Projects
Kolab:Winterfell
roundcubemail
0005-Fix-bug-where-namespace-prefix-could-not-b...
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0005-Fix-bug-where-namespace-prefix-could-not-be-truncate.patch of Package roundcubemail (Revision 60)
Currently displaying revision
60
,
Show latest
From 2f6ca6d6729603e227a7b041204bed8ea61edd5f Mon Sep 17 00:00:00 2001 From: Aleksander Machniak <alec@alec.pl> Date: Sat, 1 Apr 2017 09:45:07 +0200 Subject: [PATCH 5/6] Fix bug where namespace prefix could not be truncated on folders list if show_real_foldernames=true (#5695) --- program/include/rcmail.php | 25 +++++++++++++++++-------- program/steps/settings/edit_folder.inc | 9 +++++---- program/steps/settings/folders.inc | 5 +++-- 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/program/include/rcmail.php b/program/include/rcmail.php index 68e0d6b..5dc7415 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -1674,12 +1674,13 @@ class rcmail extends rcube * 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 bool $with_path Enable path localization + * @param string $name Folder name + * @param bool $with_path Enable path localization + * @param bool $path_remove Remove the path * * @return string Localized folder name in UTF-8 encoding */ - public function localize_foldername($name, $with_path = false) + public function localize_foldername($name, $with_path = false, $path_remove = false) { $realnames = $this->config->get('show_real_foldernames'); @@ -1687,12 +1688,20 @@ class rcmail extends rcube return $this->gettext($folder_class); } + $storage = $this->get_storage(); + $delimiter = $storage->get_hierarchy_delimiter(); + + // Remove the path + if ($path_remove) { + if (strpos($name, $delimiter)) { + $path = explode($delimiter, $name); + $name = array_pop($path); + } + } // try to localize path of the folder - if ($with_path && !$realnames) { - $storage = $this->get_storage(); - $delimiter = $storage->get_hierarchy_delimiter(); - $path = explode($delimiter, $name); - $count = count($path); + else if ($with_path && !$realnames) { + $path = explode($delimiter, $name); + $count = count($path); if ($count > 1) { for ($i = 1; $i < $count; $i++) { diff --git a/program/steps/settings/edit_folder.inc b/program/steps/settings/edit_folder.inc index 8ddc17e..c16f2ca 100644 --- a/program/steps/settings/edit_folder.inc +++ b/program/steps/settings/edit_folder.inc @@ -86,20 +86,21 @@ function rcmail_folder_form($attrib) // Location (name) if ($options['protected']) { - $foldername = str_replace($delimiter, ' » ', rcube::Q($RCMAIL->localize_folderpath($mbox))); + $foldername = str_replace($delimiter, ' » ', rcube::Q($RCMAIL->localize_foldername($mbox, false, true))); } else if ($options['norename']) { $foldername = rcube::Q($folder); } else { - if (isset($_POST['_name'])) + if (isset($_POST['_name'])) { $folder = trim(rcube_utils::get_input_value('_name', rcube_utils::INPUT_POST, true)); + } $foldername = new html_inputfield(array('name' => '_name', 'id' => '_name', 'size' => 30)); $foldername = $foldername->show($folder); - if ($options['special']) { - $foldername .= ' (' . rcube::Q($RCMAIL->localize_foldername($mbox)) .')'; + if ($options['special'] && ($sname = $RCMAIL->localize_foldername($mbox, false, true)) != $folder) { + $foldername .= ' (' . rcube::Q($sname) .')'; } } diff --git a/program/steps/settings/folders.inc b/program/steps/settings/folders.inc index 345eb47..a7fab76 100644 --- a/program/steps/settings/folders.inc +++ b/program/steps/settings/folders.inc @@ -277,12 +277,13 @@ function rcmail_subscription_form($attrib) foreach ($list_folders as $i => $folder) { $sub_key = array_search($folder['id'], $a_subscribed); $subscribed = $sub_key !== false; - $protected = $folder['id'] == 'INBOX' || ($protect_default && isset($special_folders[$folder['id']])); + $special = $folder['id'] == 'INBOX' || isset($special_folders[$folder['id']]); + $protected = $folder['id'] == 'INBOX' || ($protect_default && $special); $noselect = false; $classes = array(); $folder_utf8 = rcube_charset::convert($folder['id'], 'UTF7-IMAP'); - $display_folder = rcube::Q($protected ? $RCMAIL->localize_foldername($folder['id']) : $folder['name']); + $display_folder = rcube::Q($special ? $RCMAIL->localize_foldername($folder['id'], false, true) : $folder['name']); if ($folder['virtual']) { $classes[] = 'virtual'; -- 2.9.3
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.