public function listOwners();
/**
+ * Return the list of default folders.
+ *
+ * @return array An array with owners as keys and another array as
+ * value. The second array associates type (key) with the
+ * corresponding default folder (value).
+ */
+ public function listDefaults();
+
+ /**
* Get the default folder for a certain type.
*
* @param string $type The type of the share/folder.
}
/**
+ * Return the list of personal default folders.
+ *
+ * @return array An array that associates type (key) with the corresponding
+ * default folder name (value).
+ */
+ public function listPersonalDefaults()
+ {
+ $result = array();
+ $namespace = $this->_list->getNamespace();
+ foreach ($this->listFolderTypeAnnotations() as $folder => $annotation) {
+ if ($annotation->isDefault()
+ && ($namespace->matchNamespace($folder)->getType()
+ == Horde_Kolab_Storage_Folder_Namespace::PERSONAL)) {
+ $result[$annotation->getType()] = $folder;
+ }
+ }
+ return $result;
+ }
+
+ /**
+ * Return the list of default folders.
+ *
+ * @return array An array with owners as keys and another array as
+ * value. The second array associates type (key) with the
+ * corresponding default folder (value).
+ */
+ public function listDefaults()
+ {
+ $result = array();
+ $namespace = $this->_list->getNamespace();
+ foreach ($this->listFolderTypeAnnotations() as $folder => $annotation) {
+ if ($annotation->isDefault()) {
+ $result[$namespace->getOwner($folder)][$annotation->getType()] = $folder;
+ }
+ }
+ return $result;
+ }
+
+ /**
* Get the default folder for a certain type.
*
* @param string $type The type of the share/folder.
}
/**
+ * Return the list of personal default folders.
+ *
+ * @return array An array that associates type (key) with the corresponding
+ * default folder name (value).
+ */
+ public function listPersonalDefaults()
+ {
+ return $this->_list_cache->getQuery(self::PERSONAL_DEFAULTS);
+ }
+
+ /**
+ * Return the list of default folders.
+ *
+ * @return array An array with owners as keys and another array as
+ * value. The second array associates type (key) with the
+ * corresponding default folder (value).
+ */
+ public function listDefaults()
+ {
+ return $this->_list_cache->getQuery(self::DEFAULTS);
+ }
+
+ /**
* Get the default folder for a certain type.
*
* @param string $type The type of the share/folder.
$query = $factory->createListQuery('Base', $this->getDoubleEventList($factory));
$query->getForeignDefault('someone@example.com', 'event');
}
+
+ public function testListPersonalDefaults()
+ {
+ $factory = new Horde_Kolab_Storage_Factory();
+ $query = $factory->createListQuery('Base', $this->getAnnotatedList($factory));
+ $this->assertEquals(
+ array(
+ 'contact' => 'INBOX/Contacts',
+ 'event' => 'INBOX/Calendar',
+ 'note' => 'INBOX/Notes',
+ 'task' => 'INBOX/Tasks'
+ ),
+ $query->listPersonalDefaults()
+ );
+ }
+
+ public function testListDefaults()
+ {
+ $factory = new Horde_Kolab_Storage_Factory();
+ $query = $factory->createListQuery('Base', $this->getForeignDefaultList($factory));
+ $this->assertEquals(
+ array(
+ 'example@example.com' => array(
+ 'event' => 'user/example/Calendar'
+ ),
+ 'someone@example.com' => array(
+ 'event' => 'user/someone/Calendars/Events'
+ )
+ ),
+ $query->listDefaults()
+ );
+ }
}
$query = $this->getCachedQueryForList($this->getDoubleEventList($factory), $factory);
$query->getForeignDefault('someone@example.com', 'event');
}
+
+ public function testListPersonalDefaults()
+ {
+ $factory = new Horde_Kolab_Storage_Factory();
+ $query = $this->getCachedQueryForList($this->getAnnotatedList($factory), $factory);
+ $this->assertEquals(
+ array(
+ 'contact' => 'INBOX/Contacts',
+ 'event' => 'INBOX/Calendar',
+ 'note' => 'INBOX/Notes',
+ 'task' => 'INBOX/Tasks'
+ ),
+ $query->listPersonalDefaults()
+ );
+ }
+
+ public function testListDefaults()
+ {
+ $factory = new Horde_Kolab_Storage_Factory();
+ $query = $this->getCachedQueryForList($this->getForeignDefaultList($factory), $factory);
+ $this->assertEquals(
+ array(
+ 'example@example.com' => array(
+ 'event' => 'user/example/Calendar'
+ ),
+ 'someone@example.com' => array(
+ 'event' => 'user/someone/Calendars/Events'
+ )
+ ),
+ $query->listDefaults()
+ );
+ }
}