Blame view

sources/apps/contacts/lib/controller/pagecontroller.php 2.42 KB
d1bafeea1   Kload   [fix] Upgrade to ...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
  <?php
  /**
   * Copyright (c) 2012, 2013 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.
   */
  
  namespace OCA\Contacts\Controller;
  
  use OCA\Contacts\App,
  	OCA\Contacts\Controller,
  	OCA\Contacts\Utils\Properties,
  	OCP\AppFramework\Http\TemplateResponse;
  
  
  /**
   * Controller class for groups/categories
   */
  class PageController extends Controller {
  
  	/**
  	 * @NoAdminRequired
  	 * @NoCSRFRequired
  	 */
  	public function index() {
  		\OC::$server->getNavigationManager()->setActiveEntry('contacts');
  
  		$impp_types = Properties::getTypesForProperty('IMPP');
  		$adr_types = Properties::getTypesForProperty('ADR');
  		$phone_types = Properties::getTypesForProperty('TEL');
  		$email_types = Properties::getTypesForProperty('EMAIL');
  		$ims = Properties::getIMOptions();
  		$im_protocols = array();
  		foreach($ims as $name => $values) {
  			$im_protocols[$name] = $values['displayname'];
  		}
  
  		$maxUploadFilesize = \OCP\Util::maxUploadFilesize('/');
  
  		\OCP\Util::addScript('', 'jquery.multiselect');
  		\OCP\Util::addScript('', 'tags');
  		\OCP\Util::addScript('contacts', 'jquery.combobox');
  		\OCP\Util::addScript('contacts', 'modernizr.custom');
  		\OCP\Util::addScript('contacts', 'app');
  		\OCP\Util::addScript('contacts', 'addressbooks');
  		\OCP\Util::addScript('contacts', 'contacts');
  		\OCP\Util::addScript('contacts', 'storage');
  		\OCP\Util::addScript('contacts', 'groups');
  		\OCP\Util::addScript('contacts', 'jquery.ocaddnew');
  		\OCP\Util::addScript('files', 'jquery.fileupload');
  		\OCP\Util::addScript('3rdparty/Jcrop', 'jquery.Jcrop');
  		\OCP\Util::addStyle('3rdparty/fontawesome', 'font-awesome');
  		\OCP\Util::addStyle('contacts', 'font-awesome');
  		\OCP\Util::addStyle('', 'jquery.multiselect');
  		\OCP\Util::addStyle('contacts', 'jquery.combobox');
  		\OCP\Util::addStyle('contacts', 'jquery.ocaddnew');
  		\OCP\Util::addStyle('3rdparty/Jcrop', 'jquery.Jcrop');
  		\OCP\Util::addStyle('contacts', 'contacts');
  
  		$response = new TemplateResponse('contacts', 'contacts');
  		$response->setParams(array(
  			'uploadMaxFilesize' => $maxUploadFilesize,
  			'uploadMaxHumanFilesize' => \OCP\Util::humanFileSize($maxUploadFilesize),
  			'phone_types' => $phone_types,
  			'email_types' => $email_types,
  			'adr_types' => $adr_types,
  			'impp_types' => $impp_types,
  			'im_protocols' => $im_protocols,
  		));
  
  		return $response;
  	}
  }