various little fixes

This commit is contained in:
skeeter 2000-11-22 04:16:18 +00:00
parent fda7c53a46
commit b3a7ae3d12
4 changed files with 152 additions and 149 deletions

View File

@ -0,0 +1,8 @@
<!-- $Id$ -->
<!-- BEGIN list -->
<tr>
<td valign="top" width="10%"><b>{field}:</b></td>
<td valign="top" width="90%">{data}</td>
</tr>
<!-- END list -->

View File

@ -0,0 +1,21 @@
<!-- $Id$ -->
<!-- BEGIN view_begin -->
<center>
<h2>
<font color="{bg_text}">
{name}
</font>
</h2>
<table border="0" width="50%">
<!-- END view_begin -->
{output}
<!-- BEGIN view_end -->
</table>
<p>
{edit}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{delete}
</center>
<!-- END view_end -->

21
calendar/timematrix.php Executable file
View File

@ -0,0 +1,21 @@
<?php
/**************************************************************************\
* phpGroupWare - Calendar *
* http://www.phpgroupware.org *
* Based on Webcalendar by Craig Knudsen <cknudsen@radix.net> *
* http://www.radix.net/~cknudsen *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/* $Id$ */
$phpgw_info["flags"] = array("currentapp" => "calendar", "enable_calendar_class" => True, "enable_nextmatchs_class" => True);
include("../header.inc.php");
echo $phpgw->calendar->timematrix($phpgw->calendar->date_to_epoch($date),0,0,$participants);
$phpgw->common->phpgw_footer();
?>

View File

