01: package de.webman.documenttype.eventhandler;
02:
03: import com.teamkonzept.web.*;
04: import com.teamkonzept.webman.*;
05: import com.teamkonzept.webman.db.TKWebmanDBManager;
06: import com.teamkonzept.webman.mainint.*;
07: import com.teamkonzept.webman.mainint.db.*;
08:
09: import com.teamkonzept.webman.mainint.db.queries.*;
10: import com.teamkonzept.webman.mainint.events.*;
11: import com.teamkonzept.lib.*;
12: import com.teamkonzept.field.*;
13: import com.teamkonzept.field.db.*;
14: import com.teamkonzept.db.*;
15: import com.teamkonzept.publishing.markups.*;
16:
17: import java.util.*;
18: import java.io.*;
19:
20: /**
21: * doPREditPres
22: *
23: * Editieren der Parameter einer Presentation
24: *
25: * Reihenfolge der params im string PR_EDIT_PRES:
26: * <TK_PRESENTATION_ID>,
27: * <TK_TEMPLATE_ID>,
28: * <TK_PRESENTATION_SHORTNAME>,
29: * <TK_PRESENTATION_NAME>
30: *
31: * @author $Author: alex $
32: * @version $Revision: 1.3 $
33: */
34: public class DTEditPresHandler extends DefaultEventHandler implements
35: ParameterTypes, FrameConstants, DatabaseDefaults {
36: private DTEditPresHandler() {
37: }
38:
39: private static DTEditPresHandler instance = new DTEditPresHandler();
40:
41: public static DTEditPresHandler getInstance() {
42: return instance;
43: }
44:
45: public void handleEvent(TKEvent evt) throws TKException {
46: try {
47: WebManEvent.checkEvent(evt.getRemoteUser(), evt.getName(),
48: ContextConstants.PRESENTATIONS);
49: TKHTMLTemplate t;
50: if (evt.getName().equalsIgnoreCase("PR_EDIT_PRES"))
51: t = evt.getPrepHTMLTemplate("pr_editPres.tmpl");
52: else
53: t = evt.getPrepHTMLTemplate("pr_copyPres.tmpl");
54: String presId = evt.getParameter(PARAMETER,
55: "PRESENTATION_ID");
56: String tmplId = evt.getParameter(PARAMETER, "TEMPLATE_ID");
57: String presShortName = evt.getParameter(PARAMETER,
58: "PRESENTATION_SHORTNAME");
59: String presName = evt.getParameter(PARAMETER,
60: "PRESENTATION_NAME");
61: if (evt.getName().equalsIgnoreCase("PR_EDIT_PRES")) {
62: DTUtils.setTemplateList(t);
63: }
64: t.set("PRESENTATION_ID", presId);
65: t.set("PRESENTATION_SHORTNAME", presShortName);
66: t.set("PRESENTATION_NAME", presName);
67: t.set("UPDATE", "1");
68: t.set("THE_TEMPLATE_ID", tmplId);
69: t.set("TEMPLATE_ID", tmplId);
70: WebManEvent.fillEventsIntoTemplate(evt.getRemoteUser(), t,
71: PRESENTATIONS);
72: evt.finishTemplate(t);
73: } catch (Throwable e) {
74: // TO DO : Analyze Exception !
75: throw WebmanExceptionHandler.getException(e);
76: }
77: }
78:
79: public boolean isHandler(TKEvent evt) {
80: return evt.getName().equalsIgnoreCase("PR_EDIT_PRES")
81: || evt.getName().equalsIgnoreCase("PR_START_COPY_PRES");
82: }
83: }
|