Files
ofbiz-framework/framework/example/widget/example/FormWidgetExampleForms.xml
T
Jacques Le Roux 0a72fe8793 3 patches from Sascha Rodekamp "Localisation of labels in javascript" (https://issues.apache.org/jira/browse/OFBIZ-3964) - OFBIZ-3964
This cames from Adam's advice: http://markmail.org/message/kai5lfvlnsz7xwki

Sascha comes to this solution
The Idea is to have a method which takes a JSON Object with uiLabel Resources and label entries and returns the resolved labels in a JSON Object which can be used directly in the JS Code.
The advantage of this way, is that we have only one Ajax request which reads all labels. The alternative is an Ajax request for each label, which simplify the request (because you haven't to create a complex JSON Object) but is very expansive.

* Replaces all JS alerts with the new fancy error boxes
* Adds a few uiLabels

I simply fixed some typos. I did not test all cases but did a good review.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1056497 13f79535-47bb-0310-9956-ffa450edef68
2011-01-07 20:40:31 +00:00

367 lines
18 KiB
XML

<?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.
-->
<forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-form.xsd">
<form name="DateTimeFieldsExampleForm" type="single" title="">
<actions>
<set field="exampleDateField" value="${date:nowTimestamp()}" type="Timestamp"/>
</actions>
<!-- ***************** -->
<!-- *** field1 *** -->
<!-- ***************** -->
<field name="field1"
title="${uiLabelMap.ExampleDateField1Title}"
tooltip="${uiLabelMap.ExampleToDo}">
<date-time/>
</field>
<!-- ***************** -->
<!-- *** field9 *** -->
<!-- ***************** -->
<field name="field9"
title="${uiLabelMap.ExampleDateField9Title}">
<!--tooltip="${uiLabelMap.ExampleDateField9Tooltip}"-->
<date-time default-value="${groovy:org.ofbiz.base.util.UtilDateTime.nowTimestamp()}"/>
</field>
<!-- ***************** -->
<!-- *** field10 *** -->
<!-- ***************** -->
<field name="field10"
title="${uiLabelMap.ExampleDateField10Title}"
tooltip="${uiLabelMap.ExampleDateField10Tooltip}">
<date-time default-value="${nowTimestamp}"/>
</field>
<!-- ***************** -->
<!-- *** field11 *** -->
<!-- ***************** -->
<field name="field11"
title="${uiLabelMap.ExampleDateField11Title}"
tooltip="${uiLabelMap.ExampleDateField11Tooltip}">
<date-time default-value="${date:dayStart(nowTimestamp, timeZone, locale)}"/>
</field>
<!-- ***************** -->
<!-- *** field2 *** -->
<!-- ***************** -->
<field name="field2"
title="${uiLabelMap.ExampleDateField2Title}"
tooltip="${uiLabelMap.ExampleToDo}">
<date-time type="date"/>
</field>
<!-- ***************** -->
<!-- *** field3 *** -->
<!-- ***************** -->
<field name="field3"
title="${uiLabelMap.ExampleDateField3Title}"
tooltip="${uiLabelMap.ExampleToDo}">
<date-time type="time"/>
</field>
<!-- ***************** -->
<!-- *** field4 *** -->
<!-- ***************** -->
<field name="field4"
title="${uiLabelMap.ExampleDateField4Title}"
tooltip="${uiLabelMap.ExampleDateField4Tooltip}">
<date-time input-method="time-dropdown" clock="24" default-value="${exampleDateField}"/>
</field>
<!-- ***************** -->
<!-- *** field5 *** -->
<!-- ***************** -->
<field name="field5"
title="${uiLabelMap.ExampleDateField5Title}"
tooltip="${uiLabelMap.ExampleDateField4Tooltip}">
<date-time input-method="time-dropdown" clock="12" default-value="${exampleDateField}"/>
</field>
<!-- ***************** -->
<!-- *** field6 *** -->
<!-- ***************** -->
<field name="field6"
entry-name="exampleDateField"
title="${uiLabelMap.ExampleDateField6Title}"
tooltip="${uiLabelMap.ExampleToDo}">
<display/>
</field>
<!-- ***************** -->
<!-- *** field7 *** -->
<!-- ***************** -->
<field name="field7"
entry-name="exampleDateField"
title="${uiLabelMap.ExampleDateField7Title}"
tooltip="${uiLabelMap.ExampleDateField7Tooltip}">
<display description="${groovy:org.ofbiz.base.util.UtilDateTime.toDateString(exampleDateField, &quot;MM/dd/yyyy&quot;);}"/>
</field>
<!-- ***************** -->
<!-- *** field8 *** -->
<!-- ***************** -->
<field name="field8"
entry-name="exampleDateField"
title="${uiLabelMap.ExampleDateField8Title}"
tooltip="${uiLabelMap.ExampleDateField8Tooltip}">
<display description="${groovy:org.ofbiz.base.util.UtilDateTime.toDateString(exampleDateField, &quot;MMMM,dd,yyyy&quot;);}"/>
</field>
</form>
<form name="DropDownFieldsExampleForm" type="single" title="">
<field name="dropDownFields1" title="${uiLabelMap.ExampleDropDown}">
<display description="${uiLabelMap.ExampleDropDownTooltip}" also-hidden="false"/>
</field>
<!-- ***************** -->
<!-- *** field1 *** -->
<!-- ***************** -->
<field name="field1"
title="${uiLabelMap.ExampleDropDownField1Title}"
tooltip="${uiLabelMap.ExampleDropDownField1Tooltip}">
<drop-down allow-empty="true">
<option key="Y" description="${uiLabelMap.CommonY}"/>
<option key="N" description="${uiLabelMap.CommonN}"/>
</drop-down>
</field>
<!-- ***************** -->
<!-- *** field2 *** -->
<!-- ***************** -->
<field name="field2"
title="${uiLabelMap.ExampleDropDownField2Title}"
tooltip="${uiLabelMap.ExampleDropDownField2Tooltip}">
<drop-down allow-empty="false"> <!-- allow-empty="false" is also the default value, so you can also not specify this attribute here -->
<option key="Y" description="${uiLabelMap.CommonY}"/>
<option key="N" description="${uiLabelMap.CommonN}"/>
</drop-down>
</field>
<!-- ***************** -->
<!-- *** field5 *** -->
<!-- ***************** -->
<field name="field5"
title="${uiLabelMap.ExampleDropDownField5Title}"
tooltip="${uiLabelMap.ExampleDropDownField5Tooltip}">
<drop-down no-current-selected-key="N">
<option key="Y" description="${uiLabelMap.CommonY}"/>
<option key="N" description="${uiLabelMap.CommonN}"/>
</drop-down>
</field>
<!-- ***************** -->
<!-- *** field8 *** -->
<!-- ***************** -->
<field name="field8"
title="${uiLabelMap.ExampleDropDownField8Title}"
event="onchange"
action="return showErrorAlert('${uiLabelMap.CommonErrorMessage2}','${uiLabelMap.YouChangedTheSelectBoxValue}');"
tooltip="${uiLabelMap.ExampleDropDownField8Tooltip}">
<drop-down>
<option key="Y" description="${uiLabelMap.CommonY}"/>
<option key="N" description="${uiLabelMap.CommonN}"/>
</drop-down>
</field>
<field name="entityOptionsFields1" title="${uiLabelMap.ExampleDropDownEntityOptions}"><display description="${uiLabelMap.ExampleDropDownEntityOptionsTooltip1}" also-hidden="false"/></field>
<field name="entityOptionsFields2" title="${uiLabelMap.CommonEmptyHeader}"><display description="${uiLabelMap.ExampleDropDownEntityOptionsTooltip2}" also-hidden="false"/></field>
<field name="entityOptionsFields3" title="${uiLabelMap.CommonEmptyHeader}"><display description="${uiLabelMap.ExampleDropDownEntityOptionsTooltip3}" also-hidden="false"/></field>
<!-- ***************** -->
<!-- *** field3 *** -->
<!-- ***************** -->
<field name="field3"
title="${uiLabelMap.ExampleDropDownField3Title}"
tooltip="${uiLabelMap.ExampleToDo}">
<drop-down>
<entity-options entity-name="ExampleType"
key-field-name="exampleTypeId"
description="${description}">
<entity-order-by field-name="-description"/>
</entity-options>
</drop-down>
</field>
<!-- ***************** -->
<!-- *** field4 *** -->
<!-- ***************** -->
<field name="field4"
title="${uiLabelMap.ExampleDropDownField4Title}"
tooltip="${uiLabelMap.ExampleToDo}">
<drop-down>
<entity-options entity-name="ExampleType"
key-field-name="exampleTypeId"
description="${exampleTypeId} - ${description}">
<entity-order-by field-name="description"/>
</entity-options>
</drop-down>
</field>
<!-- ***************** -->
<!-- *** field6 *** -->
<!-- ***************** -->
<field name="exampleTypeId"
title="${uiLabelMap.ExampleDropDownField6Title}"
tooltip="${uiLabelMap.ExampleToDo}">
<drop-down>
<entity-options entity-name="ExampleType"
description="${description}"/>
</drop-down>
</field>
<!-- ***************** -->
<!-- *** field7 *** -->
<!-- ***************** -->
<field name="field7"
title="${uiLabelMap.ExampleDropDownField7Title}"
tooltip="${uiLabelMap.ExampleToDo}">
<drop-down>
<entity-options entity-name="ExampleType"
key-field-name="exampleTypeId"
description="${description}">
<entity-constraint name="exampleTypeId"
value="INSPIRED"
operator="greater"/>
<entity-order-by field-name="description"/>
</entity-options>
</drop-down>
</field>
<!-- ****************************** -->
<!-- *** Autocomplete dropdown *** -->
<!-- ****************************** -->
<!-- TODO : return only the Id, else you need to edit the field to remove the description -->
<field name="emptyField1" title="${uiLabelMap.CommonEmptyHeader}"><display/></field>
<field name="geoId" title="${uiLabelMap.ExampleAutocompleteDropdown}"
tooltip="${uiLabelMap.ExampleAutocompleteTooltip}">
<drop-down>
<auto-complete/>
<entity-options entity-name="Geo" description="${geoId}: ${geoName}">
<entity-constraint name="geoTypeId" value="COUNTRY"/>
<entity-order-by field-name="geoName"/>
</entity-options>
</drop-down>
</field>
<!-- ****************************** -->
<!-- *** Dependent dropdowns *** -->
<!-- ****************************** -->
<field name="emptyField2" title="${uiLabelMap.CommonEmptyHeader}"><display/></field>
<field name="dependendDropDownFields" title="${uiLabelMap.ExampleDependentDropDowns}">
<display description="${uiLabelMap.ExampleDependentDropDownTooltip}"/>
</field>
<field name="stateProvinceGeoId" title="${uiLabelMap.CommonState}" widget-style="required"><drop-down allow-empty="false"/></field>
<field name="countryGeoId" title="${uiLabelMap.CommonCountry}" tooltip="${uiLabelMap.CommonRequired}" widget-style="required">
<drop-down no-current-selected-key="USA">
<entity-options entity-name="Geo" key-field-name="geoId" description="${geoName}">
<entity-constraint name="geoTypeId" value="COUNTRY"/>
<entity-order-by field-name="geoName"/>
</entity-options>
</drop-down>
</field>
</form>
<!-- ****************************** -->
<!-- *** Multiple Dropdown *** -->
<!-- ****************************** -->
<!-- See why this is used here http://www.ryancramer.com/journal/entries/select_multiple/ -->
<form name="DropDownMultipleFieldExampleForm" type="single" title="">
<field name="emptyField1" title="${uiLabelMap.CommonEmptyHeader}"><display/></field>
<field name="multipleDropDownFields" title="${uiLabelMap.ExampleMultipleDropDowns}">
<display description="${uiLabelMap.ExampleMultipleDropDownTooltip}"/>
</field>
<field name="countryGeoIdMultiple" title="${uiLabelMap.CommonCountry}">
<drop-down no-current-selected-key="USA">
<entity-options entity-name="Geo" key-field-name="geoId" description="${geoName}">
<entity-constraint name="geoTypeId" value="COUNTRY"/>
<entity-order-by field-name="geoName"/>
</entity-options>
</drop-down>
</field>
</form>
<!-- Simple form to print a FOP PDF file with the fonts available in OFBiz Project -->
<form name="FOPFontsExampleForm" type="single" target="printExampleFOPFonts">
<field name="printButton" title="${uiLabelMap.ExamplePrintButton}" widget-style="smallSubmit"><submit button-type="button"/></field>
</form>
<form name="FieldGroupExampleForm" type="single" title="">
<field name="field1" title="${uiLabelMap.ExampleField} 1"><text/></field>
<field name="field2" title="${uiLabelMap.ExampleField} 2"><text/></field>
<field name="field3" title="${uiLabelMap.ExampleField} 3"><text/></field>
<field name="field4" title="${uiLabelMap.ExampleField} 4"><text/></field>
<field name="field5" title="${uiLabelMap.ExampleField} 5"><text/></field>
<field name="field6" title="${uiLabelMap.ExampleField} 6"><text/></field>
<field name="field7" title="${uiLabelMap.ExampleField} 7"><text/></field>
<field name="field8" title="${uiLabelMap.ExampleField} 8"><text/></field>
<field name="field9" title="${uiLabelMap.ExampleField} 9"><text/></field>
<field name="field10" title="${uiLabelMap.ExampleField} 10"><text/></field>
<field name="field11" title="${uiLabelMap.ExampleField} 11"><text/></field>
<field name="field12" title="${uiLabelMap.ExampleField} 12"><text/></field>
<field name="field13" title="${uiLabelMap.ExampleField} 13"><text/></field>
<field name="field14" title="${uiLabelMap.ExampleField} 14"><text/></field>
<field name="field14" title="${uiLabelMap.ExampleField} 15"><text/></field>
<sort-order>
<field-group title="${uiLabelMap.ExampleGroupField} 1" collapsible="true" initially-collapsed="true">
<sort-field name="field1"/>
<sort-field name="field2"/>
<sort-field name="field3"/>
<sort-field name="field4"/>
<sort-field name="field5"/>
</field-group>
<field-group title="${uiLabelMap.ExampleGroupField} 2" collapsible="true">
<sort-field name="field6"/>
<sort-field name="field7"/>
<sort-field name="field8"/>
<sort-field name="field9"/>
<sort-field name="field10"/>
</field-group>
<field-group title="${uiLabelMap.ExampleGroupField} 3">
<sort-field name="field11"/>
<sort-field name="field12"/>
<sort-field name="field13"/>
<sort-field name="field14"/>
<sort-field name="field15"/>
</field-group>
</sort-order>
</form>
<!-- Lookup Examples -->
<form name="ExampleLookupFields" type="single" title="">
<!-- Old style lookup (in a popup window without autocompletion), geoIdAlone because we have another geoId below -->
<field name="geoIdAlone" title="${uiLabelMap.CommonGeoId}">
<lookup target-form-name="LookupGeo" presentation="window"/>
</field>
<!-- Standard lookup (in a layer with autocompletion) -->
<!-- passes the name in one field and the id in another, passing the id in the other field does not work yet with autocompletion, WIP... -->
<field name="geoName" title="${uiLabelMap.CommonGeoName}">
<lookup target-form-name="LookupGeoName" description-field-name="geoId"/>
</field>
<!-- This field may be hidden and the name rendered in geoName using default-value if geoId is known when loading the form-->
<field name="geoId" title="${uiLabelMap.CommonGeoId}"><text/></field><!-- the text field is only used for rendering. In the "real life" you would use the hidden field commented below to pass the data to the request -->
<!--field name="geoId"><hidden/></field-->
<sort-order>
<field-group>
<sort-field name="geoIdAlone"/>
</field-group>
<field-group>
<sort-field name="geoName"/>
<sort-field name="geoId"/>
</field-group>
</sort-order>
</form>
<form name="SelectionBoxesExampleForm" type="single">
<field name="ExampleTypeId">
<check>
<entity-options key-field-name="exampleTypeId" description="${description}" entity-name="ExampleType"/>
</check>
</field>
</form>
</forms>