01: package de.webman.template.eventhandler;
02:
03: import com.teamkonzept.webman.mainint.events.*;
04: import com.teamkonzept.webman.mainint.*;
05: import com.teamkonzept.webman.*;
06: import com.teamkonzept.web.*;
07: import com.teamkonzept.lib.*;
08:
09: /**
10: * Umbennen eines Templates
11: *
12: * @author $Author: alex $
13: * @version $Revision: 1.2 $
14: */
15: public class TERenameHandler extends DefaultEventHandler implements
16: ParameterTypes {
17: private TERenameHandler() {
18: }
19:
20: private static TERenameHandler instance = new TERenameHandler();
21:
22: public static TERenameHandler getInstance() {
23: return instance;
24: }
25:
26: public void handleEvent(TKEvent evt) throws TKException {
27: try {
28: TKHTMLTemplate t = evt
29: .getPrepHTMLTemplate("te_renameTmpl.tmpl");
30: String tmplName = evt.getParameter(PARAMETER,
31: "TEMPLATE_NAME");
32: if (!TEUtils.isValidTemplateName(tmplName)) {
33: throw new TKUserException("Ungueltiger Name",
34: WRONG_TEMPLATE_NAME, USER_SEVERITY, false, null);
35: }
36: String tmplId = evt.getParameter(PARAMETER, "TEMPLATE_ID");
37: t.set("TEMPLATE_NAME", tmplName);
38: t.set("TEMPLATE_ID", tmplId);
39: WebManEvent.fillEventsIntoTemplate(evt.getRemoteUser(), t,
40: ContextConstants.TEMPLATES);
41: evt.finishTemplate(t);
42: } catch (Throwable e) {
43: throw WebmanExceptionHandler.getException(e);
44: }
45: }
46:
47: public boolean isHandler(TKEvent evt) {
48: return evt.getName().equalsIgnoreCase("TE_RENAME");
49: }
50: }
|