edit_entry now a template

This commit is contained in:
skeeter 2000-11-23 01:37:50 +00:00
parent ba00a39582
commit f7e410e9b8
5 changed files with 273 additions and 273 deletions

View File

@ -21,18 +21,21 @@
$cal_info = new calendar_item; $cal_info = new calendar_item;
if ($id > 0) { if ($id > 0) {
$can_edit = false;
$phpgw->db->query("SELECT cal_id FROM webcal_entry_user WHERE cal_login="
. $phpgw_info["user"]["account_id"] . " AND cal_id = $id");
$phpgw->db->next_record();
if ($phpgw->db->f("cal_id") > 0)
$can_edit = true;
$cal = $phpgw->calendar->getevent((int)$id); $cal = $phpgw->calendar->getevent((int)$id);
$cal_info = $cal[0]; $cal_info = $cal[0];
$can_edit = false;
if($cal_info->owner == $phpgw_info["user"]["account_id"])
$can_edit = true;
if(!$cal_info->rpt_end_use) {
$rpt_date = $phpgw->calendar->splitdate(mktime(0,0,0,$cal_info->month,$cal_info->day + 1,$cal_info->year));
$cal_info->rpt_year = $rpt_date["year"];
$cal_info->rpt_month = $rpt_date["month"];
$cal_info->rpt_day = $rpt_date["day"];
}
} else { } else {
$can_edit = true;
if (!isset($day) || !$day) if (!isset($day) || !$day)
$thisday = (int)$phpgw->calendar->today["day"]; $thisday = (int)$phpgw->calendar->today["day"];
@ -76,297 +79,230 @@
$cal_info["hour"] = $cal_info["hour"] - 12; $cal_info["hour"] = $cal_info["hour"] - 12;
$cal_info["ampm"] = "pm"; $cal_info["ampm"] = "pm";
} }
$can_edit = true;
} }
?>
<SCRIPT LANGUAGE="JavaScript"> $phpgw->template->set_file(array("edit_entry_begin" => "edit.tpl",
// do a little form verifying "list" => "list.tpl",
function validate_and_submit() { "edit_entry_end" => "edit.tpl",
if (document.addform.name.value == "") { "form_button" => "form_button_script.tpl"));
alert("<?php echo lang("You have not entered a\\nBrief Description"); ?>.");
return false;
}
h = parseInt(document.addform.hour.value);
m = parseInt(document.addform.minute.value);
if (h > 23 || m > 59) {
alert ("<?php echo lang("You have not entered a\\nvalid time of day."); ?>");
return false;
}
// would be nice to also check date to not allow Feb 31, etc...
document.addform.submit();
return true;
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR="#C0C0C0">
<H2><FONT COLOR="#000000"><?php $phpgw->template->set_block("edit_entry_begin","list","edit_entry_end","form_button");
if ($id)
echo lang("Calendar - Edit");
else
echo lang("Calendar - Add");
?></FONT></H2> $phpgw->template->set_var("bg_color",$phpgw_info["theme"]["bg_text"]);
$phpgw->template->set_var("name_error",lang("You have not entered a\\nBrief Description").".");
$phpgw->template->set_var("time_error",lang("You have not entered a\\nvalid time of day."));
if($id)
$phpgw->template->set_var("calendar_action",lang("Calendar - Edit"));
else
$phpgw->template->set_var("calendar_action",lang("Calendar - Add"));
<?php if($can_edit) {
if ($can_edit) { $phpgw->template->set_var("action_url",$phpgw->link("edit_entry_handler.php"));
?>
<FORM ACTION="<?php echo $phpgw->link("edit_entry_handler.php"); ?>" METHOD="POST" name="addform">
<?php if ($id) echo "<INPUT TYPE=\"hidden\" NAME=\"id\" VALUE=\"$id\">\n"; ?> if($id) {
$common_hidden = "<input type=\"hidden\" name=\"id\" value=\"$id\">\n";
} else {
$common_hidden = "";
}
<TABLE BORDER=0> $phpgw->template->set_var("common_hidden",$common_hidden);
<TR>
<TD><B><?php echo lang("Brief Description"); ?>:</B></TD>
<TD>
<INPUT NAME="name" SIZE=25 VALUE="<?php echo ($cal_info->name); ?>">
</TD>
</TR>
<TR> $phpgw->template->parse("out","edit_entry_begin");
<TD VALIGN="top"><B><?php echo lang("Full Description"); ?>:</B></TD>
<TD>
<TEXTAREA NAME="description" ROWS=5 COLS=40 WRAP="virtual"><?php
echo ($cal_info->description); ?></TEXTAREA>
</TD>
</TR>
<TR> $phpgw->template->set_var("field",lang("Brief Description"));
<TD><B><?php echo lang("Date"); ?>:</B></TD> $phpgw->template->set_var("data","<input name=\"name\" size=\"25\" value=\"".$cal_info->name."\">");
<TD> $phpgw->template->parse("output","list",True);
<?php
$day_html = "<SELECT NAME=\"day\">"; $phpgw->template->set_var("field",lang("Full Description"));
for ($i = 1; $i <= 31; $i++) $phpgw->template->set_var("data","<textarea name=\"description\" rows=\"5\" cols=\"40\" wrap=\"virtual\">".$cal_info->description."</textarea>");
$day_html .= "<OPTION value=\"$i\"" . ($i == $cal_info->day ? " SELECTED" : "") . ">$i" $phpgw->template->parse("output","list",True);
$phpgw->template->set_var("field",lang("Date"));
$day_html = "<select name=\"day\">";
for ($i = 1; $i <= 31; $i++)
$day_html .= "<option value=\"$i\"" . ($i == $cal_info->day ? " selected" : "") . ">$i"
. "</option>\n"; . "</option>\n";
$day_html .= "</select>"; $day_html .= "</select>";
$month_html = "<SELECT NAME=\"month\">"; $month_html = "<select name=\"month\">";
for ($i = 1; $i <= 12; $i++) { for ($i = 1; $i <= 12; $i++) {
$m = lang(date("F", mktime(0,0,0,$i,1,$cal_info->year))); $m = lang(date("F", mktime(0,0,0,$i,1,$cal_info->year)));
$month_html .= "<OPTION VALUE=\"$i\"" . ($i == $cal_info->month ? " SELECTED" : "") . ">$m" $month_html .= "<option value=\"$i\"" . ($i == $cal_info->month ? " selected" : "") . ">$m"
. "</option>\n"; . "</option>\n";
} }
$month_html .= "</select>"; $month_html .= "</select>";
$year_html = "<SELECT NAME=\"year\">"; $year_html = "<select name=\"year\">";
for ($i = ($cal_info->year - 1); $i < ($cal_info->year + 5); $i++) { for ($i = ($cal_info->year - 1); $i < ($cal_info->year + 5); $i++) {
$year_html .= "<OPTION VALUE=\"$i\"" . ($i == $cal_info->year ? " SELECTED" : "") . ">$i" $year_html .= "<option value=\"$i\"" . ($i == $cal_info->year ? " selected" : "") . ">$i"
. "</option>\n"; . "</option>\n";
} }
$year_html .= "</select>"; $year_html .= "</select>";
echo $phpgw->common->dateformatorder($year_html,$month_html,$day_html); $phpgw->template->set_var("data",$phpgw->common->dateformatorder($year_html,$month_html,$day_html));
?> $phpgw->template->parse("output","list",True);
</TD> $phpgw->template->set_var("field",lang("Time"));
</TR>
<TR> $amsel = "checked"; $pmsel = "";
<TD><B><?php echo lang("Time"); ?>:</B></TD> if ($phpgw_info["user"]["preferences"]["common"]["timeformat"] == "12") {
<?php if ($cal_info->ampm == "pm") {
$amsel = "CHECKED"; $pmsel = ""; $amsel = ""; $pmsel = "checked";
if ($phpgw_info["user"]["preferences"]["common"]["timeformat"] == "12") { } else {
if ($cal_info->ampm == "pm") { $amsel = "checked"; $pmsel = "";
$amsel = ""; $pmsel = "CHECKED"; }
} else { }
$amsel = "CHECKED"; $pmsel = ""; $str = "<input name=\"hour\" size=\"2\" VALUE=\"".$cal_info->hour."\" maxlength=\"2\">:<input name=\"minute\" size=\"2\" value=\"".((int)$cal_info->minute>=0 && (int)$cal_info->minute<=9?"0".(int)$cal_info->minute:$cal_info->minute)."\" maxlength=\"2\">";
} if ($phpgw_info["user"]["preferences"]["common"]["timeformat"] == "12") {
} $str .= "<input type=\"radio\" name=\"ampm\" value=\"am\" $amsel>am";
?> $str .= "<input type=\"radio\" name=\"ampm\" value=\"pm\" $pmsel>pm";
<TD> }
<INPUT NAME="hour" SIZE=2 VALUE="<?php
echo $cal_info->hour;?>" MAXLENGTH=2>:<INPUT NAME="minute" SIZE=2 VALUE="<?php echo $cal_info->minute>"0" && $cal_info->minute<"9"?"0".$cal_info->minute:$cal_info->minute; ?>" MAXLENGTH=2>
<?php
if ($phpgw_info["user"]["preferences"]["common"]["timeformat"] == "12") {
echo "<INPUT TYPE=radio NAME=ampm VALUE=\"am\" $amsel>am\n";
echo "<INPUT TYPE=radio NAME=ampm VALUE=\"pm\" $pmsel>pm\n";
}
?>
</TD></TR>
<TR> $phpgw->template->set_var("data",$str);
<TD><B><?php echo lang("Duration"); ?>:</B></TD> $phpgw->template->parse("output","list",True);
<TD><INPUT NAME="duration" SIZE=3 VALUE="<?php
!$cal_info->duration?0:$cal_info->duration; ?>"> <?php echo lang("minutes"); ?></TD>
</TR>
<TR> $phpgw->template->set_var("field",lang("Duration"));
<TD><B><?php echo lang("Priority"); ?>:</B></TD> $phpgw->template->set_var("data","<input name=\"duration\" size=\"3\" value=\"".(!$cal_info->duration?0:$cal_info->duration)."\"> ".lang("minutes"));
<TD><SELECT NAME="priority"> $phpgw->template->parse("output","list",True);
<OPTION VALUE="1"<?php if ($cal_info->priority == 1) echo " SELECTED";?>><?php echo lang("Low"); ?> </option>
<OPTION VALUE="2"<?php if ($cal_info->priority == 2 || $cal_info->priority == 0 ) echo " SELECTED";?>><?php echo lang("Medium"); ?></option>
<OPTION VALUE="3"<?php if ($cal_info->priority == 3) echo " SELECTED";?>><?php echo lang("High"); ?></option>
</SELECT></TD>
</TR>
<TR> $phpgw->template->set_var("field",lang("Priority"));
<TD><B><?php echo lang("Access"); ?>:</B></TD> $str = "<select name=\"priority\">";
<TD><SELECT NAME="access"> $str .= "<option value=\"1\"";
<OPTION VALUE="private"<?php if($cal_info->priority == 1) $str .= " selected";
if ($cal_info->access == "private" || ! $id) echo " SELECTED";?>><?php echo lang("Private"); ?></option> $str .= ">".lang("Low")."</option>";
<OPTION VALUE="public"<?php $str .= "<option value=\"2\"";
if ($cal_info->access == "public") echo " SELECTED"; ?>><?php echo lang("Global Public"); ?></option> if($cal_info->priority == 2 || $cal_info->priority == 0) $str .= " selected";
<OPTION VALUE="group"<?php $str .= ">".lang("Medium")."</option>";
if ($cal_info->access == "public" || strlen($cal_info->access)) echo " SELECTED";?>><?php echo lang("Group Public"); ?></option> $str .= "<option value=\"3\"";
</SELECT> if($cal_info->priority == 3) $str .= " selected";
</TD> $str .= ">".lang("High")."</option>";
</tr> $str .= "</select>";
<tr> $phpgw->template->set_var("data",$str);
$phpgw->template->parse("output","list",True);
<TD><B><?php echo lang("group access"); ?>:</B></TD> $phpgw->template->set_var("field",lang("Access"));
<TD><SELECT NAME="n_groups[]" multiple size="5"> $str = "<select name=\"access\">";
<?php $str .= "<option value=\"private\"";
if ($cal_info->access == "private" || ! $id) $str .= " selected";
$str .= ">".lang("Private")."</option>";
$str .= "<option value=\"public\"";
if ($cal_info->access == "public") $str .= " selected";
$str .= ">".lang("Global Public")."</option>";
$str .= "<option value=\"group\"";
if ($cal_info->access == "public" || !strlen($cal_info->access)) $str .= " selected";
$str .= ">".lang("Group Public")."</option>";
$str .= "</select>";
$phpgw->template->set_var("data",$str);
$phpgw->template->parse("output","list",True);
$phpgw->template->set_var("field",lang("Access"));
$str = "<select name=\"n_groups[]\" multiple size=\"5\">";
$user_groups = $phpgw->accounts->read_group_names(); $user_groups = $phpgw->accounts->read_group_names();
for ($i=0;$i<count($user_groups);$i++) { for ($i=0;$i<count($user_groups);$i++) {
echo "<option value=\"" . $user_groups[$i][0] . "\""; $str .= "<option value=\"" . $user_groups[$i][0] . "\"";
if (ereg(",".$user_groups[$i][0].",",$cal_info->groups)) if (ereg(",".$user_groups[$i][0].",",$cal_info->groups))
echo " selected"; $str .= " selected";
echo ">" . $user_groups[$i][1] . "</option>\n"; $str .= ">" . $user_groups[$i][1] . "</option>";
} }
?></SELECT></TD> $str .= "</select>";
</TR> $phpgw->template->set_var("data",$str);
$phpgw->template->parse("output","list",True);
$phpgw->template->set_var("field",lang("Participants"));
$phpgw->db->query("select account_id,account_lastname,account_firstname,account_lid "
. "from accounts where account_status !='L' and "
. "account_id != ".$phpgw_info["user"]["account_id"]." "
. "and account_permissions like '%:calendar:%' "
. "order by account_lastname,account_firstname,account_lid");
<?php if ($phpgw->db->num_rows() > 50)
$phpgw->db->query("select account_id,account_lid,account_lastname, account_firstname from " $size = 15;
. "accounts where account_status !='L' and account_lid != '" else if ($phpgw->db->num_rows() > 5)
. $phpgw_info["user"]["userid"] . "' and account_permissions like '%:calendar:%' " $size = 5;
. "order by account_lastname,account_firstname,account_lid"); else
$size = $phpgw->db->num_rows();
$str = "<select name=\"participants[]\" multiple size=\"5\">";
for ($l=0;$l<count($cal_info->participants);$l++)
$parts[$cal_info->participants[$l]] = True;
while ($phpgw->db->next_record()) {
$str .= "<option value=\"" . $phpgw->db->f("account_id") . "\"";
if ($parts[$phpgw->db->f("account_id")])
$str .= " selected";
$str .= ">".$phpgw->common->grab_owner_name($phpgw->db->f("account_id"))."</option>";
}
$str .= "</select>";
$str .= "<input type=\"hidden\" name=\"participants[]\" value=\"".$phpgw_info["user"]["account_id"]."\">";
$phpgw->template->set_var("data",$str);
$phpgw->template->parse("output","list",True);
if ($phpgw->db->num_rows() > 50) $phpgw->template->set_var("field",lang("Repeat Type"));
$size = 15; $str = "<select name=\"rpt_type\">";
else if ($phpgw->db->num_rows() > 5) $rpt_type_str = Array("none","daily","weekly","monthlybyday","monthlybydate","yearly");
$size = 5; $rpt_type_out = Array("none" => "None", "daily" => "Daily", "weekly" => "Weekly", "monthlybyday" => "Monthly (by day)", "monthlybydate" => "Monthly (by date)", "yearly" => "yearly");
else for($l=0;$l<count($rpt_type_str);$l++) {
$size = $phpgw->db->num_rows(); $str .= "<option value=\"".$rpt_type_str[$l]."\"";
if(!strcmp($cal_info->rpt_type,$rpt_type_str[$l])) $str .= " selected";
$str .= ">".lang($rpt_type_out[$rpt_type_str[$l]])."</option>";
}
$str .= "</select>";
$phpgw->template->set_var("data",$str);
$phpgw->template->parse("output","list",True);
echo "<TR><TD VALIGN=\"top\"><B>" . lang("Participants") . ":</B></TD>" $phpgw->template->set_var("field",lang("Repeat End Date"));
. "<TD>\n<SELECT NAME=\"participants[]\" multiple size=\"$size\">\n"; $str = "<input type=\"checkbox\" name=\"rpt_end_use\" value=\"y\"";
if($cal_info->rpt_end_use) $str .= " checked";
$str .= ">".lang("Use End Date")." ";
while ($phpgw->db->next_record()) { $day_html = "<select name=\"rpt_day\">";
echo "<option value=\"" . $phpgw->db->f("account_id") . "\""; for($i=1;$i<=31;$i++) {
if ($cal_info->participants[$phpgw->db->f("account_id")]) $day_html .= "<option value=\"$i\"".($i == $cal_info->rpt_day ? " selected" : "").">$i</option>\n";
echo " selected"; }
$day_html .= "</select>";
echo ">" . $phpgw->common->display_fullname($phpgw->db->f("account_lid"), $month_html = "<select name=\"rpt_month\">";
$phpgw->db->f("account_firstname"), for($i=1;$i<=12;$i++) {
$phpgw->db->f("account_lastname")); $m = lang(date("F", mktime(0,0,0,$i,1,$cal_info->rpt_year)));
echo "</option>\n"; $month_html .= "<option value=\"$i\"".($i == $cal_info->rpt_month ? " selected" : "").">$m</option>\n";
} }
$month_html .= "</select>";
echo "</select><input type=\"hidden\" name=\"participants[]\" value=\"" $year_html = "<select name=\"rpt_year\">";
. $phpgw_info["user"]["account_id"] ."\">" for ($i = ($cal_info->rpt_year - 1); $i < ($cal_info->rpt_year + 5); $i++) {
. "</td></tr>\n"; $year_html .= "<option value=\"$i\"".($i == $cal_info->rpt_year ? " selected" : "").">$i</option>\n";
}
$year_html .= "</select>";
?> $str .= $phpgw->common->dateformatorder($year_html,$month_html,$day_html);
$phpgw->template->set_var("data",$str);
$phpgw->template->parse("output","list",True);
<tr> $phpgw->template->set_var("field",lang("Repeat Day")."<br>".lang("for weekly"));
<td><b><?php echo lang("Repeat type"); ?>:</b></td> $str = "<input type=\"checkbox\" name=\"rpt_sun\" value=\"y\"".($cal_info->rpt_sun?"checked":"")."> ".lang("Sunday")." ";
<td><select name="rpt_type"> $str .= "<input type=\"checkbox\" name=\"rpt_mon\" value=\"y\"".($cal_info->rpt_mon?"checked":"")."> ".lang("Monday")." ";
<?php $str .= "<input type=\"checkbox\" name=\"rpt_tue\" value=\"y\"".($cal_info->rpt_tue?"checked":"")."> ".lang("Tuesday")." ";
echo "<option value=\"none\"" . (strcmp($cal_info->rpt_type,'none')==0?"selected":"") . ">" $str .= "<input type=\"checkbox\" name=\"rpt_wed\" value=\"y\"".($cal_info->rpt_wed?"checked":"")."> ".lang("Wednesday")." ";
. lang("None") . "</option>"; $str .= "<input type=\"checkbox\" name=\"rpt_thu\" value=\"y\"".($cal_info->rpt_thu?"checked":"")."> ".lang("Thursday")." ";
$str .= "<input type=\"checkbox\" name=\"rpt_fri\" value=\"y\"".($cal_info->rpt_fri?"checked":"")."> ".lang("Friday")." ";
$str .= "<input type=\"checkbox\" name=\"rpt_sat\" value=\"y\"".($cal_info->rpt_sat?"checked":"")."> ".lang("Saturday")." ";
$phpgw->template->set_var("data",$str);
$phpgw->template->parse("output","list",True);
echo "<option value=\"daily\"" . (strcmp($cal_info->rpt_type,'daily')==0?"selected":"") . ">" $phpgw->template->set_var("field",lang("Frequency"));
. lang("Daily") . "</option>"; $phpgw->template->set_var("data","<input name=\"rpt_freq\" size=\"4\" maxlength=\"4\" value=\"".$cal_info->rpt_freq."\">");
$phpgw->template->parse("output","list",True);
echo "<option value=\"weekly\"" . (strcmp($cal_info->rpt_type,'weekly')==0?"selected":"") . ">" $phpgw->template->set_var("submit_button",lang("Submit"));
. lang("Weekly") . "</option>";
echo "<option value=\"monthlyByDay\"".(strcmp($cal_info->rpt_type,'monthlyByDay')==0?"selected":"") if ($id > 0) {
. ">" . lang("Monthly (by day)") . "</option>"; $phpgw->template->set_var("action_url",$phpgw->link("delete.php","id=$id"));
$phpgw->template->set_var("action_text",lang("Delete"));
echo "<option value=\"monthlyByDate\"".(strcmp($cal_info->rpt_type,'monthlyByDate')==0?"checked":"") $phpgw->template->parse("delete_button","form_button");
. "> " . lang("Monthly (by date)") . "</option>"; $phpgw->template->pparse("out","edit_entry_end");
} else {
echo "<option value=\"yearly\"" . (strcmp($cal_info->rpt_type,'yearly')==0?"checked":"") . ">" $phpgw->template->set_var("delete_button","");
. lang("Yearly") . "</option>"; $phpgw->template->pparse("out","edit_entry_end");
?> }
</select>
</td>
<tr>
<td><b><?php echo lang("Repeat End date"); ?>:</b></td>
<td><input type=checkbox name=rpt_end_use value=y <?php
echo ($cal_info->rpt_end?"checked":""); ?>> <?php echo lang("Use End date"); ?>
<?php
$day_html = "<SELECT NAME=\"rpt_day\">";
for ($i = 1; $i <= 31; $i++) {
$day_html .= "<OPTION value=\"$i\"" . ($i == $cal_info->rpt_day ? " SELECTED" : "")
. ">$i</option>\n";
}
$day_html .= "</select>";
$month_html = "<select name=\"rpt_month\">";
for ($i = 1; $i <= 12; $i++) {
$m = lang(date("F", mktime(0,0,0,$i,1,$cal_info->rpt_year)));
$month_html .= "<OPTION VALUE=\"$i\"" . ($i == $cal_info->rpt_month ? " SELECTED" : "")
. ">$m</option>\n";
}
$month_html .= "</select>";
$year_html = "<select name=\"rpt_year\">";
for ($i = ($cal_info->rpt_year - 1); $i < ($cal_info->rpt_year + 5); $i++) {
$year_html .= "<OPTION VALUE=\"$i\"" . ($i == $cal_info->rpt_year ? " SELECTED" : "") . ">$i"
. "</option>\n";
}
$year_html .= "</select>";
echo $phpgw->common->dateformatorder($year_html,$month_html,$day_html);
?>
</td>
</tr>
<tr>
<td><b><?php echo lang("Repeat day"); ?>: </b><?php echo lang("(for Weekly)"); ?></td>
<td><?php
echo "<input type=checkbox name=rpt_sun value=y "
. ($cal_info->rpt_sun?"checked":"") . "> " . lang("Sunday");
echo "<input type=checkbox name=rpt_mon value=y "
. ($cal_info->rpt_mon?"checked":"") . "> " . lang("Monday");
echo "<input type=checkbox name=rpt_tue value=y "
. ($cal_info->rpt_tue?"checked":"") . "> " . lang("Tuesday");
echo "<input type=checkbox name=rpt_wed value=y "
. ($cal_info->rpt_wed?"checked":"") . "> " . lang("Wednesday");
echo "<input type=checkbox name=rpt_thu value=y "
. ($cal_info->rpt_thu?"checked":"") . "> " . lang("Thursday");
echo "<input type=checkbox name=rpt_fri value=y "
. ($cal_info->rpt_fri?"checked":"") . "> " . lang("Friday");
echo "<input type=checkbox name=rpt_sat value=y "
. ($cal_info->rpt_sat?"checked":"") . "> " . lang("Saturday");
?></td>
</tr>
<tr>
<td><b><?php echo lang("Frequency"); ?>: </b></td>
<td>
<input name="rpt_freq" size="4" maxlength="4" value="<?php echo $cal_info->rpt_freq; ?>">
</td>
</tr>
</TABLE>
<SCRIPT LANGUAGE="JavaScript">
document.writeln ( '<INPUT TYPE="button" VALUE="<?php echo lang("Submit"); ?>" ONCLICK="validate_and_submit()">' );
/* document.writeln ( '<INPUT TYPE="button" VALUE="<?php echo lang("Help"); ?>" ONCLICK="window.open ( \'help_edit_entry.php\', \'cal_help\', \'dependent,menubar,height=365,width=650,innerHeight=365,outerWidth=420,resizable=1\');">' ); */
</SCRIPT>
<NOSCRIPT>
<INPUT TYPE="submit" VALUE="<?php echo lang("Submit"); ?>">
</NOSCRIPT>
<INPUT TYPE="hidden" NAME="participant_list" VALUE="">
</FORM>
<?php
if ($id > 0) {
echo "<A HREF=\"" . $phpgw->link("delete.php","id=$id") . "\" onClick=\"return confirm('"
. lang("Are you sure\\nyou want to\\ndelete this entry ?") . "');\">"
. lang("Delete") . "</A><BR>";
}
} // ***** This might be out of place. I was getting tons of parse errors
// from if ($can_edit) { This needs to be rewritten, because if you do
// not own the entry. You should not get into this portion of the program.
$phpgw->common->phpgw_footer(); $phpgw->common->phpgw_footer();
}
?> ?>

View File

@ -0,0 +1,47 @@
<!-- $Id$ -->
<!-- BEGIN edit_entry_begin -->
<script language="JavaScript">
// do a little form verifying
function validate_and_submit() {
if (document.addform.name.value == "") {
alert("{name_error}");
return false;
}
h = parseInt(document.addform.hour.value);
m = parseInt(document.addform.minute.value);
if (h > 23 || m > 59) {
alert ("{time_error}");
return false;
}
// would be nice to also check date to not allow Feb 31, etc...
document.addform.submit();
return true;
}
</script>
</head>
<body bgcolor="#C0C0C0">
<center>
<h2><font color="#000000">{calendar_action}</font></h2>
<form action="{action_url}" method="post" name="addform">
{common_hidden}
<table border="0" width="75%">
<!-- END edit_entry_begin -->
{output}
<!-- BEGIN edit_entry_end -->
</table>
<script language="JavaScript">
document.writeln ('<INPUT TYPE="button" VALUE="{submit_button}" ONCLICK="validate_and_submit()">');
</script>
<noscript>
<input type="submit" value="{submit_button}">
</noscript>
<input type="hidden" name="participant_list" value="">
</form>
{delete_button}
</center>
<!-- END edit_entry_end -->

View File

@ -0,0 +1,6 @@
<!-- $Id$ -->
<!-- BEGIN form_button -->
<form action="{action_url}" method="post" name="{action_text}form">
<input type="submit" value="{action_text}" {action_confirm}>
</form>
<!-- END form_button -->

View File

@ -14,7 +14,7 @@
<!-- BEGIN view_end --> <!-- BEGIN view_end -->
</table> </table>
<p> <p>
{edit}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{delete} {edit_button}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{delete_button}
</center> </center>
<!-- END view_end --> <!-- END view_end -->

View File

@ -48,9 +48,10 @@
$phpgw->template->set_file(array("view_begin" => "view.tpl", $phpgw->template->set_file(array("view_begin" => "view.tpl",
"list" => "list.tpl", "list" => "list.tpl",
"view_end" => "view.tpl")); "view_end" => "view.tpl",
"form_button"=> "form_button_script.tpl"));
$phpgw->template->set_block("view_begin","list","view_end"); $phpgw->template->set_block("view_begin","list","view_end","form_button");
$phpgw->template->set_var("bg_color",$phpgw_info["theme"]["bg_text"]); $phpgw->template->set_var("bg_color",$phpgw_info["theme"]["bg_text"]);
$phpgw->template->set_var("name",$cal_info->name); $phpgw->template->set_var("name",$cal_info->name);
@ -155,11 +156,21 @@
} }
if ($is_my_event) { 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("action_url",$phpgw->link("edit_entry.php","id=$id"));
$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>"); $phpgw->template->set_var("action_text"," ".lang("Edit")." ");
$phpgw->template->set_var("action_confirm","");
$phpgw->template->parse("edit_button","form_button");
$phpgw->template->set_var("action_url",$phpgw->link("delete.php","id=$id"));
$phpgw->template->set_var("action_text",lang("Delete"));
$phpgw->template->set_var("action_confirm","onClick=\"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");
// $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 { } else {
$phpgw->template->set_var("edit",""); $phpgw->template->set_var("edit_button","");
$phpgw->template->set_var("delete",""); $phpgw->template->set_var("delete_button","");
} }
$phpgw->template->pparse("out","view_end"); $phpgw->template->pparse("out","view_end");
$phpgw->common->phpgw_footer(); $phpgw->common->phpgw_footer();