Author: mrisaliti
Date: Sun Jun 15 06:49:12 2008 New Revision: 667961 URL: http://svn.apache.org/viewvc?rev=667961&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/cms/ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/AdvancedSearchPrep.groovy (with props) ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/CmsEditAddPrep.groovy (with props) ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/FeaturePrep.groovy (with props) ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/MostRecentPrep.groovy (with props) ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/Search.groovy (with props) ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/UserPermPrep.groovy (with props) ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/contentsetup/ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/contentsetup/UserPermPrep.groovy - copied unchanged from r667937, ofbiz/trunk/applications/content/widget/contentsetup/UserPermPrep.groovy Removed: ofbiz/trunk/applications/content/widget/cms/advancedsearchprep.bsh ofbiz/trunk/applications/content/widget/cms/cmseditaddprep.bsh ofbiz/trunk/applications/content/widget/cms/featureprep.bsh ofbiz/trunk/applications/content/widget/cms/mostrecentprep.bsh ofbiz/trunk/applications/content/widget/cms/search.bsh ofbiz/trunk/applications/content/widget/cms/userpermprep.bsh ofbiz/trunk/applications/content/widget/contentsetup/UserPermPrep.groovy Modified: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSitePublishPoint.groovy ofbiz/trunk/applications/content/widget/cms/CMSScreens.xml ofbiz/trunk/applications/content/widget/contentsetup/ContentSetupScreens.xml Added: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/AdvancedSearchPrep.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/AdvancedSearchPrep.groovy?rev=667961&view=auto ============================================================================== --- ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/AdvancedSearchPrep.groovy (added) +++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/AdvancedSearchPrep.groovy Sun Jun 15 06:49:12 2008 @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.ofbiz.product.catalog.* +import org.ofbiz.product.feature.* +import org.ofbiz.product.product.* + +productFeaturesByTypeMap = ParametricSearch.getAllFeaturesByType(delegator, 2000); +productFeatureTypeIdsOrdered = new ArrayList(new TreeSet(productFeaturesByTypeMap.keySet())); + +searchOperator = request.getParameter("SEARCH_OPERATOR"); +if (!"AND".equals(searchOperator) && !"OR".equals(searchOperator)) { + searchOperator = "OR"; +} + +searchConstraintStrings = ProductSearchSession.searchGetConstraintStrings(false, session, delegator); +searchSortOrderString = ProductSearchSession.searchGetSortOrderString(false, request); + +context.productFeaturesByTypeMap = productFeaturesByTypeMap; +context.productFeatureTypeIdsOrdered = productFeatureTypeIdsOrdered; +context.searchOperator = searchOperator; +context.searchConstraintStrings = searchConstraintStrings; +context.searchSortOrderString = searchSortOrderString; \ No newline at end of file Propchange: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/AdvancedSearchPrep.groovy ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/AdvancedSearchPrep.groovy ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/AdvancedSearchPrep.groovy ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/CmsEditAddPrep.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/CmsEditAddPrep.groovy?rev=667961&view=auto ============================================================================== --- ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/CmsEditAddPrep.groovy (added) +++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/CmsEditAddPrep.groovy Sun Jun 15 06:49:12 2008 @@ -0,0 +1,93 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.ofbiz.base.util.* +import org.ofbiz.minilang.SimpleMapProcessor +import org.ofbiz.content.ContentManagementWorker +import org.ofbiz.content.content.ContentWorker +import org.ofbiz.content.data.DataResourceWorker + +userLogin = session.getAttribute("userLogin"); +contentAssocDataResourceViewFrom = delegator.makeValue("ContentAssocDataResourceViewFrom"); + +contentId = context.contentId; + +contentAssocPK = delegator.makeValue("ContentAssoc"); +contentAssocPK.setAllFields(context, false, "ca", new Boolean(true)); +Debug.logInfo("in cmseditaddprep, contentAssocPK:" + contentAssocPK,""); + +contentAssoc = null; +if (contentAssocPK.isPrimaryKey()) { + contentAssoc = delegator.findOne("ContentAssoc", contentAssocPK, false); +} + +if (contentAssoc) { + SimpleMapProcessor.runSimpleMapProcessor("org/ofbiz/content/ContentManagementMapProcessors.xml", "contentAssocOut", contentAssoc, contentAssocDataResourceViewFrom, new ArrayList(), Locale.getDefault()); +} else { + contentAssocPK.setAllFields(context, false, "ca", null); //set all field, pk and non + SimpleMapProcessor.runSimpleMapProcessor("org/ofbiz/content/ContentManagementMapProcessors.xml", "contentAssocOut", contentAssocPK, contentAssocDataResourceViewFrom, new ArrayList(), Locale.getDefault()); +} +Debug.logInfo("in cmseditaddprep, contentAssocDataResourceViewFrom:" + contentAssocDataResourceViewFrom,""); + +dataResourceId = ""; +textData = ""; +content = null; +if (contentId) { + content = delegator.findOne("Content", [contentId : contentId], true); + if (content) { + contentAssocDataResourceViewFrom.setAllFields(content, false, null, null); + } +} else { + contentAssocDataResourceViewFrom.set("contentTypeId", "DOCUMENT"); +} + +if (content) { + dataResourceId = content.dataResourceId; +} +if (!dataResourceId) { + dataResourceId = context.drDataResourceId; + if (!dataResourceId) { + dataResourceId = context.dataResourceId; + } +} +if (dataResourceId) { + dataResource = delegator.findOne("DataResource", [dataResourceId : dataResourceId], true); + SimpleMapProcessor.runSimpleMapProcessor("org/ofbiz/content/ContentManagementMapProcessors.xml", "dataResourceOut", dataResource, contentAssocDataResourceViewFrom, new ArrayList(), Locale.getDefault()); + templateRoot = [:]; + FreeMarkerViewHandler.prepOfbizRoot(templateRoot, request, response); + txt = DataResourceWorker.getDataResourceTextCache(dataResource, "text/html", Locale.getDefault(), templateRoot, delegator); + + if (txt) { + textData = UtilFormatOut.encodeXmlValue(txt); + } +} +Debug.logInfo("in cmseditaddprep, textData:" + textData,""); + +currentValue = new HashMap(contentAssocDataResourceViewFrom); +currentValue.textData = textData; +currentValue.nowTimestamp = UtilDateTime.nowTimestamp(); +context.currentValue = currentValue; + +request.setAttribute("previousParams", currentValue); + +persistAction = context.persistAction; +if (!persistAction) { + persistAction = "persistContent"; +} +context.persistAction = persistAction; \ No newline at end of file Propchange: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/CmsEditAddPrep.groovy ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/CmsEditAddPrep.groovy ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/CmsEditAddPrep.groovy ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/FeaturePrep.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/FeaturePrep.groovy?rev=667961&view=auto ============================================================================== --- ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/FeaturePrep.groovy (added) +++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/FeaturePrep.groovy Sun Jun 15 06:49:12 2008 @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.ofbiz.base.util.UtilHttp + +paramMap = UtilHttp.getParameterMap(request); + +contentId = context.contentId; +dataResourceId = context.dataResourceId; + +productFeatureList = delegator.findList("ProductFeature", null, null, null, null, true); +featureList = [] as ArrayList; +if (dataResourceId) { + productFeatureList.each { productFeature -> + productFeatureId = productFeature.productFeatureId; + description = productFeature.description; + productFeatureDataResource = delegator.findOne("ProductFeatureDataResource", [productFeatureId : productFeatureId, dataResourceId : dataResourceId], true); + if (productFeatureDataResource) { + feature = []; + feature.productFeatureId = productFeatureId; + feature.dataResourceId = dataResourceId; + feature.action = "Y"; + feature.description = description; + featureList.add(feature); + } + } + context.featureList = featureList; +} \ No newline at end of file Propchange: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/FeaturePrep.groovy ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/FeaturePrep.groovy ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/FeaturePrep.groovy ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/MostRecentPrep.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/MostRecentPrep.groovy?rev=667961&view=auto ============================================================================== --- ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/MostRecentPrep.groovy (added) +++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/MostRecentPrep.groovy Sun Jun 15 06:49:12 2008 @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* +import 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.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.securityext.login.*; +import org.ofbiz.common.*; +import org.ofbiz.entity.model.*; + +import org.ofbiz.widget.html.HtmlMenuWrapper; +import org.ofbiz.widget.WidgetWorker; +import org.ofbiz.entity.condition.EntityConditionList; +import org.ofbiz.entity.condition.EntityExpr; +import org.ofbiz.entity.condition.EntityOperator; + +import freemarker.template.SimpleHash; +import freemarker.template.SimpleSequence; + +import javax.servlet.*; +import javax.servlet.http.*; +*/ + +import org.ofbiz.base.util.* +import org.ofbiz.entity.util.* +import org.ofbiz.content.ContentManagementWorker; +import org.ofbiz.content.content.ContentWorker; + +Debug.logInfo("in mostrecentprep(1):",""); +paramMap = UtilHttp.getParameterMap(request); +forumId = ContentManagementWorker.getFromSomewhere("moderatedSiteId", paramMap, request, context); + +if (forumId) { + exprList = [] as ArrayList; + fromDate = UtilDateTime.nowTimestamp(); + thruExpr2 = EntityCondition.makeCondition("caThruDate", EntityOperator.EQUALS, null); + exprList.add(thruExpr2); + statusIdExpr = EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "CTNT_IN_PROGRESS"); + exprList.add(statusIdExpr); + contentIdToExpr = EntityCondition.makeCondition("caContentIdTo", EntityOperator.EQUALS, forumId); + exprList.add(contentIdToExpr); + expr = EntityCondition.makeCondition(exprList, EntityOperator.AND); + entityList = delegator.findList("ContentAssocViewFrom", expr, null, ['-caFromDate'], null, false); + + Debug.logInfo("in mostrecentprep(1), entityList.size():" + entityList.size(),""); + Debug.logInfo("in mostrecentprep(1), entityList:" + entityList,""); + context.mostRecentList = entityList; +} \ No newline at end of file Propchange: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/MostRecentPrep.groovy ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/MostRecentPrep.groovy ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/MostRecentPrep.groovy ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/Search.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/Search.groovy?rev=667961&view=auto ============================================================================== --- ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/Search.groovy (added) +++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/Search.groovy Sun Jun 15 06:49:12 2008 @@ -0,0 +1,139 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.lucene.analysis.Analyzer +import org.apache.lucene.analysis.standard.StandardAnalyzer +import org.apache.lucene.document.Document +import org.apache.lucene.search.Searcher +import org.apache.lucene.search.IndexSearcher +import org.apache.lucene.index.IndexReader +import org.apache.lucene.search.Query +import org.apache.lucene.search.TermQuery +import org.apache.lucene.search.BooleanQuery +import org.apache.lucene.index.Term +import org.apache.lucene.search.Hits +import org.apache.lucene.queryParser.QueryParser +import org.ofbiz.base.util.UtilHttp +import org.ofbiz.base.util.Debug +import org.ofbiz.product.feature.ParametricSearch +import org.ofbiz.content.search.SearchWorker + +paramMap = UtilHttp.getParameterMap(request); +queryLine = paramMap.queryLine; +Debug.logInfo("in search, queryLine:" + queryLine, ""); + +siteId = paramMap.lcSiteId; +Debug.logInfo("in search, siteId:" + siteId, ""); + +searchFeature1 = paramMap.SEARCH_FEAT; +searchFeature2 = paramMap.SEARCH_FEAT2; +searchFeature3 = paramMap.SEARCH_FEAT3; + +featureIdByType = ParametricSearch.makeFeatureIdByTypeMap(paramMap); +Debug.logInfo("in search, featureIdByType:" + featureIdByType, ""); + + +combQuery = new BooleanQuery(); +indexPath = null; +Searcher searcher = null; +Analyzer analyzer = null; + +try { + indexPath = SearchWorker.getIndexPath(null); + Debug.logInfo("in search, indexPath:" + indexPath, ""); + searcher = new IndexSearcher(indexPath); + Debug.logInfo("in search, searcher:" + searcher, ""); + analyzer = new StandardAnalyzer(); +} catch(java.io.FileNotFoundException e) { + request.setAttribute("errorMsgReq", "No index file exists."); + Debug.logError("in search, error:" + e.getMessage(), ""); +} + +if (queryLine || siteId) { + Query query = null; + if (queryLine) { + query = QueryParser.parse(queryLine, "content", analyzer); + combQuery.add(query, true, false); + } + Debug.logInfo("in search, combQuery(0):" + combQuery, ""); + + if (siteId) { + termQuery = new TermQuery(new Term("site", siteId)); + combQuery.add(termQuery, true, false); + Debug.logInfo("in search, termQuery:" + termQuery.toString(), ""); + } + Debug.logInfo("in search, combQuery(1):" + combQuery, ""); +} + +if (searchFeature1 || searchFeature2 || searchFeature3 || !featureIdByType.isEmpty()) { + featureQuery = new BooleanQuery(); + anyOrAll = paramMap.any_or_all; + featuresRequired = true; + + if (anyOrAll && "any".equals(anyOrAll)) { + featuresRequired = false; + } + + if (searchFeature1) { + termQuery = new TermQuery(new Term("feature", searchFeature1)); + featureQuery.add(termQuery, featuresRequired, false); + Debug.logInfo("in search searchFeature1, termQuery:" + termQuery.toString(), ""); + } + + if (searchFeature2) { + termQuery = new TermQuery(new Term("feature", searchFeature2)); + featureQuery.add(termQuery, featuresRequired, false); + Debug.logInfo("in search searchFeature2, termQuery:" + termQuery.toString(), ""); + } + + if (searchFeature3) { + termQuery = new TermQuery(new Term("feature", searchFeature3)); + featureQuery.add(termQuery, featuresRequired, false); + Debug.logInfo("in search searchFeature3, termQuery:" + termQuery.toString(), ""); + } + + if (!featureIdByType.isEmpty()) { + values = featureIdByType.values(); + values.each { val -> + termQuery = new TermQuery(new Term("feature", val)); + featureQuery.add(termQuery, featuresRequired, false); + Debug.logInfo("in search searchFeature3, termQuery:" + termQuery.toString(), ""); + } + combQuery.add(featureQuery, featuresRequired, false); + } + + if (searcher) { + Debug.logInfo("in search searchFeature3, combQuery:" + combQuery.toString(), ""); + Hits hits = searcher.search(combQuery); + Debug.logInfo("in search, hits:" + hits.length(), ""); + + contentList = [] as ArrayList; + hitSet = [:] as HashSet; + for (int start = 0; start < hits.length(); start++) { + doc = hits.doc(start); + contentId = doc.contentId; + content = delegator.findOne("Content", [contentId : contentId], true); + if (!hitSet.contains(contentId)) { + contentList.add(content); + hitSet.add(contentId); + } + } + context.queryResults = contentList; + } +} \ No newline at end of file Propchange: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/Search.groovy ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/Search.groovy ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/Search.groovy ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/UserPermPrep.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/UserPermPrep.groovy?rev=667961&view=auto ============================================================================== --- ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/UserPermPrep.groovy (added) +++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/UserPermPrep.groovy Sun Jun 15 06:49:12 2008 @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.ofbiz.base.util.* +import org.ofbiz.entity.condition.* +import org.ofbiz.content.ContentManagementWorker + +paramMap = UtilHttp.getParameterMap(request); +forumId = ContentManagementWorker.getFromSomewhere("permRoleSiteId", paramMap, request, context); +blogRoles = delegator.findList("RoleType", EntityCondition.makeCondition([parentTypeId : 'BLOG']), null, null, null, true); + +if (forumId) { + siteRoleMap = [:]; + for (int i=0; i < blogRoles.size; i++) { + roleType = blogRoles.get(i); + roleTypeId = roleType.roleTypeId; + contentRoleList = delegator.findList("ContentRole", EntityCondition.makeCondition([contentId : forumId, roleTypeId : roleTypeId]), null, null, null, false); + filteredRoleList = EntityUtil.filterByDate(contentRoleList); + cappedBlogRoleName = ModelUtil.dbNameToVarName(roleTypeId); + + filteredRoleList.each { contentRole -> + partyId = contentRole.partyId; + fromDate = contentRole.fromDate; + map = siteRoleMap.get(partyId); + if (!map) { + map = [:]; + map.partyId = partyId; + siteRoleMap.put(partyId, map); + } + map.put(cappedBlogRoleName, "Y"); + map.put(cappedBlogRoleName + "FromDate", fromDate); + } + } + siteList = new ArrayList(siteRoleMap.values()); + context.siteList = siteList; + context.rowCount = siteList.size(); + blogRoleList = [] as ArrayList; + blogRoles.each { roleType -> + blogRoleList.add(roleType.roleTypeId); + } + context.blogRoleIdList = blogRoleList; +} \ No newline at end of file Propchange: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/UserPermPrep.groovy ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/UserPermPrep.groovy ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/cms/UserPermPrep.groovy ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSitePublishPoint.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSitePublishPoint.groovy?rev=667961&r1=667960&r2=667961&view=diff ============================================================================== --- ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSitePublishPoint.groovy (original) +++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/actions/website/WebSitePublishPoint.groovy Sun Jun 15 06:49:12 2008 @@ -31,7 +31,7 @@ context.contentRoot = contentRoot; // get all sub content for the publish point - subsites = delegator.findList("ContentAssoc", [contentId : contentRoot], null, null, null, false); + subsites = delegator.findList("ContentAssoc", EntityCondition.makeCondition([contentId : contentRoot]), null, null, null, false); context.subsites = subsites; } Modified: ofbiz/trunk/applications/content/widget/cms/CMSScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/widget/cms/CMSScreens.xml?rev=667961&r1=667960&r2=667961&view=diff ============================================================================== --- ofbiz/trunk/applications/content/widget/cms/CMSScreens.xml (original) +++ ofbiz/trunk/applications/content/widget/cms/CMSScreens.xml Sun Jun 15 06:49:12 2008 @@ -86,7 +86,7 @@ <set field="dataResourceId" from-field="parameters.drDataResourceId"/> <set field="rootForumId" value="WebStoreFORUM" /> <set field="rootForumId2" value="WebStoreCONTENT" /> - <script location="component://content/widget/cms/featureprep.bsh"/> + <script location="component://content/webapp/content/WEB-INF/actions/cms/FeaturePrep.groovy"/> <set field="menuContext.contentTarget" value="CMSContentEdit?contentId=${contentId}&drDataResourceId=${dataResourceId}"/> </actions> <widgets> @@ -168,7 +168,7 @@ <set field="caFromDate" from-field="MASTER_caFromDate" /> - <script location="component://content/widget/cms/cmseditaddprep.bsh"/> + <script location="component://content/webapp/content/WEB-INF/actions/cms/CmsEditAddPrep.groovy"/> <set field="currentCMSMenuItemName" value="EditAddContent" to-scope="user"/> <set field="enableEdit" value="true" /> </actions> @@ -215,7 +215,7 @@ <set field="caContentIdTo" from-field="parameters.contentId"/> <set field="caMapKey" from-field="parameters.mapKey"/> - <script location="component://content/widget/cms/cmseditaddprep.bsh"/> + <script location="component://content/webapp/content/WEB-INF/actions/cms/CmsEditAddPrep.groovy"/> <set field="currentCMSMenuItemName" value="EditAddContent" to-scope="user"/> </actions> <widgets> @@ -246,8 +246,8 @@ <section> <actions> <script location="component://content/widget/GetMenuContext.groovy"/> - <script location="component://content/widget/cms/advancedsearchprep.bsh"/> - <script location="component://content/widget/cms/search.bsh"/> + <script location="component://content/webapp/content/WEB-INF/actions/cms/AdvancedSearchPrep.groovy"/> + <script location="component://content/webapp/content/WEB-INF/actions/cms/Search.groovy"/> <set field="title" value="CMS Search Page"/> <set field="titleProperty" value="PageTitleSearchContent"/> <set field="currentCMSMenuItemName" value="search" to-scope="user"/> @@ -322,8 +322,8 @@ <set field="forumId" from-field="parameters.contentId"/> <set field="defaultSiteId" value="WebStoreFORUM"/> <set field="currentCMSMenuItemName" value="subsites" to-scope="user"/> - <script location="component://content/widget/cms/userpermprep.bsh"/> - <script location="component://content/widget/cms/mostrecentprep.bsh"/> + <script location="component://content/webapp/content/WEB-INF/actions/cms/UserPermPrep.groovy"/> + <script location="component://content/webapp/content/WEB-INF/actions/cms/MostRecentPrep.groovy"/> </actions> <widgets> <decorator-screen name="commonCmsDecorator" location="${parameters.mainDecoratorLocation}"> Modified: ofbiz/trunk/applications/content/widget/contentsetup/ContentSetupScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/widget/contentsetup/ContentSetupScreens.xml?rev=667961&r1=667960&r2=667961&view=diff ============================================================================== --- ofbiz/trunk/applications/content/widget/contentsetup/ContentSetupScreens.xml (original) +++ ofbiz/trunk/applications/content/widget/contentsetup/ContentSetupScreens.xml Sun Jun 15 06:49:12 2008 @@ -149,7 +149,7 @@ <set field="headerItem" value="ContentSetupMenu"/> <set field="currentMenuItemName" to-scope="user" value="userpermission"/> <set field="webSitePublishPoint" from-field="parameters.webSitePublishPoint" default-value="OFBIZDOCROOT"/> - <script location="component://content/widget/contentsetup/UserPermPrep.groovy"/> + <script location="component://content/webapp/content/WEB-INF/actions/contentsetup/UserPermPrep.groovy"/> </actions> <widgets> <decorator-screen name="commonContentSetupDecorator" location="${parameters.mainDecoratorLocation}"> |
Free forum by Nabble | Edit this page |