coliver     2003/02/23 11:21:22

  Modified:    src/java/org/apache/cocoon/transformation
                        XMLFormTransformer.java
  Log:
  'Updated to support using the Cocoon flow layer with XMLForm'
  
  Revision  Changes    Path
  1.19      +28 -2     
xml-cocoon2/src/java/org/apache/cocoon/transformation/XMLFormTransformer.java
  
  Index: XMLFormTransformer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/transformation/XMLFormTransformer.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- XMLFormTransformer.java   31 Jan 2003 22:51:57 -0000      1.18
  +++ XMLFormTransformer.java   23 Feb 2003 19:21:22 -0000      1.19
  @@ -69,7 +69,8 @@
   import org.xml.sax.Attributes;
   import org.xml.sax.SAXException;
   import org.xml.sax.helpers.AttributesImpl;
  -
  +import org.apache.cocoon.components.flow.WebContinuation;
  +import org.apache.cocoon.environment.Environment;
   /**
    * Transforms a document with XMLForm
    * elements into a document in the same namespace,
  @@ -526,7 +527,32 @@
              startElementWithOptionalRefAndSimpleContent( uri, name, raw, attributes 
);
            }
             else if (
  -            TAG_SUBMIT.equals(name) ||
  +                TAG_SUBMIT.equals(name) )
  +       {
  +           String continuation = attributes.getValue("continuation");
  +           if (continuation != null) {
  +               WebContinuation kont
  +                   = (WebContinuation)((Environment)resolver).getAttribute("kont");
  +               if (kont != null) {
  +                   String id;
  +                   int level = 0;
  +                   if (continuation.equals("back")) {
  +                       level = 3;
  +                   }
  +                   id = kont.getContinuation(level).getId();
  +                   AttributesImpl impl = new AttributesImpl(attributes);
  +                   int index = impl.getIndex("id");
  +                   if (index >= 0) {
  +                       impl.setValue(index, id);
  +                   } else {
  +                       impl.addAttribute("", "id", "id", "", id);
  +                   }
  +                   attributes = impl;
  +               }
  +           } 
  +           super.startElement(uri, name, raw, attributes);
  +       }
  +          else if (
               TAG_CANCEL.equals(name) ||
               TAG_RESET.equals(name) ||
               TAG_ITEM.equals(name) 
  
  
  

Reply via email to