"use strict"; //2023-08-27: //When a window is opened or saved, some of the //parameters(universal window id, and other DB fields) //need to be reset to match the values of the window set in the DB. //2023-08-27: //get the window attributes in the database and set them to the //web window that is opened on the client-side. function update_window_attributes(win_id) { //var cid = null; if (typeof win_id === "string") { if (win_id.indexOf("_") >= 0) { get_sync_data(win_id); } } } function get_sync_data(win_id) { var form = null; var base_path = null; var u = null; var url = null; var cid = null; cid = get_content_id_by_win_id(win_id); base_path = get_base_path(); u = "/chromosphere/scripts/js/ui/ss/contents_and_js/sync_window/Default"; url = base_path + u; form = new FormData(); form.append("i", cid); http_sync_window(url, form, win_id); } function http_sync_window(u, form_data, win_id) { var xhr = new XMLHttpRequest(); var response_txt = null; ////make_progressing_progress_bar(); xhr.open("POST", u, true); //xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); //xhr.setRequestHeader("Content-Type", "text/plain;"); xhr.onreadystatechange = function () { // Call a function when the state changes. if (this.readyState === XMLHttpRequest.DONE && this.status === 200) { //Request finished. Do processing here. response_txt = this.responseText; set_universal_ids(win_id, response_txt); } else if (this.status === 500) { document.write(this.responseText); //return; } } xhr.send(form_data); } function set_universal_ids(win_id, response_txt) { var win = null; var universal_content_id = null; var universal_window_id = null; win = document.getElementById(win_id); if (win !== null) { win.setAttribute("data-unique_id", response_txt); } }