You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by jf...@apache.org on 2004/08/30 01:09:08 UTC
cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/security UserBrowserAction.java RoleBrowserAction.java GroupBrowserAction.java
jford 2004/08/29 16:09:08
Modified: src/java/org/apache/jetspeed/services/resources
JetspeedResources.java
src/java/org/apache/jetspeed/modules/actions/portlets/security
UserBrowserAction.java RoleBrowserAction.java
GroupBrowserAction.java
Log:
Added client side sorting to the user/role/group browsers. This is disabled by default.
To enable, set the following properties
groupbrowser.clientsidesort=true
rolebrowser.clientsidesort=true
userbrowser.clientsidesort=true
PR: JIRA #JS1-450
Submitted by: Bob Fleischman
Revision Changes Path
1.21 +4 -1 jakarta-jetspeed/src/java/org/apache/jetspeed/services/resources/JetspeedResources.java
Index: JetspeedResources.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/resources/JetspeedResources.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- JetspeedResources.java 27 May 2004 14:57:24 -0000 1.20
+++ JetspeedResources.java 29 Aug 2004 23:09:08 -0000 1.21
@@ -65,6 +65,9 @@
public static final String CONTENTFEEDS_FETCHALL_KEY = "contentfeeds.fetchall";
public static final String CONTENTFEEDS_PORTLETBROWSER_PREVIEW_MAXPORTLETS_KEY = "contentfeeds.portletbrowser.preview.maxportlets";
public static final String CONTENTFEEDS_PORTLETBROWSER_OVERVIEW_MAXPORTLETS_KEY = "contentfeeds.portletbrowser.overview.maxportlets";
+ public static final String GROUP_BROWSER_CLIENT_SORTING = "groupbrowser.clientsidesort";
+ public static final String ROLE_BROWSER_CLIENT_SORTING = "rolebrowser.clientsidesort";
+ public static final String USER_BROWSER_CLIENT_SORTING = "userbrowser.clientsidesort";
public static final String CONFIGURATION_DIRECTORY_KEY = "configuration.directory";
public static final String CONTENT_ROOT_URL_KEY = "content.root.url";
public static final String TEMP_DIRECTORY_KEY = "temp.directory";
1.15 +25 -1 jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/security/UserBrowserAction.java
Index: UserBrowserAction.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/security/UserBrowserAction.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- UserBrowserAction.java 23 Feb 2004 02:53:08 -0000 1.14
+++ UserBrowserAction.java 29 Aug 2004 23:09:08 -0000 1.15
@@ -37,6 +37,10 @@
import org.apache.jetspeed.modules.actions.portlets.VelocityPortletAction;
import org.apache.jetspeed.portal.portlets.VelocityPortlet;
+// added for sorting
+import java.util.Collections;
+import java.util.Comparator;
+
import java.util.List;
import java.util.Iterator;
import java.util.ArrayList;
@@ -182,6 +186,26 @@
{
userList.add(users.next());
}
+ }
+
+ boolean clientSideSort = JetspeedResources.getBoolean(JetspeedResources.USER_BROWSER_CLIENT_SORTING, false);
+
+ if(clientSideSort)
+ {
+ // Now sort the users here
+ // I'm using lastname - how can we make this property selectable?
+ Collections.sort(userList, new Comparator()
+ {
+ public int compare(Object o1, Object o2)
+ {
+ JetspeedUser user = (JetspeedUser) o1;
+ String s1 = user.getLastName().toUpperCase();
+ user = (JetspeedUser) o2;
+ String s2 = user.getLastName().toUpperCase();
+ return s1.compareTo(s2);
+ }
+ });
+ //
}
1.10 +37 -2 jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/security/RoleBrowserAction.java
Index: RoleBrowserAction.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/security/RoleBrowserAction.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- RoleBrowserAction.java 23 Feb 2004 02:53:08 -0000 1.9
+++ RoleBrowserAction.java 29 Aug 2004 23:09:08 -0000 1.10
@@ -16,7 +16,13 @@
package org.apache.jetspeed.modules.actions.portlets.security;
+// added for sorting
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.Iterator;
+import java.util.List;
+import org.apache.jetspeed.om.security.Role;
// velocity
import org.apache.velocity.context.Context;
@@ -94,7 +100,36 @@
try
{
Iterator roles = JetspeedSecurity.getRoles();
- context.put(SecurityConstants.CONTEXT_ROLES, roles);
+
+ boolean clientSideSort = JetspeedResources.getBoolean(JetspeedResources.ROLE_BROWSER_CLIENT_SORTING, false);
+
+ if(clientSideSort)
+ {
+ // Copy them out so we can sort them
+ List roleList = new ArrayList();
+ while (roles.hasNext())
+ {
+ roleList.add(roles.next());
+ }
+ // Now sort the roles here
+ Collections.sort(roleList, new Comparator()
+ {
+ public int compare(Object o1, Object o2)
+ {
+ Role role = (Role) o1;
+ String s1 = role.getName().toUpperCase();
+ role = (Role) o2;
+ String s2 = role.getName().toUpperCase();
+ return s1.compareTo(s2);
+ }
+ });
+ //
+ context.put(SecurityConstants.CONTEXT_ROLES, roleList);
+ }
+ else
+ {
+ context.put(SecurityConstants.CONTEXT_ROLES, roles);
+ }
}
catch (Exception e)
{
1.8 +40 -2 jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/security/GroupBrowserAction.java
Index: GroupBrowserAction.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/security/GroupBrowserAction.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- GroupBrowserAction.java 23 Feb 2004 02:53:08 -0000 1.7
+++ GroupBrowserAction.java 29 Aug 2004 23:09:08 -0000 1.8
@@ -16,7 +16,13 @@
package org.apache.jetspeed.modules.actions.portlets.security;
+// added for sorting
+import org.apache.jetspeed.om.security.Group;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.Iterator;
+import java.util.List;
// velocity
import org.apache.velocity.context.Context;
@@ -97,7 +103,39 @@
try
{
Iterator groups = JetspeedSecurity.getGroups();
- context.put(SecurityConstants.CONTEXT_GROUPS, groups);
+
+ boolean clientSideSort = JetspeedResources.getBoolean(JetspeedResources.GROUP_BROWSER_CLIENT_SORTING, false);
+
+ if(clientSideSort)
+ {
+ //
+ // Added Sorting - July 2004 - Bob Fleischman
+ //
+ List groupList = new ArrayList();
+ while (groups.hasNext())
+ {
+ groupList.add(groups.next());
+ }
+ // Now sort the groups here
+ Collections.sort(groupList, new Comparator()
+ {
+ public int compare(Object o1, Object o2)
+ {
+ Group group = (Group) o1;
+ String s1 = group.getName().toUpperCase();
+ group = (Group) o2;
+ String s2 = group.getName().toUpperCase();
+ return s1.compareTo(s2);
+ }
+ });
+ //
+
+ context.put(SecurityConstants.CONTEXT_GROUPS, groupList);
+ }
+ else
+ {
+ context.put(SecurityConstants.CONTEXT_GROUPS, groups);
+ }
}
catch (Exception e)
{
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org