summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
Diffstat (limited to 'program')
-rw-r--r--program/include/main.inc22
-rw-r--r--program/steps/settings/func.inc4
-rw-r--r--program/steps/settings/save_prefs.inc12
3 files changed, 26 insertions, 12 deletions
diff --git a/program/include/main.inc b/program/include/main.inc
index 8f0b3cb5f..bfba9dd24 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -879,6 +879,8 @@ function rcmail_mailbox_list($attrib)
{
global $IMAP, $OUTPUT;
static $a_mailboxes;
+
+ $attrib += array('maxlength' => 100, 'relanames' => false);
// add some labels to client
rcube_add_label('purgefolderconfirm');
@@ -911,11 +913,11 @@ function rcmail_mailbox_list($attrib)
if ($attrib['noselection'])
$select->add(rcube_label($attrib['noselection']), '0');
- rcmail_render_folder_tree_select($a_mailboxes, $mbox_name, $attrib['maxlength'], $select);
+ rcmail_render_folder_tree_select($a_mailboxes, $mbox_name, $attrib['maxlength'], $select, $attrib['realnames']);
$out = $select->show();
}
else {
- $out = html::tag('ul', $attrib, rcmail_render_folder_tree_html($a_mailboxes, $mbox_name, $attrib['maxlength']), html::$common_attrib);
+ $out = html::tag('ul', $attrib, rcmail_render_folder_tree_html($a_mailboxes, $mbox_name, $attrib['maxlength'], $attrib['realnames']), html::$common_attrib);
}
if ($type=='ul')
@@ -935,7 +937,7 @@ function rcmail_mailbox_select($p = array())
{
global $RCMAIL;
- $p += array('maxlength' => 100);
+ $p += array('maxlength' => 100, 'relanames' => false);
$a_mailboxes = array();
foreach ($RCMAIL->imap->list_mailboxes() as $folder)
@@ -946,7 +948,7 @@ function rcmail_mailbox_select($p = array())
if ($p['noselection'])
$select->add($p['noselection'], '');
- rcmail_render_folder_tree_select($a_mailboxes, $mbox, $p['maxlength'], $select);
+ rcmail_render_folder_tree_select($a_mailboxes, $mbox, $p['maxlength'], $select, $p['realnames']);
return $select;
}
@@ -989,7 +991,7 @@ function rcmail_build_folder_tree(&$arrFolders, $folder, $delm='/', $path='')
* Return html for a structured list <ul> for the mailbox tree
* @access private
*/
-function rcmail_render_folder_tree_html(&$arrFolders, &$mbox_name, $maxlength, $nestLevel=0)
+function rcmail_render_folder_tree_html(&$arrFolders, &$mbox_name, $maxlength, $realnames=false, $nestLevel=0)
{
global $COMM_PATH, $IMAP, $CONFIG, $OUTPUT;
@@ -1000,7 +1002,7 @@ function rcmail_render_folder_tree_html(&$arrFolders, &$mbox_name, $maxlength, $
$zebra_class = (($nestLevel+1)*$idx) % 2 == 0 ? 'even' : 'odd';
$title = null;
- if ($folder_class = rcmail_folder_classname($folder['id']))
+ if (($folder_class = rcmail_folder_classname($folder['id'])) && !$realnames)
$foldername = rcube_label($folder_class);
else
{
@@ -1052,7 +1054,7 @@ function rcmail_render_folder_tree_html(&$arrFolders, &$mbox_name, $maxlength, $
), Q($foldername)));
if (!empty($folder['folders']))
- $out .= "\n<ul>\n" . rcmail_render_folder_tree_html($folder['folders'], $mbox_name, $maxlength, $nestLevel+1) . "</ul>\n";
+ $out .= "\n<ul>\n" . rcmail_render_folder_tree_html($folder['folders'], $mbox_name, $maxlength, $realnames, $nestLevel+1) . "</ul>\n";
$out .= "</li>\n";
$idx++;
@@ -1066,7 +1068,7 @@ function rcmail_render_folder_tree_html(&$arrFolders, &$mbox_name, $maxlength, $
* Return html for a flat list <select> for the mailbox tree
* @access private
*/
-function rcmail_render_folder_tree_select(&$arrFolders, &$mbox_name, $maxlength, &$select, $nestLevel=0)
+function rcmail_render_folder_tree_select(&$arrFolders, &$mbox_name, $maxlength, &$select, $realnames=false, $nestLevel=0)
{
global $IMAP, $OUTPUT;
@@ -1074,7 +1076,7 @@ function rcmail_render_folder_tree_select(&$arrFolders, &$mbox_name, $maxlength,
$out = '';
foreach ($arrFolders as $key=>$folder)
{
- if ($folder_class = rcmail_folder_classname($folder['id']))
+ if (!$realnames && ($folder_class = rcmail_folder_classname($folder['id'])))
$foldername = rcube_label($folder_class);
else
{
@@ -1088,7 +1090,7 @@ function rcmail_render_folder_tree_select(&$arrFolders, &$mbox_name, $maxlength,
$select->add(str_repeat('&nbsp;', $nestLevel*4) . $foldername, $folder['id']);
if (!empty($folder['folders']))
- $out .= rcmail_render_folder_tree_select($folder['folders'], $mbox_name, $maxlength, $select, $nestLevel+1);
+ $out .= rcmail_render_folder_tree_select($folder['folders'], $mbox_name, $maxlength, $select, $realnames, $nestLevel+1);
$idx++;
}
diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc
index 1b4481881..5b6e11308 100644
--- a/program/steps/settings/func.inc
+++ b/program/steps/settings/func.inc
@@ -227,9 +227,9 @@ function rcmail_user_prefs_form($attrib)
$out .= html::tag('fieldset', null, html::tag('legend', null, Q(rcube_label('messagescomposition'))) . $table->show($attrib));
// Configure special folders
- if (!isset($no_override['folders'])) {
+ if (!isset($no_override['default_imap_folders'])) {
$RCMAIL->imap_init(true);
- $select = rcmail_mailbox_select(array('noselection' => '---'));
+ $select = rcmail_mailbox_select(array('noselection' => '---', 'realnames' => true));
$table = new html_table(array('cols' => 2));
diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc
index ccd6e5f7b..3bccffae2 100644
--- a/program/steps/settings/save_prefs.inc
+++ b/program/steps/settings/save_prefs.inc
@@ -46,6 +46,18 @@ $a_user_prefs = array(
foreach ((array)$CONFIG['dont_override'] as $p)
$a_user_prefs[$p] = $CONFIG[$p];
+// special handling for 'default_imap_folders'
+if (in_array('default_imap_folders', (array)$CONFIG['dont_override'])) {
+ foreach (array('drafts_mbox','sent_mbox','junk_mbox','trash_mbox') as $p)
+ $a_user_prefs[$p] = $CONFIG[$p];
+}
+else {
+ $a_user_prefs['default_imap_folders'] = array('INBOX');
+ foreach (array('drafts_mbox','sent_mbox','junk_mbox','trash_mbox') as $p) {
+ if ($a_user_prefs[$p])
+ $a_user_prefs['default_imap_folders'][] = $a_user_prefs[$p];
+ }
+}
// switch UI language
if (isset($_POST['_language'])) {