1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @author Thomas Tanghus |
4
|
|
|
* @copyright 2013-2014 Thomas Tanghus ([email protected]) |
5
|
|
|
* |
6
|
|
|
* This file is licensed under the Affero General Public License version 3 or |
7
|
|
|
* later. |
8
|
|
|
* See the COPYING-README file. |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace OCA\Contacts\Controller; |
12
|
|
|
|
13
|
|
|
use OCP\AppFramework\Controller; |
14
|
|
|
use OCP\AppFramework\Http\TemplateResponse; |
15
|
|
|
use OCP\IRequest; |
16
|
|
|
use OCA\Contacts\Utils\Properties; |
17
|
|
|
use OCA\Contacts\ImportManager; |
18
|
|
|
use OCA\Contacts\Factory\UtilFactory; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Controller class for groups/categories |
22
|
|
|
*/ |
23
|
|
|
class PageController extends Controller { |
24
|
|
|
/** @var ImportManager */ |
25
|
|
|
private $importManager; |
26
|
|
|
/** @var UtilFactory */ |
27
|
|
|
private $utilFactory; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @param string $AppName |
31
|
|
|
* @param IRequest $request |
32
|
|
|
* @param ImportManager $importManager |
33
|
|
|
* @param UtilFactory $utilFactory |
34
|
|
|
*/ |
35
|
1 |
|
public function __construct($AppName, |
|
|
|
|
36
|
|
|
IRequest $request, |
37
|
|
|
ImportManager $importManager, |
38
|
|
|
UtilFactory $utilFactory){ |
39
|
1 |
|
parent::__construct($AppName, $request); |
40
|
1 |
|
$this->importManager = $importManager; |
41
|
1 |
|
$this->utilFactory = $utilFactory; |
42
|
1 |
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @NoAdminRequired |
46
|
|
|
* @NoCSRFRequired |
47
|
|
|
*/ |
48
|
1 |
|
public function index() { |
49
|
1 |
|
$imppTypes = Properties::getTypesForProperty('IMPP'); |
50
|
1 |
|
$adrTypes = Properties::getTypesForProperty('ADR'); |
51
|
1 |
|
$phoneTypes = Properties::getTypesForProperty('TEL'); |
52
|
1 |
|
$emailTypes = Properties::getTypesForProperty('EMAIL'); |
53
|
1 |
|
$cloudTypes = Properties::getTypesForProperty('CLOUD'); |
54
|
1 |
|
$ims = Properties::getIMOptions(); |
55
|
1 |
|
$imProtocols = array(); |
56
|
1 |
|
foreach($ims as $name => $values) { |
57
|
1 |
|
$imProtocols[$name] = $values['displayname']; |
58
|
1 |
|
} |
59
|
|
|
|
60
|
1 |
|
$maxUploadFilesize = $this->utilFactory->maxUploadFilesize('/'); |
61
|
|
|
|
62
|
1 |
|
\OCP\Util::addScript('placeholder', null); |
63
|
1 |
|
\OCP\Util::addScript('../vendor/blueimp-md5/js/md5', null); |
64
|
1 |
|
\OCP\Util::addScript('jquery.avatar', null); |
65
|
1 |
|
\OCP\Util::addScript('avatar', null); |
66
|
|
|
|
67
|
1 |
|
$response = new TemplateResponse($this->appName, 'contacts'); |
68
|
1 |
|
$response->setParams([ |
69
|
1 |
|
'uploadMaxFilesize' => $maxUploadFilesize, |
70
|
1 |
|
'uploadMaxHumanFilesize' => $this->utilFactory->humanFileSize($maxUploadFilesize), |
71
|
1 |
|
'phoneTypes' => $phoneTypes, |
72
|
1 |
|
'emailTypes' => $emailTypes, |
73
|
1 |
|
'cloudTypes' => $cloudTypes, |
74
|
1 |
|
'adrTypes' => $adrTypes, |
75
|
1 |
|
'imppTypes' => $imppTypes, |
76
|
1 |
|
'imProtocols' => $imProtocols, |
77
|
1 |
|
'importManager' => $this->importManager, |
78
|
1 |
|
]); |
79
|
|
|
|
80
|
1 |
|
return $response; |
81
|
|
|
} |
82
|
|
|
} |
83
|
|
|
|
This check marks parameter names that have not been written in camelCase.
In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes
databaseConnectionString
.