Track Horde_Prefs_Ui:: changes.
authorMichael M Slusarz <slusarz@curecanti.org>
Mon, 30 Nov 2009 20:37:37 +0000 (13:37 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Mon, 30 Nov 2009 22:40:46 +0000 (15:40 -0700)
19 files changed:
ansel/lib/Application.php
fima/lib/Application.php
gollem/lib/Application.php
imp/acl.php
imp/filterprefs.php
imp/lib/Application.php
imp/pgp.php
imp/smime.php
imp/stationery.php
imp/templates/prefs/accountsmanagement.inc
imp/templates/prefs/draftsselect.inc
imp/templates/prefs/initialpageselect.inc
imp/templates/prefs/sentmailselect.inc
imp/templates/prefs/soundselect.inc
imp/templates/prefs/spamselect.inc
imp/templates/prefs/trashselect.inc
kronolith/lib/Application.php
nag/lib/Application.php
turba/lib/Application.php

index ebe2d97..2a68280 100644 (file)
@@ -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':
index a3b8266..fb9628b 100644 (file)
@@ -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':
index c7649a1..7d0f7b3 100644 (file)
@@ -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':
index 10d3da0..a435451 100644 (file)
@@ -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)));
index 46a5dc8..348a0ae 100644 (file)
@@ -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"));
 
index 20ddf19..0ebbcd5 100644 (file)
@@ -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);
index b6a3547..9768cf8 100644 (file)
@@ -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();
index 53ff525..f9b8bd8 100644 (file)
@@ -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');
 
index d465077..a9df3aa 100644 (file)
@@ -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) {
index 25f9ebf..89b55b0 100644 (file)
@@ -1,4 +1,3 @@
-<?php $GLOBALS['prefsui_no_save'] = true; ?>
 <input type="hidden" name="accounts_action" id="accounts_action" />
 <input type="hidden" name="accounts_data" id="accounts_data" />
 
index 2acabee..349b230 100644 (file)
@@ -1,4 +1,3 @@
-<?php if (!$prefs->isLocked('drafts_folder')): ?>
 <?php echo Horde::label('drafts', _("Drafts folder:")) ?><br />
 <input type="hidden" name="drafts_new" id="drafts_new" value="" />
 <select id="drafts" name="drafts">
@@ -6,4 +5,3 @@
  <?php echo IMP::flistSelect(array('heading' => _("Create a new drafts folder"), 'filter' => array('INBOX'), 'selected' => IMP::folderPref($prefs->getValue('drafts_folder'), true), 'new_folder' => true)) ?>
 </select>
 <br />
-<?php endif; ?>
index 2d3bf83..c0a4308 100644 (file)
@@ -1,5 +1,4 @@
-<?php if (!$prefs->isLocked('initial_page')):
-
+<?php
 if (empty($GLOBALS['conf']['user']['allow_folders'])) {
     $mailbox_option = '<option value="INBOX" selected="selected">' . _("Inbox") . '</option>';
 } else {
@@ -11,11 +10,11 @@ if (empty($GLOBALS['conf']['user']['allow_folders'])) {
     $mailbox_option .= '>' . _("Folder Navigator") . "</option>\n"
         . IMP::flistSelect(array('selected' => $mailbox_selected, 'inc_vfolder' => true));
 }
-?>
 
-<?php echo Horde::label('initial_page', _("View or mailbox to display after login:")) ?><br />
+echo Horde::label('initial_page', _("View or mailbox to display after login:"));
+?>
+<br />
 <select id="initial_page" name="initial_page">
  <?php echo $mailbox_option ?>
 </select>
 <br />
-<?php endif; ?>
index 6f863cb..1663f0e 100644 (file)
@@ -1,4 +1,3 @@
-<?php if (!$prefs->isLocked('sent_mail_folder')): ?>
 <?php echo Horde::label('sent_mail_folder', _("Sent mail folder:")) ?><br />
 <input type="hidden" name="sent_mail_new" id="sent_mail_new" value="" />
 <select name="sent_mail_folder" id="sent_mail_folder">
@@ -7,4 +6,3 @@
  <?php echo IMP::flistSelect(array('heading' => _("Create a new sent mail folder"), 'filter' => array('INBOX'))) ?>
 </select>
 <br />
-<?php endif; ?>
index 58bea09..4bccae6 100644 (file)
@@ -1,4 +1,3 @@
-<?php if (!$prefs->isLocked('nav_audio')): ?>
 <?php $nav_audio = $prefs->getValue('nav_audio') ?>
 <p><?php echo _("Play a sound on new mail? Although most browsers support embedded sound files, some may require a plugin.") ?></p>
 <ul class="sound-list">
@@ -13,4 +12,3 @@
  </li>
 <?php endforeach; ?>
 </ul>
-<?php endif; ?>
index cf2dfd9..bf46812 100644 (file)
@@ -1,8 +1,6 @@
-<?php if (!$prefs->isLocked('spam_folder')): ?>
 <?php echo Horde::label('spam', _("Spam folder:")) ?><br />
 <input type="hidden" name="spam_new" id="spam_new" value="" />
 <select id="spam" name="spam">
  <option value="<?php echo IMP::PREF_NO_FOLDER ?>"><?php echo _("None") ?></option>
  <?php echo IMP::flistSelect(array('heading' => _("Create a new Spam folder"), 'filter' => array('INBOX'), 'selected' => IMP::folderPref($prefs->getValue('spam_folder'), true), 'new_folder' => true)) ?>
 </select>
-<?php endif; ?>
index b048561..9ba80d2 100644 (file)
@@ -1,4 +1,3 @@
-<?php if (!$prefs->isLocked('trash_folder') && !$prefs->isLocked('use_vtrash')): ?>
 <?php echo Horde::label('trash', _("Trash folder:")) ?><br />
 <input type="hidden" name="trash_new" id="trash_new" value="" />
 <select id="trash" name="trash">
@@ -10,4 +9,3 @@
 ?>
 </select>
 <br />
-<?php endif; ?>
index d9219b4..516b50a 100644 (file)
@@ -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':
index db620e8..6b5f94e 100644 (file)
@@ -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':
index 894ad70..b12219d 100644 (file)
@@ -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':