diff --git a/js/app.js b/js/app.js index 06fdb798..03ea1097 100644 --- a/js/app.js +++ b/js/app.js @@ -1069,7 +1069,18 @@ OC.Contacts = OC.Contacts || { var contacts = self.contacts.getSelectedContacts(); // Only get backend, addressbookid and contactid contacts = $.map(contacts, function(c) {return c.metaData();}); - var url = OC.Router.generate('contacts_export_selected', {contacts:contacts}); + var targets = {}; + // Try to shorten request URI + $.each(contacts, function(idx, contact) { + if(!targets[contact.backend]) { + targets[contact.backend] = {}; + } + if(!targets[contact.backend][contact.addressBookId]) { + targets[contact.backend][contact.addressBookId] = []; + } + targets[contact.backend][contact.addressBookId].push(contact.contactId); + }); + var url = OC.Router.generate('contacts_export_selected', {t:targets}); console.log('export url', url); document.location.href = url; }); diff --git a/lib/controller/exportcontroller.php b/lib/controller/exportcontroller.php index 355b9c08..728a971a 100644 --- a/lib/controller/exportcontroller.php +++ b/lib/controller/exportcontroller.php @@ -78,20 +78,7 @@ class ExportController extends Controller { * @NoCSRFRequired */ public function exportSelected() { - $contacts = $this->request['contacts']; - - // First sort the contacts by backend and address book. - $targets = array(); - - foreach($contacts as $contact) { - if(!isset($targets[$contact['backend']])) { - $targets[$contact['backend']] = array(); - } - if(!isset($targets[$contact['backend']][$contact['addressBookId']])) { - $targets[$contact['backend']][$contact['addressBookId']] = array(); - } - $targets[$contact['backend']][$contact['addressBookId']][] = $contact['contactId']; - } + $targets = $this->request['t']; $exports = ''; foreach($targets as $backend => $addressBooks) {