gunnar: server/patches/horde/3.2-rc3/kronolith HK-GW-Config_kronolith-3.2-rc3.patch, NONE, 1.1 HK-GW-Fbview_relevance_kronolith-3.2-rc3.patch, NONE, 1.1 HK-GW-Fbview_xfb_access_kronolith-3.2-rc3.patch, NONE, 1.1 HK-GW-SyncML_support_kronolith-3.2-rc3.patch, NONE, 1.1 HK-GW-bug_6031_merged_kronolith-3.2-rc3.patch, NONE, 1.1 HK-GW-getid_kronolith-3.2-rc3.patch, NONE, 1.1 HK-GW-notice_fix_kronolith-3.2-rc3.patch, NONE, 1.1 HK-SB-Fbview_extra_params_kronolith-3.2-rc3.patch, NONE, 1.1 HK-SB-Fbview_save_attendees_kronolith-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/kronolith
In directory doto:/tmp/cvs-serv17251/kronolith

Added Files:
	HK-GW-Config_kronolith-3.2-rc3.patch 
	HK-GW-Fbview_relevance_kronolith-3.2-rc3.patch 
	HK-GW-Fbview_xfb_access_kronolith-3.2-rc3.patch 
	HK-GW-SyncML_support_kronolith-3.2-rc3.patch 
	HK-GW-bug_6031_merged_kronolith-3.2-rc3.patch 
	HK-GW-getid_kronolith-3.2-rc3.patch 
	HK-GW-notice_fix_kronolith-3.2-rc3.patch 
	HK-SB-Fbview_extra_params_kronolith-3.2-rc3.patch 
	HK-SB-Fbview_save_attendees_kronolith-3.2-rc3.patch 
Log Message:
Horde patches for horde-3.2-rc3

--- NEW FILE: HK-GW-Config_kronolith-3.2-rc3.patch ---
diff -r 676351b87557 kronolith/config/conf.php
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kronolith/config/conf.php	Thu Mar 13 14:18:48 2008 +0100
@@ -0,0 +1,20 @@
+<?php
+/* CONFIG START. DO NOT CHANGE ANYTHING IN OR AFTER THIS LINE. */
+// $Horde: kronolith/config/conf.xml,v 1.14.10.5 2007/12/20 14:12:23 jan Exp $
+$conf['calendar']['driver'] = 'kolab';
+$conf['storage']['default_domain'] = '';
+$conf['storage']['freebusy']['protocol'] = 'https';
+$conf['storage']['freebusy']['port'] = 443;
+$conf['storage']['driver'] = 'kolab';
+$conf['metadata']['keywords'] = false;
+$conf['reminder']['server_name'] = '';
+$conf['reminder']['from_addr'] = '';
+$conf['autoshare']['shareperms'] = 'none';
+$conf['holidays']['enable'] = true;
+$conf['menu']['print'] = true;
+$conf['menu']['import_export'] = true;
+$conf['menu']['apps'] = array();
+/* CONFIG END. DO NOT CHANGE ANYTHING IN OR BEFORE THIS LINE. */
+if (file_exists(dirname(__FILE__) . '/kolab.php')) {
+  require_once(dirname(__FILE__) . '/kolab.php');
+}
diff -r 676351b87557 kronolith/config/kolab.php
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kronolith/config/kolab.php	Thu Mar 13 14:18:48 2008 +0100
@@ -0,0 +1,5 @@
+<?php
+$conf['storage']['default_domain'] = '@@@postfix-mydomain@@@';
+$conf['reminder']['server_name'] = '@@@fqdnhostname@@@';
+$conf['reminder']['from_addr'] = 'postmaster@@@@postfix-mydomain@@@';
+?>

--- NEW FILE: HK-GW-Fbview_relevance_kronolith-3.2-rc3.patch ---
Allows to set the free/busy relevance on a calendar.

diff -r e6be25b82291 fbview-kronolith/calendars/edit.php
--- a/kronolith/calendars/edit.php	Thu Feb 21 11:55:42 2008 +0100
+++ b/kronolith/calendars/edit.php	Thu Feb 21 12:22:33 2008 +0100
@@ -53,6 +53,10 @@ if ($form->validate($vars)) {
 
 $vars->set('name', $calendar->get('name'));
 $vars->set('description', $calendar->get('desc'));
+$params = @unserialize($calendar->get('params'));
+if (isset($params['fbrelevance'])) {
+    $vars->set('fbrelevance', $params['fbrelevance']);
+}
 $title = $form->getTitle();
 require KRONOLITH_TEMPLATES . '/common-header.inc';
 require KRONOLITH_TEMPLATES . '/menu.inc';
diff -r e6be25b82291 fbview-kronolith/lib/Forms/CreateCalendar.php
--- a/kronolith/lib/Forms/CreateCalendar.php	Thu Feb 21 11:55:42 2008 +0100
+++ b/kronolith/lib/Forms/CreateCalendar.php	Thu Feb 21 12:22:33 2008 +0100
@@ -35,6 +35,9 @@ class Kronolith_CreateCalendarForm exten
 
         $this->addVariable(_("Name"), 'name', 'text', true);
         $this->addVariable(_("Description"), 'description', 'longtext', false, false, null, array(4, 60));
+        $this->addVariable(_("Relevance"), 'fbrelevance', 'radio', false, false, null, 
+                           array(array('owners/administrators', 'readers', 'no one'), 
+                                 'This calendar is only included into the free/busy data for ...'));
 
         $this->setButtons(array(_("Create")));
     }
@@ -48,6 +51,7 @@ class Kronolith_CreateCalendarForm exten
         }
         $calendar->set('name', $this->_vars->get('name'));
         $calendar->set('desc', $this->_vars->get('description'));
