included other timed events (eg. phonecalls) and (untimed) todo's into the calendar dayview

This commit is contained in:
Ralf Becker 2003-09-07 16:55:36 +00:00
parent ef850c835b
commit 3a5d9ed79f
10 changed files with 258 additions and 120 deletions

View File

@ -1276,6 +1276,7 @@
$p->set_block('day_t','day','day');
$p->set_block('day_t','day_event','day_event');
$todos = $this->get_todos($todo_label);
$var = Array(
'printer_friendly' => $printer,
'bg_text' => $this->theme['bg_text'],
@ -1289,7 +1290,10 @@
'small_calendar' => $minical,
'date' => $this->bo->long_date($now),
'username' => $GLOBALS['phpgw']->common->grab_owner_name($this->bo->owner),
'print' => $print
'print' => $print,
'lang_todos' => $todo_label,
'todos' => $this->bo->printer_friendly ? $todos :
"<div style=\"overflow: auto; height: 200px\">\n$todos</div>\n"
);
$p->set_var($var);
@ -1297,6 +1301,52 @@
echo $this->printer_friendly($p->fp('out','day'),lang('Dayview'));
}
function get_todos(&$todo_label)
{
$todos_from_hook = $GLOBALS['phpgw']->hooks->process(array(
'location' => 'calendar_include_todos',
'year' => $this->bo->year,
'month' => $this->bo->month,
'day' => $this->bo->day,
'owner' => $this->bo->owner // num. id of the user, not necessary current user
));
$content = $todo_label = '';
if (is_array($todos_from_hook))
{
foreach($todos_from_hook as $todos)
{
if (is_array($todos) && count($todos))
{
$todo_label = lang("open ToDo's:");
if (!is_object($GLOBALS['phpgw']->html))
{
$GLOBALS['phpgw']->html = CreateObject('calendar.html');
}
foreach($todos as $todo)
{
$icons = '';
foreach($todo['icons'] as $name => $app)
{
$icons .= ($icons?' ':'').$GLOBALS['phpgw']->html->image($app,$name,lang($name),'border="0" width="15" height="15"');
}
$content .= " <tr>\n <td valign=\"top\" nowrap>".
($this->bo->printer_friendly?$icons:$GLOBALS['phpgw']->html->a_href($icons,$todo['view'])).
"</td>\n <td>".($this->bo->printer_friendly?$todo['title']:
$GLOBALS['phpgw']->html->a_href($todo['title'],$todo['view']))."</td>\n </tr>\n";
}
}
}
}
if (!empty($content))
{
//echo "todos=<table border=\"0\">\n$content</table>\n";
return "<table border=\"0\">\n$content</table>\n";
}
return False;
}
function edit_status()
{
unset($GLOBALS['phpgw_info']['flags']['noheader']);
@ -2492,18 +2542,18 @@
$time_width = (intval($this->bo->prefs['common']['time_format']) == 12?10:7);
}
return 'A.minicalendar { color: #000000; font: xx-small '.$this->theme['font'].' }'."\n"
. ' A.bminicalendar { color: #336699; font: italic bold xx-small '.$this->theme['font'].' }'."\n"
. ' A.minicalendargrey { color: #999999; font: xx-small '.$this->theme['font'].' }'."\n"
. ' A.bminicalendargrey { color: #336699; font: italic bold xx-small '.$this->theme['font'].' }'."\n"
. ' A.minicalhol { padding-left:3px; padding-right:3px; background: '.$this->holiday_color.'; color: #000000; font: xx-small '.$this->theme['font'].' }'."\n"
. ' A.bminicalhol { padding-left:3px; padding-right:3px; background: '.$this->holiday_color.'; color: #336699; font: italic bold xx-small '.$this->theme['font'].' }'."\n"
. ' A.minicalgreyhol { padding-left:3px; padding-right:3px; background: '.$this->holiday_color.'; color: #999999; font: xx-small '.$this->theme['font'].' }'."\n"
. ' A.bminicalgreyhol { padding-left:3px; padding-right:3px; background: '.$this->holiday_color.'; color: #999999; font: italic bold xx-small '.$this->theme['font'].' }'."\n"
. ' .event-on { background: '.$this->theme['row_on'].'; color: '.$this->theme['bg_text'].'; font: 100 80%/110% '.$this->theme['font'].'; vertical-align: middle }'."\n"
. ' .event-off { background: '.$this->theme['row_off'].'; color: '.$this->theme['bg_text'].'; font: 100 80%/110% '.$this->theme['font'].'; vertical-align: middle }'."\n"
. ' .event-holiday { background: '.$this->theme['bg04'].'; color: '.$this->theme['bg_text'].'; font: 100 80%/110% '.$this->theme['font'].'; vertical-align: middle }'."\n"
. ' .time { background: '.$this->theme['navbar_bg'].'; color: '.$this->theme['bg_text'].'; font: 80%/110% '.$this->theme['font'].'; width: '.$time_width.'%; border: 1px '.$this->theme['navbar_text'].'; vertical-align: middle }'."\n"
return 'A.minicalendar { color: #000000; font: x-small '.$this->theme['font'].' }'."\n"
. ' A.bminicalendar { color: #336699; font: italic bold x-small '.$this->theme['font'].' }'."\n"
. ' A.minicalendargrey { color: #999999; font: x-small '.$this->theme['font'].' }'."\n"
. ' A.bminicalendargrey { color: #336699; font: italic bold x-small '.$this->theme['font'].' }'."\n"
. ' A.minicalhol { padding-left:3px; padding-right:3px; background: '.$this->holiday_color.'; color: #000000; font: x-small '.$this->theme['font'].' }'."\n"
. ' A.bminicalhol { padding-left:3px; padding-right:3px; background: '.$this->holiday_color.'; color: #336699; font: italic bold x-small '.$this->theme['font'].' }'."\n"
. ' A.minicalgreyhol { padding-left:3px; padding-right:3px; background: '.$this->holiday_color.'; color: #999999; font: x-small '.$this->theme['font'].' }'."\n"
. ' A.bminicalgreyhol { padding-left:3px; padding-right:3px; background: '.$this->holiday_color.'; color: #999999; font: italic bold x-small '.$this->theme['font'].' }'."\n"
. ' .event-on { background: '.$this->theme['row_on'].'; color: '.$this->theme['bg_text'].'; font: 100% '.$this->theme['font'].'; vertical-align: middle }'."\n"
. ' .event-off { background: '.$this->theme['row_off'].'; color: '.$this->theme['bg_text'].'; font: 100% '.$this->theme['font'].'; vertical-align: middle }'."\n"
. ' .event-holiday { background: '.$this->theme['bg04'].'; color: '.$this->theme['bg_text'].'; font: 100% '.$this->theme['font'].'; vertical-align: middle }'."\n"
. ' .time { background: '.$this->theme['row_on'].'; color: '.$this->theme['bg_text'].'; font: bold 100% '.$this->theme['font'].'; width: '.$time_width.'%; vertical-align: middle; text-align: center; }'."\n"
. ' .tablecell { width: 80px; height: 80px }'."\n"
. ' .planner-cell { cursor:pointer; cursor:hand; border: thin solid black; }';
}
@ -2572,7 +2622,7 @@
{
$text .= $this->bo->display_status($event['users_status']);
}
$text = '<font size="-2" face="'.$this->theme['font'].'"><nobr>&nbsp;'.$time.'&nbsp;</nobr> '.$this->bo->get_short_field($event,$is_private,'title').$text.': <I>'.$this->bo->get_short_field($event,$is_private,'description').'</I></font>'.$GLOBALS['phpgw']->browser->br;
$text = '<nobr>&nbsp;'.$time.'&nbsp;</nobr> '.$this->bo->get_short_field($event,$is_private,'title').$text.': <I>'.$this->bo->get_short_field($event,$is_private,'description').'</I>'.$GLOBALS['phpgw']->browser->br;
if ($editable)
{
@ -3242,7 +3292,7 @@
$events = $this->bo->cached_events[$date_to_eval];
print_debug('Date',$date_to_eval);
print_debug('Count',count($events));
$last_slot_end = -1;
$events_to_show = array();
foreach($events as $event)
{
if ($this->bo->rejected_no_show($event))
@ -3253,17 +3303,46 @@
{
$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_end = $this->slot_num($endtime-1); // -1 to no occupy eg. the 18.00 slot for a 17-18h date
$events_to_show[] = array(
'starttime' => $this->bo->maketime($event['start']),
'endtime' => $this->bo->maketime($event['end']),
'content' => $this->link_to_entry($event,$params['month'],$params['day'],$params['year'])
);
}
//echo "events_to_show=<pre>"; print_r($events_to_show); echo "</pre>\n";
$other = $GLOBALS['phpgw']->hooks->process(array(
'location' => 'calendar_include_events',
'year' => $params['year'],
'month' => $params['month'],
'day' => $params['day'],
'owner' => $this->bo->owner // num. id of the user, not necessary current user
));
if (is_array($other))
{
foreach($other as $evts)
{
if (is_array($evts))
{
$events_to_show = array_merge($events_to_show,$evts);
}
}
usort($events_to_show,create_function('$a,$b','return $a[\'starttime\']-$b[\'starttime\'];'));
//echo "events_to_show=<pre>"; print_r($events_to_show); echo "</pre>\n";
}
$last_slot_end = -1;
foreach($events_to_show as $event)
{
$slot = $this->slot_num($event['starttime'],$day_start,$day_end);
$slot_end = isset($event['endtime']) ? $this->slot_num($event['endtime']-1) : $slot; // -1 to not occupy eg. the 18.00 slot for a 17-18h date
if ($slot <= $last_slot_end)
{
$slot = $last_slot;
$slot_end = max($last_slot_end,$slot_end);
}
$rows[$slot] .= $this->link_to_entry($event,$params['month'],$params['day'],$params['year']);
$rows[$slot] .= $event['content'];
print_debug('slot',$slot);
print_debug('row',$rows[$slot]);
@ -3297,14 +3376,14 @@
$p->set_var('extras','');
if ($rowspan > 1)
{
$p->set_var('item','');
$p->set_var('event','');
$rowspan--;
}
elseif (!isset($rows[$slot]))
{
$p->set_var('event','&nbsp;');
$row_to_print = $this->nm_on_off();
$p->parse('item','day_event'.$row_to_print,False);
$p->parse('event','day_event'.$row_to_print);
}
else
{
@ -3315,7 +3394,7 @@
}
$p->set_var('event',$rows[$slot]);
$row_to_print = $this->nm_on_off();
$p->parse('item','day_event'.$row_to_print,False);
$p->parse('event','day_event'.$row_to_print);
}
$open_link = $close_link = '';
$time = '&nbsp;';
@ -3327,20 +3406,19 @@
$min = date('i',$time);
$time = $GLOBALS['phpgw']->common->formattime($hour,$min);
$open_link = ' - ';
if(!$this->bo->printer_friendly && $this->bo->check_perms(PHPGW_ACL_ADD))
{
$open_link .= '<a href="'.$this->page('add',"&date=$date_to_eval&hour=$hour&minute=$min").'">';
$close_link = '</a>';
$open_link = ' <a href="'.$this->page('add',"&date=$date_to_eval&hour=$hour&minute=$min").'">';
$close_link = '</a> ';
}
}
$var = Array(
$p->set_var(Array(
'open_link' => $open_link,
'time' => $time,
'close_link' => $close_link,
'tr_color' => '' // dummy to stop output_template_array to set it
);
$this->output_template_array($p,'item','day_time',$var);
));
$p->parse('time','day_time');
$p->parse('row','day_row',True);
}

