Esempio n. 1
0
	/**
	 * @NoAdminRequired
	 * @NoCSRFRequired
	 */
	public function index() {
		\OC::$server->getNavigationManager()->setActiveEntry($this->appName);

		$importManager = new ImportManager();
		$imppTypes = Properties::getTypesForProperty('IMPP');
		$adrTypes = Properties::getTypesForProperty('ADR');
		$phoneTypes = Properties::getTypesForProperty('TEL');
		$emailTypes = Properties::getTypesForProperty('EMAIL');
		$ims = Properties::getIMOptions();
		$imProtocols = array();
		foreach($ims as $name => $values) {
			$imProtocols[$name] = $values['displayname'];
		}

		$maxUploadFilesize = \OCP\Util::maxUploadFilesize('/');

		$response = new TemplateResponse($this->appName, 'contacts');
		$response->setParams(array(
			'uploadMaxFilesize' => $maxUploadFilesize,
			'uploadMaxHumanFilesize' => \OCP\Util::humanFileSize($maxUploadFilesize),
			'phoneTypes' => $phoneTypes,
			'emailTypes' => $emailTypes,
			'adrTypes' => $adrTypes,
			'imppTypes' => $imppTypes,
			'imProtocols' => $imProtocols,
			'importManager' => $importManager,
		));

		return $response;
	}
 /**
  * @NoAdminRequired
  * @NoCSRFRequired
  */
 public function index()
 {
     $imppTypes = Properties::getTypesForProperty('IMPP');
     $adrTypes = Properties::getTypesForProperty('ADR');
     $phoneTypes = Properties::getTypesForProperty('TEL');
     $emailTypes = Properties::getTypesForProperty('EMAIL');
     $cloudTypes = Properties::getTypesForProperty('CLOUD');
     $ims = Properties::getIMOptions();
     $imProtocols = array();
     foreach ($ims as $name => $values) {
         $imProtocols[$name] = $values['displayname'];
     }
     $maxUploadFilesize = $this->utilFactory->maxUploadFilesize('/');
     \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(['uploadMaxFilesize' => $maxUploadFilesize, 'uploadMaxHumanFilesize' => $this->utilFactory->humanFileSize($maxUploadFilesize), 'phoneTypes' => $phoneTypes, 'emailTypes' => $emailTypes, 'cloudTypes' => $cloudTypes, 'adrTypes' => $adrTypes, 'imppTypes' => $imppTypes, 'imProtocols' => $imProtocols, 'importManager' => $this->importManager]);
     return $response;
 }
Esempio n. 3
0
 /**
  * @NoAdminRequired
  * @NoCSRFRequired
  */
 public function index()
 {
     \OC::$server->getNavigationManager()->setActiveEntry($this->appName);
     $importManager = new ImportManager();
     $imppTypes = Properties::getTypesForProperty('IMPP');
     $adrTypes = Properties::getTypesForProperty('ADR');
     $phoneTypes = Properties::getTypesForProperty('TEL');
     $emailTypes = Properties::getTypesForProperty('EMAIL');
     $ims = Properties::getIMOptions();
     $imProtocols = array();
     foreach ($ims as $name => $values) {
         $imProtocols[$name] = $values['displayname'];
     }
     $maxUploadFilesize = \OCP\Util::maxUploadFilesize('/');
     \OCP\Util::addScript('', 'jquery.multiselect');
     \OCP\Util::addScript('', 'tags');
     \OCP\Util::addScript('placeholder');
     \OCP\Util::addScript('3rdparty', 'md5/md5.min');
     \OCP\Util::addScript('jquery.avatar');
     \OCP\Util::addScript('avatar');
     \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('contacts', 'otherbackendconfig');
     \OCP\Util::addScript('files', 'jquery.fileupload');
     \OCP\Util::addScript('3rdparty/Jcrop', 'jquery.Jcrop');
     \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($this->appName, 'contacts');
     $response->setParams(array('uploadMaxFilesize' => $maxUploadFilesize, 'uploadMaxHumanFilesize' => \OCP\Util::humanFileSize($maxUploadFilesize), 'phoneTypes' => $phoneTypes, 'emailTypes' => $emailTypes, 'adrTypes' => $adrTypes, 'imppTypes' => $imppTypes, 'imProtocols' => $imProtocols, 'importManager' => $importManager));
     return $response;
 }
Esempio n. 4
0
 /**
  * Set a property by the checksum of its serialized value
  * It is up to the caller to call ->save()
  *
  * @param string $checksum An 8 char m5d checksum.
  * @param string $name Property name
  * @param mixed $value
  * @param array $parameters
  * @throws @see getPropertyByChecksum
  * @return string new checksum
  */
 public function setPropertyByChecksum($checksum, $name, $value, $parameters = array())
 {
     if ($checksum === 'new') {
         $property = Property::create($name);
         $this->add($property);
     } else {
         $property = $this->getPropertyByChecksum($checksum);
     }
     switch ($name) {
         case 'EMAIL':
             $value = strtolower($value);
             $property->setValue($value);
             break;
         case 'ADR':
             if (is_array($value)) {
                 $property->setParts($value);
             } else {
                 $property->setValue($value);
             }
             break;
         case 'IMPP':
             if (is_null($parameters) || !isset($parameters['X-SERVICE-TYPE'])) {
                 throw new \InvalidArgumentException(self::$l10n->t(' Missing IM parameter for: ') . $name . ' ' . $value, 412);
             }
             $serviceType = $parameters['X-SERVICE-TYPE'];
             if (is_array($serviceType)) {
                 $serviceType = $serviceType[0];
             }
             $impp = Utils\Properties::getIMOptions($serviceType);
             if (is_null($impp)) {
                 throw new \UnexpectedValueException(self::$l10n->t('Unknown IM: ') . $serviceType, 415);
             }
             $value = $impp['protocol'] . ':' . $value;
             $property->setValue($value);
             break;
         default:
             \OCP\Util::writeLog('contacts', __METHOD__ . ' adding: ' . $name . ' ' . $value, \OCP\Util::DEBUG);
             $property->setValue($value);
             break;
     }
     $this->setParameters($property, $parameters, true);
     $this->setSaved(false);
     return substr(md5($property->serialize()), 0, 8);
 }