+        $calendar->set('params', serialize(array('fbrelevance' => (int) $this->_vars->get('fbrelevance', 0))));
         return $GLOBALS['kronolith_shares']->addShare($calendar);
     }
 
diff -r e6be25b82291 fbview-kronolith/lib/Forms/EditCalendar.php
--- a/kronolith/lib/Forms/EditCalendar.php	Thu Feb 21 11:55:42 2008 +0100
+++ b/kronolith/lib/Forms/EditCalendar.php	Thu Feb 21 12:22:34 2008 +0100
@@ -42,6 +42,9 @@ class Kronolith_EditCalendarForm extends
         $this->addHidden('', 'c', 'text', true);
         $this->addVariable(_("Name"), 'name', 'text', true);
         $this->addVariable(_("Description"), 'description', 'longtext', false, false, null, array(4, 60));
+        $this->addVariable(_("Relevance"), 'fbrelevance', 'radio', false, false, null, 
+                           array(array('owners/administrators', 'readers', 'no one'), 
+                                 'This calendar is only included into the free/busy data for ...'));
 
         $this->setButtons(array(_("Save")));
     }
@@ -51,6 +54,7 @@ class Kronolith_EditCalendarForm extends
         $original_name = $this->_calendar->get('name');
         $this->_calendar->set('name', $this->_vars->get('name'));
         $this->_calendar->set('desc', $this->_vars->get('description'));
+        $this->_calendar->set('params', serialize(array('fbrelevance' => (int) $this->_vars->get('fbrelevance', 0))));
 
         if ($original_name != $this->_vars->get('name')) {
             $result = $GLOBALS['kronolith_driver']->rename($original_name, $this->_vars->get('name'));

--- NEW FILE: HK-GW-Fbview_xfb_access_kronolith-3.2-rc3.patch ---
diff -r 14457cf2ea2c kronolith/perms.php
--- a/kronolith/perms.php	Thu Nov 29 15:20:49 2007 +0100
+++ b/kronolith/perms.php	Thu Nov 29 15:25:36 2007 +0100
@@ -15,6 +15,34 @@ require_once KRONOLITH_BASE . '/lib/base
 require_once KRONOLITH_BASE . '/lib/base.php';
 require_once 'Horde/Group.php';
 
+function &getFbperms($share) 
+{
+    $fbperms = array();
+    $params = $share->get('params');
+    if (!is_a($params, 'PEAR_Error')) {
+        $params = @unserialize($params);
+        if (isset($params['xfbaccess'])) {
+            $xfbusers = $params['xfbaccess'];
+            foreach ($xfbusers as $user) {
+                $fbperms[$user] = PERMS_READ;
+            }
+        }
+    }
+    return $fbperms;
+}
+
+function setFbperms($share, $xfbusers)
+{
+    $fbperms = array();
+    $params = $share->get('params');
+    if (!is_a($params, 'PEAR_Error')) {
+        $params = @unserialize($params);
+        $params['xfbaccess'] = $xfbusers;
+        $params = serialize($params);
+        $share->set('params', $params);
+    }
+}
+
 $shares = &Horde_Share::singleton('kronolith');
 $groups = &Group::singleton();
 $auth = &Auth::singleton($conf['auth']['driver']);
@@ -36,6 +64,8 @@ case 'edit':
         $notification->push($share, 'horde.error');
     } elseif (isset($share) && Auth::getAuth() != $share->get('owner')) {
         exit('permission denied');
+    } else {
+        $fbperms = getFbperms($share);
     }
     break;
 
@@ -251,6 +281,24 @@ case 'editform':
             }
         }
 
+        // Process free/busy permissions.
+        $fb_names = Util::getFormData('fb_names');
+        $fb_read = Util::getFormData('fb_read');
+
+        $fbperms = getFbperms($share);
+        foreach ($fb_names as $key => $user) {
+            if (empty($user)) {
+                continue;
+            }
+
+            if (!empty($fb_read[$key])) {
+                $fbperms[$user] = PERMS_READ;
+            } else {
+                unset($fbperms[$user]);
+            }
+        }
+        setFbperms($share, array_keys($fbperms));
+
         $share->setPermission($perm, false);
         $share->save();
         $notification->push(sprintf(_("Updated \"%s\"."), $share->get('name')), 'horde.success');
diff -r 14457cf2ea2c kronolith/templates/perms/perms.inc
--- a/kronolith/templates/perms/perms.inc	Thu Nov 29 15:20:49 2007 +0100
+++ b/kronolith/templates/perms/perms.inc	Thu Nov 29 15:25:36 2007 +0100
@@ -355,6 +355,61 @@
   <td> </td>
 </tr>
 
