aboutsummaryrefslogtreecommitdiff
path: root/Neutron-trunk/cms-special/admin/advanced/jsonconf/index.php
blob: f087b1c0c89bfa4139bf63c58c0dfbdbe2def8f3 (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
<?php require_once "../../../../resources/private/relative.php"; getRelativeDetails("cms-special"); ?>
<?php $pageConfig = [ "domName" => "Préférences de développement - Options avancées", "headerName" => "Préférences de développement" ]; require_once $_SERVER['DOCUMENT_ROOT'] . "/cms-special/admin/\$resources/precontent.php"; ?>
    <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-advanced-dev"]["warning"] ?></p><p><?= $lang["admin-advanced-dev"]["remove"][0] ?> <code>/data/webcontent/customSettings.json</code>. <?= $lang["admin-advanced-dev"]["remove"][1] ?></p></td></tr></tbody></table></p>
    <div id="editing">
        <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/resources/private/CodeEditor$3.php" ?>
    </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 = "Quit?";
    }

        // For Safari
        return "Quit?";
    };
</script>

<script>

function pushSettings() {
    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("content", ace.edit("editor").getValue());
    $.ajax({
        type: "POST",
        dataType: 'html',
        url: "<?= $GLOBALS["SYSTEM_ROOT"] ?>/api/admin/save_advanced.php",
        success: function (data) {
            if (data == "ok") {
                window.onbeforeunload = undefined;
                location.href = "/cms-special/admin/home";
            } 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
    });
}

</script>