19 package org.turro.www.starit;
21 import org.turro.elephant.context.ElephantContext;
22 import org.turro.elephant.context.IConstructor;
23 import org.turro.html.HTMLHelper;
24 import org.turro.i18n.I_;
25 import org.turro.marker.ElephantMarker;
26 import org.turro.starit.StarItUtil;
27 import org.turro.starit.StarsInfo;
28 import org.turro.util.IdGenerator;
37 private String entityPath;
39 private boolean readOnly;
40 private int maxRating = 5;
43 this.constructor = constructor;
47 this.entityPath = entityPath;
51 this.readOnly = readOnly;
55 String
id = container ?
"sic_" + IdGenerator.generate() : constructor.
getParameter(
"domid");
57 em.
put(
"control",
this);
58 em.
put(
"controlId",
id);
59 em.
put(
"container", container);
61 em.
put(
"entityPath", entityPath);
62 em.
put(
"readOnly", readOnly);
63 em.
process(
"widgets/webcomp",
"starIt");
73 String
id = container ?
"sic_" + IdGenerator.generate() : constructor.
getParameter(
"domid");
75 html.
startTag(
"div",
"id='" +
id +
"'");
78 for(
int star = 1; star <= 5; star++) {
82 "/_internal/system/images/star_" + (star <= si.
getStars() ?
"color" :
"bn") +
".png'")
93 "{ action: \"star-it\", path: \"" + entityPath +
"\"" +
94 ", stars: " + i +
", domid: \"" +
id +
"\" })" +
95 ".done(function(data) { $(\"#" +
id +
"\").html(data); });";
static String getRootWebPath()
HTMLGenerator endAllTags()
HTMLGenerator write(String value)
HTMLGenerator doTag(String tag)
HTMLGenerator endTableRow()
HTMLGenerator startTag(String tag)
HTMLGenerator startTableCol(String attributes)
HTMLGenerator startTable(String attributes)
static String get(String msg)
void process(String rootTmpl, String tmpl)
static boolean existsTemplate(IConstructor constructor, boolean mail, String root, String name)
Object put(Object key, Object value)
static StarsInfo stars(Object entity)
void setEntityPath(String entityPath)
void renderStars(boolean container)
void renderTemplateStars(boolean container)
void setReadOnly(boolean readOnly)
StarItCtrl(IConstructor constructor)
String getStarsUrl(String id, Integer i)
String getParameter(String param)