summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
Diffstat (limited to 'program')
-rw-r--r--program/js/app.js8
-rw-r--r--program/localization/en_US/labels.inc2
-rw-r--r--program/steps/addressbook/export.inc23
3 files changed, 33 insertions, 0 deletions
diff --git a/program/js/app.js b/program/js/app.js
index c627983f4..2804e88df 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -1090,6 +1090,12 @@ function rcube_webmail()
}
break;
+ case 'export-selected':
+ if (this.contact_list.rowcount > 0) {
+ this.goto_url('export', { _source: this.env.source, _gid: this.env.group, _cid: this.contact_list.get_selection().join(',') });
+ }
+ break;
+
case 'upload-photo':
this.upload_contact_photo(props || this.gui_objects.uploadform);
break;
@@ -4115,6 +4121,7 @@ function rcube_webmail()
// thend we can enable the group-remove-selected command
this.enable_command('group-remove-selected', this.env.group && list.selection.length > 0);
this.enable_command('compose', this.env.group || list.selection.length > 0);
+ this.enable_command('export-selected', list.selection.length > 0);
this.enable_command('edit', id && writable);
this.enable_command('delete', list.selection.length && writable);
@@ -6238,6 +6245,7 @@ function rcube_webmail()
this.enable_command('compose', (uid && this.contact_list.rows[uid]));
this.enable_command('delete', 'edit', writable);
this.enable_command('export', (this.contact_list && this.contact_list.rowcount > 0));
+ this.enable_command('export-selected', false);
}
case 'moveto':
diff --git a/program/localization/en_US/labels.inc b/program/localization/en_US/labels.inc
index 9deaa6677..a0b6e6a31 100644
--- a/program/localization/en_US/labels.inc
+++ b/program/localization/en_US/labels.inc
@@ -335,6 +335,8 @@ $labels['composeto'] = 'Compose mail to';
$labels['contactsfromto'] = 'Contacts $from to $to of $count';
$labels['print'] = 'Print';
$labels['export'] = 'Export';
+$labels['exportall'] = 'Export all';
+$labels['exportsel'] = 'Export selected';
$labels['exportvcards'] = 'Export contacts in vCard format';
$labels['newcontactgroup'] = 'Create new contact group';
$labels['grouprename'] = 'Rename group';
diff --git a/program/steps/addressbook/export.inc b/program/steps/addressbook/export.inc
index 850795c85..bf0657b74 100644
--- a/program/steps/addressbook/export.inc
+++ b/program/steps/addressbook/export.inc
@@ -56,6 +56,29 @@ if (!empty($_REQUEST['_search']) && isset($_SESSION['search'][$_REQUEST['_search
$result = new rcube_result_set($count);
$result->records = array_values($records);
}
+// selected contacts
+else if (!empty($_REQUEST['_cid'])) {
+ $sort_col = $RCMAIL->config->get('addressbook_sort_col', 'name');
+ $records = array();
+
+ $cids = explode(',', get_input_value('_cid', RCUBE_INPUT_GET));
+ $CONTACTS = rcmail_contact_source(null, true);
+
+ // Get records from all sources
+ foreach ($cids as $cid) {
+ $record = $CONTACTS->get_record($cid, true);
+ $key = rcmail_contact_key($record, $sort_col);
+ $records[$key] = $record;
+ unset($record);
+ }
+
+ ksort($records, SORT_LOCALE_STRING);
+
+ // create resultset object
+ $count = count($records);
+ $result = new rcube_result_set($count);
+ $result->records = array_values($records);
+}
// selected directory/group
else {
$CONTACTS = rcmail_contact_source(null, true);