19 package org.turro.publication.zul.ctrl;
21 import java.util.Collection;
22 import java.util.List;
23 import org.turro.string.Strings;
24 import org.turro.contacts.Connector;
25 import org.turro.contacts.Contact;
26 import org.turro.contacts.zul.label.ContactInfo;
27 import org.turro.elephant.security.IUser;
28 import org.turro.i18n.I_;
29 import org.turro.jpa.Dao;
30 import org.turro.jpa.grid.RendererOnDemand;
31 import org.turro.log.SystemLogType;
32 import org.turro.log.SystemLogger;
33 import org.turro.publication.db.PublicationPU;
34 import org.turro.publication.entity.PublicationBlogger;
35 import org.turro.publication.entity.PublicationCategory;
36 import org.turro.zkoss.grid.PagingGrid;
37 import org.turro.zul.frame.Framework;
38 import org.zkoss.zk.ui.event.Event;
39 import org.zkoss.zk.ui.event.EventListener;
40 import org.zkoss.zk.ui.event.Events;
41 import org.zkoss.zul.Checkbox;
42 import org.zkoss.zul.Column;
43 import org.zkoss.zul.Columns;
44 import org.zkoss.zul.ListModelList;
45 import org.zkoss.zul.Row;
46 import org.zkoss.zul.Toolbarbutton;
57 this.publicationCategory = publicationCategory;
68 "select ps from PublicationBlogger ps " +
69 "where ps.idContact = ? " +
70 "and ps.publicationCategory = ?",
71 new Object[] { contact.getId(), publicationCategory }
85 if(contacts !=
null && publicationCategory !=
null) {
87 for(
Contact contact : contacts) {
89 if(email !=
null && !Strings.isBlank(email.
getValue())) {
91 "select ps from PublicationBlogger ps " +
92 "where ps.idContact = ? " +
93 "and ps.publicationCategory = ?",
94 new Object[] { contact.getId(), publicationCategory }
110 private void addRows() {
111 getRows(
true).getChildren().clear();
113 if(publicationCategory ==
null)
return;
120 final Checkbox administrator =
new Checkbox();
122 administrator.addEventListener(Events.ON_CLICK,
new EventListener() {
124 public void onEvent(Event event)
throws Exception {
126 getDao().saveObject(ps);
129 row.appendChild(administrator);
131 Toolbarbutton delSubscription =
new Toolbarbutton();
132 delSubscription.setImage(
"/_zul/images/edit-delete.png");
133 delSubscription.addEventListener(Events.ON_CLICK,
new EventListener() {
135 public void onEvent(Event event)
throws Exception {
136 getDao().deleteObject(ps);
138 SystemLogger.getInstance().doLog(SystemLogType.LOG_INFO, publicationCategory,
142 row.appendChild(delSubscription);
148 setModel(
new ListModelList(list));
153 private void addColumns() {
155 cols.getChildren().clear();
157 cols.appendChild(
new Column(I_.get(
"Contact")));
158 cols.appendChild(
new Column(I_.get(
"Administrator"),
null,
"120px"));
159 cols.appendChild(
new Column(
null,
null,
"50px"));
Object getSingleResultOrNull(SqlClause sc)
static ISystemLogger getInstance()
boolean isAdministrator()
void setPublicationCategory(PublicationCategory publicationCategory)
void setAdministrator(boolean administrator)
void setIdContact(String idContact)
Collection< Long > getBloggersId()
void addContact(Contact contact)
void setPublicationCategory(PublicationCategory publicationCategory)
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)