Hide pref groups using application method
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 20 Oct 2010 05:43:27 +0000 (23:43 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 20 Oct 2010 16:07:15 +0000 (10:07 -0600)
ingo/config/prefs.php.dist
ingo/lib/Application.php

index 549303a..632737c 100644 (file)
@@ -7,14 +7,11 @@
 
 // This preference group will only be displayed if the configured
 // Ingo_Script:: driver can create script files.
-if (!isset($_SESSION['ingo']['script_generate']) ||
-    $_SESSION['ingo']['script_generate']) {
-    $prefGroups['script'] = array(
-        'column' => _("Other Preferences"),
-        'label' => _("Script Updating"),
-        'desc' => _("Preferences about script updating."),
-        'members' => array('auto_update'));
-}
+$prefGroups['script'] = array(
+    'column' => _("Other Preferences"),
+    'label' => _("Script Updating"),
+    'desc' => _("Preferences about script updating."),
+    'members' => array('auto_update'));
 
 // The following preferences are only used for Horde_Script:: drivers that use
 // scripts.
index 6314637..ff656d2 100644 (file)
@@ -228,4 +228,17 @@ class Ingo_Application extends Horde_Registry_Application
         }
     }
 
+    /**
+     * Code to run on init when viewing prefs for this application.
+     *
+     * @param Horde_Core_Prefs_Ui $ui  The UI object.
+     */
+    public function prefsInit($ui)
+    {
+        if (!isset($GLOBALS['session']['ingo:script_generate']) ||
+            $GLOBALS['session']['ingo:script_generate']) {
+            $ui->suppressGroups[] = 'script';
+        }
+    }
+
 }