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 OCA\Contacts\App,
|
2014-04-07 22:29:15 +02:00
|
|
|
OCP\AppFramework\Controller,
|
2013-10-17 02:10:34 +02:00
|
|
|
OCA\Contacts\Utils\Properties,
|
2014-05-09 13:39:17 +02:00
|
|
|
OCA\Contacts\ImportManager,
|
2013-10-17 02:10:34 +02:00
|
|
|
OCP\AppFramework\Http\TemplateResponse;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Controller class for groups/categories
|
|
|
|
*/
|
|
|
|
class PageController extends Controller {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @NoAdminRequired
|
|
|
|
* @NoCSRFRequired
|
|
|
|
*/
|
|
|
|
public function index() {
|
2014-04-07 22:29:15 +02:00
|
|
|
\OC::$server->getNavigationManager()->setActiveEntry($this->appName);
|
2013-10-17 02:10:34 +02:00
|
|
|
|
2014-05-09 13:39:17 +02:00
|
|
|
$importManager = new ImportManager();
|
2014-03-18 00:58:01 +01:00
|
|
|
$imppTypes = Properties::getTypesForProperty('IMPP');
|
|
|
|
$adrTypes = Properties::getTypesForProperty('ADR');
|
|
|
|
$phoneTypes = Properties::getTypesForProperty('TEL');
|
|
|
|
$emailTypes = Properties::getTypesForProperty('EMAIL');
|
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 = \OCP\Util::maxUploadFilesize('/');
|
|
|
|
|
2014-04-07 22:29:15 +02:00
|
|
|
$response = new TemplateResponse($this->appName, 'contacts');
|
2013-10-17 02:10:34 +02:00
|
|
|
$response->setParams(array(
|
|
|
|
'uploadMaxFilesize' => $maxUploadFilesize,
|
|
|
|
'uploadMaxHumanFilesize' => \OCP\Util::humanFileSize($maxUploadFilesize),
|
2014-03-18 00:58:01 +01:00
|
|
|
'phoneTypes' => $phoneTypes,
|
|
|
|
'emailTypes' => $emailTypes,
|
|
|
|
'adrTypes' => $adrTypes,
|
|
|
|
'imppTypes' => $imppTypes,
|
|
|
|
'imProtocols' => $imProtocols,
|
2014-05-09 13:39:17 +02:00
|
|
|
'importManager' => $importManager,
|
2013-10-17 02:10:34 +02:00
|
|
|
));
|
|
|
|
|
|
|
|
return $response;
|
|
|
|
}
|
|
|
|
}
|