allow calendar integration to supply participants and icons

This commit is contained in:
Ralf Becker 2010-01-21 03:00:53 +00:00
parent 209012c079
commit 12e5f2b218
3 changed files with 56 additions and 10 deletions

View File

@ -395,6 +395,8 @@ class calendar_so
if ($this->db->capabilities['distinct_on_text'] && $this->db->capabilities['union'])
{
// allow apps to supply participants and/or icons
if (is_null($_cols)) $cols .= ',NULL AS participants,NULL AS icons';
// changed the original OR in the query into a union, to speed up the query execution under MySQL 5
$select = array(
'table' => $this->cal_table,
@ -420,11 +422,9 @@ class calendar_so
$selects = array($selects[0],$selects[1]);
}
if (is_null($_cols)) self::get_union_selects($selects,$start,$end,$users,$cat_id,$filter,$query);
//_debug_array($selects);
$this->db->query_log = '/tmp/query.log';
// error_log("calendar_so_search:\n" . print_r($selects, true));
$rs = $this->db->union($selects,__LINE__,__FILE__,$order,$offset,$num_rows);
$this->db->query_log = false;
}
else // MsSQL oder MySQL 3.23
{
@ -457,7 +457,17 @@ $this->db->query_log = false;
$id .= '-'.$row['cal_recur_date'];
$recur_dates[] = $row['cal_recur_date'];
}
$row['alarm'] = $row['participants'] = array();
if ($row['participants'])
{
$row['participants'] = explode(',',$row['participants']);
$row['participants'] = array_combine($row['participants'],
array_fill(0,count($row['participants']),''));
}
else
{
$row['participants'] = array();
}
$row['alarm'] = array();
$row['recur_exception'] = $row['recur_exception'] ? explode(',',$row['recur_exception']) : array();
$events[$id] = egw_db::strip_array_keys($row,'cal_');

View File

@ -1168,9 +1168,42 @@ class calendar_uiviews extends calendar_ui
{
$timespan = $this->bo->timespan($event['start_m'],$event['end_m']);
}
$is_private = !$this->bo->check_perms(EGW_ACL_READ,$event);
$icons = !$is_private ? $this->event_icons($event) : array(html::image('calendar','private',lang('private')));
if(!(int)$event['id'] && preg_match('/^([a-z_-]+)([0-9]+)$/i',$event['id'],$matches))
{
$app = $matches[1];
$app_id = $matches[2];
$icons = array();
if (($is_private = !egw_link::title($app,$app_id)))
{
$icons[] = html::image('calendar','private');
}
else
{
if ($event['icons'])
{
foreach(explode(',',$event['icons']) as $icon)
{
list($icon_app,$icon) = explode(':',$icon);
if (common::find_image($icon_app,$icon))
{
$icons[] = html::image($icon_app,$icon);
}
}
}
$icons[] = html::image($app,'navbar');
}
}
else
{
if (($is_private = !$this->bo->check_perms(EGW_ACL_READ,$event)))
{
$icons = array(html::image('calendar','private'));
}
else
{
$icons = $this->event_icons($event);
}
}
$cats = $this->bo->categories($this->categories->check_list(EGW_ACL_READ, $event['category']),$color);
// these values control varius aspects of the geometry of the eventWidget
$small_trigger_width = 120 + 20*count($icons);
@ -1200,6 +1233,7 @@ class calendar_uiviews extends calendar_ui
switch ($status)
{
case 'A':
case '': // app without status
break;
case 'U':
$status_class = 'calEventSomeUnknown';
@ -1298,11 +1332,10 @@ class calendar_uiviews extends calendar_ui
{
$popup = '';
}
elseif(!is_numeric($event['id']))
elseif($app && $app_id)
{
$popup = '';
if (preg_match('/^([a-z_-]+)([0-9]+)$/i',$event['id'],$matches) &&
($edit = egw_link::edit($matches[1],$matches[2],$popup_size)))
if (($edit = egw_link::edit($app,$app_id,$popup_size)))
{
$view_link = egw::link('/index.php',$edit);

View File

@ -280,6 +280,9 @@ e.g. the div with class calTimeGrid is generated by the timeGridWidget method of
right: 0px;
top: 0px;
}
.calEventIcons img{
height: 16px;
}
.calEventHeaderSmall .calEventIcons img{
height: 13px;
}