svn commit: r730892 - /ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/ListPortalPages.groovy

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

svn commit: r730892 - /ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/ListPortalPages.groovy

hansbak-2
Author: hansbak
Date: Fri Jan  2 18:25:12 2009
New Revision: 730892

URL: http://svn.apache.org/viewvc?rev=730892&view=rev
Log:
reported by bruno: execution of example component without being logged in gives NP error: fixed

Modified:
    ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/ListPortalPages.groovy

Modified: ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/ListPortalPages.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/ListPortalPages.groovy?rev=730892&r1=730891&r2=730892&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/ListPortalPages.groovy (original)
+++ ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/ListPortalPages.groovy Fri Jan  2 18:25:12 2009
@@ -20,34 +20,35 @@
 import org.ofbiz.entity.*;
 import org.ofbiz.base.util.*;
 import org.ofbiz.entity.condition.*;
-
-ppCond =
+// only execute when a user is logged in
+if (parameters.userLogin) {
+ ppCond =
     EntityCondition.makeCondition([
-                                   EntityCondition.makeCondition([
-                                                                  EntityCondition.makeCondition("parentPortalPageId", EntityOperator.EQUALS, parameters.parentPortalPageId),
-                                                                  EntityCondition.makeCondition("portalPageId", EntityOperator.EQUALS, parameters.parentPortalPageId),
-                                                                  EntityCondition.makeCondition("originalPortalPageId", EntityOperator.EQUALS, parameters.parentPortalPageId)
-                                                                  ],EntityOperator.OR),
-                                   EntityCondition.makeCondition([
-                                                                  EntityCondition.makeCondition("ownerUserLoginId", EntityOperator.EQUALS, parameters.userLogin.userLoginId),
-                                                                  EntityCondition.makeCondition("ownerUserLoginId", EntityOperator.EQUALS, "_NA_")
-                                                                  ],EntityOperator.OR),
-                                   ],EntityOperator.AND);
-sortField = parameters.sortField;
-if (UtilValidate.isEmpty(sortField)) {
- sortField = "portalPageName";
-}
-orderBy = [sortField];
-portalPages = delegator.findList("PortalPage", ppCond, null, orderBy, null, false);
-// remove overridden system pages
-portalPages.each { portalPage ->
- if (portalPage.ownerUserLoginId.equals("_NA_")) {
- userPortalPages = delegator.findByAnd("PortalPage", [originalPortalPageId : portalPage.portalPageId, ownerUserLoginId : parameters.userLogin.userLoginId]);
- if (userPortalPages) {
- portalPages.remove(portalPage);
+        EntityCondition.makeCondition([
+            EntityCondition.makeCondition("parentPortalPageId", EntityOperator.EQUALS, parameters.parentPortalPageId),
+            EntityCondition.makeCondition("portalPageId", EntityOperator.EQUALS, parameters.parentPortalPageId),
+            EntityCondition.makeCondition("originalPortalPageId", EntityOperator.EQUALS, parameters.parentPortalPageId)
+        ],EntityOperator.OR),
+        EntityCondition.makeCondition([
+            EntityCondition.makeCondition("ownerUserLoginId", EntityOperator.EQUALS, parameters.userLogin.userLoginId),
+            EntityCondition.makeCondition("ownerUserLoginId", EntityOperator.EQUALS, "_NA_")
+        ],EntityOperator.OR),
+    ],EntityOperator.AND);
+ sortField = parameters.sortField;
+ if (UtilValidate.isEmpty(sortField)) {
+ sortField = "portalPageName";
+ }
+ orderBy = [sortField];
+ portalPages = delegator.findList("PortalPage", ppCond, null, orderBy, null, false);
+ // remove overridden system pages
+ portalPages.each { portalPage ->
+ if (portalPage.ownerUserLoginId.equals("_NA_")) {
+ userPortalPages = delegator.findByAnd("PortalPage", [originalPortalPageId : portalPage.portalPageId, ownerUserLoginId : parameters.userLogin.userLoginId]);
+ if (userPortalPages) {
+ portalPages.remove(portalPage);
+ }
  }
  }
+ context.portalPages = portalPages;
 }
 
-context.portalPages = portalPages;
-