gunnar: server/horde/fbview-kronolith HK-GW-Fbview_menu.patch, NONE, 1.1 HK-GW-Fbview_relevance.patch, NONE, 1.1 HK-GW-Fbview_xfb_access.patch, NONE, 1.1 fbview-kronolith.spec, 1.17, 1.18
cvs at kolab.org
cvs at kolab.org
Thu Nov 29 16:32:12 CET 2007
Author: gunnar
Update of /kolabrepository/server/horde/fbview-kronolith
In directory doto:/tmp/cvs-serv23106/horde/fbview-kronolith
Modified Files:
fbview-kronolith.spec
Added Files:
HK-GW-Fbview_menu.patch HK-GW-Fbview_relevance.patch
HK-GW-Fbview_xfb_access.patch
Log Message:
Support for the extended free/busy concept.
--- NEW FILE: HK-GW-Fbview_menu.patch ---
diff -r 538d4c6293be kronolith/attendees.php
--- a/kronolith/attendees.php Thu Nov 29 12:33:18 2007 +0100
+++ b/kronolith/attendees.php Thu Nov 29 12:34:39 2007 +0100
@@ -236,6 +236,7 @@ Imple::factory('ContactAutoCompleter', a
$title = _("Edit attendees");
require KRONOLITH_TEMPLATES . '/common-header.inc';
+require KRONOLITH_TEMPLATES . '/fbview-menu.inc';
if ($browser->hasFeature('javascript')) {
Horde::addScriptFile('open_savedattlist_win.js');
diff -r 538d4c6293be kronolith/calendars.php
--- a/kronolith/calendars.php Thu Nov 29 12:33:18 2007 +0100
+++ b/kronolith/calendars.php Thu Nov 29 12:34:39 2007 +0100
@@ -134,6 +134,6 @@ Horde::addScriptFile('popup.js', 'horde'
Horde::addScriptFile('popup.js', 'horde', true);
$title = _("My Calendars");
require KRONOLITH_TEMPLATES . '/common-header.inc';
-require KRONOLITH_TEMPLATES . '/menu.inc';
+require KRONOLITH_TEMPLATES . '/fbview-menu.inc';
require KRONOLITH_TEMPLATES . '/calendars/calendars.inc';
require $registry->get('templates', 'horde') . '/common-footer.inc';
diff -r 538d4c6293be kronolith/lib/Kronolith.php
--- a/kronolith/lib/Kronolith.php Thu Nov 29 12:33:18 2007 +0100
+++ b/kronolith/lib/Kronolith.php Thu Nov 29 12:34:39 2007 +0100
@@ -1968,6 +1968,33 @@ class Kronolith {
}
/**
+ * Builds Kronolith's list of menu items.
+ */
+ function getFbviewMenu($returnType = 'object')
+ {
+ global $conf, $registry, $browser, $prefs;
+
+ /* Check here for guest calendars so that we don't get multiple
+ * messages after redirects, etc. */
+ if (!Auth::getAuth() && !count($GLOBALS['all_calendars'])) {
+ $GLOBALS['notification']->push(_("No calendars are available to guests."));
+ }
+
+ require_once 'Horde/Menu.php';
+ $menu = new Menu(HORDE_MENU_MASK_HELP | HORDE_MENU_MASK_LOGIN);
+
+ $menu->add(Horde::applicationUrl('attendees.php'), _("Attendees"), 'attendees.png', null, null, null, '__noselection');
+
+ $menu->add(Horde::applicationUrl('calendars.php'), _("Calendars"), 'calendars.png', null, null, null, '__noselection');
+
+ if ($returnType == 'object') {
+ return $menu;
+ } else {
+ return $menu->render();
+ }
+ }
+
+ /**
* Used with usort() to sort events based on their start times.
* This function ignores the date component so recuring events can
* be sorted correctly on a per day basis.
diff -r 538d4c6293be kronolith/templates/fbview-menu.inc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/kronolith/templates/fbview-menu.inc Thu Nov 29 12:34:39 2007 +0100
@@ -0,0 +1,4 @@
+<div id="menu">
+ <?php echo Kronolith::getFbviewMenu('string') ?>
+</div>
+<?php $GLOBALS['notification']->notify(array('listeners' => 'status')) ?>
--- NEW FILE: HK-GW-Fbview_relevance.patch ---
Allows to set the free/busy relevance on a calendar.
diff -r e7fdad8797ac kronolith/calendars.php
--- a/kronolith/calendars.php Thu Nov 29 14:36:50 2007 +0100
+++ b/kronolith/calendars.php Thu Nov 29 14:43:24 2007 +0100
@@ -39,6 +39,7 @@ case 'save':
$cal = $kronolith_shares->newShare(md5(microtime()));
$cal->set('name', $id);
$cal->set('desc', Util::getFormData('description', ''));
+ $cal->set('params', serialize(array('fbrelevance' => (int) Util::getFormData('fbrelevance', 0))));
$result = $kronolith_shares->addShare($cal);
if (is_a($result, 'PEAR_Error')) {
$notification->push($result, 'horde.error');
@@ -50,6 +51,7 @@ case 'save':
$original_name = $cal->get('name');
$cal->set('name', $id);
$cal->set('desc', Util::getFormData('description', ''));
+ $cal->set('params', serialize(array('fbrelevance' => (int) Util::getFormData('fbrelevance', 0))));
if ($original_name != $id) {
$result = $kronolith_driver->rename($original_name, $id);
@@ -125,9 +127,16 @@ case 'delete':
$remote_calendars = unserialize($prefs->getValue('remote_cals'));
$current_user = Auth::getAuth();
$my_calendars = array();
+$fbrelevance = array();
foreach (Kronolith::listCalendars() as $id => $cal) {
if ($cal->get('owner') == $current_user) {
$my_calendars[$id] = $cal;
+ $params = @unserialize($cal->get('params'));
+ if (isset($params['fbrelevance'])) {
+ $fbrelevance[$id] = $params['fbrelevance'];
+ } else {
+ $fbrelevance[$id] = 0;
+ }
}
}
diff -r e7fdad8797ac kronolith/templates/calendars/calendars.inc
--- a/kronolith/templates/calendars/calendars.inc Thu Nov 29 14:36:50 2007 +0100
+++ b/kronolith/templates/calendars/calendars.inc Thu Nov 29 14:43:24 2007 +0100
@@ -8,7 +8,8 @@ var fields = [];
<?php foreach ($my_calendars as $id => $cal): ?>
fields['<?php echo htmlspecialchars($id) ?>'] = [
"<?php echo rawurlencode(String::convertCharset($cal->get('name'), NLS::getCharset(), 'UTF-8')) ?>",
- "<?php echo rawurlencode(String::convertCharset($cal->get('desc'), NLS::getCharset(), 'UTF-8')) ?>"];
+ "<?php echo rawurlencode(String::convertCharset($cal->get('desc'), NLS::getCharset(), 'UTF-8')) ?>",
+ "<?php echo $fbrelevance[$id] ?>"];
<?php endforeach; ?>
function newChoice()
@@ -25,6 +26,7 @@ function newChoice()
document.shares.edit_share.value = share;
document.shares.id.value = decodeURIComponent(fields[share][0]);
document.shares.description.value = decodeURIComponent(fields[share][1]);
+ document.shares.fbrelevance[fields[share][2]].checked = true;
urlObj.innerHTML = "<?php echo Util::addParameter(Horde::applicationUrl('month.php', true, -1), 'display_cal', '') ?>" + share;
subscriptionUrlObj.innerHTML = "<?php echo $webdav ? (Horde::url($registry->get('webroot', 'horde'), true, -1) . '/rpc.php/kronolith/" + share + ".ics"') : Util::addParameter(Horde::applicationUrl('ics.php', true, -1), 'c', '') . '" + share' ?>;
}
@@ -126,11 +128,55 @@ function checkSubmit()
<textarea id="description" name="description" rows="4" cols="60"></textarea>
</td>
</tr>
- <tr>
- <td valign="top" class="nowrap rightAlign">
+</table>
+
+<div class="control">
+ <?php echo _("Free/Busy relevance") ?>
+</div>
+
+<table width="100%" cellspacing="0">
+ <tr>
+ <td colspan="2">
+ <?php echo _("This calendar is only included into the free/busy data for ...") ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="15%" class="nowrap rightAlign">
+ <strong><?php echo _("owners/administrators") ?></strong>
+ </td>
+ <td width="85%">
+ <input id="admins" name="fbrelevance" type="radio" class="checkbox" value="0"/><br />
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" class="nowrap rightAlign">
+ <strong><?php echo _("readers") ?></strong>
+ </td>
+ <td>
+ <input id="readers" name="fbrelevance" type="radio" class="checkbox" value="1"/>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" class="nowrap rightAlign">
+ <strong><?php echo _("no one") ?></strong>
+ </td>
+ <td>
+ <input id="none" name="fbrelevance" type="radio" class="checkbox" value="2"/><br />
+ </td>
+ </tr>
+ <td>
+</table>
+
+<div class="control">
+ <?php echo _("Calendar links:") ?>
+</div>
+
+<table width="100%" cellspacing="0">
+ <tr>
+ <td width="15%" class="nowrap rightAlign">
<strong><?php echo _("URL") ?></strong>
</td>
- <td>
+ <td width="85%">
<span id="calendar_url"><em><?php echo _("Select a calendar above to display the URL") ?></em></span>
</td>
</tr>
--- NEW FILE: HK-GW-Fbview_xfb_access.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>
Index: fbview-kronolith.spec
===================================================================
RCS file: /kolabrepository/server/horde/fbview-kronolith/fbview-kronolith.spec,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- fbview-kronolith.spec 29 Nov 2007 11:09:02 -0000 1.17
+++ fbview-kronolith.spec 29 Nov 2007 15:32:10 -0000 1.18
@@ -3,7 +3,7 @@
%define V_package fbview-%{V_horde_name}
%define V_year 2007
%define V_month 11
-%define V_day 28
+%define V_day 29
%define V_version 2.2_rc1
%define V_uver 2.2-rc1
%define V_date %{V_year}-%{V_month}-%{V_day}
@@ -31,6 +31,9 @@
Patch0: HK-SB-Fbview_extra_params.patch
Patch1: HK-SB-Fbview_save_attendees.patch
Patch2: HK-JS-Fix_library_import.patch
+Patch3: HK-GW-Fbview_menu.patch
+Patch4: HK-GW-Fbview_relevance.patch
+Patch5: HK-GW-Fbview_xfb_access.patch
# Build Info
Prefix: %{l_prefix}
@@ -63,6 +66,9 @@
%patch -p2 -P 0
%patch -p2 -P 1
%patch -p2 -P 2
+ %patch -p2 -P 3
+ %patch -p2 -P 4
+ %patch -p2 -P 5
cd ..
%build
@@ -76,7 +82,7 @@
cd config && for fl in *.dist;do cp $fl ${fl/.dist/};done; cd ..
# Remove some stuff not necessary for fbview
- rm add.php calendars.php day.php perms.php view.php \
+ rm add.php day.php view.php \
delete.php ics.php search.php week.php contacts.php \
imple.php month.php pref_api.php workweek.php \
edit.php new.php test.php year.php attend.php \
More information about the commits
mailing list