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 Wed, 28 May 2003 20:03:31 GMT
morciuch    2003/05/28 13:03:31

  Modified:    docs/site changes.html
               webapp/WEB-INF/templates/jsp/portlets/html
                        JSP1_1andJetspeedTagLib.jsp
                        JSP1_2andJetspeedTagLib.jsp
                        parameter-demo-portlet.jsp
               webapp/WEB-INF/templates/jsp/tld template.tld
               xdocs    changes.xml
  Added:       src/java/org/apache/jetspeed/services/jsp/tags
                        JetspeedParameterStyleTag.java
  Log:
  Added parameter style jsp tag (see Bugzilla issue# 20313):
  
  Revision  Changes    Path
  1.147     +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.146
  retrieving revision 1.147
  diff -u -r1.146 -r1.147
  --- changes.html	27 May 2003 23:58:41 -0000	1.146
  +++ changes.html	28 May 2003 20:03:30 -0000	1.147
  @@ -135,6 +135,9 @@
   </li>
   -->
   <li>
  +  Add -   Bug # 20313 - 2003/05/28 - Added parameter style jsp tag (MO)
  +</li>
  +<li>
     Fix -   Bug # 7667  - 2003/05/27 - Fixing various inconsistencies in the portlet set
customizer (MO)
   </li>
   <li>
  
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/services/jsp/tags/JetspeedParameterStyleTag.java
  
  Index: JetspeedParameterStyleTag.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *     "Apache Jetspeed" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache" or
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.jetspeed.services.jsp.tags;
  
  // java classes
  import java.util.Hashtable;
  import java.util.StringTokenizer;
  
  // jsp api
  import javax.servlet.jsp.PageContext;
  import javax.servlet.jsp.JspException;
  import javax.servlet.jsp.tagext.BodyTagSupport;
  
  // Turbine Classes 
  import org.apache.turbine.util.RunData;
  import org.apache.turbine.util.Log;
  import org.apache.turbine.services.jsp.JspService;
  
  // jetspeed
  import org.apache.jetspeed.modules.ParameterLoader;
  import org.apache.jetspeed.services.security.PortalResource;
  import org.apache.jetspeed.om.registry.Parameter;
  import org.apache.jetspeed.om.registry.PortletEntry;
  import org.apache.jetspeed.services.JetspeedSecurity;
  import org.apache.jetspeed.om.security.JetspeedUser;
  import org.apache.jetspeed.services.Registry;
  
  /**
   * Supporting class for the parameter style tag.
   * Sends a parameter rendered using specific style to the output stream.
   * 
   * The following tag attributes are supported:
   * 
   * <UL>
   * <LI><code>name</code>: parameter name (required).</li>
   * <LI><code>style</code>: parameter style name (required)</LI>
   * <LI><code>value</code>: parameter current value</LI>
   * <LI><code>portlet</code>: portlet name to check security against</LI>
   * </UL>
   * <p>Note: tag body may also contain parameter style options in format: option1=value1;optionN=valueN.
Check
   * documentation for individual parameter style to see what options are supported</p>
   * <p>Note: Use care when specifying style options in the tag body - the body is not
cleansed to remove
   * embedded carriage returns and tabs.</p>
   * Examples:
   * <UL>
   * <LI><code>&lt;jetspeed:parameterStyle name="portlet-list" style="RegistryEntryListBox"/&gt;</CODE>
   * <LI><code>&lt;jetspeed:parameterStyle name="skin-list" style="RegistryEntryListBox"&gt;registry=Skin&lt;/jetspeed:parameterStyle/&gt;</CODE>
   * <LI><code>&lt;jetspeed:parameterStyle name="control-list" style="RegistryEntryListBox"
value="TabControl"&gt;registry=PortletControl&lt;/jetspeed:parameterStyle/&gt;</CODE>
   * </UL>
   * 
   * @author <a href="mailto:morciuch@apache.org">Mark Orciuch</a>
   * @version $Id: JetspeedParameterStyleTag.java,v 1.1 2003/05/28 20:03:30 morciuch Exp $
   */
  public class JetspeedParameterStyleTag extends BodyTagSupport
  {
  
      /**
       * name parameter defines parameter name
       */
      private String name = null;
  
      /**
       * name parameter defines parameter style
       */
      private String style = null;
  
      /**
       * name parameter defines current parameter style value
       */
      private String value = null;
  
      /**
       * name parameter defines portlet name to check security against
       */
      private String portlet = null;
  
      /**
       * The setter for name parameter
       * 
       * @param value
       */
      public void setName(String value)
      {
          this.name = value;
      }
  
      /**
       * The setter for value parameter
       * 
       * @param value
       */
      public void setValue(String value)
      {
          this.value = value;
      }
  
      /**
       * The setter for syle parameter
       * 
       * @param value
       */
      public void setStyle(String value)
      {
          this.style = value;
      }
  
      /**
       * The setter for value parameter
       * 
       * @param value
       */
      public void setPortlet(String value)
      {
          this.portlet = value;
      }
  
      /**
       * 
       * @return code
       * @exception JspException
       */
      public int doStartTag() throws JspException 
      {
          return EVAL_BODY_TAG;
      }
  
      /**
       * 
       * @return code
       * @exception JspException
       */
      public int doEndTag() throws JspException 
      {
          RunData data = (RunData) pageContext.getAttribute(JspService.RUNDATA, PageContext.REQUEST_SCOPE);
   
          String result = null;
  
          try
          {
  
              // See if body contains any parameter options
              String body = this.getBodyContent().getString();
              Hashtable options = new Hashtable();
  
              if (body != null && !body.trim().equalsIgnoreCase(""))
              {
                  StringTokenizer st = new StringTokenizer(body, ";");
                  String prefix = this.name + ".style.";
                  while (st.hasMoreTokens())
                  {
                      StringTokenizer pair = new StringTokenizer(st.nextToken(), "=");
                      if (pair.countTokens() == 2)
                      {
                          options.put(prefix + pair.nextToken().trim(), pair.nextToken().trim());
                      }
                  }
              }
  
              boolean canAccess = true;
  
              // If portlet name is specified, it will be used to check security for the parameter
              if (this.portlet != null)
              {
                  // Retrieve registry entry and its parameter
                  PortletEntry entry = (PortletEntry) Registry.getEntry(Registry.PORTLET,
this.portlet);
                  Parameter param = entry.getParameter(this.name);
  
                  // Verify security for the parameter
                  canAccess = JetspeedSecurity.checkPermission((JetspeedUser) data.getUser(),

                                                               new PortalResource(entry, param),

                                                               JetspeedSecurity.PERMISSION_CUSTOMIZE);
              }
  
              if (canAccess)
              {
                  result = ParameterLoader.getInstance().eval(data, 
                                                              this.style, 
                                                              this.name, 
                                                              this.value, 
                                                              options);                
              }
  
              pageContext.getOut().print(result);
  
  
          }
          catch (Exception e)
          {
              result = "<input type=\"text\" name=\"" + this.name + "\" value=\"" + this.value
+ "\"";
  
              String message = "Error processing portlet (PortletTag): [" + name + "]";
              Log.error(message, e);
              try
              {
                  pageContext.getOut().print(result);
              }
              catch (java.io.IOException ioe)
              {
              }
          }
  
          return EVAL_PAGE;
      }
  
  }
  
  
  1.6       +32 -0     jakarta-jetspeed/webapp/WEB-INF/templates/jsp/portlets/html/JSP1_1andJetspeedTagLib.jsp
  
  Index: JSP1_1andJetspeedTagLib.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/webapp/WEB-INF/templates/jsp/portlets/html/JSP1_1andJetspeedTagLib.jsp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- JSP1_1andJetspeedTagLib.jsp	29 Nov 2002 19:26:10 -0000	1.5
  +++ JSP1_1andJetspeedTagLib.jsp	28 May 2003 20:03:30 -0000	1.6
  @@ -177,6 +177,38 @@
         </tr>
       </table>
   
  +    <center><h2>jetspeed:parameterStyle</h2></center>
  +    <table>
  +      <tr>
  +        <th>name</th>
  +        <th>style</th>        
  +        <th>value</th>                
  +        <th>options</th>                
  +        <th>Returned Value</th>
  +      </tr>
  +      <tr>
  +        <td>portlet-list</td>
  +        <td>RegistryEntryListBox</td>  
  +        <td>&nbsp;</td>                              
  +        <td>&nbsp;</td>                
  +        <td><jetspeed:parameterStyle name="porlet-list" style="RegistryEntryListBox"/></td>
  +      </tr>
  +      <tr>
  +        <td>skin-list</td>
  +        <td>RegistryEntryListBox</td>  
  +        <td>&nbsp;</td>                              
  +        <td>registry=Skin;set-label=true</td>                
  +        <td><jetspeed:parameterStyle name="skin-list" style="RegistryEntryListBox">registry=Skin</jetspeed:parameterStyle></td>
  +      </tr>
  +      <tr>
  +        <td>control-list</td>
  +        <td>RegistryEntryListBox</td>  
  +        <td>TabControl</td>                              
  +        <td>registry=PortletControl;set-label=true</td>                
  +        <td><jetspeed:parameterStyle name="control-list" style="RegistryEntryListBox"
value="TabControl">registry=PortletControl;set-label=true</jetspeed:parameterStyle></td>
  +      </tr>
  +    </table>
  +
       <hr/>
       <center><h1>HTTP Request Header</h1></center>
       <table>
  
  
  
  1.5       +32 -0     jakarta-jetspeed/webapp/WEB-INF/templates/jsp/portlets/html/JSP1_2andJetspeedTagLib.jsp
  
  Index: JSP1_2andJetspeedTagLib.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/webapp/WEB-INF/templates/jsp/portlets/html/JSP1_2andJetspeedTagLib.jsp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JSP1_2andJetspeedTagLib.jsp	30 Nov 2002 19:03:24 -0000	1.4
  +++ JSP1_2andJetspeedTagLib.jsp	28 May 2003 20:03:30 -0000	1.5
  @@ -177,6 +177,38 @@
         </tr>
       </table>
   
  +    <center><h2>jetspeed:parameterStyle</h2></center>
  +    <table>
  +      <tr>
  +        <th>name</th>
  +        <th>style</th>        
  +        <th>value</th>                
  +        <th>options</th>                
  +        <th>Returned Value</th>
  +      </tr>
  +      <tr>
  +        <td>portlet-list</td>
  +        <td>RegistryEntryListBox</td>  
  +        <td>&nbsp;</td>                              
  +        <td>&nbsp;</td>                
  +        <td><jetspeed:parameterStyle name="porlet-list" style="RegistryEntryListBox"/></td>
  +      </tr>
  +      <tr>
  +        <td>skin-list</td>
  +        <td>RegistryEntryListBox</td>  
  +        <td>&nbsp;</td>                              
  +        <td>registry=Skin;set-label=true</td>                
  +        <td><jetspeed:parameterStyle name="skin-list" style="RegistryEntryListBox">registry=Skin</jetspeed:parameterStyle></td>
  +      </tr>
  +      <tr>
  +        <td>control-list</td>
  +        <td>RegistryEntryListBox</td>  
  +        <td>TabControl</td>                              
  +        <td>registry=PortletControl;set-label=true</td>                
  +        <td><jetspeed:parameterStyle name="control-list" style="RegistryEntryListBox"
value="TabControl">registry=PortletControl;set-label=true</jetspeed:parameterStyle></td>
  +      </tr>
  +    </table>
  +
       <hr/>
       <center><h1>HTTP Request Header</h1></center>
       <table>
  
  
  
  1.3       +3 -7      jakarta-jetspeed/webapp/WEB-INF/templates/jsp/portlets/html/parameter-demo-portlet.jsp
  
  Index: parameter-demo-portlet.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/webapp/WEB-INF/templates/jsp/portlets/html/parameter-demo-portlet.jsp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- parameter-demo-portlet.jsp	25 Apr 2003 19:02:25 -0000	1.2
  +++ parameter-demo-portlet.jsp	28 May 2003 20:03:30 -0000	1.3
  @@ -14,7 +14,6 @@
   <%@ page import = "org.apache.turbine.util.RunData" %>
   
   <%@ page import = "org.apache.jetspeed.portal.Portlet" %>
  -<%@ page import = "org.apache.jetspeed.modules.ParameterLoader" %>
   
   <%@ page import = "java.util.Hashtable" %>
   <%@ page import = "java.util.Enumeration" %>
  @@ -49,11 +48,8 @@
   </TABLE>
   
   <P>
  -Here's an example of using parameter style within the body of a portlet:
  +Here's an example of using parameter styles within the body of a portlet:
   <P>
  -<%
  -Hashtable map = new Hashtable();
  -map.put("skin-list.style.registry", "Skin");
  -%>
  -Available skins: <%=ParameterLoader.getInstance().eval(data, "RegistryEntryListBox","skin-list",
null, map)%>
  +Available skins: <jetspeed:parameterStyle name="skin-list" style="RegistryEntryListBox">registry=Skin;</jetspeed:parameterStyle>
  +Available controls: <jetspeed:parameterStyle name="control-list" value="TabControl"
style="RegistryEntryListBox">registry=PortletControl;</jetspeed:parameterStyle>
   
  
  
  
  1.15      +25 -0     jakarta-jetspeed/webapp/WEB-INF/templates/jsp/tld/template.tld
  
  Index: template.tld
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/webapp/WEB-INF/templates/jsp/tld/template.tld,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- template.tld	25 Apr 2003 20:43:23 -0000	1.14
  +++ template.tld	28 May 2003 20:03:30 -0000	1.15
  @@ -166,4 +166,29 @@
         <rtexprvalue>true</rtexprvalue>
       </attribute>
     </tag>  
  +  <tag>   
  +    <name>parameterStyle</name>
  +    <tagclass>org.apache.jetspeed.services.jsp.tags.JetspeedParameterStyleTag</tagclass>
  +    <bodycontent>JSP</bodycontent>
  +    <attribute>
  +      <name>name</name>
  +      <required>true</required>
  +      <rtexprvalue>true</rtexprvalue>
  +    </attribute>
  +    <attribute>
  +      <name>style</name>
  +      <required>true</required>
  +      <rtexprvalue>true</rtexprvalue>
  +    </attribute>
  +    <attribute>
  +      <name>value</name>
  +      <required>false</required>
  +      <rtexprvalue>true</rtexprvalue>
  +    </attribute>
  +    <attribute>
  +      <name>portlet</name>
  +      <required>false</required>
  +      <rtexprvalue>true</rtexprvalue>
  +    </attribute>
  +  </tag>  
   </taglib>
  
  
  
  1.166     +4 -1      jakarta-jetspeed/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/xdocs/changes.xml,v
  retrieving revision 1.165
  retrieving revision 1.166
  diff -u -r1.165 -r1.166
  --- changes.xml	27 May 2003 23:58:42 -0000	1.165
  +++ changes.xml	28 May 2003 20:03:30 -0000	1.166
  @@ -24,6 +24,9 @@
   </li>
   -->
   <li>
  +  Add -   Bug # 20313 - 2003/05/28 - Added parameter style jsp tag (MO)
  +</li>
  +<li>
     Fix -   Bug # 7667  - 2003/05/27 - Fixing various inconsistencies in the portlet set
customizer (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