View File

@ -180,6 +180,7 @@ on participant responses too calendar de auch bei Antworten der Teilnehmer
on time change of more than 4 hours too calendar de bei zeitlichen Änderungen größer als 4 Stunden
on time change of time of more than 4 hours (and above options) calendar de wenn der Termin sich um mehr als 4 Stunde verschiebt (und obige Optionen)
on time-changes >= 4 hours too calendar de
open todo's: calendar de unerledigte Aufgaben:
order calendar de Reihenfolge
overlap holiday calendar de überlappender Feiertag
participant calendar de Teilnehmer

View File

@ -164,6 +164,7 @@ on any time change too calendar en on any time change too
on invitation / cancelation only calendar en on invitation / cancelation only
on participant responses too calendar en on participant responses too
on time change of more than 4 hours too calendar en on time change of more than 4 hours too
open todo's: calendar en open ToDo's:
order calendar en Order
overlap holiday calendar en overlap holiday
participant calendar en Participant

View File

@ -4,33 +4,39 @@
<table border="0" width="100%">
<tr>
<td valign="top" width="70%">
<tr>
<td>
<table border="0" width=100%>
<tr>
<td align="middle">
<font size="+2" color="{bg_text}"><b>{date}</b></font><br>
<font size="+1" color="{bg_text}">{username}</font>
<font size="+1" color="{bg_text}">{username}</font><br>&nbsp;
</td>
</tr>
{day_events}
</table>
<p align="center">{print}</p>
</td>
<td align="center" valign="top">
<table width="100%">
<tr>
<td align="center">
{small_calendar}
</td>
</tr>
<tr>
<td>
<b>{lang_todos}</b>
{todos}
</td>
</tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="0" bgcolor="{bg_text}">
{day_events}
</table>
</td>
<td align="right">
{small_calendar}
</td>
</tr>
</td>
</tr>
</table>
{print}
<!-- END day -->
<!-- BEGIN day_event -->
<tr>
<td>
{daily_events}
{daily_events}
</td>
</tr>
<!-- END day_event -->

