cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jer...@apache.org
Subject svn commit: r694387 [1/2] - /cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/
Date Thu, 11 Sep 2008 17:55:27 GMT
Author: jeremy
Date: Thu Sep 11 10:55:16 2008
New Revision: 694387

URL: http://svn.apache.org/viewvc?rev=694387&view=rev
Log:
deprecating or marking some old widgets as needing re-working, adding new or updated widgets supporting client-side validation etc. for dojo 1.1.1

Added:
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/ChoiceGroup.js   (with props)
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/CurrencyField.js   (with props)
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/DateField.js   (with props)
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/DateTimeField.js   (with props)
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/FileField.js   (with props)
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/FilteringSelect.js   (with props)
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/FoldingGroup.js   (with props)
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/InplaceEditor.js   (with props)
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/NavGroup.js   (with props)
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/NumberField.js   (with props)
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/Repeater.js   (with props)
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/RichTextArea.js   (with props)
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/Select.js   (with props)
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/SuggestionReadStore.js   (with props)
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/TabGroup.js   (with props)
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/TextArea.js   (with props)
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/TextField.js   (with props)
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/TimeField.js   (with props)
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/TitlePane.js   (with props)
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/ValidatingTextArea.js   (with props)
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/ValidatingTextField.js   (with props)
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/_FieldMixin.js   (with props)
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/_GroupMixin.js   (with props)
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/_StatusMixin.js   (with props)
Modified:
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/AjaxForm.js
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/CFormsDragAndDropRepeater.js
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/CFormsForm.js
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/CFormsRepeater.js
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/CFormsSuggest.js
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/DropdownDateTimePicker.js
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/InfoPopup.js
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/MultiValueDoubleList.js
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/MultiValueEditor.js
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/MultiValueEditorWithSuggestion.js
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/SimpleForm.js
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/common.js
    cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/forms-lib.js

Modified: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/AjaxForm.js
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/AjaxForm.js?rev=694387&r1=694386&r2=694387&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/AjaxForm.js (original)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/AjaxForm.js Thu Sep 11 10:55:16 2008
@@ -29,84 +29,78 @@
  * @version $Id$
  */
 
