portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r412619 - in /portals/jetspeed-2/trunk/applications/j2-admin/src: java/org/apache/jetspeed/portlets/security/permissions/SecurityPermissionsPortlet.java webapp/WEB-INF/security/permissions/view.vm
Date Thu, 08 Jun 2006 00:04:10 GMT
Author: taylor
Date: Wed Jun  7 17:04:10 2006
New Revision: 412619

URL: http://svn.apache.org/viewvc?rev=412619&view=rev
Log:
check point for steve to review dojo 'issues' im experiencing

Modified:
    portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/permissions/SecurityPermissionsPortlet.java
    portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/security/permissions/view.vm

Modified: portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/permissions/SecurityPermissionsPortlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/permissions/SecurityPermissionsPortlet.java?rev=412619&r1=412618&r2=412619&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/permissions/SecurityPermissionsPortlet.java
(original)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/permissions/SecurityPermissionsPortlet.java
Wed Jun  7 17:04:10 2006
@@ -16,6 +16,7 @@
 package org.apache.jetspeed.portlets.security.permissions;
 
 import java.io.IOException;
+import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 
@@ -32,6 +33,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.jetspeed.CommonPortletServices;
 import org.apache.jetspeed.security.PermissionManager;
+import org.apache.jetspeed.security.om.InternalPermission;
 import org.apache.portals.gems.dojo.AbstractDojoVelocityPortlet;
 import org.apache.velocity.context.Context;
 
@@ -46,6 +48,21 @@
     protected final Log logger = LogFactory.getLog(this.getClass());
     protected PermissionManager pm = null;
     
+    // TODO: move to prefs
+    static final String CLASSNAMES[] = 
+    {
+        "org.apache.jetspeed.security.FolderPermission",
+        "org.apache.jetspeed.security.PagePermission",
+        "org.apache.jetspeed.security.PortletPermission"
+    };
+    static final String TITLES[] = 
+    {
+        "Folders",
+        "Pages",
+        "Portlets"
+    };
+    
+    
     public void init(PortletConfig config) throws PortletException
     {
         super.init(config);
@@ -68,24 +85,52 @@
         appendHeaderText(headerInfoText, "dojo.widget.SplitContainer");
         appendHeaderText(headerInfoText, "dojo.widget.TabContainer");
         appendHeaderText(headerInfoText, "dojo.widget.Tree");
+        appendHeaderText(headerInfoText, "dojo.widget.SortableTable");        
     }
     
     public void doView(RenderRequest request, RenderResponse response)
             throws PortletException, IOException
     {
-        Context velocityContext = getContext(request);
-        PortletSession session = request.getPortletSession();
-        List permissions = new LinkedList();
-        permissions.add("one");
-        permissions.add("two");
-        permissions.add("three");
-        permissions.add("four");
-        permissions.add("five");
-        permissions.add("six");        
-        velocityContext.put("permissions", permissions);
+        retrievePermissions(request.getPortletSession(), getContext(request));
         super.doView(request, response);
     }
 
+    public void retrievePermissions(PortletSession session, Context context)
+    {
+        Iterator folderPermissions = (Iterator)session.getAttribute("folderPermissions",
PortletSession.PORTLET_SCOPE);
+        Iterator pagePermissions = (Iterator)session.getAttribute("pagePermissions", PortletSession.PORTLET_SCOPE);
+        Iterator portletPermissions = (Iterator)session.getAttribute("portletPermissions",
PortletSession.PORTLET_SCOPE);
+        if (portletPermissions == null)
+        {
+            List folders = new LinkedList();
+            List pages = new LinkedList();
+            List portlets = new LinkedList();
+            Iterator all = pm.getPermissions();
+            while (all.hasNext())
+            {
+                InternalPermission permission = (InternalPermission)all.next();
+                if (permission.getClassname().equals(CLASSNAMES[0]))
+                {
+                    folders.add(permission);                    
+                }
+                else if (permission.getClassname().equals(CLASSNAMES[1]))
+                {
+                    pages.add(permission);
+                }
+                else if (permission.getClassname().equals(CLASSNAMES[2]))
+                {
+                    portlets.add(permission);
+                }
+                folderPermissions = folders.iterator();
+                pagePermissions = pages.iterator();
+                portletPermissions = portlets.iterator();
+            }            
+        }
+        context.put("folderPermissions", folderPermissions);
+        context.put("pagePermissions", pagePermissions);
+        context.put("portletPermissions", portletPermissions);
+    }
+    
     public void processAction(ActionRequest request,
             ActionResponse actionResponse) throws PortletException, IOException
     {

Modified: portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/security/permissions/view.vm
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/security/permissions/view.vm?rev=412619&r1=412618&r2=412619&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/security/permissions/view.vm
(original)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/security/permissions/view.vm
Wed Jun  7 17:04:10 2006
@@ -1,3 +1,73 @@
+<style type="text/css">
+		html, body
+{	
+    width: 100%;	/* make the body expand to fill the visible window */
+    height: 100%;
+    margin: 0 0 0 0;
+}
+
+		table {
+			font-family:Lucida Grande, Verdana;
+			font-size:0.8em;
+			width:100%;
+			border:1px solid #ccc;
+			cursor:default;
+		}
+
+		* html div.tableContainer {	/* IE only hack */
+			width:95%;
+			border:1px solid #ccc;
+			height: 285px;
+			overflow-x:hidden;
+			overflow-y: auto;
+		}
+
+		table td,
+		table th{
+			border-right:1px solid #999;
+			padding:2px;
+			font-weight:normal;
+		}
+		table thead td, table thead th {
+			background:#94BEFF;
+		}
+		
+		* html div.tableContainer table thead tr td,
+		* html div.tableContainer table thead tr th{
+			/* IE Only hacks */
+			position:relative;
+			top:expression(dojo.html.getFirstAncestorByTag(this,'table').parentNode.scrollTop-2);
+		}
+		
+		html>body tbody.scrollContent {
+			height: 262px;
+			overflow-x:hidden;
+			overflow-y: auto;
+		}
+
+		tbody.scrollContent td, tbody.scrollContent tr td {
+			background: #FFF;
+			padding: 2px;
+		}
+
+		tbody.scrollContent tr.alternateRow td {
+			background: #e3edfa;
+			padding: 2px;
+		}
+
+		tbody.scrollContent tr.selected td {
+			background: yellow;
+			padding: 2px;
+		}
+		tbody.scrollContent tr:hover td {
+			background: #a6c2e7;
+			padding: 2px;
+		}
+		tbody.scrollContent tr.selected:hover td {
+			background: #ff3;
+			padding: 2px;
+		}
+	</style>
 <div dojoType="LayoutContainer"
     layoutChildPriority='top-bottom'
     style="width: 100%; height: 100%;">
@@ -25,7 +95,7 @@
             </div>
             <div>
 <ul>
-#foreach($permission in $permissions)
+#foreach($permission in $portletPermissions)
 <li>$permission</li>
 #end
 </ul>            



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