cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/forms/samples/resources forms-calendar-styling.xsl
Date Sun, 04 Jul 2004 14:35:42 GMT
joerg       2004/07/04 07:35:41

  Modified:    src/blocks/forms/samples/messages FormsMessages.xml
                        FormsMessages_de.xml FormsMessages_it_IT.xml
                        FormsMessages_zh_CN.xml FormsMessages_fr.xml
                        FormsMessages_nl.xml
               src/blocks/forms/java/org/apache/cocoon/forms/datatype/convertor
                        FormattingDateConvertorBuilder.java
                        FormattingDateConvertor.java
               src/blocks/forms/samples/resources
                        forms-calendar-styling.xsl
  Log:
  provide the variant info of date datatype to the form instance,
  handle this appropriately in calendar stylesheet (display no calendar popup)
  
  Revision  Changes    Path
  1.6       +6 -6      cocoon-2.1/src/blocks/forms/samples/messages/FormsMessages.xml
  
  Index: FormsMessages.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/forms/samples/messages/FormsMessages.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- FormsMessages.xml	6 May 2004 14:13:51 -0000	1.5
  +++ FormsMessages.xml	4 Jul 2004 14:35:41 -0000	1.6
  @@ -19,19 +19,20 @@
     <message key="general.field-required">This field is required.</message>
   
     <message key="datatype.conversion-failed">Not a valid {0}.</message>
  -  <message key="datatype.long">integer number</message>
     <message key="datatype.decimal">decimal number</message>
  -  <message key="datatype.double">decimal number</message>
  -  <message key="datatype.float">decimal number</message>
     <message key="datatype.integer">integer number</message>
  -  <message key="datatype.date">date</message>
  +  <message key="datatype.long">integer number</message>
  +  <message key="datatype.float">decimal number</message>
  +  <message key="datatype.double">decimal number</message>
  +  <message key="datatype.date.date">date</message>
  +  <message key="datatype.date.time">time</message>
  +  <message key="datatype.date.datetime">date-time</message>
   
     <message key="validation.string.exact-length">Should be exactly {0} characters.</message>
     <message key="validation.string.range-length">Should contain from {0} to {1} characters.</message>
     <message key="validation.string.min-length">Should be at least {0} characters.</message>
     <message key="validation.string.max-length">Should be at most {0} characters.</message>
     <message key="validation.string.regexp">Does not match the following regular expression:
{0}</message>
  -
     <message key="validation.string.invalidemail">This field does not contain a valid
email address</message>
   
     <message key="validation.array.exact-valuecount">Exactly {0} item(s) should be
selected.</message>
  @@ -46,7 +47,6 @@
     <message key="validation.numeric.max">Number should be less than or equal to {0}.</message>
   
     <message key="validation.mod10">Mod 10 check failed.</message>
  -
   
     <message key="aggregatedfield.split-failed">Content of this field does not match
the following regular expression: {0}</message>
     <message key="upload.invalid-type">Invalid content type.</message>
  
  
  
  1.4       +8 -2      cocoon-2.1/src/blocks/forms/samples/messages/FormsMessages_de.xml
  
  Index: FormsMessages_de.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/forms/samples/messages/FormsMessages_de.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- FormsMessages_de.xml	18 Apr 2004 13:45:31 -0000	1.3
  +++ FormsMessages_de.xml	4 Jul 2004 14:35:41 -0000	1.4
  @@ -18,9 +18,15 @@
   <catalogue xml:lang="de">
     <message key="general.field-required">Dieses Feld muss aufgefllt werden.</message>
   
  -  <message key="datatype.conversion-failed">Ungltige(s) {0}.</message>
  +  <message key="datatype.conversion-failed">Ungltige {0}.</message>
  +  <message key="datatype.decimal">Dezimalzahl</message>
  +  <message key="datatype.integer">natrliche Zahl</message>
     <message key="datatype.long">natrliche Zahl</message>
  -  <message key="datatype.date">Datum</message>
  +  <message key="datatype.float">Dezimalzahl</message>
  +  <message key="datatype.double">Dezimalzahl</message>
  +  <message key="datatype.date.date">Datumsangabe</message>
  +  <message key="datatype.date.time">Zeitangabe</message>
  +  <message key="datatype.date.datetime">Datums- und Zeitangabe</message>
   
     <message key="validation.string.exact-length">Bitte geben Sie genau {0} Zeichen
