/** * Functions to manage consequences of form modification. */ INITIALChangedControle = false; function checkChanges(url,params){ var destination = '/eAwards_admin/' + url + ".do"; if (params) destination += params; if(INITIALChangedControle){ var resultResponse = confirm("You are about to change the screen without saving the latest changes. If you want to continue without saving, press the OK button, or press the Cancel button."); if(resultResponse){ INITIALChangedControle = false; window.location = destination; } }else{ window.location = destination; } } function checkChangesSave(val){ if(INITIALChangedControle){ var resultResponse = confirm("You are about to change the screen without saving the latest changes. If you want to continue without saving, press the OK button, or press the Cancel button."); if(resultResponse){ INITIALChangedControle = false; document.getElementById("idOper").value = val; doSave(); } }else{ document.getElementById("idOper").value = val; doSave(); } } function checkChangesPopup(url,height,width,params,title){ if(INITIALChangedControle){ var resultResponse = confirm("You are about to change the screen without saving the latest changes. If you want to continue without saving, press the OK button, or press the Cancel button."); if(resultResponse){ INITIALChangedControle = false; doCustomizedLov(url, height, width, params ,title); } }else{ doCustomizedLov(url,height, width , params ,title); } } function checkChangesDelete(url,params,title){ var destination = '/eAwards_admin/' + url + ".do"; if (params) destination += params; if(INITIALChangedControle){ var resultResponse = confirm("You are about to change the screen without saving the latest changes. If you want to continue without saving, press the OK button, or press the Cancel button."); if(resultResponse){ INITIALChangedControle = false; if (confirm(title)) { window.location =destination; } } }else{ if (confirm(title)) { window.location =destination; } } } function checkChangesRepportStatus(url,params,title){ var destination = '/eAwards_admin/' + url + ".do"; if (params) destination += params; if(INITIALChangedControle){ var resultResponse = confirm("You are about to change the screen without saving the latest changes. If you want to continue without saving, press the OK button, or press the Cancel button."); if(resultResponse){ INITIALChangedControle = false; if (confirm(title)) { window.location =destination; } } }else{ if (confirm(title)) { window.location =destination; } } } function adviseInputFields() { try { vForm = document.forms[0]; if(vForm.name == 'admCritProgForm') return; if(vForm.name == 'finCriterePaiementProgForm') return; vElements = vForm.elements; } catch (e) { return true; } if (vElements["action"]) { vElements["action"].value = ""; } for (i = 0; i < vElements.length; i++) { vType = vElements[i].type; if (vType != 'hidden') { vElements[i].onchange = setFormChanged; } } } /** * Set the changed flag ona form input value change */ function setFormChanged() { try { document.forms[0].elements["changed"].value = "Y"; } catch(e) { // ignore } } /** * Save and Redirect or redirect to a specific url */ function doURLAction(url,params) { var changed = "N"; try { changed = document.forms[0].elements["changed"].value; } catch(e) { // ignore } var destination = '/eAwards_admin/' + url+".do?"+params; if (changed == "Y") { if (confirm("You are about to change screen without saving the last modifications. If you want to save them press the OK button, if not, press the Cancel button.")) { document.forms[0].elements["destination"].value = url; doSave(); window.location = destination; return; } } window.location = destination; } /** * Save and Redirect or redirect to a specific url */ function doAction(url, locale, params) { var changed = "N"; try { changed = document.forms[0].elements["changed"].value; } catch(e) { // ignore } if (changed == "Y") { if (document.forms[0].elements["formSavingEnabled"].value=="Y" ) { if (confirm("You are about to change screen without saving the last modifications. If you want to save them press the OK button, if not, press the Cancel button.")) { document.forms[0].elements["destination"].value = url; // a ajouter par la suite // document.forms[0].elements["locale"].value = locale; // pour appeler le custom save des écrans au cas ou cette methode existe try { doCustSave(); } catch(e) { doSave(); } var destination = '/eAwards_admin/' + url + ".do"; //a supprimer par la suite //doActionRedirect(url, locale, params); return; } } } doActionRedirect(url, locale, params); } function doActionSave(url, locale, params) { document.forms[0].elements["destination"].value = url; document.forms[0].elements["locale"].value = locale; doSave(); return; if (locale) { if (params) destination += params; destination = addParameter(destination, "locale", locale); } window.location = destination; } function doActionRedirect(url, locale, params) { var destination = '/eAwards_admin/' + url + ".do"; if (params) destination += params; if (locale) { destination = addParameter(destination, "locale", locale); } window.location = destination; } function doMenuRedirect(url, params) { var changed = "N"; try { changed = document.forms[0].elements["changed"].value; } catch(e) { // ignore } var destination = '/eAwards_admin/' + url + ".do"; if (params) destination += params; if (changed == "Y") { //if (document.forms[0].elements["formSavingEnabled"].value=="Y" ) { if (confirm("You are about to change screen without saving the last modifications. If you want to save them press the OK button, if not, press the Cancel button.")) { document.forms[0].elements["destination"].value = destination; // pour appeler le custom save des écrans au cas ou cette methode existe // des écrans utilisent cette methode avant d"appeler le doSave try { doCustSave(); } catch(e) { doSave(); } window.location = destination; return; } } } window.location = destination; } /** * Save and Redirect or redirect to a specific url without parameters */ function doRedirectURL(url) { var changed = "N"; try { changed = document.forms[0].elements["changed"].value; } catch(e) { // ignore } var destination = url; if (changed == "Y") { if (confirm("You are about to change screen without saving the last modifications. If you want to save them press the OK button, if not, press the Cancel button.")) { document.forms[0].elements["destination"].value = url; doSave(); window.location = destination; return; } } window.location = destination; } /** * CUSTOM Save and Redirect or redirect to a specific url */ function doCustAction(url, locale, params) { var changed = "N"; try { changed = document.forms[0].elements["changed"].value; } catch(e) { // ignore } if (changed == "Y") { if (document.forms[0].elements["formSavingEnabled"].value=="Y" ){ if (confirm("You are about to change screen without saving the last modifications. If you want to save them press the OK button, if not, press the Cancel button.")) { document.forms[0].elements["destination"].value = url; // a ajouter par la suite // document.forms[0].elements["locale"].value = locale; doCustSave(); var destination = '/eAwards_admin/' + url + ".do"; //a supprimer par la suite //doActionRedirect(url, locale, params); return; } } } doActionRedirect(url, locale, params); }