2011-08-06 22:32:06 +02:00
|
|
|
<?php
|
|
|
|
/**
|
2012-02-14 01:47:18 +01:00
|
|
|
* Copyright (c) 2012 Thomas Tanghus <thomas@tanghus.net>
|
|
|
|
* Copyright (c) 2011 Jakob Sack mail@jakobsack.de
|
|
|
|
* This file is licensed under the Affero General Public License version 3 or
|
|
|
|
* later.
|
|
|
|
* See the COPYING-README file.
|
2011-08-06 22:32:06 +02:00
|
|
|
*/
|
2012-04-17 19:31:29 +02:00
|
|
|
|
2011-08-06 22:32:06 +02:00
|
|
|
|
|
|
|
// Check if we are a user
|
2012-05-01 22:59:38 +02:00
|
|
|
OCP\User::checkLoggedIn();
|
2012-05-02 19:08:37 +02:00
|
|
|
OCP\App::checkAppEnabled('contacts');
|
2012-02-16 19:16:31 +01:00
|
|
|
|
2011-12-11 16:26:00 +01:00
|
|
|
// Get active address books. This creates a default one if none exists.
|
2012-10-25 03:34:12 +02:00
|
|
|
$ids = OCA\Contacts\Addressbook::activeIds(OCP\USER::getUser());
|
2011-08-06 23:29:25 +02:00
|
|
|
|
2011-08-06 22:32:06 +02:00
|
|
|
// Load the files we need
|
2012-07-20 17:09:03 +02:00
|
|
|
OCP\App::setActiveNavigationEntry('contacts_index');
|
2011-08-06 22:32:06 +02:00
|
|
|
|
2012-10-25 03:34:12 +02:00
|
|
|
$impp_types = OCA\Contacts\App::getTypesOfProperty('IMPP');
|
|
|
|
$adr_types = OCA\Contacts\App::getTypesOfProperty('ADR');
|
|
|
|
$phone_types = OCA\Contacts\App::getTypesOfProperty('TEL');
|
|
|
|
$email_types = OCA\Contacts\App::getTypesOfProperty('EMAIL');
|
|
|
|
$ims = OCA\Contacts\App::getIMOptions();
|
2012-08-22 18:50:50 +02:00
|
|
|
$im_protocols = array();
|
|
|
|
foreach($ims as $name => $values) {
|
|
|
|
$im_protocols[$name] = $values['displayname'];
|
|
|
|
}
|
2012-10-25 03:34:12 +02:00
|
|
|
$categories = OCA\Contacts\App::getCategories();
|
2011-11-17 23:54:14 +01:00
|
|
|
|
2012-05-02 00:20:45 +02:00
|
|
|
$upload_max_filesize = OCP\Util::computerFileSize(ini_get('upload_max_filesize'));
|
|
|
|
$post_max_size = OCP\Util::computerFileSize(ini_get('post_max_size'));
|
2012-02-14 01:47:18 +01:00
|
|
|
$maxUploadFilesize = min($upload_max_filesize, $post_max_size);
|
|
|
|
|
2012-10-10 13:18:05 +02:00
|
|
|
$freeSpace=\OC\Files\Filesystem::free_space('/');
|
2012-07-20 17:09:03 +02:00
|
|
|
$freeSpace=max($freeSpace, 0);
|
|
|
|
$maxUploadFilesize = min($maxUploadFilesize, $freeSpace);
|
|
|
|
|
2012-12-07 16:21:59 +01:00
|
|
|
OCP\Util::addscript('contacts', 'multiselect');
|
2013-01-16 13:34:30 +01:00
|
|
|
OCP\Util::addscript('', 'jquery.multiselect');
|
2012-07-20 17:09:03 +02:00
|
|
|
OCP\Util::addscript('', 'oc-vcategories');
|
2012-12-17 22:42:57 +01:00
|
|
|
OCP\Util::addscript('contacts', 'modernizr.custom');
|
2012-09-17 16:15:31 +02:00
|
|
|
OCP\Util::addscript('contacts', 'app');
|
2012-07-20 17:09:03 +02:00
|
|
|
OCP\Util::addscript('contacts', 'contacts');
|
2013-01-02 02:17:51 +01:00
|
|
|
OCP\Util::addscript('contacts', 'groups');
|
2012-07-20 17:09:03 +02:00
|
|
|
OCP\Util::addscript('contacts', 'expanding');
|
|
|
|
OCP\Util::addscript('contacts', 'jquery.combobox');
|
2012-07-15 04:15:57 +02:00
|
|
|
OCP\Util::addscript('files', 'jquery.fileupload');
|
2012-07-20 17:09:03 +02:00
|
|
|
OCP\Util::addscript('contacts', 'jquery.Jcrop');
|
2012-12-07 16:21:59 +01:00
|
|
|
OCP\Util::addStyle('contacts', 'multiselect');
|
2013-01-16 13:34:30 +01:00
|
|
|
OCP\Util::addStyle('', 'jquery.multiselect');
|
2012-07-20 17:09:03 +02:00
|
|
|
OCP\Util::addStyle('contacts', 'jquery.combobox');
|
|
|
|
OCP\Util::addStyle('contacts', 'jquery.Jcrop');
|
|
|
|
OCP\Util::addStyle('contacts', 'contacts');
|
2012-02-14 01:47:18 +01:00
|
|
|
|
2012-09-17 16:15:31 +02:00
|
|
|
$tmpl = new OCP\Template( "contacts", "contacts", "user" );
|
2012-07-09 19:34:10 +02:00
|
|
|
$tmpl->assign('uploadMaxFilesize', $maxUploadFilesize, false);
|
2012-08-21 06:22:33 +02:00
|
|
|
$tmpl->assign('uploadMaxHumanFilesize',
|
2012-07-20 17:09:03 +02:00
|
|
|
OCP\Util::humanFileSize($maxUploadFilesize), false);
|
2012-11-15 03:51:46 +01:00
|
|
|
$tmpl->assign('addressbooks', OCA\Contacts\Addressbook::all(OCP\USER::getUser()), false);
|
2012-07-09 19:34:10 +02:00
|
|
|
$tmpl->assign('phone_types', $phone_types, false);
|
|
|
|
$tmpl->assign('email_types', $email_types, false);
|
2012-09-17 16:15:31 +02:00
|
|
|
$tmpl->assign('adr_types', $adr_types, false);
|
2012-08-22 18:50:50 +02:00
|
|
|
$tmpl->assign('impp_types', $impp_types, false);
|
2012-07-09 19:34:10 +02:00
|
|
|
$tmpl->assign('categories', $categories, false);
|
2012-08-22 18:50:50 +02:00
|
|
|
$tmpl->assign('im_protocols', $im_protocols, false);
|
2012-10-10 13:18:05 +02:00
|
|
|
$tmpl->printPage();
|