-dojo.widget.defineWidget(
-    "cocoon.forms.AjaxForm",
-    cocoon.forms.SimpleForm,
-    {
 
-    // widget properties
-    widgetType: "AjaxForm",
+dojo.declare("cocoon.forms.AjaxForm", cocoon.forms.SimpleForm, {
 
     /**
      * Submit the form via Ajax.
      * Choose the right transport depending on the widgets in the form and the browser's capabilities.
      *
      * @param name the name of the widget that triggered the submit (if any)
-     * @param params an object containing additional parameters to be added to the form data (optional)
+     * @param content an object containing additional parameters to be added to the form data (optional)
      */
-    submit: function(name, params) {
-        var form = this.domNode;                                /* the form node */
-        var mimetype = "text/xml";                              /* the default mime-type */
-        if (!params) params = {};                               /* create if not passed */
-
-        // TODO: should CForm's onSubmit handlers be called for Ajax events ?
-        //if (cocoon.forms.callOnSubmitHandlers(form)) == false) return; /* call CForm's onSubmit handlers */
-
+    submit: function(name, content) {
         // Provide feedback that something is happening.
         document.body.style.cursor = "wait";
-
+        // Call child Widget's onSubmit function
+        dojo.publish(this.getOnSubmitTopic()); 
         // The "ajax-action" attribute specifies an alternate submit location used in Ajax mode.
         // This allows to use Ajax in the portal where forms are normally posted to the portal URL.
-        var uri = form.getAttribute("ajax-action");
-        if (!uri) uri = form.action;
-        if (uri == "") uri = document.location;
-
-        params["forms_submit_id"] = name;                       /* name of the button doing the submit */
-        params["cocoon-ajax"] = true;                           /* tell Cocoon we want AJAX-style browser updates */
-        if (dojo.io.formHasFile(form)) {                        /* check for file-upload fields */
-            dojo.require("dojo.io.IframeIO");                   /* using IframeIO as we have file-upload fields */
-            mimetype = "text/html";                             /* a different mime-type is required for IframeIO */
+        var url = this.domNode.getAttribute("ajax-action") || this.domNode.action || document.location;
+        content = content || {};
+        // ROFL, we are using every type of delimiter in standard CForms fields, legacy legacy :) (JQ)
+        content["forms_submit_id"] = name;                      /* name of the button doing the submit */
+        content["cocoon-ajax"] = true;                          /* tell Cocoon we want AJAX-style browser updates */
+        content["dojo.transport"] = "xmlhttp";                  /* tell Cocoon we are using xmlhttp transport */
+        // prepare the basic IOArgs
+        var xhrArgs = {
+            url: url,
+            content: content,
+            form: this.domNode,
+            handleAs: "xml",
+            handle: dojo.hitch(this, function(response, ioArgs) { this._handleBrowserUpdate(this, name, response, ioArgs) })
+        };
+        // choose a transport
+        if (this.checkForActiveFile(this.domNode)) {            /* check for file-upload fields */
+            dojo.require("dojo.io.iframe");                     /* using IframeIO as we have file-upload fields */
+            xhrArgs.handleAs = "html";                          /* a different mime-type is required for IframeIO */
+            xhrArgs.content["dojo.transport"] = "iframe";       /* a different transport id is required for IframeIO */
+            dojo.io.iframe.send(xhrArgs);                       /* send the AJAX Request via iframe IO */
+            // TODO: weird bug with Safari, does not send 'cocoon-ajax' or 'dojo.transport' the second time the form is posted
+        } else {
+            xhrArgs.contentType = "application/x-www-form-urlencoded; charset=UTF-8";
+            dojo.xhrPost(xhrArgs);                              /* send the AJAX Request via xhr IO */
         }
-
-        dojo.io.bind({
-            url: uri,
-            handle: dojo.lang.hitch(this, function(type, data) { this._handleBrowserUpdate(this, name, type, data) }),
-            method: "post",
-            mimetype: mimetype,                                 /* the mimetype of the response */
-            content: params,                                    /* add extra params to the form */
-            formNode: form,                                     /* the form */
-            sendTransport: true                                 /* tell cocoon what transport we are using */
-        });
         // Toggle the click target off, so it does not get resubmitted if another submit is fired before this has finished
         // NB. This must be done after the form is assembled by dojo, or certain onChange handlers may fail
-        // Avoid the use of widget.lastClickTarget as it may already be out of date
-        if (form[name]) form[name].disabled = true;
+        // Avoid the use of this.lastClickTarget as it may already be out of date
+        if (this.domNode[name]) this.domNode[name].disabled = true;
+        dojo.publish(this.getAfterSubmitTopic());
     },
 
     /**
      * Handle the server's BrowserUpdate response.
      * Update the part of the form referenced by ids in the reponse.
      */
-    _handleBrowserUpdate: function(widget, name, type, data) {
+    _handleBrowserUpdate: function(widget, name, response, ioArgs) {
+        _response = response; // debug
         // Restore normal cursor
         document.body.style.cursor = "auto";
         // Attempt to re-enable the click target
         if (this.domNode[name]) this.domNode[name].disabled = false;
         // get a BrowsewrUpdateHandler which will replace the updated parts of the form
         var updater = new cocoon.ajax.BUHandler();
-        if (type == "load") {
-            if (!data) {
-                cocoon.ajax.BUHandler.handleError("No xml answer", data);
-                return;
-            }
+        if (response instanceof Error && response.dojoType == "timeout") {
+            updater.handleError("Request timed out", response);
+        } else if (response instanceof Error) {
+            updater.handleError("Request failed", response);
+        } else if (!response) {
+            cocoon.ajax.BUHandler.handleError("No xml answer");
+        } else {
             // add the continue handler for CForms
             updater.handlers['continue'] = function() { widget._continue(); }
             // Handle browser update directives
-            updater.processResponse(data);
-        } else if (type == "error") {
-            updater.handleError("Request failed", data);
-        } else {
-            dojo.debug("WARNING: dojo.io.bind returned an unhandled state : " + type);
+            updater.processResponse(response);
         }
     },
 
@@ -138,22 +132,17 @@
             }
             window.location.href = form.action + contParam;
         }
+    },
+    
+    checkForActiveFile: function(node) {
+        var hasFile = false;
+        var inputs = node.getElementsByTagName("input");
+        dojo.forEach(inputs, function(input){
+            if(hasFile){ return; }
+            if(input.getAttribute("type")=="file" && !input.disabled && input.value){
+                hasFile = true;
+            }
+        });
+        return hasFile;
     }
 });
-
-/**
- * Override built-in dojo function, we do not care about 'file' fields that are disabled.
- * We overide because dojo will call this during form submission and we do not want it
- * to be bothered by disabled file fields. Hopefully this can be added to dojo .....
- */
-dojo.io.checkChildrenForFile = function(node) {
-    var hasFile = false;
-    var inputs = node.getElementsByTagName("input");
-    dojo.lang.forEach(inputs, function(input){
-        if(hasFile){ return; }
-        if(input.getAttribute("type")=="file" && !input.disabled && input.value){
-            hasFile = true;
-        }
-    });
-    return hasFile;
-}

Modified: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/CFormsDragAndDropRepeater.js
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/CFormsDragAndDropRepeater.js?rev=694387&r1=694386&r2=694387&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/CFormsDragAndDropRepeater.js (original)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/CFormsDragAndDropRepeater.js Thu Sep 11 10:55:16 2008
@@ -28,6 +28,8 @@
 
 // Extends the base CFormsRepeater class.
 
+/* Deprecated in 2.1.12: TODO: This is no longer used and will no longer work  */
+
 dojo.widget.defineWidget(
     "cocoon.forms.CFormsDragAndDropRepeater",
     cocoon.forms.CFormsRepeater, {

Modified: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/CFormsForm.js
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/CFormsForm.js?rev=694387&r1=694386&r2=694387&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/CFormsForm.js (original)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/CFormsForm.js Thu Sep 11 10:55:16 2008
@@ -32,6 +32,9 @@
  * @version $Id$
  */
 
+/* TODO: This is no longer used and will no longer work  */
+
+
 dojo.widget.defineWidget(
     "cocoon.forms.CFormsForm",
     dojo.widget.DomWidget,

Modified: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/CFormsRepeater.js
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/CFormsRepeater.js?rev=694387&r1=694386&r2=694387&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/CFormsRepeater.js (original)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/CFormsRepeater.js Thu Sep 11 10:55:16 2008
@@ -31,11 +31,21 @@
 // Extends the base DomWidget class. We don't need all the HtmlWidget stuff
 // but need traversal of the DOM to build child widgets.
 
+/* Deprecated in 2.1.12 TODO: This is no longer used and will no longer work  */
+
+
 dojo.widget.defineWidget(
     "cocoon.forms.CFormsRepeater",
     dojo.widget.DomWidget, {
     // Properties
+    
+    // useHandle ? class of handle element ?
+    // multi-dnd @accept, @type ?? don't know full IDs when in CForms Templates? (but do in xslt)
+    
+    // if we are making a dnd widget, why make it unorderable by default?
     orderable: false,
+    
+    // what is the use of having no selection? the model won't work ??
     select: "$no$", // default value used to type the property, but indicating that
                     // no selection will occur
 
@@ -44,21 +54,68 @@
     widgetType: "CFormsRepeater",
     isContainer: true,
     preventClobber: true, // don't clobber our node
+
+
+
+	/*
+	
+	constructor :
+	
+		1. go through finding all dragable children
+		2. add class="dojoDndItem" to them
+		3. make Arrays of subscribed and connected events
+			add a destroy function to remove them
+
+
+	notes :
+
+		4. instantiate a dojo.dnd.Source or Selector (depending on dnd on or off?) on my node
+			or more likely a cocoon.cforms.DndSource (in this file)
+				extends dojo.dnd.Source - adds our select stuff to Selector
+		
+		? drop indicator : add support for tables :
+			.dojoDndItemBefore, .dojoDndItemBefore td {
+				border-top: 2px solid #369;
+			}
+
+		? onSelect, onDeselect(?) check/uncheck select widget
+	
+		when loaded, set the selected ones as selected
+		
+		when mousing, turn selection on or off as appropriate (how?)
+		
+		if select checkbox is visible?
+			turn row select on and off?
+			
+	
+	*/
+
+
+
+
     
     getType: function() {
 			    return "cforms-" + this.id;
     },
     
     // widget interface
+    // make sure this still runs under 1.1
     buildRendering: function(args, frag) {
 	    // FIXME: we should destroy all drag sources and drop targets when the widget is destroyed
-	    
+
+
+		// break down buildRendering so we can use inheritance more decently?
+		// or make one widget that does both multi and single dnd
         cocoon.forms.CFormsRepeater.superclass.buildRendering.call(this, args, frag);
         this.id = this.domNode.getAttribute("id");
         if (!this.orderable && this.select == "none") {
             dojo.debug(this.widgetType + " '" + this.id + "' is not orderable nor selectable");
         }
 
+
+
+
+
         if (this.orderable) {
 	        // Get the parent of the first repeater row (may be different from this.domNode)
 	        var firstRow = dojo.byId(this.id + ".0");

Modified: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/CFormsSuggest.js
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/CFormsSuggest.js?rev=694387&r1=694386&r2=694387&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/CFormsSuggest.js (original)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/CFormsSuggest.js Thu Sep 11 10:55:16 2008
@@ -34,6 +34,8 @@
  * @version $Id$
  */
 
+/* Deprecated in 2.1.12 TODO: This is no longer used and will no longer work  */
+
 dojo.widget.defineWidget(
     "cocoon.forms.CFormsSuggest",
     dojo.widget.ComboBox, {

Added: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/ChoiceGroup.js
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/ChoiceGroup.js?rev=694387&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/ChoiceGroup.js (added)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/ChoiceGroup.js Thu Sep 11 10:55:16 2008
@@ -0,0 +1,165 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+dojo.provide("cocoon.forms.ChoiceGroup");
+
+dojo.require("dijit.Menu");
+dojo.require("dijit.form.Button");
+dojo.require("dijit.layout.StackContainer");
+dojo.require("cocoon.forms._GroupMixin");
+
+/**
+ * CForms ChoiceGroup Widget.
+ * A set of panes that are switched between using a drop-down menu        
+ *
+ * eg: <fi:group>
+ *         <fi:styling type="choice" . . . />
+ *
+ * NOTE: introduced in 2.1.12
+ *
+ * @version $Id$
+ */
+ 
+ /*
+ 
+    TODO: Fix appalling behaviour of window re-size!!!
+    TODO: Status not showing
+          Not sure _setStatus being called on this
+    
+ */
+ 
+ 
+ 
+dojo.declare("cocoon.forms.ChoiceGroup", [dijit.layout.StackContainer, dijit._Templated, cocoon.forms._GroupMixin], {	
+
+	_controllerWidget: "cocoon.forms.ChoiceController", // the controller to use.
+
+  // template for menu and content, ripped from TitlePane
+  templateString: "<div class=\"dijitTitlePane forms-choice-group\">\n\t<div tabindex=\"0\" waiRole=\"button\" class=\"dijitTitlePaneTitle\" dojoAttachPoint=\"focusNode\">\n\t\t<div dojoAttachPoint=\"controllerNode\" class=\"dijitTitlePaneTextNode\"></div>\n\t</div>\n\t<div class=\"dijitTitlePaneContentOuter\">\n\t\t<div class=\"dijitReset\">\n\t\t\t<div class=\"dijitTitlePaneContentInner\" dojoAttachPoint=\"containerNode\" waiRole=\"region\" tabindex=\"-1\">\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</div>\n", 
+
+  // create the controller
+	postCreate: function(){	
+		this.inherited(arguments);
+		// create the choice list that will have a menu item for each panel
+		var Controller = dojo.getObject(this._controllerWidget);
+		this.controller = new Controller({
+			id: this.id + "_controller",
+			doLayout: this.doLayout,
+			containerId: this.id
+		}, this.controllerNode);
+	},
+	
+  // wire up the controller and its menu items
+	startup: function(){
+		if(this._started){ return; }
+		this.controller.startup();
+		this.inherited(arguments);
+  },
+
+	destroy: function(){
+		if(this.controller){
+			this.controller.destroy();
+		}
+		this.inherited(arguments);
+	},
+	  
+	// supply the relevant MenuItem to draw status on
+  getStatusWidget: function() {
+    return this.controlButton ? this.controlButton : this;
+  }
+
+});
+
+/**
+ * CForms ChoiceController Widget.
+ * A drop-down menu for choosing between panes
+ *
+ * NOTE: introduced in 2.1.12
+ */
+dojo.declare("cocoon.forms.ChoiceController", [dijit.layout.StackController], {
+
+  // Add the DropDownButton and it's Menu to the domNode
+  buildRendering: function(){		
+    this.inherited(arguments); // call my super class
+    this.menu = new dijit.Menu({ });
+    this.menu.domNode.style.display="none";
+    this.button = new dijit.form.DropDownButton({dropDown: this.menu});
+    this.domNode.appendChild(this.button.domNode);
+  },
+
+  // Add a MenuItem to the Menu for a page
+  onAddChild: function(/*Widget*/ page, /*Integer?*/ insertIndex){
+    var menuItem = new cocoon.forms.StatusMenuItem({
+        label: page.title,
+        onClick: dojo.hitch(this, "onButtonClick", page)
+    });
+    this.menu.addChild(menuItem);
+    dijit.setWaiRole((menuItem.focusNode || menuItem.domNode), "tab"); // ??
+    this.pane2button[page] = menuItem;
+		page.controlButton = menuItem;
+    if(!this._currentChild){
+      this._currentChild = page;
+    }
+  },
+
+  // Set the DropDownButton's label to the selected pane title, execute the pane's optional onShow script
+  onSelectChild: function(/*Widget*/ page){
+    if(!page){ return; }
+    this.button.setLabel(page.title);
+    var container = dijit.byId(this.containerId);
+    dijit.setWaiState(container.containerNode || container.domNode, "labelledby", this.button.id);    
+    var script = page.domNode.getAttribute("onShow");
+    if (script) dojo.hitch(page, function() { eval(script); })(); 
+  },
+  
+  // clean up on unload
+  destroy: function() {
+    if (this.button) this.button.destroy();
+    this.inherited(arguments);
+  }
+
+});
+
+/**
+ * CForms StatusMenuItem Widget.
+ * A dijit.MenuItem that shows a status mark
+ *
+ * NOTE: introduced in 2.1.12
+ */
+dojo.declare("cocoon.forms.StatusMenuItem", [dijit.MenuItem], {
+	
+	// copy of the dijit.MenuItem template, adding statusMarker
+	templateString:
+		 '<tr class="dijitReset dijitMenuItem" '
+		+'dojoAttachEvent="onmouseenter:_onHover,onmouseleave:_onUnhover,ondijitclick:_onClick">'
+		+'<td class="dijitReset"><div class="dijitMenuItemIcon ${iconClass}" dojoAttachPoint="iconNode"></div></td>'
+		+'<td tabIndex="-1" class="dijitReset dijitMenuItemLabel" dojoAttachPoint="containerNode,focusNode" waiRole="menuitem"></td>'
+		+'<td dojoAttachPoint="statusNode"><div class="dijitReset dijitValidationIconText">${_cforms_statusMarker}</div></td>'
+		+'<td class="dijitReset" dojoAttachPoint="arrowCell">'
+			+'<div class="dijitMenuExpand" dojoAttachPoint="expand" style="display:none">'
+			+'<span class="dijitInline dijitArrowNode dijitMenuExpandInner">+</span>'
+			+'</div>'
+		+'</td>'
+		+'</tr>',
+	
+	// get my marker
+  postMixInProperties: function() {
+    this._cforms_statusMarker = cocoon.forms.defaults.statusMark;
+    this.inherited(arguments); 
+  }
+
+});
+

Propchange: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/ChoiceGroup.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/CurrencyField.js
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/CurrencyField.js?rev=694387&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/CurrencyField.js (added)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/CurrencyField.js Thu Sep 11 10:55:16 2008
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+dojo.provide("cocoon.forms.CurrencyField");
+
+dojo.require("dijit.form.CurrencyTextBox");
+dojo.require("cocoon.forms.NumberField");
+dojo.require("dojo.currency");
+
+/**
+ * CForms CurrencyField Widget.
+ * A field that validates currencies in different locales        
+ *
+ * eg: <fd:field id="myNumber">
+ *       <fd:datatype base="decimal" . . . />
+ *         <fd:convertor variant="currency" . . . />
+ * 
+ * This behaves a bit differently to the equivalent in dojo @see: cocoon.forms.NumberField for a description
+ *
+ * NOTE: introduced in 2.1.12
+ *
+ * @version $Id$
+ */
+dojo.declare("cocoon.forms.CurrencyField", [cocoon.forms.NumberField], {	
+		regExpGen: dojo.currency.regexp,
+		_formatter: dojo.currency.format,
+		parse: dojo.currency.parse,
+
+});
\ No newline at end of file

Propchange: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/CurrencyField.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/DateField.js
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/DateField.js?rev=694387&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/DateField.js (added)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/DateField.js Thu Sep 11 10:55:16 2008
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+dojo.provide("cocoon.forms.DateField");
+
+dojo.require("dijit.form.DateTextBox");
+dojo.require("cocoon.forms._FieldMixin");
+
+/**
+ * CForms DateField Widget.
+ * A field that validate dates in different locales
+ *
+ * eg: <fd:field id="myDate">
+ *       <fd:datatype base=" . . . " . . . />
+ *         <fd:convertor type=" . . . " variant=" . . . " . . . />
+ *
+ * This behaves a bit differently to the equivalent in dojo @see: cocoon.forms.NumberField for a description
+ *
+ * NOTE: introduced in 2.1.12
+ *
+ * @version $Id$
+ */
+dojo.declare("cocoon.forms.DateField", [dijit.form.DateTextBox, cocoon.forms._FormattingFieldMixin, cocoon.forms._SizedFieldMixin], {	
+
+  // adding a place for the status marker to dijit.form.ValidationTextBox's template
+  templateString:"<div class=\"dijit dijitReset dijitInlineTable dijitLeft\"\n\tid=\"widget_${id}\"\n\tdojoAttachEvent=\"onmouseenter:_onMouse,onmouseleave:_onMouse,onmousedown:_onMouse\" waiRole=\"presentation\"\n\t><div style=\"overflow:hidden;\"\n\t\t><div class=\"dijitReset dijitValidationIcon\"><br></div\n\t\t><div class=\"dijitReset dijitValidationIconText\">${_cforms_statusMarker}</div\n\t\t><div class=\"dijitReset dijitInputField\"\n\t\t\t><input class=\"dijitReset\" dojoAttachPoint='textbox,focusNode' dojoAttachEvent='onfocus:_update,onkeyup:_onkeyup,onblur:_onMouse,onkeypress:_onKeyPress' autocomplete=\"off\"\n\t\t\ttype='${type}' name='${name}'\n\t\t/></div\n\t></div\n></div>\n",
+    
+  // Widget interface
+  postMixInProperties: function() {
+    this.constraints.datePattern = this.constraints.pattern;
+    this.constraints.pattern = null;
+    this.inherited(arguments);
+  }
+
+});
+

Propchange: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/DateField.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/DateTimeField.js
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/DateTimeField.js?rev=694387&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/DateTimeField.js (added)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/DateTimeField.js Thu Sep 11 10:55:16 2008
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+dojo.provide("cocoon.forms.DateTimeField");
+
+//dojo.require("dijit.form.DateTextBox");
+//dojo.require("dijit.form.TimeTextBox");
+dojo.require("dijit.form._DateTimeTextBox");
+dojo.require("cocoon.forms._FieldMixin");
+
+/**
+ * CForms DateTimeField Widget.
+ * A field that validate combined date/times in different locales
+ *
+ * eg: <fd:field id="myDate">
+ *       <fd:datatype base=" . . . " . . . />
+ *         <fd:convertor type=" . . . " variant=" . . . " . . . />
+ *
+ * This behaves a bit differently to the equivalent in dojo @see: cocoon.forms.NumberField for a description
+ *
+ * NOTE: introduced in 2.1.12
+ *
+ * @version $Id$
+ */
+ 
+ /*
+ 
+  TODO: This needs Dojo Editors attached to it :
+  
+    dijit._Calendar - for the date portion
+    dijit._TimePicker - for the time portion
+ 
+  TODO: get validation working
+  
+  TODO: Display:
+    show date + time in what looks like a single field (but is effectively two onClick regions)
+    when you click on the date or time portion :
+      switch view to an input containing the whole string 
+      bring up the appropriate editor for date or time
+ 
+    copy date/time splitting code etc. from cocoon.forms.DropdownDateTimePicker
+ 
+ */
+ 
+ 
+ 
+dojo.declare("cocoon.forms.DateTimeField", [dijit.form._DateTimeTextBox, cocoon.forms._FormattingFieldMixin, cocoon.forms._SizedFieldMixin], {	
+
+  // adding a place for the status marker to dijit.form.ValidationTextBox's template
+  templateString:"<div class=\"dijit dijitReset dijitInlineTable dijitLeft\"\n\tid=\"widget_${id}\"\n\tdojoAttachEvent=\"onmouseenter:_onMouse,onmouseleave:_onMouse,onmousedown:_onMouse\" waiRole=\"presentation\"\n\t><div style=\"overflow:hidden;\"\n\t\t><div class=\"dijitReset dijitValidationIcon\"><br></div\n\t\t><div class=\"dijitReset dijitValidationIconText\">${_cforms_statusMarker}</div\n\t\t><div class=\"dijitReset dijitInputField\"\n\t\t\t><input class=\"dijitReset\" dojoAttachPoint='textbox,focusNode' dojoAttachEvent='onfocus:_update,onkeyup:_onkeyup,onblur:_onMouse,onkeypress:_onKeyPress' autocomplete=\"off\"\n\t\t\ttype='${type}' name='${name}'\n\t\t/></div\n\t></div\n></div>\n",
+    
+  // Widget interface
+  postMixInProperties: function() {
+    this.constraints.datePattern = this.constraints.pattern;
+    this.constraints.TimePattern = this.constraints.pattern;
+    this.constraints.pattern = null;
+    this._selector = "datetime";
+    this.inherited(arguments);
+  }
+
+});
+

Propchange: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/DateTimeField.js
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/DropdownDateTimePicker.js
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/DropdownDateTimePicker.js?rev=694387&r1=694386&r2=694387&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/DropdownDateTimePicker.js (original)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/DropdownDateTimePicker.js Thu Sep 11 10:55:16 2008
@@ -25,6 +25,10 @@
  * Compared to the dojo dropdown date and time pickers, this one supports also combined datetime input
  * in one field. It also makes use of the correct forms locale.
  */
+
+/* Deprecated in 2.1.12 TODO: This is no longer used and will no longer work  */
+
+
 dojo.widget.defineWidget("cocoon.forms.DropdownDateTimePicker", dojo.widget.HtmlWidget,
     function() {
     },

Added: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/FileField.js
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/FileField.js?rev=694387&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/FileField.js (added)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/FileField.js Thu Sep 11 10:55:16 2008
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+dojo.provide("cocoon.forms.FileField");
+
+dojo.require("dijit.form.TextBox");
+dojo.require("cocoon.forms._FieldMixin");
+
+/**
+ * CForms FileField Widget.
+ * Intended to be a file input that looks the same across browsers
+ *
+ * NOTE: introduced in 2.1.12
+ *
+ * @version $Id$
+ */
+ 
+ /*
+    TODO: Implement this, probably based on code ripped from dojox.widget.FileInput
+    
+    Will exist in 3 primary states :
+    
+      Unchosen, Chosen, Uploaded
+    
+    Unchosen:
+      [ Browse... ] [*] [no file selected         ] [?]
+      
+    Chosen:
+      [   Clear   ] [*] [selected file name       ] [?]
+      
+    Uploaded:
+      [   Delete  ] [*] [selected file name, bytes] [?]
+      
+            ^        ^               ^               ^
+            |        |               |               |
+         Button   status     <input> lookalike   help button
+ 
+    NB. "<input> lookalike" sized by @size
+        Try to get the Buttons all the same width (how with i18n?)
+ 
+ */
+ 
+dojo.declare("cocoon.forms.FileField", [dijit.form.TextBox, cocoon.forms._ErrorAwareFieldMixin, cocoon.forms._SizedFieldMixin, cocoon.forms._FieldHintMixin], {	
+
+    // add _ErrorAwareFieldMixin ?
+});

Propchange: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/FileField.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/FilteringSelect.js
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/FilteringSelect.js?rev=694387&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/FilteringSelect.js (added)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/FilteringSelect.js Thu Sep 11 10:55:16 2008
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+dojo.provide("cocoon.forms.FilteringSelect");
+dojo.require("dijit.form.FilteringSelect");
+dojo.require("cocoon.forms._FieldMixin");
+
+// @see cocoon.forms.Select for design notes
+
+// TODO: Required status not appearing on parent objects (Tabs etc.)
+
+dojo.declare("cocoon.forms.FilteringSelect", [dijit.form.FilteringSelect, cocoon.forms._ErrorAwareFieldMixin, cocoon.forms._FieldHintMixin], {	
+  
+  templateString: "<div class=\"dijit dijitReset dijitInlineTable dijitLeft\"\r\tid=\"widget_${id}\"\r\tdojoAttachEvent=\"onmouseenter:_onMouse,onmouseleave:_onMouse,onmousedown:_onMouse\" dojoAttachPoint=\"comboNode\" waiRole=\"combobox\" tabIndex=\"-1\"\r\t><div style=\"overflow:hidden;\"\r\t\t><div class='dijitReset dijitRight dijitButtonNode dijitArrowButton dijitDownArrowButton'\r\t\t\tdojoAttachPoint=\"downArrowNode\" waiRole=\"presentation\"\r\t\t\tdojoAttachEvent=\"onmousedown:_onArrowMouseDown,onmouseup:_onMouse,onmouseenter:_onMouse,onmouseleave:_onMouse\"\r\t\t\t><div class=\"dijitArrowButtonInner\">&thinsp;</div\r\t\t\t><div class=\"dijitArrowButtonChar\">&#9660;</div\r\t\t></div\r\t\t><div class=\"dijitReset dijitValidationIcon\"><br></div\r\t\t><div class=\"dijitReset dijitValidationIconText\">${_cforms_statusMarker}</div\r\t\t><div class=\"dijitReset dijitInputField\"\r\t\t\t><input type=\"text\" autocomplete=\"off\" name=\"${name}\" class='dijitReset'\r\t\t\t
 dojoAttachEvent=\"onkeypress:_onKeyPress, onfocus:_update, compositionend,onkeyup\"\r\t\t\tdojoAttachPoint=\"textbox,focusNode\" waiRole=\"textbox\" waiState=\"haspopup-true,autocomplete-list\"\r\t\t/></div\r\t></div\r></div>\r",
+
+  suggestion: "", // pre-supplied label for round-tripping
+  
+  baseClass: "dijitComboBox",
+
+  postMixInProperties: function() {
+    if (this.srcNodeRef.getAttribute("store")) {
+      this.searchDelay = 200; // slow down a bit
+    }
+    this.inherited(arguments);
+  },
+  
+  buildRendering: function() {
+    this.inherited(arguments);
+    if (this.value && this.suggestion) this._setValue(this.value, this.suggestion, false); 
+  },
+
+
+
+/* 
+
+    TODO: this is doing a reverse lookup using the label when you blur the field
+    this is bad as labels seldom need to be unique (unlike key values)
+    
+    It should not need to do the reverse-lookup, it has just retrieved the data it needs
+    NB. The latest QueryReadStore samples do not do this, is there a problem with my code or data?
+
+
+  setDisplayedValue:function(label, priorityChange){
+    // this function in the superclass appears to be completely broken.
+    // for one, it attempts to do a reverse lookup for the value, FROM THE LABEL !!!!!!!!!!!!
+    
+    // TODO: if I nop this function, after setting the label, the value is unchanged (wrong)
+    
+  }
+    
+*/
+  
+});
\ No newline at end of file

Propchange: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/FilteringSelect.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/FoldingGroup.js
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/FoldingGroup.js?rev=694387&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/FoldingGroup.js (added)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/FoldingGroup.js Thu Sep 11 10:55:16 2008
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+dojo.provide("cocoon.forms.FoldingGroup");
+
+dojo.require("dijit.layout.AccordionContainer");
+dojo.require("cocoon.forms._GroupMixin");
+
+/* Folding Group
+  eg: <fi:group>
+          <fi:styling type="folding" . . . />
+          
+  A set of panes that can be switched between by clicking on their titles
+
+  We extend dijit.layout.AccordionContainer with cocoon.forms._GroupMixin providing behaviour required for CForms
+          
+*/
+
+/* 
+
+  TODO: pane sizing at start is broken, if there is not absolute height set in CSS 
+  The approaches below are not working
+  try extending AccordionPane ??????? (and change in the xslt !!)
+
+*/
+/* TODO: adding status mark to labels is broken */
+
+dojo.declare("cocoon.forms.FoldingGroup", [dijit.layout.AccordionContainer, cocoon.forms._GroupMixin], {	
+
+  // the controller to use
+	//_controllerWidget: "dijit.layout.StackController" 
+  xxlayout: function(){ 
+    if (this.selectedChildWidget && this.selectedChildWidget.containerNode.clientHeight == 0) {
+      var high = 0, border = /* eek! */3;
+      
+      high = this.selectedChildWidget.containerNode.scrollHeight;
+
+      if (high > 0) this.selectedChildWidget.containerNode.style.height = high + "px";
+    }
+    this.inherited(arguments);
+  },
+  
+  postCreate: function() {
+    this.inherited(arguments);
+    
+    var totalCollapsedHeight = 0;
+    dojo.forEach(this.getChildren(), function(child){
+      totalCollapsedHeight += child.getTitleHeight();
+    });
+    console.debug("AccordionGroup.postCreate: " + totalCollapsedHeight);
+    
+    //this.domNode.style.height = "200px";
+  },
+  
+  startup: function() {
+    this.inherited(arguments);
+    console.debug("AccordionGroup.startup: " + this.selectedChildWidget.containerNode.style.height);
+  },
+  layout: function() {
+    //console.debug("AccordionGroup.layout");
+    var totalCollapsedHeight = 0;
+    dojo.forEach(this.getChildren(), function(child){
+      totalCollapsedHeight += child.getTitleHeight();
+    });
+    console.debug("AccordionGroup.layout: " + (totalCollapsedHeight));
+    this.inherited(arguments);
+  },
+  _setupChild: function(page) {
+    console.debug("AccordionGroup._setupChild");
+    this.inherited(arguments);
+  }
+  
+});
+

Propchange: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/FoldingGroup.js
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/InfoPopup.js
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/InfoPopup.js?rev=694387&r1=694386&r2=694387&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/InfoPopup.js (original)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/InfoPopup.js Thu Sep 11 10:55:16 2008
@@ -15,42 +15,61 @@
  * limitations under the License.
  */
 dojo.provide("cocoon.forms.InfoPopup");
+dojo.require("dijit.form.Button");
+dojo.require("dijit.layout.ContentPane");
 
 /*
  * A widget displaying an icon which when pressed shows a popup.
  * The content of the popup is the content of the original element declaring the widget.
  */
-dojo.widget.defineWidget(
+dojo.declare(
     // widget name and class
     "cocoon.forms.InfoPopup",
 
     // superclass
-    dojo.widget.HtmlWidget,
-
-    function() {
-
-    },
+    [dijit.form.DropDownButton],
 
     // properties and methods
     {
+				iconClass: "dijitValidationIcon",
+				closeIconClass: "dijitDialogCloseIcon",
+				label: "",
+	
+				widgetsInTemplate: true,
+	
         isContainer: true,
-        icon: "",
+				templateString: "",
+        templatePath: dojo.moduleUrl("cocoon.forms", "templates/InfoPopup.html"),
 
-        templatePath: cocoon.resourcesUri + "/forms/js/templates/InfoPopup.html",
-        templateCssPath: cocoon.resourcesUri + "/forms/js/templates/InfoPopup.css",
 
-        closeIconURL: cocoon.resourcesUri + "/forms/js/templates/images/close.gif",
 
         containerToggle: "plain", /* plain, explode, wipe, fade */
 
         containerToggleDuration: 150,
+        
+        
 
-        postMixInProperties: function(args, frag, parent) {
-            cocoon.forms.InfoPopup.superclass.postMixInProperties(this, args, frag, parent);
-
-            this.iconURL = cocoon.resourcesUri + "/forms/js/templates/images/" + this.icon;
-        },
-
+				startup: function(){
+					// the child widget from srcNodeRef is the dropdown widget.  Insert it in the page DOM,
+					// make it invisible, and store a reference to pass to the popup code.
+					if(!this.dropDown){
+						console.debug("dropDownNode: " + this.dropDownContainer);
+						//var dropDownNode = dojo.query("[widgetId]", this.dropDownContainer);
+						//console.debug("dropDownNode: " + this.dropDownNode);
+						//this.dropDown = dijit.byNode(dropDownNode);
+						this.dropDown = dijit.byNode(this.dropDownContainer);
+						delete this.dropDownContainer;
+					}
+					dojo.body().appendChild(this.dropDown.domNode);
+					this.dropDown.domNode.style.display="none";
+				}
+        
+        
+        
+        
+        
+        
+/*
         attachTemplateNodes: function(){
             // summary: use attachTemplateNodes to specify containerNode, as fillInTemplate is too late for this
             cocoon.forms.InfoPopup.superclass.attachTemplateNodes.apply(this, arguments);
@@ -91,6 +110,6 @@
         hidePopup: function() {
             this.infoPopup.close();
         }
-
+*/
     }
 );
\ No newline at end of file

Added: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/InplaceEditor.js
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/InplaceEditor.js?rev=694387&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/InplaceEditor.js (added)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/InplaceEditor.js Thu Sep 11 10:55:16 2008
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+dojo.provide("cocoon.forms.InplaceEditor");
+
+dojo.require("dijit.InlineEditBox");
+dojo.require("cocoon.forms._FieldMixin");
+
+
+/**
+ * CForms InplaceEditor Widget.
+ * A wrapper for an editor field that shows plain content until clicked on to edit
+ *
+ * NOTE: introduced in 2.1.12
+ *
+ * @version $Id$
+ */
+dojo.declare("cocoon.forms.InplaceEditor", [dijit.InlineEditBox, cocoon.forms._FieldMixin], {	
+    
+  //noValueIndicator: "edit this",
+
+  required: false, // is this a required field
+  valueNode: "",   // the id of the field holding my value
+  editorId: "",    // the id of my editor
+  autoSave: false, // changing default
+    
+  postMixInProperties: function() {
+    this.inherited(arguments);
+    if(this.editorParams.invalidMessage) this._cforms_Error = true;
+    this._cforms_statusMarker = cocoon.forms.defaults.statusMark; // the error marker
+  },
+    
+  // Widget interface
+  postCreate: function() {
+    this.inherited(arguments);
+    // make a node for the status marker
+    this.statusNode = dojo.doc.createElement('span');
+    this.statusNode.innerHTML = this._cforms_statusMarker;
+    dojo.addClass(this.statusNode, "dijitReset inPlaceValidation dijitValidationIconText");
+    dojo.place(this.statusNode, this.domNode, "before");
+  },
+
+  // Widget interface
+  startup: function(){
+    if (this._cforms_Error) {
+      this.state = "Error";
+      dojo.addClass(this.getStatusWidget(), "dijitError cformsStatus" + this.required ? " cformsRequired" : "");
+      dijit.setWaiState(this.domNode, "invalid", "true");
+    } else if (this.required) {
+      dojo.addClass(this.getStatusWidget(), "cformsStatus cformsRequired");
+    } else {
+      dojo.addClass(this.getStatusWidget(), "cformsStatus");
+    }
+    this.inherited(arguments);
+  },
+    
+  // return the field node that contains the Widget value - overridden by 'MappedTextBox' type subclasses
+  getValueNode: function() {
+    return dojo.byId(this.valueNode);
+  },
+    
+  //copy the display value to the submitted field, before the form submits
+  onSubmit: function() {
+    this.getValueNode().value = this.getValue();
+  },
+
+  // where to place classes to mark status
+  getStatusWidget: function() { 
+    return this.domNode.parentNode;
+  },
+
+  // InlineEditBox interface - copy my classes to the phantom node (required etc.)
+  _edit: function(){
+    // hide the statusNode
+    dojo.style(this.statusNode, "display", "none");
+    // copy css to new view
+    var classes = this.domNode.className;
+    // let the editor switch domNode
+    this.inherited(arguments);
+    dojo.addClass(this.domNode, classes);
+  },
+  
+  // InlineEditBox interface - show my child editor's status on me
+  _showText: function() {
+    this.state = dijit.byId(this.editorId).state; // undefined
+    this.inherited(arguments);
+    // show the statusNode
+    dojo.style(this.statusNode, "display", "inline-block");
+    // set my state classes
+    if (this.state === "Error") {
+      dojo.addClass(this.getStatusWidget(), "dijitError");
+    } else {
+      dojo.removeClass(this.getStatusWidget(), "dijitError");
+    }
+  }
+});

Propchange: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/InplaceEditor.js
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/MultiValueDoubleList.js
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/MultiValueDoubleList.js?rev=694387&r1=694386&r2=694387&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/MultiValueDoubleList.js (original)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/MultiValueDoubleList.js Thu Sep 11 10:55:16 2008
@@ -24,6 +24,10 @@
  *  - items can be moved around using ctrl+up and ctrl+down.
  *  - an item can be replaced/updated by pressing ctrl+enter in the input box
  */
+ 
+ /* TODO: This needs to be replaced with a version for dojo 1.1.1 */
+
+ 
 dojo.widget.defineWidget(
     // widget name and class
     "cocoon.forms.MultiValueDoubleList",

Modified: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/MultiValueEditor.js
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/MultiValueEditor.js?rev=694387&r1=694386&r2=694387&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/MultiValueEditor.js (original)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/MultiValueEditor.js Thu Sep 11 10:55:16 2008
@@ -23,6 +23,9 @@
  *  - items can be moved around using ctrl+up and ctrl+down.
  *  - an item can be replaced/updated by pressing ctrl+enter in the input box
  */
+ 
+  /* TODO: This needs to be replaced with a version for dojo 1.1.1 */
+
 dojo.widget.defineWidget(
     // widget name and class
     "cocoon.forms.MultiValueEditor",

Modified: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/MultiValueEditorWithSuggestion.js
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/MultiValueEditorWithSuggestion.js?rev=694387&r1=694386&r2=694387&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/MultiValueEditorWithSuggestion.js (original)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/MultiValueEditorWithSuggestion.js Thu Sep 11 10:55:16 2008
@@ -25,6 +25,9 @@
  *  - items can be moved around using ctrl+up and ctrl+down.
  *  - an item can be replaced/updated by pressing ctrl+enter in the input box
  */
+ 
+  /* TODO: This needs to be replaced with a version for dojo 1.1.1 */
+
 dojo.widget.defineWidget("cocoon.forms.MultiValueEditorWithSuggestion",
     cocoon.forms.MultiValueEditor,
     function() {
@@ -35,7 +38,7 @@
         name: "",
         widgetsInTemplate: true,
         cformsIdPrefix: "id-prefix-not-set",
-        dataUrl: "_cocoon/forms/suggest",
+        dataUrl: "_cocoon/forms/suggest", // url relative to this page
         styleClass: "",
         popupUri: "",
         popupSize: "",

Added: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/NavGroup.js
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/NavGroup.js?rev=694387&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/NavGroup.js (added)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/NavGroup.js Thu Sep 11 10:55:16 2008
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+dojo.provide("cocoon.forms.NavGroup");
+
+dojo.require("dijit.layout.StackContainer");
+dojo.require("cocoon.forms._GroupMixin");
+
+/**
+ * CForms NavGroup Widget.
+ * A set of panes that are switched between using a custom controller        
+ *
+ * eg: <fi:group id"someNavGroup">
+ *         <fi:styling type="nav" . . . />
+ *
+ * NB. The id attribute is required
+ * 
+ * Use this when you want to make your own custom controller, which may be anywhere in the template
+ * For an example see: src/blocks/forms/samples/forms/group_styles_template.xml
+ *
+ * NOTE: introduced in 2.1.12
+ *
+ * @version $Id$
+ */
+dojo.declare("cocoon.forms.NavGroup", [dijit.layout.StackContainer, cocoon.forms._GroupMixin], {	
+
+  // the controller to use
+	_controllerWidget: "dijit.layout.NavController",
+  
+  // use my buttons for the statusWidget
+  getStatusWidget: function() {
+    return this.controlButton ? this.controlButton : this;
+  }
+});
+
+/**
+ * CForms NavController Widget.
+ * A container of buttons, one for each page
+ * NB. Must be placed (and can be customised) by the User, in their own template
+ *
+ * NOTE: introduced in 2.1.12
+ */
+dojo.declare("cocoon.forms.NavController", [dijit.layout.StackController], {
+  
+  //	The name of the tab widget to create to correspond to each page
+	buttonWidget: "cocoon.forms._NavButton" 	
+
+});
+
+/**
+ * CForms _NavButton Widget.
+ * A dijit.layout._StackButton that shows a status mark
+ *
+ * NOTE: introduced in 2.1.12
+ */
+dojo.declare("cocoon.forms._NavButton", [dijit.layout._StackButton], {
+
+  // copy of the dijit.form.Button template, adding statusMarker
+	templateString:"<div class=\"dijit dijitReset dijitLeft dijitInline\"\n\tdojoAttachEvent=\"onclick:_onButtonClick,onmouseenter:_onMouse,onmouseleave:_onMouse,onmousedown:_onMouse\"\n\twaiRole=\"presentation\"\n\t><button class=\"dijitReset dijitStretch dijitButtonNode dijitButtonContents\" dojoAttachPoint=\"focusNode,titleNode,statusNode\"\n\t\ttype=\"${type}\" waiRole=\"button\" waiState=\"labelledby-${id}_label\"\n\t\t><span class=\"dijitReset dijitValidationIconText\">${_cforms_statusMarker}</span><span class=\"dijitReset dijitInline ${iconClass}\" dojoAttachPoint=\"iconNode\" \n \t\t\t><span class=\"dijitReset dijitToggleButtonIconChar\">&#10003;</span \n\t\t></span\n\t\t><div class=\"dijitReset dijitInline\"><center class=\"dijitReset dijitButtonText\" id=\"${id}_label\" dojoAttachPoint=\"containerNode\">${label}</center></div\n\t></button\n></div>\n",
+
+  // get my status marker
+  postMixInProperties: function() {
+    this._cforms_statusMarker = cocoon.forms.defaults.statusMark;
+    this.inherited(arguments); 
+  },
+
+});

Propchange: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/NavGroup.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/NumberField.js
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/NumberField.js?rev=694387&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/NumberField.js (added)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/NumberField.js Thu Sep 11 10:55:16 2008
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+dojo.provide("cocoon.forms.NumberField");
+
+dojo.require("dijit.form.NumberTextBox");
+dojo.require("cocoon.forms.common");
+dojo.require("cocoon.forms._FieldMixin");
+
+/**
+ * CForms NumberField Widget.
+ * A field that validate numbers in different locales        
+ *
+ * eg: <fd:field id="myNumber">
+ *       <fd:datatype base=" . . . " . . . />
+ *         <fd:convertor type=" . . . " variant=" . . . " . . . />
+ *
+ * This behaves a bit differently to dojo's version :
+ *
+ *   dojo:
+ *     receive the string primitive of the number 
+ *     display it using the specified constraints, or locale
+ *     validate it using specified constraints
+ *     send back the primitive string version
+ *     
+ *   cforms:
+ *     change: receive the preformatted string
+ *     add:    set the preformatted value on the display field
+ *     same:   display it using the specified constraints and locale
+ *     same:   validate it using the specified constraints and locale
+ *     change: send back the formatted verion
+ *
+ * NOTE: introduced in 2.1.12
+ *
+ * @version $Id$
+ */
+dojo.declare("cocoon.forms.NumberField", [dijit.form.NumberTextBox, cocoon.forms._FormattingFieldMixin, cocoon.forms._SizedFieldMixin], {	
+
+  value: "", // override dojo's behaviour of not showing invalid numbers at start
+  valueType: "number", // integer|long|float|double|number|percent 
+
+  // adding a place for the status marker to dijit.form.ValidationTextBox's template
+  templateString:"<div class=\"dijit dijitReset dijitInlineTable dijitLeft\"\n\tid=\"widget_${id}\"\n\tdojoAttachEvent=\"onmouseenter:_onMouse,onmouseleave:_onMouse,onmousedown:_onMouse\" waiRole=\"presentation\"\n\t><div style=\"overflow:hidden;\"\n\t\t><div class=\"dijitReset dijitValidationIcon\"><br></div\n\t\t><div class=\"dijitReset dijitValidationIconText\">${_cforms_statusMarker}</div\n\t\t><div class=\"dijitReset dijitInputField\"\n\t\t\t><input class=\"dijitReset\" dojoAttachPoint='textbox,focusNode' dojoAttachEvent='onfocus:_update,onkeyup:_onkeyup,onblur:_onMouse,onkeypress:_onKeyPress' autocomplete=\"off\"\n\t\t\ttype='${type}' name='${name}'\n\t\t/></div\n\t></div\n></div>\n",
+  
+  // TODO: don't clear invalid entries ???
+  
+  // Widget interface
+  postMixInProperties: function() {
+    // get the default validation rules for the valueType
+    var defaults = cocoon.forms.defaults.constraints[this.valueType] || { pattern: "#.######", type: "number" };
+    // mixin the validation rules from cforms
+    this.constraints = dojo.mixin(dojo.mixin({}, defaults), this.constraints);
+    if (this.constraints.locale) this.lang = this.constraints.locale;
+    this.inherited(arguments);
+  }
+
+});
+

Propchange: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/NumberField.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/Repeater.js
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/Repeater.js?rev=694387&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/Repeater.js (added)
+++ cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/Repeater.js Thu Sep 11 10:55:16 2008
@@ -0,0 +1,359 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+dojo.provide("cocoon.forms.Repeater");
+dojo.require("dijit._Widget");
+dojo.require("dojo.dnd.Manager");
+
+/**
+ * CForms Repeater Widget.
+ * A versatile repeater, configured from the CForms model and template
+ * A range of different behaviours are exhibited depending on the configuration
+ * Includes drag and drop but this is only loaded if needed
+ *
+ * uses dojo.dnd.Container if you only need row highlighing
+ * uses dojo.dnd.Selector if you need rows to be selectable
+ * uses dojo.dnd.Target or dojo.dnd.Source if you need drag and drop behaviour
+ *
+ * The types that may be dragged onto a Repeater is ultimately enforced by the CForms model
+ * along with what kind of copy versus move behaviour is allowed
+ *
+ * TODO: To support file fields in Repeaters (usecase: queueing an unknown quantity of uploads), 
+ *       we need a way to optionally stop a full field submit when repeater and row-actions are called.
+ *       Can we add a row without replacing the Repeater (???)
+ *       Currently BU only does replace, but could do more (???)
+ * TODO: Disallow drags of rows containing inValid fields, to another Repeater (???)
+ *
+ * NOTE: introduced in 2.1.12, replacing: CFormsRepeater and CFormsDragAndDropRepeater
+ *
+ * @version $Id$
+ */
+dojo.declare("cocoon.forms.Repeater", dijit._Widget, {
+
+  // Properties that can be set from the widget's attributes
+  orderable   : false,   // use orderable to turn internal dnd behaviour on and off
+  handleClass : "",      // the user-specified css class marking row drag handles (if empty, use the whole row)
+  select      : "",      // the name of the optional select control
+  singular    : false,   // should it be possible to select/dnd more than one row at a time?
+  horizontal  : false,   // should we try to render the rows horizontally?
+  skipForm    : true,    // do not dnd on form fields
+  acceptType  : [],      // the type(s) I accept - used to allow dragging in
+  rowType     : "",      // the type(s) I contain - used to allow dragging out
+  dndAction   : "",      // custom dnd handler in form model
+  dndAllow    : ["any"], // control whether to allow copy and/or move based on meta key
+  id          : "",      // the cforms id of the widget
+
+  /** 
+   * Widget interface
+   * Initialise instance variables
+   */ 
+  constructor: function() {
+    this.subscriptions = []; // keep track of my subscriptions for disposal
+  },
+  
+  /** 
+   * Widget interface
+   * Prepare some configuration parameters
+   */ 
+  postMixInProperties: function() {
+    this.inherited(arguments); // call my super class
+    this.dndAction = this.dndAction ? this.dndAction : this.id; // the action to call on the server, default: this repeater's id
+    if (this.dndAllow.length === 0) this.dndAllow = ["any"];
+    this.ignoreMeta = this.dndAllow[0] !== "any";
+    this.ignoreMetaTo = this.dndAllow[1] ? this.dndAllow[1] !== "any" : this.ignoreMeta;
+    this.copyOrMove = this.dndAllow[0] === "copy";
+    this.copyOrMoveTo = this.dndAllow[1] ? this.dndAllow[1] === "copy" : this.copyOrMove;
+  },
+  
+  /** 
+   * Widget interface
+   * Choose what type of container to make depending on input parameters
+   * Go through finding all dragable children, prepare them for dnd constructor
+   */ 
+  buildRendering: function(){   
+    this.inherited(arguments); // call my super class
+    if(!this.containerNode) this.containerNode = this.domNode; // make getDescendants() work for proper disposal of child widgets
+    var row, widgetNode, rows = [], firstRow = dojo.byId(this.id + ".0");
+    if (firstRow) { // there is row markup in this Repeater
+      widgetNode = firstRow.parentNode; // get the parent node to add the dnd container to
+      for (var i = 0; row = dojo.byId(this.id + "." + i); i++) rows.push(row); // build nodelist of RepeaterRows
+    } else { // there are no Rows to find the parent Widget from
+      var widgetNode = this.domNode.firstChild; // find the first child element of this domNode
+      while(widgetNode && widgetNode.nodeType !== 1 /*ELEMENT_NODE*/) widgetNode = widgetNode.nextSibling;
+      if (!widgetNode) widgetNode = this.domNode; // resort to using this domNode div
+    }
+    var params = { // parameters to construct our dnd container
+      withHandles: this.handleClass !== "" && (this.orderable || this.rowType !== ""), // do we have select/drag handles?
+      skipForm: this.skipForm, // should the user be able to drag having clicked in a form field?
+      accept: this.acceptType.length > 0 ? this.acceptType : ["id_" + this.id], // the type(s) you can drop on me
+      horizontal: this.horizontal, // should I be drawn horizontally (divs only)
+      singular: this.singular, // should the user be able to drag more than one row at a time?
+      isSource: true, // don't let this be overriden by the user
+      creator: dojo.hitch(this, this.creator) // cforms needs a custom row creator
+    };
+    dojo.forEach(rows, function(node) { // decorate the RepeaterRows
+      dojo.addClass(node, "dojoDndItem"); // used by the DND Constructor to find rows
+      var type = this.rowType ? this.rowType : "id_" + this.id; // default: 'id_[widget ID]'
+      node.setAttribute("dndType", type); // mark the rows with their type for the DND constructor
+      dojo.addClass(node, type.split(/\s*,\s*/).join(' ')); // add type(s) as CSS classes
+      if (params.withHandles) {
+        dojo.forEach(dojo.query("." + this.handleClass, row), function(handle) { // mark the handles for the DND constructor
+          dojo.addClass(handle, "dojoDndHandle"); // you could put more than one handle on a row
+        });
+      }
+    }, this); // the context for dojo.forEach
+    // decide which type of dojo.dnd Object we need to instantiate
+    if (!this.orderable && this.select === "" && this.acceptType.length === 0 && this.rowType === "") {
+      dojo.require("dojo.dnd.Container"); // lazy load
+      this.container = new dojo.dnd.Container(widgetNode, params); // a container that just highlights rows as you mouse over them
+    } else if (!this.orderable && this.select !== "" && this.acceptType.length === 0 && this.rowType === "") {
+      dojo.require("dojo.dnd.Selector"); // lazy load
+      this.container = new dojo.dnd.Selector(widgetNode, params); // a container that allows rows to be selected by clicking on them
+    } else if (!this.orderable && this.acceptType.length > 0 && this.rowType === "") {
+      dojo.require("dojo.dnd.Source"); // lazy load
+      this.subscriptions.push(dojo.subscribe("/dnd/drop", this, "onDndDrop")); // we must be setup before construction (so we get called first)
+      this.container = new dojo.dnd.Target(widgetNode, params); // a container you can drop rows onto
+    } else {
+      dojo.require("dojo.dnd.Source"); // lazy load
+      this.subscriptions.push(dojo.subscribe("/dnd/drop", this, "onDndDrop")); // we must be setup before construction (so we get called first)
+      this.container = new dojo.dnd.Source(widgetNode, params); // a container you can dnd rows to and from
+    }
+    if (this.container.checkAcceptance) { // monkey-patch dojo.dnd.Source to handle extra cforms features
+      this.container._cforms_originalCheckAcceptance = this.container.checkAcceptance; // preserve the old function
+      this.container.checkAcceptance = dojo.hitch(this, this.checkAcceptance); // give the container our checkAcceptance function
+      this.container.copyState = dojo.hitch(this, this.copyState); // give the container our copyState function
+    }
+  },
+  
+  /** 
+   * Widget interface
+   * Wire up the rows to their select controls
+   */ 
+  startup: function() {
+    this.inherited(arguments); // call my super class
+    if (this.select !== "") { // set selection state on pre-selected Items
+      var suffix = "." + this.select + ":input";
+      dojo.forEach(this.container.getAllNodes(), function(row) {
+        var widget = dijit.byId(row.id + suffix); // get the select widget
+        if (widget) {
+          if (widget.checked) this.selectRow(row); // set selection state of row if select is checked
+          widget.onChange = dojo.hitch(this, function(newValue) {newValue ? this.selectRow(row) : this.deSelectRow(row); return true;});
+        }
+      }, this);
+      // setup listeners for synchronising select events with the select fields
+      this.connect(this.container, "_addItemClass", "checkRowSelect");
+      this.connect(this.container, "_removeItemClass", "uncheckRowSelect");
+    }
+  },
+  
+  /** 
+   * Widget interface
+   * Clean up on unload
+   */ 
+  destroy: function() {
+    this.inherited(arguments);
+    dojo.forEach(this.connections, dojo.disconnect); // disconnect event listeners
+    dojo.forEach(this.subscriptions, dojo.unsubscribe); // unsubscribe from event subscriptions 
+    if (this.container) this.container.destroy(); // destroy my dnd container and it's child widgets
+    this.container = null;
+  },
+  
+  /** 
+   * dojo.dnd.Source interface
+   * Subscription Event Handler for '/dnd/drop'
+   * Row(s) are being dropped on me, it has already been checked that this is allowed
+   * Send request parameters to the server to say what has changed
+   * NB. This must be called before the before the handler in the Container
+   *     This event is called on every Repeater in the form, in the order they subscribe
+   */ 
+  onDndDrop: function(source, nodes, copy) {
+    if(this.container.containerState !== "Over") return; // only the container being dropped on should run onDndDrop
+    var beforeIdx = 0, fromIdxs = [], i = 0, params = {};
+    if (this.container.targetAnchor) { // get the index of the row in the target to drop before
+      beforeIdx = this.container.targetAnchor.id.substring(this.container.targetAnchor.id.lastIndexOf(".") +1);
+      if (isNaN(beforeIdx)) beforeIdx = 0;
+    }
+    if (!this.container.before) beforeIdx++; // dojo has 'before' and 'after' states, cforms only uses 'before'
+    for (var key in source.selection) { // get the indexes of all of the rows being dragged
+      var idx = key.substring(key.lastIndexOf(".") +1);
+      if (!isNaN(idx)) fromIdxs[i++] = idx; // there will not be a numerical index on dummy rows in empty drop targets
+    }
+    if (fromIdxs.length < 1) return; // no change
+    params["dndTarget.id"] = this.id; // the ID of the target repeater (needed by fd:action handlers)
+    params[this.id + ".before"] = beforeIdx; // items should be inserted before this index
+    params[this.id + ".action"] = copy ? "copy" : "move"; // the command to copy or move the rows
+    if (this.container === source) { // internal operation (legacy parameters)
+      params[this.id + ".from"] = fromIdxs; // the index(es) of the row(s) to move or copy
+    } else { // between two Repeaters (legacy parameters)
+      params[this.id + ".sourceRepeaterId"] = dijit.getEnclosingWidget(nodes[0]).id; // the ID of the source repeater
+      params[this.id + ".sourceRepeaterIndex"] = fromIdxs; // the index(es) of the row(s) to move or copy
+    }
+    cocoon.forms.submitForm(this.domNode, this.dndAction, params); // submit the form
+    if (!copy) { // if this is a move, destroy the child widgets
+      dojo.forEach(nodes, function(item){
+        var list= dojo.query('[widgetId]', item);
+		    dojo.forEach(list.map(dijit.byNode), function(widget){ widget.destroy(); });
+      }, this);
+    }
+    
+  },
+  
+  /**
+   * dojo.dnd.Container interface
+   * Custom Row Creator, called by dojo.dnd.Container._normalizedCreator
+   * @param node String the innerHTML of the row being dragged (which is not great, as it shows the contents of help etc.)
+   * @param hint boolean if true, then an avatar is being made
+   * 
+   * The problem being solved here is this :
+   * The built-in creator deep-clones rows from the Source to the Target Repeater.
+   * When the Target Repeater is replaced via BrowserUpdate, we have to recursively destroy it and it's child widgets.
+   * This also destroys the widgets in the Source Row that these were cloned from.
+   * So instead, as the Target is about to be replaced via XHR, just put a placeholder in there.
+   */
+  creator: function(node, hint) {
+    var containerType = this.container.parent.tagName.toLowerCase();
+    if (containerType === "tbody" || containerType === "table") {
+      var n = dojo.dnd._createTrTd("&#160;");
+      dojo.addClass(n, "dijitTreeExpandoLoading"); // animated loading icon
+      return {node: n}; // put a placeholder row in the Target table
+    } else { // the Target is a div etc.
+      var n = dojo.dnd._createNode(dojo.dnd._defaultCreatorNodes[containerType])("&#160;");
+      dojo.addClass(n, "dijitTreeExpandoLoading");
+      return {node: n};// put an appropriately wrapped placeholder in the Target
+    }
+  },
+  
+  /**
+   * dojo.dnd.Source interface
+   * Check the acceptance of a row dragged over this container
+   * This is monkey-patched into this.container to add support for @orderable
+   * @orderable controls dnd behaviour within a single repeater
+   */
+  checkAcceptance: function(source, nodes) {
+    if (this.container === source) {
+      if (!this.orderable) return false; 
+    } else {
+      if (!this.container._cforms_originalCheckAcceptance(source, nodes)) return false;
+    }
+    return true;
+  },
+  
+  /**
+   * dojo.dnd.Source interface
+   * Returns true, if we may copy items, false to move
+   * This is monkey-patched into this.container to add support for @dndAllow
+   * This is called every time the mouse moves while dragging
+   */
+  copyState: function(keyPressed) { // adding support for @dndAllow
+    if (this.container.containerState === "Over") { // are we over this Source?        
+      if (this.ignoreMeta) return this.copyOrMove;
+    } else { // we may be dragging between containers
+      if (this.ignoreMetaTo) return this.copyOrMoveTo;
+    }
+    return keyPressed;
+  },
+  
+  /**
+   * Event Handlers to keep the select Widget and row selection state in sync
+   *
+   * NB. There is no proper API for this in dojo.dnd
+   * TODO: This code is not entirely Saneª
+   */
+  
+  /**
+    * onChange handler for row select control
+    * Deselect the row
+    */
+  deSelectRow:function(row) {
+    if (this.container.selection[row.id]) { 
+      if (this.container.anchor === row) {
+        this.container._removeAnchor();
+      } else {
+        dojo.removeClass(row, "dojoDndItemSelected");
+      }
+      delete this.container.selection[row.id];
+    }
+  },
+  
+  /**
+    * Listener for container._removeItemClass 
+    * Update select when row de-selected
+    */
+  uncheckRowSelect: function(row, type) {
+    if (type === "Selected" || type === "Anchor") { 
+      var widget = dijit.byId(row.id + "." + this.select + ":input");
+      if (widget && widget.checked === true) {
+        widget.setValue(false); 
+      }
+    }
+  },
+
+  /**
+    * onChange handler for row select control
+    * Select the row
+    */
+  selectRow: function(row) {
+    if (!this.container.selection[row.id]) { 
+      if (!this.container.anchor){
+        this.container.anchor = row;
+        dojo.removeClass(row, "dojoDndItemSelected");
+        dojo.addClass(row, "dojoDndItemAnchor");
+      } else if (this.container.anchor !== row){
+        dojo.removeClass(row, "dojoDndItemAnchor");
+        dojo.addClass(row, "dojoDndItemSelected");
+      }
+      this.container.selection[row.id] = 1;
+    }
+  },
+  
+  /**
+    * Listener for container._addItemClass 
+    * Update select when row selected
+    */
+  checkRowSelect: function(row, type) { 
+    if (type === "Selected" || type === "Anchor") {
+      // find the row's select
+      var widget = dijit.byId(row.id + "." + this.select + ":input");
+      if (widget && widget.checked === false) {
+        widget.setValue(true); 
+       }
+    }
+  }
+
+});
+
+/**
+ * CForms Repeater DND Avatar Widget.
+ * Extend the construct function, so that the built-in row creator is used for making our Avatar
+ * Not the custom creator we supplied.
+ * Due to issues with the DND api, a custom creator cannot make a decent avatar out of a row containing widgets
+ *
+ * NOTE: introduced in 2.1.12
+ */
+dojo.declare("cocoon.forms.Avatar", dojo.dnd.Avatar, {
+  construct: function() {
+    var creator = this.manager.source.creator;
+    this.manager.source.creator = null; // temporarily hide our creator, so the built-in one is used for Avatars
+    this.inherited(arguments);
+    this.manager.source.creator = creator;
+  }
+});
+
+dojo.extend(dojo.dnd.Manager, {
+  makeAvatar: function() {
+    return new cocoon.forms.Avatar(this);
+  }
+});
\ No newline at end of file

Propchange: cocoon/branches/BRANCH_2_1_X-dojo1_1/src/blocks/forms/resources/org/apache/cocoon/forms/resources/js/Repeater.js
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message