Edit C:\Users\Administrator\Desktop\Back\galaxie - Copy\cti\testagentready2.jsp
<%/****************************************************************************** * Copyright (c) 2000-2007 e-Deal * * e-Deal S.A. * 55 rue Brillat Savarin * 75013 Paris * France * * T: +33 (0)1 53 80 80 30 * F: +33 (0)1 73 01 69 77 * http://www.e-deal.com * * La diffusion de ce code source sous quelque forme que ce soit sans * l'autorisation de E-DEAL est interdite. * * Vous êtes autorisés à modifier ce code source uniquement pour votre usage * propre et sous réserve que les mentions de copyright demeurent intactes. * * Ce code est fourni en l'état. Aucune garantie d'aucune sorte, explicite ou * implicite n'est donnée. En aucun cas E-DEAL ne pourra être tenu pour * responsable des dommages pouvant résulter de l'utilisation de ce code * source. * * ******************************************************************************/%> <%@page session="true" import="com.edeal.frontline.*,java.util.*,com.edeal.frontline.services.*,com.edeal.frontline.services.cti.*"%><%@ page import="com.edeal.frontline.services.cti.CTIServiceClient" %><%@ 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()); logger.warn("Test agent ready"); String contextPath = (String) session.getAttribute("contextPath"); FlContext context = null; if (contextPath != null) { context = Frontline.getContext(contextPath); } else { context = Frontline.getContext(request.getContextPath()); } DataDictionary dico = context.getDataDictionary(); CTIServiceClient cti = null; String actorID = (String) session.getAttribute("actorID"); // Java way to test if the agent is ready and put him ready or not. boolean isActorReady = false; boolean wantActorReady = true; //String reason = "pause"; String reason = Utils.getRequestParameter(context, request, "reason"); if ("+".equalsIgnoreCase(reason)) { reason = ""; } try{ cti = (CTIServiceClient)context.getServiceManager().getServiceClient(session, "CTI"); isActorReady = cti.isActorReady(actorID); wantActorReady = !isActorReady; // ((CTIProviderGenesys)cti.getProvider()).setActorReady(actorID, !isActorReady); }catch(Exception e){ logger.warn("Error in CTI Service :\n"+e.getMessage()); }%> <html> <head> <META Http-Equiv="Cache-Control" Content="no-cache"> <META Http-Equiv="Pragma" Content="no-cache"> <META Http-Equiv="Cache" Content="no store"> <META Http-Equiv="Expires" Content="0"> <script type="text/javascript" language="javascript" src="<fl:webapp/>/js/ajax/sarissa.js"></script> <script type="text/javascript" language="javascript" src="<fl:webapp/>/js/ajax/ajax.js"></script> <script language="javascript"> var genesysOperation = '<fl:webapp/>/<%=GenesysServlet.SERVLET_NAME%>?<%=GenesysServlet.URL_ACTION_PARAMETER%>='; var isReady = genesysOperation+'<%=GenesysServlet.IS_READY_OPERATION%>'; var setReady = genesysOperation+'<%=GenesysServlet.READY_OPERATION%>'; //var reason = <%= reason %>; function isAgentReady(){ // url like genesys?op=isready var url = isReady; url=encodeURI(url); //alert("url called : "+url); doAjax(url); } function setAgentReady(toReady, reason){ // url like genesys?op=ready&readyState=true|false&reason= var url = setReady+'&readyState='+toReady; if (reason != '') { url = url + '&reason='+reason; } url=encodeURI(url); //alert("url called : "+url); doAjax(url); } function doSubmit(status) { <%-- Change actor status to 'Not available' if 'status' is '2', otherwise change it to 'Available'. --%> // The reason for the readiness. var reason = ''; <%--<% if (!wantActorReady) { %>--%> if (status==2) { <%-- Become not ready. --%> reason = window.document.form_dispo.reason.options[window.document.form_dispo.reason.selectedIndex].value; } <%--<% } %>--%> //alert(reason); //if (reason != '') { <%--setAgentReady(<%= wantActorReady %>, reason);--%> setAgentReady((status==1?true:false), reason); <%-- Get in window.opener (infobar.jsp) the node atribute actorstatus, and update both CTI status with reason, and the actor status (copy/paste) of changeActorStatus in global_js.jsp, but do not delegate or infinite loop can occur. Inspired of global_js.jsp#changeActorStatus(). --%> var node = window.opener.document.getElementById("actorstatus"); var currStatus = node.getAttribute("actorstatus"); if (currStatus == '<%= dico.getRefIdByCode("Sta", "Val", "ACTIF") %>') { node.setAttribute('actorstatus', '<%= dico.getRefIdByCode("Sta", "Val", "INDISPO") %>'); node.src = '<fl:webapp/>/icons/infobar/ico_pas_dispo.gif'; node.title = '<%= dico.getRefDisp(session, "Sta", "Te1", dico.getRefIdByCode("Sta", "Val", "INDISPO")) %>' doAjax("<fl:link url="<%= \"/save_object_ajax.fl?type=Actor&$$presentFields=ActStaID&id=\" + (String)session.getAttribute(\"actorID\") %>"/>&ActStaID=" + encodeURIComponent('<%= dico.getRefIdByCode("Sta", "Val", "INDISPO") %>')); } else { node.setAttribute('actorstatus', '<%= dico.getRefIdByCode("Sta", "Val", "ACTIF") %>'); node.src = '<fl:webapp/>/icons/infobar/ico_dispo.gif'; node.title = '<%= dico.getRefDisp(session, "Sta", "Te1", dico.getRefIdByCode("Sta", "Val", "ACTIF")) %>' doAjax("<fl:link url="<%= \"/save_object_ajax.fl?type=Actor&$$presentFields=ActStaID&id=\" + (String)session.getAttribute(\"actorID\") %>"/>&ActStaID=" + encodeURIComponent('<%= dico.getRefIdByCode("Sta", "Val", "ACTIF") %>')); } //} window.document.form_dispo.action='<fl:webapp/>/cti/testagentready2.jsp'; window.document.form_dispo.submit(); window.close(); } </script> </head> <body> <form name="form_dispo"> <table width="550" border="0" cellspacing="0" cellpadding="4" class="transparent"> <tr> <td class="transparent">Mode agent désiré :</td> <td class="transparent"> <% if (wantActorReady) { %> <!--<a onclick="putReason();" href="<fl:webapp/>/cti/testagentready2.jsp">disponible</a> Moti--> <a href="javascript:doSubmit(1);">disponible</a></td><td class="transparent"> <a href="javascript:doSubmit(2);">indisponible</a> <td>Motif : </td><td><select name="reason"><option value="1">Traitement Dossier</option><option value="2">Pause Agent</option><option value="3">Entretien individuel</option><option value="4">Réunion d'équipe</option><option value="5">Formation</option><option value="6">Entretien client physique</option></select></td> <% } else { %> <a href="javascript:doSubmit(2);">indisponible</a> <td>Motif : </td><td><select name="reason"><option value="1">Traitement Dossier</option><option value="2">Pause Agent</option><option value="3">Entretien individuel</option><option value="4">Réunion d'équipe</option><option value="5">Formation</option><option value="6">Entretien client physique</option></select></td> <% } %> </td> </tr> </table> </form> </body> </html>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de