From 618c554c2f64663bdf5cf00b8d75318e1b797505 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 2 Dec 2005 15:34:45 +0000 Subject: [PATCH] fixed bugs with recuring events in listview: - opened as their first recurance not the one you clicked on - recure-information is not shown --- calendar/inc/class.bocal.inc.php | 48 ++++++++++++++++++++++++++ calendar/inc/class.bocalupdate.inc.php | 35 +------------------ calendar/inc/class.uilist.inc.php | 2 ++ calendar/setup/etemplates.inc.php | 4 ++- calendar/templates/default/list.xet | 7 ++-- 5 files changed, 58 insertions(+), 38 deletions(-) diff --git a/calendar/inc/class.bocal.inc.php b/calendar/inc/class.bocal.inc.php index 27bd2dcaf7..9d68fa5136 100644 --- a/calendar/inc/class.bocal.inc.php +++ b/calendar/inc/class.bocal.inc.php @@ -1386,6 +1386,54 @@ class bocal return $users + $groups; // users first and then groups, both alphabeticaly } + + /** + * Convert the recure-information of an event, into a human readable string + * + * @param array $event + * @return string + */ + function recure2string($event) + { + $str = ''; + // Repeated Events + if($event['recur_type'] != MCAL_RECUR_NONE) + { + $str = lang($this->recur_types[$event['recur_type']]); + + $str_extra = array(); + if ($event['recur_enddate']) + { + $str_extra[] = lang('ends').': '.lang($this->format_date($event['recur_enddate'],'l')).', '.$this->long_date($event['recur_enddate']).' '; + } + // only weekly uses the recur-data (days) !!! + if($event['recur_type'] == MCAL_RECUR_WEEKLY) + { + $repeat_days = array(); + foreach ($this->recur_days as $mcal_mask => $dayname) + { + if ($event['recur_data'] & $mcal_mask) + { + $repeat_days[] = lang($dayname); + } + } + if(count($repeat_days)) + { + $str_extra[] = lang('days repeated').': '.implode(', ',$repeat_days); + } + } + if($event['recur_interval']) + { + $str_extra[] = lang('Interval').': '.$event['recur_interval']; + } + + if(count($str_extra)) + { + $str .= ' ('.implode(', ',$str_extra).')'; + } + } + return $str; + } /** * Read the holidays for a given $year diff --git a/calendar/inc/class.bocalupdate.inc.php b/calendar/inc/class.bocalupdate.inc.php index 57a7aa8191..1508a68e51 100644 --- a/calendar/inc/class.bocalupdate.inc.php +++ b/calendar/inc/class.bocalupdate.inc.php @@ -898,42 +898,9 @@ class bocalupdate extends bocal // Repeated Events if($event['recur_type'] != MCAL_RECUR_NONE) { - $str = lang($this->rpt_type[$event['recur_type']]); - - $str_extra = array(); - if ($event['recur_enddate']) - { - $str_extra[] = lang('ends').': '.lang($this->format_date($event['recur_enddate'],'l')).', '.$this->long_date($event['recur_enddate']).' '; - } - // only weekly uses the recur-data (days) !!! - if($event['recur_type'] == MCAL_RECUR_WEEKLY) - { - $repeat_days = array(); - foreach ($this->recur_days as $mcal_mask => $dayname) - { - if ($event['recur_data'] & $mcal_mask) - { - $repeat_days[] = lang($dayname); - } - } - if(count($repeat_days)) - { - $str_extra[] = lang('days repeated').': '.implode(', ',$repeat_days); - } - } - if($event['recur_interval']) - { - $str_extra[] = lang('Interval').': '.$event['recur_interval']; - } - - if(count($str_extra)) - { - $str .= ' ('.implode(', ',$str_extra).')'; - } - $var['recur_type'] = Array( 'field' => lang('Repetition'), - 'data' => $str, + 'data' => $this->recure2string($event), ); } return $var; diff --git a/calendar/inc/class.uilist.inc.php b/calendar/inc/class.uilist.inc.php index f6f356ce16..d42ad6c75e 100644 --- a/calendar/inc/class.uilist.inc.php +++ b/calendar/inc/class.uilist.inc.php @@ -194,6 +194,8 @@ class uilist extends uical $readonlys['view['.$event['id'].']'] = !$this->bo->check_perms(EGW_ACL_READ,$event); $event['parts'] = implode(",\n",$this->bo->participants($event)); + $event['recure'] = $this->bo->recure2string($event); + $event['date'] = $this->bo->date2string($event['start']); if (empty($event['description'])) $event['description'] = ' '; // no description screws the titles horz. alignment if (empty($event['location'])) $event['location'] = ' '; // no location screws the owner horz. alignment $rows[] = $event; diff --git a/calendar/setup/etemplates.inc.php b/calendar/setup/etemplates.inc.php index 5be28afe42..acb6fe9976 100644 --- a/calendar/setup/etemplates.inc.php +++ b/calendar/setup/etemplates.inc.php @@ -1,5 +1,5 @@ 'calendar.list.rows','template' => '','lang' => $templ_data[] = array('name' => 'calendar.list.rows','template' => '','lang' => '','group' => '0','version' => '1.0.1.002','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:4:{s:2:"c1";s:2:"th";s:2:"c2";s:7:"row,top";s:1:"B";s:3:"40%";s:1:"E";s:3:"10%";}i:1;a:5:{s:1:"A";a:4:{s:4:"type";s:4:"vbox";s:4:"size";s:1:"2";i:1;a:3:{s:4:"type";s:20:"nextmatch-sortheader";s:5:"label";s:5:"Start";s:4:"name";s:9:"cal_start";}i:2;a:3:{s:4:"type";s:20:"nextmatch-sortheader";s:4:"name";s:7:"cal_end";s:5:"label";s:3:"End";}}s:1:"B";a:4:{s:4:"type";s:4:"vbox";s:4:"size";s:1:"2";i:1;a:3:{s:4:"type";s:20:"nextmatch-sortheader";s:5:"label";s:5:"Title";s:4:"name";s:9:"cal_title";}i:2;a:3:{s:4:"type";s:20:"nextmatch-sortheader";s:5:"label";s:11:"Description";s:4:"name";s:15:"cal_description";}}s:1:"C";a:4:{s:4:"type";s:4:"vbox";s:4:"size";s:1:"2";i:1;a:4:{s:4:"type";s:20:"nextmatch-sortheader";s:4:"name";s:9:"cal_owner";s:5:"label";s:5:"Owner";s:8:"readonly";s:1:"1";}i:2;a:3:{s:4:"type";s:20:"nextmatch-sortheader";s:4:"name";s:12:"cal_location";s:5:"label";s:8:"Location";}}s:1:"D";a:3:{s:4:"size";s:16:"All participants";s:4:"name";s:11:"participant";s:4:"type";s:23:"nextmatch-accountfilter";}s:1:"E";a:2:{s:4:"type";s:5:"label";s:5:"label";s:7:"Actions";}}i:2;a:5:{s:1:"A";a:5:{s:4:"type";s:4:"vbox";s:4:"size";s:1:"2";i:1;a:3:{s:4:"type";s:9:"date-time";s:4:"name";s:13:"${row}[start]";s:8:"readonly";s:1:"1";}i:2;a:3:{s:4:"type";s:9:"date-time";s:4:"name";s:11:"${row}[end]";s:8:"readonly";s:1:"1";}s:4:"name";s:5:"start";}s:1:"B";a:4:{s:4:"type";s:4:"vbox";s:4:"size";s:1:"2";i:1;a:5:{s:4:"type";s:5:"label";s:4:"name";s:13:"${row}[title]";s:8:"readonly";s:1:"1";s:7:"no_lang";s:1:"1";s:4:"size";s:1:"b";}i:2;a:3:{s:4:"type";s:5:"label";s:4:"name";s:19:"${row}[description]";s:7:"no_lang";s:1:"1";}}s:1:"C";a:4:{s:4:"type";s:4:"vbox";s:4:"size";s:1:"2";i:1;a:3:{s:4:"type";s:14:"select-account";s:4:"name";s:13:"${row}[owner]";s:8:"readonly";s:1:"1";}i:2;a:3:{s:4:"type";s:5:"label";s:4:"name";s:16:"${row}[location]";s:7:"no_lang";s:1:"1";}}s:1:"D";a:4:{s:4:"type";s:5:"label";s:4:"name";s:13:"${row}[parts]";s:8:"readonly";s:1:"1";s:7:"no_lang";s:1:"1";}s:1:"E";a:5:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"3";i:1;a:6:{s:4:"type";s:6:"button";s:4:"size";s:4:"view";s:5:"label";s:4:"view";s:4:"name";s:19:"view[$row_cont[id]]";s:4:"help";s:15:"View this event";s:7:"onclick";s:176:"window.open(egw::link(\'/index.php\',\'menuaction=calendar.uiforms.view&cal_id=$row_cont[id]\'),\'425\',\'dependent=yes,width=750,height=450,scrollbars=yes,status=yes\'); return false;";}i:2;a:6:{s:4:"type";s:6:"button";s:4:"size";s:4:"edit";s:5:"label";s:4:"Edit";s:4:"name";s:19:"edit[$row_cont[id]]";s:4:"help";s:15:"Edit this event";s:7:"onclick";s:176:"window.open(egw::link(\'/index.php\',\'menuaction=calendar.uiforms.edit&cal_id=$row_cont[id]\'),\'425\',\'dependent=yes,width=750,height=450,scrollbars=yes,status=yes\'); return false;";}i:3;a:6:{s:4:"type";s:6:"button";s:4:"name";s:21:"delete[$row_cont[id]]";s:4:"size";s:6:"delete";s:5:"label";s:6:"Delete";s:4:"help";s:17:"Delete this event";s:7:"onclick";s:36:"return confirm(\'Delete this event\');";}}}}s:4:"rows";i:2;s:4:"cols";i:5;s:7:"options";a:0:{}s:4:"size";s:4:"100%";}}','size' => '100%','style' => '','modified' => '1128457387',); +$templ_data[] = array('name' => 'calendar.list.rows','template' => '','lang' => '','group' => '0','version' => '1.0.1.003','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:4:{s:2:"c1";s:2:"th";s:2:"c2";s:7:"row,top";s:1:"B";s:3:"40%";s:1:"E";s:3:"10%";}i:1;a:5:{s:1:"A";a:4:{s:4:"type";s:4:"vbox";s:4:"size";s:1:"2";i:1;a:3:{s:4:"type";s:20:"nextmatch-sortheader";s:5:"label";s:5:"Start";s:4:"name";s:9:"cal_start";}i:2;a:3:{s:4:"type";s:20:"nextmatch-sortheader";s:4:"name";s:7:"cal_end";s:5:"label";s:3:"End";}}s:1:"B";a:4:{s:4:"type";s:4:"vbox";s:4:"size";s:1:"2";i:1;a:3:{s:4:"type";s:20:"nextmatch-sortheader";s:5:"label";s:5:"Title";s:4:"name";s:9:"cal_title";}i:2;a:3:{s:4:"type";s:20:"nextmatch-sortheader";s:5:"label";s:11:"Description";s:4:"name";s:15:"cal_description";}}s:1:"C";a:4:{s:4:"type";s:4:"vbox";s:4:"size";s:1:"2";i:1;a:4:{s:4:"type";s:20:"nextmatch-sortheader";s:4:"name";s:9:"cal_owner";s:5:"label";s:5:"Owner";s:8:"readonly";s:1:"1";}i:2;a:3:{s:4:"type";s:20:"nextmatch-sortheader";s:4:"name";s:12:"cal_location";s:5:"label";s:8:"Location";}}s:1:"D";a:3:{s:4:"size";s:16:"All participants";s:4:"name";s:11:"participant";s:4:"type";s:23:"nextmatch-accountfilter";}s:1:"E";a:2:{s:4:"type";s:5:"label";s:5:"label";s:7:"Actions";}}i:2;a:5:{s:1:"A";a:5:{s:4:"type";s:4:"vbox";s:4:"size";s:1:"2";i:1;a:3:{s:4:"type";s:9:"date-time";s:4:"name";s:13:"${row}[start]";s:8:"readonly";s:1:"1";}i:2;a:3:{s:4:"type";s:9:"date-time";s:4:"name";s:11:"${row}[end]";s:8:"readonly";s:1:"1";}s:4:"name";s:5:"start";}s:1:"B";a:5:{s:4:"type";s:4:"vbox";s:4:"size";s:1:"3";i:1;a:5:{s:4:"type";s:5:"label";s:4:"name";s:13:"${row}[title]";s:8:"readonly";s:1:"1";s:7:"no_lang";s:1:"1";s:4:"size";s:1:"b";}i:2;a:3:{s:4:"type";s:5:"label";s:4:"name";s:19:"${row}[description]";s:7:"no_lang";s:1:"1";}i:3;a:3:{s:4:"type";s:5:"label";s:4:"name";s:14:"${row}[recure]";s:7:"no_lang";s:1:"1";}}s:1:"C";a:4:{s:4:"type";s:4:"vbox";s:4:"size";s:1:"2";i:1;a:3:{s:4:"type";s:14:"select-account";s:4:"name";s:13:"${row}[owner]";s:8:"readonly";s:1:"1";}i:2;a:3:{s:4:"type";s:5:"label";s:4:"name";s:16:"${row}[location]";s:7:"no_lang";s:1:"1";}}s:1:"D";a:4:{s:4:"type";s:5:"label";s:4:"name";s:13:"${row}[parts]";s:8:"readonly";s:1:"1";s:7:"no_lang";s:1:"1";}s:1:"E";a:5:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"3";i:1;a:6:{s:4:"type";s:6:"button";s:4:"size";s:4:"view";s:5:"label";s:4:"view";s:4:"name";s:19:"view[$row_cont[id]]";s:4:"help";s:15:"View this event";s:7:"onclick";s:197:"window.open(egw::link(\'/index.php\',\'menuaction=calendar.uiforms.view&cal_id=$row_cont[id]&date=$row_cont[date]\'),\'425\',\'dependent=yes,width=750,height=450,scrollbars=yes,status=yes\'); return false;";}i:2;a:6:{s:4:"type";s:6:"button";s:4:"size";s:4:"edit";s:5:"label";s:4:"Edit";s:4:"name";s:19:"edit[$row_cont[id]]";s:4:"help";s:15:"Edit this event";s:7:"onclick";s:197:"window.open(egw::link(\'/index.php\',\'menuaction=calendar.uiforms.edit&cal_id=$row_cont[id]&date=$row_cont[date]\'),\'425\',\'dependent=yes,width=750,height=450,scrollbars=yes,status=yes\'); return false;";}i:3;a:6:{s:4:"type";s:6:"button";s:4:"name";s:21:"delete[$row_cont[id]]";s:4:"size";s:6:"delete";s:5:"label";s:6:"Delete";s:4:"help";s:17:"Delete this event";s:7:"onclick";s:36:"return confirm(\'Delete this event\');";}}}}s:4:"rows";i:2;s:4:"cols";i:5;s:7:"options";a:0:{}s:4:"size";s:4:"100%";}}','size' => '100%','style' => '','modified' => '1128457387',); + diff --git a/calendar/templates/default/list.xet b/calendar/templates/default/list.xet index 1f1bbe3b95..eebc5c4cf6 100644 --- a/calendar/templates/default/list.xet +++ b/calendar/templates/default/list.xet @@ -1,7 +1,7 @@ -