steffen: server/kolab-resource-handlers/kolab-resource-handlers/freebusy freebusy.class.php, 1.18, 1.19 freebusycache.class.php, 1.8, 1.9 pfb.php, 1.9, 1.10 recurrence.class.php, 1.2, 1.3
cvs at intevation.de
cvs at intevation.de
Thu Nov 25 13:08:43 CET 2004
Author: steffen
Update of /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/freebusy
In directory doto:/tmp/cvs-serv15129/kolab-resource-handlers/kolab-resource-handlers/freebusy
Modified Files:
freebusy.class.php freebusycache.class.php pfb.php
recurrence.class.php
Log Message:
make use of the freebusy relevancy annotation
Index: freebusy.class.php
===================================================================
RCS file: /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/freebusy/freebusy.class.php,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- freebusy.class.php 1 Nov 2004 13:09:19 -0000 1.18
+++ freebusy.class.php 25 Nov 2004 12:08:40 -0000 1.19
@@ -56,6 +56,17 @@
return $this->imap->getACL();
}
+ function getRelevance() {
+ $val = $this->imap->getAnnotation( '/vendor/kolab/incidences-for', 'value.shared' );
+ if( PEAR::isError($val) ) {
+ myLog("No /vendor/kolab/incidences-for found for ".$this->foldername, RM_LOG_DEBUG);
+ return 'admins';
+ } else {
+ myLog("/vendor/kolab/incidences-for = $val for ".$this->foldername, RM_LOG_DEBUG);
+ return $val;
+ }
+ }
+
function &generateFreeBusy($startstamp = NULL, $endstamp = NULL ) {
require_once 'PEAR.php';
@@ -143,7 +154,7 @@
$summary = ($event['sensitivity'] == 'public' ? $event['summary'] : '');
- myLog("Looking at message with uid=$uid and summary=$summary", RM_LOG_DEBUG);
+ //myLog("Looking at message with uid=$uid and summary=$summary", RM_LOG_DEBUG);
// Get the events initial start
$initial_start = $event['start-date'];
Index: freebusycache.class.php
===================================================================
RCS file: /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/freebusy/freebusycache.class.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- freebusycache.class.php 22 Oct 2004 08:55:49 -0000 1.8
+++ freebusycache.class.php 25 Nov 2004 12:08:41 -0000 1.9
@@ -8,7 +8,7 @@
$this->extended = $extended;
}
- function store( $filename, $fbdata, $acl ) {
+ function store( $filename, $fbdata, $acl, $relevance ) {
if( ereg( '\.\.', $filename ) ) {
$this->error = $filename._(' is not absolute');
return false;
@@ -59,28 +59,36 @@
if( !$this->storeACL( $filename, $acl ) ) return false;
// Update overview db
+ switch( $relevance ) {
+ case 'admins': $perm = 'a'; break;
+ case 'readers': $perm = 'r'; break;
+ case 'nobody': $perm = 'false'; break;
+ }
+
$db = dba_open( $this->basedir.'/pfbcache.db', 'cd', 'gdbm' );
if( $db === false ) return false;
foreach( $acl as $ac ) {
- if( strpos( $ac['RIGHTS'], 'r' ) !== false ) {
- if( dba_exists( $ac['USER'], $db ) ) {
- $lst = dba_fetch( $ac['USER'], $db );
- $lst = $this->decodeList( $lst );
- $lst[] = $filename;
- dba_replace( $ac['USER'], $this->encodeList(array_unique($lst)), $db );
- } else {
- dba_insert( $ac['USER'], $filename, $db );
- }
- }
- }
- $deleteduids = $this->aclDiff( $oldacl, $acl );
- foreach( $deleteduids as $uid ) {
+ $uid = $ac['USER'];
if( dba_exists( $uid, $db ) ) {
$lst = dba_fetch( $uid, $db );
$lst = $this->decodeList( $lst );
$lst = array_diff( $lst, array($filename));
dba_replace( $uid, $this->encodeList($lst), $db );
- }
+ }
+ }
+ if( $perm !== false ) {
+ foreach( $acl as $ac ) {
+ if( strpos( $ac['RIGHTS'], $perm ) !== false ) {
+ if( dba_exists( $ac['USER'], $db ) ) {
+ $lst = dba_fetch( $ac['USER'], $db );
+ $lst = $this->decodeList( $lst );
+ $lst[] = $filename;
+ dba_replace( $ac['USER'], $this->encodeList(array_unique($lst)), $db );
+ } else {
+ dba_insert( $ac['USER'], $filename, $db );
+ }
+ }
+ }
}
dba_close($db);
return true;
Index: pfb.php
===================================================================
RCS file: /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/freebusy/pfb.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- pfb.php 10 Nov 2004 16:10:57 -0000 1.9
+++ pfb.php 25 Nov 2004 12:08:41 -0000 1.10
@@ -107,7 +107,8 @@
if( PEAR::isError( $rc ) ) {
notfound( "Folder: ".$fb->foldername.', '.$rc->toString());
return false;
- }
+ }
+ $relevance = $fb->getRelevance();
list($vfb,$xvfb) = $fb->generateFreeBusy();
$ts = mktime();
if( PEAR::isError( $vfb ) ) {
@@ -116,11 +117,11 @@
}
$acl = $fb->getACL();
- if( !$cache->store( $owner.'/'.$folder, $vfb, $acl ) ) {
+ if( !$cache->store( $owner.'/'.$folder, $vfb, $acl, $relevance ) ) {
trigger_error('Could not store pfb in cache file '.$owner.'/'.$folder
.'.pfb: '.$cache->error, E_USER_WARNING);
}
- if( !$xcache->store( $owner.'/'.$folder, $xvfb, $acl ) ) {
+ if( !$xcache->store( $owner.'/'.$folder, $xvfb, $acl, $relevance ) ) {
trigger_error('Could not store xpfb in cache file '.$owner.'/'.$folder
.'.xpfb: '.$cache->error, E_USER_WARNING);
}
Index: recurrence.class.php
===================================================================
RCS file: /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/freebusy/recurrence.class.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- recurrence.class.php 1 Nov 2004 02:33:27 -0000 1.2
+++ recurrence.class.php 25 Nov 2004 12:08:41 -0000 1.3
@@ -35,7 +35,7 @@
// Daily recurrence, every 'interval' days
$count = 0;
for( $t = $this->initial_start; $t < $endstamp; $t = strtotime( '+'.$this->interval.' days',$t) ) {
- myLog("Adding recurrence $t -> ".($t+$duration), RM_LOG_DEBUG );
+ //myLog("Adding recurrence $t -> ".($t+$duration), RM_LOG_DEBUG );
//$vFb->addBusyPeriod('BUSY', $t, null, $duration, $extra);
$this->setBusy( $t, null, $duration );
$count++;
@@ -54,7 +54,7 @@
foreach( $this->day as $day ) {
$tmp = strtotime( $day, $t);
if( $tmp < $endstamp ) {
- myLog("Adding recurrence $tmp -> ".($tmp+$duration), RM_LOG_DEBUG );
+ //myLog("Adding recurrence $tmp -> ".($tmp+$duration), RM_LOG_DEBUG );
//$vFb->addBusyPeriod('BUSY', $tmp, null, $duration, $extra);
$this->setBusy( $tmp, null, $duration );
} else {
@@ -78,7 +78,7 @@
foreach( $this->daynumber as $dayno ) {
$tmp = strtotime( "+$dayno days", $t);
if( $tmp < $endstamp ) {
- myLog("Adding recurrence $tmp -> ".($tmp+$duration), RM_LOG_DEBUG );
+ //myLog("Adding recurrence $tmp -> ".($tmp+$duration), RM_LOG_DEBUG );
//$vFb->addBusyPeriod('BUSY', $tmp, null, $duration, $extra);
$this->setBusy( $tmp, null, $duration );
} else {
@@ -93,7 +93,7 @@
$wday = $this->day[$i];
$tmp = strtotime( "+$dayno $wday", $t);
if( $tmp < $endstamp ) {
- myLog("Adding recurrence $tmp -> ".($tmp+$duration), RM_LOG_DEBUG );
+ //myLog("Adding recurrence $tmp -> ".($tmp+$duration), RM_LOG_DEBUG );
//$vFb->addBusyPeriod('BUSY', $tmp, null, $duration, $extra);
$this->setBusy( $tmp, null, $duration );
} else {
@@ -116,7 +116,7 @@
foreach( $this->daynumber as $dayno ) {
$tmp = strtotime( "+$dayno days", $t);
if( $tmp < $endstamp ) {
- myLog("Adding recurrence $tmp -> ".($tmp+$duration), RM_LOG_DEBUG );
+ //myLog("Adding recurrence $tmp -> ".($tmp+$duration), RM_LOG_DEBUG );
//$vFb->addBusyPeriod('BUSY', $tmp, null, $duration, $extra);
$this->setBusy( $tmp, null, $duration );
} else {
@@ -130,7 +130,7 @@
$month = $this->month[$i];
$tmp = strtotime( "+$dayno $month", $t);
if( $tmp < $endstamp ) {
- myLog("Adding recurrence $tmp -> ".($tmp+$duration), RM_LOG_DEBUG );
+ //myLog("Adding recurrence $tmp -> ".($tmp+$duration), RM_LOG_DEBUG );
//$vFb->addBusyPeriod('BUSY', $tmp, null, $duration, $extra);
$this->setBusy( $tmp, null, $duration );
} else {
@@ -144,7 +144,7 @@
$wday = $this->day[$i];
$tmp = strtotime( "+$dayno $wday", $t);
if( $tmp < $endstamp ) {
- myLog("Adding recurrence $tmp -> ".($tmp+$duration), RM_LOG_DEBUG );
+ //myLog("Adding recurrence $tmp -> ".($tmp+$duration), RM_LOG_DEBUG );
//$vFb->addBusyPeriod('BUSY', $tmp, null, $duration, $extra);
$this->setBusy( $tmp, null, $duration );
} else {
More information about the commits
mailing list