cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fel...@apache.org
Subject svn commit: r680303 - in /cocoon/trunk/blocks/cocoon-forms: cocoon-forms-impl/src/changes/ cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/ cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/img/ cocoon-forms-...
Date Mon, 28 Jul 2008 10:00:37 GMT
Author: felixk
Date: Mon Jul 28 03:00:34 2008
New Revision: 680303

URL: http://svn.apache.org/viewvc?rev=680303&view=rev
Log:
<action dev="felixk" type="fix" fixes-bug="COCOON-1822" due-to="Karen Torres &amp;
Rafael Márquez" due-to-email="ktorres@agssa.net &amp; rmarquez@agssa.net">
        Forms: MultiValueField list-type="double-listbox" does not work correctly in ajax
enabled forms.
</action>

Added:
    cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/img/move_all_left.gif
  (with props)
    cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/img/move_all_right.gif
  (with props)
    cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/img/move_left.gif
  (with props)
    cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/img/move_right.gif
  (with props)
    cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/MultiValueDoubleList.js
  (with props)
    cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/templates/MultiValueDoubleList.html
  (with props)
    cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/forms/multiValueDoubleList.xml
  (with props)
    cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/forms/multiValueDoubleList_template.xml
  (with props)
Modified:
    cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/changes/changes.xml
    cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/forms-advanced-field-styling.xsl
    cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/__package__.js
    cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/manifest.js
    cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/flow/forms_flow_example.js
    cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/welcome.xml

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/changes/changes.xml?rev=680303&r1=680302&r2=680303&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/changes/changes.xml (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/changes/changes.xml Mon Jul 28
03:00:34 2008
@@ -25,6 +25,9 @@
 <document>
   <body>
     <release version="1.1.1" date="TBD" description="unreleased">
+      <action dev="felixk" type="fix" fixes-bug="COCOON-1822" due-to="Karen Torres &amp;
Rafael Márquez" due-to-email="ktorres@agssa.net &amp; rmarquez@agssa.net">
+        Forms: MultiValueField list-type="double-listbox" does not work correctly in ajax
enabled forms.
+      </action>
       <action dev="joerg" type="fix" fixes-bug="COCOON-1825" due-to="Vincent Demay" due-to-email="vincent@demay-fr.net">
         Fix @id handling on fi:group/fi:struct element in conjunction with AJAX requests.
       </action>

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/forms-advanced-field-styling.xsl
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/forms-advanced-field-styling.xsl?rev=680303&r1=680302&r2=680303&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/forms-advanced-field-styling.xsl
(original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/forms-advanced-field-styling.xsl
Mon Jul 28 03:00:34 2008
@@ -185,6 +185,69 @@
 
   <xsl:template match="fi:multivaluefield/fi:styling[@list-type='double-listbox']/@submit-on-change"
mode="styling"/>
 
+   <!--+
+      | fi:multivaluefield with list-type='dojo-double-listbox' styling
+      +-->
+  <xsl:template
+      match="fi:multivaluefield[fi:styling/@list-type='dojo-double-listbox']">
+      <xsl:variable name="id" select="@id"/>
+      <xsl:variable name="values" select="fi:values/fi:value/text()"/>
+      <div id="{@id}" class="forms-doubleList forms doubleList"
+          title="{fi:hint}">
+          <table>
+              <tr>
+                  <td>
+                      <div dojoType="forms:MultiValueDoubleList" styleClass="multivalue-widget"
id="{$id}:widget" cformsIdPrefix="{$id}"
+                          availableListLabel="{fi:styling/fi:available-label}" selectedListLabel="{fi:styling/fi:selected-label}"
+                          size="{fi:styling/@size}">
+                          <!-- Data is supplied to the widget using this table-->
+                          <table>
+                              <tbody>
+                                  <!-- select for the available values-->
+                                  <xsl:for-each select="fi:selection-list/fi:item">
+                                      <xsl:variable name="value" select="@value"/>
+                                      <xsl:if test="not($values[. = $value])">
+                                          <tr>
+                                              <td>
+                                                  <xsl:value-of select="$value"/>
+                                              </td>
+                                              <td>
+                                                  <xsl:copy-of select="fi:label/node()"/>
+                                              </td>
+                                          </tr>
+                                      </xsl:if>
+                                  </xsl:for-each>
+                              </tbody>
+                          </table>
+                          <table>
+                              <tbody>
+                                  <!-- select for the selected values -->
+                                  <xsl:for-each select="fi:selection-list/fi:item">
+                                      <xsl:variable name="value" select="@value"/>
+                                      <xsl:if test="$values[. = $value]">
+                                          <tr>
+                                              <td>
+                                                  <xsl:value-of select="$value"/>
+                                              </td>
+                                              <td>
+                                                  <xsl:copy-of select="fi:label/node()"/>
+                                              </td>
+                                          </tr>
+                                      </xsl:if>
+                                  </xsl:for-each>
+                              </tbody>
+                          </table>
+                      </div>
+                  </td>
+                  <td>
+                      <xsl:apply-templates select="." mode="common"/>
+                  </td>
+              </tr>
+          </table>
+      </div>
+      <xsl:apply-templates select="." mode="label-ajax-request"/>
+  </xsl:template>
+
   <!--+
       | fi:multivaluefield without a selection list
       +-->

Added: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/img/move_all_left.gif
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/img/move_all_left.gif?rev=680303&view=auto
==============================================================================
Binary file - no diff available.

Propchange: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/img/move_all_left.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/img/move_all_right.gif
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/img/move_all_right.gif?rev=680303&view=auto
==============================================================================
Binary file - no diff available.

Propchange: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/img/move_all_right.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/img/move_left.gif
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/img/move_left.gif?rev=680303&view=auto
==============================================================================
Binary file - no diff available.

Propchange: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/img/move_left.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/img/move_right.gif
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/img/move_right.gif?rev=680303&view=auto
==============================================================================
Binary file - no diff available.

Propchange: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/img/move_right.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/MultiValueDoubleList.js
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/MultiValueDoubleList.js?rev=680303&view=auto
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/MultiValueDoubleList.js
(added)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/MultiValueDoubleList.js
Mon Jul 28 03:00:34 2008
@@ -0,0 +1,349 @@
+/*
+ * 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.require("dojo.widget.HtmlWidget");
+dojo.provide("cocoon.forms.MultiValueDoubleList");
+
+/**
+ * A free-entry multivalue field editor style double list.
+ *
+ * Some functionality that's not visible at first sight:
+ *  - 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
+ */
+dojo.widget.defineWidget(
+    // widget name and class
+    "cocoon.forms.MultiValueDoubleList",
+
+    // superclass
+    dojo.widget.HtmlWidget,
+
+    function() {
+    },
+    // properties and methods
+   {
+        isContainer: false,
+
+        cformsIdPrefix: "id-prefix-not-set",
+        resourcesUri: cocoon.formsResourcesUri,
+        templatePath: cocoon.formsResourcesUri + "/js/templates/MultiValueDoubleList.html",
+
+        availableListLabel : "Available",
+        selectedListLabel : "Selected",
+        size: "5",
+        styleClass : "",
+
+        fillInTemplate: function(args, frag) {
+            cocoon.forms.MultiValueDoubleList.superclass.fillInTemplate(this, args, frag);
+            // Available list options.
+            this.selectLeft.addOption = function(value, text) {
+                var alreadyInList = false;
+                for (var i = 0; this.options.length > i && !alreadyInList; i++)
{
+                    if (this.options[i].value == value) {
+                        alreadyInList = true;
+                    }
+                }
+
+                if (!alreadyInList) {
+                    this.options[this.options.length] = new Option(text, value);
+                }
+            }
+            // Selected list options.
+            this.selectRight.addOption = function(value, text) {
+                var alreadyInList = false;
+                for (var i = 0; this.options.length > i && !alreadyInList; i++)
{
+                    if (this.options[i].value == value) {
+                        alreadyInList = true;
+                    }
+                }
+
+                if (!alreadyInList) {
+                    this.options[this.options.length] = new Option(text, value);
+                }
+            }
+
+            dojo.event.connect(this.selectRight, "ondblclick", this, "_transferLeft");
+            dojo.event.connect(this.transferRight, "onclick", this, "_transferRight");
+            dojo.event.connect(this.selectLeft, "ondblclick", this, "_transferRight");
+            dojo.event.connect(this.transferAllRight, "onclick", this, "_transferAllRight");
+            dojo.event.connect(this.transferLeft, "onclick", this, "_transferLeft");
+            dojo.event.connect(this.transferAllLeft, "onclick", this, "_transferAllLeft");
+
+            dojo.event.connect(this, "addedTo", this, "_addOnSubmitHandler");
+            this._readData(this.getFragNodeRef(frag));
+
+        },
+
+        _addOnSubmitHandler: function(parent) {
+            var form = this._getForm(this);
+            if (form != null) {
+                dojo.event.connect("before", form,"onsubmit", this, "_selectAll");
+            } else {
+                dojo.debug("MultiValueDoubleList is not being added to a form -- no onSubmitHandler
then.");
+            }
+        },
+
+        /**
+         * Finds the HTML form to which a widget belongs.
+         * The widget is passed as an argument since this might become a generic
+         * utility function outside of this wiget.
+         */
+        _getForm: function(widget) {
+            do {
+                if (widget.domNode != null && widget.domNode.tagName != null &&
widget.domNode.tagName.toLowerCase() == "form") {
+                    return widget.domNode;
+                }
+                widget = widget.parent;
+            } while (widget != null)
+            return null;
+        },
+
+        _readData: function(origFrag) {
+            // Read data from available list options.
+            var table = dojo.dom.getFirstChildElement(origFrag, "table");
+            if (table != null) {
+                var tbody = dojo.dom.firstElement(table, "tbody");
+                if (tbody != null) {
+                    var tr = dojo.dom.firstElement(tbody, "tr");
+                    while (tr != null) {
+                        var td = dojo.dom.firstElement(tr, "td");
+                        var value = td != null ? dojo.dom.textContent(td) : null;
+                        var text = td.nextSibling != null ? dojo.dom.textContent(td.nextSibling)
: value;
+
+                        if (value && text) {
+                            this.selectLeft.addOption(value, text);
+                        }
+                        tr = dojo.dom.nextElement(tr, "tr");
+                    }
+                }
+                // Read data from selected list options.
+                var table1 = dojo.dom.getNextSiblingElement(table, "table");
+                if (table1 != null) {
+                    var tbody1 = dojo.dom.firstElement(table1, "tbody");
+                    if (tbody1 != null) {
+                        var tr1 = dojo.dom.firstElement(tbody1, "tr");
+                        while (tr1 != null) {
+                            var td1 = dojo.dom.firstElement(tr1, "td");
+                            var value1 = td1 != null ? dojo.dom.textContent(td1) : null;
+                            var text1 = td1.nextSibling != null ? dojo.dom.textContent(td1.nextSibling)
: value1;
+
+                            if (value1 && text1) {
+                                this.selectRight.addOption(value1, text1);
+                            }
+                            tr1 = dojo.dom.nextElement(tr1, "tr");
+                        }
+                    }
+                }
+            } else {
+                dojo.debug("MultiValueDoubleList: no data table found");
+            }
+        },
+
+        _selectAll: function() {
+            this._selectAllOptions(this.selectRight);
+        },
+
+        _transferLeft: function (event) {
+            dojo.event.browser.stopEvent(event);
+            this._moveSelectedOptions(this.selectRight, this.selectLeft);
+            this._update();
+        },
+
+        _transferRight: function (event) {
+            dojo.event.browser.stopEvent(event);
+            this._moveSelectedOptions(this.selectLeft, this.selectRight);
+            this._update();
+        },
+
+        _transferAllLeft: function (event) {
+            dojo.event.browser.stopEvent(event);
+            this._moveAllOptions(this.selectRight, this.selectLeft);
+            this._update();
+        },
+
+        _transferAllRight: function (event) {
+            dojo.event.browser.stopEvent(event);
+            this._moveAllOptions(this.selectLeft, this.selectRight);
+            this._update();
+        },
+
+        _update: function() {
+            var removedLeft = new Object();
+            var removedRight = new Object();
+            var addedLeft = new Object();
+            var addedRight = new Object();
+            var newLeft = new Object();
+            var newRight = new Object();
+            var originalLeftValues = new Object();
+            var originalRightValues = new Object();
+            var delimiter = ",";
+            var right = this.selectRight;
+            var left = this.selectLeft;
+            var removedLeftField = null;
+            var removedRightField = null;
+            var addedLeftField = null;
+            var addedRightField = null;
+            var newLeftField = null;
+            var newRightField = null;
+            for (var i = 0; i < left.options.length; i++) {
+                var o = left.options[i];
+                newLeft[o.value] = 1;
+                if (typeof(originalLeftValues[o.value]) == "undefined") {
+                    addedLeft[o.value] = 1;
+                    removedRight[o.value] = 1;
+                    }
+                }
+            for (var i = 0; i < right.options.length; i++) {
+                var o = right.options[i];
+                newRight[o.value] = 1;
+                if (typeof(originalRightValues[o.value]) == "undefined") {
+                    addedRight[o.value] = 1;
+                    removedLeft[o.value] = 1;
+                    }
+                }
+            if (removedLeftField != null) {
+                removedLeftField.value = this._join(removedLeft, delimiter);
+            }
+            if (removedRightField != null) {
+                removedRightField.value = this._join(removedRight, delimiter);
+            }
+            if (addedLeftField != null) {
+                addedLeftField.value = this._join(addedLeft, delimiter);
+            }
+            if (addedRightField != null) {
+                addedRightField.value = this._join(addedRight, delimiter);
+            }
+            if (newLeftField != null) {
+                newLeftField.value = this._join(newLeft, delimiter);
+            }
+            if (newRightField != null) {
+                newRightField.value = this._join(newRight, delimiter);
+            }
+        },
+
+        _moveSelectedOptions: function (from, to) {
+            if (arguments.length > 3) {
+                var regex = arguments[3];
+                if(regex != "") {
+                    this._unSelectMatchingOptions(from,regex);
+                }
+            }
+            for(var i = 0; i < from.options.length; i++) {
+                var o = from.options[i];
+                if(o.selected) {
+                    to.options[to.options.length] = new Option( o.text, o.value, true, o.selected);
+                }
+            }
+            for (var i = (from.options.length-1); i >= 0; i--) {
+                var o = from.options[i];
+                if(o.selected) {
+                    from.options[i] = null;
+                }
+            }
+            if ((arguments.length < 3) || (arguments[2] == true)) {
+                this._sortSelect(from);
+                this._sortSelect(to);
+            }
+            from.selectedIndex = -1;
+            to.selectedIndex = -1;
+        },
+
+        _moveAllOptions: function (from, to) {
+            this._selectAllOptions(from);
+            if(arguments.length == 2) {
+                this._moveSelectedOptions(from, to);
+            } else if(arguments.length == 3) {
+                this._moveSelectedOptions(from, to, arguments[2]);
+            } else if(arguments.length == 4) {
+                this._moveSelectedOptions(from, to, arguments[2], arguments[3]);
+            }
+        },
+
+        _selectAllOptions: function (obj) {
+            for(var i = 0; i < obj.options.length; i++) {
+                obj.options[i].selected = true;
+            }
+        },
+
+        _unSelectMatchingOptions: function (obj, regex) {
+            this._selectUnselectMatchingOptions(obj, regex, "unselect", false);
+        },
+
+        _selectUnselectMatchingOptions: function(obj, regex, which, only) {
+            if (window.RegExp) {
+                var selected1;
+                var selected2;
+                if(which == "select"){
+                    selected1 = true;
+                    selected2 = false;
+                } else if (which == "unselect") {
+                    selected1 = false;
+                    selected2 = true;
+                } else {
+                      return;
+                }
+                var re = new RegExp(regex);
+                for (var i = 0;i < obj.options.length; i++) {
+                    if(re.test(obj.options[i].text)) {
+                        obj.options[i].selected = selected1;
+                } else {
+                    if(only == true) {
+                        obj.options[i].selected = selected2;
+                    }
+                }
+              }
+           }
+        },
+
+        _join: function(o, delimiter) {
+            var val;
+            var str="";
+            for(val in o) {
+                if (str.length > 0) {
+                    str = str + delimiter;
+                }
+                str = str + val;
+            }
+            return str;
+        },
+
+        _sortSelect: function(obj) {
+            var o = new Array();
+            if(obj.options == null) {
+                return;
+            }
+            for(var i = 0; i < obj.options.length; i++) {
+                o[o.length] = new Option( obj.options[i].text, obj.options[i].value, obj.options[i].defaultSelected,
obj.options[i].selected) ;
+             }
+             if (o.length == 0) {
+                 return;
+             }
+             o = o.sort( function(a,b) {
+                            if ((a.text + "") < (b.text + "")) {
+                                return -1;
+                            }
+                            if ((a.text + "") > (b.text + "")) {
+                                return 1;
+                            }
+                            return 0;
+                         } );
+            for(var i = 0; i < o.length; i++) {
+                obj.options[i] = new Option(o[i].text, o[i].value, o[i].defaultSelected,
o[i].selected);
+            }
+        }
+
+    }
+);

Propchange: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/MultiValueDoubleList.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/MultiValueDoubleList.js
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/__package__.js
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/__package__.js?rev=680303&r1=680302&r2=680303&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/__package__.js
(original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/__package__.js
Mon Jul 28 03:00:34 2008
@@ -30,6 +30,7 @@
                 "cocoon.forms.InfoPopup",
                 "cocoon.forms.MultiValueEditor",
                 "cocoon.forms.MultiValueEditorWithSuggestion",
+                "cocoon.forms.MultiValueDoubleList",
                 "dojo.widget.InlineEditBox" // also needed by advanced-field-styling
         ]
 });

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/manifest.js
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/manifest.js?rev=680303&r1=680302&r2=680303&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/manifest.js
(original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/manifest.js
Mon Jul 28 03:00:34 2008
@@ -44,7 +44,8 @@
             "dropdowndatetimepicker"    : "cocoon.forms.DropdownDateTimePicker",
             "infopopup"                 : "cocoon.forms.InfoPopup",
             "multivalueeditor"          : "cocoon.forms.MultiValueEditor",
-            "multivalueeditorwithsuggestion" : "cocoon.forms.MultiValueEditorWithSuggestion"
+            "multivalueeditorwithsuggestion" : "cocoon.forms.MultiValueEditorWithSuggestion",
+            "multivaluedoublelist"      : "cocoon.forms.MultiValueDoubleList"
             // register new Widgets in the cocoon.forms namespace here
         },
         svg: {

Added: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/templates/MultiValueDoubleList.html
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/templates/MultiValueDoubleList.html?rev=680303&view=auto
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/templates/MultiValueDoubleList.html
(added)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/templates/MultiValueDoubleList.html
Mon Jul 28 03:00:34 2008
@@ -0,0 +1,31 @@
+<div id="${this.widgetId}" class="${this.styleClass}">
+  <table>
+    <tr>
+    <th>${this.availableListLabel}</th>
+    <th/>
+    <th>${this.selectedListLabel}</th>
+    </tr>
+    <tr>
+      <td>
+        <select name="${this.cformsIdPrefix}.unselected" id="${this.cformsIdPrefix}.unselected"
size="${this.size}"
+            multiple="multiple" dojoAttachPoint="selectLeft">
+        </select>
+      </td>
+      <td width="10px">
+        <img dojoAttachPoint="transferRight" src="${this.resourcesUri}/img/move_right.gif">
+        <br/>
+        <img dojoAttachPoint="transferAllRight" src="${this.resourcesUri}/img/move_all_right.gif">
+        <br/>
+        <img dojoAttachPoint="transferLeft" src="${this.resourcesUri}/img/move_left.gif">
+        <br/>
+        <img dojoAttachPoint="transferAllLeft" src="${this.resourcesUri}/img/move_all_left.gif">
+        <br/>
+      </td>
+      <td>
+        <select name="${this.cformsIdPrefix}" id="${this.cformsIdPrefix}:input" size="${this.size}"
+            multiple="multiple" dojoAttachPoint="selectRight">
+        </select>
+      </td>
+    </tr>
+  </table>
+</div>

Propchange: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/templates/MultiValueDoubleList.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/templates/MultiValueDoubleList.html
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/flow/forms_flow_example.js
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/flow/forms_flow_example.js?rev=680303&r1=680302&r2=680303&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/flow/forms_flow_example.js
(original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/flow/forms_flow_example.js
Mon Jul 28 03:00:34 2008
@@ -286,3 +286,18 @@
         {title: "Calculated results", text: "Grand total of your order: " + form.getChild("grandtotal").value});
 }
 
+function do_multiValueDoubleList() {
+    var list = new Packages.java.util.ArrayList();
+    list.add("3");
+    list.add("5");
+    var form = new Form("forms/multiValueDoubleList.xml");
+    form.getChild("field_1").setValue(list.toArray());
+    form.showForm("multiValueDoubleList-display-pipeline.jx");
+    var _field_1 = form.getChild("field_1").getValue();
+    var _string1 = "";
+    for (var i = 0; i < _field_1.length; i++) {
+        _string1 += " " + _field_1[i] + ",";
+    }
+    cocoon.sendPage("textresult-display-pipeline.jx",
+        { title: "Values selected", text: "_field_1: "+_string1 });
+}

Added: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/forms/multiValueDoubleList.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/forms/multiValueDoubleList.xml?rev=680303&view=auto
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/forms/multiValueDoubleList.xml
(added)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/forms/multiValueDoubleList.xml
Mon Jul 28 03:00:34 2008
@@ -0,0 +1,61 @@
+<?xml version="1.0"?>
+<!--
+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.
+-->
+<!-- form used to illustrate activate/invisible state widget on ajax forms. -->
+<fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition" xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
+
+  <fd:widgets>
+
+    <fd:multivaluefield id="field_1">
+        <fd:label><br>Multivalue dojo widget:</br></fd:label>
+        <fd:hint>double-list multivalue dojo widget</fd:hint>
+        <fd:help>double-list multivalue dojo widget</fd:help>
+        <fd:datatype base="string"/>
+        <fd:selection-list>
+            <fd:item value="1"/>
+            <fd:item value="2"/>
+            <fd:item value="3"/>
+            <fd:item value="4"/>
+            <fd:item value="5"/>
+            <fd:item value="6"/>
+        </fd:selection-list>
+    </fd:multivaluefield>
+
+    <fd:action id="show">
+      <fd:label>show/Active ...</fd:label>
+      <fd:on-action>
+        <fd:javascript>
+            widget.getForm().getChild("field_1").setState(org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE);
+        </fd:javascript>
+      </fd:on-action>
+    </fd:action>
+    <fd:action id="hide">
+      <fd:label>hide ...</fd:label>
+      <fd:on-action>
+        <fd:javascript>
+            widget.getForm().getChild("field_1").setState(org.apache.cocoon.forms.formmodel.WidgetState.INVISIBLE);
+        </fd:javascript>
+      </fd:on-action>
+    </fd:action>
+
+    <fd:submit id="save">
+        <fd:label>Save</fd:label>
+        <fd:hint>Save</fd:hint>
+    </fd:submit>
+
+  </fd:widgets>
+</fd:form>

Propchange: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/forms/multiValueDoubleList.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/forms/multiValueDoubleList.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/forms/multiValueDoubleList_template.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/forms/multiValueDoubleList_template.xml?rev=680303&view=auto
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/forms/multiValueDoubleList_template.xml
(added)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/forms/multiValueDoubleList_template.xml
Mon Jul 28 03:00:34 2008
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<!--
+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.
+-->
+<page xmlns:ft="http://apache.org/cocoon/forms/1.0#template" xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
+  <!-- Import the macros that define CForms template elements -->
+  <jx:import uri="servlet:forms:/resource/internal/generation/jx-macros.xml"/>
+  <h4 class="samplesGroup">Sample to double-list multivalue widget with dojo.</h4>
+  <title>Sample form</title>
+  <content>
+    <ft:form-template action="continue" method="POST" ajax="true">
+      <ft:continuation-id/>
+
+        <ft:widget id="field_1">
+              <fi:styling list-type="dojo-double-listbox" size="10">
+                <fi:available-label>Available items</fi:available-label>
+                <fi:selected-label>Selected items</fi:selected-label>
+              </fi:styling>
+        </ft:widget>
+
+        <ft:widget id="show"/>
+        <ft:widget id="hide"/>
+        <ft:widget id="save"/>
+
+    </ft:form-template>
+  </content>
+</page>

Propchange: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/forms/multiValueDoubleList_template.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/forms/multiValueDoubleList_template.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/welcome.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/welcome.xml?rev=680303&r1=680302&r2=680303&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/welcome.xml
(original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/welcome.xml
Mon Jul 28 03:00:34 2008
@@ -140,7 +140,9 @@
    <sample name="Cocoon multivalue editor with suggestions" href="do-multivalueWithSuggestion.flow">
      (Ajax) Very simple demo of the &lt;fd:multivaluefield&gt; with suggestion support
feature.
    </sample>
-   
+   <sample name="Cocoon double-list multivalue widget" href="do-multiValueDoubleList.flow">
+     (Ajax) Demo of the double list &lt;fd:multivaluefield&gt;.
+   </sample>
    <sample name="In place editing" href="do-inplace.flow">
      (Ajax) Various ways to use in place editing.
    </sample>



Mime
View raw message