From 3f159263514a3de495770db48a109df318346124 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Mon, 30 Nov 2009 13:37:37 -0700 Subject: [PATCH] Track Horde_Prefs_Ui:: changes. --- ansel/lib/Application.php | 2 +- fima/lib/Application.php | 2 +- gollem/lib/Application.php | 2 +- imp/acl.php | 7 ++--- imp/filterprefs.php | 7 ++--- imp/lib/Application.php | 50 +++++++++++++++++++++++++++--- imp/pgp.php | 5 +-- imp/smime.php | 5 +-- imp/stationery.php | 7 ++--- imp/templates/prefs/accountsmanagement.inc | 1 - imp/templates/prefs/draftsselect.inc | 2 -- imp/templates/prefs/initialpageselect.inc | 9 +++--- imp/templates/prefs/sentmailselect.inc | 2 -- imp/templates/prefs/soundselect.inc | 2 -- imp/templates/prefs/spamselect.inc | 2 -- imp/templates/prefs/trashselect.inc | 2 -- kronolith/lib/Application.php | 2 +- nag/lib/Application.php | 2 +- turba/lib/Application.php | 2 +- 19 files changed, 63 insertions(+), 50 deletions(-) diff --git a/ansel/lib/Application.php b/ansel/lib/Application.php index ebe2d9799..2a682803f 100644 --- a/ansel/lib/Application.php +++ b/ansel/lib/Application.php @@ -38,7 +38,7 @@ class Ansel_Application extends Horde_Registry_Application * * @return boolean True if preference was updated. */ - public function prefsHandle($item, $updated) + public function prefsSpecial($item, $updated) { switch ($item) { case 'default_category_select': diff --git a/fima/lib/Application.php b/fima/lib/Application.php index a3b8266d8..fb9628b52 100644 --- a/fima/lib/Application.php +++ b/fima/lib/Application.php @@ -11,7 +11,7 @@ class Fima_Application extends Horde_Regsitry_Application * * @return boolean True if preference was updated. */ - public function prefsHandle($item, $updated) + public function prefsSpecial($item, $updated) { switch ($item) { case 'ledgerselect': diff --git a/gollem/lib/Application.php b/gollem/lib/Application.php index c7649a166..7d0f7b356 100644 --- a/gollem/lib/Application.php +++ b/gollem/lib/Application.php @@ -54,7 +54,7 @@ class Gollem_Application extends Horde_Registry_Application * * @return boolean True if preference was updated. */ - public function prefsHandle($item, $updated) + public function prefsSpecial($item, $updated) { switch ($item) { case 'columnselect': diff --git a/imp/acl.php b/imp/acl.php index 10d3da024..a435451d6 100644 --- a/imp/acl.php +++ b/imp/acl.php @@ -126,18 +126,15 @@ if (empty($folder)) { $curr_acl = $ACLDriver->getACL($folder); $canEdit = $ACLDriver->canEdit($folder, Horde_Auth::getAuth()); -extract(Horde::loadConfiguration('prefs.php', array('prefGroups', '_prefs'), 'imp')); - -$app = 'imp'; $chunk = Horde_Util::nonInputVar('chunk'); -Horde_Prefs_Ui::generateHeader(null, $chunk); +Horde_Prefs_Ui::generateHeader('imp', null, null, $chunk); /* Set up template. */ $t = new Horde_Template(); $t->setOption('gettext', true); $t->set('aclurl', Horde::applicationUrl('acl.php')); $t->set('forminput', Horde_Util::formInput()); -$t->set('aclnavcell', Horde_Util::bufferOutput(array('Horde_Prefs_Ui', 'generateNavigationCell'), 'acl')); +$t->set('aclnavcell', Horde_Util::bufferOutput(array('Horde_Prefs_Ui', 'generateNavigationCell'), 'imp', 'acl')); $t->set('changefolder', Horde::link('#', _("Change Folder"), 'smallheader', '', '', '', '', array('id' => 'changefolder'))); $t->set('sharedimg', Horde::img('shared.png', _("Change Folder"))); $t->set('options', IMP::flistSelect(array('selected' => $folder))); diff --git a/imp/filterprefs.php b/imp/filterprefs.php index 46a5dc8e2..348a0aead 100644 --- a/imp/filterprefs.php +++ b/imp/filterprefs.php @@ -12,8 +12,6 @@ require_once dirname(__FILE__) . '/lib/Application.php'; new IMP_Application(array('init' => true)); -extract(Horde::loadConfiguration('prefs.php', array('prefGroups', '_prefs'), 'imp')); - /* Are preferences locked? */ $login_locked = $prefs->isLocked('filter_on_login') || empty($_SESSION['imp']['filteravail']); $display_locked = $prefs->isLocked('filter_on_display') || empty($_SESSION['imp']['filteravail']); @@ -44,14 +42,13 @@ case 'update_prefs': break; } -$app = 'imp'; $chunk = Horde_Util::nonInputVar('chunk'); $group = 'filters'; -Horde_Prefs_Ui::generateHeader(null, $chunk); +Horde_Prefs_Ui::generateHeader('imp', null, null, $chunk); $t = new Horde_Template(); $t->setOption('gettext', true); -$t->set('navcell', Horde_Util::bufferOutput(array('Horde_Prefs_Ui', 'generateNavigationCell'), 'filters')); +$t->set('navcell', Horde_Util::bufferOutput(array('Horde_Prefs_Ui', 'generateNavigationCell'), 'imp', 'filters')); $t->set('prefsurl', Horde::getServiceLink('options', 'imp')); $t->set('return_text', _("Return to Options")); diff --git a/imp/lib/Application.php b/imp/lib/Application.php index 20ddf19de..0ebbcd50d 100644 --- a/imp/lib/Application.php +++ b/imp/lib/Application.php @@ -526,17 +526,17 @@ class IMP_Application extends Horde_Registry_Application * * @return boolean True if preference was updated. */ - public function prefsHandle($item, $updated) + public function prefsSpecial($item, $updated) { switch ($item) { case 'sentmailselect': return $this->_prefsSentmailSelect($updated); case 'draftsselect': - return $updated | $this->_prefsHandleFolders($updated, 'drafts_folder', 'drafts', 'drafts_new'); + return $updated | $this->_prefsSpecialFolders($updated, 'drafts_folder', 'drafts', 'drafts_new'); case 'spamselect': - return $updated | $this->_prefsHandleFolders($updated, 'spam_folder', 'spam', 'spam_new'); + return $updated | $this->_prefsSpecialFolders($updated, 'spam_folder', 'spam', 'spam_new'); case 'trashselect': return $this->_prefsTrashSelect($updated); @@ -566,6 +566,46 @@ class IMP_Application extends Horde_Registry_Application } /** + * Special preferences handling on UI display. + * + * @param string $item The preference name. + * + * @return boolean True if the preference item should be displayed. + */ + public function prefsSpecialGenerate($item) + { + switch ($item) { + case 'sentmailselect': + return !$GLOBALS['prefs']->isLocked('sent_mail_folder'); + + case 'draftsselect': + return !$GLOBALS['prefs']->isLocked('drafts_folder'); + + case 'spamselect': + return !$GLOBALS['prefs']->isLocked('spam_folder'); + + case 'trashselect': + return (!$GLOBALS['prefs']->isLocked('trash_folder') && !$GLOBALS['prefs']->isLocked('use_vtrash')); + + case 'initialpageselect': + return !$GLOBALS['prefs']->isLocked('initial_page'); + + case 'encryptselect': + return !$GLOBALS['prefs']->isLocked('default_encrypt'); + + case 'soundselect': + return !$GLOBALS['prefs']->isLocked('nav_audio'); + + case 'accountsmanagement': + $GLOBALS['prefsui_no_save'] = true; + return true; + + default: + return true; + } + } + + /** * Do anything that we need to do as a result of certain preferences * changing. */ @@ -666,7 +706,7 @@ class IMP_Application extends Horde_Registry_Application /** * TODO */ - protected function _prefsHandlefolders($updated, $pref, $folder, $new) + protected function _prefsSpecialFolders($updated, $pref, $folder, $new) { if (!$GLOBALS['conf']['user']['allow_folders']) { return $updated; @@ -714,7 +754,7 @@ class IMP_Application extends Horde_Registry_Application return false; } - $updated = $updated | $this->_prefsHandleFolders($updated, 'trash_folder', 'trash', 'trash_new'); + $updated = $updated | $this->_prefsSpecialFolders($updated, 'trash_folder', 'trash', 'trash_new'); if ($updated) { $prefs->setValue('use_vtrash', 0); $prefs->setDirty('trash_folder', true); diff --git a/imp/pgp.php b/imp/pgp.php index b6a3547f1..9768cf853 100644 --- a/imp/pgp.php +++ b/imp/pgp.php @@ -302,11 +302,8 @@ try { $notification->push($e); } -extract(Horde::loadConfiguration('prefs.php', array('prefGroups', '_prefs'), 'imp')); - -$app = 'imp'; $chunk = Horde_Util::nonInputVar('chunk'); -Horde_Prefs_Ui::generateHeader('pgp', $chunk); +Horde_Prefs_Ui::generateHeader('imp', null, 'pgp', $chunk); /* If PGP preference not active, do NOT show PGP Admin screen. */ $t = new Horde_Template(); diff --git a/imp/smime.php b/imp/smime.php index 53ff52593..f9b8bd81e 100644 --- a/imp/smime.php +++ b/imp/smime.php @@ -221,11 +221,8 @@ try { $notification->push($e); } -extract(Horde::loadConfiguration('prefs.php', array('prefGroups', '_prefs'), 'imp')); - -$app = 'imp'; $chunk = Horde_Util::nonInputVar('chunk'); -Horde_Prefs_Ui::generateHeader('smime', $chunk); +Horde_Prefs_Ui::generateHeader('imp', null, 'smime', $chunk); $selfURL = Horde::applicationUrl('smime.php'); diff --git a/imp/stationery.php b/imp/stationery.php index d465077da..a9df3aac8 100644 --- a/imp/stationery.php +++ b/imp/stationery.php @@ -101,17 +101,14 @@ if ($stationery['t'] == 'html') { } /* Show the header. */ -extract(Horde::loadConfiguration('prefs.php', array('prefGroups', '_prefs'), 'imp')); - -$app = 'imp'; $chunk = Horde_Util::nonInputVar('chunk'); -Horde_Prefs_Ui::generateHeader(null, $chunk); +Horde_Prefs_Ui::generateHeader('imp', null, null, $chunk); $t = new Horde_Template(); $t->setOption('gettext', true); $t->set('action', Horde::selfUrl()); $t->set('forminput', Horde_Util::formInput()); -$t->set('navcell', Horde_Util::bufferOutput(array('Horde_Prefs_Ui', 'generateNavigationCell'), 'compose')); +$t->set('navcell', Horde_Util::bufferOutput(array('Horde_Prefs_Ui', 'generateNavigationCell'), 'imp', 'compose')); $slist = array(); foreach ($stationery_list as $key => $choice) { diff --git a/imp/templates/prefs/accountsmanagement.inc b/imp/templates/prefs/accountsmanagement.inc index 25f9ebf55..89b55b0f4 100644 --- a/imp/templates/prefs/accountsmanagement.inc +++ b/imp/templates/prefs/accountsmanagement.inc @@ -1,4 +1,3 @@ - diff --git a/imp/templates/prefs/draftsselect.inc b/imp/templates/prefs/draftsselect.inc index 2acabeef8..349b230b4 100644 --- a/imp/templates/prefs/draftsselect.inc +++ b/imp/templates/prefs/draftsselect.inc @@ -1,4 +1,3 @@ -isLocked('drafts_folder')): ?>

- diff --git a/imp/templates/prefs/initialpageselect.inc b/imp/templates/prefs/initialpageselect.inc index 2d3bf83df..c0a4308fe 100644 --- a/imp/templates/prefs/initialpageselect.inc +++ b/imp/templates/prefs/initialpageselect.inc @@ -1,5 +1,4 @@ -isLocked('initial_page')): - +' . _("Inbox") . ''; } else { @@ -11,11 +10,11 @@ if (empty($GLOBALS['conf']['user']['allow_folders'])) { $mailbox_option .= '>' . _("Folder Navigator") . "\n" . IMP::flistSelect(array('selected' => $mailbox_selected, 'inc_vfolder' => true)); } -?> -
+echo Horde::label('initial_page', _("View or mailbox to display after login:")); +?> +

- diff --git a/imp/templates/prefs/sentmailselect.inc b/imp/templates/prefs/sentmailselect.inc index 6f863cb32..1663f0e4c 100644 --- a/imp/templates/prefs/sentmailselect.inc +++ b/imp/templates/prefs/sentmailselect.inc @@ -1,4 +1,3 @@ -isLocked('sent_mail_folder')): ?>

- diff --git a/imp/templates/prefs/soundselect.inc b/imp/templates/prefs/soundselect.inc index 58bea0917..4bccae690 100644 --- a/imp/templates/prefs/soundselect.inc +++ b/imp/templates/prefs/soundselect.inc @@ -1,4 +1,3 @@ -isLocked('nav_audio')): ?> getValue('nav_audio') ?>

- diff --git a/imp/templates/prefs/spamselect.inc b/imp/templates/prefs/spamselect.inc index cf2dfd910..bf4681210 100644 --- a/imp/templates/prefs/spamselect.inc +++ b/imp/templates/prefs/spamselect.inc @@ -1,8 +1,6 @@ -isLocked('spam_folder')): ?>
- diff --git a/imp/templates/prefs/trashselect.inc b/imp/templates/prefs/trashselect.inc index b048561f7..9ba80d224 100644 --- a/imp/templates/prefs/trashselect.inc +++ b/imp/templates/prefs/trashselect.inc @@ -1,4 +1,3 @@ -isLocked('trash_folder') && !$prefs->isLocked('use_vtrash')): ?>

- diff --git a/kronolith/lib/Application.php b/kronolith/lib/Application.php index d9219b457..516b50aa3 100644 --- a/kronolith/lib/Application.php +++ b/kronolith/lib/Application.php @@ -74,7 +74,7 @@ class Kronolith_Application extends Horde_Registry_Application * * @return boolean True if preference was updated. */ - public function prefsHandle($item, $updated) + public function prefsSpecial($item, $updated) { switch ($item) { case 'remote_cal_management': diff --git a/nag/lib/Application.php b/nag/lib/Application.php index db620e8fb..6b5f94e8d 100644 --- a/nag/lib/Application.php +++ b/nag/lib/Application.php @@ -56,7 +56,7 @@ class Nag_Application extends Horde_Registry_Application * * @return boolean True if preference was updated. */ - public function prefsHandle($item, $updated) + public function prefsSpecial($item, $updated) { switch ($item) { case 'tasklistselect': diff --git a/turba/lib/Application.php b/turba/lib/Application.php index 894ad7032..b12219dc7 100644 --- a/turba/lib/Application.php +++ b/turba/lib/Application.php @@ -87,7 +87,7 @@ class Turba_Application extends Horde_Registry_Application * * @return boolean True if preference was updated. */ - public function prefsHandle($item, $updated) + public function prefsSpecial($item, $updated) { switch ($item) { case 'columnselect': -- 2.11.0