19 package org.turro.zul.commentit;
21 import org.turro.command.CommandUtil;
22 import org.turro.commentit.CommentItUtil;
23 import org.turro.contacts.CommentIt;
24 import org.turro.contacts.db.ContactsPU;
25 import org.turro.elephant.context.Application;
26 import org.turro.elephant.util.Messages;
27 import org.turro.html.HTMLEntities;
28 import org.turro.i18n.I_;
29 import org.turro.zkoss.grid.PagingGrid;
30 import org.turro.zkoss.label.LabelExtended;
31 import org.zkoss.zk.ui.event.Event;
32 import org.zkoss.zk.ui.event.EventListener;
33 import org.zkoss.zk.ui.event.Events;
34 import org.zkoss.zk.ui.ext.AfterCompose;
35 import org.zkoss.zul.Button;
36 import org.zkoss.zul.Column;
37 import org.zkoss.zul.Columns;
38 import org.zkoss.zul.Hlayout;
39 import org.zkoss.zul.Label;
40 import org.zkoss.zul.Row;
41 import org.zkoss.zul.Rows;
61 private void addColumns() {
62 Columns cols =
new Columns();
63 cols.setSizable(
true);
64 cols.setMenupopup(
"auto");
67 Column col =
new Column(
I_.
get(
"Date"),
null,
"200px");
68 cols.appendChild(col);
70 col =
new Column(
I_.
get(
"Author"),
null,
"250px");
71 cols.appendChild(col);
73 col =
new Column(
I_.
get(
"Comment"));
74 cols.appendChild(col);
76 col =
new Column(
I_.
get(
"Entity"));
77 cols.appendChild(col);
79 col =
new Column(
"",
null,
"250px");
80 cols.appendChild(col);
83 private void addRows() {
88 rows.getChildren().clear();
91 for(
final CommentIt ci : CommentItUtil.pending()) {
92 final Row row =
new Row();
94 rows.appendChild(row);
96 LabelExtended lext =
new LabelExtended();
97 lext.setDate(ci.getDateCreation());
98 lext.setSclass(
"ldate");
99 row.appendChild(lext);
101 Label author =
new Label(
102 ci.getName() +
" (" +
105 " " + ci.getWeb() +
" " +
107 author.setSclass(
"lauthor");
108 row.appendChild(author);
110 Label body =
new Label(HTMLEntities.unescape(ci.getBody()));
111 body.setSclass(
"lbody");
112 row.appendChild(body);
114 row.appendChild(CommandUtil.getLinkOrSpace(ci.getPath()));
116 if(app.
isInRole(
"publication:accept")) {
117 Hlayout hbox =
new Hlayout();
118 Button confirm =
new Button(I_.get(
"Accept"));
119 confirm.addEventListener(Events.ON_CLICK,
new EventListener() {
121 public void onEvent(Event event)
throws Exception {
122 Messages.confirmAcceptation().show(() -> {
123 CommentItUtil.acceptComment(ci);
128 hbox.appendChild(confirm);
129 Button
delete =
new Button(I_.get(
"Delete"));
130 delete.addEventListener(Events.ON_CLICK,
new EventListener() {
132 public void onEvent(Event event)
throws Exception {
133 Messages.confirmDeletion().show(() -> {
134 new ContactsPU().deleteObject(ci);
139 hbox.appendChild(
delete);
140 row.appendChild(hbox);
boolean isInRole(String role)
static Application getApplication()
static String get(String msg)