2011-08-06 20:32:06 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2012-02-14 00:47:18 +00: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 20:32:06 +00:00
|
|
|
*/
|
2012-04-17 17:31:29 +00:00
|
|
|
|
2011-08-06 20:32:06 +00:00
|
|
|
|
|
|
|
// Check if we are a user
|
2011-09-18 19:31:56 +00:00
|
|
|
OC_Util::checkLoggedIn();
|
2012-02-16 18:16:31 +00:00
|
|
|
OC_Util::checkAppEnabled('contacts');
|
|
|
|
|
2011-12-11 15:26:00 +00:00
|
|
|
// Get active address books. This creates a default one if none exists.
|
2012-05-01 16:50:31 +00:00
|
|
|
$ids = OC_Contacts_Addressbook::activeIds(OCP\USER::getUser());
|
2011-12-30 20:07:16 +00:00
|
|
|
$contacts = OC_Contacts_VCard::all($ids);
|
|
|
|
|
2012-05-01 16:50:31 +00:00
|
|
|
$addressbooks = OC_Contacts_Addressbook::active(OCP\USER::getUser());
|
2011-08-06 21:29:25 +00:00
|
|
|
|
2011-08-06 20:32:06 +00:00
|
|
|
// Load the files we need
|
|
|
|
OC_App::setActiveNavigationEntry( 'contacts_index' );
|
|
|
|
|
|
|
|
// Load a specific user?
|
|
|
|
$id = isset( $_GET['id'] ) ? $_GET['id'] : null;
|
2011-12-06 21:33:20 +00:00
|
|
|
$details = array();
|
2011-12-30 20:07:16 +00:00
|
|
|
|
2012-01-02 22:14:58 +00:00
|
|
|
if(is_null($id) && count($contacts) > 0) {
|
|
|
|
$id = $contacts[0]['id'];
|
2011-08-06 20:32:06 +00:00
|
|
|
}
|
2012-01-04 21:36:34 +00:00
|
|
|
if(!is_null($id)) {
|
|
|
|
$vcard = OC_Contacts_App::getContactVCard($id);
|
2012-02-14 00:47:18 +00:00
|
|
|
$details = OC_Contacts_VCard::structureContact($vcard);
|
2012-01-04 21:36:34 +00:00
|
|
|
}
|
2011-12-18 22:04:45 +00:00
|
|
|
$property_types = OC_Contacts_App::getAddPropertyOptions();
|
2011-12-06 21:31:04 +00:00
|
|
|
$phone_types = OC_Contacts_App::getTypesOfProperty('TEL');
|
2012-04-29 20:10:16 +00:00
|
|
|
$email_types = OC_Contacts_App::getTypesOfProperty('EMAIL');
|
2012-03-29 16:54:06 +00:00
|
|
|
$categories = OC_Contacts_App::getCategories();
|
2011-11-17 22:54:14 +00:00
|
|
|
|
2012-02-14 00:47:18 +00:00
|
|
|
$upload_max_filesize = OC_Helper::computerFileSize(ini_get('upload_max_filesize'));
|
|
|
|
$post_max_size = OC_Helper::computerFileSize(ini_get('post_max_size'));
|
|
|
|
$maxUploadFilesize = min($upload_max_filesize, $post_max_size);
|
|
|
|
|
|
|
|
$freeSpace=OC_Filesystem::free_space('/');
|
|
|
|
$freeSpace=max($freeSpace,0);
|
|
|
|
$maxUploadFilesize = min($maxUploadFilesize ,$freeSpace);
|
|
|
|
|
|
|
|
OC_Util::addScript('','jquery.multiselect');
|
2012-03-12 13:12:27 +00:00
|
|
|
OC_Util::addScript('','oc-vcategories');
|
2012-02-14 00:47:18 +00:00
|
|
|
OC_Util::addScript('contacts','contacts');
|
|
|
|
OC_Util::addScript('contacts','jquery.combobox');
|
|
|
|
OC_Util::addScript('contacts','jquery.inview');
|
|
|
|
OC_Util::addScript('contacts','jquery.Jcrop');
|
2012-03-07 20:50:55 +00:00
|
|
|
OC_Util::addScript('contacts','jquery.multi-autocomplete');
|
2012-05-01 07:49:22 +00:00
|
|
|
OCP\Util::addStyle('','jquery.multiselect');
|
|
|
|
OCP\Util::addStyle('contacts','jquery.combobox');
|
|
|
|
OCP\Util::addStyle('contacts','jquery.Jcrop');
|
|
|
|
OCP\Util::addStyle('contacts','contacts');
|
2012-02-14 00:47:18 +00:00
|
|
|
|
|
|
|
$tmpl = new OC_Template( "contacts", "index", "user" );
|
|
|
|
$tmpl->assign('uploadMaxFilesize', $maxUploadFilesize);
|
|
|
|
$tmpl->assign('uploadMaxHumanFilesize', OC_Helper::humanFileSize($maxUploadFilesize));
|
2012-04-12 20:38:09 +00:00
|
|
|
$tmpl->assign('property_types', $property_types);
|
|
|
|
$tmpl->assign('phone_types', $phone_types);
|
2012-04-29 20:10:16 +00:00
|
|
|
$tmpl->assign('email_types', $email_types);
|
2012-04-12 20:38:09 +00:00
|
|
|
$tmpl->assign('categories', $categories);
|
2011-08-06 21:29:25 +00:00
|
|
|
$tmpl->assign('addressbooks', $addressbooks);
|
2011-08-06 20:32:06 +00:00
|
|
|
$tmpl->assign('contacts', $contacts);
|
|
|
|
$tmpl->assign('details', $details );
|
|
|
|
$tmpl->assign('id',$id);
|
|
|
|
$tmpl->printPage();
|
2012-02-14 00:47:18 +00:00
|
|
|
|
|
|
|
?>
|