about 80% complete with ACL

This commit is contained in:
skeeter 2001-02-17 14:22:33 +00:00
parent 05109bbdba
commit f114de0d95
5 changed files with 2242 additions and 1701 deletions

View File

@ -37,7 +37,7 @@
include('../header.inc.php'); include('../header.inc.php');
$view = 'day'; $view = 'day';
$now = $phpgw->calendar->splitdate(mktime (0, 0, 0, $thismonth, $thisday, $thisyear) - ((60 * 60) * $phpgw_info['user']['preferences']['common']['tz_offset'])); $now = $phpgw->calendar->makegmttime(0, 0, 0, $thismonth, $thisday, $thisyear);
$template = Array( $template = Array(
'day_t' => 'day.tpl' 'day_t' => 'day.tpl'
@ -62,7 +62,7 @@
$phpgw->template->set_var('date',lang(date('F',$m)).' '.$thisday.', '.$thisyear); $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('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('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('small_calendar',$phpgw->calendar->mini_calendar($thisday,$thismonth,$thisyear,'day.php'));
if (!$friendly) if (!$friendly)
{ {

File diff suppressed because it is too large Load Diff

View File

@ -73,17 +73,17 @@
} else { } else {
$d = date ("d"); $d = date ("d");
} }
$d_time = mktime(0,0,0,$m,$d,$y); $thisdate = $phpgw->calendar->makegmttime(0,0,0,$m,$d,$y);
$thisdate = date("Ymd", $d_time); $sun = $phpgw->calendar->get_weekday_start($y,$m,$d) -
$sun = $phpgw->calendar->get_weekday_start($y,$m,$d); ((60 * 60) * intval($phpgw_info['user']['preferences']['common']['tz_offset']));
for ($i = -7; $i <= 7; $i++) { for ($i = -7; $i <= 7; $i++) {
$tsun = $sun + (3600 * 24 * 7 * $i); $begin = $sun + (3600 * 24 * 7 * $i);
$tsat = $tsun + (3600 * 24 * 6); $end = $begin + (3600 * 24 * 6);
echo "<OPTION VALUE=\"" . $phpgw->common->show_date($tsun,"Ymd") . "\""; echo "<OPTION VALUE=\"" . $phpgw->common->show_date($begin,"Ymd") . "\"";
if ($phpgw->common->show_date($tsun,"Ymd") <= $thisdate && $phpgw->common->show_date($tsat,"Ymd") >= $thisdate) if ($begin <= $thisdate['raw'] && $end >= $thisdate['raw'])
echo " SELECTED"; echo " SELECTED";
echo ">" . lang($phpgw->common->show_date($tsun,"F")) . " " . $phpgw->common->show_date($tsun,"d") . "-" echo ">" . lang($phpgw->common->show_date($begin,"F")) . " " . $phpgw->common->show_date($begin,"d") . "-"
. lang($phpgw->common->show_date($tsat,"F")) . " " . $phpgw->common->show_date($tsat,"d"); . lang($phpgw->common->show_date($end,"F")) . " " . $phpgw->common->show_date($end,"d");
echo "</option>\n"; echo "</option>\n";
} }
?> ?>

View File

@ -28,10 +28,6 @@
include('../header.inc.php'); include('../header.inc.php');
$next = $phpgw->calendar->splitdate(mktime(2,0,0,$thismonth + 1,1,$thisyear));
$prev = $phpgw->calendar->splitdate(mktime(2,0,0,$thismonth - 1,1,$thisyear));
$view = "month"; $view = "month";
$p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('calendar')); $p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('calendar'));
@ -48,13 +44,12 @@
$p->set_var('bg_text',$phpgw_info['theme']['bg_text']); $p->set_var('bg_text',$phpgw_info['theme']['bg_text']);
$p->set_var('small_calendar_prev',$phpgw->calendar->mini_calendar(1,$prev['month'],$prev['year'],'day.php')); $p->set_var('small_calendar_prev',$phpgw->calendar->mini_calendar(1,$thismonth - 1,$thisyear,'day.php'));
$m = mktime(2,0,0,$thismonth,1,$thisyear); $m = mktime(0,0,0,$thismonth,1,$thisyear);
$p->set_var('month_identifier',lang(strftime("%B",$m)) . ' ' . $thisyear); $p->set_var('month_identifier',lang(strftime("%B",$m)) . ' ' . $thisyear);
$p->set_var('username',$phpgw->common->grab_owner_name($owner)); $p->set_var('username',$phpgw->common->grab_owner_name($owner));
$p->set_var('small_calendar_next',$phpgw->calendar->mini_calendar(1,$next['month'],$next['year'],'day.php')); $p->set_var('small_calendar_next',$phpgw->calendar->mini_calendar(1,$thismonth + 1,$thisyear,'day.php'));
flush();
$p->set_var('large_month',$phpgw->calendar->display_large_month($thismonth,$thisyear,True,$owner)); $p->set_var('large_month',$phpgw->calendar->display_large_month($thismonth,$thisyear,True,$owner));
if (!$friendly) { if (!$friendly) {
$param = 'year='.$thisyear.'&month='.$thismonth.'&friendly=1&filter='.$filter.'&owner='.$owner; $param = 'year='.$thisyear.'&month='.$thismonth.'&friendly=1&filter='.$filter.'&owner='.$owner;

View File

@ -14,122 +14,117 @@
/* $Id$ */ /* $Id$ */
$phpgw_info["flags"] = array("currentapp" => "calendar", "enable_nextmatchs_class" => True); $phpgw_flags = Array(
'currentapp' => 'calendar',
'enable_nextmatchs_class' => True
);
$phpgw_info['flags'] = $phpgw_flags;
if (isset($friendly) && $friendly){ if (isset($friendly) && $friendly)
$phpgw_info["flags"]["noheader"] = True; {
$phpgw_info["flags"]["nonavbar"] = True; $phpgw_info['flags']['noheader'] = True;
$phpgw_info["flags"]["noappheader"] = True; $phpgw_info['flags']['nonavbar'] = True;
$phpgw_info["flags"]["noappfooter"] = True; $phpgw_info['flags']['noappheader'] = True;
$phpgw_info["flags"]["nofooter"] = True; $phpgw_info['flags']['noappfooter'] = True;
} else { $phpgw_info['flags']['nofooter'] = True;
$friendly = 0; }
} else
include("../header.inc.php"); {
$friendly = 0;
}
include('../header.inc.php');
if(isset($friendly) && $friendly) { $next = $phpgw->calendar->makegmttime(0,0,0,$thismonth,$thisday + 7,$thisyear);
if(!isset($phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"])) $prev = $phpgw->calendar->makegmttime(0,0,0,$thismonth,$thisday - 7,$thisyear);
$phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"] = "Sunday";
if (isset($date) && strlen($date) > 0) { $nextmonth = $phpgw->calendar->makegmttime(0,0,0,$thismonth + 1,1,$thisyear);
$thisyear = substr($date, 0, 4); $prevmonth = $phpgw->calendar->makegmttime(0,0,0,$thismonth - 1,1,$thisyear);
$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;
}
}
if(!isset($owner)) { $owner = 0; } $first = $phpgw->calendar->gmtdate($phpgw->calendar->get_weekday_start($thisyear, $thismonth, $thisday));
$last = $phpgw->calendar->gmtdate($first['raw'] + 518400);
if(!isset($owner) || !$owner) { $p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('calendar'));
$owner = $phpgw_info['user']['account_id']; $templates = Array(
$rights = PHPGW_ACL_READ + PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE; 'week_t' => 'week.tpl'
} else { );
$grants = $phpgw->acl->get_grants('calendar'); $p->set_file($templates);
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,$thisday + 7,$thisyear)); $p->set_block('week_t','week');
$prev = $phpgw->calendar->splitdate(mktime(2,0,0,$thismonth,$thisday - 7,$thisyear));
$nextmonth = $phpgw->calendar->splitdate(mktime(2,0,0,$thismonth + 1,1,$thisyear)); if ($friendly)
$prevmonth = $phpgw->calendar->splitdate(mktime(2,0,0,$thismonth - 1,1,$thisyear)); {
$p->set_var('printer_friendly','<body bgcolor="'.$phpgw_info['theme']['bg_color'].'">');
}
else
{
$p->set_var('printer_friendly','');
}
if($phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"] == "Sunday") { $p->set_var('bg_text',$phpgw_info['theme']['bg_text']);
$start = 7200;
} else {
$start = 93600;
}
$first = $phpgw->calendar->splitdate($phpgw->calendar->get_weekday_start($thisyear, $thismonth, $thisday) + $start);
$last = $phpgw->calendar->splitdate($first["raw"] + 518400);
$p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('calendar')); $p->set_var('small_calendar_prev',$phpgw->calendar->mini_calendar($thisday,$thismonth - 1,$thisyear,'day.php'));
$p->set_file(array("week_t" => "week.tpl"));
if (!$friendly)
{
$p->set_var('prev_week_link','<a href="'.$phpgw->link('week.php','year='.$prev['year'].'&month='.$prev['month'].'&day='.$prev['day']).'">&lt;&lt;</a>');
}
else
{
$p->set_var('prev_week_link','&lt;&lt;');
}
$p->set_var('small_calendar_this',$phpgw->calendar->mini_calendar($thisday,$thismonth,$thisyear,'day.php'));
$p->set_block("week_t","week"); $week_id = lang(strftime("%B",$first['raw'])).' '.$first['day'];
if ($friendly) { if($first['month'] <> $last['month'] && $first['year'] <> $last['year'])
$p->set_var("printer_friendly","<body bgcolor=\"".$phpgw_info["theme"]["bg_color"]."\">"); {
} else { $week_id .= ', '.$first['year'];
$p->set_var("printer_friendly",""); }
}
$week_id .= ' - ';
if($first['month'] <> $last['month'])
{
$week_id .= lang(strftime("%B",$last['raw'])).' ';
}
$week_id .= $last['day'].', '.$last['year'];
$p->set_var("bg_text",$phpgw_info["theme"]["bg_text"]); $p->set_var('week_identifier',$week_id);
$p->set_var('username',$phpgw->common->grab_owner_name($owner));
$p->set_var("small_calendar_prev",$phpgw->calendar->mini_calendar($thisday,$prevmonth["month"],$prevmonth["year"],"day.php")); if (!$friendly)
if (!$friendly) { {
$p->set_var("prev_week_link","<a href=\"".$phpgw->link("week.php","year=".$prev["year"]."&month=".$prev["month"]."&day=".$prev["day"])."\">&lt;&lt;</a>"); $p->set_var('next_week_link','<a href="'.$phpgw->link('week.php','year='.$next['year'].'&month='.$next['month'].'&day='.$next['day']).'">&gt;&gt;</a>');
} else { }
$p->set_var("prev_week_link","&lt;&lt;"); else
} {
$p->set_var("small_calendar_this",$phpgw->calendar->mini_calendar($thisday,$thismonth,$thisyear,"day.php")); $p->set_var('next_week_link','&gt;&gt;');
}
$p->set_var('small_calendar_next',$phpgw->calendar->mini_calendar($thisday,$$thismonth + 1,$thisyear,'day.php'));
$p->set_var('week_display',$phpgw->calendar->display_large_week($thisday,$thismonth,$thisyear,true,$owner));
$week_id = lang(strftime("%B",$first["raw"]))." ".$first["day"]; if (!$friendly)
if($first["month"] <> $last["month"] && $first["year"] <> $last["year"]) $week_id .= ", ".$first["year"]; {
$week_id .= " - "; $param = 'year='.$thisyear.'&month='.$thismonth.'&friendly=1&filter='.$filter;
if($first["month"] <> $last["month"]) $week_id .= lang(strftime("%B",$last["raw"]))." "; $p->set_var('print','<a href="'.$phpgw->link('',$param)
$week_id .= $last["day"].", ".$last["year"]; .'" TARGET="cal_printer_friendly" onMouseOver="window.'
. "status = '" . lang('Generate printer-friendly version')
$p->set_var("week_identifier",$week_id); . "'\">[". lang('Printer Friendly') . ']</A>');
$p->set_var("username",$phpgw->common->grab_owner_name($owner)); $p->parse('out','week_t');
$p->pparse('out','week_t');
if (!$friendly) { }
$p->set_var("next_week_link","<a href=\"".$phpgw->link("week.php","year=".$next["year"]."&month=".$next["month"]."&day=".$next["day"])."\">&gt;&gt;</a>"); else
} else { {
$p->set_var("next_week_link","&gt;&gt;"); $p->set_var('print','');
} $p->parse('out','week_t');
$p->set_var("small_calendar_next",$phpgw->calendar->mini_calendar($thisday,$nextmonth["month"],$nextmonth["year"],"day.php")); $p->pparse('out','week_t');
$p->set_var("week_display",$phpgw->calendar->display_large_week($thisday,$thismonth,$thisyear,true,$owner)); }
$phpgw->common->phpgw_footer();
if (!$friendly) {
$param = 'year='.$thisyear.'&month='.$thismonth.'&friendly=1&filter='.$filter;
$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","week_t");
$p->pparse("out","week_t");
} else {
$p->set_var("print","");
$p->parse("out","week_t");
$p->pparse("out","week_t");
}
$phpgw->common->phpgw_footer();
?> ?>