From a45f9b7bf58475ccc812e819f159638403c00419 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Mon, 1 Jul 2013 10:22:14 +0200 Subject: Contacts drag-n-drop default action is to move contacts (#1488751) Added possibility to choose to move or copy contacts from drag-n-drop menu (#1488751) Use consistent naming: 'moveto' -> 'move' --- program/steps/addressbook/func.inc | 50 +++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) (limited to 'program/steps/addressbook/func.inc') diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc index c7f7fb479..8ec581f9a 100644 --- a/program/steps/addressbook/func.inc +++ b/program/steps/addressbook/func.inc @@ -322,7 +322,7 @@ function rcmail_contacts_list($attrib) $OUTPUT->include_script('list.js'); // add some labels to client - $OUTPUT->add_label('deletecontactconfirm', 'copyingcontact', 'contactdeleting'); + $OUTPUT->add_label('deletecontactconfirm', 'copyingcontact', 'movingcontact', 'contactdeleting'); return $out; } @@ -779,6 +779,54 @@ function rcmail_format_date_col($val) return format_date($val, $RCMAIL->config->get('date_format', 'Y-m-d'), false); } +/** + * Updates saved search after data changed + */ +function rcmail_search_update($return = false) +{ + global $RCMAIL; + + if (($search_request = $_REQUEST['_search']) && isset($_SESSION['search'][$search_request])) { + $search = (array)$_SESSION['search'][$search_request]; + $sort_col = $RCMAIL->config->get('addressbook_sort_col', 'name'); + $afields = $return ? $RCMAIL->config->get('contactlist_fields') : array('name', 'email'); + $records = array(); + + foreach ($search as $s => $set) { + $source = $RCMAIL->get_address_book($s); + + // reset page + $source->set_page(1); + $source->set_pagesize(9999); + $source->set_search_set($set); + + // get records + $result = $source->list_records($afields); + + if (!$result->count) { + unset($search[$s]); + continue; + } + + if ($return) { + while ($row = $result->next()) { + $row['sourceid'] = $s; + $key = rcube_addressbook::compose_contact_key($row, $sort_col); + $records[$key] = $row; + } + unset($result); + } + + $search[$s] = $source->get_search_set(); + } + + $_SESSION['search'][$search_request] = $search; + + return $records; + } + + return false; +} /** * Returns contact ID(s) and source(s) from GET/POST data -- cgit v1.2.3