19 package org.turro.newsletter;
21 import java.io.IOException;
22 import java.util.Date;
23 import java.util.logging.Level;
24 import java.util.logging.Logger;
25 import org.turro.action.Contacts;
26 import org.turro.action.queue.Notifications;
27 import org.turro.auth.Authentication;
28 import org.turro.elephant.context.Application;
29 import org.turro.elephant.context.ElephantContext;
30 import org.turro.elephant.util.Messages;
31 import org.turro.entities.ActionWithEntity;
32 import org.turro.i18n.I_;
33 import org.turro.jpa.composer.EntityComposer;
34 import org.turro.jpa.entity.DaoEntity;
35 import org.turro.mail.message.MailInline;
36 import org.turro.mail.message.MailMessageTemplate;
37 import org.turro.mail.queue.GenericElephantNotification;
38 import org.turro.newsletter.mail.NewsletterSendToSubscribers;
39 import org.turro.plugin.contacts.IContact;
40 import org.turro.publication.db.PublicationPU;
41 import org.turro.publication.entity.Newsletter;
42 import org.turro.publication.zul.menu.PublicationMenu;
43 import org.turro.queue.zul.AllCategoriesListbox;
44 import org.turro.zkoss.dialog.SelectionDialog;
45 import org.turro.zkoss.input.DateboxShort;
46 import org.turro.zkoss.locale.LangListbox;
47 import org.turro.zul.frame.Framework;
48 import org.zkoss.zk.ui.Component;
49 import org.zkoss.zk.ui.event.InputEvent;
50 import org.zkoss.zk.ui.select.annotation.Listen;
51 import org.zkoss.zk.ui.select.annotation.Wire;
52 import org.zkoss.zk.ui.util.Clients;
53 import org.zkoss.zul.Checkbox;
54 import org.zkoss.zul.Div;
55 import org.zkoss.zul.Html;
56 import org.zkoss.zul.Textbox;
64 private boolean modified;
69 @Wire(
"#newsCategory")
75 @Wire(
"#newsTemplate")
79 private Checkbox accepted;
82 private Textbox newsTitle;
84 @Wire(
"#staticContent")
85 private Checkbox staticContent;
87 @Wire(
"#sendingChoice")
96 @Listen(
"onClick = #preview")
99 if(contact !=
null && contact.
isWebUser()) {
103 div.setStyle(
"overflow:auto;");
105 div.appendChild(html);
107 entity.resetGlobalContext();
108 }
catch (IOException ex) {
114 @Listen(
"onClick = #sendNow")
118 Clients.showNotification(
I_.
get(
"Queued sender started"));
122 @Listen(
"onChange = #pubTitle")
124 entity.setTitle(event.getValue());
137 entity.setCreation(
new Date());
158 newsDate.setValue(
entity.getDate());
162 newsTitle.setValue(
entity.getUnescapedTitle());
163 accepted.setChecked(
entity.isAccepted());
164 staticContent.setChecked(
entity.isStaticContent());
165 sendingChoice.setObjectValue(
entity.getSendingChoice());
167 accepted.setDisabled(
true);
170 actionWithEntity.
setRoot(
"contact");
177 entity.setAccepted(
false);
179 return super.beforeSave();
184 return !
entity.isEmpty() && super.shouldBeSaved();
static NotificationCategory getCategory(String id)
static IContact getIContact()
boolean isInRole(String role)
static Application getApplication()
static String logMsg(String msg)
static Messages confirmDeletion()
void setEntity(Object entity)
void setRoot(String entityRoot)
static String get(String msg)
static final String GENERIC_NOTIFICATION
DaoEntity getWrapperInstance(Component comp)
Newsletter getEntityInstance(Long id)
void onTitle(InputEvent event)
String getAttributeName()
void setNewsletter(Newsletter newsletter)
void setCategory(NotificationCategory category)
static void showComponent(Page page, String title, Component component, String width, String height, final Command command)
static Framework getCurrent()
void setSelectedLabel(String text)
void setSelectedTooltiptext(String text)