portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From morci...@apache.org
Subject cvs commit: jakarta-jetspeed/xdocs changes.xml
Date Thu, 06 Feb 2003 16:14:28 GMT
morciuch    2003/02/06 08:14:28

  Modified:    docs/site changes.html
               src/java/org/apache/jetspeed/modules/actions/portlets
                        JspPortletAction.java QuestionnaireAction.java
               src/java/org/apache/jetspeed/portal/portlets JspPortlet.java
               webapp/WEB-INF/templates/jsp/portlets/html
                        JetspeedQuestionnaire.jsp
                        JetspeedQuestionnaireConfirmation.jsp
               xdocs    changes.xml
  Log:
  Alternative implementation of JspPortletAction.setTemplate using session (see Bugzilla bug#
16443).
  
  Revision  Changes    Path
  1.104     +3 -0      jakarta-jetspeed/docs/site/changes.html
  
  Index: changes.html
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/docs/site/changes.html,v
  retrieving revision 1.103
  retrieving revision 1.104
  diff -u -r1.103 -r1.104
  --- changes.html	28 Jan 2003 04:46:20 -0000	1.103
  +++ changes.html	6 Feb 2003 16:14:26 -0000	1.104
  @@ -133,6 +133,9 @@
   </li>
   -->
   <li>
  +  Fixed - Bug # 16443 - 2003/02/05 - Reimplemented setTemplate method in JspPortletAction
to utilize session (MO)
  +</li>
  +<li>
     Fixed - Bug # 16443 - 2003/01/27 - Corrected the setTemplate functionality in JspPortletAction
