svn commit: r667678 - in /ofbiz/trunk/applications: content/widget/contentsetup/ContentSetupScreens.xml content/widget/contentsetup/UserPermPrep.groovy content/widget/contentsetup/userpermprep.bsh order/widget/ordermgr/OrderViewScreens.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r667678 - in /ofbiz/trunk/applications: content/widget/contentsetup/ContentSetupScreens.xml content/widget/contentsetup/UserPermPrep.groovy content/widget/contentsetup/userpermprep.bsh order/widget/ordermgr/OrderViewScreens.xml

mrisaliti
Author: mrisaliti
Date: Fri Jun 13 15:27:37 2008
New Revision: 667678

URL: http://svn.apache.org/viewvc?rev=667678&view=rev
Log:
Converted some content bsh scripts to groovy (Part of issue OFBIZ-1801)

Added:
    ofbiz/trunk/applications/content/widget/contentsetup/UserPermPrep.groovy
      - copied, changed from r667620, ofbiz/trunk/applications/content/widget/contentsetup/userpermprep.bsh
Removed:
    ofbiz/trunk/applications/content/widget/contentsetup/userpermprep.bsh
Modified:
    ofbiz/trunk/applications/content/widget/contentsetup/ContentSetupScreens.xml
    ofbiz/trunk/applications/order/widget/ordermgr/OrderViewScreens.xml

Modified: ofbiz/trunk/applications/content/widget/contentsetup/ContentSetupScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/widget/contentsetup/ContentSetupScreens.xml?rev=667678&r1=667677&r2=667678&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/widget/contentsetup/ContentSetupScreens.xml (original)
+++ ofbiz/trunk/applications/content/widget/contentsetup/ContentSetupScreens.xml Fri Jun 13 15:27:37 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.bsh"/>
+                <script location="component://content/widget/contentsetup/UserPermPrep.groovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="commonContentSetupDecorator" location="${parameters.mainDecoratorLocation}">

Copied: ofbiz/trunk/applications/content/widget/contentsetup/UserPermPrep.groovy (from r667620, ofbiz/trunk/applications/content/widget/contentsetup/userpermprep.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/widget/contentsetup/UserPermPrep.groovy?p2=ofbiz/trunk/applications/content/widget/contentsetup/UserPermPrep.groovy&p1=ofbiz/trunk/applications/content/widget/contentsetup/userpermprep.bsh&r1=667620&r2=667678&rev=667678&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/widget/contentsetup/userpermprep.bsh (original)
+++ ofbiz/trunk/applications/content/widget/contentsetup/UserPermPrep.groovy Fri Jun 13 15:27:37 2008
@@ -17,57 +17,34 @@
  * 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.condition.*;
 import org.ofbiz.entity.model.*;
 import org.ofbiz.entity.util.*;
-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.service.*;
 import org.ofbiz.content.ContentManagementWorker;
 
-import freemarker.template.SimpleHash;
-import freemarker.template.SimpleSequence;
-
-import javax.servlet.*;
-import javax.servlet.http.*;
-
-delegator = request.getAttribute("delegator");
 paramMap = UtilHttp.getParameterMap(request);
 forumId = ContentManagementWorker.getFromSomewhere("webSitePublishPoint", paramMap, request, context);
-blogRoles = delegator.findByAndCache("RoleType", UtilMisc.toMap("parentTypeId", "BLOG"));
+blogRoles = delegator.findList("RoleType", EntityCondition.makeCondition([parentTypeId : 'BLOG']), null, null, null, true);
 
-if (UtilValidate.isNotEmpty(forumId)) {
-    siteRoleMap = new HashMap();
+if (forumId) {
+    siteRoleMap = [:];
     for (int i=0; i < blogRoles.size(); i++) {
         roleType = blogRoles.get(i);
-        roleTypeId = roleType.getString("roleTypeId");
-        contentRoleList = delegator.findByAnd("ContentRole", UtilMisc.toMap("contentId", forumId, "roleTypeId", roleTypeId));
+        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);
 
-        iter = filteredRoleList.iterator();
-        while (iter.hasNext()) {
-            contentRole = iter.next();
-            partyId = contentRole.getString("partyId");
-            fromDate = contentRole.get("fromDate");
+        filteredRoleList.each { contentRole ->
+            partyId = contentRole.partyId;
+            fromDate = contentRole.fromDate;
             map = siteRoleMap.get(partyId);
-            if (map == null) {
-                map = new HashMap();
-                map.put("partyId", partyId);
+            if (!map) {
+                map = [:];
+                map.partyId = partyId;
                 siteRoleMap.put(partyId, map);
             }
             map.put( cappedBlogRoleName, "Y");
@@ -75,13 +52,12 @@
         }
     }
     siteList = new ArrayList(siteRoleMap.values());
-    context.put("siteList", siteList);
-    context.put("rowCount", siteList.size());
-    blogRoleIter = blogRoles.iterator();
-    blogRoleList = new ArrayList();
-    while (blogRoleIter.hasNext()) {
-        roleType = blogRoleIter.next();
-        blogRoleList.add(roleType.get("roleTypeId"));
+    context.siteList = siteList;
+    context.rowCount = siteList.size();
+    blogRoleList = [] as ArrayList;
+    
+    blogRoles.each { roleType ->
+        blogRoleList.add(roleType.roleTypeId);
     }
-    context.put("blogRoleIdList", blogRoleList);
-}
+    context.blogRoleIdList = blogRoleList;
+}
\ No newline at end of file

Modified: ofbiz/trunk/applications/order/widget/ordermgr/OrderViewScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/widget/ordermgr/OrderViewScreens.xml?rev=667678&r1=667677&r2=667678&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/widget/ordermgr/OrderViewScreens.xml (original)
+++ ofbiz/trunk/applications/order/widget/ordermgr/OrderViewScreens.xml Fri Jun 13 15:27:37 2008
@@ -175,7 +175,7 @@
                 <set field="titleProperty" value="OrderFindOrder"/>
                 <set field="headerItem" value="findorders"/>
                 <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/findOrders.bsh"/>
-                <script location="component://content/webapp/content/WEB-INF/actions/print/findPrinters.bsh"/>
+                <script location="component://content/webapp/content/WEB-INF/actions/print/FindPrinters.groovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="CommonOrderViewDecorator">