Blame view
sources/apps/contacts/appinfo/app.php
3.54 KB
|
d1bafeea1
|
1 |
<?php |
|
6d9380f96
|
2 3 4 5 6 7 8 |
/** * @author Thomas Tanghus * @copyright 2011-2014 Thomas Tanghus (thomas@tanghus.net) * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. */ |
|
d1bafeea1
|
9 10 |
namespace OCA\Contacts; |
|
6d9380f96
|
11 |
|
|
d1bafeea1
|
12 13 14 15 |
use \OC\AppFramework\Core\API; //require_once __DIR__ . '/../lib/controller/pagecontroller.php'; \Sabre\VObject\Component::$classMap['VCARD'] = '\OCA\Contacts\VObject\VCard'; |
|
6d9380f96
|
16 |
\Sabre\VObject\Property::$classMap['CATEGORIES'] = '\OCA\Contacts\VObject\GroupProperty'; |
|
d1bafeea1
|
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
\Sabre\VObject\Property::$classMap['FN'] = '\OC\VObject\StringProperty';
\Sabre\VObject\Property::$classMap['TITLE'] = '\OC\VObject\StringProperty';
\Sabre\VObject\Property::$classMap['ROLE'] = '\OC\VObject\StringProperty';
\Sabre\VObject\Property::$classMap['NOTE'] = '\OC\VObject\StringProperty';
\Sabre\VObject\Property::$classMap['NICKNAME'] = '\OC\VObject\StringProperty';
\Sabre\VObject\Property::$classMap['EMAIL'] = '\OC\VObject\StringProperty';
\Sabre\VObject\Property::$classMap['TEL'] = '\OC\VObject\StringProperty';
\Sabre\VObject\Property::$classMap['IMPP'] = '\OC\VObject\StringProperty';
\Sabre\VObject\Property::$classMap['URL'] = '\OC\VObject\StringProperty';
\Sabre\VObject\Property::$classMap['LABEL'] = '\OC\VObject\StringProperty';
\Sabre\VObject\Property::$classMap['X-EVOLUTION-FILE-AS'] = '\OC\VObject\StringProperty';
\Sabre\VObject\Property::$classMap['N'] = '\OC\VObject\CompoundProperty';
\Sabre\VObject\Property::$classMap['ADR'] = '\OC\VObject\CompoundProperty';
\Sabre\VObject\Property::$classMap['GEO'] = '\OC\VObject\CompoundProperty';
\Sabre\VObject\Property::$classMap['ORG'] = '\OC\VObject\CompoundProperty';
\OC::$server->getNavigationManager()->add(array(
'id' => 'contacts',
'order' => 10,
'href' => \OCP\Util::linkToRoute('contacts_index'),
'icon' => \OCP\Util::imagePath( 'contacts', 'contacts.svg' ),
'name' => \OCP\Util::getL10N('contacts')->t('Contacts')
)
);
$api = new API('contacts');
$api->connectHook('OC_User', 'post_createUser', '\OCA\Contacts\Hooks', 'userCreated');
$api->connectHook('OC_User', 'post_deleteUser', '\OCA\Contacts\Hooks', 'userDeleted');
$api->connectHook('OCA\Contacts', 'pre_deleteAddressBook', '\OCA\Contacts\Hooks', 'addressBookDeletion');
$api->connectHook('OCA\Contacts', 'pre_deleteContact', '\OCA\Contacts\Hooks', 'contactDeletion');
$api->connectHook('OCA\Contacts', 'post_createContact', 'OCA\Contacts\Hooks', 'contactAdded');
$api->connectHook('OCA\Contacts', 'post_updateContact', '\OCA\Contacts\Hooks', 'contactUpdated');
$api->connectHook('OCA\Contacts', 'scanCategories', '\OCA\Contacts\Hooks', 'scanCategories');
$api->connectHook('OCA\Contacts', 'indexProperties', '\OCA\Contacts\Hooks', 'indexProperties');
$api->connectHook('OC_Calendar', 'getEvents', 'OCA\Contacts\Hooks', 'getBirthdayEvents');
$api->connectHook('OC_Calendar', 'getSources', 'OCA\Contacts\Hooks', 'getCalenderSources');
\OCP\Util::addscript('contacts', 'loader');
|
|
6d9380f96
|
56 |
\OCP\Util::addscript('contacts', 'admin');
|
|
d1bafeea1
|
57 58 59 60 61 |
\OC_Search::registerProvider('OCA\Contacts\SearchProvider');
//\OCP\Share::registerBackend('contact', 'OCA\Contacts\Share_Backend_Contact');
\OCP\Share::registerBackend('addressbook', 'OCA\Contacts\Share\Addressbook', 'contact');
//\OCP\App::registerPersonal('contacts','personalsettings');
|
|
6d9380f96
|
62 |
\OCP\App::registerAdmin('contacts', 'admin');
|
|
d1bafeea1
|
63 |
|
|
6d9380f96
|
64 |
if (\OCP\User::isLoggedIn()) {
|
|
d1bafeea1
|
65 66 |
$app = new App($api->getUserId()); $addressBooks = $app->getAddressBooksForUser(); |
|
6d9380f96
|
67 68 69 70 |
foreach ($addressBooks as $addressBook) {
if ($addressBook->isActive()) {
\OCP\Contacts::registerAddressBook($addressBook->getSearchProvider());
}
|
|
d1bafeea1
|
71 72 |
} } |
|
6d9380f96
|
73 |