(MO)
   </li>
   <li>
  
  
  
  1.4       +80 -4     jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/JspPortletAction.java
  
  Index: JspPortletAction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/JspPortletAction.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JspPortletAction.java	28 Jan 2003 04:46:21 -0000	1.3
  +++ JspPortletAction.java	6 Feb 2003 16:14:26 -0000	1.4
  @@ -87,9 +87,10 @@
       /**
        * This method is used when you want to short circuit an Action
        * and change the template that will be executed next.
  -     *
  -     * @param data Turbine information.
  +     * 
  +     * @param data     Turbine information.
        * @param template The template that will be executed next.
  +     * @deprecated As of 1.4b4
        */
       public void setTemplate(RunData data, String template)
       {
  @@ -97,6 +98,28 @@
       }
   
       /**
  +     * This method is used when you want to short circuit an Action
  +     * and change the template that will be executed next. The template
  +     * will persist until session expires or setTemplate with null
  +     * template name is called.
  +     * 
  +     * @param data     Turbine information.
  +     * @param portlet  Reference to portlet.     
  +     * @param template The template that will be executed next.
  +     */
  +    public void setTemplate(RunData data, Portlet portlet, String template)
  +    {
  +        if (template != null)
  +        {
  +            PortletSessionState.setAttribute(portlet, data, JspPortlet.TEMPLATE, template);
  +        }   
  +        else
  +        {
  +            PortletSessionState.clearAttribute(portlet, data, JspPortlet.TEMPLATE);
  +        }
  +    }
  +
  +    /**
        * Performs the action
        * 
        * @param rundata
  @@ -186,13 +209,66 @@
           // Ignore submits from other instances of the same portlet
           if (theButton == null || !PortletSessionState.isMyRequest(data, portlet))
           {
  -            throw new NoSuchMethodException("JspActionEvent: The button was null or not
my request");
  +            throw new NoSuchMethodException("JspPortletAction: The button was null or not
my request");
  +        }
  +
  +        if (Log.getLogger().isDebugEnabled())
  +        {
  +            Log.debug("JspPortletAction: attempting to execute event handler: " + theButton);
           }
   
           Method method = getClass().getMethod(theButton, classes);
           args[0] = data;
           args[1] = portlet;
           method.invoke(this, args);
  +    }
  +
  +    /**
  +     * This overrides the default Action.perform() to execute the
  +     * doEvent() method.  If that fails, then it will execute the
  +     * doPerform() method instead.
  +     *
  +     * @param data A Turbine RunData object.
  +     * @exception Exception, a generic exception.
  +     */
  +    protected void perform(RunData rundata)
  +    throws Exception
  +    {
  +        if (rundata.getParameters().getString("action") != null)
  +        {
  +            // if context is already defined and Actions defined, events 
  +            // have already been processed, call doPerform
  +            if (Log.getLogger().isDebugEnabled())
  +            {
  +                Log.debug("JspPortletAction: Action detected, calling doPerform");
  +            }
  +            doPerform(rundata);
  +        }
  +        else
  +        {
  +            try
  +            {
  +                // process implicit ActionEvent invocation
  +                Log.debug("JspPortletAction: try executing events");
  +                
  +                Portlet portlet = (Portlet) rundata.getRequest().getAttribute("portlet");
  +                
  +                if (portlet != null)
  +                {
  +                    executeEvents(rundata);
  +                    doPerform(rundata);
  +                }
  +            }                    
  +            catch (NoSuchMethodException e)
  +            {
  +                // no event selected, process normal context generation
  +                if (Log.getLogger().isDebugEnabled())
  +                {
  +                    Log.debug("JspPortletAction: no events, calling doPerform");
  +                }
  +                doPerform(rundata);
  +            }
  +        }
       }
   
       /** 
  
  
  
  1.4       +23 -3     jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/QuestionnaireAction.java
  
  Index: QuestionnaireAction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/QuestionnaireAction.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- QuestionnaireAction.java	28 Jan 2003 04:46:21 -0000	1.3
  +++ QuestionnaireAction.java	6 Feb 2003 16:14:27 -0000	1.4
  @@ -117,6 +117,25 @@
           }
   
           rundata.getRequest().setAttribute("questions", qa);
  +
  +        // After successful send, the user may or may not click the Continue button so
  +        // reset to default template here
  +        if (rundata.getRequest().getAttribute("email") == null)
  +        {
  +            this.setTemplate(rundata, portlet, null);
  +        }
  +
  +    }
  +
  +    /**
  +     * Continue event handler.
  +     *
  +     * @param portlet The jsp-based portlet that is being built.
  +     * @param rundata The turbine rundata context for this request.
  +     */
  +    public void doContinue(RunData rundata, Portlet portlet)
  +    {
  +        this.setTemplate(rundata, portlet, null);
       }
   
       /**
  @@ -215,7 +234,7 @@
               rundata.getRequest().setAttribute("email", emailBody.toString());
               String confirmTemplate = portlet.getPortletConfig().getInitParameter("confirm.template",

                                                                                    "JetspeedQuestionnaireConfirmation.jsp");
  -            this.setTemplate(rundata, confirmTemplate);
  +            this.setTemplate(rundata, portlet, confirmTemplate);
   
               rundata.setMessage("Email successfully sent");
           }
  @@ -225,9 +244,10 @@
               rundata.setMessage("Error sending email: " + e);
           }
   
  -        buildNormalContext(portlet, rundata);
  +        //buildNormalContext(portlet, rundata);
   
       }
  +
   
   }
   
  
  
  
  1.8       +4 -2      jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/JspPortlet.java
  
  Index: JspPortlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/JspPortlet.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- JspPortlet.java	28 Jan 2003 04:46:21 -0000	1.7
  +++ JspPortlet.java	6 Feb 2003 16:14:27 -0000	1.8
  @@ -64,6 +64,7 @@
   // Jetspeed portal
   import org.apache.jetspeed.portal.PortletException;
   import org.apache.jetspeed.services.template.TemplateLocatorService;
  +import org.apache.jetspeed.util.PortletSessionState;
   
   // Ecs 
   import org.apache.ecs.ConcreteElement;
  @@ -130,9 +131,10 @@
   
               // either the action selected the template, or use the default template 
               // defined in the registry
  -            if (rundata.getRequest().getAttribute(TEMPLATE) != null)
  +            if (PortletSessionState.getAttribute(this, rundata, TEMPLATE) != null)
               {
  -                template = (String) rundata.getRequest().getAttribute(TEMPLATE);
  +                template = (String) PortletSessionState.getAttribute(this, rundata, TEMPLATE);
  +                //PortletSessionState.clearAttribute(this, rundata, TEMPLATE);
                   if (Log.getLogger().isDebugEnabled())
                   {
                       Log.debug("JspPorlet: Template switched per request attribute to ["
+ template + "] for portlet [" + 
  
  
  
  1.3       +1 -0      jakarta-jetspeed/webapp/WEB-INF/templates/jsp/portlets/html/JetspeedQuestionnaire.jsp
  
  Index: JetspeedQuestionnaire.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/webapp/WEB-INF/templates/jsp/portlets/html/JetspeedQuestionnaire.jsp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JetspeedQuestionnaire.jsp	26 Jan 2003 05:04:03 -0000	1.2
  +++ JetspeedQuestionnaire.jsp	6 Feb 2003 16:14:27 -0000	1.3
  @@ -54,6 +54,7 @@
       <TR>
           <TD COLSPAN="2">
               <FORM METHOD="POST">
  +                <INPUT TYPE="hidden" NAME="js_peid" VALUE="<%=jspeid%>">  
           
                   <p>&nbsp;&nbsp;File containing image of the site: 
                   <INPUT TYPE="FILE" SIZE="30" NAME="emailAttachment" VALUE="">   
            
                   <p>&nbsp;&nbsp;
  
  
  
  1.2       +9 -1      jakarta-jetspeed/webapp/WEB-INF/templates/jsp/portlets/html/JetspeedQuestionnaireConfirmation.jsp
  
  Index: JetspeedQuestionnaireConfirmation.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/webapp/WEB-INF/templates/jsp/portlets/html/JetspeedQuestionnaireConfirmation.jsp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JetspeedQuestionnaireConfirmation.jsp	28 Jan 2003 04:46:21 -0000	1.1
  +++ JetspeedQuestionnaireConfirmation.jsp	6 Feb 2003 16:14:27 -0000	1.2
  @@ -1,6 +1,13 @@
   <%@ taglib uri='/WEB-INF/templates/jsp/tld/template.tld' prefix='jetspeed' %>
   
  +<%@ page import = "org.apache.turbine.util.RunData" %>
  +
  +<%@ page import = "java.util.Enumeration" %>
  +<%@ page import = "java.util.Hashtable" %>
  +
   <% 
  +RunData data = (RunData) request.getAttribute("rundata");
  +String jspeid = (String) request.getAttribute("js_peid");
   String email = (String) request.getAttribute("email");
   %>
   
  @@ -10,7 +17,8 @@
   <B><%=email%></B>
   <P>
   <FORM METHOD="POST">
  -    <INPUT TYPE="SUBMIT" VALUE="Continue">
  +    <INPUT TYPE="hidden" NAME="js_peid" VALUE="<%=jspeid%>">              
  +    <INPUT TYPE="SUBMIT" NAME="eventSubmit_doContinue" VALUE="Continue">
   </FORM>
   <P>
   Thank you again you for your contribution!
  
  
  
  1.121     +4 -1      jakarta-jetspeed/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/xdocs/changes.xml,v
  retrieving revision 1.120
  retrieving revision 1.121
  diff -u -r1.120 -r1.121
  --- changes.xml	28 Jan 2003 04:46:21 -0000	1.120
  +++ changes.xml	6 Feb 2003 16:14:28 -0000	1.121
  @@ -23,6 +23,9 @@
   </li>
   -->
   <li>
  +  Fixed - Bug # 16443 - 2003/02/05 - Reimplemented setTemplate method in JspPortletAction
to utilize session (MO)
  +</li>
  +<li>
     Fixed - Bug # 16443 - 2003/01/27 - Corrected the setTemplate functionality in JspPortletAction
(MO)
   </li>
   <li>
  
  
  

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


Mime
View raw message