| | |
| | | |
| | | // Hide and show an element by changing "display" to block and none |
| | | document.querySelector(".codeeditor-space").style.display = "none"; |
| | | document.querySelector(".code-editor-container").style.display = "none"; |
| | | //document.querySelector(".code-editor-container").style.display = "none"; |
| | | document.querySelector("#mce-editor").style.display = "none"; |
| | | //document.querySelector(".box").style.display = "block"; |
| | | |
| | |
| | | |
| | | this.fm_menu_datei_speichern_unter = function(callback) { |
| | | self.dialog_laden_und_zeigen('data/tpl/dlg-save-as.tpl', '', function() { |
| | | |
| | | document.querySelector('#cancel-btn').addEventListener('click', function() { |
| | | //self.fm_do_close(); |
| | | self.dialog_schliessen(); |
| | | }); |
| | | document.querySelector('#speichern-btn').addEventListener('click', function() { |
| | | self.fm_menu_datei_speichern(function() { |
| | | console.log(document.querySelector('#datei-name-in').value); |
| | | self.fm_save_file(document.querySelector('#datei-name-in').value, 'saveTextFileAs', callback); |
| | | self.fm_do_close(); |
| | | self.dialog_schliessen(); |
| | | }); |
| | | }); |
| | | }); |
| | | |
| | | |
| | |
| | | //dlg.style.display = "none"; |
| | | dlg.style.height = '0'; |
| | | dlg.innerHTML = ''; |
| | | self.removeAllListeners('#cancel-btn'); |
| | | self.removeAllListeners('#speichern-btn'); |
| | | }; |
| | | |
| | | this.fm_dateiwahl = function(ev) { |
| | |
| | | tinymce.activeEditor.undoManager.clear(); |
| | | } |
| | | var m = '?c=de.uhilger.filecms.api.FileMgr&m=' + method; |
| | | var u = '../svc'; // + m; |
| | | //var data = [self.pfad, saveFileName, content]; |
| | | //var data = "p=" + self.serialisieren(self.pfad); |
| | | //data += "&p=" + self.serialisieren(saveFileName); |
| | | //data += "&p=" + self.serialisieren(content); |
| | | var data = 'c=de.uhilger.filecms.api.FileMgr&m=' + method + '&p=' + self.pfad + '&p=' + saveFileName + 'p3=' + content; |
| | | self.http_post(u, data, function(resp) { |
| | | // hier scheint nichts zurueckzukommen.. |
| | | var u = '../svc' + m; |
| | | var data = '&p=' + self.pfad + '&p=' + saveFileName + '&p=' + encodeURIComponent(content); |
| | | self.fm_post(u, data, "text", function(resp) { |
| | | // ... |
| | | }); |
| | | /* |
| | | self.fm_post(u, {p: self.pfad, p: saveFileName, p: content}, '', function(resp) { |
| | | // hier scheint nichts zurueckzukommen.. |
| | | }); |
| | | */ |
| | | self.openFileName = saveFileName; |
| | | if(typeof (callback) !== 'function') { |
| | | |
| | |
| | | |
| | | this.fm_text_edit = function(content, mode) { |
| | | document.querySelector(".codeeditor-space").style.display = "block"; |
| | | document.querySelector(".code-editor-container").style.display = "block"; |
| | | document.querySelector(".zentrum-behaelter").style.display = "none"; |
| | | //document.querySelector(".code-editor-container").style.display = "block"; |
| | | //document.querySelector(".zentrum-behaelter").style.display = "none"; |
| | | document.querySelector(".breadcrumb").style.display = "none"; |
| | | document.querySelector(".zentrum").style.display = "none"; |
| | | self.fm_code_edit(content, mode); |
| | | self.openEditor = 'text'; |
| | | }; |
| | |
| | | |
| | | this.fm_do_close = function() { |
| | | document.querySelector(".codeeditor-space").style.display = "none"; |
| | | document.querySelector(".code-editor-container").style.display = "none"; |
| | | document.querySelector(".zentrum-behaelter").style.display = "block"; |
| | | //document.querySelector(".code-editor-container").style.display = "none"; |
| | | //document.querySelector(".zentrum-behaelter").style.display = "block"; |
| | | document.querySelector(".breadcrumb").style.display = "block"; |
| | | document.querySelector(".zentrum").style.display = "block"; |
| | | if(self.cm !== undefined) { |
| | | self.cm.toTextArea(); |
| | | } |
| | |
| | | |
| | | this.removeAllListeners = function(id) { |
| | | var el = document.getElementById(id); |
| | | elClone = el.cloneNode(true); |
| | | el.parentNode.replaceChild(elClone, el); |
| | | if(el !== null) { |
| | | elClone = el.cloneNode(true); |
| | | el.parentNode.replaceChild(elClone, el); |
| | | } |
| | | }; // https://stackoverflow.com/questions/19469881/remove-all-event-listeners-of-specific-type |
| | | |
| | | this.escapeHtml = function(text) { |
| | |
| | | var xmlhttp = new XMLHttpRequest(); |
| | | var url = u; |
| | | xmlhttp.onreadystatechange = function() { |
| | | if (this.readyState == 4 && this.status == 200) { |
| | | if (this.readyState === 4 && this.status === 200) { |
| | | scallback(this.responseText); |
| | | } |
| | | }; |
| | |
| | | var xmlhttp = new XMLHttpRequest(); |
| | | var url = u; |
| | | xmlhttp.onreadystatechange = function() { |
| | | if (this.readyState == 4 && this.status == 200) { |
| | | if (this.readyState === 4 && this.status === 200) { |
| | | scallback(this.responseText); |
| | | } |
| | | }; |
| | | xmlhttp.open("POST", url, true); |
| | | xmlhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); |
| | | //xmlhttp.send(d); |
| | | xmlhttp.send(self.serialisieren(d)); |
| | | |
| | | /* |
| | | $.ajax({ |
| | | url: u, |
| | | data: d, |
| | | type: "POST", |
| | | dataType: dtype, |
| | | success: scallback, |
| | | error: function (xhr, status, errorThrown) { |
| | | $('#fehler').html("Error: " + errorThrown + " Status: " + status); |
| | | }, |
| | | complete: function (xhr, status) { |
| | | //alert( "The request is complete!" ); |
| | | } |
| | | }); |
| | | */ |
| | | xmlhttp.send(d); |
| | | }; |
| | | |
| | | /* |
| | | this.http_get = function(u, cb) { |
| | | self.http_call('GET', u, null, cb); |
| | | }; |
| | |
| | | scallback(this.responseText); |
| | | } |
| | | }; |
| | | xhr.open(method, url); |
| | | xhr.open(method, url, false); |
| | | if(method === 'GET') { |
| | | xhr.send(); |
| | | } else if(method === 'POST' || method === 'PUT') { |
| | |
| | | xhr.send(data); |
| | | } |
| | | }; |
| | | |
| | | */ |
| | | |
| | | |
| | | } |