/** * Create a new folder. * * @param string $folder The path of the folder to create. * @param string $type An optional type for the folder. * * @return NULL */ public function createFolder($folder, $type = null) { $this->_driver->create($folder); if ($type) { $this->_driver->setAnnotation($folder, Horde_Kolab_Storage_List_Query_List::ANNOTATION_FOLDER_TYPE, $type); } foreach ($this->_listeners as $listener) { $listener->updateAfterCreateFolder($folder, $type); } }
/** * Set the specified folder as default for its current type. * * @param string $folder The folder name. */ public function setDefault($folder) { $types = $this->listTypes(); if (!isset($types[$folder])) { throw new Horde_Kolab_Storage_List_Exception(sprintf("The folder %s has no Kolab type. It cannot be marked as 'default' folder!", $folder)); } $previous = $this->getDefault($types[$folder]); if ($previous) { $this->_driver->setAnnotation($previous, self::ANNOTATION_FOLDER_TYPE, $types[$folder]); } $this->_driver->setAnnotation($folder, self::ANNOTATION_FOLDER_TYPE, $types[$folder] . '.default'); }
/** * Set the specified folder as default for its current type. * * @param array $folder The folder data. * @param string|boolean $previous The previous default folder or false if there was none. */ public function setDefault($folder, $previous = false) { if (!$this->_cache->hasNamespace()) { // Cache not synchronized yet. return; } if ($folder['namespace'] !== Horde_Kolab_Storage_Folder_Namespace::PERSONAL) { throw new Horde_Kolab_Storage_List_Exception(sprintf("Unable to mark %s as a default folder. It is not within your personal namespace!", $folder['folder'])); } $annotations = $this->_cache->getFolderTypes(); if (!isset($annotations[$folder['folder']])) { throw new Horde_Kolab_Storage_List_Exception(sprintf("The folder %s has no Kolab type. It cannot be marked as 'default' folder!", $folder['folder'])); } if ($previous) { $this->_driver->setAnnotation($previous, Horde_Kolab_Storage_List_Query_List::ANNOTATION_FOLDER_TYPE, $folder['type']); $annotations[$previous] = $folder['type']; } $this->_driver->setAnnotation($folder['folder'], Horde_Kolab_Storage_List_Query_List::ANNOTATION_FOLDER_TYPE, $folder['type'] . '.default'); $annotations[$folder['folder']] = $folder['type'] . '.default'; $folder_list = $this->_cache->getFolders(); $namespace = unserialize($this->_cache->getNamespace()); $this->_synchronize($namespace, $folder_list, $annotations); }
/** * Sets the annotation on a folder. * * @param string $folder The name of the folder. * @param string $annotation The annotation to set. * @param array $value The values to set * * @return NULL */ public function setAnnotation($folder, $annotation, $value) { $this->_driver->setAnnotation($folder, $annotation, $value); }
/** * Set the share parameters. * * @param string $folder The folder name. * @param array $parameters The share parameters. * * @return string The encoded share parameters. */ public function setParameters($folder, array $parameters) { $this->_driver->setAnnotation($folder, self::ANNOTATION_SHARE_PARAMETERS, base64_encode(serialize($parameters))); }
/** * Set the active sync settings. * * @param string $folder The folder name. * @param array $data The active sync settings. * * @return string The encoded share parameters. */ public function setActiveSync($folder, array $data) { $this->_driver->setAnnotation($folder, self::ANNOTATION_ACTIVE_SYNC, base64_encode(json_encode($data))); }