You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ha...@apache.org on 2009/04/02 08:18:49 UTC
svn commit: r761177 -
/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java
Author: hansbak
Date: Thu Apr 2 06:18:49 2009
New Revision: 761177
URL: http://svn.apache.org/viewvc?rev=761177&view=rev
Log:
only check for privat portal pages in the menu if a user is logged in
Modified:
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java?rev=761177&r1=761176&r2=761177&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java Thu Apr 2 06:18:49 2009
@@ -359,26 +359,28 @@
EntityOperator.OR)),
EntityOperator.AND);
portalPages = delegator.findList("PortalPage", cond, null, null, null, false);
- String userLoginId = ((GenericValue)context.get("userLogin")).getString("userLoginId");
- // replace with private pages
- for (GenericValue portalPage : portalPages) {
- cond = EntityCondition.makeCondition(UtilMisc.toList(
- EntityCondition.makeCondition("ownerUserLoginId", EntityOperator.EQUALS, userLoginId),
- EntityCondition.makeCondition("originalPortalPageId", EntityOperator.EQUALS, portalPage.getString("portalPageId"))),
- EntityOperator.AND);
- List <GenericValue> privatePortalPages = delegator.findList("PortalPage", cond, null, null, null, false);
- if (UtilValidate.isNotEmpty(privatePortalPages)) {
- portalPages.remove(portalPage);
- portalPages.add(privatePortalPages.get(0));
- }
+ if (UtilValidate.isNotEmpty(context.get("userLogin"))) { // check if a user is logged in
+ String userLoginId = ((GenericValue)context.get("userLogin")).getString("userLoginId");
+ // replace with private pages
+ for (GenericValue portalPage : portalPages) {
+ cond = EntityCondition.makeCondition(UtilMisc.toList(
+ EntityCondition.makeCondition("ownerUserLoginId", EntityOperator.EQUALS, userLoginId),
+ EntityCondition.makeCondition("originalPortalPageId", EntityOperator.EQUALS, portalPage.getString("portalPageId"))),
+ EntityOperator.AND);
+ List <GenericValue> privatePortalPages = delegator.findList("PortalPage", cond, null, null, null, false);
+ if (UtilValidate.isNotEmpty(privatePortalPages)) {
+ portalPages.remove(portalPage);
+ portalPages.add(privatePortalPages.get(0));
+ }
+ }
+ // add any other created private pages
+ cond = EntityCondition.makeCondition(UtilMisc.toList(
+ EntityCondition.makeCondition("ownerUserLoginId", EntityOperator.EQUALS, userLoginId),
+ EntityCondition.makeCondition("originalPortalPageId", EntityOperator.EQUALS, null),
+ EntityCondition.makeCondition("parentPortalPageId", EntityOperator.EQUALS, parentPortalPageId)),
+ EntityOperator.AND);
+ portalPages.addAll(delegator.findList("PortalPage", cond, null, null, null, false));
}
- // add any other created private pages
- cond = EntityCondition.makeCondition(UtilMisc.toList(
- EntityCondition.makeCondition("ownerUserLoginId", EntityOperator.EQUALS, userLoginId),
- EntityCondition.makeCondition("originalPortalPageId", EntityOperator.EQUALS, null),
- EntityCondition.makeCondition("parentPortalPageId", EntityOperator.EQUALS, parentPortalPageId)),
- EntityOperator.AND);
- portalPages.addAll(delegator.findList("PortalPage", cond, null, null, null, false));
portalPages = EntityUtil.orderBy(portalPages, UtilMisc.toList("sequenceNum"));
} catch (GenericEntityException e) {
Debug.logError("Could not retrieve portalpages in the menu:" + e.getMessage(), module);