From 84a7fb811d07c73ce91abb295c70189b5e6fa224 Mon Sep 17 00:00:00 2001 From: skeeter Date: Wed, 14 Feb 2001 02:58:46 +0000 Subject: [PATCH] ACL incorporation - about 50% done --- calendar/day.php | 121 +++++-------- calendar/inc/class.calendar_sql.inc.php | 69 ++++--- calendar/inc/functions.inc.php | 76 ++++++++ calendar/inc/header.inc.php | 101 +++-------- calendar/month.php | 43 +---- calendar/view.php | 230 +++++++++++++++--------- 6 files changed, 337 insertions(+), 303 deletions(-) diff --git a/calendar/day.php b/calendar/day.php index 093624fccc..c2a9040065 100644 --- a/calendar/day.php +++ b/calendar/day.php @@ -14,91 +14,62 @@ /* $Id$ */ - $phpgw_info["flags"] = array("currentapp" => "calendar", "enable_nextmatchs_class" => True); + $phpgw_info['flags'] = array('currentapp' => 'calendar', 'enable_nextmatchs_class' => True); - if (isset($friendly) && $friendly){ - $phpgw_info["flags"]["noheader"] = True; - $phpgw_info["flags"]["nonavbar"] = True; - $phpgw_info["flags"]["noappheader"] = True; - $phpgw_info["flags"]["noappfooter"] = True; - $phpgw_info["flags"]["nofooter"] = True; - } else { - $friendly = 0; + if (isset($friendly) && $friendly) + { + $phpgw_info['flags']['noheader'] = True; + $phpgw_info['flags']['nonavbar'] = True; + $phpgw_info['flags']['noappheader'] = True; + $phpgw_info['flags']['noappfooter'] = True; + $phpgw_info['flags']['nofooter'] = True; + } + else + { + $friendly = 0; } - include("../header.inc.php"); + include('../header.inc.php'); + $view = 'day'; - if(isset($friendly) && $friendly) { - if(!isset($phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"])) - $phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"] = "Sunday"; + $now = $phpgw->calendar->splitdate(mktime (0, 0, 0, $thismonth, $thisday, $thisyear) - ((60 * 60) * $phpgw_info['user']['preferences']['common']['tz_offset'])); - if (isset($date) && strlen($date) > 0) { - $thisyear = substr($date, 0, 4); - $thismonth = substr($date, 4, 2); - $thisday = substr($date, 6, 2); - } else { - if (!isset($day) || !$day) - $thisday = $phpgw->calendar->today["day"]; - else - $thisday = $day; - if (!isset($month) || !$month) - $thismonth = $phpgw->calendar->today["month"]; - else - $thismonth = $month; - if (!isset($year) || !$year) - $thisyear = $phpgw->calendar->today["year"]; - else - $thisyear = $year; - } + $template = Array( + 'day_t' => 'day.tpl' + ); + + $phpgw->template->set_file($template); + + //$phpgw->template->set_block('day_t'); + + if ($friendly) + { + $phpgw->template->set_var('printer_friendly',''); + } + else + { + $phpgw->template->set_var('printer_friendly',''); } - if(!isset($owner)) { $owner = 0; } - unset($owner); - - if(!isset($owner) || !$owner) { - $id = $phpgw_info["user"]["userid"]; - $fn = $phpgw_info["user"]["firstname"]; - $ln = $phpgw_info["user"]["lastname"]; - $owner = 0; - } else { - $phpgw->db->query("SELECT account_lid,account_firstname,account_lastname FROM accounts WHERE account_id=$owner"); - $phpgw->db->next_record(); - $id = $phpgw->db->f("account_lid"); - $fn = $phpgw->db->f("account_firstname"); - $ln = $phpgw->db->f("account_lastname"); - } - - $view = "day"; - - $now = $phpgw->calendar->splitdate(mktime (0, 0, 0, $thismonth, $thisday, $thisyear) - ((60 * 60) * $phpgw_info["user"]["preferences"]["common"]["tz_offset"])); - - $phpgw->template->set_file(array("day_t" => "day.tpl")); - - //$phpgw->template->set_block("day_t"); - - if ($friendly) { - $phpgw->template->set_var("printer_friendly",""); - } else { - $phpgw->template->set_var("printer_friendly",""); - } - - $phpgw->template->set_var("bg_text",$phpgw_info["theme"]["bg_text"]); + $phpgw->template->set_var('bg_text',$phpgw_info['theme']['bg_text']); $m = mktime(2,0,0,$thismonth,1,$thisyear); - $phpgw->template->set_var("date",lang(date("F",$m))." ".$thisday.", ".$thisyear); - $phpgw->template->set_var("username",$phpgw->common->display_fullname($id,$fn,$ln)); - $phpgw->template->set_var("daily_events",$phpgw->calendar->print_day_at_a_glance($now,$owner)); - $phpgw->template->set_var("small_calendar",$phpgw->calendar->mini_calendar($now["day"],$now["month"],$now["year"],"day.php")); + $phpgw->template->set_var('date',lang(date('F',$m)).' '.$thisday.', '.$thisyear); + $phpgw->template->set_var('username',$phpgw->common->grab_owner_name($owner)); + $phpgw->template->set_var('daily_events',$phpgw->calendar->print_day_at_a_glance($now,$owner)); + $phpgw->template->set_var('small_calendar',$phpgw->calendar->mini_calendar($now['day'],$now['month'],$now['year'],'day.php')); - if (!$friendly) { - $param = 'year='.$thisyear.'&month='.$thismonth.'&day='.$thisday.'&friendly=1&filter='.$filter; - $phpgw->template->set_var("print","link("",$param)."\" TARGET=\"cal_printer_friendly\" onMouseOver=\"window.status = '".lang("Generate printer-friendly version")."'\">[".lang("Printer Friendly")."]"); - $phpgw->template->parse("out","day_t"); - $phpgw->template->pparse("out","day_t"); - } else { - $phpgw->template->set_var("print",""); - $phpgw->template->parse("out","day_t"); - $phpgw->template->pparse("out","day_t"); + if (!$friendly) + { + $param = 'year='.$thisyear.'&month='.$thismonth.'&day='.$thisday.'&friendly=1&filter='.$filter.'&owner='.$owner; + $phpgw->template->set_var('print','[".lang('Printer Friendly').']'); + $phpgw->template->pparse('out','day_t'); } + else + { + $phpgw->template->set_var('print',''); + $phpgw->template->pparse('out','day_t'); + } + $phpgw->common->phpgw_footer(); ?> diff --git a/calendar/inc/class.calendar_sql.inc.php b/calendar/inc/class.calendar_sql.inc.php index 7b89391528..f278a43723 100755 --- a/calendar/inc/class.calendar_sql.inc.php +++ b/calendar/inc/class.calendar_sql.inc.php @@ -131,6 +131,20 @@ } } + function check_perms($needed) + { + global $rights; + + if($rights & $needed) + { + return True; + } + else + { + return False; + } + } + function group_search($owner=0) { global $phpgw, $phpgw_info; @@ -351,25 +365,25 @@ global $phpgw_info; $is_private = False; - if ($owner == $phpgw_info['user']['account_id'] || $owner == 0) { + if ($owner == $phpgw_info['user']['account_id'] || $owner == 0 || $this->check_perms(16) == True) { } elseif ($cal_info->access == 'private') { - $is_private = True; + $is_private = True; } elseif($cal_info->access == 'group') { - $is_private = True; - $phpgw->db->query('SELECT account_lid FROM accounts WHERE account_id='.$owner,__LINE__,__FILE__); - $phpgw->db->next_record(); - $groups = $phpgw->accounts->read_groups($phpgw->db->f('account_lid')); - while ($group = each($groups)) { - if (strpos(' '.$cal_info->groups.' ',','.$group[0]).',') $is_private = False; - } + $is_private = True; + $phpgw->db->query('SELECT account_lid FROM accounts WHERE account_id='.$owner,__LINE__,__FILE__); + $phpgw->db->next_record(); + $groups = $phpgw->accounts->read_groups($phpgw->db->f('account_lid')); + while ($group = each($groups)) { + if (strpos(' '.$cal_info->groups.' ',','.$group[0]).',') $is_private = False; + } } if ($is_private) { - $str = 'private'; + $str = 'private'; } elseif (strlen($cal_info->name) > 19) { - $str = substr($cal_info->name, 0 , 19); - $str .= '...'; + $str = substr($cal_info->name, 0 , 19); + $str .= '...'; } else { - $str = $cal_info->name; + $str = $cal_info->name; } return $str; } @@ -794,7 +808,6 @@ function display_week($startdate,$weekly,$cellcolor,$display_name = False,$owner=0,$monthstart=0,$monthend=0) { global $phpgw; global $phpgw_info; - global $rights; $str = ''; $gr_events = CreateObject('calendar.calendar_item'); @@ -832,19 +845,19 @@ if (!$this->printer_friendly) { $str = ''; - if($rights & PHPGW_ACL_ADD) { + if($this->check_perms(PHPGW_ACL_ADD) == True) { $str .= ''; } $str .= 'check_perms(PHPGW_ACL_ADD) == True) { $str .= 'alt="'.lang('New Entry').'" '; } $str .= 'border="0" align="right">'; - if($rights & PHPGW_ACL_ADD) { + if($this->check_perms(PHPGW_ACL_ADD) == True) { $str .= ''; } @@ -1163,7 +1176,7 @@ } function mini_calendar($day,$month,$year,$link='') { - global $phpgw, $phpgw_info, $view; + global $phpgw, $phpgw_info, $view, $owner; $date = $this->makegmttime(0,0,0,$month,$day,$year); $month_ago = intval(date('Ymd',mktime(0,0,0,$month - 1,$day,$year))); @@ -1183,9 +1196,17 @@ $p->set_var('cal_img_root',$phpgw->common->get_image_path('calendar')); $p->set_var('bgcolor',$phpgw_info['theme']['bg_color']); $p->set_var('bgcolor1',$phpgw_info['theme']['bg_color']); - $p->set_var('month','' . lang($phpgw->common->show_date($date['raw'],'F')).' '.$year) . ''; - $p->set_var('prevmonth',$phpgw->link($phpgw_info['server']['webserver_url'].'/calendar/index.php','date='.$month_ago)); - $p->set_var('nextmonth',$phpgw->link($phpgw_info['server']['webserver_url'].'/calendar/index.php','date='.$month_ahead)); + if(!$this->printer_friendly) + { + $p->set_var('month','' . lang($phpgw->common->show_date($date['raw'],'F')).' '.$year . ''); + } + else + { + $p->set_var('month',lang($phpgw->common->show_date($date['raw'],'F')).' '.$year); + } + + $p->set_var('prevmonth',$phpgw->link($phpgw_info['server']['webserver_url'].'/calendar/month.php','date='.$month_ago.'&owner='.$owner)); + $p->set_var('nextmonth',$phpgw->link($phpgw_info['server']['webserver_url'].'/calendar/month.php','date='.$month_ahead.'&owner='.$owner)); $p->set_var('bgcolor2',$phpgw_info['theme']['cal_dayview']); for($i=0;$i<7;$i++) { @@ -1207,7 +1228,7 @@ $p->set_var('bgcolor2','#FFFFFF'); } if(!$this->printer_friendly) { - $str .= ''; + $str .= ''; } $str .= $cal['day']; if (!$this->printer_friendly) $str .= ''; @@ -1398,7 +1419,7 @@ $p->set_var('open_link',''); $p->set_var('close_link',''); $str = ' - '; - if(!$this->printer_friendly) { + if(!$this->printer_friendly && $this->check_perms(PHPGW_ACL_EDIT)) { $str .= 'acl->get_grants('calendar'); + + if(!isset($owner)) + { + $owner = 0; + } + + if(!isset($owner) || !$owner) + { + $owner = $phpgw_info['user']['account_id']; + $rights = PHPGW_ACL_READ + PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE + 16; + } + else + { + if($grants[$owner]) + { + $rights = $grants[$owner]; + if (!($rights & PHPGW_ACL_READ)) + { + $owner = $phpgw_info['user']['account_id']; + } + } + } + /* Load calendar class */ $printer_friendly = ((isset($friendly) && ($friendly==1))?True:False); $phpgw->calendar = CreateObject('calendar.calendar',$printer_friendly); + + if(!isset($phpgw_info['user']['preferences']['calendar']['weekdaystarts'])) + $phpgw_info['user']['preferences']['calendar']['weekdaystarts'] = 'Sunday'; + + if (isset($date) && strlen($date) > 0) + { + $thisyear = intval(substr($date, 0, 4)); + $thismonth = intval(substr($date, 4, 2)); + $thisday = intval(substr($date, 6, 2)); + } + else + { + if (!isset($day) || !$day) + { + $thisday = $phpgw->calendar->today['day']; + } + else + { + $thisday = $day; + } + + if (!isset($month) || !$month) + { + $thismonth = $phpgw->calendar->today['month']; + } + else + { + $thismonth = $month; + } + + if (!isset($year) || !$year) + { + $thisyear = $phpgw->calendar->today['year']; + } + else + { + $thisyear = $year; + } + + } + + $phpgw->calendar->tempyear = $thisyear; + $phpgw->calendar->tempmonth = $thismonth; + $phpgw->calendar->tempday = $thisday; ?> diff --git a/calendar/inc/header.inc.php b/calendar/inc/header.inc.php index 65fcf54ad7..380e91e9e4 100644 --- a/calendar/inc/header.inc.php +++ b/calendar/inc/header.inc.php @@ -18,53 +18,6 @@ global $date, $year, $month, $day, $thisyear, $thismonth, $thisday, $filter, $keywords; global $matrixtype, $participants, $owner, $phpgw, $grants, $rights; } - - if(!isset($phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"])) - $phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"] = "Sunday"; - - if(!isset($owner)) { $owner = 0; } - - $grants = $phpgw->acl->get_grants('calendar'); - - if(!isset($owner) || !$owner) { - $owner = $phpgw_info['user']['account_id']; - $rights = PHPGW_ACL_READ + PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE + 16; - } else { - if($grants[$owner]) - { - $rights = $grants[$owner]; - if (!($rights & PHPGW_ACL_READ)) - { - $owner = $phpgw_info['user']['account_id']; - $rights = PHPGW_ACL_READ + PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE + 16; - } - } - } - - if(!isset($filter) || !$filter) - $filter = $phpgw_info["user"]["preferences"]["calendar"]["defaultfilter"]; - if (isset($date) && strlen($date) > 0) { - $thisyear = intval(substr($date, 0, 4)); - $thismonth = intval(substr($date, 4, 2)); - $thisday = intval(substr($date, 6, 2)); - } else { - if (!isset($day) || !$day) - $thisday = $phpgw->calendar->today["day"]; - else - $thisday = $day; - if (!isset($month) || !$month) - $thismonth = $phpgw->calendar->today["month"]; - else - $thismonth = $month; - if (!isset($year) || !$year) - $thisyear = $phpgw->calendar->today["year"]; - else - $thisyear = $year; - } - - $phpgw->calendar->tempyear = $thisyear; - $phpgw->calendar->tempmonth = $thismonth; - $phpgw->calendar->tempday = $thisday; ?> @@ -73,33 +26,33 @@   - + - " method="POST"> + diff --git a/calendar/month.php b/calendar/month.php index 2d458dd83d..fbab288e01 100755 --- a/calendar/month.php +++ b/calendar/month.php @@ -28,47 +28,6 @@ include('../header.inc.php'); - if(isset($friendly) && $friendly) { - if(!isset($phpgw_info['user']['preferences']['calendar']['weekdaystarts'])) - $phpgw_info['user']['preferences']['calendar']['weekdaystarts'] = 'Sunday'; - - if (isset($date) && strlen($date) > 0) { - $thisyear = intval(substr($date, 0, 4)); - $thismonth = intval(substr($date, 4, 2)); - $thisday = intval(substr($date, 6, 2)); - } else { - if (!isset($day) || !$day) - $thisday = $phpgw->calendar->today['day']; - else - $thisday = $day; - if (!isset($month) || !$month) - $thismonth = $phpgw->calendar->today['month']; - else - $thismonth = $month; - if (!isset($year) || !$year) - $thisyear = $phpgw->calendar->today['year']; - else - $thisyear = $year; - } - - if(!isset($owner)) { $owner = 0; } - - if(!isset($owner) || !$owner) { - $owner = $phpgw_info['user']['account_id']; - $rights = PHPGW_ACL_READ + PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE + 16; - } else { - $grants = $phpgw->acl->get_grants('calendar'); - if($grants[$owner]) - { - $rights = $grants[$owner]; - if (!($rights & PHPGW_ACL_READ)) - { - $owner = $phpgw_info['user']['account_id']; - } - } - } - } - $next = $phpgw->calendar->splitdate(mktime(2,0,0,$thismonth + 1,1,$thisyear)); $prev = $phpgw->calendar->splitdate(mktime(2,0,0,$thismonth - 1,1,$thisyear)); @@ -98,7 +57,7 @@ flush(); $p->set_var('large_month',$phpgw->calendar->display_large_month($thismonth,$thisyear,True,$owner)); if (!$friendly) { - $param = 'year='.$thisyear.'&month='.$thismonth.'&friendly=1&filter='.$filter; + $param = 'year='.$thisyear.'&month='.$thismonth.'&friendly=1&filter='.$filter.'&owner='.$owner; $p->set_var('print','[". lang('Printer Friendly') . ']'); $p->parse('out','index_t'); diff --git a/calendar/view.php b/calendar/view.php index 7bbe3435ce..b09d34c6b9 100755 --- a/calendar/view.php +++ b/calendar/view.php @@ -14,15 +14,28 @@ /* $Id$ */ - $phpgw_info["flags"] = array("currentapp" => "calendar", "enable_nextmatchs_class" => True); - include("../header.inc.php"); -$debugme = "on"; - if ($id < 1) { - echo lang("Invalid entry id."); - $phpgw->common->phpgw_exit(); + $phpgw_flags = array( + 'currentapp' => 'calendar', + 'enable_nextmatchs_class' => True + ); + $phpgw_info["flags"] = $phpgw_flags; + + include('../header.inc.php'); + + if(! ($rights & PHPGW_ACL_READ)) + { + echo lang('You do not have permission to read this record'); + $phpgw->common->phpgw_exit(); } - function add_day(&$repeat_days,$day) { + if ($id < 1) + { + echo lang("Invalid entry id."); + $phpgw->common->phpgw_exit(); + } + + function add_day(&$repeat_days,$day) + { if($repeat_days) $repeat_days .= ", "; $repeat_days .= $day; } @@ -30,44 +43,57 @@ $debugme = "on"; function display_item($field,$data) { global $phpgw; - $phpgw->template->set_var("field",$field); - $phpgw->template->set_var("data",$data); - $phpgw->template->parse("output","list",True); + $phpgw->template->set_var('field',$field); + $phpgw->template->set_var('data',$data); + $phpgw->template->parse('output','list',True); } - - if ($year) $thisyear = $year; - if ($month) $thismonth = $month; - - $pri[1] = lang("Low"); - $pri[2] = lang("Normal"); - $pri[3] = lang("High"); + $pri = Array( + 1 => lang('Low'), + 2 => lang('Normal'), + 3 => lang('High') + ); $db = $phpgw->db; $unapproved = FALSE; - // first see who has access to view this entry - $is_my_event = false; $cal = $phpgw->calendar->getevent(intval($id)); $cal_info = $cal[0]; - if(($cal_info->owner == $phpgw_info["user"]["account_id"]) || $phpgw_info["user"]["apps"]["admin"]) - $is_my_event = true; - + reset($cal_info->participants); + $participating = False; + while($participant = each($cal_info->participants)) + { + if($participant[1] == $owner) + { + $participating = True; + break; + } + } + + if($cal_info->owner != $phpgw_info['user']['account_id'] || $participating == False) + { + echo lang('You do not have permission to read this record'); + $phpgw->common->phpgw_exit(); + } + $description = nl2br($description); - $phpgw->template->set_file(array("view_begin" => "view.tpl", - "list" => "list.tpl", - "view_end" => "view.tpl", - "form_button"=> "form_button_script.tpl")); + $templates = Array( + 'view_begin' => 'view.tpl', + 'list' => 'list.tpl', + 'view_end' => 'view.tpl', + 'form_button' => 'form_button_script.tpl' + ); + $phpgw->template->set_file($templates); - $phpgw->template->set_block("view_begin","list","view_end","form_button"); + $phpgw->template->set_block('view_begin','list','view_end','form_button'); - $phpgw->template->set_var("bg_text",$phpgw_info["theme"]["bg_text"]); - $phpgw->template->set_var("name",$cal_info->name); - $phpgw->template->parse("out","view_begin"); + $phpgw->template->set_var('bg_text',$phpgw_info['theme']['bg_text']); + $phpgw->template->set_var('name',$cal_info->name); + $phpgw->template->parse('out','view_begin'); // Some browser add a \n when its entered in the database. Not a big deal // this will be printed even though its not needed. @@ -75,95 +101,123 @@ $debugme = "on"; display_item(lang("Description"),nl2br($cal_info->description)); } - display_item(lang("Start Date/Time"),$phpgw->common->show_date($cal_info->datetime)); + display_item(lang('Start Date/Time'),$phpgw->common->show_date($cal_info->datetime)); // save date so the trailer links are for the same time period $thisyear = (int)$cal_info->year; $thismonth = (int)$cal_info->month; $thisday = (int)$cal_info->day; - display_item(lang("End Date/Time"),$phpgw->common->show_date($cal_info->edatetime)); + display_item(lang('End Date/Time'),$phpgw->common->show_date($cal_info->edatetime)); - display_item(lang("Priority"),$pri[$cal_info->priority]); + display_item(lang('Priority'),$pri[$cal_info->priority]); - $phpgw->template->set_var("field",lang("Created by")); + $phpgw->template->set_var('field',lang('Created by')); $participate = False; for($i=0;$iparticipants);$i++) { - if($cal_info->participants[$i] == $phpgw_info["user"]["account_id"]) { + if($cal_info->participants[$i] == $phpgw_info['user']['account_id']) { $participate = True; } } - if($is_my_event && $participate) - display_item(lang("Created by"),"link("viewmatrix.php","participants=".$cal_info->owner."&date=".$cal_info->year.$cal_info->month.$cal_info->day."&matrixtype=free/busy") - ."\">".$phpgw->common->grab_owner_name($cal_info->owner).""); + if($cal_info->owner == $phpgw_info['user']['account_id'] && $participate) + { + display_item(lang('Created by'),''.$phpgw->common->grab_owner_name($cal_info->owner).''); + } else - display_item(lang("Created by"),$phpgw->common->grab_owner_name($cal_info->owner)); + { + display_item(lang('Created by'),$phpgw->common->grab_owner_name($cal_info->owner)); + } - display_item(lang("Updated"),$phpgw->common->show_date($cal_info->mdatetime)); + display_item(lang('Updated'),$phpgw->common->show_date($cal_info->mdatetime)); if($cal_info->groups[0]) { - $cal_grps = ""; + $cal_grps = ''; for($i=0;$igroups);$i++) { - if($i>0) $cal_grps .= "
"; - $db->query("SELECT account_lid FROM phpgw_accounts WHERE account_id=".$cal_info->groups[$i],__LINE__,__FILE__); - $db->next_record(); - $cal_grps .= $db->f("account_lid"); + if($i>0) $cal_grps .= '
'; + $cal_grps .= $phpgw->accounts->id2name($cal_info->groups[$i]); } - display_item(lang("Groups"),$cal_grps); + display_item(lang('Groups'),$cal_grps); } - $str = ""; + $str = ''; for($i=0;$iparticipants);$i++) { - if($i) $str .= "
"; + if($i) $str .= '
'; $str .= $phpgw->common->grab_owner_name($cal_info->participants[$i]); } - display_item(lang("Participants"),$str); + display_item(lang('Participants'),$str); // Repeated Events $str = $cal_info->rpt_type; - if($str <> "none" || $cal_info->rpt_use_end) { - $str .= " ("; - if($cal_info->rpt_use_end) - $str .= lang("ends").": ".$phpgw->common->show_date($cal_info->rpt_end,"l, F d, Y")." "; - if($cal_info->rpt_type == "weekly" || $cal_info->rpt_type == "daily") { - $repeat_days = ""; - if ($cal_info->rpt_sun) - add_day($repeat_days,lang("Sunday ")); - if ($cal_info->rpt_mon) - add_day($repeat_days,lang("Monday ")); - if ($cal_info->rpt_tue) - add_day($repeat_days,lang("Tuesay ")); - if ($cal_info->rpt_wed) - add_day($repeat_days,lang("Wednesday ")); - if ($cal_info->rpt_thu) - add_day($repeat_days,lang("Thursday ")); - if ($cal_info->rpt_fri) - add_day($repeat_days,lang("Friday ")); - if ($cal_info->rpt_sat) - add_day($repeat_days,lang("Saturday ")); - $str .= lang("days repeated").": ".$repeat_days; + if($str <> 'none' || $cal_info->rpt_use_end) { + $str .= ' ('; + if($cal_info->rpt_use_end) + { + $str .= lang('ends').': '.$phpgw->common->show_date($cal_info->rpt_end,'l, F d, Y').' '; } - if($cal_info->rpt_freq) $str .= lang("frequency")." ".$cal_info->rpt_freq; - $str .= ")"; + if($cal_info->rpt_type == 'weekly' || $cal_info->rpt_type == 'daily') + { + $repeat_days = ''; + if ($cal_info->rpt_sun) + { + add_day($repeat_days,lang('Sunday ')); + } + if ($cal_info->rpt_mon) + { + add_day($repeat_days,lang('Monday ')); + } + if ($cal_info->rpt_tue) + { + add_day($repeat_days,lang('Tuesay ')); + } + if ($cal_info->rpt_wed) + { + add_day($repeat_days,lang('Wednesday ')); + } + if ($cal_info->rpt_thu) + { + add_day($repeat_days,lang('Thursday ')); + } + if ($cal_info->rpt_fri) + { + add_day($repeat_days,lang('Friday ')); + } + if ($cal_info->rpt_sat) + { + add_day($repeat_days,lang('Saturday ')); + } + $str .= lang('days repeated').': '.$repeat_days; + } + if($cal_info->rpt_freq) $str .= lang('frequency').' '.$cal_info->rpt_freq; + $str .= ')'; - display_item(lang("Repetition"),$str); + display_item(lang('Repetition'),$str); } - if ($is_my_event) { - $phpgw->template->set_var("action_url_button",$phpgw->link("edit_entry.php","id=$id")); - $phpgw->template->set_var("action_text_button"," ".lang("Edit")." "); - $phpgw->template->set_var("action_confirm_button",""); - $phpgw->template->parse("edit_button","form_button"); - - $phpgw->template->set_var("action_url_button",$phpgw->link("delete.php","id=$id")); - $phpgw->template->set_var("action_text_button",lang("Delete")); - $phpgw->template->set_var("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.")."')\""); - $phpgw->template->parse("delete_button","form_button"); - } else { - $phpgw->template->set_var("edit_button",""); - $phpgw->template->set_var("delete_button",""); + if ($rights & PHPGW_ACL_EDIT) + { + $phpgw->template->set_var('action_url_button',$phpgw->link('edit_entry.php','id='.$id.'&owner='.$owner)); + $phpgw->template->set_var('action_text_button',' '.lang('Edit').' '); + $phpgw->template->set_var('action_confirm_button',''); + $phpgw->template->parse('edit_button','form_button'); } - $phpgw->template->pparse("out","view_end"); + else + { + $phpgw->template->set_var('edit_button',''); + } + + if ($rights & PHPGW_ACL_DELETE) + { + $phpgw->template->set_var('action_url_button',$phpgw->link('delete.php','id='.$id.'&owner='.$owner)); + $phpgw->template->set_var('action_text_button',lang('Delete')); + $phpgw->template->set_var('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.")."')\""); + $phpgw->template->parse('delete_button','form_button'); + } + else + { + $phpgw->template->set_var('delete_button',''); + } + $phpgw->template->pparse('out','view_end'); $phpgw->common->phpgw_footer(); ?>
- "> - /today.gif" alt="" border="0"> + + <?php echo lang('Today'); ?> - "> - /week.gif" alt="" border="0"> + + <?php echo lang('This week'); ?> - "> - /month.gif" alt="" border="0"> + + <?php echo lang('This month'); ?> - "> - /year.gif" alt="" border="0"> + + <?php echo lang('This year'); ?> - "> - /view.gif" alt="" border="0"> + + <?php echo lang('Daily Matrix View'); ?>
- : + : @@ -115,19 +68,19 @@ "; + echo ''; } } ?> - +
- : + : @@ -152,18 +105,18 @@ while(list($grantor,$temp_rights) = each($grants)) { ?> - + - +
@@ -175,8 +128,8 @@ - > - "> + > +