19 package org.turro.publication.zul.www;
21 import java.util.Date;
22 import org.turro.string.ObjectString;
23 import org.turro.auth.Authentication;
24 import org.turro.elephant.TemplateControl;
25 import org.turro.elephant.context.Application;
26 import org.turro.jpa.Dao;
27 import org.turro.plugin.contacts.IContact;
28 import org.turro.publication.db.PublicationPU;
29 import org.turro.publication.entity.Publication;
30 import org.turro.publication.util.PublicationWrapper;
31 import org.turro.publication.zul.ctrl.BloggerCategoriesListbox;
32 import org.turro.publication.zul.ctrl.BloggerGroupsListbox;
33 import org.turro.zkoss.input.DateboxShort;
34 import org.turro.zkoss.text.WikiEditor;
35 import org.zkoss.zk.ui.select.annotation.Listen;
36 import org.zkoss.zk.ui.select.annotation.Wire;
37 import org.zkoss.zul.Textbox;
50 @Wire(
"#title")
private Textbox title;
51 @Wire(
"#author")
private Textbox author;
56 @Listen(
"onSelect=#category")
61 @Listen(
"onSelect=#group")
66 @Listen(
"onChange=#title")
68 publication.
setTitle(title.getValue());
71 @Listen(
"onChange=#author")
76 @Listen(
"onChange=#date")
81 @Listen(
"onChange=#summary")
86 @Listen(
"onChange=#body")
91 @Listen(
"onClick=#save")
95 publication = dw.
save();
100 @Listen(
"onClick=#cancel")
114 this.publication = publication;
124 private void checkPublication() {
125 if(publication ==
null) {
128 publication = getDao().find(
Publication.class, pubId);
131 IContact contact = Authentication.getIContact();
132 if(publication ==
null) {
133 publication =
new Publication();
135 publication.
setAuthor(contact.getName());
140 date.setValue(publication.
getDate());
141 author.setValue(publication.
getAuthor());
145 private void initComponents() {
146 if(publication.
getId() !=
null && publication.
getId() > 0) {
147 IContact contact = Authentication.getIContact();
148 if(Application.getApplication().isInRole(
"publication:all") ||
152 date.setValue(publication.
getDate());
153 author.setValue(publication.
getAuthor());
161 Application.getApplication().sendRedirect(
"/user");
177 private Dao getDao() {
179 _dao =
new PublicationPU();
IConstructor getConstructor()
abstract void sendRedirect(String uri)
static Application getApplication()
boolean isBlogger(IContact contact)
void setPublicationGroup(PublicationGroup publicationGroup)
void setTitle(String title)
void setWikiBody(String wikiBody)
void setWikiSummary(String wikiSummary)
String getUnescapedTitle()
void setIdContact(String idContact)
void setAuthor(String author)
PublicationCategory getPublicationCategory()
void setCreation(Date creation)
void setPublicationCategory(PublicationCategory publicationCategory)
void setPublication(Publication publication)
void setPath(String path)
void setImageFolder(String folder)
void setValue(String value)
void setFileFolder(String folder)
void setReadOnlyRepository(boolean readOnlyRepository)
String getParameter(String param)