cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v2 Form.js
Date Thu, 18 Mar 2004 13:59:20 GMT
bruno       2004/03/18 05:59:20

  Modified:    src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v2
                        Form.js
  Log:
  Allow to create the form based on a dom-tree containing the XML form description,
  in addition to an URI.
  
  Revision  Changes    Path
  1.3       +12 -5     cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v2/Form.js
  
  Index: Form.js
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/v2/Form.js,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Form.js	11 Mar 2004 02:56:32 -0000	1.2
  +++ Form.js	18 Mar 2004 13:59:20 -0000	1.3
  @@ -21,9 +21,11 @@
   defineClass("org.apache.cocoon.forms.flow.javascript.v2.ScriptableWidget");
   
   /**
  - * Create a form, given the URI of its definition file
  + * Create a form, giving either:
  + *   - the URI of its definition file
  + *   - an fd:form element in the form of a org.w3c.dom.Element
    */
  -function Form(uri) {
  +function Form(formDefinition) {
       var formMgr = null;
       var resolver = null;
       var src = null;
  @@ -33,9 +35,14 @@
           var SourceResolver = 
               Packages.org.apache.cocoon.environment.SourceResolver;
           formMgr = cocoon.getComponent(FormManager.ROLE);
  -        resolver = cocoon.getComponent(SourceResolver.ROLE);
  -        src = resolver.resolveURI(uri);
  -        var form = formMgr.createForm(src);
  +        var form;
  +        if ((typeof formDefinition) == "string" || formDefinition instanceof String) {
  +            resolver = cocoon.getComponent(SourceResolver.ROLE);
  +            src = resolver.resolveURI(formDefinition);
  +            form = formMgr.createForm(src);
  +        } else {
  +            form = formMgr.createForm(formDefinition)
  +        }
           this.binding_ = null;
           this.formWidget_ = new Widget(form);
           this.local_ = cocoon.createPageLocal();
  
  
  

Mime
View raw message