Author: jacopoc
Date: Wed Aug 29 08:54:46 2007 New Revision: 570846 URL: http://svn.apache.org/viewvc?rev=570846&view=rev Log: Small improvement in the order entry cart screen: separated into smaller templates so that it is easier to reuse it. Added: ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/addItemsToShoppingList.ftl ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/javascript.ftl Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcart.ftl ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryCartScreens.xml Added: ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/addItemsToShoppingList.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/addItemsToShoppingList.ftl?rev=570846&view=auto ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/addItemsToShoppingList.ftl (added) +++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/addItemsToShoppingList.ftl Wed Aug 29 08:54:46 2007 @@ -0,0 +1,59 @@ +<#-- +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. +--> + +<!-- Screenlet to add cart to shopping list. The shopping lists are presented in a dropdown box. --> + +<#if (shoppingLists?exists) && (shoppingCartSize > 0)> + <div class="screenlet"> + <div class="screenlet-header"> + <div class="boxhead"> ${uiLabelMap.OrderAddOrderToShoppingList}</div> + </div> + <div class="screenlet-body"> + <table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td> + <form method="post" name="addBulkToShoppingList" action="<@ofbizUrl>addBulkToShoppingList</@ofbizUrl>" style='margin: 0;'> + <#assign index = 0/> + <#list shoppingCart.items() as cartLine> + <#if (cartLine.getProductId()?exists) && !cartLine.getIsPromo()> + <input type="hidden" name="selectedItem" value="${index}"/> + </#if> + <#assign index = index + 1/> + </#list> + <table border="0"> + <tr> + <td> + <div class="tabletext"> + <select name='shoppingListId' class='selectBox'> + <#list shoppingLists as shoppingList> + <option value='${shoppingList.shoppingListId}'>${shoppingList.getString("listName")}</option> + </#list> + </select> + <input type="submit" class="smallSubmit" value="${uiLabelMap.EcommerceAddtoShoppingList}"/> + </div> + </td> + </tr> + </table> + </form> + </td> + </tr> + </table> + </div> + </div> +</#if> Added: ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/javascript.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/javascript.ftl?rev=570846&view=auto ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/javascript.ftl (added) +++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/javascript.ftl Wed Aug 29 08:54:46 2007 @@ -0,0 +1,105 @@ +<#-- +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 language="JavaScript" type="text/javascript"> +function toggle(e) { + e.checked = !e.checked; +} +function checkToggle(e) { + var cform = document.cartform; + if (e.checked) { + var len = cform.elements.length; + var allchecked = true; + for (var i = 0; i < len; i++) { + var element = cform.elements[i]; + if (element.name == "selectedItem" && !element.checked) { + allchecked = false; + } + cform.selectAll.checked = allchecked; + } + } else { + cform.selectAll.checked = false; + } +} +function toggleAll() { + var cform = document.cartform; + var len = cform.elements.length; + for (var i = 0; i < len; i++) { + var e = cform.elements[i]; + if (e.name == "selectedItem") { + toggle(e); + } + } +} +function removeSelected() { + var cform = document.cartform; + cform.removeSelected.value = true; + cform.submit(); +} +function addToList() { + var cform = document.cartform; + cform.action = "<@ofbizUrl>addBulkToShoppingList</@ofbizUrl>"; + cform.submit(); +} +function gwAll(e) { + var cform = document.cartform; + var len = cform.elements.length; + var selectedValue = e.value; + if (selectedValue == "") { + return; + } + + var cartSize = ${shoppingCartSize}; + var passed = 0; + for (var i = 0; i < len; i++) { + var element = cform.elements[i]; + var ename = element.name; + var sname = ename.substring(0,16); + if (sname == "option^GIFT_WRAP") { + var options = element.options; + var olen = options.length; + var matching = -1; + for (var x = 0; x < olen; x++) { + var thisValue = element.options[x].value; + if (thisValue == selectedValue) { + element.selectedIndex = x; + passed++; + } + } + } + } + if (cartSize > passed && selectedValue != "NO^") { + alert("${uiLabelMap.OrderSelectedGiftNotAvailableForAll}"); + } + cform.submit(); +} +function quicklookup_popup(element) { + target = element; // note: global var target comes from fieldlookup.js + var searchTerm = element.value; + var obj_lookupwindow = window.open('LookupProduct?productId_op=like&productId_ic=Y&productId=' + searchTerm,'FieldLookup', 'width=700,height=550,scrollbars=yes,status=no,resizable=yes,top='+my+',left='+mx+',dependent=yes,alwaysRaised=yes'); + obj_lookupwindow.opener = window; + obj_lookupwindow.focus(); +} +function quicklookup(element) { + <#if shoppingCart.getOrderType() == "PURCHASE_ORDER"> + window.location='LookupBulkAddSupplierProducts?productId='+element.value; + <#else> + window.location='LookupBulkAddProducts?productId='+element.value; + </#if> +} +</script> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcart.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcart.ftl?rev=570846&r1=570845&r2=570846&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcart.ftl (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcart.ftl Wed Aug 29 08:54:46 2007 @@ -16,93 +16,6 @@ specific language governing permissions and limitations under the License. --> -<script language="JavaScript" type="text/javascript"> -function toggle(e) { - e.checked = !e.checked; -} -function checkToggle(e) { - var cform = document.cartform; - if (e.checked) { - var len = cform.elements.length; - var allchecked = true; - for (var i = 0; i < len; i++) { - var element = cform.elements[i]; - if (element.name == "selectedItem" && !element.checked) { - allchecked = false; - } - cform.selectAll.checked = allchecked; - } - } else { - cform.selectAll.checked = false; - } -} -function toggleAll() { - var cform = document.cartform; - var len = cform.elements.length; - for (var i = 0; i < len; i++) { - var e = cform.elements[i]; - if (e.name == "selectedItem") { - toggle(e); - } - } -} -function removeSelected() { - var cform = document.cartform; - cform.removeSelected.value = true; - cform.submit(); -} -function addToList() { - var cform = document.cartform; - cform.action = "<@ofbizUrl>addBulkToShoppingList</@ofbizUrl>"; - cform.submit(); -} -function gwAll(e) { - var cform = document.cartform; - var len = cform.elements.length; - var selectedValue = e.value; - if (selectedValue == "") { - return; - } - - var cartSize = ${shoppingCartSize}; - var passed = 0; - for (var i = 0; i < len; i++) { - var element = cform.elements[i]; - var ename = element.name; - var sname = ename.substring(0,16); - if (sname == "option^GIFT_WRAP") { - var options = element.options; - var olen = options.length; - var matching = -1; - for (var x = 0; x < olen; x++) { - var thisValue = element.options[x].value; - if (thisValue == selectedValue) { - element.selectedIndex = x; - passed++; - } - } - } - } - if (cartSize > passed && selectedValue != "NO^") { - alert("${uiLabelMap.OrderSelectedGiftNotAvailableForAll}"); - } - cform.submit(); -} -function quicklookup_popup(element) { - target = element; // note: global var target comes from fieldlookup.js - var searchTerm = element.value; - var obj_lookupwindow = window.open('LookupProduct?productId_op=like&productId_ic=Y&productId=' + searchTerm,'FieldLookup', 'width=700,height=550,scrollbars=yes,status=no,resizable=yes,top='+my+',left='+mx+',dependent=yes,alwaysRaised=yes'); - obj_lookupwindow.opener = window; - obj_lookupwindow.focus(); -} -function quicklookup(element) { - <#if shoppingCart.getOrderType() == "PURCHASE_ORDER"> - window.location='LookupBulkAddSupplierProducts?productId='+element.value; - <#else> - window.location='LookupBulkAddProducts?productId='+element.value; - </#if> -} -</script> <div class="screenlet"> <div class="screenlet-body"> @@ -211,47 +124,6 @@ </table> </div> </div> - -<!-- Screenlet to add cart to shopping list. The shopping lists are presented in a dropdown box. --> - -<#if (shoppingLists?exists) && (shoppingCartSize > 0)> - <div class="screenlet"> - <div class="screenlet-header"> - <div class="boxhead"> ${uiLabelMap.OrderAddOrderToShoppingList}</div> - </div> - <div class="screenlet-body"> - <table border="0" cellspacing="0" cellpadding="0"> - <tr> - <td> - <form method="post" name="addBulkToShoppingList" action="<@ofbizUrl>addBulkToShoppingList</@ofbizUrl>" style='margin: 0;'> - <#assign index = 0/> - <#list shoppingCart.items() as cartLine> - <#if (cartLine.getProductId()?exists) && !cartLine.getIsPromo()> - <input type="hidden" name="selectedItem" value="${index}"/> - </#if> - <#assign index = index + 1/> - </#list> - <table border="0"> - <tr> - <td> - <div class="tabletext"> - <select name='shoppingListId' class='selectBox'> - <#list shoppingLists as shoppingList> - <option value='${shoppingList.shoppingListId}'>${shoppingList.getString("listName")}</option> - </#list> - </select> - <input type="submit" class="smallSubmit" value="${uiLabelMap.EcommerceAddtoShoppingList}"/> - </div> - </td> - </tr> - </table> - </form> - </td> - </tr> - </table> - </div> - </div> -</#if> <script language="JavaScript" type="text/javascript"> document.quickaddform.add_product_id.focus(); Modified: ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryCartScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryCartScreens.xml?rev=570846&r1=570845&r2=570846&view=diff ============================================================================== --- ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryCartScreens.xml (original) +++ ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryCartScreens.xml Wed Aug 29 08:54:46 2007 @@ -75,7 +75,9 @@ <widgets> <decorator-screen name="CommonOrderEntryDecorator" location="component://order/widget/ordermgr/OrderEntryCommonScreens.xml"> <decorator-section name="body"> + <platform-specific><html><html-template location="component://order/webapp/ordermgr/entry/cart/javascript.ftl"/></html></platform-specific> <platform-specific><html><html-template location="component://order/webapp/ordermgr/entry/cart/showcart.ftl"/></html></platform-specific> + <platform-specific><html><html-template location="component://order/webapp/ordermgr/entry/cart/addItemsToShoppingList.ftl"/></html></platform-specific> <platform-specific><html><html-template location="component://order/webapp/ordermgr/entry/cart/showcartitems.ftl"/></html></platform-specific> <platform-specific><html><html-template location="component://order/webapp/ordermgr/entry/cart/promoCodes.ftl"/></html></platform-specific> <platform-specific><html><html-template location="component://order/webapp/ordermgr/entry/cart/manualPromotions.ftl"/></html></platform-specific> |
Free forum by Nabble | Edit this page |