- improve performance and consistency by setting all list-related env data in list action only
| | |
| | | |
| | | if (this.gui_objects.messagelist) { |
| | | |
| | | this.message_list = new rcube_list_widget(this.gui_objects.messagelist, |
| | | {multiselect:true, multiexpand:true, draggable:true, keyboard:true, |
| | | column_movable:this.env.col_movable, column_fixed:0, dblclick_time:this.dblclick_time}); |
| | | this.message_list = new rcube_list_widget(this.gui_objects.messagelist, { |
| | | multiselect:true, multiexpand:true, draggable:true, keyboard:true, |
| | | column_movable:this.env.col_movable, column_fixed:0, dblclick_time:this.dblclick_time |
| | | }); |
| | | this.message_list.row_init = function(o){ p.init_message_row(o); }; |
| | | this.message_list.addEventListener('dblclick', function(o){ p.msglist_dbl_click(o); }); |
| | | this.message_list.addEventListener('click', function(o){ p.msglist_click(o); }); |
| | |
| | | this.enable_command('toggle_status', 'toggle_flag', 'menu-open', 'menu-save', true); |
| | | |
| | | // load messages |
| | | if (this.env.messagecount) |
| | | this.command('list'); |
| | | } |
| | | |
| | |
| | | // show printing dialog |
| | | else if (this.env.action == 'print') |
| | | window.print(); |
| | | |
| | | if (this.env.messagecount) { |
| | | this.enable_command('select-all', 'select-none', 'expunge', true); |
| | | this.enable_command('expand-all', 'expand-unread', 'collapse-all', this.env.threading); |
| | | } |
| | | |
| | | if (this.purge_mailbox_test()) |
| | | this.enable_command('purge', true); |
| | | |
| | | this.set_page_buttons(); |
| | | |
| | | // get unread count for each mailbox |
| | | if (this.gui_objects.mailboxlist) { |
| | |
| | | |
| | | $search_mods = $RCMAIL->config->get('search_mods', $SEARCH_MODS_DEFAULT); |
| | | $OUTPUT->set_env('search_mods', $search_mods); |
| | | |
| | | // make sure the message count is refreshed (for default view) |
| | | $IMAP->messagecount($mbox_name, $IMAP->threading ? 'THREADS' : 'ALL', true); |
| | | } |
| | | |
| | | // set current mailbox and some other vars in client environment |
| | |
| | | $a_show_cols[$f] = 'to'; |
| | | |
| | | $skin_path = $_SESSION['skin_path'] = $CONFIG['skin_path']; |
| | | $message_count = $IMAP->messagecount(NULL, $IMAP->threading ? 'THREADS' : 'ALL'); |
| | | |
| | | // set client env |
| | | $OUTPUT->add_gui_object('messagelist', $attrib['id']); |
| | | $OUTPUT->set_env('autoexpand_threads', intval($CONFIG['autoexpand_threads'])); |
| | | $OUTPUT->set_env('messagecount', $message_count); |
| | | $OUTPUT->set_env('current_page', $IMAP->list_page); |
| | | $OUTPUT->set_env('pagecount', ceil($message_count/$IMAP->page_size)); |
| | | $OUTPUT->set_env('sort_col', $_SESSION['sort_col']); |
| | | $OUTPUT->set_env('sort_order', $_SESSION['sort_order']); |
| | | |
| | |
| | | |
| | | $OUTPUT->set_env('messages', array()); |
| | | $OUTPUT->set_env('coltypes', $a_show_cols); |
| | | |
| | | if (!$message_count) |
| | | $OUTPUT->show_message('nomessagesfound', 'notice'); |
| | | |
| | | $OUTPUT->include_script('list.js'); |
| | | |
| | |
| | | |
| | | function rcmail_get_messagecount_text($count=NULL, $page=NULL) |
| | | { |
| | | global $IMAP, $MESSAGE; |
| | | global $RCMAIL, $IMAP, $MESSAGE; |
| | | |
| | | if (isset($MESSAGE->index)) |
| | | { |
| | |
| | | $page = $IMAP->list_page; |
| | | |
| | | $start_msg = ($page-1) * $IMAP->page_size + 1; |
| | | $max = $count!==NULL ? $count : $IMAP->messagecount(NULL, $IMAP->threading ? 'THREADS' : 'ALL'); |
| | | |
| | | if ($count!==NULL) |
| | | $max = $count; |
| | | else if ($RCMAIL->action) |
| | | $max = $IMAP->messagecount(NULL, $IMAP->threading ? 'THREADS' : 'ALL'); |
| | | |
| | | if ($max==0) |
| | | $out = rcube_label('mailboxempty'); |
| | |
| | | )); |
| | | |
| | | ?> |
| | | |
| | |
| | | $OUTPUT->set_env('messagecount', $count); |
| | | $OUTPUT->set_env('pagecount', $pages); |
| | | $OUTPUT->set_env('threading', (bool) $IMAP->threading); |
| | | $OUTPUT->set_env('current_page', $IMAP->list_page); |
| | | $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($count)); |
| | | $OUTPUT->command('set_mailboxname', rcmail_get_mailbox_name_text()); |
| | | |
| | |
| | | $OUTPUT->send(); |
| | | |
| | | ?> |
| | | |