"use strict"; //2024-11-24: //this script contains functions for reading, writing, //and removing data from one window to another. //this script is part of the central processing system. //it's a bit of a mixed mess right now. the files listed below //both exist in more than one location on the file system. //see file: 'cps_functions.js' //see file: 'win_to_win_comms.js' //see file: 'create_window.js' //see file: 'window.js' function write_to_window(win_id, data, overwrite = false) { var win_content_box = null; win_content_box = document.getElementById(win_id + "_inner_contents_container"); if (win_content_box !== null) { setTimeout(function () { if (overwrite === false) { win_content_box.innerHTML = win_content_box.innerHTML + data; } else if (overwrite === true) { win_content_box.innerHTML = data; } write_window_content_to_database(win_id, win_content_box.innerHTML); setTimeout(function () { //this function sets a "do reload" flag //in the designated window. Once the do //reload flag has been set to true, then //the window reloads its content from the //server. see file: 'reload_window.js' ////set_do_reload_window_true(win_id); //the following function call executes //the "reload window" function. once the //reload flag has been set to true on a //window, the reload function can be called. //see file: 'reload_window.js' reload_content(win_id); //this function sets a "do NOT reload" flag //in the designated window. once the do //reload flag has been set to false, then //the window doesn't reload again. //see file: 'reload_window.js' set_do_reload_window_false(win_id); }, 500); }, 10); } } function write_window_content_to_database(win_id, data) { var win = null; var u = null; var b = null; var txt = null; var f = null; var content_data_id = null; win = document.getElementById(win_id); if (win !== null) { content_data_id = win.id.split("_")[2].toString(); b = return_base_path(); f = new FormData(); u = b + "/chromosphere/scripts/js/ui/ss/contents_and_js/set_content?i=" + content_data_id; txt = data.toString(); f.append("contentDataTextEditor", txt); http_post_form_write_to_window(u, f); } } function http_post_form_write_to_window(u, form_data) { var xhr = new XMLHttpRequest(); xhr.open("POST", u, true); ////alert("posted"); ////xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8"); ////xhr.setRequestHeader("Content-Type", "text/plain; charset=utf-8"); xhr.onreadystatechange = function () { // Call a function when the state changes. if (this.readyState === XMLHttpRequest.DONE && this.status === 200) { ////alert("text has been saved."); } } xhr.send(form_data); } function write_HTML_to_window(win_id, HTML_text = "") { } function append_HTML_to_window(win_id, HTML_text = "") { } function insert_HTML_to_window(win_id, HTML_text = "") { } function remove_HTML_to_window(win_id, HTML_text = "") { } function read_window_HTML() { }