Blame view

sources/apps/contacts/lib/controller/pagecontroller.php 2.44 KB
d1bafeea1   Kload   [fix] Upgrade to ...
1
2
  <?php
  /**
6d9380f96   Cédric Dupont   Update sources OC...
3
4
5
   * @author Thomas Tanghus
   * @copyright 2013-2014 Thomas Tanghus (thomas@tanghus.net)
   *
d1bafeea1   Kload   [fix] Upgrade to ...
6
7
8
9
10
11
12
13
   * 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,
6d9380f96   Cédric Dupont   Update sources OC...
14
  	OCP\AppFramework\Controller,
d1bafeea1   Kload   [fix] Upgrade to ...
15
  	OCA\Contacts\Utils\Properties,
6d9380f96   Cédric Dupont   Update sources OC...
16
  	OCA\Contacts\ImportManager,
d1bafeea1   Kload   [fix] Upgrade to ...
17
18
19
20
21
22
23
24
25
26
27
28
29
  	OCP\AppFramework\Http\TemplateResponse;
  
  
  /**
   * Controller class for groups/categories
   */
  class PageController extends Controller {
  
  	/**
  	 * @NoAdminRequired
  	 * @NoCSRFRequired
  	 */
  	public function index() {
6d9380f96   Cédric Dupont   Update sources OC...
30
  		\OC::$server->getNavigationManager()->setActiveEntry($this->appName);
d1bafeea1   Kload   [fix] Upgrade to ...
31

6d9380f96   Cédric Dupont   Update sources OC...
32
33
34
35
36
  		$importManager = new ImportManager();
  		$imppTypes = Properties::getTypesForProperty('IMPP');
  		$adrTypes = Properties::getTypesForProperty('ADR');
  		$phoneTypes = Properties::getTypesForProperty('TEL');
  		$emailTypes = Properties::getTypesForProperty('EMAIL');
d1bafeea1   Kload   [fix] Upgrade to ...
37
  		$ims = Properties::getIMOptions();
6d9380f96   Cédric Dupont   Update sources OC...
38
  		$imProtocols = array();
d1bafeea1   Kload   [fix] Upgrade to ...
39
  		foreach($ims as $name => $values) {
6d9380f96   Cédric Dupont   Update sources OC...
40
  			$imProtocols[$name] = $values['displayname'];
d1bafeea1   Kload   [fix] Upgrade to ...
41
42
43
44
45
46
47
48
49
50
51
52
53
54
  		}
  
  		$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');
6d9380f96   Cédric Dupont   Update sources OC...
55
  		\OCP\Util::addScript('contacts', 'otherbackendconfig');
d1bafeea1   Kload   [fix] Upgrade to ...
56
57
  		\OCP\Util::addScript('files', 'jquery.fileupload');
  		\OCP\Util::addScript('3rdparty/Jcrop', 'jquery.Jcrop');
d1bafeea1   Kload   [fix] Upgrade to ...
58
59
60
61
62
  		\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');
6d9380f96   Cédric Dupont   Update sources OC...
63
  		$response = new TemplateResponse($this->appName, 'contacts');
d1bafeea1   Kload   [fix] Upgrade to ...
64
65
66
  		$response->setParams(array(
  			'uploadMaxFilesize' => $maxUploadFilesize,
  			'uploadMaxHumanFilesize' => \OCP\Util::humanFileSize($maxUploadFilesize),
6d9380f96   Cédric Dupont   Update sources OC...
67
68
69
70
71
72
  			'phoneTypes' => $phoneTypes,
  			'emailTypes' => $emailTypes,
  			'adrTypes' => $adrTypes,
  			'imppTypes' => $imppTypes,
  			'imProtocols' => $imProtocols,
  			'importManager' => $importManager,
d1bafeea1   Kload   [fix] Upgrade to ...
73
74
75
76
77
  		));
  
  		return $response;
  	}
  }