Blame view
sources/apps/contacts/appinfo/routes.php
13.4 KB
|
d1bafeea1
|
1 2 3 |
<?php /** * @author Thomas Tanghus |
|
6d9380f96
|
4 |
* @copyright 2013-2014 Thomas Tanghus (thomas@tanghus.net) |
|
d1bafeea1
|
5 6 7 8 9 10 11 12 13 14 15 16 17 |
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
namespace OCA\Contacts;
use OCA\Contacts\Dispatcher;
//define the routes
$this->create('contacts_index', '/')
->get()
->action(
function($params){
|
|
6d9380f96
|
18 |
\OC::$session->close(); |
|
d1bafeea1
|
19 20 21 22 23 24 25 26 27 28 29 30 |
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('PageController', 'index');
}
);
$this->create('contacts_jsconfig', 'ajax/config.js')
->actionInclude('contacts/js/config.php');
$this->create('contacts_address_books_for_user', 'addressbooks/')
->get()
->action(
function($params) {
|
|
6d9380f96
|
31 |
\OC::$session->close(); |
|
d1bafeea1
|
32 33 34 35 |
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('AddressBookController', 'userAddressBooks');
}
);
|
|
6d9380f96
|
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
$this->create('contacts_address_book_connectors', 'connectors/{backend}')
->get()
->action(
function($params) {
\OC::$session->close();
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('BackendController', 'getConnectors');
}
)
->requirements(array('backend'));
$this->create('contacts_backend_enable', 'backend/{backend}/{enable}')
->get()
->action(
function($params) {
\OC::$session->close();
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('BackendController', 'enableBackend');
}
)
->requirements(array('backend', 'enable'));
$this->create('contacts_backend_status', 'backend/{backend}')
->get()
->action(
function($params) {
\OC::$session->close();
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('BackendController', 'backendStatus');
}
)
->requirements(array('backend'));
|
|
d1bafeea1
|
68 69 70 71 |
$this->create('contacts_address_book_add', 'addressbook/{backend}/add')
->post()
->action(
function($params) {
|
|
6d9380f96
|
72 |
\OC::$session->close(); |
|
d1bafeea1
|
73 74 75 76 77 78 79 80 81 82 |
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('AddressBookController', 'addAddressBook');
}
)
->requirements(array('backend'));
$this->create('contacts_address_book', 'addressbook/{backend}/{addressBookId}')
->get()
->action(
function($params) {
|
|
6d9380f96
|
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
\OC::$session->close();
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('AddressBookController', 'getAddressBook');
}
)
->requirements(array('backend', 'addressBookId'));
$this->create('contacts_address_book_contacts', 'addressbook/{backend}/{addressBookId}/contacts')
->get()
->action(
function($params) {
\OC::$session->close();
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('AddressBookController', 'getContacts');
}
)
->requirements(array('backend', 'addressBookId'));
$this->create('contacts_address_book_headers', 'addressbook/{backend}/{addressBookId}')
->method('HEAD')
->action(
function($params) {
\OC::$session->close();
$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) {
\OC::$session->close();
|
|
d1bafeea1
|
117 118 119 120 121 122 123 124 125 126 |
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('AddressBookController', 'getAddressBook');
}
)
->requirements(array('backend', 'addressBookId'));
$this->create('contacts_address_book_update', 'addressbook/{backend}/{addressBookId}')
->post()
->action(
function($params) {
|
|
6d9380f96
|
127 |
\OC::$session->close(); |
|
d1bafeea1
|
128 129 130 131 132 133 134 135 136 137 138 |
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('AddressBookController', 'updateAddressBook');
}
)
->requirements(array('backend', 'addressBookId'));
$this->create('contacts_address_book_delete', 'addressbook/{backend}/{addressBookId}')
->delete()
->action(
function($params) {
$dispatcher = new Dispatcher($params);
|
|
6d9380f96
|
139 |
\OC::$session->close(); |
|
d1bafeea1
|
140 141 142 143 144 145 146 147 148 |
$dispatcher->dispatch('AddressBookController', 'deleteAddressBook');
}
)
->requirements(array('backend', 'addressBookId'));
$this->create('contacts_address_book_activate', 'addressbook/{backend}/{addressBookId}/activate')
->post()
->action(
function($params) {
|
|
6d9380f96
|
149 |
\OC::$session->close(); |
|
d1bafeea1
|
150 151 152 153 154 155 156 157 158 159 |
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('AddressBookController', 'activateAddressBook');
}
)
->requirements(array('backend', 'addressBookId'));
$this->create('contacts_address_book_add_contact', 'addressbook/{backend}/{addressBookId}/contact/add')
->post()
->action(
function($params) {
|
|
6d9380f96
|
160 |
\OC::$session->close(); |
|
d1bafeea1
|
161 162 163 164 165 166 167 168 169 170 |
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('AddressBookController', 'addChild');
}
)
->requirements(array('backend', 'addressBookId'));
$this->create('contacts_address_book_delete_contact', 'addressbook/{backend}/{addressBookId}/contact/{contactId}')
->delete()
->action(
function($params) {
|
|
6d9380f96
|
171 |
\OC::$session->close(); |
|
d1bafeea1
|
172 173 174 175 176 177 178 179 180 181 |
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('AddressBookController', 'deleteChild');
}
)
->requirements(array('backend', 'addressBookId', 'contactId'));
$this->create('contacts_address_book_delete_contacts', 'addressbook/{backend}/{addressBookId}/deleteContacts')
->post()
->action(
function($params) {
|
|
6d9380f96
|
182 |
\OC::$session->close(); |
|
d1bafeea1
|
183 184 185 186 187 188 189 190 191 192 |
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('AddressBookController', 'deleteChildren');
}
)
->requirements(array('backend', 'addressBookId', 'contactId'));
$this->create('contacts_address_book_move_contact', 'addressbook/{backend}/{addressBookId}/contact/{contactId}')
->post()
->action(
function($params) {
|
|
6d9380f96
|
193 |
\OC::$session->close(); |
|
d1bafeea1
|
194 195 196 197 198 |
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('AddressBookController', 'moveChild');
}
)
->requirements(array('backend', 'addressBookId', 'contactId'));
|
|
6d9380f96
|
199 |
$this->create('contacts_import_upload', 'addressbook/{backend}/{addressBookId}/{importType}/import/upload')
|
|
d1bafeea1
|
200 201 202 |
->post()
->action(
function($params) {
|
|
6d9380f96
|
203 |
\OC::$session->close(); |
|
d1bafeea1
|
204 205 206 207 |
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('ImportController', 'upload');
}
)
|
|
6d9380f96
|
208 |
->requirements(array('backend', 'addressBookId', 'importType'));
|
|
d1bafeea1
|
209 |
|
|
6d9380f96
|
210 |
$this->create('contacts_import_prepare', 'addressbook/{backend}/{addressBookId}/{importType}/import/prepare')
|
|
d1bafeea1
|
211 212 213 |
->post()
->action(
function($params) {
|
|
6d9380f96
|
214 |
\OC::$session->close(); |
|
d1bafeea1
|
215 216 217 218 |
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('ImportController', 'prepare');
}
)
|
|
6d9380f96
|
219 |
->requirements(array('backend', 'addressBookId', 'importType'));
|
|
d1bafeea1
|
220 |
|
|
6d9380f96
|
221 |
$this->create('contacts_import_start', 'addressbook/{backend}/{addressBookId}/{importType}/import/start')
|
|
d1bafeea1
|
222 223 224 |
->post()
->action(
function($params) {
|
|
6d9380f96
|
225 |
\OC::$session->close(); |
|
d1bafeea1
|
226 227 228 229 |
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('ImportController', 'start');
}
)
|
|
6d9380f96
|
230 |
->requirements(array('backend', 'addressBookId', 'importType'));
|
|
d1bafeea1
|
231 |
|
|
6d9380f96
|
232 |
$this->create('contacts_import_status', 'addressbook/{backend}/{addressBookId}/{importType}/import/status')
|
|
d1bafeea1
|
233 234 235 |
->get()
->action(
function($params) {
|
|
6d9380f96
|
236 |
\OC::$session->close(); |
|
d1bafeea1
|
237 238 239 240 |
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('ImportController', 'status');
}
)
|
|
6d9380f96
|
241 |
->requirements(array('backend', 'addressBookId', 'importType'));
|
|
d1bafeea1
|
242 243 244 245 246 |
$this->create('contacts_address_book_export', 'addressbook/{backend}/{addressBookId}/export')
->get()
->action(
function($params) {
|
|
6d9380f96
|
247 |
\OC::$session->close(); |
|
d1bafeea1
|
248 249 250 251 252 253 254 255 256 257 |
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('ExportController', 'exportAddressBook');
}
)
->requirements(array('backend', 'addressBookId'));
$this->create('contacts_contact_export', 'addressbook/{backend}/{addressBookId}/contact/{contactId}/export')
->get()
->action(
function($params) {
|
|
6d9380f96
|
258 |
\OC::$session->close(); |
|
d1bafeea1
|
259 260 261 262 263 264 265 266 267 268 |
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('ExportController', 'exportContact');
}
)
->requirements(array('backend', 'addressbook', 'contactId'));
$this->create('contacts_export_selected', 'exportSelected')
->get()
->action(
function($params) {
|
|
6d9380f96
|
269 |
\OC::$session->close(); |
|
d1bafeea1
|
270 271 272 273 274 275 276 277 278 |
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('ExportController', 'exportSelected');
}
);
$this->create('contacts_contact_photo', 'addressbook/{backend}/{addressBookId}/contact/{contactId}/photo')
->get()
->action(
function($params) {
|
|
6d9380f96
|
279 |
\OC::$session->close(); |
|
d1bafeea1
|
280 281 282 283 284 285 286 |
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('ContactPhotoController', 'getPhoto');
}
)
->requirements(array('backend', 'addressbook', 'contactId'));
$this->create('contacts_upload_contact_photo', 'addressbook/{backend}/{addressBookId}/contact/{contactId}/photo')
|
|
6d9380f96
|
287 |
->put() |
|
d1bafeea1
|
288 289 |
->action(
function($params) {
|
|
6d9380f96
|
290 |
\OC::$session->close(); |
|
d1bafeea1
|
291 292 293 294 295 296 297 298 299 300 |
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('ContactPhotoController', 'uploadPhoto');
}
)
->requirements(array('backend', 'addressbook', 'contactId'));
$this->create('contacts_cache_contact_photo', 'addressbook/{backend}/{addressBookId}/contact/{contactId}/photo/cacheCurrent')
->get()
->action(
function($params) {
|
|
6d9380f96
|
301 |
\OC::$session->close(); |
|
d1bafeea1
|
302 303 304 305 306 307 308 309 310 311 |
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('ContactPhotoController', 'cacheCurrentPhoto');
}
)
->requirements(array('backend', 'addressbook', 'contactId'));
$this->create('contacts_cache_fs_photo', 'addressbook/{backend}/{addressBookId}/contact/{contactId}/photo/cacheFS')
->get()
->action(
function($params) {
|
|
6d9380f96
|
312 |
\OC::$session->close(); |
|
d1bafeea1
|
313 314 315 316 317 318 319 320 321 322 |
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('ContactPhotoController', 'cacheFileSystemPhoto');
}
)
->requirements(array('backend', 'addressBookId', 'contactId'));
$this->create('contacts_tmp_contact_photo', 'addressbook/{backend}/{addressBookId}/contact/{contactId}/photo/{key}/tmp')
->get()
->action(
function($params) {
|
|
6d9380f96
|
323 |
\OC::$session->close(); |
|
d1bafeea1
|
324 325 326 327 328 329 330 331 332 333 |
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('ContactPhotoController', 'getTempPhoto');
}
)
->requirements(array('backend', 'addressbook', 'contactId', 'key'));
$this->create('contacts_crop_contact_photo', 'addressbook/{backend}/{addressBookId}/contact/{contactId}/photo/{key}/crop')
->post()
->action(
function($params) {
|
|
6d9380f96
|
334 |
\OC::$session->close(); |
|
d1bafeea1
|
335 336 337 338 339 340 341 342 343 344 345 |
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('ContactPhotoController', 'cropPhoto');
}
)
->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) {
|
|
6d9380f96
|
346 |
\OC::$session->close(); |
|
d1bafeea1
|
347 348 349 350 351 352 353 354 355 356 |
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('ContactController', 'patch');
}
)
->requirements(array('backend', 'addressbook', 'contactId'));
$this->create('contacts_contact_get', 'addressbook/{backend}/{addressBookId}/contact/{contactId}/')
->get()
->action(
function($params) {
|
|
6d9380f96
|
357 |
\OC::$session->close(); |
|
d1bafeea1
|
358 359 360 361 362 363 364 365 366 367 368 |
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('ContactController', 'getContact');
}
)
->requirements(array('backend', 'addressbook', 'contactId'));
// Save all properties. Used for merging contacts.
$this->create('contacts_contact_save_all', 'addressbook/{backend}/{addressBookId}/contact/{contactId}/save')
->post()
->action(
function($params) {
|
|
6d9380f96
|
369 |
\OC::$session->close(); |
|
d1bafeea1
|
370 371 372 373 374 375 376 377 378 379 |
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('ContactController', 'saveContact');
}
)
->requirements(array('backend', 'addressbook', 'contactId'));
$this->create('contacts_categories_list', 'groups/')
->get()
->action(
function($params) {
|
|
6d9380f96
|
380 |
\OC::$session->close(); |
|
d1bafeea1
|
381 382 383 384 385 386 387 388 389 |
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('GroupController', 'getGroups');
}
);
$this->create('contacts_categories_add', 'groups/add')
->post()
->action(
function($params) {
|
|
6d9380f96
|
390 |
\OC::$session->close(); |
|
d1bafeea1
|
391 392 393 394 395 396 397 398 399 |
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('GroupController', 'addGroup');
}
);
$this->create('contacts_categories_delete', 'groups/delete')
->post()
->action(
function($params) {
|
|
6d9380f96
|
400 |
\OC::$session->close(); |
|
d1bafeea1
|
401 402 403 404 405 406 407 408 409 |
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('GroupController', 'deleteGroup');
}
);
$this->create('contacts_categories_rename', 'groups/rename')
->post()
->action(
function($params) {
|
|
6d9380f96
|
410 |
\OC::$session->close(); |
|
d1bafeea1
|
411 412 413 414 415 416 417 418 419 |
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('GroupController', 'renameGroup');
}
);
$this->create('contacts_categories_addto', 'groups/addto/{categoryId}')
->post()
->action(
function($params) {
|
|
6d9380f96
|
420 |
\OC::$session->close(); |
|
d1bafeea1
|
421 422 423 424 425 426 427 428 429 |
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('GroupController', 'addToGroup');
}
);
$this->create('contacts_categories_removefrom', 'groups/removefrom/{categoryId}')
->post()
->action(
function($params) {
|
|
6d9380f96
|
430 |
\OC::$session->close(); |
|
d1bafeea1
|
431 432 433 434 435 436 437 438 439 440 |
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('GroupController', 'removeFromGroup');
}
)
->requirements(array('categoryId'));
$this->create('contacts_setpreference', 'preference/set')
->post()
->action(
function($params) {
|
|
6d9380f96
|
441 |
\OC::$session->close(); |
|
d1bafeea1
|
442 443 444 445 446 447 448 449 450 |
$dispatcher = new Dispatcher($params);
$dispatcher->dispatch('SettingsController', 'set');
}
);
$this->create('contacts_index_properties', 'indexproperties/{user}/')
->post()
->action(
function($params) {
|
|
6d9380f96
|
451 |
\OC::$session->close(); |
|
d1bafeea1
|
452 453 454 455 456 457 458 459 460 |
// TODO: Add BackgroundJob for this.
\OCP\Util::emitHook('OCA\Contacts', 'indexProperties', array());
\OCP\Config::setUserValue($params['user'], 'contacts', 'contacts_properties_indexed', 'yes');
\OCP\JSON::success(array('isIndexed' => true));
}
)
->requirements(array('user'))
->defaults(array('user' => \OCP\User::getUser()));
|