19 package org.turro.mail.zul;
21 import java.util.Collection;
22 import java.util.HashMap;
23 import java.util.logging.Level;
24 import java.util.logging.Logger;
25 import org.apache.commons.mail.EmailException;
26 import org.turro.action.Contacts;
27 import org.turro.action.MailSenders;
28 import org.turro.auth.Authentication;
29 import org.turro.command.Command;
30 import org.turro.command.Context;
31 import org.turro.elephant.context.ElephantContext;
32 import org.turro.entities.Entities;
33 import org.turro.entities.EntityCombobox;
34 import org.turro.i18n.I_;
35 import org.turro.plugin.contacts.ContactList;
36 import org.turro.plugin.contacts.IContact;
37 import org.turro.sendable.MailRecipients;
38 import org.turro.zkoss.text.WikiEditor;
39 import org.zkoss.zk.ui.Executions;
40 import org.zkoss.zk.ui.IdSpace;
41 import org.zkoss.zk.ui.ext.AfterCompose;
42 import org.zkoss.zk.ui.select.Selectors;
43 import org.zkoss.zk.ui.select.annotation.Listen;
44 import org.zkoss.zk.ui.select.annotation.Wire;
45 import org.zkoss.zk.ui.util.Clients;
46 import org.zkoss.zul.Panel;
47 import org.zkoss.zul.Textbox;
53 public class MailToControl extends Panel implements IdSpace, AfterCompose {
56 private Textbox subject;
70 @Listen(
"onClick = #send")
79 .put(
"subject", subject.getValue())
80 .put(
"text", wikiText.
getHtml())
81 .sendTemplate(
"mailTo", subject.getValue());
82 Clients.showNotification(
I_.
get(
"Comment was sent..."));
83 }
catch (EmailException ex) {
88 @Listen(
"onClick = #sendTest")
94 public Object execute(Context context) {
100 HashMap args =
new HashMap();
106 .put(
"subject", subject.getValue())
107 .put(
"text", wikiText.
getHtml())
108 .sendTemplate(
"mailTo", subject.getValue());
109 Clients.showNotification(
I_.
get(
"Comment was sent..."));
110 }
catch (EmailException ex) {
120 Executions.createComponents(
"/WEB-INF/_zul/bs/comps/mailTo/mailToControl.zul",
this,
null);
121 Selectors.wireComponents(
this,
this,
false);
122 Selectors.wireEventListeners(
this,
this);
130 private void initComponents() {
137 private void updateButtons() {
static IMailSender getPool()
static IContact getIContact()
static String logMsg(String msg)
static IElephantEntity getController(String path)
void setEntity(Object entity)
void setRoot(String root)
static String get(String msg)
AssistantSet getAssistants()
static void selectRecipients(Collection< IContact > recipients, Command command)
Collection< IContact > getRecipients()
IMailSender setFrom(IContact contact)
IMailSender setRoot(String root)