Author: woonsan
Date: Thu Mar 18 14:47:13 2010
New Revision: 924839

URL: http://svn.apache.org/viewvc?rev=924839&view=rev
Log:
JS2-1131: Fixing the problem: "Deleting the current page leaves things in a 
kind of unknown status."
When the current page is deleted, it redirects to the parent folder url.
Also, changes to not display "Delete" submenu when there is only one page in a 
folder because a folder is displayed only when it has at least one page.

Modified:
    
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/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=924839&r1=924838&r2=924839&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
 Thu Mar 18 14:47:13 2010
@@ -58,6 +58,7 @@ private void printMenuItem(MenuElement e
     
     if (MenuElement.MENU_ELEMENT_TYPE.equals(type))
     {
+        String url = ((Menu) element).getUrl();
         boolean reservedFolder = ((Folder) 
element.getManagedNode()).isReserved();
         if (reservedFolder)
         {
@@ -70,7 +71,7 @@ private void printMenuItem(MenuElement e
             styleClass = "active expanded";
         }
         out.write("<li type='" + type + "' nodeType='" + nodeType + "' 
editable='" + editable + "' path='" + path + "' class='" + styleClass + "'>\n");
-        out.write("<a href='#'>" + title + "</a>\n");
+        out.write("<a href='" + pageNavigator.getAbsoluteUrl(url, 
renderResponse, rc) + "'>" + title + "</a>\n");
         
         if (depth < maxDepth)
         {
@@ -129,7 +130,7 @@ 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="#"><fmt:message 
key="spaces.pages.label.space.title"><fmt:param 
value="${space.title}"/></fmt:message></a></h3>
+      <h3><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)
@@ -207,9 +208,9 @@ for (MenuElement element : linkElements)
             <div class="yui-menu-content">
               <ul>
                 <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_delete" class="yui-menuitem-content" 
href="#"><fmt:message key='spaces.pages.label.delete'/></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_changeUrl" class="yui-menuitem-content" 
href="#"><fmt:message key='spaces.pages.label.changeUrl'/></a></li>
@@ -285,6 +286,7 @@ YUI().use('jetui-portal', 'io', 'json', 
         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();
@@ -344,7 +346,19 @@ YUI().use('jetui-portal', 'io', 'json', 
     var onDeleteComplete = function(id, o, args) {
         var listItem = args.complete[0];
         if (listItem) {
+            var redirectLocation = null;
+            var nodeType = listItem.getAttribute("nodeType");
+            if (listItem.hasClass("active") && ".psml" == nodeType) {
+                var href = listItem.one("A").get("href");
+                redirectLocation = href.substring(0, href.lastIndexOf('/'));
+            } 
             listItem.remove();
+            if (nodePopupMenu) {
+                nodePopupMenu.setStyle("display", "none");
+            }
+            if (redirectLocation) {
+                location.href = redirectLocation;
+            }
         }
     };
     
@@ -380,6 +394,9 @@ YUI().use('jetui-portal', 'io', 'json', 
         if (listItem) {
             onCopyComplete(id, o, args);
             listItem.remove();
+            if (nodePopupMenu) {
+                nodePopupMenu.setStyle("display", "none");
+            }
             resetMenuItemEventHandlers();
         }
     };



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to