diff --git a/calendar/edit_entry.php b/calendar/edit_entry.php
index 1f80bfdc98..e87f40c602 100755
--- a/calendar/edit_entry.php
+++ b/calendar/edit_entry.php
@@ -99,11 +99,7 @@
if($can_edit) {
$phpgw->template->set_var("action_url",$phpgw->link("edit_entry_handler.php"));
- if($id) {
- $common_hidden = "\n";
- } else {
- $common_hidden = "";
- }
+ $common_hidden = "\n";
$phpgw->template->set_var("common_hidden",$common_hidden);
@@ -295,8 +291,9 @@
$phpgw->template->set_var("submit_button",lang("Submit"));
if ($id > 0) {
- $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_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");
$phpgw->template->pparse("out","edit_entry_end");
} else {
diff --git a/calendar/edit_entry_handler.php b/calendar/edit_entry_handler.php
index e44ce69faa..ce22aa72ee 100755
--- a/calendar/edit_entry_handler.php
+++ b/calendar/edit_entry_handler.php
@@ -1,4 +1,3 @@
-
"calendar", "noheader" => True, "nonavbar" => True, "enable_calendar_class" => True, "enable_nextmatchs_class" => True);
include("../header.inc.php");
+
+ if($REQUEST_METHOD <> "POST") {
+ }
+
+ $cal_info = new calendar_item;
+
+ for(reset($HTTP_POST_VARS);$key=key($HTTP_POST_VARS);next($HTTP_POST_VARS)) {
+ $data = $HTTP_POST_VARS[$key];
+ $cal_info->set($key,$data);
+ }
+
+ $phpgw->calendar->add($cal_info,$cal_info->id);
+
// Input time format "2359"
- function add_duration($time, $duration)
- {
- $hour = (int)($time / 10000);
- $min = $time % 100;
- $minutes = $hour * 60 + $min + $duration;
- $h = $minutes / 60;
- $m = $minutes % 60;
- $ret = sprintf ("%d%02d",$h,$m);
- //echo "add_duration ( $time, $duration ) = $ret
";
- return $ret;
- }
+// function add_duration($time, $duration)
+// {
+// $hour = (int)($time / 10000);
+// $min = $time % 100;
+// $minutes = $hour * 60 + $min + $duration;
+// $h = $minutes / 60;
+// $m = $minutes % 60;
+// $ret = sprintf ("%d%02d",$h,$m);
+// //echo "add_duration ( $time, $duration ) = $ret
";
+// return $ret;
+// }
- // check to see if two events overlap
- function times_overlap($time1, $duration1, $time2, $duration2)
- {
- //echo "times_overlap ( $time1, $duration1, $time2, $duration2 )
";
- $hour1 = (int) ($time1 / 100);
- $min1 = $time1 % 100;
- $hour2 = (int) ($time2 / 100);
- $min2 = $time2 % 100;
- // convert to minutes since midnight
- $tmins1start = $hour1 * 60 + $min1;
- $tmins1end = $tmins1start + $duration1;
- $tmins2start = $hour2 * 60 + $min2;
- $tmins2end = $tmins2start + $duration2;
- //echo "tmins1start=$tmins1start, tmins1end=$tmins1end, tmins2start="
- // . "$tmins2start, tmins2end=$tmins2end
";
-
- if ($tmins1start >= $tmins2start && $tmins1start <= $tmins2end)
- return true;
- if ($tmins1end >= $tmins2start && $tmins1end <= $tmins2end)
- return true;
- if ($tmins2start >= $tmins1start && $tmins2start <= $tmins1end)
- return true;
- if ($tmins2end >= $tmins1start && $tmins2end <= $tmins1end)
- return true;
- return false;
- }
-
- $phpgw->db->lock(array('webcal_entry','webcal_entry_user','webcal_entry_groups',
- 'webcal_entry_repeats'));
-
- // first check for any schedule conflicts
- if (strlen($hour) > 0) {
- $date = mktime(0,0,0,$month,$day,$year);
- if ($phpgw_info["user"]["preferences"]["common"]["timeformat"] == "12") {
- $hour %= 12;
- if ($ampm == "pm")
- $hour += 12;
- }
-
- $sql = "SELECT webcal_entry_user.cal_login, webcal_entry.cal_time," .
- "webcal_entry.cal_duration, webcal_entry.cal_name, " .
- "webcal_entry.cal_id, webcal_entry.cal_access " .
- "FROM webcal_entry, webcal_entry_user " .
- "WHERE webcal_entry.cal_id = webcal_entry_user.cal_id " .
- "AND webcal_entry.cal_date = " . date("Ymd", $date) . " AND ( ";
-
- for ($i = 0; $i < count($participants); $i++) {
- if ($i) $sql .= " OR ";
- $sql .= " webcal_entry_user.cal_login = '" . $participants[$i] . "'";
- }
- $sql .= " )";
-
- $phpgw->db->query($sql);
- $time1 = sprintf("%d:%02d", $hour, $minute);
- $duration1 = sprintf("%d", $duration);
-
- while ($phpgw->db->next_record()) {
- // see if either event overlaps one another
- if ($phpgw->db->f(4) != $id) {
- $time2 = $phpgw->db->f(1);
- $duration2 = $phpgw->db->f(2);
- if (times_overlap($time1, $duration1, $time2, $duration2)) {
- $overlap .= "
";
- if ($phpgw->db->f(5) == 'R' && $phpgw->db->f(0) != $login)
- $overlap .= "(PRIVATE)";
- else {
- $overlap .= "link("view.php",
- "id=".$phpgw->db->f(4))."\">"
- . $phpgw->db->f(3) . "";
- }
- $overlap .= " (" . display_time($time2);
- if ($duration2 > 0)
- $overlap .= "-" . display_time(add_duration($time2,$duration2))
- . ")";
- }
- }
- }
- }
-
-if ($overlap)
- $error = lang("The following conflicts with the suggested time:",
- $overlap);
-
-if (! $error) {
- // now add the entries
-
- if ($id != 0) {
- $phpgw->db->query("DELETE FROM webcal_entry WHERE cal_id = $id");
- $phpgw->db->query("DELETE FROM webcal_entry_user WHERE cal_id = $id");
- $phpgw->db->query("DELETE FROM webcal_entry_repeats WHERE cal_id = $id");
- $phpgw->db->query("DELETE FROM webcal_entry_groups WHERE cal_id = $id");
- }
-
- $sql = "INSERT INTO webcal_entry (cal_owner, cal_date, " .
- "cal_time, cal_mod_date, cal_mod_time, cal_duration, cal_priority, " .
- "cal_access, cal_type, cal_name, cal_description ) " .
- "VALUES ('" . $phpgw_info["user"]["account_id"] . "', ";
-
- $date = mktime(0,0,0,$month,$day,$year);
- $sql .= date("Ymd", $date) . ", ";
- if (strlen($hour) > 0) {
- if ($phpgw_info["user"]["preferences"]["common"]["timeformat"] == "12") {
- $hour %= 12;
- if ($ampm == "pm")
- $hour += 12;
- }
- $sql .= sprintf("%02d%02d00, ",$hour,$minute);
- } else
- $sql .= "'-1', ";
-
- $sql .= date("Ymd") . ", " . date("Gis") . ", ";
- $sql .= sprintf("%d, ",$duration);
- $sql .= sprintf("%d, ",$priority);
- $sql .= "'$access', ";
-
- if ($rpt_type != 'none')
- $sql .= "'M', ";
- else
- $sql .= "'E', ";
-
- if (strlen($name) == 0)
- $name = "Unnamed Event";
-
- $sql .= "'" . addslashes($name) . "', ";
- if (! $description)
- $sql .= "'" . addslashes($name) . "')";
- else
- $sql .= "'" . addslashes($description) . "' )";
-
- $error = "";
- $phpgw->db->query($sql);
-
- $phpgw->db->query("SELECT MAX(cal_id) FROM webcal_entry");
- $phpgw->db->next_record();
- $id = $phpgw->db->f(0);
-
- while ($participant = each($participants)) {
- $phpgw->db->query("INSERT INTO webcal_entry_user (cal_id,cal_login,cal_status ) "
- . "VALUES ($id, '" . $participant[1] . "', 'A')");
- }
-
- if (strlen($rpt_type) || ! strcmp($rpt_type,'none') == 0) {
- // clearly, we want to delete the old repeats, before inserting new...
- $phpgw->db->query("delete from webcal_entry_repeats where cal_id='$id'");
- $freq = ($rpt_freq?$rpt_freq:1);
-
- if ($rpt_end_use) {
- $end = "'" . date("Ymd",mktime(0,0,0,$rpt_month,$rpt_day,$rpt_year))
- . "'";
- } else
- $end = 0;
-
- if ($rpt_type == 'weekly') {
- $days = ($rpt_sun?'y':'n')
- . ($rpt_mon?'y':'n')
- . ($rpt_tue?'y':'n')
- . ($rpt_wed?'y':'n')
- . ($rpt_thu?'y':'n')
- . ($rpt_fri?'y':'n')
- . ($rpt_sat?'y':'n');
- } else {
- $days = "nnnnnnn";
- }
-
- $phpgw->db->query("insert into webcal_entry_repeats (cal_id,cal_type,"
- . "cal_end,cal_days,cal_frequency) values($id,'$rpt_type',"
- . "$end,'$days',$freq)");
- }
- $phpgw->db->query("insert into webcal_entry_groups values ($id,'"
- . $phpgw->accounts->array_to_string($access,$n_groups) . "') ");
-
-
+// // check to see if two events overlap
+// function times_overlap($time1, $duration1, $time2, $duration2)
+// {
+// //echo "times_overlap ( $time1, $duration1, $time2, $duration2 )
";
+// $hour1 = (int) ($time1 / 100);
+// $min1 = $time1 % 100;
+// $hour2 = (int) ($time2 / 100);
+// $min2 = $time2 % 100;
+// // convert to minutes since midnight
+// $tmins1start = $hour1 * 60 + $min1;
+// $tmins1end = $tmins1start + $duration1;
+// $tmins2start = $hour2 * 60 + $min2;
+// $tmins2end = $tmins2start + $duration2;
+// //echo "tmins1start=$tmins1start, tmins1end=$tmins1end, tmins2start="
+// // . "$tmins2start, tmins2end=$tmins2end
";
+//
+// if ($tmins1start >= $tmins2start && $tmins1start <= $tmins2end)
+// return true;
+// if ($tmins1end >= $tmins2start && $tmins1end <= $tmins2end)
+// return true;
+// if ($tmins2start >= $tmins1start && $tmins2start <= $tmins1end)
+// return true;
+// if ($tmins2end >= $tmins1start && $tmins2end <= $tmins1end)
+// return true;
+// return false;
+// }
+//
+// $phpgw->db->lock(array('webcal_entry','webcal_entry_user','webcal_entry_groups',
+// 'webcal_entry_repeats'));
+//
+// // first check for any schedule conflicts
+// if (strlen($hour) > 0) {
+// $date = mktime(0,0,0,$month,$day,$year);
+// if ($phpgw_info["user"]["preferences"]["common"]["timeformat"] == "12") {
+// $hour %= 12;
+// if ($ampm == "pm")
+// $hour += 12;
+// }
+//
+// $sql = "SELECT webcal_entry_user.cal_login, webcal_entry.cal_time," .
+// "webcal_entry.cal_duration, webcal_entry.cal_name, " .
+// "webcal_entry.cal_id, webcal_entry.cal_access " .
+// "FROM webcal_entry, webcal_entry_user " .
+// "WHERE webcal_entry.cal_id = webcal_entry_user.cal_id " .
+// "AND webcal_entry.cal_date = " . date("Ymd", $date) . " AND ( ";
+//
+// for ($i = 0; $i < count($participants); $i++) {
+// if ($i) $sql .= " OR ";
+// $sql .= " webcal_entry_user.cal_login = '" . $participants[$i] . "'";
+// }
+// $sql .= " )";
+//
+// $phpgw->db->query($sql);
+// $time1 = sprintf("%d:%02d", $hour, $minute);
+// $duration1 = sprintf("%d", $duration);
+//
+// while ($phpgw->db->next_record()) {
+// // see if either event overlaps one another
+// if ($phpgw->db->f(4) != $id) {
+// $time2 = $phpgw->db->f(1);
+// $duration2 = $phpgw->db->f(2);
+// if (times_overlap($time1, $duration1, $time2, $duration2)) {
+// $overlap .= "";
+// if ($phpgw->db->f(5) == 'R' && $phpgw->db->f(0) != $login)
+// $overlap .= "(PRIVATE)";
+// else {
+// $overlap .= "link("view.php",
+// "id=".$phpgw->db->f(4))."\">"
+// . $phpgw->db->f(3) . "";
+// }
+// $overlap .= " (" . display_time($time2);
+// if ($duration2 > 0)
+// $overlap .= "-" . display_time(add_duration($time2,$duration2))
+// . ")";
+// }
+// }
+// }
+// }
+//
+//if ($overlap)
+// $error = lang("The following conflicts with the suggested time:",
+// $overlap);
+//
+//if (! $error) {
+// // now add the entries
+//
+// if ($id != 0) {
+// $phpgw->db->query("DELETE FROM webcal_entry WHERE cal_id = $id");
+// $phpgw->db->query("DELETE FROM webcal_entry_user WHERE cal_id = $id");
+// $phpgw->db->query("DELETE FROM webcal_entry_repeats WHERE cal_id = $id");
+// $phpgw->db->query("DELETE FROM webcal_entry_groups WHERE cal_id = $id");
+// }
+//
+// $sql = "INSERT INTO webcal_entry (cal_owner, cal_date, " .
+// "cal_time, cal_mod_date, cal_mod_time, cal_duration, cal_priority, " .
+// "cal_access, cal_type, cal_name, cal_description ) " .
+// "VALUES ('" . $phpgw_info["user"]["account_id"] . "', ";
+//
+// $date = mktime(0,0,0,$month,$day,$year);
+// $sql .= date("Ymd", $date) . ", ";
+// if (strlen($hour) > 0) {
+// if ($phpgw_info["user"]["preferences"]["common"]["timeformat"] == "12") {
+// $hour %= 12;
+// if ($ampm == "pm")
+// $hour += 12;
+// }
+// $sql .= sprintf("%02d%02d00, ",$hour,$minute);
+// } else
+// $sql .= "'-1', ";
+//
+// $sql .= date("Ymd") . ", " . date("Gis") . ", ";
+// $sql .= sprintf("%d, ",$duration);
+// $sql .= sprintf("%d, ",$priority);
+// $sql .= "'$access', ";
+//
+// if ($rpt_type != 'none')
+// $sql .= "'M', ";
+// else
+// $sql .= "'E', ";
+//
+// if (strlen($name) == 0)
+// $name = "Unnamed Event";
+//
+// $sql .= "'" . addslashes($name) . "', ";
+// if (! $description)
+// $sql .= "'" . addslashes($name) . "')";
+// else
+// $sql .= "'" . addslashes($description) . "' )";
+//
+// $error = "";
+// $phpgw->db->query($sql);
+//
+// $phpgw->db->query("SELECT MAX(cal_id) FROM webcal_entry");
+// $phpgw->db->next_record();
+// $id = $phpgw->db->f(0);
+//
+// while ($participant = each($participants)) {
+// $phpgw->db->query("INSERT INTO webcal_entry_user (cal_id,cal_login,cal_status ) "
+// . "VALUES ($id, '" . $participant[1] . "', 'A')");
+// }
+//
+// if (strlen($rpt_type) || ! strcmp($rpt_type,'none') == 0) {
+// // clearly, we want to delete the old repeats, before inserting new...
+// $phpgw->db->query("delete from webcal_entry_repeats where cal_id='$id'");
+// $freq = ($rpt_freq?$rpt_freq:1);
+//
+// if ($rpt_end_use) {
+// $end = "'" . date("Ymd",mktime(0,0,0,$rpt_month,$rpt_day,$rpt_year))
+// . "'";
+// } else
+// $end = 0;
+//
+// if ($rpt_type == 'weekly') {
+// $days = ($rpt_sun?'y':'n')
+// . ($rpt_mon?'y':'n')
+// . ($rpt_tue?'y':'n')
+// . ($rpt_wed?'y':'n')
+// . ($rpt_thu?'y':'n')
+// . ($rpt_fri?'y':'n')
+// . ($rpt_sat?'y':'n');
+// } else {
+// $days = "nnnnnnn";
+// }
+//
+// $phpgw->db->query("insert into webcal_entry_repeats (cal_id,cal_type,"
+// . "cal_end,cal_days,cal_frequency) values($id,'$rpt_type',"
+// . "$end,'$days',$freq)");
+// }
+// $phpgw->db->query("insert into webcal_entry_groups values ($id,'"
+// . $phpgw->accounts->array_to_string($access,$n_groups) . "') ");
+//
+//
Header("Location: ".$phpgw->link("index.php","year=$year&month=$month&cd=14"));
-}
-$phpgw->common->phpgw_header();
+$phpgw->common->phpgw_footer();
?>
-
-Scheduling Conflict
- x - x conflicts with the following existing calendar entries:", display_time($time),display_time(add_duration($time,$duration))); ?>
-?>
-
-
-
-
-Error
-
-
-
-
-db->unlock();
- $phpgw->common->phpgw_footer();
-?>
diff --git a/calendar/templates/default/edit.tpl b/calendar/templates/default/edit.tpl
index a68a0bb93a..6b617c0ad1 100755
--- a/calendar/templates/default/edit.tpl
+++ b/calendar/templates/default/edit.tpl
@@ -32,13 +32,8 @@ function validate_and_submit() {
-
-
-
+
+
{delete_button}
diff --git a/calendar/templates/default/form_button_script.tpl b/calendar/templates/default/form_button_script.tpl
index 4d78330454..8bcb0ea363 100755
--- a/calendar/templates/default/form_button_script.tpl
+++ b/calendar/templates/default/form_button_script.tpl
@@ -1,6 +1,6 @@
-
diff --git a/calendar/view.php b/calendar/view.php
index 2722656941..c5e2b36b42 100755
--- a/calendar/view.php
+++ b/calendar/view.php
@@ -53,7 +53,7 @@
$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_text",$phpgw_info["theme"]["bg_text"]);
$phpgw->template->set_var("name",$cal_info->name);
$phpgw->template->parse("out","view_begin");
@@ -156,14 +156,14 @@
}
if ($is_my_event) {
- $phpgw->template->set_var("action_url",$phpgw->link("edit_entry.php","id=$id"));
- $phpgw->template->set_var("action_text"," ".lang("Edit")." ");
- $phpgw->template->set_var("action_confirm","");
+ $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",$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->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");
// $phpgw->template->set_var("edit","link("edit_entry.php","id=$id")."\">".lang("Edit")."");