Pārlūkot izejas kodu

Fixing deletion of events from calendar theme

pull/129/head
Benjamin Southall pirms 6 gadiem
vecāks
revīzija
7b9bad7382
2 mainītis faili ar 8 papildinājumiem un 3 dzēšanām
  1. +3
    -2
      templates/themes/calendar/calendar.html
  2. +5
    -1
      templates/themes/calendar/calendarpost.php

+ 3
- 2
templates/themes/calendar/calendar.html Parādīt failu

@@ -130,7 +130,7 @@
} }
$.ajax({ $.ajax({
url: 'calendarpost.php', url: 'calendarpost.php',
data: 'type=update&title='+ event.title+'&description='+ event.description + '&start='+ start +'&end='+ end +'&id='+ event.id ,
data: 'type=update&title='+ event.title+'&description='+ event.description + '&start='+ start +'&end='+ end +'&id='+ event.id +'&color=' + event.color +'&url=' + event.url ,
type: "POST", type: "POST",
success: function(json) { success: function(json) {
alert("Updated Successfully"); alert("Updated Successfully");
@@ -148,6 +148,7 @@
$('#calendar').fullCalendar('removeEvents', event.id); $('#calendar').fullCalendar('removeEvents', event.id);
alert("Updated Successfully");} alert("Updated Successfully");}
}); });
return false;


} }
}, },
@@ -172,7 +173,7 @@
} }
$.ajax({ $.ajax({
url: 'calendarpost.php', url: 'calendarpost.php',
data: 'type=update&title='+ event.title+ '&description='+ event.description + '&start='+ start +'&end='+ end +'&id='+ event.id ,
data: 'type=update&title='+ event.title+'&description='+ event.description + '&start='+ start +'&end='+ end +'&id='+ event.id +'&color=' + event.color +'&url=' + event.url ,
type: "POST", type: "POST",
success: function(json) { success: function(json) {
alert("Updated Successfully"); alert("Updated Successfully");


+ 5
- 1
templates/themes/calendar/calendarpost.php Parādīt failu

@@ -24,7 +24,9 @@ $method = $_SERVER['REQUEST_METHOD'];
break; break;
case "delete": case "delete":
$id = $_POST['id']; $id = $_POST['id'];
$query = query("DELETE from calendar_events WHERE id = :id") or error(db_error());
$query = prepare("DELETE from calendar_events WHERE id = :id");
$query->bindValue(':id', $id);
$query->execute() or error(db_error($query));
break; break;
case "update": case "update":
$id = $_POST['id']; $id = $_POST['id'];
@@ -32,6 +34,8 @@ $method = $_SERVER['REQUEST_METHOD'];
$description = $_POST['description']; $description = $_POST['description'];
$start = $_POST['start']; $start = $_POST['start'];
$end = $_POST['end']; $end = $_POST['end'];
$color = $_POST['color'];
$url = $_POST['url'];
$query = prepare(" UPDATE calendar_events SET title = :title, description = :description, start = :start, end = :end, url = :url, color =:color WHERE id = :id"); $query = prepare(" UPDATE calendar_events SET title = :title, description = :description, start = :start, end = :end, url = :url, color =:color WHERE id = :id");
$query->bindValue(':id', $id); $query->bindValue(':id', $id);
$query->bindValue(':title', $title); $query->bindValue(':title', $title);


Notiek ielāde…
Atcelt
Saglabāt