portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woon...@apache.org
Subject svn commit: r921520 - in /portals/jetspeed-2/applications/j2-admin/trunk/src/main: resources/org/apache/jetspeed/portlets/spaces/resources/SpacesResources.properties webapp/WEB-INF/view/spaces/page-navigator.jsp webapp/WEB-INF/view/toolbox/toolbox.jsp
Date Wed, 10 Mar 2010 19:15:01 GMT
Author: woonsan
Date: Wed Mar 10 19:15:01 2010
New Revision: 921520

URL: http://svn.apache.org/viewvc?rev=921520&view=rev
Log:
JS2-1057: Adding modal dialog for users to choose the target folder.

Modified:
    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/webapp/WEB-INF/view/spaces/page-navigator.jsp
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/toolbox/toolbox.jsp

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=921520&r1=921519&r2=921520&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
Wed Mar 10 19:15:01 2010
@@ -40,6 +40,9 @@ spaces.pages.label.copy = Copy
 spaces.pages.label.space.title = {0}
 spaces.pages.label.template = Template
 spaces.pages.label.close = Close
+spaces.pages.label.ok = OK
+spaces.pages.label.cancel = Cancel
 spaces.pages.message.confirm.delete = Are you sure to delete this item?
+spaces.pages.message.confirm.choosefolder = Choose the target folder.
 spaces.pages.message.confirm.move = Are you sure to move this item?
 spaces.pages.message.confirm.copy = Are you sure to copy this item?

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=921520&r1=921519&r2=921520&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
Wed Mar 10 19:15:01 2010
@@ -92,6 +92,47 @@ private void printMenuItem(MenuElement e
         out.write("\n");
     }
 }
