You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by rg...@apache.org on 2004/11/26 08:47:27 UTC

svn commit: r106641 - /cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/input/DateInputModule.java /cocoon/branches/BRANCH_2_1_X/src/webapp/samples/modules/sitemap.xmap /cocoon/branches/BRANCH_2_1_X/status.xml

Author: rgoers
Date: Thu Nov 25 23:47:26 2004
New Revision: 106641

URL: http://svn.apache.org/viewcvs?view=rev&rev=106641
Log:
Implement enhancement for bug 28360.

Modified:
   cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/input/DateInputModule.java
   cocoon/branches/BRANCH_2_1_X/src/webapp/samples/modules/sitemap.xmap
   cocoon/branches/BRANCH_2_1_X/status.xml

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/input/DateInputModule.java
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/input/DateInputModule.java?view=diff&rev=106641&p1=cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/input/DateInputModule.java&r1=106640&p2=cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/input/DateInputModule.java&r2=106641
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/input/DateInputModule.java	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/input/DateInputModule.java	Thu Nov 25 23:47:26 2004
@@ -34,7 +34,7 @@
  * root node or nested <format/> tag on module declaration.
  *
  * @author <a href="mailto:haul@apache.org">Christian Haul</a>
- * @version CVS $Id: DateInputModule.java,v 1.3 2004/03/05 13:02:48 bdelacretaz Exp $
+ * @version CVS $Id$
  * @see java.text.SimpleDateFormat
  */
 public class DateInputModule extends AbstractInputModule implements ThreadSafe {
@@ -48,7 +48,7 @@
 
     public Object getAttribute( String name, Configuration modeConf, Map objectModel ) throws ConfigurationException {
         
-        String format = (String) this.settings.get("format",null);
+        String format = (String) this.settings.get("format",name);
         if (modeConf != null) {
             format = modeConf.getAttribute("format", format);
             // this is preferred:
@@ -58,7 +58,11 @@
         if (format==null) {
             return new Date();
         } else {
-            return new SimpleDateFormat(format).format(new Date());
+            try {
+                return new SimpleDateFormat(format).format(new Date());
+            } catch (Exception e) {
+                return new Date();
+            }
         }
     }
 

Modified: cocoon/branches/BRANCH_2_1_X/src/webapp/samples/modules/sitemap.xmap
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/webapp/samples/modules/sitemap.xmap?view=diff&rev=106641&p1=cocoon/branches/BRANCH_2_1_X/src/webapp/samples/modules/sitemap.xmap&r1=106640&p2=cocoon/branches/BRANCH_2_1_X/src/webapp/samples/modules/sitemap.xmap&r2=106641
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/webapp/samples/modules/sitemap.xmap	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/webapp/samples/modules/sitemap.xmap	Thu Nov 25 23:47:26 2004
@@ -262,12 +262,14 @@
 
       <map:match pattern="content/date.xml">
         <map:generate type="jx" src="properties.xml">
-          <map:parameter name="date" value="{date:date}"/>
+          <map:parameter name="format-in-config" value="{date:date}"/>
+          <map:parameter name="format-inline" value="{date:MMM d, yyyy}"/>
         </map:generate>
         <map:transform src="properties2html.xsl">
           <map:parameter name="title" value="Date Input module (DateMetaModule)"/>
           <map:parameter name="description" value="Returns the current
-            date and time.  The format is specified in cocoon.xconf"/>
+            date and time.  The format is specified in cocoon.xconf or as the
+            data specified in the input module reference"/>
         </map:transform>
         <map:serialize/>
       </map:match>

Modified: cocoon/branches/BRANCH_2_1_X/status.xml
Url: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/status.xml?view=diff&rev=106641&p1=cocoon/branches/BRANCH_2_1_X/status.xml&r1=106640&p2=cocoon/branches/BRANCH_2_1_X/status.xml&r2=106641
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/status.xml	(original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml	Thu Nov 25 23:47:26 2004
@@ -202,6 +202,9 @@
 
   <changes>
  <release version="@version@" date="@date@">
+   <action dev="RG" type="update" fixes-bug="28360" due-to="Nico Verwer" due-to-email="nverwer@email.com">
+     DateInputModule now accepts date format string when specified in a sitemap.
+   </action>
    <action dev="RG" type="add">
      Portal: Added support for storing JSR-168 Portlet preferences.
    </action>