From: Michael M Slusarz Date: Tue, 13 Apr 2010 05:25:52 +0000 (-0600) Subject: Add advanced preferences options screen X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=af641454c185e75d46fa43da92ef16d0c29d6cb1;p=horde.git Add advanced preferences options screen --- diff --git a/framework/Core/lib/Horde/Core/Prefs/Ui.php b/framework/Core/lib/Horde/Core/Prefs/Ui.php index 45d0e49c5..1c54005f9 100644 --- a/framework/Core/lib/Horde/Core/Prefs/Ui.php +++ b/framework/Core/lib/Horde/Core/Prefs/Ui.php @@ -5,6 +5,10 @@ * See Horde_Registry_Application:: for a summary of the API callbacks that * are available. * + * Session variables set (stored in 'horde_prefs'): + * 'advanced' - (boolean) If true, display advanced prefs. + * 'nomenu' - (boolean) If true, hide menu display. + * * Copyright 2001-2010 The Horde Project (http://www.horde.org/) * * See the enclosed file COPYING for license information (LGPL). If you @@ -143,8 +147,15 @@ class Horde_Core_Prefs_Ui if (!empty($this->prefGroups[$group]['members'])) { foreach ($this->prefGroups[$group]['members'] as $pref) { + /* Changeable pref if: + * 1. Not locked + * 2. Not in suppressed array ($this->suppress) + * 3. Not an advanced pref -or- in advanced view mode + * 4. Not checking for implicit -or- not an implicit pref */ if (!$GLOBALS['prefs']->isLocked($pref) && !in_array($pref, $this->suppress) && + (empty($this->prefs[$pref]['advanced']) || + !empty($_SESSION['horde_prefs']['advanced'])) && (!$implicit || (!empty($this->prefs[$pref]['type']) && ($this->prefs[$pref]['type'] != 'implicit')))) { @@ -162,6 +173,12 @@ class Horde_Core_Prefs_Ui */ public function handleForm() { + /* Toggle Advanced/Basic mode. */ + if (!empty($this->vars->show_advanced) || + !empty($this->vars->show_basic)) { + $_SESSION['horde_prefs']['advanced'] = !empty($this->vars->show_advanced); + } + if (!$this->group || !$this->groupIsEditable($this->group)) { return; } @@ -547,6 +564,13 @@ class Horde_Core_Prefs_Ui } $t->set('apps', $tmp); $t->set('header', htmlspecialchars(($this->app == 'horde') ? _("Global Options") : sprintf(_("Options for %s"), $registry->get('name', $this->app)))); + + if (empty($_SESSION['horde_prefs']['advanced'])) { + $t->set('advanced', $this->selfUrl()->add('show_advanced', 1)); + } else { + $t->set('basic', $this->selfUrl()->add('show_basic', 1)); + } + echo $t->fetch($h_templates . '/prefs/app.html'); /* Generate navigation header. */ diff --git a/horde/config/prefs.php.dist b/horde/config/prefs.php.dist index 245a5b350..369644f4e 100644 --- a/horde/config/prefs.php.dist +++ b/horde/config/prefs.php.dist @@ -39,6 +39,13 @@ * * The following are OPTIONAL values for each entry: * + * advanced - (boolean) Mark pref as advanced - will only be displayed if user + * switches to advanced options mode. + * VALUES: + * true: Advanced preference; hidden in basic options mode. + * false: Basic preference; shown regardless of options mode. + * DEFAULT: false + * * locked - (boolean) Allow preference to be changed from the options screen? * VALUES: * true: Do not show this preference in the UI and don't allow diff --git a/horde/docs/CHANGES b/horde/docs/CHANGES index 48917a7cf..63dfbf318 100644 --- a/horde/docs/CHANGES +++ b/horde/docs/CHANGES @@ -2,6 +2,7 @@ v4.0-cvs -------- +[mms] Add advanced preferences options screen. [mjr] Horde_Image can now act as an Iterator for multi-page images. [mms] Remove Horde_Cipher library. [mms] Add 'cssfiles' hook to add custom CSS files to a page. diff --git a/horde/templates/prefs/app.html b/horde/templates/prefs/app.html index 2a95e29e8..a1f17f248 100644 --- a/horde/templates/prefs/app.html +++ b/horde/templates/prefs/app.html @@ -15,6 +15,13 @@ + + + [Show Advanced Options] + + [Hide Advanced Options] + + diff --git a/horde/themes/screen.css b/horde/themes/screen.css index 3b7ac819b..b9b6bfc0b 100644 --- a/horde/themes/screen.css +++ b/horde/themes/screen.css @@ -564,6 +564,10 @@ div.prefsContainer p { img.prefsLinkImg { padding-right: 1px; } +span.prefsAdvanced { + padding: 3px 10px 0 0; + font-size: 80%; +} /* Block styles. */ .currentBlock { diff --git a/imp/config/prefs.php.dist b/imp/config/prefs.php.dist index 8f8b3c2b4..f3d5c8c52 100644 --- a/imp/config/prefs.php.dist +++ b/imp/config/prefs.php.dist @@ -449,8 +449,7 @@ $_prefs['compose_confirm'] = array( // allow the user to add a priority header when composing messages? $_prefs['set_priority'] = array( 'value' => 1, - // Locked by default - 'locked' => true, + 'advanced' => true, 'type' => 'checkbox', 'desc' => _("Set a priority header when composing messages?") ); @@ -582,8 +581,7 @@ $prefGroups['reply'] = array( // Should the original message be included? $_prefs['reply_quote'] = array( 'value' => 1, - // Locked by default - 'locked' => true, + 'advanced' => true, 'type' => 'checkbox', 'desc' => _("Include original message in a reply?") ); @@ -628,8 +626,7 @@ $prefGroups['forward'] = array( // forward method. $_prefs['forward_default'] = array( 'value' => 'attach', - // Locked by default - 'locked' => true, + 'advanced' => true, 'type' => 'enum', 'enum' => array( 'attach' => _("As attachment"), @@ -643,7 +640,7 @@ $_prefs['forward_default'] = array( // original message (for the body text)? $_prefs['forward_format'] = array( 'value' => 0, - // Locked by default + 'advanced' => true, 'locked' => true, 'type' => 'checkbox', 'desc' => _("When forwarding a message in the body text, should we use the same format as the original message?") @@ -680,8 +677,7 @@ $_prefs['unseen_drafts'] = array( // auto-save drafts? value is in minutes, 0 == don't save. $_prefs['auto_save_drafts'] = array( 'value' => 5, - // Locked by default - 'locked' => true, + 'advanced' => true, 'type' => 'enum', 'enum' => array( 0 => _("No"), @@ -773,8 +769,7 @@ $_prefs['html_image_addrbook'] = array( // should we try to mark different conversations with different colors? $_prefs['highlight_text'] = array( 'value' => 1, - // Locked by default - 'locked' => true, + 'advanced' => true, 'type' => 'checkbox', 'desc' => _("Mark different levels of quoting with different colors?") ); @@ -782,8 +777,7 @@ $_prefs['highlight_text'] = array( // should we try to mark simple markup with html tags? $_prefs['highlight_simple_markup'] = array( 'value' => 1, - // Locked by default - 'locked' => true, + 'advanced' => true, 'type' => 'checkbox', 'desc' => _("Mark simple markup?") ); @@ -805,8 +799,7 @@ $_prefs['show_quoteblocks'] = array( // should we dim signatures? $_prefs['dim_signature'] = array( 'value' => 0, - // Locked by default - 'locked' => true, + 'advanced' => true, 'type' => 'checkbox', 'desc' => _("Dim signatures?") ); @@ -858,8 +851,7 @@ $_prefs['default_msg_charset'] = array( // Send read receipts? $_prefs['disposition_send_mdn'] = array( 'value' => 1, - // Locked by default - 'locked' => true, + 'advanced' => true, 'type' => 'enum', 'enum' => array( 0 => _("Never send read receipt"), @@ -1205,8 +1197,7 @@ $_prefs['sortdate'] = array( // message was first received on the IMAP server and is maintained even // if the message moves between mailboxes. 'value' => Horde_Imap_Client::SORT_ARRIVAL, - // Locked by default - 'locked' => true, + 'advanced' => true, 'type' => 'enum', 'enum' => array( Horde_Imap_Client::SORT_ARRIVAL => _("Arrival time on server"), @@ -1629,16 +1620,14 @@ $_prefs['mimp_preview_msg'] = array( $_prefs['mimp_download_confirm'] = array( 'value' => 0, - // Locked by default - 'locked' => true, + 'advanced' => true, 'type' => 'number', 'desc' => _("Only show download confirmation page if message part is greater than this size, in bytes. Set to 0 to always require the confirmation page.") ); $_prefs['mimp_inline_all'] = array( 'value' => 0, - // Locked by default - 'locked' => true, + 'advanced' => true, 'type' => 'checkbox', 'desc' => _("Show all inline parts by default in message view? If unchecked, will treat all but the first viewable inline part as attachments.") ); @@ -1669,8 +1658,7 @@ $_prefs['preview_enabled'] = array( $_prefs['preview_maxlen'] = array( 'value' => 250, - // Locked by default - 'locked' => true, + 'advanced' => true, 'type' => 'enum', 'enum' => array( 100 => _("100 characters"), @@ -1678,29 +1666,26 @@ $_prefs['preview_maxlen'] = array( 500 => _("500 characters"), 1000 => _("1000 characters") ), - 'desc' => _("Characters to display:") + 'desc' => _("Characters to display in preview:") ); $_prefs['preview_strip_nl'] = array( 'value' => 1, - // Locked by default - 'locked' => true, + 'advanced' => true, 'type' => 'checkbox', - 'desc' => _("Strip linebreaks?") + 'desc' => _("Strip linebreaks in preview?") ); $_prefs['preview_show_unread'] = array( 'value' => 1, - // Locked by default - 'locked' => true, + 'advanced' => true, 'type' => 'checkbox', 'desc' => _("Show previews for unread messages only?") ); $_prefs['preview_show_tooltip'] = array( 'value' => 0, - // Locked by default - 'locked' => true, + 'advanced' => true, 'type' => 'checkbox', 'desc' => _("Show previews in tooltips?") );