<%@ 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.DashboardPageBaseHelper, com.edeal.frontline.navigation.FlRequest, java.util.LinkedHashMap, java.util.Vector, org.apache.commons.logging.Log, org.apache.commons.logging.LogFactory" %> <%@ taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %> <% String actID = (String) session.getAttribute("actorID"); FlRequest flRequest = new FlRequest(request); final Log logger = LogFactory.getLog(getClass()); String afterCreation = (String) flRequest.getParameter("aftercreation"); String order = null; String isAdmin = null; String willBeModel = null; if (afterCreation != null) { isAdmin = "1"; willBeModel = "1"; } else { isAdmin = (String) flRequest.getRequestParameterOrAttribute("admin"); willBeModel = (String) flRequest.getRequestParameterOrAttribute("model"); order = (String) flRequest.getParameter("order"); } boolean isModel = Dashboard.isDshDefault(); DashboardHelper dashboardHelper = new DashboardHelper(Dashboard); Vector pages = dashboardHelper.collectPages(); LinkedHashMap availablePages = DashboardPage.collectAvailableDashboardPages(session, flRequest.getContext(), actID); DashboardPage defaultPage = null; Iterator pageIterator = availablePages.values().iterator(); while (defaultPage == null && pageIterator.hasNext()) defaultPage = pageIterator.next(); 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; //Vector availableDashboardBeans = DashboardHelper.toVector(DashboardHelper.collectDefaultDashboards(context, actID)); if (bodyPageURL == null) bodyPageURL = (String) request.getAttribute("body"); if (actionBodyURL == null) actionBodyURL = (String) request.getAttribute("action"); 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))); MenuBean menuBeanMaster = null; String menuIdMaster = null; SoftwareBean swBeanMaster = null; String sfwIdMaster = flRequest.getRequestParameterOrAttribute("SfwID"); flRequest.setAttribute("SfwID", sfwIdMaster); 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"; FlLocale flLocale = FlLocale.getInstance(session); String language = flLocale.getLanguage(); %> <fl:getMessage code="L2025" alt="E-DEAL"/> CRM <%= strActDisp == null ? "" : " - " + Utils.formatToWeb(strActDisp, false) %>
<% for (DashboardPage pageModel : availablePages.values()) { String pageUrl = pageModel.getUrl(); pageUrl = pageUrl.toLowerCase().startsWith("http") ? pageUrl:flRequest.computeURL(pageUrl); %> <% } %>
" title="" /> " title="" /> " title="" /> " title="" /> " title="" /> " title="" /> " title="" />  
<% if (!isModel) { %> " title="" /> <% } if (willBeModel.equals("1")) { %> <% } %>
<% int pageOrder = 0; for (DashboardPageBean dashboardBeanPage : pages) { DashboardPage dashboardPage = new DashboardPage(session, context, dashboardBeanPage.getDspPage()); %>
" />
<% String dashUrl=dashboardPage.getUrl(); dashUrl=dashUrl.toLowerCase().startsWith("http:")?dashUrl:flRequest.computeURL(dashUrl); %>
<% pageOrder ++; } %>