<%-- IBM Confidential OCO Source Material --%> <%-- 5724-J34 (C) COPYRIGHT International Business Machines Corp. 2004,2012 --%> <%-- The source code for this program is not published or otherwise divested --%> <%-- of its trade secrets, irrespective of what has been deposited with the --%> <%-- U.S. Copyright Office. --%> <%@ page language="java" import="org.apache.struts.util.MessageResources,org.apache.struts.action.Action"%> <%@ page import="java.util.*"%> <%@ page import="com.ibm.ws.console.xdoperations.chart.*"%> <%@ page import="com.ibm.ws.console.xdoperations.util.*"%> <%@ page import="com.ibm.ws.xd.visualizationengine.cacheservice.util.*"%> <%@ page import="com.ibm.ws.xd.admin.utils.ConfigUtils"%> <%@ page errorPage="/secure/error.jsp"%> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> <%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles"%> <%@ taglib uri="/WEB-INF/ibmcommon.tld" prefix="ibmcommon"%> <%//System.out.println("chartLayout:: begin"); %> <% String csrfIdValue = (String)session.getAttribute("com.ibm.ws.console.CSRFToken"); String chartLite = (String)request.getAttribute("chartLite"); if (chartLite == null) chartLite = ""; //TODO -- get rid of this and just have contextType be correct. String dashboardContext = (String)request.getAttribute("dashboard"); if (dashboardContext == null) dashboardContext = ""; boolean tabContainerExists = true; if (request.getParameter("single") != null) { tabContainerExists = false; } %> <%//System.out.println("chartLayout:: after browser detection"); %> <%try { MessageResources msgs = (MessageResources) application.getAttribute(Action.MESSAGES_KEY); String oldsvgviewer = getString("svg.viewer.old.version", msgs, request); String vieweravail = getString("svg.viewer.available", msgs, request); String viewernotavail = getString("svg.viewer.not.available", msgs, request);%> <%!String escape(String str) { if (str == null) return str; String autoinstall = ""; String adobepage = ""; if (str.indexOf(autoinstall) > -1) { int index = str.indexOf(autoinstall); String firststr = str.substring(0, index); String secondstr = str.substring(index + autoinstall.length()); return (firststr.replaceAll("'", "\\\\'") + autoinstall + secondstr.replaceAll("'", "\\\\'")); } else if (str.indexOf(adobepage) > -1) { int index = str.indexOf(adobepage); String firststr = str.substring(0, index); String secondstr = str.substring(index + adobepage.length()); return (firststr.replaceAll("'", "\\\\'") + adobepage + secondstr.replaceAll("'", "\\\\'")); } return str.replaceAll("'", "\\\\'"); } String getString(String key, org.apache.struts.util.MessageResources msgs, HttpServletRequest request) { String str = msgs.getMessage(request.getLocale(), key); return escape(str); } %> <% ChartCollectionForm collectionForm = (ChartCollectionForm) request.getSession().getAttribute(Constants.CHART_COLLECTION_FORM_KEY); String enableRefresh = collectionForm.getEnableAutoRefresh(); if (chartLite.equalsIgnoreCase("true")) { enableRefresh = "false"; } String refreshInterval = collectionForm.getRefreshInterval(); Hashtable tabTable = collectionForm.getTabTable(); String chartFormat = (String) request.getParameter("chartFormat"); String contextType = (String) request.getParameter("contextType"); //System.out.println("chartLayout:: contextType=" + contextType); if (contextType == null || contextType.contains("Dashboard")) { contextType = (String)request.getAttribute("contextType"); } String originalWindow = (String) request.getParameter("originalWindow"); String currWindow = (String) request.getAttribute(Constants.CURRENT_FRAME); if (currWindow == null) { currWindow = (String) request.getParameter(Constants.CURRENT_FRAME); if (currWindow == null) { currWindow = Constants.GRAPH_FRAME_NAME; } } //String maxTime = "-1"; //String minTime = "-1"; String rname = Utils.getResourceName(session, contextType); String target = contextType + Constants.DATASET_NAME_SEPARATOR + currWindow; if (rname.length() > 0) target = contextType + Constants.DATASET_NAME_SEPARATOR + rname + Constants.DATASET_NAME_SEPARATOR + currWindow; ArrayList tabList = (ArrayList) tabTable.get(target); if (tabList == null) { //System.out.println("null tabList"); Set keys = tabTable.keySet(); Iterator i_keys = keys.iterator(); while (i_keys.hasNext()) { String key = (String) i_keys.next(); //System.out.println("chartLayout:: tabTable key=" + key); if (key.startsWith(contextType)) { tabList = (ArrayList) tabTable.get(key); target = key; } } } String selectedRefId = request.getParameter("refId"); //System.out.println("[chartLayout.jsp]:find refId=" + selectedRefId); if (selectedRefId == null || selectedRefId.equals("undefined")) { selectedRefId = (String)request.getAttribute("refId"); //System.out.println("[chartLayout.jsp]:find refId 2=" + selectedRefId); if (selectedRefId == null) { ChartDetailForm detailForm = (ChartDetailForm)request.getSession().getAttribute("ChartDetailForm"); selectedRefId = detailForm.getRefId(); //System.out.println("[chartLayout.jsp]:find refId 3=" + selectedRefId); } } String multiChartRefId = selectedRefId.replace('.','_'); multiChartRefId = multiChartRefId.replace('-', '_'); ChartDetailForm selectedForm = null; //System.out.println("chartLayout:: tabList.size=" + tabList.size()); for (int t = 0; t < tabList.size(); t++) { //System.out.println("chartLayout:: tabList index" + t); ChartDetailForm tab = (ChartDetailForm) tabList.get(t); //System.out.println("chartLayout:: tab" + tab); String refId = tab.getRefId(); //System.out.println("chartLayout:: tab refId2=" + refId); //System.out.println("chartLayout:: tab selectedRefId2=" + selectedRefId); if (refId.equals(selectedRefId)) { selectedForm = tab; } } String[] availableHistoricModes = selectedForm.getAvailableHistoricModes(); int sizeOfAvailableHistoricModes = availableHistoricModes.length; //for (int test = 0; test < sizeOfAvailableHistoricModes; ++test) { // System.out.println("availableHistoricModes["+ test+ "]:"+ availableHistoricModes[test]); //} //If for some reason the selectedRefId is not on the request or session but there //is a chart in the tab list, just display it. //if (selectedRefId.equals("undefined") && tabList.size() > 0) { // ChartDetailForm tab = (ChartDetailForm) tabList.get(0); // System.out.println("chartLayout:: tab2" + tab); // selectedForm = tab; // selectedRefId = tab.getRefId(); // System.out.println("chartLayout:: tab selectedRefId3=" + selectedRefId); //} String refId = selectedForm.getRefId(); String scope = selectedForm.getScope(); String name = selectedForm.getScopeName(); String subdomain = selectedForm.getSubdomain(); String metric = selectedForm.getMetric(); String type = selectedForm.getType(); String filter = selectedForm.getFilter(); String prevDataSets = selectedForm.getPreviousDataSets(); String size = selectedForm.getSize(); String historicMode = selectedForm.getTimeWindow(); List scopes = selectedForm.getScopeList(); List names = selectedForm.getNamesList(); List subdomains = selectedForm.getSubdomainList(); List metrics = selectedForm.getMetricList(); List filters = selectedForm.getFilterList(); List availDataSets = selectedForm.getAvailableDataSets(); Hashtable metricScales = selectedForm.getMetricScales(); List dataSets = selectedForm.getDataSets(); Hashtable shapes = selectedForm.getChartShapes(); String prefsState = (String) request.getSession().getAttribute(currWindow + "_com_ibm_ws_chart_settings_" + selectedRefId); String scopeState = (String) request.getSession().getAttribute(currWindow + "_scopeTable_" + selectedRefId); String subdomainState = (String) request.getSession().getAttribute(currWindow + "_subdomainTable_" + selectedRefId); //System.out.println("chartLayout:: prefsState=" + prefsState + " scopeState=" + scopeState + " subdomainState=" + subdomainState); if (prefsState == null) prefsState = "none"; if (scopeState == null) scopeState = "none"; if (subdomainState == null) subdomainState = "none"; String chartSize = selectedForm.getSize(); int svgwidth = Constants.SMALL_WIDTH; int svgheight = Constants.SMALL_HEIGHT; if (chartSize.equals(Constants.SIZES[Constants.MEDIUM])) { svgwidth = Constants.MED_WIDTH; svgheight = Constants.MED_HEIGHT; } else if (chartSize.equals(Constants.SIZES[Constants.LARGE])) { svgwidth = Constants.LG_WIDTH; svgheight = Constants.LG_HEIGHT; } String detailFormAction = "ChartDetail.do"; String detailFormName = "ChartDetailForm"; String detailFormId = "ChartDetailForm_" + refId; String detailFormType = "com.ibm.ws.console.xdoperations.chart.ChartDetailForm"; String minValueId = "minValue_" + refId; String maxValueId = "maxValue_" + refId; String scopeNameWarning = "scopeNameWarning_" + refId; String scopeTable = "scopeTable_" + refId; String subdomainTable = "subdomainTable_" + refId; String ODRFiltersToggle = "ODRFiltersToggle_" + refId; String chartScope = "chartScope_" + refId; String chartScopeName = "chartScopeName_" + refId; String subdomainId = "subdomain_" + refId; String datasetName = "datasetName_" + refId; String metricId = "metric_" + refId; String odrfilter = "odrfilter_" + refId; String ODRFilterDiv = "ODRFilterDiv_" + refId; String filterId = "filter_" + refId; String timeWindow = "timeWindow_" + refId; %> <% String setChartSelectionCall = "scriptScope.setChartSelections(dojo.byId('" + filterId + "'), dojo.byId('" + datasetName + "'), dojo.byId('" + metricId + "'))"; String selectChartCall = "scriptScope.selectChart(dojo.byId('chartType'), dojo.byId('" + chartScope + "'), dojo.byId('" + chartScopeName + "'), dojo.byId('" + subdomainId + "'), dojo.byId('" + filterId + "'), dojo.byId('" + datasetName + "'), dojo.byId('" + metricId + "'))"; String display = ""; boolean disableHistoric = false; String visible="visible"; if (chartLite.equalsIgnoreCase("true")) { disableHistoric = true; display = "none"; visible="hidden"; } boolean isSingleChart = false; if (request.getParameter("single") != null) { isSingleChart = true; %>
" onclick="returnChart();" />

<% } %> <% //System.out.println("chartLayout::02"); %> <% if (!chartLite.equalsIgnoreCase("true")) { %> <% } %>
<% //System.out.println("chartLayout::03"); %> <%//System.out.println("chartLayout::04"); %> <% String ua = request.getHeader( "User-Agent" ); boolean isMSIE = ( ua != null && ua.indexOf( "MSIE" ) != -1 ); String displayStr = "display: none;"; if (visible == "visible") { displayStr = ""; } if (isMSIE) { %> <% } else { %> <% } %> <% //System.out.println("chartLayout:: after scripts"); } catch (Throwable t) { System.err.println("chartLayout::cause:: " + t.getCause()); System.err.println("chartLayout::message:: " + t.getMessage()); t.printStackTrace(); }%>