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/26 15:58:24 UTC
svn commit: r679994 [2/3] - in /ofbiz/trunk/applications/ecommerce:
webapp/ecommerce/WEB-INF/actions/cart/
webapp/ecommerce/WEB-INF/actions/catalog/
webapp/ecommerce/WEB-INF/actions/content/
webapp/ecommerce/WEB-INF/actions/customer/ webapp/ecommerce/W...
Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/CurrentValPrep.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/currentvalprep.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/CurrentValPrep.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/CurrentValPrep.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/currentvalprep.bsh&r1=679885&r2=679994&rev=679994&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/currentvalprep.bsh (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/CurrentValPrep.groovy Sat Jul 26 06:58:22 2008
@@ -37,70 +37,65 @@
import javax.servlet.*;
import javax.servlet.http.*;
-LocalDispatcher dispatcher = (LocalDispatcher)request.getAttribute("dispatcher");
-GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator");
-Map parameters = context.get("parameters");
+
currentEntityMap = session.getAttribute("currentEntityMap");
-if (currentEntityMap == null) {
- currentEntityMap = new HashMap();
+if (!currentEntityMap) {
+ currentEntityMap = [:];
session.setAttribute("currentEntityMap", currentEntityMap);
}
-entityName = context.get("entityName");
-currentEntityPropertyName = parameters.get("currentEntityPropertyName");
-if (currentEntityPropertyName == null) {
+entityName = context.entityName;
+currentEntityPropertyName = parameters.currentEntityPropertyName;
+if (!currentEntityPropertyName) {
currentEntityName = entityName;
} else {
- currentEntityName = parameters.get(currentEntityPropertyName);
+ currentEntityName = parameters[currentEntityPropertyName];
}
//Debug.logInfo("in currentvalprep, currentEntityName:" + currentEntityName,"");
-cachedPK = currentEntityMap.get(currentEntityName);
+cachedPK = currentEntityMap[currentEntityName];
//Debug.logInfo("in currentvalprep, cachedPK:" + cachedPK,"");
// Build a key from param or attribute values.
-Map paramMap = UtilHttp.getParameterMap(request);
+paramMap = UtilHttp.getParameterMap(request);
//Debug.logInfo("paramMap:" + paramMap, null);
-GenericValue v = delegator.makeValue(currentEntityName);
+v = delegator.makeValue(currentEntityName);
passedPK = v.getPrimaryKey();
keyColl = passedPK.getAllKeys();
keyIt = keyColl.iterator();
while (keyIt.hasNext()) {
- attrName = (String)keyIt.next();
- attrVal = request.getAttribute(attrName);
- if (attrVal == null) {
- attrVal = paramMap.get(attrName);
- }
+ attrName = keyIt.next();
+ attrVal = parameters[attrName];
//Debug.logInfo("in currentvalprep, attrName:" + attrName,"");
//Debug.logInfo("in currentvalprep, attrVal:" + attrVal,"");
- if (attrVal != null && attrVal != void) {
- passedPK.put(attrName,attrVal);
+ if (attrVal) {
+ passedPK[attrName] = attrVal;
}
}
//Debug.logInfo("in currentvalprep, passedPK:" + passedPK,"");
// messed up code to determine whether or not the cached or passed keys have missing fields,
// in which case, the valid one is used to retrieve the current value
-boolean pksEqual = true;
-if (cachedPK != null) {
+pksEqual = true;
+if (cachedPK) {
keyColl = cachedPK.getPrimaryKey().getAllKeys();
keyIt = keyColl.iterator();
while (keyIt.hasNext()) {
- String sCached = null;
- String sPassed = null;
- Object oCached = null;
- Object oCached = null;
- String ky = (String)keyIt.next();
- oPassed = passedPK.get(ky);
- if (oPassed != null) {
- sPassed = oPassed.toString();
- if (sPassed == null || sPassed.length() == 0) {
+ sCached = null;
+ sPassed = null;
+ oCached = null;
+ oCached = null;
+ ky = keyIt.next();
+ oPassed = passedPK[ky];
+ if (oPassed) {
+ sPassed = oPassed;
+ if (!sPassed) {
pksEqual = false;
} else {
- oCached = cachedPK.get(ky);
- if (oCached != null) {
- sCached = oCached.toString();
- if (sPassed == null || sPassed.length() == 0) {
+ oCached = cachedPK[ky];
+ if (oCached) {
+ sCached = oCached;
+ if (!sPassed) {
pksEqual = false;
} else {
if (!sPassed.equals(sCached)) {
@@ -122,66 +117,33 @@
}
//Debug.logInfo("in currentvalprep, currentPK:" + currentPK,"");
-currentEntityMap.put(currentEntityName, currentPK);
+currentEntityMap[currentEntityName] = currentPK;
request.setAttribute("currentPK", currentPK);
-context.put("currentPK", currentPK);
+context.currentPK = currentPK;
currentValue = delegator.findOne(currentPK.getPrimaryKey().getEntityName(), currentPK.getPrimaryKey(), false);
-context.put("currentValue", currentValue);
+context.currentValue = currentValue;
request.setAttribute("currentValue", currentValue);
// Debug.logInfo("===========in currentvalprep, currentValue:" + request.getAttribute("currentValue"),"");
-if (currentValue != null) {
+if (currentValue) {
if (currentEntityName.indexOf("DataResource") >= 0) {
- String suffix = "";
- String s = null;
- try {
- s = (String)currentValue.get("dataResourceTypeId");
- if (UtilValidate.isNotEmpty(s)) {
- suffix = "_" + s;
- }
- } catch(IllegalArgumentException e) {
- // ignore
- }
- try {
- if (UtilValidate.isEmpty(suffix)) {
- s = (String)currentValue.get("drDataResourceTypeId");
- if (UtilValidate.isNotEmpty(s)) {
- suffix += "_" + s;
- }
- }
- } catch(IllegalArgumentException e) {
- // ignore
- }
-
- if (UtilValidate.isNotEmpty(suffix) && suffix.equals("_ELECTRONIC_TEXT")) {
- try {
- s = (String)currentValue.get("mimeTypeId");
- if (UtilValidate.isNotEmpty(s)) {
- suffix += "_" + s;
- }
- } catch (IllegalArgumentException e) {
- // ignore
- }
- try {
- if (UtilValidate.isEmpty(s)) {
- s = (String)currentValue.get("drMimeTypeId");
- if (UtilValidate.isNotEmpty(s)) {
- suffix += "_" + s;
- }
- }
- } catch(IllegalArgumentException e) {
- // ignore
- }
+ suffix = "";
+ s = currentValue.dataResourceTypeId ?: currentValue.drDataResourceTypeId;
+ if (s) suffix = "_" + s;
+
+ if ("_ELECTRONIC_TEXT".equals(suffix)) {
+ s = currentValue.mimeTypeId ?: currentValue.drMimeTypeId;
+ if (s) suffix += "_" + s;
}
//Debug.logInfo("in currentvalprep, suffix:" + suffix,"");
-// if (UtilValidate.isNotEmpty(suffix)) {
-// ContentManagementWorker.mruAdd(session, (GenericEntity)currentPK, suffix);
+// if (suffix) {
+// ContentManagementWorker.mruAdd(session, currentPK, suffix);
// } else {
- ContentManagementWorker.mruAdd(session, (GenericEntity)currentPK);
+ ContentManagementWorker.mruAdd(session, currentPK);
// }
} else {
- ContentManagementWorker.mruAdd(session, (GenericEntity)currentPK);
+ ContentManagementWorker.mruAdd(session, currentPK);
}
}
//Debug.logInfo("in currentvalprep, contentId:" + request.getAttribute("contentId"),"");
Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/EditAddPrep.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/editaddprep.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/EditAddPrep.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/EditAddPrep.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/editaddprep.bsh&r1=679885&r2=679994&rev=679994&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/editaddprep.bsh (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/EditAddPrep.groovy Sat Jul 26 06:58:22 2008
@@ -45,17 +45,13 @@
import javax.servlet.*;
import javax.servlet.http.*;
-delegator = (GenericDelegator) request.getAttribute("delegator");
-userLogin = session.getAttribute("userLogin");
-paramMap = UtilHttp.getParameterMap(request);
-
-singleWrapper = context.get("singleWrapper");
-contentIdTo = paramMap.get("contentIdTo");
+singleWrapper = context.singleWrapper;
+contentIdTo = parameters.contentIdTo;
singleWrapper.putInContext("contentIdTo", contentIdTo);
-mapKey = paramMap.get("mapKey");
+mapKey = parameters.mapKey;
singleWrapper.putInContext("mapKey", mapKey);
-if (mapKey != null && mapKey.equals("SUMMARY")) {
+if ("SUMMARY".equals(mapKey)) {
singleWrapper.putInContext("textSource", "summaryData");
} else {
singleWrapper.putInContext("textSource", "textData");
@@ -68,30 +64,27 @@
//currentValue = request.getAttribute("currentValue");
//currentValue = request.getAttribute("currentValue");
-currentValue = ContentWorker.getSubContentCache(delegator, contentIdTo, mapKey, null, userLogin, null, null, new Boolean(false), null);
+currentValue = ContentWorker.getSubContentCache(delegator, contentIdTo, mapKey, null, userLogin, null, null, false, null);
//Debug.logInfo("in editaddprep, currentValue:" + currentValue,"");
-if (currentValue == null) {
- parentValue = delegator.findByPrimaryKeyCache("Content", UtilMisc.toMap("contentId", contentIdTo));
+if (!currentValue) {
+ parentValue = delegator.findByPrimaryKeyCache("Content", [contentId : contentIdTo]);
currentValue = delegator.makeValue("Content");
- subject = parentValue.get("contentName");
- if (mapKey != null && mapKey.equals("SUMMARY")) {
+ subject = parentValue.contentName;
+ if ("SUMMARY".equals(mapKey)) {
subject = "Short " + subject;
}
- currentValue.put("contentName", subject);
- currentValue.put("description", subject);
+ currentValue.contentName = subject;
+ currentValue.description = subject;
singleWrapper.putInContext("contentTypeId", "DOCUMENT");
} else {
singleWrapper.putInContext("contentTypeId", null);
//Debug.logInfo("in editaddprep, currentValue:" + currentValue,"");
}
singleWrapper.putInContext("currentValue", currentValue);
-context.put("currentValue", currentValue);
+context.currentValue = currentValue;
request.setAttribute("currentValue", currentValue);
-persistAction = paramMap.get("persistAction");
+persistAction = parameters.persistAction ?: "persistContent";
-if (UtilValidate.isEmpty(persistAction)) {
- persistAction = "persistContent";
-}
singleWrapper.putInContext("persistAction", persistAction);
//Debug.logInfo("in editaddprep, currentValue:" + currentValue,"");
Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/FormPrep.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/formprep.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/FormPrep.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/FormPrep.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/formprep.bsh&r1=679885&r2=679994&rev=679994&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/formprep.bsh (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/FormPrep.groovy Sat Jul 26 06:58:22 2008
@@ -41,23 +41,22 @@
import javax.servlet.*;
import javax.servlet.http.*;
-formDefFile = page.get("formDefFile");
-singleFormName = page.get("singleFormName");
+formDefFile = page.formDefFile;
+singleFormName = page.singleFormName;
//org.ofbiz.base.util.Debug.logInfo("in formprep, singleFormName:" + singleFormName, null);
-entityName = page.get("entityName");
-//String defaultMapName = page.get("defaultMapName");
-//if( defaultMapName == null) defaultMapName = "currentValue";
+entityName = page.entityName;
+//defaultMapName = page.defaultMapName;
+//if(!defaultMapName) defaultMapName = "currentValue";
defaultMapName = "currentValue";
-HtmlFormWrapper singleWrapper = new HtmlFormWrapper(formDefFile, singleFormName, request, response);
+singleWrapper = new HtmlFormWrapper(formDefFile, singleFormName, request, response);
// The idea here is that by setting the map name here, dependency on the
// widget-form config file could be eliminated.
-ModelForm modelForm = singleWrapper.getModelForm();
+modelForm = singleWrapper.getModelForm();
//modelForm.setDefaultMapName(defaultMapName);
-currentValue = (GenericValue) request.getAttribute("currentValue");
+currentValue = request.getAttribute("currentValue");
//org.ofbiz.base.util.Debug.logInfo("in formprep, currentValue:" + currentValue, null);
singleWrapper.putInContext(defaultMapName, currentValue);
-context.put("singleWrapper", singleWrapper);
+context.singleWrapper = singleWrapper;
request.setAttribute("singleWrapper", singleWrapper);
-
Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/HtmlAreaPrep.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/htmlareaprep.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/HtmlAreaPrep.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/HtmlAreaPrep.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/htmlareaprep.bsh&r1=679885&r2=679994&rev=679994&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/htmlareaprep.bsh (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/HtmlAreaPrep.groovy Sat Jul 26 06:58:22 2008
@@ -36,10 +36,8 @@
import javax.servlet.*;
import javax.servlet.http.*;
-paramMap = UtilHttp.getParameterMap(request);
-contentIdTo = (String)paramMap.get("contentIdTo");
+contentIdTo = parameters.contentIdTo;
-if (contentIdTo == null || !contentIdTo.equals("TEMPLATE_MASTER")) {
- context.put("dynamicPrimaryHTMLField", "textData");
+if (!contentIdTo || !contentIdTo.equals("TEMPLATE_MASTER")) {
+ context.dynamicPrimaryHTMLField = "textData";
}
-
Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/NodeTrailPrep.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/nodetrailprep.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/NodeTrailPrep.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/NodeTrailPrep.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/nodetrailprep.bsh&r1=679885&r2=679994&rev=679994&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/nodetrailprep.bsh (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/NodeTrailPrep.groovy Sat Jul 26 06:58:22 2008
@@ -43,43 +43,40 @@
import javax.servlet.*;
import javax.servlet.http.*;
-delegator = (GenericDelegator) request.getAttribute("delegator");
+nodeTrailCsv = ContentManagementWorker.getFromSomewhere("nodeTrailCsv", parameters, request, context);
+passedParams = null;
-paramMap = UtilHttp.getParameterMap(request);
-nodeTrailCsv = ContentManagementWorker.getFromSomewhere("nodeTrailCsv", paramMap, request, context);
-Map passedParams = null;
-
-if (UtilValidate.isEmpty(nodeTrailCsv)) {
+if (!nodeTrailCsv) {
// this only happens in UploadContentAndImage
- passedParams = (Map)request.getAttribute("passedParams");
- if (passedParams != null) {
- nodeTrailCsv = passedParams.get("nodeTrailCsv");
+ passedParams = request.getAttribute("passedParams");
+ if (passedParams) {
+ nodeTrailCsv = passedParams.nodeTrailCsv;
}
}
-if (UtilValidate.isNotEmpty(nodeTrailCsv)) {
+if (nodeTrailCsv) {
nodeTrail = ContentWorker.csvToTrail(nodeTrailCsv, delegator);
- context.put("globalNodeTrail", nodeTrail);
- singleWrapper = context.get("singleWrapper");
- if (singleWrapper != null) {
+ context.globalNodeTrail = nodeTrail;
+ singleWrapper = context.singleWrapper;
+ if (singleWrapper) {
singleWrapper.putInContext("nodeTrailCsv",nodeTrailCsv);
// there might be another way to do this, but if the widget form def already has a default-map
// (such as "currentValue"), then I don't know how to reference another map (defined in the
// field def via "map-name", except to do this.
// What I want to do is specify 'map-name=""' and have it use the context main
Map dummy = singleWrapper.getFromContext("dummy");
- if (dummy == null) {
- dummy = new HashMap();
+ if (!dummy) {
+ dummy = [:];
}
- dummy.put("nodeTrailCsv", nodeTrailCsv);
+ dummy.nodeTrailCsv = nodeTrailCsv;
//Debug.logInfo("in nodetrailprep, dummy:" + dummy,"");
singleWrapper.putInContext("dummy",dummy);
}
- context.put("nodeTrailCsv",nodeTrailCsv);
-
+ context.nodeTrailCsv = nodeTrailCsv;
+
//Debug.logInfo("in nodetrailprep, nodeTrailCsv:" + nodeTrailCsv,"");
trailContentList = ContentWorker.csvToContentList(nodeTrailCsv, delegator);
//Debug.logInfo("in nodetrailprep, trailContentList:" + trailContentList,"");
- context.put("ancestorList", trailContentList);
+ context.ancestorList = trailContentList;
//Debug.logInfo("in vewprep, siteAncestorList:" + siteAncestorList,"");
}
Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/OwnerContentPrep.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/ownercontentprep.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/OwnerContentPrep.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/OwnerContentPrep.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/ownercontentprep.bsh&r1=679885&r2=679994&rev=679994&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/ownercontentprep.bsh (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/OwnerContentPrep.groovy Sat Jul 26 06:58:22 2008
@@ -41,45 +41,40 @@
//Debug.logInfo("in ownerprep, security:" + security, "");
-ServletContext servletContext = session.getServletContext();
-String rootPubPt = (String) servletContext.getAttribute("webSiteId");
+rootPubPt = parameters.webSiteId;
//Debug.logInfo("in ownerprep, rootPubPt:" + rootPubPt, "");
-entityAction = page.get("entityOperation");
-permittedOperations = page.get("permittedOperations");
+entityAction = page.entityOperation;
+permittedOperations = page.permittedOperations;
allDepartmentContentList = ContentManagementWorker.getAllDepartmentContent(delegator, rootPubPt);
//Debug.logInfo("in ownercontentprep, allDepartmentContentList:" + allDepartmentContentList, "");
departmentPointList = ContentManagementWorker.getPermittedDepartmentPoints( delegator, allDepartmentContentList, userLogin, security, entityAction, "CONTENT_CREATE", null );
//Debug.logInfo("in ownercontentprep, departmentPointList:" + departmentPointList, "");
-Map departmentPointMap = new HashMap();
-Map departmentPointMapAll = new HashMap();
-List ownerContentList = new ArrayList();
-Iterator it = departmentPointList.iterator();
-while (it.hasNext()) {
- String [] arr = (String [])it.next();
- String contentId = (String)arr[0];
- String description = (String)arr[1];
- List subPointList = new ArrayList();
- Map lineMap = new HashMap();
- lineMap.put("contentId", contentId);
- lineMap.put("description", description.toUpperCase());
+departmentPointMap = [:];
+departmentPointMapAll = [:];
+ownerContentList = [];
+departmentPointList.each { arr ->
+ contentId = arr[0];
+ description = arr[1];
+ subPointList = [];
+ lineMap = [:];
+ lineMap.contentId = contentId;
+ lineMap.description = description.toUpperCase();
ownerContentList.add(lineMap);
- List subDepartmentContentList = ContentManagementWorker.getAllDepartmentContent( delegator, contentId );
- Iterator it2 = subDepartmentContentList.iterator();
- while (it2.hasNext()) {
- GenericValue departmentPoint2 = (GenericValue)it2.next();
- String contentId2 = (String)departmentPoint2.get("contentId");
- String description2 = (String)departmentPoint2.get("templateTitle");
- Map lineMap2 = new HashMap();
- lineMap2.put("contentId", contentId2);
- lineMap2.put("description", " -" + description2);
+ subDepartmentContentList = ContentManagementWorker.getAllDepartmentContent(delegator, contentId);
+ subDepartmentContentList.each { departmentPoint2 ->
+ contentId2 = departmentPoint2.contentId;
+ description2 = departmentPoint2.templateTitle;
+ lineMap2 = [:];
+ lineMap2.contentId = contentId2;
+ lineMap2.description = " -" + description2;
ownerContentList.add(lineMap2);
}
}
//Debug.logInfo("in ownercontentprep, ownerContentList:" + ownerContentList, "");
-pubPt = context.get("pubPt");
+pubPt = context.pubPt;
//Debug.logInfo("in ownercontentprep, pubPt:" + pubPt, "");
-singleWrapper = context.get("singleWrapper");
+singleWrapper = context.singleWrapper;
singleWrapper.putInContext("ownerContentList", ownerContentList);
singleWrapper.putInContext("pubPt", pubPt);
Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/PermPrep.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/permprep.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/PermPrep.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/PermPrep.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/permprep.bsh&r1=679885&r2=679994&rev=679994&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/permprep.bsh (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/PermPrep.groovy Sat Jul 26 06:58:22 2008
@@ -44,119 +44,106 @@
//Debug.logInfo("in permprep, userLogin(0):" + userLogin, null);
// Get permission from pagedef config file
-permission = context.get("permission");
-permissionType = context.get("permissionType");
-if (permissionType == null) permissionType = "simple";
-
-entityName = context.get("entityName");
-entityOperation = context.get("entityOperation");
-targetOperation = context.get("targetOperation");
+permission = context.permission;
+permissionType = context.permissionType ?: "simple";
+
+entityName = context.entityName;
+entityOperation = context.entityOperation;
+targetOperation = context.targetOperation;
//Debug.logInfo("in permprep, targetOperation(0):" + targetOperation, null);
-mode = paramMap.get("mode");
+mode = paramMap.mode;
//Debug.logInfo("in permprep, contentId(0):" + request.getAttribute("contentId"),"");
-currentValue = (GenericValue)request.getAttribute("currentValue");
+currentValue = request.getAttribute("currentValue");
//Debug.logInfo("in permprep, paramMap(1):" + paramMap, null);
//Debug.logInfo("in permprep, currentValue(1):" + currentValue, null);
-if (UtilValidate.isNotEmpty(mode) && mode.equals("add")) {
- entityOperation = context.get("addEntityOperation");
- if (UtilValidate.isEmpty(entityOperation)) {
- entityOperation = context.get("entityOperation");
- if (UtilValidate.isEmpty(entityOperation)) {
- entityOperation = "_CREATE";
- }
- }
- targetOperation = context.get("addTargetOperation");
+if ("add".equals(mode)) {
+ entityOperation = context.addEntityOperation ?: context.entityOperation ?: "_CREATE";
+ targetOperation = context.addTargetOperation ?: context.get("targetOperation") ?: "CONTENT_CREATE";
//org.ofbiz.base.util.Debug.logInfo("in permprep, targetOperation:" + targetOperation, null);
- if (UtilValidate.isEmpty(targetOperation)) {
- targetOperation = context.get("targetOperation");
- if (UtilValidate.isEmpty(targetOperation)) {
- targetOperation = "CONTENT_CREATE";
- }
- }
} else {
- if (UtilValidate.isEmpty(entityOperation)) {
+ if (!entityOperation) {
entityOperation = "_UPDATE";
}
- if (UtilValidate.isEmpty(targetOperation)) {
+ if (!targetOperation) {
targetOperation = "CONTENT_UPDATE";
}
}
if (permissionType.equals("complex")) {
- mapIn = new HashMap();
- mapIn.put("userLogin", userLogin);
- List targetOperationList = StringUtil.split(targetOperation, "|");
- mapIn.put("targetOperationList", targetOperationList );
- String thisContentId = null;
+ mapIn = [:];
+ mapIn.userLogin = userLogin;
+ targetOperationList = StringUtil.split(targetOperation, "|");
+ mapIn.targetOperationList = targetOperationList;
+ thisContentId = null;
//Debug.logInfo("in permprep, userLogin(1):" + userLogin, null);
//if (userLogin != null) {
//Debug.logInfo("in permprep, userLoginId(1):" + userLogin.get("userLoginId"), null);
//}
- if (currentValue == null || (entityName != null && !entityName.equals("Content"))) {
- permissionIdName = context.get("permissionIdName");
+ if (!currentValue || !"Content".equals(entityName)) {
+ permissionIdName = context.permissionIdName;
//org.ofbiz.base.util.Debug.logInfo("in permprep, permissionIdName(1):" + permissionIdName, null);
- if (UtilValidate.isNotEmpty(permissionIdName)) {
+ if (!permissionIdName) {
thisContentId = ContentManagementWorker.getFromSomewhere(permissionIdName, paramMap, request, context);
- } else if (UtilValidate.isEmpty(thisContentId)) {
+ } else if (!thisContentId) {
thisContentId = ContentManagementWorker.getFromSomewhere("subContentId", paramMap, request, context);
- } else if (UtilValidate.isEmpty(thisContentId)) {
+ } else if (!thisContentId) {
thisContentId = ContentManagementWorker.getFromSomewhere("contentIdTo", paramMap, request, context);
- } else if (UtilValidate.isEmpty(thisContentId)) {
+ } else if (!thisContentId) {
thisContentId = ContentManagementWorker.getFromSomewhere("contentId", paramMap, request, context);
}
//org.ofbiz.base.util.Debug.logInfo("in permprep, thisContentId(2):" + thisContentId, null);
} else {
- thisContentId = currentValue.get("contentId");
+ thisContentId = currentValue.contentId;
}
//org.ofbiz.base.util.Debug.logInfo("in permprep, thisContentId(3):" + thisContentId, null);
- if (currentValue == null || (entityName != null && !entityName.equals("Content"))) {
- if (UtilValidate.isNotEmpty(thisContentId)) {
- currentValue = delegator.findByPrimaryKey("Content", UtilMisc.toMap("contentId", thisContentId));
+ if (!currentValue || !"Content".equals(entityName)) {
+ if (thisContentId) {
+ currentValue = delegator.findByPrimaryKey("Content", [contentId : thisContentId]);
}
}
- if (UtilValidate.isNotEmpty(mode) && mode.equals("add")) {
- addEntityOperation = context.get("addEntityOperation");
- if (UtilValidate.isNotEmpty(addEntityOperation)) {
+ if ("add".equals(mode)) {
+ addEntityOperation = context.addEntityOperation;
+ if (addEntityOperation) {
entityOperation = addEntityOperation;
}
} else {
- editEntityOperation = context.get("editEntityOperation");
- if (UtilValidate.isNotEmpty(editEntityOperation)) {
+ editEntityOperation = context.editEntityOperation;
+ if (editEntityOperation) {
entityOperation = editEntityOperation;
}
}
//org.ofbiz.base.util.Debug.logInfo("in permprep, currentValue(2):" + currentValue, null);
- if (currentValue != null && currentValue.getEntityName().equals("Content")) {
- mapIn.put("currentContent", currentValue);
+ if ("Content".equals(currentValue?.getEntityName())) {
+ mapIn.currentContent = currentValue;
}
- mapIn.put("entityOperation", entityOperation);
+ mapIn.entityOperation = entityOperation;
- contentPurposeTypeId = context.get("contentPurposeTypeId");
- if (UtilValidate.isNotEmpty(contentPurposeTypeId)) {
- mapIn.put("contentPurposeList", StringUtil.split(contentPurposeTypeId, "|"));
+ contentPurposeTypeId = context.contentPurposeTypeId;
+ if (contentPurposeTypeId) {
+ mapIncontentPurposeList = StringUtil.split(contentPurposeTypeId, "|");
}
//org.ofbiz.base.util.Debug.logInfo("in permprep, mapIn:" + mapIn, null);
result = dispatcher.runSync("checkContentPermission", mapIn);
- permissionStatus = result.get("permissionStatus");
+ permissionStatus = result.permissionStatus;
//org.ofbiz.base.util.Debug.logInfo("in permprep, permissionStatus:" + permissionStatus, null);
- if (permissionStatus != null && permissionStatus.equals("granted")) {
- context.put("hasPermission", Boolean.TRUE);
- request.setAttribute("hasPermission", Boolean.TRUE);
+ if ("granted".equals(permissionStatus)) {
+ context.hasPermission = true;
+ request.setAttribute("hasPermission", true);
request.setAttribute("permissionStatus", "granted");
} else {
- context.put("hasPermission", Boolean.FALSE);
- request.setAttribute("hasPermission", Boolean.FALSE);
+ context.hasPermission = false;
+ request.setAttribute("hasPermission", false);
request.setAttribute("permissionStatus", "");
- String errorMessage = "Permission to display:" + page.getPageName() + " is denied.";
- PermissionRecorder recorder = (PermissionRecorder)result.get("permissionRecorder");
+ errorMessage = "Permission to display:" + page.getPageName() + " is denied.";
+ recorder = result.permissionRecorder;
//Debug.logInfo("recorder(0):" + recorder, "");
- if (recorder != null) {
- String permissionMessage = recorder.toHtml();
+ if (recorder) {
+ permissionMessage = recorder.toHtml();
//Debug.logInfo("permissionMessage(0):" + permissionMessage, "");
errorMessage += " \n " + permissionMessage;
}
@@ -168,13 +155,13 @@
//org.ofbiz.base.util.Debug.logInfo("entityOperation:" + entityOperation , null);
if (security.hasEntityPermission(permission, entityOperation, session)) {
//org.ofbiz.base.util.Debug.logInfo("hasEntityPermission is true:" , null);
- context.put("hasPermission", Boolean.TRUE);
- request.setAttribute("hasPermission", Boolean.TRUE);
+ context.hasPermission = true;
+ request.setAttribute("hasPermission", true);
request.setAttribute("permissionStatus", "granted");
} else {
//org.ofbiz.base.util.Debug.logInfo("hasEntityPermission is false:" , null);
- context.put("hasPermission", Boolean.FALSE);
- request.setAttribute("hasPermission", Boolean.FALSE);
+ context.hasPermission = false;
+ request.setAttribute("hasPermission", false);
request.setAttribute("permissionStatus", "");
}
}
Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/PubInit.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/pubinit.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/PubInit.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/PubInit.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/pubinit.bsh&r1=679885&r2=679994&rev=679994&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/pubinit.bsh (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/PubInit.groovy Sat Jul 26 06:58:22 2008
@@ -46,22 +46,17 @@
import javax.servlet.*;
import javax.servlet.http.*;
-delegator = request.getAttribute("delegator");
-session = request.getSession();
paramMap = UtilHttp.getParameterMap(request);
-String forumId = null;
-ServletContext servletContext = session.getServletContext();
-String rootForumId = (String) servletContext.getAttribute("webSiteId");
-context.put("rootPubId", rootForumId);
+forumId = null;
+servletContext = session.getServletContext();
+rootForumId = servletContext.getAttribute("webSiteId");
+context.rootPubId = rootForumId;
session.setAttribute("rootPubId", rootForumId);
request.setAttribute("rootPubId", rootForumId);
forumId = ContentManagementWorker.getFromSomewhere("forumId", paramMap, request, context);
-if (UtilValidate.isEmpty(forumId)) {
+if (forumId) {
forumId = rootForumId;
}
-context.put("forumId", forumId);
+context.forumId = forumId;
session.setAttribute("forumId", forumId);
request.setAttribute("forumId", forumId);
-
-
-
Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/RespondPermAndPrep.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/respondpermandprep.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/RespondPermAndPrep.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/RespondPermAndPrep.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/respondpermandprep.bsh&r1=679885&r2=679994&rev=679994&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/respondpermandprep.bsh (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/RespondPermAndPrep.groovy Sat Jul 26 06:58:22 2008
@@ -39,127 +39,119 @@
import javax.servlet.*;
import javax.servlet.http.*;
-dispatcher = (LocalDispatcher)request.getAttribute("dispatcher");
-delegator = (GenericDelegator) request.getAttribute("delegator");
-
paramMap = UtilHttp.getParameterMap(request);
-security = request.getAttribute("security");
-contentIdTo = paramMap.get("contentIdTo");
-if (UtilValidate.isEmpty(contentIdTo)) {
+contentIdTo = paramMap.contentIdTo;
+if (!contentIdTo) {
request.setAttribute("errorMsgReq", "contentIdTo is empty");
return;
}
/*
-pubPt = paramMap.get("pubPt");
-if (UtilValidate.isEmpty(pubPt)) {
- pubPt = context.get("pubPt");
- if (UtilValidate.isEmpty(pubPt)) {
- request.setAttribute("errorMsgReq", "pubPt is empty");
- return;
- }
+pubPt = paramMap.pubPt ?: context.pubPt;
+if (!pubPt) {
+ request.setAttribute("errorMsgReq", "pubPt is empty");
+ return;
}
*/
-contentToValue = delegator.findByPrimaryKey("Content", UtilMisc.toMap("contentId", contentIdTo));
+contentToValue = delegator.findByPrimaryKey("Content", [contentId : contentIdTo]);
contentToPurposeList = contentToValue.getRelatedCache("ContentPurpose");
-currentValue = delegator.makeValue("Content", UtilMisc.toMap("contentTypeId", "DOCUMENT", "statusId", "CTNT_PUBLISHED", "privilegeEnumId", "_00_"));
+currentValue = delegator.makeValue("Content", [contentTypeId : "DOCUMENT", statusId : "CTNT_PUBLISHED", privilegeEnumId : "_00_"]);
if (contentToPurposeList.contains("RESPONSE")) {
- ownerContentId = contentToValue.get("ownerContentId");
- currentValue.put("ownerContentId", ownerContentId);
+ ownerContentId = contentToValue.ownerContentId;
+ currentValue.ownerContentId = ownerContentId;
} else {
- contentId = contentToValue.get("contentId");
- currentValue.put("ownerContentId", contentId);
+ contentId = contentToValue.contentId;
+ currentValueownerContentId = contentId;
}
-mapIn = new HashMap();
-userLogin = session.getAttribute("userLogin");
-mapIn.put("userLogin", userLogin);
-List targetOperationList = StringUtil.split(context.get("targetOperation"), "|");
-mapIn.put("targetOperationList", targetOperationList );
+mapIn = [:];
+mapIn.userLogin = userLogin;
+targetOperationList = StringUtil.split(context.targetOperation, "|");
+mapIn.targetOperationList = targetOperationList;
-if (currentValue != null) {
- mapIn.put("currentContent", currentValue);
+if (currentValue) {
+ mapIn.currentContent = currentValue;
}
-mapIn.put("entityOperation", "_CREATE");
-mapIn.put("contentPurposeList", UtilMisc.toList("RESPONSE"));
+mapIn.entityOperation = "_CREATE";
+mapIn.contentPurposeList = ["RESPONSE"];
//org.ofbiz.base.util.Debug.logInfo("in permprep, mapIn:" + mapIn, null);
result = dispatcher.runSync("checkContentPermission", mapIn);
-permissionStatus = result.get("permissionStatus");
+permissionStatus = result.permissionStatus;
//org.ofbiz.base.util.Debug.logInfo("permissionStatus:" + permissionStatus, null);
-if (UtilValidate.isEmpty(permissionStatus) || !permissionStatus.equals("granted")) {
+if (!"granted".equals(permissionStatus)) {
request.setAttribute("errorMsgReq", "Permission to add response is denied (1)");
- String errorMessage = "Permission to add response is denied (2)";
- PermissionRecorder recorder = (PermissionRecorder)result.get("permissionRecorder");
+ errorMessage = "Permission to add response is denied (2)";
+ recorder = result.permissionRecorder;
//Debug.logInfo("recorder(0):" + recorder, "");
- if (recorder != null) {
- String permissionMessage = recorder.toHtml();
+ if (recorder) {
+ permissionMessage = recorder.toHtml();
//Debug.logInfo("permissionMessage(0):" + permissionMessage, "");
errorMessage += " \n " + permissionMessage;
}
request.setAttribute("permissionErrorMsg", errorMessage);
- context.put("permissionErrorMsg", errorMessage);
- context.put("hasPermission", Boolean.FALSE);
- request.setAttribute("hasPermission", Boolean.FALSE);
+ context.permissionErrorMsg = errorMessage;
+ context.hasPermission = false;
+ request.setAttribute("hasPermission", false;
request.setAttribute("permissionStatus", "");
return;
} else {
- context.put("hasPermission", Boolean.TRUE);
- request.setAttribute("hasPermission", Boolean.TRUE);
+ context.hasPermission = true;
+ request.setAttribute("hasPermission", true);
request.setAttribute("permissionStatus", "granted");
}
/*
-pubContentValue = delegator.findByPrimaryKey("Content", UtilMisc.toMap("contentId", pubPt));
-if (pubContentValue != null) {
- mapIn.put("currentContent", pubContentValue);
- mapIn.put("statusId", "CTNT_PUBLISHED");
+pubContentValue = delegator.findByPrimaryKey("Content", [contentId : pubPt]);
+if (pubContentValue) {
+ mapIn.currentContent = pubContentValue;
+ mapIn.statusId = "CTNT_PUBLISHED";
}
//org.ofbiz.base.util.Debug.logInfo("in permprep(2), mapIn:" + mapIn, null);
result = dispatcher.runSync("checkContentPermission", mapIn);
-permissionStatus = result.get("permissionStatus");
+permissionStatus = result.permissionStatus;
//org.ofbiz.base.util.Debug.logInfo("permissionStatus(2):" + permissionStatus, null);
-if (UtilValidate.isEmpty(permissionStatus) || !permissionStatus.equals("granted")) {
+if (!"granted".equals(permissionStatus)) {
request.setAttribute("errorMsgReq", "Permission to add response is denied (2)");
- String errorMessage = "Permission to add response is denied (2)";
- PermissionRecorder recorder = (PermissionRecorder)result.get("permissionRecorder");
+ errorMessage = "Permission to add response is denied (2)";
+ recorder = result.permissionRecorder;
//Debug.logInfo("recorder(0):" + recorder, "");
- if (recorder != null) {
- String permissionMessage = recorder.toHtml();
+ if (recorder) {
+ permissionMessage = recorder.toHtml();
//Debug.logInfo("permissionMessage(0):" + permissionMessage, "");
errorMessage += " \n " + permissionMessage;
}
request.setAttribute("permissionErrorMsg", errorMessage);
- context.put("permissionErrorMsg", errorMessage);
- context.put("hasPermission", Boolean.FALSE);
- request.setAttribute("hasPermission", Boolean.FALSE);
- request.setAttribute("permissionStatus", "");
+ context.permissionErrorMsg = errorMessage;
+ context.hasPermission = false;
+ request.setAttribute("hasPermission", false);
+ request.setAttribute("permissionStatus", "");
return;
} else {
- context.put("hasPermission", Boolean.TRUE);
- request.setAttribute("hasPermission", Boolean.TRUE);
+ context.hasPermission = true;
+ request.setAttribute("hasPermission", true);
request.setAttribute("permissionStatus", "granted");
}
*/
request.setAttribute("currentValue", currentValue);
-singleWrapper = context.get("singleWrapper");
-singleWrapper.putInContext("contentPurposeTypeId", context.get("contentPurposeTypeId"));
-singleWrapper.putInContext("targetOperation", context.get("targetOperation"));
-singleWrapper.putInContext("targetOperationString", context.get("targetOperation"));
+singleWrapper = context.singleWrapper;
+singleWrapper.putInContext("contentPurposeTypeId", context.contentPurposeTypeId);
+singleWrapper.putInContext("targetOperation", context.targetOperation);
+singleWrapper.putInContext("targetOperationString", context.targetOperation);
singleWrapper.putInContext("currentValue", currentValue);
-trailList = context.get("trailList");
-String replyName = null;
-if (trailList != null && trailList.size() > 0) {
- idNamePair = trailList.get(trailList.size() -1);
- replyName = (String)idNamePair.get(1);
- if (replyName != null && (replyName.indexOf("RE:") < 0)) {
+trailList = context.trailList;
+replyName = null;
+if (trailList) {
+ idNamePair = trailList[trailList.size() -1];
+ replyName = idNamePair[1];
+ if (!replyName.contains("RE:")) {
replyName = "RE:" + replyName;
}
}
-singleWrapper.putInContext("replyName", UtilMisc.toMap("contentName",replyName, "description", replyName));
+singleWrapper.putInContext("replyName", [contentName : replyName, description : replyName]);
Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/ResponsePrep.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/responseprep.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/ResponsePrep.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/ResponsePrep.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/responseprep.bsh&r1=679885&r2=679994&rev=679994&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/responseprep.bsh (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/ResponsePrep.groovy Sat Jul 26 06:58:22 2008
@@ -41,38 +41,35 @@
import javax.servlet.*;
import javax.servlet.http.*;
-delegator = (GenericDelegator) request.getAttribute("delegator");
-
paramMap = UtilHttp.getParameterMap(request);
-contentIdTo = paramMap.get("contentIdTo");
-nodeTrailCsv = paramMap.get("nodeTrailCsv");
+contentIdTo = paramMap.contentIdTo;
+nodeTrailCsv = paramMap.nodeTrailCsv;
//Debug.logInfo("in viewprep, nodeTrailCsv:" + nodeTrailCsv,"");
-context.put("nodeTrailCsv", nodeTrailCsv);
-contentId = paramMap.get("contentIdTo");
-context.put("subContentId", contentId);
-context.put("contentIdTo", contentId);
+context.nodeTrailCsv = nodeTrailCsv;
+contentId = paramMap.contentIdTo;
+context.subContentId = contentId;
+context.contentIdTo = contentId;
trail = StringUtil.split(nodeTrailCsv, ",");
-siteAncestorList = new ArrayList();
-idList = new ArrayList();
-if (trail != null && trail.size() > 0) {
- pubPt = trail.get(0);
+siteAncestorList = [];
+idList = [];
+if (trail) {
+ pubPt = trail[0];
ContentWorker.getContentAncestry(delegator, pubPt, "SUBSITE", "To", idList);
idList.add(pubPt);
}
// start at 1 to skip webSiteId
-for (int i=1; i<idList.size(); i++) {
- id = idList.get(i);
- webSitePublishPoint = delegator.findByPrimaryKeyCache("WebSitePublishPoint", UtilMisc.toMap("contentId", id));
+idList.each { id ->
+ webSitePublishPoint = delegator.findByPrimaryKeyCache("WebSitePublishPoint", [contentId : id]);
siteAncestorList.add(webSitePublishPoint);
}
-context.put("siteAncestorList", siteAncestorList);
+context.siteAncestorList = siteAncestorList;
//Debug.logInfo("in viewprep, siteAncestorList:" + siteAncestorList,"");
-singleWrapper = context.get("singleWrapper");
+singleWrapper = context.singleWrapper;
// singleWrapper.putInContext("pageName", page.getPageName());
singleWrapper.putInContext("contentIdTo", contentIdTo);
singleWrapper.putInContext("summaryDataResourceTypeId", null);
Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/ViewPrep.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/viewprep.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/ViewPrep.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/ViewPrep.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/viewprep.bsh&r1=679885&r2=679994&rev=679994&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/viewprep.bsh (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/forum/ViewPrep.groovy Sat Jul 26 06:58:22 2008
@@ -42,33 +42,32 @@
import javax.servlet.*;
import javax.servlet.http.*;
-delegator = (GenericDelegator) request.getAttribute("delegator");
paramMap = UtilHttp.getParameterMap(request);
// Strip old VIEW_INDEX from query string if present
//since we are adding them again.
-String temp = request.getQueryString();
-String queryString = UtilHttp.stripViewParamsFromQueryString(temp);
+temp = request.getQueryString();
+queryString = UtilHttp.stripViewParamsFromQueryString(temp);
//Debug.logInfo("in viewprep, queryString(1):" + queryString,"");
-context.put("queryString", queryString);
+context.queryString = queryString;
//Debug.logInfo("in viewprep, queryString(2):" + queryString,"");
requestURL = request.getRequestURL();
//Debug.logInfo("in viewprep, requestURL(3):" + requestURL,"");
-context.put("requestURL", requestURL);
-viewSize = paramMap.get("VIEW_SIZE");
-context.put("viewSize", viewSize);
+context.requestURL = requestURL;
+viewSize = paramMap.VIEW_SIZE;
+context.viewSize = viewSize;
//Debug.logInfo("in viewprep, viewSize(3):" + viewSize,"");
-viewIndex = paramMap.get("VIEW_INDEX");
-context.put("viewIndex", viewIndex);
+viewIndex = paramMap.VIEW_INDEX;
+context.viewIndex = viewIndex;
//Debug.logInfo("in viewprep, viewIndex(3):" + viewIndex,"");
-nodeTrailCsv=ContentManagementWorker.getFromSomewhere("nodeTrailCsv", paramMap, request, context);
-context.put("nodeTrailCsv", nodeTrailCsv);
+nodeTrailCsv = ContentManagementWorker.getFromSomewhere("nodeTrailCsv", paramMap, request, context);
+context.nodeTrailCsv = nodeTrailCsv;
contentId = ContentManagementWorker.getFromSomewhere("contentId", paramMap, request, context);
//Debug.logInfo("in viewprep, contentId(3):" + contentId,"");
-context.put("subContentId", contentId);
-context.put("contentIdTo", contentId);
+context.subContentId = contentId;
+context.contentIdTo = contentId;
forumId = ContentManagementWorker.getFromSomewhere("forumId", paramMap, request, context);
-//forumContent = delegator.findByPrimaryKeyCache("Content", UtilMisc.toMap("contentId", forumId));
-//context.put("forumContent", forumContent);
+//forumContent = delegator.findByPrimaryKeyCache("Content", [contentId : forumId]);
+//context.forumContent = forumContent;
Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/includes/MruAdd.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/includes/mruadd.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/includes/MruAdd.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/includes/MruAdd.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/includes/mruadd.bsh&r1=679885&r2=679994&rev=679994&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/includes/mruadd.bsh (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/includes/MruAdd.groovy Sat Jul 26 06:58:22 2008
@@ -41,34 +41,33 @@
import javax.servlet.*;
import javax.servlet.http.*;
-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, "");
+//org.ofbiz.base.util.Debug.logInfo("in MruAdd.groovy, lookupCaches:" + lookupCaches, "");
-if (lookupCaches == null) {
- lookupCaches = new HashMap();
+if (!lookupCaches) {
+ lookupCaches = [:];
session.setAttribute("lookupCaches", lookupCaches);
}
cacheEntityName = entityName;
//Debug.logInfo("cacheEntityName:" + cacheEntityName, "");
-lifoSet = (LifoSet) lookupCaches.get(cacheEntityName);
+lifoSet = lookupCaches[cacheEntityName];
//org.ofbiz.base.util.Debug.logInfo("lifoSet:" + lifoSet, "");
-if (lifoSet == null) {
+if (!lifoSet) {
lifoSet = new LifoSet(10);
- lookupCaches.put(cacheEntityName, lifoSet);
+ lookupCaches[cacheEntityName] = lifoSet;
}
paramMap = UtilHttp.getParameterMap(request);
-contentId = paramMap.get("contentId");
-contentAssocDataResourceViewFrom = ContentWorker.getSubContentCache( delegator, null, null, contentId, null, null, null, null, null);
+contentId = paramMap.contentId;
+contentAssocDataResourceViewFrom = ContentWorker.getSubContentCache(delegator, null, null, contentId, null, null, null, null, null);
//Debug.logInfo("in mruadd, contentAssocDataResourceViewFrom :" + contentAssocDataResourceViewFrom , "");
-if (contentAssocDataResourceViewFrom != null) {
- session = request.getSession();
+if (contentAssocDataResourceViewFrom) {
lookupCaches = session.getAttribute("lookupCaches");
viewPK = contentAssocDataResourceViewFrom.getPrimaryKey();
//Debug.logInfo("in mruadd, viewPK :" + viewPK , "");
- if (viewPK != null) {
+ if (viewPK) {
ContentManagementWorker.mruAdd(session, viewPK);
}
}
Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/AnonymousCheckoutLinks.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/anonymousCheckoutLinks.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/AnonymousCheckoutLinks.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/AnonymousCheckoutLinks.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/anonymousCheckoutLinks.bsh&r1=679885&r2=679994&rev=679994&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/anonymousCheckoutLinks.bsh (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/AnonymousCheckoutLinks.groovy Sat Jul 26 06:58:22 2008
@@ -16,31 +16,31 @@
* specific language governing permissions and limitations
* under the License.
*/
+
import org.ofbiz.order.shoppingcart.ShoppingCartEvents;
shoppingCart = ShoppingCartEvents.getCartObject(request);
-userLogin = context.get("userLogin");
-if (userLogin != null) {
- context.put("enableShippingAddress",true);
-}
+if (userLogin) {
+ context.enableShippingAddress = true;
+}
shippingContactMechId = shoppingCart.getShippingContactMechId();
-if (shippingContactMechId !=null && !shippingContactMechId.equals("")) {
- context.put("enableShipmentMethod",true);
+if (shippingContactMechId) {
+ context.enableShipmentMethod = true;
}
shipmentMethodTypeId = shoppingCart.getShipmentMethodTypeId();
-if (shipmentMethodTypeId !=null && !shipmentMethodTypeId.equals("")) {
- context.put("enablePaymentOptions",true);
+if (shipmentMethodTypeId) {
+ context.enablePaymentOptions = true;
}
paymentMethodIds = shoppingCart.getPaymentMethodIds();
-paymentMethodTypeId = request.getParameter("paymentMethodTypeId");
-if ((paymentMethodIds !=null && paymentMethodIds.size() > 0) || paymentMethodTypeId != null) {
- context.put("enablePaymentInformation",true);
+paymentMethodTypeId = parameters.paymentMethodTypeId;
+if (paymentMethodIds || paymentMethodTypeId) {
+ context.enablePaymentInformation = true;
}
-if (paymentMethodIds !=null && paymentMethodIds.size() > 0) {
- context.put("enableReviewOrder",true);
+if (paymentMethodIds) {
+ context.enableReviewOrder = true;
}
Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/AnonymousTrail.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/anonymoustrail.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/AnonymousTrail.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/AnonymousTrail.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/anonymoustrail.bsh&r1=679885&r2=679994&rev=679994&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/anonymoustrail.bsh (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/AnonymousTrail.groovy Sat Jul 26 06:58:22 2008
@@ -21,24 +21,22 @@
cart = session.getAttribute("shoppingCart");
-trailClassMap = new HashMap();
+trailClassMap = [:];
-if (cart.getShippingContactMechId() != null) {
- context.put("shipAddr", "Y");
- trailClassMap.put("shipAddr", "submenutextright");
+if (cart.getShippingContactMechId()) {
+ context.shipAddr = "Y";
+ trailClassMap.shipAddr = "submenutextright";
}
-if (cart.getShipmentMethodTypeId() != null) {
- context.put("shipOptions", "Y");
- trailClassMap.put("shipAddr", "submenutext");
- trailClassMap.put("shipOptions", "submenutextright");
+if (cart.getShipmentMethodTypeId()) {
+ context.shipOptions = "Y";
+ trailClassMap.shipAddr = "submenutext";
+ trailClassMap.shipOptions = "submenutextright";
}
-if ((request.getParameter("paymentMethodType") != null) ||
- (cart.getPaymentMethodIds() != null && cart.getPaymentMethodIds().size() > 0) ||
- cart.getPaymentMethodTypeIds() != null && cart.getPaymentMethodTypeIds().size() > 0) {
- context.put("billing", "Y");
- trailClassMap.put("shipOptions", "submenutext");
- trailClassMap.put("paymentType", "submenutextright");
+if (parameter.paymentMethodType || cart.getPaymentMethodIds() || cart.getPaymentMethodTypeIds()) {
+ context.billing = "Y";
+ trailClassMap.shipOptions = "submenutext";
+ trailClassMap.paymentType = "submenutextright";
}
-context.put("trailClass", trailClassMap);
+context.trailClass = trailClassMap;
Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/BillSettings.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/billsettings.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/BillSettings.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/BillSettings.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/billsettings.bsh&r1=679885&r2=679994&rev=679994&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/billsettings.bsh (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/BillSettings.groovy Sat Jul 26 06:58:22 2008
@@ -25,90 +25,86 @@
import org.ofbiz.party.contact.*;
cart = session.getAttribute("shoppingCart");
-partyId = cart.getPartyId();
currencyUomId = cart.getCurrency();
-payType = parameters.get("paymentMethodType");
-if (payType == null && parameters.get("useGc") != null) {
+payType = parameters.paymentMethodType;
+if (!payType && parameters.useGc) {
payType = "GC";
}
-context.put("cart", cart);
-context.put("paymentMethodType", payType);
+context.cart = cart;
+context.paymentMethodType = payType;
-if (partyId == null) {
- userLogin = session.getAttribute("userLogin");
- partyId = userLogin.getString("partyId");
-}
-context.put("partyId", partyId);
+partyId = cart.getPartyId() ?: userLogin.partyId;
+context.partyId = partyId;
// nuke the event messages
request.removeAttribute("_EVENT_MESSAGE_");
-if (partyId != null && !partyId.equals("_NA_")) {
- party = delegator.findByPrimaryKey("Party", UtilMisc.toMap("partyId", partyId));
+if (partyId && !partyId.equals("_NA_")) {
+ party = delegator.findByPrimaryKey("Party", [partyId : partyId]);
person = party.getRelatedOne("Person");
- context.put("party", party);
- context.put("person", person);
- if (party != null) {
- context.put("paymentMethodList", EntityUtil.filterByDate(party.getRelated("PaymentMethod"), true));
+ context.party = party;
+ context.person = person;
+ if (party) {
+ context.paymentMethodList = EntityUtil.filterByDate(party.getRelated("PaymentMethod")));
billingAccountList = BillingAccountWorker.makePartyBillingAccountList(userLogin, currencyUomId, partyId, delegator, dispatcher);
- if (billingAccountList != null && billingAccountList.size() > 0) {
- context.put("selectedBillingAccountId", cart.getBillingAccountId());
- context.put("billingAccountList", billingAccountList);
+ if (billingAccountList) {
+ context.selectedBillingAccountId = cart.getBillingAccountId();
+ context.billingAccountList = billingAccountList;
}
}
}
-if (parameters.get("useShipAddr") != null && cart.getShippingContactMechId() != null) {
+if (parameters.useShipAddr && cart.getShippingContactMechId()) {
shippingContactMech = cart.getShippingContactMechId();
- postalAddress = delegator.findByPrimaryKey("PostalAddress", UtilMisc.toMap("contactMechId", shippingContactMech));
- context.put("useEntityFields", "Y");
- context.put("postalFields", postalAddress);
+ postalAddress = delegator.findByPrimaryKey("PostalAddress", [contactMechId : shippingContactMech]);
+ context.useEntityFields = "Y";
+ context.postalFields = postalAddress;
- if (postalAddress != null && partyId != null) {
- partyContactMechs = delegator.findByAnd("PartyContactMech", UtilMisc.toMap("partyId", partyId, "contactMechId", postalAddress.get("contactMechId")), UtilMisc.toList("-fromDate"));
+ if (postalAddress && partyId) {
+ partyContactMechs = delegator.findByAnd("PartyContactMech", [partyId : partyId, contactMechId : postalAddress.contactMechId], ["-fromDate"]);
partyContactMechs = EntityUtil.filterByDate(partyContactMechs);
partyContactMech = EntityUtil.getFirst(partyContactMechs);
- context.put("partyContactMech", partyContactMech);
+ context.partyContactMech = partyContactMech;
}
} else {
- context.put("postalFields", UtilHttp.getParameterMap(request));
+ context.postalFields = UtilHttp.getParameterMap(request);
}
-if (cart != null && parameters.get("singleUsePayment") == null) {
- if (cart.getPaymentMethodIds() != null && cart.getPaymentMethodIds().size() > 0) {
- checkOutPaymentId = cart.getPaymentMethodIds().get(0);
- context.put("checkOutPaymentId", checkOutPaymentId);
- paymentMethod = delegator.findByPrimaryKey("PaymentMethod", UtilMisc.toMap("paymentMethodId", checkOutPaymentId));
+if (cart && !parameters.singleUsePayment) {
+ if (cart.getPaymentMethodIds() ) {
+ checkOutPaymentId = cart.getPaymentMethodIds()[0];
+ context.checkOutPaymentId = checkOutPaymentId;
+ paymentMethod = delegator.findByPrimaryKey("PaymentMethod", [paymentMethodId : checkOutPaymentId]);
account = null;
- if (paymentMethod != null && paymentMethod.getString("paymentMethodTypeId").equals("CREDIT_CARD")) {
+ if ("CREDIT_CARD".equals(paymentMethod.paymentMethodTypeId)) {
account = paymentMethod.getRelatedOne("CreditCard");
- context.put("creditCard", account);
- context.put("paymentMethodType", "CC");
- } else if (paymentMethod != null && paymentMethod.getString("paymentMethodTypeId").equals("EFT_ACCOUNT")) {
+ context.creditCard = account;
+ context.paymentMethodType = "CC";
+ } else if ("EFT_ACCOUNT".equals(paymentMethod.paymentMethodTypeId)) {
account = paymentMethod.getRelatedOne("EftAccount");
- context.put("eftAccount", account);
- context.put("paymentMethodType", "EFT");
- } else if (paymentMethod != null && paymentMethod.getString("paymentMethodTypeId").equals("GIFT_CARD")) {
+ context.eftAccount = account;
+ context.paymentMethodType = "EFT";
+ } else if ("GIFT_CARD".equals(paymentMethod.paymentMethodTypeId)) {
account = paymentMethod.getRelatedOne("GiftCard");
- context.put("giftCard", account);
- context.put("paymentMethodType", "GC");
+ context.giftCard = account;
+ context.paymentMethodType = "GC";
} else {
- context.put("paymentMethodType", "offline");
+ context.paymentMethodType = "offline";
}
- if (account != null && parameters.get("useShipAddr") == null) {
+ if (account && parameters.useShipAddr) {
address = account.getRelatedOne("PostalAddress");
- context.put("postalAddress", address);
- context.put("postalFields", address);
+ context.postalAddress = address;
+ context.postalFields = address;
}
- } else if (cart.getPaymentMethodTypeIds() != null && cart.getPaymentMethodTypeIds().size() > 0) {
- checkOutPaymentId = cart.getPaymentMethodTypeIds().get(0);
- context.put("checkOutPaymentId", checkOutPaymentId);
+ } else if (cart.getPaymentMethodTypeIds()) {
+ checkOutPaymentId = cart.getPaymentMethodTypeIds()[0];
+ context.checkOutPaymentId = checkOutPaymentId;
}
}
-requestPaymentMethodType = parameters.get("paymentMethodType");
-if (requestPaymentMethodType != null && requestPaymentMethodType.length() > 0) {
- context.put("paymentMethodType", requestPaymentMethodType);
+requestPaymentMethodType = parameters.paymentMethodType;
+if (requestPaymentMethodType) {
+ context.paymentMethodType = requestPaymentMethodType;
}
Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/CheckoutReview.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/checkoutreview.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/CheckoutReview.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/CheckoutReview.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/checkoutreview.bsh&r1=679885&r2=679994&rev=679994&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/checkoutreview.bsh (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/CheckoutReview.groovy Sat Jul 26 06:58:22 2008
@@ -27,85 +27,83 @@
import org.ofbiz.product.store.*;
cart = session.getAttribute("shoppingCart");
-context.put("cart", cart);
+context.cart = cart;
orderItems = cart.makeOrderItems();
-context.put("orderItems", orderItems);
+context.orderItems = orderItems;
orderAdjustments = cart.makeAllAdjustments();
-List orderItemShipGroupInfo = cart.makeAllShipGroupInfos();
-if (orderItemShipGroupInfo != null && orderItemShipGroupInfo.size() > 0) {
- Iterator osiInfos = orderItemShipGroupInfo.iterator();
- while (osiInfos.hasNext()) {
- GenericValue valueObj = (GenericValue) osiInfos.next();
+orderItemShipGroupInfo = cart.makeAllShipGroupInfos();
+if (orderItemShipGroupInfo) {
+ orderItemShipGroupInfo.each { valueObj ->
if ("OrderAdjustment".equals(valueObj.getEntityName())) {
// shipping / tax adjustment(s)
orderAdjustments.add(valueObj);
}
}
}
-context.put("orderAdjustments", orderAdjustments);
+context.orderAdjustments = orderAdjustments;
workEfforts = cart.makeWorkEfforts(); // if required make workefforts for rental fixed assets too.
-context.put("workEfforts", workEfforts);
+context.workEfforts = workEfforts;
orderHeaderAdjustments = OrderReadHelper.getOrderHeaderAdjustments(orderAdjustments, null);
-context.put("orderHeaderAdjustments", orderHeaderAdjustments);
-context.put("orderItemShipGroups", cart.getShipGroups());
-context.put("headerAdjustmentsToShow", OrderReadHelper.filterOrderAdjustments(orderHeaderAdjustments, true, false, false, false, false));
-
-orderSubTotal = OrderReadHelper.getOrderItemsSubTotal(orderItems, orderAdjustments,workEfforts);
-context.put("orderSubTotal", orderSubTotal);
-context.put("placingCustomerPerson", userLogin == null ? null : userLogin.getRelatedOne("Person"));
-context.put("paymentMethods", cart.getPaymentMethods());
+context.orderHeaderAdjustments = orderHeaderAdjustments;
+context.orderItemShipGroups = cart.getShipGroups();
+context.headerAdjustmentsToShow = OrderReadHelper.filterOrderAdjustments(orderHeaderAdjustments, true, false, false, false, false);
+
+orderSubTotal = OrderReadHelper.getOrderItemsSubTotal(orderItems, orderAdjustments, workEfforts);
+context.orderSubTotal = orderSubTotal;
+context.placingCustomerPerson = userLogin?.getRelatedOne("Person");
+context.paymentMethods = cart.getPaymentMethods();
paymentMethodTypeIds = cart.getPaymentMethodTypeIds();
paymentMethodType = null;
paymentMethodTypeId = null;
-if (paymentMethodTypeIds != null && paymentMethodTypeIds.size() > 0) {
- paymentMethodTypeId = paymentMethodTypeIds.get(0);
- paymentMethodType = delegator.findByPrimaryKey("PaymentMethodType", UtilMisc.toMap("paymentMethodTypeId", paymentMethodTypeId));
- context.put("paymentMethodType", paymentMethodType);
+if (paymentMethodTypeIds) {
+ paymentMethodTypeId = paymentMethodTypeIds[0];
+ paymentMethodType = delegator.findByPrimaryKey("PaymentMethodType", [paymentMethodTypeId : paymentMethodTypeId]);
+ context.paymentMethodType = paymentMethodType;
}
webSiteId = CatalogWorker.getWebSiteId(request);
productStore = ProductStoreWorker.getProductStore(request);
-context.put("productStore", productStore);
+context.productStore = productStore;
-isDemoStore = !"N".equals(productStore.getString("isDemoStore"));
-context.put("isDemoStore", isDemoStore);
+isDemoStore = !"N".equals(productStore.isDemoStore);
+context.isDemoStore = isDemoStore;
-payToPartyId = productStore.getString("payToPartyId");
+payToPartyId = productStore.payToPartyId;
paymentAddress = PaymentWorker.getPaymentAddress(delegator, payToPartyId);
-if (paymentAddress != null) context.put("paymentAddress", paymentAddress);
+if (paymentAddress) context.paymentAddress = paymentAddress;
// TODO: FIXME!
/*
-billingAccount = cart.getBillingAccountId() != null ? delegator.findByPrimaryKey("BillingAccount", UtilMisc.toMap("billingAccountId", cart.getBillingAccountId())) : null;
-if (billingAccount != null)
- context.put("billingAccount", billingAccount);
+billingAccount = cart.getBillingAccountId() ? delegator.findByPrimaryKey("BillingAccount", [billingAccountId : cart.getBillingAccountId()]) : null;
+if (billingAccount)
+ context.billingAccount = billingAccount;
*/
-context.put("customerPoNumber", cart.getPoNumber());
-context.put("carrierPartyId", cart.getCarrierPartyId());
-context.put("shipmentMethodTypeId", cart.getShipmentMethodTypeId());
-context.put("shippingInstructions", cart.getShippingInstructions());
-context.put("maySplit", cart.getMaySplit());
-context.put("giftMessage", cart.getGiftMessage());
-context.put("isGift", cart.getIsGift());
-context.put("currencyUomId", cart.getCurrency());
-
-shipmentMethodType = delegator.findByPrimaryKey("ShipmentMethodType", UtilMisc.toMap("shipmentMethodTypeId", cart.getShipmentMethodTypeId()));
-if (shipmentMethodType != null) context.put("shipMethDescription", shipmentMethodType.getString("description"));
-
-OrderReadHelper orh = new OrderReadHelper(orderAdjustments, orderItems);
-context.put("localOrderReadHelper", orh);
-context.put("orderShippingTotal", cart.getTotalShipping());
-context.put("orderTaxTotal", cart.getTotalSalesTax());
-context.put("orderGrandTotal", new Double(cart.getGrandTotal()));
+context.customerPoNumber = cart.getPoNumber();
+context.carrierPartyId = cart.getCarrierPartyId();
+context.shipmentMethodTypeId = cart.getShipmentMethodTypeId();
+context.shippingInstructions = cart.getShippingInstructions();
+context.maySplit = cart.getMaySplit();
+context.giftMessage = cart.getGiftMessage();
+context.isGift = cart.getIsGift();
+context.currencyUomId = cart.getCurrency();
+
+shipmentMethodType = delegator.findByPrimaryKey("ShipmentMethodType", [shipmentMethodTypeId : cart.getShipmentMethodTypeId()]);
+if (shipmentMethodType) context.shipMethDescription = shipmentMethodType.description;
+
+orh = new OrderReadHelper(orderAdjustments, orderItems);
+context.localOrderReadHelper = orh;
+context.orderShippingTotal = cart.getTotalShipping();
+context.orderTaxTotal = cart.getTotalSalesTax();
+context.orderGrandTotal = new Double(cart.getGrandTotal());
// nuke the event messages
request.removeAttribute("_EVENT_MESSAGE_");
Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/CheckoutShippingOptions.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/checkoutshippingoptions.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/CheckoutShippingOptions.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/CheckoutShippingOptions.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/checkoutshippingoptions.bsh&r1=679885&r2=679994&rev=679994&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/checkoutshippingoptions.bsh (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/CheckoutShippingOptions.groovy Sat Jul 26 06:58:22 2008
@@ -28,23 +28,18 @@
party = userLogin.getRelatedOne("Party");
productStore = ProductStoreWorker.getProductStore(request);
-itemSizes = new LinkedList();
-featureIdSet = new HashSet();
-shipAddress = null;
-shipWeight = 0.00;
-shipTotal = 0.00;
-if (cart != null) {
+if (cart) {
shippingEstWpr = new ShippingEstimateWrapper(dispatcher, cart, 0);
- context.put("shippingEstWpr", shippingEstWpr);
- context.put("carrierShipmentMethodList", shippingEstWpr.getShippingMethods());
+ context.shippingEstWpr = shippingEstWpr;
+ context.carrierShipmentMethodList = shippingEstWpr.getShippingMethods();
}
-context.put("shoppingCart", cart);
-context.put("userLogin", userLogin);
-context.put("productStoreId", productStore.get("productStoreId"));
-context.put("productStore", productStore);
-context.put("emailList", ContactHelper.getContactMechByType(party, "EMAIL_ADDRESS", false));
+context.shoppingCart = cart;
+context.userLogin = userLogin;
+context.productStoreId = productStore.productStoreId;
+context.productStore = productStore;
+context.emailList = ContactHelper.getContactMechByType(party, "EMAIL_ADDRESS", false);
-if (cart.getShipmentMethodTypeId() != null && cart.getCarrierPartyId() != null) {
- context.put("chosenShippingMethod", cart.getShipmentMethodTypeId() + '@' + cart.getCarrierPartyId());
+if (cart.getShipmentMethodTypeId() && cart.getCarrierPartyId()) {
+ context.chosenShippingMethod = cart.getShipmentMethodTypeId() + '@' + cart.getCarrierPartyId();
}
Copied: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/CustSettings.groovy (from r679885, ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/custsettings.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/CustSettings.groovy?p2=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/CustSettings.groovy&p1=ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/custsettings.bsh&r1=679885&r2=679994&rev=679994&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/custsettings.bsh (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/CustSettings.groovy Sat Jul 26 06:58:22 2008
@@ -22,82 +22,81 @@
partyId = null;
-userLogin = context.get("userLogin");
-if (userLogin != null) {
- partyId = userLogin.get("partyId");
+if (userLogin) {
+ partyId = userLogin.partyId;
}
-if (partyId == null && parameters.get("partyId") != null) {
- partyId = parameters.get("partyId");
+if (!partyId && parameters.partyId) {
+ partyId = parameters.partyId;
}
-if (partyId != null) {
- parameters.put("partyId", partyId);
+if (partyId) {
+ parameters.partyId = partyId;
// NOTE: if there was an error, then don't look up and fill in all of this data, just use the values from the previous request (which will be in the parameters Map automagically)
- if (request.getAttribute("_ERROR_MESSAGE_") == null && request.getAttribute("_ERROR_MESSAGE_LIST_") == null) {
- person = delegator.findByPrimaryKey("Person", UtilMisc.toMap("partyId", partyId));
- if (person != null) {
- context.put("callSubmitForm",true);
+ if (!request.getAttribute("_ERROR_MESSAGE_") && !request.getAttribute("_ERROR_MESSAGE_LIST_")) {
+ person = delegator.findByPrimaryKey("Person", [partyId : partyId]);
+ if (person) {
+ context.callSubmitForm = true;
// should never be null for the anonymous checkout, but just in case
- parameters.put("personalTitle", person.get("personalTitle"));
- parameters.put("firstName", person.get("firstName"));
- parameters.put("middleName", person.get("middleName"));
- parameters.put("lastName", person.get("lastName"));
- parameters.put("suffix", person.get("suffix"));
-
+ parameters.personalTitle = person.personalTitle;
+ parameters.firstName = person.firstName;
+ parameters.middleName = person.middleName;
+ parameters.lastName = person.lastName;
+ parameters.suffix = person.suffix;
+
//Parameters not in use, Do we really need these here or should be removed.
- parameters.put("residenceStatusEnumId", person.get("residenceStatusEnumId"));
- parameters.put("maritalStatus", person.get("maritalStatus"));
- parameters.put("employmentStatusEnumId", person.get("employmentStatusEnumId"));
- parameters.put("occupation", person.get("occupation"));
- parameters.put("yearsWithEmployer", person.get("yearsWithEmployer"));
- parameters.put("monthsWithEmployer", person.get("monthsWithEmployer"));
- parameters.put("existingCustomer", person.get("existingCustomer"));
-
+ parameters.residenceStatusEnumId = person.residenceStatusEnumId;
+ parameters.maritalStatus = person.maritalStatus;
+ parameters.employmentStatusEnumId = person.employmentStatusEnumId;
+ parameters.occupation = person.occupation;
+ parameters.yearsWithEmployer = person.yearsWithEmployer;
+ parameters.monthsWithEmployer = person.monthsWithEmployer;
+ parameters.existingCustomer = person.existingCustomer;
+
// birthDate -> birthDateDay, birthDateMonth, birthDateYear
- birthDate = person.get("birthDate");
- if (birthDate != null) {
+ birthDate = person.birthDate;
+ if (birthDate) {
// will be in the format "yyyy-mm-dd", like "2006-10-21"
birthDateString = birthDate.toString();
- parameters.put("birthDateDay", birthDateString.substring(8));
- parameters.put("birthDateMonth", birthDateString.substring(5, 7));
- parameters.put("birthDateYear", birthDateString.substring(0, 4));
+ parameters.birthDateDay = birthDateString.substring(8);
+ parameters.birthDateMonth = birthDateString.substring(5, 7);
+ parameters.birthDateYear = birthDateString.substring(0, 4);
// and finally, the whole thing, just in case we want it that way
- parameters.put("birthDate", birthDateString);
+ parameters.birthDate = birthDateString;
}
}
-
+
// get the Email Address
emailPartyContactDetail = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("PartyContactDetailByPurpose",
- UtilMisc.toMap("partyId", partyId, "contactMechPurposeTypeId", "PRIMARY_EMAIL")), true));
- if (emailPartyContactDetail != null) {
- parameters.put("emailContactMechId", emailPartyContactDetail.get("contactMechId"));
- parameters.put("emailAddress", emailPartyContactDetail.get("infoString"));
- parameters.put("emailSol", emailPartyContactDetail.get("allowSolicitation"));
+ [partyId : partyId, contactMechPurposeTypeId : "PRIMARY_EMAIL"])));
+ if (emailPartyContactDetail) {
+ parameters.emailContactMechId = emailPartyContactDetail.contactMechId;
+ parameters.emailAddress = emailPartyContactDetail.infoString;
+ parameters.emailSol = emailPartyContactDetail.allowSolicitation;
}
// get the Phone Numbers
homePhonePartyContactDetail = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("PartyContactDetailByPurpose",
- UtilMisc.toMap("partyId", partyId, "contactMechPurposeTypeId", "PHONE_HOME")), true));
- if (homePhonePartyContactDetail != null) {
- parameters.put("homePhoneContactMechId", homePhonePartyContactDetail.get("contactMechId"));
- parameters.put("homeCountryCode", homePhonePartyContactDetail.get("countryCode"));
- parameters.put("homeAreaCode", homePhonePartyContactDetail.get("areaCode"));
- parameters.put("homeContactNumber", homePhonePartyContactDetail.get("contactNumber"));
- parameters.put("homeExt", homePhonePartyContactDetail.get("extension"));
- parameters.put("homeSol", homePhonePartyContactDetail.get("allowSolicitation"));
+ [partyId : partyId, contactMechPurposeTypeId : "PHONE_HOME"])));
+ if (homePhonePartyContactDetail) {
+ parameters.homePhoneContactMechId = homePhonePartyContactDetail.contactMechId;
+ parameters.homeCountryCode = homePhonePartyContactDetail.countryCode;
+ parameters.homeAreaCode = homePhonePartyContactDetail.areaCode;
+ parameters.homeContactNumber = homePhonePartyContactDetail.contactNumber;
+ parameters.homeExt = homePhonePartyContactDetail.extension;
+ parameters.homeSol = homePhonePartyContactDetail.allowSolicitation;
}
workPhonePartyContactDetail = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("PartyContactDetailByPurpose",
- UtilMisc.toMap("partyId", partyId, "contactMechPurposeTypeId", "PHONE_WORK")), true));
- if (workPhonePartyContactDetail != null) {
- parameters.put("workPhoneContactMechId", workPhonePartyContactDetail.get("contactMechId"));
- parameters.put("workCountryCode", workPhonePartyContactDetail.get("countryCode"));
- parameters.put("workAreaCode", workPhonePartyContactDetail.get("areaCode"));
- parameters.put("workContactNumber", workPhonePartyContactDetail.get("contactNumber"));
- parameters.put("workExt", workPhonePartyContactDetail.get("extension"));
- parameters.put("workSol", workPhonePartyContactDetail.get("allowSolicitation"));
+ [partyId : partyId, contactMechPurposeTypeId : "PHONE_WORK"])));
+ if (workPhonePartyContactDetail) {
+ parameters.workPhoneContactMechId = workPhonePartyContactDetail.contactMechId;
+ parameters.workCountryCode = workPhonePartyContactDetail.countryCode;
+ parameters.workAreaCode = workPhonePartyContactDetail.areaCode;
+ parameters.workContactNumber = workPhonePartyContactDetail.contactNumber;
+ parameters.workExt = workPhonePartyContactDetail.extension;
+ parameters.workSol = workPhonePartyContactDetail.allowSolicitation;
}
}
}
Modified: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/customer/viewprofile.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/customer/viewprofile.ftl?rev=679994&r1=679993&r2=679994&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/customer/viewprofile.ftl (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/customer/viewprofile.ftl Sat Jul 26 06:58:22 2008
@@ -573,7 +573,7 @@
</#if>
<#-- ============================================================= -->
-<#-- only 5 messages will show; edit the viewprofile.bsh to change this number -->
+<#-- only 5 messages will show; edit the ViewProfile.groovy to change this number -->
${screens.render("component://ecommerce/widget/CustomerScreens.xml#messagelist-include")}
${screens.render("component://ecommerce/widget/CustomerScreens.xml#FinAccountList-include")}
Modified: ofbiz/trunk/applications/ecommerce/widget/CartScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/widget/CartScreens.xml?rev=679994&r1=679993&r2=679994&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/widget/CartScreens.xml (original)
+++ ofbiz/trunk/applications/ecommerce/widget/CartScreens.xml Sat Jul 26 06:58:22 2008
@@ -43,7 +43,7 @@
<screen name="minipromotext">
<section>
<actions>
- <script location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/cart/showpromotext.bsh"/>
+ <script location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/cart/ShowPromoText.groovy"/>
</actions>
<widgets>
<platform-specific><html><html-template location="component://ecommerce/webapp/ecommerce/cart/minipromotext.ftl"/></html></platform-specific>
@@ -69,8 +69,8 @@
<set field="titleProperty" value="PageTitleShoppingCart"/>
<set field="headerItem" value="Shopping Cart"/>
- <script location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/cart/showcart.bsh"/>
- <script location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/cart/showpromotext.bsh"/>
+ <script location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/cart/ShowCart.groovy"/>
+ <script location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/cart/ShowPromoText.groovy"/>
</actions>
<widgets>
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
@@ -90,8 +90,8 @@
<set field="promoUseDetailsInlineScreen" value="component://ecommerce/widget/CartScreens.xml#promoUseDetailsInline"/>
<set field="titleProperty" value="PageTitleShowAllPromotions"/>
- <script location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/cart/showcart.bsh"/>
- <script location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/cart/showpromotext.bsh"/>
+ <script location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/cart/ShowCart.groovy"/>
+ <script location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/cart/ShowPromoText.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=679994&r1=679993&r2=679994&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/widget/CatalogScreens.xml (original)
+++ ofbiz/trunk/applications/ecommerce/widget/CatalogScreens.xml Sat Jul 26 06:58:22 2008
@@ -61,7 +61,7 @@
<screen name="minireorderprods">
<section>
<actions>
- <script location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/minireorderprods.bsh"/>
+ <script location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/MiniReorderProds.groovy"/>
<property-map resource="ProductUiLabels" map-name="uiLabelMap" global="true"/>
</actions>
<widgets>
@@ -94,7 +94,7 @@
<section>
<actions>
<property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
- <script location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/miniproductsummary.bsh"/>
+ <script location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/MiniProductSummary.groovy"/>
</actions>
<widgets>
<platform-specific><html><html-template location="component://ecommerce/webapp/ecommerce/catalog/minilastviewedproducts.ftl"/></html></platform-specific>
@@ -119,7 +119,7 @@
<actions>
<property-map resource="ProductUiLabels" map-name="uiLabelMap" global="true"/>
<property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
- <script location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/miniproductsummary.bsh"/>
+ <script location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/catalog/MiniProductSummary.groovy"/>
</actions>
<widgets>
<platform-specific><html><html-template location="component://ecommerce/webapp/ecommerce/catalog/miniproductsummary.ftl"/></html></platform-specific>