mpo         2004/04/09 04:02:40

  Modified:    src/blocks/forms/samples/forms/binding done.jx
               src/blocks/forms/samples/flow bindings.js
  Log:
  Transparently allowing for some samples to have specific styling.
  (the aggregate sample needs this)
  
  Plus introducing new display-mode for the XML.
  
  Revision  Changes    Path
  1.2       +1 -1      cocoon-2.1/src/blocks/forms/samples/forms/binding/done.jx
  
  Index: done.jx
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/forms/samples/forms/binding/done.jx,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- done.jx   9 Mar 2004 10:34:03 -0000       1.1
  +++ done.jx   9 Apr 2004 11:02:39 -0000       1.2
  @@ -28,7 +28,7 @@
                     <dumpBean bean="#{.}" />
                   </jx:when>
                   <jx:otherwise>
  -                  #{.}
  +                  <pre>#{.}</pre>
                   </jx:otherwise>
                 </jx:choose>
               </td>
  
  
  
  1.5       +41 -1     cocoon-2.1/src/blocks/forms/samples/flow/bindings.js
  
  Index: bindings.js
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/forms/samples/flow/bindings.js,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- bindings.js       6 Apr 2004 08:52:52 -0000       1.4
  +++ bindings.js       9 Apr 2004 11:02:40 -0000       1.5
  @@ -73,11 +73,15 @@
       form.load(bean);
   
       // wait for user to submit the form correctly    
  -    form.showForm("binding.form");
  +    form.showForm("binding.form." + sampleCode);
        
       // saves the form into the backend-bean
       form.save(bean);
       var bizData = new Object();
  +    //hack the XML content to a string for display
  +    if (backendType.equals("XML")) {
  +     bean = {xml: serializeNode(bean)};
  +    }
       bizData["bean"] = bean;
       bizData["backendType"] = backendType;
       bizData["sampleCode"] = sampleCode;
  @@ -86,6 +90,14 @@
   }
   
   /** 
  + * Uses internal cocoon utility class to convert the DOM Node to it's 
  + * String representation .
  + */
  +function serializeNode(node) {
  +    return Packages.org.apache.cocoon.xml.XMLUtils.serializeNodeToXML(node);
  +}
  +
  +/** 
    * Creates the form for this sample. And automatically creates the 
accompanied 
    * binding.
    */
  @@ -197,6 +209,34 @@
   
               bean.put(contexts[i], subBean);
       }
  +    return bean;
  +}
  +
  +
  +/**
  + * Creates the JS Bean for sample '03aggregate'
  + */ 
  +function createJSBeanFor03aggregate() {
  +    var bean = new Object();
  +    bean["match-combined"] = new Object();
  +    bean["match-combined"].split = new Object();
  +    bean["match-combined"].split.day = "7";
  +    bean["match-combined"].split.month = "4";
  +    bean["match-combined"].split.year = "2004";
  +
  +    bean["match-split"] = new Object();    
  +    bean["match-split"].combined = "07/04/2004";
  +    bean["match-split"].split = new Object();
  +    return bean;
  +}
  +
  +/**
  + * Creates the Java Bean for sample '03aggregate'
  + */ 
  +function createJavaBeanFor03aggregate() {
  +    var bean = new Packages.java.util.HashMap();
  +    bean.put("match-combined", new 
Packages.org.apache.cocoon.forms.samples.bindings.DateWrapper("07","04","2004"));
  +    bean.put("match-split", new 
Packages.org.apache.cocoon.forms.samples.bindings.DateWrapper("07","04","2004"));
       return bean;
   }
   
  
  
  

Reply via email to