Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/CurrentValPrep.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/CurrentValPrep.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/CurrentValPrep.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/CurrentValPrep.groovy Wed Nov 2 19:09:13 2016 @@ -17,131 +17,131 @@ * under the License. */ -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.security.*; -import org.apache.ofbiz.service.*; -import org.apache.ofbiz.entity.model.*; -import org.apache.ofbiz.content.ContentManagementWorker; +import java.util.ArrayList +import java.util.Collection +import java.util.HashMap +import java.util.Iterator +import java.util.LinkedList +import java.util.List +import java.util.Map +import java.util.Set +import java.util.TreeSet +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.security.* +import org.apache.ofbiz.service.* +import org.apache.ofbiz.entity.model.* +import org.apache.ofbiz.content.ContentManagementWorker -import javax.servlet.*; -import javax.servlet.http.*; +import javax.servlet.* +import javax.servlet.http.* -currentEntityMap = session.getAttribute("currentEntityMap"); +currentEntityMap = session.getAttribute("currentEntityMap") if (!currentEntityMap) { - currentEntityMap = [:]; - session.setAttribute("currentEntityMap", currentEntityMap); + currentEntityMap = [:] + session.setAttribute("currentEntityMap", currentEntityMap) } -entityName = context.entityName; -currentEntityPropertyName = parameters.currentEntityPropertyName; +entityName = context.entityName +currentEntityPropertyName = parameters.currentEntityPropertyName if (!currentEntityPropertyName) { - currentEntityName = entityName; + currentEntityName = entityName } else { - currentEntityName = parameters[currentEntityPropertyName]; + currentEntityName = parameters[currentEntityPropertyName] } -//Debug.logInfo("in currentvalprep, currentEntityName:" + currentEntityName,""); -cachedPK = currentEntityMap[currentEntityName]; -//Debug.logInfo("in currentvalprep, cachedPK:" + cachedPK,""); +//Debug.logInfo("in currentvalprep, currentEntityName:" + currentEntityName,"") +cachedPK = currentEntityMap[currentEntityName] +//Debug.logInfo("in currentvalprep, cachedPK:" + cachedPK,"") // Build a key from param or attribute values. -paramMap = UtilHttp.getParameterMap(request); -//Debug.logInfo("paramMap:" + paramMap, null); -v = delegator.makeValue(currentEntityName); -passedPK = v.getPrimaryKey(); -keyColl = passedPK.getAllKeys(); -keyIt = keyColl.iterator(); +paramMap = UtilHttp.getParameterMap(request) +//Debug.logInfo("paramMap:" + paramMap, null) +v = delegator.makeValue(currentEntityName) +passedPK = v.getPrimaryKey() +keyColl = passedPK.getAllKeys() +keyIt = keyColl.iterator() while (keyIt.hasNext()) { - attrName = keyIt.next(); - attrVal = parameters[attrName]; - //Debug.logInfo("in currentvalprep, attrName:" + attrName,""); - //Debug.logInfo("in currentvalprep, attrVal:" + attrVal,""); + attrName = keyIt.next() + attrVal = parameters[attrName] + //Debug.logInfo("in currentvalprep, attrName:" + attrName,"") + //Debug.logInfo("in currentvalprep, attrVal:" + attrVal,"") if (attrVal) { - passedPK[attrName] = attrVal; + passedPK[attrName] = attrVal } } -//Debug.logInfo("in currentvalprep, passedPK:" + passedPK,""); +//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 -pksEqual = true; +pksEqual = true if (cachedPK) { - keyColl = cachedPK.getPrimaryKey().getAllKeys(); - keyIt = keyColl.iterator(); + keyColl = cachedPK.getPrimaryKey().getAllKeys() + keyIt = keyColl.iterator() while (keyIt.hasNext()) { - sCached = null; - sPassed = null; - oCached = null; - oCached = null; - ky = keyIt.next(); - oPassed = passedPK[ky]; + sCached = null + sPassed = null + oCached = null + oCached = null + ky = keyIt.next() + oPassed = passedPK[ky] if (oPassed) { - sPassed = oPassed; + sPassed = oPassed if (!sPassed) { - pksEqual = false; + pksEqual = false } else { - oCached = cachedPK[ky]; + oCached = cachedPK[ky] if (oCached) { - sCached = oCached; + sCached = oCached if (!sPassed) { - pksEqual = false; + pksEqual = false } else { if (!sPassed.equals(sCached)) { - //pksEqual = true; + //pksEqual = true } } } } } else { - pksEqual = false; + pksEqual = false } } } -currentPK = passedPK; +currentPK = passedPK if (!pksEqual) { - currentPK = cachedPK; + currentPK = cachedPK // all other condition result in currentPK = passedPK } -//Debug.logInfo("in currentvalprep, currentPK:" + currentPK,""); +//Debug.logInfo("in currentvalprep, currentPK:" + currentPK,"") -currentEntityMap[currentEntityName] = currentPK; -request.setAttribute("currentPK", currentPK); -context.currentPK = currentPK; -currentValue = from(currentPK.getPrimaryKey().getEntityName()).where(currentPK.getPrimaryKey()).queryOne(); -context.currentValue = currentValue; -request.setAttribute("currentValue", currentValue); +currentEntityMap[currentEntityName] = currentPK +request.setAttribute("currentPK", currentPK) +context.currentPK = currentPK +currentValue = from(currentPK.getPrimaryKey().getEntityName()).where(currentPK.getPrimaryKey()).queryOne() +context.currentValue = currentValue +request.setAttribute("currentValue", currentValue) -// Debug.logInfo("===========in currentvalprep, currentValue:" + request.getAttribute("currentValue"),""); +// Debug.logInfo("===========in currentvalprep, currentValue:" + request.getAttribute("currentValue"),"") if (currentValue) { if (currentEntityName.indexOf("DataResource") >= 0) { - suffix = ""; - s = currentValue.dataResourceTypeId ?: currentValue.drDataResourceTypeId; - if (s) suffix = "_" + s; + suffix = "" + s = currentValue.dataResourceTypeId ?: currentValue.drDataResourceTypeId + if (s) suffix = "_" + s if ("_ELECTRONIC_TEXT".equals(suffix)) { - s = currentValue.mimeTypeId ?: currentValue.drMimeTypeId; - if (s) suffix += "_" + s; + s = currentValue.mimeTypeId ?: currentValue.drMimeTypeId + if (s) suffix += "_" + s } - //Debug.logInfo("in currentvalprep, suffix:" + suffix,""); + //Debug.logInfo("in currentvalprep, suffix:" + suffix,"") // if (suffix) { -// ContentManagementWorker.mruAdd(session, currentPK, suffix); +// ContentManagementWorker.mruAdd(session, currentPK, suffix) // } else { - ContentManagementWorker.mruAdd(session, currentPK); + ContentManagementWorker.mruAdd(session, currentPK) // } } else { - ContentManagementWorker.mruAdd(session, currentPK); + ContentManagementWorker.mruAdd(session, currentPK) } } -//Debug.logInfo("in currentvalprep, contentId:" + request.getAttribute("contentId"),""); +//Debug.logInfo("in currentvalprep, contentId:" + request.getAttribute("contentId"),"") Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/EditAddPrep.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/EditAddPrep.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/EditAddPrep.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/EditAddPrep.groovy Wed Nov 2 19:09:13 2016 @@ -17,72 +17,72 @@ * under the License. */ -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.security.*; -import org.apache.ofbiz.service.*; -import org.apache.ofbiz.entity.model.*; -import org.apache.ofbiz.securityext.login.*; -import org.apache.ofbiz.common.*; -import org.apache.ofbiz.entity.model.*; -import org.apache.ofbiz.content.ContentManagementWorker; -import org.apache.ofbiz.content.content.ContentWorker; - -import freemarker.template.SimpleHash; -import freemarker.template.SimpleSequence; - -import javax.servlet.*; -import javax.servlet.http.*; - -singleWrapper = context.singleWrapper; -contentIdTo = parameters.contentIdTo; -singleWrapper.putInContext("contentIdTo", contentIdTo); -mapKey = parameters.mapKey; -singleWrapper.putInContext("mapKey", mapKey); +import java.util.ArrayList +import java.util.Collection +import java.util.HashMap +import java.util.Iterator +import java.util.LinkedList +import java.util.List +import java.util.Map +import java.util.Set +import java.util.TreeSet +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.security.* +import org.apache.ofbiz.service.* +import org.apache.ofbiz.entity.model.* +import org.apache.ofbiz.securityext.login.* +import org.apache.ofbiz.common.* +import org.apache.ofbiz.entity.model.* +import org.apache.ofbiz.content.ContentManagementWorker +import org.apache.ofbiz.content.content.ContentWorker + +import freemarker.template.SimpleHash +import freemarker.template.SimpleSequence + +import javax.servlet.* +import javax.servlet.http.* + +singleWrapper = context.singleWrapper +contentIdTo = parameters.contentIdTo +singleWrapper.putInContext("contentIdTo", contentIdTo) +mapKey = parameters.mapKey +singleWrapper.putInContext("mapKey", mapKey) if ("SUMMARY".equals(mapKey)) { - singleWrapper.putInContext("textSource", "summaryData"); + singleWrapper.putInContext("textSource", "summaryData") } else { - singleWrapper.putInContext("textSource", "textData"); + singleWrapper.putInContext("textSource", "textData") } -singleWrapper.putInContext("dataResourceTypeId", "ELECTRONIC_TEXT"); -singleWrapper.putInContext("contentAssocTypeId", "SUB_CONTENT"); -//Debug.logInfo("in editaddprep, contentIdTo:" + contentIdTo,""); -//Debug.logInfo("in editaddprep, mapKey:" + mapKey,""); -//currentValue = request.getAttribute("currentValue"); -//currentValue = request.getAttribute("currentValue"); +singleWrapper.putInContext("dataResourceTypeId", "ELECTRONIC_TEXT") +singleWrapper.putInContext("contentAssocTypeId", "SUB_CONTENT") +//Debug.logInfo("in editaddprep, contentIdTo:" + contentIdTo,"") +//Debug.logInfo("in editaddprep, mapKey:" + mapKey,"") +//currentValue = request.getAttribute("currentValue") +//currentValue = request.getAttribute("currentValue") -currentValue = ContentWorker.getSubContentCache(delegator, contentIdTo, mapKey, null, userLogin, null, null, false, null); -//Debug.logInfo("in editaddprep, currentValue:" + currentValue,""); +currentValue = ContentWorker.getSubContentCache(delegator, contentIdTo, mapKey, null, userLogin, null, null, false, null) +//Debug.logInfo("in editaddprep, currentValue:" + currentValue,"") if (!currentValue) { - parentValue = from("Content").where("contentId", contentIdTo).cache(true).queryOne(); - currentValue = delegator.makeValue("Content"); - subject = parentValue.contentName; + parentValue = from("Content").where("contentId", contentIdTo).cache(true).queryOne() + currentValue = delegator.makeValue("Content") + subject = parentValue.contentName if ("SUMMARY".equals(mapKey)) { - subject = "Short " + subject; + subject = "Short " + subject } - currentValue.contentName = subject; - currentValue.description = subject; - singleWrapper.putInContext("contentTypeId", "DOCUMENT"); + currentValue.contentName = subject + currentValue.description = subject + singleWrapper.putInContext("contentTypeId", "DOCUMENT") } else { - singleWrapper.putInContext("contentTypeId", null); - //Debug.logInfo("in editaddprep, currentValue:" + currentValue,""); + singleWrapper.putInContext("contentTypeId", null) + //Debug.logInfo("in editaddprep, currentValue:" + currentValue,"") } -singleWrapper.putInContext("currentValue", currentValue); -context.currentValue = currentValue; -request.setAttribute("currentValue", currentValue); -persistAction = parameters.persistAction ?: "persistContent"; +singleWrapper.putInContext("currentValue", currentValue) +context.currentValue = currentValue +request.setAttribute("currentValue", currentValue) +persistAction = parameters.persistAction ?: "persistContent" -singleWrapper.putInContext("persistAction", persistAction); -//Debug.logInfo("in editaddprep, currentValue:" + currentValue,""); +singleWrapper.putInContext("persistAction", persistAction) +//Debug.logInfo("in editaddprep, currentValue:" + currentValue,"") Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/HtmlAreaPrep.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/HtmlAreaPrep.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/HtmlAreaPrep.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/HtmlAreaPrep.groovy Wed Nov 2 19:09:13 2016 @@ -17,25 +17,25 @@ * under the License. */ -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.security.*; -import org.apache.ofbiz.service.*; -import org.apache.ofbiz.entity.model.*; -import org.apache.ofbiz.content.data.DataResourceWorker; -import org.apache.ofbiz.webapp.ftl.FreeMarkerViewHandler; - -import java.io.StringWriter; -import freemarker.ext.beans.BeansWrapper; -import freemarker.template.SimpleHash; -import freemarker.template.WrappingTemplateModel; +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.security.* +import org.apache.ofbiz.service.* +import org.apache.ofbiz.entity.model.* +import org.apache.ofbiz.content.data.DataResourceWorker +import org.apache.ofbiz.webapp.ftl.FreeMarkerViewHandler + +import java.io.StringWriter +import freemarker.ext.beans.BeansWrapper +import freemarker.template.SimpleHash +import freemarker.template.WrappingTemplateModel -import javax.servlet.*; -import javax.servlet.http.*; +import javax.servlet.* +import javax.servlet.http.* -contentIdTo = parameters.contentIdTo; +contentIdTo = parameters.contentIdTo if (!contentIdTo || !contentIdTo.equals("TEMPLATE_MASTER")) { - context.dynamicPrimaryHTMLField = "textData"; + context.dynamicPrimaryHTMLField = "textData" } Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/NodeTrailPrep.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/NodeTrailPrep.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/NodeTrailPrep.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/NodeTrailPrep.groovy Wed Nov 2 19:09:13 2016 @@ -17,64 +17,64 @@ * under the License. */ -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; - -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.security.*; -import org.apache.ofbiz.service.*; -import org.apache.ofbiz.entity.model.*; -import org.apache.ofbiz.securityext.login.*; -import org.apache.ofbiz.common.*; -import org.apache.ofbiz.entity.model.*; -import org.apache.ofbiz.content.content.ContentWorker; -import org.apache.ofbiz.content.ContentManagementWorker; +import java.util.ArrayList +import java.util.Collection +import java.util.HashMap +import java.util.Iterator +import java.util.LinkedList +import java.util.List +import java.util.Map +import java.util.Set +import java.util.TreeSet + +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.security.* +import org.apache.ofbiz.service.* +import org.apache.ofbiz.entity.model.* +import org.apache.ofbiz.securityext.login.* +import org.apache.ofbiz.common.* +import org.apache.ofbiz.entity.model.* +import org.apache.ofbiz.content.content.ContentWorker +import org.apache.ofbiz.content.ContentManagementWorker -import javax.servlet.*; -import javax.servlet.http.*; +import javax.servlet.* +import javax.servlet.http.* -nodeTrailCsv = ContentManagementWorker.getFromSomewhere("nodeTrailCsv", parameters, request, context); -passedParams = null; +nodeTrailCsv = ContentManagementWorker.getFromSomewhere("nodeTrailCsv", parameters, request, context) +passedParams = null if (!nodeTrailCsv) { // this only happens in UploadContentAndImage - passedParams = request.getAttribute("passedParams"); + passedParams = request.getAttribute("passedParams") if (passedParams) { - nodeTrailCsv = passedParams.nodeTrailCsv; + nodeTrailCsv = passedParams.nodeTrailCsv } } if (nodeTrailCsv) { - nodeTrail = ContentWorker.csvToTrail(nodeTrailCsv, delegator); - context.globalNodeTrail = nodeTrail; - singleWrapper = context.singleWrapper; + nodeTrail = ContentWorker.csvToTrail(nodeTrailCsv, delegator) + context.globalNodeTrail = nodeTrail + singleWrapper = context.singleWrapper if (singleWrapper) { - singleWrapper.putInContext("nodeTrailCsv",nodeTrailCsv); + 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"); + Map dummy = singleWrapper.getFromContext("dummy") if (!dummy) { - dummy = [:]; + dummy = [:] } - dummy.nodeTrailCsv = nodeTrailCsv; - //Debug.logInfo("in nodetrailprep, dummy:" + dummy,""); - singleWrapper.putInContext("dummy",dummy); + dummy.nodeTrailCsv = nodeTrailCsv + //Debug.logInfo("in nodetrailprep, dummy:" + dummy,"") + singleWrapper.putInContext("dummy",dummy) } - context.nodeTrailCsv = nodeTrailCsv; + context.nodeTrailCsv = nodeTrailCsv - //Debug.logInfo("in nodetrailprep, nodeTrailCsv:" + nodeTrailCsv,""); - trailContentList = ContentWorker.csvToContentList(nodeTrailCsv, delegator); - //Debug.logInfo("in nodetrailprep, trailContentList:" + trailContentList,""); - context.ancestorList = trailContentList; - //Debug.logInfo("in vewprep, siteAncestorList:" + siteAncestorList,""); + //Debug.logInfo("in nodetrailprep, nodeTrailCsv:" + nodeTrailCsv,"") + trailContentList = ContentWorker.csvToContentList(nodeTrailCsv, delegator) + //Debug.logInfo("in nodetrailprep, trailContentList:" + trailContentList,"") + context.ancestorList = trailContentList + //Debug.logInfo("in vewprep, siteAncestorList:" + siteAncestorList,"") } Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/OwnerContentPrep.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/OwnerContentPrep.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/OwnerContentPrep.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/OwnerContentPrep.groovy Wed Nov 2 19:09:13 2016 @@ -17,62 +17,62 @@ * under the License. */ -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.security.*; -import org.apache.ofbiz.service.*; -import org.apache.ofbiz.entity.model.*; -import org.apache.ofbiz.content.data.DataResourceWorker; -import org.apache.ofbiz.webapp.ftl.FreeMarkerViewHandler; -import org.apache.ofbiz.content.content.ContentWorker; -import org.apache.ofbiz.content.ContentManagementWorker; - -import java.io.StringWriter; -import freemarker.ext.beans.BeansWrapper; -import freemarker.template.SimpleHash; -import freemarker.template.WrappingTemplateModel; +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.security.* +import org.apache.ofbiz.service.* +import org.apache.ofbiz.entity.model.* +import org.apache.ofbiz.content.data.DataResourceWorker +import org.apache.ofbiz.webapp.ftl.FreeMarkerViewHandler +import org.apache.ofbiz.content.content.ContentWorker +import org.apache.ofbiz.content.ContentManagementWorker + +import java.io.StringWriter +import freemarker.ext.beans.BeansWrapper +import freemarker.template.SimpleHash +import freemarker.template.WrappingTemplateModel -import javax.servlet.*; -import javax.servlet.http.*; +import javax.servlet.* +import javax.servlet.http.* // load edit or create Content form -//Debug.logInfo("in ownerprep, security:" + security, ""); +//Debug.logInfo("in ownerprep, security:" + security, "") -rootPubPt = parameters.webSiteId; -//Debug.logInfo("in ownerprep, rootPubPt:" + rootPubPt, ""); -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, ""); -departmentPointMap = [:]; -departmentPointMapAll = [:]; -ownerContentList = []; +rootPubPt = parameters.webSiteId +//Debug.logInfo("in ownerprep, rootPubPt:" + rootPubPt, "") +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, "") +departmentPointMap = [:] +departmentPointMapAll = [:] +ownerContentList = [] departmentPointList.each { arr -> - contentId = arr[0]; - description = arr[1]; - subPointList = []; - lineMap = [:]; - lineMap.contentId = contentId; - lineMap.description = description.toUpperCase(); - ownerContentList.add(lineMap); - subDepartmentContentList = ContentManagementWorker.getAllDepartmentContent(delegator, contentId); + contentId = arr[0] + description = arr[1] + subPointList = [] + lineMap = [:] + lineMap.contentId = contentId + lineMap.description = description.toUpperCase() + ownerContentList.add(lineMap) + subDepartmentContentList = ContentManagementWorker.getAllDepartmentContent(delegator, contentId) subDepartmentContentList.each { departmentPoint2 -> - contentId2 = departmentPoint2.contentId; - description2 = departmentPoint2.templateTitle; - lineMap2 = [:]; - lineMap2.contentId = contentId2; - lineMap2.description = " -" + description2; - ownerContentList.add(lineMap2); + contentId2 = departmentPoint2.contentId + description2 = departmentPoint2.templateTitle + lineMap2 = [:] + lineMap2.contentId = contentId2 + lineMap2.description = " -" + description2 + ownerContentList.add(lineMap2) } } -//Debug.logInfo("in ownercontentprep, ownerContentList:" + ownerContentList, ""); +//Debug.logInfo("in ownercontentprep, ownerContentList:" + ownerContentList, "") -pubPt = context.pubPt; -//Debug.logInfo("in ownercontentprep, pubPt:" + pubPt, ""); -singleWrapper = context.singleWrapper; -singleWrapper.putInContext("ownerContentList", ownerContentList); -singleWrapper.putInContext("pubPt", pubPt); +pubPt = context.pubPt +//Debug.logInfo("in ownercontentprep, pubPt:" + pubPt, "") +singleWrapper = context.singleWrapper +singleWrapper.putInContext("ownerContentList", ownerContentList) +singleWrapper.putInContext("pubPt", pubPt) Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/PermPrep.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/PermPrep.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/PermPrep.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/PermPrep.groovy Wed Nov 2 19:09:13 2016 @@ -17,149 +17,149 @@ * under the License. */ -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; - -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.security.*; -import org.apache.ofbiz.service.*; -import org.apache.ofbiz.entity.model.*; -import org.apache.ofbiz.content.content.PermissionRecorder; -import org.apache.ofbiz.content.ContentManagementWorker; +import java.util.ArrayList +import java.util.Collection +import java.util.HashMap +import java.util.Iterator +import java.util.LinkedList +import java.util.List +import java.util.Map +import java.util.Set +import java.util.TreeSet + +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.security.* +import org.apache.ofbiz.service.* +import org.apache.ofbiz.entity.model.* +import org.apache.ofbiz.content.content.PermissionRecorder +import org.apache.ofbiz.content.ContentManagementWorker -import javax.servlet.*; -import javax.servlet.http.*; +import javax.servlet.* +import javax.servlet.http.* -paramMap = UtilHttp.getParameterMap(request); -//Debug.logInfo("in permprep, userLogin(0):" + userLogin, null); +paramMap = UtilHttp.getParameterMap(request) +//Debug.logInfo("in permprep, userLogin(0):" + userLogin, null) // Get permission from pagedef config file -permission = context.permission; -permissionType = context.permissionType ?: "simple"; +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.mode; -//Debug.logInfo("in permprep, contentId(0):" + request.getAttribute("contentId"),""); -currentValue = request.getAttribute("currentValue"); -//Debug.logInfo("in permprep, paramMap(1):" + paramMap, null); -//Debug.logInfo("in permprep, currentValue(1):" + currentValue, null); +entityName = context.entityName +entityOperation = context.entityOperation +targetOperation = context.targetOperation +//Debug.logInfo("in permprep, targetOperation(0):" + targetOperation, null) + +mode = paramMap.mode +//Debug.logInfo("in permprep, contentId(0):" + request.getAttribute("contentId"),"") +currentValue = request.getAttribute("currentValue") +//Debug.logInfo("in permprep, paramMap(1):" + paramMap, null) +//Debug.logInfo("in permprep, currentValue(1):" + currentValue, null) if ("add".equals(mode)) { - entityOperation = context.addEntityOperation ?: context.entityOperation ?: "_CREATE"; - targetOperation = context.addTargetOperation ?: context.get("targetOperation") ?: "CONTENT_CREATE"; - //org.apache.ofbiz.base.util.Debug.logInfo("in permprep, targetOperation:" + targetOperation, null); + entityOperation = context.addEntityOperation ?: context.entityOperation ?: "_CREATE" + targetOperation = context.addTargetOperation ?: context.get("targetOperation") ?: "CONTENT_CREATE" + //org.apache.ofbiz.base.util.Debug.logInfo("in permprep, targetOperation:" + targetOperation, null) } else { if (!entityOperation) { - entityOperation = "_UPDATE"; + entityOperation = "_UPDATE" } if (!targetOperation) { - targetOperation = "CONTENT_UPDATE"; + targetOperation = "CONTENT_UPDATE" } } if (permissionType.equals("complex")) { - mapIn = [:]; - mapIn.userLogin = userLogin; - targetOperationList = StringUtil.split(targetOperation, "|"); - mapIn.targetOperationList = targetOperationList; - thisContentId = null; + mapIn = [:] + mapIn.userLogin = userLogin + targetOperationList = StringUtil.split(targetOperation, "|") + mapIn.targetOperationList = targetOperationList + thisContentId = null - //Debug.logInfo("in permprep, userLogin(1):" + userLogin, null); + //Debug.logInfo("in permprep, userLogin(1):" + userLogin, null) //if (userLogin != null) { - //Debug.logInfo("in permprep, userLoginId(1):" + userLogin.get("userLoginId"), null); + //Debug.logInfo("in permprep, userLoginId(1):" + userLogin.get("userLoginId"), null) //} if (!currentValue || !"Content".equals(entityName)) { - permissionIdName = context.permissionIdName; - //org.apache.ofbiz.base.util.Debug.logInfo("in permprep, permissionIdName(1):" + permissionIdName, null); + permissionIdName = context.permissionIdName + //org.apache.ofbiz.base.util.Debug.logInfo("in permprep, permissionIdName(1):" + permissionIdName, null) if (!permissionIdName) { - thisContentId = ContentManagementWorker.getFromSomewhere(permissionIdName, paramMap, request, context); + thisContentId = ContentManagementWorker.getFromSomewhere(permissionIdName, paramMap, request, context) } else if (!thisContentId) { - thisContentId = ContentManagementWorker.getFromSomewhere("subContentId", paramMap, request, context); + thisContentId = ContentManagementWorker.getFromSomewhere("subContentId", paramMap, request, context) } else if (!thisContentId) { - thisContentId = ContentManagementWorker.getFromSomewhere("contentIdTo", paramMap, request, context); + thisContentId = ContentManagementWorker.getFromSomewhere("contentIdTo", paramMap, request, context) } else if (!thisContentId) { - thisContentId = ContentManagementWorker.getFromSomewhere("contentId", paramMap, request, context); + thisContentId = ContentManagementWorker.getFromSomewhere("contentId", paramMap, request, context) } - //org.apache.ofbiz.base.util.Debug.logInfo("in permprep, thisContentId(2):" + thisContentId, null); + //org.apache.ofbiz.base.util.Debug.logInfo("in permprep, thisContentId(2):" + thisContentId, null) } else { - thisContentId = currentValue.contentId; + thisContentId = currentValue.contentId } - //org.apache.ofbiz.base.util.Debug.logInfo("in permprep, thisContentId(3):" + thisContentId, null); + //org.apache.ofbiz.base.util.Debug.logInfo("in permprep, thisContentId(3):" + thisContentId, null) if (!currentValue || !"Content".equals(entityName)) { if (thisContentId) { - currentValue = from("Content").where("contentId", thisContentId).queryOne(); + currentValue = from("Content").where("contentId", thisContentId).queryOne() } } if ("add".equals(mode)) { - addEntityOperation = context.addEntityOperation; + addEntityOperation = context.addEntityOperation if (addEntityOperation) { - entityOperation = addEntityOperation; + entityOperation = addEntityOperation } } else { - editEntityOperation = context.editEntityOperation; + editEntityOperation = context.editEntityOperation if (editEntityOperation) { - entityOperation = editEntityOperation; + entityOperation = editEntityOperation } } - //org.apache.ofbiz.base.util.Debug.logInfo("in permprep, currentValue(2):" + currentValue, null); + //org.apache.ofbiz.base.util.Debug.logInfo("in permprep, currentValue(2):" + currentValue, null) if ("Content".equals(currentValue?.getEntityName())) { - mapIn.currentContent = currentValue; + mapIn.currentContent = currentValue } - mapIn.entityOperation = entityOperation; + mapIn.entityOperation = entityOperation - contentPurposeTypeId = context.contentPurposeTypeId; + contentPurposeTypeId = context.contentPurposeTypeId if (contentPurposeTypeId) { - mapIncontentPurposeList = StringUtil.split(contentPurposeTypeId, "|"); + mapIncontentPurposeList = StringUtil.split(contentPurposeTypeId, "|") } - //org.apache.ofbiz.base.util.Debug.logInfo("in permprep, mapIn:" + mapIn, null); - result = runService('checkContentPermission', mapIn); - permissionStatus = result.permissionStatus; - //org.apache.ofbiz.base.util.Debug.logInfo("in permprep, permissionStatus:" + permissionStatus, null); + //org.apache.ofbiz.base.util.Debug.logInfo("in permprep, mapIn:" + mapIn, null) + result = runService('checkContentPermission', mapIn) + permissionStatus = result.permissionStatus + //org.apache.ofbiz.base.util.Debug.logInfo("in permprep, permissionStatus:" + permissionStatus, null) if ("granted".equals(permissionStatus)) { - context.hasPermission = true; - request.setAttribute("hasPermission", true); - request.setAttribute("permissionStatus", "granted"); + context.hasPermission = true + request.setAttribute("hasPermission", true) + request.setAttribute("permissionStatus", "granted") } else { - context.hasPermission = false; - request.setAttribute("hasPermission", false); - request.setAttribute("permissionStatus", ""); - errorMessage = "Permission to display:" + page.getPageName() + " is denied."; - recorder = result.permissionRecorder; - //Debug.logInfo("recorder(0):" + recorder, ""); + context.hasPermission = false + request.setAttribute("hasPermission", false) + request.setAttribute("permissionStatus", "") + errorMessage = "Permission to display:" + page.getPageName() + " is denied." + recorder = result.permissionRecorder + //Debug.logInfo("recorder(0):" + recorder, "") if (recorder) { - permissionMessage = recorder.toHtml(); - //Debug.logInfo("permissionMessage(0):" + permissionMessage, ""); - errorMessage += " \n " + permissionMessage; + permissionMessage = recorder.toHtml() + //Debug.logInfo("permissionMessage(0):" + permissionMessage, "") + errorMessage += " \n " + permissionMessage } - request.setAttribute("errorMsgReq", errorMessage); + request.setAttribute("errorMsgReq", errorMessage) } - //Debug.logInfo("in permprep, contentId(1):" + request.getAttribute("contentId"),""); + //Debug.logInfo("in permprep, contentId(1):" + request.getAttribute("contentId"),"") } else { - //org.apache.ofbiz.base.util.Debug.logInfo("permission:" + permission , null); - //org.apache.ofbiz.base.util.Debug.logInfo("entityOperation:" + entityOperation , null); + //org.apache.ofbiz.base.util.Debug.logInfo("permission:" + permission , null) + //org.apache.ofbiz.base.util.Debug.logInfo("entityOperation:" + entityOperation , null) if (security.hasEntityPermission(permission, entityOperation, session)) { - //org.apache.ofbiz.base.util.Debug.logInfo("hasEntityPermission is true:" , null); - context.hasPermission = true; - request.setAttribute("hasPermission", true); - request.setAttribute("permissionStatus", "granted"); + //org.apache.ofbiz.base.util.Debug.logInfo("hasEntityPermission is true:" , null) + context.hasPermission = true + request.setAttribute("hasPermission", true) + request.setAttribute("permissionStatus", "granted") } else { - //org.apache.ofbiz.base.util.Debug.logInfo("hasEntityPermission is false:" , null); - context.hasPermission = false; - request.setAttribute("hasPermission", false); - request.setAttribute("permissionStatus", ""); + //org.apache.ofbiz.base.util.Debug.logInfo("hasEntityPermission is false:" , null) + context.hasPermission = false + request.setAttribute("hasPermission", false) + request.setAttribute("permissionStatus", "") } } Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/PubInit.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/PubInit.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/PubInit.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/PubInit.groovy Wed Nov 2 19:09:13 2016 @@ -17,40 +17,40 @@ * under the License. */ -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.security.*; -import org.apache.ofbiz.service.*; -import org.apache.ofbiz.entity.model.*; -import org.apache.ofbiz.webapp.website.WebSiteWorker; -import org.apache.ofbiz.securityext.login.*; -import org.apache.ofbiz.common.*; -import org.apache.ofbiz.entity.model.*; -import org.apache.ofbiz.content.ContentManagementWorker; +import java.util.ArrayList +import java.util.Collection +import java.util.HashMap +import java.util.Iterator +import java.util.LinkedList +import java.util.List +import java.util.Map +import java.util.Set +import java.util.TreeSet +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.security.* +import org.apache.ofbiz.service.* +import org.apache.ofbiz.entity.model.* +import org.apache.ofbiz.webapp.website.WebSiteWorker +import org.apache.ofbiz.securityext.login.* +import org.apache.ofbiz.common.* +import org.apache.ofbiz.entity.model.* +import org.apache.ofbiz.content.ContentManagementWorker -import javax.servlet.*; -import javax.servlet.http.*; +import javax.servlet.* +import javax.servlet.http.* -paramMap = UtilHttp.getParameterMap(request); -forumId = null; -servletContext = session.getServletContext(); -rootForumId = WebSiteWorker.getWebSiteId(request); -context.rootPubId = rootForumId; -session.setAttribute("rootPubId", rootForumId); -request.setAttribute("rootPubId", rootForumId); -forumId = ContentManagementWorker.getFromSomewhere("forumId", paramMap, request, context); +paramMap = UtilHttp.getParameterMap(request) +forumId = null +servletContext = session.getServletContext() +rootForumId = WebSiteWorker.getWebSiteId(request) +context.rootPubId = rootForumId +session.setAttribute("rootPubId", rootForumId) +request.setAttribute("rootPubId", rootForumId) +forumId = ContentManagementWorker.getFromSomewhere("forumId", paramMap, request, context) if (forumId) { - forumId = rootForumId; + forumId = rootForumId } -context.forumId = forumId; -session.setAttribute("forumId", forumId); -request.setAttribute("forumId", forumId); +context.forumId = forumId +session.setAttribute("forumId", forumId) +request.setAttribute("forumId", forumId) Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/RespondPermAndPrep.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/RespondPermAndPrep.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/RespondPermAndPrep.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/RespondPermAndPrep.groovy Wed Nov 2 19:09:13 2016 @@ -17,139 +17,139 @@ * under the License. */ -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; - -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.security.*; -import org.apache.ofbiz.service.*; -import org.apache.ofbiz.entity.model.*; -import org.apache.ofbiz.content.content.PermissionRecorder; +import java.util.ArrayList +import java.util.Collection +import java.util.HashMap +import java.util.Iterator +import java.util.LinkedList +import java.util.List +import java.util.Map +import java.util.Set +import java.util.TreeSet + +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.security.* +import org.apache.ofbiz.service.* +import org.apache.ofbiz.entity.model.* +import org.apache.ofbiz.content.content.PermissionRecorder -import javax.servlet.*; -import javax.servlet.http.*; +import javax.servlet.* +import javax.servlet.http.* -paramMap = UtilHttp.getParameterMap(request); +paramMap = UtilHttp.getParameterMap(request) -contentIdTo = paramMap.contentIdTo; +contentIdTo = paramMap.contentIdTo if (!contentIdTo) { - request.setAttribute("errorMsgReq", "contentIdTo is empty"); - return; + request.setAttribute("errorMsgReq", "contentIdTo is empty") + return } /* -pubPt = paramMap.pubPt ?: context.pubPt; +pubPt = paramMap.pubPt ?: context.pubPt if (!pubPt) { - request.setAttribute("errorMsgReq", "pubPt is empty"); - return; + request.setAttribute("errorMsgReq", "pubPt is empty") + return } */ -contentToValue = from("Content").where("contentId", contentIdTo).queryOne(); -contentToPurposeList = contentToValue.getRelated("ContentPurpose", null, null, true); -currentValue = delegator.makeValue("Content", [contentTypeId : "DOCUMENT", statusId : "CTNT_PUBLISHED", privilegeEnumId : "_00_"]); +contentToValue = from("Content").where("contentId", contentIdTo).queryOne() +contentToPurposeList = contentToValue.getRelated("ContentPurpose", null, null, true) +currentValue = delegator.makeValue("Content", [contentTypeId : "DOCUMENT", statusId : "CTNT_PUBLISHED", privilegeEnumId : "_00_"]) if (contentToPurposeList.contains("RESPONSE")) { - ownerContentId = contentToValue.ownerContentId; - currentValue.ownerContentId = ownerContentId; + ownerContentId = contentToValue.ownerContentId + currentValue.ownerContentId = ownerContentId } else { - contentId = contentToValue.contentId; - currentValueownerContentId = contentId; + contentId = contentToValue.contentId + currentValueownerContentId = contentId } -mapIn = [:]; -mapIn.userLogin = userLogin; -targetOperationList = StringUtil.split(context.targetOperation, "|"); -mapIn.targetOperationList = targetOperationList; +mapIn = [:] +mapIn.userLogin = userLogin +targetOperationList = StringUtil.split(context.targetOperation, "|") +mapIn.targetOperationList = targetOperationList if (currentValue) { - mapIn.currentContent = currentValue; + mapIn.currentContent = currentValue } -mapIn.entityOperation = "_CREATE"; -mapIn.contentPurposeList = ["RESPONSE"]; +mapIn.entityOperation = "_CREATE" +mapIn.contentPurposeList = ["RESPONSE"] -//org.apache.ofbiz.base.util.Debug.logInfo("in permprep, mapIn:" + mapIn, null); -result = runService('checkContentPermission', mapIn); -permissionStatus = result.permissionStatus; -//org.apache.ofbiz.base.util.Debug.logInfo("permissionStatus:" + permissionStatus, null); +//org.apache.ofbiz.base.util.Debug.logInfo("in permprep, mapIn:" + mapIn, null) +result = runService('checkContentPermission', mapIn) +permissionStatus = result.permissionStatus +//org.apache.ofbiz.base.util.Debug.logInfo("permissionStatus:" + permissionStatus, null) if (!"granted".equals(permissionStatus)) { - request.setAttribute("errorMsgReq", "Permission to add response is denied (1)"); - errorMessage = "Permission to add response is denied (2)"; - recorder = result.permissionRecorder; - //Debug.logInfo("recorder(0):" + recorder, ""); + request.setAttribute("errorMsgReq", "Permission to add response is denied (1)") + errorMessage = "Permission to add response is denied (2)" + recorder = result.permissionRecorder + //Debug.logInfo("recorder(0):" + recorder, "") if (recorder) { - permissionMessage = recorder.toHtml(); - //Debug.logInfo("permissionMessage(0):" + permissionMessage, ""); - errorMessage += " \n " + permissionMessage; + permissionMessage = recorder.toHtml() + //Debug.logInfo("permissionMessage(0):" + permissionMessage, "") + errorMessage += " \n " + permissionMessage } - request.setAttribute("permissionErrorMsg", errorMessage); - context.permissionErrorMsg = errorMessage; - context.hasPermission = false; - request.setAttribute("hasPermission", false); - request.setAttribute("permissionStatus", ""); - return; + request.setAttribute("permissionErrorMsg", errorMessage) + context.permissionErrorMsg = errorMessage + context.hasPermission = false + request.setAttribute("hasPermission", false) + request.setAttribute("permissionStatus", "") + return } else { - context.hasPermission = true; - request.setAttribute("hasPermission", true); - request.setAttribute("permissionStatus", "granted"); + context.hasPermission = true + request.setAttribute("hasPermission", true) + request.setAttribute("permissionStatus", "granted") } /* -pubContentValue = delegator.findOne("Content", [contentId : pubPt], false); +pubContentValue = delegator.findOne("Content", [contentId : pubPt], false) if (pubContentValue) { - mapIn.currentContent = pubContentValue; - mapIn.statusId = "CTNT_PUBLISHED"; + mapIn.currentContent = pubContentValue + mapIn.statusId = "CTNT_PUBLISHED" } -//org.apache.ofbiz.base.util.Debug.logInfo("in permprep(2), mapIn:" + mapIn, null); -result = dispatcher.runSync("checkContentPermission", mapIn); -permissionStatus = result.permissionStatus; -//org.apache.ofbiz.base.util.Debug.logInfo("permissionStatus(2):" + permissionStatus, null); +//org.apache.ofbiz.base.util.Debug.logInfo("in permprep(2), mapIn:" + mapIn, null) +result = dispatcher.runSync("checkContentPermission", mapIn) +permissionStatus = result.permissionStatus +//org.apache.ofbiz.base.util.Debug.logInfo("permissionStatus(2):" + permissionStatus, null) if (!"granted".equals(permissionStatus)) { - request.setAttribute("errorMsgReq", "Permission to add response is denied (2)"); - errorMessage = "Permission to add response is denied (2)"; - recorder = result.permissionRecorder; - //Debug.logInfo("recorder(0):" + recorder, ""); + request.setAttribute("errorMsgReq", "Permission to add response is denied (2)") + errorMessage = "Permission to add response is denied (2)" + recorder = result.permissionRecorder + //Debug.logInfo("recorder(0):" + recorder, "") if (recorder) { - permissionMessage = recorder.toHtml(); - //Debug.logInfo("permissionMessage(0):" + permissionMessage, ""); - errorMessage += " \n " + permissionMessage; + permissionMessage = recorder.toHtml() + //Debug.logInfo("permissionMessage(0):" + permissionMessage, "") + errorMessage += " \n " + permissionMessage } - request.setAttribute("permissionErrorMsg", errorMessage); - context.permissionErrorMsg = errorMessage; - context.hasPermission = false; - request.setAttribute("hasPermission", false); - request.setAttribute("permissionStatus", ""); - return; + request.setAttribute("permissionErrorMsg", errorMessage) + context.permissionErrorMsg = errorMessage + context.hasPermission = false + request.setAttribute("hasPermission", false) + request.setAttribute("permissionStatus", "") + return } else { - context.hasPermission = true; - request.setAttribute("hasPermission", true); - request.setAttribute("permissionStatus", "granted"); + context.hasPermission = true + request.setAttribute("hasPermission", true) + request.setAttribute("permissionStatus", "granted") } */ -request.setAttribute("currentValue", currentValue); -singleWrapper = context.singleWrapper; -singleWrapper.putInContext("contentPurposeTypeId", context.contentPurposeTypeId); -singleWrapper.putInContext("targetOperation", context.targetOperation); -singleWrapper.putInContext("targetOperationString", context.targetOperation); -singleWrapper.putInContext("currentValue", currentValue); +request.setAttribute("currentValue", currentValue) +singleWrapper = context.singleWrapper +singleWrapper.putInContext("contentPurposeTypeId", context.contentPurposeTypeId) +singleWrapper.putInContext("targetOperation", context.targetOperation) +singleWrapper.putInContext("targetOperationString", context.targetOperation) +singleWrapper.putInContext("currentValue", currentValue) -trailList = context.trailList; -replyName = null; +trailList = context.trailList +replyName = null if (trailList) { - idNamePair = trailList[trailList.size() -1]; - replyName = idNamePair[1]; + idNamePair = trailList[trailList.size() -1] + replyName = idNamePair[1] if (!replyName.contains("RE:")) { - replyName = "RE:" + replyName; + replyName = "RE:" + replyName } } -singleWrapper.putInContext("replyName", [contentName : replyName, description : replyName]); +singleWrapper.putInContext("replyName", [contentName : replyName, description : replyName]) Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/ResponsePrep.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/ResponsePrep.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/ResponsePrep.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/ResponsePrep.groovy Wed Nov 2 19:09:13 2016 @@ -17,59 +17,59 @@ * under the License. */ -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; - -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.security.*; -import org.apache.ofbiz.service.*; -import org.apache.ofbiz.entity.model.*; -import org.apache.ofbiz.securityext.login.*; -import org.apache.ofbiz.common.*; -import org.apache.ofbiz.content.content.ContentWorker; - -import javax.servlet.*; -import javax.servlet.http.*; - -paramMap = UtilHttp.getParameterMap(request); - - -contentIdTo = paramMap.contentIdTo; -nodeTrailCsv = paramMap.nodeTrailCsv; -//Debug.logInfo("in viewprep, nodeTrailCsv:" + nodeTrailCsv,""); -context.nodeTrailCsv = nodeTrailCsv; -contentId = paramMap.contentIdTo; -context.subContentId = contentId; -context.contentIdTo = contentId; - -trail = StringUtil.split(nodeTrailCsv, ","); -siteAncestorList = []; -idList = []; +import java.util.ArrayList +import java.util.Collection +import java.util.HashMap +import java.util.Iterator +import java.util.LinkedList +import java.util.List +import java.util.Map +import java.util.Set +import java.util.TreeSet + +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.security.* +import org.apache.ofbiz.service.* +import org.apache.ofbiz.entity.model.* +import org.apache.ofbiz.securityext.login.* +import org.apache.ofbiz.common.* +import org.apache.ofbiz.content.content.ContentWorker + +import javax.servlet.* +import javax.servlet.http.* + +paramMap = UtilHttp.getParameterMap(request) + + +contentIdTo = paramMap.contentIdTo +nodeTrailCsv = paramMap.nodeTrailCsv +//Debug.logInfo("in viewprep, nodeTrailCsv:" + nodeTrailCsv,"") +context.nodeTrailCsv = nodeTrailCsv +contentId = paramMap.contentIdTo +context.subContentId = contentId +context.contentIdTo = contentId + +trail = StringUtil.split(nodeTrailCsv, ",") +siteAncestorList = [] +idList = [] if (trail) { - pubPt = trail[0]; - ContentWorker.getContentAncestry(delegator, pubPt, "SUBSITE", "To", idList); - idList.add(pubPt); + pubPt = trail[0] + ContentWorker.getContentAncestry(delegator, pubPt, "SUBSITE", "To", idList) + idList.add(pubPt) } // start at 1 to skip webSiteId idList.each { id -> - webSitePublishPoint = from("WebSitePublishPoint").where("contentId", id).cache(true).queryOne(); - siteAncestorList.add(webSitePublishPoint); + webSitePublishPoint = from("WebSitePublishPoint").where("contentId", id).cache(true).queryOne() + siteAncestorList.add(webSitePublishPoint) } -context.siteAncestorList = siteAncestorList; -//Debug.logInfo("in viewprep, siteAncestorList:" + siteAncestorList,""); +context.siteAncestorList = siteAncestorList +//Debug.logInfo("in viewprep, siteAncestorList:" + siteAncestorList,"") -singleWrapper = context.singleWrapper; -// singleWrapper.putInContext("pageName", page.getPageName()); -singleWrapper.putInContext("contentIdTo", contentIdTo); -singleWrapper.putInContext("summaryDataResourceTypeId", null); -singleWrapper.putInContext("mapKey", null); -singleWrapper.putInContext("nodeTrailCsv", nodeTrailCsv); +singleWrapper = context.singleWrapper +// singleWrapper.putInContext("pageName", page.getPageName()) +singleWrapper.putInContext("contentIdTo", contentIdTo) +singleWrapper.putInContext("summaryDataResourceTypeId", null) +singleWrapper.putInContext("mapKey", null) +singleWrapper.putInContext("nodeTrailCsv", nodeTrailCsv) Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/ViewPrep.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/ViewPrep.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/ViewPrep.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/forum/ViewPrep.groovy Wed Nov 2 19:09:13 2016 @@ -17,55 +17,55 @@ * under the License. */ -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; - -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.security.*; -import org.apache.ofbiz.service.*; -import org.apache.ofbiz.entity.model.*; -import org.apache.ofbiz.securityext.login.*; -import org.apache.ofbiz.common.*; -import org.apache.ofbiz.content.content.ContentWorker; -import org.apache.ofbiz.content.ContentManagementWorker; +import java.util.ArrayList +import java.util.Collection +import java.util.HashMap +import java.util.Iterator +import java.util.LinkedList +import java.util.List +import java.util.Map +import java.util.Set +import java.util.TreeSet + +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.security.* +import org.apache.ofbiz.service.* +import org.apache.ofbiz.entity.model.* +import org.apache.ofbiz.securityext.login.* +import org.apache.ofbiz.common.* +import org.apache.ofbiz.content.content.ContentWorker +import org.apache.ofbiz.content.ContentManagementWorker -import javax.servlet.*; -import javax.servlet.http.*; +import javax.servlet.* +import javax.servlet.http.* -paramMap = UtilHttp.getParameterMap(request); +paramMap = UtilHttp.getParameterMap(request) // Strip old VIEW_INDEX from query string if present //since we are adding them again. -temp = request.getQueryString(); -queryString = UtilHttp.stripViewParamsFromQueryString(temp); -//Debug.logInfo("in viewprep, queryString(1):" + queryString,""); -context.queryString = queryString; -//Debug.logInfo("in viewprep, queryString(2):" + queryString,""); - -requestURL = request.getRequestURL(); -//Debug.logInfo("in viewprep, requestURL(3):" + requestURL,""); -context.requestURL = requestURL; -viewSize = paramMap.VIEW_SIZE; -context.viewSize = viewSize; -//Debug.logInfo("in viewprep, viewSize(3):" + viewSize,""); -viewIndex = paramMap.VIEW_INDEX; -context.viewIndex = viewIndex; -//Debug.logInfo("in viewprep, viewIndex(3):" + viewIndex,""); - -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.subContentId = contentId; -context.contentIdTo = contentId; -forumId = ContentManagementWorker.getFromSomewhere("forumId", paramMap, request, context); -//forumContent = delegator.findOne("Content", [contentId : forumId], true); -//context.forumContent = forumContent; +temp = request.getQueryString() +queryString = UtilHttp.stripViewParamsFromQueryString(temp) +//Debug.logInfo("in viewprep, queryString(1):" + queryString,"") +context.queryString = queryString +//Debug.logInfo("in viewprep, queryString(2):" + queryString,"") + +requestURL = request.getRequestURL() +//Debug.logInfo("in viewprep, requestURL(3):" + requestURL,"") +context.requestURL = requestURL +viewSize = paramMap.VIEW_SIZE +context.viewSize = viewSize +//Debug.logInfo("in viewprep, viewSize(3):" + viewSize,"") +viewIndex = paramMap.VIEW_INDEX +context.viewIndex = viewIndex +//Debug.logInfo("in viewprep, viewIndex(3):" + viewIndex,"") + +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.subContentId = contentId +context.contentIdTo = contentId +forumId = ContentManagementWorker.getFromSomewhere("forumId", paramMap, request, context) +//forumContent = delegator.findOne("Content", [contentId : forumId], true) +//context.forumContent = forumContent Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/includes/MruAdd.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/includes/MruAdd.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/includes/MruAdd.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/includes/MruAdd.groovy Wed Nov 2 19:09:13 2016 @@ -17,55 +17,55 @@ * under the License. */ -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; - -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.security.*; -import org.apache.ofbiz.service.*; -import org.apache.ofbiz.entity.model.*; -import org.apache.ofbiz.content.ContentManagementWorker; -import org.apache.ofbiz.content.content.ContentWorker; -import org.apache.ofbiz.base.util.collections.LifoSet; - -import javax.servlet.*; -import javax.servlet.http.*; - -lookupCaches = session.getAttribute("lookupCaches"); -//org.apache.ofbiz.base.util.Debug.logInfo("entityName:" + entityName, ""); -//org.apache.ofbiz.base.util.Debug.logInfo("in MruAdd.groovy, lookupCaches:" + lookupCaches, ""); +import java.util.ArrayList +import java.util.Collection +import java.util.HashMap +import java.util.Iterator +import java.util.LinkedList +import java.util.List +import java.util.Map +import java.util.Set +import java.util.TreeSet + +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.security.* +import org.apache.ofbiz.service.* +import org.apache.ofbiz.entity.model.* +import org.apache.ofbiz.content.ContentManagementWorker +import org.apache.ofbiz.content.content.ContentWorker +import org.apache.ofbiz.base.util.collections.LifoSet + +import javax.servlet.* +import javax.servlet.http.* + +lookupCaches = session.getAttribute("lookupCaches") +//org.apache.ofbiz.base.util.Debug.logInfo("entityName:" + entityName, "") +//org.apache.ofbiz.base.util.Debug.logInfo("in MruAdd.groovy, lookupCaches:" + lookupCaches, "") if (!lookupCaches) { - lookupCaches = [:]; - session.setAttribute("lookupCaches", lookupCaches); + lookupCaches = [:] + session.setAttribute("lookupCaches", lookupCaches) } -cacheEntityName = entityName; -//Debug.logInfo("cacheEntityName:" + cacheEntityName, ""); -lifoSet = lookupCaches[cacheEntityName]; -//org.apache.ofbiz.base.util.Debug.logInfo("lifoSet:" + lifoSet, ""); +cacheEntityName = entityName +//Debug.logInfo("cacheEntityName:" + cacheEntityName, "") +lifoSet = lookupCaches[cacheEntityName] +//org.apache.ofbiz.base.util.Debug.logInfo("lifoSet:" + lifoSet, "") if (!lifoSet) { - lifoSet = new LifoSet(10); - lookupCaches[cacheEntityName] = lifoSet; + lifoSet = new LifoSet(10) + lookupCaches[cacheEntityName] = lifoSet } -paramMap = UtilHttp.getParameterMap(request); -contentId = paramMap.contentId; -contentAssocDataResourceViewFrom = ContentWorker.getSubContentCache(delegator, null, null, contentId, null, null, null, null, null); -//Debug.logInfo("in mruadd, contentAssocDataResourceViewFrom :" + contentAssocDataResourceViewFrom , ""); +paramMap = UtilHttp.getParameterMap(request) +contentId = paramMap.contentId +contentAssocDataResourceViewFrom = ContentWorker.getSubContentCache(delegator, null, null, contentId, null, null, null, null, null) +//Debug.logInfo("in mruadd, contentAssocDataResourceViewFrom :" + contentAssocDataResourceViewFrom , "") if (contentAssocDataResourceViewFrom) { - lookupCaches = session.getAttribute("lookupCaches"); - viewPK = contentAssocDataResourceViewFrom.getPrimaryKey(); - //Debug.logInfo("in mruadd, viewPK :" + viewPK , ""); + lookupCaches = session.getAttribute("lookupCaches") + viewPK = contentAssocDataResourceViewFrom.getPrimaryKey() + //Debug.logInfo("in mruadd, viewPK :" + viewPK , "") if (viewPK) { - ContentManagementWorker.mruAdd(session, viewPK); + ContentManagementWorker.mruAdd(session, viewPK) } } Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/AnonymousCheckoutLinks.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/AnonymousCheckoutLinks.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/AnonymousCheckoutLinks.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/AnonymousCheckoutLinks.groovy Wed Nov 2 19:09:13 2016 @@ -17,30 +17,30 @@ * under the License. */ -import org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents; +import org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents -shoppingCart = ShoppingCartEvents.getCartObject(request); +shoppingCart = ShoppingCartEvents.getCartObject(request) if (userLogin) { - context.enableShippingAddress = true; + context.enableShippingAddress = true } -shippingContactMechId = shoppingCart.getShippingContactMechId(); +shippingContactMechId = shoppingCart.getShippingContactMechId() if (shippingContactMechId) { - context.enableShipmentMethod = true; + context.enableShipmentMethod = true } -shipmentMethodTypeId = shoppingCart.getShipmentMethodTypeId(); +shipmentMethodTypeId = shoppingCart.getShipmentMethodTypeId() if (shipmentMethodTypeId) { - context.enablePaymentOptions = true; + context.enablePaymentOptions = true } -paymentMethodIds = shoppingCart.getPaymentMethodIds(); -paymentMethodTypeId = parameters.paymentMethodTypeId; +paymentMethodIds = shoppingCart.getPaymentMethodIds() +paymentMethodTypeId = parameters.paymentMethodTypeId if (paymentMethodIds || paymentMethodTypeId) { - context.enablePaymentInformation = true; + context.enablePaymentInformation = true } if (paymentMethodIds) { - context.enableReviewOrder = true; + context.enableReviewOrder = true } Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/AnonymousTrail.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/AnonymousTrail.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/AnonymousTrail.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/AnonymousTrail.groovy Wed Nov 2 19:09:13 2016 @@ -17,26 +17,26 @@ * under the License. */ -import org.apache.ofbiz.order.shoppingcart.*; +import org.apache.ofbiz.order.shoppingcart.* -cart = session.getAttribute("shoppingCart"); +cart = session.getAttribute("shoppingCart") -trailClassMap = [:]; +trailClassMap = [:] if (cart.getShippingContactMechId()) { - context.shipAddr = "Y"; - trailClassMap.shipAddr = "submenutextright"; + context.shipAddr = "Y" + trailClassMap.shipAddr = "submenutextright" } if (cart.getShipmentMethodTypeId()) { - context.shipOptions = "Y"; - trailClassMap.shipAddr = "submenutext"; - trailClassMap.shipOptions = "submenutextright"; + context.shipOptions = "Y" + trailClassMap.shipAddr = "submenutext" + trailClassMap.shipOptions = "submenutextright" } if (parameters.paymentMethodType || cart.getPaymentMethodIds() || cart.getPaymentMethodTypeIds()) { - context.billing = "Y"; - trailClassMap.shipOptions = "submenutext"; - trailClassMap.paymentType = "submenutextright"; + context.billing = "Y" + trailClassMap.shipOptions = "submenutext" + trailClassMap.paymentType = "submenutextright" } -context.trailClass = trailClassMap; +context.trailClass = trailClassMap Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/BillSettings.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/BillSettings.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/BillSettings.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/BillSettings.groovy Wed Nov 2 19:09:13 2016 @@ -17,92 +17,92 @@ * under the License. */ -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.entity.util.*; -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.accounting.payment.*; -import org.apache.ofbiz.order.shoppingcart.*; -import org.apache.ofbiz.party.contact.*; - -cart = session.getAttribute("shoppingCart"); -currencyUomId = cart.getCurrency(); -payType = parameters.paymentMethodType; +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.entity.util.* +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.accounting.payment.* +import org.apache.ofbiz.order.shoppingcart.* +import org.apache.ofbiz.party.contact.* + +cart = session.getAttribute("shoppingCart") +currencyUomId = cart.getCurrency() +payType = parameters.paymentMethodType if (!payType && parameters.useGc) { - payType = "GC"; + payType = "GC" } -context.cart = cart; -context.paymentMethodType = payType; +context.cart = cart +context.paymentMethodType = payType -partyId = cart.getPartyId() ?: userLogin.partyId; -context.partyId = partyId; +partyId = cart.getPartyId() ?: userLogin.partyId +context.partyId = partyId // nuke the event messages -request.removeAttribute("_EVENT_MESSAGE_"); +request.removeAttribute("_EVENT_MESSAGE_") if (partyId && !partyId.equals("_NA_")) { - party = from("Party").where("partyId", partyId).queryOne(); - person = party.getRelatedOne("Person", false); - context.party = party; - context.person = person; + party = from("Party").where("partyId", partyId).queryOne() + person = party.getRelatedOne("Person", false) + context.party = party + context.person = person if (party) { - context.paymentMethodList = EntityUtil.filterByDate(party.getRelated("PaymentMethod", null, null, false)); + context.paymentMethodList = EntityUtil.filterByDate(party.getRelated("PaymentMethod", null, null, false)) - billingAccountList = BillingAccountWorker.makePartyBillingAccountList(userLogin, currencyUomId, partyId, delegator, dispatcher); + billingAccountList = BillingAccountWorker.makePartyBillingAccountList(userLogin, currencyUomId, partyId, delegator, dispatcher) if (billingAccountList) { - context.selectedBillingAccountId = cart.getBillingAccountId(); - context.billingAccountList = billingAccountList; + context.selectedBillingAccountId = cart.getBillingAccountId() + context.billingAccountList = billingAccountList } } } if (parameters.useShipAddr && cart.getShippingContactMechId()) { - shippingContactMech = cart.getShippingContactMechId(); - postalAddress = from("PostalAddress").where("contactMechId", shippingContactMech).queryOne(); - context.useEntityFields = "Y"; - context.postalFields = postalAddress; + shippingContactMech = cart.getShippingContactMechId() + postalAddress = from("PostalAddress").where("contactMechId", shippingContactMech).queryOne() + context.useEntityFields = "Y" + context.postalFields = postalAddress if (postalAddress && partyId) { - partyContactMech = from("PartyContactMech").where("partyId", partyId, "contactMechId", postalAddress.contactMechId).orderBy("-fromDate").filterByDate().queryFirst(); - context.partyContactMech = partyContactMech; + partyContactMech = from("PartyContactMech").where("partyId", partyId, "contactMechId", postalAddress.contactMechId).orderBy("-fromDate").filterByDate().queryFirst() + context.partyContactMech = partyContactMech } } else { - context.postalFields = UtilHttp.getParameterMap(request); + context.postalFields = UtilHttp.getParameterMap(request) } if (cart && !parameters.singleUsePayment) { if (cart.getPaymentMethodIds() ) { - checkOutPaymentId = cart.getPaymentMethodIds()[0]; - context.checkOutPaymentId = checkOutPaymentId; - paymentMethod = from("PaymentMethod").where("paymentMethodId", checkOutPaymentId).queryOne(); - account = null; + checkOutPaymentId = cart.getPaymentMethodIds()[0] + context.checkOutPaymentId = checkOutPaymentId + paymentMethod = from("PaymentMethod").where("paymentMethodId", checkOutPaymentId).queryOne() + account = null if ("CREDIT_CARD".equals(paymentMethod.paymentMethodTypeId)) { - account = paymentMethod.getRelatedOne("CreditCard", false); - context.creditCard = account; - context.paymentMethodType = "CC"; + account = paymentMethod.getRelatedOne("CreditCard", false) + context.creditCard = account + context.paymentMethodType = "CC" } else if ("EFT_ACCOUNT".equals(paymentMethod.paymentMethodTypeId)) { - account = paymentMethod.getRelatedOne("EftAccount", false); - context.eftAccount = account; - context.paymentMethodType = "EFT"; + account = paymentMethod.getRelatedOne("EftAccount", false) + context.eftAccount = account + context.paymentMethodType = "EFT" } else if ("GIFT_CARD".equals(paymentMethod.paymentMethodTypeId)) { - account = paymentMethod.getRelatedOne("GiftCard", false); - context.giftCard = account; - context.paymentMethodType = "GC"; + account = paymentMethod.getRelatedOne("GiftCard", false) + context.giftCard = account + context.paymentMethodType = "GC" } else { - context.paymentMethodType = "offline"; + context.paymentMethodType = "offline" } if (account && parameters.useShipAddr) { - address = account.getRelatedOne("PostalAddress", false); - context.postalAddress = address; - context.postalFields = address; + address = account.getRelatedOne("PostalAddress", false) + context.postalAddress = address + context.postalFields = address } } else if (cart.getPaymentMethodTypeIds()) { - checkOutPaymentId = cart.getPaymentMethodTypeIds()[0]; - context.checkOutPaymentId = checkOutPaymentId; + checkOutPaymentId = cart.getPaymentMethodTypeIds()[0] + context.checkOutPaymentId = checkOutPaymentId } } -requestPaymentMethodType = parameters.paymentMethodType; +requestPaymentMethodType = parameters.paymentMethodType if (requestPaymentMethodType) { - context.paymentMethodType = requestPaymentMethodType; + context.paymentMethodType = requestPaymentMethodType } Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/CheckoutReview.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/CheckoutReview.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/CheckoutReview.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/CheckoutReview.groovy Wed Nov 2 19:09:13 2016 @@ -17,94 +17,94 @@ * under the License. */ -import java.lang.*; -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.accounting.payment.*; -import org.apache.ofbiz.order.order.*; -import org.apache.ofbiz.party.contact.*; -import org.apache.ofbiz.product.catalog.*; -import org.apache.ofbiz.product.store.*; -import org.apache.ofbiz.webapp.website.WebSiteWorker; - -cart = session.getAttribute("shoppingCart"); -context.cart = cart; +import java.lang.* +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.accounting.payment.* +import org.apache.ofbiz.order.order.* +import org.apache.ofbiz.party.contact.* +import org.apache.ofbiz.product.catalog.* +import org.apache.ofbiz.product.store.* +import org.apache.ofbiz.webapp.website.WebSiteWorker + +cart = session.getAttribute("shoppingCart") +context.cart = cart -orderItems = cart.makeOrderItems(); -context.orderItems = orderItems; +orderItems = cart.makeOrderItems() +context.orderItems = orderItems -orderAdjustments = cart.makeAllAdjustments(); +orderAdjustments = cart.makeAllAdjustments() -orderItemShipGroupInfo = cart.makeAllShipGroupInfos(); +orderItemShipGroupInfo = cart.makeAllShipGroupInfos() if (orderItemShipGroupInfo) { orderItemShipGroupInfo.each { valueObj -> if ("OrderAdjustment".equals(valueObj.getEntityName())) { // shipping / tax adjustment(s) - orderAdjustments.add(valueObj); + orderAdjustments.add(valueObj) } } } -context.orderAdjustments = orderAdjustments; +context.orderAdjustments = orderAdjustments -workEfforts = cart.makeWorkEfforts(); // if required make workefforts for rental fixed assets too. -context.workEfforts = workEfforts; +workEfforts = cart.makeWorkEfforts() // if required make workefforts for rental fixed assets too. +context.workEfforts = workEfforts -orderHeaderAdjustments = OrderReadHelper.getOrderHeaderAdjustments(orderAdjustments, null); -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", false); -context.paymentMethods = cart.getPaymentMethods(); - -paymentMethodTypeIds = cart.getPaymentMethodTypeIds(); -paymentMethodType = null; -paymentMethodTypeId = null; +orderHeaderAdjustments = OrderReadHelper.getOrderHeaderAdjustments(orderAdjustments, null) +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", false) +context.paymentMethods = cart.getPaymentMethods() + +paymentMethodTypeIds = cart.getPaymentMethodTypeIds() +paymentMethodType = null +paymentMethodTypeId = null if (paymentMethodTypeIds) { - paymentMethodTypeId = paymentMethodTypeIds[0]; - paymentMethodType = from("PaymentMethodType").where("paymentMethodTypeId", paymentMethodTypeId).queryOne(); - context.paymentMethodType = paymentMethodType; + paymentMethodTypeId = paymentMethodTypeIds[0] + paymentMethodType = from("PaymentMethodType").where("paymentMethodTypeId", paymentMethodTypeId).queryOne() + context.paymentMethodType = paymentMethodType } -webSiteId = WebSiteWorker.getWebSiteId(request); +webSiteId = WebSiteWorker.getWebSiteId(request) -productStore = ProductStoreWorker.getProductStore(request); -context.productStore = productStore; +productStore = ProductStoreWorker.getProductStore(request) +context.productStore = productStore -isDemoStore = !"N".equals(productStore.isDemoStore); -context.isDemoStore = isDemoStore; +isDemoStore = !"N".equals(productStore.isDemoStore) +context.isDemoStore = isDemoStore -payToPartyId = productStore.payToPartyId; -paymentAddress = PaymentWorker.getPaymentAddress(delegator, payToPartyId); -if (paymentAddress) context.paymentAddress = paymentAddress; +payToPartyId = productStore.payToPartyId +paymentAddress = PaymentWorker.getPaymentAddress(delegator, payToPartyId) +if (paymentAddress) context.paymentAddress = paymentAddress // TODO: FIXME! /* -billingAccount = cart.getBillingAccountId() ? delegator.findOne("BillingAccount", [billingAccountId : cart.getBillingAccountId()], false) : null; +billingAccount = cart.getBillingAccountId() ? delegator.findOne("BillingAccount", [billingAccountId : cart.getBillingAccountId()], false) : null if (billingAccount) - context.billingAccount = billingAccount; + context.billingAccount = billingAccount */ -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 = from("ShipmentMethodType").where("shipmentMethodTypeId", cart.getShipmentMethodTypeId()).queryOne(); -if (shipmentMethodType) context.shipMethDescription = shipmentMethodType.description; - -orh = new OrderReadHelper(orderAdjustments, orderItems); -context.localOrderReadHelper = orh; -context.orderShippingTotal = cart.getTotalShipping(); -context.orderTaxTotal = cart.getTotalSalesTax(); -context.orderGrandTotal = 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 = from("ShipmentMethodType").where("shipmentMethodTypeId", cart.getShipmentMethodTypeId()).queryOne() +if (shipmentMethodType) context.shipMethDescription = shipmentMethodType.description + +orh = new OrderReadHelper(orderAdjustments, orderItems) +context.localOrderReadHelper = orh +context.orderShippingTotal = cart.getTotalShipping() +context.orderTaxTotal = cart.getTotalSalesTax() +context.orderGrandTotal = cart.getGrandTotal() // nuke the event messages -request.removeAttribute("_EVENT_MESSAGE_"); +request.removeAttribute("_EVENT_MESSAGE_") Modified: ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/CheckoutShippingOptions.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/CheckoutShippingOptions.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/CheckoutShippingOptions.groovy (original) +++ ofbiz/trunk/specialpurpose/ecommerce/groovyScripts/order/CheckoutShippingOptions.groovy Wed Nov 2 19:09:13 2016 @@ -17,29 +17,29 @@ * under the License. */ -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.entity.util.*; -import org.apache.ofbiz.party.contact.*; -import org.apache.ofbiz.product.store.*; -import org.apache.ofbiz.order.shoppingcart.shipping.*; +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.entity.util.* +import org.apache.ofbiz.party.contact.* +import org.apache.ofbiz.product.store.* +import org.apache.ofbiz.order.shoppingcart.shipping.* -cart = session.getAttribute("shoppingCart"); -party = userLogin.getRelatedOne("Party", false); -productStore = ProductStoreWorker.getProductStore(request); +cart = session.getAttribute("shoppingCart") +party = userLogin.getRelatedOne("Party", false) +productStore = ProductStoreWorker.getProductStore(request) if (cart) { - shippingEstWpr = new ShippingEstimateWrapper(dispatcher, cart, 0); - context.shippingEstWpr = shippingEstWpr; - context.carrierShipmentMethodList = shippingEstWpr.getShippingMethods(); + shippingEstWpr = new ShippingEstimateWrapper(dispatcher, cart, 0) + context.shippingEstWpr = shippingEstWpr + context.carrierShipmentMethodList = shippingEstWpr.getShippingMethods() } -context.shoppingCart = cart; -context.userLogin = userLogin; -context.productStoreId = productStore.productStoreId; -context.productStore = productStore; -context.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() && cart.getCarrierPartyId()) { - context.chosenShippingMethod = cart.getShipmentMethodTypeId() + '@' + cart.getCarrierPartyId(); + context.chosenShippingMethod = cart.getShipmentMethodTypeId() + '@' + cart.getCarrierPartyId() } |
Free forum by Nabble | Edit this page |