cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sylv...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/formmodel Upload.java
Date Mon, 09 Feb 2004 11:28:34 GMT
sylvain     2004/02/09 03:28:34

  Modified:    src/blocks/woody/java/org/apache/cocoon/woody/formmodel
                        Upload.java
  Log:
  Fix bug #26785
  
  Revision  Changes    Path
  1.4       +11 -10    cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/formmodel/Upload.java
  
  Index: Upload.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/formmodel/Upload.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Upload.java	4 Feb 2004 17:25:57 -0000	1.3
  +++ Upload.java	9 Feb 2004 11:28:34 -0000	1.4
  @@ -72,17 +72,18 @@
    * @version CVS $Id$
    */
   public class Upload extends AbstractWidget implements ValidationErrorAware {
  -    private UploadDefinition definition;
  +    private UploadDefinition uploadDefinition;
       private Part part;
       private ValidationError validationError;
   
       public Upload(UploadDefinition uploadDefinition) {
  -        this.definition = uploadDefinition;
  +        this.uploadDefinition = uploadDefinition;
  +        this.setDefinition(uploadDefinition);
           setLocation(uploadDefinition.getLocation());
       }
   
       public UploadDefinition getUploadDefinition() {
  -        return this.definition;
  +        return this.uploadDefinition;
       }
   
       public String getId() {
  @@ -129,13 +130,13 @@
   
       public boolean validate(FormContext formContext) {
           if (this.part == null) {
  -            if (this.definition.isRequired()) {
  +            if (this.uploadDefinition.isRequired()) {
                   this.validationError = new ValidationError(new I18nMessage("general.field-required",
Constants.I18N_CATALOGUE));
               }
           } else {
  -            String mimeTypes = this.definition.getMimeTypes();
  +            String mimeTypes = this.uploadDefinition.getMimeTypes();
               if (mimeTypes != null) {
  -                StringTokenizer tok = new StringTokenizer(this.definition.getMimeTypes(),
", ");
  +                StringTokenizer tok = new StringTokenizer(this.uploadDefinition.getMimeTypes(),
", ");
                   this.validationError = new ValidationError(new I18nMessage("upload.invalid-type",
Constants.I18N_CATALOGUE));
                   String contentType = this.part.getMimeType();
                   while (tok.hasMoreTokens()) {
  @@ -176,9 +177,9 @@
       public void generateSaxFragment(ContentHandler contentHandler, Locale locale) throws
SAXException {
           AttributesImpl fieldAttrs = new AttributesImpl();
           fieldAttrs.addCDATAAttribute("id", getFullyQualifiedId());
  -        fieldAttrs.addCDATAAttribute("required", String.valueOf(definition.isRequired()));
  -        if (definition.getMimeTypes() != null) {
  -            fieldAttrs.addCDATAAttribute("mime-types", definition.getMimeTypes());
  +        fieldAttrs.addCDATAAttribute("required", String.valueOf(uploadDefinition.isRequired()));
  +        if (uploadDefinition.getMimeTypes() != null) {
  +            fieldAttrs.addCDATAAttribute("mime-types", uploadDefinition.getMimeTypes());
           }
           contentHandler.startElement(Constants.WI_NS, FIELD_EL, Constants.WI_PREFIX_COLON
+ FIELD_EL, fieldAttrs);
   
  
  
  

Mime
View raw message