Author: mrisaliti
Date: Fri Jun 13 15:02:46 2008 New Revision: 667666 URL: http://svn.apache.org/viewvc?rev=667666&view=rev Log: Converted some content bsh scripts to groovy (Part of issue OFBIZ-1801) Added: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/content/PrepSeqNo.groovy - copied, changed from r667620, ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/content/prepseqno.bsh ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/datasetup/DataCategoryPrep.groovy - copied, changed from r667620, ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/datasetup/datacategoryprep.bsh ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/layout/EditSubContent.groovy - copied, changed from r667620, ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/layout/editsubcontent.bsh ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/print/FindPrinters.groovy - copied, changed from r667620, ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/print/findPrinters.bsh ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyQuestions.groovy - copied, changed from r667620, ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyQuestions.bsh ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyResponse.groovy - copied, changed from r667620, ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyResponse.bsh ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/ViewSurveyResponses.groovy - copied, changed from r667620, ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/ViewSurveyResponses.bsh ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/EditWebSiteParties.groovy - copied, changed from r667620, ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/EditWebSiteParties.bsh ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSiteCMSMetaInfo.groovy - copied, changed from r667620, ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSiteCMSMetaInfo.bsh ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSitePublishPoint.groovy - copied, changed from r667620, ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSitePublishPoint.bsh Removed: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/content/prepseqno.bsh ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/datasetup/datacategoryprep.bsh ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/layout/editsubcontent.bsh ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/print/findPrinters.bsh ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyQuestions.bsh ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyResponse.bsh ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/ViewSurveyResponses.bsh ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/EditWebSiteParties.bsh ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSiteCMSMetaInfo.bsh ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSitePublishPoint.bsh Modified: ofbiz/trunk/applications/content/widget/SurveyScreens.xml ofbiz/trunk/applications/content/widget/WebSiteScreens.xml ofbiz/trunk/applications/content/widget/compdoc/CompDocScreens.xml ofbiz/trunk/applications/content/widget/datasetup/DataResourceSetupScreens.xml ofbiz/trunk/applications/content/widget/layout/LayoutScreens.xml Copied: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/content/PrepSeqNo.groovy (from r667620, ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/content/prepseqno.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/content/PrepSeqNo.groovy?p2=ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/content/PrepSeqNo.groovy&p1=ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/content/prepseqno.bsh&r1=667620&r2=667666&rev=667666&view=diff ============================================================================== --- ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/content/prepseqno.bsh (original) +++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/content/PrepSeqNo.groovy Fri Jun 13 15:02:46 2008 @@ -16,17 +16,18 @@ * specific language governing permissions and limitations * under the License. */ -import org.ofbiz.base.util.Debug; -import org.ofbiz.base.util.UtilValidate; + +import org.ofbiz.base.util.Debug -seqNo = context.get("caSequenceNum"); -if (UtilValidate.isEmpty(seqNo)) { - seqNo = context.get("sequenceNum"); +seqNo = context.caSequenceNum; +if (!seqNo) { + seqNo = context.sequenceNum; } Debug.logInfo("caSequenceNum:" + seqNo, ""); -if (seqNo != null) { + +if (seqNo) { seqNumBefore = seqNo - 1; - context.put("seqNumBefore", seqNumBefore); + context.seqNumBefore = seqNumBefore; seqNumAfter = seqNo + 1; - context.put("seqNumAfter", seqNumAfter); -} + context.seqNumAfter = seqNumAfter; +} \ No newline at end of file Copied: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/datasetup/DataCategoryPrep.groovy (from r667620, ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/datasetup/datacategoryprep.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/datasetup/DataCategoryPrep.groovy?p2=ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/datasetup/DataCategoryPrep.groovy&p1=ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/datasetup/datacategoryprep.bsh&r1=667620&r2=667666&rev=667666&view=diff ============================================================================== --- ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/datasetup/datacategoryprep.bsh (original) +++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/datasetup/DataCategoryPrep.groovy Fri Jun 13 15:02:46 2008 @@ -17,26 +17,20 @@ * under the License. */ -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.ofbiz.base.util.*; -import org.ofbiz.entity.*; -import org.ofbiz.content.data.DataResourceWorker; +import org.ofbiz.entity.* +import org.ofbiz.content.data.DataResourceWorker /** * This script calls two methods in DataResourceWorker to build an indented * DataCategory picklist. */ - -List dataCategoryTrail = new ArrayList(); -Map rootNode = new HashMap(); -rootNode.put("id", "ROOT"); +dataCategoryTrail = [] as ArrayList; +rootNode = [:]; +rootNode.id = "ROOT"; DataResourceWorker.getDataCategoryMap(delegator, 0, rootNode, dataCategoryTrail, true); -List dataCategoryList = new ArrayList(); + +dataCategoryList = [] as ArrayList; DataResourceWorker.buildList(rootNode, dataCategoryList, 0); -context.put("dataCategoryList", dataCategoryList); +context.dataCategoryList = dataCategoryList; \ No newline at end of file Copied: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/layout/EditSubContent.groovy (from r667620, ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/layout/editsubcontent.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/layout/EditSubContent.groovy?p2=ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/layout/EditSubContent.groovy&p1=ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/layout/editsubcontent.bsh&r1=667620&r2=667666&rev=667666&view=diff ============================================================================== --- ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/layout/editsubcontent.bsh (original) +++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/layout/EditSubContent.groovy Fri Jun 13 15:02:46 2008 @@ -17,50 +17,38 @@ * under the License. */ -import org.ofbiz.base.util.*; -import org.ofbiz.entity.*; -import org.ofbiz.security.*; -import org.ofbiz.service.*; -import org.ofbiz.entity.model.*; -import org.ofbiz.widget.html.*; -import org.ofbiz.widget.form.*; -import org.ofbiz.content.data.DataResourceWorker; -import org.ofbiz.webapp.ftl.FreeMarkerViewHandler; +import org.ofbiz.base.util.* +import org.ofbiz.entity.* +import org.ofbiz.entity.model.* +import org.ofbiz.content.data.DataResourceWorker +import org.ofbiz.webapp.ftl.FreeMarkerViewHandler + +import java.io.StringWriter +import freemarker.ext.beans.BeansWrapper +import freemarker.template.WrappingTemplateModel -import java.io.StringWriter; -import freemarker.ext.beans.BeansWrapper; -import freemarker.template.WrappingTemplateModel; - -import javax.servlet.*; -import javax.servlet.http.*; - -// load edit or create Content form -dispatcher = (LocalDispatcher)request.getAttribute("dispatcher"); -delegator = (GenericDelegator) request.getAttribute("delegator"); +import javax.servlet.* +import javax.servlet.http.* Locale locale = UtilHttp.getLocale(request); -if (currentValue != null) { - dataResourceId = (String)currentValue.get("drDataResourceId"); - dataResourceTypeId = (String)currentValue.get("drDataResourceTypeId"); - if (UtilValidate.isNotEmpty(dataResourceTypeId)) { - mimeTypeId = (String)currentValue.get("drMimeTypeId"); +if (currentValue) { + dataResourceId = currentValue.drDataResourceId; + dataResourceTypeId = currentValue.drDataResourceTypeId; + if (dataResourceTypeId) { + mimeTypeId = currentValue.drMimeTypeId; rootDir = request.getSession().getServletContext().getRealPath("/"); wrapper = BeansWrapper.getDefaultInstance(); WrappingTemplateModel.setDefaultObjectWrapper(wrapper); - templateRoot = new HashMap(); + templateRoot = [:]; FreeMarkerViewHandler.prepOfbizRoot(templateRoot, request, response); - ctx = new HashMap(); - ctx.put("rootDir", rootDir); + ctx = [:]; + ctx.rootDir = rootDir; // webSiteId and https need to go here, too - templateRoot.put("context", ctx); + templateRoot.context = ctx; out = new StringWriter(); - currentValue.set("drDataTemplateTypeId", "NONE"); + currentValue.drDataTemplateTypeId = "NONE"; DataResourceWorker.renderDataResourceAsText(delegator, dataResourceId, out, templateRoot, currentValue, locale, mimeTypeId); textData = out.toString(); - context.put("textData", textData); + context.textData = textData; } -} - -//context.put("contentIdTo", contentIdTo); -//mapKey = (String)paramMap.get("mapKey"); - +} \ No newline at end of file Copied: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/print/FindPrinters.groovy (from r667620, ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/print/findPrinters.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/print/FindPrinters.groovy?p2=ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/print/FindPrinters.groovy&p1=ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/print/findPrinters.bsh&r1=667620&r2=667666&rev=667666&view=diff ============================================================================== --- ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/print/findPrinters.bsh (original) +++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/print/FindPrinters.groovy Fri Jun 13 15:02:46 2008 @@ -17,14 +17,12 @@ * under the License. */ -import javax.print.PrintService; -import javax.print.PrintServiceLookup; -import javax.print.attribute.PrintServiceAttribute; -import javax.print.attribute.standard.PrinterName; +import javax.print.PrintService +import javax.print.PrintServiceLookup +import javax.print.attribute.PrintServiceAttribute +import javax.print.attribute.standard.PrinterName -import javolution.util.FastList; - -List printers = FastList.newInstance(); +printers = []; PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null); if (services.length > 0) { for (int i = 0; i < services.length; i++) { @@ -32,4 +30,4 @@ printers.add(((PrinterName)attr).getValue()); } } -context.put("printers", printers); +context.printers = printers; \ No newline at end of file Copied: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyQuestions.groovy (from r667620, ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyQuestions.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyQuestions.groovy?p2=ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyQuestions.groovy&p1=ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyQuestions.bsh&r1=667620&r2=667666&rev=667666&view=diff ============================================================================== --- ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyQuestions.bsh (original) +++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyQuestions.groovy Fri Jun 13 15:02:46 2008 @@ -17,19 +17,19 @@ * under the License. */ -import java.util.*; -import org.ofbiz.entity.*; -import org.ofbiz.base.util.*; -import org.ofbiz.widget.html.*; - -surveyQuestionId = parameters.get("surveyQuestionId"); -context.put("surveyQuestionId", surveyQuestionId); - -surveyQuestion = delegator.findByPrimaryKey("SurveyQuestion", UtilMisc.toMap("surveyQuestionId", surveyQuestionId)); - -surveyQuestionAndApplList = delegator.findByAnd("SurveyQuestionAndAppl", UtilMisc.toMap("surveyId", surveyId), UtilMisc.toList("sequenceNum")); -surveyPageList = delegator.findByAnd("SurveyPage", UtilMisc.toMap("surveyId", surveyId), UtilMisc.toList("sequenceNum")); -surveyMultiRespList = delegator.findByAnd("SurveyMultiResp", UtilMisc.toMap("surveyId", surveyId), UtilMisc.toList("multiRespTitle")); +import org.ofbiz.entity.* +import org.ofbiz.entity.condition.* +import org.ofbiz.base.util.* +import org.ofbiz.widget.html.* + +surveyQuestionId = parameters.surveyQuestionId; +context.surveyQuestionId = surveyQuestionId; + +surveyQuestion = delegator.findOne("SurveyQuestion", [surveyQuestionId : surveyQuestionId], false); + +surveyQuestionAndApplList = delegator.findList("SurveyQuestionAndAppl", EntityCondition.makeCondition([surveyId : surveyId]), null, ['sequenceNum'], null, false); +surveyPageList = delegator.findList("SurveyPage", EntityCondition.makeCondition([surveyId : surveyId]), null, ['sequenceNum'], null, false); +surveyMultiRespList = delegator.findList("SurveyMultiResp", EntityCondition.makeCondition([surveyId : surveyId]), null, ['multiRespTitle'], null, false); HtmlFormWrapper createSurveyQuestionWrapper = new HtmlFormWrapper("component://content/webapp/content/survey/SurveyForms.xml", "CreateSurveyQuestion", request, response); createSurveyQuestionWrapper.putInContext("surveyId", surveyId); @@ -38,47 +38,46 @@ HtmlFormWrapper createSurveyQuestionCategoryWrapper = new HtmlFormWrapper("component://content/webapp/content/survey/SurveyForms.xml", "CreateSurveyQuestionCategory", request, response); createSurveyQuestionCategoryWrapper.putInContext("surveyId", surveyId); -if (surveyQuestion != null && surveyQuestion.get("surveyQuestionTypeId") != null && "OPTION".equals(surveyQuestion.getString("surveyQuestionTypeId"))) { +if (surveyQuestion && surveyQuestion.surveyQuestionTypeId && "OPTION".equals(surveyQuestion.surveyQuestionTypeId)) { // get the options - questionOptions = delegator.findByAnd("SurveyQuestionOption", UtilMisc.toMap("surveyQuestionId", surveyQuestionId), UtilMisc.toList("sequenceNum")); - context.put("questionOptions", questionOptions); + questionOptions = delegator.findList("SurveyQuestionOption", EntityCondition.makeCondition([surveyQuestionId : surveyQuestionId]), null, ['sequenceNum'], null, false); + context.questionOptions = questionOptions; HtmlFormWrapper createSurveyOptionWrapper = new HtmlFormWrapper("component://content/webapp/content/survey/SurveyForms.xml", "CreateSurveyQuestionOption", request, response); // survey question option - optionSeqId = parameters.get("surveyOptionSeqId"); + optionSeqId = parameters.surveyOptionSeqId; surveyQuestionOption = null; - if (optionSeqId != null) { - surveyQuestionOption = delegator.findByPrimaryKey("SurveyQuestionOption", UtilMisc.toMap("surveyQuestionId", surveyQuestionId, "surveyOptionSeqId", optionSeqId)); + if (optionSeqId) { + surveyQuestionOption = delegator.findOne("SurveyQuestionOption", [surveyQuestionId : surveyQuestionId, surveyOptionSeqId : optionSeqId], false); } - context.put("surveyQuestionOption", surveyQuestionOption); + context.surveyQuestionOption = surveyQuestionOption; createSurveyOptionWrapper.putInContext("surveyQuestionOption", surveyQuestionOption); createSurveyOptionWrapper.putInContext("surveyQuestionId", surveyQuestionId); createSurveyOptionWrapper.putInContext("surveyId", surveyId); - context.put("createSurveyOptionWrapper", createSurveyOptionWrapper); + context.createSurveyOptionWrapper = createSurveyOptionWrapper; } -surveyQuestionCategoryId = parameters.get("surveyQuestionCategoryId"); +surveyQuestionCategoryId = parameters.surveyQuestionCategoryId; surveyQuestionCategory = null; categoryQuestions = null; -if (!UtilValidate.isEmpty(surveyQuestionCategoryId)) { - surveyQuestionCategory = delegator.findByPrimaryKey("SurveyQuestionCategory", UtilMisc.toMap("surveyQuestionCategoryId", surveyQuestionCategoryId)); - if (surveyQuestionCategory != null) { +if (surveyQuestionCategoryId) { + surveyQuestionCategory = delegator.findOne("SurveyQuestionCategory", [surveyQuestionCategoryId : surveyQuestionCategoryId], false); + if (surveyQuestionCategory) { categoryQuestions = surveyQuestionCategory.getRelated("SurveyQuestion"); } } -questionCategories = delegator.findList("SurveyQuestionCategory", null, null, UtilMisc.toList("description"), null, false); +questionCategories = delegator.findList("SurveyQuestionCategory", null, null, ['description'], null, false); +context.surveyQuestion = surveyQuestion; -context.put("surveyQuestion", surveyQuestion); - -context.put("surveyQuestionAndApplList", surveyQuestionAndApplList); -context.put("surveyPageList", surveyPageList); -context.put("surveyMultiRespList", surveyMultiRespList); - -context.put("createSurveyQuestionWrapper", createSurveyQuestionWrapper); -context.put("createSurveyQuestionCategoryWrapper", createSurveyQuestionCategoryWrapper); - -context.put("surveyQuestionCategory", surveyQuestionCategory); -context.put("categoryQuestions", categoryQuestions); -context.put("questionCategories", questionCategories); +context.surveyQuestionAndApplList = surveyQuestionAndApplList; +context.surveyPageList = surveyPageList; +context.surveyMultiRespList = surveyMultiRespList; + +context.createSurveyQuestionWrapper = createSurveyQuestionWrapper; +context.createSurveyQuestionCategoryWrapper = createSurveyQuestionCategoryWrapper; + +context.surveyQuestionCategory = surveyQuestionCategory; +context.categoryQuestions = categoryQuestions; +context.questionCategories = questionCategories; \ No newline at end of file Copied: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyResponse.groovy (from r667620, ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyResponse.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyResponse.groovy?p2=ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyResponse.groovy&p1=ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyResponse.bsh&r1=667620&r2=667666&rev=667666&view=diff ============================================================================== --- ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyResponse.bsh (original) +++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/EditSurveyResponse.groovy Fri Jun 13 15:02:46 2008 @@ -17,27 +17,24 @@ * under the License. */ -import java.util.*; -import org.ofbiz.entity.*; -import org.ofbiz.base.util.*; -import org.ofbiz.content.survey.*; +import org.ofbiz.content.survey.* +import org.ofbiz.base.util.* -surveyResponseId = parameters.get("surveyResponseId"); -//causes problems, not sure why was here: partyId = parameters.get("partyId"); +surveyResponseId = parameters.surveyResponseId; partyId = null; -if ((surveyId == null) && (surveyResponseId != null)) { - surveyResponse = delegator.findByPrimaryKey("SurveyResponse", UtilMisc.toMap("surveyResponseId", surveyResponseId)); - surveyId = surveyResponse.getString("surveyId"); - context.put("surveyId", surveyId); +if (!surveyId && surveyResponseId) { + surveyResponse = delegator.findOne("SurveyResponse", [surveyResponseId : surveyResponseId], false); + surveyId = surveyResponse.surveyId; + context.surveyId = surveyId; } surveyWrapper = new SurveyWrapper(delegator, surveyResponseId, partyId, surveyId, null); surveyWrapper.setEdit(true); templateUrl = UtilURL.fromOfbizHomePath("applications/content/template/survey/genericsurvey.ftl"); -if (templateUrl != null) { +if (templateUrl) { writer = new StringWriter(); surveyWrapper.render(templateUrl, writer); - context.put("surveyString", writer.toString()); -} + context.surveyString = writer.toString(); +} \ No newline at end of file Copied: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/ViewSurveyResponses.groovy (from r667620, ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/ViewSurveyResponses.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/ViewSurveyResponses.groovy?p2=ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/ViewSurveyResponses.groovy&p1=ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/ViewSurveyResponses.bsh&r1=667620&r2=667666&rev=667666&view=diff ============================================================================== --- ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/ViewSurveyResponses.bsh (original) +++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/survey/ViewSurveyResponses.groovy Fri Jun 13 15:02:46 2008 @@ -17,28 +17,25 @@ * under the License. */ -import java.util.*; -import org.ofbiz.entity.*; -import org.ofbiz.base.util.*; import org.ofbiz.content.survey.*; -if (survey == null) { - surveyResponseId = parameters.get("surveyResponseId"); - if (!UtilValidate.isEmpty(surveyResponseId)) { - surveyResponse = delegator.findByPrimaryKey("SurveyResponse", UtilMisc.toMap("surveyResponseId", surveyResponseId)); - if (surveyResponse != null) { - surveyId = surveyResponse.getString("surveyId"); - if (!UtilValidate.isEmpty(surveyId)) { - survey = delegator.findByPrimaryKey("Survey", UtilMisc.toMap("surveyId", surveyId)); - context.put("survey", survey); - context.put("surveyId", surveyId); +if (!survey) { + surveyResponseId = parameters.surveyResponseId; + if (surveyResponseId) { + surveyResponse = delegator.findOne("SurveyResponse", [surveyResponseId : surveyResponseId], false); + if (surveyResponse) { + surveyId = surveyResponse.surveyId; + if (surveyId) { + survey = delegator.findOne("Survey", [surveyId : surveyId], false); + context.survey = survey; + context.surveyId = surveyId; } } } } -if (survey != null) { +if (survey) { surveyWrapper = new SurveyWrapper(delegator, surveyId); - context.put("surveyWrapper", surveyWrapper); - context.put("sequenceSort", UtilMisc.toList("sequenceNum")); -} + context.surveyWrapper = surveyWrapper; + context.sequenceSort = ['sequenceNum']; +} \ No newline at end of file Copied: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/EditWebSiteParties.groovy (from r667620, ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/EditWebSiteParties.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/EditWebSiteParties.groovy?p2=ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/EditWebSiteParties.groovy&p1=ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/EditWebSiteParties.bsh&r1=667620&r2=667666&rev=667666&view=diff ============================================================================== --- ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/EditWebSiteParties.bsh (original) +++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/EditWebSiteParties.groovy Fri Jun 13 15:02:46 2008 @@ -17,23 +17,16 @@ * under the License. */ -import org.ofbiz.base.util.*; -import org.ofbiz.entity.*; - -List webSiteRoles = null; -List webSiteRoleDatas = new LinkedList(); -if (webSite != null) { - webSiteRoles = webSite.getRelated("WebSiteRole", null, UtilMisc.toList("sequenceNum", "partyId")); - Iterator webSiteRoleIter = webSiteRoles.iterator(); - while (webSiteRoleIter.hasNext()) { - GenericValue webSiteRole = (GenericValue) webSiteRoleIter.next(); - Map webSiteRoleData = new HashMap(); - webSiteRoleData.put("webSiteRole", webSiteRole); - webSiteRoleData.put("person", webSiteRole.getRelatedOne("Person")); - webSiteRoleData.put("partyGroup", webSiteRole.getRelatedOne("PartyGroup")); - webSiteRoleData.put("roleType", webSiteRole.getRelatedOneCache("RoleType")); +webSiteRoleDatas = [] as LinkedList; +if (webSite) { + webSiteRoles = webSite.getRelated("WebSiteRole", null, ['sequenceNum', 'partyId']); + webSiteRoles.each { webSiteRole -> + Map webSiteRoleData = [:]; + webSiteRoleData.webSiteRole = webSiteRole; + webSiteRoleData.person = webSiteRole.getRelatedOne("Person"); + webSiteRoleData.partyGroup = webSiteRole.getRelatedOne("PartyGroup"); + webSiteRoleData.roleType = webSiteRole.getRelatedOneCache("RoleType"); webSiteRoleDatas.add(webSiteRoleData); } } - -context.put("webSiteRoleDatas", webSiteRoleDatas); +context.webSiteRoleDatas = webSiteRoleDatas; \ No newline at end of file Copied: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSiteCMSMetaInfo.groovy (from r667620, ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSiteCMSMetaInfo.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSiteCMSMetaInfo.groovy?p2=ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSiteCMSMetaInfo.groovy&p1=ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSiteCMSMetaInfo.bsh&r1=667620&r2=667666&rev=667666&view=diff ============================================================================== --- ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSiteCMSMetaInfo.bsh (original) +++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSiteCMSMetaInfo.groovy Fri Jun 13 15:02:46 2008 @@ -17,45 +17,45 @@ * under the License. */ -import org.ofbiz.base.util.*; -import org.ofbiz.entity.*; -import org.ofbiz.entity.util.*; +import org.ofbiz.entity.* +import org.ofbiz.entity.condition.* +import org.ofbiz.entity.util.* -if (content != null) { +if (content) { // lookup assoc content - titles = delegator.findByAnd("ContentAssoc", UtilMisc.toMap("contentId", contentId, "mapKey", "title"), UtilMisc.toList("-fromDate")); + titles = delegator.findList("ContentAssoc", EntityCondition.makeCondition([contentId : contentId, mapKey : 'title']), null, ['-fromDate'], null, false); titles = EntityUtil.filterByDate(titles); title = EntityUtil.getFirst(titles); - if (title != null) { + if (title) { tc = title.getRelatedOne("ToContent"); tcdr = tc.getRelatedOne("DataResource"); - context.put("title", tcdr); + context.title = tcdr; } - titleProps = delegator.findByAnd("ContentAssoc", UtilMisc.toMap("contentId", contentId, "mapKey", "titleProperty"), UtilMisc.toList("-fromDate")); + titleProps = delegator.findList("ContentAssoc", EntityCondition.makeCondition([contentId : contentId, mapKey : 'titleProperty']), null, ['-fromDate'], null, false); titleProps = EntityUtil.filterByDate(titleProps); titleProp = EntityUtil.getFirst(titleProps); - if (titleProp != null) { + if (titleProp) { tpc = titleProp.getRelatedOne("ToContent"); tpcdr = tpc.getRelatedOne("DataResource"); - context.put("titleProperty", tpcdr); + context.titleProperty = tpcdr; } - metaDescs = delegator.findByAnd("ContentAssoc", UtilMisc.toMap("contentId", contentId, "mapKey", "metaDescription"), UtilMisc.toList("-fromDate")); + metaDescs = delegator.findList("ContentAssoc", EntityCondition.makeCondition([contentId : contentId, mapKey : 'metaDescription']), null, ['-fromDate'], null, false); metaDescs = EntityUtil.filterByDate(metaDescs); metaDesc = EntityUtil.getFirst(metaDescs); - if (metaDesc != null) { + if (metaDesc) { mdc = metaDesc.getRelatedOne("ToContent"); mdcdr = mdc.getRelatedOne("DataResource"); - context.put("metaDescription", mdcdr); + context.metaDescription = mdcdr; } - metaKeys = delegator.findByAnd("ContentAssoc", UtilMisc.toMap("contentId", contentId, "mapKey", "metaKeywords"), UtilMisc.toList("-fromDate")); + metaKeys = delegator.findList("ContentAssoc", EntityCondition.makeCondition([contentId : contentId, mapKey : 'metaKeywords']), null, ['-fromDate'], null, false); metaKeys = EntityUtil.filterByDate(metaKeys); metaKey = EntityUtil.getFirst(metaKeys); - if (metaKey != null) { + if (metaKey) { mkc = metaKey.getRelatedOne("ToContent"); mkcdr = mkc.getRelatedOne("DataResource"); - context.put("metaKeywords", mkcdr); + context.metaKeywords = mkcdr; } } \ No newline at end of file Copied: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSitePublishPoint.groovy (from r667620, ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSitePublishPoint.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSitePublishPoint.groovy?p2=ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSitePublishPoint.groovy&p1=ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSitePublishPoint.bsh&r1=667620&r2=667666&rev=667666&view=diff ============================================================================== --- ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSitePublishPoint.bsh (original) +++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSitePublishPoint.groovy Fri Jun 13 15:02:46 2008 @@ -17,35 +17,34 @@ * under the License. */ -import org.ofbiz.base.util.*; -import org.ofbiz.entity.*; -import org.ofbiz.entity.util.*; +import org.ofbiz.entity.condition.* +import org.ofbiz.entity.util.* -Map pplookupMap = UtilMisc.toMap("webSiteId", webSiteId, "webSiteContentTypeId", "PUBLISH_POINT"); -List webSiteContents = delegator.findByAnd("WebSiteContent", pplookupMap, UtilMisc.toList("-fromDate")); +pplookupMap = [webSiteId : webSiteId, webSiteContentTypeId : 'PUBLISH_POINT']; +webSiteContents = delegator.findList("WebSiteContent", EntityCondition.makeCondition(pplookupMap), null, ['-fromDate'], null, false); webSiteContents = EntityUtil.filterByDate(webSiteContents); webSiteContent = EntityUtil.getFirst(webSiteContents); -if (webSiteContent != null) { +if (webSiteContent) { content = webSiteContent.getRelatedOne("Content"); - contentRoot = content.getString("contentId"); - context.put("content", content); - context.put("contentRoot", contentRoot); + contentRoot = content.contentId; + context.content = content; + context.contentRoot = contentRoot; // get all sub content for the publish point - List subsites = delegator.findByAnd("ContentAssoc", UtilMisc.toMap("contentId", contentRoot)); - context.put("subsites", subsites); + subsites = delegator.findList("ContentAssoc", [contentId : contentRoot], null, null, null, false); + context.subsites = subsites; } -Map mnlookupMap = UtilMisc.toMap("webSiteId", webSiteId, "webSiteContentTypeId", "MENU_ROOT"); -List webSiteMenus = delegator.findByAnd("WebSiteContent", mnlookupMap, UtilMisc.toList("-fromDate")); +mnlookupMap = [webSiteId : webSiteId, webSiteContentTypeId : 'MENU_ROOT']; +webSiteMenus = delegator.findList("WebSiteContent", EntityCondition.makeCondition(mnlookupMap), null, ['-fromDate'], null, false); webSiteMenu = EntityUtil.getFirst(webSiteMenus); -if (webSiteMenu != null) { +if (webSiteMenu) { menu = webSiteMenu.getRelatedOne("Content"); - menuRoot = menu.getString("contentId"); - context.put("menu", menu); - context.put("menuRoot", menuRoot); + menuRoot = menu.contentId; + context.menu = menu; + context.menuRoot = menuRoot; // get all sub content for the publish point - List menus = delegator.findByAnd("ContentAssoc", UtilMisc.toMap("contentId", menuRoot)); - context.put("menus", menus); -} + menus = delegator.findList("ContentAssoc", EntityCondition.makeCondition([contentId : menuRoot]), null, null, null, false); + context.menus = menus; +} \ No newline at end of file Modified: ofbiz/trunk/applications/content/widget/SurveyScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/widget/SurveyScreens.xml?rev=667666&r1=667665&r2=667666&view=diff ============================================================================== --- ofbiz/trunk/applications/content/widget/SurveyScreens.xml (original) +++ ofbiz/trunk/applications/content/widget/SurveyScreens.xml Fri Jun 13 15:02:46 2008 @@ -246,7 +246,7 @@ <set field="surveyId" from-field="parameters.surveyId"/> <entity-one entity-name="Survey" value-name="survey"/> - <script location="component://content/webapp/content/WEB-INF/actions/survey/EditSurveyQuestions.bsh"/> + <script location="component://content/webapp/content/WEB-INF/actions/survey/EditSurveyQuestions.groovy"/> </actions> <widgets> <decorator-screen name="CommonSurveyDecorator"> @@ -342,7 +342,7 @@ <set field="surveyId" from-field="parameters.surveyId"/> <entity-one entity-name="Survey" value-name="survey"/> - <script location="component://content/webapp/content/WEB-INF/actions/survey/ViewSurveyResponses.bsh"/> + <script location="component://content/webapp/content/WEB-INF/actions/survey/ViewSurveyResponses.groovy"/> </actions> <widgets> <decorator-screen name="CommonSurveyDecorator"> @@ -383,7 +383,7 @@ <set field="surveyResponseId" from-field="parameters.surveyResponseId"/> <entity-one entity-name="SurveyResponse" value-name="surveyResponse"/> - <script location="component://content/webapp/content/WEB-INF/actions/survey/EditSurveyResponse.bsh"/> + <script location="component://content/webapp/content/WEB-INF/actions/survey/EditSurveyResponse.groovy"/> </actions> <widgets> <decorator-screen name="CommonSurveyDecorator"> Modified: ofbiz/trunk/applications/content/widget/WebSiteScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/widget/WebSiteScreens.xml?rev=667666&r1=667665&r2=667666&view=diff ============================================================================== --- ofbiz/trunk/applications/content/widget/WebSiteScreens.xml (original) +++ ofbiz/trunk/applications/content/widget/WebSiteScreens.xml Fri Jun 13 15:02:46 2008 @@ -206,7 +206,7 @@ <set field="labelTitleProperty" value="PageTitleCreateWebSiteParties"/> <set field="webSiteId" from-field="parameters.webSiteId"/> <entity-one entity-name="WebSite" value-name="webSite"/> - <script location="component://content/webapp/content/WEB-INF/actions/website/EditWebSiteParties.bsh"/> + <script location="component://content/webapp/content/WEB-INF/actions/website/EditWebSiteParties.groovy"/> </actions> <widgets> <decorator-screen name="CommonWebSiteDecorator"> @@ -235,7 +235,7 @@ <set field="webSiteId" from-field="parameters.webSiteId"/> <entity-one entity-name="WebSite" value-name="webSite"/> - <script location="component://content/webapp/content/WEB-INF/actions/website/WebSitePublishPoint.bsh"/> + <script location="component://content/webapp/content/WEB-INF/actions/website/WebSitePublishPoint.groovy"/> </actions> <widgets> <decorator-screen name="CommonWebSiteDecorator"> @@ -268,11 +268,11 @@ <screen name="WebSiteCMSNav"> <section> - <actions> + <actions> <set field="webSiteId" from-field="parameters.webSiteId"/> <entity-one entity-name="WebSite" value-name="webSite"/> - <script location="component://content/webapp/content/WEB-INF/actions/website/WebSitePublishPoint.bsh"/> + <script location="component://content/webapp/content/WEB-INF/actions/website/WebSitePublishPoint.groovy"/> </actions> <widgets> <container style="screenlet"> @@ -400,7 +400,7 @@ <set field="contentId" from-field="parameters.contentId"/> <entity-one entity-name="Content" value-name="content"/> - <script location="component://content/webapp/content/WEB-INF/actions/website/WebSiteCMSMetaInfo.bsh"/> + <script location="component://content/webapp/content/WEB-INF/actions/website/WebSiteCMSMetaInfo.groovy"/> </actions> <widgets> <platform-specific> Modified: ofbiz/trunk/applications/content/widget/compdoc/CompDocScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/widget/compdoc/CompDocScreens.xml?rev=667666&r1=667665&r2=667666&view=diff ============================================================================== --- ofbiz/trunk/applications/content/widget/compdoc/CompDocScreens.xml (original) +++ ofbiz/trunk/applications/content/widget/compdoc/CompDocScreens.xml Fri Jun 13 15:02:46 2008 @@ -1162,7 +1162,7 @@ <screen name="childTemplateLine"> <section> <actions> - <script location="component://content/webapp/content/WEB-INF/actions/content/prepseqno.bsh"/> + <script location="component://content/webapp/content/WEB-INF/actions/content/PrepSeqNo.groovy"/> </actions> <widgets> <include-menu name="childTemplateLine" location="component://content/widget/compdoc/CompDocMenus.xml"/> @@ -1172,7 +1172,7 @@ <screen name="childInstanceLine"> <section> <actions> - <script location="component://content/webapp/content/WEB-INF/actions/content/prepseqno.bsh"/> + <script location="component://content/webapp/content/WEB-INF/actions/content/PrepSeqNo.groovy"/> <!-- find the most recent ContentAssoc/ContentRevisionItem view using the rootInstanceContentId as the contentId value and rootInstanceRevSeqId for the revision and the contentId of the current template part as the itemContentId Modified: ofbiz/trunk/applications/content/widget/datasetup/DataResourceSetupScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/widget/datasetup/DataResourceSetupScreens.xml?rev=667666&r1=667665&r2=667666&view=diff ============================================================================== --- ofbiz/trunk/applications/content/widget/datasetup/DataResourceSetupScreens.xml (original) +++ ofbiz/trunk/applications/content/widget/datasetup/DataResourceSetupScreens.xml Fri Jun 13 15:02:46 2008 @@ -173,7 +173,7 @@ <set field="titleProperty" value="PageTitleEditDataResourceCategory"/> <set field="headerItem" value="DataResourceSetupMenu"/> <set field="tabButtonItem" to-scope="user" value="EditDataCategory"/> - <script location="component://content/webapp/content/WEB-INF/actions/datasetup/datacategoryprep.bsh"/> + <script location="component://content/webapp/content/WEB-INF/actions/datasetup/DataCategoryPrep.groovy"/> <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer"/> <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="20"/> </actions> Modified: ofbiz/trunk/applications/content/widget/layout/LayoutScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/widget/layout/LayoutScreens.xml?rev=667666&r1=667665&r2=667666&view=diff ============================================================================== --- ofbiz/trunk/applications/content/widget/layout/LayoutScreens.xml (original) +++ ofbiz/trunk/applications/content/widget/layout/LayoutScreens.xml Fri Jun 13 15:02:46 2008 @@ -150,7 +150,7 @@ <set field="tabButtonItem" to-scope="user" value="EditLayoutSubContent"/> <entity-one entity-name="SubContentDataResourceView" value-name="currentValue"/> - <script location="component://content/webapp/content/WEB-INF/actions/layout/editsubcontent.bsh"/> + <script location="component://content/webapp/content/WEB-INF/actions/layout/EditSubContent.groovy"/> </actions> <widgets> <decorator-screen name="commonLayoutDecorator" location="${parameters.mainDecoratorLocation}"> @@ -182,7 +182,7 @@ <set field="tabButtonItem" to-scope="user" value="EditLayoutText"/> <entity-one entity-name="SubContentDataResourceView" value-name="currentValue"/> - <script location="component://content/webapp/content/WEB-INF/actions/layout/editsubcontent.bsh"/> + <script location="component://content/webapp/content/WEB-INF/actions/layout/EditSubContent.groovy"/> </actions> <widgets> <decorator-screen name="commonLayoutDecorator" location="${parameters.mainDecoratorLocation}"> @@ -203,7 +203,7 @@ <set field="tabButtonItem" to-scope="user" value="EditLayoutHtml"/> <entity-one entity-name="SubContentDataResourceView" value-name="currentValue"/> - <script location="component://content/webapp/content/WEB-INF/actions/layout/editsubcontent.bsh"/> + <script location="component://content/webapp/content/WEB-INF/actions/layout/EditSubContent.groovy"/> </actions> <widgets> <decorator-screen name="commonLayoutDecorator" location="${parameters.mainDecoratorLocation}"> @@ -224,7 +224,7 @@ <set field="tabButtonItem" to-scope="user" value="EditLayoutUrl"/> <entity-one entity-name="SubContentDataResourceView" value-name="currentValue"/> - <script location="component://content/webapp/content/WEB-INF/actions/layout/editsubcontent.bsh"/> + <script location="component://content/webapp/content/WEB-INF/actions/layout/EditSubContent.groovy"/> </actions> <widgets> <decorator-screen name="commonLayoutDecorator" location="${parameters.mainDecoratorLocation}"> @@ -245,7 +245,7 @@ <set field="tabButtonItem" to-scope="user" value="EditLayoutImage"/> <entity-one entity-name="SubContentDataResourceView" value-name="currentValue"/> - <script location="component://content/webapp/content/WEB-INF/actions/layout/editsubcontent.bsh"/> + <script location="component://content/webapp/content/WEB-INF/actions/layout/EditSubContent.groovy"/> </actions> <widgets> <decorator-screen name="commonLayoutDecorator" location="${parameters.mainDecoratorLocation}"> |
Free forum by Nabble | Edit this page |