gunnar: server/patches/horde/3.2-rc3/framework HK-GW-Fbview_xfb_concept_framework-3.2-rc3.patch, NONE, 1.1 HK-GW-Fix_Prefs_for_Ingo_framework-3.2-rc3.patch, NONE, 1.1 HK-GW-Kolab_history_driver_framework-3.2-rc3.patch, NONE, 1.1 HK-GW-Kolab_syncml_driver_framework-3.2-rc3.patch, NONE, 1.1

cvs at kolab.org cvs at kolab.org
Thu Mar 13 16:37:27 CET 2008


Author: gunnar

Update of /kolabrepository/server/patches/horde/3.2-rc3/framework
In directory doto:/tmp/cvs-serv17251/framework

Added Files:
	HK-GW-Fbview_xfb_concept_framework-3.2-rc3.patch 
	HK-GW-Fix_Prefs_for_Ingo_framework-3.2-rc3.patch 
	HK-GW-Kolab_history_driver_framework-3.2-rc3.patch 
	HK-GW-Kolab_syncml_driver_framework-3.2-rc3.patch 
Log Message:
Horde patches for horde-3.2-rc3

--- NEW FILE: HK-GW-Fbview_xfb_concept_framework-3.2-rc3.patch ---
diff -r 7d4ae482d6a2 framework/Share/Share/kolab.php
--- a/framework/Share/Share/kolab.php	Thu Mar 13 07:16:33 2008 +0100
+++ b/framework/Share/Share/kolab.php	Thu Mar 13 07:16:38 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.
@@ -894,16 +901,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);
     }
 
     /**
@@ -982,6 +1108,13 @@ class Horde_Share_Object_kolab extends H
             $default = array('source' => 'kolab',
                              'default' => $this->get('default'),
                              'name' => $this->get('name'));
+            $type = $this->getType();
+            if (!is_a($type, 'PEAR_Error') && $type[0] == 'event') {
+                $default = array_merge($default, array(
+                                           'fbrelevance' => $this->getFbrelevance(),
+                                           'xfbaccess'   => $this->getXfbaccess()
+                                       ));
+            }
             if (is_a($params, 'PEAR_Error') || $params == '') {
                 $params = $default;
             }
@@ -1036,8 +1169,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;
@@ -1086,6 +1220,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;
@@ -1106,6 +1241,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-rc3.patch ---
A dumb patch to fix the preference system for Ingo. Ingo probably needs a new Kolab driver to circumvent this problem in a correct fashion.

diff -r 007f8b011552 framework/Prefs/Prefs/kolab.php
--- a/framework/Prefs/Prefs/kolab.php	Fri Mar 07 07:10:21 2008 +0100
+++ b/framework/Prefs/Prefs/kolab.php	Fri Mar 07 07:10:25 2008 +0100
@@ -1,5 +1,6 @@
 <?php
 
+require_once 'Horde/Auth.php';
 require_once 'Horde/Prefs/ldap.php';
 require_once 'Horde/Kolab.php';
 
@@ -42,7 +43,8 @@ class Prefs_kolab extends Prefs_ldap {
                         'searchpw' => $GLOBALS['conf']['kolab']['ldap']['phppw'],
                         'uid' => 'mail');
 
-        parent::Prefs_ldap($user, $password, $scope, $params, $caching);
+        parent::Prefs_ldap(Auth::getAuth(), Auth::getCredential('password'),
+                           $scope, $params, $caching);
     }
 
 }

--- NEW FILE: HK-GW-Kolab_history_driver_framework-3.2-rc3.patch ---
diff -r c394053eccb5 framework/History/History.php
--- a/framework/History/History.php	Thu Mar 13 07:13:48 2008 +0100
+++ b/framework/History/History.php	Thu Mar 13 07:14:22 2008 +0100
@@ -1,7 +1,7 @@
 <?php
 /**
  * The History:: class provides a method of tracking changes in Horde
- * objects, stored in a SQL table.
+ * objects.
  *
  * $Horde: framework/History/History.php,v 1.58 2008/01/02 11:11:59 jan Exp $
  *
@@ -17,86 +17,49 @@ class Horde_History {
 class Horde_History {
 
     /**
-     * Pointer to a DB instance to manage the history.
-     *
-     * @var DB
[...1235 lines suppressed...]
@@ -56,6 +56,7 @@ communication between a Horde client and
     <dir name="XML">
      <file name="contact.php" role="php" />
      <file name="event.php" role="php" />
+     <file name="history.php" role="php" />
      <file name="task.php" role="php" />
      <file name="note.php" role="php" />
      <file name="prefs.php" role="php" />
diff -r c394053eccb5 framework/Share/Share/kolab.php
--- a/framework/Share/Share/kolab.php	Thu Mar 13 07:13:48 2008 +0100
+++ b/framework/Share/Share/kolab.php	Thu Mar 13 07:14:22 2008 +0100
@@ -605,6 +605,8 @@ class Horde_Share_kolab extends Horde_Sh
             return _("Calendar");
         case 'nag':
             return _("Tasks");
+        case 'history':
+            return _("History");
         case 'ingo':
             return _("Filters");
         case 'prefs':

--- NEW FILE: HK-GW-Kolab_syncml_driver_framework-3.2-rc3.patch ---
diff -r be3dbc9fb8b3 framework/Kolab/Kolab.php
--- a/framework/Kolab/Kolab.php	Thu Mar 13 10:04:59 2008 +0100
+++ b/framework/Kolab/Kolab.php	Thu Mar 13 10:15:22 2008 +0100
@@ -742,6 +742,14 @@ class Kolab {
                 'default_share_name'    => _("%s's History"),
             );
 
+        case 'syncml':
+            return array(
+                'mime_type_suffix'      => 'syncml',
+                'default_folder_name'   => _("SyncML"),
+                'share_name'            => _("sync db"),
+                'default_share_name'    => _("%s's SyncML db"),
+            );
+
         default:
             return PEAR::raiseError(sprintf(_("The Horde/Kolab integration engine does not support \"%s\""), $app));
         }
diff -r be3dbc9fb8b3 framework/Kolab/Kolab/XML/syncml.php
[...1532 lines suppressed...]
+        $dt->remove($this->_user, true);
+
+        print "OK\n";
+    }
+
+}
diff -r be3dbc9fb8b3 framework/SyncML/package.xml
--- a/framework/SyncML/package.xml	Thu Mar 13 10:04:59 2008 +0100
+++ b/framework/SyncML/package.xml	Thu Mar 13 10:15:22 2008 +0100
@@ -62,6 +62,10 @@ http://pear.php.net/dtd/package-2.0.xsd"
     </dir> <!-- /SyncML/Device -->
     <dir name="Backend">
      <file name="Horde.php" role="php" />
+     <dir name="Horde">
+       <file name="kolab.php" role="php" />
+       <file name="sql.php" role="php" />
+     </dir> <!-- /SyncML/Backend/Horde -->
      <file name="Sql.php" role="php" />
     </dir> <!-- /SyncML/Backend -->
     <file name="Backend.php" role="php" />





More information about the commits mailing list