<%@page session="true" import="com.edeal.frontline.*,java.util.*"%><%@ page import="com.edeal.frontline.navigation.FlRequest" %><%@ page import="com.edeal.frontline.services.cti.CTIServiceClient" %><%@ page import="com.edeal.frontline.services.FlServiceClient" %><%@ page import="com.edeal.frontline.services.FlServiceException" %><%@ taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %><%final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory.getLog(getClass()); response.setContentType("application/x-javascript"); FlRequest flRequest = new FlRequest(request); FlContext context = flRequest.getContext(); DataDictionary dico = context.getDataDictionary(); String strActID = (String)session.getAttribute("actorID"); boolean actHasLic; try { actHasLic = ((Boolean)session.getAttribute("actorHasCTI")).booleanValue(); } catch (Exception e) { actHasLic = context.getLicenceManager().actorHasSoftware(strActID, CTIServiceClient.CTI_LIC_CODE, LicenceManager.LicenceType.PermanentLicence, null); } //if CTI is activated, the CTI window will pop up. //if not, it is hidden in the main frameset and the ActiveX control should not be loaded. boolean activateCTI = false; CTIServiceClient cti = null; try { cti = (CTIServiceClient)context.getServiceManager().getServiceClient(session, "CTI"); activateCTI = (cti != null); } catch (final FlServiceException flse) { } boolean isDoCTIWindow = false; if (activateCTI) { try { isDoCTIWindow = !cti.useHideFrame(); } catch(Exception e) { } }%> var useCtiWindow = <%= isDoCTIWindow %>; function doCtiOnLoad() { <% if (activateCTI && actHasLic) { %> if (useCtiWindow) { var ctiWindow = window.open('','CTI'); try { ctiWindow.doOnLoadCTI(true); } catch (error) {} } else { doOnLoadCTI(); } <% } %> } function addInteraction(pPhone,pObj, pID){ var strQuery = '&'; if('Actor' == pObj) { if(pID == '<%= strActID %>') { strQuery += 'initIntActID=' + pID; } else { strQuery += 'initIntActID=<%= strActID %>;' + pID; } } else if('Person' == pObj) { strQuery += 'initIntPerID=' + 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 += '&initIntAtvID=<%= dico.getRefIdByCode("IntAtvID", "OUTPHONE") %>'; window.open('/create_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(pPhone, pObj, pID) { var urlRandomizer = (new Date()).getTime(); doAjax('/doCallCTI_ajax.fl?rand=' + urlRandomizer + '&arg0=' + flEscape(pPhone) + '&arg1=' + flEscape(pObj) + '&arg2=' + flEscape(pID)); } function doAnswer(pRef) { <% if (activateCTI && actHasLic) { %> if (useCtiWindow) { var ctiWindow = window.open('','CTI'); try { ctiWindow.doAnswerCTI(pRef); } catch (error) {} } else { doAnswerCTI(pRef); } <% } %> } function doTransfer(pRef, pPhone) { var urlRandomizer = (new Date()).getTime(); doAjax('/doTransferCTI_ajax.fl?rand=' + urlRandomizer + '&arg0=' + flEscape(pRef) + '&arg1=' + flEscape(pPhone)); } function doChangeStatus(newState) { var urlRandomizer = (new Date()).getTime(); doAjax('/doCTIChangeStatus_ajax.fl?rand=' + urlRandomizer + '&newState=' + newState); } // Form transfer // pRef : tel reference // pPhone : someone to call // pobjID : object id to associate // pType : object type to associate // pIsGroup : is this a group ? (escalation group team) // pCallerPhone : the first caller phone number (the client). function doTransferForm(pRef, pPhone, pobjID, pType, pIsGroup, pCallerPhone) { //alert('doTransferForm : pobjID : '+pobjID); //alert('doTransferForm : pType : '+pType); var urlRandomizer = (new Date()).getTime(); //alert('avant url '); var url = '/doTransferFormCTI_ajax.fl?rand=' +urlRandomizer + '&arg0=' + escape(pRef) + '&arg1=' + escape(pPhone); //alert('url1 : '+url); url += '&pType='+escape(pType)+'&pobjID='+escape(pobjID)+'&isGroup='+escape(pIsGroup)+'&callerPhone='+escape(pCallerPhone); //alert('url : '+url); doAjax(url); }