1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2024-12-01 13:24:10 +01:00
OwncloudContactsOfficial/appinfo/routes.php

401 lines
12 KiB
PHP
Raw Normal View History

2013-03-10 12:40:59 +01:00
<?php
/**
* @author Thomas Tanghus
* Copyright (c) 2013 Thomas Tanghus (thomas@tanghus.net)
* 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-10 12:40:59 +01:00
//define the routes
//for the index
$this->create('contacts_index', '/')
->actionInclude('contacts/index.php');
// ->action(
// function($params){
// //
// }
// );
$this->create('contacts_jsconfig', 'ajax/config.js')
->actionInclude('contacts/js/config.php');
2013-04-25 01:04:29 +02:00
/* TODO: Check what it requires to be a RESTful API. I think maybe {user}
shouldn't be in the URI but be authenticated in headers or elsewhere.
*/
2013-04-25 04:29:59 +02:00
$this->create('contacts_address_books_for_user', 'addressbooks/')
->get()
->action(
function($params) {
session_write_close();
2013-09-17 18:46:59 +02:00
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('AddressBookController', 'userAddressBooks', $params);
}
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) {
session_write_close();
2013-09-17 18:46:59 +02:00
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('AddressBookController', 'addAddressBook', $params);
2013-05-24 20:35:23 +02:00
}
)
->requirements(array('backend'));
2013-05-24 20:35:23 +02:00
$this->create('contacts_address_book', 'addressbook/{backend}/{addressBookId}')
->get()
->action(
function($params) {
session_write_close();
2013-09-17 18:46:59 +02:00
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('AddressBookController', 'getAddressBook', $params);
}
)
->requirements(array('backend', 'addressBookId'));
$this->create('contacts_address_book_update', 'addressbook/{backend}/{addressBookId}')
2013-05-07 19:16:06 +02:00
->post()
->action(
function($params) {
session_write_close();
2013-09-17 18:46:59 +02:00
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('AddressBookController', 'updateAddressBook', $params);
2013-05-07 19:16:06 +02:00
}
)
->requirements(array('backend', 'addressBookId'));
2013-05-07 19:16:06 +02:00
$this->create('contacts_address_book_delete', 'addressbook/{backend}/{addressBookId}')
->delete()
->action(
function($params) {
2013-09-17 18:46:59 +02:00
$dispatcher = new Dispatcher($params);
session_write_close();
2013-09-17 18:46:59 +02:00
$dispatcher->dispatch('AddressBookController', 'deleteAddressBook', $params);
}
)
->requirements(array('backend', 'addressBookId'));
$this->create('contacts_address_book_activate', 'addressbook/{backend}/{addressBookId}/activate')
->post()
->action(
function($params) {
session_write_close();
2013-09-17 18:46:59 +02:00
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('AddressBookController', 'activateAddressBook', $params);
}
)
->requirements(array('backend', 'addressBookId'));
$this->create('contacts_address_book_add_contact', 'addressbook/{backend}/{addressBookId}/contact/add')
->post()
->action(
function($params) {
session_write_close();
2013-09-17 18:46:59 +02:00
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('AddressBookController', 'addChild', $params);
}
)
->requirements(array('backend', 'addressBookId'));
$this->create('contacts_address_book_delete_contact', 'addressbook/{backend}/{addressBookId}/contact/{contactId}')
->delete()
->action(
function($params) {
session_write_close();
2013-09-17 18:46:59 +02:00
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('AddressBookController', 'deleteChild', $params);
}
)
->requirements(array('backend', 'addressBookId', 'contactId'));
$this->create('contacts_address_book_delete_contacts', 'addressbook/{backend}/{addressBookId}/deleteContacts')
2013-09-03 14:08:12 +02:00
->post()
->action(
function($params) {
session_write_close();
2013-09-17 18:46:59 +02:00
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('AddressBookController', 'deleteChildren', $params);
2013-09-03 14:08:12 +02:00
}
)
->requirements(array('backend', 'addressBookId', 'contactId'));
2013-09-03 14:08:12 +02:00
$this->create('contacts_address_book_move_contact', 'addressbook/{backend}/{addressBookId}/contact/{contactId}')
->post()
->action(
function($params) {
session_write_close();
2013-09-17 18:46:59 +02:00
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('AddressBookController', 'moveChild', $params);
}
)
->requirements(array('backend', 'addressBookId', 'contactId'));
$this->create('contacts_import_upload', 'addressbook/{backend}/{addressBookId}/import/upload')
->post()
->action(
function($params) {
session_write_close();
2013-09-17 18:46:59 +02:00
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('ImportController', 'upload', $params);
}
)
->requirements(array('backend', 'addressBookId'));
$this->create('contacts_import_prepare', 'addressbook/{backend}/{addressBookId}/import/prepare')
->post()
->action(
function($params) {
session_write_close();
2013-09-17 18:46:59 +02:00
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('ImportController', 'prepare', $params);
}
)
->requirements(array('backend', 'addressBookId'));
$this->create('contacts_import_start', 'addressbook/{backend}/{addressBookId}/import/start')
->post()
->action(
function($params) {
session_write_close();
2013-09-17 18:46:59 +02:00
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('ImportController', 'start', $params);
}
)
->requirements(array('backend', 'addressBookId'));
$this->create('contacts_import_status', 'addressbook/{backend}/{addressBookId}/import/status')
2013-06-25 21:44:23 +02:00
->get()
->action(
function($params) {
session_write_close();
2013-09-17 18:46:59 +02:00
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('ImportController', 'status', $params);
}
)
->requirements(array('backend', 'addressBookId'));
$this->create('contacts_address_book_export', 'addressbook/{backend}/{addressBookId}/export')
2013-09-24 13:39:45 +02:00
->get()
->action(
function($params) {
session_write_close();
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('ExportController', 'exportAddressBook', $params);
}
)
->requirements(array('backend', 'addressBookId'));
2013-09-24 13:39:45 +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) {
session_write_close();
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('ExportController', 'exportContact', $params);
}
)
->requirements(array('backend', 'addressbook', 'contactId'));
2013-09-24 13:39:45 +02:00
$this->create('contacts_export_selected', 'exportSelected')
->get()
->action(
function($params) {
session_write_close();
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('ExportController', 'exportSelected', $params);
}
);
$this->create('contacts_contact_photo', 'addressbook/{backend}/{addressBookId}/contact/{contactId}/photo')
->get()
->action(
function($params) {
session_write_close();
2013-09-17 18:46:59 +02:00
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('ContactPhotoController', 'getPhoto', $params);
}
)
->requirements(array('backend', 'addressbook', 'contactId'));
$this->create('contacts_upload_contact_photo', 'addressbook/{backend}/{addressBookId}/contact/{contactId}/photo')
->post()
->action(
function($params) {
session_write_close();
2013-09-17 18:46:59 +02:00
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('ContactPhotoController', 'uploadPhoto', $params);
}
)
->requirements(array('backend', 'addressbook', 'contactId'));
$this->create('contacts_cache_contact_photo', 'addressbook/{backend}/{addressBookId}/contact/{contactId}/photo/cacheCurrent')
->get()
->action(
function($params) {
session_write_close();
2013-09-17 18:46:59 +02:00
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('ContactPhotoController', 'cacheCurrentPhoto', $params);
}
)
->requirements(array('backend', 'addressbook', 'contactId'));
$this->create('contacts_cache_fs_photo', 'addressbook/{backend}/{addressBookId}/contact/{contactId}/photo/cacheFS')
->get()
->action(
function($params) {
session_write_close();
2013-09-17 18:46:59 +02:00
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('ContactPhotoController', 'cacheFileSystemPhoto', $params);
}
)
->requirements(array('backend', 'addressbook', 'contactId'));
$this->create('contacts_tmp_contact_photo', 'addressbook/{backend}/{addressBookId}/contact/{contactId}/photo/{key}/tmp')
->get()
->action(
function($params) {
session_write_close();
2013-09-17 18:46:59 +02:00
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('ContactPhotoController', 'getTempPhoto', $params);
}
)
->requirements(array('backend', 'addressbook', 'contactId', 'key'));
$this->create('contacts_crop_contact_photo', 'addressbook/{backend}/{addressBookId}/contact/{contactId}/photo/{key}/crop')
->post()
->action(
function($params) {
session_write_close();
2013-09-17 18:46:59 +02:00
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('ContactPhotoController', 'cropPhoto', $params);
}
)
->requirements(array('backend', 'addressbook', 'contactId', 'key'));
// Save or delete a single property.
$this->create('contacts_contact_patch', 'addressbook/{backend}/{addressBookId}/contact/{contactId}')
->patch()
->action(
function($params) {
session_write_close();
2013-09-17 18:46:59 +02:00
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('ContactController', 'patch', $params);
}
)
->requirements(array('backend', 'addressbook', 'contactId'));
2013-04-03 16:43:18 +02:00
$this->create('contacts_contact_get', 'addressbook/{backend}/{addressBookId}/contact/{contactId}/')
2013-05-09 05:58:28 +02:00
->get()
->action(
function($params) {
session_write_close();
2013-09-17 18:46:59 +02:00
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('ContactController', 'getContact', $params);
2013-05-09 05:58:28 +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.
$this->create('contacts_contact_save_all', 'addressbook/{backend}/{addressBookId}/contact/{contactId}/save')
2013-04-03 16:43:18 +02:00
->post()
->action(
function($params) {
session_write_close();
2013-09-17 18:46:59 +02:00
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('ContactController', 'saveContact', $params);
2013-04-03 16:43:18 +02:00
}
)
->requirements(array('backend', 'addressbook', 'contactId'));
2013-04-25 04:29:59 +02:00
$this->create('contacts_categories_list', 'groups/')
->get()
->action(
function($params) {
session_write_close();
2013-09-17 18:46:59 +02:00
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('GroupController', 'getGroups', $params);
}
2013-04-25 04:29:59 +02:00
);
2013-04-25 04:29:59 +02:00
$this->create('contacts_categories_add', 'groups/add')
->post()
->action(
function($params) {
session_write_close();
2013-09-17 18:46:59 +02:00
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('GroupController', 'addGroup', $params);
}
2013-04-25 04:29:59 +02:00
);
2013-04-25 04:29:59 +02:00
$this->create('contacts_categories_delete', 'groups/delete')
->post()
->action(
function($params) {
session_write_close();
2013-09-17 18:46:59 +02:00
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('GroupController', 'deleteGroup', $params);
}
2013-04-25 04:29:59 +02:00
);
2013-05-21 23:39:50 +02:00
$this->create('contacts_categories_rename', 'groups/rename')
->post()
->action(
function($params) {
session_write_close();
2013-09-17 18:46:59 +02:00
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('GroupController', 'renameGroup', $params);
2013-05-21 23:39:50 +02:00
}
);
$this->create('contacts_categories_addto', 'groups/addto/{categoryId}')
->post()
->action(
function($params) {
session_write_close();
2013-09-17 18:46:59 +02:00
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('GroupController', 'addToGroup', $params);
}
2013-04-25 04:29:59 +02:00
);
$this->create('contacts_categories_removefrom', 'groups/removefrom/{categoryId}')
->post()
->action(
function($params) {
session_write_close();
2013-09-17 18:46:59 +02:00
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('GroupController', 'removeFromGroup', $params);
}
)
->requirements(array('categoryId'));
2013-04-25 04:29:59 +02:00
$this->create('contacts_setpreference', 'preference/set')
->post()
->action(
function($params) {
session_write_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-04-25 04:29:59 +02:00
);
$this->create('contacts_index_properties', 'indexproperties/{user}/')
->post()
->action(
function($params) {
session_write_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());
\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'))
->defaults(array('user' => \OCP\User::getUser()));