Author: jleroux
Date: Fri Sep 24 19:19:23 2010 New Revision: 1001035 URL: http://svn.apache.org/viewvc?rev=1001035&view=rev Log: * 1st try to use asmselect in Freemarker template. It works until the form is submitted, not sure why yet. I let the necessary variable commented out for now in order/widget/ordermgr/OrderEntryOrderScreens.xml * Safer getRelatedGeos service Modified: ofbiz/branches/jquery/applications/order/config/OrderUiLabels.xml ofbiz/branches/jquery/applications/order/webapp/ordermgr/entry/setAdditionalParty.ftl ofbiz/branches/jquery/applications/order/widget/ordermgr/OrderEntryOrderScreens.xml ofbiz/branches/jquery/framework/common/script/org/ofbiz/common/CommonServices.xml ofbiz/branches/jquery/framework/common/webcommon/includes/setMultipleSelectJs.ftl Modified: ofbiz/branches/jquery/applications/order/config/OrderUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/applications/order/config/OrderUiLabels.xml?rev=1001035&r1=1001034&r2=1001035&view=diff ============================================================================== --- ofbiz/branches/jquery/applications/order/config/OrderUiLabels.xml (original) +++ ofbiz/branches/jquery/applications/order/config/OrderUiLabels.xml Fri Sep 24 19:19:23 2010 @@ -6845,9 +6845,9 @@ </property> <property key="OrderPartySelectRoleForParty"> <value xml:lang="de">Rolle für Akteur wählen</value> - <value xml:lang="en">Select Role For Party</value> + <value xml:lang="en">Select Role(s) For Party</value> <value xml:lang="es">Elija rol para el participante</value> - <value xml:lang="fr">Choisir le rôle pour l'acteur</value> + <value xml:lang="fr">Choisir le ou les rôles pour l'acteur</value> <value xml:lang="it">Seleziona Ruolo Per Soggetto</value> <value xml:lang="nl">Rol voor relatie selecteren</value> <value xml:lang="pt_BR">Selecionar papel para o participante</value> Modified: ofbiz/branches/jquery/applications/order/webapp/ordermgr/entry/setAdditionalParty.ftl URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/applications/order/webapp/ordermgr/entry/setAdditionalParty.ftl?rev=1001035&r1=1001034&r2=1001035&view=diff ============================================================================== --- ofbiz/branches/jquery/applications/order/webapp/ordermgr/entry/setAdditionalParty.ftl (original) +++ ofbiz/branches/jquery/applications/order/webapp/ordermgr/entry/setAdditionalParty.ftl Fri Sep 24 19:19:23 2010 @@ -107,7 +107,7 @@ under the License. <tr> <td width="100%"> <table border="0" cellspacing="0" cellpadding="0" class="boxbottom"> - <form method="post" action="<@ofbizUrl>addAdditionalParty</@ofbizUrl>"> + <form method="post" action="<@ofbizUrl>addAdditionalParty</@ofbizUrl>" name="addAdditionalPartyForm" id="addAdditionalPartyForm"> <tr> <td> </td> <td> Modified: ofbiz/branches/jquery/applications/order/widget/ordermgr/OrderEntryOrderScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/applications/order/widget/ordermgr/OrderEntryOrderScreens.xml?rev=1001035&r1=1001034&r2=1001035&view=diff ============================================================================== --- ofbiz/branches/jquery/applications/order/widget/ordermgr/OrderEntryOrderScreens.xml (original) +++ ofbiz/branches/jquery/applications/order/widget/ordermgr/OrderEntryOrderScreens.xml Fri Sep 24 19:19:23 2010 @@ -183,10 +183,20 @@ under the License. <set field="stepLabelId" value="PartyParties"/> <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/SetAdditionalParty.groovy"/> <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/AdditionalPartyListing.groovy"/> + + <!-- asmslect parameters, must be prefixed by asm_ --> + <!--set field="asm_multipleSelectForm" value="addAdditionalPartyForm"/> + <set field="asm_multipleSelect" value="additionalRoleTypeId"/> + <set field="asm_formSize" value="700"/> + <set field="asm_asmListItemPercentOfForm" value="95"/> + <set field="asm_sortable" value="false"/> + <property-map resource="OrderUiLabels" map-name="uiLabelMap" global="true"/> + <set field="asm_title" value="${uiLabelMap.OrderPartySelectRoleForParty}"/--> </actions> <widgets> <decorator-screen name="CommonOrderCheckoutDecorator"> <decorator-section name="body"> + <platform-specific><html><html-template location="component://common/webcommon/includes/setMultipleSelectJs.ftl"/></html></platform-specific> <platform-specific> <html><html-template location="component://order/webapp/ordermgr/entry/setAdditionalParty.ftl"/></html> </platform-specific> Modified: ofbiz/branches/jquery/framework/common/script/org/ofbiz/common/CommonServices.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/common/script/org/ofbiz/common/CommonServices.xml?rev=1001035&r1=1001034&r2=1001035&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/common/script/org/ofbiz/common/CommonServices.xml (original) +++ ofbiz/branches/jquery/framework/common/script/org/ofbiz/common/CommonServices.xml Fri Sep 24 19:19:23 2010 @@ -311,18 +311,22 @@ under the License. <simple-method method-name="getRelatedGeos" short-description="get related geos to a geo through a geoAssoc" login-required="false"> <entity-and entity-name="GeoAssoc" list="geoAssoc"> - <field-map field-name="geoIdTo" from-field="parameters.geoId"/> + <field-map field-name="geoId" from-field="parameters.geoId"/> <field-map field-name="geoAssocTypeId" from-field="parameters.geoAssocTypeId"/> </entity-and> <if-empty field="geoAssoc"> - <set field="noOptions" value="_NA_"/> + <set field="noOptions" value="____"/> <field-to-list list="geoList" field="noOptions"/> - <return/> + <else> + <iterate list="geoAssoc" entry="geo"> + <field-to-list list="geoList" field="geo.geoIdTo"/> + </iterate> + </else> </if-empty> - <iterate list="geoAssoc" entry="geo"> - <field-to-list list="geoList" field="geo.geoId"/> - </iterate> <field-to-result field="geoList"/> + <log level="always" message="parameters.geoIdTo===========================${parameters.geoId}"></log> + <log level="always" message="parameters.geoAssocTypeId===========================${geoAssocTypeId}"></log> + <log level="always" message="geoList===========================${geoList}"></log> </simple-method> </simple-methods> Modified: ofbiz/branches/jquery/framework/common/webcommon/includes/setMultipleSelectJs.ftl URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/common/webcommon/includes/setMultipleSelectJs.ftl?rev=1001035&r1=1001034&r2=1001035&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/common/webcommon/includes/setMultipleSelectJs.ftl (original) +++ ofbiz/branches/jquery/framework/common/webcommon/includes/setMultipleSelectJs.ftl Fri Sep 24 19:19:23 2010 @@ -18,25 +18,49 @@ under the License. --> <script type="text/javascript"> jQuery(document).ready(function() { -<#if asm_title?exists> <#-- set the dropdown "title" if exists --> - jQuery("#${asm_multipleSelect}").attr('title', '${asm_title}'); + +widget = jQuery("#${asm_multipleSelect}"); +ftl = jQuery("select[name='${asm_multipleSelect}']"); +isWidget = widget.length; +isFtl = ftl.length; + +<#if asm_title?exists> + // set the dropdown "title" if exists + if (isWidget) widget.attr('title', '${asm_title}'); + if (isFtl) ftl.attr('title', '${asm_title}'); </#if> - // use asmSelect - jQuery("#${asm_multipleSelect}").asmSelect({ - addItemTarget: 'top', - sortable: ${asm_sortable}, - removeLabel: '${uiLabelMap.CommonRemove}' - }); + // use asmSelect in Widget Forms + if (isWidget) { + widget.asmSelect({ + addItemTarget: 'top', + sortable: ${asm_sortable}, + removeLabel: '${uiLabelMap.CommonRemove}' + }); + } + // use asmSelect in Freemarker Templates + else if (isFtl) { + ftl.asmSelect({ + addItemTarget: 'top', + sortable: ${asm_sortable}, + removeLabel: '${uiLabelMap.CommonRemove}' + //,debugMode: true + }); + } <#if asm_relatedField?exists> <#-- can be used without related field --> // track possible relatedField changes - if (jQuery('#${asm_multipleSelectForm}')) { - // on initial focus or if the field value changes, select related multi values. - // FIXME : not sure why focus does not work here, must be added as event/action in the multipleSelectForm.relatedField - jQuery("#${asm_relatedField}").bind('change focus', function() { - typeValue = jQuery('#${asm_typeField}').val(); - selectMultipleRelatedValues('${asm_requestName}', '${asm_paramKey}', '${asm_relatedField}', '${asm_multipleSelect}', '${asm_type}', typeValue, '${asm_responseName}'); - }); + // on initial focus or if the field value changes, select related multi values. + // FIXME : not sure why focus does not work here, must be added as event/action in the multipleSelectForm.relatedField + if (isWidget) { + jQuery("#${asm_relatedField}").bind('change focus', function() { + typeValue = jQuery('#${asm_typeField}').val(); + selectMultipleRelatedValues('${asm_requestName}', '${asm_paramKey}', '${asm_relatedField}', '${asm_multipleSelect}', '${asm_type}', typeValue, '${asm_responseName}'); + }); + } else if (isFtl) { + jQuery("#${asm_relatedField}").bind('change focus', function() { + typeValue = jQuery('#${asm_typeField}').val(); + selectMultipleRelatedValues('${asm_requestName}', '${asm_paramKey}', '${asm_relatedField}', '${asm_multipleSelect}', '${asm_type}', typeValue, '${asm_responseName}'); + }); } </#if> }); |
Free forum by Nabble | Edit this page |