1 package de.webman.template.eventhandler; 2 3 import com.teamkonzept.webman.mainint.events.*; 4 import com.teamkonzept.webman.mainint.*; 5 import com.teamkonzept.webman.*; 6 import com.teamkonzept.web.*; 7 import com.teamkonzept.lib.*; 8 9 16 17 public class TECopyHandler extends DefaultEventHandler implements ParameterTypes 18 { 19 private TECopyHandler() 20 {} 21 22 private static TECopyHandler instance = new TECopyHandler(); 23 24 public static TECopyHandler getInstance() 25 { 26 return instance; 27 } 28 public void handleEvent(TKEvent evt) throws TKException 29 { 30 try 31 { 32 TKHTMLTemplate t = evt.getPrepHTMLTemplate( "te_copyTmpl.tmpl" ); 33 String tmplName = evt.getParameter( PARAMETER, "TEMPLATE_NAME" ); 34 if (!TEUtils.isValidTemplateName(tmplName)) 35 throw new TKUserException("Ungueltiger Name", WRONG_TEMPLATE_NAME, USER_SEVERITY, false, null); 36 String tmplId = evt.getParameter( PARAMETER, "TEMPLATE_ID" ); 37 t.set( "TEMPLATE_NAME", tmplName ); 38 t.set( "TEMPLATE_ID", tmplId ); 39 40 WebManEvent.fillEventsIntoTemplate(evt.getRemoteUser(), t, ContextConstants.TEMPLATES); 41 evt.finishTemplate(t); 42 } 43 catch (Throwable e) 44 { 45 throw WebmanExceptionHandler.getException(e); 46 } 47 } 48 49 public boolean isHandler(TKEvent evt) 50 { 51 return evt.getName().equalsIgnoreCase("TE_COPY"); 52 } 53 } 54 | Popular Tags |