19 package org.turro.timetracker;
22 import org.amic.util.date.CheckDate;
23 import org.turro.string.Strings;
24 import org.turro.action.Plugins;
25 import org.turro.annotation.ElephantPlugin;
26 import org.turro.auth.Authentication;
27 import org.turro.collections.KeyValueMap;
28 import org.turro.elephant.context.IConstructor;
29 import org.turro.elephant.direct.AbstractDirectContentCtrl;
30 import org.turro.elephant.direct.DirectContent;
31 import org.turro.elephant.entities.db.TimeTrackerType;
32 import org.turro.entities.Entities;
33 import org.turro.marker.ElephantMarker;
34 import org.turro.plugin.contacts.IContact;
44 private final static String TTCONTEXT =
"time-tracker-entity-path";
53 throw new UnsupportedOperationException(
"Not supported yet.");
59 marker.
put(
"entityPath", entityPath);
61 marker.
put(
"queue", getQueue(entityPath,
false));
62 marker.
put(
"valids", getQueue(entityPath,
false).getNextValids());
63 CheckDate dateTrack =
new CheckDate();
64 marker.
put(
"year", dateTrack.getYear());
65 marker.
put(
"month", dateTrack.getMonth());
66 marker.
put(
"day", dateTrack.getDay());
67 marker.
put(
"hour", dateTrack.getHour());
68 marker.
put(
"minute", dateTrack.getMinute());
81 String type = map.get(
"type");
82 if(
"track".equals(type)) {
83 if(map.containsKey(
"trackdelete")) {
85 }
else if(map.containsKey(
"tracktype")) {
86 CheckDate dateTrack =
new CheckDate(
87 map.get(Integer.class,
"year"),
88 map.get(Integer.class,
"month"),
89 map.get(Integer.class,
"day"),
90 map.get(Integer.class,
"hour"),
91 map.get(Integer.class,
"minute"),
93 if(getQueue(entityPath,
true).correctDate(dateTrack)) {
94 getQueue(entityPath,
false).addTrack(
TimeTrackerType.valueOf(map.get(
"tracktype")), dateTrack.getDate());
100 }
else if(
"entity".equals(type)) {
110 if(!Strings.isBlank(entityPath) && (getQueue(entityPath,
true) !=
null)) {
111 super.render(constructor);
114 marker.
put(
"actions",
this);
119 Map<String, Object> args =
Plugins.
execute(
"CurrentCompany",
null);
120 marker.
put(
"stores", args.get(
"departmentStores"));
122 if(!Strings.isBlank(entityPath)) {
123 marker.
put(
"openTracks", getQueue(entityPath,
false).getActiveTracks());
125 marker.
process(
"timetracker",
"selectEntity");
130 return createRightNowURL(
"type=track;tracktype=" + type.toString());
138 if(reset || (ttq ==
null && !Strings.isBlank(entityPath))) {
static Map< String, Object > execute(String name, Map params)
static IContact getIContact()
static IElephantEntity getController(String path)
void process(String rootTmpl, String tmpl)
IConstructor getConstructor()
Object put(Object key, Object value)
void doExecute(IConstructor constructor, KeyValueMap map)
String getActionLink(IConstructor constructor, TimeTrackerType type)
void render(IConstructor constructor)
void prepareCleanMarker(ElephantMarker em, KeyValueMap kvm)
void prepareMarker(ElephantMarker marker)
static TimeTrackerQueue load(String entityPath, String trackedPath)
void setSessionAttribute(String key, Object value)
void removeSessionAttribute(String key)
Object getSessionAttribute(String key)