phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] calendar/inc class.bocalendar.inc.php class.boc...


From: Sigurd Nes
Subject: [Phpgroupware-cvs] calendar/inc class.bocalendar.inc.php class.boc...
Date: Thu, 07 Dec 2006 11:50:51 +0000

CVSROOT:        /sources/phpgroupware
Module name:    calendar
Changes by:     Sigurd Nes <sigurdne>   06/12/07 11:50:51

Modified files:
        inc            : class.bocalendar.inc.php 
                         class.bocustom_fields.inc.php 
                         class.socalendar_sql.inc.php 
                         class.uicalendar.inc.php 

Log message:
        notices and some fixes

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/calendar/inc/class.bocalendar.inc.php?cvsroot=phpgroupware&r1=1.111&r2=1.112
http://cvs.savannah.gnu.org/viewcvs/calendar/inc/class.bocustom_fields.inc.php?cvsroot=phpgroupware&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/calendar/inc/class.socalendar_sql.inc.php?cvsroot=phpgroupware&r1=1.45&r2=1.46
http://cvs.savannah.gnu.org/viewcvs/calendar/inc/class.uicalendar.inc.php?cvsroot=phpgroupware&r1=1.131&r2=1.132

Patches:
Index: class.bocalendar.inc.php
===================================================================
RCS file: /sources/phpgroupware/calendar/inc/class.bocalendar.inc.php,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -b -r1.111 -r1.112
--- class.bocalendar.inc.php    6 Dec 2006 19:10:45 -0000       1.111
+++ class.bocalendar.inc.php    7 Dec 2006 11:50:51 -0000       1.112
@@ -12,7 +12,7 @@
   *  option) any later version.                                              *
   \**************************************************************************/
 
-       /* $Id: class.bocalendar.inc.php,v 1.111 2006/12/06 19:10:45 sigurdne 
Exp $ */
+       /* $Id: class.bocalendar.inc.php,v 1.112 2006/12/07 11:50:51 sigurdne 
Exp $ */
 
        class bocalendar
        {
@@ -1413,7 +1413,7 @@
                                $private = $event['public'] == False || 
$event['public'] == 0;
                        }
                        $user = $GLOBALS['phpgw_info']['user']['account_id'];
-                       $grants = $this->grants[$owner];
+                       $grants = 
(isset($this->grants[$owner])?$this->grants[$owner]:'');
 
                        if ( $owner == $user ) //if the current user is the 
owner they have full rights
                        {
@@ -1424,15 +1424,31 @@
                        {
                                // Check if the $user is one of the 
participants or has a read-grant from one of them
                                //
+
+/*                             this logic must be wrong - gets mapped to the 
wrong user - ask Dave                             
                                foreach($event['participants'] as $contact_id 
=> $accept)
                                {
-                                       if 
($this->grants[$GLOBALS['phpgw']->accounts->search_person($contact_id)] & 
PHPGW_ACL_READ 
+                                       if 
(isset($this->grants[$GLOBALS['phpgw']->accounts->search_person($contact_id)])
+                                               && 
($this->grants[$GLOBALS['phpgw']->accounts->search_person($contact_id)] & 
PHPGW_ACL_READ) 
                                                || 
$GLOBALS['phpgw']->accounts->search_person($contact_id) == $user)
                                        {
                                                $grants |= PHPGW_ACL_READ;
                                                break;
                                        }
                                }
+
+*/
+                               // the contact is the person - right ?
+                               foreach($event['participants'] as $contact_id 
=> $accept)
+                               {
+                                       if (isset($this->grants[$contact_id])
+                                               && ($this->grants[$contact_id] 
& PHPGW_ACL_READ) 
+                                               || $contact_id == $user)
+                                       {
+                                               $grants |= PHPGW_ACL_READ;
+                                               break;
+                                       }
+                               }
                        }
 
                        if ( $this->is_group && $needed == PHPGW_ACL_ADD)
@@ -1812,6 +1828,8 @@
                        $r_events = count($repeated);
                        for ($i=0;$i<$r_events;$i++)
                        {
+                               if($this->repeating_events[$i]['recur_type'] 
!=0)
+                               {
                                $rep_events = $this->repeating_events[$i];
                                $id = $rep_events['id'];
                                $event_beg_day = 
mktime(0,0,0,$rep_events['start']['month'],$rep_events['start']['mday'],$rep_events['start']['year']);
@@ -1936,6 +1954,7 @@
                                                        break;
                                        }
                                }
+                               }
                        }       // end for loop
                }       // end function
 