ein.</message>
     <message key="validation.string.range-length">Bitte geben Sie zwischen {0} und
{1} Zeichen ein.</message>
  
  
  
  1.6       +7 -1      cocoon-2.1/src/blocks/forms/samples/messages/FormsMessages_it_IT.xml
  
  Index: FormsMessages_it_IT.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/forms/samples/messages/FormsMessages_it_IT.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- FormsMessages_it_IT.xml	6 Apr 2004 08:43:09 -0000	1.5
  +++ FormsMessages_it_IT.xml	4 Jul 2004 14:35:41 -0000	1.6
  @@ -19,8 +19,14 @@
     <message key="general.field-required">Questo campo è obbligatorio.</message>
   
     <message key="datatype.conversion-failed">Formato {0} non valido.</message>
  +  <message key="datatype.decimal">#decimal number#</message>
  +  <message key="datatype.integer">numero intero</message>
     <message key="datatype.long">numero intero</message>
  -  <message key="datatype.date">data</message>
  +  <message key="datatype.float">#decimal number#</message>
  +  <message key="datatype.double">#decimal number#</message>
  +  <message key="datatype.date.date">data</message>
  +  <message key="datatype.date.time">#time#</message>
  +  <message key="datatype.date.datetime">#date-time#</message>
   
     <message key="validation.string.exact-length">Questo campo deve essere lungo esattamente
{0} caratteri.</message>
     <message key="validation.string.range-length">Questo campo deve contenere fra {0}
e {1} caratteri.</message>
  
  
  
  1.3       +7 -5      cocoon-2.1/src/blocks/forms/samples/messages/FormsMessages_zh_CN.xml
  
  Index: FormsMessages_zh_CN.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/forms/samples/messages/FormsMessages_zh_CN.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FormsMessages_zh_CN.xml	8 May 2004 11:56:35 -0000	1.2
  +++ FormsMessages_zh_CN.xml	4 Jul 2004 14:35:41 -0000	1.3
  @@ -1,4 +1,4 @@
  -<?xml version="1.0" encoding="UTF-8"?>
  +<?xml version="1.0" encoding="UTF-8"?>
   <!--
     Copyright 1999-2004 The Apache Software Foundation
   
  @@ -19,12 +19,14 @@
     <message key="general.field-required">此域是必须的</message>
   
     <message key="datatype.conversion-failed">不是一个有效的{0}类型.</message>
  -  <message key="datatype.long">整数</message>
     <message key="datatype.decimal">小数</message> 
  -  <message key="datatype.double">小数</message> 
  -  <message key="datatype.float">小数</message> 
     <message key="datatype.integer">整数</message> 
  -  <message key="datatype.date">日期</message>
  +  <message key="datatype.long">整数</message>
  +  <message key="datatype.float">小数</message> 
  +  <message key="datatype.double">小数</message> 
  +  <message key="datatype.date.date">日期</message>
  +  <message key="datatype.date.time">#time#</message>
  +  <message key="datatype.date.datetime">#date-time#</message>
   
     <message key="validation.string.exact-length">应为{0}个字符.</message>
     <message key="validation.string.range-length">应包含{0}到{1}个字符.</message>
  
  
  
  1.6       +7 -1      cocoon-2.1/src/blocks/forms/samples/messages/FormsMessages_fr.xml
  
  Index: FormsMessages_fr.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/forms/samples/messages/FormsMessages_fr.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- FormsMessages_fr.xml	6 Apr 2004 08:23:37 -0000	1.5
  +++ FormsMessages_fr.xml	4 Jul 2004 14:35:41 -0000	1.6
  @@ -19,8 +19,14 @@
     <message key="general.field-required">Cette donnée est obligatoire.</message>
   
     <message key="datatype.conversion-failed">N'est pas un(e) {0}.</message>
  +  <message key="datatype.decimal">#decimal number#</message>
  +  <message key="datatype.integer">nombre entier</message>
     <message key="datatype.long">nombre entier</message>
  -  <message key="datatype.date">date</message>
  +  <message key="datatype.float">#decimal number#</message>
  +  <message key="datatype.double">#decimal number#</message>
  +  <message key="datatype.date.date">date</message>
  +  <message key="datatype.date.time">#time#</message>
  +  <message key="datatype.date.datetime">#date-time#</message>
   
     <message key="validation.string.exact-length">Doit avoir exactement {0} caractères.</message>
     <message key="validation.string.range-length">Doit avoir entre {0} et {1} caractères.</message>
  
  
  
  1.2       +13 -1     cocoon-2.1/src/blocks/forms/samples/messages/FormsMessages_nl.xml
  
  Index: FormsMessages_nl.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/forms/samples/messages/FormsMessages_nl.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FormsMessages_nl.xml	19 Apr 2004 15:36:25 -0000	1.1
  +++ FormsMessages_nl.xml	4 Jul 2004 14:35:41 -0000	1.2
  @@ -18,22 +18,34 @@
   <catalogue xml:lang="nl">
     <message key="general.field-required">Dit veld moet ingevuld zijn.</message>
     <message key="datatype.conversion-failed">Ongeldig {0}.</message>
  +  <message key="datatype.decimal">#decimal number#</message>
  +  <message key="datatype.integer">integer getal</message>
     <message key="datatype.long">integer getal</message>
  -  <message key="datatype.date">datum</message>
  +  <message key="datatype.float">#decimal number#</message>
  +  <message key="datatype.double">#decimal number#</message>
  +  <message key="datatype.date.date">datum</message>
  +  <message key="datatype.date.time">#time#</message>
  +  <message key="datatype.date.datetime">#date-time#</message>
  +
     <message key="validation.string.exact-length">Dit veld moet precies {0} tekens