+<!-- Extended free/busy Permissions -->
+<tr valign="middle">
+  <td class="header leftAlign">
+    <?php echo Horde::img('user.png', '', '', $registry->getImageDir('horde')) . ' ' . _("Extended free/busy access") ?>
+  </td>
+  <td class="header" align="center"> </td>
+  <td class="header" align="center"><?php echo _("Read") ?></td>
+  <td class="header" align="center"> </td>
+  <td class="header" align="center"> </td>
+  <td class="header" align="center"> </td>
+  <td class="header"> </td>
+</tr>
+<?php foreach ($fbperms as $user => $fbperm) { if ($user != $owner) { ?>
+<tr>
+  <td class="light"><?php echo htmlspecialchars(Auth::removeHook($user)) ?><input type="hidden" name="fb_names[<?php echo htmlspecialchars($user) ?>]" value="<?php echo htmlspecialchars($user) ?>" /></td>
+  <td align="center"> </td>
+  <td align="center">
+    <input type="checkbox" id="fb_read_<?php echo str_replace('@', '_', htmlspecialchars($user)) ?>" name="fb_read[<?php echo htmlspecialchars($user) ?>]"<?php echo ($fbperm & PERMS_READ) ? ' checked="checked"' : '' ?> />
+    <label for="fb_read_<?php echo str_replace('@', '_', htmlspecialchars($user)) ?>" class="hidden"><?php echo _("Read") ?></label>
+  </td>
+  <td align="center"> </td>
+  <td align="center"> </td>
+  <td align="center"> </td>
+  <td> </td>
+</tr>
+<?php } } ?>
+<!-- New extended free/busy row -->
+<tr>
+<?php if ($auth->hasCapability('list')): ?>
+  <td class="light">
+    <label for="fb_names_new" class="hidden"><?php echo _("Select a user to add:") ?></label>
+    <select id="fb_names_new" name="fb_names[||new]">
+      <option value=""><?php echo _("Select a user to add:") ?></option>
+    <?php foreach ($userList as $user) { if (!isset($userperms[$user])) { ?>
+      <option value="<?php echo htmlspecialchars($user) ?>"><?php echo htmlspecialchars(Auth::removeHook($user)) ?></option>
+    <?php } } ?>
+    </select>
+  </td>
+<?php else: ?>
+  <td class="light">
+    <label for="fb_names_new" class="hidden"><?php echo _("User to add:") ?></label>
+    <input type="text" id="fb_names_new" name="fb_names[||new]" />
+  </td>
+<?php endif; ?>
+  <td align="center"> </td>
+  <td align="center">
+    <input type="checkbox" id="fb_read_new" name="fb_read[||new]" />
+    <label for="fb_read_new" class="hidden"><?php echo _("Read") ?></label>
+  </td>
+  <td align="center"> </td>
+  <td align="center"> </td>
+  <td align="center"> </td>
+  <td> </td>
+</tr>
+
 <tr>
  <td colspan="7"> </td>
 </tr>

--- NEW FILE: HK-GW-SyncML_support_kronolith-3.2-rc3.patch ---
diff -r 172b6872dafc kronolith/lib/Driver/kolab.php
--- a/kronolith/lib/Driver/kolab.php	Thu Mar 13 13:27:27 2008 +0100
+++ b/kronolith/lib/Driver/kolab.php	Thu Mar 13 13:27:34 2008 +0100
@@ -437,18 +437,13 @@ class Kronolith_Driver_kolab_wrapper_old
 
         $edit = false;
         if ($event->isStored() || $event->exists()) {
-            $uid = $event->getUID();
-
-            $result = $this->_kolab->loadObject($uid);
-            //No error check here, already done in exists()
-
+            $uid = $event->getId();
             $edit = true;
         } else {
-            if ($event->getUID()) {
-                $uid = $event->getUID();
+            if ($event->getId()) {
+                $uid = $event->getId();
             } else {
                 $uid = md5(uniqid(mt_rand(), true));
-                $event->setUID($uid);
                 $event->setId($uid);
             }
 
@@ -975,6 +970,36 @@ class Kronolith_Driver_kolab_wrapper_new
         $this->_synchronized = false;
     }
 
+    /**
+     * Split the unique id into calendar and id.
+     *
+     * @param string $uid  The global UID for a event.
+     *
+     * @return array An array holding the calendar and the id within
+     *               that calendar.
+     */
+    function _splitUID($uid)
+    {
+        if (!$uid) {
+            return array(null, null);
+        }
+
+        $split = split('@', $uid, 3);
+        if (count($split) == 3) {
+            $calendar = $split[0];
+            $id = $split[1];
+        } else if (count($split) == 2) {
+            $calendar = Auth::getAuth();
+            $id = $split[0];
+        } else {
+            /* Hm, this should not happen */
+            Horde::logMessage(sprintf(_("Invalid uid %s"), $uid), __FILE__, __LINE__, PEAR_LOG_ERR);
+            $calendar = Auth::getAuth();
+            $id = $uid;
+        }
+        return array($id, $calendar);
+    }
+
     // We delay initial synchronization to the first use
     // so multiple calendars don't add to the total latency.
     // This function must be called before all internal driver functions
@@ -1069,13 +1094,21 @@ class Kronolith_Driver_kolab_wrapper_new
             return PEAR::raiseError(sprintf("Kolab::exists called for calendar %s. Currently active is %s.", $calendar_id, $this->_driver->_calendar));
         }
 
+        list($id, $calendar) = $this->_splitUID($uid);
+
+        // Log error if someone uses this function in an unsupported way
+        if ($calendar != $this->_driver->_calendar) {
+            Horde::logMessage(sprintf("Kolab::exists called for calendar %s. Currently active is %s.", $calendar, $this->_driver->_calendar), __FILE__, __LINE__, PEAR_LOG_ERR);
+            return PEAR::raiseError(sprintf("Kolab::exists called for calendar %s. Currently active is %s.", $calendar, $this->_driver->_calendar));
+        }
+
         $result = $this->synchronize();
         if (is_a($result, 'PEAR_Error')) {
             return $result;
         }
 
-        if ($this->_store->objectUidExists($uid)) {
-            return $uid;
+        if ($this->_store->objectUidExists($id)) {
+            return $id;
         }
 
         return false;
@@ -1141,7 +1174,7 @@ class Kronolith_Driver_kolab_wrapper_new
             }
 
             if ($keep_event) {
-                $ids[$event->getUID()] = $event->getUID();
+                $ids[$event->getUID()] = $event->getId();
             }
         }
 
