<%@page session="true"%> <%@ page import="com.edeal.frontline.navigation.FlRequest" %> <%@ page import="com.edeal.frontline.FlContext" %> <%@ page import="com.edeal.frontline.DataDictionary" %> <%@ page import="com.edeal.frontline.Utils" %> <%@ page import="com.edeal.frontline.services.cti.CTIServiceClient" %> <%@ page import="com.edeal.frontline.controller.actions.DisplaySimpleMessageAction" %> <%@ page import="com.edeal.frontline.controller.actions.BackgroundAjaxAction" %> <%@page import="com.edeal.frontline.controller.actions.SaveActionbarCssAction"%> <%@page import="com.edeal.frontline.controller.actions.RetrieveLabelAjax"%> <%@page import="com.edeal.frontline.controller.actions.ListMenuMassSelectLayerAction"%> <%@ taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %><% response.setContentType("application/x-javascript"); FlRequest flRequest = new FlRequest(request); FlContext context = flRequest.getContext(); DataDictionary dico = context.getDataDictionary(); String strActID = (String)session.getAttribute("actorID"); %>function login_ajax() { var f = document.forms['login_form']; if (!f) { return false; } if (f.login.value == '') { return false; } var url = '/login_ajax.fl?login=' + encodeURIComponent(f.login.value); if (f.pwd) { url += '&pwd=' + encodeURIComponent(f.pwd.value); } if (f.forwardPage) { url += '&forwardPage=' + encodeURIComponent(f.forwardPage.value); } if (f.resolutionX) { url += '&resolutionX=' + encodeURIComponent(f.resolutionX.value); } if (f.resolutionY) { url += '&resolutionY=' + encodeURIComponent(f.resolutionY.value); } doAjax(url); return false; } //implements the Array.indexOf (does not exists in IE <= 8) if (!Array.prototype.indexOf) { Array.prototype.indexOf = function(obj, start) { for (var i = (start || 0), j = this.length; i < j; i++) { if (this[i] === obj) { return i; } } return -1; } } if (typeof console == "undefined") { console = {}; console.log = function(astring) {return false;}; } String.prototype.trim = function () { return this.replace(/^\s*/, "").replace(/\s*$/, ""); } function unicity(field, value, type, id, msg, formName, origValue) { if (!field || !value) { return; } // If we revert back to the original value, that's ok, just return if (origValue != '' && origValue.toUpperCase() == value.toUpperCase()) { return; } var url = '/unicity.fl?field=' + encodeURIComponent(field); if (type) { url += "&type=" + encodeURIComponent(type); } if (id) { url += "&id=" + encodeURIComponent(id); } if (value) { url += "&value=" + encodeURIComponent(value); } if (msg) { url += "&msg=" + encodeURIComponent(msg); } if (formName) { url += "&formName=" + encodeURIComponent(formName); } doAjax(url); } // Just add the setting of property ed_loaded to the body onload stack jsOnload.add("window.document['ed_loaded']=true"); function doOpenHistory(objID) { window.open('/admin/history/embedded_list.jsp?id=' + objID, 'History', 'menubar=no, status=no, toolbar=no, scrollbars=yes, resizable=no, width=860, height=450'); } function mandatoryFields() { var mFields = document.forms[0].elements["mandatory"]; if (mFields && !mFields.length) { var tmp = new Array(); tmp[0] = mFields; mFields = tmp; } var messages = new Array(); var allOK = true; if (mFields) { for (var i = 0; i < mFields.length; i++) { var element = mFields[i]; var fieldName = element.value; var msg = document.getElementById("mandatory." + fieldName).value; var fields = document.forms[0].elements[fieldName]; if (fields && (!fields.length || fields.type == "select-one" || fields.type == "select-multiple")) { var tmp = new Array(); tmp[0] = fields; fields = tmp; } if (!fields) { //fields managed by views //must be self validated with view.isOnError(); var view = edManager.getViewByID(fieldName); } var needAlert = false; if (view) { if (view.options.ismultivalued) { if (view.model.length == 0) { needAlert = true; } } else { if (view.model.get("value") == "") { needAlert = true; } } } else { if (fields.length >= 1) { var fieldType = fields[0].type; if (fieldType == "select-one") { if (fields[0].options[fields[0].selectedIndex] != undefined) { if (fields[0].options[fields[0].selectedIndex].value == "") { needAlert = true; } } } else if (fieldType == "select-multiple") { if (fields[0].selectedIndex < 0) { needAlert = true; } } else if (fieldType == "radio" || fieldType == "checkbox") { var isChecked = false; for (var j = 0; j < fields.length; j++) { if (fields[j].checked) { isChecked = true; } } needAlert = !isChecked; } else { needAlert = (fields[0].value.trim() == ""); } } } if (needAlert) { allOK = false; messages[messages.length] = msg; document.getElementById(fieldName + "_msg").style.display = "inline"; } else { document.getElementById(fieldName + "_msg").style.display = "none"; } } } if (messages.length > 0) { var msg = ""; for (var i = 0; i < messages.length; i++) { msg += messages[i] + "\n"; } window.alert(msg); } return allOK; } // *********** ZIP CODE MANAGMENT ********** // ** Retrieve a city label according to zipcode & country function retrieveCity(country, zipCode, cityFieldName, formName) { if (country && zipCode && cityFieldName) { var f; if (formName) { f = document.forms[formName]; } else { f = document.forms[0]; } var query = "?zip=" + encodeURIComponent(zipCode) + "&country=" + encodeURIComponent(country) + "&field=" + encodeURIComponent(cityFieldName); if (formName) { query += "&form=" + encodeURIComponent(formName); } doAjax("/getcitylist.fl" + query); } } var doSubmit = null; var afterSubmit = null; var flagSubmit = false; $(document).one("onallviewsrendered", function() { flagSubmit = true; }); function submit() { if (typeof(edApplication) == "undefined") { flagSubmit = true; } if (flagSubmit) { flagSubmit = false; doExitConf = false; if (!mandatoryFields()) { flagSubmit = true; return; } presentFieldsValue(); if (doSubmit){ if (!doSubmit()) { flagSubmit = true; return; } } document.forms[0].submit(); if (afterSubmit != null) { afterSubmit(); } } } function checkAlarms() { doAjax(''); } var editNoteStatus = false; function editBlocNote(saveUrl) { if (saveUrl==null) { saveUrl=""; } var divNode = document.getElementById("read_note"); var textNode = document.getElementById("edit_note"); if (editNoteStatus) { // on passe en lecture var msg = textNode.value; doAjax(saveUrl+"&ActNotes=" + encodeURIComponent(msg)); divNode.innerHTML = msg.split("\n").join("
"); textNode.style.display = "none"; divNode.style.display = "block"; } else { // on passe en edition var msg = divNode.innerHTML; if (msg) { textNode.value = msg.split("
").join("\n").split("
").join("\n"); } else { textNode.value = ""; } divNode.style.display = "none"; textNode.style.display = "block"; textNode.focus(); } editNoteStatus = !editNoteStatus; } function changeActorStatus(actorStatusURL) { if (actorStatusURL == null) { actorStatusURL = ""/>"; } var node = document.getElementById("actorstatus"); var currStatus = node.getAttribute("actorstatus"); <%-- Change both the actor status and the CTI status if such a CTI exists (like Genesys) by choosing an arbitrary reason that mapps easily with the two actor states ACTIF and INDISPO. --%> if (currStatus == '<%=dico.getRefIdByCode("Sta", "Val", "ACTIF")%>') { node.setAttribute('actorstatus', '<%=dico.getRefIdByCode("Sta", "Val", "INDISPO")%>'); node.src = '/icons/infobar/ico_pas_dispo.gif'; node.title = '<%=dico.getRefDisp(session, "Sta", "Te1", dico.getRefIdByCode("Sta", "Val", "INDISPO"))%>' doAjax(actorStatusURL + "&ActStaID=" + encodeURIComponent('<%=dico.getRefIdByCode("Sta", "Val", "INDISPO")%>')); <%-- Open the testagentready2.jsp page if possible and try to change the CTI agent status if such a CTI exists. --%> doSubmit(1); } else { node.setAttribute('actorstatus', '<%=dico.getRefIdByCode("Sta", "Val", "ACTIF")%>'); node.src = '/icons/infobar/ico_dispo.gif'; node.title = '<%=dico.getRefDisp(session, "Sta", "Te1", dico.getRefIdByCode("Sta", "Val", "ACTIF"))%>' doAjax(actorStatusURL + "&ActStaID=" + encodeURIComponent('<%=dico.getRefIdByCode("Sta", "Val", "ACTIF")%>')); <%-- Open the testagentready2.jsp page if possible and try to change the CTI agent status if such a CTI exists. --%> doSubmit(2); } } <%-- Update the CTI agent status when the actor status has been changed. --%> <%-- TODO For now, this function can handle only Genesys CTIs. Hack: show and close immediatly the window, as we don't need it, we only need to change the readiness status. 'READY' and 'NOT_READY' have been hard-coded here. --%> function doSubmit(status) { var window = window.open('/cti/testagentready2.jsp'); if (status == 1) { window.setAgentReady(true, 'READY'); } else { window.setAgentReady(false, 'NOT_READY'); } window.close(); } imgContract = new Image(); imgContract.src = '/icons/ico/contraction.gif' ; imgExpand = new Image(); imgExpand.src = '/icons/ico/expand.gif' ; function expandNotes(divID, nbPix) { var element = document.getElementById(divID + "_value"); var height = element.scrollHeight; var maxHeight = element.style.maxHeight; var args; var o = document.getElementById(divID + "_value"); if (maxHeight == "100%") { if (!o) return; document.images['expander'+divID].src = imgContract.src; element.style.maxHeight = nbPix + "px"; if (height > nbPix) { element.style.height = nbPix + "px"; } else { element.style.height = "auto"; } $("#"+divID + "_value_link").show(); } else { if (!o) return; document.images['expander'+divID].src = imgExpand.src; element.style.maxHeight = "100%"; element.style.height = "100%"; $("#"+divID + "_value_link").hide(); } // remove link "lire la suite" // $("#"+divID + "_value_link").remove(); return false; } function findWindowWidth() { var myWidth = 0; if( typeof( window.innerWidth ) == 'number' ) { //Non-IE myWidth = window.innerWidth; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode' myWidth = document.documentElement.clientWidth; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //IE 4 compatible myWidth = document.body.clientWidth; } return myWidth; } function findWindowHeight() { var myHeight = 0; if( typeof( window.innerWidth ) == 'number' ) { //Non-IE myHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode' myHeight = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //IE 4 compatible myHeight = document.body.clientHeight; } return myHeight; } function doOnLoadHandler(e) { try { if (doOnLoad) { doOnLoad(); } } catch (error) { } try { jsOnload.run(); } catch (ex) { } var urlRandomizer = (new Date()).getTime(); doAjax('/loadCTI_ajax.fl?rand=' + urlRandomizer); // If we're editing, then set up the confirmation dialog window var windowHref = window.location.href; if (windowHref.indexOf('?') >= 0) { windowHref = windowHref.substring(0, windowHref.indexOf('?')); } if (windowHref.indexOf('edit') >= 0 || windowHref.indexOf('create') >= 0) { setUpConfDialog(); } } // This should be the only window.onload! If you need to run some javascript // when the page is loaded, the use the jsOnload javascript object, or // implement a doOnLoad() method in your page window.onload = doOnLoadHandler; function addInteractionGlobal(pPhone, pObj, pID){ var strQuery = '&'; if('Actor' == pObj) { if(pID == '<%=strActID%>') { strQuery += 'initIntActID=' + pID; } else { strQuery += 'initIntActID=<%=strActID%>;' + pID; } } else if('Person' == pObj) { strQuery += 'initIntPersonID=' + pID; } else if('Enterprise' == pObj) { strQuery += 'initIntEntID=' + pID; } else if('Journalist' == pObj) { strQuery += 'initIntJouID=' + pID; } else if('Support' == pObj) { strQuery += 'initIntSupID=' + pID; } else if('Location' == pObj) { strQuery += 'initIntLocID=' + pID; } else { return; } var dt = new Date(); strQuery += '&initIntDate=' + flEscape((dt.getDate() < 10 ? '0' + dt.getDate() : dt.getDate()) + '/' + ((dt.getMonth() + 1) < 10 ? '0' + (dt.getMonth() + 1) : (dt.getMonth() + 1)) + '/' + dt.getFullYear()); strQuery += '&initIntTimeBeg=' + flEscape((dt.getHours() < 10 ? '0' + dt.getHours() : dt.getHours()) + ':' + (dt.getMinutes() < 10 ? '0' + dt.getMinutes() : dt.getMinutes())); strQuery += '&initIntTimeEnd='; strQuery += '&initIntStiID=<%=dico.getRefIdByCode("IntStiID", "DONE")%>'; strQuery += '&initIntAtvCode=OUTPHONE'; window.open('/create_realize_interaction.fl?phone=' + flEscape(pPhone) + strQuery + '&done=1', 'InteractionFrom', 'menubar=yes,status=yes,toolbar=yes,scrollbars=yes,resizable=yes,width=1024,height=768'); } function doCall(arg0, arg1, arg2) { var urlRandomizer = (new Date()).getTime(); doAjax('/doCallCTI_ajax.fl?rand=' + urlRandomizer + '&arg0=' + flEscape(arg0) + '&arg1=' + flEscape(arg1) + '&arg2=' + flEscape(arg2)); } function doTransfer(arg0, arg1) { var urlRandomizer = (new Date()).getTime(); doAjax('/doTransferCTI_ajax.fl?rand=' + urlRandomizer + '&arg0=' + flEscape(arg0) + '&arg1=' + flEscape(arg1)); } // displaySimpleMessage // displays a simple text message in a nicely formatted pop-up window // parameters: // action: action url // it's up to the action to set the message as request attributes // if action is null then the following parameters are used and passed to the display_simple_message action // msgTitle: tab title // msg: message content // textType (optional): format of the message content and title (html, text or javascript) // remember that the msg or msgTitle can be a message code or the actual hardcoded message function displaySimpleMessage(action,msgTitle,msg,textType) { if (action==null) { action="display_simple_message.fl?<%=DisplaySimpleMessageAction.REQ_ATTRIB_MSGTITLE%>="; action+=msgTitle+"&<%=DisplaySimpleMessageAction.REQ_ATTRIB_MSGCONTENT%>="; action+=msg+"&<%=DisplaySimpleMessageAction.REQ_ATTRIB_TEXTTYPE%>="; action+=(textType==null)?"<%=DisplaySimpleMessageAction.REQ_VALUE_MSGTYPE_JAVASCRIPT%>":textType; } var msgWin = window.open(action, 'VerifDisp', 'menubar=no,status=no,toolbar=no,scrollbars=no,resizable=yes,width=600,height=150,screenX=80,screenY=10'); } function hideActionPane() { $('#totalSidebarDiv').toggle('normal', hideActionPane2); } function hideActionPane2() { $('#object_body').animate({ right: '5px' }, 'normal'); $('#object_actions').css('paddingTop', '0px'); $('#hiddenSidebarDiv').toggle('normal'); var url = '/save_actionbar_css.fl?<%=SaveActionbarCssAction.ACTIONBAR_DEPLOYED_ATTR%>=false'; doAjax(url); } function showActionPane() { $('#object_body').animate({ right: findCss('#object_body', 'right', '210px') }, 'normal'); $('#hiddenSidebarDiv').toggle('normal', showActionPane2); } function showActionPane2() { $('#object_actions').css('paddingTop', findCss('#object_actions', 'paddingTop', '5px')); $('#totalSidebarDiv').toggle('normal'); var url = '/save_actionbar_css.fl?<%=SaveActionbarCssAction.ACTIONBAR_DEPLOYED_ATTR%>=true'; doAjax(url); } // -------------------------------------- // -------------------------------------- // Confirmation when leaving an edit page var startValues = new Array(); var usedInputs = new Array(); var doExitConf = true; var goodbyeMsg = 'Vous avez fait des modifications sur cette fiche, qui seront perdues si vous continuez'; function setUpConfLabelCallback(arrIndex) { if (eDealXmlhttpArr[arrIndex].readyState == 4) { hideWaiting(); try { goodbyeMsg = eDealXmlhttpArr[arrIndex].responseText; } catch (error) { } } } function setUpConfDialog() { $(':input').each(function() { var name = this.name; if (!name || name == '') { return; } if (name.indexOf('$') >= 0) { return; } if (name.indexOf('lbl') >= 0) { return; } if (name.indexOf('#') >= 0) { return; } if (!this.id || this.id == '') { return; } if (this.type == 'radio' || this.type == 'checkbox') { if (startValues[name]) { return; } var mvaVar = document.forms[0][name]; if (mvaVar.length && mvaVar.length > 0) { var mvaValue = ''; for (var cnt = 0; cnt < mvaVar.length; cnt++) { if (cnt > 0) { mvaValue += '|'; } mvaValue += mvaVar[cnt].checked; } usedInputs[usedInputs.length] = name; startValues[name] = mvaValue; } else { usedInputs[usedInputs.length] = name; startValues[name] = mvaVar.checked; } } else { var valueVar = this.value; if (!valueVar) { valueVar = ''; } usedInputs[usedInputs.length] = name; startValues[name] = valueVar; } }); } function testForExitChanges() { $(':input').each(function() { var name = this.name; if (doExitConf) { return; } if (!name || name == '') { return; } if (name.indexOf('$') >= 0) { return; } if (name.indexOf('lbl') >= 0) { return; } if (name.indexOf('#') >= 0) { return; } if (!this.id || this.id == '') { return; } if (this.type == 'radio' || this.type == 'checkbox') { if (startValues[name] == null) { return; } var mvaVar = document.forms[0][name]; if (mvaVar.length && mvaVar.length > 0) { var mvaValue = ''; for (var cnt = 0; cnt < mvaVar.length; cnt++) { if (cnt > 0) { mvaValue += '|'; } mvaValue += mvaVar[cnt].checked; } if (startValues[name] != mvaValue) { doExitConf = true; } else { startValues[name] = null; } } else { var mvaValue = mvaVar.checked if (startValues[name] != mvaValue) { doExitConf = true; } else { startValues[name] = null; } } } else { var valueVar = this.value; if (!valueVar) { valueVar = ''; } if (startValues[name] != valueVar) { doExitConf = true; } } }); } // Temporarily commented out until we can get IE to work with this method function goodbye(e) { doExitConf = false; if (!doExitConf) { return; } } // ------------------------------ /* Finds the value of the css element 'element', as found in the css rule 'theClass' */ function findCss(theClass, element, defValue) { var cssRules; if (document.all) { cssRules = 'rules'; } else if (document.getElementById) { cssRules = 'cssRules'; } var added = false; for (var S = 0; S < document.styleSheets.length; S++){ for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) { if (document.styleSheets[S][cssRules][R].selectorText == theClass) { if(document.styleSheets[S][cssRules][R].style[element]){ return document.styleSheets[S][cssRules][R].style[element]; } } } } // Nothing found, return the default return defValue; } // Excpect an status object equivalent to public class AjaxReturnStatus { // public String status; // public String message; // public String errormsg; // } var globalBackgoundStatusDisplayFunction = function(jsonBgStatus, htmlElementIDForResponse) { var limitString = 64; if (jsonBgStatus.status == "<%=BackgroundAjaxAction.AjaxExecutionStatus.OK.toString()%>") { if (htmlElementIDForResponse == null) { alert(jsonBgStatus.message); } else { var messageFromJson = jsonBgStatus.message; var messageToDiplay = messageFromJson; if (messageFromJson.length > limitString){ messageToDiplay = messageFromJson.substring(0, limitString); } $("#"+htmlElementIDForResponse).html(''+messageToDiplay+''); $("#"+htmlElementIDForResponse).show('slow').delay(2000).hide('slow');//,function() { $("#"+htmlElementIDForResponse).hide('slow'); }); //$('#foo').slideUp(300).delay(800).fadeIn(400); } } else { if (htmlElementIDForResponse == null) { alert(jsonBgStatus.message+"\n"+jsonBgStatus.errormsg); } else { var messagesFromJson = jsonBgStatus.message + ' ' + jsonBgStatus.errormsg; var messageToDiplay = messagesFromJson; if (messagesFromJson.length > limitString - 7){ messageToDiplay = messagesFromJson.substring(0, limitString - 7); } $("#"+htmlElementIDForResponse).html('ERROR :'+messageToDiplay+''); $("#"+htmlElementIDForResponse).show('slow'); } } } // called by the tag function doCallBackgroundAjaxAction(fieldName,ajaxUrl,fGetValueDynamically,bgCallBackFn) { if (fGetValueDynamically) { var value=$("#"+fieldName).val(); if (value!=null && value!="") { ajaxUrl=ajaxUrl+encodeURIComponent(value); } } //alert(fieldName+" = "+ajaxUrl+" = "+bgCallBackFn); doBackgroundAjax(ajaxUrl,bgCallBackFn,"bgstatus"+fieldName) } function doMail(objSql, destID, email) { window.open('/mail_messages.fl?ObjSql=' + objSql + '&destID=' + destID + '&email=' + email, 'EMAIL', 'menubar=no,status=no,toolbar=no,scrollbars=yes,resizable=yes,width=700,height=270'); } function openPopupLayer(fields, objectType, urlAction) { var jsonData = JSON.stringify(fields); $.openPopupLayer({ name: "PopupLayer", width: "auto", height: "auto", parameters: {data : jsonData, objectType : objectType}, url: urlAction }); } function openPopupLayerWaiting(jsonData, urlAjax, successMessage, waitingPopupStatusFunction) { doClosePopUp("PopupLayer"); $.openPopupLayer({ name: "WaitingPopup", width: "auto", height: "auto", url: "/waiting_operation_popup.fl", success : function() { $.ajax({ data: jsonData, type: "POST", url: urlAjax, timeout: 0,//no timeout contentType: "application/json;charset=utf-8", dataType: 'json', success: analyseResponse, error: function(jqXHR, textStatus, errorThrown) { if (console && console.log) { console.log("error :"); console.log("jqXHR :"); console.log(jqXHR); console.log("textStatus :"); console.log(textStatus); console.log("errorThrown :"); console.log(errorThrown); } } }); } }); function analyseResponse(data) { if (typeof(waitingPopupStatusFunction) != 'function') { waitingPopupStatus(data, successMessage); } else { waitingPopupStatusFunction(data, successMessage); } } } function waitingPopupStatus(data, detail) { if (data != null) { if (data.status == "<%= ListMenuMassSelectLayerAction.RETURN_SUCCESS %>") { $("#waiting_popup").attr("src", "/js/progressbar/images/success.png"); $("#detail_popup").html(detail + ' ' + decodeURIComponent(data.detail)); } else if (data.status == "<%= ListMenuMassSelectLayerAction.RETURN_FAILURE %>") { $("#waiting_popup").attr("src", "/js/progressbar/images/failure.png"); $("#detail_popup").html(decodeURIComponent(data.detail)); $("#error_popup").html(decodeURIComponent(data.error)); } else { $("#waiting_popup").attr("src", "/js/progressbar/images/failure.png"); } executeSearch(); } } function doClosePopUp(popName){ $.closePopupLayer(popName); } function sendMailWithDocuments(idObj, typeObj, email, emailField) { if (typeObj == null || idObj == null) return; urlToRedirect = '"/>'; if(urlToRedirect.search("\\?")>0){ urlToRedirect += 'id='; } else { urlToRedirect += '?id='; } urlToRedirect += idObj + '&type=' + typeObj; if (email != null) { urlToRedirect += '&email=' + email; } if (emailField != null) { urlToRedirect += '&emailfield=' + emailField; } window.parent.location = urlToRedirect; } function sendMailCmdGiftCheque_WithDocuments(idObj, typeObj, email, emailField) { if (typeObj == null || idObj == null) return; urlToRedirect = '"/>'; if(urlToRedirect.search("\\?")>0){ urlToRedirect += 'id='; } else { urlToRedirect += '?id='; } urlToRedirect += idObj + '&type=' + typeObj; if (email != null) { urlToRedirect += '&email=' + email; } if (emailField != null) { urlToRedirect += '&emailfield=' + emailField; } window.parent.location = urlToRedirect; } function sendMailPaymentSlip_WithDocuments(idObj, typeObj, email, emailField) { if (typeObj == null || idObj == null) return; urlToRedirect = '"/>'; if(urlToRedirect.search("\\?")>0){ urlToRedirect += 'id='; } else { urlToRedirect += '?id='; } urlToRedirect += idObj + '&type=' + typeObj; if (email != null) { urlToRedirect += '&email=' + email; } if (emailField != null) { urlToRedirect += '&emailfield=' + emailField; } window.parent.location = urlToRedirect; } function sendMailOpportunityWithDocuments(idObj, typeObj, vers, email, emailField, clientCase) { if (typeObj == null || idObj == null) return; urlToRedirect = '"/>'; if(urlToRedirect.search("\\?")>0){ urlToRedirect += 'id='; } else { urlToRedirect += '?id='; } urlToRedirect += idObj + '&type=' + typeObj; if (email != null) { urlToRedirect += '&emailEnt=' + email; } if (vers != null) { urlToRedirect += '&typOppDoc=' + vers; } if (emailField != null) { urlToRedirect += '&emailPer=' + emailField; } if (clientCase != null) { urlToRedirect += '&clientCase=' + clientCase; } window.parent.location = urlToRedirect; } /* * Allowing to recover message for specified label, * by synchronous Ajax calling. Asis parameter * can be true or false in order to return the * message "as is". */ function getMessage(labelCode, labelAlt, asis) { return doSynchronAjax("retrieveLabelAjax.fl?code="+labelCode+"&alt="+encodeURIComponent(labelAlt)+"&asis="+asis); } function popupCenter(url, name, width, height, xtr) { var top = (screen.height - height)/2; var left = (screen.width - width)/2; window.open(url, name, xtr + ", top=" + top + ",left=" + left + ", width=" + width + ", height=" + height); } function displayWarning(warnMsg) { if (!edManager.edViews) { setTimeout(function() {displayWarning(warnMsg)}, 1000); } else { Utils.openDialog("Warning", warnMsg, {modal:true}); } } function otherProcess(type, id) { window.parent.location = '/list_process_to_run.fl?objectType=' + type + '&objectID=' + id; } function openPopupLayerProcess(mapParams) { showWaiting() $.openPopupLayer({ name: "PopupLayer", width: "auto", height: "auto", parameters: mapParams, url: "/popup_process_run.fl", success: function() { hideWaiting(); } }); } /* * viewResponse and previewScriptResponse function are called when we use the dynamic function "getEventParStatus" in a XML list */ function viewResponse(id){ window.open('/read_formresponse.fl?id='+id, 'ViewFormResponse' , 'menubar=no,status=no,toolbar=no,scrollbars=no,resizable=yes,width=810,height=500'); } function previewScriptResponse(id, hasNotes, perID){ window.open('/read_scriptresponse.fl?scriptID='+id+'&preview=0&lsePosition=0&hasNotes='+hasNotes+'&perID='+perID, 'PreviewFormResponse' , 'menubar=no,status=no,toolbar=no,scrollbars=no,resizable=yes,width=800,height=500'); } function updateTimestampInput (dateOrTimeInput, fieldName, errorMessage) { dateOrTimeInput = $(dateOrTimeInput); var isDate = dateOrTimeInput.hasClass("date"); var success = false; if (isDate) { success = ctrlDateField(dateOrTimeInput.get(0),errorMessage); } else { success = ctrlHourField(dateOrTimeInput.get(0),errorMessage); } if (success) { var hiddenDateTimeInput = dateOrTimeInput.parent().find("input[name='"+fieldName+"']"); var datetInput = dateOrTimeInput.parent().find("input[name='Date$"+fieldName+"']"); var timeInput = dateOrTimeInput.parent().find("input[name='Time$"+fieldName+"']"); hiddenDateTimeInput.val(datetInput.val()+" "+timeInput.val()); } }