<%@page import="com.edeal.frontline.helper.ContextHelper"%> <%@ page session="true" %> <%@ page import="com.edeal.frontline.DashboardBean, com.edeal.frontline.DashboardPageBean, com.edeal.frontline.DataDictionary, com.edeal.frontline.FieldNotInitializedException, com.edeal.frontline.FlContext, com.edeal.frontline.MenuBean, com.edeal.frontline.SoftwareBean, com.edeal.frontline.Utils, com.edeal.frontline.dashboard.DashboardPage, com.edeal.frontline.helper.custom.DashboardHelper, com.edeal.frontline.helper.custom.AlarmHelper, com.edeal.frontline.helper.custom.ActorHelper, com.edeal.frontline.navigation.FlRequest, java.util.HashMap, java.util.LinkedHashMap, java.util.HashSet, java.util.Vector, org.apache.commons.logging.Log, org.apache.commons.logging.LogFactory" %> <%@page import="com.edeal.frontline.controller.actions.GetInfoBarInformationAction"%> <%@ taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %><% String actID = (String) session.getAttribute("actorID"); %> <% Vector dashboardBeans = new Vector(); FlRequest flRequest = new FlRequest(request); final Log logger = LogFactory.getLog(getClass()); String actionBodyURL = Utils.getRequestParameter(flRequest.getContext(), request, "actionPageURL"); String bodyPageURL = Utils.getRequestParameter(flRequest.getContext(), request, "bodyPageURL"); FlContext context = flRequest.getContext(); DataDictionary dico = flRequest.getContext().getDataDictionary(); String strActDisp = null; if (bodyPageURL == null) bodyPageURL = (String) request.getAttribute("body"); if (actionBodyURL == null) actionBodyURL = (String) request.getAttribute("action"); if (flRequest.getAttribute("Dashboards") != null) dashboardBeans = (Vector) flRequest.getAttribute("Dashboards"); try { strActDisp = flRequest.getContext().getDataDictionary().getTable("sql", "Actor").toString(session, actID); } catch (Throwable e) { } Integer resX = (Integer) session.getAttribute("resolutionX"); String activateAlert = flRequest.getContext().getContextParameter("ActivateAlert"); boolean isAlertsActivated = ((activateAlert != null) && ("true".equalsIgnoreCase(activateAlert))); String alertType = context.getContextParameter("InfoBar.AlertType "); alertType = (alertType != null) ? alertType : GetInfoBarInformationAction.ALERTTYPE_SCROLL; MenuBean menuBeanMaster = null; String menuIdMaster = null; SoftwareBean swBeanMaster = null; String sfwIdMaster = flRequest.getRequestParameterOrAttribute("SfwID"); if (flRequest.getRequestParameterOrAttribute("mn") != null) menuIdMaster = flRequest.getRequestParameterOrAttribute("mn"); else if (flRequest.getRequestParameterOrAttribute("MenID") != null) menuIdMaster = flRequest.getRequestParameterOrAttribute("MenID"); // First try the menu directly, and get sfwIdMaster from that if (menuIdMaster != null) { try { menuBeanMaster = new MenuBean(menuIdMaster, flRequest.getContext()); try { sfwIdMaster = menuBeanMaster.getMenSfwID(); } catch (FieldNotInitializedException fnie) { logger.debug("Master software ID was not found in the master MenuBean", fnie); } swBeanMaster = new SoftwareBean(sfwIdMaster, flRequest.getContext()); } catch (Exception e) { menuBeanMaster = null; swBeanMaster = null; } } // Then try the getting the software and pulling the menu from there if (menuBeanMaster == null) { try { swBeanMaster = new SoftwareBean(sfwIdMaster, flRequest.getContext()); menuBeanMaster = flRequest.getContext().getMenuManager().getMenu(actID, swBeanMaster.getID()); } catch (Exception e) { menuBeanMaster = null; swBeanMaster = null; } } // If we still don't have a menu, try getting it from the default stored in the session if (menuBeanMaster == null) { try { menuBeanMaster = new MenuBean((String) session.getAttribute("DefaultMenID"), flRequest.getContext()); swBeanMaster = new SoftwareBean(menuBeanMaster.getMenSfwID(), flRequest.getContext()); } // Try to affect the first available software and visible for current actor catch (Exception e) { Vector softwareBeans = flRequest.getContext().getLicenceManager().getSoftwareBeans(); for (SoftwareBean softwareBean : softwareBeans) { Vector sfwRoleHidden = null; try { sfwRoleHidden = (Vector)softwareBean.getSfwRoleHidden(); } catch (FieldNotInitializedException fnie) { } ActorBean actBean = ActorHelper.getSessionActor(session); Vector actRoles = null; try { actRoles = actBean.getActRoles(); } catch (FieldNotInitializedException fnie) { } Boolean isSfwRoleHidden = true; if (sfwRoleHidden != null && actRoles != null) { for (int j = 0; j < actRoles.size(); j++) { if (!sfwRoleHidden.contains(actRoles.elementAt(j))) { // if at least one of my role allows me to see a software so I can see it isSfwRoleHidden = false; break; } } } else { isSfwRoleHidden = false; } if (softwareBean.isSfwInactive() || softwareBean.isSfwHidden() || (isSfwRoleHidden)) { continue; } swBeanMaster = softwareBean; flRequest.setAttribute("SfwID", softwareBean.getSfwID()); break; } } } String sfwCodeMaster = ""; try { sfwCodeMaster = swBeanMaster.getSfwCode(); } catch (FieldNotInitializedException fnie) { logger.debug("Master software code was not found", fnie); } if (sfwCodeMaster.equals("")) sfwCodeMaster = "UNDEFINED"; Vector availableDashboardBeans = DashboardHelper.toVector(DashboardHelper.collectDefaultDashboards(context, actID)); FlLocale flLocale = FlLocale.getInstance(session); String language = flLocale.getLanguage(); String warnMsg = (String) session.getAttribute("warnMsg"); boolean isGeolocalizationActivated = false; isGeolocalizationActivated = ContextHelper.isActivatedService(context, "Geolocalization"); String geocoderkey = (String) context.getContextParameter("GoogleMapKey"); String contextFromRequest = (String)request.getAttribute("jsonContext"); if (contextFromRequest == null) { contextFromRequest = "{\"actorId\":\"" + actID + "\", \"locale\":\"" + language + "\"}"; } %> <fl:getMessage code="L2025" alt="E-DEAL"/> CRM <%=strActDisp == null ? "" : " - " + Utils.formatToWeb(strActDisp, false)%>
<% if (dashboardBeans.size() == 1) { %>
<% for (DashboardBean dashboard : dashboardBeans) { %>
<% DashboardHelper dashboardHelper = new DashboardHelper(dashboard); int dashboardHeight = 0; int pageOrder = 0; int pageHeight, pageWidth, pageX, pageY; DashboardPage pageModel = null; Vector pages = dashboardHelper.collectPages(); for (DashboardPageBean dashboardPageBean : pages) { pageHeight = dashboardPageBean.getDspHeight(); pageY = dashboardPageBean.getDspY(); if (pageHeight + pageY > dashboardHeight) dashboardHeight = pageHeight + pageY; } %>
<% for (DashboardPageBean dashboardPageBean : pages) { try { pageModel = new DashboardPage(session, context, dashboardPageBean.getDspPage()); pageHeight = dashboardPageBean.getDspHeight(); pageWidth = dashboardPageBean.getDspWidth(); pageX = dashboardPageBean.getDspX(); pageY = dashboardPageBean.getDspY(); %>
<%= pageModel.getName() %>
<% } catch (FieldNotInitializedException fnie) { logger.error("Pages properties incomplete", fnie); } pageOrder ++; } %>
" title="" />   " title="" />
<% } %>
<% } else { int dashboardOrder = 0; %> <% for (DashboardBean dashboard : dashboardBeans) { %> "> <% DashboardHelper dashboardHelper = new DashboardHelper(dashboard); int dashboardHeight = 0; int pageOrder = 0; int pageHeight, pageWidth, pageX, pageY; DashboardPage pageModel = null; Vector pages = dashboardHelper.collectPages(); for (DashboardPageBean dashboardPageBean : pages) { pageHeight = dashboardPageBean.getDspHeight(); pageY = dashboardPageBean.getDspY(); if (pageHeight + pageY > dashboardHeight) dashboardHeight = pageHeight + pageY; } %>
<% for (DashboardPageBean dashboardPageBean : pages) { try { pageModel = new DashboardPage(session, context, dashboardPageBean.getDspPage()); pageHeight = dashboardPageBean.getDspHeight(); pageWidth = dashboardPageBean.getDspWidth(); pageX = dashboardPageBean.getDspX(); pageY = dashboardPageBean.getDspY(); %>
<%= pageModel.getName() %>
<% } catch (FieldNotInitializedException fnie) { logger.error("Pages properties incomplete", fnie); } pageOrder ++; } %>
" title="" />   " title="" />
<% dashboardOrder ++; } %>
<% } %>