01: package de.webman.form.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.events.*;
09: import com.teamkonzept.lib.*;
10: import com.teamkonzept.db.*;
11: import de.webman.form.Form;
12: import de.webman.form.FormDependencies;
13:
14: /**
15: * Displays the form dependencies.
16: *
17: * @author $Author: uli $
18: * @version $Revision: 1.7 $
19: */
20: public class CTInfoHandler extends DefaultEventHandler implements
21: ParameterTypes, FrameConstants, DatabaseDefaults {
22:
23: /**
24: * The singleton instance.
25: */
26: private static final CTInfoHandler INSTANCE = new CTInfoHandler();
27:
28: /**
29: * Avoids outside intstantiation.
30: */
31: private CTInfoHandler() {
32: // NOP
33: }
34:
35: /**
36: * Returns the singleton instance.
37: *
38: * @return the singleton instance.
39: */
40: public static CTInfoHandler getInstance() {
41: return INSTANCE;
42: }
43:
44: /**
45: * Handles the specified event.
46: *
47: * @param event the event to be handled.
48: * @throws TKException if any error occurred during event handling.
49: */
50: public void handleEvent(TKEvent event) throws TKException {
51: try {
52: // Check event.
53: WebManEvent.checkEvent(event.getRemoteUser(), event
54: .getName(), ContextConstants.CONTENT_TREE);
55:
56: // Get form.
57: Form form = new Form(Integer.valueOf(event.getParameter(
58: PARAMETER, "FORM_ID")));
59:
60: // Prepare template.
61: TKHTMLTemplate template = event
62: .getPrepHTMLTemplate("ct_dependency.tmpl");
63: template.set("FORM_DESCRIPTION", form.getDescription());
64: template.setListIterator(new TKStandardPluginIterator(
65: "REFERENCES", null, FormDependencies
66: .getDependencies(form), false, template
67: .getListIterator()));
68:
69: // Propagate ACLs.
70: WebManEvent.fillEventsIntoTemplate(event.getRemoteUser(),
71: template, CONTENT_TREE);
72: WebManEvent.fillEventsIntoTemplate(event.getRemoteUser(),
73: template, CONTENT_EDIT);
74: WebManEvent.fillEventsIntoTemplate(event.getRemoteUser(),
75: template, PRESENTATIONS);
76: WebManEvent.fillEventsIntoTemplate(event.getRemoteUser(),
77: template, SITE_TREE);
78:
79: // Finish event.
80: event.finishTemplate(template);
81: } catch (Throwable e) {
82: // TO DO : Analyze Exception !
83: throw WebmanExceptionHandler.getException(e);
84: }
85: }
86:
87: /**
88: * Checks wether this handler is capable to handle the specified event.
89: *
90: * @param event the event to be handled.
91: * @return <CODE>true</CODE> if this handler is capable to handle the
92: * specified event, otherwise <CODE>false</CODE>.
93: */
94: public boolean isHandler(TKEvent event) {
95: return event.getName().equalsIgnoreCase("CT_INFO");
96: }
97:
98: }
|