Permalink
Browse files

Improved folder path presentation in page title (use unified delimite…

…r, localize path).

E.g. folder "INBOX.test" will be displayed as "Inbox >> test"
  • Loading branch information...
1 parent 8e8f3b9 commit 4d7964d9101d08b5e7533cea50e52e07bf3f783a @alecpl alecpl committed Jan 18, 2013
Showing with 27 additions and 5 deletions.
  1. +21 −2 program/include/rcmail.php
  2. +6 −2 program/steps/mail/func.inc
  3. +0 −1 program/steps/mail/list.inc
@@ -1677,12 +1677,31 @@ public function folder_classname($folder_id)
* Try to localize the given IMAP folder name.
* UTF-7 decode it in case no localized text was found
*
- * @param string $name Folder name
+ * @param string $name Folder name
+ * @param bool $with_path Enable path localization
*
* @return string Localized folder name in UTF-8 encoding
*/
- public function localize_foldername($name)
+ public function localize_foldername($name, $with_path = true)
{
+ // try to localize path of the folder
+ if ($with_path) {
+ $storage = $this->get_storage();
+ $delimiter = $storage->get_hierarchy_delimiter();
+ $path = explode($delimiter, $name);
+ $count = count($path);
+
+ if ($count > 1) {
+ for ($i = 1; $i < $count; $i++) {
+ $folder = implode($delimiter, array_slice($path, 0, -$i));
+ if ($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');
+ }
+ }
+ }
+ }
+
if ($folder_class = $this->folder_classname($name)) {
return $this->gettext($folder_class);
}
@@ -89,11 +89,12 @@ if (empty($RCMAIL->action) || $RCMAIL->action == 'list') {
}
$threading = (bool) $RCMAIL->storage->get_threading();
+ $delimiter = $RCMAIL->storage->get_hierarchy_delimiter();
// set current mailbox and some other vars in client environment
$OUTPUT->set_env('mailbox', $mbox_name);
$OUTPUT->set_env('pagesize', $RCMAIL->storage->get_pagesize());
- $OUTPUT->set_env('delimiter', $RCMAIL->storage->get_hierarchy_delimiter());
+ $OUTPUT->set_env('delimiter', $delimiter);
$OUTPUT->set_env('threading', $threading);
$OUTPUT->set_env('threads', $threading || $RCMAIL->storage->get_capability('THREAD'));
$OUTPUT->set_env('preview_pane_mark_read', $RCMAIL->config->get('preview_pane_mark_read', 0));
@@ -121,7 +122,10 @@ if (empty($RCMAIL->action) || $RCMAIL->action == 'list') {
'movingmessage', 'copyingmessage', 'deletingmessage', 'markingmessage',
'copy', 'move', 'quota');
- $OUTPUT->set_pagetitle(rcmail_localize_foldername($RCMAIL->storage->mod_folder($mbox_name)));
+ $pagetitle = $RCMAIL->localize_foldername($RCMAIL->storage->mod_folder($mbox_name), true);
+ $pagetitle = str_replace($delimiter, " \xC2\xBB ", $pagetitle);
+
+ $OUTPUT->set_pagetitle($pagetitle);
}
/**
@@ -97,7 +97,6 @@ $OUTPUT->set_env('threading', $threading);
$OUTPUT->set_env('current_page', $count ? $RCMAIL->storage->get_page() : 1);
$OUTPUT->set_env('exists', $RCMAIL->storage->count($mbox_name, 'EXISTS'));
$OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($count), $mbox_name);
-$OUTPUT->command('set_mailboxname', rcmail_get_mailbox_name_text());
// add message rows
rcmail_js_message_list($a_headers, FALSE, $cols);

0 comments on commit 4d7964d

Please sign in to comment.