David -

I have fixed a number of minor problems that were causing the customizers to
be non-functional in the tip CVS code with the new peid stuff.

I have attached a full patch file to apply these changes to the tip as of
Now (10pm eastern time Sunday night March 24 2002).

Basically, here's the changes:

Some of the controller and template .vm files had a reference to "Metainfo"
when the proper spelling (case) seems to be "MetaInfo", for entry and
portlets sections of the .psml document object.  Pane names were just "*" in
the customizers, and the browser window title didn't have the correct name.
I changed these:

controllers/html/card-customize.vm
controllers/html/column-customize.vm
controllers/html/row-customize.vm
templates/vm/layouts/html/default.vm

These same controllers also need to encode a "js_peid" parameter instead of
a "portlet" name parameter to "controls.Customize" - I replaced the code
with ".addQueryData("js_peid",$entry.Id)".  Now clicking on a pane list in a
customizer will not only edit that pane, but also pick the correct one to
edit!

org.apache.jetspeed.modules.actions.controls.Customize.java I changed to
deal with no peid by using the root set of the profile.  I also removed code
in there to do the same thing, name based.  Now the top.vm edit links (html,
wml) work.

org.apache.jetspeed.modules.actions.JetspeedSessionValidator I changed to
recognize the peid parameter and set it in the rundata (else it won't be
found there later), and fixed the Maximize handling here to use peid, to be
consistent with Maximize.

A number of classes accessed a portlet by name rather than by id.  I changed
these to use code like: ".getPortletsById(set.getID())" instead of
".getPortlets(set.getName())":

org/apache/jetspeed/modules/actions/controllers/RowColumnControllerAction.ja
va

Note: the RowColumnControllerAction change was needed to get the customizers
to work.  These others I found searching for the code pattern and changed
without full understanding of what they are doing or where they are used:

org/apache/jetspeed/modules/actions/controllers/MultiColumnControllerAction.
java
org/apache/jetspeed/modules/actions/portlets/CustomizeSetAction.java
org/apache/jetspeed/util/AutoProfile.java

I still want a change in the JetspeedTemplateLink's "forPortlet", so that it
a) takes a peid not a name, and b) if given blank or null, just ignores the
call.  My changes for this are in the patch as well.

Can you review and apply these patches?  Thanks!

- Glenn 

--------------------------------------------
Glenn R. Golden, Systems Research Programmer
University of Michigan School of Information
[EMAIL PROTECTED]               734-615-1419
http://www-personal.si.umich.edu/~ggolden/
--------------------------------------------

Index: src/java/org/apache/jetspeed/modules/actions/JetspeedSessionValidator.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/JetspeedSessionValidator.java,v
retrieving revision 1.15
diff -u -r1.15 JetspeedSessionValidator.java
--- src/java/org/apache/jetspeed/modules/actions/JetspeedSessionValidator.java  20 Mar 
2002 06:55:48 -0000      1.15
+++ src/java/org/apache/jetspeed/modules/actions/JetspeedSessionValidator.java  25 Mar 
+2002 04:18:18 -0000
@@ -155,17 +155,17 @@
         data.getUser().setTemp("locale", locale);
         
 
-        String maximizedPortlet = (String)jdata.getUser().getTemp("portlet");
+        String maximizedPortlet = (String)jdata.getUser().getTemp("js_peid");
         if (maximizedPortlet != null) {
-            jdata.setPortlet(maximizedPortlet);
+            jdata.setJs_peid(maximizedPortlet);
             jdata.setScreenTemplate("Maximize");
         }
 
         // if a portlet is referenced in the parameters request, store it
         // in the RunData object
-        String paramPortlet = jdata.getParameters().getString("portlet");
+        String paramPortlet = jdata.getParameters().getString("js_peid");
         if (paramPortlet != null && paramPortlet.length() > 0) {
-            jdata.setPortlet(paramPortlet);
+            jdata.setJs_peid(paramPortlet);
         }
         
     }
Index: 
src/java/org/apache/jetspeed/modules/actions/controllers/MultiColumnControllerAction.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/controllers/MultiColumnControllerAction.java,v
retrieving revision 1.7
diff -u -r1.7 MultiColumnControllerAction.java
--- 
src/java/org/apache/jetspeed/modules/actions/controllers/MultiColumnControllerAction.java
   22 Mar 2002 18:42:06 -0000      1.7
