diff options
author | thomascube <thomas@roundcube.net> | 2005-09-25 14:18:03 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2005-09-25 14:18:03 +0000 |
commit | 4e17e6c9dbac8991ee8b302cb2581241247dc8bc (patch) | |
tree | d877546f6bd334b041734498e81f6299e005b01c /program/steps/addressbook/list.inc |
Initial revision
Diffstat (limited to 'program/steps/addressbook/list.inc')
-rw-r--r-- | program/steps/addressbook/list.inc | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/program/steps/addressbook/list.inc b/program/steps/addressbook/list.inc new file mode 100644 index 000000000..87ac888de --- /dev/null +++ b/program/steps/addressbook/list.inc @@ -0,0 +1,59 @@ +<?php + +/* + +-----------------------------------------------------------------------+ + | program/steps/addressbook/list.inc | + | | + | This file is part of the RoundCube Webmail client | + | Copyright (C) 2005, RoundCube Dev. - Switzerland | + | All rights reserved. | + | | + | PURPOSE: | + | Send contacts list to client (as remote response) | + | | + +-----------------------------------------------------------------------+ + | Author: Thomas Bruederli <roundcube@gmail.com> | + +-----------------------------------------------------------------------+ + + $Id$ + +*/ + +$REMOTE_REQUEST = TRUE; + +// count contacts for this user +$sql_result = $DB->query(sprintf("SELECT COUNT(contact_id) AS rows + FROM %s + WHERE del!='1' + AND user_id=%d", + get_table_name('contacts'), + $_SESSION['user_id'])); + +$sql_arr = $DB->fetch_assoc($sql_result); +$rowcount = $sql_arr['rows']; + +// update message count display +$pages = ceil($rowcount/$CONFIG['pagesize']); +$commands = sprintf("this.set_rowcount('%s');\n", rcmail_get_rowcount_text($rowcount)); +$commands .= sprintf("this.set_env('pagecount', %d);\n", $pages); + +$start_row = ($CONTACTS_LIST['page']-1) * $CONFIG['pagesize']; + +// get contacts from DB +$sql_result = $DB->query(sprintf("SELECT * FROM %s + WHERE del!='1' + AND user_id=%d + ORDER BY name + LIMIT %d, %d", + get_table_name('contacts'), + $_SESSION['user_id'], + $start_row, + $CONFIG['pagesize'])); + +$commands .= rcmail_js_contacts_list($sql_result); + +// send response +rcube_remote_response($commands); + +exit; +?>
\ No newline at end of file |