Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/roundcube/roundcubemail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2020-01-05 17:46:38 +0300
committerGitHub <noreply@github.com>2020-01-05 17:46:38 +0300
commite8e8c31eb35f12e47e1faaf0c4c8a2cd70e6db9e (patch)
treee0addf9ec22404e62a3cc05a570400ce8dc55f79 /program/include/rcmail.php
parent245e1aa9f9d7f1a7c5a790aae786853df90ba274 (diff)
Improve namespace roots presentation (#5012) (#6789)
- Display a special icon for other users and shared namespace roots (Elastic) - Change folders sorting so shared/other users namespaces are listed last Fixes #5012.
Diffstat (limited to 'program/include/rcmail.php')
-rw-r--r--program/include/rcmail.php52
1 files changed, 38 insertions, 14 deletions
diff --git a/program/include/rcmail.php b/program/include/rcmail.php
index 83f945fce..a20ae8ad7 100644
--- a/program/include/rcmail.php
+++ b/program/include/rcmail.php
@@ -1635,7 +1635,7 @@ class rcmail extends rcube
$is_collapsed = strpos($collapsed, '&'.rawurlencode($folder['id']).'&') !== false;
$unread = $msgcounts ? intval($msgcounts[$folder['id']]['UNSEEN']) : 0;
- if ($folder_class && !$realnames) {
+ if ($folder_class && !$realnames && $this->text_exists($folder_class)) {
$foldername = $this->gettext($folder_class);
}
else {
@@ -1733,7 +1733,7 @@ class rcmail extends rcube
}
}
- if (!$realnames && ($folder_class = $this->folder_classname($folder['id']))) {
+ if (!$realnames && ($folder_class = $this->folder_classname($folder['id'])) && $this->text_exists($folder_class)) {
$foldername = $this->gettext($folder_class);
}
else {
@@ -1757,21 +1757,43 @@ class rcmail extends rcube
}
/**
- * Return internal name for the given folder if it matches the configured special folders
+ * Returns class name for the given folder if it is a special folder
+ * (including shared/other users namespace roots).
+ *
+ * @param string $folder_id IMAP Folder name
+ *
+ * @return string|null CSS class name
*/
public function folder_classname($folder_id)
{
- if ($folder_id == 'INBOX') {
- return 'inbox';
- }
+ static $classes;
+
+ if ($classes === null) {
+ $classes = array('INBOX' => 'inbox');
- // for these mailboxes we have localized labels and css classes
- foreach (array('sent', 'drafts', 'trash', 'junk') as $smbx)
- {
- if ($folder_id === $this->config->get($smbx.'_mbox')) {
- return $smbx;
+ // for these mailboxes we have css classes
+ foreach (array('sent', 'drafts', 'trash', 'junk') as $type) {
+ if (($mbox = $this->config->get($type . '_mbox')) && !isset($classes[$mbox])) {
+ $classes[$mbox] = $type;
+ }
+ }
+
+ $storage = $this->get_storage();
+
+ // add classes for shared/other user namespace roots
+ foreach (array('other', 'shared') as $ns_name) {
+ if ($ns = $storage->get_namespace($ns_name)) {
+ foreach ($ns as $root) {
+ $root = substr($root[0], 0, -1);
+ if (strlen($root) && !isset($classes[$root])) {
+ $classes[$root] = "ns-$ns_name";
+ }
+ }
+ }
}
}
+
+ return $classes[$folder_id];
}
/**
@@ -1788,7 +1810,7 @@ class rcmail extends rcube
{
$realnames = $this->config->get('show_real_foldernames');
- if (!$realnames && ($folder_class = $this->folder_classname($name))) {
+ if (!$realnames && ($folder_class = $this->folder_classname($name)) && $this->text_exists($folder_class)) {
return $this->gettext($folder_class);
}
@@ -1809,8 +1831,10 @@ class rcmail extends rcube
if ($count > 1) {
for ($i = 1; $i < $count; $i++) {
- $folder = implode($delimiter, array_slice($path, 0, -$i));
- if ($folder_class = $this->folder_classname($folder)) {
+ $folder = implode($delimiter, array_slice($path, 0, -$i));
+ $folder_class = $this->folder_classname($folder);
+
+ if ($folder_class && $this->text_exists($folder_class)) {
$name = implode($delimiter, array_slice($path, $count - $i));
$name = rcube_charset::convert($name, 'UTF7-IMAP');