portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woon...@apache.org
Subject svn commit: r926196 - in /portals/jetspeed-2/applications/j2-admin/trunk/src/main: java/org/apache/jetspeed/portlets/spaces/ resources/org/apache/jetspeed/portlets/spaces/resources/ webapp/WEB-INF/view/spaces/
Date Mon, 22 Mar 2010 17:12:36 GMT
Author: woonsan
Date: Mon Mar 22 17:12:36 2010
New Revision: 926196

URL: http://svn.apache.org/viewvc?rev=926196&view=rev
Log:
JS2-1132: Adding document ordering feature in page navigator.
Also, making the node types to create configurable by pref.

Modified:
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/PageNavigator.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/spaces/resources/SpacesResources.properties
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/spaces/resources/SpacesResources_en.properties
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/spaces/resources/SpacesResources_ko.properties
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/spaces/page-navigator.jsp

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/PageNavigator.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/PageNavigator.java?rev=926196&r1=926195&r2=926196&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/PageNavigator.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/PageNavigator.java
Mon Mar 22 17:12:36 2010
@@ -77,6 +77,7 @@ public class PageNavigator extends Gener
     public static final String DEFAULT_SPACE_NAVS_MENU = "space-navigations";
     public static final String DEFAULT_SPACE_LINKS_MENU = "space-links";
     public static final String DEFAULT_TEMPLATE_PAGE = "/_template/new-user/min.psml";
+    public static final String [] DEFAULT_MANAGEABLE_NODE_TYPES = { ".psml", "folder", ".link"
}; 
     public static final String FOLDER_SPACE_FLAGS = "folderSpaceFlags";
     public static final String TEMPLATE_PAGE_NODES = "templatePageNodes";
     
@@ -161,6 +162,14 @@ public class PageNavigator extends Gener
         request.setAttribute("spaceLinkElements", getSpaceLinkMenuElements(spaceBean, request));
         request.setAttribute("templatePages", getTemplatePageNodes(request));
         