View File

@ -1,21 +1,21 @@
<!-- $Id$ -->
<!-- BEGIN day -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<table width="100%" cellspacing="0" cellpadding="0">
{row}
</table>
<!-- END day -->
<!-- BEGIN day_row -->
<tr>{item}
<tr>{time}{event}
</tr>
<!-- END day_row -->
<!-- BEGIN day_event_on -->
<td class="event-on"{extras}>{event}</td>
<td class="event-on"{extras}>&nbsp;{event}</td>
<!-- END day_event_on -->
<!-- BEGIN day_event_off -->
<td class="event-off"{extras}>{event}</td>
<td class="event-off"{extras}>&nbsp;{event}</td>
<!-- END day_event_off -->
<!-- BEGIN day_event_holiday -->
<td class="event-holiday"{extras}>{event}</td>
<td class="event-holiday"{extras}>&nbsp;{event}</td>
<!-- END day_event_holiday -->
<!-- BEGIN day_time -->
<td class="time" nowrap>{open_link}{time}{close_link}</td>

View File

@ -1,6 +1,5 @@
<!-- $Id$ -->
<!-- BEGIN footer_table -->
<br clear="all">
<hr clear="all">
<font size="-1">
<table border="0" width="100%" cellpadding="0" cellspacing="0">

View File