@@ -2040,20 +2059,22 @@
                                                $start['mday'] = 
intval(substr($startdate,6,2));
                                                
for($j=$startdate,$k=0;$j<=$enddate;$k++,$j=intval(date('Ymd',mktime(0,0,0,$start['month'],$start['mday']
 + $k,$start['year']))))
                                                {
-                                                       $c_evt_day = 
count($this->cached_events[$j]) - 1;
-                                                       if($c_evt_day < 0)
-                                                       {
                                                                $c_evt_day = 0;
+                                                       
if(isset($this->cached_events[$j]) && is_array($this->cached_events[$j]))
+                                                       {
+                                                               $c_evt_day = 
count($this->cached_events[$j]);
                                                        }
+
                                                        if($this->debug)
                                                        {
-                                                               echo '<!-- 
Date: '.$j.' Count : '.$c_evt_day.' -->'."\n";
+                                                               echo 'Date: 
'.$j.' Count : '.$c_evt_day."\n";
                                                        }
-                                                       
if($this->cached_events[$j][$c_evt_day]['id'] != $event['id'])
+                                                       
if(!isset($this->cached_events[$j][$c_evt_day])
+                                                               
||$this->cached_events[$j][$c_evt_day]['id'] != $event['id'])
                                                        {
                                                                if($this->debug)
                                                                {
-                                                                       echo 
'<!-- Adding Event for Date: '.$j.' -->'."\n";
+                                                                       echo 
'Adding Event for Date: '.$j."\n";
                                                                }
                                                                
$this->cached_events[$j][] = $event;
                                                        }
@@ -2097,7 +2118,7 @@
                        $retval = array();
                        
for($j=date('Ymd',mktime(0,0,0,$smonth,$sday,$syear)),$k=0;$j<=date('Ymd',mktime(0,0,0,$emonth,$eday,$eyear));$k++,$j=date('Ymd',mktime(0,0,0,$smonth,$sday
 + $k,$syear)))
                        {
-                               if(is_array($this->cached_events[$j]))
+                               if(isset($this->cached_events[$j]) && 
is_array($this->cached_events[$j]))
                                {
                                        $retval[$j] = $this->cached_events[$j];
                                }
@@ -2868,7 +2889,7 @@
                        );
 
                        $cats = array();
-                       $this->cat->categories($this->bo->owner,'calendar');
+                       $this->cat->categories($this->owner,'calendar');
                        if(strpos($event['category'],','))
                        {
                                $cats = explode(',',$event['category']);
@@ -3012,7 +3033,7 @@
                        }
                        foreach($this->fields as $field => $data)
                        {
-                               if (!$data['disabled'])
+                               if (!isset($data['disabled']) || 
!$data['disabled'])
                                {
                                        if (isset($var[$field]))
                                        {

Index: class.bocustom_fields.inc.php
===================================================================
RCS file: /sources/phpgroupware/calendar/inc/class.bocustom_fields.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- class.bocustom_fields.inc.php       15 May 2005 06:57:37 -0000      1.2
+++ class.bocustom_fields.inc.php       7 Dec 2006 11:50:51 -0000       1.3
@@ -10,7 +10,7 @@
   *  option) any later version.                                              *
   \**************************************************************************/
 
-       /* $Id: class.bocustom_fields.inc.php,v 1.2 2005/05/15 06:57:37 skwashd 
Exp $ */
+       /* $Id: class.bocustom_fields.inc.php,v 1.3 2006/12/07 11:50:51 
sigurdne Exp $ */
 
        class bocustom_fields
        {
@@ -67,9 +67,9 @@
                                                'disabled' => $data['disabled']
                                        );
                                }
-                               $this->fields[$field]['label']  = 
$data['label'];
-                               $this->fields[$field]['length'] = 
$data['length'];
-                               $this->fields[$field]['shown']  = 
$data['shown'];
+                               $this->fields[$field]['label']  = 
(isset($data['label'])?$data['label']:'');
+                               $this->fields[$field]['length'] = 
(isset($data['length'])?$data['length']:'');
+                               $this->fields[$field]['shown']  = 
(isset($data['shown'])?$data['shown']:'');
                        }
                }
 

Index: class.socalendar_sql.inc.php
===================================================================
RCS file: /sources/phpgroupware/calendar/inc/class.socalendar_sql.inc.php,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -b -r1.45 -r1.46
--- class.socalendar_sql.inc.php        6 Dec 2006 15:12:46 -0000       1.45
+++ class.socalendar_sql.inc.php        7 Dec 2006 11:50:51 -0000       1.46
@@ -12,7 +12,7 @@
   *  option) any later version.                                              *
   \**************************************************************************/
 
