portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r894724 - in /portals/jetspeed-2/portal/trunk: applications/jetspeed/src/main/webapp/WEB-INF/jetui/yui/ applications/jetspeed/src/main/webapp/WEB-INF/pages/ applications/jetspeed/src/main/webapp/javascript/jetspeed/jetui/ applications/jetsp...
Date Wed, 30 Dec 2009 22:24:45 GMT
Author: taylor
Date: Wed Dec 30 22:24:44 2009
New Revision: 894724

URL: http://svn.apache.org/viewvc?rev=894724&view=rev
Log:
JS2-1084
refactoring jetui to remove all hard-coded toolbars. added apis to jetui to generically retrieve
toolbars
added additional metadata to portlets and layouts to represent "tools" and "toolbars"
renamed drop groups to easier to understandable names "grid", "detached", "toolbars"
continuing detach mode implementation....

Added:
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/ui/Toolbar.java
  (with props)
Modified:
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/jetui/yui/jetui.jsp
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/pages/template.tpsml
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/javascript/jetspeed/jetui/jetui-portal.js
    portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/jetui/engine/portal.js
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/ui/Jetui.java
    portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/conf/jetspeed/jetspeed.properties

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/jetui/yui/jetui.jsp
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/jetui/yui/jetui.jsp?rev=894724&r1=894723&r2=894724&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/jetui/yui/jetui.jsp
(original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/jetui/yui/jetui.jsp
Wed Dec 30 22:24:44 2009
@@ -20,6 +20,7 @@
 <%@ page import="java.util.List" %>
 <%@ page import="java.util.Map" %>
 <%@ page import="org.apache.jetspeed.ui.Jetui" %>
+<%@ page import="org.apache.jetspeed.ui.Toolbar" %>
 <%@ page import="org.apache.jetspeed.request.RequestContext" %>
 <%@ page import="org.apache.jetspeed.om.page.ContentFragment" %>
 <%@ page import="org.apache.jetspeed.om.page.ContentPage" %>
@@ -38,28 +39,9 @@
   ContentPage portalPage = rc.getPage();
   ContentFragment maximized = (ContentFragment)request.getAttribute(PortalReservedParameters.MAXIMIZED_FRAGMENT_ATTRIBUTE);
   ColumnLayout columnLayout = (ColumnLayout)request.getAttribute("columnLayout");
-  
-  String navContent = null;
-  String tbContent = null;
-  
-  ContentFragment pageNav = jetui.getContentFragment("jsPageNavigator",  rc);
-  ContentFragment toolbox = jetui.getContentFragment("jsToolbox",  rc);
   ContentFragment jstbLeft = jetui.getContentFragment("jstbLeft",  rc);
-  ContentFragment jstbRight = jetui.getContentFragment("jstbRight",  rc);
-  
-  if (maximized != null)
-  {
-      navContent = jetui.renderPortletWindow(pageNav.getId(), pageNav.getName(), rc);
-      tbContent = jetui.renderPortletWindow(toolbox.getId(), pageNav.getName(), rc);
-  }
-  else
-  {
-      navContent = jetui.getRenderedContent(pageNav, rc);
-      tbContent = jetui.getRenderedContent(toolbox, rc);
-  }
-  
+  ContentFragment jstbRight = jetui.getContentFragment("jstbRight",  rc);   
   String breadcrumbs = jetui.renderPortletWindow("jsBreadcrumbMenu", "j2-admin::BreadcrumbMenu",
rc);
-  
   String encoding = "text/html"; 
   if (response.getCharacterEncoding() != null)
   {
@@ -74,22 +56,29 @@
   if (portalPagePath == null || "".equals(portalPagePath)) {
       portalPagePath = "/";
   }
-  String leftState = jstbLeft.getState();
+  // Toolbars
+  Toolbar ltb = jetui.getToolbar(rc, Toolbar.Orientation.LEFT);  
+  Toolbar rtb = jetui.getToolbar(rc, Toolbar.Orientation.RIGHT);
   String leftDisplayState = "display: block";
   String leftToggleClass = "jstbToggle1";
-  if (leftState != null && leftState.equals("closed"))
+  String rightDisplayState = "display: block";
+  String rightToggleClass = "jstbToggle2"; 
+  if (ltb != null)
   {
+  	if (ltb.isClosed())
+  	{
       leftDisplayState = "display: none";
       leftToggleClass = "jstbToggle2";
+  	}
   }
-  String rightState = jstbRight.getState();
-  String rightDisplayState = "display: block";
-  String rightToggleClass = "jstbToggle2";
-  if (rightState != null && rightState.equals("closed"))
-  {
+  if (rtb != null)
+  {  
+  	if (rtb.isClosed())
+  	{
       rightDisplayState = "display: none";
       rightToggleClass = "jstbToggle1";
-  }
+  	}
+  }  
 %>
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 <html>
@@ -142,7 +131,7 @@
 <div class="header">
 <h1 class="logo">Jetspeed 2</h1>
 <div class="menu">
-&nbsp;<span style='position: absolute; left: 0px; top: 42px;' id='jstbLeftToggle'
class='<%=leftToggleClass%>'></span><span id='jstbRightToggle' class='<%=rightToggleClass%>'
style='position: absolute; right: 0px; top: 42px;'></span>
+&nbsp;<% if (ltb != null) { %><span style='position: absolute; left: 0px; top:
42px;' id='jstbLeftToggle' class='<%=leftToggleClass%>'></span><% } if (rtb
!= null) { %><span id='jstbRightToggle' class='<%=rightToggleClass%>' style='position:
absolute; right: 0px; top: 42px;'></span><% } %>
 </div>
 <%if (request.getUserPrincipal() != null) {%>
 <span class="layout-statusarea"><b><%=userInfo.get("user.name.given")%>
<%=userInfo.get("user.name.family")%></b> | Profile | Tasks (5) | Notifications
(2) | <a href="<%=request.getContextPath()%>/login/logout?org.apache.jetspeed.login.destination=<%=request.getContextPath()%>/ui">Log
out</a></span>
@@ -154,19 +143,43 @@
 <table cellpadding="0" cellspacing="0" border="0" width="100%" id="main">
 <tr>         
 <td>
-<div id='jstbLeft' class='jsLeftToolbar' style='<%=leftDisplayState%>'>
-<div id='template-top2.jsPageNavigator' class='xportal-layout-cell'>
-<div id="jsNavigator2" class="portlet <%=pageDec%>">
+<%
+if (ltb != null)
+{
+%>
+<div id='<%=ltb.getId()%>' class='<%=ltb.getCssClass()%>' style='<%=leftDisplayState%>'>
+<%
+  for (ContentFragment tool : ltb.getTools())
+  {
+      String decorator = tool.getDecorator(); 
+      if (decorator == null)
+  		    decorator = pageDec;
+      String navContent;
+      if (maximized != null)
+          navContent = jetui.renderPortletWindow(tool.getId(), tool.getName(), rc);
+      else
+          navContent = jetui.getRenderedContent(tool, rc);
+      String title = "";      
+      boolean showTitle = tool.getDecoration().getTitleOption() == Decoration.TitleOption.SHOW;
  
+      if (showTitle && tool.getPortletContent() != null)
+          title = tool.getPortletContent().getTitle();      
+%>
+<div id='<%=tool.getId()%>' class='portal-toolbar-cell' detached='false' locked='<%=tool.isLocked()%>'
name='<%=tool.getName()%>' tool='true'>
+<div class="portlet <%=decorator%>">
     <div class="PTitle" >
-      <div class="PTitleContent">Navigator</div>
+      <div class="PTitleContent"><%=title%></div>
     </div>
     <div class="PContentBorder">
-      <div class="PContent"><div id="nav-main"><%=navContent %></div></div>
+      <div class="PContent"><div id="nav-main"><%=navContent%></div></div>
     </div>
-<!--   <a class="addthis_button" href="http://www.addthis.com/bookmark.php?v=250&amp;pub=xa-4b0265f81058c137"><img
src="http://s7.addthis.com/static/btn/sm-share-en.gif" width="83" height="16" alt="Bookmark
and Share" style="border:0"/></a><script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pub=xa-4b0265f81058c137"></script>
-->
+<!--  TODO: make this a portlet <a class="addthis_button" href="http://www.addthis.com/bookmark.php?v=250&amp;pub=xa-4b0265f81058c137"><img
src="http://s7.addthis.com/static/btn/sm-share-en.gif" width="83" height="16" alt="Bookmark
and Share" style="border:0"/></a><script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pub=xa-4b0265f81058c137"></script>
-->
 </div>
 </div>
+<% } %>
 </div>
+<% 
+} // endif ltb
+%>
 </td>
 <td id='jsMainarea' class='jsMainarea'>
 <div class="PContent"><span style="line-height:0.005px;">&nbsp;</span><%=breadcrumbs%></div>
@@ -237,18 +250,42 @@
 </div>
 </td>
 <td>
-<div id='jstbRight' class='jsRightToolbar' style='<%=rightDisplayState%>'>
-<div id='jsToolbox' class='xportal-layout-cell'>
-<div id="jsToolbox2" class="portlet <%=pageDec%>">
+<%
+if (rtb != null)
+{
+%>
+<div id='<%=rtb.getId()%>' class='<%=rtb.getCssClass()%>' style='<%=rightDisplayState%>'>
+<%
+  for (ContentFragment tool : rtb.getTools())
+  {
+      String decorator = tool.getDecorator(); 
+      if (decorator == null)
+  		    decorator = pageDec;            
+      String tbContent;
+      if (maximized != null)
+          tbContent = jetui.renderPortletWindow(tool.getId(), tool.getName(), rc);
+      else
+          tbContent = jetui.getRenderedContent(tool, rc);
+      String title = "";      
+      boolean showTitle = tool.getDecoration().getTitleOption() == Decoration.TitleOption.SHOW;
  
+      if (showTitle && tool.getPortletContent() != null)
+          title = tool.getPortletContent().getTitle();      
+%>
+<div id='<%=tool.getId()%>' class='portal-toolbar-cell' detached='false' locked='<%=tool.isLocked()%>'
name='<%=tool.getName()%>' tool='true'>
+<div class="portlet <%=decorator%>">
     <div class="PTitle" >
-      <div class="PTitleContent">Toolbox</div>
+      <div class="PTitleContent"><%=title%></div>
     </div>
     <div class="PContentBorder">
-      <div class="PContent"><%=tbContent %></div>
+      <div class="PContent"><%=tbContent%></div>
     </div>
 </div>
-</div> 
 </div>
+<% } %>
+</div>
+<% 
+} // endif rtb
+%>
 </td>
 </tr>
 </table>

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/pages/template.tpsml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/pages/template.tpsml?rev=894724&r1=894723&r2=894724&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/pages/template.tpsml
(original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/WEB-INF/pages/template.tpsml
Wed Dec 30 22:24:44 2009
@@ -17,11 +17,14 @@
    <fragment id="jstbLeft" type="layout" name="jetspeed-layouts::VelocityOneColumn">
         <property name="row" value="0"></property>
         <property name="column" value="0"></property>
-	    <property name="state" value="normal"></property>                      
         
+	    <property name="state" value="normal"></property>
+	    <property name='toolbar' value='true'></property>                      
         
+	    <property name='class' value='jsLeftToolbar'></property>               
                
 	    <fragment id="jsPageNavigator" type="portlet" name="j2-admin::PageNavigator">
 	  	        <property name="row" value="0"></property>
 	            <property name="column" value="0"></property>
-	            <property name="state" value="leftdock"></property>            
           
+	            <property name="state" value="leftdock"></property>
+	            <property name="tool" value="true"></property>                 
      
 	    </fragment>
 	</fragment>
     
@@ -34,10 +37,13 @@
         <property name="row" value="0"></property>
         <property name="column" value="2"></property>    
 	    <property name="state" value="normal"></property>                      
         
+	    <property name='toolbar' value='true'></property>
+	    <property name='class' value='jsRightToolbar'></property>              
                 
 	    <fragment id="jsToolbox" type="portlet" name="j2-admin::JetspeedToolbox">
 	            <property name="row" value="0"></property>
 	            <property name="column" value="0"></property>
 	            <property name="state" value="rightdock"></property>           
            
+	            <property name="tool" value="true"></property>                 
      
 	    </fragment>
    </fragment>
     

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/javascript/jetspeed/jetui/jetui-portal.js
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/javascript/jetspeed/jetui/jetui-portal.js?rev=894724&r1=894723&r2=894724&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/javascript/jetspeed/jetui/jetui-portal.js
(original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/javascript/jetspeed/jetui/jetui-portal.js
Wed Dec 30 22:24:44 2009
@@ -163,6 +163,12 @@
         destructor : function(cfg) { 
         },
         
+        booleanValue : function(s) {
+            if (s == null)
+            	return false;
+            return (s == "" || s.toLowerCase() == "false") ? false : true;          
+        },        
+        
         /**
          * Toggles toolbar
          * 
@@ -211,7 +217,7 @@
                 //node.plug(Y.Plugin.Drag);
                 var drop = new Y.DD.Drop({
                 node: dragParent,
-                groups: ['portlets']            
+                groups: ['grid']            
                 });
             }
             // BOZO: im manipulating internal DD structures, should find a way to detach
the handler
@@ -269,7 +275,7 @@
             if (dragParent.get('children').size() == 0) {
                 var drop = new Y.DD.Drop({
                     node: dragParent,
-                    groups: ['portlets']            
+                    groups: ['grid']            
                 });
             }                           
         },
@@ -302,10 +308,10 @@
                 window.setStyle('top', '10px');
                 window.setStyle('left', '10px');
             	window.data.set('detached', true);
-            	window.data.set("toolbar", true);
+            	window.data.set("tool", false);
             	var drag = Y.DD.DDM.getDrag(window);
-            	drag.removeFromGroup("portals");
-            	drag.addToGroup("toolbars");
+            	drag.removeFromGroup("grid");
+            	drag.addToGroup("detached");
             	drag.set('dragMode', 'point');
             	var drop = Y.DD.DDM.getDrop(window);
             	var i = 0;
@@ -321,7 +327,7 @@
     			{
                     var drop = new Y.DD.Drop({
                         node: dragParent,
-                        groups: ['portlets']            
+                        groups: ['grid']            
                     });
     			}                
             }            
@@ -330,14 +336,12 @@
         onMoveComplete : function(id, o, args) { 
             var id = id; // Transaction ID. 
             var data = o.responseText; // Response data.
-            Y.log("move result = " + data);
             var windowId = args.complete[0];
         },             
 
         onStateComplete : function(id, o, args) { 
             var id = id; // Transaction ID. 
             var data = o.responseText; // Response data.
-            Y.log("move result = " + data);
             var windowId = args.complete[0];
         },             
         
@@ -347,7 +351,7 @@
         movePortlet : function(drag, e) {
             var portal = JETUI_YUI.getPortalInstance();        	
             var windowId =  drag.getAttribute('id');
-            if (drag.data.get("toolbar") == false) {
+            if (drag.data.get("detached") == false) {
             	var oldColumn = drag.data.get('column');
             	var oldRow = drag.data.get('row');        	
         		var dragParent = drag.get('parentNode');
@@ -380,6 +384,7 @@
                     };
                 var request = Y.io(uri, config);
             }        	
+            // TODO: handle toolbar moves
         },
                 
         reallocateColumn : function(column) {
@@ -414,7 +419,7 @@
                 {
                     var drop = new Y.DD.Drop({
                         node: parent,
-                        groups: ['portlets']            
+                        groups: ['grid']            
                     });
                 }
             }
@@ -558,10 +563,10 @@
             v.setAttribute("column", fragment.properties.column);
             
             var portlet = Y.JetUI.Portlet.attach(v);
-            var dragGroups = ['portlets'];
+            var dragGroups = ['grid'];
             var dragMode = 'intersect';
-            var dropGroups  = ['portlets', 'toolbars'];
-            if (portlet.get("toolbar") == false) {
+            var dropGroups  = ['grid'];
+            if (portlet.get("detached") == false) {
                 var ddNav = new Y.DD.Drag({
                     node: v,
                     groups: dragGroups,
@@ -624,8 +629,9 @@
         ATTRS: {
             "name" : { value: "undefined" }, 
             "id" : { value: "0" },
-            "toolbar" : { value : false },
+            "tool" : { value : false },
             "detached" : { value : false },
+            "locked" : { value : false },
             "column" : { value : 0 },
             "row" : { value : 0 },
             "x" : { value : 0 },
@@ -659,24 +665,30 @@
         info : function() {
             Y.log("name: " + this.get("name"));
             Y.log("id  : " + this.get("id"));       
-            Y.log("toolbar  : " + this.get("toolbar"));     
+            Y.log("tool  : " + this.get("tool"));     
             Y.log("detached  : " + this.get("detached"));     
+            Y.log("locked  : " + this.get("locked"));     
             Y.log("col, row  : " + this.get("column") + "," + this.get("row"));     
             Y.log("x, y  : " + this.get("x") + "," + this.get("y"));     
             Y.log("---------");
         }
     });
-    
+
     /**
      * Create a portlet window and attach the portlet window to the sepcified node.
      * @method attach
      */
     Y.JetUI.Portlet.attach = function(node) {
+        var portal = JETUI_YUI.getPortalInstance();        	    	
         var portlet = new Y.JetUI.Portlet();
         portlet.set("name", node.getAttribute("name"));
         portlet.set("id", node.getAttribute("id"));
-        portlet.set("toolbar", Boolean(node.getAttribute("locked").toLowerCase() === 'true'
|| node.getAttribute("detached").toLowerCase() === 'true'));
-        portlet.set("detached", Boolean(node.getAttribute("detached").toLowerCase() === 'true'));
+        var tool = portal.booleanValue(node.getAttribute("tool"));
+        portlet.set("tool", tool);
+        var detached = portal.booleanValue(node.getAttribute("detached"));
+        portlet.set("detached", detached);
+        var locked = portal.booleanValue(node.getAttribute("locked"));
+        portlet.set("locked", locked);
         portlet.set("column", node.getAttribute("column"));
         portlet.set("row", node.getAttribute("row"));
         portlet.set("x", node.getAttribute("x"));
@@ -721,8 +733,9 @@
             "name" : { value: "undefined" }, 
             "id" : { value: "0" },
             "nested" : { value : false },
-            "column" : { value : 0 },
             "locked" : { value : false },
+            "toolbar" : { value : false },
+            "column" : { value : 0 },
             "row" : { value : 0 }
         }
     });
@@ -755,6 +768,7 @@
             Y.log("id  : " + this.get("id"));       
             Y.log("nested  : " + this.get("nested"));       
             Y.log("locked  : " + this.get("locked"));       
+            Y.log("toolbar  : " + this.get("toolbar"));       
             Y.log("col, row  : " + this.get("column") + "," + this.get("row"));     
             Y.log("---------");
         }
@@ -765,13 +779,15 @@
      * @method attach
      */
     Y.JetUI.Layout.attach = function(node) {
-        var layout = new Y.JetUI.Layout();
+        var portal = JETUI_YUI.getPortalInstance();        	    	
+    	var layout = new Y.JetUI.Layout();
         layout.set("name", node.getAttribute("name"));
         layout.set("id", node.getAttribute("id"));
         layout.set("nested", false);
-        var locked = node.getAttribute("locked");
-        locked = (locked == null || locked == "false") ? false : true;          
+        var locked = portal.booleanValue(node.getAttribute("locked"));
         layout.set("locked", locked);
+        var toolbar = portal.booleanValue(node.getAttribute("toolbar"));
+        layout.set("toolbar", toolbar);
         layout.set("column", node.getAttribute("column"));        
         layout.set("row", 0);
         node.data = layout;

Modified: portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/jetui/engine/portal.js
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/jetui/engine/portal.js?rev=894724&r1=894723&r2=894724&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/jetui/engine/portal.js
(original)
+++ portals/jetspeed-2/portal/trunk/applications/jetspeed/src/main/webapp/jetui/engine/portal.js
Wed Dec 30 22:24:44 2009
@@ -4,20 +4,6 @@
     var portal = JETUI_YUI.getPortalInstance();
 	var config = JETUI_YUI.config;
     Y.log("Starting up JETUI " +  config.engine + " engine...");        
-    //if (config.engine == Y.JetUI.Portal.CSRE)
-    	
-    ////////////////////////////////////////////////////    
-    // Create Navigator Portlet
-    var navigator = new Y.JetUI.Portlet();
-    navigator.set("name", "j2-admin::PageNavigator");
-    navigator.set("id", "_PageNavigator");
-    navigator.set("toolbar", true);
-    navigator.set("detached", false);
-    var toolbox = new Y.JetUI.Portlet();
-    toolbox.set("name", "j2-admin::JetspeedToolbox");
-    toolbox.set("id", "_JetspeedToolbox");
-    toolbox.set("toolbar", true);
-    toolbox.set("detached", false);
     
     ////////////////////////////////////////////////////    
     // setup toolbar docking area and togglers    
@@ -61,39 +47,13 @@
     }
     ////////////////////////////////////////////////////       
     // drag and drop
-    var nav = Y.one("[id='template-top2.jsPageNavigator']"); 
-    if (!Y.Lang.isNull(nav)) {
-	    nav.data = navigator;
-	    var ddNav = new Y.DD.Drag({
-	        node: nav,
-	        groups: ['toolbars'],
-	        dragMode: 'point'                
-	    }).plug(Y.Plugin.DDProxy, { 
-	      	 moveOnEnd: false         	    	
-	    });    
-	    ddNav.addHandle(config.dragHandleStyle);
-	    nav.on('click', onClickToolbar);
-    }    
     var jetspeedZone = Y.one('#jetspeedZone');
     if (!Y.Lang.isNull(jetspeedZone)) {   
 	    var jzDrop = new Y.DD.Drop({
 	        node: jetspeedZone,
-	        groups: ['toolbars']        
+	        groups: ['detached']        
 	    });
     }    
-    var tb = Y.one('#jsToolbox');
-    if (!Y.Lang.isNull(tb)) {    
-	    tb.data = toolbox;
-	    var ddToolbox = new Y.DD.Drag({
-	        node: tb,
-	        groups: ['toolbars'],                 
-	        dragMode: 'point'        
-	    }).plug(Y.Plugin.DDProxy, { 
-	      	 moveOnEnd: false         	    	
-	    });    
-	    ddToolbox.addHandle(config.dragHandleStyle); 
-	    tb.on('click', onClickToolbar);
-    }
     var jstbLeft = Y.one('#jstbLeft');
     if (!Y.Lang.isNull(jstbLeft)) {    
 	    var drop = new Y.DD.Drop({
@@ -110,43 +70,44 @@
     }
 	var draggablePortlets = Y.Node.all(config.portletStyle);    
     draggablePortlets.each(function(v, k) {
-        var portlet = Y.JetUI.Portlet.attach(v);
-    	//Y.log("portlet = " + v.getAttribute("name") + v.getAttribute("id") + "locked = " +
v.getAttribute("locked"));
-        var dragGroups = ['portlets'];
-        var dragMode = 'intersect';
-        var dropGroups  = ['portlets', 'toolbars'];
-        if (portlet.get("toolbar") == true || portlet.get("detached") == true) {
-	        dragGroups = ['toolbars'],	        
-	        dragMode = 'point';
-	        dropGroups = [];
-        }        
-        var ddNav = new Y.DD.Drag({
-            node: v,
-            groups: dragGroups,
-            dragMode: dragMode                    
-        }).plug(Y.Plugin.DDProxy, { 
-          	 moveOnEnd: false         	    	
-        });    
-        ddNav.addHandle(config.dragHandleStyle);
-    	var drop = new Y.DD.Drop({
-            node: v,
-            groups: dropGroups            
-        });
-    	// portlet.info();
+    	if (v.getAttribute("id") != "jsPortletTemplate")
+    	{
+	        var portlet = Y.JetUI.Portlet.attach(v);
+	        var dragGroups = ['grid'];
+	        var dragMode = 'intersect';
+	        var dropGroups  = ['grid'];
+	        if (portlet.get("detached") == true) {
+		        dragGroups = ['detached'],	        
+		        dragMode = 'point';
+		        dropGroups = [];
+	        }        
+	        var ddNav = new Y.DD.Drag({
+	            node: v,
+	            groups: dragGroups,
+	            dragMode: dragMode                    
+	        }).plug(Y.Plugin.DDProxy, { 
+	          	 moveOnEnd: false         	    	
+	        });    
+	        ddNav.addHandle(config.dragHandleStyle);
+	    	var drop = new Y.DD.Drop({
+	            node: v,
+	            groups: dropGroups            
+	        });
+	    	//portlet.info();
+    	}
     });
     
     var dropLayouts = Y.Node.all(config.layoutStyle); 
     dropLayouts.each(function(v, k) {
-    	//Y.log("layout = " + v.getAttribute("name") + v.getAttribute("id"));
         var layout = Y.JetUI.Layout.attach(v);
-        //layout.info();
         if (v.get('children').size() == 0)
         {
 	    	var drop = new Y.DD.Drop({
 	        node: v,
-	        groups: ['portlets']            
+	        groups: ['grid']            
 	    	});
         }
+        //layout.info();        
     });
     
     var closeWindows = Y.Node.all('.portlet-action-close');
@@ -163,7 +124,7 @@
 	    var portal = JETUI_YUI.getPortalInstance();
 		var drop = e.drop.get('node'),
             drag = e.drag.get('node');
-        if (drag.data.get("toolbar"))
+        if (drag.data.get("detached"))
         {        	
             if (drop == portal.jstbLeft || drop == portal.jstbRight)
             {
@@ -200,7 +161,7 @@
         if (drag.target) {
             drag.target.set('locked', false);
         }
-        if (drag.get('node').data.get("toolbar"))
+        if (drag.get('node').data.get("detached"))
         {
             drag.get('node').setStyle('visibility', '');        	
         }
@@ -221,7 +182,7 @@
         var srcNode = drag.get('node');
         dragNode.set('innerHTML', srcNode.get('innerHTML'));
 
-        if (drag.get('node').data.get("toolbar"))
+        if (drag.get('node').data.get("detached"))
         {
         	drag.get('node').setStyle('visibility', 'hidden');        	
         }
@@ -260,7 +221,7 @@
         }        
         portal.lastX = x;
         
-        if (e.drag.get('node').data.get("toolbar"))
+        if (e.drag.get('node').data.get("detached"))
         {        
             var drop = e.drop.get('node'),
             drag = e.drag.get('node');            
@@ -299,7 +260,7 @@
 		    	}	    	
 		    	else if (y >= region.top && y <= region.bottom && x >= region.left
&& x <= region.right)
 		    	{
-		    		// Y.log("**** HIT");
+		    		//Y.log("**** HIT");
 		    		portal.isMoving = true;
 		    		portal.moveToGrid(e); 
 		    		portal.isMoving = false;

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/ui/Jetui.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/ui/Jetui.java?rev=894724&r1=894723&r2=894724&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/ui/Jetui.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/ui/Jetui.java
Wed Dec 30 22:24:44 2009
@@ -246,4 +246,29 @@
     {
         return this.pc;
     }
+    
+    public Toolbar getToolbar(RequestContext context, Toolbar.Orientation orientation)
+    {
+        Toolbar toolbar = null;
+        String id;
+        if (orientation == Toolbar.Orientation.LEFT)
+        {
+            id = Toolbar.LEFT_TOOLBAR_ID;
+        }
+        else if (orientation == Toolbar.Orientation.RIGHT)
+        {
+            id = Toolbar.RIGHT_TOOLBAR_ID;            
+        }
+        else
+            return toolbar;
+        ContentPage page = context.getPage();
+        ContentFragment cf = page.getFragmentByFragmentId(id);
+        toolbar = new Toolbar(orientation, id, cf);
+        toolbar.setCssClass(cf.getProperty("class"));
+        String state = cf.getProperty("state");
+        if (state != null)
+            toolbar.setClosed(state.equals("closed"));
+        return toolbar;
+    }
+    
 }

Added: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/ui/Toolbar.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/ui/Toolbar.java?rev=894724&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/ui/Toolbar.java
(added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/ui/Toolbar.java
Wed Dec 30 22:24:44 2009
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jetspeed.ui;
+
+import java.util.List;
+
+import org.apache.jetspeed.om.page.ContentFragment;
+
+public class Toolbar
+{
+    public enum Orientation { LEFT, RIGHT };
+    public static final String LEFT_TOOLBAR_ID = "jstbLeft";
+    public static final String RIGHT_TOOLBAR_ID = "jstbRight";
+
+    private String id;    
+    private String cssClass;    
+    private Orientation orientation;
+    private boolean closed = false;
+    private ContentFragment cf;
+
+    public Toolbar(Orientation o, String id, ContentFragment cf)
+    {
+        this.orientation = o;
+        this.id = id;
+        this.cf = cf;
+    }
+    
+    public String getCssClass()
+    {
+        return cssClass;
+    }
+    public void setCssClass(String cssClass)
+    {
+        this.cssClass = cssClass;
+    }
+    public boolean isClosed()
+    {
+        return closed;
+    }
+    public void setClosed(boolean closed)
+    {
+        this.closed = closed;
+    }
+    public String getId()
+    {
+        return id;
+    }
+    public void setId(String id)
+    {
+        this.id = id;
+    }
+    public Orientation getOrientation()
+    {
+        return orientation;
+    }
+    public void setOrientation(Orientation orientation)
+    {
+        this.orientation = orientation;
+    }
+    public List<ContentFragment> getTools()
+    {
+        return cf.getFragments(); 
+    }    
+}
\ No newline at end of file

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/ui/Toolbar.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/ui/Toolbar.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/conf/jetspeed/jetspeed.properties
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/conf/jetspeed/jetspeed.properties?rev=894724&r1=894723&r2=894724&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/conf/jetspeed/jetspeed.properties
(original)
+++ portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/resources/conf/jetspeed/jetspeed.properties
Wed Dec 30 22:24:44 2009
@@ -95,7 +95,10 @@
 supported.windowstate = maximized
 supported.windowstate = minimized
 supported.windowstate = solo
-
+supported.windowstate = detach
+supported.windowstate = close
+supported.windowstate.additional.defaults = detach
+supported.windowstate.additional.defaults = close
     
 # -------------------------------------------------------------------
 #  Portlet Container Runtime Options 



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