I propose that the category filter includes only categories that will list
*some* portlets when selected. This can be done as an optional feature
controlled via customizer.hide.empty.categories in jr.props. I am attaching
a patch to CustomizeSetAction which accomplishes this.

Best regards,

Mark C. Orciuch
Next Generation Solutions, Ltd.
e-Mail: [EMAIL PROTECTED]
web: http://www.ngsltd.com

Index: CustomizeSetAction.java
===================================================================
RCS file: 
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/CustomizeSetAction.java,v
retrieving revision 1.33
diff -u -r1.33 CustomizeSetAction.java
--- CustomizeSetAction.java     24 Oct 2002 16:17:20 -0000      1.33
+++ CustomizeSetAction.java     1 Nov 2002 22:10:16 -0000
@@ -289,7 +289,7 @@
             List portlets  = buildPortletList(rundata, set, mediaType, allPortlets);
             Map userSelections = getUserSelections(rundata); 
             // Build a list of categories from the available portlets
-            List categories = buildCategoryList(rundata, allPortlets);
+            List categories = buildCategoryList(rundata, mediaType, allPortlets);
             context.put("categories", categories);
             
             int size = getSize(portlet);               
@@ -1090,19 +1090,27 @@
      * @param RunData current requests RunData object
      * @param List portlets All available portlets
      */    
-    public static List buildCategoryList(RunData data, List portlets)
+    public static List buildCategoryList(RunData data, String mediaType, List 
+portlets)
     {
         TreeMap catMap = new TreeMap();
         Iterator pItr = portlets.iterator();
         while (pItr.hasNext())
         {
             PortletEntry entry =  (PortletEntry) pItr.next();
-            Iterator cItr = entry.listCategories();
-            while (cItr.hasNext())
+            if (JetspeedSecurity.checkPermission((JetspeedUser) data.getUser(), 
+                                     new PortalResource(entry), 
+                                     JetspeedSecurity.PERMISSION_VIEW)
+                && ((!entry.isHidden()) 
+                && (!entry.getType().equals(PortletEntry.TYPE_ABSTRACT))
+                && entry.hasMediaType(mediaType)))
             {
-                BaseCategory cat = (BaseCategory) cItr.next();
-                catMap.put(cat.getName(), cat);
-            }            
+                Iterator cItr = entry.listCategories();
+                while (cItr.hasNext())
+                {
+                    BaseCategory cat = (BaseCategory) cItr.next();
+                    catMap.put(cat.getName(), cat);
+                }            
+            }
         }
         
         BaseCategory allCat = new BaseCategory();


--
To unsubscribe, e-mail:   <mailto:jetspeed-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:jetspeed-dev-help@;jakarta.apache.org>

Reply via email to