You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by le...@apache.org on 2008/07/11 14:21:23 UTC
svn commit: r675930 - in /ofbiz/trunk/applications:
ecommerce/webapp/ecommerce/WEB-INF/actions/ ecommerce/widget/
order/webapp/ordermgr/WEB-INF/actions/entry/cart/
order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ order/widget/ordermgr/
Author: lektran
Date: Fri Jul 11 05:21:21 2008
New Revision: 675930
URL: http://svn.apache.org/viewvc?rev=675930&view=rev
Log:
A few more bsh -> groovy conversions
Added:
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/ShowPromotionDetails.groovy
- copied unchanged from r675904, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/showPromotionDetails.groovy
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/AdvancedSearchOptions.groovy
- copied unchanged from r675904, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/advancedsearchoptions.groovy
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Breadcrumbs.groovy (with props)
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Category.groovy
- copied, changed from r675904, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/category.bsh
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/CategoryDetail.groovy
- copied, changed from r675904, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/categorydetail.bsh
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ChooseCatalog.groovy (with props)
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/KeywordSearch.groovy
- copied, changed from r675904, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/keywordsearch.bsh
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/KeywordSearchOptions.groovy
- copied, changed from r675904, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/keywordsearchoptions.bsh
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/PrepareConfigForm.groovy
- copied, changed from r675904, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/prepareconfigform.bsh
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Product.groovy
- copied, changed from r675904, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/product.bsh
Removed:
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/cart/showPromotionDetails.groovy
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/advancedsearchoptions.groovy
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/breadcrumbs.bsh
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/category.bsh
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/categorydetail.bsh
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/choosecatalog.bsh
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/keywordsearch.bsh
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/keywordsearchoptions.bsh
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/prepareconfigform.bsh
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/product.bsh
Modified:
ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/main.bsh
ofbiz/trunk/applications/ecommerce/widget/CartScreens.xml
ofbiz/trunk/applications/ecommerce/widget/CatalogScreens.xml
ofbiz/trunk/applications/ecommerce/widget/CommonScreens.xml
ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryCartScreens.xml
ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryCatalogScreens.xml
Modified: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/main.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/main.bsh?rev=675930&r1=675929&r2=675930&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/main.bsh (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/main.bsh Fri Jul 11 05:21:21 2008
@@ -29,7 +29,7 @@
*
* The whole thing should be re-thought, and should preferably NOT use a custom session variable or try to go through the main page.
*
- * NOTE: see section commented out in category.bsh for the other part of this.
+ * NOTE: see section commented out in Category.groovy for the other part of this.
*
* NOTE JLR 20070221 this should be done using the same method than in add to cart. I will do it like that and remove all this after.
*
Modified: ofbiz/trunk/applications/ecommerce/widget/CartScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/widget/CartScreens.xml?rev=675930&r1=675929&r2=675930&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/widget/CartScreens.xml (original)
+++ ofbiz/trunk/applications/ecommerce/widget/CartScreens.xml Fri Jul 11 05:21:21 2008
@@ -110,7 +110,7 @@
<set field="MainColumnStyle" value="center"/>
<set field="productsummaryScreen" value="component://ecommerce/widget/CatalogScreens.xml#productsummary"/>
<set field="titleProperty" value="PageTitleShowPromotionDetails"/>
- <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/cart/showPromotionDetails.groovy"/>
+ <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/cart/ShowPromotionDetails.groovy"/>
</actions>
<widgets>
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
Modified: ofbiz/trunk/applications/ecommerce/widget/CatalogScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/widget/CatalogScreens.xml?rev=675930&r1=675929&r2=675930&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/widget/CatalogScreens.xml (original)
+++ ofbiz/trunk/applications/ecommerce/widget/CatalogScreens.xml Fri Jul 11 05:21:21 2008
@@ -37,7 +37,7 @@
<screen name="keywordsearchbox">
<section>
<actions>
- <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/keywordsearchoptions.bsh"/>
+ <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/KeywordSearchOptions.groovy"/>
</actions>
<widgets>
<platform-specific><html><html-template location="component://order/webapp/ordermgr/entry/catalog/keywordsearchbox.ftl"/></html></platform-specific>
@@ -145,7 +145,7 @@
<section>
<actions>
<property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
- <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/breadcrumbs.bsh"/>
+ <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Breadcrumbs.groovy"/>
</actions>
<widgets>
<platform-specific><html><html-template location="component://order/webapp/ordermgr/entry/catalog/breadcrumbs.ftl"/></html></platform-specific>
@@ -164,7 +164,7 @@
<set field="MainColumnStyle" value="center"/>
<set field="titleProperty" value="PageTitleCategoryPage"/>
- <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/category.bsh"/>
+ <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Category.groovy"/>
</actions>
<widgets>
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
@@ -201,7 +201,7 @@
<set field="productsummaryScreen" value="component://ecommerce/widget/CatalogScreens.xml#productsummary"/>
<set field="productCategoryLinkScreen" value="component://ecommerce/widget/CatalogScreens.xml#ProductCategoryLink"/>
- <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/categorydetail.bsh"/>
+ <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/CategoryDetail.groovy"/>
<entity-and entity-name="ProductCategoryLink" list-name="productCategoryLinks" use-cache="true" filter-by-date="true">
<field-map field-name="productCategoryId" env-name="productCategoryId"/>
@@ -234,7 +234,7 @@
<set field="titleProperty" value="PageTitleProductPage"/>
<set field="layoutSettings.javaScripts[]" value="/images/prototypejs/prototype.js" global="true"/>
<set field="configproductdetailScreen" value="component://ecommerce/widget/CatalogScreens.xml#configproductdetail"/>
- <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/product.bsh"/>
+ <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Product.groovy"/>
</actions>
<widgets>
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
@@ -276,7 +276,7 @@
<set field="productsummaryScreen" value="component://ecommerce/widget/CatalogScreens.xml#productsummary"/>
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/productdetail.bsh"/>
- <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/prepareconfigform.bsh"/>
+ <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/PrepareConfigForm.groovy"/>
</actions>
<widgets>
<include-screen name="breadcrumbs"/>
@@ -389,7 +389,7 @@
<set field="titleProperty" value="PageTitleSearchResults"/>
<set field="parameters.VIEW_SIZE" from-field="parameters.VIEW_SIZE" default-value="10"/>
- <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/keywordsearch.bsh"/>
+ <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/KeywordSearch.groovy"/>
</actions>
<widgets>
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
@@ -410,7 +410,7 @@
<set field="titleProperty" value="PageTitleAdvancedSearch"/>
<set field="headerItem" value="Advanced Search"/>
- <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/advancedsearchoptions.groovy"/>
+ <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/AdvancedSearchOptions.groovy"/>
</actions>
<widgets>
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
Modified: ofbiz/trunk/applications/ecommerce/widget/CommonScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/widget/CommonScreens.xml?rev=675930&r1=675929&r2=675930&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/widget/CommonScreens.xml (original)
+++ ofbiz/trunk/applications/ecommerce/widget/CommonScreens.xml Fri Jul 11 05:21:21 2008
@@ -215,7 +215,7 @@
<set field="randomSurveyGroup" value="testSurveyGroup"/>
<script location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/main.bsh"/>
- <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/category.bsh"/>
+ <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Category.groovy"/>
</actions>
<widgets>
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
Added: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Breadcrumbs.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Breadcrumbs.groovy?rev=675930&view=auto
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Breadcrumbs.groovy (added)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Breadcrumbs.groovy Fri Jul 11 05:21:21 2008
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+
+/*
+ * This script is also referenced by the ecommerce's screens and
+ * should not contain order component's specific code.
+ */
+
+import org.ofbiz.base.util.*;
+import org.ofbiz.product.category.*;
+import javolution.util.FastMap;
+
+categoryList = request.getAttribute("topLevelList");
+if(categoryList) {
+ catContentWrappers = FastMap.newInstance();
+ CategoryWorker.getCategoryContentWrappers(catContentWrappers, categoryList, request);
+ context.catContentWrappers = catContentWrappers;
+}
Propchange: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Breadcrumbs.groovy
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Breadcrumbs.groovy
------------------------------------------------------------------------------
svn:keywords = "Date Rev Author URL Id"
Propchange: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Breadcrumbs.groovy
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Category.groovy (from r675904, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/category.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Category.groovy?p2=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Category.groovy&p1=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/category.bsh&r1=675904&r2=675930&rev=675930&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/category.bsh (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Category.groovy Fri Jul 11 05:21:21 2008
@@ -31,54 +31,52 @@
detailScreen = "categorydetail";
catalogName = CatalogWorker.getCatalogName(request);
-productCategoryId = request.getAttribute("productCategoryId");
-if (productCategoryId == null) {
- productCategoryId = parameters.get("category_id");
-}
-context.put("productCategoryId", productCategoryId);
+productCategoryId = request.getAttribute("productCategoryId") ?: parameters.category_id;
+context.productCategoryId = productCategoryId;
/* NOTE DEJ20070220: this is a weird way to do this and caused unacceptable side effects as described in the related
* comment in the main.bsh file
*
* NOTE JLR 20070221 this should be done using the same method than in add to cart. I will do it like that and remove all this after.
*
-if (productCategoryId != null) {
- session.setAttribute("productCategoryId",productCategoryId);// for language change
+if (productCategoryId) {
+ session.setAttribute("productCategoryId", productCategoryId);// for language change
previousParams = session.getAttribute("_PREVIOUS_PARAMS_");
- if (previousParams != null && previousParams.length() > 0) {
- previousParams = UtilHttp.stripNamedParamsFromQueryString(previousParams, UtilMisc.toList("category_id"));
- previousParams = previousParams + "&category_id=" + productCategoryId;
+ if (previousParams) {
+ previousParams = UtilHttp.stripNamedParamsFromQueryString(previousParams, ["category_id"]);
+ previousParams += "&category_id=" + productCategoryId;
} else {
previousParams = "category_id=" + productCategoryId;
}
session.setAttribute("_PREVIOUS_PARAMS_", previousParams); // for login
- context.put("previousParams", previousParams);
+ context.previousParams = previousParams;
}
*/
-category = delegator.findByPrimaryKeyCache("ProductCategory", UtilMisc.toMap("productCategoryId", productCategoryId));
-if (category != null) {
- if (category.get("detailScreen") != null)
- detailScreen = category.getString("detailScreen");
- CategoryContentWrapper categoryContentWrapper = new CategoryContentWrapper(category, request);
- context.put("title", categoryContentWrapper.get("CATEGORY_NAME"));
- categoryDescription = categoryContentWrapper.get("DESCRIPTION");
- if (categoryDescription != null) {
- context.put("metaDescription", categoryDescription);
- context.put("metaKeywords", categoryDescription + ", " + catalogName);
+category = delegator.findByPrimaryKeyCache("ProductCategory", [productCategoryId : productCategoryId]);
+if (category) {
+ if (category.detailScreen) {
+ detailScreen = category.detailScreen;
+ }
+ categoryContentWrapper = new CategoryContentWrapper(category, request);
+ context.title = categoryContentWrapper.CATEGORY_NAME;
+ categoryDescription = categoryContentWrapper.DESCRIPTION;
+ if (categoryDescription) {
+ context.metaDescription = categoryDescription;
+ context.metaKeywords = categoryDescription + ", " + catalogName;
} else {
- context.put("metaKeywords", catalogName);
+ context.metaKeywords = catalogName;
}
- context.put("productCategory", category);
+ context.productCategory = category;
}
// check the catalogs template path and update
templatePathPrefix = CatalogWorker.getTemplatePathPrefix(request);
-if (templatePathPrefix != null) {
+if (templatePathPrefix) {
detailScreen = templatePathPrefix + detailScreen;
}
-context.put("detailScreen", detailScreen);
+context.detailScreen = detailScreen;
request.setAttribute("productCategoryId", productCategoryId);
-request.setAttribute("defaultViewSize", new Integer(10));
-request.setAttribute("limitView", new Boolean(true));
+request.setAttribute("defaultViewSize", 10);
+request.setAttribute("limitView", true);
Copied: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/CategoryDetail.groovy (from r675904, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/categorydetail.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/CategoryDetail.groovy?p2=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/CategoryDetail.groovy&p1=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/categorydetail.bsh&r1=675904&r2=675930&rev=675930&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/categorydetail.bsh (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/CategoryDetail.groovy Fri Jul 11 05:21:21 2008
@@ -29,57 +29,50 @@
import org.ofbiz.product.category.CategoryContentWrapper;
productCategoryId = request.getAttribute("productCategoryId");
-context.put("productCategoryId", productCategoryId);
+context.productCategoryId = productCategoryId;
-viewSize = parameters.get("VIEW_SIZE");
-viewIndex = parameters.get("VIEW_INDEX");
+viewSize = parameters.VIEW_SIZE;
+viewIndex = parameters.VIEW_INDEX;
currentCatalogId = CatalogWorker.getCurrentCatalogId(request);
// set the default view size
-defaultViewSize = request.getAttribute("defaultViewSize");
-if (defaultViewSize == null) {
- defaultViewSize = new java.lang.Integer(10);
-}
-context.put("defaultViewSize", defaultViewSize);
+defaultViewSize = request.getAttribute("defaultViewSize") ?: 10;
+context.defaultViewSize = defaultViewSize;
// set the limit view
-Boolean limitViewObj = request.getAttribute("limitView");
-limitView = true;
-if (limitViewObj != null) {
- limitView = limitViewObj;
-}
-context.put("limitView", limitView);
+limitView = request.getAttribute("limitView") ?: true;
+context.limitView = limitView;
// get the product category & members
-andMap = UtilMisc.toMap("productCategoryId", productCategoryId,
- "viewIndexString", viewIndex, "viewSizeString", viewSize,
- "defaultViewSize", defaultViewSize, "limitView", limitView);
+andMap = [productCategoryId : productCategoryId,
+ viewIndexString : viewIndex,
+ viewSizeString : viewSize,
+ defaultViewSize : defaultViewSize,
+ limitView : limitView];
andMap.put("prodCatalogId", currentCatalogId);
-andMap.put("checkViewAllow", Boolean.TRUE);
-if (context.get("orderByFields") != null) {
- andMap.put("orderByFields", context.get("orderByFields"));
+andMap.put("checkViewAllow", true);
+if (context.orderByFields) {
+ andMap.put("orderByFields", context.orderByFields);
} else {
- andMap.put("orderByFields", UtilMisc.toList("sequenceNum", "productId"));
+ andMap.put("orderByFields", ["sequenceNum", "productId"]);
}
catResult = dispatcher.runSync("getProductCategoryAndLimitedMembers", andMap);
-productCategory = catResult.get("productCategory");
-if (catResult != null) {
- context.put("productCategoryMembers", catResult.get("productCategoryMembers"));
- context.put("productCategory", productCategory);
- context.put("viewIndex", catResult.get("viewIndex"));
- context.put("viewSize", catResult.get("viewSize"));
- context.put("lowIndex", catResult.get("lowIndex"));
- context.put("highIndex", catResult.get("highIndex"));
- context.put("listSize", catResult.get("listSize"));
-}
+productCategory = catResult.productCategory;
+context.productCategoryMembers = catResult.productCategoryMembers;
+context.productCategory = productCategory;
+context.viewIndex = catResult.viewIndex;
+context.viewSize = catResult.viewSize;
+context.lowIndex = catResult.lowIndex;
+context.highIndex = catResult.highIndex;
+context.listSize = catResult.listSize;
// set this as a last viewed
// DEJ20070220: WHY is this done this way? why not use the existing CategoryWorker stuff?
-int LAST_VIEWED_TO_KEEP = 10; // modify this to change the number of last viewed to keep
+LAST_VIEWED_TO_KEEP = 10; // modify this to change the number of last viewed to keep
lastViewedCategories = session.getAttribute("lastViewedCategories");
-if (lastViewedCategories == null) {
- lastViewedCategories = new LinkedList();
+if (!lastViewedCategories) {
+ lastViewedCategories = [];
session.setAttribute("lastViewedCategories", lastViewedCategories);
}
lastViewedCategories.remove(productCategoryId);
Added: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ChooseCatalog.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ChooseCatalog.groovy?rev=675930&view=auto
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ChooseCatalog.groovy (added)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ChooseCatalog.groovy Fri Jul 11 05:21:21 2008
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+import org.ofbiz.base.util.*;
+import org.ofbiz.entity.util.*;
+import org.ofbiz.product.catalog.*;
+import org.ofbiz.order.shoppingcart.*;
+import org.ofbiz.product.store.ProductStoreWorker;
+
+catalogCol = null;
+currentCatalogId = null;
+currentCatalogName = null;
+
+cart = ShoppingCartEvents.getCartObject(request);
+productStoreId = cart.getProductStoreId();
+partyId = cart.getOrderPartyId();
+
+currentCatalogId = CatalogWorker.getCurrentCatalogId(request);
+
+if ("SALES_ORDER".equals(cart.getOrderType())) {
+ catalogCol = CatalogWorker.getCatalogIdsAvailable(delegator, productStoreId, partyId);
+} else {
+ catalogCol = CatalogWorker.getAllCatalogIds(request);
+ if (!currentCatalogId && catalogCol) {
+ currentCatalogId = catalogCol.get(0);
+ }
+ session.setAttribute("CURRENT_CATALOG_ID", currentCatalogId);
+}
+currentCatalogName = CatalogWorker.getCatalogName(request, currentCatalogId);
+
+context.catalogCol = catalogCol;
+context.currentCatalogId = currentCatalogId;
+context.currentCatalogName = currentCatalogName;
Propchange: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ChooseCatalog.groovy
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ChooseCatalog.groovy
------------------------------------------------------------------------------
svn:keywords = "Date Rev Author URL Id"
Propchange: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ChooseCatalog.groovy
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/KeywordSearch.groovy (from r675904, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/keywordsearch.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/KeywordSearch.groovy?p2=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/KeywordSearch.groovy&p1=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/keywordsearch.bsh&r1=675904&r2=675930&rev=675930&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/keywordsearch.bsh (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/KeywordSearch.groovy Fri Jul 11 05:21:21 2008
@@ -27,21 +27,21 @@
import org.ofbiz.product.feature.*;
import org.ofbiz.product.product.*;
-module = "keywordsearch.bsh";
+module = "KeywordSearch.groovy";
// note: this can be run multiple times in the same request without causing problems, will check to see on its own if it has run again
ProductSearchSession.processSearchParameters(parameters, request);
prodCatalogId = CatalogWorker.getCurrentCatalogId(request);
-Map result = ProductSearchSession.getProductSearchResult(request, delegator, prodCatalogId);
+result = ProductSearchSession.getProductSearchResult(request, delegator, prodCatalogId);
-context.put("productIds", result.get("productIds"));
-context.put("viewIndex", result.get("viewIndex"));
-context.put("viewSize", result.get("viewSize"));
-context.put("listSize", result.get("listSize"));
-context.put("lowIndex", result.get("lowIndex"));
-context.put("highIndex", result.get("highIndex"));
-context.put("paging", result.get("paging"));
-context.put("previousViewSize", result.get("previousViewSize"));
-context.put("searchCategory", result.get("searchCategory"));
-context.put("searchConstraintStrings", result.get("searchConstraintStrings"));
-context.put("searchSortOrderString", result.get("searchSortOrderString"));
+context.productIds = result.productIds;
+context.viewIndex = result.viewIndex;
+context.viewSize = result.viewSize;
+context.listSize = result.listSize;
+context.lowIndex = result.lowIndex;
+context.highIndex = result.highIndex;
+context.paging = result.paging;
+context.previousViewSize = result.previousViewSize;
+context.searchCategory = result.searchCategory;
+context.searchConstraintStrings = result.searchConstraintStrings;
+context.searchSortOrderString = result.searchSortOrderString;
Copied: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/KeywordSearchOptions.groovy (from r675904, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/keywordsearchoptions.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/KeywordSearchOptions.groovy?p2=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/KeywordSearchOptions.groovy&p1=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/keywordsearchoptions.bsh&r1=675904&r2=675930&rev=675930&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/keywordsearchoptions.bsh (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/KeywordSearchOptions.groovy Fri Jul 11 05:21:21 2008
@@ -33,7 +33,7 @@
searchOperator = "OR";
}
-context.put("currentCatalogId", currentCatalogId);
-context.put("searchCategoryId", searchCategoryId);
-context.put("otherSearchProdCatalogCategories", otherSearchProdCatalogCategories);
-context.put("searchOperator", searchOperator);
+context.currentCatalogId = currentCatalogId;
+context.searchCategoryId = searchCategoryId;
+context.otherSearchProdCatalogCategories = otherSearchProdCatalogCategories;
+context.searchOperator = searchOperator;
Copied: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/PrepareConfigForm.groovy (from r675904, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/prepareconfigform.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/PrepareConfigForm.groovy?p2=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/PrepareConfigForm.groovy&p1=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/prepareconfigform.bsh&r1=675904&r2=675930&rev=675930&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/prepareconfigform.bsh (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/PrepareConfigForm.groovy Fri Jul 11 05:21:21 2008
@@ -28,28 +28,27 @@
import org.ofbiz.base.util.*;
currencyUomId = ShoppingCartEvents.getCartObject(request).getCurrency();
-product = context.get("product");
+product = context.product;
-if (product != null) {
- configWrapper = ProductConfigWorker.getProductConfigWrapper(product.getString("productId"), currencyUomId, request);
+if (product) {
+ configWrapper = ProductConfigWorker.getProductConfigWrapper(product.productId, currencyUomId, request);
ProductConfigWorker.fillProductConfigWrapper(configWrapper, request);
if (!configWrapper.isCompleted()) {
configId = request.getParameter("configId");
- if (UtilValidate.isNotEmpty(configId)) {
+ if (configId) {
configWrapper.loadConfig(delegator, configId);
} else {
configWrapper.setDefaultConfig();
}
-
}
ProductConfigWorker.storeProductConfigWrapper(configWrapper, delegator);
if (!ProductStoreWorker.isStoreInventoryAvailable(request, configWrapper, 1.0)) {
- context.put("productNotAvailable", "Y");
+ context.productNotAvailable = "Y";
}
- context.put("configwrapper", configWrapper);
- context.put("configId", configWrapper.getConfigId());
- context.put("totalPrice", configWrapper.getTotalPrice());
- context.put("renderSingleChoiceWithRadioButtons", "Y");
- context.put("showOffsetPrice", "Y");
+ context.configwrapper = configWrapper;
+ context.configId = configWrapper.getConfigId();
+ context.totalPrice = configWrapper.getTotalPrice();
+ context.renderSingleChoiceWithRadioButtons = "Y";
+ context.showOffsetPrice = "Y";
}
Copied: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Product.groovy (from r675904, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/product.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Product.groovy?p2=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Product.groovy&p1=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/product.bsh&r1=675904&r2=675930&rev=675930&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/product.bsh (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Product.groovy Fri Jul 11 05:21:21 2008
@@ -27,94 +27,86 @@
import org.ofbiz.product.product.ProductWorker;
import org.ofbiz.product.product.ProductContentWrapper;
-dispatcher = request.getAttribute("dispatcher");
-delegator = request.getAttribute("delegator");
contentPathPrefix = CatalogWorker.getContentPathPrefix(request);
catalogName = CatalogWorker.getCatalogName(request);
currentCatalogId = CatalogWorker.getCurrentCatalogId(request);
requestParams = UtilHttp.getParameterMap(request);
detailScreen = "productdetail";
-productId = requestParams.get("product_id");
-if (UtilValidate.isEmpty(productId)) productId = request.getAttribute("product_id");
+productId = requestParams.product_id ?: request.getAttribute("product_id");
/*
* NOTE JLR 20070221 this should be done using the same method than in add to cart. I will do it like that and remove all this after.
*
-if (productId != null) {
+if (productId) {
previousParams = session.getAttribute("_PREVIOUS_PARAMS_");
- if (previousParams != null && previousParams.length() > 0) {
- previousParams = UtilHttp.stripNamedParamsFromQueryString(previousParams, UtilMisc.toList("product_id"));
- previousParams = previousParams + "&product_id=" + productId;
+ if (previousParams) {
+ previousParams = UtilHttp.stripNamedParamsFromQueryString(previousParams, ["product_id"]);
+ previousParams += "&product_id=" + productId;
} else {
previousParams = "product_id=" + productId;
}
session.setAttribute("_PREVIOUS_PARAMS_", previousParams); // for login
- context.put("previousParams", previousParams);
+ context.previousParams = previousParams;
}*/
// get the product entity
-if (productId != null) {
- product = delegator.findByPrimaryKeyCache("Product", UtilMisc.toMap("productId", productId));
-
+if (productId) {
+ product = delegator.findByPrimaryKeyCache("Product", [productId : productId]);
+
// first make sure this isn't a variant that has an associated virtual product, if it does show that instead of the variant
virtualProductId = ProductWorker.getVariantVirtualId(product);
- if (virtualProductId != null) {
+ if (virtualProductId) {
productId = virtualProductId;
- product = delegator.findByPrimaryKeyCache("Product", UtilMisc.toMap("productId", productId));
+ product = delegator.findByPrimaryKeyCache("Product", [productId : productId]);
}
-
- context.put("productId", productId);
-
+
+ context.productId = productId;
+
// now check to see if there is a view allow category and if this product is in it...
- if (product != null) {
+ if (product) {
viewProductCategoryId = CatalogWorker.getCatalogViewAllowCategoryId(delegator, currentCatalogId);
- if (viewProductCategoryId != null) {
+ if (viewProductCategoryId) {
if (!CategoryWorker.isProductInCategory(delegator, productId, viewProductCategoryId)) {
// a view allow productCategoryId was found, but the product is not in the category, axe it...
product = null;
}
}
}
-
- if (product != null) {
- context.put("product", product);
- ProductContentWrapper contentWrapper = new ProductContentWrapper(product, request);
+
+ if (product) {
+ context.product = product;
+ contentWrapper = new ProductContentWrapper(product, request);
context.put("title", contentWrapper.get("PRODUCT_NAME"));
context.put("metaDescription", contentWrapper.get("DESCRIPTION"));
- keywords = new ArrayList();
- keywords.add(product.getString("productName"));
+ keywords = [];
+ keywords.add(product.productName);
keywords.add(catalogName);
- members = delegator.findByAndCache("ProductCategoryMember", UtilMisc.toMap("productId", productId));
- membersIter = members.iterator();
- while (membersIter.hasNext()) {
- member = membersIter.next();
+ members = delegator.findByAndCache("ProductCategoryMember", [productId : productId]);
+ members.each { member ->
category = member.getRelatedOneCache("ProductCategory");
- keywords.add(category.getString("description"));
+ keywords.add(category.description);
}
- context.put("metaKeywords", StringUtil.join(keywords, ", "));
-
+ context.metaKeywords = StringUtil.join(keywords, ", ");
+
// Set the default template for aggregated product (product component configurator ui)
- if (product.getString("productTypeId") != null && product.getString("productTypeId").equals("AGGREGATED") && configproductdetailScreen != null) {
+ if (product.productTypeId && "AGGREGATED".equals(product.productTypeId) && configproductdetailScreen) {
detailScreen = configproductdetailScreen;
}
- productTemplate = product.getString("detailScreen");
- if (productTemplate != null && productTemplate.length() > 0) {
+ productTemplate = product.detailScreen;
+ if (productTemplate) {
detailScreen = productTemplate;
}
-
}
}
-
+
// check the catalog's template path and update
templatePathPrefix = CatalogWorker.getTemplatePathPrefix(request);
-if (templatePathPrefix != null) {
+if (templatePathPrefix) {
detailScreen = templatePathPrefix + detailScreen;
-}
-
-// set the template for the view
-context.put("detailScreen", detailScreen);
+}
-
+// set the template for the view
+context.detailScreen = detailScreen;
Modified: ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryCartScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryCartScreens.xml?rev=675930&r1=675929&r2=675930&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryCartScreens.xml (original)
+++ ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryCartScreens.xml Fri Jul 11 05:21:21 2008
@@ -138,7 +138,7 @@
<set field="title" value="Show Promotion Details"/>
<set field="productsummaryScreen" value="component://order/widget/ordermgr/OrderEntryCatalogScreens.xml#productsummary"/>
- <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/cart/showPromotionDetails.groovy"/>
+ <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/cart/ShowPromotionDetails.groovy"/>
</actions>
<widgets>
<decorator-screen name="CommonOrderEntryDecorator" location="component://order/widget/ordermgr/OrderEntryCommonScreens.xml">
Modified: ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryCatalogScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryCatalogScreens.xml?rev=675930&r1=675929&r2=675930&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryCatalogScreens.xml (original)
+++ ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryCatalogScreens.xml Fri Jul 11 05:21:21 2008
@@ -25,7 +25,7 @@
<screen name="choosecatalog">
<section>
<actions>
- <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/choosecatalog.bsh"/>
+ <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ChooseCatalog.groovy"/>
</actions>
<widgets>
<platform-specific><html><html-template location="component://order/webapp/ordermgr/entry/catalog/choosecatalog.ftl"/></html></platform-specific>
@@ -35,7 +35,7 @@
<screen name="keywordsearchbox">
<section>
<actions>
- <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/keywordsearchoptions.bsh"/>
+ <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/KeywordSearchOptions.groovy"/>
</actions>
<widgets>
<platform-specific><html><html-template location="component://order/webapp/ordermgr/entry/catalog/keywordsearchbox.ftl"/></html></platform-specific>
@@ -68,7 +68,7 @@
<screen name="breadcrumbs">
<section>
<actions>
- <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/breadcrumbs.bsh"/>
+ <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Breadcrumbs.groovy"/>
</actions>
<widgets>
<platform-specific><html><html-template location="component://order/webapp/ordermgr/entry/catalog/breadcrumbs.ftl"/></html></platform-specific>
@@ -97,7 +97,7 @@
<screen name="category-include">
<section>
<actions>
- <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/category.bsh"/>
+ <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Category.groovy"/>
</actions>
<widgets>
<section>
@@ -118,7 +118,7 @@
<section>
<actions>
<set field="productsummaryScreen" value="component://order/widget/ordermgr/OrderEntryCatalogScreens.xml#productsummary"/>
- <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/categorydetail.bsh"/>
+ <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/CategoryDetail.groovy"/>
</actions>
<widgets>
<platform-specific><html><html-template location="component://order/webapp/ordermgr/entry/catalog/categorydetail.ftl"/></html></platform-specific>
@@ -134,7 +134,7 @@
<set field="layoutSettings.javaScripts[]" value="/images/prototypejs/prototype.js" global="true"/>
<set field="title-property" value="PageTitleProductPage"/>
<set field="configproductdetailScreen" value="component://order/widget/ordermgr/OrderEntryCatalogScreens.xml#configproductdetail"/>
- <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/product.bsh"/>
+ <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Product.groovy"/>
</actions>
<widgets>
<decorator-screen name="CommonOrderCatalogDecorator" location="component://order/widget/ordermgr/OrderEntryCommonScreens.xml">
@@ -179,7 +179,7 @@
<set field="productsummaryScreen" value="component://order/widget/ordermgr/OrderEntryCatalogScreens.xml#productsummary"/>
<script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/productdetail.bsh"/>
<!--<script location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/prepareconfigform.bsh"/>-->
- <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/prepareconfigform.bsh"/>
+ <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/PrepareConfigForm.groovy"/>
</actions>
<widgets>
<include-screen name="breadcrumbs"/>
@@ -197,7 +197,7 @@
<set field="title-property" value="PageTitleSearchResults"/>
<set field="productsummaryScreen" value="component://order/widget/ordermgr/OrderEntryCatalogScreens.xml#productsummary"/>
- <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/keywordsearch.bsh"/>
+ <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/KeywordSearch.groovy"/>
</actions>
<widgets>
<decorator-screen name="CommonOrderCatalogDecorator" location="component://order/widget/ordermgr/OrderEntryCommonScreens.xml">
@@ -216,7 +216,7 @@
<set field="title-property" value="PageTitleAdvancedSearch"/>
<set field="headerItem" value="Advanced Search"/>
- <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/advancedsearchoptions.groovy"/>
+ <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/AdvancedSearchOptions.groovy"/>
<entity-condition entity-name="PartyRoleAndPartyDetail" list-name="supplerPartyRoleAndPartyDetails">
<condition-expr field-name="roleTypeId" value="SUPPLIER"/>