Update of 
/var/cvs/contributions/CMSContainer/cmsc/utilities/src/java/com/finalist/cmsc/struts
In directory 
james.mmbase.org:/tmp/cvs-serv12554/cmsc/utilities/src/java/com/finalist/cmsc/struts

Modified Files:
        WizardInitAction.java 
Log Message:
CMSC-1087 (changes the status box of a page to a dynamic tree in the Workflow 
section of the CMSC)


See also: 
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer/cmsc/utilities/src/java/com/finalist/cmsc/struts
See also: http://www.mmbase.org/jira/browse/CMSC-1087


Index: WizardInitAction.java
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer/cmsc/utilities/src/java/com/finalist/cmsc/struts/WizardInitAction.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- WizardInitAction.java       1 Aug 2008 13:15:37 -0000       1.8
+++ WizardInitAction.java       4 Nov 2008 12:02:06 -0000       1.9
@@ -1,6 +1,8 @@
 package com.finalist.cmsc.struts;
 
-import java.util.*;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;
@@ -8,7 +10,10 @@
 import org.apache.commons.lang.StringUtils;
 import org.apache.struts.action.ActionForward;
 import org.apache.struts.action.ActionMapping;
-import org.mmbase.bridge.*;
+import org.mmbase.bridge.Cloud;
+import org.mmbase.bridge.Node;
+import org.mmbase.bridge.NodeList;
+import org.mmbase.bridge.NodeManager;
 import org.mmbase.util.logging.Logger;
 import org.mmbase.util.logging.Logging;
 
@@ -55,25 +60,33 @@
          session.removeAttribute("creation");
       }
 
-      String[] contenttypes = request.getParameterValues("contenttype");
-      String contenttype = null;
-      if (contenttypes == null || contenttypes.length == 0) {
+      String[] elementtypes = request.getParameterValues("contenttype");
+      if(elementtypes == null || elementtypes.length == 0){
+         elementtypes = request.getParameterValues("assettype");
+      }
+      String elementtype = null;
+      if (elementtypes == null || elementtypes.length == 0) {
          if (objectNumber != null && !"new".equals(objectNumber)) {
             Node node = cloud.getNode(objectNumber);
-            contenttype = node.getNodeManager().getName();
+            elementtype = node.getNodeManager().getName();
          }
          else {
             throw new IllegalStateException("No criteria available to find a 
wizard."
-                  + " Provide a contenttype or objectnumber");
+                  + " Provide a elementtype or objectnumber");
          }
       }
       else {
-         if (contenttypes.length == 1) {
-            contenttype = contenttypes[0];
+         if (elementtypes.length == 1) {
+            elementtype = elementtypes[0];
          }
          else {
-            List<String> list = Arrays.asList(contenttypes);
+            List<String> list = Arrays.asList(elementtypes);
+            if(request.getParameterValues("contenttype").length > 1){
             addToRequest(request, "contenttypes", list);
+            }
+            else {
+               addToRequest(request, "assettypes", list);
+            }
             ActionForward ret = mapping.findForward("newtypes");
             return ret;
          }
@@ -83,24 +96,24 @@
       if (StringUtils.isEmpty(wizardConfigName)) {
          NodeList list = null;
          NodeManager manager = cloud.getNodeManager("editwizards");
-         list = manager.getList("nodepath = '" + contenttype + "'", null, 
null);
+         list = manager.getList("nodepath = '" + elementtype + "'", null, 
null);
          if (!list.isEmpty()) {
             Node wizard = list.getNode(0);
             wizardConfigName = wizard.getStringValue("wizard");
          }
          else {
-            String typeWizard = "config/" + contenttype + "/" + contenttype;
+            String typeWizard = "config/" + elementtype + "/" + elementtype;
             if (editwizardExists(typeWizard)) {
                wizardConfigName = typeWizard;
             }
             else {
-               throw new IllegalStateException("Unable to find a wizard for 
contenttype " + contenttype + " or objectnumber "
+               throw new IllegalStateException("Unable to find a wizard for 
elementtype " + elementtype + " or objectnumber "
                      + objectNumber);
             }
          }
       }
 
-      session.setAttribute("contenttype", contenttype);
+      session.setAttribute("contenttype", elementtype);
 
       String sessionkey = request.getParameter("sessionkey");
       if (sessionkey == null || sessionkey.length() == 0) {
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to