%@page import="com.edeal.frontline.helper.CTIHelper"%> <%/****************************************************************************** * Copyright (c) 2000-2013 E-DEAL * * E-DEAL S.A. * 41, rue Périer * 92120 Montrouge * France * * T: +33 (0)1 73 03 29 80 * 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.*"%><%@ page import="java.util.Locale" %><%@ page import="com.edeal.frontline.navigation.FlRequest" %><%@ page import="com.edeal.frontline.services.cti.CTIServiceClient" %><%@ page import="com.edeal.frontline.controller.actions.LoginAction" %><%@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()); FlRequest flRequest = new FlRequest(request); FlContext context = flRequest.getContext(); DataDictionary dico = context.getDataDictionary(); Locale locale = request.getLocale(); response.addHeader("EDEAL_login","true"); String forwardPage = flRequest.getRequestParameterOrAttribute("forwardPage"); if (forwardPage == null) { forwardPage = "/index.jsp"; } /* * If actor language cannot be result (take navigator locale), * initialize language code to english language by default. * If navigator language is french use french language code */ String languageID = dico.getRefIdByCode("ActLngPrinc", "fr_FR"); //if (Locale.FRANCE.equals(locale) || Locale.FRENCH.equals(locale)) { // languageID = dico.getRefIdByCode("ActLngPrinc", "fr_FR"); //} else if (Locale.ENGLISH.equals(locale) || Locale.UK.equals(locale) || Locale.US.equals(locale)) { languageID = dico.getRefIdByCode("ActLngPrinc", "en_US"); } String vocalcomActivated = flRequest.getRequestParameterOrAttribute("vocalcomActivated"); String genesysActivated = flRequest.getRequestParameterOrAttribute(CTIHelper.PARAM_GENESYSACTIVATED); String algoriaActivated = flRequest.getRequestParameterOrAttribute(CTIHelper.PARAM_ALGORIAACTIVATED); String actorID = (String)session.getAttribute("actorID"); // if the actor has already been to logged to E-DEAL and there are no // activated CTI; redirect to forward page; else re-log in a two step process if(actorID != null && !"true".equalsIgnoreCase(vocalcomActivated) && !"true".equalsIgnoreCase(genesysActivated) && !"true".equalsIgnoreCase(algoriaActivated)) { if(Utils.validateActor(context, actorID)) { String anonymousID = Utils.validateActor(context, "Anonymous", null); String systemID = Utils.validateActor(context, "System", null); if(!actorID.equalsIgnoreCase(anonymousID) && !actorID.equalsIgnoreCase(systemID)) { response.sendRedirect(request.getContextPath() + forwardPage); } } } final String errorMsg = flRequest.getRequestParameterOrAttribute(LoginAction.ERROR_MSG_ATTRIBUTE_NAME); //String errorMsg = (String)flRequest.getAttribute("errorMsg"); String op = flRequest.getRequestParameterOrAttribute("op"); String msgErr = flRequest.getRequestParameterOrAttribute("msgErr"); String licError = null; try { licError = (String) session.getAttribute("error"); session.setAttribute("error","0"); } catch (Exception e) {} String actorLogin = Utils.getRequestParameter(context, request, "login"); String pwdLogin = Utils.getRequestParameter(context, request, "pwd"); // Reloop on the page for Vocalcom CTI. //String vocalcomActivated = flRequest.getRequestParameterOrAttribute("vocalcomActivated"); String vocalcomStation = flRequest.getRequestParameterOrAttribute("vocalcomStation"); flRequest.setAttribute("vocalcomActivated", "false"); String pActivateCTI = context.getContextParameter("ActivateCTI"); // Is CTI in available services ? boolean isGenesysCTI = false; // Is Genesys the CTI call engine ? boolean showGenesysProperties = false; // Do we have tested login and licence of the user ? (so second time in this page) boolean showAgentName = false; // Do we enable to modify the agent name (from the actor properties)? boolean showPlaceName = false; // Do we enable to modify the place name (from the actor properties)? boolean showPhoneLogin = false; // Do we enable to modify the phone login (from the actor properties)? boolean showPhonePasscode = false; // Do we enable to modify the phone passcode (from the actor properties)? boolean showPhoneQueue = false; // Do we enable to modify the phone queue (from the actor properties)? String agentName = ""; String placeName = ""; String phoneLogin = ""; String phonePasscode = ""; String phoneQueue = ""; // Algoria String algoriaPhoneNumber = ""; boolean isAlgoriaCTI = false; boolean showAlgoriaProperties = false; // Algoria // Check if the CTI Option is activated. if (pActivateCTI != null && "true".equalsIgnoreCase(pActivateCTI)) { // Check if the CTI provider is Genesys. try{ final CTIServiceClient cti = (CTIServiceClient)context.getServiceManager().getServiceClient(session, "CTI"); isGenesysCTI = ("genesys".equalsIgnoreCase(cti.getImplementation().getProviderId())); // Check if the CTI provider is Algoria isAlgoriaCTI = ("algoria".equalsIgnoreCase(cti.getImplementation().getProviderId())); showGenesysProperties = (isGenesysCTI && "true".equalsIgnoreCase(genesysActivated)); if (showGenesysProperties) { // This is the second time we come so we initialize the show option values. showAgentName = cti.getImplementation().getOption(CTIHelper.OPTION_GENESYS_SHOWAGENTNAME, false); showPlaceName = cti.getImplementation().getOption(CTIHelper.OPTION_GENESYS_SHOWPLACENAME, false); showPhoneLogin = cti.getImplementation().getOption(CTIHelper.OPTION_GENESYS_SHOWPHONELOGIN, false); showPhonePasscode = cti.getImplementation().getOption(CTIHelper.OPTION_GENESYS_SHOWPHONEPASSCODE, false); showPhoneQueue = cti.getImplementation().getOption(CTIHelper.OPTION_GENESYS_SHOWPHONEQUEUE, false); agentName = (String)request.getAttribute(CTIHelper.PARAM_GENESYSAGENTNAME); placeName = (String)request.getAttribute(CTIHelper.PARAM_GENESYSPLACENAME); phoneLogin = (String)request.getAttribute(CTIHelper.PARAM_GENESYSPHONELOGIN); phonePasscode = (String)request.getAttribute(CTIHelper.PARAM_GENESYSPHONEPASSCODE); phoneQueue = (String)request.getAttribute(CTIHelper.PARAM_GENESYSPHONEQUEUE); } // Algoria showAlgoriaProperties = (isAlgoriaCTI && "true".equalsIgnoreCase(algoriaActivated)); if (showAlgoriaProperties) { // This is the second time we come so we initialize the show option values. algoriaPhoneNumber = (String)request.getAttribute(CTIHelper.PARAM_ALGORIAPHONENUMBER); } // Algoria }catch(Exception e){ logger.warn("Error in CTI Service :\nMessage : "+e.getMessage()+"\nCause : " + e.getCause()); } } // Check cookie remember me presence final Cookie cookies [] = request.getCookies (); if (cookies != null) { for (int i = 0; i < cookies.length; i++) { /* * If remember cookie is present && cookie isn't expired && response isn't commited * then redirect /login.fl to try authentication with remember cookie */ if (cookies[i].getName().equals("edrememberme") && request.getAttribute(LoginAction.EXPIRED_COOKIE_VALIDITY) == null && !response.isCommitted()) { response.sendRedirect(request.getContextPath() +"/login.fl"); } } } //Compute remenber me option String edRemembermeEnabled = context.getContextParameter(LoginAction.EDREMEMBERME_COOKIE_ENABLED_OPTION_NAME); String edRemembermeDuration = context.getContextParameter(LoginAction.EDREMEMBERME_COOKIE_DURATION_OPTION_NAME); int edrDuration = 0; boolean edrEnabled = false; if(edRemembermeDuration != null && !"".equals(edRemembermeDuration)){ try{ edrDuration = new Double(edRemembermeDuration).intValue(); } catch (NumberFormatException e){ } } if(edRemembermeEnabled != null && !"".equals(edRemembermeEnabled)){ edrEnabled = Boolean.parseBoolean(edRemembermeEnabled); } String token = request.getParameter("token"); %>