Fix so current page is reset on list-mode change (#1489907)

pull/194/head
Aleksander Machniak 11 years ago
parent 8833432c61
commit bb57fca320

@ -27,6 +27,7 @@ CHANGELOG Roundcube Webmail
- Fix malformed References: header in send/saved mail (#1489891) - Fix malformed References: header in send/saved mail (#1489891)
- Fix handling unicode characters in links (#1489898) - Fix handling unicode characters in links (#1489898)
- Fix incorrect handling of HTML comments in messages sanitization code (#1489904) - Fix incorrect handling of HTML comments in messages sanitization code (#1489904)
- Fix so current page is reset on list-mode change (#1489907)
RELEASE 1.0.1 RELEASE 1.0.1
------------- -------------

@ -23,39 +23,8 @@
// always instantiate storage object (but not connect to server yet) // always instantiate storage object (but not connect to server yet)
$RCMAIL->storage_init(); $RCMAIL->storage_init();
// set imap properties and session vars // init environment - set current folder, page, list mode
if (!strlen($mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_GPC, true))) { rcmail_init_env();
$mbox = strlen($_SESSION['mbox']) ? $_SESSION['mbox'] : 'INBOX';
}
if (!($page = intval($_GET['_page']))) {
$page = $_SESSION['page'] ? $_SESSION['page'] : 1;
}
$RCMAIL->storage->set_folder($_SESSION['mbox'] = $mbox);
$RCMAIL->storage->set_page($_SESSION['page'] = $page);
$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');
// set default sort col/order to session
if (!isset($_SESSION['sort_col'])) {
$_SESSION['sort_col'] = $message_sort_col ? $message_sort_col : '';
}
if (!isset($_SESSION['sort_order'])) {
$_SESSION['sort_order'] = strtoupper($message_sort_order) == 'ASC' ? 'ASC' : 'DESC';
}
// set threads mode
if (isset($_GET['_threads'])) {
if ($_GET['_threads'])
$a_threading[$_SESSION['mbox']] = true;
else
unset($a_threading[$_SESSION['mbox']]);
$RCMAIL->user->save_prefs(array('message_threading' => $a_threading));
}
$RCMAIL->storage->set_threading($a_threading[$_SESSION['mbox']]);
// set message set for search result // set message set for search result
if (!empty($_REQUEST['_search']) && isset($_SESSION['search']) if (!empty($_REQUEST['_search']) && isset($_SESSION['search'])
@ -184,6 +153,61 @@ $RCMAIL->register_action_map(array(
)); ));
/**
* Sets storage properties and session
*/
function rcmail_init_env()
{
global $RCMAIL;
$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');
// set imap properties and session vars
if (!strlen($mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_GPC, true))) {
$mbox = strlen($_SESSION['mbox']) ? $_SESSION['mbox'] : 'INBOX';
}
if (!($page = intval($_GET['_page']))) {
$page = $_SESSION['page'] ? $_SESSION['page'] : 1;
}
$RCMAIL->storage->set_folder($_SESSION['mbox'] = $mbox);
$RCMAIL->storage->set_page($_SESSION['page'] = $page);
// set default sort col/order to session
if (!isset($_SESSION['sort_col'])) {
$_SESSION['sort_col'] = $message_sort_col ? $message_sort_col : '';
}
if (!isset($_SESSION['sort_order'])) {
$_SESSION['sort_order'] = strtoupper($message_sort_order) == 'ASC' ? 'ASC' : 'DESC';
}
// set threads mode
if (isset($_GET['_threads'])) {
if ($_GET['_threads']) {
// re-set current page number when listing mode changes
if (!$a_threading[$_SESSION['mbox']]) {
$RCMAIL->storage->set_page($_SESSION['page'] = 1);
}
$a_threading[$_SESSION['mbox']] = true;
}
else {
// re-set current page number when listing mode changes
if ($a_threading[$_SESSION['mbox']]) {
$RCMAIL->storage->set_page($_SESSION['page'] = 1);
}
unset($a_threading[$_SESSION['mbox']]);
}
$RCMAIL->user->save_prefs(array('message_threading' => $a_threading));
}
$RCMAIL->storage->set_threading($a_threading[$_SESSION['mbox']]);
}
/** /**
* Returns default search mods * Returns default search mods
*/ */

Loading…
Cancel
Save