Here are some problems with the current state of the peid work, a proposal
for one change to address them, and two patch files which have the changes
proposed.  If we like the suggestions, someone could apply the patches and
check them in.

I made the patches with "cvs diff -u", as the jakarta site suggests.  Is
this useful?  How does on apply these patches?

* * *

JetspeedTemplateLink is not quite right for the new peid feature.  It still
has forPortlet() taking a portlet name (not id) and producing a url with
"/portlet/<name>" intead of "/js_peid/<id>".

We need some call in there to make take a portlet id and make a url with
"/js_peid/<id>".

Do we want to change the definition of forPortlet()?  It's new, so doing so
might not break too much.  We would change it to encode the new "js_peid"
parameter.  It would have to be passed the peid from the request, which can
be found in the $data.Js_peid.

Forms that want to be submitted to just a portlet could encode their action
url as:

$jlink.forPortlet("$!data.Js_peid")

forPortlet() would, if passed a null or empty parameter, for the case where
there is no peid in the request, just be ignored, so the $jink would be back
to the entire portal rather than specifying a portlet.

* * *

Also, we would have to assure that whenever a reqest comes in with a
"js_peid", that the rundata's Js_peid() is properly set with it, and not
rely upon an action (such as Maximize) to set this value.

We need to fix JetspeedSessionValidator.doPerform():

        String maximizedPortlet =
(String)jdata.getUser().getTemp("portlet");
        if (maximizedPortlet != null) {
            jdata.setPortlet(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");
        if (paramPortlet != null && paramPortlet.length() > 0) {
            jdata.setPortlet(paramPortlet);
        }

Are we ok that the user.getTemp("portlet") is reserved here for maximize? If
so, we need to fix it so it sets the jdata.Js_peid(), which is what Maxmize
now uses, and check the getTemp("js_peid"), which Maximize is also setting.

To assure that the Js_peid() is set in the rundata, we also need another
hunk of code like this:

        // if a portlet is referenced in the parameters request, store it
        // in the RunData object
        String paramPortletID = jdata.getParameters().getString("js_peid");
        if (paramPortletID != null && paramPortletID.length() > 0) {
            jdata.setJs_peid(paramPortletID);
        }

So all the new peid folks will have it set in the rundata.



Index: 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
--- JetspeedTemplateLink.java   11 Mar 2002 07:22:12 -0000      1.7
+++ JetspeedTemplateLink.java   14 Mar 2002 18:49:36 -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 peid 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,6 +224,14 @@
     }
     
     /** 
+     * @return the portlet ID parameter value
+     */
+    public String getPortletID()
+    {
+        return this.portletID;
+    }
+
+    /** 
      * @return the portlet parameter name
      */
     public String getPortletKey()
@@ -219,6 +239,14 @@
         return PORTLET_KEY;
     }
     
+    /** 
+     * @return the portlet parameter name
+     */
+    public String getPortletIDKey()
+    {
+        return PORTLET_ID_KEY;
+    }
+
     /** 
      * @return the action parameter name
      */
Index: JetspeedSessionValidator.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/JetspeedSessionValidator.java,v
retrieving revision 1.14
diff -u -r1.14 JetspeedSessionValidator.java
--- JetspeedSessionValidator.java       19 Feb 2002 14:02:08 -0000      1.14
+++ JetspeedSessionValidator.java       14 Mar 2002 18:48:38 -0000
@@ -154,9 +154,9 @@
         data.getUser().setTemp("locale", locale);
         
 
-        String maximizedPortlet = (String)jdata.getUser().getTemp("portlet");
-        if (maximizedPortlet != null) {
-            jdata.setPortlet(maximizedPortlet);
+        String maximizedPortletID = (String)jdata.getUser().getTemp("js_peid");
+        if (maximizedPortletID != null) {
+            jdata.setJs_peid(maximizedPortletID);
             jdata.setScreenTemplate("Maximize");
         }
 
@@ -166,7 +166,14 @@
         if (paramPortlet != null && paramPortlet.length() > 0) {
             jdata.setPortlet(paramPortlet);
         }
-        
+
+        // if a portlet is referenced by ID in the parameters request, store it
+        // in the RunData object
+        String paramPortletID = jdata.getParameters().getString("js_peid");
+        if (paramPortletID != null && paramPortletID.length() > 0)
+        {
+            jdata.setJs_peid(paramPortletID);
+        }
     }
 
     /**

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

Reply via email to