-  /* $Id: class.socalendar_sql.inc.php,v 1.45 2006/12/06 15:12:46 sigurdne Exp 
$ */
+  /* $Id: class.socalendar_sql.inc.php,v 1.46 2006/12/07 11:50:51 sigurdne Exp 
$ */
 
 class socalendar_ extends socalendar__
 {
@@ -302,6 +302,10 @@
                                }
                                
$this->add_attribute('recur_exception',$exceptions);
                        }
+                       else
+                       {
+                               $this->add_attribute('recur_type',0);
+                       }
                        
                //Legacy Support
                        $this->stream->query('SELECT * FROM phpgw_cal_user 
WHERE cal_id='.$event_id,__LINE__,__FILE__);

Index: class.uicalendar.inc.php
===================================================================
RCS file: /sources/phpgroupware/calendar/inc/class.uicalendar.inc.php,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -b -r1.131 -r1.132
--- class.uicalendar.inc.php    6 Dec 2006 19:10:45 -0000       1.131
+++ class.uicalendar.inc.php    7 Dec 2006 11:50:51 -0000       1.132
@@ -12,7 +12,7 @@
   *  option) any later version.                                              *
   \**************************************************************************/
 
-       /* $Id: class.uicalendar.inc.php,v 1.131 2006/12/06 19:10:45 sigurdne 
Exp $ */
+       /* $Id: class.uicalendar.inc.php,v 1.132 2006/12/07 11:50:51 sigurdne 
Exp $ */
 
        class uicalendar
        {
@@ -563,8 +563,9 @@
                        $datetime = 
mktime(0,0,0,$this->bo->month,$this->bo->day,$this->bo->year) - 
$GLOBALS['phpgw']->datetime->tz_offset;
                        $this->bo->check_repeating_events($datetime);
                        $check_date = 
$GLOBALS['phpgw']->common->show_date($datetime,'Ymd');
-                       if(is_array($this->bo->cached_events[$check_date][0]) &&
-                               $this->bo->cached_events[$check_date][0]['id'] 
== $event['id'])
+                       if(isset($this->bo->cached_events[$check_date][0])
+                               && 
is_array($this->bo->cached_events[$check_date][0])
+                               && 
$this->bo->cached_events[$check_date][0]['id'] == $event['id'])
                        {
                                $starttime = 
$this->bo->maketime($event['start']);
                                $endtime = $this->bo->maketime($event['end']);
@@ -2435,7 +2436,7 @@
                        }
                        elseif 
(intval($GLOBALS['phpgw']->common->show_date($starttime,'Hi')) || $starttime != 
$endtime)
                        {
-                               if($starttime < $rawdate_offset && 
$event['recur_type']==MCAL_RECUR_NONE)
+                               if($starttime < $rawdate_offset && 
isset($event['recur_type']) && $event['recur_type']==MCAL_RECUR_NONE)
                                {
                                        $start_time = 
$GLOBALS['phpgw']->common->show_date($rawdate_offset,$this->bo->users_timeformat);
                                }
@@ -2567,7 +2568,8 @@
                                                'title' => lang('high priority')
                                        );
                                }
