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.international.LanguageManager;
13: import com.teamkonzept.field.*;
14: import com.teamkonzept.field.db.*;
15: import com.teamkonzept.db.*;
16: import com.teamkonzept.publishing.markups.*;
17:
18: import java.util.*;
19: import java.sql.*;
20:
21: /**
22: * Informationen über die Verwendung eines Documenttyps
23: *
24: * Reihenfolge der params im String PR_DELETE_PRES:
25: *
26: * @author $Author: alex $
27: * @version $Revision: 1.3 $
28: */
29: public class DTInfoHandler extends DefaultEventHandler implements
30: ParameterTypes, FrameConstants, DatabaseDefaults {
31: private DTInfoHandler() {
32: }
33:
34: private static DTInfoHandler instance = new DTInfoHandler();
35:
36: public static DTInfoHandler getInstance() {
37: return instance;
38: }
39:
40: public void handleEvent(TKEvent evt) throws TKException {
41: try {
42: WebManEvent.checkEvent(evt.getRemoteUser(), evt.getName(),
43: ContextConstants.PRESENTATIONS);
44: String presId = evt.getParameter(PARAMETER,
45: "PRESENTATION_ID");
46: String name = evt.getParameter(PARAMETER,
47: "PRESENTATION_NAME");
48: // Checken, ob der DokumentTyp noch in der Sitestruktur benutzt wird
49: TKVector refs = DTUtils
50: .getDependencies(new Integer(presId));
51: TKHTMLTemplate t = evt
52: .getPrepHTMLTemplate("dependency.tmpl");
53: Object[] temp = new Object[1];
54: temp[0] = name;
55: String errorText = LanguageManager.getText("documenttype",
56: "DEPENDENCY", temp);
57: t.set("TITLE", errorText);
58: t.setListIterator(new TKStandardPluginIterator(
59: "REFERENCES", null, refs, false, t
60: .getListIterator()));
61: evt.finishTemplate(t);
62: } catch (Throwable e) {
63: throw WebmanExceptionHandler.getException(e);
64: }
65: }
66:
67: public boolean isHandler(TKEvent evt) {
68: return evt.getName().equalsIgnoreCase("PR_INFO");
69: }
70: }
|