gunnar: server/kolab-webclient/kronolith/patches/kronolith-2.3.3 t_kronolith_HK_GW_FbviewRelevance.diff, NONE, 1.1 t_kronolith_HK_GW_XfbAccess.diff, NONE, 1.1 series, 1.1, 1.2

cvs at kolab.org cvs at kolab.org
Fri Jan 22 19:55:29 CET 2010


Author: gunnar

Update of /kolabrepository/server/kolab-webclient/kronolith/patches/kronolith-2.3.3
In directory doto:/tmp/cvs-serv15922/kronolith/patches/kronolith-2.3.3

Modified Files:
	series 
Added Files:
	t_kronolith_HK_GW_FbviewRelevance.diff 
	t_kronolith_HK_GW_XfbAccess.diff 
Log Message:
Merge xfbaccess and fbrelevance patches into the kronolith package.

--- NEW FILE: t_kronolith_HK_GW_FbviewRelevance.diff ---
From: Gunnar Wrobel <p at rdus.de>
Subject: [PATCH] t/kronolith/HK/GW/FbviewRelevance

Heed the Free/Busy relevance setting.

Signed-off-by: Gunnar Wrobel <p at rdus.de>

---
 calendars/edit.php         |    4 ++++
 .../kronolith/lib/Forms/CreateCalendar.php         |    4 ++++
 lib/Forms/EditCalendar.php |    4 ++++
 3 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/calendars/edit.php b/calendars/edit.php
index 67137d2..6357a2c 100644
--- a/calendars/edit.php
+++ b/calendars/edit.php
@@ -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 --git a/lib/Forms/CreateCalendar.php b/lib/Forms/CreateCalendar.php
index f11ae06..8d1154e 100644
--- a/lib/Forms/CreateCalendar.php
+++ b/lib/Forms/CreateCalendar.php
@@ -35,6 +35,9 @@ class Kronolith_CreateCalendarForm extends Horde_Form {
 
         $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 extends Horde_Form {
         }
         $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 --git a/lib/Forms/EditCalendar.php b/lib/Forms/EditCalendar.php
index 0a76c57..e0b4659 100644
--- a/lib/Forms/EditCalendar.php
+++ b/lib/Forms/EditCalendar.php
@@ -42,6 +42,9 @@ class Kronolith_EditCalendarForm extends Horde_Form {
         $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 Horde_Form {
         $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'));
-- 
tg: (2b89751..) t/kronolith/HK/GW/FbviewRelevance (depends on: t/kronolith/HK/SB/ExtraParameters)
-- 
TOPGIT patch commit log
=======================

commit 0175a71d1238e9b6907c31b7b97430dd7fc0486e
Author: Gunnar Wrobel <p at rdus.de>
Date:   Sat Mar 14 01:10:44 2009 +0100

    Remove stray .orig file.

commit 6aba4a0d6a6d139204db96eeff2569528088b265
Author: Gunnar Wrobel <p at rdus.de>
Date:   Sun Feb 1 22:27:55 2009 +0000

    Added patch kronolith/HK-GW-Fbview_relevance.patch from the mercurial release queue.

--- NEW FILE: t_kronolith_HK_GW_XfbAccess.diff ---
From: Gunnar Wrobel <p at rdus.de>
Subject: [PATCH] t/kronolith/HK/GW/XfbAccess

Allows to set the extended free/busy view access parameters via the calendar settings.

Signed-off-by: Gunnar Wrobel <p at rdus.de>

---
 perms.php                 |   48 ++++++++++++++++++
 templates/perms/perms.inc |   55 +++++++++++++++++++++
 2 files changed, 103 insertions(+), 0 deletions(-)

diff --git a/perms.php b/perms.php
index f9bed71..4966bd4 100644
--- a/perms.php
+++ b/perms.php
@@ -15,6 +15,34 @@
 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;
 
@@ -226,6 +256,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));
+
         $result = $share->setPermission($perm, false);
         if (is_a($result, 'PEAR_Error')) {
             $notification->push($result, 'horde.error');
diff --git a/templates/perms/perms.inc b/templates/perms/perms.inc
index 4ca65a6..2174167 100644
--- a/templates/perms/perms.inc
+++ b/templates/perms/perms.inc
@@ -330,6 +330,61 @@ foreach ($userList as $user) {
   <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($fbperms[$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>
-- 
tg: (0175a71..) t/kronolith/HK/GW/XfbAccess (depends on: t/kronolith/HK/GW/FbviewRelevance)
-- 
TOPGIT patch commit log
=======================

commit 2d1588fad36f7b13bb534d70f14aa4f75ef8d35f
Author: Gunnar Wrobel <p at rdus.de>
Date:   Sun Feb 1 22:29:11 2009 +0000

    Added patch kronolith/HK-GW-Fbview_xfb_access.patch from the mercurial release queue.

Index: series
===================================================================
RCS file: /kolabrepository/server/kolab-webclient/kronolith/patches/kronolith-2.3.3/series,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- series	22 Jan 2010 18:47:50 -0000	1.1
+++ series	22 Jan 2010 18:55:27 -0000	1.2
@@ -1 +1,3 @@
 t_kronolith_HK_GW_AuthenticatedFreeBusy.diff
+t_kronolith_HK_GW_FbviewRelevance.diff
+t_kronolith_HK_GW_XfbAccess.diff





More information about the commits mailing list