Author: shuber
Date: Tue Aug  8 16:23:03 2006
New Revision: 14864

URL: https://svndev.jahia.net/websvn/listing.php?sc=1&rev=14864&repname=jahia
Log:
- Fix for JAHIA-1217
- Also fixed issues with move that allowed move in the subtree of the moved 
category.

Modified:
    trunk/core/src/java/org/jahia/admin/categories/ManageCategories.java
    trunk/core/src/webapp/jsp/jahia/administration/manage_categories.jsp
    
trunk/core/src/webapp/jsp/jahia/administration/manage_categories_deletecategory.jsp
    
trunk/core/src/webapp/jsp/jahia/administration/manage_categories_movecategory.jsp

Modified: trunk/core/src/java/org/jahia/admin/categories/ManageCategories.java
URL: 
https://svndev.jahia.net/websvn/diff.php?path=/trunk/core/src/java/org/jahia/admin/categories/ManageCategories.java&rev=14864&repname=jahia
==============================================================================
--- trunk/core/src/java/org/jahia/admin/categories/ManageCategories.java 
(original)
+++ trunk/core/src/java/org/jahia/admin/categories/ManageCategories.java Tue 
Aug  8 16:23:03 2006
@@ -127,6 +127,9 @@
         }
 
         String operation = request.getParameter("sub");
+        if (operation == null) {
+            operation = "display";
+        }
 
         sReg = ServicesRegistry.getInstance();
 
@@ -712,10 +715,13 @@
             if (curCategoryKey != null) {
                 session.setAttribute(CURRENTCATEGORY_SESSIONKEY, 
curCategoryKey);
             }
+            int curCategoryID = Integer.parseInt(curCategoryKey);
             String parentCategoryKey = 
request.getParameter("parentCategoryKey");
+            int parentCategoryID = Integer.parseInt(parentCategoryKey);
 
             JTree tree = null;
-            if (request.getParameterMap().containsKey("guitree")) {
+            if ((request.getParameter("guitree") != null) &&
+               (!"".equals(request.getParameter("guitree"))) ) {
                 // we only load the tree from the session if we were doing
                 // control operations on it.
                 tree = (JTree) session.getAttribute(
@@ -729,8 +735,9 @@
                     new 
DefaultMutableTreeNode(Category.getRootCategory(jParams.getUser()), true);
                 DefaultTreeModel treeModel = new DefaultTreeModel(top, true);
                 tree = new JTree(treeModel);
+                Category stopCategory = Category.getCategory(curCategoryID, 
jParams.getUser());
                 buildCategoryTree(top, 
Category.getRootCategory(jParams.getUser()),
-                                  Category.getCategory(curCategoryKey, 
jParams.getUser()), jParams.getUser());
+                                  stopCategory, jParams.getUser());
                 session.setAttribute(CATEGORYTREE_SESSIONKEY, tree);
             }
 

Modified: trunk/core/src/webapp/jsp/jahia/administration/manage_categories.jsp
URL: 
https://svndev.jahia.net/websvn/diff.php?path=/trunk/core/src/webapp/jsp/jahia/administration/manage_categories.jsp&rev=14864&repname=jahia
==============================================================================
--- trunk/core/src/webapp/jsp/jahia/administration/manage_categories.jsp 
(original)
+++ trunk/core/src/webapp/jsp/jahia/administration/manage_categories.jsp Tue 
Aug  8 16:23:03 2006
@@ -51,6 +51,11 @@
 
     }
 
+    function submitAction(action) {
+        document.mainForm.action = action;
+        document.mainForm.submit();
+    }
+
     //-->
 </script>
 
@@ -133,6 +138,8 @@
         if ( nodeInfo instanceof Category ){
             Category curCategory = (Category) nodeInfo;
             String updateUrl = 
jData.gui().html().drawUpdateCategoryLauncher(curCategory);
+            String moveUrl = 
JahiaAdministration.composeActionURL(request,response,"categories","&sub=moveCategory&parentCategoryKey="
 + parentCategoryKey + "&currentCategoryKey=" + 
curCategory.getObjectKey().getIdInType());
+            String deleteUrl = 
JahiaAdministration.composeActionURL(request,response,"categories","&sub=deleteCategory&parentCategoryKey="
 + parentCategoryKey + "&currentCategoryKey=" + 
curCategory.getObjectKey().getIdInType());
             boolean writeAccess = ACLResource.checkWriteAccess(curCategory, 
curCategory, jData.getProcessingContext().getUser());
             if (!"".equals(updateUrl)) {
     %>
@@ -140,7 +147,7 @@
            title='<jahia:adminResourceBundle 
resourceName="org.jahia.admin.categories.ManageCategories.editCategoryAction.label"/>'>
             <% }
                 String catDisplay = 
curCategory.getTitle(jData.getProcessingContext().getLocale());
-                if (catDisplay == null) {
+                if ((catDisplay == null) || ("".equals(catDisplay))) {
                     catDisplay = "(key=" + curCategory.getKey() + ")";
                 }
                 out.println(catDisplay);
@@ -175,14 +182,14 @@
         <%  }
             if (writeAccess && 
!ROOT_CATEGORY_KEY.equals(curCategory.getKey())) { %>
             <li>
-        <a 
href='<%=JahiaAdministration.composeActionURL(request,response,"categories","&sub=moveCategory&parentCategoryKey="
 + parentCategoryKey + "&currentCategoryKey=" + 
curCategory.getObjectKey().getIdInType())%>'
+        <a href='javascript:submitAction("<%=moveUrl%>")'
            class="moveAction"
            title='<jahia:adminResourceBundle 
resourceName="org.jahia.admin.categories.ManageCategories.moveCategoryAction.label"/>'>
             <span><jahia:adminResourceBundle 
resourceName="org.jahia.admin.categories.ManageCategories.moveCategoryAction.label"/></span>
         </a>
                 </li>
             <li>
-        <a 
href='<%=JahiaAdministration.composeActionURL(request,response,"categories","&sub=deleteCategory&parentCategoryKey="
 + parentCategoryKey + "&currentCategoryKey=" + 
curCategory.getObjectKey().getIdInType())%>'
+        <a href='javascript:submitAction("<%=deleteUrl%>")'
            class="deleteAction"
            title='<jahia:adminResourceBundle 
