Small improvement in the order entry cart screen: separated into smaller templates so that it is easier to reuse it.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@570846 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jacopo Cappellato
2007-08-29 15:54:46 +00:00
parent 9b347446c8
commit cf69c6967b
4 changed files with 166 additions and 128 deletions
@@ -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">&nbsp;${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>
@@ -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>
@@ -16,93 +16,6 @@ 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>
<div class="screenlet">
<div class="screenlet-body">
@@ -212,47 +125,6 @@ function quicklookup(element) {
</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">&nbsp;${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();
</script>
@@ -75,7 +75,9 @@ under the License.
<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>