aboutsummaryrefslogtreecommitdiff
path: root/Neutron-trunk/cms-special/admin/calendar/add/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'Neutron-trunk/cms-special/admin/calendar/add/index.php')
-rw-r--r--Neutron-trunk/cms-special/admin/calendar/add/index.php140
1 files changed, 140 insertions, 0 deletions
diff --git a/Neutron-trunk/cms-special/admin/calendar/add/index.php b/Neutron-trunk/cms-special/admin/calendar/add/index.php
new file mode 100644
index 0000000..1029788
--- /dev/null
+++ b/Neutron-trunk/cms-special/admin/calendar/add/index.php
@@ -0,0 +1,140 @@
+<?php require_once "../../../../resources/private/relative.php"; getRelativeDetails("cms-special"); ?>
+<?php $pageConfig = [ "domName" => "Ajouter un événement - Calendrier", "headerName" => "Ajouter un événement" ]; require_once $_SERVER['DOCUMENT_ROOT'] . "/cms-special/admin/\$resources/precontent.php"; ?>
+ <div id="datainput">
+ <h3><?= $lang["admin-calendar"]["create"]["date"] ?></h3>
+ <ul>
+ <li><?= $lang["admin-calendar"]["create"]["day"] ?> </li>
+ <select id="day">
+ <option value="01" <?php if ("01" == date('d')) {echo("selected");} ?>>1er</option>
+ <option value="02" <?php if ("02" == date('d')) {echo("selected");} ?>>2</option>
+ <option value="03" <?php if ("03" == date('d')) {echo("selected");} ?>>3</option>
+ <option value="04" <?php if ("04" == date('d')) {echo("selected");} ?>>4</option>
+ <option value="05" <?php if ("05" == date('d')) {echo("selected");} ?>>5</option>
+ <option value="06" <?php if ("06" == date('d')) {echo("selected");} ?>>6</option>
+ <option value="07" <?php if ("07" == date('d')) {echo("selected");} ?>>7</option>
+ <option value="08" <?php if ("08" == date('d')) {echo("selected");} ?>>8</option>
+ <option value="09" <?php if ("09" == date('d')) {echo("selected");} ?>>9</option>
+ <option value="10" <?php if ("10" == date('d')) {echo("selected");} ?>>10</option>
+ <option value="11" <?php if ("11" == date('d')) {echo("selected");} ?>>11</option>
+ <option value="12" <?php if ("12" == date('d')) {echo("selected");} ?>>12</option>
+ <option value="13" <?php if ("13" == date('d')) {echo("selected");} ?>>13</option>
+ <option value="14" <?php if ("14" == date('d')) {echo("selected");} ?>>14</option>
+ <option value="15" <?php if ("15" == date('d')) {echo("selected");} ?>>15</option>
+ <option value="16" <?php if ("16" == date('d')) {echo("selected");} ?>>16</option>
+ <option value="17" <?php if ("17" == date('d')) {echo("selected");} ?>>17</option>
+ <option value="18" <?php if ("18" == date('d')) {echo("selected");} ?>>18</option>
+ <option value="19" <?php if ("19" == date('d')) {echo("selected");} ?>>19</option>
+ <option value="20" <?php if ("20" == date('d')) {echo("selected");} ?>>20</option>
+ <option value="21" <?php if ("21" == date('d')) {echo("selected");} ?>>21</option>
+ <option value="22" <?php if ("22" == date('d')) {echo("selected");} ?>>22</option>
+ <option value="23" <?php if ("23" == date('d')) {echo("selected");} ?>>23</option>
+ <option value="24" <?php if ("24" == date('d')) {echo("selected");} ?>>24</option>
+ <option value="25" <?php if ("25" == date('d')) {echo("selected");} ?>>25</option>
+ <option value="26" <?php if ("26" == date('d')) {echo("selected");} ?>>26</option>
+ <option value="27" <?php if ("27" == date('d')) {echo("selected");} ?>>27</option>
+ <option value="28" <?php if ("28" == date('d')) {echo("selected");} ?>>28</option>
+ <option value="29" <?php if ("29" == date('d')) {echo("selected");} ?>>29</option>
+ <option value="30" <?php if ("30" == date('d')) {echo("selected");} ?>>30</option>
+ <option value="31" <?php if ("31" == date('d')) {echo("selected");} ?>>31</option>
+ </select><br><br>
+ <li><?= $lang["admin-calendar"]["create"]["month"] ?> </li>
+ <select id="month">
+ <option disabled><?= $lang["admin-calendar"]["create"]["trimesters"][0] ?></option>
+ <option value="1" <?php if ("01" == date('m')) {echo("selected");} ?>><?= $lang["admin-calendar"]["create"]["months"][0] ?></option>
+ <option value="2" <?php if ("02" == date('m')) {echo("selected");} ?>><?= $lang["admin-calendar"]["create"]["months"][1] ?></option>
+ <option value="3" <?php if ("03" == date('m')) {echo("selected");} ?>><?= $lang["admin-calendar"]["create"]["months"][2] ?></option>
+ <option disabled><?= $lang["admin-calendar"]["create"]["trimesters"][1] ?></option>
+ <option value="4" <?php if ("04" == date('m')) {echo("selected");} ?>><?= $lang["admin-calendar"]["create"]["months"][3] ?></option>
+ <option value="5" <?php if ("05" == date('m')) {echo("selected");} ?>><?= $lang["admin-calendar"]["create"]["months"][4] ?></option>
+ <option value="6" <?php if ("06" == date('m')) {echo("selected");} ?>><?= $lang["admin-calendar"]["create"]["months"][5] ?></option>
+ <option disabled><?= $lang["admin-calendar"]["create"]["trimesters"][2] ?></option>
+ <option value="7" <?php if ("07" == date('m')) {echo("selected");} ?>><?= $lang["admin-calendar"]["create"]["months"][6] ?></option>
+ <option value="8" <?php if ("08" == date('m')) {echo("selected");} ?>><?= $lang["admin-calendar"]["create"]["months"][7] ?></option>
+ <option value="9" <?php if ("09" == date('m')) {echo("selected");} ?>><?= $lang["admin-calendar"]["create"]["months"][8] ?></option>
+ <option disabled><?= $lang["admin-calendar"]["create"]["trimesters"][3] ?></option>
+ <option value="10" <?php if ("10" == date('m')) {echo("selected");} ?>><?= $lang["admin-calendar"]["create"]["months"][9] ?></option>
+ <option value="11" <?php if ("11" == date('m')) {echo("selected");} ?>><?= $lang["admin-calendar"]["create"]["months"][10] ?></option>
+ <option value="12" <?php if ("12" == date('m')) {echo("selected");} ?>><?= $lang["admin-calendar"]["create"]["months"][11] ?></option>
+ </select><br><br>
+ <li><?= $lang["admin-calendar"]["create"]["year"] ?></li>
+ <select id="year">
+ <option value="<?= date('Y') ?>" selected><?= date('Y') ?></option>
+ <option value="<?= date('Y') + 1 ?>"><?= date('Y') + 1 ?></option>
+ <option value="<?= date('Y') + 2 ?>"><?= date('Y') + 2 ?></option>
+ <option value="<?= date('Y') + 3 ?>"><?= date('Y') + 3 ?></option>
+ <option value="<?= date('Y') + 4 ?>"><?= date('Y') + 4 ?></option>
+ <option value="<?= date('Y') + 5 ?>"><?= date('Y') + 5 ?></option>
+ </select>
+ </ul>
+ <h3><?= $lang["admin-calendar"]["create"]["info"] ?></h3>
+ <ul>
+ <li><?= $lang["admin-calendar"]["create"]["name"] ?></li>
+ <input type="text" placeholder="<?= $lang["admin-calendar"]["create"]["nameph"] ?>" id="name"><br><br>
+ <li><?= $lang["admin-calendar"]["create"]["desc"] ?> <i>(<?= $lang["admin-calendar"]["create"]["mandatory"] ?>)</i></li>
+ <input type="text" placeholder="<?= $lang["admin-calendar"]["create"]["web"] ?>" id="desc"><br><br>
+ <li><?= $lang["admin-calendar"]["create"]["web"] ?> <i>(<?= $lang["admin-calendar"]["create"]["mandatory"] ?>)</i> :</li>
+ <input onchange="validateUrl()" onkeyup="validateUrl()" onkeydown="validateUrl()" type="text" placeholder="<?= $lang["admin-calendar"]["create"]["webph"] ?>" id="link"><img id="link_check" src="<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/image/storeloader.svg" style="vertical-align:middle;" class="hide" width="24px" height="24px"><a class="hide" id="link_invalid"><img src="<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/image/close.svg" style="vertical-align:middle;" class="invert" width="24px" height="24px"></a>
+ </ul>
+ <p><table class="message_info"><tbody><tr><td><img src="<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/image/message_info.svg" class="message_img"></td><td style="width:100%;"><p><?= $lang["admin-calendar"]["create"]["notice"] ?></p></td></tr></tbody></table></p>
+ <div style="text-align: center;"><p><a class="button" onclick="createCmsEvent()"><?= $lang["admin-calendar"]["create"]["complete"] ?></a></p></div><br>
+ </div>
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/cms-special/admin/\$resources/postcontent.php"; ?>
+
+<script>
+
+function UrlRegex(str) {
+ var pattern = new RegExp('^(https?:\\/\\/)?'+ // protocol
+ '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|'+ // domain name
+ '((\\d{1,3}\\.){3}\\d{1,3}))'+ // OR ip (v4) address
+ '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // port and path
+ '(\\?[;&a-z\\d%_.~+=-]*)?'+ // query string
+ '(\\#[-a-z\\d_]*)?$','i'); // fragment locator
+ return !!pattern.test(str);
+}
+
+function validateUrl() {
+ document.getElementById('link_invalid').classList.add('hide');
+ document.getElementById('link_check').classList.remove('hide');
+ setTimeout(() => {
+ if (!UrlRegex(document.getElementById('link').value)) {
+ document.getElementById('link_invalid').classList.remove('hide');
+ } else {
+ document.getElementById('link_invalid').classList.add('hide');
+ }
+ document.getElementById('link_check').classList.add('hide');
+ }, 2000)
+}
+
+function createCmsEvent() {
+ document.getElementById('datainput').classList.add('hide')
+ var formData = new FormData();
+ formData.append("day", document.getElementById('day').value);
+ formData.append("month", document.getElementById('month').value);
+ formData.append("year", document.getElementById('year').value);
+ formData.append("name", document.getElementById('name').value);
+ formData.append("desc", document.getElementById('desc').value);
+ formData.append("link", document.getElementById('link').value);
+ $.ajax({
+ type: "POST",
+ dataType: 'html',
+ url: "<?= $GLOBALS["SYSTEM_ROOT"] ?>/api/admin/calendar_create.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('datainput').classList.remove('hide')
+ }
+ },
+ error: function (error) {
+ alert("<?= $lang["admin-errors"]["connerror"] ?>")
+ document.getElementById('datainput').classList.remove('hide')
+ },
+ data: formData,
+ cache: false,
+ contentType: false,
+ processData: false
+ });
+}
+
+</script> \ No newline at end of file