19 package org.turro.contacts.www;
21 import java.io.IOException;
22 import javax.servlet.ServletException;
23 import org.turro.string.Strings;
24 import org.turro.action.Contacts;
25 import org.turro.action.MyContacts;
26 import org.turro.contacts.db.ContactsPU;
27 import org.turro.elephant.context.IElement;
28 import org.turro.elephant.impl.abstracts.AbstractElement;
29 import org.turro.elephant.impl.context.AttributeItem;
30 import org.turro.elephant.layout.IManageable;
31 import org.turro.elephant.layout.IRenderable;
32 import org.turro.elephant.security.IDefendable;
33 import org.turro.file.util.FileAttach;
34 import org.turro.marker.ElephantMarker;
35 import org.turro.plugin.contacts.ContactSortedSet;
36 import org.turro.plugin.contacts.IContact;
44 protected String
sclass, fullTemplate, summaryTemplate;
52 public void loadData() throws ServletException, IOException {
54 fullTemplate =
getAttributes().getAttributeValue(
"attrib:fullTemplate",
"");
55 summaryTemplate =
getAttributes().getAttributeValue(
"attrib:summaryTemplate",
"");
61 if(!Strings.isBlank(
item)) {
79 if(!Strings.isBlank(
item)) {
80 prepareValues(marker,
contact, 0);
82 marker.
process(
"contact", getFullTemplate());
83 }
else if(
set.isEmpty()) {
84 marker.
put(
"divider",
false);
85 marker.
put(
"header",
true);
86 marker.
put(
"footer",
true);
87 marker.
put(
"empty",
true);
88 marker.
process(
"contact", getSummaryTemplate());
91 marker.
put(
"empty",
false);
93 marker.
put(
"divider", index > 0);
94 marker.
put(
"header", index == 0);
95 marker.
put(
"footer", index ==
set.size() - 1);
96 prepareValues(marker, c, 0);
98 marker.
process(
"contact", getSummaryTemplate());
107 return "<div class='" +
sclass +
"dossier-web'>";
117 String link = getItemLink(c, page);
119 marker.
put(
"path", link);
120 marker.
put(
"all", getPageLink(page));
122 marker.
put(
"readall", getItemLink(c, page));
128 private String getItemLink(IContact c,
int page) {
132 private String getPageLink(
int page) {
137 private String getSummaryTemplate() {
138 return Strings.isBlank(summaryTemplate) ?
"mySummary" : summaryTemplate;
141 private String getFullTemplate() {
142 return Strings.isBlank(fullTemplate) ?
"myFull" : fullTemplate;
AttributeSupport getAttributes()
static AttributeItem getFromParameter(IConstructor constructor, String name, String defaultValue)
void process(String rootTmpl, String tmpl)
Object put(Object key, Object value)
String getParameter(String param)
void setTitle(String title)
IConstructor getConstructor()