@ -1,38 +0,0 @@
<!-- $Id$ -->
<!-- BEGIN day -->
{printer_friendly}
<table border="0" width="100%">
<tr>
<td valign="top" width="70%">
<tr>
<td>
<table border="0" width=100%>
<tr>
<td align="middle">
<font size="+2" color="{bg_text}"><b>{date}</b></font><br>
<font size="+1" color="{bg_text}">{username}</font>
</td>
</tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<!-- <table border="0" width="100%" cellspacing="0" cellpadding="0" bgcolor="{bg_text}">-->
{day_events}
</table
</td>
<td valign="top" align="right">
{small_calendar}
</td>
</tr>
</td>
</tr>
</table>
{print}
<!-- END day -->
<!-- BEGIN day_event -->
<tr>
<td>
{daily_events}
</td>
</tr>
<!-- END day_event -->

View File

@ -27,7 +27,8 @@
'get_rows' => True,
'link_title' => True,
'link_query' => True,
'link_id2from' => True
'link_id2from' => True,
'cal_to_include' => True
);
var $enums;
var $so;
@ -272,4 +273,73 @@
}
return $content;
}
/*!
@function cal_to_include
@syntax cal_to_include( $args )
@author ralfbecker
@abstract hook called be calendar to include events or todos in the cal-dayview
@param $args[year], $args[month], $args[day] date of the events
@param $args[owner] owner of the events
@param $args[location] calendar_include_{events|todos}
@returns array of events (array with keys starttime, endtime, title, view, icon, content)
*/
function cal_to_include($args)
{
//echo "<p>cal_to_include("; print_r($args); echo ")</p>\n";
$user = intval($args['owner']);
if ($user <= 0 && !checkdate($args['month'],$args['day'],$args['year']))
{
return False;
}
$do_events = $args['location'] == 'calendar_include_events';
$start = 0;
$to_include = array();
$date_wanted = sprintf('%04d/%02d/%02d',$args['year'],$args['month'],$args['day']);
while ($infos = $this->search('info_startdate','',"user$user".($do_events?'date':'opentoday').$date_wanted,'','','','','',$start,$total))
{
foreach($infos as $info)
{
$time = intval(date('Hi',$info['info_startdate']));
$date = date('Y/m/d',$info['info_startdate']);
if ($do_events && !$time ||
!$do_events && $time && $date == $date_wanted)
{
continue;
}
if (!is_object($GLOBALS['phpgw']->html)) // only once and only if thers something to report
{
$GLOBALS['phpgw']->html = CreateObject('etemplate.html');
$GLOBALS['phpgw']->translation->add_app('infolog');
}
$title = ($do_events?$GLOBALS['phpgw']->common->formattime(date('H',$info['info_startdate']),date('i',$info['info_startdate'])).' ':'').
$info['info_subject'];
$view = $this->link->view('infolog',$info['info_id']);
$content = '';
foreach($icons = array(
$info['info_type'] => 'infolog',
$info['info_status'] => 'infolog'
) as $name => $app)
{
$content .= $GLOBALS['phpgw']->html->image($app,$name,lang($name),'border="0" width="15" height="15"').' ';
}
$content = '<p style="margin: 0px">'.$GLOBALS['phpgw']->html->a_href($content.'&nbsp;'.$title,$view).'</p>';
$to_include[] = array(
'starttime' => $info['info_startdate'],
'endtime' => $info['info_enddate'] ? $info['info_enddate'] : $info['info_startdate'],
'title' => $title,
'view' => $view,
'icons' => $icons,
'content' => $content
);
}
if ($total <= $start+count($infos))
{
break; // no more availible
}
}
//echo "boinfolog::cal_to_include("; print_r($args); echo ")<pre>"; print_r($to_include); echo "</pre>\n";
return $to_include;
}
}

