You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by an...@apache.org on 2007/02/22 17:15:52 UTC
svn commit: r510573 - in /cocoon: branches/BRANCH_2_1_X/
trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/
trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/...
Author: antonio
Date: Thu Feb 22 08:15:51 2007
New Revision: 510573
URL: http://svn.apache.org/viewvc?view=rev&rev=510573
Log:
<action dev="AG" type="fix" fixes-bug="COCOON-2013" due-to="Larry Ruiz" due-to-email="lruiz@agssa.net">
CForms: MultivalueEditorWithSuggestion, extended multivalueeditor widget with suggestion list.
</action>
Added:
cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/MultiValueEditorWithSuggestion.js (with props)
cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/templates/MultiValueEditorWithSuggestion.html (with props)
cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/forms/ajax_multivalue_with_suggestion_form.xml (with props)
cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/forms/ajax_multivalue_with_suggestion_template.xml (with props)
cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/forms/contactsjson.xml (with props)
Modified:
cocoon/branches/BRANCH_2_1_X/status.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/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/sitemap.xmap
cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/welcome.xml
Modified: cocoon/branches/BRANCH_2_1_X/status.xml
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/status.xml?view=diff&rev=510573&r1=510572&r2=510573
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/status.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml Thu Feb 22 08:15:51 2007
@@ -181,6 +181,9 @@
<changes>
<release version="2.1.11" date="TBD">
+ <action dev="AG" type="fix" fixes-bug="COCOON-2013" due-to="Larry Ruiz" due-to-email="lruiz@agssa.net">
+ CForms: MultivalueEditorWithSuggestion, extended multivalueeditor widget with suggestion list.
+ </action>
<action dev="AG" type="fix" fixes-bug="COCOON-2011" due-to="Paul Friedman" due-to-email="paul.friedman@quoininc.com">
CForms: CFormsSuggest widget does not implement the onValueChanged event.
</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?view=diff&rev=510573&r1=510572&r2=510573
==============================================================================
--- 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 Thu Feb 22 08:15:51 2007
@@ -203,6 +203,32 @@
</xsl:template>
<!--+
+ | fi:multivaluefield with a selection list and suggestions support
+ +-->
+ <xsl:template match="fi:multivaluefield[fi:styling/@type='MultiValueEditorWithSuggestion']">
+ <!-- <xsl:variable name="values" select="fi:values/fi:value/text()"/>
+ <xsl:variable name="popupUri" select="fi:styling/@popup-uri"/>
+ <xsl:variable name="popupLinkText" select="fi:styling/@popup-link-text"/>
+ <xsl:variable name="dataUrl" select="fi:styling/@dataUrl"/>
+ <xsl:variable name="popupSize" select="fi:styling/@popup-size"/>-->
+
+ <div id="{@id}" dojoType="forms:MultiValueEditorWithSuggestion" styleClass="multivalue-widget" dataUrl="{fi:styling/@dataUrl}"
+ popupUri="{fi:styling/@popup-uri}" popupLinkText="{fi:styling/@popup-link-text}" popupSize="{fi:styling/@popup-size}">
+ <table>
+ <tbody>
+ <xsl:for-each select="fi:selection-list/fi:item">
+ <xsl:variable name="value" select="@value"/>
+ <tr>
+ <td><xsl:value-of select="$value"/></td>
+ <td><xsl:copy-of select="fi:label/node()"/></td>
+ </tr>
+ </xsl:for-each>
+ </tbody>
+ </table>
+ </div>
+ </xsl:template>
+
+ <!--+
| Field with in-place editing
| Reacts to 2 different types:
| - 'inplace' for a single line input
Added: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/MultiValueEditorWithSuggestion.js
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/MultiValueEditorWithSuggestion.js?view=auto&rev=510573
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/MultiValueEditorWithSuggestion.js (added)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/MultiValueEditorWithSuggestion.js Thu Feb 22 08:15:51 2007
@@ -0,0 +1,223 @@
+/*
+ * 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.require("cocoon.forms.MultiValueEditor");
+dojo.provide("cocoon.forms.MultiValueEditorWithSuggestion");
+
+/**
+ * A free-entry multivalue field editor.
+ *
+ * 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("cocoon.forms.MultiValueEditorWithSuggestion",
+ cocoon.forms.MultiValueEditor,
+ function() {
+ },
+ // properties and methods
+ {
+ widgetsInTemplate: true,
+ cformsIdPrefix: "id-prefix-not-set",
+ dataUrl: "_cocoon/forms/suggest",
+ styleClass: "",
+ popupUri: "",
+ popupSize: "",
+ popupLinkText: "",
+ resourcesUri: cocoon.resourcesUri,
+ templatePath: cocoon.resourcesUri + "/forms/js/templates/MultiValueEditorWithSuggestion.html",
+
+ _setUpDataUrl: function() {
+ var dataUrl = this.dataUrl;
+ if (!dataUrl || dataUrl == "") {
+ dataUrl = "_cocoon/forms/suggest/" + this.widgetId + "?filter=%{searchString}";
+ } else {
+ var strings = dataUrl.split("?");
+ if (strings.length > 1) {
+ if (strings[0] == "_cocoon/forms/suggest") {
+ strings[0] += "/" + this.widgetId;
+ }
+ dataUrl = strings[0] + "?" + strings[1] + "&";
+ } else {
+ dataUrl += "?";
+ }
+ dataUrl += "filter=%{searchString}";
+ }
+ this.dataUrl = dataUrl;
+ },
+
+ _addOnSubmitHandler: function(parent) {
+ var form = this._getForm(this);
+ if (form != null) {
+ dojo.event.connect("before", form,"onsubmit", this, "_selectAll");
+ } else {
+ dojo.debug("MultiValueEditorWithSuggestion is not being added to a form -- no onSubmitHandler then.");
+ }
+ },
+
+ postCreate: function() {
+ this.entry.dataUrl = this.dataUrl;
+ this.entry.dataProvider.searchUrl = this.dataUrl;
+ dojo.event.connect(this.entry.textInputNode, "onkeypress", this, "_processInputKey");
+ },
+
+ _readData: function(origFrag) {
+ 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.select.addOption(value, text);
+ }
+ tr = dojo.dom.nextElement(tr, "tr");
+ }
+ }
+ } else {
+ dojo.debug("MultiValueEditorWithSuggestion: no data table found");
+ }
+ },
+
+ _processInputKey: function(event) {
+ var k = dojo.event.browser.keys;
+ switch (event.key){
+ case k.KEY_ENTER:
+ if (this.entry.comboBoxSelectionValue.value && this.entry.comboBoxValue.value) {
+ this.select.addOption(this.entry.comboBoxSelectionValue.value, this.entry.comboBoxValue.value);
+ }
+ dojo.event.browser.stopEvent(event);
+ this.entry.setValue(null);
+ this.entry.setSelectedValue(null);
+ break;
+ }
+ },
+
+ fillInTemplate: function(args, frag) {
+ cocoon.forms.MultiValueEditor.superclass.fillInTemplate(this, args, frag);
+
+ this._setUpDataUrl();
+
+ if (!this.popupSize || this.popupSize == "") {
+ this.popupSize = "400,450";
+ }
+
+ this.select.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, true, true);
+ }
+ }
+
+ dojo.event.connect(this.select, "onkeydown", this, "_processSelectKey");
+ dojo.event.connect(this.select, "onchange", this, "_processSelectChange");
+
+ dojo.event.connect(this.deleteButton, "onclick", this, "_deleteValues");
+ dojo.event.connect(this.moveUpButton, "onclick", this, "_moveUp");
+ dojo.event.connect(this.moveDownButton, "onclick", this, "_moveDown");
+
+ if (this.linkButton) {
+ if (this.popupUri != "" && this.popupLinkText != "") {
+ dojo.event.connect(this.linkButton, "onclick", this, "openPopup");
+ } else {
+ dojo.dom.destroyNode(this.linkButton);
+ }
+ }
+
+ dojo.event.connect(this, "addedTo", this, "_addOnSubmitHandler");
+ this._readData(this.getFragNodeRef(frag));
+ },
+
+ openPopup: function() {
+ if (!this.popupWindow) {
+ this.popupWindow = new PopupWindow();
+ var values = this.popupSize.split(",");
+ this.popupWindow.setSize(parseInt(values[0]), parseInt(values[1]));
+ this.popupWindow.setWindowProperties("scrollbars=yes,resizable=yes");
+ this.popupWindow.name = this.widgetId;
+ this.popupWindow.showPopup = __showPopup;
+ if (this.popupUri.indexOf("?") == -1) {
+ this.popupUri += "?"
+ } else {
+ this.popupUri += "&";
+ }
+ this.popupUri += "caller=" + this.widgetId + ":input";
+ this.popupWindow.setUrl(this.popupUri);
+ }
+ this.popupWindow.showPopup(this.linkButton.id);
+ }
+ }
+);
+
+function __showPopup(anchorname) {
+ this.getXYPosition(anchorname);
+ this.x += this.offsetX;
+ this.y += this.offsetY;
+ if (!this.populated && (this.contents != "")) {
+ this.populated = true;
+ this.refresh();
+ }
+ if (this.divName != null) {
+ // Show the DIV object
+ if (this.use_gebi) {
+ document.getElementById(this.divName).style.left = this.x + "px";
+ document.getElementById(this.divName).style.top = this.y + "px";
+ document.getElementById(this.divName).style.visibility = "visible";
+ } else if (this.use_css) {
+ document.all[this.divName].style.left = this.x;
+ document.all[this.divName].style.top = this.y;
+ document.all[this.divName].style.visibility = "visible";
+ } else if (this.use_layers) {
+ document.layers[this.divName].left = this.x;
+ document.layers[this.divName].top = this.y;
+ document.layers[this.divName].visibility = "visible";
+ }
+ } else {
+ if (this.popupWindow == null || this.popupWindow.closed) {
+ // If the popup window will go off-screen, move it so it doesn't
+ if (this.x < 0) {
+ this.x = 0;
+ }
+ if (this.y < 0) {
+ this.y = 0;
+ }
+ if (screen && screen.availHeight) {
+ if ((this.y + this.height) > screen.availHeight) {
+ this.y = screen.availHeight - this.height;
+ }
+ }
+ if (screen && screen.availWidth) {
+ if ((this.x + this.width) > screen.availWidth) {
+ this.x = screen.availWidth - this.width;
+ }
+ }
+ var avoidAboutBlank = window.opera || ( document.layers && !navigator.mimeTypes['*'] ) || navigator.vendor == 'KDE' || ( document.childNodes && !document.all && !navigator.taintEnabled );
+ this.popupWindow = window.open(avoidAboutBlank?"":"about:blank","window_"+ this.name,this.windowProperties+",width="+this.width+",height="+this.height+",screenX="+this.x+",left="+this.x+",screenY="+this.y+",top="+this.y+"");
+ }
+ this.refresh();
+ }
+}
\ No newline at end of file
Propchange: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/MultiValueEditorWithSuggestion.js
------------------------------------------------------------------------------
svn:eol-style = native
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?view=diff&rev=510573&r1=510572&r2=510573
==============================================================================
--- 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 Thu Feb 22 08:15:51 2007
@@ -29,6 +29,7 @@
"cocoon.forms.DropdownDateTimePicker",
"cocoon.forms.InfoPopup",
"cocoon.forms.MultiValueEditor",
+ "cocoon.forms.MultiValueEditorWithSuggestion",
"dojo.widget.InlineEditBox" // also needed by advanced-field-styling
]
});
Added: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/templates/MultiValueEditorWithSuggestion.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/MultiValueEditorWithSuggestion.html?view=auto&rev=510573
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/templates/MultiValueEditorWithSuggestion.html (added)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/templates/MultiValueEditorWithSuggestion.html Thu Feb 22 08:15:51 2007
@@ -0,0 +1,31 @@
+<div id="${this.widgetId}" class="${this.styleClass}">
+ <table>
+ <tr>
+ <td>Search:</td>
+ <td>
+ <select dojoType="ComboBox" autoComplete="true" mode="remote" dojoAttachPoint="entry"
+ dataUrl="${this.dataUrl}" style="width: 300px;" maxListLength="15">
+ </select>
+ </td>
+ <td/>
+ </tr>
+ <tr>
+ <td/>
+ <td>
+ <select name="${this.widgetId}" id="${this.widgetId}:input" size="5" multiple="multiple" style="width:100%"
+ dojoAttachPoint="select">
+ </select>
+ </td>
+ <td width="20px">
+ <a id="${this.widgetId}.link" href="#" dojoAttachPoint="linkButton">${this.popupLinkText}</a>
+ <br/>
+ <img dojoAttachPoint="deleteButton" src="${this.resourcesUri}/forms/img/delete.gif"/>
+ <br/>
+ <img dojoAttachPoint="moveUpButton" src="${this.resourcesUri}/forms/img/move_up.gif"/>
+ <br/>
+ <img dojoAttachPoint="moveDownButton" src="${this.resourcesUri}/forms/img/move_down.gif"/>
+ <br/>
+ </td>
+ </tr>
+ </table>
+</div>
Propchange: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/js/templates/MultiValueEditorWithSuggestion.html
------------------------------------------------------------------------------
svn:eol-style = native
Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/manifest.js
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/manifest.js?view=diff&rev=510573&r1=510572&r2=510573
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/manifest.js (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/manifest.js Thu Feb 22 08:15:51 2007
@@ -42,7 +42,8 @@
"cformssuggest" : "cocoon.forms.CFormsSuggest",
"dropdowndatetimepicker" : "cocoon.forms.DropdownDateTimePicker",
"infopopup" : "cocoon.forms.InfoPopup",
- "multivalueeditor" : "cocoon.forms.MultiValueEditor"
+ "multivalueeditor" : "cocoon.forms.MultiValueEditor",
+ "multivalueeditorwithsuggestion" : "cocoon.forms.MultiValueEditorWithSuggestion"
// register new Widgets in the cocoon.forms namespace here
},
svg: {
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?view=diff&rev=510573&r1=510572&r2=510573
==============================================================================
--- 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 Thu Feb 22 08:15:51 2007
@@ -79,6 +79,29 @@
{ key: "zw", value: "Zimbabwe" }
];
+var people = [
+ { id: 1, name: "Jean-Baptiste Quenot" },
+ { id: 2, name: "Donald Ball" },
+ { id: 3, name: "Joerg Heinicke" }
+];
+
+function contactsLookup(){
+ var filter = cocoon.request.getParameter("filter");
+ var suggestion = [];
+ if (filter) {
+ for (var i = 0; i < people.length; i++) {
+ if (people[i].name.toUpperCase().indexOf(filter.toUpperCase()) == 0) {
+ suggestion.push(people[i]);
+ }
+ }
+ } else {
+ suggestion = people;
+ }
+
+ cocoon.sendPage("contacts.json-combo-data", {"people": suggestion});
+ return suggestion;
+}
+
function selectCountry() {
var form = new Form("forms/countryselector_form.xml");
form.showForm("countryselector-display-pipeline");
@@ -227,6 +250,21 @@
(path.suggested ? path.suggestionLabel : "(none)") +
"\n\n\npersonId = " + person.value +
"\npersonName = " + (person.suggested ? person.suggestionLabel : "(none)")});
+}
+
+function do_multivalueWithSuggestion() {
+ var form = new Form("forms/ajax_multivalue_with_suggestion_form.xml");
+
+ form.showForm("ajax_multivalue_with_suggestion-display-pipeline.jx");
+
+ var _contacts = form.getChild("contacts").getValue();
+ var _string = "";
+ for (var i = 0; i < _contacts.length; i++) {
+ _string += " " + _contacts[i] + ",";
+ }
+
+ cocoon.sendPage("textresult-display-pipeline.jx",
+ { title: "Values selected", text: _string });
}
function do_inplace() {
Added: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/forms/ajax_multivalue_with_suggestion_form.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/forms/ajax_multivalue_with_suggestion_form.xml?view=auto&rev=510573
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/forms/ajax_multivalue_with_suggestion_form.xml (added)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/forms/ajax_multivalue_with_suggestion_form.xml Thu Feb 22 08:15:51 2007
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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 multivaluefield with suggestion lists. -->
+<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="contacts">
+ <fd:label>Contacts</fd:label>
+ <fd:hint>Select the contacts</fd:hint>
+ <fd:datatype base="long" />
+ </fd:multivaluefield>
+
+ <fd:submit id="ok"><fd:label>OK</fd:label></fd:submit>
+ </fd:widgets>
+</fd:form>
Propchange: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/forms/ajax_multivalue_with_suggestion_form.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/forms/ajax_multivalue_with_suggestion_template.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/forms/ajax_multivalue_with_suggestion_template.xml?view=auto&rev=510573
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/forms/ajax_multivalue_with_suggestion_template.xml (added)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/forms/ajax_multivalue_with_suggestion_template.xml Thu Feb 22 08:15:51 2007
@@ -0,0 +1,50 @@
+<?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="resource://org/apache/cocoon/forms/generation/jx-macros.xml"/>
+ <h4 class="samplesGroup">AJAX sample</h4>
+ <title>Cocoon multivalue field with suggestions</title>
+ <content>
+
+ <para>This simple example illustrates the <fd:multivaluefield> styled as
+ MultiValueEditorWithSuggestion feature, that allows to provide suggestions on
+ the fly to the user.
+ </para>
+
+ <ft:form-template action="continue" method="post" ajax="true">
+ <ft:continuation-id/>
+ Choose a person.
+ <br/>
+ <ft:widget id="contacts">
+ <fi:styling type="MultiValueEditorWithSuggestion"
+ dataUrl="_cocoon/forms/suggest/contacts"/>
+ </ft:widget>
+ <br/>
+ <br/>
+ <ft:widget id="ok"/>
+ </ft:form-template>
+
+ <p>
+ <a href="./">Back to Forms samples</a>
+ </p>
+ </content>
+</page>
Propchange: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/forms/ajax_multivalue_with_suggestion_template.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/forms/contactsjson.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/forms/contactsjson.xml?view=auto&rev=510573
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/forms/contactsjson.xml (added)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/forms/contactsjson.xml Thu Feb 22 08:15:51 2007
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<fi:selection-list
+ xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
+ xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
+ <jx:forEach var="contact" items="${people}">
+ <jx:if test="${contact != null}">
+ <fi:item value="${contact.id}">
+ <fi:label>${contact.name}</fi:label>
+ </fi:item>
+ </jx:if>
+ </jx:forEach>
+</fi:selection-list>
Propchange: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/forms/contactsjson.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/sitemap.xmap
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/sitemap.xmap?view=diff&rev=510573&r1=510572&r2=510573
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/sitemap.xmap (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-sample/src/main/resources/COB-INF/sitemap.xmap Thu Feb 22 08:15:51 2007
@@ -204,6 +204,16 @@
<map:transform src="resource://org/apache/cocoon/forms/resources/selection-list2json.xsl"/>
<map:serialize type="json"/>
</map:match>
+
+ <map:match pattern="_cocoon/forms/suggest/*">
+ <map:call function="{1}Lookup"/>
+ </map:match>
+ <map:match pattern="*.json-combo-data">
+ <map:generate type="jx" src="forms/{1}json.xml"/>
+ <map:transform src="resource://org/apache/cocoon/forms/resources/selection-list2json.xsl"/>
+ <map:serialize type="json"/>
+ </map:match>
+
<!--
| Show a form, using the forms transformer
-->
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?view=diff&rev=510573&r1=510572&r2=510573
==============================================================================
--- 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 Thu Feb 22 08:15:51 2007
@@ -135,6 +135,10 @@
<sample name="Cocoon suggests" href="do-suggest.flow">
(Ajax) Very simple demo of the <fd:suggestion-list> feature.
</sample>
+ <sample name="Cocoon multivalue editor with suggestions" href="do-multivalueWithSuggestion.flow">
+ (Ajax) Very simple demo of the <fd:multivaluefield> with suggestion support feature.
+ </sample>
+
<sample name="In place editing" href="do-inplace.flow">
(Ajax) Various ways to use in place editing.
</sample>