steffen: server/kolab-resource-handlers/kolab-resource-handlers/freebusy freebusy.class.php, 1.20, 1.21 recurrence.class.php, 1.3, 1.4

cvs at intevation.de cvs at intevation.de
Tue Nov 30 21:56:52 CET 2004


Author: steffen

Update of /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/freebusy
In directory doto:/tmp/cvs-serv28618/kolab-resource-handlers/freebusy

Modified Files:
	freebusy.class.php recurrence.class.php 
Log Message:
Fix for Issue243 (recurring event fb bug)

Index: freebusy.class.php
===================================================================
RCS file: /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/freebusy/freebusy.class.php,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- freebusy.class.php	30 Nov 2004 01:29:25 -0000	1.20
+++ freebusy.class.php	30 Nov 2004 20:56:50 -0000	1.21
@@ -148,7 +148,8 @@
       }
       */
 
-      if( array_key_exists( 'show-time-as', $event ) && strtolower(trim($event['show-time-as'])) == 'free' ) {
+      if( array_key_exists( 'show-time-as', $event ) && 
+	  strtolower(trim($event['show-time-as'])) == 'free' ) {
 	continue;
       }
     
@@ -314,6 +315,7 @@
 	$rhash = array();
 	$attrs = $value->attributes();
 	foreach( $attrs as $attr ) {
+	  //myLog("getEventHash setting rhash[".$attr->name."] = ".$attr->value, RM_LOG_DEBUG);
 	  $rhash[$attr->name] = $attr->value;
 	}
 	foreach( $value->child_nodes() as $v ) {

Index: recurrence.class.php
===================================================================
RCS file: /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/freebusy/recurrence.class.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- recurrence.class.php	25 Nov 2004 12:08:41 -0000	1.3
+++ recurrence.class.php	30 Nov 2004 20:56:50 -0000	1.4
@@ -20,7 +20,7 @@
   function setCycletype( $ctype ) { $this->cycle_type = $ctype; }
   function setType( $type ) { $this->type = $type; }
   function setInterval( $interval ) { $this->interval = $interval; }
-  function setDaynumber( $num ) { $this->daynumber = $num; }
+  function setDaynumber( $num ) { $this->daynumber = is_array($num)?$num:array($num); }
   function setDay( $day ) { $this->day = $day; }
   function setMonth( $month ) { $this->month = $month; }
   
@@ -30,13 +30,13 @@
   function expand( $startstamp, $endstamp ) {
     $duration = $this->initial_end-$this->initial_start;
     myLog( "Recurrence::expand( $startstamp, $endstamp )", RM_LOG_DEBUG );	
+    //myLog( "cycletype=".$this->cycle_type, RM_LOG_DEBUG);
     switch( $this->cycle_type ) {
     case 'daily':
       // 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 );
-	    //$vFb->addBusyPeriod('BUSY', $t, null, $duration, $extra);
 	    $this->setBusy( $t, null, $duration );
 	    $count++;
 	    if( $this->range_type == 'number' && $count > $this->range ) {
@@ -44,9 +44,9 @@
 	    } else if( $this->range_type == 'date' && $t > strtotime( '+1 day',$this->range ) ) {
 	      break;
 	    }
-	  }
-	  break;
-	case 'weekly':
+      }
+      break;
+    case 'weekly':
 	  // Weekly recurrence, every 'interval' weeks on 'day' days
 	  if( !$this->interval ) $this->interval = 1;
 	  $count = 0;
@@ -55,7 +55,6 @@
 	      $tmp = strtotime( $day, $t);
 	      if( $tmp < $endstamp ) {
 		//myLog("Adding recurrence $tmp -> ".($tmp+$duration), RM_LOG_DEBUG );
-		//$vFb->addBusyPeriod('BUSY', $tmp, null, $duration, $extra);	      
 		$this->setBusy( $tmp, null, $duration );
 	      } else {
 		break;
@@ -68,7 +67,7 @@
 	      break;
 	    }	    
 	  }
-	case 'monthly':
+    case 'monthly':
 	  // Weekly recurrence, every 'interval' weeks
 	  if( !$this->interval ) $this->interval = 1;
 	  $count = 0;
@@ -76,10 +75,9 @@
 	    if( $this->type == 'daynumber') {
 	      // On numbered days
 	      foreach( $this->daynumber as $dayno ) {
-		$tmp = strtotime( "+$dayno days", $t);
+		$tmp = strtotime( "+$dayno days", $t);		
 		if( $tmp < $endstamp ) {
 		  //myLog("Adding recurrence $tmp -> ".($tmp+$duration), RM_LOG_DEBUG );
-		  //$vFb->addBusyPeriod('BUSY', $tmp, null, $duration, $extra);	      
 		  $this->setBusy( $tmp, null, $duration );
 		} else {
 		  break;
@@ -94,7 +92,6 @@
 		$tmp = strtotime( "+$dayno $wday", $t);
 		if( $tmp < $endstamp ) {
 		  //myLog("Adding recurrence $tmp -> ".($tmp+$duration), RM_LOG_DEBUG );
-		  //$vFb->addBusyPeriod('BUSY', $tmp, null, $duration, $extra);
 		  $this->setBusy( $tmp, null, $duration );
 		} else {
 		  break;
@@ -108,7 +105,7 @@
 	      break;
 	    }
 	  }
-	case 'yearly':
+    case 'yearly':
 	  if( !$this->interval ) $interval = 1;
 	  $count = 0;
 	  for( $t = $this->initial_start; $t < $endstamp; $t = strtotime( "+$interval years", $t) ) {
@@ -117,7 +114,6 @@
 		$tmp = strtotime( "+$dayno days", $t);
 		if( $tmp < $endstamp ) {
 		  //myLog("Adding recurrence $tmp -> ".($tmp+$duration), RM_LOG_DEBUG );
-		  //$vFb->addBusyPeriod('BUSY', $tmp, null, $duration, $extra);
 		  $this->setBusy( $tmp, null, $duration );
 		} else {
 		  break;
@@ -131,7 +127,6 @@
 		$tmp = strtotime( "+$dayno $month", $t);
 		if( $tmp < $endstamp ) {
 		  //myLog("Adding recurrence $tmp -> ".($tmp+$duration), RM_LOG_DEBUG );
-		  //$vFb->addBusyPeriod('BUSY', $tmp, null, $duration, $extra);
 		  $this->setBusy( $tmp, null, $duration );	      
 		} else {
 		  break;
@@ -145,7 +140,6 @@
 		$tmp = strtotime( "+$dayno $wday", $t);
 		if( $tmp < $endstamp ) {
 		  //myLog("Adding recurrence $tmp -> ".($tmp+$duration), RM_LOG_DEBUG );
-		  //$vFb->addBusyPeriod('BUSY', $tmp, null, $duration, $extra);
 		  $this->setBusy( $tmp, null, $duration );	      
 		} else {
 		  break;
@@ -169,7 +163,7 @@
 
   var $initial_start = NULL; // timestamp
   var $initial_end   = NULL; // timestamp
-  var $cycle_type    = NULL; // string { 'daily', 'weekly', 'monthly', 'yearly'
+  var $cycle_type    = NULL; // string { 'daily', 'weekly', 'monthly', 'yearly' }
   var $type          = NULL; // string { 'daynumber', 'weekday', 'monthday', 'yearday' }
   var $interval      = NULL; // int
   var $daynumber     = NULL; // array(int)





More information about the commits mailing list