@@ -1169,18 +1202,14 @@ class Kronolith_Driver_kolab_wrapper_new
 
     function &getByUID($uid, $getAll = false)
     {
-        $ownerCalendars = array_keys(Kronolith::listCalendars(true, PERMS_READ));
+        list($id, $calendar) = $this->_splitUID($uid);
 
-        foreach ($ownerCalendars as $calendar) {
-            $this->_driver->open($calendar);
-            $this->synchronize();
+        $this->_driver->open($calendar);
+        $this->synchronize();
 
-            if (!array_key_exists($uid, $this->_events_cache)) {
-                continue;
-            }
-
+        if (array_key_exists($id, $this->_events_cache)) {
             // Ok, found event
-            $event = &$this->_events_cache[$uid];
+            $event = &$this->_events_cache[$id];
 
             if ($getAll) {
                 $events = array();
@@ -1209,9 +1238,9 @@ class Kronolith_Driver_kolab_wrapper_new
             return $result;
         }
 
-        $uid = $event->getUID();
+        $uid = $event->getId();
         if ($uid == null) {
-            $event->setUID($this->_store->generateUID());
+            $event->setId($this->_store->generateUID());
         }
 
         $attributes = $event->toDriver();
@@ -1219,12 +1248,19 @@ class Kronolith_Driver_kolab_wrapper_new
         $stored_uid = null;
         if ($event->isStored() || $event->exists()) {
             $stored_uid = $attributes['uid'];
+            $action = array('action' => 'modify');
+        } else {
+            $action = array('action' => 'add');
         }
 
         $result = $this->_store->save($attributes, $stored_uid);
         if (is_a($result, 'PEAR_Error')) {
             return $result;
         }
+
+        /* Log the creation/modification of this item in the history log. */
+        $history = &Horde_History::singleton();
+        $history->log('kronolith:' . $event->getCalendar() . ':' . $event->getUID(), $action, true);
 
         // refresh IMAP cache
         $this->synchronize(true);
@@ -1233,7 +1269,7 @@ class Kronolith_Driver_kolab_wrapper_new
             Kolab::triggerFreeBusyUpdate($this->_store->parseFolder($this->_driver->_calendar));
         }
 
-        return $event->getUID();
+        return $event->getId();
     }
 
     /**
@@ -1332,6 +1368,10 @@ class Kronolith_Driver_kolab_wrapper_new
                 Horde::logMessage($result, __FILE__, __LINE__, PEAR_LOG_ERR);
             }
 
+            /* Log the deletion of this item in the history log. */
+            $history = &Horde_History::singleton();
+            $history->log('kronolith:' . $event->getCalendar() . ':' . $event->getUID(), array('action' => 'delete'), true);
+
             if (is_callable('Kolab', 'triggerFreeBusyUpdate')) {
                 Kolab::triggerFreeBusyUpdate($this->_store->parseFolder($this->_driver->_calendar));
             }
@@ -1351,10 +1391,61 @@ class Kronolith_Driver_kolab_wrapper_new
  */
 class Kronolith_Event_kolab_new extends Kronolith_Event {
 
+    /**
+     * Returns the global UID for this event.
+     *
+     * @return string  The global UID for this event.
+     */
+    function getUID()
+    {
+      if (!$this->eventID) {
+            return null;
+        }
+        
+        if ($this->_calendar == Auth::getAuth()) {
+            return $this->eventID . '@' . $GLOBALS['conf']['server']['name'];
+        }
+        return $this->eventID . '@' . $this->_calendar . '@' . $GLOBALS['conf']['server']['name'];
+    }
+
+    /**
+     * Sets the global UID for this event. For the Kolab backend it is
+     * suboptimal if the UID gets set as we rather generate the UID
+     * based on the ID. But we'll try to support is as much as
+     * possible.
+     *
+     * @param string $uid  The global UID for this event.
+     */
+    function setUID($uid)
+    {
+        if (!$uid) {
+            $this->_uid = null;
+            $this->eventID = null;
+            return;
+        }
+
+        $split = split('@', $uid, 3);
+        if (count($split) == 3) {
+            $this->_uid = $uid;
+            $this->eventID = $split[1];
+            $this->_calendar = $split[0];
+        } else if (count($split) == 2) {
+            $this->_uid = $uid;
+            $this->eventID = $split[0];
+            $this->_calendar = Auth::getAuth();
+        } else {
+            /* Hm, this should not happen */
+            Horde::logMessage(sprintf(_("Invalid uid %s"), $uid), __FILE__, __LINE__, PEAR_LOG_ERR);
+            $this->_uid = $uid;
+            $this->eventID = $uid;
+            $this->_calendar = Auth::getAuth();
+        }
+    }
+
     function fromDriver($event)
     {
         $this->eventID = $event['uid'];
-        $this->setUID($this->eventID);
+        $this->_uid = $this->getUID();
 
         if (isset($event['summary'])) {
             $this->title = $event['summary'];
@@ -1472,7 +1563,7 @@ class Kronolith_Event_kolab_new extends 
     function toDriver()
     {
         $event = array();
-        $event['uid'] = $this->getUID();
+        $event['uid'] = $this->getId();
         $event['summary'] = $this->title;
         $event['body']  = $this->description;
         $event['location'] = $this->location;
@@ -1485,7 +1576,7 @@ class Kronolith_Event_kolab_new extends 
         }
 
         // Only set organizer if this is a new event
-        if ($this->getID() == null) {
+        if (!$this->exists()) {
             $organizer = array(
                             'display-name' => Kronolith::getUserName($this->getCreatorId()),
                             'smtp-address' => Kronolith::getUserEmail($this->getCreatorId())

--- NEW FILE: HK-GW-bug_6031_merged_kronolith-3.2-rc3.patch ---
diff -r 7070ff26ec97 kronolith/lib/Driver/kolab.php
--- a/kronolith/lib/Driver/kolab.php	Wed Mar 12 08:28:13 2008 +0100
+++ b/kronolith/lib/Driver/kolab.php	Wed Mar 12 14:41:10 2008 +0100
@@ -1156,11 +1156,20 @@ class Kronolith_Driver_kolab_wrapper_new
             /* do recurrence expansion if not keeping anyway */
             if (!$keep_event && $event->recurs()) {
                 $next = $event->recurrence->nextRecurrence($startDate);
-                if ($next !== false && 
-                    !$event->recurrence->hasException($next->year, $next->month, $next->mday) &&
-                    (!(($endDate->compareDateTime($event->start) < 0) || 
-                       ($startDate->compareDateTime($event->end) > 0)))) {
-                    $keep_event = true;
+                while ($next !== false && 
+                       $event->recurrence->hasException($next->year, $next->month, $next->mday)) {
+                    $next->mday++;
+                    $next = $event->recurrence->nextRecurrence($next);
+                }
+
+                if ($next !== false) {
+                    $duration = $next->timestamp() - $event->start->timestamp();
+                    $next_end = &new Horde_Date($event->end->timestamp() + $duration);
+
+                    if ((!(($endDate->compareDateTime($next) < 0) || 
+                           ($startDate->compareDateTime($next_end) > 0)))) {
+                        $keep_event = true;
+                    }
                 }
             }
 

--- NEW FILE: HK-GW-getid_kronolith-3.2-rc3.patch ---
diff -r 8e1e82288f58 kronolith/delete.php
--- a/kronolith/delete.php	Thu Mar 06 11:09:17 2008 +0100
+++ b/kronolith/delete.php	Thu Mar 06 11:13:53 2008 +0100
@@ -56,7 +56,7 @@ if ($eventID = Util::getFormData('eventI
         if (!$event->recurs() ||
             Util::getFormData('all') ||
             !$event->recurrence->hasActiveRecurrence()) {
-            $result = $kronolith_driver->deleteEvent($event->getID());
+            $result = $kronolith_driver->deleteEvent($event->getId());
             if (is_a($result, 'PEAR_Error')) {
                 $notification->push($result, 'horde.error');
             }
diff -r 8e1e82288f58 kronolith/lib/Driver/holidays.php
--- a/kronolith/lib/Driver/holidays.php	Thu Mar 06 11:09:17 2008 +0100
+++ b/kronolith/lib/Driver/holidays.php	Thu Mar 06 11:13:53 2008 +0100
@@ -177,7 +177,7 @@ class Kronolith_Event_holidays extends K
         $this->stored = true;
         $this->initialized = true;
         $this->setTitle(String::convertCharset($dhEvent->getTitle(), 'iso-8859-1'));
-        $this->setID($dhEvent->getInternalName());
+        $this->setId($dhEvent->getInternalName());
 
         $this->start = new Horde_Date($dhEvent->_date->getTime());
         $this->end = new Horde_Date($this->start);
diff -r 8e1e82288f58 kronolith/lib/Driver/sql.php
--- a/kronolith/lib/Driver/sql.php	Thu Mar 06 11:09:17 2008 +0100
+++ b/kronolith/lib/Driver/sql.php	Thu Mar 06 11:13:53 2008 +0100
@@ -805,7 +805,7 @@ class Kronolith_Driver_sql extends Krono
                     return $event;
                 }
 
-                $this->deleteEvent($event->getID());
+                $this->deleteEvent($event->getId());
             }
         }
         return true;
diff -r 8e1e82288f58 kronolith/lib/api.php
--- a/kronolith/lib/api.php	Thu Mar 06 11:09:17 2008 +0100
+++ b/kronolith/lib/api.php	Thu Mar 06 11:13:53 2008 +0100
@@ -921,7 +921,7 @@ function _kronolith_delete($uid)
         return PEAR::raiseError(_("Permission Denied"));
     }
 
-    return $kronolith_driver->deleteEvent($event->getID());
+    return $kronolith_driver->deleteEvent($event->getId());
 }
 
 /**
diff -r 8e1e82288f58 kronolith/templates/delete/one.inc
--- a/kronolith/templates/delete/one.inc	Thu Mar 06 11:09:17 2008 +0100
+++ b/kronolith/templates/delete/one.inc	Thu Mar 06 11:13:53 2008 +0100
@@ -11,7 +11,7 @@ if (empty($url)) {
 <input type="hidden" name="month" value="<?php if (isset($month)) echo htmlspecialchars($month) ?>" />
 <input type="hidden" name="mday" value="<?php if (isset($day)) echo htmlspecialchars($day) ?>" />
 <input type="hidden" name="url" value="<?php echo htmlspecialchars($url) ?>" />
-<input type="hidden" name="eventID" value="<?php echo htmlspecialchars($this->event->getID()) ?>" />
+<input type="hidden" name="eventID" value="<?php echo htmlspecialchars($this->event->getId()) ?>" />
 <input type="hidden" name="calendar" value="<?php echo htmlspecialchars(Util::getFormData('calendar')) ?>" />
 
 <div class="headerbox">
diff -r 8e1e82288f58 kronolith/templates/edit/edit.inc
--- a/kronolith/templates/edit/edit.inc	Thu Mar 06 11:09:17 2008 +0100
+++ b/kronolith/templates/edit/edit.inc	Thu Mar 06 11:13:53 2008 +0100
@@ -10,7 +10,7 @@
 <input type="hidden" name="url" value="<?php echo htmlspecialchars($url) ?>" />
 <?php endif; ?>
 <?php if ($event->isInitialized() && !$event->isRemote()): ?>
-<input type="hidden" name="eventID" value="<?php echo htmlspecialchars($event->getID()) ?>" />
+<input type="hidden" name="eventID" value="<?php echo htmlspecialchars($event->getId()) ?>" />
 <input type="hidden" name="existingcalendar" value="<?php echo htmlspecialchars($event->getCalendar()) ?>" />
 <?php endif; ?>
 <?php if (!$showCalSelect): ?>

--- NEW FILE: HK-GW-notice_fix_kronolith-3.2-rc3.patch ---
diff -r fe6b81992192 kronolith/lib/Driver/kolab.php
--- a/kronolith/lib/Driver/kolab.php	Wed Mar 05 08:41:51 2008 +0100
+++ b/kronolith/lib/Driver/kolab.php	Wed Mar 05 08:44:50 2008 +0100
@@ -1380,19 +1380,23 @@ class Kronolith_Event_kolab_new extends 
         $this->end = new Horde_Date($event['end-date']);
         $this->durMin = ($this->end->timestamp() - $this->start->timestamp()) / 60;
 
-        switch ($event['show-time-as']) {
-            case 'free':
-                $this->status = KRONOLITH_STATUS_CANCELLED;
-                break;
-
-            case 'tentative':
-                $this->status = KRONOLITH_STATUS_TENTATIVE;
-                break;
-
-            case 'busy':
-            case 'outofoffice':
-            default:
-                $this->status = KRONOLITH_STATUS_CONFIRMED;
+        if (isset($event['show-time-as'])) {
+            switch ($event['show-time-as']) {
+                case 'free':
+                    $this->status = KRONOLITH_STATUS_CANCELLED;
+                    break;
+
+                case 'tentative':
+                    $this->status = KRONOLITH_STATUS_TENTATIVE;
+                    break;
+
+                case 'busy':
+                case 'outofoffice':
+                default:
+                    $this->status = KRONOLITH_STATUS_CONFIRMED;
+            }
+        } else {
+            $this->status = KRONOLITH_STATUS_CONFIRMED;
         }
 
         // Recurrence

--- NEW FILE: HK-SB-Fbview_extra_params_kronolith-3.2-rc3.patch ---
This includes extra parameters into the free/busy view. The params are hardcoded so this patch won't make it upstream.

diff -r ef1a8c5a02ca kronolith/lib/FBView.php
--- a/kronolith/lib/FBView.php	Fri Mar 07 07:26:47 2008 +0100
+++ b/kronolith/lib/FBView.php	Fri Mar 07 07:28:12 2008 +0100
@@ -86,7 +86,7 @@ class Kronolith_FreeBusy_View {
             $template = new Horde_Template();
             $rows = '';
             foreach ($this->_requiredMembers as $member) {
-                $blocks = $this->_getBlocks($member, $member->getBusyPeriods(), 'busyblock.html', _("Busy"));
+                $blocks = $this->_getBlocks($member, $member->getBusyPeriods(), 'busyblock.html', _("Busy"), $member->getExtraParams());
                 $template = new Horde_Template();
                 $template->set('blocks', $blocks);
                 $template->set('name', $member->getName());
@@ -107,7 +107,7 @@ class Kronolith_FreeBusy_View {
             $template = new Horde_Template();
             $rows = '';
             foreach ($this->_optionalMembers as $member) {
-                $blocks = $this->_getBlocks($member, $member->getBusyPeriods(), 'busyblock.html', _("Busy"));
+                $blocks = $this->_getBlocks($member, $member->getBusyPeriods(), 'busyblock.html', _("Busy"), $member->getExtraParams());
                 $template = new Horde_Template();
                 $template->set('blocks', $blocks);
                 $template->set('name', $member->getName());
@@ -122,6 +122,9 @@ class Kronolith_FreeBusy_View {
             $template->set('legend', '');
             $html .= $template->fetch(KRONOLITH_TEMPLATES . '/fbview/section.html');
         }
+
+	//**********
+	//This has been disabled in kolab-fbview. Make this optional?
 
         // Possible meeting times.
         $optimal->setAttribute('ORGANIZER', _("All Attendees"));
@@ -144,6 +147,9 @@ class Kronolith_FreeBusy_View {
         $template->set('name', _("Required Attendees"));
         $template->set('blocks', $blocks);
         $rows .= $template->fetch(KRONOLITH_TEMPLATES . '/fbview/row.html');
+
+	//This has been disabled in kolab-fbview. Make this optional?
+	//**********
 
         // Reset locale.
         setlocale(LC_NUMERIC, $lc);
@@ -217,7 +223,7 @@ class Kronolith_FreeBusy_View {
         return $instances[$view];
     }
 
-    function _getBlocks($member, $periods, $blockfile, $label)
+    function _getBlocks($member, $periods, $blockfile, $label, $extra = array())
     {
         $template = new Horde_Template();
         $template->set('label', $label);
@@ -250,6 +256,21 @@ class Kronolith_FreeBusy_View {
 
                 $template->set('left', $left . '%');
                 $template->set('width', $width . '%');
+                $template->set('evclick', '');
+
+                if (isset($extra[$periodStart])) {
+                    if (!empty($extra[$periodStart]['X-UID'])) {
+                        $link = "javascript:performAction('viewaction', '" 
+			  . addslashes($member->getName() . "#" 
+				       . String::convertCharset(base64_decode($extra[$periodStart]['X-UID']), 
+								'UTF-8',NLS::getCharset())) . "')";
+                        $template->set('evclick', $link);
+                    }
+                    if (!empty($extra[$periodStart]['X-SUMMARY'])) {
+                        $template->set('label', String::convertCharset(base64_decode($extra[$periodStart]['X-SUMMARY']),'UTF-8',
+				       NLS::getCharset()));
+                    }
+                }
 
                 $blocks .= $template->fetch(KRONOLITH_TEMPLATES . '/fbview/' . $blockfile);
             } else {

--- NEW FILE: HK-SB-Fbview_save_attendees_kronolith-3.2-rc3.patch ---
Provides a patch to store the list of attendees in the user preferences. This is a broken patch that has been rejected upstream (http://bugs.horde.org/ticket/?id=4788). This should be solved using Horde::Groups.

diff -r 493f14c45965 kronolith/attendees.php
--- a/kronolith/attendees.php	Tue Feb 26 14:53:24 2008 +0100
+++ b/kronolith/attendees.php	Tue Feb 26 14:53:35 2008 +0100
@@ -159,6 +159,16 @@ case 'clear':
     $attendees = array();
     $_SESSION['kronolith']['attendees'] = $attendees;
     break;
+
+case 'save':
+    if (empty($attendees)) {
+        break;
+    }
+    $savedattlist = unserialize($prefs->getValue('saved_attendee_list'));
+    $savedattlist[] = array_keys($attendees);
+    $prefs->setValue('saved_attendee_list', serialize($savedattlist));
+    $notification->push(_('Successfully saved attendee list'), 'horde.success');
+    break;
 }
 
 // Get the current Free/Busy view; default to the 'day' view if none specified.
@@ -237,6 +247,14 @@ Imple::factory('ContactAutoCompleter', a
 
 $title = _("Edit attendees");
 require KRONOLITH_TEMPLATES . '/common-header.inc';
+
+if ($browser->hasFeature('javascript')) {
+    Horde::addScriptFile('open_savedattlist_win.js');
+    $savedattlist_url = 'javascript:open_savedattlist_win();';
+} else {
+    $savedattlist_url = Horde::applicationUrl('savedattlist.php');
+}
+
 $notification->notify(array('status'));
 require KRONOLITH_TEMPLATES . '/attendees/attendees.inc';
 require $registry->get('templates', 'horde') . '/common-footer.inc';
diff -r 493f14c45965 kronolith/config/prefs.php.dist
--- a/kronolith/config/prefs.php.dist	Tue Feb 26 14:53:24 2008 +0100
+++ b/kronolith/config/prefs.php.dist	Tue Feb 26 14:53:35 2008 +0100
@@ -457,3 +457,11 @@ if ($GLOBALS['registry']->hasMethod('con
     'shared' => false,
     'type' => 'implicit'
 );
+
+$_prefs['saved_attendee_list'] = array(
+    'value' => 'a:0:{}',
+    'locked' => false,
+    'shared' => false,
+    'type' => 'implicit',
+    'desc' => _("A saved list of attendees")
+);
diff -r 493f14c45965 kronolith/savedattlist.php
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kronolith/savedattlist.php	Tue Feb 26 14:53:35 2008 +0100
@@ -0,0 +1,77 @@
+<?php
+/**
+ * $Horde: kronolith/attendeeshandler.php,v 1.1 2004/05/25 08:34:21 stuart Exp $
+ *
+ * Copyright 2004 Code Fusion  <http://www.codefusion.co.za/>
+ *                Stuart Binge <s.binge at codefusion.co.za>
+ *
+ * See the enclosed file COPYING for license information (GPL).  If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ */
+
+ at define('KRONOLITH_BASE', dirname(__FILE__));
+require_once KRONOLITH_BASE . '/lib/base.php';
+require_once KRONOLITH_BASE . '/lib/FBView.php';
+
+$title = _('Load Attendee List');
+
+Horde::addScriptFile('tooltip.js', 'horde');
+require KRONOLITH_TEMPLATES . '/common-header.inc';
+
+// Get our list of saved attendees
+$savedattlist = unserialize($prefs->getValue('saved_attendee_list'));
+
+// Preformat our image urls
+$delimg = Horde::img('delete.png', _("Remove List"), null, $GLOBALS['registry']->getImageDir('horde'));
+$loadimg = Horde::img('tree/folder.png', _("Load List"), null, $GLOBALS['registry']->getImageDir('horde'));
+
+// Get our Action ID & Value. This specifies what action the user initiated.
+$actionID = Util::getFormData('actionID', false);
+$actionValue = Util::getFormData('actionValue', false);
+if (!$actionID) {
+    $actionID = (Util::getFormData('addNew', false) ? 'add' : false);
+    $actionValue = Util::getFormData('newAttendees', '');
+}
+
+// Perform the specified action, if there is one.
+switch ($actionID) {
+case 'remove':
+    // Remove the specified attendee
+    if (array_key_exists($actionValue, $savedattlist)) {
+        unset($savedattlist[$actionValue]);
+	$prefs->setValue('saved_attendee_list', serialize($savedattlist));
+    }
+    
+    break;
+
+case 'dismiss':
+    // Make sure we're actually allowed to dismiss
+    if (!$allow_dismiss) break;
+
+    // Close the attendee window
+    global $browser;
+
+    if ($browser->hasFeature('javascript')) {
+        Util::closeWindowJS();
+    } else {
+        $url = Util::getFormData('url');
+
+        if (!empty($url)) {
+            $location = Horde::applicationUrl($url, true);
+        } else {
+            $url = Util::addParameter($prefs->getValue('defaultview') . '.php', 'month', Util::getFormData('month'));
+            $url = Util::addParameter($url, 'year', Util::getFormData('year'));
+            $location = Horde::applicationUrl($url, true);
+        }
+
+        // Make sure URL is unique.
+        $location = Util::addParameter($location, 'unique', md5(microtime()));
+
+        header('Location: ' . $location);
+    }
+    break;
+}
+
+$form_handler = Horde::applicationUrl('savedattlist.php');
+require KRONOLITH_TEMPLATES . '/savedattlist/savedattlist.inc';
+require $GLOBALS['registry']->get('templates', 'horde') . '/common-footer.inc';
diff -r 493f14c45965 kronolith/templates/attendees/attendees.inc
--- a/kronolith/templates/attendees/attendees.inc	Tue Feb 26 14:53:24 2008 +0100
+++ b/kronolith/templates/attendees/attendees.inc	Tue Feb 26 14:53:35 2008 +0100
@@ -92,6 +92,8 @@ function switchDateView(view, timestamp)
 <div>
  <input type="submit" class="button" name="addNew" value="<?php echo htmlspecialchars(_("Save Attendees")) ?>" />
  <input type="submit" class="button" name="addNewClose" value="<?php echo htmlspecialchars(_("Save and Finish")) ?>" />
+ <input type="button" class="button" name="loadAttList" value="<?php echo htmlspecialchars(_("Load Attendee List")) ?>" onclick="<?php echo $savedattlist_url ?>" />
+ <?php if (!empty($attendees)): ?><input type="button" class="button" name="saveAttList" value="<?php echo htmlspecialchars(_("Save Attendee List")) ?>" onclick="performAction('save', '');" /><?php endif; ?>
  <?php if (!empty($attendees)): ?><input type="submit" class="button" name="clearAll" value="<?php echo htmlspecialchars(_("Clear all attendees")) ?>" /><?php endif; ?>
 </div>
 
diff -r 493f14c45965 kronolith/templates/javascript/open_savedattlist_win.js
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kronolith/templates/javascript/open_savedattlist_win.js	Tue Feb 26 14:53:35 2008 +0100
@@ -0,0 +1,36 @@
+<?php if (!strstr($_SERVER['PHP_SELF'], 'javascript.php')): ?><script language="JavaScript" type="text/javascript">
+<!--
+<?php endif; ?>
+function open_savedattlist_win(args)
+{
+    var url = "<?php echo Horde::url($GLOBALS['registry']->applicationWebPath('%application%/savedattlist.php', 'kronolith')) ?>";
+    if (url.indexOf('?') == -1) glue = '?';
+    else glue = '<?php echo ini_get('arg_separator.output') ?>';
+    var now = new Date();
+    var name = "savedattlist_window_" + now.getTime();
+    if (args != "") {
+        url = url + glue + args + '<?php echo ini_get('arg_separator.output') ?>' + "uniq=" + now.getTime();
+    } else {
+        url = url + glue + "uniq=" + now.getTime();
+    }
+    var Width = screen.width;
+    if (Width > 775) {
+        Width = 700;
+    } else {
+        Width -= 75;
+    }
+    var Height = screen.height;
+    if (Height > 725) {
+        Height = 650;
+    } else {
+        Height -= 75;
+    }
+    param = "toolbar=no,location=no,status=yes,scrollbars=yes,resizable=yes,width=" + Width + ",height=" + Height + ",left=0,top=0";
+    name = window.open(url, name, param);
+    if (!eval("name.opener")) {
+        name.opener = self;
+    }
+}
+<?php if (!strstr($_SERVER['PHP_SELF'], 'javascript.php')): ?>// -->
+</script>
+<?php endif; ?>
diff -r 493f14c45965 kronolith/templates/savedattlist/savedattlist.inc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kronolith/templates/savedattlist/savedattlist.inc	Tue Feb 26 14:53:35 2008 +0100
@@ -0,0 +1,68 @@
+<!-- javascript action handling -->
+<script language="JavaScript" type="text/javascript">
+<!--
+function performAction(id, value)
+{
+    document.savedattlistForm.actionID.value = id;
+    document.savedattlistForm.actionValue.value = value;
+    document.savedattlistForm.submit();
+    return false;
+}
+
+function updateMessage(list)
+{
+    if (parent.opener.closed) {
+        alert('<?php echo addslashes(_("The Edit Attendees screen is no longer present. Exiting.")) ?>');
+        this.close();
+        return;
+    }
+
+    if (!parent.opener.document.attendeesForm) {
+        alert('<?php echo addslashes(_("You can only use this form from the Edit Attendees screen.")) ?>');
+        this.close();
+        return;
+    }
+
+    parent.opener.document.attendeesForm.newAttendees.value = list;
+    this.close();
+}
+// -->
+</script>
+
+<form method="post" action="<?php echo $form_handler; ?>" name="savedattlistForm">
+<?php Util::pformInput(); ?>
+<input type="hidden" name="actionID" value="" />
+<input type="hidden" name="actionValue" value="" />
+
+<div align="center">
+
+<table border="0" width="500" cellspacing="0" cellpadding="2">
+
+<!-- header -->
+<tr><td colspan="4" class="header"><b><?php echo $title ?></b></td></tr>
+
+<!-- attendee list header -->
+<tr class="item">
+ <td nowrap="nowrap" width="2%" align="center"><?php echo $loadimg ?></td>
+ <td nowrap="nowrap" width="2%" align="center"><?php echo $delimg ?></td>
+ <td nowrap="nowrap" width="96%"><b><?php echo htmlspecialchars(_("Attendees")) ?></b></td>
+</tr>
+
+<!-- attendees -->
+<?php $i = 0 ?>
+<?php if (empty($savedattlist)): ?>
+ <tr class="item<?php echo ($i++ % 2) ?>"><td align="center" colspan="3"><i><?php echo htmlspecialchars('-- ' . _("No saved attendee lists are available") . ' --') ?></i></td></tr>
+<?php else: foreach ($savedattlist as $index => $list): ?>
+ <tr class="item<?php echo ($i++ % 2) ?>">
+ <?php
+  echo '<td align="center">', Horde::link("javascript:updateMessage('" . addslashes(implode(', ', $list)) . "')", _("Load this list")), $loadimg, "</a></td>";
+ ?>
+ <?php
+  echo '<td align="center">', Horde::link("javascript:performAction('remove', '" . $index . "')", _("Remove this list")), $delimg, "</a></td>";
+ ?>
+  <td><?php echo implode(', ', $list); ?></td>
+ </tr>
+<?php endforeach; endif; ?>
+</table>
+</div>
+</form>





More information about the commits mailing list