blob: a6f4ebd76f171c50f1f17ec0d888a55c7ce87b6a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
<?php require_once "../../../../resources/private/relative.php"; getRelativeDetails("cms-special"); ?>
<?php $pageConfig = [ "domName" => "Supprimer un événement - Calendrier", "headerName" => "Supprimer un événement" ]; include_once $_SERVER['DOCUMENT_ROOT'] . "/cms-special/admin/\$resources/precontent.php"; ?>
<?php
$eventsraw = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/caldb.json");
if (isset($_GET['id'])) {} else {
require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("<script>location.href = '" . $GLOBALS['SYSTEM_ROOT'] . "/cms-special/admin/calendar';</script>");
}
if (isJson($eventsraw)) {
$events = json_decode($eventsraw);
foreach ($events->events as $element) {
if (isset($element->timestamp)) {
if ($element->timestamp == $_GET['id']) {
$event = $element;
}
}
}
} else {
require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("<script>location.href = '" . $GLOBALS['SYSTEM_ROOT'] . "/cms-special/admin/calendar';</script>");
}
if (!isset($event)) {
require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("<script>location.href = '" . $GLOBALS['SYSTEM_ROOT'] . "/cms-special/admin/calendar';</script>");
}
?>
<h3><?= $lang["admin-calendar"]["info"] ?></h3>
<ul>
<li><b><?= $event->name ?></b></li>
<?php
if (trim($event->description) != "") {
echo("<li><i>" . $event->description . "</i></li>");
}
if (isset($event->link)) {
if (trim($event->link) != "") {
echo("<li><i>" . $event->link . "</i></li>");
}
}
?>
<li><?= $event->datestr ?> (<code><?= $event->timestamp ?></code>)</li>
</ul>
<h3><?= $lang["admin-calendar"]["deleteask"] ?></h3>
<ul id="delete">
<li><a class="sblink" href="<?= $GLOBALS["SYSTEM_ROOT"] ?>/cms-special/admin/calendar" title="<?= $lang["admin-calendar"]["deletenoph"] ?>"><?= $lang["admin-calendar"]["deleteno"] ?></a></li>
<li><a class="sblink" onclick="deleteEvent()" title="<?= $lang["admin-calendar"]["deleteyesph"] ?>"><?= $lang["admin-calendar"]["deleteyes"] ?></a></li>
</ul>
<?php include_once $_SERVER['DOCUMENT_ROOT'] . "/cms-special/admin/\$resources/postcontent.php"; ?>
<script>
function deleteEvent() {
document.getElementById('delete').classList.add('hide')
var formData = new FormData();
formData.append("id", <?= $event->timestamp ?>);
$.ajax({
type: "POST",
dataType: 'html',
url: "<?= $GLOBALS["SYSTEM_ROOT"] ?>/api/admin/calendar_delete.php",
success: function (data) {
if (data == "ok") {
location.href = "<?= $GLOBALS["SYSTEM_ROOT"] ?>/cms-special/admin/calendar";
} else {
alert("<?= $lang["admin-errors"]["errorprefix"] ?>" + data)
document.getElementById('delete').classList.remove('hide')
}
},
error: function (error) {
alert("<?= $lang["admin-errors"]["connerror"] ?>")
document.getElementById('delete').classList.remove('hide')
},
data: formData,
cache: false,
contentType: false,
processData: false
});
}
</script>
|