[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: calendar/inc class.bocalendar.inc.php,1.71.2.30
From: |
Ralf Becker <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: calendar/inc class.bocalendar.inc.php,1.71.2.30,1.71.2.31 class.uicalendar.inc.php,1.66.2.50,1.66.2.51 |
Date: |
Wed, 26 Feb 2003 11:21:32 -0500 |
Update of /cvsroot/phpgroupware/calendar/inc
In directory subversions:/tmp/cvs-serv24677
Modified Files:
Tag: Version-0_9_14-branch
class.bocalendar.inc.php class.uicalendar.inc.php
Log Message:
some fixes for recuring events:
- they show up in the planner now
- you are able to delete single occurantses of recuring events
applied patch #774 from mishas: dayview sometimes not showing 1. event
Index: class.bocalendar.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/calendar/inc/class.bocalendar.inc.php,v
retrieving revision 1.71.2.30
retrieving revision 1.71.2.31
diff -C2 -r1.71.2.30 -r1.71.2.31
*** class.bocalendar.inc.php 6 Feb 2003 22:15:05 -0000 1.71.2.30
--- class.bocalendar.inc.php 26 Feb 2003 16:21:29 -0000 1.71.2.31
***************
*** 515,518 ****
--- 515,521 ----
$this->so->add_entry($event);
$cd = 16;
+
+ $this->so->cal->event = $temp_event;
+ unset($temp_event);
}
else
***************
*** 521,526 ****
}
// }
- $this->so->cal->event = $temp_event;
- unset($temp_event);
return $cd;
}
--- 524,527 ----
***************
*** 933,936 ****
--- 934,976 ----
}
+ /*!
+ @function time2array
+ @abstract returns a date-array suitable for the start- or
endtime of an event from a timestamp
+ @syntax time2array($time,$alarm=0)
+ @param $time the timestamp for the values of the array
+ @param $alarm (optional) alarm field of the array, defaults to 0
+ @author ralfbecker
+ */
+ function time2array($time,$alarm = 0)
+ {
+ return array(
+ 'year' => intval(date('Y',$time)),
+ 'month' => intval(date('m',$time)),
+ 'mday' => intval(date('d',$time)),
+ 'hour' => intval(date('H',$time)),
+ 'min' => intval(date('i',$time)),
+ 'sec' => intval(date('s',$time)),
+ 'alarm' => intval($alarm)
+ );
+ }
+
+ /*!
+ @function set_recur_date
+ @abstract set the start- and enddates of a recuring event for a
recur-date
+ @syntax set_recur_date(&$event,$date)
+ @param $event the event which fields to set (has to be the
original event for start-/end-times)
+ @param $date the recuring date in form 'Ymd', eg. 20030226
+ @author ralfbecker
+ */
+ function set_recur_date(&$event,$date)
+ {
+ $org_start = $this->maketime($event['start']);
+ $org_end = $this->maketime($event['end']);
+ $start =
mktime($event['start']['hour'],$event['start']['min'],0,substr($date,4,2),substr($date,6,2),substr($date,0,4));
+ $end = $org_end + $start - $org_start;
+ $event['start'] = $this->time2array($start);
+ $event['end'] = $this->time2array($end);
+ }
+
function fix_update_time(&$time_param)
{
***************
*** 2294,2298 ****
{
$already_moved = Array();
- $has_category = Array(); // remove only multiple
occurences of a category per event/day
for($v=$firstday;$v<=$lastday;$v++)
{
--- 2334,2337 ----
***************
*** 2301,2370 ****
continue;
}
! while (list($g,$event) =
each($this->cached_events[$v]))
{
! $start =
sprintf('%04d%02d%02d',$event['start']['year'],$event['start']['month'],$event['start']['mday']);
print_debug('EVENT',_debug_array($event,False));
print_debug('start',$start);
print_debug('v',$v);
! if($start < $firstday)
! {
! $start = $firstday; // event
continues into current month/year
! }
!
! // if ($start != $v &&
$event['recur_type'] == MCAL_RECUR_NONE)
// this is an enddate-entry --> remove it
! if ($start != $v)
// this is an enddate-entry --> remove it
! {
!
unset($this->cached_events[$v][$g]);
! if($g !=
count($this->cached_events[$v]))
! {
! if
($has_category[$event['id']]['category'] != True)
! {
! continue; // we
need at least one evidence for this category
! }
! for($h=$g +
1;$h<$c_daily;$h++)
! {
!
$this->cached_events[$v][$h - 1] = $this->cached_events[$v][$h];
! }
!
$has_category[$event['id']]['category'] = True;
!
unset($this->cached_events[$v][$h]);
! }
!
! // if ($start < $firstday &&
$event['recur_type'] == MCAL_RECUR_NONE) // start
before period --> move it to the beginning
! if ($start < $firstday)
// start before period --> move it to the beginning
! {
!
if($already_moved[$event['id']] > 0)
! {
! continue;
! }
! $add_event = True;
! $c_events =
count($this->cached_events[$firstday]);
!
for($i=0;$i<$c_events;$i++)
! {
! $add_event =
($this->cached_events[$firstday][$i]['id'] == $event['id']?False:$add_event);
! }
! if($add_event)
! {
!
$this->cached_events[$firstday][] = $event;
!
$already_moved[$event['id']] = 1;
!
print_debug('Event moved');
! }
! else
! {
!
$already_moved[$event['id']] = 2;
!
print_debug('Event removed (not moved');
! }
! }
! else
! {
! print_debug('Event
removed');
! }
! }
! else
{
! print_debug('Event OK');
}
}
- flush();
}
}
--- 2340,2359 ----
continue;
}
! $cached = $this->cached_events[$v];
! $this->cached_events[$v] = array();
! while (list($g,$event) = each($cached))
{
! $end =
date('Ymd',$this->maketime($event['end']));
print_debug('EVENT',_debug_array($event,False));
print_debug('start',$start);
print_debug('v',$v);
! if
(!isset($already_moved[$event['id']]) || $event['recur_type'] && $v > $end)
{
! $this->cached_events[$v][] =
$event;
! $already_moved[$event['id']] =
1;
! print_debug('Event moved');
}
}
}
}
Index: class.uicalendar.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/calendar/inc/class.uicalendar.inc.php,v
retrieving revision 1.66.2.50
retrieving revision 1.66.2.51
diff -C2 -r1.66.2.50 -r1.66.2.51
*** class.uicalendar.inc.php 13 Feb 2003 23:12:31 -0000 1.66.2.50
--- class.uicalendar.inc.php 26 Feb 2003 16:21:29 -0000 1.66.2.51
***************
*** 777,780 ****
--- 777,781 ----
'action_confirm_button' =>
"onClick=\"return confirm('".lang("Are you sure\\nyou want to\\ndelete this
single occurence ?\\n\\nThis will delete\\nthis entry for all users.")."')\"",
'action_extra_field' =>
'<input type="hidden" name="delete_type" value="single">'
+ . '<input type="hidden"
name="date"
value="'.sprintf('%04d%02d%02d',$this->bo->year,$this->bo->month,$this->bo->day).'">'
);
$p->set_var($var);
***************
*** 843,851 ****
function edit($params='')
{
! if(!$this->bo->check_perms(PHPGW_ACL_EDIT))
! {
! $this->no_edit();
! }
!
if($this->debug)
{
--- 844,853 ----
function edit($params='')
{
! // No event loaded, so what to check?
! // if(!$this->bo->check_perms(PHPGW_ACL_EDIT))
! // {
! // $this->no_edit();
! // }
!
if($this->debug)
{
***************
*** 889,898 ****
{
$event['id'] = 0;
! $event['start']['month'] =
$this->bo->month;
! $event['start']['mday'] =
$this->bo->day;
! $event['start']['year'] =
$this->bo->year;
! $event['end']['month'] =
$this->bo->month;
! $event['end']['mday'] = $this->bo->day;
! $event['end']['year'] = $this->bo->year;
$event['recur_type'] = MCAL_RECUR_NONE;
$event['recur_interval'] = 0;
--- 891,895 ----
{
$event['id'] = 0;
!
$this->bo->set_recur_date($event,$GLOBALS['HTTP_POST_VARS']['date']);
$event['recur_type'] = MCAL_RECUR_NONE;
$event['recur_interval'] = 0;
***************
*** 901,904 ****
--- 898,902 ----
$event['recur_enddate']['mday'] = 0;
$event['recur_enddate']['year'] = 0;
+ $event['recur_execption'] = array();
}
$this->edit_form(
***************
*** 1171,1180 ****
if(isset($GLOBALS['HTTP_POST_VARS']['delete_type']) &&
$GLOBALS['HTTP_POST_VARS']['delete_type'] == 'single')
{
$cd = $this->bo->delete_single(
Array(
'id' => $cal_id,
! 'year' =>
$this->bo->year,
! 'month' =>
$this->bo->month,
! 'day' =>
$this->bo->day
)
);
--- 1169,1179 ----
if(isset($GLOBALS['HTTP_POST_VARS']['delete_type']) &&
$GLOBALS['HTTP_POST_VARS']['delete_type'] == 'single')
{
+ $date =
$GLOBALS['HTTP_POST_VARS']['date'];
$cd = $this->bo->delete_single(
Array(
'id' => $cal_id,
! 'year' =>
substr($date,0,4),
! 'month' =>
substr($date,4,2),
! 'day' =>
substr($date,6,2)
)
);
***************
*** 1564,1568 ****
* planner_update_row - update a row of the planner view
*
! * parameters are:
* - index (e.g. user id, category id, ...) of the row
* - name/title of the row (e.g. user name, category name)
--- 1563,1567 ----
* planner_update_row - update a row of the planner view
*
! * parameters are:
* - index (e.g. user id, category id, ...) of the row
* - name/title of the row (e.g. user name, category name)
***************
*** 1576,1584 ****
$intervals_per_day =
$this->bo->prefs['calendar']['planner_intervals_per_day'];
$is_private =
!$this->bo->check_perms(PHPGW_ACL_READ,$event);
!
$view = $this->planner_html->link('/index.php',
array(
'menuaction' =>
'calendar.uicalendar.view',
! 'cal_id' => $event['id']
)
);
--- 1575,1584 ----
$intervals_per_day =
$this->bo->prefs['calendar']['planner_intervals_per_day'];
$is_private =
!$this->bo->check_perms(PHPGW_ACL_READ,$event);
!
$view = $this->planner_html->link('/index.php',
array(
'menuaction' =>
'calendar.uicalendar.view',
! 'cal_id' => $event['id'],
! 'date' =>
date('Ymd',$this->bo->maketime($event['start']))
)
);
***************
*** 1611,1621 ****
} while ($akt_cell > $start_cell);
if ($akt_cell < $start_cell)
{
! $row[$event['id'].'_1'] = ' ';
! $row['.'.$event['id'].'_1'] =
'colspan="'.($start_cell-$akt_cell).'"';
}
! $opt = &$row['.'.$event['id'].'_2'];
! $cel = &$row[$event['id'].'_2'];
// if possible, display information about event within
cells representing it
--- 1611,1622 ----
} while ($akt_cell > $start_cell);
+ $id =
$event['id'].'-'.date('Ymd',$this->bo->maketime($event['start']));
if ($akt_cell < $start_cell)
{
! $row[$id.'_1'] = ' ';
! $row['.'.$id.'_1'] =
'colspan="'.($start_cell-$akt_cell).'"';
}
! $opt = &$row['.'.$id.'_2'];
! $cel = &$row[$id.'_2'];
// if possible, display information about event within
cells representing it
***************
*** 1697,1700 ****
--- 1698,1705 ----
$cel .=
$this->planner_html->image('calendar','mini-calendar-bar.gif','','border="0"');
}
+ if ($event['recur_type'])
+ {
+ $cel .=
$this->planner_html->image('calendar','recur.gif','','border="0"');
+ }
$cel .=
$this->planner_html->image('calendar',count($event['participants'])>1?'multi_3.gif':'single.gif',$this->planner_participants($event['participants']),'border="0"');
$cel .= '</a>';
***************
*** 1749,1753 ****
{
$days_between =
$GLOBALS['phpgw']->datetime->days_between($this->bo->month,1,$this->bo->year,$event['end']['month'],$event['end']['mday'],$event['end']['year']);
-
$end_cell = $intervals_per_day * $days_between
+ $interval[$event['end']['hour']];
if ($end_cell == $start_cell && $end_cell <
$last_cell)
--- 1754,1757 ----
***************
*** 1760,1764 ****
$end_cell = $last_cell;
}
-
// get the categories associated with event
//
--- 1764,1767 ----
***************
*** 1899,1904 ****
// process all events on day $v
//
! while (list($nul,$event) = @each($daily))
{
$this->planner_process_event($event);
}
--- 1902,1911 ----
// process all events on day $v
//
! while (list(,$event) = @each($daily))
{
+ if ($event['recur_type']) //
calculate start- + end-datetime for recuring events
+ {
+
$this->bo->set_recur_date($event,$v);
+ }
$this->planner_process_event($event);
}
***************
*** 3441,3445 ****
{
print_debug('IND before',$ind);
! if($ind <=
date('H',$last_endtime-1)) // -1 to allow events to end on a full hour,
without blocking the next hour-slot
{
$ind = $last_ind;
--- 3448,3452 ----
{
print_debug('IND before',$ind);
! if($ind <=
date('H',$last_endtime-1) && $last_ind) // -1 to allow events to end on a
full hour, without blocking the next hour-slot
{
$ind = $last_ind;
***************
*** 4101,4105 ****
'action_url_button' =>
$this->page('delete','&cal_id='.$event['id']),
'action_text_button' =>
lang('Delete'),
! 'action_confirm_button' =>
"onClick=\"return confirm('".lang("Are you sure\\nyou want to \\ndelete this
entry?\\n\\nThis will delete\\nthis entry for all users.")."')\"",
'action_extra_field' => ''
);
--- 4108,4112 ----
'action_url_button' =>
$this->page('delete','&cal_id='.$event['id']),
'action_text_button' =>
lang('Delete'),
! 'action_confirm_button' =>
"onClick=\"return confirm('".lang("Are you sure\\nyou want to \\ndelete this
entry ?\\n\\nThis will delete\\nthis entry for all users.")."')\"",
'action_extra_field' => ''
);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: calendar/inc class.bocalendar.inc.php,1.71.2.30,1.71.2.31 class.uicalendar.inc.php,1.66.2.50,1.66.2.51,
Ralf Becker <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: property/templates/default apartment.xsl,NONE,1.1 entrance.xsl,1.1,1.2
- Next by Date:
[Phpgroupware-cvs] CVS: calendar/setup phpgw_de.lang,1.12.2.8,1.12.2.9 phpgw_en.lang,1.13.2.15,1.13.2.16
- Previous by thread:
[Phpgroupware-cvs] CVS: property/templates/default apartment.xsl,NONE,1.1 entrance.xsl,1.1,1.2
- Next by thread:
[Phpgroupware-cvs] CVS: calendar/setup phpgw_de.lang,1.12.2.8,1.12.2.9 phpgw_en.lang,1.13.2.15,1.13.2.16
- Index(es):