summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2014-03-22 14:55:12 +0100
committerAleksander Machniak <alec@alec.pl>2014-03-23 11:19:22 +0100
commit5fefe78f750030f35d3c47cf9f379c431037a0e9 (patch)
tree79ef67f5ba846fda45cc1a7e0d9af67ddedc97a3
parenteb9c51018d8dbd9f3a2cf5254ff55ece0ef6f6a9 (diff)
Make sure parent folder selector always contains parent folder
of current folder, even if it does not exist
-rw-r--r--program/include/rcmail.php25
-rw-r--r--program/steps/settings/edit_folder.inc1
2 files changed, 23 insertions, 3 deletions
diff --git a/program/include/rcmail.php b/program/include/rcmail.php
index 9c7ed98aa..c026eed67 100644
--- a/program/include/rcmail.php
+++ b/program/include/rcmail.php
@@ -1360,12 +1360,31 @@ class rcmail extends rcube
$delimiter = $storage->get_hierarchy_delimiter();
- foreach ($list as $folder) {
- if (empty($p['exceptions']) || !in_array($folder, $p['exceptions'])) {
- $this->build_folder_tree($a_mailboxes, $folder, $delimiter);
+ if (!empty($p['exceptions'])) {
+ $list = array_diff($list, (array) $p['exceptions']);
+ }
+
+ if (!empty($p['additional'])) {
+ foreach ($p['additional'] as $add_folder) {
+ $add_items = explode($delimiter, $add_folder);
+ $folder = '';
+ while (count($add_items)) {
+ $folder .= array_shift($add_items);
+
+ // @TODO: sorting
+ if (!in_array($folder, $list)) {
+ $list[] = $folder;
+ }
+
+ $folder .= $delimiter;
+ }
}
}
+ foreach ($list as $folder) {
+ $this->build_folder_tree($a_mailboxes, $folder, $delimiter);
+ }
+
$select = new html_select($p);
if ($p['noselection']) {
diff --git a/program/steps/settings/edit_folder.inc b/program/steps/settings/edit_folder.inc
index fc6b2cd16..6b7bd08d2 100644
--- a/program/steps/settings/edit_folder.inc
+++ b/program/steps/settings/edit_folder.inc
@@ -139,6 +139,7 @@ function rcmail_folder_form($attrib)
'unsubscribed' => true,
'skip_noinferiors' => true,
'exceptions' => $exceptions,
+ 'additional' => strlen($selected) ? array($selected) : null,
));
$form['props']['fieldsets']['location']['content']['path'] = array(