resourceName="org.jahia.admin.categories.ManageCategories.deleteCategoryAction.label"/>'>
             <span><jahia:adminResourceBundle 
resourceName="org.jahia.admin.categories.ManageCategories.deleteCategoryAction.label"/></span>

Modified: 
trunk/core/src/webapp/jsp/jahia/administration/manage_categories_deletecategory.jsp
URL: 
https://svndev.jahia.net/websvn/diff.php?path=/trunk/core/src/webapp/jsp/jahia/administration/manage_categories_deletecategory.jsp&rev=14864&repname=jahia
==============================================================================
--- 
trunk/core/src/webapp/jsp/jahia/administration/manage_categories_deletecategory.jsp
 (original)
+++ 
trunk/core/src/webapp/jsp/jahia/administration/manage_categories_deletecategory.jsp
 Tue Aug  8 16:23:03 2006
@@ -56,7 +56,10 @@
 <br>
 
 <h2><jahia:adminResourceBundle 
resourceName="org.jahia.admin.categories.ManageCategories.deleteCategory.label"/>&nbsp;:</h2>
-  <form name="mainForm" 
action='<%=JahiaAdministration.composeActionURL(request,response,"categories","&sub=commitDeleteCategory&parentCategoryKey="
 + parentCategoryKey + "&targetCategoryKey=" + categoryKey)%>' method="post">
+  <form name="mainForm" 
action='<%=JahiaAdministration.composeActionURL(request,response,"categories","")%>'
 method="post">
+    <input type="hidden" name="sub" value="commitDeleteCategory" />
+    <input type="hidden" name="parentCategoryKey" 
value="<%=parentCategoryKey%>" />
+    <input type="hidden" name="targetCategoryKey" value="<%=categoryKey%>" />
     <input type="hidden" name="test" value="test" />
     <p>
       <b>

Modified: 
trunk/core/src/webapp/jsp/jahia/administration/manage_categories_movecategory.jsp
URL: 
https://svndev.jahia.net/websvn/diff.php?path=/trunk/core/src/webapp/jsp/jahia/administration/manage_categories_movecategory.jsp&rev=14864&repname=jahia
==============================================================================
--- 
trunk/core/src/webapp/jsp/jahia/administration/manage_categories_movecategory.jsp
 (original)
+++ 
trunk/core/src/webapp/jsp/jahia/administration/manage_categories_movecategory.jsp
 Tue Aug  8 16:23:03 2006
@@ -63,8 +63,11 @@
 
 <h2><jahia:adminResourceBundle 
resourceName="org.jahia.admin.categories.ManageCategories.moveCategory.label"/>&nbsp;:</h2>
 
-  <form name="mainForm" 
action='<%=JahiaAdministration.composeActionURL(request,response,"categories","&sub=commitMoveCategory&parentCategoryKey="
 + parentCategoryKey + "&currentCategoryKey=" + currentCategoryKey)%>' 
method="post">
-    
+  <form name="mainForm" 
action='<%=JahiaAdministration.composeActionURL(request,response,"categories","")%>'
 method="post">
+      <input type="hidden" name="sub" value="commitMoveCategory" />
+      <input type="hidden" name="parentCategoryKey" 
value="<%=parentCategoryKey%>" />
+      <input type="hidden" name="currentCategoryKey" 
value="<%=currentCategoryKey%>" />
+
     <table border="0" cellspacing="0" cellpadding="5" class="topAlignedTable">
       <tr>
         <td>
@@ -87,11 +90,14 @@
                   Object nodeInfo = pageContext.findAttribute("userObject");
                   Category curCategory = (Category) nodeInfo;
                   String catDisplay = 
curCategory.getTitle(jData.getProcessingContext().getLocale());
-                  if (catDisplay == null) {
+                  if ((catDisplay == null) || ("".equals(catDisplay))) {
                       catDisplay = "(key=" + curCategory.getKey() + ")";
                   }
+                  if (!curCategory.getKey().equals(currentCategoryKey)) {
                %>
-                  <input type="radio" name="newParentKey" 
value="<%=curCategory.getObjectKey().getIDInType()%>"> <%= catDisplay %>
+                  <input type="radio" name="newParentKey" 
value="<%=curCategory.getObjectKey().getIDInType()%>">
+               <% } %>
+                  <%= catDisplay %>
                </jahiaHtml:tree>
             <!-- end of category tree display -->
         </td>

Reply via email to