diff options
author | thomascube <thomas@roundcube.net> | 2011-07-18 17:35:12 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2011-07-18 17:35:12 +0000 |
commit | fa59965b41023095d4da710a72ce71bb230de1eb (patch) | |
tree | 448a135fdc8ca5226b25d75bfa0240e60833f0ce /program/steps/addressbook/func.inc | |
parent | 3a9f7954baf92a40ee149c8d0acc3e56826945ff (diff) |
Asynchronously load contacts after page load
Diffstat (limited to 'program/steps/addressbook/func.inc')
-rw-r--r-- | program/steps/addressbook/func.inc | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc index 62c61ecd0..270f70f9f 100644 --- a/program/steps/addressbook/func.inc +++ b/program/steps/addressbook/func.inc @@ -84,6 +84,9 @@ if (!$RCMAIL->action && !$OUTPUT->ajax_call) { $OUTPUT->set_pagetitle(rcube_label('addressbook')); $_SESSION['addressbooks_count'] = count($js_list); $_SESSION['addressbooks_count_writeable'] = $writeable; + + if (!strlen($source)) + $source = strval(key($js_list)); $CONTACTS = rcmail_contact_source($source, true); } @@ -180,8 +183,6 @@ function rcmail_directory_list($attrib) // currently selected source $current = get_input_value('_source', RCUBE_INPUT_GPC); - if (!strlen($current) || !isset($sources[$source])) - $current = strval(key($sources)); foreach ($sources as $j => $source) { $id = strval($source['id'] ? $source['id'] : $j); @@ -247,7 +248,7 @@ function rcmail_contact_groups($args) } -// return the message list as HTML table +// return the contacts list as HTML table function rcmail_contacts_list($attrib) { global $CONTACTS, $OUTPUT; @@ -255,20 +256,16 @@ function rcmail_contacts_list($attrib) // define list of cols to be displayed $a_show_cols = array('name'); - // count contacts for this user - $result = $CONTACTS->list_records($a_show_cols); - // add id to message list table if not specified if (!strlen($attrib['id'])) $attrib['id'] = 'rcmAddressList'; // create XHTML table - $out = rcube_table_output($attrib, $result->records, $a_show_cols, $CONTACTS->primary_key); + $out = rcube_table_output($attrib, array(), $a_show_cols, $CONTACTS->primary_key); // set client env $OUTPUT->add_gui_object('contactslist', $attrib['id']); $OUTPUT->set_env('current_page', (int)$CONTACTS->list_page); - $OUTPUT->set_env('pagecount', ceil($result->count/$CONTACTS->page_size)); $OUTPUT->include_script('list.js'); // add some labels to client @@ -331,7 +328,7 @@ function rcmail_rowcount_display($attrib) $OUTPUT->add_gui_object('countdisplay', $attrib['id']); - return html::span($attrib, rcmail_get_rowcount_text()); + return html::span($attrib, rcube_label('loading')); } @@ -343,9 +340,6 @@ function rcmail_get_rowcount_text($result=null) if (!$result) { $result = $CONTACTS->get_result(); } - if (!$result) { - $result = $CONTACTS->count(); - } if ($result->count == 0) $out = rcube_label('nocontactsfound'); |