+        String [] manageableNodeTypes = DEFAULT_MANAGEABLE_NODE_TYPES;
+        String manageableNodeTypesPref = request.getPreferences().getValue("manageableNodeTypes",
null);
+        if (!StringUtils.isBlank(manageableNodeTypesPref))
+        {
+            manageableNodeTypes = StringUtils.split(manageableNodeTypesPref, ", \t\r\n");
+        }
+        request.setAttribute("manageableNodeTypes", manageableNodeTypes);
+        
         if (SpaceAdminUtils.isUserSpaceOwner(spaceBean, request) || SpaceAdminUtils.isUserSpaceAdmin(spaceBean,
admin, request))
         {
             request.setAttribute("pageEditable", Boolean.TRUE);

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/spaces/resources/SpacesResources.properties
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/spaces/resources/SpacesResources.properties?rev=926196&r1=926195&r2=926196&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/spaces/resources/SpacesResources.properties
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/spaces/resources/SpacesResources.properties
Mon Mar 22 17:12:36 2010
@@ -31,11 +31,12 @@ spaces.label.save = Save
 spaces.label.cancel = Cancel
 spaces.message.forbidden = You are not allowed to edit the current space.
 
-spaces.pages.label.folder = Folder
-spaces.pages.label.page = Page
-spaces.pages.label.link = Link
+spaces.pages.label.nodeType.folder = Folder
+spaces.pages.label.nodeType..psml = Page
+spaces.pages.label.nodeType..link = Link
 spaces.pages.label.add = Add
 spaces.pages.label.rename = Rename
+spaces.pages.label.documentOrdering = Document Ordering
 spaces.pages.label.changeUrl = Change URL
 spaces.pages.label.delete = Delete
 spaces.pages.label.move = Move

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/spaces/resources/SpacesResources_en.properties
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/spaces/resources/SpacesResources_en.properties?rev=926196&r1=926195&r2=926196&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/spaces/resources/SpacesResources_en.properties
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/spaces/resources/SpacesResources_en.properties
Mon Mar 22 17:12:36 2010
@@ -31,11 +31,12 @@ spaces.label.save = Save
 spaces.label.cancel = Cancel
 spaces.message.forbidden = You are not allowed to edit the current space.
 
-spaces.pages.label.folder = Folder
-spaces.pages.label.page = Page
-spaces.pages.label.link = Link
+spaces.pages.label.nodeType.folder = Folder
+spaces.pages.label.nodeType..psml = Page
+spaces.pages.label.nodeType..link = Link
 spaces.pages.label.add = Add
 spaces.pages.label.rename = Rename
+spaces.pages.label.documentOrdering = Document Ordering
 spaces.pages.label.changeUrl = Change URL
 spaces.pages.label.delete = Delete
 spaces.pages.label.move = Move

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/spaces/resources/SpacesResources_ko.properties
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/spaces/resources/SpacesResources_ko.properties?rev=926196&r1=926195&r2=926196&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/spaces/resources/SpacesResources_ko.properties
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/spaces/resources/SpacesResources_ko.properties
Mon Mar 22 17:12:36 2010
@@ -31,11 +31,12 @@ spaces.label.save = \uc800\uc7a5
 spaces.label.cancel = \ucde8\uc18c
 spaces.message.forbidden = \ud574\ub2f9 \uc2a4\ud398\uc774\uc2a4\ub97c \ud3b8\uc9d1\ud560
\uad8c\ud55c\uc774 \uc5c6\uc2b5\ub2c8\ub2e4.
 
-spaces.pages.label.folder = \ud3f4\ub354
-spaces.pages.label.page = \ud398\uc774\uc9c0
-spaces.pages.label.link = \ub9c1\ud06c
+spaces.pages.label.nodeType.folder = \ud3f4\ub354
+spaces.pages.label.nodeType..psml = \ud398\uc774\uc9c0
+spaces.pages.label.nodeType..link = \ub9c1\ud06c
 spaces.pages.label.add = \ucd94\uac00
 spaces.pages.label.rename = \uc774\ub984\ubc14\uafb8\uae30
+spaces.pages.label.documentOrdering = \ud398\uc774\uc9c0/\ud3f4\ub354 \uc21c\uc11c
 spaces.pages.label.changeUrl = URL \ubcc0\uacbd
 spaces.pages.label.delete = \uc0ad\uc81c
 spaces.pages.label.move = \uc774\ub3d9

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/spaces/page-navigator.jsp
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/spaces/page-navigator.jsp?rev=926196&r1=926195&r2=926196&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/spaces/page-navigator.jsp
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/spaces/page-navigator.jsp
Mon Mar 22 17:12:36 2010
@@ -124,7 +124,9 @@ Theme theme = (Theme) rc.getRequest().ge
 <form id='jsPages' method="POST" action='<portlet:actionURL/>'>
   <div class="portlet-section-body">
     <div class="portlet-section-text">
-      <h3><a href="<%=basePath%>${space.path}"><fmt:message key="spaces.pages.label.space.title"><fmt:param
value="${space.title}"/></fmt:message></a></h3>
+      <h3 id="<portlet:namespace/>spaceMenuItem" editable="${pageEditable}" nodeType="folder"
path="${space.path}" style="margin-right: 1em">
+        <a href="<%=basePath%>${space.path}"><fmt:message key="spaces.pages.label.space.title"><fmt:param
value="${space.title}"/></fmt:message></a>
+      </h3>
       <ul id="<portlet:namespace/>pageNavMenu" class="navmenu">
 <%
 for (MenuElement element : menuElements)
@@ -163,9 +165,9 @@ for (MenuElement element : linkElements)
       <tr>
         <td class="portlet-section-body">
           <select name="type" class="portlet-form-input-field">
-            <option value=".psml"><fmt:message key="spaces.pages.label.page"/></option>
-            <option value="folder"><fmt:message key="spaces.pages.label.folder"/></option>
-            <option value=".link"><fmt:message key="spaces.pages.label.link"/></option>
+            <c:forEach var="nodeType" items="${manageableNodeTypes}">
+              <option value="${nodeType}"><fmt:message key="spaces.pages.label.nodeType.${nodeType}"/></option>
+            </c:forEach>
           </select>
           <input type="text" name="name" class="portlet-form-input-field" size="15" value=""
><input type="submit" value="<fmt:message key='spaces.pages.label.add'/>" />
         </td>
@@ -200,13 +202,12 @@ for (MenuElement element : linkElements)
           </span>
           <div id="<portlet:namespace/>menuOptions" class="yui-menu">
             <div class="yui-menu-content">
-              <ul>
+              <ul id="<portlet:namespace/>nodePopupMenuItemList">
                 <li class="yui-menuitem"><a id="<portlet:namespace/>nodePopupMenu_rename"
class="yui-menuitem-content" href="#"><fmt:message key='spaces.pages.label.rename'/></a></li>
                 <li class="yui-menuitem"><a id="<portlet:namespace/>nodePopupMenu_move"
class="yui-menuitem-content" href="#"><fmt:message key='spaces.pages.label.move'/></a></li>
                 <li class="yui-menuitem"><a id="<portlet:namespace/>nodePopupMenu_copy"
class="yui-menuitem-content" href="#"><fmt:message key='spaces.pages.label.copy'/></a></li>
                 <li class="yui-menuitem"><a id="<portlet:namespace/>nodePopupMenu_delete"
class="yui-menuitem-content" href="#"><fmt:message key='spaces.pages.label.delete'/></a></li>
-              </ul>
-              <ul>
+                <li class="yui-menuitem"><a id="<portlet:namespace/>nodePopupMenu_documentOrdering"
class="yui-menuitem-content" href="#"><fmt:message key='spaces.pages.label.documentOrdering'/></a></li>
                 <li class="yui-menuitem"><a id="<portlet:namespace/>nodePopupMenu_changeUrl"
class="yui-menuitem-content" href="#"><fmt:message key='spaces.pages.label.changeUrl'/></a></li>
               </ul>
             </div>
@@ -218,10 +219,10 @@ for (MenuElement element : linkElements)
 </span>
 
 <div style="display: none">
-  <div id="<portlet:namespace/>modalHeader" align="center">
-    <h2 id="<portlet:namespace/>modalHeader"><fmt:message key='spaces.pages.message.confirm.choosefolder'/></h2>
+  <div id="<portlet:namespace/>folderModalHeader" align="center">
+    <h2 id="<portlet:namespace/>folderModalHeader"><fmt:message key='spaces.pages.message.confirm.choosefolder'/></h2>
   </div>
-  <div id="<portlet:namespace/>modalBody">
+  <div id="<portlet:namespace/>folderModalBody">
     <div style="WIDTH: 100%; HEIGHT: 200px; OVERFLOW: auto">
       <form id="<portlet:namespace/>targetFolderForm">
         <ul class="navmenu">
@@ -235,10 +236,28 @@ for (MenuElement element : linkElements)
       </form>
     </div>
   </div> 
-  <div id="<portlet:namespace/>modalFooter" align="center">
+  <div id="<portlet:namespace/>folderModalFooter" align="center">
+    <form>
+      <input id="<portlet:namespace/>folderModalOK" type="button" value="<fmt:message
key='spaces.pages.label.ok'/>" />
+      <input id="<portlet:namespace/>folderModalCancel" type="button" value="<fmt:message
key='spaces.pages.label.cancel'/>" />
+    </form>
+  </div>
+</div>
+
+<div style="display: none">
+  <div id="<portlet:namespace/>documentOrderingModalHeader" align="center">
+    <h2 id="<portlet:namespace/>documentOrderingModalHeader"><fmt:message
key='spaces.pages.label.documentOrdering'/></h2>
+  </div>
+  <div id="<portlet:namespace/>documentOrderingModalBody">
+    <div style="WIDTH: 100%; HEIGHT: 200px; OVERFLOW: auto">
+      <ul class="navmenu" id="<portlet:namespace/>documentOrderingItems">
+      </ul>
+    </div>
+  </div> 
+  <div id="<portlet:namespace/>documentOrderingModalFooter" align="center">
     <form>
-      <input id="<portlet:namespace/>modalOK" type="button" value="<fmt:message
key='spaces.pages.label.ok'/>" />
-      <input id="<portlet:namespace/>modalCancel" type="button" value="<fmt:message
key='spaces.pages.label.cancel'/>" />
+      <input id="<portlet:namespace/>documentOrderingModalOK" type="button" value="<fmt:message
key='spaces.pages.label.ok'/>" />
+      <input id="<portlet:namespace/>documentOrderingModalCancel" type="button"
value="<fmt:message key='spaces.pages.label.cancel'/>" />
     </form>
   </div>
 </div>
@@ -269,25 +288,48 @@ YUI().use('jetui-portal', 'io', 'json', 
     
     var nodePopupMenu = null;
     var curNodeListItem = null;
+    var nodePopupMenuItems = new Array();
     
     var onMenuItemMouseEnter = function(e) {
         if (nodePopupMenu == null) {
             nodePopupMenu = Y.Node.one("#<portlet:namespace/>nodePopupMenu");
             nodePopupMenu.plug(Y.Plugin.NodeFocusManager, { descendants: ".yui-menuitem"});
             nodePopupMenu.plug(Y.Plugin.NodeMenuNav, { autoSubmenuDisplay: false, mouseOutHideDelay:
3000, submenuHideDelay: 3000 });
+            var menuItemList = Y.Node.one("#<portlet:namespace/>nodePopupMenuItemList");
+            menuItemList.get("children").each(function(v, k) {
+                var id = v.one("A").get("id");
+                nodePopupMenuItems[id.substring(id.lastIndexOf('_') + 1)] = v;
+            });
             resetNodePopupMenuEventHandlers();
         }
-        var li = e.target;
-        if ("true" == li.getAttribute("editable")) {
-            var nodeType = li.getAttribute("nodeType");
-            Y.Node.one("#<portlet:namespace/>nodePopupMenu_delete").setStyle("display",
".psml" != nodeType || li.get("parentNode").get("children").size() > 1 ? "" : "none");
-            Y.Node.one("#<portlet:namespace/>nodePopupMenu_changeUrl").setStyle("display",
".link" == nodeType ? "" : "none");
-            var liElem = Y.Node.getDOMNode(li);
-            var xy = li.getXY();
+        var menuItem = e.target;
+        if ("true" == menuItem.getAttribute("editable")) {
+            var nodeType = menuItem.getAttribute("nodeType");
+            var isSpaceMenuItem = (menuItem.get("tagName") != "LI");
+            var menuItemList = Y.Node.one("#<portlet:namespace/>nodePopupMenuItemList");
+            menuItemList.get("children").each(function(v, k) {
+                v.remove();
+            });
+            if (!isSpaceMenuItem) {
+                menuItemList.appendChild(nodePopupMenuItems["rename"]);
+                menuItemList.appendChild(nodePopupMenuItems["move"]);
+                menuItemList.appendChild(nodePopupMenuItems["copy"]);
+                if (".psml" != nodeType || menuItem.get("parentNode").get("children").size()
> 1) {
+                    menuItemList.appendChild(nodePopupMenuItems["delete"]);
+                }
+            }
+            if (nodeType == "folder") {
+                menuItemList.appendChild(nodePopupMenuItems["documentOrdering"]);
+            }
+            if (nodeType == ".link") {
+                menuItemList.appendChild(nodePopupMenuItems["changeUrl"]);
+            }
+            var menuItemElem = Y.Node.getDOMNode(menuItem);
+            var xy = menuItem.getXY();
             nodePopupMenu.setStyle("display", "block");
-	        nodePopupMenu.setStyle("left", "" + (xy[0] + liElem.offsetWidth - 12) + "px");
+	        nodePopupMenu.setStyle("left", "" + (xy[0] + menuItemElem.offsetWidth - 12) + "px");
 	        nodePopupMenu.setStyle("top", "" + xy[1] + "px");
-	        curNodeListItem = li;
+	        curNodeListItem = menuItem;
         }
         e.halt();
     };
@@ -375,7 +417,7 @@ YUI().use('jetui-portal', 'io', 'json', 
         e.halt();
     };
 
-    var onModalCancelClick = function(e) {
+    var onFolderModalCancelClick = function(e) {
         var portal = (JETUI_YUI ? JETUI_YUI.getPortalInstance() : null);
         if (portal) {
             portal.hideModalPanel();
@@ -420,7 +462,7 @@ YUI().use('jetui-portal', 'io', 'json', 
     
     var currentFolderChoosingMode = "move";
     
-    var onModalOKClick = function(e) {
+    var onFolderModalOKClick = function(e) {
         var form = Y.Node.one("#<portlet:namespace/>targetFolderForm");
         var target = null;
         form.all("INPUT").each(function(v, k) {
@@ -481,7 +523,7 @@ YUI().use('jetui-portal', 'io', 'json', 
         if (!curNodeListItem) {
             return;
         }
-        resetModalPanelEventHandlers();
+        resetFolderModalPanelEventHandlers();
         var modalFeatures = {
             "width": 400,
             "height": 300,
@@ -490,7 +532,7 @@ YUI().use('jetui-portal', 'io', 'json', 
         var portal = (JETUI_YUI ? JETUI_YUI.getPortalInstance() : null);
         if (portal) {
             currentFolderChoosingMode = "move";
-            portal.showModalPanel("#<portlet:namespace/>modalHeader", "#<portlet:namespace/>modalBody",
"#<portlet:namespace/>modalFooter", modalFeatures);
+            portal.showModalPanel("#<portlet:namespace/>folderModalHeader", "#<portlet:namespace/>folderModalBody",
"#<portlet:namespace/>folderModalFooter", modalFeatures);
         }
         e.halt();
     };
@@ -499,7 +541,7 @@ YUI().use('jetui-portal', 'io', 'json', 
         if (!curNodeListItem) {
             return;
         }
-        resetModalPanelEventHandlers();
+        resetFolderModalPanelEventHandlers();
         var modalFeatures = {
             "width": 400,
             "height": 300,
@@ -508,11 +550,113 @@ YUI().use('jetui-portal', 'io', 'json', 
         var portal = (JETUI_YUI ? JETUI_YUI.getPortalInstance() : null);
         if (portal) {
             currentFolderChoosingMode = "copy";
-            portal.showModalPanel("#<portlet:namespace/>modalHeader", "#<portlet:namespace/>modalBody",
"#<portlet:namespace/>modalFooter", modalFeatures);
+            portal.showModalPanel("#<portlet:namespace/>folderModalHeader", "#<portlet:namespace/>folderModalBody",
"#<portlet:namespace/>folderModalFooter", modalFeatures);
+        }
+        e.halt();
+    };
+    
+    var onDocumentOrderingModalCancelClick = function(e) {
+        var portal = (JETUI_YUI ? JETUI_YUI.getPortalInstance() : null);
+        if (portal) {
+            portal.hideModalPanel();
+        }
+        e.halt();
+    };
+    
+    var onDocumentOrderingComplete = function(id, o, args) {
+        var listItem = args.complete[0];
+        var docOrders = args.complete[1];
+        var subItems = new Array();
+        var subItemList = null;
+        var subList = null;
+        if (listItem.get("tagName") == "LI") {
+            subList = listItem.one("UL");
+        } else {
+            subList = Y.Node.one("#<portlet:namespace/>pageNavMenu");
+        }
+        subItemList = subList.get("children");
+        subItemList.each(function(v, k) {
+            subItems[v.getAttribute("path")] = v;
+        });
+        subItemList.each(function(v, k) {
+            v.remove();
+        });
+        for (var i = 0; i < docOrders.length; i++) {
+            var path = docOrders[i];
+            var item = subItems[path];
+            if (item) {
+                subList.appendChild(item);
+                subItems[path] = null;
+            }
+        }
+        for (var path in subItems) {
+            if (subItems[path]) {
+                subList.appendChild(subItems[path]);
+            }
+        }
+    };
+    
+    var onDocumentOrderingModalOKClick = function(e) {
+        var curDocOrders = [];
+        var newDocOrders = [];
+        var menuItemList = null;
+        if (curNodeListItem.get("tagName") == "LI") {
+            menuItemList = curNodeListItem.one("UL");
+        } else {
+            menuItemList = Y.Node.one("#<portlet:namespace/>pageNavMenu");
+        }
+        menuItemList.get("children").each(function(v, k) {
+            curDocOrders.push(v.getAttribute("path"));
+        });
+        var orderingItems = Y.Node.one("#<portlet:namespace/>documentOrderingItems");
+        orderingItems.one("LI").one("UL").all("LI").each(function(v, k) {
+            newDocOrders.push(v.getAttribute("path"));
+        });
+        if (curDocOrders.toString() != newDocOrders.toString()) {
+            var docOrder = [];
+            for (var i = 0; i < newDocOrders.length; i++) {
+                var doc = newDocOrders[i];
+                if (doc.lastIndexOf('/') >= 0) {
+                    doc = doc.substring(doc.lastIndexOf('/') + 1);
+                }
+                docOrder.push(doc);
+            }
+            var nodeType = curNodeListItem.getAttribute("nodeType");
+            var path = curNodeListItem.getAttribute("path");
+            var uri = "<%=contextPath%>/services/pagemanagement/info/" + nodeType +
path + "?_type=json";
+            var config = {
+                    on: { complete: onDocumentOrderingComplete },
+                    method: "POST",
+                    data: "docorder=" + docOrder.toString(),
+                    arguments: { complete: [ curNodeListItem, newDocOrders ] }
+                };
+            var request = Y.io(uri, config);
+        }
+        
+        var portal = (JETUI_YUI ? JETUI_YUI.getPortalInstance() : null);
+        if (portal) {
+            portal.hideModalPanel();
         }
         e.halt();
     };
     
+    var onDocumentOrderingClick = function(e) {
+        if (!curNodeListItem) {
+            return;
+        }
+        resetDocumentOrderingModalPanelEventHandlers(curNodeListItem);
+        var modalFeatures = {
+                "width": 400,
+                "height": 300,
+                "addClasses": ["layout-<%=theme.getPageLayoutDecoration().getName()%>"]
+            };
+         var portal = (JETUI_YUI ? JETUI_YUI.getPortalInstance() : null);
+         if (portal) {
+             portal.showModalPanel("#<portlet:namespace/>documentOrderingModalHeader",
"#<portlet:namespace/>documentOrderingModalBody", "#<portlet:namespace/>documentOrderingModalFooter",
modalFeatures);
+         }
+         e.halt();
+    };
+    
     var onChangeUrlComplete = function(id, o, args) {
         var id = id; // Transaction ID. 
         var data = o.responseText;
@@ -570,6 +714,9 @@ YUI().use('jetui-portal', 'io', 'json', 
         });
 
         <c:if test="${pageEditable}">
+        var spaceMenuItem = Y.Node.one("#<portlet:namespace/>spaceMenuItem");
+        menuItemEventHandles.push(spaceMenuItem.on("mouseenter", onMenuItemMouseEnter));
+        
         pageNavMenu.all("LI").each(function(v, k) {
             menuItemEventHandles.push(v.on("mouseenter", onMenuItemMouseEnter));
         });
@@ -592,17 +739,13 @@ YUI().use('jetui-portal', 'io', 'json', 
         Y.Node.one("#<portlet:namespace/>nodePopupMenu_move").on("click", onMoveClick);
         Y.detach("click", onCopyClick, "#<portlet:namespace/>nodePopupMenu_copy");
         Y.Node.one("#<portlet:namespace/>nodePopupMenu_copy").on("click", onCopyClick);
+        Y.detach("click", onChangeUrlClick, "#<portlet:namespace/>nodePopupMenu_documentOrdering");
+        Y.Node.one("#<portlet:namespace/>nodePopupMenu_documentOrdering").on("click",
onDocumentOrderingClick);
         Y.detach("click", onChangeUrlClick, "#<portlet:namespace/>nodePopupMenu_changeUrl");
         Y.Node.one("#<portlet:namespace/>nodePopupMenu_changeUrl").on("click", onChangeUrlClick);
     };
     
-    var modalPanelEventHandles = [];
-    var resetModalPanelEventHandlers = function() {
-        for (var i = 0; i < modalPanelEventHandles.length; i++) {
-            modalPanelEventHandles[i].detach();
-        }
-        modalPanelEventHandles = [];
-        
+    var resetFolderModalPanelEventHandlers = function() {
         var targetSubFolders = Y.Node.one("#<portlet:namespace/>targetSubFolders");
         targetSubFolders.get("children").each(function(v, k) {
             v.remove();
@@ -627,14 +770,93 @@ YUI().use('jetui-portal', 'io', 'json', 
             }
         });
         
-        var targetFolders = Y.Node.one("#<portlet:namespace/>modalBody").one("UL");
+        var targetFolders = Y.Node.one("#<portlet:namespace/>folderModalBody").one("UL");
         targetFolders.all("A").each(function(v, k) {
             v.on("click", onMenuItemClick);
         });
-        Y.detach("click", onModalOKClick, "#<portlet:namespace/>modalOK");
-        Y.Node.one("#<portlet:namespace/>modalOK").on("click", onModalOKClick);
-        Y.detach("click", onModalCancelClick, "#<portlet:namespace/>modalCancel");
-        Y.Node.one("#<portlet:namespace/>modalCancel").on("click", onModalCancelClick);
+        Y.detach("click", onFolderModalOKClick, "#<portlet:namespace/>folderModalOK");
+        Y.Node.one("#<portlet:namespace/>folderModalOK").on("click", onFolderModalOKClick);
+        Y.detach("click", onFolderModalCancelClick, "#<portlet:namespace/>folderModalCancel");
+        Y.Node.one("#<portlet:namespace/>folderModalCancel").on("click", onFolderModalCancelClick);
+    };
+
+    var onDummyLinkClick = function(e) {
+        e.halt();
+    };
+    
+    var onDocumentMoveUp = function(e) {
+        var item = e.target;
+        while (item.get("tagName") != "LI") {
+            item = item.get("parentNode");
+        }
+        var prevItem = item.previous();
+        if (prevItem) {
+            var parentNode = item.get("parentNode");
+            item.remove();
+            parentNode.insertBefore(item, prevItem);
+        }
+        e.halt();
+    };
+    
+    var onDocumentMoveDown = function(e) {
+        var item = e.target;
+        while (item.get("tagName") != "LI") {
+            item = item.get("parentNode");
+        }
+        var parentNode = item.get("parentNode");
+        var nextItem = item.next();
+        if (nextItem) {
+            var parentNode = item.get("parentNode");
+            item.remove();
+            var nextOfNextItem = nextItem.next();
+            if (nextOfNextItem) {
+                parentNode.insertBefore(item, nextOfNextItem);
+            } else {
+                parentNode.appendChild(item);
+            }
+        }
+        e.halt();
+    };
+    
+    var resetDocumentOrderingModalPanelEventHandlers = function(baseNode) {
+        var documentOrderingItems = Y.Node.one("#<portlet:namespace/>documentOrderingItems");
+        documentOrderingItems.get("children").each(function(v, k) {
+            v.remove();
+        });
+        var cloned = null;
+        if (baseNode.get("tagName") == "LI") {
+            cloned = baseNode.cloneNode(true);
+        } else {
+            cloned = Y.Node.create("<LI class='expanded' nodetype='folder'></LI>");
+            cloned.appendChild(baseNode.one("A").cloneNode(true));
+            cloned.appendChild(Y.Node.one("#<portlet:namespace/>pageNavMenu").cloneNode(true));
+        }
+        cloned.replaceClass("closed", "expanded");
+        cloned.one("A").setAttribute("href", "#");
+        cloned.on("click", onDummyLinkClick);
+        var childItems = cloned.one("UL");
+        childItems.setStyle("display", "");
+        childItems.all("UL").each(function(v, k) {
+            v.remove();
+        });
+        var uplink = Y.Node.create("<A href='#' class='moveup' style='position: absolute;
left: 300px;'><img border='0' src='<%=contextPath%>/decorations/layout/images/movePortletUp.gif'/></A>");
+        var downlink = Y.Node.create("<A href='#' class='movedown' style='position: absolute;
left: 320px;'><img border='0' src='<%=contextPath%>/decorations/layout/images/movePortletDown.gif'/></A>");
+        childItems.all("LI").each(function(v, k) {
+            var link = v.one("A");
+            link.setAttribute("href", "#");
+            link.on("click", onDummyLinkClick);
+            var itemUplink = uplink.cloneNode(true);
+            var itemDownlink = downlink.cloneNode(true);
+            itemUplink.on("click", onDocumentMoveUp);
+            itemDownlink.on("click", onDocumentMoveDown); 
+            v.append(itemUplink);
+            v.append(itemDownlink);
+        });
+        documentOrderingItems.append(cloned);
+        Y.detach("click", onDocumentOrderingModalOKClick, "#<portlet:namespace/>documentOrderingModalOK");
+        Y.Node.one("#<portlet:namespace/>documentOrderingModalOK").on("click", onDocumentOrderingModalOKClick);
+        Y.detach("click", onDocumentOrderingModalCancelClick, "#<portlet:namespace/>documentOrderingModalCancel");
+        Y.Node.one("#<portlet:namespace/>documentOrderingModalCancel").on("click",
onDocumentOrderingModalCancelClick);
     };
     
     resetMenuItemEventHandlers();



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message