18 package org.turro.zul.acceptance;
20 import java.util.Collection;
21 import java.util.List;
22 import org.turro.acceptance.AcceptanceMail;
23 import org.turro.acceptance.AcceptanceUtil;
24 import org.turro.auth.Authentication;
25 import org.turro.command.Command;
26 import org.turro.command.Context;
27 import org.turro.contacts.Acceptance;
28 import org.turro.contacts.Contact;
29 import org.turro.contacts.db.ContactsPU;
30 import org.turro.contacts.util.ContactCombobox;
31 import org.turro.elephant.context.Application;
32 import org.turro.i18n.I_;
33 import org.turro.jpa.Dao;
34 import org.turro.plugin.contacts.IContact;
35 import org.turro.zkoss.dialog.InputDialog;
36 import org.turro.zkoss.dialog.InputField;
37 import org.zkoss.zk.ui.HtmlBasedComponent;
38 import org.zkoss.zul.Listbox;
39 import org.zkoss.zul.Listcell;
40 import org.zkoss.zul.Listhead;
41 import org.zkoss.zul.Listheader;
42 import org.zkoss.zul.Listitem;
51 private List<Acceptance> list;
73 if(a.getContact().getId().equals(logged.
getId()) && a.getDateAcceptance() ==
null) {
94 new InputField(
"Contact", null, null, 0) {
96 protected HtmlBasedComponent createEditor() {
104 public Object execute(Context context) {
106 if(fields.length > 0) {
108 String comment =
null;
110 if(
"Contact".equals(f.getLabel())) {
111 contact = contactInput.getContact();
112 }
else if(
"Comment".equals(f.getLabel())) {
113 comment = (String) f.getValue();
116 if(contact !=
null) {
118 AcceptanceUtil.request((Contact) Authentication.getIContact().getContact(), contact, path, comment)
130 for(Listitem li : (Collection<Listitem>) getSelectedItems()) {
142 public void delete() {
144 for(Listitem li : (Collection<Listitem>) getSelectedItems()) {
152 private void refreshItems() {
156 Listitem li =
new Listitem();
157 li.appendChild(
new Listcell(a.getPetitioner().getName()));
158 li.appendChild(
new Listcell(a.getContact().getName()));
159 li.appendChild(
new Listcell(
null,
160 a.getDateAcceptance() ==
null ?
161 "/_zul/images/cancel.png" :
162 "/_zul/images/ok.png"));
163 li.appendChild(
new Listcell(a.getAcceptanceComment()));
169 private void addHeaders() {
170 Listhead head =
new Listhead();
171 head.setSizable(
true);
173 head.appendChild(
new Listheader(I_.get(
"Petitioner")));
174 head.appendChild(
new Listheader(I_.get(
"Contact")));
175 head.appendChild(
new Listheader(
null,
null,
"40px"));
176 head.appendChild(
new Listheader(I_.get(
"Comment")));
static Acceptance accept(Acceptance a)
static List< Acceptance > getAcceptances(String path)
static boolean isAdministrator()
static IContact getIContact()
boolean isInRole(String role)
static Application getApplication()
static String get(String msg)
void deleteObject(Object obj)
void setPath(String path)