View File

@ -91,12 +91,13 @@
*/
function aclFilter($filter = 'none')
{
ereg('.*(own|privat|all|none).*',$filter,$vars);
ereg('.*(own|privat|all|none|user)([0-9]*).*',$filter,$vars);
$filter = $vars[1];
$f_user = intval($vars[2]);
if (isset($this->acl_filter[$filter]))
if (isset($this->acl_filter[$filter.$user]))
{
return $this->acl_filter[$filter]; // used cached filter if found
return $this->acl_filter[$filter.$user]; // used cached filter if found
}
if (is_array($this->grants))
{
@ -138,7 +139,11 @@
}
$filtermethod .= ') ';
return $this->acl_filter[$filter] = $filtermethod; // cache the filter
if ($filter == 'user' && $f_user > 0)
{
$filtermethod = " ((info_owner=$f_user AND info_responsible=0 OR info_responsible=$f_user) AND $filtermethod)";
}
return $this->acl_filter[$filter.$user] = $filtermethod; // cache the filter
}
/*!
@ -173,12 +178,19 @@
*/
function dateFilter($filter = '')
{
ereg('.*(upcoming|today|overdue).*',$filter,$vars);
ereg('.*(upcoming|today|overdue|date)([-/.0-9]*).*',$filter,$vars);
$filter = $vars[1];
if (isset($vars[2]) && !empty($vars[2]) && ($date = split('[-/.]',$vars[2])))
{
$today = mktime(0,0,0,intval($date[1]),intval($date[2]),intval($date[0]));
$tomorrow = mktime(0,0,0,intval($date[1]),intval($date[2])+1,intval($date[0]));
}
else
{
$now = getdate(time());
$tomorrow = mktime(0,0,0,$now['mon'],$now['mday']+1,$now['year']);
}
switch ($filter)
{
case 'upcoming':
@ -187,6 +199,12 @@
return " AND info_startdate < '$tomorrow'";
case 'overdue':
return " AND (info_enddate != 0 AND info_enddate < '$tomorrow')";
case 'date':
if (!$today || !$tomorrow)
{
return '';
}
return " AND ($today <= info_startdate AND info_startdate < $tomorrow)";
}
return '';
}
@ -438,7 +456,7 @@
*/
function search($order,$sort,$filter,$cat_id,$query,$action,$action_id,$ordermethod,&$start,&$total)
{
//echo "<p>soinfolog.search(action='$action/$action_id')</p>\n";
//echo "<p>soinfolog.search(order='$order',,filter='$filter',,query='$query',action='$action/$action_id')</p>\n";
$action2app = array(
'addr' => 'addressbook',
'proj' => 'projects',
@ -468,7 +486,7 @@
$filtermethod = $this->aclFilter($filter);
$filtermethod .= $this->statusFilter($filter);
$filtermethod .= $this->dateFilter($filter);
// echo "<p>filtermethod='$filtermethod'</p>";
//echo "<p>filtermethod='$filtermethod'</p>";
if (intval($cat_id))
{
@ -501,6 +519,7 @@
$start = 0;
}
$this->db->limit_query($sql="SELECT DISTINCT phpgw_infolog.* $query $ordermethod",$start,__LINE__,__FILE__);
while ($this->db->next_record())
{
$this->db2data(&$info);

View File

@ -34,7 +34,7 @@
The entries may be viewed or added from InfoLog direct or from within
the contact/address, project or calendar view.<p>
Other documents / files can be linked to InfoLog entries and are store in the VFS
(phpGroupWare\'s virtual file system). An extension of the VFS allows to symlink
(eGroupWare\'s virtual file system). An extension of the VFS allows to symlink
the files to a fileserver, instead of placeing a copy in the VFS
(<i>need to be configured in the admin-section</i>).
It is planed to include emails and faxes into InfoLog in the future.';
@ -44,7 +44,7 @@
expressions and direct calls to php-functions (e.g. to link the phone calls
(again) to the addressbook entrys).<p>
<b>More information</b> about InfoLog and the current development-status can be found on the
<a href="http://www.phpgroupware.org/wiki/InfoLog" target="_blank">InfoLog page in our Wiki</a>.';
<a href="http://www.egroupware.org/wiki/InfoLog" target="_blank">InfoLog page in our Wiki</a>.';
/* The hooks this app includes, needed for hooks registration */
$setup_info['infolog']['hooks'][] = 'preferences';
@ -57,6 +57,8 @@
$setup_info['infolog']['hooks']['projects_view'] = 'infolog.uiinfolog.hook_view';
$setup_info['infolog']['hooks']['calendar_view'] = 'infolog.uiinfolog.hook_view';
$setup_info['infolog']['hooks']['infolog'] = 'infolog.uiinfolog.hook_view';
$setup_info['infolog']['hooks']['calendar_include_events'] = 'infolog.boinfolog.cal_to_include';
$setup_info['infolog']['hooks']['calendar_include_todos'] = 'infolog.boinfolog.cal_to_include';
/* Dependencies for this app to work */
$setup_info['infolog']['depends'][] = array(