PortaleOrdiniGruppo/PostIn/postin_user_onload.js
2025-03-24 15:28:26 +01:00

65 lines
2.9 KiB
JavaScript

function SetupOnLoad() {
// tabs.Hide("_1", false);
// tabs.Hide("_2", false);
document.getElementById('tabsContainer').style.display = 'none';
var imid, h, s, t, f, o = window.adjustWidthAndHeight,
ae = LibJavascript.Events.addEvent,
im = 0,
dim = document.images,
bds = Ctrl('bodyDiv').style;
ZtVWeb.getPortletInc('bodyDiv', 'postin_user').setBackgroundColor(w_color);
t = Ctrl('textualpostit')
t.style.resize = "none"
//t.style.backgroundColor = i.style.backgroundColor*/
adjustWidthAndHeight = function () {
if (o) o.apply(null, arguments);
// t.style.width=Max(parseInt(bds.width)-2,50)+'px'
// t.style.height=Max(parseInt(bds.height)-2,50)+'px'
document.getElementById('FrmMain').style.cssText = 'height:100%;width:100%;';
document.getElementById('bodyDiv').style.cssText = 'height:100%;width:100%;';
document.documentElement.style.height = '100%';
}
t.style.zIndex = 100
f = function () {
var j, h
if (m_cFunction == 'view' || m_cFunction == 'query')
return
if (t.value != w_textualpostit)
Set_textualpostit(t.value)
if (document.FSender.m_cAction.value == 'discard') {} else if ((Empty(w_textualpostit) || w_textualpostit == w_scrivi_postit)) {
j = new JSURL('postin_user?m_cAction=delete&m_cID=' + w_m_cId + '&m_cMode=hyperlink&code=' + URLenc(w_code), true)
} else if (m_bUpdated) {
//in Chrome NameForCaller non restituisce 'parent'
Set_MultiCompS(parent.document.FSender.m_cLastWhere.value)
j = new JSURL('postin_user?m_cAction=writeload&m_cID=' + w_m_cId + '&m_cMode=hyperlink&code=' + URLenc(w_code) + '&postit=' + URLenc(w_postit) +
'&status=' + URLenc(w_status) + '&datestart=' + URLenc(WtA(w_datestart, 'T')) +
'&datestop=' + URLenc(WtA(w_datestop, 'T')) + '&MultiCompS=' + URLenc(w_MultiCompS), true)
}
if (j && Empty(j.Response()) && window['fetch']) {
h = {
'Content-type': 'application/x-www-form-urlencoded'
}
if (j['userAgent'])
h["User-Agent"] = j.userAgent
if (j['Referer'])
h["Referer"] = j.Referer
fetch((SetNumberSettings.normKey ? Strtran(SetNumberSettings.normKey(''), '/stdFunctions.js', '') : ZtVWeb.SPWebRootURL) + '/servlet/postin_user', {
method: j.methodUsed,
body: j.prm,
headers: h,
keepalive: true
}).catch(function (error) {
console.log('There has been a problem with postin operation: ');
console.log(error);
});
}
}
if (window.addEventListener) {
window.addEventListener("beforeunload", f, true);
} else if (window.attachEvent) {
window.attachEvent("onbeforeunload", f);
}
}