lang zijn.</message>
     <message key="validation.string.range-length">Het aantal tekens moet tussen de
{0} en {1} liggen.</message>
     <message key="validation.string.min-length">Dit veld moet minimaal {0} tekens lang
zijn.</message>
     <message key="validation.string.max-length">Dit veld mag maximaal {0} tekens lang
zijn.</message>
     <message key="validation.string.regexp">De waarde komt niet overeen met deze reg.
exp.: {0}</message>
     <message key="validation.string.invalidemail">Dit is geen geldig email adres</message>
  +
     <message key="validation.array.exact-valuecount">Kies precies {0} elementen.</message>
     <message key="validation.array.range-valuecount">Kies tussen de {0} en {1} elementen.</message>
     <message key="validation.array.min-valuecount">Kies minimaal {0} elementen.</message>
     <message key="validation.array.max-valuecount">Kies maximaal {0} elementen.</message>
  +
     <message key="multivaluefield.conversionfailed">Een van de gekozen waarden is ongeldig.</message>
  +
     <message key="validation.numeric.range">De waarde moet liggen tussen {0} en {1}.</message>
     <message key="validation.numeric.min">De waarde is minimaal {0}.</message>
     <message key="validation.numeric.max">De waarde is maximaal {0}.</message>
  +
     <message key="validation.mod10">De Mod 10 verificatie is mislukt.</message>
  +
     <message key="aggregatedfield.split-failed">De waarde komt niet overeen met deze
