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');
$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(
'day_t' => 'day.tpl'
@ -62,7 +62,7 @@
$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'));
$phpgw->template->set_var('small_calendar',$phpgw->calendar->mini_calendar($thisday,$thismonth,$thisyear,'day.php'));
if (!$friendly)
{

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -28,10 +28,6 @@
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";
$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('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('username',$phpgw->common->grab_owner_name($owner));
$p->set_var('small_calendar_next',$phpgw->calendar->mini_calendar(1,$next['month'],$next['year'],'day.php'));
flush();
$p->set_var('small_calendar_next',$phpgw->calendar->mini_calendar(1,$thismonth + 1,$thisyear,'day.php'));
$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.'&owner='.$owner;

View File

@ -14,122 +14,117 @@
/* $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){
$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");
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');
if(isset($friendly) && $friendly) {
if(!isset($phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"]))
$phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"] = "Sunday";
$next = $phpgw->calendar->makegmttime(0,0,0,$thismonth,$thisday + 7,$thisyear);
$prev = $phpgw->calendar->makegmttime(0,0,0,$thismonth,$thisday - 7,$thisyear);
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;
}
}
$nextmonth = $phpgw->calendar->makegmttime(0,0,0,$thismonth + 1,1,$thisyear);
$prevmonth = $phpgw->calendar->makegmttime(0,0,0,$thismonth - 1,1,$thisyear);
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) {
$owner = $phpgw_info['user']['account_id'];
$rights = PHPGW_ACL_READ + PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE;
} else {
$grants = $phpgw->acl->get_grants('calendar');
if($grants[$owner])
{
$rights = $grants[$owner];
if (!($rights & PHPGW_ACL_READ))
{
$owner = $phpgw_info['user']['account_id'];
}
}
}
$p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('calendar'));
$templates = Array(
'week_t' => 'week.tpl'
);
$p->set_file($templates);
$next = $phpgw->calendar->splitdate(mktime(2,0,0,$thismonth,$thisday + 7,$thisyear));
$prev = $phpgw->calendar->splitdate(mktime(2,0,0,$thismonth,$thisday - 7,$thisyear));
$p->set_block('week_t','week');
$nextmonth = $phpgw->calendar->splitdate(mktime(2,0,0,$thismonth + 1,1,$thisyear));
$prevmonth = $phpgw->calendar->splitdate(mktime(2,0,0,$thismonth - 1,1,$thisyear));
if ($friendly)
{
$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") {
$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->set_var('bg_text',$phpgw_info['theme']['bg_text']);
$p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('calendar'));
$p->set_file(array("week_t" => "week.tpl"));
$p->set_var('small_calendar_prev',$phpgw->calendar->mini_calendar($thisday,$thismonth - 1,$thisyear,'day.php'));
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) {
$p->set_var("printer_friendly","<body bgcolor=\"".$phpgw_info["theme"]["bg_color"]."\">");
} else {
$p->set_var("printer_friendly","");
}
if($first['month'] <> $last['month'] && $first['year'] <> $last['year'])
{
$week_id .= ', '.$first['year'];
}
$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) {
$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"));
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
{
$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($first["month"] <> $last["month"] && $first["year"] <> $last["year"]) $week_id .= ", ".$first["year"];
$week_id .= " - ";
if($first["month"] <> $last["month"]) $week_id .= lang(strftime("%B",$last["raw"]))." ";
$week_id .= $last["day"].", ".$last["year"];
$p->set_var("week_identifier",$week_id);
$p->set_var("username",$phpgw->common->grab_owner_name($owner));
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 {
$p->set_var("next_week_link","&gt;&gt;");
}
$p->set_var("small_calendar_next",$phpgw->calendar->mini_calendar($thisday,$nextmonth["month"],$nextmonth["year"],"day.php"));
$p->set_var("week_display",$phpgw->calendar->display_large_week($thisday,$thismonth,$thisyear,true,$owner));
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();
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();
?>