Subversion Repositories oidplus

Rev

Rev 405 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 405 Rev 424
Line 22... Line 22...
22
var current_node = "";
22
var current_node = "";
23
var popstate_running = false;
23
var popstate_running = false;
24
// DEFAULT_LANGUAGE will be set by oidplus.min.js.php
24
// DEFAULT_LANGUAGE will be set by oidplus.min.js.php
25
// language_messages will be set by oidplus.min.js.php
25
// language_messages will be set by oidplus.min.js.php
26
// language_tblprefix will be set by oidplus.min.js.php
26
// language_tblprefix will be set by oidplus.min.js.php
-
 
27
// csrf_token will be set by oidplus.min.js.php
27
 
28
 
28
var pageChangeCallbacks = [];
29
var pageChangeCallbacks = [];
29
var pageChangeRequestCallbacks = [];
30
var pageChangeRequestCallbacks = [];
30
 
31
 
31
function isInternetExplorer() {
32
function isInternetExplorer() {
Line 85... Line 86...
85
}
86
}
86
 
87
 
87
function getTreeLoadURL() {
88
function getTreeLoadURL() {
88
        var url = new URL(window.location.href);
89
        var url = new URL(window.location.href);
89
        var goto = url.searchParams.get("goto");
90
        var goto = url.searchParams.get("goto");
90
        return (goto != null) ? "ajax.php?action=tree_load&goto="+encodeURIComponent(goto)
91
        return (goto != null) ? "ajax.php?csrf_token="+csrf_token+"&action=tree_load&goto="+encodeURIComponent(goto)
91
                              : "ajax.php?action=tree_load";
92
                              : "ajax.php?csrf_token="+csrf_token+"&action=tree_load";
92
}
93
}
93
 
94
 
94
function reloadContent() {
95
function reloadContent() {
95
        // window.location.href = "?goto="+encodeURIComponent(current_node);
96
        // window.location.href = "?goto="+encodeURIComponent(current_node);
96
        if (openOidInPanel(current_node, false)) {
97
        if (openOidInPanel(current_node, false)) {
Line 151... Line 152...
151
                                // If it can be found, then open all parent nodes and select the node
152
                                // If it can be found, then open all parent nodes and select the node
152
                                $.ajax({
153
                                $.ajax({
153
                                        url:"ajax.php",
154
                                        url:"ajax.php",
154
                                        method:"POST",
155
                                        method:"POST",
155
                                        data:{
156
                                        data:{
-
 
157
                                                csrf_token:csrf_token,
156
                                                action:"tree_search",
158
                                                action:"tree_search",
157
                                                search:id
159
                                                search:id
158
                                        },
160
                                        },
159
                                        error:function(jqXHR, textStatus, errorThrown) {
161
                                        error:function(jqXHR, textStatus, errorThrown) {
160
                                                console.error(_L("Error: %1",errorThrown));
162
                                                console.error(_L("Error: %1",errorThrown));
Line 188... Line 190...
188
        $('#real_content').html(_L("Loading..."));
190
        $('#real_content').html(_L("Loading..."));
189
        $('#static_link').attr("href", "index.php?goto="+encodeURIComponent(id));
191
        $('#static_link').attr("href", "index.php?goto="+encodeURIComponent(id));
190
        $("#gotoedit").val(id);
192
        $("#gotoedit").val(id);
191
 
193
 
192
        // Normal opening of a description
194
        // Normal opening of a description
193
        fetch('ajax.php?action=get_description&id='+encodeURIComponent(id))
195
        fetch("ajax.php?csrf_token="+csrf_token+"&action=get_description&id="+encodeURIComponent(id))
194
        .then(function(response) {
196
        .then(function(response) {
195
                response.json()
197
                response.json()
196
                .then(function(data) {
198
                .then(function(data) {
197
                        if ("error" in data) {
199
                        if ("error" in data) {
198
                                alert(_L("Failed to load content: %1",data.error));
200
                                alert(_L("Failed to load content: %1",data.error));