01: package de.webman.content.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: import com.teamkonzept.webman.mainint.db.queries.*;
09: import com.teamkonzept.webman.mainint.events.*;
10: import com.teamkonzept.lib.*;
11: import com.teamkonzept.field.*;
12: import com.teamkonzept.field.db.*;
13: import com.teamkonzept.db.*;
14: import com.teamkonzept.publishing.markups.*;
15:
16: import java.sql.*;
17: import java.io.*;
18:
19: /**
20: * Speichern eines editierten node (Name)
21: *
22: *
23: * @author $Author: alex $
24: * @version $Revision: 1.7 $
25: */
26: public class CEUpdateNodeHandler extends DefaultEventHandler implements
27: ParameterTypes, FrameConstants, DatabaseDefaults {
28: private CEUpdateNodeHandler() {
29: }
30:
31: private static CEUpdateNodeHandler instance = new CEUpdateNodeHandler();
32:
33: public static CEUpdateNodeHandler getInstance() {
34: return instance;
35: }
36:
37: public void handleEvent(TKEvent evt) throws TKException {
38: try {
39: CEUtils.checkEvent(evt);
40: ContentContext ceContext = new ContentContext(evt
41: .getParams());
42: String openNode = ceContext.getParam("OPEN_NODE");
43: if (openNode == null)
44: openNode = "-1";
45:
46: if (!CEUtils.isValidPathname(ceContext.conNodeShortName))
47: return;
48:
49: TKQuery q = TKDBManager
50: .newQuery(TKDBContentTreeUpdateNode.class);
51: q.setQueryParams("CONTENT_NODE_ID", ceContext.conNodeId);
52: q
53: .setQueryParams("CONTENT_NODE_NAME",
54: ceContext.conNodeName);
55: q.setQueryParams("CONTENT_NODE_SHORTNAME",
56: ceContext.conNodeShortName);
57: q
58: .setQueryParams("CONTENT_NODE_TYPE",
59: ceContext.conNodeType);
60: q.setQueryParams("TREE_ID", new Integer(0));
61: q.setQueryParams("PROTOTYPE_ID", TKNull.NULL);
62: q.setQueryParams("CONTENT_FORM", ceContext.formId);
63:
64: if (ceContext.conNodeType.intValue() == DIRECTORY_NODE_INTEGER
65: .intValue()) {
66: q.setQueryParams("CONTENT_FORM", TKNull.NULL);
67: } else {
68: q.setQueryParams("CONTENT_FORM", ceContext.formId);
69: }
70: q.execute();
71: if (ceContext.conNodeType.equals(DIRECTORY_NODE_INTEGER)
72: || ceContext.conNodeType.equals(GROUP_INTEGER)) {
73: // DirectoryNode
74: TKHTMLTemplate frame = evt
75: .getPrepHTMLTemplate("f_ce.tmpl");
76: HTMLUtils.fillFrameSet(frame, LEFT_FRAME_WIDTH,
77: "CE_SHOWLIST", "CE_EMPTY");
78: // behalte Sortier-Parameter
79: CEUtils.keepSortParameter(evt, frame);
80:
81: TreeUtils.keepOpenNodes(evt, frame);
82: evt.finishTemplate(frame);
83: } else {
84: evt.getParams().put(PARAMETER, "RECALCULATE", "a");
85: CEBrowseHandler.getInstance().handleEvent(evt);
86: }
87: } catch (Throwable e) {
88: // TO DO : Analyze Exception !
89: throw WebmanExceptionHandler.getException(e);
90: }
91: }
92:
93: public boolean isHandler(TKEvent evt) {
94: return evt.getName().equalsIgnoreCase("CE_UPDATE_NODE");
95: }
96: }
|