Author: lektran
Date: Sat Jul 26 06:58:22 2008 New Revision: 679994 URL: http://svn.apache.org/viewvc?rev=679994&view=rev Log: A few more bsh -> groovy conversions Added: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/cart/ShowCart.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/cart/showcart.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/cart/ShowPromoText.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/cart/showpromotext.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/MiniProductSummary.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/miniproductsummary.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/MiniReorderProds.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/minireorderprods.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/AdvancedSearchPrep.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/advancedsearchprep.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/ContentPrep.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/contentprep.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/Mrv.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/mrv.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/Search.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/search.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/ChangePassword.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/changepassword.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/ContactList.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/contactlist.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/CustomerSurvey.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/customersurvey.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditContactMech.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/editcontactmech.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditPaymentMethod.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/editpaymentmethod.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditPerson.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/editperson.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/GiftCardBalance.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/giftcardbalance.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/GiftCardLink.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/giftcardlink.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/NewCustomer.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/newcustomer.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/ViewProfile.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/viewprofile.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/ContentAddPrep.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/contentaddprep.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/ContentPrep.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/contentprep.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/CurrentValPrep.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/currentvalprep.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/EditAddPrep.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/editaddprep.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/FormPrep.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/formprep.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/HtmlAreaPrep.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/htmlareaprep.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/NodeTrailPrep.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/nodetrailprep.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/OwnerContentPrep.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/ownercontentprep.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/PermPrep.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/permprep.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/PubInit.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/pubinit.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/RespondPermAndPrep.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/respondpermandprep.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/ResponsePrep.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/responseprep.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/ViewPrep.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/viewprep.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/includes/MruAdd.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/includes/mruadd.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/AnonymousCheckoutLinks.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/anonymousCheckoutLinks.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/AnonymousTrail.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/anonymoustrail.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/BillSettings.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/billsettings.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/CheckoutReview.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/checkoutreview.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/CheckoutShippingOptions.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/checkoutshippingoptions.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/CustSettings.groovy - copied, changed from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/custsettings.bsh Removed: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/cart/showcart.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/cart/showpromotext.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/miniproductsummary.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/minireorderprods.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/advancedsearchprep.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/contentprep.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/mrv.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/search.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/changepassword.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/contactlist.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/customersurvey.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/editcontactmech.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/editpaymentmethod.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/editperson.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/giftcardbalance.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/giftcardlink.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/newcustomer.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/viewprofile.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/comboprep.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/contentaddprep.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/contentprep.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/currentvalprep.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/editaddprep.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/formprep.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/forumbrowse.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/htmlareaprep.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/listparamprep.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/nodetrailprep.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/ownercontentprep.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/permprep.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/pubinit.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/requiredrole.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/respondpermandprep.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/responseprep.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/trailprep.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/viewprep.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/includes/mruadd.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/includes/mruprep.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/anonymousCheckoutLinks.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/anonymoustrail.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/billsettings.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/checkoutreview.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/checkoutshippingoptions.bsh ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/custsettings.bsh Modified: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/customer/viewprofile.ftl ofbiz/trunk/applications/ecommerce/widget/CartScreens.xml ofbiz/trunk/applications/ecommerce/widget/CatalogScreens.xml ofbiz/trunk/applications/ecommerce/widget/ContentScreens.xml ofbiz/trunk/applications/ecommerce/widget/CustomerScreens.xml ofbiz/trunk/applications/ecommerce/widget/EmailContactListScreens.xml ofbiz/trunk/applications/ecommerce/widget/ForumScreens.xml ofbiz/trunk/applications/ecommerce/widget/OrderScreens.xml Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/cart/ShowCart.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/cart/showcart.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/cart/ShowCart.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/cart/ShowCart.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/cart/showcart.bsh&r1=679885&r2=679994&rev=679994&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/cart/showcart.bsh (original) +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/cart/ShowCart.groovy Sat Jul 26 06:58:22 2008 @@ -23,39 +23,32 @@ import org.ofbiz.order.shoppingcart.ShoppingCartEvents; import org.ofbiz.entity.condition.*; -delegator = request.getAttribute("delegator"); -userLogin = session.getAttribute("userLogin"); - // Get the Cart and Prepare Size shoppingCart = ShoppingCartEvents.getCartObject(request); -if (shoppingCart != null) { - context.put("shoppingCartSize", shoppingCart.size()); -} else { - context.put("shoppingCartSize", 0); -} -context.put("shoppingCart", shoppingCart); +context.shoppingCartSize = shoppingCart?.size() ?: 0; +context.shoppingCart = shoppingCart; -if (request.getAttribute("add_product_id") != "") { // check if a parameter is apssed - add_product_id = request.getParameter("add_product_id"); - product = delegator.findByPrimaryKeyCache("Product",UtilMisc.toMap("productId",add_product_id)); - context.put("product",product); +if (parameters.add_product_id) { // check if a parameter is passed + add_product_id = parameters.add_product_id; + product = delegator.findByPrimaryKeyCache("Product", [productId : add_product_id]); + context.product = product; } // get all the possible gift wrap options -allgiftWraps = delegator.findByAnd("ProductFeature", UtilMisc.toMap("productFeatureTypeId", "GIFT_WRAP"), UtilMisc.toList("defaultSequenceNum")); -context.put("allgiftWraps", allgiftWraps); +allgiftWraps = delegator.findByAnd("ProductFeature", [productFeatureTypeId : "GIFT_WRAP"], ["defaultSequenceNum"]); +context.allgiftWraps = allgiftWraps; // get the shopping lists for the logged in user -if (userLogin != null) { - exprList = UtilMisc.toList(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, userLogin.getString("partyId")), - EntityCondition.makeCondition("listName", EntityOperator.NOT_EQUAL, "auto-save")); +if (userLogin) { + exprList = [EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, userLogin.partyId), + EntityCondition.makeCondition("listName", EntityOperator.NOT_EQUAL, "auto-save")]; condition = EntityCondition.makeCondition(exprList, EntityOperator.AND); - allShoppingLists = delegator.findList("ShoppingList", condition, null, UtilMisc.toList("listName"), null, false); - context.put("shoppingLists", allShoppingLists); + allShoppingLists = delegator.findList("ShoppingList", condition, null, ["listName"], null, false); + context.shoppingLists = allShoppingLists; } // Get Cart Associated Products Data associatedProducts = ProductDisplayWorker.getRandomCartProductAssoc(request, true); -context.put("associatedProducts", associatedProducts); +context.associatedProducts = associatedProducts; -context.put("contentPathPrefix", CatalogWorker.getContentPathPrefix(request)); +context.contentPathPrefix = CatalogWorker.getContentPathPrefix(request); Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/cart/ShowPromoText.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/cart/showpromotext.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/cart/ShowPromoText.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/cart/ShowPromoText.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/cart/showpromotext.bsh&r1=679885&r2=679994&rev=679994&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/cart/showpromotext.bsh (original) +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/cart/ShowPromoText.groovy Sat Jul 26 06:58:22 2008 @@ -20,10 +20,6 @@ import org.ofbiz.base.util.UtilMisc; import org.ofbiz.order.shoppingcart.product.ProductPromoWorker; -dispatcher = request.getAttribute("dispatcher"); -delegator = request.getAttribute("delegator"); -userLogin = session.getAttribute("userLogin"); - promoShowLimit = 3; //Get Promo Text Data @@ -32,12 +28,10 @@ showPromoText = false; promoToShow = 0; productPromosAllShowable = new ArrayList(productPromosAll.size()); -productPromoIterator = productPromosAll.iterator(); -while (productPromoIterator.hasNext()) { - productPromo = productPromoIterator.next(); - promoText = productPromo.get("promoText"); +productPromosAll.each { productPromo -> + promoText = productPromo.promoText; - if (promoText != null && promoText.length() > 0 && !"N".equals(productPromo.getString("showToCustomer"))) { + if (promoText && !"N".equals(productPromo.showToCustomer)) { showPromoText = true; promoToShow++; productPromosAllShowable.add(productPromo); @@ -49,16 +43,16 @@ productPromos = null; if (productPromosRandomTemp.size() > promoShowLimit) { productPromos = new ArrayList(promoShowLimit); - for (int i=0; i<promoShowLimit; i++) { - randomIndex = (int) Math.round(java.lang.Math.random() * (productPromosRandomTemp.size() - 1)); + for (i = 0; i < promoShowLimit; i++) { + randomIndex = Math.round(java.lang.Math.random() * (productPromosRandomTemp.size() - 1)) as int; productPromos.add(productPromosRandomTemp.remove(randomIndex)); } } else { productPromos = productPromosRandomTemp; } -context.put("promoShowLimit", promoShowLimit); -context.put("productPromosAllShowable", productPromosAllShowable); -context.put("productPromos", productPromos); -context.put("showPromoText", showPromoText); -context.put("promoToShow", promoToShow); +context.promoShowLimit = promoShowLimit; +context.productPromosAllShowable = productPromosAllShowable; +context.productPromos = productPromos; +context.showPromoText = showPromoText; +context.promoToShow = promoToShow; Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/MiniProductSummary.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/miniproductsummary.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/MiniProductSummary.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/MiniProductSummary.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/miniproductsummary.bsh&r1=679885&r2=679994&rev=679994&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/miniproductsummary.bsh (original) +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/MiniProductSummary.groovy Sat Jul 26 06:58:22 2008 @@ -26,7 +26,6 @@ import org.ofbiz.product.store.*; import org.ofbiz.order.shoppingcart.*; -delegator = request.getAttribute("delegator"); miniProduct = request.getAttribute("miniProduct"); optProductId = request.getAttribute("optProductId"); webSiteId = CatalogWorker.getWebSiteId(request); @@ -35,45 +34,41 @@ cart = ShoppingCartEvents.getCartObject(request); context.remove("totalPrice"); - -if (optProductId != null) { - miniProduct = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", optProductId)); +if (optProductId) { + miniProduct = delegator.findByPrimaryKey("Product", [productId : optProductId]); } -if (miniProduct != null && productStoreId != null && prodCatalogId != null) { - userLogin = session.getAttribute("userLogin"); - dispatcher = request.getAttribute("dispatcher"); - +if (miniProduct && productStoreId && prodCatalogId ) { // calculate the "your" price - priceParams = UtilMisc.toMap("product", miniProduct, - "prodCatalogId", prodCatalogId, "webSiteId", webSiteId, - "currencyUomId", cart.getCurrency(), - "autoUserLogin", session.getAttribute("autoUserLogin")); - priceParams.put("productStoreId", productStoreId); - if (userLogin != null) priceParams.put("partyId", userLogin.get("partyId")); + priceParams = [product : miniProduct, + prodCatalogId : prodCatalogId, + webSiteId : webSiteId, + currencyUomId : cart.getCurrency(), + autoUserLogin : autoUserLogin, + productStoreId : productStoreId]; + if (userLogin) priceParams.partyId = userLogin.partyId; priceResult = dispatcher.runSync("calculateProductPrice", priceParams); // returns: isSale, price, orderItemPriceInfos - context.put("priceResult", priceResult); + context.priceResult = priceResult; // get aggregated product totalPrice - if ("AGGREGATED".equals(miniProduct.getString("productTypeId"))) { + if ("AGGREGATED".equals(miniProduct.productTypeId)) { configWrapper = ProductConfigWorker.getProductConfigWrapper(optProductId, cart.getCurrency(), request); - if (configWrapper != null) { + if (configWrapper) { configWrapper.setDefaultConfig(); - context.put("totalPrice",configWrapper.getTotalPrice()); + context.totalPrice = configWrapper.getTotalPrice(); } } - - context.put("miniProduct", miniProduct); - context.put("nowTimeLong", UtilDateTime.nowTimestamp().getTime()); - context.put("miniProdFormName", request.getAttribute("miniProdFormName")); - context.put("miniProdQuantity", request.getAttribute("miniProdQuantity")); + context.miniProduct = miniProduct; + context.nowTimeLong = nowTimestamp.getTime(); + + context.miniProdFormName = request.getAttribute("miniProdFormName"); + context.miniProdQuantity = request.getAttribute("miniProdQuantity"); // make the miniProductContentWrapper ProductContentWrapper miniProductContentWrapper = new ProductContentWrapper(miniProduct, request); - context.put("miniProductContentWrapper", miniProductContentWrapper); - -} + context.miniProductContentWrapper = miniProductContentWrapper; +} Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/MiniReorderProds.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/minireorderprods.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/MiniReorderProds.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/MiniReorderProds.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/minireorderprods.bsh&r1=679885&r2=679994&rev=679994&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/minireorderprods.bsh (original) +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/MiniReorderProds.groovy Sat Jul 26 06:58:22 2008 @@ -20,5 +20,5 @@ import org.ofbiz.order.shoppingcart.product.ProductDisplayWorker; reorderProductResults = ProductDisplayWorker.getQuickReorderProducts(request); -context.put("reorderProducts", reorderProductResults.get("products")); -context.put("reorderQuantities", reorderProductResults.get("quantities")); +context.reorderProducts = reorderProductResults.products; +context.reorderQuantities = reorderProductResults.quantities; Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/AdvancedSearchPrep.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/advancedsearchprep.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/AdvancedSearchPrep.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/AdvancedSearchPrep.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/advancedsearchprep.bsh&r1=679885&r2=679994&rev=679994&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/advancedsearchprep.bsh (original) +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/AdvancedSearchPrep.groovy Sat Jul 26 06:58:22 2008 @@ -25,7 +25,7 @@ productFeaturesByTypeMap = ParametricSearch.getAllFeaturesByType(delegator, 2000); productFeatureTypeIdsOrdered = new ArrayList(new TreeSet(productFeaturesByTypeMap.keySet())); -searchOperator = request.getParameter("SEARCH_OPERATOR"); +searchOperator = parameters.SEARCH_OPERATOR; if (!"AND".equals(searchOperator) && !"OR".equals(searchOperator)) { searchOperator = "OR"; } @@ -33,8 +33,8 @@ searchConstraintStrings = ProductSearchSession.searchGetConstraintStrings(false, session, delegator); searchSortOrderString = ProductSearchSession.searchGetSortOrderString(false, request); -context.put("productFeaturesByTypeMap", productFeaturesByTypeMap); -context.put("productFeatureTypeIdsOrdered", productFeatureTypeIdsOrdered); -context.put("searchOperator", searchOperator); -context.put("searchConstraintStrings", searchConstraintStrings); -context.put("searchSortOrderString", searchSortOrderString); +context.productFeaturesByTypeMap = productFeaturesByTypeMap; +context.productFeatureTypeIdsOrdered = productFeatureTypeIdsOrdered; +context.searchOperator = searchOperator; +context.searchConstraintStrings = searchConstraintStrings; +context.searchSortOrderString = searchSortOrderString; Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/ContentPrep.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/contentprep.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/ContentPrep.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/ContentPrep.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/contentprep.bsh&r1=679885&r2=679994&rev=679994&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/contentprep.bsh (original) +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/ContentPrep.groovy Sat Jul 26 06:58:22 2008 @@ -17,12 +17,4 @@ * under the License. */ -import java.util.*; -import org.ofbiz.base.util.*; - -paramMap = UtilHttp.getParameterMap(request); -contentId = (String)paramMap.get("cid"); -if (UtilValidate.isEmpty(contentId)) - contentId = (String)paramMap.get("contentId"); - -context.put("contentId", contentId); +context.contentId = parameters.cid ?: parameters.contentId; Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/Mrv.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/mrv.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/Mrv.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/Mrv.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/mrv.bsh&r1=679885&r2=679994&rev=679994&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/mrv.bsh (original) +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/Mrv.groovy Sat Jul 26 06:58:22 2008 @@ -39,35 +39,29 @@ import javax.servlet.*; import javax.servlet.http.*; -GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator"); entityName = "ContentDataResourceView"; -lookupCaches = (Map)session.getAttribute("lookupCaches"); +lookupCaches = session.getAttribute("lookupCaches"); -//org.ofbiz.base.util.Debug.logInfo("entityName:" + entityName, ""); -//org.ofbiz.base.util.Debug.logInfo("in mruprep.bsh, lookupCaches:" + lookupCaches, ""); -if (lookupCaches == null) { - lookupCaches = new HashMap(); +if (!lookupCaches) { + lookupCaches = [:]; session.setAttribute("lookupCaches", lookupCaches); } -lifoSet = (LifoSet) lookupCaches.get(entityName); -//org.ofbiz.base.util.Debug.logInfo("lifoSet:" + lifoSet, ""); +lifoSet = lookupCaches[entityName]; -if (lifoSet == null) { +if (!lifoSet) { lifoSet = new LifoSet(10); - lookupCaches.put("ContentAssocDataResourceViewFrom", lifoSet); + lookupCaches.ContentAssocDataResourceViewFrom = lifoSet; } -int sz = lifoSet.size(); -Object contentIdKey = null; -mrvList = new ArrayList(); +sz = lifoSet.size(); +contentIdKey = null; +mrvList = []; -iter = lifoSet.iterator(); -while (iter.hasNext()) { - pk0 = iter.next(); +lifoSet.each { pk0 -> pk = pk0.getPrimaryKey(); gv = delegator.findOne(pk.getEntityName(), pk, true); - if (gv != null) { - String [] arr = { gv.get("contentId"), gv.get("contentName") }; + if (gv) { + arr = [gv.contentId, gv.contentName] as String[]; mrvList.add(arr); } else { // should handle errors in some other way; this does not provide any tracing; impossible to locat Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/Search.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/search.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/Search.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/Search.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/search.bsh&r1=679885&r2=679994&rev=679994&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/search.bsh (original) +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/content/Search.groovy Sat Jul 26 06:58:22 2008 @@ -26,79 +26,66 @@ import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.document.Document; -import org.apache.lucene.search.Searcher; -import org.apache.lucene.search.IndexSearcher; +import org.apache.lucene.search.*; import org.apache.lucene.index.IndexReader; -import org.apache.lucene.search.Query; -import org.apache.lucene.search.TermQuery; -import org.apache.lucene.search.BooleanQuery; import org.apache.lucene.index.Term; -import org.apache.lucene.search.Hits; import org.apache.lucene.queryParser.QueryParser; import org.ofbiz.widget.html.HtmlFormWrapper; import org.ofbiz.product.feature.ParametricSearch; paramMap = UtilHttp.getParameterMap(request); -queryLine = paramMap.get("queryLine"); +queryLine = paramMap.queryLine; //Debug.logInfo("in search, queryLine:" + queryLine, ""); -formDefFile = page.get("formDefFile"); -queryFormName = page.get("queryFormName"); +formDefFile = page.formDefFile; +queryFormName = page.queryFormName; //Debug.logInfo("in search, queryFormName:" + queryFormName, ""); -HtmlFormWrapper queryWrapper = new HtmlFormWrapper(formDefFile, queryFormName, request, response); -context.put("queryWrapper", queryWrapper); +queryWrapper = new HtmlFormWrapper(formDefFile, queryFormName, request, response); +context.queryWrapper = queryWrapper; -listFormName = page.get("listFormName"); +listFormName = page.listFormName; //Debug.logInfo("in search, listFormName:" + listFormName, ""); -HtmlFormWrapper listWrapper = new HtmlFormWrapper(formDefFile, listFormName, request, response); -context.put("listWrapper", listWrapper); -siteId = paramMap.get("siteId"); +listWrapper = new HtmlFormWrapper(formDefFile, listFormName, request, response); +context.listWrapper = listWrapper; +siteId = paramMap.siteId ?: "WebStoreCONTENT"; //Debug.logInfo("in search, siteId:" + siteId, ""); -Map featureIdByType = ParametricSearch.makeFeatureIdByTypeMap(paramMap); +featureIdByType = ParametricSearch.makeFeatureIdByTypeMap(paramMap); //Debug.logInfo("in search, featureIdByType:" + featureIdByType, ""); combQuery = new BooleanQuery(); -String indexPath = null; -Searcher searcher = null; -Analyzer analyzer = null; +indexPath = null; +searcher = null; +analyzer = null; try { indexPath = SearchWorker.getIndexPath(null); searcher = new IndexSearcher(indexPath); analyzer = new StandardAnalyzer(); } catch(java.io.FileNotFoundException e) { - Debug.logError(e, "search.bsh"); + Debug.logError(e, "Search.groovy"); request.setAttribute("errorMsgReq", "No index file exists."); } -if (UtilValidate.isEmpty(siteId)) { - siteId = "WebStoreCONTENT"; -} termQuery = new TermQuery(new Term("site", siteId.toLowerCase())); -combQuery.add(termQuery, true, false); +combQuery.add(termQuery, BooleanClause.Occur.MUST); //Debug.logInfo("in search, termQuery:" + termQuery.toString(), ""); //Debug.logInfo("in search, combQuery(1):" + combQuery, ""); -if (UtilValidate.isNotEmpty(queryLine) && analyzer != null) { +if (queryLine && analyzer) { Query query = null; - if (UtilValidate.isNotEmpty(queryLine)) { - query = QueryParser.parse(queryLine, "content", analyzer); - combQuery.add(query, true, false); - } + query = QueryParser.parse(queryLine, "content", analyzer); + combQuery.add(query, true, false); } -if (!featureIdByType.isEmpty()) { +if (featureIdByType) { featureQuery = new BooleanQuery(); - anyOrAll = paramMap.get("any_or_all"); - boolean featuresRequired = true; - if (anyOrAll != null && anyOrAll.equals("any")) { + anyOrAll = paramMap.any_or_all; + featuresRequired = true; + if ("any".equals(anyOrAll)) { featuresRequired = false; } - if (!featureIdByType.isEmpty()) { - values = featureIdByType.values(); - iter = values.iterator(); - while (iter.hasNext()) { - val = iter.next(); - termQuery = new TermQuery(new Term("feature", val)); + if (featureIdByType) { + featureIdByType.each { key, value -> + termQuery = new TermQuery(new Term("feature", value)); featureQuery.add(termQuery, featuresRequired, false); //Debug.logInfo("in search searchFeature3, termQuery:" + termQuery.toString(), ""); } @@ -106,16 +93,16 @@ combQuery.add(featureQuery, featuresRequired, false); } -if (searcher != null) { +if (searcher) { Debug.logInfo("in search searchFeature3, combQuery:" + combQuery.toString(), ""); - Hits hits = searcher.search(combQuery); + hits = searcher.search(combQuery); Debug.logInfo("in search, hits:" + hits.length(), ""); - List contentList = new ArrayList(); - HashSet hitSet = new HashSet(); - for (int start = 0; start < hits.length(); start++) { + contentList = []; + hitSet = new HashSet(); + for (start = 0; start < hits.length(); start++) { doc = hits.doc(start); - contentId = doc.get("contentId"); - content = delegator.findByPrimaryKeyCache("Content", UtilMisc.toMap("contentId", contentId)); + contentId = doc.contentId; + content = delegator.findByPrimaryKeyCache("Content", [contentId : contentId]); if (!hitSet.contains(contentId)) { contentList.add(content); hitSet.add(contentId); Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/ChangePassword.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/changepassword.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/ChangePassword.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/ChangePassword.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/changepassword.bsh&r1=679885&r2=679994&rev=679994&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/changepassword.bsh (original) +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/ChangePassword.groovy Sat Jul 26 06:58:22 2008 @@ -18,24 +18,20 @@ */ import java.util.HashMap; -; import org.ofbiz.base.util.UtilHttp; -userLogin = session.getAttribute("userLogin"); - tryEntity = true; -errorMessage = request.getAttribute("_ERROR_MESSAGE_"); -if (errorMessage != null && errorMessage.length() > 0) { +errorMessage = parameters._ERROR_MESSAGE_; +if (errorMessage) { tryEntity = false; } -donePage = request.getParameter("DONE_PAGE"); -if (donePage == null || donePage.length() == 0) donePage = "viewprofile"; +donePage = parameters.DONE_PAGE ?: "viewprofile"; userLoginData = userLogin; -if (!tryEntity.booleanValue()) userLoginData = UtilHttp.getParameterMap(request); -if (userLoginData == null) userLoginData = new HashMap(); +if (!tryEntity) userLoginData = UtilHttp.getParameterMap(request); +if (!userLoginData) userLoginData = [:]; -context.put("donePage", donePage); -context.put("userLoginData", userLoginData); +context.donePage = donePage; +context.userLoginData = userLoginData; Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/ContactList.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/contactlist.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/ContactList.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/ContactList.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/contactlist.bsh&r1=679885&r2=679994&rev=679994&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/contactlist.bsh (original) +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/ContactList.groovy Sat Jul 26 06:58:22 2008 @@ -27,13 +27,13 @@ import org.ofbiz.product.store.ProductStoreWorker; import org.ofbiz.accounting.payment.PaymentWorker; -publicEmailContactLists = delegator.findByAnd("ContactList", UtilMisc.toMap("isPublic", "Y", "contactMechTypeId", "EMAIL_ADDRESS"), UtilMisc.toList("contactListName")); -context.put("publicEmailContactLists", publicEmailContactLists); +publicEmailContactLists = delegator.findByAnd("ContactList", [isPublic : "Y", contactMechTypeId : "EMAIL_ADDRESS"], ["contactListName"]); +context.publicEmailContactLists = publicEmailContactLists; -if (userLogin != null) { - partyAndContactMechList = delegator.findByAnd("PartyAndContactMech", UtilMisc.toMap("partyId", partyId, "contactMechTypeId", "EMAIL_ADDRESS"), UtilMisc.toList("-fromDate")); - partyAndContactMechList = EntityUtil.filterByDate(partyAndContactMechList, true); - context.put("partyAndContactMechList", partyAndContactMechList); +if (userLogin) { + partyAndContactMechList = delegator.findByAnd("PartyAndContactMech", [partyId : partyId, contactMechTypeId : "EMAIL_ADDRESS"], ["-fromDate"]); + partyAndContactMechList = EntityUtil.filterByDate(partyAndContactMechList); + context.partyAndContactMechList = partyAndContactMechList; } Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/CustomerSurvey.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/customersurvey.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/CustomerSurvey.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/CustomerSurvey.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/customersurvey.bsh&r1=679885&r2=679994&rev=679994&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/customersurvey.bsh (original) +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/CustomerSurvey.groovy Sat Jul 26 06:58:22 2008 @@ -22,30 +22,24 @@ import org.ofbiz.entity.GenericValue; import org.ofbiz.product.store.ProductStoreSurveyWrapper; -delegator = request.getAttribute("delegator"); -userLogin = session.getAttribute("userLogin"); -partyId = userLogin.getString("partyId"); +partyId = userLogin.partyId; paramMap = UtilHttp.getParameterMap(request); -Debug.log("ParamMap - " + paramMap); -productStoreSurveyId = paramMap.get("productStoreSurveyId"); -if (productStoreSurveyId == null) { - productStoreSurveyId = request.getAttribute("productStoreSurveyId"); -} +productStoreSurveyId = parameters.productStoreSurveyId; -surveyAppl = delegator.findByPrimaryKey("ProductStoreSurveyAppl", UtilMisc.toMap("productStoreSurveyId", productStoreSurveyId)); -if (surveyAppl != null) { +surveyAppl = delegator.findByPrimaryKey("ProductStoreSurveyAppl", [productStoreSurveyId : productStoreSurveyId]); +if (surveyAppl) { survey = surveyAppl.getRelatedOne("Survey"); - context.put("survey", survey); + context.survey = survey; - if (request.getAttribute("_ERROR_MESSAGE") == null) { - paramMap = UtilMisc.toMap("productStoreSurveyId", productStoreSurveyId); + if (!parameters._ERROR_MESSAGE_) { + paramMap = [productStoreSurveyId : productStoreSurveyId]; } wrapper = new ProductStoreSurveyWrapper(surveyAppl, partyId, paramMap); - context.put("surveyWrapper", wrapper); + context.surveyWrapper = wrapper; - surveyResp = request.getAttribute("surveyResponseId"); - if (!UtilValidate.isEmpty(surveyResp)) { + surveyResp = parameters.surveyResponseId; + if (surveyResp) { wrapper.setThisResponseId(surveyResp); wrapper.callResult(true); } Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditContactMech.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/editcontactmech.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditContactMech.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditContactMech.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/editcontactmech.bsh&r1=679885&r2=679994&rev=679994&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/editcontactmech.bsh (original) +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditContactMech.groovy Sat Jul 26 06:58:22 2008 @@ -22,91 +22,82 @@ import org.ofbiz.base.util.UtilHttp; import org.ofbiz.base.util.UtilMisc; -userLogin = session.getAttribute("userLogin"); -security = request.getAttribute("security"); -delegator = request.getAttribute("delegator"); - /* puts the following in the context: "contactMech", "contactMechId", "partyContactMech", "partyContactMechPurposes", "contactMechTypeId", "contactMechType", "purposeTypes", "postalAddress", "telecomNumber", "requestName", "donePage", "tryEntity", "contactMechTypes" */ -target = new HashMap(); -ContactMechWorker.getContactMechAndRelated(request, userLogin.getString("partyId"), target); -targetIter = target.keySet().iterator(); -while (targetIter.hasNext()) { - key = targetIter.next(); - context.put(key, target.get(key)); -} +target = [:]; +ContactMechWorker.getContactMechAndRelated(request, userLogin.partyId, target); +context.putAll(target); -if (!security.hasEntityPermission("PARTYMGR", "_VIEW", session) && context.get("partyContactMech") == null && context.get("contactMech") != null) { - context.put("canNotView", true); +if (!security.hasEntityPermission("PARTYMGR", "_VIEW", session) && !context.partyContactMech && context.contactMech) { + context.canNotView = true; } else { - context.put("canNotView", false); + context.canNotView = false; } -preContactMechTypeId = request.getParameter("preContactMechTypeId"); -if (preContactMechTypeId == null) preContactMechTypeId = request.getAttribute("preContactMechTypeId"); -if (preContactMechTypeId != null) context.put("preContactMechTypeId", preContactMechTypeId); - -paymentMethodId = request.getParameter("paymentMethodId"); -if (paymentMethodId == null) paymentMethodId = request.getAttribute("paymentMethodId"); -if (paymentMethodId != null) context.put("paymentMethodId", paymentMethodId); - -cmNewPurposeTypeId = request.getParameter("contactMechPurposeTypeId"); -if (cmNewPurposeTypeId == null) cmNewPurposeTypeId = request.getAttribute("contactMechPurposeTypeId"); -if (cmNewPurposeTypeId != null) { - contactMechPurposeType = delegator.findByPrimaryKey("ContactMechPurposeType", UtilMisc.toMap("contactMechPurposeTypeId", cmNewPurposeTypeId)); - if (contactMechPurposeType != null) { - context.put("contactMechPurposeType", contactMechPurposeType); +preContactMechTypeId = parameters.preContactMechTypeId; +if (preContactMechTypeId) context.preContactMechTypeId = preContactMechTypeId; + +paymentMethodId = parameters.paymentMethodId; +if (paymentMethodId) context.paymentMethodId = paymentMethodId; + +cmNewPurposeTypeId = parameters.contactMechPurposeTypeId; +if (cmNewPurposeTypeId) { + contactMechPurposeType = delegator.findByPrimaryKey("ContactMechPurposeType", [contactMechPurposeTypeId : cmNewPurposeTypeId]); + if (contactMechPurposeType) { + context.contactMechPurposeType = contactMechPurposeType; } else { cmNewPurposeTypeId = null; } - context.put("cmNewPurposeTypeId", cmNewPurposeTypeId); + context.cmNewPurposeTypeId = cmNewPurposeTypeId; } -tryEntity = context.get("tryEntity"); +tryEntity = context.tryEntity; -contactMechData = context.get("contactMech"); -if (!tryEntity.booleanValue()) contactMechData = parameters; -if (contactMechData == null) contactMechData = new HashMap(); -if (contactMechData != null) context.put("contactMechData", contactMechData); - -partyContactMechData = context.get("partyContactMech"); -if (!tryEntity.booleanValue()) partyContactMechData = parameters; -if (partyContactMechData == null) partyContactMechData = new HashMap(); -if (partyContactMechData != null) context.put("partyContactMechData", partyContactMechData); - -postalAddressData = context.get("postalAddress"); -if (!tryEntity.booleanValue()) postalAddressData = parameters; -if (postalAddressData == null) postalAddressData = new HashMap(); -if (postalAddressData != null) context.put("postalAddressData", postalAddressData); - -telecomNumberData = context.get("telecomNumber"); -if (!tryEntity.booleanValue()) telecomNumberData = parameters; -if (telecomNumberData == null) telecomNumberData = new HashMap(); -if (telecomNumberData != null) context.put("telecomNumberData", telecomNumberData); +contactMechData = context.contactMech; +if (!tryEntity) contactMechData = parameters; +if (!contactMechData) contactMechData = [:]; +if (contactMechData) context.contactMechData = contactMechData; + +partyContactMechData = context.partyContactMech; +if (!tryEntity) partyContactMechData = parameters; +if (!partyContactMechData) partyContactMechData = [:]; +if (partyContactMechData) context.partyContactMechData = partyContactMechData; + +postalAddressData = context.postalAddress; +if (!tryEntity) postalAddressData = parameters; +if (!postalAddressData) postalAddressData = [:]; +if (postalAddressData) context.postalAddressData = postalAddressData; + +telecomNumberData = context.telecomNumber; +if (!tryEntity) telecomNumberData = parameters; +if (!telecomNumberData) telecomNumberData = [:]; +if (telecomNumberData) context.telecomNumberData = telecomNumberData; // load the geo names for selected countries and states/regions -if ( request.getParameter( "countryGeoId" ) != null ) { - geoValue = delegator.findByPrimaryKeyCache( "Geo", UtilMisc.toMap("geoId", request.getParameter("countryGeoId"))); - if ( geoValue != null ) - context.put("selectedCountryName", geoValue.get("geoName") ); -} else if ( postalAddressData != null && postalAddressData.get("countryGeoId") != null ) { - geoValue = delegator.findByPrimaryKeyCache( "Geo", UtilMisc.toMap("geoId", postalAddressData.get("countryGeoId"))); - if ( geoValue != null ) - context.put("selectedCountryName", geoValue.get("geoName") ); +if (parameters.countryGeoId) { + geoValue = delegator.findByPrimaryKeyCache("Geo", [geoId : parameters.countryGeoId]); + if (geoValue) { + context.selectedCountryName = geoValue.geoName; + } +} else if (postalAddressData?.countryGeoId) { + geoValue = delegator.findByPrimaryKeyCache("Geo", [geoId : postalAddressData.countryGeoId]); + if (geoValue) { + context.selectedCountryName = geoValue.geoName; + } } -if ( request.getParameter( "stateProvinceGeoId" ) != null ) { - geoValue = delegator.findByPrimaryKeyCache( "Geo", UtilMisc.toMap("geoId", request.getParameter("stateProvinceGeoId"))); - if ( geoValue != null ) - context.put("selectedStateName", geoValue.get("geoName") ); -} else if ( postalAddressData != null && postalAddressData.get("stateProvinceGeoId") != null ) { - geoValue = delegator.findByPrimaryKeyCache( "Geo", UtilMisc.toMap("geoId", postalAddressData.get("stateProvinceGeoId"))); - if ( geoValue != null ) - context.put("selectedStateName", geoValue.get("geoName") ); +if (parameters.stateProvinceGeoId) { + geoValue = delegator.findByPrimaryKeyCache("Geo", [geoId : parameters.stateProvinceGeoId]); + if (geoValue) { + context.selectedStateName = geoValue.geoName; + } +} else if (postalAddressData?.stateProvinceGeoId) { + geoValue = delegator.findByPrimaryKeyCache("Geo", [geoId : postalAddressData.stateProvinceGeoId]); + if (geoValue) { + context.selectedStateName = geoValue.geoName; + } } - - Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditPaymentMethod.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/editpaymentmethod.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditPaymentMethod.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditPaymentMethod.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/editpaymentmethod.bsh&r1=679885&r2=679994&rev=679994&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/editpaymentmethod.bsh (original) +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditPaymentMethod.groovy Sat Jul 26 06:58:22 2008 @@ -22,44 +22,43 @@ import org.ofbiz.accounting.payment.PaymentWorker; import org.ofbiz.party.contact.ContactMechWorker; -paymentResults = PaymentWorker.getPaymentMethodAndRelated(request, userLogin.getString("partyId")); +paymentResults = PaymentWorker.getPaymentMethodAndRelated(request, userLogin.partyId); //returns the following: "paymentMethod", "creditCard", "giftCard", "eftAccount", "paymentMethodId", "curContactMechId", "donePage", "tryEntity" context.putAll(paymentResults); -curPostalAddressResults = ContactMechWorker.getCurrentPostalAddress(request, userLogin.getString("partyId"), paymentResults.get("curContactMechId")); +curPostalAddressResults = ContactMechWorker.getCurrentPostalAddress(request, userLogin.partyId, paymentResults.curContactMechId); //returns the following: "curPartyContactMech", "curContactMech", "curPostalAddress", "curPartyContactMechPurposes" context.putAll(curPostalAddressResults); -postalAddressInfos = ContactMechWorker.getPartyPostalAddresses(request, userLogin.getString("partyId"), paymentResults.get("curContactMechId")); +postalAddressInfos = ContactMechWorker.getPartyPostalAddresses(request, userLogin.partyId, paymentResults.curContactMechId); context.put("postalAddressInfos", postalAddressInfos); //prepare "Data" maps for filling form input boxes -parameterMap = UtilHttp.getParameterMap(request); -tryEntity = paymentResults.get("tryEntity"); +tryEntity = paymentResults.tryEntity; -creditCardData = paymentResults.get("creditCard"); -if (!tryEntity.booleanValue()) creditCardData = parameterMap; -if (creditCardData == null) creditCardData = new HashMap(); -if (creditCardData != null) context.put("creditCardData", creditCardData); - -giftCardData = paymentResults.get("giftCard"); -if (!tryEntity.booleanValue()) giftCardData = parameterMap; -if (giftCardData == null) giftCardData = new HashMap(); -if (giftCardData != null) context.put("giftCardData", giftCardData); - -eftAccountData = paymentResults.get("eftAccount"); -if (!tryEntity.booleanValue()) eftAccountData = parameterMap; -if (eftAccountData == null) eftAccountData = new HashMap(); -if (eftAccountData != null) context.put("eftAccountData", eftAccountData); - -paymentMethodData = paymentResults.get("paymentMethod"); -if (!tryEntity.booleanValue()) paymentMethodData = parameterMap; -if (paymentMethodData == null) paymentMethodData = new HashMap(); -if (paymentMethodData != null) context.put("paymentMethodData", paymentMethodData); +creditCardData = paymentResults.creditCard; +if (!tryEntity) creditCardData = parameters; +if (!creditCardData) creditCardData = [:]; +if (creditCardData) context.creditCardData = creditCardData; + +giftCardData = paymentResults.giftCard; +if (!tryEntity) giftCardData = parameters; +if (!giftCardData) giftCardData = [:]; +if (giftCardData) context.giftCardData = giftCardData; + +eftAccountData = paymentResults.eftAccount; +if (!tryEntity) eftAccountData = parameters; +if (!eftAccountData) eftAccountData = [:]; +if (eftAccountData) context.eftAccountData = eftAccountData; + +paymentMethodData = paymentResults.paymentMethod; +if (!tryEntity) paymentMethodData = parameters; +if (!paymentMethodData) paymentMethodData = [:]; +if (paymentMethodData) context.paymentMethodData = paymentMethodData; //prepare security flag -if (!security.hasEntityPermission("PARTYMGR", "_VIEW", session) && (context.get("creditCard") != null || context.get("giftCard") != null || context.get("eftAccount") != null) && context.get("paymentMethod") != null && !userLogin.get("partyId").equals((context.get("paymentMethod")).get("partyId"))) { - context.put("canNotView", true); +if (!security.hasEntityPermission("PARTYMGR", "_VIEW", session) && (context.creditCard || context.giftCard || context.eftAccount) && context.paymentMethod && !userLogin.partyId.equals(context.paymentMethod.partyId)) { + context.canNotView = true; } else { - context.put("canNotView", false); + context.canNotView = false; } Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditPerson.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/editperson.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditPerson.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditPerson.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/editperson.bsh&r1=679885&r2=679994&rev=679994&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/editperson.bsh (original) +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/EditPerson.groovy Sat Jul 26 06:58:22 2008 @@ -18,28 +18,24 @@ */ import java.util.HashMap; -; import org.ofbiz.base.util.UtilHttp; -userLogin = session.getAttribute("userLogin"); person = null; -if (userLogin != null) { +if (userLogin) { person = userLogin.getRelatedOne("Person"); } tryEntity = true; -errorMessage = request.getAttribute("_ERROR_MESSAGE_"); -if (errorMessage != null && errorMessage.length() > 0) { +errorMessage = parameters._ERROR_MESSAGE_; +if (errorMessage) { tryEntity = false; } personData = person; if (!tryEntity) personData = UtilHttp.getParameterMap(request); -if (personData == null) personData = new HashMap(); +if (!personData) personData = [:]; -donePage = request.getParameter("DONE_PAGE"); -if (donePage == null || donePage.length() == 0) donePage = "viewprofile"; - -context.put("person", person); -context.put("personData", personData); -context.put("donePage", donePage); +donePage = parameters.DONE_PAGE ?: "viewprofile"; +context.person = person; +context.personData = personData; +context.donePage = donePage; Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/GiftCardBalance.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/giftcardbalance.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/GiftCardBalance.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/GiftCardBalance.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/giftcardbalance.bsh&r1=679885&r2=679994&rev=679994&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/giftcardbalance.bsh (original) +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/GiftCardBalance.groovy Sat Jul 26 06:58:22 2008 @@ -18,5 +18,4 @@ */ import org.ofbiz.product.store.*; - context.put("paymentProperties", ProductStoreWorker.getProductStorePaymentProperties(request, "GIFT_CARD", null, true)); - + context.paymentProperties = ProductStoreWorker.getProductStorePaymentProperties(request, "GIFT_CARD", null, true); Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/GiftCardLink.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/giftcardlink.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/GiftCardLink.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/GiftCardLink.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/giftcardlink.bsh&r1=679885&r2=679994&rev=679994&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/giftcardlink.bsh (original) +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/GiftCardLink.groovy Sat Jul 26 06:58:22 2008 @@ -17,18 +17,17 @@ * under the License. */ - import org.ofbiz.product.store.*; +import org.ofbiz.product.store.*; - processResult = request.getAttribute("processResult"); - if (processResult != null) { - if (!processResult) { - request.setAttribute("_ERROR_MESSAGE_", "<li>There was a problem linking your cards. Please check the numbers and try again.</li>"); - request.removeAttribute("_EVENT_MESSAGE_"); - } else { - request.setAttribute("_EVENT_MESSAGE_", "<li>Thank-you. Your gift card account is now linked.</li>"); - } - } +processResult = parameters.processResult; +if (processResult != null) { + if (!processResult) { + request.setAttribute("_ERROR_MESSAGE_", "<li>There was a problem linking your cards. Please check the numbers and try again.</li>"); + request.removeAttribute("_EVENT_MESSAGE_"); + } else { + request.setAttribute("_EVENT_MESSAGE_", "<li>Thank-you. Your gift card account is now linked.</li>"); + } +} - userLogin = session.getAttribute("userLogin"); - context.put("userLogin", userLogin); - context.put("paymentProperties", ProductStoreWorker.getProductStorePaymentProperties(request, "GIFT_CARD", null, true)); +context.userLogin = userLogin; +context.paymentProperties = ProductStoreWorker.getProductStorePaymentProperties(request, "GIFT_CARD", null, true); Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/NewCustomer.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/newcustomer.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/NewCustomer.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/NewCustomer.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/newcustomer.bsh&r1=679885&r2=679994&rev=679994&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/newcustomer.bsh (original) +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/NewCustomer.groovy Sat Jul 26 06:58:22 2008 @@ -20,42 +20,32 @@ import org.ofbiz.base.util.UtilMisc; import org.ofbiz.product.store.ProductStoreWorker; -delegator = request.getAttribute("delegator"); - productStore = ProductStoreWorker.getProductStore(request); -context.put("productStoreId", productStore.get("productStoreId")); -context.put("productStore", productStore); +context.productStoreId = productStore.productStoreId; +context.productStore = productStore; -if ("Y".equals(productStore.getString("allowPassword"))) { - context.put("createAllowPassword", true); -} else { - context.put("createAllowPassword", false); -} - -if ("Y".equals(productStore.getString("usePrimaryEmailUsername"))) { - context.put("getUsername", false); -} else { - context.put("getUsername", true); -} +context.createAllowPassword = "Y".equals(productStore.allowPassword); +context.getUsername = !"Y".equals(productStore.usePrimaryEmailUsername); // load the geo names for selected countries and states/regions -if (request.getParameter("CUSTOMER_COUNTRY") != null) { - geoValue = delegator.findByPrimaryKeyCache( "Geo", UtilMisc.toMap("geoId", request.getParameter("CUSTOMER_COUNTRY"))); - if (geoValue != null) - context.put("selectedCountryName", geoValue.get("geoName") ); +if (parameters.CUSTOMER_COUNTRY) { + geoValue = delegator.findByPrimaryKeyCache("Geo", [geoId : parameters.CUSTOMER_COUNTRY]); + if (geoValue) { + context.selectedCountryName = geoValue.geoName; + } } -if (request.getParameter("CUSTOMER_STATE") != null) { - geoValue = delegator.findByPrimaryKeyCache( "Geo", UtilMisc.toMap("geoId", request.getParameter("CUSTOMER_STATE"))); - if ( geoValue != null ) - context.put("selectedStateName", geoValue.get("geoName") ); +if (parameters.CUSTOMER_STATE) { + geoValue = delegator.findByPrimaryKeyCache("Geo", [geoId : parameters.CUSTOMER_STATE]); + if (geoValue) { + context.selectedStateName = geoValue.geoName; + } } -previousParams = session.getAttribute("_PREVIOUS_PARAMS_"); -if (previousParams != null && previousParams.length() > 0) { +previousParams = parameters._PREVIOUS_PARAMS_; +if (previousParams) { previousParams = "?" + previousParams; } else { previousParams = ""; } -context.put("previousParams", previousParams); - +context.previousParams = previousParams; Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/ViewProfile.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/viewprofile.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/ViewProfile.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/ViewProfile.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/viewprofile.bsh&r1=679885&r2=679994&rev=679994&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/viewprofile.bsh (original) +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/ViewProfile.groovy Sat Jul 26 06:58:22 2008 @@ -28,69 +28,69 @@ import org.ofbiz.accounting.payment.PaymentWorker; productStoreId = ProductStoreWorker.getProductStoreId(request); -context.put("productStoreId", productStoreId); +context.productStoreId = productStoreId; -if (userLogin != null) { - profiledefs = delegator.findByPrimaryKey("PartyProfileDefault", UtilMisc.toMap("partyId", partyId, "productStoreId", productStoreId)); - - showOld = "true".equals(request.getParameter("SHOW_OLD")); - - partyContactMechValueMaps = ContactMechWorker.getPartyContactMechValueMaps(delegator, userLogin.getString("partyId"), showOld); - paymentMethodValueMaps = PaymentWorker.getPartyPaymentMethodValueMaps(delegator, userLogin.getString("partyId"), showOld); - - context.put("profiledefs", profiledefs); - context.put("showOld", showOld); - context.put("partyContactMechValueMaps", partyContactMechValueMaps); - context.put("paymentMethodValueMaps", paymentMethodValueMaps); +if (userLogin) { + profiledefs = delegator.findByPrimaryKey("PartyProfileDefault", [partyId : partyId, productStoreId : productStoreId]); + + showOld = "true".equals(parameters.SHOW_OLD); + + partyContactMechValueMaps = ContactMechWorker.getPartyContactMechValueMaps(delegator, userLogin.partyId, showOld); + paymentMethodValueMaps = PaymentWorker.getPartyPaymentMethodValueMaps(delegator, userLogin.partyId, showOld); + + context.profiledefs = profiledefs; + context.showOld = showOld; + context.partyContactMechValueMaps = partyContactMechValueMaps; + context.paymentMethodValueMaps = paymentMethodValueMaps; // shipping methods - for default selection - if (profiledefs != null && profiledefs.get("defaultShipAddr") != null) { - shipAddress = delegator.findByPrimaryKey("PostalAddress", UtilMisc.toMap("contactMechId", profiledefs.get("defaultShipAddr"))); - if (shipAddress != null) { - carrierShipMeths = ProductStoreWorker.getAvailableStoreShippingMethods(delegator, productStoreId, shipAddress, UtilMisc.toList(new Double(1)), null, 0, 1); - context.put("carrierShipMethods", carrierShipMeths); + if (profiledefs?.defaultShipAddr) { + shipAddress = delegator.findByPrimaryKey("PostalAddress", [contactMechId : profiledefs.defaultShipAddr]); + if (shipAddress) { + carrierShipMeths = ProductStoreWorker.getAvailableStoreShippingMethods(delegator, productStoreId, shipAddress, [1], null, 0, 1); + context.carrierShipMethods = carrierShipMeths; } } profileSurveys = ProductStoreWorker.getProductSurveys(delegator, productStoreId, null, "CUSTOMER_PROFILE"); - context.put("surveys", profileSurveys); + context.surveys = profileSurveys; - orderBy = UtilMisc.toList("-entryDate"); + orderBy = ["-entryDate"]; findOpts = new EntityFindOptions(); findOpts.setMaxRows(5); - exprs = UtilMisc.toList(EntityCondition.makeCondition("partyIdTo", EntityOperator.EQUALS, partyId)); + exprs = [EntityCondition.makeCondition("partyIdTo", EntityOperator.EQUALS, partyId)]; exprs.add(EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "COM_READ")); condition = EntityCondition.makeCondition(exprs, EntityOperator.AND); messages = delegator.findList("CommunicationEvent", condition, null, orderBy, findOpts, false); - context.put("messages", messages); - context.put("profileMessages", true); + context.messages = messages; + context.profileMessages = true; - partyContent = delegator.findByAnd("ContentRole", UtilMisc.toMap("partyId", partyId, "roleTypeId", "OWNER")); + partyContent = delegator.findByAnd("ContentRole", [partyId : partyId, roleTypeId : "OWNER"]); partyContent = EntityUtil.filterByDate(partyContent); - context.put("partyContent", partyContent); + context.partyContent = partyContent; - mimeTypes = delegator.findList("MimeType", null, null, UtilMisc.toList("description", "mimeTypeId"), null, false); - context.put("mimeTypes", mimeTypes); + mimeTypes = delegator.findList("MimeType", null, null, ["description", "mimeTypeId"], null, false); + context.mimeTypes = mimeTypes; - partyContentTypes = delegator.findList("PartyContentType", null, null, UtilMisc.toList("description"), null, false); - context.put("partyContentTypes", partyContentTypes); + partyContentTypes = delegator.findList("PartyContentType", null, null, ["description"], null, false); + context.partyContentTypes = partyContentTypes; // call the getOrderedSummaryInformation service to get the sub-total of valid orders in last X months - monthsToInclude = new Integer(12); - Map serviceIn = UtilMisc.toMap("partyId", partyId, "roleTypeId", "PLACING_CUSTOMER", "orderTypeId", "SALES_ORDER", "statusId", "ORDER_COMPLETED", "monthsToInclude", monthsToInclude, "userLogin", userLogin); - Map result = dispatcher.runSync("getOrderedSummaryInformation", serviceIn); - context.put("monthsToInclude", monthsToInclude); - context.put("totalSubRemainingAmount", result.get("totalSubRemainingAmount")); - context.put("totalOrders", result.get("totalOrders")); - - contactListPartyList = delegator.findByAnd("ContactListParty", UtilMisc.toMap("partyId", partyId), UtilMisc.toList("-fromDate")); + monthsToInclude = 12; + serviceIn = [partyId : partyId, roleTypeId : "PLACING_CUSTOMER", orderTypeId : "SALES_ORDER", statusId : "ORDER_COMPLETED", monthsToInclude : monthsToInclude, userLogin : userLogin]; + result = dispatcher.runSync("getOrderedSummaryInformation", serviceIn); + context.monthsToInclude = monthsToInclude; + context.totalSubRemainingAmount = result.totalSubRemainingAmount; + context.totalOrders = result.totalOrders; + + contactListPartyList = delegator.findByAnd("ContactListParty", [partyId : partyId], ["-fromDate"]); // show all, including history, ie don't filter: contactListPartyList = EntityUtil.filterByDate(contactListPartyList, true); - context.put("contactListPartyList", contactListPartyList); + context.contactListPartyList = contactListPartyList; - publicContactLists = delegator.findByAnd("ContactList", UtilMisc.toMap("isPublic", "Y"), UtilMisc.toList("contactListName")); - context.put("publicContactLists", publicContactLists); + publicContactLists = delegator.findByAnd("ContactList", [isPublic : "Y"], ["contactListName"]); + context.publicContactLists = publicContactLists; - partyAndContactMechList = delegator.findByAnd("PartyAndContactMech", UtilMisc.toMap("partyId", partyId), UtilMisc.toList("-fromDate")); - partyAndContactMechList = EntityUtil.filterByDate(partyAndContactMechList, true); - context.put("partyAndContactMechList", partyAndContactMechList); + partyAndContactMechList = delegator.findByAnd("PartyAndContactMech", [partyId : partyId], ["-fromDate"]); + partyAndContactMechList = EntityUtil.filterByDate(partyAndContactMechList); + context.partyAndContactMechList = partyAndContactMechList; } Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/ContentAddPrep.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/contentaddprep.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/ContentAddPrep.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/ContentAddPrep.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/contentaddprep.bsh&r1=679885&r2=679994&rev=679994&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/contentaddprep.bsh (original) +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/ContentAddPrep.groovy Sat Jul 26 06:58:22 2008 @@ -45,58 +45,51 @@ import javax.servlet.*; import javax.servlet.http.*; -singleWrapper = context.get("singleWrapper"); -singleWrapper.putInContext("contentPurposeTypeId", page.get("contentPurposeTypeId")); -singleWrapper.putInContext("contentAssocTypeId", page.get("contentAssocTypeId")); -servletContext = session.getServletContext(); -String rootPubPt = (String) servletContext.getAttribute("webSiteId"); +singleWrapper = context.singleWrapper; +singleWrapper.putInContext("contentPurposeTypeId", page.contentPurposeTypeId); +singleWrapper.putInContext("contentAssocTypeId", page.contentAssocTypeId); +rootPubPt = parameters.webSiteId; paramMap = UtilHttp.getParameterMap(request); contentIdTo = ContentManagementWorker.getFromSomewhere("forumId", paramMap, request, context); -context.put("contentIdTo", contentIdTo); +context.contentIdTo = contentIdTo; //Debug.logInfo("in contentaddprep, contentIdTo:" + contentIdTo,""); //Debug.logInfo("in contentaddprep, paramMap:" + paramMap,""); -attrList = delegator.findByAndCache("ContentAttribute", UtilMisc.toMap("contentId", contentIdTo, "attrName", "publishOperation")); -String publishOperation = null; -if (attrList.size() > 0) { +attrList = delegator.findByAndCache("ContentAttribute", [contentId : contentIdTo, attrName : "publishOperation"]); +publishOperation = null; +if (attrList) { contentAttribute = attrList.get(0); - publishOperation = contentAttribute.get("attrValue"); + publishOperation = contentAttribute.attrValue; //Debug.logInfo("in contentaddprep, publishOperation:" + publishOperation,""); } singleWrapper.putInContext("publishOperation", publishOperation); singleWrapper.putInContext("contentIdTo", contentIdTo); //singleWrapper.putInContext("ownerContentId", contentIdTo); -summaryDataResourceTypeId = page.get("summaryDataResourceTypeId"); +summaryDataResourceTypeId = page.summaryDataResourceTypeId; singleWrapper.putInContext("summaryDataResourceTypeId", summaryDataResourceTypeId); -targetOperation = page.get("targetOperation"); -if (UtilValidate.isEmpty(targetOperation)) { - targetOperation = "CONTENT_CREATE"; -} +targetOperation = page.targetOperation ?: "CONTENT_CREATE"; singleWrapper.putInContext("targetOperation", targetOperation); singleWrapper.putInContext("contentTypeId", "DOCUMENT"); -contentPurpose = page.get("contentPurpose"); -if (UtilValidate.isEmpty(contentPurpose)) { - contentPurpose = "ARTICLE"; -} +contentPurpose = page.contentPurpose ?: "ARTICLE"; singleWrapper.putInContext("contentPurpose", contentPurpose); singleWrapper.putInContext("forumId", contentIdTo); -forumContent = delegator.findByPrimaryKeyCache("Content", UtilMisc.toMap("contentId", contentIdTo)); +forumContent = delegator.findByPrimaryKeyCache("Content", [contentId : contentIdTo]); statusId = "CTNT_PUBLISHED"; -if (forumContent != null) { - statusId = forumContent.getString("statusId"); - if (UtilValidate.isEmpty(statusId)) { - statusId = page.get("statusId"); +if (forumContent) { + statusId = forumContent.statusId; + if (!statusId) { + statusId = page.statusId; } - if (UtilValidate.isEmpty(statusId)) { + if (!statusId) { statusId = "CTNT_PUBLISHED"; } } singleWrapper.putInContext("statusId", statusId); -siteAncestorList = new ArrayList(); +siteAncestorList = []; siteAncestorList.add(contentIdTo); -context.put("siteAncestorList", siteAncestorList); +context.siteAncestorList = siteAncestorList; //Debug.logInfo("in viewprep, siteAncestorList:" + siteAncestorList,""); Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/ContentPrep.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/contentprep.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/ContentPrep.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/ContentPrep.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/contentprep.bsh&r1=679885&r2=679994&rev=679994&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/contentprep.bsh (original) +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/ContentPrep.groovy Sat Jul 26 06:58:22 2008 @@ -40,104 +40,93 @@ // load edit or create Content form -dispatcher = (LocalDispatcher)request.getAttribute("dispatcher"); -delegator = (GenericDelegator) request.getAttribute("delegator"); - -ServletContext servletContext = session.getServletContext(); -String rootPubPt = (String) servletContext.getAttribute("webSiteId"); -//security = (Security)session.getAttribute("security"); -security = (Security)request.getAttribute("security"); +rootPubPt = parameters.webSiteId; //Debug.logInfo("in contentprep, security:" + security, ""); -userLogin = session.getAttribute("userLogin"); -GenericValue currentValue = null; -singleWrapper = context.get("singleWrapper"); +singleWrapper = context.singleWrapper; paramMap = UtilHttp.getParameterMap(request); contentId = ""; -if (UtilValidate.isEmpty(contentId)) - contentId = (String)ContentManagementWorker.getFromSomewhere("masterContentId", paramMap, request, context); -if (UtilValidate.isEmpty(contentId)) - contentId = (String)ContentManagementWorker.getFromSomewhere("contentIdTo", paramMap, request, context); -if (UtilValidate.isEmpty(contentId)) - contentId = (String)ContentManagementWorker.getFromSomewhere("contentId", paramMap, request, context); +contentId = ContentManagementWorker.getFromSomewhere("masterContentId", paramMap, request, context); +if (!contentId) + contentId = ContentManagementWorker.getFromSomewhere("contentIdTo", paramMap, request, context); +if (!contentId) + contentId = ContentManagementWorker.getFromSomewhere("contentId", paramMap, request, context); //Debug.logInfo("in contentprep, contentId(1):" + contentId, ""); -if (currentValue == null) { - currentValue = (GenericValue)request.getAttribute("currentValue"); +currentValue = parameters.currentValue; //Debug.logInfo("in contentprep, currentValue(0):" + currentValue, ""); + +if (!contentId && currentValue) { + contentId = currentValue.contentId; } -if (UtilValidate.isEmpty(contentId) && currentValue != null) { - contentId = currentValue.getString("contentId"); -} -if (UtilValidate.isNotEmpty(contentId) && currentValue == null) { - currentValue = delegator.findByPrimaryKeyCache("Content", UtilMisc.toMap("contentId", contentId)); +if (contentId && !currentValue) { + currentValue = delegator.findByPrimaryKeyCache("Content", [contentId : contentId]); } //Debug.logInfo("in contentprep, currentValue(1):" + currentValue, ""); //Debug.logInfo("in contentprep, contentId(4):" + contentId, ""); -Locale locale = Locale.getDefault(); -if (currentValue != null) { - dataResourceId = (String)currentValue.get("dataResourceId"); - context.put("contentId", contentId); - context.put("contentName", currentValue.get("contentName")); - context.put("description", currentValue.get("description")); - context.put("statusId", currentValue.get("statusId")); +if (currentValue) { + dataResourceId = currentValue.dataResourceId; + context.contentId = contentId; + context.contentName = currentValue.contentName; + context.description = currentValue.description; + context.statusId = currentValue.statusId; - mimeTypeId = (String)currentValue.get("mimeTypeId"); + mimeTypeId = currentValue.mimeTypeId; rootDir = request.getSession().getServletContext().getRealPath("/"); wrapper = BeansWrapper.getDefaultInstance(); WrappingTemplateModel.setDefaultObjectWrapper(wrapper); //templateRoot = new SimpleHash(wrapper); - templateRoot = new HashMap(); + templateRoot = [:]; FreeMarkerViewHandler.prepOfbizRoot(templateRoot, request, response); - ctx = new HashMap(); - ctx.put("rootDir", rootDir); + ctx = [:]; + ctx.rootDir = rootDir; // webSiteId and https need to go here, too - templateRoot.put("context", ctx); - fromDate = UtilDateTime.nowTimestamp(); + templateRoot.context = ctx; + fromDate = nowTimestamp; assocTypes = null; - //assocTypes = UtilMisc.toList("SUB_CONTENT"); + //assocTypes = ["SUB_CONTENT"]; subContentDataResourceView = ContentWorker.getSubContent(delegator, contentId, "ARTICLE", null, userLogin, assocTypes, fromDate); - if (subContentDataResourceView != null) { + if (subContentDataResourceView) { out = new StringWriter(); ContentWorker.renderContentAsText(dispatcher, delegator, null, out, templateRoot, subContentDataResourceView, locale, mimeTypeId, true); textData = out.toString(); - context.put("txtContentId", subContentDataResourceView.get("contentId")); - context.put("txtDataResourceId", subContentDataResourceView.get("dataResourceId")); - context.put("textData", textData); + context.txtContentId = subContentDataResourceView.contentId; + context.txtDataResourceId = subContentDataResourceView.dataResourceId; + context.textData = textData; //Debug.logInfo("textId:" + txtContentId, ""); //Debug.logInfo("textData:" + textData, ""); - if (singleWrapper != null) { + if (singleWrapper) { //Debug.logInfo("textData:" + textData, ""); singleWrapper.putInContext("textData", textData); } } subContentDataResourceView = ContentWorker.getSubContent(dispatcher, delegator, contentId, "SUMMARY", null, userLogin, assocTypes, fromDate, true); - if (subContentDataResourceView != null) { + if (subContentDataResourceView) { out = new StringWriter(); ContentWorker.renderContentAsText(delegator, null, out, templateRoot, subContentDataResourceView, locale, mimeTypeId); summaryData = out.toString(); - context.put("sumContentId", subContentDataResourceView.get("contentId")); - context.put("sumDataResourceId", subContentDataResourceView.get("dataResourceId")); - context.put("summaryData", summaryData); + context.sumContentId = subContentDataResourceView.contentId; + context.sumDataResourceId = subContentDataResourceView.dataResourceId; + context.summaryData = summaryData; //Debug.logInfo("sumId:" + sumContentId, ""); //Debug.logInfo("summaryData:" + summaryData, ""); - if (singleWrapper != null) { + if (singleWrapper) { //Debug.logInfo("summaryData:" + summaryData, ""); singleWrapper.putInContext("summaryData", summaryData); } } subContentDataResourceView = ContentWorker.getSubContent(dispatcher, delegator, contentId, "IMAGE", null, userLogin, assocTypes, fromDate, true); - if (subContentDataResourceView != null) { + if (subContentDataResourceView) { out = new StringWriter(); ContentWorker.renderContentAsText(delegator, null, out, templateRoot, subContentDataResourceView, locale, mimeTypeId); imageData = out.toString(); - context.put("imgContentId", subContentDataResourceView.get("contentId")); - context.put("imgDataResourceId", subContentDataResourceView.get("dataResourceId")); - context.put("imageData", imageData); + context.imgContentId = subContentDataResourceView.contentId; + context.imgDataResourceId = subContentDataResourceView.dataResourceId; + context.imageData = imageData; } } |
Free forum by Nabble | Edit this page |