19 package org.turro.participation;
21 import java.util.Collections;
22 import java.util.List;
23 import org.turro.string.Strings;
24 import org.turro.action.MailSenders;
25 import org.turro.annotation.ElephantPlugin;
26 import org.turro.assistant.ParticipationInfo;
27 import org.turro.auth.Authentication;
28 import org.turro.collections.KeyValueMap;
29 import org.turro.elephant.context.IConstructor;
30 import org.turro.elephant.direct.AbstractDirectEntityCtrl;
31 import org.turro.elephant.direct.DirectContent;
32 import org.turro.entities.IElephantEntity;
33 import org.turro.marker.ElephantMarker;
34 import org.turro.plugin.contacts.ContactList;
35 import org.turro.plugin.contacts.IContact;
41 @ElephantPlugin(label=
"participation-ctrl")
42 @DirectContent(identifier=
"participation-action")
48 super(
"widgets/participation",
"participation");
55 setTemplate(reason.toString().replaceAll(
"_",
"-").toLowerCase());
62 list.
add(ep.getContact());
82 marker.
put(
"checkLink", getAjaxUrl((String) marker.
get(
"domid"), map));
88 addContainerId(marker,
true);
91 String participatorPath =
"/contact/" + contact.
getId();
93 KeyValueMap kvm =
new KeyValueMap(Collections.EMPTY_MAP);
94 kvm.put(
"type",
"click");
95 kvm.put(
"entityPath", entityPath);
96 kvm.put(
"participatorPath", participatorPath);
97 kvm.put(
"reason", reason.toString());
98 marker.
put(
"checkLink", getAjaxUrl((String) marker.
get(
"containerId"), kvm));
111 String type = map.get(
"type");
112 if(
"click".equals(type)) {
113 processClick(constructor, map);
117 private void processClick(
IConstructor constructor, KeyValueMap map) {
122 boolean selected = info.
toggle();
126 String subject = participator.
getName() +
" " + info.
getReasonStr() +
" " + entity.getName();
127 String description = entity.getDescription();
128 if(Strings.isBlank(description)) description =
"";
131 .send(subject, subject +
"\n\n" + description);
135 String subject = participator.getName() +
" NOT " + info.
getReasonStr() +
" " + entity.getName();
136 String description = entity.getDescription();
137 if(Strings.isBlank(description)) description =
"";
138 MailSenders.getPool()
140 .send(subject, subject +
"\n\n" + description);
143 writeMarkerToResponse(constructor, map);
static IMailSender getPool()
IElephantEntity getEntity()
List< IEntityParticipation > getParticipations()
IElephantEntity getParticipator()
List< IEntityParticipation > getCrossParticipations()
static IContact getIContact()
Object put(Object key, Object value)
List< IEntityParticipation > getParticipations()
void prepareMarker(ElephantMarker marker)
void setReason(ParticipationReason reason)
List< IEntityParticipation > getCrossParticipations()
ContactList getParticipators()
void doExecute(IConstructor constructor, KeyValueMap map)
void prepareCleanMarker(ElephantMarker marker, KeyValueMap map)
boolean isMailableOnDeselect()
boolean isMailableOnSelect()