From 174327c25cd68f203e0985df51b94765738c7dce Mon Sep 17 00:00:00 2001 From: Aleksander Machniak <alec@alec.pl> Date: Tue, 11 Jun 2013 03:33:21 -0400 Subject: [PATCH] Merge pull request #77 from dpc22/realnames --- program/include/rcmail.php | 9 +++++++-- program/steps/settings/func.inc | 13 +++++++++++++ config/main.inc.php.dist | 3 +++ program/steps/settings/save_prefs.inc | 2 ++ program/localization/en_GB/labels.inc | 1 + 5 files changed, 26 insertions(+), 2 deletions(-) diff --git a/config/main.inc.php.dist b/config/main.inc.php.dist index 889d101..1091b87 100644 --- a/config/main.inc.php.dist +++ b/config/main.inc.php.dist @@ -481,6 +481,9 @@ // NOTE: Use folder names with namespace prefix (INBOX. on Courier-IMAP) $rcmail_config['default_folders'] = array('INBOX', 'Drafts', 'Sent', 'Junk', 'Trash'); +// Disable localization of the four default folder names listed above +$rcmail_config['show_real_foldernames'] = false; + // automatically create the above listed default folders on first login $rcmail_config['create_default_folders'] = false; diff --git a/program/include/rcmail.php b/program/include/rcmail.php index 0cb4aad..17c95d7 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -1326,6 +1326,9 @@ $msgcounts = $this->storage->get_cache('messagecount'); $collapsed = $this->config->get('collapsed_folders'); + if ($this->config->get('show_real_foldernames')) + $realnames = true; + $out = ''; foreach ($arrFolders as $folder) { $title = null; @@ -1491,7 +1494,8 @@ if ($count > 1) { for ($i = 0; $i < $count; $i++) { $folder = implode($delimiter, array_slice($path, 0, -$i)); - if ($folder_class = $this->folder_classname($folder)) { + if (!$this->config->get('show_real_foldernames') && + ($folder_class = $this->folder_classname($folder))) { $name = implode($delimiter, array_slice($path, $count - $i)); return $this->gettext($folder_class) . $delimiter . rcube_charset::convert($name, 'UTF7-IMAP'); } @@ -1499,7 +1503,8 @@ } } - if ($folder_class = $this->folder_classname($name)) { + if (!$this->config->get('show_real_foldernames') && + ($folder_class = $this->folder_classname($name))) { return $this->gettext($folder_class); } else { diff --git a/program/localization/en_GB/labels.inc b/program/localization/en_GB/labels.inc index 275208a..88e4cfd 100644 --- a/program/localization/en_GB/labels.inc +++ b/program/localization/en_GB/labels.inc @@ -37,6 +37,7 @@ $labels['sent'] = 'Sent'; $labels['trash'] = 'Deleted Items'; $labels['junk'] = 'Junk'; +$labels['show_real_foldernames'] = 'Show real names for special folders'; // message listing $labels['subject'] = 'Subject'; diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc index 636941d..cbe3bc9 100644 --- a/program/steps/settings/func.inc +++ b/program/steps/settings/func.inc @@ -780,6 +780,19 @@ 'main' => array('name' => Q(rcube_label('mainoptions'))), ); + + if (!isset($no_override['show_real_foldernames'])) { + $field_id = 'show_real_foldernames'; + $input_show_real_foldernames = + new html_checkbox(array('name' => '_show_real_foldernames', + 'id' => $field_id, 'value' => 1)); + + $blocks['main']['options']['show_real_foldernames'] = array( + 'title' => html::label($field_id, + Q(rcube_label('show_real_foldernames'))), + 'content' => $input_show_real_foldernames->show($config['show_real_foldernames']?1:0), + ); + } // Configure special folders if (!isset($no_override['default_folders'])) { // load folders list only when needed diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc index d0a3bec..19edb41 100644 --- a/program/steps/settings/save_prefs.inc +++ b/program/steps/settings/save_prefs.inc @@ -120,6 +120,8 @@ case 'folders': $a_user_prefs = array( + 'show_real_foldernames' => + isset($_POST['_show_real_foldernames']) ? TRUE : FALSE, 'drafts_mbox' => get_input_value('_drafts_mbox', RCUBE_INPUT_POST, true), 'sent_mbox' => get_input_value('_sent_mbox', RCUBE_INPUT_POST, true), 'junk_mbox' => get_input_value('_junk_mbox', RCUBE_INPUT_POST, true), -- Gitblit v1.9.1