reg. exp.: {0}</message>
   </catalogue>
  
  
  
  1.3       +7 -8      cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/datatype/convertor/FormattingDateConvertorBuilder.java
  
  Index: FormattingDateConvertorBuilder.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/datatype/convertor/FormattingDateConvertorBuilder.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FormattingDateConvertorBuilder.java	9 Mar 2004 13:08:46 -0000	1.2
  +++ FormattingDateConvertorBuilder.java	4 Jul 2004 14:35:41 -0000	1.3
  @@ -51,14 +51,13 @@
   
           String variant = configElement.getAttribute("variant");
           if (!variant.equals("")) {
  -            if (variant.equals("date"))
  -                convertor.setVariant(FormattingDateConvertor.DATE);
  -            else if (variant.equals("time"))
  -                convertor.setVariant(FormattingDateConvertor.TIME);
  -            else if (variant.equals("datetime"))
  -                convertor.setVariant(FormattingDateConvertor.DATE_TIME);
  -            else
  +            if (variant.equals(FormattingDateConvertor.DATE) ||
  +                    variant.equals(FormattingDateConvertor.TIME) ||
  +                    variant.equals(FormattingDateConvertor.DATE_TIME)) {
  +                convertor.setVariant(variant);
  +            } else {
                   throw new Exception("Invalid value \"" + variant + "\" for variant attribute
at " + DomHelper.getLocation(configElement));
  +            }
           }
   
           Element patternsEl = DomHelper.getChildElement(configElement, Constants.DEFINITION_NS,
"patterns", false);
  
  
  
  1.6       +18 -19    cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/datatype/convertor/FormattingDateConvertor.java
  
  Index: FormattingDateConvertor.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/datatype/convertor/FormattingDateConvertor.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- FormattingDateConvertor.java	2 Jul 2004 10:09:49 -0000	1.5
  +++ FormattingDateConvertor.java	4 Jul 2004 14:35:41 -0000	1.6
  @@ -50,15 +50,15 @@
       /** See {@link #setStyle}. */
       private int style;
       /** See {@link #setVariant}. */
  -    private int variant;
  +    private String variant;
       /** Locale-specific formatting patterns. */
       private LocaleMap localizedPatterns;
       /** Non-locale specific formatting pattern. */
       private String nonLocalizedPattern;
   
  -    public static final int DATE = 1;
  -    public static final int TIME = 2;
  -    public static final int DATE_TIME = 3;
  +    public static final String DATE = "date";
  +    public static final String TIME = "time";
  +    public static final String DATE_TIME = "datetime";
   
       public FormattingDateConvertor() {
           this.style = java.text.DateFormat.SHORT;
  @@ -71,7 +71,7 @@
           try {
               return new ConversionResult(dateFormat.parse(value));
           } catch (ParseException e) {
  -            return ConversionResult.create("date");
  +            return ConversionResult.create("date." + this.variant);
           }
       }
   
  @@ -95,16 +95,12 @@
       protected DateFormat getDateFormat(Locale locale) {
           DateFormat dateFormat = null;
   
  -        switch (variant) {
  -            case DATE:
  -                dateFormat = I18nSupport.getInstance().getDateFormat(style, locale);
  -                break;
  -            case TIME:
  -                dateFormat = I18nSupport.getInstance().getTimeFormat(style, locale);
  -                break;
  -            case DATE_TIME:
  -                dateFormat = I18nSupport.getInstance().getDateTimeFormat(style, style,
locale);
  -                break;
  +        if (this.variant.equals(DATE)) {
  +            dateFormat = I18nSupport.getInstance().getDateFormat(style, locale);
  +        } else if (this.variant.equals(TIME)) {
  +            dateFormat = I18nSupport.getInstance().getTimeFormat(style, locale);
  +        } else if (this.variant.equals(DATE_TIME)) {
  +            dateFormat = I18nSupport.getInstance().getDateTimeFormat(style, style, locale);
           }
   
           String pattern = (String)localizedPatterns.get(locale);
  @@ -129,10 +125,12 @@
           this.style = style;
       }
   
  -    public void setVariant(int variant) {
  -        if (variant != DATE && variant != TIME && variant != DATE_TIME)
  +    public void setVariant(String variant) {
  +        if (DATE.equals(variant) || TIME.equals(variant) || DATE_TIME.equals(variant))
{
  +            this.variant = variant;
  +        } else {
               throw new IllegalArgumentException("Invalid value for variant parameter.");
  -        this.variant = variant;
  +        }
       }
   
       public void addFormattingPattern(Locale locale, String pattern) {
  @@ -151,6 +149,7 @@
           if (pattern != null) {
               AttributesImpl attrs = new AttributesImpl();
               attrs.addCDATAAttribute("pattern", pattern);
  +            attrs.addCDATAAttribute("variant", this.variant);
               contentHandler.startElement(Constants.INSTANCE_NS, CONVERTOR_EL, Constants.INSTANCE_PREFIX_COLON
+ CONVERTOR_EL, attrs);
               contentHandler.endElement(Constants.INSTANCE_NS, CONVERTOR_EL, Constants.INSTANCE_PREFIX_COLON
+ CONVERTOR_EL);
           }
  
  
  
  1.9       +3 -2      cocoon-2.1/src/blocks/forms/samples/resources/forms-calendar-styling.xsl
  
  Index: forms-calendar-styling.xsl
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/forms/samples/resources/forms-calendar-styling.xsl,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- forms-calendar-styling.xsl	30 Jun 2004 18:51:48 -0000	1.8
  +++ forms-calendar-styling.xsl	4 Jul 2004 14:35:41 -0000	1.9
  @@ -47,10 +47,11 @@
         | fi:field with either
         | - explicit styling @type = 'date' or
         | - implicit if no styling @type is specified,
  -      |   but datatype @type = 'date', selection lists must be excluded here
  +      |   but datatype/@type = 'date' and datatype/convertor/@variant = 'date',
  +      |   selection lists must be excluded here
         +-->
     <xsl:template match="fi:field[fi:styling/@type='date'] |
  -                       fi:field[not(fi:styling/@type)][fi:datatype[@type='date']][not(fi:selection-list)]">
  +                       fi:field[not(fi:styling/@type)][fi:datatype[@type='date'][fi:convertor/@variant='date']][not(fi:selection-list)]">
       <xsl:variable name="id" select="generate-id()"/>
       
       <xsl:variable name="format">
  
  
  

Mime
View raw message