aboutsummaryrefslogtreecommitdiff
path: root/Neutron-trunk/cms-special/admin-v2/pages
diff options
context:
space:
mode:
authorMinteck <nekostarfan@gmail.com>2021-08-24 15:38:16 +0200
committerMinteck <nekostarfan@gmail.com>2021-08-24 15:38:16 +0200
commit529ffcbfa97ab51a64a97f6dff08aeb2bc0cc105 (patch)
tree8a50c30271b9b328cde0d907b1441f2dabdc341b /Neutron-trunk/cms-special/admin-v2/pages
parent15e4724761c50b30803df1811a525c85058f70bf (diff)
downloadelectrode-529ffcbfa97ab51a64a97f6dff08aeb2bc0cc105.tar.gz
electrode-529ffcbfa97ab51a64a97f6dff08aeb2bc0cc105.tar.bz2
electrode-529ffcbfa97ab51a64a97f6dff08aeb2bc0cc105.zip
Update
Diffstat (limited to 'Neutron-trunk/cms-special/admin-v2/pages')
-rw-r--r--Neutron-trunk/cms-special/admin-v2/pages/add/index.php145
-rw-r--r--Neutron-trunk/cms-special/admin-v2/pages/delete/index.php88
-rw-r--r--Neutron-trunk/cms-special/admin-v2/pages/edit/index.php194
-rw-r--r--Neutron-trunk/cms-special/admin-v2/pages/index.php66
-rw-r--r--Neutron-trunk/cms-special/admin-v2/pages/rename/index.php89
5 files changed, 582 insertions, 0 deletions
diff --git a/Neutron-trunk/cms-special/admin-v2/pages/add/index.php b/Neutron-trunk/cms-special/admin-v2/pages/add/index.php
new file mode 100644
index 0000000..54dacdb
--- /dev/null
+++ b/Neutron-trunk/cms-special/admin-v2/pages/add/index.php
@@ -0,0 +1,145 @@
+<?php require_once "../../../../resources/private/relative.php"; getRelativeDetails("cms-special"); ?>
+<?php $pageConfig = [ "domName" => "Nouvelle page - Pages", "headerName" => "Nouvelle page" ]; require_once $_SERVER['DOCUMENT_ROOT'] . "/cms-special/admin/\$resources/precontent.php"; ?>
+ <p>
+ <form name="settings">
+ <div class="nd_Field nd_Field_input nd_Field__centered" id="namebox">
+ <input id="name" name="name" type="text" placeholder="<?= $lang["admin-pages"]["pagename"] ?>" spellcheck="false" autocomplete="off">
+ <label for="name"><?= $lang["admin-pages"]["pagename"] ?></label>
+ </div><br>
+ <input style="display:none;" type="radio" id="type-visual" value="visual" onchange="switchEditor()" name="type" checked>
+ <input style="display:none;" type="radio" id="type-html" onchange="switchEditor()" value="html" name="type">
+ <div style="text-align: center;"><div id="ptype-visual" class="mdc-card mdc-card--outlined mdc-card--selected" onclick="document.getElementsByName('type')[0].value = 'visual';switchEditor();" style="width:256px;margin:10px;display:inline-block;">
+ <div class="mdc-card__primary-action" tabindex="0" style="padding:0;">
+ <div class="mdc-card-wrapper__text-section" style="padding-left:5px;padding-right:5px;">
+ <h2 style="margin-bottom:5px;" class="mdc-typography mdc-typography--headline6"><?= $lang["admin-pages"]["editors"][0] ?></h2>
+ <h3 style="margin-top:5px;" class="mdc-typography mdc-typography--subtitle2"><?= $lang["admin-pages"]["editordescs"][0] ?></h3>
+ </div>
+ </div>
+ </div>
+ <div id="ptype-html" class="mdc-card mdc-card--outlined" onclick="document.getElementsByName('type')[0].value = 'html';switchEditor();" style="width:256px;margin:10px;display:inline-block;">
+ <div class="mdc-card__primary-action" tabindex="0" style="padding:0;">
+ <div class="mdc-card-wrapper__text-section" style="padding-left:5px;padding-right:5px;">
+ <h2 style="margin-bottom:5px;" class="mdc-typography mdc-typography--headline6"><?= $lang["admin-pages"]["editors"][1] ?></h2>
+ <h3 style="margin-top:5px;" class="mdc-typography mdc-typography--subtitle2"><?= $lang["admin-pages"]["editordescs"][1] ?></h3>
+ </div>
+ </div>
+ </div></div>
+ </form>
+ </p>
+ <div id="editing"><div id="editor-visual">
+ <?php
+ require_once $_SERVER['DOCUMENT_ROOT'] . "/resources/private/VisualEditor$2.php";
+ ?></div>
+ <div id="editor-html" class="hide">
+ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/resources/private/CodeEditor$2.php" ?>
+ </div>
+ </div>
+ <div class="hide" id="loader" style="text-align: center;"><img src="<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/image/loader.svg" class="loader"></div>
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/cms-special/admin/\$resources/postcontent.php"; ?>
+
+<script>
+ window.onbeforeunload = function (e) {
+ e = e || window.event;
+
+ // For IE and Firefox prior to version 4
+ if (e) {
+ e.returnValue = "<?= $lang["admin-pages"]["quitwarn"] ?>";
+ }
+
+ // For Safari
+ return "<?= $lang["admin-pages"]["quitwarn"] ?>";
+ };
+</script>
+
+<script>
+
+function createPageVisual() {
+ Array.from(document.getElementsByTagName('input')).forEach((el) => {el.disabled = true})
+ document.getElementById('loader').classList.remove('hide')
+ document.getElementById('editing').classList.add('hide')
+ var formData = new FormData();
+ formData.append("title", document.getElementById('name').value);
+ formData.append("type", "0");
+ formData.append("content", editor.getData());
+ $.ajax({
+ type: "POST",
+ dataType: 'html',
+ url: "<?= $GLOBALS["SYSTEM_ROOT"] ?>/api/admin/create_page.php",
+ success: function (data) {
+ if (data == "ok") {
+ location.href = "<?= $GLOBALS["SYSTEM_ROOT"] ?>/cms-special/admin/pages";
+ } else {
+ alert("<?= $lang["admin-errors"]["errorprefix"] ?>" + data)
+ Array.from(document.getElementsByTagName('input')).forEach((el) => {el.disabled = false})
+ document.getElementById('loader').classList.add('hide')
+ document.getElementById('editing').classList.remove('hide')
+ }
+ },
+ error: function (error) {
+ alert("<?= $lang["admin-errors"]["connerror"] ?>")
+ document.getElementById('loader').classList.add('hide')
+ document.getElementById('editing').classList.remove('hide')
+ },
+ data: formData,
+ cache: false,
+ contentType: false,
+ processData: false
+ });
+}
+
+function createPageVisualNoBack() {
+ Array.from(document.getElementsByTagName('input')).forEach((el) => {el.disabled = true})
+ document.getElementById('loader').classList.remove('hide')
+ document.getElementById('editing').classList.add('hide')
+ var formData = new FormData();
+ formData.append("title", document.getElementById('name').value);
+ formData.append("type", "0");
+ formData.append("content", editor.getData());
+ $.ajax({
+ type: "POST",
+ dataType: 'html',
+ url: "<?= $GLOBALS["SYSTEM_ROOT"] ?>/api/admin/create_page.php",
+ success: function (data) {
+ if (data == "ok") {
+ alert("<?= $lang["admin-pages"]["saved"] ?>");
+ Array.from(document.getElementsByTagName('input')).forEach((el) => {el.disabled = false})
+ document.getElementById('loader').classList.add('hide')
+ document.getElementById('editing').classList.remove('hide')
+ } else {
+ alert("<?= $lang["admin-errors"]["errorprefix"] ?>" + data)
+ Array.from(document.getElementsByTagName('input')).forEach((el) => {el.disabled = false})
+ document.getElementById('loader').classList.add('hide')
+ document.getElementById('editing').classList.remove('hide')
+ }
+ },
+ error: function (error) {
+ alert("<?= $lang["admin-errors"]["connerror"] ?>")
+ document.getElementById('loader').classList.add('hide')
+ document.getElementById('editing').classList.remove('hide')
+ },
+ data: formData,
+ cache: false,
+ contentType: false,
+ processData: false
+ });
+}
+
+function switchEditor() {
+ if (document.forms['settings'].type.value == "visual") {
+ document.getElementById('editor-visual').classList.remove('hide')
+ document.getElementById('editor-html').classList.add('hide')
+ document.getElementById('ptype-html').classList.remove('mdc-card--selected');
+ document.getElementById('ptype-visual').classList.add('mdc-card--selected');
+ } else {
+ document.getElementById('editor-visual').classList.add('hide')
+ document.getElementById('editor-html').classList.remove('hide')
+ document.getElementById('ptype-visual').classList.remove('mdc-card--selected');
+ document.getElementById('ptype-html').classList.add('mdc-card--selected');
+ loadAce()
+ }
+ document.body.focus();
+}
+
+document.forms['settings'].type.value = "visual"
+
+</script> \ No newline at end of file
diff --git a/Neutron-trunk/cms-special/admin-v2/pages/delete/index.php b/Neutron-trunk/cms-special/admin-v2/pages/delete/index.php
new file mode 100644
index 0000000..4cbcb49
--- /dev/null
+++ b/Neutron-trunk/cms-special/admin-v2/pages/delete/index.php
@@ -0,0 +1,88 @@
+<?php require_once "../../../../resources/private/relative.php"; getRelativeDetails("cms-special"); ?>
+<?php
+
+if (isset($_GET['slug'])) {
+ $currentSlug = $_GET['slug'];
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pages/" . $currentSlug)) {} else {
+ header("Location: /cms-special/admin/pages");
+ require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit();
+ }
+} else {
+ header("Location: /cms-special/admin/pages");
+ require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit();
+}
+
+?>
+<?php $pageConfig = [ "domName" => "Pages", "headerName" => "Pages" ]; require_once $_SERVER['DOCUMENT_ROOT'] . "/cms-special/admin/\$resources/precontent.php"; ?>
+<?php
+
+if ($currentSlug == "index") {
+ $currentName = "{$lang["admin-pages"]["home"]}";
+ echo("<script>page = \"index\"</script>");
+} else {
+ $currentName = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/" . $currentSlug . "/pagename");
+ echo("<script>page = \"{$currentSlug}\"</script>");
+}
+
+?>
+ <div id="confirm">
+ <div style="text-align:center;">
+ <p><?= $lang["admin-pages"]["deletec"][0] . $currentName . $lang["admin-pages"]["deletec"][1] ?></p>
+ <?php
+
+ if ($currentSlug == "index") {
+ require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("<i>{$lang["admin-pages"]["deletec"][2]}</i></div></body></html>");
+ }
+
+ ?>
+ <!--<ul>
+ <li><a onclick="deletePage()" class="sblink" title="<?= $lang["admin-pages"]["deleteyl"] ?>"><?= $lang["admin-pages"]["deletey"] ?></a></li>
+ <li><a onclick="location.href='/cms-special/admin/pages/manage/?slug=<?= $currentSlug ?>'" class="sblink" title="<?= $lang["admin-pages"]["deletenl"] ?>"><?= $lang["admin-pages"]["deleten"] ?></a></li>
+ </ul>-->
+ <a title="<?= $lang["admin-pages"]["deletenl"] ?>" onclick="location.href='/cms-special/admin/pages';" class="mdc-button mdc-button--raised">
+ <div class="mdc-button__ripple"></div>
+ <span class="mdc-button__label"><?= $lang["admin-pages"]["deleten"] ?></span>
+ </a>
+ <a title="<?= $lang["admin-pages"]["deleteyl"] ?>" onclick="deletePage();" class="mdc-button mdc-button--outlined">
+ <div class="mdc-button__ripple"></div>
+ <span class="mdc-button__label"><?= $lang["admin-pages"]["deletey"] ?></span>
+ </a>
+ </div>
+ </div>
+ <div class="hide" id="loader" style="text-align: center;"><img src="<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/image/loader.svg" class="loader">
+ </div>
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/cms-special/admin/\$resources/postcontent.php"; ?>
+
+<script>
+
+function deletePage() {
+ document.getElementById('confirm').classList.add('hide')
+ document.getElementById('loader').classList.remove('hide')
+ var formData = new FormData();
+ formData.append("page", "<?= $currentSlug ?>");
+ $.ajax({
+ type: "POST",
+ dataType: 'html',
+ url: "<?= $GLOBALS["SYSTEM_ROOT"] ?>/api/admin/delete_page.php",
+ success: function (data) {
+ if (data == "ok") {
+ location.href = "<?= $GLOBALS["SYSTEM_ROOT"] ?>/cms-special/admin/pages";
+ } else {
+ alert("<?= $lang["admin-errors"]["errorprefix"] ?>" + data)
+ document.getElementById('loader').classList.add('hide')
+ document.getElementById('confirm').classList.remove('hide')
+ }
+ },
+ error: function (error) {
+ alert("<?= $lang["admin-errors"]["connerror"] ?>")
+ document.getElementById('loader').classList.add('hide')
+ document.getElementById('confirm').classList.remove('hide')
+ },
+ data: formData,
+ cache: false,
+ contentType: false,
+ processData: false
+ });
+}
+
+</script> \ No newline at end of file
diff --git a/Neutron-trunk/cms-special/admin-v2/pages/edit/index.php b/Neutron-trunk/cms-special/admin-v2/pages/edit/index.php
new file mode 100644
index 0000000..b198566
--- /dev/null
+++ b/Neutron-trunk/cms-special/admin-v2/pages/edit/index.php
@@ -0,0 +1,194 @@
+<?php require_once "../../../../resources/private/relative.php"; getRelativeDetails("cms-special"); ?>
+<?php
+
+if (isset($_GET['slug'])) {
+ $currentSlug = $_GET['slug'];
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pages/" . $currentSlug)) {} else {
+ header("Location: /cms-special/admin/pages");
+ require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit();
+ }
+} else {
+ header("Location: /cms-special/admin/pages");
+ require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit();
+}
+
+?>
+<?php $pageConfig = [ "domName" => "Pages", "headerName" => "Pages" ]; require_once $_SERVER['DOCUMENT_ROOT'] . "/cms-special/admin/\$resources/precontent.php"; ?>
+ <div id="editing">
+ <?php
+
+ if ($currentSlug == "index") {
+ $currentName = "{$lang["admin-pages"]["home"]}";
+ echo("<script>page = \"index\"</script>");
+ } else {
+ $currentName = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/" . $currentSlug . "/pagename");
+ echo("<script>page = \"{$currentSlug}\"</script>");
+ }
+
+ $type = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pagetypes/" . $currentSlug);
+ if (isset($_GET['forcehtml'])) {
+ $type = "1";
+ }
+ if ($type == "0") {
+ require_once $_SERVER['DOCUMENT_ROOT'] . "/resources/private/VisualEditor.php";
+ }
+ if ($type == "1"):
+
+ ?>
+ <p><table class="message_warning"><tbody><tr><td><img src="<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/image/message_warning.svg" class="message_img"></td><td style="width:100%;"><p><?= $lang["admin-pages"]["htmlw"][0] ?></p><p><?= $lang["admin-pages"]["htmlw"][1] ?></p></td></tr></tbody></table></p>
+ <?php
+
+ require_once $_SERVER['DOCUMENT_ROOT'] . "/resources/private/CodeEditor.php";
+ endif;
+
+ ?>
+ </div>
+ <div class="hide" id="loader" style="text-align: center;"><img src="<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/image/loader.svg" class="loader"></div>
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/cms-special/admin/\$resources/postcontent.php"; ?>
+
+<script>
+ window.onbeforeunload = function (e) {
+ e = e || window.event;
+
+ // For IE and Firefox prior to version 4
+ if (e) {
+ e.returnValue = "<?= $lang["admin-pages"]["quitwarn"] ?>";
+ }
+
+ // For Safari
+ return "<?= $lang["admin-pages"]["quitwarn"] ?>";
+ };
+</script>
+
+<script>
+
+function updatePage() {
+ document.getElementById('loader').classList.remove('hide')
+ document.getElementById('editing').classList.add('hide')
+ var formData = new FormData();
+ formData.append("title", "<?= $currentSlug ?>");
+ formData.append("content", editor.getData());
+ $.ajax({
+ type: "POST",
+ dataType: 'html',
+ url: "<?= $GLOBALS["SYSTEM_ROOT"] ?>/api/admin/edit_page.php",
+ success: function (data) {
+ if (data == "ok") {
+ window.onbeforeunload = null;
+ location.href = "<?= $GLOBALS["SYSTEM_ROOT"] ?>/cms-special/admin/pages";
+ } else {
+ alert("<?= $lang["admin-errors"]["errorprefix"] ?>" + data)
+ document.getElementById('loader').classList.add('hide')
+ document.getElementById('editing').classList.remove('hide')
+ }
+ },
+ error: function (error) {
+ alert("<?= $lang["admin-errors"]["connerror"] ?>")
+ document.getElementById('loader').classList.add('hide')
+ document.getElementById('editing').classList.remove('hide')
+ },
+ data: formData,
+ cache: false,
+ contentType: false,
+ processData: false
+ });
+}
+
+function updatePageNoBack() {
+ document.getElementById('loader').classList.remove('hide')
+ document.getElementById('editing').classList.add('hide')
+ var formData = new FormData();
+ formData.append("title", "<?= $currentSlug ?>");
+ formData.append("content", editor.getData());
+ $.ajax({
+ type: "POST",
+ dataType: 'html',
+ url: "<?= $GLOBALS["SYSTEM_ROOT"] ?>/api/admin/edit_page.php",
+ success: function (data) {
+ if (data == "ok") {
+ alert("<?= $lang["admin-pages"]["saved"] ?>");
+ document.getElementById('loader').classList.add('hide')
+ document.getElementById('editing').classList.remove('hide')
+ } else {
+ alert("<?= $lang["admin-errors"]["errorprefix"] ?>" + data)
+ document.getElementById('loader').classList.add('hide')
+ document.getElementById('editing').classList.remove('hide')
+ }
+ },
+ error: function (error) {
+ alert("<?= $lang["admin-errors"]["connerror"] ?>")
+ document.getElementById('loader').classList.add('hide')
+ document.getElementById('editing').classList.remove('hide')
+ },
+ data: formData,
+ cache: false,
+ contentType: false,
+ processData: false
+ });
+}
+
+function updatePageHTMLNoBack() {
+ document.getElementById('loader').classList.remove('hide')
+ document.getElementById('editing').classList.add('hide')
+ var formData = new FormData();
+ formData.append("title", "<?= $currentSlug ?>");
+ formData.append("content", ace.edit("editor").getValue());
+ $.ajax({
+ type: "POST",
+ dataType: 'html',
+ url: "<?= $GLOBALS["SYSTEM_ROOT"] ?>/api/admin/edit_page.php",
+ success: function (data) {
+ if (data == "ok") {
+ alert("<?= $lang["admin-pages"]["saved"] ?>");
+ document.getElementById('loader').classList.add('hide')
+ document.getElementById('editing').classList.remove('hide')
+ } else {
+ alert("<?= $lang["admin-errors"]["errorprefix"] ?>" + data)
+ document.getElementById('loader').classList.add('hide')
+ document.getElementById('editing').classList.remove('hide')
+ }
+ },
+ error: function (error) {
+ alert("<?= $lang["admin-errors"]["connerror"] ?>")
+ document.getElementById('loader').classList.add('hide')
+ document.getElementById('editing').classList.remove('hide')
+ },
+ data: formData,
+ cache: false,
+ contentType: false,
+ processData: false
+ });
+}
+
+function updatePageHTML() {
+ document.getElementById('loader').classList.remove('hide')
+ document.getElementById('editing').classList.add('hide')
+ var formData = new FormData();
+ formData.append("title", "<?= $currentSlug ?>");
+ formData.append("content", ace.edit("editor").getValue());
+ $.ajax({
+ type: "POST",
+ dataType: 'html',
+ url: "<?= $GLOBALS["SYSTEM_ROOT"] ?>/api/admin/edit_page.php",
+ success: function (data) {
+ if (data == "ok") {
+ location.href = "<?= $GLOBALS["SYSTEM_ROOT"] ?>/cms-special/admin/pages";
+ } else {
+ alert("<?= $lang["admin-errors"]["errorprefix"] ?>" + data)
+ document.getElementById('loader').classList.add('hide')
+ document.getElementById('editing').classList.remove('hide')
+ }
+ },
+ error: function (error) {
+ alert("<?= $lang["admin-errors"]["connerror"] ?>")
+ document.getElementById('loader').classList.add('hide')
+ document.getElementById('editing').classList.remove('hide')
+ },
+ data: formData,
+ cache: false,
+ contentType: false,
+ processData: false
+ });
+}
+
+</script> \ No newline at end of file
diff --git a/Neutron-trunk/cms-special/admin-v2/pages/index.php b/Neutron-trunk/cms-special/admin-v2/pages/index.php
new file mode 100644
index 0000000..d8e1e3d
--- /dev/null
+++ b/Neutron-trunk/cms-special/admin-v2/pages/index.php
@@ -0,0 +1,66 @@
+<?php require_once "../../../resources/private/relative.php"; getRelativeDetails("cms-special"); ?>
+<?php $pageConfig = [ "domName" => "Pages", "headerName" => "Gestionnaire de pages" ]; require_once $_SERVER['DOCUMENT_ROOT'] . "/cms-special/admin/\$resources/precontent.php"; ?>
+
+ <div class="admin-pages-list">
+ <?php
+
+ $pages = scandir($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pages/");
+ $sizetotal = 0;
+ foreach ($pages as $page) {
+ if ($page != "." && $page != "..") {
+ $type = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pagetypes/" . $page);
+ $size = filesize($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pages/" . $page);
+ if ($size > 1024) {
+ if ($size > 1048576) {
+ $sizestr = round($size / 1048576, 2) . " " . $lang["sizes"]["mib"];
+ } else {
+ $sizestr = round($size / 1024, 2) . " " . $lang["sizes"]["kib"];
+ }
+ } else {
+ $sizestr = $size . " " . $lang["sizes"]["bytes"];
+ }
+ $sizetotal = $sizetotal + $size;
+ $sizestr = str_replace(".", ",", $sizestr);
+ if ($page == "index"): ?>
+<!-- echo("<li><a href='/cms-special/admin/pages/manage/?slug={$page}' class='sblink' title='{$lang['admin-pages']['lore']}'>{$lang['admin-pages']['home']}</a> ({$page}), {$typestr}, {$sizestr}</li>");-->
+ <div class="mdc-card mdc-card--outlined" style="width:256px;margin:10px;display:inline-block;">
+ <div class="mdc-card-wrapper__text-section" style="padding-left:5px;padding-right:5px;">
+ <h2 style="margin-bottom:5px;white-space: nowrap;overflow: hidden !important;text-overflow: ellipsis;" class="mdc-typography mdc-typography--headline6"><?= $lang["admin-pages"]["home"] ?></h2>
+ <h3 style="margin-top:5px;" class="mdc-typography mdc-typography--subtitle2"><?php $text = strip_tags(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pages/" . $page));if (strlen($text)>100){echo(substr($text,0,100) . " …");}else{echo($text);} ?></h3>
+ </div><br><br>
+ <div class="mdc-card__actions mdc-card__actions-pages-list">
+ <a href="<?= $GLOBALS["SYSTEM_ROOT"] ?>/cms-special/admin/pages/edit/?slug=<?= $page ?>" title="<?= $lang["admin-pages"]["editl"] ?>" class="mdc-button mdc-card__action mdc-card__action--button">
+ <div class="mdc-button__ripple"></div>
+ <span class="mdc-button__label"><?= $lang["admin-pages"]["edit"] ?></span>
+ </a>
+ <a href="<?= $GLOBALS["SYSTEM_ROOT"] ?>/cms-special/admin/pages/edit/?slug=<?= $page ?>&forcehtml" class="material-icons mdc-icon-button mdc-card__action mdc-card__action--icon mdi-icbtn-card" title="<?= $lang["admin-pages"]["editcode"] ?>">code</a>
+ </div>
+ </div>
+ <?php else: ?>
+ <div class="mdc-card mdc-card--outlined" style="width:256px;margin:10px;display:inline-block;">
+ <div class="mdc-card-wrapper__text-section" style="padding-left:5px;padding-right:5px;">
+ <h2 style="margin-bottom:5px;white-space: nowrap;overflow: hidden !important;text-overflow: ellipsis;" class="mdc-typography mdc-typography--headline6"><?= file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/" . $page . "/pagename") ?></h2>
+ <h3 style="margin-top:5px;" class="mdc-typography mdc-typography--subtitle2"><?php $text = strip_tags(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pages/" . $page));if (strlen($text)>100){echo(substr($text,0,100) . " …");}else{echo($text);} ?></h3>
+ </div><br><br>
+ <div class="mdc-card__actions mdc-card__actions-pages-list">
+ <a href="<?= $GLOBALS["SYSTEM_ROOT"] ?>/cms-special/admin/pages/edit/?slug=<?= $page ?>" title="<?= $lang["admin-pages"]["editl"] ?>" class="mdc-button mdc-card__action mdc-card__action--button">
+ <div class="mdc-button__ripple"></div>
+ <span class="mdc-button__label"><?= $lang["admin-pages"]["edit"] ?></span>
+ </a>
+ <a href="<?= $GLOBALS["SYSTEM_ROOT"] ?>/cms-special/admin/pages/rename/?slug=<?= $page ?>" class="material-icons mdc-icon-button mdc-card__action mdc-card__action--icon mdi-icbtn-card" title="<?= $lang["admin-pages"]["renamel"] ?>">create</a>
+ <a href="<?= $GLOBALS["SYSTEM_ROOT"] ?>/cms-special/admin/pages/delete/?slug=<?= $page ?>" class="material-icons mdc-icon-button mdc-card__action mdc-card__action--icon mdi-icbtn-card" title="<?= $lang["admin-pages"]["deletel"] ?>">delete</a>
+ </div>
+ </div>
+ <?php endif;
+ }
+ }
+ ?>
+ </div>
+ <p><div style="text-align: center;">
+ <a title="<?= $lang["admin-pages"]["alore"] ?>" href="<?= $GLOBALS["SYSTEM_ROOT"] ?>/cms-special/admin/pages/add" class="mdc-button mdc-button--outlined">
+ <div class="mdc-button__ripple"></div>
+ <i class="material-icons-outlined mdc-button__icon" aria-hidden="true">add</i>
+ <span class="mdc-button__label"><?= $lang["admin-pages"]["create"] ?></span>
+ </a>
+ </div></p>
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/cms-special/admin/\$resources/postcontent.php"; ?> \ No newline at end of file
diff --git a/Neutron-trunk/cms-special/admin-v2/pages/rename/index.php b/Neutron-trunk/cms-special/admin-v2/pages/rename/index.php
new file mode 100644
index 0000000..d7118ba
--- /dev/null
+++ b/Neutron-trunk/cms-special/admin-v2/pages/rename/index.php
@@ -0,0 +1,89 @@
+<?php require_once "../../../../resources/private/relative.php"; getRelativeDetails("cms-special"); ?>
+<?php
+
+if (isset($_GET['slug'])) {
+ $currentSlug = $_GET['slug'];
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/pages/" . $currentSlug)) {} else {
+ header("Location: /cms-special/admin/pages");
+ require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit();
+ }
+} else {
+ header("Location: /cms-special/admin/pages");
+ require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit();
+}
+
+?>
+<?php $pageConfig = [ "domName" => "Pages", "headerName" => "Pages" ]; require_once $_SERVER['DOCUMENT_ROOT'] . "/cms-special/admin/\$resources/precontent.php"; ?>
+<?php
+
+if ($currentSlug == "index") {
+ $currentName = "{$lang["admin-pages"]["home"]}";
+ echo("<script>page = \"index\"</script>");
+} else {
+ $currentName = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/" . $currentSlug . "/pagename");
+ echo("<script>page = \"{$currentSlug}\"</script>");
+}
+
+?>
+ <div id="confirm">
+ <p><?= $lang["admin-pages"]["renamew"][0] . $currentName . $lang["admin-pages"]["renamew"][1] ?></p>
+ <?php
+
+ if ($currentSlug == "index") {
+ require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("<i>{$lang["admin-pages"]["renamew"][2]}</i></div></body></html>");
+ }
+
+ ?>
+ <div class="nd_Field nd_Field_input nd_Field__centered nd_Field__disabled" id="onamebox">
+ <input id="oldname" name="oldname" type="text" placeholder="<?= $lang["admin-pages"]["oname"] ?>" spellcheck="false" disabled autocomplete="off" value="<?= $currentName ?>">
+ <label for="name"><?= $lang["admin-pages"]["oname"] ?></label>
+ </div><div class="nd_Field nd_Field_input nd_Field__centered" id="nnamebox">
+ <input id="newname" name="newname" type="text" placeholder="<?= $lang["admin-pages"]["nname"] ?>" spellcheck="false" autocomplete="off" value="<?= $currentName ?>">
+ <label for="name"><?= $lang["admin-pages"]["nname"] ?></label>
+ </div>
+ <p><div style="text-align: center;">
+ <a title="<?= $lang["admin-pages"]["renamel2"] ?>" onclick="renamePage();" class="mdc-button mdc-button--raised">
+ <div class="mdc-button__ripple"></div>
+ <i class="material-icons-outlined mdc-button__icon" aria-hidden="true">edit</i>
+ <span class="mdc-button__label"><?= $lang["admin-pages"]["rename2"] ?></span>
+ </a>
+ </div></p>
+ </div>
+ <div class="hide" id="loader" style="text-align: center;"><img src="/resources/image/loader.svg" class="loader">
+ </div>
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/cms-special/admin/\$resources/postcontent.php"; ?>
+
+<script>
+
+function renamePage() {
+ document.getElementById('confirm').classList.add('hide')
+ document.getElementById('loader').classList.remove('hide')
+ var formData = new FormData();
+ formData.append("page", "<?= $currentSlug ?>");
+ formData.append("newname", document.getElementById('newname').value);
+ $.ajax({
+ type: "POST",
+ dataType: 'html',
+ url: "<?= $GLOBALS["SYSTEM_ROOT"] ?>/api/admin/rename_page.php",
+ success: function (data) {
+ if (data == "ok") {
+ location.href = "<?= $GLOBALS["SYSTEM_ROOT"] ?>/cms-special/admin/pages";
+ } else {
+ alert("<?= $lang["admin-errors"]["errorprefix"] ?>" + data)
+ document.getElementById('loader').classList.add('hide')
+ document.getElementById('confirm').classList.remove('hide')
+ }
+ },
+ error: function (error) {
+ alert("<?= $lang["admin-errors"]["connerror"] ?>")
+ document.getElementById('loader').classList.add('hide')
+ document.getElementById('confirm').classList.remove('hide')
+ },
+ data: formData,
+ cache: false,
+ contentType: false,
+ processData: false
+ });
+}
+
+</script> \ No newline at end of file