+++ 
+src/java/org/apache/jetspeed/modules/actions/controllers/MultiColumnControllerAction.java
+   25 Mar 2002 04:18:20 -0000
@@ -281,7 +281,7 @@
         PortletSet customizedSet = (PortletSet)jdata.getCustomized();
         Portlets set = jdata.getProfile()
                             .getDocument()
-                            .getPortlets(customizedSet.getName());
+                            .getPortletsById(customizedSet.getID());
 
         Log.debug("MultiCol: columns "+columns+" set "+set);
 
@@ -409,7 +409,7 @@
                     
                 Portlets portlets = jdata.getProfile()
                                          .getDocument()
-                                         .getPortlets(customizedSet.getName());
+                                         .getPortletsById(customizedSet.getID());
                 if (portlets != null)
                 {
                     for (int i=0; i < portlets.getEntryCount(); i++)
Index: 
src/java/org/apache/jetspeed/modules/actions/controllers/RowColumnControllerAction.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/controllers/RowColumnControllerAction.java,v
retrieving revision 1.8
diff -u -r1.8 RowColumnControllerAction.java
--- 
src/java/org/apache/jetspeed/modules/actions/controllers/RowColumnControllerAction.java
     22 Mar 2002 18:42:06 -0000      1.8
+++ 
+src/java/org/apache/jetspeed/modules/actions/controllers/RowColumnControllerAction.java
+     25 Mar 2002 04:18:21 -0000
@@ -149,7 +149,7 @@
         
         Portlets portlets = jdata.getProfile()
                                  .getDocument()
-                                 .getPortlets(set.getName());
+                                 .getPortletsById(set.getID());
 
         List plist = new ArrayList();
         List work = new ArrayList();
@@ -359,7 +359,7 @@
         if (position > -1)
         {
             Portlets set = profile.getDocument()
-                                  .getPortlets(customizedSet.getName());
+                                  .getPortletsById(customizedSet.getID());
             if (set != null)
             {
                 // first try explicit portlets position
@@ -495,7 +495,7 @@
             int target = -1;
             
             Portlets set = profile.getDocument()
-                                  .getPortlets(customizedSet.getName());
+                                  .getPortletsById(customizedSet.getID());
             Layout targetLayout = null;
             Layout baseLayout = null;
 
Index: src/java/org/apache/jetspeed/modules/actions/controls/Customize.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/controls/Customize.java,v
retrieving revision 1.7
diff -u -r1.7 Customize.java
--- src/java/org/apache/jetspeed/modules/actions/controls/Customize.java        13 Mar 
2002 05:41:15 -0000      1.7
+++ src/java/org/apache/jetspeed/modules/actions/controls/Customize.java        25 Mar 
+2002 04:18:21 -0000
@@ -89,13 +89,6 @@
             return;
         }
 
-        // Get jsp_peid parmameter.  If it does not exist, then do nothing
-        String peid = rundata.getParameters().getString("js_peid");
-        if ( peid == null )
-        {
-            return;
-        }
-        
         JetspeedRunData jdata = (JetspeedRunData)rundata;
 
         // Load the profile for customization (if not already loaded!)
@@ -127,26 +120,14 @@
         }
         // ---------------------------------------------------------------------
         
-        
-        String name = jdata.getPortlet();
-        if ( name == null )
+        // Get js_peid parmameter.
+        // If it does not exist, we will customize the root of the profile
+        String peid = rundata.getParameters().getString("js_peid");
+        if ( peid == null )
         {
-            //if no portlet specified, customized the default pane
-            //of the profile
-
-            // set Portlet #1 for wml
-            // Andreas Kempf, ICM S CP PE, Munich
-            // ---------------------------------------------------------------------
-            if ((editMediaType != null) && (editMediaType.equalsIgnoreCase("wml")))
-            {
-              name="1";
-            }
-            else  
-              name="0";
-            // ---------------------------------------------------------------------
-
-      
-            jdata.setPortlet(name);
+            // use the id of the root set of the profile
+            peid = jdata.getProfile().getRootSet().getID();
+            jdata.setJs_peid(peid);
         }
 
         Portlet found = null;
Index: src/java/org/apache/jetspeed/modules/actions/portlets/CustomizeSetAction.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/CustomizeSetAction.java,v
retrieving revision 1.15
diff -u -r1.15 CustomizeSetAction.java
--- src/java/org/apache/jetspeed/modules/actions/portlets/CustomizeSetAction.java      
 22 Mar 2002 18:42:06 -0000      1.15
+++ src/java/org/apache/jetspeed/modules/actions/portlets/CustomizeSetAction.java      
+ 25 Mar 2002 04:18:24 -0000
@@ -366,7 +366,7 @@
         {
             Portlets portlets = ((JetspeedRunData)rundata).getProfile()
                                             .getDocument()
-                                            .getPortlets(set.getName());
+                                            .getPortletsById(set.getID());
 
             List usedPortlets = AutoProfile.getPortletList(rundata);
             boolean addIt;
@@ -438,7 +438,7 @@
         {
             Portlets portlets = ((JetspeedRunData)rundata).getProfile()
                                             .getDocument()
-                                            .getPortlets(set.getName());
+                                            .getPortletsById(set.getID());
             
             if (portlets!=null)
             {
@@ -478,7 +478,7 @@
                 {
                     set.setController(pc);
 
-                    Portlets portlets = 
profile.getDocument().getPortlets(set.getName());
+                    Portlets portlets = 
+profile.getDocument().getPortletsById(set.getID());
 
                     Controller c = portlets.getController();
                     if (c == null)
@@ -530,7 +530,7 @@
                     set.getPortletConfig().setPortletSkin(s);
 
                     Profile profile = ((JetspeedRunData)rundata).getProfile();
-                    Portlets portlets = 
profile.getDocument().getPortlets(set.getName());
+                    Portlets portlets = 
+profile.getDocument().getPortletsById(set.getID());
 
                     Skin psmlSkin = portlets.getSkin();
                     if (psmlSkin == null)
Index: src/java/org/apache/jetspeed/util/AutoProfile.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-jetspeed/src/java/org/apache/jetspeed/util/AutoProfile.java,v
retrieving revision 1.2
diff -u -r1.2 AutoProfile.java
--- src/java/org/apache/jetspeed/util/AutoProfile.java  22 Mar 2002 18:51:57 -0000     
 1.2
+++ src/java/org/apache/jetspeed/util/AutoProfile.java  25 Mar 2002 04:18:28 -0000
@@ -117,7 +117,7 @@
     public static List getPortletList (RunData rundata)
     {
       Profile profile = ((JetspeedRunData)rundata).getProfile();
-      Portlets allPortlets = 
profile.getDocument().getPortlets(((PortletSet)((JetspeedRunData)rundata).getCustomized()).getName());
+      Portlets allPortlets = 
+profile.getDocument().getPortletsById(((PortletSet)((JetspeedRunData)rundata).getCustomized()).getID());
 
       
       List installed = new ArrayList ();
Index: src/java/org/apache/jetspeed/util/template/JetspeedTemplateLink.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-jetspeed/src/java/org/apache/jetspeed/util/template/JetspeedTemplateLink.java,v
retrieving revision 1.7
diff -u -r1.7 JetspeedTemplateLink.java
--- src/java/org/apache/jetspeed/util/template/JetspeedTemplateLink.java        11 Mar 
2002 07:22:12 -0000      1.7
+++ src/java/org/apache/jetspeed/util/template/JetspeedTemplateLink.java        25 Mar 
+2002 04:18:31 -0000
@@ -87,6 +87,7 @@
         
     // parameter names for the Jetspeed framework elements    
     public static final String PORTLET_KEY = "portlet";
+    public static final String PORTLET_ID_KEY = "js_peid";
     public static final String ACTION_KEY = "action";
     public static final String SCREEN_KEY = "screen";
     public static final String TEMPLATE_KEY = "template";
@@ -98,6 +99,11 @@
     private String portletName = null;
 
     /**
+     *<p>The ID (js_peid) of the portlet for which a URL will be generated.</p>
+     */
+    private String portletID = null;
+
+    /**
      *<p>Request to which we refer.</p>
      */
     private JetspeedRunData data = null;
@@ -180,15 +186,18 @@
     /** 
      * Return a URI that refers to the named portlet.
      *
-     * @param portlet the name of the portlet to link to
+     * @param peid the ID of the portlet to link to
      * @return a DynamicURI referencing the named portlet for easy link construction 
in template
      */
-    public DynamicURI forPortlet(String portlet)
+    public DynamicURI forPortlet(String peid)
     {
-        this.portletName = portlet;
-        removePathInfo(getPortletKey());
-        removeQueryData(getPortletKey());
-        return addPathInfo(getPortletKey(), portlet);
+        // ignore the call if missing peid 
+        if ((peid == null) || (peid.length() == 0)) return this;
+
+        this.portletID = peid;
+        removePathInfo(getPortletIDKey());
+        removeQueryData(getPortletIDKey());
+        return addPathInfo(getPortletIDKey(), peid);
     }
     
     /** 
@@ -200,7 +209,10 @@
      */
     public DynamicURI setPortlet(String portlet)
     {
-        return this.forPortlet( portlet ); 
+        this.portletName = portlet;
+        removePathInfo(getPortletKey());
+        removeQueryData(getPortletKey());
+        return addPathInfo(getPortletKey(), portlet);
     }
     
     /** 
@@ -212,11 +224,27 @@
     }
     
     /** 
+     * @return the portlet ID parameter value
+     */
+    public String getPortletID()
+    {
+        return this.portletID;
+    }
+
+    /** 
      * @return the portlet parameter name
      */
     public String getPortletKey()
     {
         return PORTLET_KEY;
+    }
+
+    /** 
+     * @return the portlet parameter name
+     */
+    public String getPortletIDKey()
+    {
+        return PORTLET_ID_KEY;
     }
     
     /** 
Index: webapp/WEB-INF/templates/vm/controllers/html/card-customize.vm
===================================================================
RCS file: 
/home/cvspublic/jakarta-jetspeed/webapp/WEB-INF/templates/vm/controllers/html/card-customize.vm,v
retrieving revision 1.6
diff -u -r1.6 card-customize.vm
--- webapp/WEB-INF/templates/vm/controllers/html/card-customize.vm      22 Dec 2001 
03:02:35 -0000      1.6
+++ webapp/WEB-INF/templates/vm/controllers/html/card-customize.vm      25 Mar 2002 
+04:18:35 -0000
@@ -31,7 +31,7 @@
 #if ($entry.Parent)
   #set ($title = $titles.get($entry.Parent) )
 #else
-  #set ($title = $entry.Metainfo.Title)
+  #set ($title = $entry.MetaInfo.Title)
 #end
 ##
 #if ($title=="*")
@@ -53,14 +53,14 @@
   ## Portlet is not used - use blank image!
   #if (!$FF)
     #set ($portletcount = $portletcount + 1)
-    <a href="$link.setAction("controls.Customize")?portlet=$portletcount">
+    <a href="$link.setAction("controls.Customize").addQueryData("js_peid",$entry.Id)">
       <img src="images/is_pane.gif" alt="$l10n.CUSTOMIZER_CUSTOMIZABLEPANE" width=14" 
height="14" border="0" hspace="2" >
     </a></TD>
   #end
 
     <td valign="top">
   #if (!$FF)
-    <a href="$link.setAction("controls.Customize")?portlet=$portletcount">
+    <a href="$link.setAction("controls.Customize").addQueryData("js_peid",$entry.Id)">
       <b>$title</b>
     </a>
   #else
Index: webapp/WEB-INF/templates/vm/controllers/html/column-customize.vm
===================================================================
RCS file: 
/home/cvspublic/jakarta-jetspeed/webapp/WEB-INF/templates/vm/controllers/html/column-customize.vm,v
retrieving revision 1.4
diff -u -r1.4 column-customize.vm
--- webapp/WEB-INF/templates/vm/controllers/html/column-customize.vm    22 Dec 2001 
03:02:35 -0000      1.4
+++ webapp/WEB-INF/templates/vm/controllers/html/column-customize.vm    25 Mar 2002 
+04:18:36 -0000
@@ -30,7 +30,7 @@
       #if ($entry.Parent)
         #set ($title = $titles.get($entry.Parent) )
       #else
-        #set ($title = $entry.Metainfo.Title)
+        #set ($title = $entry.MetaInfo.Title)
       #end
       ##
       #if ($title=="*")
@@ -53,7 +53,7 @@
       ## Portlet is not used - use the pane image!
       #if (!$FF)
         #set ($portletcount = $portletcount + 1)
-          <a href="$link.setAction("controls.Customize")?portlet=$portletcount">
+          <a 
+href="$link.setAction("controls.Customize").addQueryData("js_peid",$entry.Id)">
             <img src="images/is_pane.gif" alt="$l10n.CUSTOMIZER_CUSTOMIZABLEPANE" 
width=14" height="14" border="0" hspace="2">
           </a>
         </td>
@@ -61,7 +61,7 @@
 
       <td valign="top">
       #if (!$FF)
-        <a href="$link.setAction("controls.Customize")?portlet=$portletcount">
+        <a 
+href="$link.setAction("controls.Customize").addQueryData("js_peid",$entry.Id)">
           <b>$title</b>
         </a>
       #else
Index: webapp/WEB-INF/templates/vm/controllers/html/row-customize.vm
===================================================================
RCS file: 
/home/cvspublic/jakarta-jetspeed/webapp/WEB-INF/templates/vm/controllers/html/row-customize.vm,v
retrieving revision 1.4
diff -u -r1.4 row-customize.vm
--- webapp/WEB-INF/templates/vm/controllers/html/row-customize.vm       22 Dec 2001 
03:02:35 -0000      1.4
+++ webapp/WEB-INF/templates/vm/controllers/html/row-customize.vm       25 Mar 2002 
+04:18:37 -0000
@@ -31,7 +31,7 @@
 #if ($entry.Parent)
   #set ($title = $titles.get($entry.Parent) )
 #else
-  #set ($title = $entry.Metainfo.Title)
+  #set ($title = $entry.MetaInfo.Title)
 #end
 ##
 #if ($title=="*")
@@ -54,14 +54,14 @@
   ## Portlet is not used - use blank image!
   #if (!$FF)
     #set ($portletcount = $portletcount + 1)
-    <a href="$link.setAction("controls.Customize")?portlet=$portletcount">
+    <a href="$link.setAction("controls.Customize").addQueryData("js_peid",$entry.Id)">
       <img src="images/is_pane.gif" alt="$l10n.CUSTOMIZER_CUSTOMIZABLEPANE" width=14" 
height="14" border="0" hspace="2">
     </a></TD>
   #end
 
     <td valign="top">
   #if (!$FF)
-    <a href="$link.setAction("controls.Customize")?portlet=$portletcount">
+    <a href="$link.setAction("controls.Customize").addQueryData("js_peid",$entry.Id)">
       <b>$title</b>
     </a>
   #else
Index: webapp/WEB-INF/templates/vm/layouts/html/default.vm
===================================================================
RCS file: 
/home/cvspublic/jakarta-jetspeed/webapp/WEB-INF/templates/vm/layouts/html/default.vm,v
retrieving revision 1.7
diff -u -r1.7 default.vm
--- webapp/WEB-INF/templates/vm/layouts/html/default.vm 31 Jan 2002 12:24:28 -0000     
 1.7
+++ webapp/WEB-INF/templates/vm/layouts/html/default.vm 25 Mar 2002 04:18:37 -0000
@@ -2,7 +2,7 @@
   <head>
     <base href="$clink.External">
     <link href="$clink.setURI("css/default.css").Absolute" type="text/css" 
rel="stylesheet">
-    <title>Jakarta Jetspeed Portal: 
$!{data.profile.document.portlets.getMetainfo().title} </title>
+    <title>Jakarta Jetspeed Portal: 
+$!{data.profile.document.portlets.getMetaInfo().title} </title>
   </head>
   <body bgcolor="#ffffff">
     #if ($config.getBoolean("topnav.enable") == true)

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to