From 95427ccd8bcb03db7c9ab306df4aef2844a3a9c4 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 19 Oct 2010 23:43:27 -0600 Subject: [PATCH] Hide pref groups using application method --- ingo/config/prefs.php.dist | 13 +++++-------- ingo/lib/Application.php | 13 +++++++++++++ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/ingo/config/prefs.php.dist b/ingo/config/prefs.php.dist index 549303a0a..632737c95 100644 --- a/ingo/config/prefs.php.dist +++ b/ingo/config/prefs.php.dist @@ -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. diff --git a/ingo/lib/Application.php b/ingo/lib/Application.php index 63146377e..ff656d2a9 100644 --- a/ingo/lib/Application.php +++ b/ingo/lib/Application.php @@ -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'; + } + } + } -- 2.11.0