1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2025-01-23 12:52:17 +01:00

83 lines
2.3 KiB
PHP
Raw Normal View History

2013-10-17 02:10:34 +02:00
<?php
/**
2014-01-26 00:40:22 +01:00
* @author Thomas Tanghus
* @copyright 2013-2014 Thomas Tanghus (thomas@tanghus.net)
*
2013-10-17 02:10:34 +02:00
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
namespace OCA\Contacts\Controller;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IRequest;
use OCA\Contacts\Utils\Properties;
use OCA\Contacts\ImportManager;
use OCA\Contacts\Factory\UtilFactory;
2013-10-17 02:10:34 +02:00
/**
* Controller class for groups/categories
*/
class PageController extends Controller {
/** @var ImportManager */
private $importManager;
/** @var UtilFactory */
private $utilFactory;
/**
* @param string $AppName
* @param IRequest $request
* @param ImportManager $importManager
* @param UtilFactory $utilFactory
*/
public function __construct($AppName,
IRequest $request,
ImportManager $importManager,
UtilFactory $utilFactory){
parent::__construct($AppName, $request);
$this->importManager = $importManager;
$this->utilFactory = $utilFactory;
}
2013-10-17 02:10:34 +02:00
/**
* @NoAdminRequired
* @NoCSRFRequired
*/
public function index() {
2014-03-18 00:58:01 +01:00
$imppTypes = Properties::getTypesForProperty('IMPP');
$adrTypes = Properties::getTypesForProperty('ADR');
$phoneTypes = Properties::getTypesForProperty('TEL');
$emailTypes = Properties::getTypesForProperty('EMAIL');
$cloudTypes = Properties::getTypesForProperty('CLOUD');
2013-10-17 02:10:34 +02:00
$ims = Properties::getIMOptions();
2014-03-18 00:58:01 +01:00
$imProtocols = array();
2013-10-17 02:10:34 +02:00
foreach($ims as $name => $values) {
2014-03-18 00:58:01 +01:00
$imProtocols[$name] = $values['displayname'];
2013-10-17 02:10:34 +02:00
}
$maxUploadFilesize = $this->utilFactory->maxUploadFilesize('/');
2013-10-17 02:10:34 +02:00
\OCP\Util::addScript('placeholder', null);
\OCP\Util::addScript('../vendor/blueimp-md5/js/md5', null);
\OCP\Util::addScript('jquery.avatar', null);
\OCP\Util::addScript('avatar', null);
$response = new TemplateResponse($this->appName, 'contacts');
$response->setParams([
2013-10-17 02:10:34 +02:00
'uploadMaxFilesize' => $maxUploadFilesize,
'uploadMaxHumanFilesize' => $this->utilFactory->humanFileSize($maxUploadFilesize),
2014-03-18 00:58:01 +01:00
'phoneTypes' => $phoneTypes,
'emailTypes' => $emailTypes,
'cloudTypes' => $cloudTypes,
2014-03-18 00:58:01 +01:00
'adrTypes' => $adrTypes,
'imppTypes' => $imppTypes,
'imProtocols' => $imProtocols,
'importManager' => $this->importManager,
]);
2013-10-17 02:10:34 +02:00
return $response;
}
}