01: package de.webman.content.eventhandler;
02:
03: import com.teamkonzept.web.*;
04: import com.teamkonzept.webman.*;
05: import com.teamkonzept.webman.mainint.*;
06: import com.teamkonzept.webman.mainint.db.queries.*;
07: import com.teamkonzept.webman.mainint.events.*;
08: import com.teamkonzept.lib.*;
09: import com.teamkonzept.field.*;
10: import com.teamkonzept.field.db.*;
11: import com.teamkonzept.db.*;
12: import de.webman.content.workflow.*;
13: import de.webman.acl.Policy;
14:
15: /**
16: * liefert neue Formularseite mit Defaultwerten zurueck
17: *
18: *
19: * @param
20: * @author $Author: sebastian $
21: * @version $Revision: 1.10 $
22: */
23: public class CEDefaultHandler extends DefaultEventHandler implements
24: ParameterTypes, FrameConstants {
25: private CEDefaultHandler() {
26: }
27:
28: private static CEDefaultHandler instance = new CEDefaultHandler();
29:
30: public static CEDefaultHandler getInstance() {
31: return instance;
32: }
33:
34: public void handleEvent(TKEvent evt) throws TKException {
35: try {
36: TKHTMLTemplate t = evt
37: .getPrepHTMLTemplate("ce_fields.tmpl");
38:
39: ContentContext ceContext = CEUtils.keepCEContext(evt, t);
40:
41: // statische Daten der Versionsverwaltuung abrufen
42: VersionStatics statics = VersionStatics.setup();
43:
44: // Versionsinfos erzeugen
45: CEUtils.getVersionInfo(ceContext, t, statics);
46:
47: TKFormDBData data = new TKFormDBData(ceContext.formId
48: .intValue());
49: TKFormDBInterface.Get(data); // Formdata holen
50: TKBaseField field = TKFieldRegistry.getFieldFromDB(data);
51: field.fillIntoTemplate(t, field.getDefault(), ""); // Contentdata holen
52: WebManEvent.fillEventsIntoTemplate(evt.getRemoteUser(), t,
53: ContextConstants.CONTENT_EDIT,
54: Policy.CONTENT_TREE_ID, ceContext.conNodeId);
55:
56: evt.finishTemplate(t);
57: } catch (Throwable e) {
58: // TO DO : Analyze Exception !
59: throw WebmanExceptionHandler.getException(e);
60: }
61: }
62:
63: public boolean isHandler(TKEvent evt) {
64: return evt.getName().equalsIgnoreCase("CE_DEFAULT");
65: }
66: }
|