From 9a6c38e14895bd093627e12f2fcf2c6ff1e3af3c Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Fri, 11 Jan 2013 14:39:23 +0100 Subject: New feature to export only selected contacts from addressbook (by Phil Weir) --- CHANGELOG | 1 + program/js/app.js | 8 ++++++++ program/localization/en_US/labels.inc | 2 ++ program/steps/addressbook/export.inc | 23 +++++++++++++++++++++++ skins/classic/addressbook.css | 8 ++++++++ skins/classic/templates/addressbook.html | 10 ++++++++++ skins/larry/styles.css | 2 +- skins/larry/templates/addressbook.html | 12 +++++++++++- 8 files changed, 64 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 25d79d1e2..ecc45c220 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ CHANGELOG Roundcube Webmail =========================== +- Feature to export only selected contacts from addressbook (by Phil Weir) - Force autocommit mode in mysql database driver (#1488902) RELEASE 0.9-beta 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); diff --git a/skins/classic/addressbook.css b/skins/classic/addressbook.css index a398325b4..1bb1e2c61 100644 --- a/skins/classic/addressbook.css +++ b/skins/classic/addressbook.css @@ -67,6 +67,14 @@ background-position: -128px -32px; } +#abooktoolbar a.exportAll { + background-position: -128px 0; +} + +#abooktoolbar a.exportAllSel { + background-position: -128px -32px; +} + #abooktoolbar span.separator { width: 5px; background-position: -162px 0; diff --git a/skins/classic/templates/addressbook.html b/skins/classic/templates/addressbook.html index 74673007a..404fb2c11 100644 --- a/skins/classic/templates/addressbook.html +++ b/skins/classic/templates/addressbook.html @@ -27,7 +27,10 @@   + + + @@ -38,6 +41,13 @@ +
+
    +
  • +
  • +
+
+
  • diff --git a/skins/larry/styles.css b/skins/larry/styles.css index 9386c79d7..773ef23d4 100644 --- a/skins/larry/styles.css +++ b/skins/larry/styles.css @@ -1680,6 +1680,7 @@ ul.proplist li { } .toolbar a.button.export { + min-width: 74px; background-position: center -1054px; } @@ -1695,7 +1696,6 @@ ul.proplist li { background-position: 0 -1745px; } - a.menuselector { display: inline-block; border: 1px solid #ababab; diff --git a/skins/larry/templates/addressbook.html b/skins/larry/templates/addressbook.html index 9a9a2d747..7904f6f3a 100644 --- a/skins/larry/templates/addressbook.html +++ b/skins/larry/templates/addressbook.html @@ -13,7 +13,11 @@
    - + + + + + @@ -75,6 +79,12 @@
    +
    +
      +
    • +
    • +
    +
      -- cgit v1.2.3