morciuch    2002/11/14 12:21:51

  Modified:    src/java/org/apache/jetspeed/modules/actions/portlets
                        CustomizeSetAction.java
               xdocs    changes.xml
               docs/site changes.html
  Log:
  Empty portlet categories in customizer are now supressed by default
  
  Revision  Changes    Path
  1.34      +33 -11    
jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/CustomizeSetAction.java
  
  Index: CustomizeSetAction.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/CustomizeSetAction.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- CustomizeSetAction.java   24 Oct 2002 16:17:20 -0000      1.33
  +++ CustomizeSetAction.java   14 Nov 2002 20:21:51 -0000      1.34
  @@ -96,7 +96,7 @@
   import org.apache.jetspeed.util.template.JetspeedLink;
   import org.apache.jetspeed.util.template.JetspeedLinkFactory;
   import org.apache.jetspeed.services.statemanager.SessionState;
  -
  +import org.apache.jetspeed.services.resources.JetspeedResources;
   
   // Turbine stuff
   import org.apache.turbine.util.DynamicURI;
  @@ -137,6 +137,7 @@
       private static final String PORTLET_LIST = "session.portlets.list";
       private static final String ALL_PORTLET_LIST = "session.all.portlets.list";
       private static final String PORTLET_LIST_PAGE_SIZE = 
"session.portlets.page.size";
  +    private static final String HIDE_EMPTY_CATEGORIES = 
"customizer.hide.empty.categories";
   
       /** 
        * Subclasses must override this method to provide default behavior 
  @@ -216,8 +217,8 @@
           context.put("set", set);
           context.put("action", "portlets.CustomizeSetAction");        
           context.put("controllers", buildInfoList(rundata, 
Registry.PORTLET_CONTROLLER, mediaType));
  -        context.put("skins", buildList(rundata, Registry.SKIN));
  -        context.put("securitys", buildList(rundata, Registry.SECURITY));
  +        //context.put("skins", buildList(rundata, Registry.SKIN));
  +        //context.put("securitys", buildList(rundata, Registry.SECURITY));
           context.put("customizer", portlet);
       
           String controllerName = set.getController().getConfig().getName();
  @@ -289,7 +290,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 +1091,40 @@
        * @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)
       {
  +        boolean hideEmpties = JetspeedResources.getBoolean(HIDE_EMPTY_CATEGORIES, 
true);
           TreeMap catMap = new TreeMap();
           Iterator pItr = portlets.iterator();
           while (pItr.hasNext())
           {
               PortletEntry entry =  (PortletEntry) pItr.next();
  -            Iterator cItr = entry.listCategories();
  -            while (cItr.hasNext())
  +            if (hideEmpties)
               {
  -                BaseCategory cat = (BaseCategory) cItr.next();
  -                catMap.put(cat.getName(), cat);
  -            }            
  +                if (JetspeedSecurity.checkPermission((JetspeedUser) data.getUser(), 
  +                                         new PortalResource(entry), 
  +                                         JetspeedSecurity.PERMISSION_VIEW)
  +                    && ((!entry.isHidden()) 
  +                    && (!entry.getType().equals(PortletEntry.TYPE_ABSTRACT))
  +                    && entry.hasMediaType(mediaType)))
  +                {
  +                    Iterator cItr = entry.listCategories();
  +                    while (cItr.hasNext())
  +                    {
  +                        BaseCategory cat = (BaseCategory) cItr.next();
  +                        catMap.put(cat.getName(), cat);
  +                    }            
  +                }
  +            }
  +            else
  +            {
  +                Iterator cItr = entry.listCategories();
  +                while (cItr.hasNext())
  +                {
  +                    BaseCategory cat = (BaseCategory) cItr.next();
  +                    catMap.put(cat.getName(), cat);
  +                }            
  +            }
           }
           
           BaseCategory allCat = new BaseCategory();
  
  
  
  1.90      +5 -2      jakarta-jetspeed/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/xdocs/changes.xml,v
  retrieving revision 1.89
  retrieving revision 1.90
  diff -u -r1.89 -r1.90
  --- changes.xml       12 Nov 2002 22:19:01 -0000      1.89
  +++ changes.xml       14 Nov 2002 20:21:51 -0000      1.90
  @@ -23,7 +23,10 @@
   </li>
   -->
   <li>
  -  Add - 2002/12/8 - Security Ref in the customizers is now only visible to admin 
(MO)
  +  Add - 2002/11/14 - Empty portlet categories in customizer are now supressed by 
default (MO)
  +</li>
  +<li>
  +  Add - 2002/11/12 - Security Ref in the customizers is now only visible to admin 
(MO)
   </li>
   <li>
     Fix - Bug # 11264 - 2002/11/8 - Modified JetspeedPaneTag to support maximize mode 
when JSP is the default template engine (MO)
  
  
  
  1.69      +4 -1      jakarta-jetspeed/docs/site/changes.html
  
  Index: changes.html
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/docs/site/changes.html,v
  retrieving revision 1.68
  retrieving revision 1.69
  diff -u -r1.68 -r1.69
  --- changes.html      12 Nov 2002 22:19:00 -0000      1.68
  +++ changes.html      14 Nov 2002 20:21:51 -0000      1.69
  @@ -131,7 +131,10 @@
   </li>
   -->
   <li>
  -  Add - 2002/12/8 - Security Ref in the customizers is now only visible to admin 
(MO)
  +  Add - 2002/11/14 - Empty portlet categories in customizer are now supressed by 
default (MO)
  +</li>
  +<li>
  +  Add - 2002/11/12 - Security Ref in the customizers is now only visible to admin 
(MO)
   </li>
   <li>
     Fix - Bug # 11264 - 2002/11/8 - Modified JetspeedPaneTag to support maximize mode 
when JSP is the default template engine (MO)
  
  
  

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