You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2004/11/19 22:53:12 UTC

cvs commit: jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/localeselector LocaleSelectorPortlet.java

taylor      2004/11/19 13:53:12

  Modified:    applications/jsf-demo/src/webapp/WEB-INF faces-config.xml
                        portlet.xml
               applications/demo/src/webapp/WEB-INF portlet.xml
               applications/pam/src/webapp/WEB-INF portlet.xml
                        jetspeed-portlet.xml
  Added:       applications/pam/src/java/org/apache/jetspeed/portlets/localeselector/resources
                        LocaleSelectorResources_it.properties
                        LocaleSelectorResources_ja.properties
                        LocaleSelectorResources_zh.properties
                        LocaleSelectorResources_en.properties
                        LocaleSelectorResources_fr.properties
                        LocaleSelectorResources_nl.properties
                        LocaleSelectorResources.properties
               applications/jsf-demo/src/java/org/apache/portals/applications/desktop/resources
                        Calendar_en.properties Calendar_de.properties
               applications/demo/src/webapp/WEB-INF/view bookmark-view.jsp
                        bookmark-edit.jsp bookmark-help.jsp
               applications/demo/src/java/org/apache/jetspeed/demo/simple
                        PickANumberPortlet.java
               applications/demo/src/java/org/apache/portals/applications/desktop/resources
                        Bookmark_de.properties Bookmark_en.properties
               applications/jsf-demo/src/java/org/apache/portals/applications/desktop/calendar
                        CalendarBean.java
               applications/pam/src/webapp/WEB-INF/view locale-list.jsp
               applications/demo/src/java/org/apache/portals/applications/desktop
                        BookmarkPortlet.java
               applications/jsf-demo/src/webapp/WEB-INF/view
                        calendar-help.html calendar-edit.jsp
                        calendar-notes.jsp calendar-view.jsp
               applications/pam/src/java/org/apache/jetspeed/portlets/localeselector
                        LocaleSelectorPortlet.java
  Removed:     applications/localeselector/src/java/org/apache/jetspeed/portlets/localeselector/resources
                        LocaleSelectorResources_fr.properties
                        LocaleSelectorResources_it.properties
                        LocaleSelectorResources_en.properties
                        LocaleSelectorResources_zh.properties
                        LocaleSelectorResources.properties
                        LocaleSelectorResources_ja.properties
                        LocaleSelectorResources_nl.properties
               applications/localeselector/src/webapp/WEB-INF portlet.xml
                        web.xml portlet.tld jetspeed-portlet.xml
               applications/localeselector/xdocs navigation.xml
               applications/localeselector project.xml maven.xml .cvsignore
                        project.properties
               applications/demo/src/java/org/apache/jetspeed/demo/simple
                        PickANumberServlet.java
               applications/localeselector/src/webapp/WEB-INF/view
                        locale-list.jsp
               applications/localeselector/src/java/org/apache/jetspeed/portlets/localeselector
                        LocaleSelectorPortlet.java
  Log:
  http://nagoya.apache.org/jira/browse/JS2-163
  
   Ive decided to cut back on the re-org of the demo portlets.
  Ate suggested that I do not combine the struts, jsf, perl, php and demo portlets all into one big demo.
  Reason: because its better for users to clearly see the dependencies in a project based on one bridge.
  I think he has a valid point.
  
  So instead the re-org involves:
  
  - new RSS app
  - new Bookmark portlet in /demo
  - new Calendar portlet in /jsf-demo
  - dropped the idea of a /general (/desktop) app, maybe later when Bookmark and Calendar mature out of demo
  - move LocaleSelector into PAM (its dependent on J2, it has to go with other J2-dependent portlets)
  
  Revision  Changes    Path
  1.1                  jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources_it.properties
  
  Index: LocaleSelectorResources_it.properties
  ===================================================================
  # Copyright 2004 The Apache Software Foundation
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  #
  # Please contact me if you have any questions or suggestion : desmax74@yahoo.it
  #
  # Italian version by Dess� Massimiliano  <a href="desmax74@yahoo.it.it">desmax74@yahoo.it</a>.
  # Vers 0.1 jetspeed 2.0   10/08/2004
  #
  # $Id: LocaleSelectorResources_it.properties,v 1.1 2004/11/19 21:53:11 taylor Exp $
  #
  
  # Label
  localeselector.label.language=Lingua:
  localeselector.label.change=cambia
  
  # Locale Name
  localeselector.locale.de=Tedesco
  localeselector.locale.en=Inglese
  localeselector.locale.es=Spagnolo
  localeselector.locale.fr=Francese
  localeselector.locale.it=Italiano
  localeselector.locale.ja=Giapponese
  localeselector.locale.ko=Coreano
  localeselector.locale.nl=Olandese
  localeselector.locale.sv=Svedese
  localeselector.locale.zh=Cinese semplificato
  localeselector.locale.zh_TW=Cinese tradizionale
  localeselector.locale.ru=Russo
  
  
  
  
  1.1                  jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources_ja.properties
  
  Index: LocaleSelectorResources_ja.properties
  ===================================================================
  # Copyright 2004 The Apache Software Foundation
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  #
  # $Id: LocaleSelectorResources_ja.properties,v 1.1 2004/11/19 21:53:11 taylor Exp $
  #
  # LOCALIZATION MAINTAINER:
  #  Shinsuke Sugaya <sh...@yahoo.co.jp>
  
  # portlet info
  javax.portlet.title=\u8A00\u8A9E\u9078\u629E
  javax.portlet.short-title=\u597D\u307F\u306E\u8A00\u8A9E\u3092\u9078\u629E\u3059\u308B\u305F\u3081\u306E\u30DD\u30FC\u30C8\u30EC\u30C3\u30C8\u3067\u3059\u3002
  javax.portlet.keywords=\u30ED\u30B1\u30FC\u30EB,\u8A00\u8A9E
  
  # Label
  localeselector.label.language=\u8A00\u8A9E:
  localeselector.label.change=\u5909\u66F4
  
  # Locale Name
  localeselector.locale.de=\u30C9\u30A4\u30C4\u8A9E
  localeselector.locale.en=\u82F1\u8A9E
  localeselector.locale.es=\u30B9\u30DA\u30A4\u30F3\u8A9E
  localeselector.locale.fr=\u30D5\u30E9\u30F3\u30B9\u8A9E
  localeselector.locale.it=\u30A4\u30BF\u30EA\u30A2\u8A9E
  localeselector.locale.ja=\u65E5\u672C\u8A9E
  localeselector.locale.ko=\u97D3\u56FD\u8A9E
  localeselector.locale.nl=\u30AA\u30E9\u30F3\u30C0\u8A9E
  localeselector.locale.sv=\u30B9\u30A6\u30A7\u30FC\u30C7\u30F3\u8A9E
  localeselector.locale.zh=\u7C21\u4F53\u5B57\u4E2D\u56FD\u8A9E
  localeselector.locale.zh_TW=\u7E41\u4F53\u5B57\u4E2D\u56FD\u8A9E
  localeselector.locale.ru=\u82F1\u8A9E
  
  
  
  1.1                  jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources_zh.properties
  
  Index: LocaleSelectorResources_zh.properties
  ===================================================================
  # Copyright 2004 The Apache Software Foundation
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  #
  # $Id: LocaleSelectorResources_zh.properties,v 1.1 2004/11/19 21:53:11 taylor Exp $
  #
  # LOCALIZATION MAINTAINER:
  #  Yi Shen <sh...@gmail.com>
  
  # portlet info
  javax.portlet.title=\u9009\u62e9\u60a8\u7684\u8bed\u8a00
  javax.portlet.short-title=\u9009\u62e9\u60a8\u7684\u9ed8\u8ba4\u8bed\u8a00
  javax.portlet.keywords=\u533a\u57df\u8bed\u8a00,\u8bed\u8a00
  
  # Label
  localeselector.label.language=\u8bed\u8a00:
  localeselector.label.change=\u66f4\u6539
  
  # Locale Name
  localeselector.locale.de=\u5fb7\u8bed
  localeselector.locale.en=\u82f1\u8bed
  localeselector.locale.es=\u897f\u73ed\u7259\u8bed
  localeselector.locale.fr=\u6cd5\u8bed
  localeselector.locale.it=\u610f\u5927\u5229\u8bed
  localeselector.locale.ja=\u65e5\u8bed
  localeselector.locale.ko=\u97e9\u56fd\u8bed
  localeselector.locale.nl=\u8377\u5170\u8bed
  localeselector.locale.sv=\u745e\u5178\u8bed
  localeselector.locale.zh=\u7b80\u4f53\u4e2d\u6587
  localeselector.locale.zh_TW=\u7e41\u4f53\u4e2d\u6587
  localeselector.locale.ru=\u4fc4\u8bed
  
  
  
  
  1.1                  jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources_en.properties
  
  Index: LocaleSelectorResources_en.properties
  ===================================================================
  # Copyright 2004 The Apache Software Foundation
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  #
  # $Id: LocaleSelectorResources_en.properties,v 1.1 2004/11/19 21:53:11 taylor Exp $
  #
  # LOCALIZATION MAINTAINER:
  #  Jetspeed Development Team
  
  # portlet info
  javax.portlet.title=Locale Selector
  javax.portlet.short-title=This is a portlet to select your preferred locale
  javax.portlet.keywords=Locale,Language
  
  # Label
  localeselector.label.language=Language:
  localeselector.label.change=Change
  
  # Locale Name
  localeselector.locale.de=German
  localeselector.locale.en=English
  localeselector.locale.es=Spanish
  localeselector.locale.fr=French
  localeselector.locale.it=Italian
  localeselector.locale.ja=Japanese
  localeselector.locale.ko=Korean
  localeselector.locale.nl=Dutch
  localeselector.locale.sv=Swedish
  localeselector.locale.zh=Simplified Chinese
  localeselector.locale.zh_TW=Traditional Chinese
  localeselector.locale.ru=Russian
  
  
  
  
  1.1                  jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources_fr.properties
  
  Index: LocaleSelectorResources_fr.properties
  ===================================================================
  # Copyright 2004 The Apache Software Foundation
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  #
  # $Id: LocaleSelectorResources_fr.properties,v 1.1 2004/11/19 21:53:11 taylor Exp $
  #
  
  # Label
  localeselector.label.language=Language:
  localeselector.label.change=Change
  
  # Locale Name
  localeselector.locale.de=Allemand
  localeselector.locale.en=Anglais
  localeselector.locale.es=Espanol
  localeselector.locale.fr=Francais
  localeselector.locale.it=Italien
  localeselector.locale.ja=Japonais
  localeselector.locale.ko=Coreen
  localeselector.locale.nl=Neerlandais
  localeselector.locale.sv=Suedois
  localeselector.locale.zh=Chinois Simplifie
  localeselector.locale.zh_TW=Chinois Traditionnel
  localeselector.locale.ru=Russe
  
  
  
  
  
  1.1                  jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources_nl.properties
  
  Index: LocaleSelectorResources_nl.properties
  ===================================================================
  # Copyright 2004 The Apache Software Foundation
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  #
  # $Id: LocaleSelectorResources_nl.properties,v 1.1 2004/11/19 21:53:11 taylor Exp $
  #
  
  # Label
  localeselector.label.language=Taal:
  localeselector.label.change=Wijzigen
  
  # Locale Name
  localeselector.locale.de=Duits
  localeselector.locale.en=Engels
  localeselector.locale.es=Spaans
  localeselector.locale.fr=Frans
  localeselector.locale.it=Italiaans
  localeselector.locale.ja=Japans
  localeselector.locale.ko=Koreaans
  localeselector.locale.nl=Nederlands
  localeselector.locale.sv=Zweeds
  localeselector.locale.zh=Vereenvoudigd Chinees
  localeselector.locale.zh_TW=Traditioneel Chinees
  localeselector.locale.ru=Russisch
  
  
  
  
  1.1                  jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/localeselector/resources/LocaleSelectorResources.properties
  
  Index: LocaleSelectorResources.properties
  ===================================================================
  # Copyright 2004 The Apache Software Foundation
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  #
  # $Id: LocaleSelectorResources.properties,v 1.1 2004/11/19 21:53:11 taylor Exp $
  #
  
  # Base Locales
  # DO NOT TRANSLATE & DO NOT INCLUDE IN L10N PROPERTIES FILE
  localeselector.locales=de,en,es,fr,it,ja,ko,nl,sv,zh,zh_TW
  
  # Label
  localeselector.label.language=Language:
  localeselector.label.change=Change
  
  # Locale Name
  localeselector.locale.de=German
  localeselector.locale.en=English
  localeselector.locale.es=Spanish
  localeselector.locale.fr=French
  localeselector.locale.it=Italian
  localeselector.locale.ja=Japanese
  localeselector.locale.ko=Korean
  localeselector.locale.nl=Dutch
  localeselector.locale.sv=Swedish
  localeselector.locale.zh=Simplified Chinese
  localeselector.locale.zh_TW=Traditional Chinese
  localeselector.locale.ru=Russian
  
  
  
  1.1                  jakarta-jetspeed-2/applications/jsf-demo/src/java/org/apache/portals/applications/desktop/resources/Calendar_en.properties
  
  Index: Calendar_en.properties
  ===================================================================
  javax.portlet.title = Calendar Portlet
  javax.portlet.short-title = Calendar
  javax.portlet.keywords = calendar
  calendar.page = Calendar Page
  calendar.notes = Notes
  add = Save
  edit = Edit
  cancel = Cancel
  
  
  
  1.1                  jakarta-jetspeed-2/applications/jsf-demo/src/java/org/apache/portals/applications/desktop/resources/Calendar_de.properties
  
  Index: Calendar_de.properties
  ===================================================================
  javax.portlet.title = Kalender Portlet
  javax.portlet.short-title = Kalendar
  javax.portlet.keywords = kalendar
  calendar.page = Kalendar Seit
  calendar.notes = Anmerkungen
  edit = Edit
  add = Hinzuf�gen
  cancel = Abbrechen
  
  
  
  1.7       +22 -0     jakarta-jetspeed-2/applications/jsf-demo/src/webapp/WEB-INF/faces-config.xml
  
  Index: faces-config.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/jsf-demo/src/webapp/WEB-INF/faces-config.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- faces-config.xml	17 Nov 2004 01:06:43 -0000	1.6
  +++ faces-config.xml	19 Nov 2004 21:53:12 -0000	1.7
  @@ -123,6 +123,28 @@
       </navigation-case>
     </navigation-rule>
   
  +	<navigation-rule>
  +        <from-view-id>/WEB-INF/view/calendar-view.jsp</from-view-id> 
  +		<navigation-case>
  +			<from-outcome>editNotes</from-outcome>
  +            <to-view-id>/WEB-INF/view/calendar-notes.jsp</to-view-id>
  +		</navigation-case>
  +	</navigation-rule>
  +
  +	<navigation-rule>
  +        <from-view-id>/WEB-INF/view/calendar-notes.jsp</from-view-id> 
  +		<navigation-case>
  +			<from-outcome>returnFromNotes</from-outcome>
  +            <to-view-id>/WEB-INF/view/calendar-view.jsp</to-view-id>
  +		</navigation-case>
  +	</navigation-rule>
  +	
  +    <managed-bean>
  +        <managed-bean-name>calendar</managed-bean-name>
  +        <managed-bean-class>org.apache.portals.applications.desktop.calendar.CalendarBean</managed-bean-class>
  +        <managed-bean-scope>session</managed-bean-scope>
  +    </managed-bean>
  +
     <managed-bean>
       <description>
         The "backing file" bean that backs up the guessNumber webapp
  
  
  
  1.3       +35 -0     jakarta-jetspeed-2/applications/jsf-demo/src/webapp/WEB-INF/portlet.xml
  
  Index: portlet.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/jsf-demo/src/webapp/WEB-INF/portlet.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- portlet.xml	17 Aug 2004 20:06:14 -0000	1.2
  +++ portlet.xml	19 Nov 2004 21:53:12 -0000	1.3
  @@ -40,4 +40,39 @@
               <short-title>guessNumber</short-title>
           </portlet-info>
       </portlet>
  +	
  +   <portlet>
  +        <description>Calendar Portlet</description>		
  +        <portlet-name>CalendarPortlet</portlet-name>		
  +        <display-name>Calendar</display-name>		
  +        <portlet-class>org.apache.portals.bridges.myfaces.FacesPortlet</portlet-class>
  +        <init-param>
  +            <name>ViewPage</name>
  +            <value>/WEB-INF/view/calendar-view.jsp</value>
  +        </init-param>
  +        <init-param>
  +            <name>HelpPage</name>
  +            <value>/WEB-INF/view/calendar-help.html</value>
  +        </init-param>
  +        <init-param>
  +            <name>EditPage</name>
  +            <value>/WEB-INF/view/calendar-edit.jsp</value>
  +        </init-param>
  +        <expiration-cache>-1</expiration-cache>		        
  +        <supports>
  +			<mime-type>text/html</mime-type>
  +            <portlet-mode>VIEW</portlet-mode>
  +            <portlet-mode>EDIT</portlet-mode>
  +            <portlet-mode>HELP</portlet-mode>
  +		</supports>
  +        <supported-locale>en</supported-locale>        
  +        <supported-locale>de</supported-locale>
  +	    <resource-bundle>org.apache.portals.applications.desktop.resources.Calendar</resource-bundle>            
  +		<portlet-info>
  +            <title>Calendar</title>
  +            <short-title>Calendar</short-title>
  +			<keywords>calendar,desktop</keywords>
  +        </portlet-info>
  +	</portlet>
  +	
   </portlet-app>
  
  
  
  1.1                  jakarta-jetspeed-2/applications/demo/src/webapp/WEB-INF/view/bookmark-view.jsp
  
  Index: bookmark-view.jsp
  ===================================================================
  <%@ page session="false" %>                            
  <%@ page import="javax.portlet.*"%>
  <%@ page import="java.util.Enumeration"%>
  <%@ page import="java.util.ResourceBundle"%>
  <%@ taglib uri='/WEB-INF/portlet.tld' prefix='portlet'%>
  <portlet:defineObjects/>                            
  
  <%
  ResourceBundle myText = portletConfig.getResourceBundle(renderRequest.getLocale());         
  %>
  <br><B><%=myText.getString("available_bookmarks")%></B><br><br>       
  <%
    PortletPreferences prefs = renderRequest.getPreferences();
    Enumeration e = prefs.getNames();                        
    if (!e.hasMoreElements()) // no bookmarks
      {
  %>
        <%=myText.getString("no_bookmarks")%><BR>
  <%
      }
    while (e.hasMoreElements())
      {
        String name = (String)e.nextElement();
        String value = prefs.getValue
                       (name,"<"+
                       myText.getString("undefined")+">");
  %>
        <A target="_blank" HREF=<%=value%>><%=name%></A><BR>                
  <%
      }
  %>
  <br>
  
  
  1.1                  jakarta-jetspeed-2/applications/demo/src/webapp/WEB-INF/view/bookmark-edit.jsp
  
  Index: bookmark-edit.jsp
  ===================================================================
  <%@ page session="false" %>
  <%@ page import="javax.portlet.*"%>
  <%@ page import="java.util.*"%>
  <%@ taglib uri='/WEB-INF/portlet.tld' prefix='portlet'%>
  
  <portlet:actionURL portletMode="edit" var="myAction">
  	<portlet:param name="add" value="add"/>
  </portlet:actionURL>
  
  <portlet:renderURL portletMode="view" var="myCancel"/>
  
  <jsp:useBean id="addUrl" scope="request" 
   class="java.lang.String" />                        
  <jsp:useBean id="cancelUrl" scope="request" 
   class="java.lang.String" />                        
  <portlet:defineObjects/>
  <%
  ResourceBundle myText = portletConfig.getResourceBundle(request.getLocale());
  %>
  <B><%=myText.getString("available_bookmarks")%></B><br>
  <FORM ACTION="<%=myAction%>" METHOD="POST">            
  <TABLE CELLPADDING=0 CELLSPACING=4>                
    <TR>                                        
      <TD>                                    
        <B><%=myText.getString("name")%></B>        
      </TD>                                        
      <TD>                                        
        <B><%=myText.getString("url")%></B>        
      </TD>                                        
      <TD>    
      </TD>
    </TR>
  <%
  PortletPreferences prefs = renderRequest.getPreferences();
  Enumeration e = prefs.getNames();
  while (e.hasMoreElements())
    {
      String name = (String)e.nextElement();
      String value = prefs.getValue(name,
                         "<" +
                         myText.getString("undefined") 
                         +">");
  %>
      <TR>
        <TD>
          <%=name%>                                
        </TD>
        <TD>
          <%=value%>                                
        </TD>
        <TD>
          <portlet:actionURL var="removeUrl">            
             <portlet:param name="remove" value="<%=name%>"/> 
          </portlet:actionURL>                        
          <A HREF ="<%=removeUrl.toString()%>">        
  [<%=myText.getString("delete")%>]            
     </A>                                    
        </TD>
      </TR>
  <%
    }
  %>
    <TR>
      <TD>
        <INPUT NAME="name" TYPE="text">                
      </TD>                                        
      <TD>                                        
        <INPUT NAME="value" size='50' TYPE="text">            
      </TD>                                        
      <TD>                                        
        <INPUT NAME="add" TYPE="submit"                 
         value="<%=myText.getString("add")%>">            
      </TD>
    </TR>
  </TABLE>
  </FORM>
  <FORM ACTION="<%=myCancel%>" METHOD="POST">            
  <INPUT NAME="cancel"  TYPE="submit"                 
   VALUE="<%=myText.getString("cancel")%>">            
  </FORM>                                    
  
  
  1.1                  jakarta-jetspeed-2/applications/demo/src/webapp/WEB-INF/view/bookmark-help.jsp
  
  Index: bookmark-help.jsp
  ===================================================================
  <%@ page session="false" %>
  <%@ page import="javax.portlet.*"%>
  <%@ page import="java.util.*"%>
  <%@ taglib uri='/WEB-INF/portlet.tld' prefix='portlet'%>
  
  <portlet:renderURL portletMode="view" var="myCancel"/>
  
  <portlet:defineObjects/>
  <%
  ResourceBundle myText = portletConfig.getResourceBundle(request.getLocale());
  %>
  
  <B><%=myText.getString("help.title")%></B>
  <p><%=myText.getString("help.text")%></B></p>
  <FORM ACTION="<%=myCancel%>" METHOD="POST">            
  <INPUT NAME="cancel"  TYPE="submit"                 
   VALUE="<%=myText.getString("cancel")%>">            
  </FORM>                                    
  
  
  1.1                  jakarta-jetspeed-2/applications/demo/src/java/org/apache/jetspeed/demo/simple/PickANumberPortlet.java
  
  Index: PickANumberPortlet.java
  ===================================================================
  /*
   * Copyright 2000-2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.jetspeed.demo.simple;
  
  import java.io.IOException;
  
  import javax.portlet.ActionRequest;
  import javax.portlet.ActionResponse;
  import javax.portlet.PortletException;
  import javax.portlet.PortletPreferences;
  import javax.portlet.PortletRequest;
  import javax.portlet.PortletSession;
  import javax.portlet.RenderRequest;
  import javax.portlet.RenderResponse;
  
  import org.apache.portals.bridges.common.GenericServletPortlet;
  
  /**
   * This class only exists to maintain the Help and View page names.  As soon
   * as the container/engine will retain the preferences this class can be
   * replaced by configuring portlet preferences.
   *
   * @version $Id: PickANumberPortlet.java,v 1.1 2004/11/19 21:53:12 taylor Exp $
   * @task Remove this class when the container/engine retain preferences
   */
  public class PickANumberPortlet extends GenericServletPortlet
  {
      /**
       * Default action page when preference does not exist
       *
       * @see org.apache.portals.bridges.common.GenericServletPortlet#processAction
       */
      private static final String DEFAULT_ACTION_PAGE = null;
      
      /**
       * Default custom page when preference does not exist
       *
       * @see org.apache.portals.bridges.common.GenericServletPortlet#doCustom
       */
      private static final String DEFAULT_CUSTOM_PAGE = null;
      
      /**
       * Default edit page when preference does not exist
       *
       * @see org.apache.portals.bridges.common.GenericServletPortlet#doEdit
       */
      private static final String DEFAULT_EDIT_PAGE = "/WEB-INF/demo/simple/PickANumberEdit.jsp";
      
      /**
       * Default help page when preference does not exist
       *
       * @see org.apache.portals.bridges.common.GenericServletPortlet#doHelp
       */
      private static final String DEFAULT_HELP_PAGE = "/WEB-INF/demo/simple/PickANumberHelp.jsp";
      
      /**
       * Default help page when preference does not exist
       *
       * @see org.apache.portals.bridges.common.GenericServletPortlet#doView
       */
      
      private static final String DEFAULT_VIEW_PAGE = "/WEB-INF/demo/simple/PickANumber.jsp";
      
      /**
       * Attribute name of Guess Count
       */
      private static final String GUESS_COUNT_NAME = "GuessCount";
      
      /**
       * Paramter name of current guess
       */
      private static final String GUESS_PARAMETER_NAME = "Guess";
      
      /**
       * Attribute name of the last guess
       */
      private static final String LAST_GUESS_NAME = "LastGuess";
  
      /**
       * Attribute name of Target Value
       */
      private static final String TARGET_VALUE_NAME = "TargetValue";
      
      /**
       * Attribute name of Top Range Value (in Edit Mode)
       */
      private static final String TOP_RANGE_NAME = "TopRange";
      
      /**
       * Set default page values when class is created
       */
      public PickANumberPortlet()
      {
          setDefaultActionPage(DEFAULT_ACTION_PAGE);
          setDefaultCustomPage(DEFAULT_CUSTOM_PAGE);
          setDefaultEditPage(DEFAULT_EDIT_PAGE);
          setDefaultHelpPage(DEFAULT_HELP_PAGE);
          setDefaultViewPage(DEFAULT_VIEW_PAGE);
      }
  
              
      public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException
      {
          PortletSession session = request.getPortletSession();
          Long guessCount = null;
          Long targetValue = null;
          Long lastGuess = null;
          
          // Get target value
          lastGuess = (Long)session.getAttribute(LAST_GUESS_NAME, PortletSession.APPLICATION_SCOPE);
          if (lastGuess == null)
          {
              lastGuess = new Long(0);
              session.setAttribute(LAST_GUESS_NAME, guessCount, PortletSession.APPLICATION_SCOPE);            
          }
  
          // Get target value
  
          targetValue = (Long)session.getAttribute(TARGET_VALUE_NAME, PortletSession.APPLICATION_SCOPE);
          if (targetValue == null)
          {            
              targetValue = new Long(Math.round(Math.random() * getHighRange(request)));
              System.out.println("cheater: target value = " + targetValue);
              guessCount = new Long(0);
              session.setAttribute( TARGET_VALUE_NAME, targetValue, PortletSession.APPLICATION_SCOPE);
              long highRange = getHighRange(request);
              session.setAttribute( TOP_RANGE_NAME, new Long(highRange), PortletSession.APPLICATION_SCOPE);
          }
  
          guessCount = (Long)session.getAttribute(GUESS_COUNT_NAME, PortletSession.APPLICATION_SCOPE);
          if (guessCount == null)
          {
              guessCount = new Long(0);
              session.setAttribute( GUESS_COUNT_NAME, guessCount, PortletSession.APPLICATION_SCOPE);            
          }
  
          Long highRange = (Long)session.getAttribute(TOP_RANGE_NAME, PortletSession.APPLICATION_SCOPE);
          if (highRange == null)
          {
              long range = getHighRange(request);
              session.setAttribute( TOP_RANGE_NAME, new Long(range), PortletSession.APPLICATION_SCOPE);
          }
          
          super.doView(request, response);
      }
      
      /**
       * Increment attributes in different scopes
       *
       * @see javax.portlet.GenericPortlet#processActions
       *
       */
      public void processAction(ActionRequest request, ActionResponse actionResponse)
      throws PortletException, IOException
      {
          // Is it an edit (customize) action
          if (isEditAction(request))
          {
              savePreferences(request);
              return;
          }
          
          Long guessCount = null;
          Long targetValue = null;
          Long currentGuess = null;
          Long lastGuess = null;
          
          PortletSession session = request.getPortletSession();
          
          // Get target value
          lastGuess = (Long)session.getAttribute(LAST_GUESS_NAME, PortletSession.APPLICATION_SCOPE);
  
          // Get target value
          targetValue = (Long)session.getAttribute(TARGET_VALUE_NAME, PortletSession.APPLICATION_SCOPE);
          if ((targetValue != null) && (lastGuess != null))
          {
              if (targetValue.equals(lastGuess))
              {
                  targetValue = null; // Since the number as guesed, start a new game
              }
          }
          if (targetValue == null)
          {
              long random = (Math.round(Math.random() * getHighRange(request)));
              if (random == 0)
              {
                  random = 1; // don;t allow 0
              }
              targetValue = new Long(random);
              System.out.println("cheater: target value = " + targetValue);
              guessCount = new Long(0);
              session.setAttribute( TARGET_VALUE_NAME, targetValue, PortletSession.APPLICATION_SCOPE);
          }
  
          // Get the guessCount, if it has not already been set.
          if (guessCount == null)
          {
              guessCount = (Long)session.getAttribute(GUESS_COUNT_NAME, PortletSession.APPLICATION_SCOPE);
              if (guessCount == null)
              {
                  guessCount = new Long(0);
              }
          }
          
  
          // Increment the guessCount
          guessCount = new Long(guessCount.longValue() + 1);
          
          try
          {
              String result = request.getParameter(GUESS_PARAMETER_NAME);
              // System.out.println("result = " + result);
              if (result != null)
              {
                  currentGuess = new Long(result);
              }
          }
          catch (Exception e)
          {
              currentGuess = new Long(0);
          }
  
          // Update the attribute values
          session.setAttribute( GUESS_COUNT_NAME, guessCount, PortletSession.APPLICATION_SCOPE);
          session.setAttribute( LAST_GUESS_NAME, currentGuess, PortletSession.APPLICATION_SCOPE);
          //actionResponse.setRenderParameter(LAST_GUESS_NAME, lastGuess.toString());        
          return;
      }
      
      private long getHighRange(PortletRequest request)
      {
          PortletPreferences prefs = request.getPreferences();
          String highRangePref = prefs.getValue("TopRange", "102");
          long range = Long.parseLong(highRangePref);
          if (range < 2)
          {
              range = 102;
          }
          return range;
      }
      
      private boolean isEditAction(ActionRequest request)
      {
          return (request.getParameter(TOP_RANGE_NAME) != null);        
      }
      
      private void savePreferences(PortletRequest request)
      {
          String topRange = request.getParameter(TOP_RANGE_NAME);
          long range = Long.parseLong(topRange);
          if (range < 2)
          {
              // TODO: throw validation exception
              return;
          }
          PortletPreferences prefs = request.getPreferences();
          try
          {
              prefs.setValue(TOP_RANGE_NAME, topRange);
              prefs.store();
              PortletSession session = request.getPortletSession();            
              session.setAttribute( TOP_RANGE_NAME, new Long(range), PortletSession.APPLICATION_SCOPE);            
          }
          catch (Exception e)
          {
              // TODO: throw validation exception and redirect to error 
          }
      }
      
  }
  
  
  
  1.24      +59 -2     jakarta-jetspeed-2/applications/demo/src/webapp/WEB-INF/portlet.xml
  
  Index: portlet.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/demo/src/webapp/WEB-INF/portlet.xml,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- portlet.xml	15 Nov 2004 05:53:55 -0000	1.23
  +++ portlet.xml	19 Nov 2004 21:53:12 -0000	1.24
  @@ -15,7 +15,8 @@
   limitations under the License.
   -->
   <portlet-app id="demo" version="1.0">
  -  <portlet id="HelloPortlet">
  +
  +<portlet id="HelloPortlet">
       <init-param>
         <description>test init param</description>
         <name>hello</name>
  @@ -42,6 +43,62 @@
       </portlet-info>
     </portlet>
     
  +  <user-attribute>
  +	<description>User Given Name</description>
  +	<name>user.name.given</name>
  +  </user-attribute>
  +  <user-attribute>
  +	<description>User Last Name</description>
  +	<name>user.name.family</name>
  +  </user-attribute>
  +  <user-attribute>
  +	<description>User eMail</description>
  +	<name>user.home-info.online.email</name>
  +  </user-attribute>
  +  
  +  <portlet>
  +    <description>Bookmark Portlet</description>
  +    <portlet-name>BookmarkPortlet</portlet-name>
  +    <display-name>Bookmark Portlet</display-name>
  +    <portlet-class>org.apache.portals.applications.desktop.BookmarkPortlet</portlet-class>
  +    <init-param>
  +		<name>ViewPage</name>
  +			<value>/WEB-INF/view/bookmark-view.jsp</value>
  +     </init-param>   
  +    <init-param>
  +		<name>EditPage</name>
  +			<value>/WEB-INF/view/bookmark-edit.jsp</value>
  +     </init-param>   
  +    <init-param>
  +		<name>HelpPage</name>
  +			<value>/WEB-INF/view/bookmark-help.jsp</value>
  +     </init-param>   
  +    <expiration-cache>0</expiration-cache>            
  +    <supports>
  +      <mime-type>text/html</mime-type>                
  +      <portlet-mode>VIEW</portlet-mode>                
  +      <portlet-mode>EDIT</portlet-mode>                
  +      <portlet-mode>HELP</portlet-mode>                
  +    </supports>                                
  +    <supported-locale>en</supported-locale>                
  +    <supported-locale>de</supported-locale>            
  +    <resource-bundle>org.apache.portals.applications.desktop.resources.Bookmark</resource-bundle>            
  +    <portlet-preferences>
  +      <preference>                            
  +        <name>Jetspeed-2 Site</name>                    
  +        <value>http://portals.apache.org/jetspeed-2/</value>    
  +      </preference>                               		
  +      <preference>                            
  +        <name>Bluesunrise Site</name>                    
  +        <value>http://www.bluesunrise.com/</value>    
  +      </preference>                               
  +      <preference>                            
  +        <name>Apache Home</name>                    
  +        <value>http://www.apache.org/</value>    
  +      </preference>                               	  
  +    </portlet-preferences>        
  +  </portlet>
  +	  
     <portlet id="PreferencePortlet">
       <portlet-name>PreferencePortlet</portlet-name>
       <display-name>PreferencePortlet</display-name>
  @@ -110,7 +167,7 @@
       </init-param>              
       <portlet-name>PickANumberPortlet</portlet-name>
       <display-name>Pick a number game</display-name>
  -    <portlet-class>org.apache.jetspeed.demo.simple.PickANumberServlet</portlet-class>
  +    <portlet-class>org.apache.jetspeed.demo.simple.PickANumberPortlet</portlet-class>
       <expiration-cache>-1</expiration-cache>
       <supports>
         <mime-type>text/html</mime-type>
  
  
  
  1.1                  jakarta-jetspeed-2/applications/demo/src/java/org/apache/portals/applications/desktop/resources/Bookmark_de.properties
  
  Index: Bookmark_de.properties
  ===================================================================
  javax.portlet.title = Lesezeichen 2 Portlet
  javax.portlet.short-title = Lesezeichen2
  javax.portlet.keywords = Lesezeichen, Bookmark
  available_bookmarks = Verf�gbare Lesezeichen
  no_bookmarks = Keine Lezezeichen verf�gbar. Bitte benutzen Sie den Edit-Mode, um neue Lesezeichen hinzuzuf�gen.
  undefined = nicht definiert
  name = Name
  url = URL
  add = Hinzuf�gen
  delete = l�schen
  cancel = Abbrechen
  help.title = Help Mode
  help.text = The Bookmark portlet tracks URLs in your portal. This example keeps a simple linear list of bookmarks. \
    A bookmark can contain the name and URL of a website. By clicking on a link, you will navigate to the bookmark in a new window. \
    To add and remove bookmarks, go into the portlet window's edit mode.
  
  
  1.1                  jakarta-jetspeed-2/applications/demo/src/java/org/apache/portals/applications/desktop/resources/Bookmark_en.properties
  
  Index: Bookmark_en.properties
  ===================================================================
  javax.portlet.title = Bookmark Portlet 2
  javax.portlet.short-title = Bookmark2
  javax.portlet.keywords = Bookmark
  available_bookmarks = Available bookmarks
  no_bookmarks = no bookmarks available. Please use edit mode to add bookmarks.
  undefined = undefined
  name = Name
  url = URL
  add = Add
  delete = Delete
  cancel = Cancel
  help.title = Help Mode
  help.text = The Bookmark portlet tracks URLs in your portal. This example keeps a simple linear list of bookmarks. \
    A bookmark can contain the name and URL of a website. By clicking on a link, you will navigate to the bookmark in a new window. \
    To add and remove bookmarks, go into the portlet window's edit mode.
  
  
  1.1                  jakarta-jetspeed-2/applications/jsf-demo/src/java/org/apache/portals/applications/desktop/calendar/CalendarBean.java
  
  Index: CalendarBean.java
  ===================================================================
  /*
   * Copyright 2000-2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.portals.applications.desktop.calendar;
  
  import java.text.SimpleDateFormat;
  import java.util.Date;
  import java.util.Locale;
  
  import javax.faces.context.FacesContext;
  import javax.portlet.PortletPreferences;
  import javax.portlet.PortletRequest;
  
  /**
   * CalendarBean
   * 
   * @author <a href="mailto:taylor@apache.org">David Sean Taylor </a>
   * @version $Id: CalendarBean.java,v 1.1 2004/11/19 21:53:12 taylor Exp $
   */
  
  public class CalendarBean
  {
      private Date date = new Date();
      private String notes = "";
  
      public Date getDate()
      {
          return date;
      }
  
      public void setDate(Date date)
      {
          if (date != null)
          {
              this.date = date;
          }
      }
      
      public String getNotes()
      {
          return notes;
      }
      
      public void setNotes(String notes)
      {
          this.notes = notes;
      }
      
     public String getDateKey(Date date)  
     {
         SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd", Locale.getDefault());
         return formatter.format(date);
         
     }
      /*
       * actions
       */
      
      public String save()
      {
          if (this.date != null)
          {
              PortletRequest request = (PortletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
              PortletPreferences prefs = request.getPreferences();
              try
              {
                  
                  prefs.setValue(getDateKey(this.date), this.notes);
                  prefs.store();
              }
              catch (Exception e)
              {
                  System.err.println("error storing prefs " + e);
              }
          }
          return "returnFromNotes";
      }
      
      public String selectDate()
      {
          if (this.date == null)
          {
              return "editNotes";
          }
          String selectedDate = getDateKey(this.date);
          PortletRequest request = (PortletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
          notes = request.getPreferences().getValue(selectedDate, "");
          return "editNotes"; // goto the navigation rule
      }
  }
  
  
  1.1                  jakarta-jetspeed-2/applications/pam/src/webapp/WEB-INF/view/locale-list.jsp
  
  Index: locale-list.jsp
  ===================================================================
  <%--
  Copyright 2004 The Apache Software Foundation
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
      http://www.apache.org/licenses/LICENSE-2.0
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  --%>
  <%@ page language="java" import="javax.portlet.*, java.util.List, java.util.Iterator, org.apache.jetspeed.om.common.portlet.MutablePortletApplication" session="true" %>
  <%@ taglib uri='/WEB-INF/portlet.tld' prefix='portlet'%>
  <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
  <%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
  <c:set var="currentLocale"><%= request.getAttribute("currentLocale") %></c:set>
  <fmt:setBundle basename="org.apache.jetspeed.portlets.localeselector.resources.LocaleSelectorResources" />
  
  <portlet:actionURL var="changeLocaleAction">
  </portlet:actionURL>
  
  <form action="<%=changeLocaleAction%>" method="POST">
  <table border="0">
  	<tr>
  		<td align="right"><fmt:message key="localeselector.label.language"/></td>
  		<td align="left">
  			<select name="org.apache.jetspeed.prefered.locale">
  				<c:set var="locales"><fmt:message key="localeselector.locales"/></c:set>
  				<c:forTokens var="l" items="${locales}" delims=",">
  				<option value="<c:out value="${l}"/>"
  					<c:if test="${currentLocale == l}">selected</c:if>
  				><fmt:message>localeselector.locale.<c:out value="${l}"/></fmt:message></option>
  				</c:forTokens>
  			</select>
  		</td>
  	</tr>
  	<tr>
  		<td align="center" colspan="2"><input type="submit" value="<fmt:message key="localeselector.label.change"/>"/></td>
  	</tr>
  </table>
  </form>
  
  
  
  1.1                  jakarta-jetspeed-2/applications/demo/src/java/org/apache/portals/applications/desktop/BookmarkPortlet.java
  
  Index: BookmarkPortlet.java
  ===================================================================
  /*
   * Copyright 2000-2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.portals.applications.desktop;
  
  import javax.portlet.ActionRequest;
  import javax.portlet.ActionResponse;
  import javax.portlet.PortletException;
  import javax.portlet.PortletPreferences;
  
  import org.apache.portals.bridges.common.GenericServletPortlet;
  
  
  /**
   * BookmarkPortlet
   * 
   * @author <a href="mailto:taylor@apache.org">David Sean Taylor </a>
   * @version $Id: BookmarkPortlet.java,v 1.1 2004/11/19 21:53:12 taylor Exp $
   */
  public class BookmarkPortlet extends GenericServletPortlet
  {
      public void processAction (ActionRequest request, ActionResponse actionResponse)
          throws PortletException, java.io.IOException 
      {
          String removeName = request.getParameter("remove");     
          if (removeName!=null) 
          { // remove
              PortletPreferences prefs = request.getPreferences();
              prefs.reset(removeName);     
              prefs.store();
          }
          String add = request.getParameter("add");           
          if (add!=null) 
          { // add                     
              PortletPreferences prefs = request.getPreferences();
              prefs.setValue(request.getParameter("name"),                           
                      request.getParameter("value"));     
              prefs.store();                          
          }
      }
  }
  
  
  
  1.1                  jakarta-jetspeed-2/applications/jsf-demo/src/webapp/WEB-INF/view/calendar-help.html
  
  Index: calendar-help.html
  ===================================================================
  <h1>Calendar Help Page</h1>
  
  
  
  1.1                  jakarta-jetspeed-2/applications/jsf-demo/src/webapp/WEB-INF/view/calendar-edit.jsp
  
  Index: calendar-edit.jsp
  ===================================================================
  <h1>Calendar Edit Page</h1>
  
  
  
  1.1                  jakarta-jetspeed-2/applications/jsf-demo/src/webapp/WEB-INF/view/calendar-notes.jsp
  
  Index: calendar-notes.jsp
  ===================================================================
  <%@ page session="true" contentType="text/html;charset=utf-8"%>
  <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
  <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
  <%@ taglib uri="http://myfaces.sourceforge.net/tld/myfaces_ext_0_9.tld" prefix="x"%>
  
  <f:loadBundle basename="org.apache.portals.applications.desktop.resources.Calendar" var="MESSAGE" />
  
  <f:view>
  <h:outputText  styleClass='portlet-header' value="#{MESSAGE['calendar.notes']}" />
   <h:outputText value="#{calendar.date}" />
  
  <h:form id="calendarForm">
  	<h:inputTextarea value="#{calendar.notes}" />
  	<h:commandButton id="save" value="#{MESSAGE['add']}" action="#{calendar.save}"/>     
   	<h:commandButton id="cancel" value="#{MESSAGE['cancel']}" 
  	                     action="returnFromNotes" immediate='true'>
  	</h:commandButton>   
  </h:form>     
       
  </f:view>
  
  
  
  1.1                  jakarta-jetspeed-2/applications/jsf-demo/src/webapp/WEB-INF/view/calendar-view.jsp
  
  Index: calendar-view.jsp
  ===================================================================
  <%@ page session="true" contentType="text/html;charset=utf-8"%>
  <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
  <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
  <%@ taglib uri="http://myfaces.sourceforge.net/tld/myfaces_ext_0_9.tld" prefix="x"%>
  
  
  <f:loadBundle basename="org.apache.portals.applications.desktop.resources.Calendar" var="MESSAGE" />
  
  <f:view>
  
  <h:form id="calendarForm">
  <x:inputCalendar 
      value="#{calendar.date}"
      monthYearRowClass="portlet-section-header" 
      weekRowClass="portlet-section-subheader"
      dayCellClass="portlet-menu-item"
      currentDayCellClass="portlet-menu-item-selected" 
       />     
  <h:outputText value="#{calendar.date}" />
  <h:commandButton id="edit" value="#{MESSAGE['calendar.notes']}" action="#{calendar.selectDate}"/>
  
  </h:form>     
       
  </f:view>
  
  
  
  1.16      +20 -0     jakarta-jetspeed-2/applications/pam/src/webapp/WEB-INF/portlet.xml
  
  Index: portlet.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/pam/src/webapp/WEB-INF/portlet.xml,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- portlet.xml	12 Nov 2004 06:34:25 -0000	1.15
  +++ portlet.xml	19 Nov 2004 21:53:12 -0000	1.16
  @@ -16,6 +16,26 @@
   -->
   <portlet-app id="pam" version="1.0">
   
  +<portlet id="LocaleSelector">
  +    <portlet-name>LocaleSelector</portlet-name>
  +    <display-name>Locale Selector</display-name>
  +    <description>Locale Selector is a portlet to select your preferred locale</description>
  +    <portlet-class>org.apache.jetspeed.portlets.localeselector.LocaleSelectorPortlet</portlet-class>
  +    <expiration-cache>-1</expiration-cache>
  +    <supports>
  +      <mime-type>text/html</mime-type>
  +      <portlet-mode>VIEW</portlet-mode>
  +    </supports>
  +    <supported-locale>en</supported-locale>
  +    <supported-locale>ja</supported-locale>
  +    <resource-bundle>org.apache.jetspeed.portlets.localeselector.resources.LocaleSelectorResources</resource-bundle>
  +    <portlet-info>
  +      <title>Locale Selector</title>
  +      <short-title>This is a portlet to select your preferred locale</short-title>
  +      <keywords>Locale,Language</keywords>
  +    </portlet-info>
  +</portlet>
  +
   <portlet id="PortletApplicationBrowser">
       <init-param>
       	<description>This parameter sets the template used in view mode.</description>
  
  
  
  1.8       +6 -0      jakarta-jetspeed-2/applications/pam/src/webapp/WEB-INF/jetspeed-portlet.xml
  
  Index: jetspeed-portlet.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/pam/src/webapp/WEB-INF/jetspeed-portlet.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- jetspeed-portlet.xml	6 Oct 2004 22:11:48 -0000	1.7
  +++ jetspeed-portlet.xml	19 Nov 2004 21:53:12 -0000	1.8
  @@ -29,6 +29,12 @@
           <dc:creator>J2 Team</dc:creator>
       </portlet>
   
  +    <portlet>
  +        <portlet-name>LocaleSelectorPortlet</portlet-name>
  +        <dc:title>Locale Selector Portlet</dc:title>
  +        <dc:creator>J2 Team</dc:creator>
  +    </portlet>
  +
   	<js:services>
   	    <js:service name='SearchComponent'/>
   		<js:service name='PortletRegistryComponent'/>
  
  
  
  1.1                  jakarta-jetspeed-2/applications/pam/src/java/org/apache/jetspeed/portlets/localeselector/LocaleSelectorPortlet.java
  
  Index: LocaleSelectorPortlet.java
  ===================================================================
  /*
   * Copyright 2000-2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.jetspeed.portlets.localeselector;
  
  import java.io.IOException;
  import java.util.Locale;
  
  import javax.portlet.ActionRequest;
  import javax.portlet.ActionResponse;
  import javax.portlet.GenericPortlet;
  import javax.portlet.PortletConfig;
  import javax.portlet.PortletContext;
  import javax.portlet.PortletException;
  import javax.portlet.PortletRequestDispatcher;
  import javax.portlet.PortletSession;
  import javax.portlet.RenderRequest;
  import javax.portlet.RenderResponse;
  
  import org.apache.jetspeed.request.RequestContext;
  
  /**
   * 
   * 
   * @author <a href="mailto:shinsuke@yahoo.co.jp">Shinsuke Sugaya</a>
   */
  public class LocaleSelectorPortlet extends GenericPortlet
  {
      public static final String PREFERED_LOCALE_SESSION_KEY = "org.apache.jetspeed.prefered.locale";
  
      /* (non-Javadoc)
       * @see javax.portlet.Portlet#init(javax.portlet.PortletConfig)
       */
      public void init(PortletConfig config) throws PortletException
      {
          super.init(config);
      }
  
      /* (non-Javadoc)
       * @see javax.portlet.GenericPortlet#doView(javax.portlet.RenderRequest, javax.portlet.RenderResponse)
       */
      protected void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException
      {
          PortletContext context = getPortletContext();
  
          Locale locale = request.getLocale();
          if (locale == null)
          {
              locale = Locale.getDefault();
          }
          request.setAttribute("currentLocale", locale.toString());
  
          PortletRequestDispatcher rd = context.getRequestDispatcher("/WEB-INF/view/locale-list.jsp");
          rd.include(request, response);
      }
  
      /* (non-Javadoc)
       * @see javax.portlet.Portlet#processAction(javax.portlet.ActionRequest, javax.portlet.ActionResponse)
       */
      public void processAction(ActionRequest request, ActionResponse response) throws PortletException, IOException
      {
  
          PortletSession session = request.getPortletSession();
          String language = request.getParameter(PREFERED_LOCALE_SESSION_KEY);
  
          if (language != null)
          {
              String country = "";
              String variant = "";
              int countryIndex = language.indexOf('_');
              if (countryIndex > -1)
              {
                  country = language.substring(countryIndex + 1).trim();
                  language = language.substring(0, countryIndex).trim();
                  int vDash = country.indexOf("_");
                  if (vDash > 0)
                  {
                      String cTemp = country.substring(0, vDash);
                      variant = country.substring(vDash + 1);
                      country = cTemp;
                  }
              }
  
              // TODO Set the prefered locale to user's persistent storage if not anon user
              Locale preferedLocale = new Locale(language, country, variant);
              session.setAttribute(RequestContext.PREFERED_LOCALE_SESSION_KEY, preferedLocale,PortletSession.APPLICATION_SCOPE);
              RequestContext requestContext = (RequestContext) request.getAttribute(RequestContext.REQUEST_PORTALENV);
              requestContext.setLocale(preferedLocale);
              requestContext.setSessionAttribute(RequestContext.PREFERED_LOCALE_SESSION_KEY, preferedLocale);
          }
  
          return;
      }
  
  }
  
  
  

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