ACL incorporation - about 50% done

This commit is contained in:
skeeter 2001-02-14 02:58:46 +00:00
parent 2fe467a133
commit 84a7fb811d
6 changed files with 337 additions and 303 deletions

View File

@ -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','<body bgcolor="'.$phpgw_info['theme']['bg_color'].'">');
}
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","<body bgcolor=\"".$phpgw_info["theme"]["bg_color"]."\">");
} 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","<a href=\"".$phpgw->link("",$param)."\" TARGET=\"cal_printer_friendly\" onMouseOver=\"window.status = '".lang("Generate printer-friendly version")."'\">[".lang("Printer Friendly")."]</A>");
$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','<a href="'.$phpgw->link('',$param)."\" TARGET=\"cal_printer_friendly\" onMouseOver=\"window.status = '".lang('Generate printer-friendly version')."'\">[".lang('Printer Friendly').']</A>');
$phpgw->template->pparse('out','day_t');
}
else
{
$phpgw->template->set_var('print','');
$phpgw->template->pparse('out','day_t');
}
$phpgw->common->phpgw_footer();
?>

View File

@ -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 .= '<a href="'.$phpgw->link($phpgw_info['server']['webserver_url'].'/calendar/edit_entry.php','year='.$date_year.'&month='.$date['month'].'&day='.$date['day']).'">';
}
$str .= '<img src="'.$phpgw->common->get_image_path('calendar').'/new.gif" width="10" height="10" ';
if($rights & PHPGW_ACL_ADD) {
if($this->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 .= '</a>';
}
@ -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','<a href="' . $phpgw->link($phpgw_info['server']['webserver_url'].'/calendar/index.php','month=' . date('m',$date['raw']).'&year=' . date('Y',$date['raw'])) . '" class="minicalendar">' . lang($phpgw->common->show_date($date['raw'],'F')).' '.$year) . '</a>';
$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','<a href="' . $phpgw->link($phpgw_info['server']['webserver_url'].'/calendar/month.php','month='.date('m',$date['raw']).'&year='.date('Y',$date['raw']).'&owner='.$owner) . '" class="minicalendar">' . lang($phpgw->common->show_date($date['raw'],'F')).' '.$year . '</a>');
}
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 .= '<a href="'.$phpgw->link($phpgw_info['server']['webserver_url'].'/calendar/'.$link,'year='.$cal['year'].'&month='.$cal['month'].'&day='.$cal['day']).'" class="minicalendar">';
$str .= '<a href="'.$phpgw->link($phpgw_info['server']['webserver_url'].'/calendar/'.$link,'year='.$cal['year'].'&month='.$cal['month'].'&day='.$cal['day'].'&owner='.$owner).'" class="minicalendar">';
}
$str .= $cal['day'];
if (!$this->printer_friendly) $str .= '</a>';
@ -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 .= '<a href="'.$phpgw->link($phpgw_info['server']['webserver_url'].'/calendar/edit_entry.php','year='.$date['year']
. '&month='.$date['month'].'&day='.$date['day']
. '&hour='.substr($time,0,strpos($time,':'))
@ -1406,7 +1427,7 @@
}
$p->set_var('open_link',$str);
$p->set_var('time',(intval(substr($time,0,strpos($time,':'))) < 10 ? '0'.$time : $time) );
if(!$this->printer_friendly) {
if(!$this->printer_friendly && $this->check_perms(PHPGW_ACL_EDIT)) {
$p->set_var('close_link','</a>');
}
$p->parse('monthweek_day','day_row_time',True);

View File

@ -11,7 +11,83 @@
/* $Id$ */
global $phpgw_info, $phpgw, $grants, $owner, $rights, $filter;
global $date, $year, $month, $day, $thisyear, $thismonth, $thisday;
if(!isset($filter) || !$filter)
{
$filter = $phpgw_info["user"]["preferences"]["calendar"]["defaultfilter"];
}
$grants = $phpgw->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;
?>

View File

@ -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;
?>
<table border="0" width="100%" cols="8" cellpadding="0" cellspacing="0">
@ -73,33 +26,33 @@
&nbsp;
</td>
<td width="2%">
<a href="<?php echo $phpgw->link("day.php","day=".$phpgw->calendar->today["day"]."&month=".$phpgw->calendar->today["month"]."&year=".$phpgw->calendar->today["year"]); ?>">
<img src="<?php echo $phpgw_info["server"]["app_images"]; ?>/today.gif" alt="<?php echo lang("Today"); ?>" border="0">
<a href="<?php echo $phpgw->link('day.php','day='.$phpgw->calendar->today['day'].'&month='.$phpgw->calendar->today['month'].'&year='.$phpgw->calendar->today['year'].'&owner='.$owner); ?>">
<img src="<?php echo $phpgw_info['server']['app_images']; ?>/today.gif" alt="<?php echo lang('Today'); ?>" border="0">
</a>
</td>
<td width="2%" align="left">
<a href="<?php echo $phpgw->link("week.php","day=".$phpgw->calendar->today["day"]."&month=".$phpgw->calendar->today["month"]."&year=".$phpgw->calendar->today["year"]); ?>">
<img src="<?php echo $phpgw_info["server"]["app_images"]; ?>/week.gif" alt="<?php echo lang("This week"); ?>" border="0">
<a href="<?php echo $phpgw->link('week.php','day='.$phpgw->calendar->today['day'].'&month='.$phpgw->calendar->today['month'].'&year='.$phpgw->calendar->today['year'].'&owner='.$owner); ?>">
<img src="<?php echo $phpgw_info['server']['app_images']; ?>/week.gif" alt="<?php echo lang('This week'); ?>" border="0">
</a>
</td>
<td width="2%" align="left">
<a href="<?php echo $phpgw->link("month.php","day=".$phpgw->calendar->today["day"]."&month=".$phpgw->calendar->today["month"]."&year=".$phpgw->calendar->today["year"]); ?>">
<img src="<?php echo $phpgw_info["server"]["app_images"]; ?>/month.gif" alt="<?php echo lang("This month"); ?>" border="0">
<a href="<?php echo $phpgw->link('month.php','day='.$phpgw->calendar->today['day'].'&month='.$phpgw->calendar->today['month'].'&year='.$phpgw->calendar->today['year'].'&owner='.$owner); ?>">
<img src="<?php echo $phpgw_info['server']['app_images']; ?>/month.gif" alt="<?php echo lang('This month'); ?>" border="0">
</a>
</td>
<td width="2%" align="left">
<a href="<?php echo $phpgw->link("year.php","day=".$phpgw->calendar->today["day"]."&month=".$phpgw->calendar->today["month"]."&year=".$phpgw->calendar->today["year"]); ?>">
<img src="<?php echo $phpgw_info["server"]["app_images"]; ?>/year.gif" alt="<?php echo lang("This year"); ?>" border="0">
<a href="<?php echo $phpgw->link('year.php','day='.$phpgw->calendar->today['day'].'&month='.$phpgw->calendar->today['month'].'&year='.$phpgw->calendar->today['year'].'&owner='.$owner); ?>">
<img src="<?php echo $phpgw_info['server']['app_images']; ?>/year.gif" alt="<?php echo lang('This year'); ?>" border="0">
</a>
</td>
<td width="2%" align="left">
<a href="<?php echo $phpgw->link("matrixselect.php","day=".$phpgw->calendar->today["day"]."&month=".$phpgw->calendar->today["month"]."&year=".$phpgw->calendar->today["year"]); ?>">
<img src="<?php echo $phpgw_info["server"]["app_images"]; ?>/view.gif" alt="<?php echo lang("Daily Matrix View"); ?>" border="0">
<a href="<?php echo $phpgw->link('matrixselect.php','day='.$phpgw->calendar->today['day'].'&month='.$phpgw->calendar->today['month'].'&year='.$phpgw->calendar->today['year'].'&owner='.$owner); ?>">
<img src="<?php echo $phpgw_info['server']['app_images']; ?>/view.gif" alt="<?php echo lang('Daily Matrix View'); ?>" border="0">
</a>
</td>
<form action="<?php echo $phpgw->link(); ?>" method="POST" name="filtermethod">
<form action="<?php echo $phpgw->link('','owner='.$owner); ?>" method="POST" name="filtermethod">
<td width="45%" align="center" valign="center">
<b><?php echo lang("Filter"); ?>:</b>
<b><?php echo lang('Filter'); ?>:</b>
<input type="hidden" name="from" value="<?php echo $PHP_SELF; ?>">
<?php if(isset($date) && $date) { ?>
<input type="hidden" name="date" value="<?php echo $date; ?>">
@ -115,19 +68,19 @@
<?php }
if(isset($participants) && $participants) {
for ($i=0;$i<count($participants);$i++) {
echo "<input type=\"hidden\" name=\"participants[]\" value=\"".$participants[$i]."\">";
echo '<input type="hidden" name="participants[]" value="'.$participants[$i].'">';
}
} ?>
<select name="filter" onchange="document.filtermethod.submit()">
<option value="all"<?php if($filter=="all") echo " selected"; ?>><?php echo lang("All"); ?></option>
<option value="private"<?php if((!isset($filter) || !$filter) || $filter=="private") echo " selected"; ?>><?php echo lang("Private Only"); ?></option>
<option value="public"<?php if($filter=="public") echo " selected"; ?>><?php echo lang("Global Public Only"); ?></option>
<option value="group"<?php if($filter=="group") echo " selected"; ?>><?php echo lang("Group Public Only"); ?></option>
<option value="private+public"<?php if($filter=="private+public") echo " selected"; ?>><?php echo lang("Private and Global Public"); ?></option>
<option value="private+group"<?php if($filter=="private+group") echo " selected"; ?>><?php echo lang("Private and Group Public"); ?></option>
<option value="public+group"<?php if($filter=="public+group") echo " selected"; ?>><?php echo lang("Global Public and Group Public"); ?></option>
<option value="all"<?php if($filter=='all') echo ' selected'; ?>><?php echo lang('All'); ?></option>
<option value="private"<?php if((!isset($filter) || !$filter) || $filter=='private') echo ' selected'; ?>><?php echo lang('Private Only'); ?></option>
<option value="public"<?php if($filter=='public') echo ' selected'; ?>><?php echo lang('Global Public Only'); ?></option>
<option value="group"<?php if($filter=='group') echo ' selected'; ?>><?php echo lang('Group Public Only'); ?></option>
<option value="private+public"<?php if($filter=='private+public') echo ' selected'; ?>><?php echo lang('Private and Global Public'); ?></option>
<option value="private+group"<?php if($filter=='private+group') echo ' selected'; ?>><?php echo lang('Private and Group Public'); ?></option>
<option value="public+group"<?php if($filter=='public+group') echo ' selected'; ?>><?php echo lang('Global Public and Group Public'); ?></option>
</select>
<NOSCRIPT><INPUT TYPE="submit" VALUE="<?php echo lang("Go!"); ?>"></NOSCRIPT></FONT>
<NOSCRIPT><INPUT TYPE="submit" VALUE="<?php echo lang('Go!'); ?>"></NOSCRIPT></FONT>
</td>
</form>
<?php
@ -136,7 +89,7 @@
?>
<form action="<?php echo $phpgw->link(); ?>" method="POST" name="setowner">
<td width="20%" align="center" valign="center">
<b><?php echo lang("User"); ?>:</b>
<b><?php echo lang('User'); ?>:</b>
<input type="hidden" name="from" value="<?php echo $PHP_SELF; ?>">
<?php if(isset($date) && $date) { ?>
<input type="hidden" name="date" value="<?php echo $date; ?>">
@ -152,18 +105,18 @@
while(list($grantor,$temp_rights) = each($grants))
{
?>
<option value="<?php echo $grantor; ?>"<?php if($grantor==$owner) echo " selected"; ?>><?php echo $phpgw->common->grab_owner_name($grantor); ?></option>
<option value="<?php echo $grantor; ?>"<?php if($grantor==$owner) echo ' selected'; ?>><?php echo $phpgw->common->grab_owner_name($grantor); ?></option>
<?php
}
?>
</select>
<NOSCRIPT><INPUT TYPE="submit" VALUE="<?php echo lang("Go!"); ?>"></NOSCRIPT></FONT>
<NOSCRIPT><INPUT TYPE="submit" VALUE="<?php echo lang('Go!'); ?>"></NOSCRIPT></FONT>
</td>
</form>
<?php
}
?>
<form action="<?php echo $phpgw->link("search.php"); ?>" method="POST">
<form action="<?php echo $phpgw->link('search.php','owner='.$owner); ?>" method="POST">
<td align="right" valign="center">
<input type="hidden" name="from" value="<?php echo $PHP_SELF; ?>">
<?php if(isset($date) && $date) { ?>
@ -175,8 +128,8 @@
<?php if(isset($filter) && $filter) { ?>
<input type="hidden" name="filter" value="<?php echo $filter; ?>">
<?php } ?>
<input name="keywords"<?php if($keywords) echo " value=\"".$keywords."\""; ?>>
<input type="submit" name="submit" value="<?php echo lang("Search"); ?>">
<input name="keywords"<?php if($keywords) echo ' value="'.$keywords.'"'; ?>>
<input type="submit" name="submit" value="<?php echo lang('Search'); ?>">
</td>
</form>
</tr>

View File

@ -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','<a href="'.$phpgw->link('',$param).'" TARGET="cal_printer_friendly" onMouseOver="window.'
. "status = '" . lang('Generate printer-friendly version'). "'\">[". lang('Printer Friendly') . ']</a>');
$p->parse('out','index_t');

View File

@ -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;$i<count($cal_info->participants);$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"),"<a href=\""
.$phpgw->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)."</a>");
if($cal_info->owner == $phpgw_info['user']['account_id'] && $participate)
{
display_item(lang('Created by'),'<a href="'
.$phpgw->link('viewmatrix.php','participants='.$cal_info->owner.'&date='.$cal_info->year.$cal_info->month.$cal_info->day.'&matrixtype=free/busy&owner='.$owner)
.'">'.$phpgw->common->grab_owner_name($cal_info->owner).'</a>');
}
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;$i<count($cal_info->groups);$i++) {
if($i>0) $cal_grps .= "<br>";
$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 .= '<br>';
$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;$i<count($cal_info->participants);$i++) {
if($i) $str .= "<br>";
if($i) $str .= '<br>';
$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();
?>