Aleksander Machniak
2014-06-21 d1749659d25c5b68600aef3557284cedff8dded1
Backported option to set default message list mode - default_list_mode (#1487312)
6 files modified
44 ■■■■■ changed files
CHANGELOG 1 ●●●● patch | view | raw | blame | history
config/defaults.inc.php 9 ●●●●● patch | view | raw | blame | history
program/steps/mail/func.inc 7 ●●●● patch | view | raw | blame | history
program/steps/settings/edit_folder.inc 6 ●●●●● patch | view | raw | blame | history
program/steps/settings/folders.inc 7 ●●●●● patch | view | raw | blame | history
program/steps/settings/save_folder.inc 14 ●●●●● patch | view | raw | blame | history
CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail
===========================
- Add option to set default message list mode - default_list_mode (#1487312)
- Enable contextmenu plugin for TinyMCE editor (#1487014)
- Fix some mime-type to extension mapping checks in Installer (#1489983)
- Fix errors when using localStorage in Safari's private browsing mode (#1489996)
config/defaults.inc.php
@@ -970,9 +970,12 @@
// If true, after message delete/move, the next message will be displayed
$config['display_next'] = true;
// 0 - Do not expand threads
// 1 - Expand all threads automatically
// 2 - Expand only threads with unread messages
// Default messages listing mode. One of 'threads' or 'list'.
$config['default_list_mode'] = 'list';
// 0 - Do not expand threads
// 1 - Expand all threads automatically
// 2 - Expand only threads with unread messages
$config['autoexpand_threads'] = 0;
// When replying:
program/steps/mail/func.inc
@@ -142,6 +142,7 @@
{
    global $RCMAIL;
    $default_threading  = $RCMAIL->config->get('default_list_mode', 'list') == 'threads';
    $a_threading        = $RCMAIL->config->get('message_threading', array());
    $message_sort_col   = $RCMAIL->config->get('message_sort_col');
    $message_sort_order = $RCMAIL->config->get('message_sort_order');
@@ -181,13 +182,15 @@
                $RCMAIL->storage->set_page($_SESSION['page'] = 1);
            }
            unset($a_threading[$_SESSION['mbox']]);
            $a_threading[$_SESSION['mbox']] = false;
        }
        $RCMAIL->user->save_prefs(array('message_threading' => $a_threading));
    }
    $RCMAIL->storage->set_threading($a_threading[$_SESSION['mbox']]);
    $threading = isset($a_threading[$_SESSION['mbox']]) ? $a_threading[$_SESSION['mbox']] : $default_threading;
    $RCMAIL->storage->set_threading($threading);
}
/**
program/steps/settings/edit_folder.inc
@@ -163,8 +163,10 @@
            $value = (int) $_POST['_viewmode'];
        }
        else if (strlen($mbox_imap)) {
            $a_threaded = $RCMAIL->config->get('message_threading', array());
            $value = (int) isset($a_threaded[$mbox_imap]);
            $a_threaded   = $RCMAIL->config->get('message_threading', array());
            $default_mode = $RCMAIL->config->get('default_list_mode', 'list');
            $value = (int) (isset($a_threaded[$mbox_imap]) ? $a_threaded[$mbox_imap] : $default_mode == 'threads');
        }
        $form['props']['fieldsets']['settings']['content']['viewmode'] = array(
program/steps/settings/folders.inc
@@ -407,16 +407,17 @@
        $a_threaded = (array) $RCMAIL->config->get('message_threading', array());
        $oldprefix  = '/^' . preg_quote($oldname . $delimiter, '/') . '/';
        foreach (array_keys($a_threaded) as $key) {
        foreach ($a_threaded as $key => $val) {
            if ($key == $oldname) {
                unset($a_threaded[$key]);
                $a_threaded[$newname] = true;
                $a_threaded[$newname] = $val;
            }
            else if (preg_match($oldprefix, $key)) {
                unset($a_threaded[$key]);
                $a_threaded[preg_replace($oldprefix, $newname.$delimiter, $key)] = true;
                $a_threaded[preg_replace($oldprefix, $newname.$delimiter, $key)] = $val;
            }
        }
        $RCMAIL->user->save_prefs(array('message_threading' => $a_threaded));
        // #1488692: update session
program/steps/settings/save_folder.inc
@@ -115,15 +115,13 @@
        if (isset($_POST['_viewmode'])) {
            $a_threaded = (array) $RCMAIL->config->get('message_threading', array());
            if ($_POST['_viewmode'])
                $a_threaded[$folder['name']] = true;
            else
                unset($a_threaded[$folder['name']]);
            $a_threaded[$folder['name']] = (bool) $_POST['_viewmode'];
            $RCMAIL->user->save_prefs(array('message_threading' => $a_threaded));
        }
        rcmail_update_folder_row($folder['name'], null, $folder['subscribe'], $folder['class']);
        $OUTPUT->show_message('foldercreated', 'confirmation');
        // reset folder preview frame
        $OUTPUT->command('subscription_select');
@@ -167,14 +165,12 @@
                    }
                    else if (preg_match($oldprefix, $key)) {
                        unset($a_threaded[$key]);
                        $a_threaded[preg_replace($oldprefix, $folder['name'].$delimiter, $key)] = true;
                        $a_threaded[preg_replace($oldprefix, $folder['name'].$delimiter, $key)] = $val;
                    }
                }
            }
            if ($_POST['_viewmode'])
                $a_threaded[$folder['name']] = true;
            else
                unset($a_threaded[$folder['name']]);
            $a_threaded[$folder['name']] = (bool) $_POST['_viewmode'];
            $RCMAIL->user->save_prefs(array('message_threading' => $a_threaded));
        }