1 package de.webman.config.eventhandler; 2 3 import com.teamkonzept.web.*; 4 import com.teamkonzept.webman.*; 5 import com.teamkonzept.webman.db.TKWebmanDBManager; 6 import com.teamkonzept.webman.mainint.*; 7 import com.teamkonzept.webman.mainint.db.*; 8 9 import de.webman.content.workflow.*; 10 import com.teamkonzept.webman.mainint.db.queries.*; 11 import com.teamkonzept.webman.mainint.events.*; 12 import com.teamkonzept.lib.*; 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.sql.*; 19 import java.io.*; 20 21 28 public class COWorkflowListHandler extends DefaultEventHandler implements ParameterTypes, FrameConstants, DatabaseDefaults 29 { 30 private COWorkflowListHandler() 31 {} 32 33 private static COWorkflowListHandler instance = new COWorkflowListHandler(); 34 35 public static COWorkflowListHandler getInstance() 36 { 37 return instance; 38 } 39 40 public void handleEvent(TKEvent evt) throws TKException 41 { 42 try 43 { 44 WebManEvent.checkEvent(evt.getRemoteUser(), evt.getName(), ContextConstants.CUSTOMIZE_PROPERTIES); 45 TKHTMLTemplate t = evt.getPrepHTMLTemplate( "co_workflow.tmpl" ); 46 String event = evt.toString(); 47 String action = event == null ? null : evt.getParameter(ACTION,event); 48 49 VersionStatics statics = VersionStatics.setup(); 51 VersionStatics newStatics = null; 52 53 if (action == null || action.length() == 0 || action.equalsIgnoreCase ("GET")) 54 { 55 newStatics = new VersionStatics (statics); 57 newStatics.load(); 58 } 59 else if (action.equalsIgnoreCase ("UPDATE")) 60 { 61 newStatics = new VersionStatics (statics); 62 newStatics.load(); 63 VersionStatics.putStatics (newStatics); 64 } 65 else if (action.equalsIgnoreCase ("SAVE")) 66 { 67 newStatics = new VersionStatics (statics); 68 newStatics.scanFields (evt.getParams().getClass (PARAMETER)); 69 statics.saveTransitions(newStatics); 70 newStatics.load(); 71 } 72 else if (action.equalsIgnoreCase ("SCRIPT")) 73 { 74 newStatics = new VersionStatics (statics); 75 newStatics.scanFields (evt.getParams().getClass (PARAMETER)); 76 newStatics.script(evt.getHttpInterface().getDocumentRoot()); 77 } 78 else 79 { 80 newStatics = new VersionStatics (statics); 82 newStatics.scanFields (evt.getParams().getClass (PARAMETER)); 83 } 84 t.setListIterator (new TKStandardPluginIterator ("VERSION_STATUS","STATUS", 85 VersionStatus.filterComments(newStatics),true,t.getListIterator())); 86 87 t.setListIterator (new TKStandardPluginIterator ("TRANSITION_MODES","MODE", 88 newStatics.getModes(), false,t.getListIterator())); 89 90 t.setListIterator (new TKStandardPluginIterator ("TRANSITION_ATTRIBUTES","ATTR", 91 newStatics.attributes,false,t.getListIterator())); 92 93 t.setListIterator (new TKStandardPluginIterator ("VERSION_TRANSITIONS","TRANS", 94 newStatics.getTransitions(),true,t.getListIterator())); 95 96 t.setListIterator (new TKStandardPluginIterator 98 ("PREDEFINED_FILTERS",null,statics.getInternationalFilters(),true,t.getListIterator())); 99 100 101 evt.finishTemplate(t); 102 } 103 catch (Throwable e) 104 { 105 throw WebmanExceptionHandler.getException(e); 106 } 107 } 108 109 public boolean isHandler(TKEvent evt) 110 { 111 return evt.getName().equalsIgnoreCase("CO_WORKFLOW_LIST"); 112 } 113 } 114 | Popular Tags |