roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r645116 - /roller/branches/roller_4.0/apps/weblogger/src/java/org/apache/roller/weblogger/ui/core/util/menu/MenuHelper.java
Date Sat, 05 Apr 2008 15:14:47 GMT
Author: snoopdave
Date: Sat Apr  5 08:14:47 2008
New Revision: 645116

URL: http://svn.apache.org/viewvc?rev=645116&view=rev
Log:
Another bug fix related to ROL-1666. This change makes the menu code prefer runtime over startup
properties when checking whether a menu tab/item is enabled/disabled.

Modified:
    roller/branches/roller_4.0/apps/weblogger/src/java/org/apache/roller/weblogger/ui/core/util/menu/MenuHelper.java

Modified: roller/branches/roller_4.0/apps/weblogger/src/java/org/apache/roller/weblogger/ui/core/util/menu/MenuHelper.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.0/apps/weblogger/src/java/org/apache/roller/weblogger/ui/core/util/menu/MenuHelper.java?rev=645116&r1=645115&r2=645116&view=diff
==============================================================================
--- roller/branches/roller_4.0/apps/weblogger/src/java/org/apache/roller/weblogger/ui/core/util/menu/MenuHelper.java
(original)
+++ roller/branches/roller_4.0/apps/weblogger/src/java/org/apache/roller/weblogger/ui/core/util/menu/MenuHelper.java
Sat Apr  5 08:14:47 2008
@@ -26,6 +26,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.config.WebloggerConfig;
+import org.apache.roller.weblogger.config.WebloggerRuntimeConfig;
 import org.apache.roller.weblogger.pojos.WeblogPermission;
 import org.apache.roller.weblogger.pojos.User;
 import org.apache.roller.weblogger.pojos.Weblog;
@@ -98,9 +99,9 @@
             // does this tab have an enabledProperty?
             boolean includeTab = true;
             if(configTab.getEnabledProperty() != null) {
-                includeTab = WebloggerConfig.getBooleanProperty(configTab.getEnabledProperty());
+                includeTab = getBooleanProperty(configTab.getEnabledProperty());
             } else if(configTab.getDisabledProperty() != null) {
-                includeTab = ! WebloggerConfig.getBooleanProperty(configTab.getDisabledProperty());
+                includeTab = ! getBooleanProperty(configTab.getDisabledProperty());
             }
             
             if(includeTab) {
@@ -135,9 +136,9 @@
                     
                     boolean includeItem = true;
                     if(configTabItem.getEnabledProperty() != null) {
-                        includeItem = WebloggerConfig.getBooleanProperty(configTabItem.getEnabledProperty());
+                        includeItem = getBooleanProperty(configTabItem.getEnabledProperty());
                     } else if(configTabItem.getDisabledProperty() != null) {
-                        includeItem = ! WebloggerConfig.getBooleanProperty(configTabItem.getDisabledProperty());
+                        includeItem = !getBooleanProperty(configTabItem.getDisabledProperty());
                     }
                     
                     if(includeItem) {
@@ -208,6 +209,13 @@
         return weblog.hasUserPermissions(user, permMask);
     }
     
+    /** Check enabled property, prefers runtime properties */
+    private static boolean getBooleanProperty(String propertyName) {
+        if (WebloggerRuntimeConfig.getProperty(propertyName) != null) {
+            return WebloggerRuntimeConfig.getBooleanProperty(propertyName);
+        }
+        return WebloggerConfig.getBooleanProperty(propertyName);
+    }
     
     private static boolean isSelected(String currentAction, ParsedTabItem tabItem) {
         



Mime
View raw message