-                               if($event['recur_type'] == MCAL_RECUR_NONE)
+
+                               if(isset($event['recur_type']) && 
$event['recur_type'] == MCAL_RECUR_NONE)
                                {
                                        $picture[] = array(
                                                'pict'  => 
$GLOBALS['phpgw']->common->image('calendar','circle'),
@@ -3233,10 +3235,15 @@
                        
                        $date_to_eval = 
sprintf("%04d%02d%02d",$params['year'],$params['month'],$params['day']);
 
-                       $day_start = 
mktime(intval($this->bo->prefs['calendar']['workdaystarts']),0,0,$params['month'],$params['day'],$params['year']);
-                       $day_end = 
mktime(intval($this->bo->prefs['calendar']['workdayends']),0,1,$params['month'],$params['day'],$params['year']);
+//                     $day_start = 
mktime(intval($this->bo->prefs['calendar']['workdaystarts']),0,0,$params['month'],$params['day'],$params['year']);
+//                     $day_end = 
mktime(intval($this->bo->prefs['calendar']['workdayends']),0,1,$params['month'],$params['day'],$params['year']);
+                       $day_start = 
mktime(intval($this->bo->prefs['calendar']['workdaystarts']),0,0,0,0,0);
+                       $day_end = 
mktime(intval($this->bo->prefs['calendar']['workdayends']),0,1,0,0,0);
+
                        $daily = 
$this->set_week_array($GLOBALS['phpgw']->datetime->get_weekday_start($params['year'],$params['month'],$params['day']),$this->theme['row_on'],True);
                        print_debug('Date to Eval',$date_to_eval);
+                       $rows = array();
+                       $last_slot = 
$this->slot_num($day_end,$day_start,$day_end);
                        if($daily[$date_to_eval]['appts'])
                        {
                                $events = 
$this->bo->cached_events[$date_to_eval];
@@ -3260,13 +3267,13 @@
                                        {
                                                continue;       // user does 
not want to see rejected events
                                        }
-                                       if ($event['recur_type'])       // 
calculate start- + end-datetime for recuring events
+                                       if (isset($event['recur_type']) && 
$event['recur_type'])        // calculate start- + end-datetime for recuring 
events
                                        {
                                                
$this->bo->set_recur_date($event,$date_to_eval);
                                        }
                                        $starttime = 
$this->bo->maketime($event['start']);
                                        $endtime = 
$this->bo->maketime($event['end']);
-                                       $slot = 
$this->slot_num($starttime,$day_start,$day_end);
+                                       $slot = 
$this->slot_num($starttime,mktime(intval($this->bo->prefs['calendar']['workdaystarts']),0,0,$event['start']['month'],$event['start']['mday'],$event['start']['year']),mktime(intval($this->bo->prefs['calendar']['workdaystarts']),0,0,$event['end']['month'],$event['end']['mday'],$event['end']['year']));
                                        $slot_end = 
$this->slot_num($endtime-1);        // -1 to no occupy eg. the 18.00 slot for a 
17-18h date
 
                                        if ($slot <= $last_slot_end)
@@ -3274,7 +3281,15 @@
                                                $slot = $last_slot;
                                                $slot_end = 
max($last_slot_end,$slot_end);
                                        }
+                                       if(isset($rows[$slot]))
+                                       {
                                        $rows[$slot] .= 
$this->link_to_entry($event,$params['month'],$params['day'],$params['year']);
+                                       }
+                                       else
+                                       {
+                                               $rows[$slot] = 
$this->link_to_entry($event,$params['month'],$params['day'],$params['year']);   
                                 
+                                       }
+
 ## by tb  --> old cat-colors: has problems with overlaying events
 #                                      $tmp_cats = 
explode(',',$event['category']);
 #                                      $tmp_cat  = $tmp_cats[0];
@@ -3287,7 +3302,7 @@
                                        
                                        $last_slot = $slot;
                                        $last_slot_end = $slot_end;
-                                       
print_debug('Time',$GLOBALS['phpgw']->common->show_date($this->bo->maketime($events[$i]['start'])
 - $GLOBALS['phpgw']->datetime->tz_offset).' - 
'.$GLOBALS['phpgw']->common->show_date($this->bo->maketime($events[$i]['end']) 
- $GLOBALS['phpgw']->datetime->tz_offset));
+                                       
print_debug('Time',$GLOBALS['phpgw']->common->show_date($this->bo->maketime($event['start'])
 - $GLOBALS['phpgw']->datetime->tz_offset).' - 
'.$GLOBALS['phpgw']->common->show_date($this->bo->maketime($event['end']) - 
$GLOBALS['phpgw']->datetime->tz_offset));
                                        print_debug('Slot',$slot);
                                }
                                //echo "rows=<pre>"; print_r($rows); echo "<br 
/>row_span="; print_r($row_span); echo "</pre>\n";




reply via email to

[Prev in Thread] Current Thread [Next in Thread]