2013-03-10 12:40:59 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @author Thomas Tanghus
|
2014-01-26 00:40:22 +01:00
|
|
|
* @copyright 2013-2014 Thomas Tanghus (thomas@tanghus.net)
|
2013-03-10 12:40:59 +01:00
|
|
|
* This file is licensed under the Affero General Public License version 3 or
|
|
|
|
* later.
|
|
|
|
* See the COPYING-README file.
|
|
|
|
*/
|
|
|
|
namespace OCA\Contacts;
|
|
|
|
|
2013-09-17 18:46:59 +02:00
|
|
|
use OCA\Contacts\Dispatcher;
|
2013-03-25 17:08:47 +01:00
|
|
|
|
2013-03-10 12:40:59 +01:00
|
|
|
//define the routes
|
|
|
|
$this->create('contacts_index', '/')
|
2013-10-17 02:10:34 +02:00
|
|
|
->get()
|
|
|
|
->action(
|
|
|
|
function($params){
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2013-10-17 02:10:34 +02:00
|
|
|
$dispatcher = new Dispatcher($params);
|
|
|
|
$dispatcher->dispatch('PageController', 'index');
|
|
|
|
}
|
|
|
|
);
|
2013-03-10 12:40:59 +01:00
|
|
|
|
2013-04-01 03:44:46 +02:00
|
|
|
$this->create('contacts_jsconfig', 'ajax/config.js')
|
|
|
|
->actionInclude('contacts/js/config.php');
|
|
|
|
|
2013-04-25 04:29:59 +02:00
|
|
|
$this->create('contacts_address_books_for_user', 'addressbooks/')
|
2013-03-22 14:49:34 +01:00
|
|
|
->get()
|
|
|
|
->action(
|
2013-03-25 17:08:47 +01:00
|
|
|
function($params) {
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2013-09-17 18:46:59 +02:00
|
|
|
$dispatcher = new Dispatcher($params);
|
2013-10-17 02:10:34 +02:00
|
|
|
$dispatcher->dispatch('AddressBookController', 'userAddressBooks');
|
2013-03-22 14:49:34 +01:00
|
|
|
}
|
2013-04-25 04:29:59 +02:00
|
|
|
);
|
2013-03-10 12:40:59 +01:00
|
|
|
|
2013-05-24 20:35:23 +02:00
|
|
|
$this->create('contacts_address_book_add', 'addressbook/{backend}/add')
|
|
|
|
->post()
|
|
|
|
->action(
|
|
|
|
function($params) {
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2013-09-17 18:46:59 +02:00
|
|
|
$dispatcher = new Dispatcher($params);
|
2013-10-17 02:10:34 +02:00
|
|
|
$dispatcher->dispatch('AddressBookController', 'addAddressBook');
|
2013-05-24 20:35:23 +02:00
|
|
|
}
|
|
|
|
)
|
2013-10-03 04:11:54 +02:00
|
|
|
->requirements(array('backend'));
|
2013-05-24 20:35:23 +02:00
|
|
|
|
2013-10-03 04:11:54 +02:00
|
|
|
$this->create('contacts_address_book', 'addressbook/{backend}/{addressBookId}')
|
2013-03-22 14:49:34 +01:00
|
|
|
->get()
|
|
|
|
->action(
|
2013-03-25 17:08:47 +01:00
|
|
|
function($params) {
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2013-09-17 18:46:59 +02:00
|
|
|
$dispatcher = new Dispatcher($params);
|
2013-10-17 02:10:34 +02:00
|
|
|
$dispatcher->dispatch('AddressBookController', 'getAddressBook');
|
2013-03-22 14:49:34 +01:00
|
|
|
}
|
2013-03-25 17:08:47 +01:00
|
|
|
)
|
2013-10-03 04:11:54 +02:00
|
|
|
->requirements(array('backend', 'addressBookId'));
|
2014-01-29 23:49:49 +01:00
|
|
|
|
|
|
|
$this->create('contacts_address_book_headers', 'addressbook/{backend}/{addressBookId}')
|
|
|
|
->method('HEAD')
|
|
|
|
->action(
|
|
|
|
function($params) {
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2014-01-29 23:49:49 +01:00
|
|
|
$dispatcher = new Dispatcher($params);
|
|
|
|
$dispatcher->dispatch('AddressBookController', 'getAddressBook');
|
|
|
|
}
|
|
|
|
)
|
|
|
|
->requirements(array('backend', 'addressBookId'));
|
|
|
|
|
|
|
|
$this->create('contacts_address_book_options', 'addressbook/{backend}/{addressBookId}')
|
|
|
|
->method('OPTIONS')
|
|
|
|
->action(
|
|
|
|
function($params) {
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2014-01-29 23:49:49 +01:00
|
|
|
$dispatcher = new Dispatcher($params);
|
|
|
|
$dispatcher->dispatch('AddressBookController', 'getAddressBook');
|
|
|
|
}
|
|
|
|
)
|
|
|
|
->requirements(array('backend', 'addressBookId'));
|
2013-03-25 17:08:47 +01:00
|
|
|
|
2013-10-03 04:11:54 +02:00
|
|
|
$this->create('contacts_address_book_update', 'addressbook/{backend}/{addressBookId}')
|
2013-05-07 19:16:06 +02:00
|
|
|
->post()
|
|
|
|
->action(
|
|
|
|
function($params) {
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2013-09-17 18:46:59 +02:00
|
|
|
$dispatcher = new Dispatcher($params);
|
2013-10-17 02:10:34 +02:00
|
|
|
$dispatcher->dispatch('AddressBookController', 'updateAddressBook');
|
2013-05-07 19:16:06 +02:00
|
|
|
}
|
|
|
|
)
|
2013-10-03 04:11:54 +02:00
|
|
|
->requirements(array('backend', 'addressBookId'));
|
2013-05-07 19:16:06 +02:00
|
|
|
|
2013-10-03 04:11:54 +02:00
|
|
|
$this->create('contacts_address_book_delete', 'addressbook/{backend}/{addressBookId}')
|
2013-04-25 04:50:45 +02:00
|
|
|
->delete()
|
2013-03-25 17:08:47 +01:00
|
|
|
->action(
|
|
|
|
function($params) {
|
2013-09-17 18:46:59 +02:00
|
|
|
$dispatcher = new Dispatcher($params);
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2013-10-17 02:10:34 +02:00
|
|
|
$dispatcher->dispatch('AddressBookController', 'deleteAddressBook');
|
2013-03-25 17:08:47 +01:00
|
|
|
}
|
|
|
|
)
|
2013-10-03 04:11:54 +02:00
|
|
|
->requirements(array('backend', 'addressBookId'));
|
2013-03-25 17:08:47 +01:00
|
|
|
|
2013-10-03 04:11:54 +02:00
|
|
|
$this->create('contacts_address_book_activate', 'addressbook/{backend}/{addressBookId}/activate')
|
2013-09-05 22:07:40 +02:00
|
|
|
->post()
|
|
|
|
->action(
|
|
|
|
function($params) {
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2013-09-17 18:46:59 +02:00
|
|
|
$dispatcher = new Dispatcher($params);
|
2013-10-17 02:10:34 +02:00
|
|
|
$dispatcher->dispatch('AddressBookController', 'activateAddressBook');
|
2013-09-05 22:07:40 +02:00
|
|
|
}
|
|
|
|
)
|
2013-10-03 04:11:54 +02:00
|
|
|
->requirements(array('backend', 'addressBookId'));
|
2013-09-05 22:07:40 +02:00
|
|
|
|
2013-10-03 04:11:54 +02:00
|
|
|
$this->create('contacts_address_book_add_contact', 'addressbook/{backend}/{addressBookId}/contact/add')
|
2013-03-25 17:08:47 +01:00
|
|
|
->post()
|
|
|
|
->action(
|
|
|
|
function($params) {
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2013-09-17 18:46:59 +02:00
|
|
|
$dispatcher = new Dispatcher($params);
|
2013-10-17 02:10:34 +02:00
|
|
|
$dispatcher->dispatch('AddressBookController', 'addChild');
|
2013-03-25 17:08:47 +01:00
|
|
|
}
|
|
|
|
)
|
2013-10-03 04:11:54 +02:00
|
|
|
->requirements(array('backend', 'addressBookId'));
|
2013-03-25 17:08:47 +01:00
|
|
|
|
2013-10-03 04:11:54 +02:00
|
|
|
$this->create('contacts_address_book_delete_contact', 'addressbook/{backend}/{addressBookId}/contact/{contactId}')
|
2013-04-25 04:50:45 +02:00
|
|
|
->delete()
|
2013-03-28 03:19:01 +01:00
|
|
|
->action(
|
|
|
|
function($params) {
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2013-09-17 18:46:59 +02:00
|
|
|
$dispatcher = new Dispatcher($params);
|
2013-10-17 02:10:34 +02:00
|
|
|
$dispatcher->dispatch('AddressBookController', 'deleteChild');
|
2013-03-28 03:19:01 +01:00
|
|
|
}
|
|
|
|
)
|
2013-10-03 04:11:54 +02:00
|
|
|
->requirements(array('backend', 'addressBookId', 'contactId'));
|
2013-03-28 03:19:01 +01:00
|
|
|
|
2013-10-03 04:11:54 +02:00
|
|
|
$this->create('contacts_address_book_delete_contacts', 'addressbook/{backend}/{addressBookId}/deleteContacts')
|
2013-09-03 14:08:12 +02:00
|
|
|
->post()
|
|
|
|
->action(
|
|
|
|
function($params) {
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2013-09-17 18:46:59 +02:00
|
|
|
$dispatcher = new Dispatcher($params);
|
2013-10-17 02:10:34 +02:00
|
|
|
$dispatcher->dispatch('AddressBookController', 'deleteChildren');
|
2013-09-03 14:08:12 +02:00
|
|
|
}
|
|
|
|
)
|
2013-10-03 04:11:54 +02:00
|
|
|
->requirements(array('backend', 'addressBookId', 'contactId'));
|
2013-09-03 14:08:12 +02:00
|
|
|
|
2013-10-03 04:11:54 +02:00
|
|
|
$this->create('contacts_address_book_move_contact', 'addressbook/{backend}/{addressBookId}/contact/{contactId}')
|
2013-05-06 01:49:10 +02:00
|
|
|
->post()
|
|
|
|
->action(
|
|
|
|
function($params) {
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2013-09-17 18:46:59 +02:00
|
|
|
$dispatcher = new Dispatcher($params);
|
2013-10-17 02:10:34 +02:00
|
|
|
$dispatcher->dispatch('AddressBookController', 'moveChild');
|
2013-05-06 01:49:10 +02:00
|
|
|
}
|
|
|
|
)
|
2013-10-03 04:11:54 +02:00
|
|
|
->requirements(array('backend', 'addressBookId', 'contactId'));
|
2013-05-06 01:49:10 +02:00
|
|
|
|
2013-09-20 16:24:29 +02:00
|
|
|
$this->create('contacts_import_upload', 'addressbook/{backend}/{addressBookId}/{importType}/import/upload')
|
2013-05-02 20:41:26 +02:00
|
|
|
->post()
|
|
|
|
->action(
|
|
|
|
function($params) {
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2013-09-17 18:46:59 +02:00
|
|
|
$dispatcher = new Dispatcher($params);
|
2013-10-17 02:10:34 +02:00
|
|
|
$dispatcher->dispatch('ImportController', 'upload');
|
2013-05-02 20:41:26 +02:00
|
|
|
}
|
|
|
|
)
|
2013-09-20 16:24:29 +02:00
|
|
|
->requirements(array('backend', 'addressBookId', 'importType'));
|
2013-05-02 20:41:26 +02:00
|
|
|
|
2013-09-20 16:24:29 +02:00
|
|
|
$this->create('contacts_import_prepare', 'addressbook/{backend}/{addressBookId}/{importType}/import/prepare')
|
2013-09-10 00:28:16 +02:00
|
|
|
->post()
|
|
|
|
->action(
|
|
|
|
function($params) {
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2013-09-17 18:46:59 +02:00
|
|
|
$dispatcher = new Dispatcher($params);
|
2013-10-17 02:10:34 +02:00
|
|
|
$dispatcher->dispatch('ImportController', 'prepare');
|
2013-09-10 00:28:16 +02:00
|
|
|
}
|
|
|
|
)
|
2013-09-20 16:24:29 +02:00
|
|
|
->requirements(array('backend', 'addressBookId', 'importType'));
|
2013-09-10 00:28:16 +02:00
|
|
|
|
2013-09-20 16:24:29 +02:00
|
|
|
$this->create('contacts_import_start', 'addressbook/{backend}/{addressBookId}/{importType}/import/start')
|
2013-05-02 20:41:26 +02:00
|
|
|
->post()
|
|
|
|
->action(
|
|
|
|
function($params) {
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2013-09-17 18:46:59 +02:00
|
|
|
$dispatcher = new Dispatcher($params);
|
2013-10-17 02:10:34 +02:00
|
|
|
$dispatcher->dispatch('ImportController', 'start');
|
2013-05-02 20:41:26 +02:00
|
|
|
}
|
|
|
|
)
|
2013-09-20 16:24:29 +02:00
|
|
|
->requirements(array('backend', 'addressBookId', 'importType'));
|
2013-05-02 20:41:26 +02:00
|
|
|
|
2013-09-20 16:24:29 +02:00
|
|
|
$this->create('contacts_import_status', 'addressbook/{backend}/{addressBookId}/{importType}/import/status')
|
2013-06-25 21:44:23 +02:00
|
|
|
->get()
|
2013-05-02 20:41:26 +02:00
|
|
|
->action(
|
|
|
|
function($params) {
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2013-09-17 18:46:59 +02:00
|
|
|
$dispatcher = new Dispatcher($params);
|
2013-10-17 02:10:34 +02:00
|
|
|
$dispatcher->dispatch('ImportController', 'status');
|
2013-05-02 20:41:26 +02:00
|
|
|
}
|
|
|
|
)
|
2013-09-20 16:24:29 +02:00
|
|
|
->requirements(array('backend', 'addressBookId', 'importType'));
|
2013-05-02 20:41:26 +02:00
|
|
|
|
2013-10-03 04:11:54 +02:00
|
|
|
$this->create('contacts_address_book_export', 'addressbook/{backend}/{addressBookId}/export')
|
2013-09-24 13:39:45 +02:00
|
|
|
->get()
|
|
|
|
->action(
|
|
|
|
function($params) {
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2013-09-24 13:39:45 +02:00
|
|
|
$dispatcher = new Dispatcher($params);
|
2013-10-17 02:10:34 +02:00
|
|
|
$dispatcher->dispatch('ExportController', 'exportAddressBook');
|
2013-09-24 13:39:45 +02:00
|
|
|
}
|
|
|
|
)
|
2013-10-03 04:11:54 +02:00
|
|
|
->requirements(array('backend', 'addressBookId'));
|
2013-09-24 13:39:45 +02:00
|
|
|
|
2013-10-03 04:11:54 +02:00
|
|
|
$this->create('contacts_contact_export', 'addressbook/{backend}/{addressBookId}/contact/{contactId}/export')
|
2013-09-24 13:39:45 +02:00
|
|
|
->get()
|
|
|
|
->action(
|
|
|
|
function($params) {
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2013-09-24 13:39:45 +02:00
|
|
|
$dispatcher = new Dispatcher($params);
|
2013-10-17 02:10:34 +02:00
|
|
|
$dispatcher->dispatch('ExportController', 'exportContact');
|
2013-09-24 13:39:45 +02:00
|
|
|
}
|
|
|
|
)
|
2013-10-03 04:11:54 +02:00
|
|
|
->requirements(array('backend', 'addressbook', 'contactId'));
|
2013-09-24 13:39:45 +02:00
|
|
|
|
|
|
|
$this->create('contacts_export_selected', 'exportSelected')
|
|
|
|
->get()
|
|
|
|
->action(
|
|
|
|
function($params) {
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2013-09-24 13:39:45 +02:00
|
|
|
$dispatcher = new Dispatcher($params);
|
2013-10-17 02:10:34 +02:00
|
|
|
$dispatcher->dispatch('ExportController', 'exportSelected');
|
2013-09-24 13:39:45 +02:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2013-10-03 04:11:54 +02:00
|
|
|
$this->create('contacts_contact_photo', 'addressbook/{backend}/{addressBookId}/contact/{contactId}/photo')
|
2013-04-05 00:30:42 +02:00
|
|
|
->get()
|
|
|
|
->action(
|
|
|
|
function($params) {
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2013-09-17 18:46:59 +02:00
|
|
|
$dispatcher = new Dispatcher($params);
|
2013-10-17 02:10:34 +02:00
|
|
|
$dispatcher->dispatch('ContactPhotoController', 'getPhoto');
|
2013-04-05 00:30:42 +02:00
|
|
|
}
|
|
|
|
)
|
2013-10-03 04:11:54 +02:00
|
|
|
->requirements(array('backend', 'addressbook', 'contactId'));
|
2013-04-05 00:30:42 +02:00
|
|
|
|
2013-10-03 04:11:54 +02:00
|
|
|
$this->create('contacts_upload_contact_photo', 'addressbook/{backend}/{addressBookId}/contact/{contactId}/photo')
|
2014-03-20 01:55:48 +01:00
|
|
|
->put()
|
2013-09-04 08:03:33 +02:00
|
|
|
->action(
|
|
|
|
function($params) {
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2013-09-17 18:46:59 +02:00
|
|
|
$dispatcher = new Dispatcher($params);
|
2013-10-17 02:10:34 +02:00
|
|
|
$dispatcher->dispatch('ContactPhotoController', 'uploadPhoto');
|
2013-09-04 08:03:33 +02:00
|
|
|
}
|
|
|
|
)
|
2013-10-03 04:11:54 +02:00
|
|
|
->requirements(array('backend', 'addressbook', 'contactId'));
|
2013-09-04 08:03:33 +02:00
|
|
|
|
2013-10-03 04:11:54 +02:00
|
|
|
$this->create('contacts_cache_contact_photo', 'addressbook/{backend}/{addressBookId}/contact/{contactId}/photo/cacheCurrent')
|
2013-09-04 08:03:33 +02:00
|
|
|
->get()
|
|
|
|
->action(
|
|
|
|
function($params) {
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2013-09-17 18:46:59 +02:00
|
|
|
$dispatcher = new Dispatcher($params);
|
2013-10-17 02:10:34 +02:00
|
|
|
$dispatcher->dispatch('ContactPhotoController', 'cacheCurrentPhoto');
|
2013-09-04 08:03:33 +02:00
|
|
|
}
|
|
|
|
)
|
2013-10-03 04:11:54 +02:00
|
|
|
->requirements(array('backend', 'addressbook', 'contactId'));
|
2013-09-04 08:03:33 +02:00
|
|
|
|
2013-10-03 04:11:54 +02:00
|
|
|
$this->create('contacts_cache_fs_photo', 'addressbook/{backend}/{addressBookId}/contact/{contactId}/photo/cacheFS')
|
2013-09-04 08:03:33 +02:00
|
|
|
->get()
|
|
|
|
->action(
|
|
|
|
function($params) {
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2013-09-17 18:46:59 +02:00
|
|
|
$dispatcher = new Dispatcher($params);
|
2013-10-17 02:10:34 +02:00
|
|
|
$dispatcher->dispatch('ContactPhotoController', 'cacheFileSystemPhoto');
|
2013-09-04 08:03:33 +02:00
|
|
|
}
|
|
|
|
)
|
2013-10-22 17:10:23 +02:00
|
|
|
->requirements(array('backend', 'addressBookId', 'contactId'));
|
2013-09-04 08:03:33 +02:00
|
|
|
|
2013-10-03 04:11:54 +02:00
|
|
|
$this->create('contacts_tmp_contact_photo', 'addressbook/{backend}/{addressBookId}/contact/{contactId}/photo/{key}/tmp')
|
2013-09-04 08:03:33 +02:00
|
|
|
->get()
|
|
|
|
->action(
|
|
|
|
function($params) {
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2013-09-17 18:46:59 +02:00
|
|
|
$dispatcher = new Dispatcher($params);
|
2013-10-17 02:10:34 +02:00
|
|
|
$dispatcher->dispatch('ContactPhotoController', 'getTempPhoto');
|
2013-09-04 08:03:33 +02:00
|
|
|
}
|
|
|
|
)
|
2013-10-03 04:11:54 +02:00
|
|
|
->requirements(array('backend', 'addressbook', 'contactId', 'key'));
|
2013-09-04 08:03:33 +02:00
|
|
|
|
2013-10-03 04:11:54 +02:00
|
|
|
$this->create('contacts_crop_contact_photo', 'addressbook/{backend}/{addressBookId}/contact/{contactId}/photo/{key}/crop')
|
2013-09-04 08:03:33 +02:00
|
|
|
->post()
|
|
|
|
->action(
|
|
|
|
function($params) {
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2013-09-17 18:46:59 +02:00
|
|
|
$dispatcher = new Dispatcher($params);
|
2013-10-17 02:10:34 +02:00
|
|
|
$dispatcher->dispatch('ContactPhotoController', 'cropPhoto');
|
2013-09-04 08:03:33 +02:00
|
|
|
}
|
|
|
|
)
|
2013-10-03 04:11:54 +02:00
|
|
|
->requirements(array('backend', 'addressbook', 'contactId', 'key'));
|
2013-09-04 08:03:33 +02:00
|
|
|
|
2013-10-03 04:11:54 +02:00
|
|
|
// Save or delete a single property.
|
|
|
|
$this->create('contacts_contact_patch', 'addressbook/{backend}/{addressBookId}/contact/{contactId}')
|
|
|
|
->patch()
|
2013-03-25 17:08:47 +01:00
|
|
|
->action(
|
|
|
|
function($params) {
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2013-09-17 18:46:59 +02:00
|
|
|
$dispatcher = new Dispatcher($params);
|
2013-10-17 02:10:34 +02:00
|
|
|
$dispatcher->dispatch('ContactController', 'patch');
|
2013-03-25 17:08:47 +01:00
|
|
|
}
|
|
|
|
)
|
2013-10-03 04:11:54 +02:00
|
|
|
->requirements(array('backend', 'addressbook', 'contactId'));
|
2013-04-03 16:43:18 +02:00
|
|
|
|
2013-10-03 04:11:54 +02:00
|
|
|
$this->create('contacts_contact_get', 'addressbook/{backend}/{addressBookId}/contact/{contactId}/')
|
2013-05-09 05:58:28 +02:00
|
|
|
->get()
|
|
|
|
->action(
|
|
|
|
function($params) {
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2013-09-17 18:46:59 +02:00
|
|
|
$dispatcher = new Dispatcher($params);
|
2013-10-17 02:10:34 +02:00
|
|
|
$dispatcher->dispatch('ContactController', 'getContact');
|
2013-05-09 05:58:28 +02:00
|
|
|
}
|
|
|
|
)
|
2013-10-03 04:11:54 +02:00
|
|
|
->requirements(array('backend', 'addressbook', 'contactId'));
|
2013-05-09 05:58:28 +02:00
|
|
|
|
2013-04-03 16:43:18 +02:00
|
|
|
// Save all properties. Used for merging contacts.
|
2013-10-03 04:11:54 +02:00
|
|
|
$this->create('contacts_contact_save_all', 'addressbook/{backend}/{addressBookId}/contact/{contactId}/save')
|
2013-04-03 16:43:18 +02:00
|
|
|
->post()
|
|
|
|
->action(
|
|
|
|
function($params) {
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2013-09-17 18:46:59 +02:00
|
|
|
$dispatcher = new Dispatcher($params);
|
2013-10-17 02:10:34 +02:00
|
|
|
$dispatcher->dispatch('ContactController', 'saveContact');
|
2013-04-03 16:43:18 +02:00
|
|
|
}
|
|
|
|
)
|
2013-10-03 04:11:54 +02:00
|
|
|
->requirements(array('backend', 'addressbook', 'contactId'));
|
2013-03-25 17:08:47 +01:00
|
|
|
|
2013-04-25 04:29:59 +02:00
|
|
|
$this->create('contacts_categories_list', 'groups/')
|
2013-03-25 17:08:47 +01:00
|
|
|
->get()
|
|
|
|
->action(
|
|
|
|
function($params) {
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2013-09-17 18:46:59 +02:00
|
|
|
$dispatcher = new Dispatcher($params);
|
2013-10-17 02:10:34 +02:00
|
|
|
$dispatcher->dispatch('GroupController', 'getGroups');
|
2013-03-25 17:08:47 +01:00
|
|
|
}
|
2013-04-25 04:29:59 +02:00
|
|
|
);
|
2013-03-25 17:08:47 +01:00
|
|
|
|
2013-04-25 04:29:59 +02:00
|
|
|
$this->create('contacts_categories_add', 'groups/add')
|
2013-03-25 17:08:47 +01:00
|
|
|
->post()
|
|
|
|
->action(
|
|
|
|
function($params) {
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2013-09-17 18:46:59 +02:00
|
|
|
$dispatcher = new Dispatcher($params);
|
2013-10-17 02:10:34 +02:00
|
|
|
$dispatcher->dispatch('GroupController', 'addGroup');
|
2013-03-25 17:08:47 +01:00
|
|
|
}
|
2013-04-25 04:29:59 +02:00
|
|
|
);
|
2013-03-25 17:08:47 +01:00
|
|
|
|
2013-04-25 04:29:59 +02:00
|
|
|
$this->create('contacts_categories_delete', 'groups/delete')
|
2013-03-25 17:08:47 +01:00
|
|
|
->post()
|
|
|
|
->action(
|
|
|
|
function($params) {
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2013-09-17 18:46:59 +02:00
|
|
|
$dispatcher = new Dispatcher($params);
|
2013-10-17 02:10:34 +02:00
|
|
|
$dispatcher->dispatch('GroupController', 'deleteGroup');
|
2013-03-25 17:08:47 +01:00
|
|
|
}
|
2013-04-25 04:29:59 +02:00
|
|
|
);
|
2013-03-25 17:08:47 +01:00
|
|
|
|
2013-05-21 23:39:50 +02:00
|
|
|
$this->create('contacts_categories_rename', 'groups/rename')
|
|
|
|
->post()
|
|
|
|
->action(
|
|
|
|
function($params) {
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2013-09-17 18:46:59 +02:00
|
|
|
$dispatcher = new Dispatcher($params);
|
2013-10-17 02:10:34 +02:00
|
|
|
$dispatcher->dispatch('GroupController', 'renameGroup');
|
2013-05-21 23:39:50 +02:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2013-10-03 04:11:54 +02:00
|
|
|
$this->create('contacts_categories_addto', 'groups/addto/{categoryId}')
|
2013-03-29 06:51:16 +01:00
|
|
|
->post()
|
|
|
|
->action(
|
|
|
|
function($params) {
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2013-09-17 18:46:59 +02:00
|
|
|
$dispatcher = new Dispatcher($params);
|
2013-10-17 02:10:34 +02:00
|
|
|
$dispatcher->dispatch('GroupController', 'addToGroup');
|
2013-03-29 06:51:16 +01:00
|
|
|
}
|
2013-04-25 04:29:59 +02:00
|
|
|
);
|
2013-03-29 06:51:16 +01:00
|
|
|
|
2013-10-03 04:11:54 +02:00
|
|
|
$this->create('contacts_categories_removefrom', 'groups/removefrom/{categoryId}')
|
2013-03-29 06:51:16 +01:00
|
|
|
->post()
|
|
|
|
->action(
|
|
|
|
function($params) {
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2013-09-17 18:46:59 +02:00
|
|
|
$dispatcher = new Dispatcher($params);
|
2013-10-17 02:10:34 +02:00
|
|
|
$dispatcher->dispatch('GroupController', 'removeFromGroup');
|
2013-03-29 06:51:16 +01:00
|
|
|
}
|
|
|
|
)
|
2013-10-03 04:11:54 +02:00
|
|
|
->requirements(array('categoryId'));
|
2013-03-29 06:51:16 +01:00
|
|
|
|
2013-04-25 04:29:59 +02:00
|
|
|
$this->create('contacts_setpreference', 'preference/set')
|
2013-03-25 17:08:47 +01:00
|
|
|
->post()
|
|
|
|
->action(
|
|
|
|
function($params) {
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2013-09-17 18:46:59 +02:00
|
|
|
$dispatcher = new Dispatcher($params);
|
2013-10-01 19:13:28 +02:00
|
|
|
$dispatcher->dispatch('SettingsController', 'set');
|
2013-03-25 17:08:47 +01:00
|
|
|
}
|
2013-04-25 04:29:59 +02:00
|
|
|
);
|
2013-04-01 03:47:59 +02:00
|
|
|
|
|
|
|
$this->create('contacts_index_properties', 'indexproperties/{user}/')
|
|
|
|
->post()
|
|
|
|
->action(
|
|
|
|
function($params) {
|
2014-03-21 14:16:40 +01:00
|
|
|
\OC::$session->close();
|
2013-04-25 01:04:29 +02:00
|
|
|
// TODO: Add BackgroundJob for this.
|
2013-09-16 02:24:08 +02:00
|
|
|
\OCP\Util::emitHook('OCA\Contacts', 'indexProperties', array());
|
2013-04-01 03:47:59 +02:00
|
|
|
|
|
|
|
\OCP\Config::setUserValue($params['user'], 'contacts', 'contacts_properties_indexed', 'yes');
|
|
|
|
\OCP\JSON::success(array('isIndexed' => true));
|
|
|
|
}
|
|
|
|
)
|
2013-04-05 18:28:15 +02:00
|
|
|
->requirements(array('user'))
|
2013-04-01 03:47:59 +02:00
|
|
|
->defaults(array('user' => \OCP\User::getUser()));
|
2013-05-02 20:41:26 +02:00
|
|
|
|