@ -1,4 +1,3 @@
<?php php_track_vars?>
<?php
/**************************************************************************\
* phpGroupWare - Calendar *
@ -22,12 +21,9 @@
exit;
}
function grab_group($db,$id)
{
$db->query("select groups from webcal_entry_groups where cal_id=$id");
$db->next_record();
return $db->f("groups");
function add_day($repeat_days,$day) {
if($repeat_days) $repeat_days .= ", ";
return $repeat_days . $day;
}
if ($year) $thisyear = $year;
@ -39,172 +35,129 @@
$unapproved = FALSE;
// first see who has access to view this entry
$is_my_event = false;
$phpgw->db->query("SELECT cal_id FROM webcal_entry_user WHERE cal_login="
. $phpgw_info["user"]["account_id"]." AND cal_id = $id");
$cal = $phpgw->calendar->getevent((int)$id);
$phpgw->db->next_record();
if ($phpgw->db->f(0) == $id)
$cal_info = $cal[0];
if ($cal_info->owner == $phpgw_info["user"]["account_id"])
$is_my_event = true;
$phpgw->db->query("SELECT cal_owner, cal_date, cal_time, cal_mod_date, "
. "cal_mod_time,cal_duration,cal_priority,cal_type,cal_access, "
. "cal_name,cal_description,account_firstname, account_lastname "
. " FROM webcal_entry, accounts WHERE cal_id=$id "
. " and webcal_entry.cal_owner = accounts.account_id");
$phpgw->db->next_record();
$owner = $phpgw->db->f(0);
$name = $phpgw->db->f(9);
$description = $phpgw->db->f(10);
$name = stripslashes($name);
$name = htmlspecialchars($name);
$description = stripslashes($description);
$description = htmlspecialchars($description);
$description = nl2br($description);
?>
<h2>
<font color="<?php echo $H2COLOR; ?>">
<?php echo ($name); ?>
</font>
</h2>
$phpgw->template->set_file(array("view_begin" => "view.tpl",
"list" => "list.tpl",
"view_end" => "view.tpl"));
$phpgw->template->set_block("view_begin","list","view_end");
$phpgw->template->set_var("bg_color",$phpgw_info["theme"]["bg_text"]);
$phpgw->template->set_var("name",$cal_info->name);
$phpgw->template->parse("out","view_begin");
<TABLE BORDER=0>
<?php
// Some browser add a \n when its entered in the database. Not a big deal
// this will be printed even though its not needed.
if ($description) {
echo "<tr><td VALIGN=\"top\"><b>" . lang("Description") . ":</B></TD><td>"
. "$description</TD></TR>";
if (nl2br($cal_info->description)) {
$phpgw->template->set_var("field",lang("Description"));
$phpgw->template->set_var("data",nl2br($cal_info->description));
$phpgw->template->parse("output","list",True);
}
?>
$phpgw->template->set_var("field",lang("Date"));
$phpgw->template->set_var("data",$phpgw->common->show_date(mktime(0,0,0,$cal_info->month,$cal_info->day,$cal_info->year),"l, F d, Y"));
$phpgw->template->parse("output","list",True);
<tr>
<TD VALIGN="top"><b><?php echo lang("Date"); ?>:</B></TD>
<td><?php echo date_to_str($phpgw->db->f(1)); ?></TD>
</TR>
<?php
// save date so the trailer links are for the same time period
$list = split("-",$phpgw->db->f(1));
$thisyear = (int)($phpgw->db->f(1) / 10000);
$thismonth = ($phpgw->db->f(1) / 100) % 100;
$thisday = $phpgw->db->f(1) % 100;
$thisyear = (int)$cal_info->year;
$thismonth = (int)$cal_info->month;
$thisday = (int)$cal_info->day;
if ($phpgw->db->f(2) > 0) {
?>
<tr>
<TD VALIGN="top"><b><?php echo lang("Time"); ?>:</B></TD>
<td><?php echo display_time($phpgw->db->f(2)); ?></TD>
</TR>
<?php
if($cal_info->hour || $cal_info->minute) {
$phpgw->template->set_var("field",lang("Time"));
$phpgw->template->set_var("data",$phpgw->calendar->build_time_for_display($phpgw->calendar->fixtime($cal_info->hour,$cal_info->minute,$cal_info->ampm)));
$phpgw->template->parse("output","list",True);
}
if ($phpgw->db->f(5) > 0) {
echo "<tr><TD VALIGN=\"top\"><b>" . lang("Duration") . ":</B></TD><td>"
. $phpgw->db->f(5) . " " . lang("minutes") . "</TD></TR>";
if ($cal_info->duration > 0) {
$phpgw->template->set_var("field",lang("Duration"));
$phpgw->template->set_var("data",$cal_info->duration." ".lang("minutes"));
$phpgw->template->parse("output","list",True);
}
?>
<tr>
<TD VALIGN="top"><b><?php echo lang("Priority"); ?>:</B></TD>
<td><?php echo $pri[$phpgw->db->f(6)]; ?></TD>
</TR>
$phpgw->template->set_var("field",lang("Priority"));
$phpgw->template->set_var("data",$pri[$cal_info->priority]);
$phpgw->template->parse("output","list",True);
<?php
echo "<tr><TD VALIGN=\"top\"><b>" . lang("Created by") . ":</B></TD>\n";
$phpgw->template->set_var("field",lang("Created by"));
$phpgw->template->set_var("data","<a href=\""
.$phpgw->link("timematrix.php","participants=".$cal_info->owner."&date=".$cal_info->year.$cal_info->month.$cal_info->day)
."\">".$phpgw->common->grab_owner_name($cal_info->owner)."</a>");
$phpgw->template->parse("output","list",True);
echo "<td>" . $phpgw->db->f(11) . " " . $phpgw->db->f(12) . "</td></tr>\n";
?>
<tr>
<TD VALIGN="top"><b><?php echo lang("Updated"); ?>:</B></TD>
<td><?php echo date_to_str($phpgw->db->f(3)) . " " . display_time($phpgw->db->f(4));
?></TD>
</TR>
$phpgw->template->set_var("field",lang("Updated"));
$phpgw->template->set_var("data",$phpgw->common->show_date(mktime(0,0,0,$cal_info->mod_month,$cal_info->mod_day,$cal_info->mod_year),"l, F d, Y")." ".$phpgw->calendar->build_time_for_display($phpgw->calendar->fixtime($cal_info->mod_hour,$cal_info->mod_minute,$cal_info->mod_ampm)));
$phpgw->template->parse("output","list",True);
<?php
$cal_groups_temp = $phpgw->accounts->read_group_names();
for($i = 0; $i < count($cal_groups_temp); $i++) {
$cal_groups .= $cal_groups_temp[$i][1] . "<br>\n";
}
if ($cal_groups)
echo "<tr><td><b>" . lang("Groups") . ":</b></td><td>".$cal_groups."</td></tr>";
?>
<tr>
<TD VALIGN="top"><b><?php echo lang("Participants"); ?>:</B></TD>
<td><?php
$phpgw->db->query("SELECT webcal_entry_user.cal_login, accounts.account_lastname, "
. "accounts.account_firstname, webcal_entry_user.cal_status "
. "FROM webcal_entry_user, accounts WHERE webcal_entry_user."
. "cal_id='$id' AND webcal_entry_user.cal_login = accounts."
. "account_id");
$first = 1;
while ($phpgw->db->next_record()) {
if ($first)
$first = 0;
else
echo "<BR>";
if (strlen($phpgw->db->f(1)) > 0)
echo $phpgw->db->f(1) . ", " . $phpgw->db->f(2);
else
echo $phpgw->db->f(0);
if($cal_info->groups) {
$cal_groups = explode(",",$phpgw->accounts->convert_str_to_names_access($cal_info->groups));
$cal_grps = "";
for($i=1;$i<=count($cal_groups);$i++) {
if($i>1) $cal_grps .= "<br>";
$cal_grps .= $cal_groups[$i];
}
?>
</TD>
</TR>
<tr>
<TD VALIGN="top"><b><?php echo lang("Repetition"); ?>:</B></TD>
<td>
<?php
$phpgw->db->query("SELECT * from webcal_entry_repeats WHERE cal_id=$id");
$phpgw->db->next_record();
if (substr($phpgw->db->f(5),0,1) == 'y')
$t_repeat_days = lang("Sunday ");
if (substr($phpgw->db->f(5),1,1) == 'y')
$t_repeat_days .= lang("Monday ");
if (substr($phpgw->db->f(5),2,1) == 'y')
$t_repeat_days .= lang("Tuesday ");
if (substr($phpgw->db->f(5),3,1) == 'y')
$t_repeat_days .= lang("Wednesday ");
if (substr($phpgw->db->f(5),4,1) == 'y')
$t_repeat_days .= lang("Thursday ");
if (substr($phpgw->db->f(5),5,1) == 'y')
$t_repeat_days .= lang("Friday ");
if (substr($phpgw->db->f(5),6,1) == 'y')
$t_repeat_days .= lang("Saturday ");
echo $phpgw->db->f(2) . " (";
if ($phpgw->db->f(3))
echo "ends: " . $phpgw->db->f(3) . ", ";
if ($phpgw->db->f(2) == 'weekly')
echo lang("days repeated") . ": " . $t_repeat_days . ", ";
echo lang("frequency") . ": " . $phpgw->db->f(4) . ")";
?>
</TABLE>
<P>
<?php
if ($phpgw_info["user"]["account_id"] == $owner) {
echo "<A HREF=\"" . $phpgw->link("edit_entry.php","id=$id") . "\">"
. lang("Edit") . "</A><BR>\n<A HREF=\"" . $phpgw->link("delete.php","id=$id") . "\" onClick=\"return confirm('"
. lang("Are you sure\\nyou want to\\ndelete this entry ?\\n\\nThis will delete\\nthis entry for all users.") . "');\">" . lang("Delete") . "</A><BR>\n";
$phpgw->template->set_var("field",lang("Groups"));
$phpgw->template->set_var("data",$cal_grps);
$phpgw->template->parse("output","list",True);
}
?>
<?php
$str = "";
for($i=0;$i<count($cal_info->participants);$i++) {
if($i) $str .= "<br>";
$str .= $phpgw->common->grab_owner_name($cal_info->participants[$i]);
}
$phpgw->template->set_var("field",lang("Participants"));
$phpgw->template->set_var("data",$str);
$phpgw->template->parse("output","list",True);
// Repeated Events
$str = $cal_info->rpt_type;
if($str <> "none" || ($cal_info->rpt_end_month && $cal_info->rpt_end_day && $cal_info->rpt_end_year)) {
$str .= " (";
if($cal_info->rpt_end_month && $cal_info->rpt_end_day && $cal_info->rpt_end_year)
$str .= lang("ends").": ".$phpgw->common->show_date(mktime(0,0,0,$cal_info->rpt_end_month,$cal_info->rpt_end_day,$cal_info->rpt_end_year),"l, F d, Y")." ";
if($cal_info->rpt_type == "weekly") {
if ($cal_info->rpt_sun)
$repeat_days = add_day($repeat_days,lang("Sunday "));
if ($cal_info->rpt_mon)
$repeat_days = add_day($repeat_days,lang("Monday "));
if ($cal_info->rpt_tue)
$repeat_days = add_day($repeat_days,lang("Tuesay "));
if ($cal_info->rpt_wed)
$repeat_days = add_day($repeat_days,lang("Wednesday "));
if ($cal_info->rpt_thu)
$repeat_days = add_day($repeat_days,lang("Thursday "));
if ($cal_info->rpt_fri)
$repeat_days = add_day($repeat_days,lang("Friday "));
if ($cal_info->rpt_sat)
$repeat_days = 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 .= ")";
$phpgw->template->set_var("field",lang("Repetition"));
$phpgw->template->set_var("data",$str);
$phpgw->template->parse("output","list",True);
}
if ($is_my_event) {
$phpgw->template->set_var("edit","<a href=\"".$phpgw->link("edit_entry.php","id=$id")."\">".lang("Edit")."</a>");
$phpgw->template->set_var("delete","<a href=\"".$phpgw->link("delete.php","id=$id")."\" onClick=\"return confirm('".lang("Are you sure\\nyou want to\\ndelete this entry ?\\n\\nThis will delete\\nthis entry for all users.")."');\">".lang("Delete")."</a>");
} else {
$phpgw->template->set_var("edit","");
$phpgw->template->set_var("delete","");
}
$phpgw->template->pparse("out","view_end");
$phpgw->common->phpgw_footer();
?>