diff --git a/calendar/edit_entry.php b/calendar/edit_entry.php index f6489854af..1f80bfdc98 100755 --- a/calendar/edit_entry.php +++ b/calendar/edit_entry.php @@ -21,18 +21,21 @@ $cal_info = new calendar_item; 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_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 { + $can_edit = true; if (!isset($day) || !$day) $thisday = (int)$phpgw->calendar->today["day"]; @@ -76,297 +79,230 @@ $cal_info["hour"] = $cal_info["hour"] - 12; $cal_info["ampm"] = "pm"; } - $can_edit = true; } -?> - - -
+ $phpgw->template->set_file(array("edit_entry_begin" => "edit.tpl", + "list" => "list.tpl", + "edit_entry_end" => "edit.tpl", + "form_button" => "form_button_script.tpl")); --{edit} {delete} +{edit_button} {delete_button} diff --git a/calendar/view.php b/calendar/view.php index 5a1fb81207..2722656941 100755 --- a/calendar/view.php +++ b/calendar/view.php @@ -48,9 +48,10 @@ $phpgw->template->set_file(array("view_begin" => "view.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("name",$cal_info->name); @@ -155,11 +156,21 @@ } if ($is_my_event) { - $phpgw->template->set_var("edit","link("edit_entry.php","id=$id")."\">".lang("Edit").""); - $phpgw->template->set_var("delete","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").""); + $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->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","link("edit_entry.php","id=$id")."\">".lang("Edit").""); +// $phpgw->template->set_var("delete","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").""); } else { - $phpgw->template->set_var("edit",""); - $phpgw->template->set_var("delete",""); + $phpgw->template->set_var("edit_button",""); + $phpgw->template->set_var("delete_button",""); } $phpgw->template->pparse("out","view_end"); $phpgw->common->phpgw_footer();