+
+private void printFolderMenuItem(MenuElement element,
+                                 int depth,
+                                 int maxDepth,
+                                 javax.servlet.jsp.JspWriter out,
+                                 RenderRequest renderRequest) throws java.io.IOException
+{
+    String type = element.getElementType();
+    String nodeType = element.getManagedNode().getType();
+    boolean editable = element.isEditable();
+    String path = element.getManagedNode().getPath();
+    String title = element.getTitle(renderRequest.getLocale());
+    if (MenuElement.MENU_ELEMENT_TYPE.equals(type))
+    { 
+        out.write("<li path='" + path + "' class='closed'>");
+        out.write("<input type='radio' name='targetFolder' value='" + path + "' /><a
href='#'>" + title + "</a>");
+        out.write("\n");
+        
+        if (depth < maxDepth)
+        {
+            List<MenuElement> childElements = (List<MenuElement>) ((Menu) element).getElements();
+            
+            if (childElements != null && !childElements.isEmpty())
+            {
+                out.write("<ul style='display: none'>");
+                out.write("\n");
+                
+                for (MenuElement child : childElements)
+                {
+                    printFolderMenuItem(child, depth + 1, maxDepth, out, renderRequest);
+                }
+                
+                out.write("</ul>");
+                out.write("\n");
+            }
+        }
+        
+        out.write("</li>");
+        out.write("\n");
+    }
+}
 %>
 
 <portlet:defineObjects/>
@@ -201,111 +242,34 @@ for (MenuElement element : linkElements)
   </span>
 </span>
 
-<div id="<portlet:namespace/>folderSelectorOverlay" style="BACKGROUND-COLOR: #eee;
BORDER-LEFT: #fff solid 2px; BORDER-TOP: #fff solid 2px; BORDER-RIGHT: #aaa solid 2px; BORDER-BOTTOM:
#aaa solid 2px; DISPLAY: none; PADDING: 10px">
-  <div class="yui-widget-hd">
-    <table border="0" width="100%" cellpadding="0" cellspacing="0">
-      <tr>
-        <td><h2>Destination folder:</h2></td>
-        <td align="right"><a id="<portlet:namespace/>folderSelectorOverlayClose"
href="#"><img border="0" alt="<fmt:message key='spaces.pages.label.close'/>" src="<%=contextPath%>/decorations/images/close.gif"/></a></td>
-      </tr>
-    </table>
+<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>
+  <div id="<portlet:namespace/>modalBody">
+    <div style="WIDTH: 100%; HEIGHT: 400px; OVERFLOW: auto">
+      <form id="<portlet:namespace/>targetFolderForm">
+        <ul class="navmenu">
+<%
+for (MenuElement element : menuElements)
+{
+    printFolderMenuItem(element, 0, 6, out, renderRequest);
+}
+%>
+        </ul>
+      </form>
+    </div>
+  </div> 
+  <div id="<portlet:namespace/>modalFooter" 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'/>" />
+    </form>
   </div>
-  <div class="yui-widget-bd"></div>
-  <div class="yui-widget-ft" align="center"><a id="<portlet:namespace/>folderSelectorOverlayCloseButton"
href="#"><fmt:message key="spaces.pages.label.close"/></a></div>
 </div>
 
 <script language="javascript">
-YUI().use('jetui-portal', 'io', 'json', 'node', 'plugin', 'event-mouseenter', 'node-menunav',
'overlay', 'anim', function(Y) {
-    
-    var folderSelectorOverlay = null;
-    
-    function AnimPlugin(config) {
-        AnimPlugin.superclass.constructor.apply(this, arguments);
-    }
-    
-    AnimPlugin.NS = "fx";
-    AnimPlugin.NAME = "animPlugin";
-    AnimPlugin.ATTRS = {
-        duration : { value: 0.1 },
-        animVisible : {
-            valueFn : function() {
-                var host = this.get("host");
-                var boundingBox = host.get("boundingBox");
-                var anim = new Y.Anim({
-                    node: boundingBox,
-                    to: { opacity: 1 },
-                    duration: this.get("duration")
-                });
-                if (!host.get("visible")) {
-                    boundingBox.setStyle("opacity", 0);
-                }
-                anim.on("destroy", function() {
-                    if (Y.UA.ie) {
-                        this.get("node").setStyle("opacity", 1);
-                    } else {
-                        this.get("node").setStyle("opacity", "");
-                    }
-                });
-                return anim;
-            }
-        },
-        animHidden : {
-            valueFn : function() {
-                return new Y.Anim({
-                    node: this.get("host").get("boundingBox"),
-                    to: { opacity: 0 },
-                    duration: this.get("duration")
-                });
-            }
-        }
-    }
-    
-    Y.extend(AnimPlugin, Y.Plugin.Base, {
-        initializer : function(config) {
-            this._bindAnimVisible();
-            this._bindAnimHidden();
-            this.after("animVisibleChange", this._bindAnimVisible);
-            this.after("animHiddenChange", this._bindAnimHidden);
-            this.doBefore("_uiSetVisible", this._uiAnimSetVisible);
-        },
-        destructor : function() {
-            this.get("animVisible").destroy();
-            this.get("animHidden").destroy();
-        },
-        _uiAnimSetVisible : function(val) {
-            if (this.get("host").get("rendered")) {
-                if (val) {
-                    this.get("animHidden").stop();
-                    this.get("animVisible").run();
-                } else {
-                    this.get("animVisible").stop();
-                    this.get("animHidden").run();
-                }
-                return new Y.Do.Prevent("AnimPlugin prevented default show/hide");
-            }
-        },
-        _uiSetVisible : function(val) {
-            var host = this.get("host");
-            var hiddenClass = host.getClassName("hidden");
-            if (!val) {
-                host.get("boundingBox").addClass(hiddenClass);
-            } else {
-                host.get("boundingBox").removeClass(hiddenClass);
-            }
-        },
-        _bindAnimVisible : function() {
-            var animVisible = this.get("animVisible");
-            animVisible.on("start", Y.bind(function() {
-                this._uiSetVisible(true);
-            }, this));
-        },
-        _bindAnimHidden : function() {
-            var animHidden = this.get("animHidden");
-            animHidden.after("end", Y.bind(function() {
-                this._uiSetVisible(false);
-            }, this));
-        }
-    });
+YUI().use('jetui-portal', 'io', 'json', 'node', 'plugin', 'event-mouseenter', 'node-menunav',
function(Y) {
     
     var onMenuItemClick = function(e) {
         var a = e.target;
@@ -367,10 +331,6 @@ YUI().use('jetui-portal', 'io', 'json', 
         if (titleElem && title) {
             titleElem.set("text", title);
         }
-        if (nodePopupMenu == null) {
-            nodePopupMenu = Y.Node.one("#<portlet:namespace/>nodePopupMenu");
-        }        
-        nodePopupMenu.setStyle("display", "none");
     };
     
     var onRenameClick = function(e) {
@@ -399,10 +359,6 @@ YUI().use('jetui-portal', 'io', 'json', 
         if (listItem) {
             listItem.remove();
         }
-        if (nodePopupMenu == null) {
-            nodePopupMenu = Y.Node.one("#<portlet:namespace/>nodePopupMenu");
-        }        
-        nodePopupMenu.setStyle("display", "none");        
     };
     
     var onDeleteClick = function(e) {
@@ -423,37 +379,90 @@ YUI().use('jetui-portal', 'io', 'json', 
         }
         e.halt();
     };
+
+    var onModalCancelClick = function(e) {
+        var portal = (JETUI_YUI ? JETUI_YUI.getPortalInstance() : null);
+        if (portal) {
+            portal.hideModalPanel();
+        }
+        e.halt();
+    };
+
+    var onMoveComplete = function(id, o, args) {
+        var listItem = args.complete[0];
+        if (listItem) {
+            listItem.remove();
+        }
+    };
+    
+    var onCopyComplete = function(id, o, args) {
+        var listItem = args.complete[0];
+    };
+    
+    var currentFolderChoosingMode = "move";
+    
+    var onModalOKClick = function(e) {
+        var form = Y.Node.one("#<portlet:namespace/>targetFolderForm");
+        var target = null;
+        form.all("INPUT").each(function(v, k) {
+            if (v.get("checked")) {
+                target = v.get("value");
+            }
+        });
+        
+        if (target) {
+            if (currentFolderChoosingMode == "move") {
+                var cf = confirm("<fmt:message key='spaces.pages.message.confirm.move'/>");
+                if (cf) {
+                    var path = curNodeListItem.getAttribute("path");
+                    var nodeType = curNodeListItem.getAttribute("nodeType");
+                    var uri = "<%=contextPath%>/services/pagemanagement/move/" + nodeType
+ path + "?_type=json";
+                    var config = {
+                            on: { complete: onMoveComplete },
+                            method: "POST",
+                            data: "deep=true&merge=true&target=" + target,
+                            arguments: { complete: [ curNodeListItem ] }
+                        };
+                    var request = Y.io(uri, config);
+                }
+            } else if (currentFolderChoosingMode == "copy") {
+                var cf = confirm("<fmt:message key='spaces.pages.message.confirm.copy'/>");
+                if (cf) {
+                    var path = curNodeListItem.getAttribute("path");
+                    var nodeType = curNodeListItem.getAttribute("nodeType");
+                    var uri = "<%=contextPath%>/services/pagemanagement/copy/" + nodeType
+ path + "?_type=json";
+                    var config = {
+                            on: { complete: onCopyComplete },
+                            method: "POST",
+                            data: "deep=true&merge=true&target=" + target,
+                            arguments: { complete: [ curNodeListItem ] }
+                        };
+                    var request = Y.io(uri, config);
+                }
+            }
+        }
+        
+        var portal = (JETUI_YUI ? JETUI_YUI.getPortalInstance() : null);
+        if (portal) {
+            portal.hideModalPanel();
+        }
+        e.halt();
+    };
     
     var onMoveClick = function(e) {
         if (!curNodeListItem) {
             return;
         }
-        /*
-        var point = [ e.pageX, e.pageY ];
-        var windowWidth = window.innerWidth;
-        var windowHeight = window.innerHeight;
-        
-        if (!folderSelectorOverlay) {
-            Y.Node.getDOMNode(Y.Node.one("#<portlet:namespace/>folderSelectorOverlay")).style.display
= "";
-            folderSelectorOverlay = new Y.Overlay({
-                contentBox: "#<portlet:namespace/>folderSelectorOverlay",
-                xy: [windowWidth, windowHeight],
-                visible: false,
-                plugins : [{fn:AnimPlugin, cfg:{duration:0.1}}]
-            });
-        }
-
-        var inheritDecoName = "<%=theme.getPageLayoutDecoration().getName()%>";
-        folderSelectorOverlay.set("bodyContent", "hello, world!");
-        folderSelectorOverlay.set("zIndex", 16777271);
+        var modalFeatures = {
+            "width": 400,
+            "height": 500,
+            "addClasses": ["layout-<%=theme.getPageLayoutDecoration().getName()%>"]
+        };
         var portal = (JETUI_YUI ? JETUI_YUI.getPortalInstance() : null);
         if (portal) {
-            portal.setScreenMask(true);
+            currentFolderChoosingMode = "move";
+            portal.showModalPanel("#<portlet:namespace/>modalHeader", "#<portlet:namespace/>modalBody",
"#<portlet:namespace/>modalFooter", modalFeatures);
         }
-        folderSelectorOverlay.render();
-        folderSelectorOverlay.move(point);
-        folderSelectorOverlay.show();
-        */
         e.halt();
     };
     
@@ -461,22 +470,28 @@ YUI().use('jetui-portal', 'io', 'json', 
         if (!curNodeListItem) {
             return;
         }
-        e.halt();
-    };
-
-    var closeFolderSelectorOverlay = function(e) {
-        folderSelectorOverlay.hide();
+        var modalFeatures = {
+            "width": 400,
+            "height": 500,
+            "addClasses": ["layout-<%=theme.getPageLayoutDecoration().getName()%>"]
+        };
         var portal = (JETUI_YUI ? JETUI_YUI.getPortalInstance() : null);
         if (portal) {
-            portal.setScreenMask(false);
+            currentFolderChoosingMode = "copy";
+            portal.showModalPanel("#<portlet:namespace/>modalHeader", "#<portlet:namespace/>modalBody",
"#<portlet:namespace/>modalFooter", modalFeatures);
         }
         e.halt();
     };
-    
+
     var pageNavMenu = Y.Node.one("#<portlet:namespace/>pageNavMenu");
     pageNavMenu.all("A").each(function(v, k) {
         v.on("click", onMenuItemClick);
     });
+
+    var targetFolders = Y.Node.one("#<portlet:namespace/>modalBody").one("UL");
+    targetFolders.all("A").each(function(v, k) {
+        v.on("click", onMenuItemClick);
+    });
     
     <c:if test="${pageEditable}">
     pageNavMenu.all("LI").each(function(v, k) {
@@ -502,12 +517,12 @@ YUI().use('jetui-portal', 'io', 'json', 
     
     var nodePopupMenu = Y.one("#<portlet:namespace/>nodePopupMenu");
     nodePopupMenu.plug(Y.Plugin.NodeMenuNav, { autoSubmenuDisplay: false, mouseOutHideDelay:
0 });
-
+    
     Y.Node.one("#<portlet:namespace/>nodePopupMenu_rename").on("click", onRenameClick);
     Y.Node.one("#<portlet:namespace/>nodePopupMenu_delete").on("click", onDeleteClick);
     Y.Node.one("#<portlet:namespace/>nodePopupMenu_move").on("click", onMoveClick);
     Y.Node.one("#<portlet:namespace/>nodePopupMenu_copy").on("click", onCopyClick);
-    Y.Node.one("#<portlet:namespace/>folderSelectorOverlayClose").on("click", closeFolderSelectorOverlay);
-    Y.Node.one("#<portlet:namespace/>folderSelectorOverlayCloseButton").on("click",
closeFolderSelectorOverlay);
+    Y.Node.one("#<portlet:namespace/>modalOK").on("click", onModalOKClick);
+    Y.Node.one("#<portlet:namespace/>modalCancel").on("click", onModalCancelClick);
 });
 </script>

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/toolbox/toolbox.jsp
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/toolbox/toolbox.jsp?rev=921520&r1=921519&r2=921520&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/toolbox/toolbox.jsp
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/toolbox/toolbox.jsp
Wed Mar 10 19:15:01 2010
@@ -172,7 +172,7 @@ limitations under the License.
 <div id="<portlet:namespace/>previewOverlay" style="BACKGROUND-COLOR: #eee; BORDER-LEFT:
#fff solid 2px; BORDER-TOP: #fff solid 2px; BORDER-RIGHT: #aaa solid 2px; BORDER-BOTTOM: #aaa
solid 2px; DISPLAY: none; PADDING: 5px">
     <div class="yui-widget-hd"><h2><fmt:message key="toolbox.label.preview"/></h2></div>
 	<div class="yui-widget-bd"></div>
-    <div class="yui-widget-ft" align="right"><a id="<portlet:namespace/>previewOverlayClose"
href="#"><fmt:message key="toolbox.label.close"/></a></div>
+    <div class="yui-widget-ft" align="center"><a id="<portlet:namespace/>previewOverlayClose"
href="#"><fmt:message key="toolbox.label.close"/></a></div>
 </div>
 
 <script language="javascript">



---------------------------------------------------------------------
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