18 package org.turro.publication.zul.ctrl;
20 import java.util.Collection;
21 import java.util.Date;
22 import java.util.List;
23 import org.turro.string.Strings;
24 import org.turro.assistant.Assistant;
25 import org.turro.assistant.AssistantConstants;
26 import org.turro.assistant.AssistantSet;
27 import org.turro.assistant.Assistants;
28 import org.turro.contacts.Connector;
29 import org.turro.contacts.Contact;
30 import org.turro.contacts.zul.label.ContactInfo;
31 import org.turro.elephant.security.IUser;
32 import org.turro.elephant.util.DateFormats;
33 import org.turro.i18n.I_;
34 import org.turro.jpa.Dao;
35 import org.turro.jpa.grid.RendererOnDemand;
36 import org.turro.log.SystemLogType;
37 import org.turro.log.SystemLogger;
38 import org.turro.publication.db.PublicationPU;
39 import org.turro.publication.entity.PublicationCategory;
40 import org.turro.publication.entity.PublicationSubscription;
41 import org.turro.zkoss.grid.PagingGrid;
42 import org.turro.zul.frame.Framework;
43 import org.zkoss.zk.ui.event.Event;
44 import org.zkoss.zk.ui.event.EventListener;
45 import org.zkoss.zk.ui.event.Events;
46 import org.zkoss.zul.*;
58 this.publicationCategory = publicationCategory;
69 if(email !=
null && !Strings.isBlank(email.
getValue())) {
71 "select ps from PublicationSubscription ps " +
72 "where ps.idContact = ? " +
73 "and ps.publicationCategory = ?",
74 new Object[] { contact.getId(), publicationCategory }
82 "subscribed", contact.
getName());
90 if(contacts !=
null && publicationCategory !=
null) {
92 for(
Contact contact : contacts) {
94 if(email !=
null && !Strings.isBlank(email.
getValue())) {
96 "select ps from PublicationSubscription ps " +
97 "where ps.idContact = ? " +
98 "and ps.publicationCategory = ?",
99 new Object[] { contact.getId(), publicationCategory }
107 "subscribed", contact.
getName());
117 if(Strings.isBlank(entityPath))
return;
124 if(email !=
null && !Strings.isBlank(email.
getValue())) {
126 "select ps from PublicationSubscription ps " +
127 "where ps.idContact = ? " +
128 "and ps.publicationCategory = ?",
129 new Object[] { contact.getId(), publicationCategory }
137 "subscribed", contact.
getName());
144 private void addRows() {
145 getRows(
true).getChildren().clear();
147 if(publicationCategory ==
null)
return;
155 Toolbarbutton delSubscription =
new Toolbarbutton();
156 delSubscription.setImage(
"/_zul/images/edit-delete.png");
157 delSubscription.addEventListener(Events.ON_CLICK,
new EventListener() {
159 public void onEvent(Event event)
throws Exception {
160 getDao().deleteObject(ps);
166 row.appendChild(delSubscription);
172 setModel(
new ListModelList(list));
177 private void addColumns() {
179 cols.getChildren().clear();
181 cols.appendChild(
new Column(I_.get(
"Contact")));
182 cols.appendChild(
new Column(I_.get(
"Creation"),
null,
"200px"));
183 cols.appendChild(
new Column(
null,
null,
"50px"));
static void addAssistants(String role, AssistantSet list, Object data)
Object getSingleResultOrNull(SqlClause sc)
static ISystemLogger getInstance()
Collection< Long > getSubscriptorsId()
void setPublicationCategory(PublicationCategory publicationCategory)
void setCreation(Date creation)
void setIdContact(String idContact)
void addAttendeesByEntity(String entityPath, boolean deep)
void setPublicationCategory(PublicationCategory publicationCategory)
void addContact(Contact contact)
Columns getColumns(boolean create)
Rows getRows(boolean create)
void setRowCount(int rows)
static FrameClipboard getClipboard()
static final String CONNECTOR_EMAIL
void doLog(SystemLogType type, Object entity, String comment, Serializable data)