gunnar: server/patches/horde/framework-3.2-rc2 HK-GW-Fbview_xfb_concept_framework-3.2-rc2.patch, NONE, 1.1 HK-GW-Fix_Prefs_for_Ingo_framework-3.2-rc2.patch, NONE, 1.1
cvs at kolab.org
cvs at kolab.org
Wed Feb 20 18:35:17 CET 2008
Author: gunnar
Update of /kolabrepository/server/patches/horde/framework-3.2-rc2
In directory doto:/tmp/cvs-serv32120/framework-3.2-rc2
Added Files:
HK-GW-Fbview_xfb_concept_framework-3.2-rc2.patch
HK-GW-Fix_Prefs_for_Ingo_framework-3.2-rc2.patch
Log Message:
A first set of patches for Horde-3.2-rc2. Kronolith/Fbview has not yet been completed.
--- NEW FILE: HK-GW-Fbview_xfb_concept_framework-3.2-rc2.patch ---
diff -r 2c98314667d0 framework/Share/Share/kolab.php
--- a/framework/Share/Share/kolab.php Mon Feb 18 10:10:00 2008 +0100
+++ b/framework/Share/Share/kolab.php Mon Feb 18 10:10:51 2008 +0100
@@ -17,6 +17,13 @@ define('HORDE_ANNOT_SHARE_ATTR', HORDE_A
* Marks a share without a name. These shares are still invalid
*/
define('KOLAB_SHARE_INVALID', 'KOLAB_SHARE_INVALID');
+
+/**
+ * Kolab specific free/busy relevance
+ */
+define('KOLAB_FBRELEVANCE_ADMINS', 0);
+define('KOLAB_FBRELEVANCE_READERS', 1);
+define('KOLAB_FBRELEVANCE_NOBODY', 2);
/**
* Horde_Share_kolab:: provides the kolab backend for the horde share driver.
@@ -849,16 +856,135 @@ class Horde_Share_Object_kolab extends H
*/
function isDefault()
{
+ $type = $this->getType();
+ if (is_a($type, 'PEAR_Error')) {
+ return false;
+ }
+ return $type[1];
+ }
+
+ //FIXME: The following five functions (actually also most other things in this class
+ // needs to go into Kolab/IMAP.php
+ /**
+ * Get the folder type
+ *
+ * @return mixed Array containing the type and the default status or a PEAR_Error
+ * if the folder annotation cannot be accessed.
+ */
+ function getType()
+ {
$imap = &$this->_shareOb->getImap();
- $annotation = $imap->getAnnotation(KOLAB_ANNOT_FOLDER_TYPE, 'value.shared', $this->_folder);
+ $annotation = $imap->getAnnotation(KOLAB_ANNOT_FOLDER_TYPE,
+ 'value.shared',
+ $this->_folder);
if (is_a($annotation, 'PEAR_Error')) {
- return false;
- }
- if (empty($annotation)) {
- return false;
- }
- $type = explode('.', $annotation);
- return (!empty($type[1]) && $type[1] == 'default');
+ return $annotation;
+ }
+
+ if (!empty($annotation)) {
+ $default = false;
+ $subtype = '';
+ $type = explode('.', $annotation);
+ if (!empty($type[0])) {
+ $foldertype = $type[0];
+ if (!empty($type[1])) {
+ $subtype = $type[1];
+ if ($type[1] == 'default') {
+ $default = true;
+ }
+ }
+ }
+ return array($foldertype, $default, $subtype);
+ } else {
+ return PEAR::raiseError(sprintf(_("Unknown folder type for folder %s."), $this->_folder));
+ }
+ }
+
+ /**
+ * Get the free/busy relevance for this folder
+ *
+ * @return int Value containing the FB_RELEVANCE.
+ */
+ function getFbrelevance()
+ {
+ $imap = &$this->_shareOb->getImap();
+ $entry = KOLAB_ANNOT_ROOT . 'incidences-for';
+
+ $annotation = $imap->getAnnotation($entry, 'value.shared', $this->_folder);
+ if (is_a($annotation, 'PEAR_Error') || empty($annotation)) {
+ return KOLAB_FBRELEVANCE_ADMINS;
+ }
+ switch ($annotation) {
+ case 'admins':
+ return KOLAB_FBRELEVANCE_ADMINS;
+ case 'readers':
+ return KOLAB_FBRELEVANCE_READERS;
+ case 'nobody':
+ return KOLAB_FBRELEVANCE_NOBODY;
+ default:
+ return KOLAB_FBRELEVANCE_ADMINS;
+ }
+ }
+
+ /**
+ * Set the free/busy relevance for this folder
+ *
+ * @param int $relevance Value containing the FB_RELEVANCE
+ *
+ * @return mixed True on success or a PEAR_Error.
+ */
+ function setFbrelevance($relevance)
+ {
+ switch ($relevance) {
+ case KOLAB_FBRELEVANCE_ADMINS:
+ $value = 'admins';
+ break;
+ case KOLAB_FBRELEVANCE_READERS:
+ $value = 'readers';
+ break;
+ case KOLAB_FBRELEVANCE_NOBODY:
+ $value = 'nobody';
+ break;
+ default:
+ $value = 'admins';
+ }
+
+ $imap = &$this->_shareOb->getImap();
+ $entry = KOLAB_ANNOT_ROOT . 'incidences-for';
+ return $imap->setAnnotation($entry, array('value.shared' => $value), $this->_folder);
+ }
+
+ /**
+ * Get the extended free/busy access settings for this folder
+ *
+ * @return array Array containing the users with access to the
+ * extended information.
+ */
+ function getXfbaccess()
+ {
+ $imap = &$this->_shareOb->getImap();
+ $entry = KOLAB_ANNOT_ROOT . 'xfb-readable';
+
+ $annotation = $imap->getAnnotation($entry, 'value.shared', $this->_folder);
+ if (is_a($annotation, 'PEAR_Error') || empty($annotation)) {
+ return array();
+ }
+ return explode(' ', $annotation);
+ }
+
+ /**
+ * Set the extended free/busy access settings for this folder
+ *
+ * @param array $access Array containing the users with access to the
+ * extended information.
+ *
+ * @return mixed True on success or a PEAR_Error.
+ */
+ function setXfbaccess($access)
+ {
+ $imap = &$this->_shareOb->getImap();
+ $entry = KOLAB_ANNOT_ROOT . 'xfb-readable';
+ return $imap->setAnnotation($entry, array('value.shared' => join(' ', $access)), $this->_folder);
}
/**
@@ -934,13 +1060,18 @@ class Horde_Share_Object_kolab extends H
break;
case 'params':
- $params = $this->getAttribute('params');
+ $params = @unserialize($this->getAttribute('params'));
if (is_a($params, 'PEAR_Error') || $params == '') {
- $params = serialize(array('source' => 'kolab',
- 'default' => $this->get('default'),
- 'name' => $this->get('name')));
- }
- $this->data['params'] = $params;
+ $params = array('source' => 'kolab',
+ 'default' => $this->get('default'),
+ 'name' => $this->get('name'));
+ }
+ $type = $this->getType();
+ if (!is_a($type, 'PEAR_Error') && $type[0] == 'event') {
+ $params = array_merge($params, array('fbrelevance' => $this->getFbrelevance(),
+ 'xfbaccess' => $this->getXfbaccess()));
+ }
+ $this->data['params'] = serialize($params);
break;
case 'default':
@@ -991,8 +1122,9 @@ class Horde_Share_Object_kolab extends H
$value = unserialize($value);
if (isset($value['default'])) {
$this->data['default'] = $value['default'];
- }
- break;
+ unset($value['default']);
+ }
+ $value = serialize($value);
default:
$this->data[$attribute] = $value;
@@ -1041,6 +1173,7 @@ class Horde_Share_Object_kolab extends H
}
} elseif ($attribute == 'default') {
$imap = &$this->_shareOb->getImap();
+ //FIXME: Simplify with getType
$annotation = $imap->getAnnotation(KOLAB_ANNOT_FOLDER_TYPE, 'value.shared', $this->_folder);
if (is_a($annotation, 'PEAR_Error')) {
return $annotation;
@@ -1061,6 +1194,40 @@ class Horde_Share_Object_kolab extends H
continue;
} elseif ($attribute == 'folder') {
continue;
+ } elseif ($attribute == 'params') {
+ $type = $this->getType();
+ if (!is_a($type, 'PEAR_Error') && $type[0] == 'event') {
+ $params = @unserialize($value);
+ if (isset($params['fbrelevance'])) {
+ $result = $this->setFbrelevance($params['fbrelevance']);
+ if (is_a($result, 'PEAR_Error')) {
+ return $result;
+ }
+ unset($params['fbrelevance']);
+ }
+ if (isset($params['xfbaccess'])) {
+ $result = $this->setXfbaccess($params['xfbaccess']);
+ if (is_a($result, 'PEAR_Error')) {
+ return $result;
+ }
+ unset($params['xfbaccess']);
+ }
+
+ if (empty($params)) {
+ continue;
+ }
+
+ $value = @serialize($params);
+ }
+
+ $imap = &$this->_shareOb->getImap();
+ // setAnnotation apparently does not suppoort UTF-8 nor any special characters
+ $store = base64_encode($value);
+ $entry = HORDE_ANNOT_SHARE_ATTR . $attribute;
+ $result = $imap->setAnnotation($entry, array('value.shared' => $store), $this->_folder);
+ if (is_a($result, 'PEAR_Error')) {
+ return $result;
+ }
} else {
$imap = &$this->_shareOb->getImap();
// setAnnotation apparently does not suppoort UTF-8 nor any special characters
--- NEW FILE: HK-GW-Fix_Prefs_for_Ingo_framework-3.2-rc2.patch ---
This patch is required if you want to use Ingo with the Kolab server.
diff -r 56b552eb6b01 framework/Prefs/Prefs/kolab.php
--- a/framework/Prefs/Prefs/kolab.php Wed Nov 28 17:00:34 2007 +0100
+++ b/framework/Prefs/Prefs/kolab.php Wed Nov 28 17:04:21 2007 +0100
@@ -1,5 +1,6 @@
<?php
+require_once 'Horde/Auth.php';
require_once 'Horde/Prefs/ldap.php';
require_once 'Horde/Kolab.php';
@@ -38,6 +39,8 @@ class Prefs_kolab extends Prefs_ldap {
'version' => '3',
'basedn' => $GLOBALS['conf']['kolab']['ldap']['basedn'],
'fetchdn' => true,
+ 'username' => Auth::getAuth(),
+ 'password' => Auth::getCredential('password'),
'searchdn' => $GLOBALS['conf']['kolab']['ldap']['phpdn'],
'searchpass' => $GLOBALS['conf']['kolab']['ldap']['phppw'],
'uid' => array('mail', 'uid'));
More information about the commits
mailing list