diff options
Diffstat (limited to 'Neutron-trunk/cms-special/admin-v2/appearance')
-rw-r--r--[-rwxr-xr-x] | Neutron-trunk/cms-special/admin-v2/appearance/index.php | 120 |
1 files changed, 6 insertions, 114 deletions
diff --git a/Neutron-trunk/cms-special/admin-v2/appearance/index.php b/Neutron-trunk/cms-special/admin-v2/appearance/index.php index 22c5065..4d15264 100755..100644 --- a/Neutron-trunk/cms-special/admin-v2/appearance/index.php +++ b/Neutron-trunk/cms-special/admin-v2/appearance/index.php @@ -1,5 +1,5 @@ <?php require_once "../../../resources/private/relative.php"; getRelativeDetails("cms-special"); ?> -<?php $loadEditor = false;$pageConfig = [ "domName" => "Apparence", "headerName" => "Apparence" ]; require_once $_SERVER['DOCUMENT_ROOT'] . "/cms-special/admin/\$resources/precontent.php"; ?> +<?php $loadEditor = false;$pageConfig = [ "domName" => "Apparence", "headerName" => "Apparence" ]; require_once $_SERVER['DOCUMENT_ROOT'] . "/cms-special/admin-v2/\$resources/precontent.php"; ?> <span id="appearance-error-box" class="hide"><div id="error"><span id="appearance-error"><?= $lang["admin-appearance"]["error"] ?></span></div></span> <div id="appearance-settings" style="text-align: center;"> <?= $lang["admin-appearance"]["site"] ?> <input onchange="validateName()" onkeyup="validateName()" onkeydown="validateName()" type="text" id="name-field" placeholder="Nom du site" value="<?= file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/sitename") ?>"><br> @@ -31,47 +31,7 @@ <a onclick="submitData()" class="button"><?= $lang["admin-appearance"]["save"] ?></a> </div> <div style="text-align: center;"><div id="appearance-loader" class="hide"><img src="<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/image/loader.svg" class="loader"></div></div> - <h2><?= $lang["admin-appearance"]["footer"] ?></h2> - <span id="footer-error-box" class="hide"><div id="error"><span id="footer-error"><?= $lang["admin-appearance"]["error"] ?></span></div></span> - <div id="footer-settings"><div style="text-align: center;"> - <div style="text-align: center;"><?= $lang["admin-appearance"]["fdesc"] ?></div> - <div name="content" id="fedit"> - <?= file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/data/webcontent/footer") ?> - </div><br> - <a onclick="updateFooter()" class="button"><?= $lang["admin-appearance"]["publish"] ?></a> - <script src="<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/js/ckeditor5/ckeditor.js"></script><script src="<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/js/ckeditor5/translations/<?= $langsel ?>.js"></script> - <script> - let editor; - ClassicEditor - .create( document.querySelector( '#fedit' ), { - language: { - ui: '<?= $langsel ?>', - content: '<?= $langsel ?>' - }, - toolbar: [ - 'heading', '|', 'bold', 'italic', 'link', '|', 'mediaembed', 'blockquote', 'inserttable', '|', 'bulletedList', 'numberedList', '|', 'undo', 'redo' - ] - } ) - .then( newEditor => { - editor = newEditor; - } ) - .catch( error => { - console.error( error ); - } ); - </script></div> - <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-appearance"]["fdisc"][0] ?></p><p><?= $lang["admin-appearance"]["fdisc"][1] ?></p></td></tr></tbody></table></p> - </div> - <div style="text-align: center;"><div id="footer-loader" class="hide"><img src="<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/image/loader.svg" class="loader"></div></div> - <h2><?= $lang["admin-appearance"]["password"] ?></h2> - <span id="password-error-box" class="hide"><div id="error"><span id="password-error"><?= $lang["admin-appearance"]["error"] ?></span></div></span> - <div id="password-settings" style="text-align: center;"> - <p><?= $lang["admin-appearance"]["oldpass"] ?> <input type="password" id="old-password" placeholder="<?= $lang["admin-appearance"]["secure"] ?>"></p> - <p><?= $lang["admin-appearance"]["newpass"] ?> <input type="password" id="new-password" placeholder="<?= $lang["admin-appearance"]["secure"] ?>"></p> - <p><?= $lang["admin-appearance"]["passrep"] ?> <input type="password" id="repeat-password" placeholder="<?= $lang["admin-appearance"]["secure"] ?>"></p> - <a onclick="changePassword()" class="button"><?= $lang["admin-appearance"]["change"] ?></a> - </div> - <div style="text-align: center;"><div id="password-loader" class="hide"><img src="<?= $GLOBALS["SYSTEM_ROOT"] ?>/resources/image/loader.svg" class="loader"></div></div> -<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/cms-special/admin/\$resources/postcontent.php"; ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/cms-special/admin-v2/\$resources/postcontent.php"; ?> <script> @@ -165,78 +125,10 @@ function submitData() { } }, error: function (error) { - document.getElementById('password-error').innerHTML = "<?= $lang["admin-errors"]["connerror"] ?>" - document.getElementById('password-error-box').classList.remove("hide") - document.getElementById('password-loader').classList.add('hide') - document.getElementById('password-settings').classList.remove('hide') - }, - data: formData, - cache: false, - contentType: false, - processData: false - }); -} - -function changePassword() { - document.getElementById('password-loader').classList.remove('hide') - document.getElementById('password-settings').classList.add('hide') - var formData = new FormData(); - formData.append("oldpass", document.getElementById('old-password').value); - formData.append("newpass", document.getElementById('new-password').value); - formData.append("newpassr", document.getElementById('repeat-password').value); - document.getElementById('password-error-box').classList.add("hide") - $.ajax({ - type: "POST", - dataType: 'html', - url: "<?= $GLOBALS["SYSTEM_ROOT"] ?>/api/admin/password.php", - success: function (data) { - if (data == "ok") { - location.href = "<?= $GLOBALS["SYSTEM_ROOT"] ?>/cms-special/admin/login"; - } else { - document.getElementById('password-error').innerHTML = data - document.getElementById('password-error-box').classList.remove("hide") - document.getElementById('password-loader').classList.add('hide') - document.getElementById('password-settings').classList.remove('hide') - } - }, - error: function (error) { - document.getElementById('password-error').innerHTML = "<?= $lang["admin-errors"]["connerror"] ?>" - document.getElementById('password-error-box').classList.remove("hide") - document.getElementById('password-loader').classList.add('hide') - document.getElementById('password-settings').classList.remove('hide') - }, - data: formData, - cache: false, - contentType: false, - processData: false - }); -} - -function updateFooter() { - document.getElementById('footer-loader').classList.remove('hide') - document.getElementById('footer-settings').classList.add('hide') - var formData = new FormData(); - formData.append("footer", editor.getData()); - document.getElementById('footer-error-box').classList.add("hide") - $.ajax({ - type: "POST", - dataType: 'html', - url: "<?= $GLOBALS["SYSTEM_ROOT"] ?>/api/admin/footer.php", - success: function (data) { - if (data == "ok") { - location.href = "<?= $GLOBALS["SYSTEM_ROOT"] ?>/cms-special/admin/appearance"; - } else { - document.getElementById('footer-error').innerHTML = data - document.getElementById('footer-error-box').classList.remove("hide") - document.getElementById('footer-loader').classList.add('hide') - document.getElementById('footer-settings').classList.remove('hide') - } - }, - error: function (error) { - document.getElementById('footer-error').innerHTML = "<?= $lang["admin-errors"]["connerror"] ?>" - document.getElementById('footer-error-box').classList.remove("hide") - document.getElementById('footer-loader').classList.add('hide') - document.getElementById('footer-settings').classList.remove('hide') + document.getElementById('appearance-error').innerHTML = "<?= $lang["admin-errors"]["connerror"] ?>" + document.getElementById('appearance-error-box').classList.remove("hide") + document.getElementById('appearance-loader').classList.add('hide') + document.getElementById('appearance-settings').classList.remove('hide') }, data: formData, cache: false, |