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 Fri, 17 Jan 2003 18:39:55 GMT
morciuch    2003/01/17 10:39:54

  Modified:    docs/site changes.html
               webapp/WEB-INF/conf demo-portlets.xreg
               xdocs    changes.xml
  Added:       src/java/org/apache/jetspeed/modules/actions/portlets
                        QuestionnaireAction.java
               webapp/WEB-INF/templates/jsp/portlets/html
                        JetspeedQuestionnaire.jsp
  Log:
  Added Jetspeed Questionnaire portlet (see Bugzilla bug# 15215)
  
  Revision  Changes    Path
  1.97      +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.96
  retrieving revision 1.97
  diff -u -r1.96 -r1.97
  --- changes.html	16 Jan 2003 18:32:34 -0000	1.96
  +++ changes.html	17 Jan 2003 18:39:54 -0000	1.97
  @@ -133,6 +133,9 @@
   </li>
   -->
   <li>
  +  Add - Bug # 15215 - 2003/01/17 - Added Jetspeed Questionnaire portlet (MO)
  +</li>
  +<li>
     Update - Bug # 16174 - 2003/01/16 - Enabled security ref selection in the customizers
for user role (MO)
   </li>
   <li>
  
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/QuestionnaireAction.java
  
  Index: QuestionnaireAction.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2001 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.modules.actions.portlets;
  
  // Turbine stuff
  import org.apache.turbine.util.Log;
  import org.apache.turbine.util.RunData;
  
  // Jetspeed stuff
  import org.apache.jetspeed.portal.Portlet;
  import org.apache.jetspeed.om.registry.Parameter;
  import org.apache.jetspeed.services.Registry;
  import org.apache.jetspeed.om.registry.PortletEntry;
  import org.apache.jetspeed.services.resources.JetspeedResources;
  
  // Java stuff
  import java.util.Hashtable;
  import java.util.Iterator;
  import java.io.File;
  
  import javax.mail.Session;
  import javax.mail.Address;
  import javax.mail.Message;
  import javax.mail.Multipart;
  import javax.mail.Transport;
  import javax.mail.internet.MimeMessage;
  import javax.mail.internet.InternetAddress;
  import javax.mail.internet.MimeBodyPart;
  import javax.mail.internet.MimeMultipart;
  import javax.activation.FileDataSource;
  import javax.activation.DataHandler;
  
  /**
   * This action sets up the template context for retrieving stock quotes.
   *
   * @author <a href="mailto:morciuch@apache.org">Mark Orciuch</a>
   * @version $Id: QuestionnaireAction.java,v 1.1 2003/01/17 18:39:54 morciuch Exp $ 
   */
  
  public class QuestionnaireAction extends JspPortletAction
  {
  
      /**
       * Build the normal state content for this portlet.
       *
       * @param portlet The jsp-based portlet that is being built.
       * @param rundata The turbine rundata context for this request.
       */
      protected void buildNormalContext(Portlet portlet, RunData rundata)
      {
          PortletEntry entry = (PortletEntry) Registry.getEntry(Registry.PORTLET, portlet.getName());
          Iterator i = entry.getParameterNames();
          Hashtable qa = new Hashtable();
  
          while (i.hasNext())
          {
              String name = (String) i.next();
              Parameter param = entry.getParameter(name);
              if (param.isHidden() == false)
              {
                  String title = param.getTitle();
                  String value = portlet.getPortletConfig().getInitParameter(name);
                  qa.put(title, value);
              }
          }
  
          rundata.getRequest().setAttribute("questions", qa);
      }
  
      /**
       * Sort the quotes.
       *
       * @param portlet The jsp-based portlet that is being built.
       * @param rundata The turbine rundata context for this request.
       */
      public void doEmail(RunData rundata, Portlet portlet)
      {
          StringBuffer emailBody = new StringBuffer();
          PortletEntry entry = (PortletEntry) Registry.getEntry(Registry.PORTLET, portlet.getName());
          Iterator i = entry.getParameterNames();
  
          while (i.hasNext())
          {
              String name = (String) i.next();
              Parameter param = entry.getParameter(name);
              if (param.isHidden() == false)
              {
                  String title = param.getTitle();
                  String value = portlet.getPortletConfig().getInitParameter(name);
                  value = value == null || value.length() == 0 ? "NOT PROVIDED" : value;
                  emailBody.append(title);
                  emailBody.append(" ===> ");
                  emailBody.append(value);
                  emailBody.append("\n\n");
  
              }
          }
  
          String emailSmtp = JetspeedResources.getString(JetspeedResources.MAIL_SERVER_KEY);
          String emailFrom = rundata.getParameters().getString("emailFrom", rundata.getUser().getEmail());
          String emailTo = rundata.getParameters().getString("emailTo", "jetspeed-dev@jakarta.apache.org");
          String emailAttachment = rundata.getRequest().getParameter("emailAttachment");
          try
          {
              String emailText = emailBody.toString();
  
              // Create the JavaMail session
              java.util.Properties properties = System.getProperties();
              properties.put("mail.smtp.host", emailSmtp);
              Session emailSession = Session.getInstance(properties, null);
  
              // Construct the message
              MimeMessage message = new MimeMessage(emailSession);
  
              // Set the from address
              Address fromAddress = new InternetAddress(emailFrom);
              message.setFrom(fromAddress);
  
              // Parse and set the recipient addresses
              Address[] toAddresses = InternetAddress.parse(emailTo);
              message.setRecipients(Message.RecipientType.TO, toAddresses);
  
              // Set the subject and text
              message.setSubject("Jetspeed Questionnaire");
              message.setText(emailText);
  
              // Attach file with message
              if (emailAttachment != null)
              {
                  File file = new File(emailAttachment);
                  if (file.exists())
                  {
                      // create and fill the first message part
                      MimeBodyPart mbp1 = new MimeBodyPart();
                      mbp1.setText(emailText);
  
                      // create the second message part
                      MimeBodyPart mbp2 = new MimeBodyPart();
  
                      // attach the file to the message
                      FileDataSource fds = new FileDataSource(emailAttachment);
                      mbp2.setDataHandler(new DataHandler(fds));
                      mbp2.setFileName(fds.getName());
  
                      // create the Multipart and its parts to it
                      Multipart mp = new MimeMultipart();
                      mp.addBodyPart(mbp1);
                      mp.addBodyPart(mbp2);
  
                      // add the Multipart to the message
                      message.setContent(mp);
                  }
                  else
                  {
                      message.setText(emailBody.toString());
                  }
              }
  
              // send the message
              Transport.send(message);
  
              rundata.setMessage("Email successfully sent");
  
          }
          catch (Exception e)
          {
              Log.error(e);
              rundata.setMessage("Error sending email: " + e);
          }
  
          buildNormalContext(portlet, rundata);
  
      }
  
  }
  
  
  
  
  1.30      +137 -0    jakarta-jetspeed/webapp/WEB-INF/conf/demo-portlets.xreg
  
  Index: demo-portlets.xreg
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/webapp/WEB-INF/conf/demo-portlets.xreg,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- demo-portlets.xreg	2 Jan 2003 19:19:55 -0000	1.29
  +++ demo-portlets.xreg	17 Jan 2003 18:39:54 -0000	1.30
  @@ -433,4 +433,141 @@
   		<category group="Jetspeed">finance.stocks</category>
   		<category group="Jetspeed">jsp</category>
   	</portlet-entry>
  +	<portlet-entry name="JetspeedQuestionnairePortlet" hidden="false" type="ref" parent="JSP"
application="false">
  +		<security-ref parent="user-only"/>
  +		<meta-info>
  +			<title>Jetspeed Questionnaire</title>
  +			<description>Polls the Jetspeed community for information
  +                about their Jetspeed-powered sites</description>
  +		</meta-info>
  +		<parameter name="template" value="JetspeedQuestionnaire.jsp" hidden="true" cachedOnName="true"
cachedOnValue="true"/>
  +		<parameter name="action" value="portlets.QuestionnaireAction" hidden="true" cachedOnName="true"
cachedOnValue="true"/>
  +		<parameter name="q1" value="" type="style" hidden="false" cachedOnName="true" cachedOnValue="true">
  +			<meta-info>
  +				<title>Site Name and Brief Description of How It Is Used</title>
  +				<description>For example: Allows employees and customer
  +                    to manage order, catalogs, documentation, etc</description>
  +			</meta-info>
  +		</parameter>
  +		<parameter name="q1.style" value="TextArea" hidden="true" cachedOnName="true" cachedOnValue="true"/>
  +		<parameter name="q2" value="Internet" type="style" hidden="false" cachedOnName="true"
cachedOnValue="true">
  +			<meta-info>
  +				<title>Site Type</title>
  +				<description>Please e-mail a sample snapshot of your
  +                    portal if it&apos;s an Intranet or not yet available
  +                    via Internet</description>
  +			</meta-info>
  +		</parameter>
  +		<parameter name="q2.style" value="ListBox" hidden="true" cachedOnName="true" cachedOnValue="true"/>
  +		<parameter name="q2.style.items" value="Internet,Intranet" hidden="true" cachedOnName="true"
cachedOnValue="true"/>
  +		<parameter name="q3" value="Prototype" type="style" hidden="false" cachedOnName="true"
cachedOnValue="true">
  +			<meta-info>
  +				<title>Implementation Stage</title>
  +			</meta-info>
  +		</parameter>
  +		<parameter name="q3.style" value="ListBox" hidden="true" cachedOnName="true" cachedOnValue="true"/>
  +		<parameter name="q3.style.items" value="Prototype,Beta,Production" hidden="true" cachedOnName="true"
cachedOnValue="true"/>
  +		<parameter name="q4" value="" type="" hidden="false" cachedOnName="true" cachedOnValue="true">
  +			<meta-info>
  +				<title>Site URL (if internet site)</title>
  +			</meta-info>
  +		</parameter>
  +		<parameter name="q5" value="1.4 Beta 3" type="style" hidden="false" cachedOnName="true"
cachedOnValue="true">
  +			<meta-info>
  +				<title>Version of Jetspeed Used</title>
  +			</meta-info>
  +		</parameter>
  +		<parameter name="q5.style" value="ListBox" hidden="true" cachedOnName="true" cachedOnValue="true"/>
  +		<parameter name="q5.style.items" value="1.3x,1.4 Beta 1, 1.4 Beta 2, 1.4 Beta 3,CVS"
hidden="true" cachedOnName="true" cachedOnValue="true"/>
  +		<parameter name="q6" value="" type="" hidden="false" cachedOnName="true" cachedOnValue="true">
  +			<meta-info>
  +				<title>Operating System Platform</title>
  +			</meta-info>
  +		</parameter>
  +		<parameter name="q7" value="Tomcat" type="style" hidden="false" cachedOnName="true"
cachedOnValue="true">
  +			<meta-info>
  +				<title>Servlet Container Used</title>
  +			</meta-info>
  +		</parameter>
  +		<parameter name="q7.style" value="ListBox" hidden="true" cachedOnName="true" cachedOnValue="true"/>
  +		<parameter name="q7.style.items" value="Tomcat,WebSphere,WebLogic,Other" hidden="true"
cachedOnName="true" cachedOnValue="true"/>
  +		<parameter name="q8" value="" type="style" hidden="false" cachedOnName="true" cachedOnValue="true">
  +			<meta-info>
  +				<title>Hardware Configuration Used</title>
  +			</meta-info>
  +		</parameter>
  +		<parameter name="q8.style" value="TextArea" hidden="true" cachedOnName="true" cachedOnValue="true"/>
  +		<parameter name="q9" value="" type="" hidden="false" cachedOnName="true" cachedOnValue="true">
  +			<meta-info>
  +				<title>Number of Users</title>
  +			</meta-info>
  +		</parameter>
  +		<parameter name="q10" value="" type="" hidden="false" cachedOnName="true" cachedOnValue="true">
  +			<meta-info>
  +				<title>Number of Nodes Running Replicated Jetspeed</title>
  +			</meta-info>
  +		</parameter>
  +		<parameter name="q11" value="Velocity" type="style" hidden="false" cachedOnName="true"
cachedOnValue="true">
  +			<meta-info>
  +				<title>Default Template Engine</title>
  +			</meta-info>
  +		</parameter>
  +		<parameter name="q11.style" value="ListBox" hidden="true" cachedOnName="true" cachedOnValue="true"/>
  +		<parameter name="q11.style.items" value="Velocity,JSP" hidden="true" cachedOnName="true"
cachedOnValue="true"/>
  +		<parameter name="q12" value="Turbine" type="style" hidden="false" cachedOnName="true"
cachedOnValue="true">
  +			<meta-info>
  +				<title>Security Type Used</title>
  +			</meta-info>
  +		</parameter>
  +		<parameter name="q12.style" value="ListBox" hidden="true" cachedOnName="true" cachedOnValue="true"/>
  +		<parameter name="q12.style.items" value="Turbine,LDAP,None,Custom" hidden="true" cachedOnName="true"
cachedOnValue="true"/>
  +		<parameter name="q13" value="Hypersonic" type="style" hidden="false" cachedOnName="true"
cachedOnValue="true">
  +			<meta-info>
  +				<title>Default Database</title>
  +			</meta-info>
  +		</parameter>
  +		<parameter name="q13.style" value="ListBox" hidden="true" cachedOnName="true" cachedOnValue="true"/>
  +		<parameter name="q13.style.items" value="Hypersonic,mySQL,Oracle,SQLServer,Sybase,DB/2,Other"
hidden="true" cachedOnName="true" cachedOnValue="true"/>
  +		<parameter name="q14" value="Disk" type="style" hidden="false" cachedOnName="true"
cachedOnValue="true">
  +			<meta-info>
  +				<title>PSML Persistence Mechanism</title>
  +			</meta-info>
  +		</parameter>
  +		<parameter name="q14.style" value="ListBox" hidden="true" cachedOnName="true" cachedOnValue="true"/>
  +		<parameter name="q14.style.items" value="Disk,Database" hidden="true" cachedOnName="true"
cachedOnValue="true"/>
  +		<parameter name="q15" value="" type="style" hidden="false" cachedOnName="true" cachedOnValue="true">
  +			<meta-info>
  +				<title>Jetspeed Features Used</title>
  +				<description>For example: WebPagePortlet, RSS Portlet,
  +                    PSML, Reference Links, Registry security, etc.</description>
  +			</meta-info>
  +		</parameter>
  +		<parameter name="q15.style" value="TextArea" hidden="true" cachedOnName="true" cachedOnValue="true"/>
  +		<parameter name="q16" value="" type="style" hidden="false" cachedOnName="true" cachedOnValue="true">
  +			<meta-info>
  +				<title>Customization to Base Jetspeed</title>
  +				<description>For example: portlets added, custom
  +                    security, integration with CMS, etc.</description>
  +			</meta-info>
  +		</parameter>
  +		<parameter name="q16.style" value="TextArea" hidden="true" cachedOnName="true" cachedOnValue="true"/>
  +		<parameter name="q17" value="" type="" hidden="false" cachedOnName="true" cachedOnValue="true">
  +			<meta-info>
  +				<title>Contact E-Mail Address</title>
  +				<description>Optional, if you don&apos;t want people to
  +                    e-mail you questions about your site</description>
  +			</meta-info>
  +		</parameter>
  +		<parameter name="q18" value="" type="style" hidden="false" cachedOnName="true" cachedOnValue="true">
  +			<meta-info>
  +				<title>Check here if we have the permission to publish
  +                    snapshot and/or link to your site</title>
  +			</meta-info>
  +		</parameter>
  +		<parameter name="q18.style" value="CheckBox" hidden="true" cachedOnName="true" cachedOnValue="true"/>
  +		<media-type ref="html"/>
  +		<url cachedOnURL="true"/>
  +		<category group="Jetspeed">jsp</category>
  +		<category group="Jetspeed">questionnaire</category>
  +	</portlet-entry>
   </registry>
  
  
  
  1.1                  jakarta-jetspeed/webapp/WEB-INF/templates/jsp/portlets/html/JetspeedQuestionnaire.jsp
  
  Index: JetspeedQuestionnaire.jsp
  ===================================================================
  <%@ taglib uri='/WEB-INF/templates/jsp/tld/template.tld' prefix='jetspeed' %>
  
  <%@ page import = "org.apache.turbine.util.Log" %>
  <%@ 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");
  %>
  
  <p>
  Dear Jetspeed User:
  <P>
  Thank you for taking the time to filling out this questionnaire - think of it as a form
contributing back to the project. 
  It will allow us to get a better picture of how Jetspeed is used and, in turn, respond better
to Jetspeed community's needs. 
  Also, we hope that it will provide some concrete real world examples to convince you, your
bosses or clients that Jetspeed is 
  the right choice for a portal product.
  <P>
  Please be as specific as your particular situation allows you to be. We realize that you
may have to get special permission 
  to release information about intranet projects - just do your best.
  <p> 
  The following table lists your current responses. Click <a href="<jetspeed:portletlink
jspeid="<%=jspeid%>" action="controls.Customize"/>">here</A> 
  to change your responses (or customize this portlet) and see your changes reflected in the
table below:
  <P>
  <TABLE BORDER="1">
      <TR>
          <TH>Question</TH>
          <TH>Response</TH>
      </TR>
  <%
  Hashtable questions = (Hashtable) request.getAttribute("questions");
  if (questions != null)
  {
      Enumeration i = questions.keys();
  
      while(i.hasMoreElements())
      {
          String title = (String) i.nextElement();
          String value = (String) questions.get(title);
          value = value == null || value.length() == 0 ? "NOT PROVIDED" : value;
  %>
      <TR>
          <TD><B><%=title%></B></TD>
          <TD><%=(value.equalsIgnoreCase("") ? "&nbsp;" : value) %></TD>
      </TR>
  <%
      }
  }
  
  %>
      <TR>
          <TD COLSPAN="2">
              <FORM METHOD="POST">
                  <p>&nbsp;&nbsp;File containing image of the site: 
                  <INPUT TYPE="FILE" SIZE="30" NAME="emailAttachment" VALUE="">    
           
                  <p>&nbsp;&nbsp;
                  <INPUT TYPE="SUBMIT" NAME="eventSubmit_doEmail" VALUE="E-Mail Questionnaire">
to 
                  <INPUT TYPE="TEXT" SIZE="30" NAME="emailTo" VALUE="jetspeed-dev@jakarta.apache.org">
                   from <INPUT TYPE="TEXT" SIZE="30" NAME="emailFrom" VALUE="<%=data.getUser().getEmail()%>">
                  &nbsp;&nbsp;<font COLOR="RED"><B><%=data.getMessage()
== null ? "" : data.getMessage()%></B></FONT>
              </FORM>
          </TD>
      </TR>
  </TABLE>
  <P>
  Thank you again you for your contribution!
  <P>
  Jetspeed Development Team
  <P>
  <IMG SRC="<jetspeed:contentUri href="images/jetspeed-powered.gif"/>">
  
  
  
  1.114     +4 -1      jakarta-jetspeed/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/xdocs/changes.xml,v
  retrieving revision 1.113
  retrieving revision 1.114
  diff -u -r1.113 -r1.114
  --- changes.xml	16 Jan 2003 18:32:34 -0000	1.113
  +++ changes.xml	17 Jan 2003 18:39:54 -0000	1.114
  @@ -23,6 +23,9 @@
   </li>
   -->
   <li>
  +  Add - Bug # 15215 - 2003/01/17 - Added Jetspeed Questionnaire portlet (MO)
  +</li>
  +<li>
     Update - Bug # 16174 - 2003/01/16 - Enabled security ref selection in the customizers
for user role (MO)
   </li>
   <li>
  
  
  

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


Mime
View raw message