Author: jleroux
Date: Thu Sep 23 19:06:22 2010 New Revision: 1000586 URL: http://svn.apache.org/viewvc?rev=1000586&view=rev Log: Change how Webtools/Geo Management is done: * Now the link from the Find list goes to the Link Geo screen. It opens (focus on Geo field) with selected multiples (in function of assoc type) for the geo selected in Find list, and changes accordingly. In jQuery branch it will use asmselect for that * So the Create screen is now a Create/Edit screen with a lookup for Geo choice This continues to allow geos Edition/Creation and to links them, but now shows also the links between geos in the Link screen. Due to native limitations of select multiples, it's not very useful in trunk but interesting in jQuery branch (I did not try to find an equivalent to asmselect in the Prototype worls, still doable...) Added: ofbiz/trunk/framework/common/webcommon/includes/setMultipleSelectJs.ftl (with props) ofbiz/trunk/framework/images/webapp/images/selectMultipleRelatedValues.js (with props) Modified: ofbiz/trunk/framework/common/widget/CommonScreens.xml ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml ofbiz/trunk/framework/webtools/widget/GeoManagementForms.xml ofbiz/trunk/framework/webtools/widget/GeoManagementScreens.xml Added: ofbiz/trunk/framework/common/webcommon/includes/setMultipleSelectJs.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/setMultipleSelectJs.ftl?rev=1000586&view=auto ============================================================================== --- ofbiz/trunk/framework/common/webcommon/includes/setMultipleSelectJs.ftl (added) +++ ofbiz/trunk/framework/common/webcommon/includes/setMultipleSelectJs.ftl Thu Sep 23 19:06:22 2010 @@ -0,0 +1,30 @@ +<#-- +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. +--> +<script type="text/javascript"> +document.observe('dom:loaded', function() { + // track possible relatedField changes + if ($('${multipleSelectForm}')) { + // If the field value changes, select related multi values, focus must be handled in the related form + $("${relatedField}").observe('change', function() { + typeValue = $('${typeField}'); + selectMultipleRelatedValues('${requestName}', '${paramKey}', '${relatedField}', '${multipleSelect}', '${type}', typeValue, '${responseName}'); + }); + } + }); +</script> Propchange: ofbiz/trunk/framework/common/webcommon/includes/setMultipleSelectJs.ftl ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/common/webcommon/includes/setMultipleSelectJs.ftl ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/framework/common/webcommon/includes/setMultipleSelectJs.ftl ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: ofbiz/trunk/framework/common/widget/CommonScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/widget/CommonScreens.xml?rev=1000586&r1=1000585&r2=1000586&view=diff ============================================================================== --- ofbiz/trunk/framework/common/widget/CommonScreens.xml (original) +++ ofbiz/trunk/framework/common/widget/CommonScreens.xml Thu Sep 23 19:06:22 2010 @@ -124,6 +124,7 @@ under the License. <set field="layoutSettings.javaScripts[]" value="/images/calendarDateSelect/locale/${initialLocale}.js" global="true"/> <set field="layoutSettings.javaScripts[]" value="/images/GooglemapMarkers.js" global="true"/> <set field="layoutSettings.javaScripts[]" value="/images/getDependentDropdownValues.js" global="true"/> + <set field="layoutSettings.javaScripts[]" value="/images/selectMultipleRelatedValues.js" global="true"/> <set field="layoutSettings.commonHeaderImageLinkUrl" from-field="layoutSettings.commonHeaderImageLinkUrl" default-value="main" global="true"/> <set field="visualThemeId" from-field="userPreferences.VISUAL_THEME" global="true"/> Modified: ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js?rev=1000586&r1=1000585&r2=1000586&view=diff ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js (original) +++ ofbiz/trunk/framework/images/webapp/images/getDependentDropdownValues.js Thu Sep 23 19:06:22 2010 @@ -35,8 +35,7 @@ function getDependentDropdownValues(requ params[paramKey] = $F(paramField); var optionList = []; - var requestToSend = request; - new Ajax.Request(requestToSend, { + new Ajax.Request(request, { asynchronous: false, parameters: params, onSuccess: function(transport) { Added: ofbiz/trunk/framework/images/webapp/images/selectMultipleRelatedValues.js URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/selectMultipleRelatedValues.js?rev=1000586&view=auto ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/selectMultipleRelatedValues.js (added) +++ ofbiz/trunk/framework/images/webapp/images/selectMultipleRelatedValues.js Thu Sep 23 19:06:22 2010 @@ -0,0 +1,43 @@ +/* + * 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. + */ + +// *** selectMultipleRelatedValues: Select multi related values +// request = request calling the service which retrieve the info from the DB, ex: getAssociatedStateList +// paramKey = parameter value used in the called service +// paramField = parent dropdown field Id +// targetField = dependend dropdown field Id +// type = type of values to retrieve +// typeValue = value of type to retrieve +// responseName = result returned by the service (using a standard json response, ie chaining json request) + +function selectMultipleRelatedValues(request, paramKey, paramField, targetField, type, typeValue, responseName) { + var params = new Array(); + params[paramKey] = $F(paramField); // get requested value from parent dropdown field + params[type] = $F(typeValue); + + new Ajax.Request(request, { + asynchronous: false, + parameters: params, + onSuccess: function(transport) { + var data = transport.responseText.evalJSON(true); + selectedOptions = data[responseName]; + $(targetField).setValue(selectedOptions); + } + }); +} Propchange: ofbiz/trunk/framework/images/webapp/images/selectMultipleRelatedValues.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/images/webapp/images/selectMultipleRelatedValues.js ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/framework/images/webapp/images/selectMultipleRelatedValues.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml?rev=1000586&r1=1000585&r2=1000586&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml (original) +++ ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/controller.xml Thu Sep 23 19:06:22 2010 @@ -554,6 +554,7 @@ under the License. <request-map uri="FindGeo"><security https="true" auth="true"/><response name="success" type="view" value="FindGeo" save-home-view="true"/></request-map> <request-map uri="EditGeo"><security https="true" auth="true"/><response name="success" type="view" value="EditGeo"/></request-map> <request-map uri="LinkGeos"><security https="true" auth="true"/><response name="success" type="view" value="LinkGeos"/></request-map> + <request-map uri="LookupGeo"><security https="true" auth="true"/><response name="success" type="view" value="LookupGeo"/></request-map> <request-map uri="createGeo"> <security https="true" auth="true"/> <event type="service" path="" invoke="createGeo"/> @@ -677,6 +678,7 @@ under the License. <view-map name="FindGeo" type="screen" page="component://webtools/widget/GeoManagementScreens.xml#FindGeo"/> <view-map name="EditGeo" type="screen" page="component://webtools/widget/GeoManagementScreens.xml#EditGeo"/> <view-map name="LinkGeos" type="screen" page="component://webtools/widget/GeoManagementScreens.xml#LinkGeos"/> + <view-map name="LookupGeo" type="screen" page="component://webtools/widget/GeoManagementScreens.xml#LookupGeo"/> <!-- end of view mappings --> </site-conf> Modified: ofbiz/trunk/framework/webtools/widget/GeoManagementForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/widget/GeoManagementForms.xml?rev=1000586&r1=1000585&r2=1000586&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/widget/GeoManagementForms.xml (original) +++ ofbiz/trunk/framework/webtools/widget/GeoManagementForms.xml Thu Sep 23 19:06:22 2010 @@ -26,7 +26,7 @@ <form name="ListGeos" extends-resource="component://common/widget/LookupForms.xml" extends="listLookupGeo" paginate-target="${currentUrl}" odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar" separate-columns="true" > <field name="geoId" widget-style="buttontext" title="${uiLabelMap.CommonGeoId}"> - <hyperlink also-hidden="false" target-type="plain" description="${geoId}" target="EditGeo"> + <hyperlink also-hidden="false" target-type="plain" description="${geoId}" target="LinkGeos"> <parameter param-name="geoId"/> </hyperlink> </field> @@ -37,13 +37,12 @@ <parameter param-name="noConditionFind" value="Y"/> </hyperlink> </field> - <field name="noConditionFind"><hidden value="N"/></field> </form> <form name="EditGeo" type="single" target="updateGeo" title="" default-map-name="geo" header-row-style="header-row" default-table-style="basic-table"> <alt-target use-when="geo==null" target="createGeo"/> - <field name="geoId" title="${uiLabelMap.CommonGeoId}"><text/></field> + <field name="geoId" title="${uiLabelMap.CommonGeoId}"><lookup target-form-name="LookupGeo"/></field> <field name="geoTypeId" title="${uiLabelMap.CommonGeoTypeId}"> <drop-down allow-empty="true"> <entity-options key-field-name="geoTypeId" entity-name="GeoType" description="${description}"> @@ -59,9 +58,20 @@ <field name="submitButton" title="${uiLabelMap.CommonSubmit}" widget-style="smallSubmit"><submit button-type="button"/></field> </form> - - <form name="LinkGeos" type="single" target="linkGeos" title="" header-row-style="header-row" default-table-style="basic-table"> - <field name="geoIds" title="${uiLabelMap.CommonGeos}"> + <form name="ListLookupGeo" extends="ListGeos"> + <field name="geoId" widget-style="buttontext" title="${uiLabelMap.CommonGeoId}"> + <hyperlink also-hidden="false" target-type="plain" description="${geoId}" target="EditGeo"> + <parameter param-name="geoId"/> + </hyperlink> + </field> + <field name="deleteLink"><ignored/></field> + </form> + + <form name="LinkGeos" type="single" target="linkGeos" title="" focus-field-name="geoId" + header-row-style="header-row" default-table-style="basic-table"> + <field name="geoIds" title="${uiLabelMap.CommonGeos}" + event="onFocus" + action="typeValue = $('${typeField}');selectMultipleRelatedValues('${requestName}', '${paramKey}', '${relatedField}', '${multipleSelect}', '${type}', typeValue, '${responseName}');"> <drop-down allow-multiple="true"> <entity-options entity-name="Geo" key-field-name="geoId" description="${geoName}"> <!--entity-constraint name="geoTypeId" operator="equals" value="COUNTRY"/--><!-- useful at least to test, else it's long... --> @@ -69,8 +79,11 @@ </entity-options> </drop-down> </field> - <field name="geoAssocTypeId" title="${uiLabelMap.CommonGeoAssocTypeId}"> - <drop-down allow-empty="true"> + <field name="dummy" title="${uiLabelMap.CommonEmptyHeader}" position="2"><display/></field> + <field name="geoAssocTypeId" title="${uiLabelMap.CommonGeoAssocTypeId}" position="3" + event="onChange" + action="typeValue = $('${typeField}');selectMultipleRelatedValues('${requestName}', '${paramKey}', '${relatedField}', '${multipleSelect}', '${type}', typeValue, '${responseName}');"> + <drop-down> <entity-options key-field-name="geoAssocTypeId" entity-name="GeoAssocType" description="${description}"> <entity-order-by field-name="description"/> </entity-options> Modified: ofbiz/trunk/framework/webtools/widget/GeoManagementScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/widget/GeoManagementScreens.xml?rev=1000586&r1=1000585&r2=1000586&view=diff ============================================================================== --- ofbiz/trunk/framework/webtools/widget/GeoManagementScreens.xml (original) +++ ofbiz/trunk/framework/webtools/widget/GeoManagementScreens.xml Thu Sep 23 19:06:22 2010 @@ -68,6 +68,29 @@ </widgets> </section> </screen> + <screen name="LookupGeo"> + <section> + <actions> + <set field="title" value="${uiLabelMap.PageTitleLookupGeo}"/> + <set field="queryString" from-field="result.queryString"/> + <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer"/> + <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="20"/> + <set field="entityName" value="Geo"/> + <set field="searchFields" value="[geoId, geoName]"/> + <set field="currentUrl" value="LookupGeo"/> + </actions> + <widgets> + <decorator-screen name="LookupDecorator" location="component://common/widget/CommonScreens.xml"> + <decorator-section name="search-options"> + <include-form name="FindGeo" location="component://webtools/widget/GeoManagementForms.xml"/> + </decorator-section> + <decorator-section name="search-results"> + <include-form name="ListLookupGeo" location="component://webtools/widget/GeoManagementForms.xml"/> + </decorator-section> + </decorator-screen> + </widgets> + </section> + </screen> <screen name="LinkGeos"> <section> @@ -78,15 +101,20 @@ <set field="noId" value="true"/><!-- see CommonGeoManagementDecorator --> - <set field="multipleSelect" value="geoIds"/> + <!-- selectMultipleRelatedValues parameters --> <set field="multipleSelectForm" value="LinkGeos"/> - <set field="formSize" value="422"/> - <set field="asmListItemPercentOfForm" value="95"/> - <set field="sortable" value="false"/> + <set field="multipleSelect" value="LinkGeos_geoIds"/> + <set field="relatedField" value="LinkGeos_geoId"/> + <set field="requestName" value="getRelatedGeos"/> + <set field="paramKey" value="geoId"/> + <set field="type" value="geoAssocTypeId"/> + <set field="typeField" value="LinkGeos_geoAssocTypeId"/> + <set field="responseName" value="geoList"/> </actions> <widgets> <decorator-screen name="CommonGeoManagementDecorator" location="component://webtools/widget/CommonScreens.xml"> <decorator-section name="body"> + <platform-specific><html><html-template location="component://common/webcommon/includes/setMultipleSelectJs.ftl"/></html></platform-specific> <screenlet title="${uiLabelMap.WebtoolsGeosLinkExplained}"> <include-form name="LinkGeos" location="component://webtools/widget/GeoManagementForms.xml"/> </screenlet> |
Free forum by Nabble | Edit this page |