<%@ page language="java" import="java.util.*,java.text.SimpleDateFormat" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="sitemesh"
	uri="http://www.opensymphony.com/sitemesh/decorator"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="cui" tagdir="/WEB-INF/tags"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<%
com.cesgroup.cesmonitor.service.LoginUser user=com.cesgroup.cesmonitor.common.Util.getLoginUser();
if(user==null){
%>
<script type="text/javascript">
window.location.href="${ctx}/logout";
</script>
<% 
return;
}
%>

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="Author" content="" />
<title>智能监控平台</title>
<link rel="shortcut icon" type="images/x-icon"
	href="${ctx}/login/css/images/logoNew.ico">
<%-- <meta name="msapplication-TileImage"
	content="${ctx}/img/ms-tile-144x144.png"> --%>
<meta name="msapplication-TileColor" content="#d40000">
<meta name="msapplication-config" content="none" />
<link rel="stylesheet" type="text/css"
	href="${ctx}/js/highcharts/highcharts.css" />
<link rel="stylesheet" type="text/css"
	href="${ctx}/styles/blue-theme.css" />
<link rel="stylesheet" type="text/css" href="${ctx}/styles/common.css" />

<script>
	var PHP_TZ_OFFSET = 28800;
</script>
<script src="${ctx}/js/browsers.js"></script>
<script
	src="${ctx}/php/jsLoader.php?ver=3.0.7&amp;lang=zh_CN&showGuiMessaging=1"></script>
<script
	src="${ctx}/php/jsLoader.php?ver=3.0.7&amp;lang=zh_CN&showGuiMessaging=1&amp;files[]=class.calendar.js&amp;files[]=servercheck.js"></script>
<script src="${ctx}/php/js/class.pmaster.js"></script>

<script src="${ctx}/js/highcharts/highcharts.js"></script>
<script type="text/javascript"
	src="${ctx}/js/highcharts/highcharts-3d.js"></script>
<script type="text/javascript" src="${ctx}/js/highcharts/exporting.js"></script>
<script type="text/javascript"
	src="${ctx}/js/highcharts/offline-exporting.js"></script>
<script src="${ctx}/js/highcharts/highcharts-more.js"></script>
<script src="${ctx}/js/highcharts/solid-gauge.js"></script>
<script type="text/javascript" src="${ctx}/js/bootstrap.modal.min.js"></script>
<script type="text/javascript" src="${ctx}/js/jquery.alert.js"></script>
<%-- <script type="text/javascript" src="${ctx}/js/jquery.1.10.1.min.js"></script>
 --%><sitemesh:head />
</head>
<body>
	<div class="msg-bad-global" id="msg-bad-global"></div>
	<script type="text/javascript">
		MMenu.def_label = ''
	</script>
	<header role="banner">
		<div class="nav" role="navigation">

			<div class="top-nav-container" id="mmenu">
				<a class="header-logo"
					href="${ctx}/php/zabbix.php?action=dashboard.view&ddreset=1"><div
						class="logo"></div></a>
				<ul class="top-nav">
					<li id="view" onmouseover="javascript: MMenu.mouseOver('view');"><a
						tabindex="0">首页</a></li>
					<li id="cm" onmouseover="javascript: MMenu.mouseOver('cm');"><a
						tabindex="0">资源管理</a></li>
					<li id="network"
						onmouseover="javascript: MMenu.mouseOver('network');"><a
						tabindex="0">网络管理</a></li>
					<li id="service"
						onmouseover="javascript: MMenu.mouseOver('service');"><a
						tabindex="0">业务管理</a></li>
					<li id="reports"
						onmouseover="javascript: MMenu.mouseOver('reports');"><a
						tabindex="0">统计报表</a></li>
					<%
					  if (user != null) {
					        request.setAttribute("user", user);
					        if (user.isAdmin() || user.isSuperAdmin()) {
					%>
					<li id="config"
						onmouseover="javascript: MMenu.mouseOver('config');"><a
						tabindex="0">系统配置</a></li>
					<%
					    }
					        if (user.isSuperAdmin()) {
					%>
					<li id="admin" onmouseover="javascript: MMenu.mouseOver('admin');"><a
						tabindex="0">系统管理</a></li>

					<%
					      }
					    }
					%>
				</ul>

				<ul class="top-nav-icons">
					<!-- <li><form method="get" action="search.php"
							accept-charset="utf-8">
							<input type="hidden" id="sid" name="sid" value="ef3f044dced6cbd9"><input
								type="hidden" id="form_refresh" name="form_refresh" value="1"><input
								type="text" id="search" name="search" value="" maxlength="255"
								autocomplete="off" class="search">
							<button type="submit" class="btn-search">&nbsp;</button>
						</form></li> -->
					<li><a class="top-nav-profile"
						title="${user.username}&nbsp;(${user.name}&nbsp;${user.surname})"
						href="${ctx}/php/profile.php">&nbsp;</a></li>
					<!-- <li><a class="top-nav-signout" title="退出"
						onclick="javascript: return redirect('index.php?reconnect=1&sid=ef3f044dced6cbd9', 'post', 'sid', true)"
						href="javascript:void(0)">&nbsp;</a></li> -->
					<li><a class="top-nav-signout" title="退出" href="${ctx}/logout">&nbsp;</a></li>
				</ul>
			</div>
			<div class="top-subnav-container"
				onmouseover="javascript: MMenu.mouseOver();"
				onmouseout="javascript: MMenu.mouseOut();">
				<ul class="top-subnav" id="sub_view" style="display: none;">
					<li><a href="${ctx}/formview/index.php">监控总览</a></li>
				</ul>
				<ul class="top-subnav" id="sub_cm" style="display: none;">
					<li><a href="${ctx}/formview/host.php">资源监控</a></li>
					<%
					    if (user != null) {
					        request.setAttribute("user", user);
					        if (user.isAdmin() || user.isSuperAdmin()) {
					%>
					<li><a
						href="${ctx}/php/zabbix.php?action=discovery.view&ddreset=1">自动发现</a></li>
					<%
					     }
					   }
					%>
					<li><a href="${ctx}/formview/listOfAlarms.php">告警列表</a></li>
					<li><a href="${ctx}/php/hostinventories.php?ddreset=1">资产记录</a></li>
					<li><a href="${ctx}/php/tr_status.php?ddreset=1">触发器状态</a></li>

					<%
					    if (user != null) {
					        request.setAttribute("user", user);
					        if (user.isAdmin() || user.isSuperAdmin()) {
					%>
					<li><a href="${ctx}/php/hosts.php?ddreset=1">监控配置</a></li>
					<li><a href="${ctx}/php/discoveryconf.php?ddreset=1">自动发现配置</a></li>
					<%
					     }
					   }
					%>
				</ul>
				<ul class="top-subnav" id="sub_network" style="display: none;">
					<li><a href="${ctx}/php/sysmaps.php?map_type=1&ddreset=1">网络拓扑图</a></li>
					<li><a href="${ctx}/formview/quickDisplay.php">流量趋势</a></li>
					<%
					    if (user != null) {
					        request.setAttribute("user", user);
					        if (user.isAdmin() || user.isSuperAdmin()) {
					%>
					<li><a href="${ctx}/formview/quickConfig.php">快速访问配置</a></li>
					<%
					     }
					   }
					%>
				</ul>
				<ul class="top-subnav" id="sub_service" style="display: none;">
					<li><a href="${ctx}/php/srv_status.php?ddreset=1">业务列表</a></li>
					<li><a href="${ctx}/php/sysmaps.php?map_type=2&ddreset=1">业务视图</a></li>
					<%
					    if (user != null) {
					        request.setAttribute("user", user);
					        if (user.isAdmin() || user.isSuperAdmin()) {
					%>
					<li><a href="${ctx}/php/services.php?ddreset=1">业务配置</a></li>
					<%
					    }
					    }
					%>
				</ul>
				<ul class="top-subnav" id="sub_reports" style="display: none;">
					<li><a href="${ctx}/report/abnormalAlarm.php">报表展示</a></li>
					<li><a href="${ctx}/php/toptriggers.php?ddreset=1">异常告警Top100</a></li>
					<li><a href="${ctx}/php/charts.php?ddreset=1">图形</a></li>
				</ul>
				<ul class="top-subnav" id="sub_config" style="display: none;">
					<li><a href="${ctx}/php/hostgroups.php?ddreset=1">主机群组</a></li>
					<li><a href="${ctx}/php/templates.php?ddreset=1">模板</a></li>
					<li><a href="${ctx}/php/triggers.php?ddreset=1">触发器</a></li>
					<li><a href="${ctx}/php/actionconf.php?ddreset=1">动作</a></li>
					<%
				    if (user != null) {
				        request.setAttribute("user", user);
				        if (user.isSuperAdmin()) {
					%>
					<li><a
						href="${ctx}/php/zabbix.php?action=script.list&ddreset=1">脚本</a></li>
					<%
					    }
					  }
					%>
				</ul>
				<ul class="top-subnav" id="sub_admin" style="display: none;">
					<li><a href="${ctx}/php/usergrps.php?ddreset=1">用户群组</a></li>
					<li><a href="${ctx}/php/users.php?ddreset=1">用户</a></li>
					<li><a
						href="${ctx}/php/zabbix.php?action=mediatype.list&ddreset=1">告警媒介</a></li>
					<li><a href="${ctx}/php/auditlogs.php?ddreset=1">系统审计</a></li>
					<li><a href="${ctx}/php/auditacts.php?ddreset=1">告警推送日志</a></li>
					<li><a href="${ctx}/php/adm.gui.php?ddreset=1">系统资源库</a></li>
				</ul>

				<ul class="left-screen" id="screen-menu" style="display: none;">
					<%-- 	<li><a href="${ctx}/screen/index1?ddreset=1" target="_blank">大屏一</a></li> --%>
					<li><a
						href="${ctx}/login?autologin=1&username=${user.username}&password=${user.password}&forwardUrl=/cesmonitor/screen/index1?ddreset=1"
						target="_blank">大屏一</a></li>
					<li><a href="${ctx}/screen/index2?ddreset=1" target="_blank">大屏二</a></li>
					<li><a href="${ctx}/screen/index3?ddreset=1" target="_blank">大屏三</a></li>
				</ul>
				<%
				if(user.isSuperAdmin()){
				%>
				<ul class="screenIcon" id="screen-icon">
					<li><span class="screen-icon" title="大屏"
						onClick="showScreenList()"></span></li>
				</ul>
				<%
				}
				%>
				<div class="server-name"></div>
			</div>
		</div>
	</header>
	<div class="article">

		<sitemesh:body />
	</div>


	<div class="footer" id="footer">
		上海中信信息发展股份有限公司© 2017-2018
		<p style="display: inline-block; color: #666;"></p>
		, <a class="grey link-alt" target="_blank"
			href="http://www.cesgroup.com.cn" ><span id="cesFoot"></span></a>
	</div>

	<script type="text/javascript">
		
			jQuery(document).ready(function() {
						//initMessages({});
						//service_conf_tree = new CTree("tree_Admin_service_conf_tree",service_conf_tree_tree);

					/* 	resetMenu(); */
				var urlPathname = window.location.pathname;
				var s="a[href='"+urlPathname+"']";
				if(urlPathname=='/cesmonitor/map/createFromHosts'){
					s="a[href='/cesmonitor/php/sysmaps.php?map_type=1&ddreset=1']";
				}
				//$(s).parent("li").addClass("active");
				//$(s).parent("li").parent("ul").parent("li").addClass("active");
				jQuery(s).addClass("selected");
				jQuery(s).parent().parent().css("display","block");
				var noHost=jQuery(s).parent().parent().attr("id");
				if(noHost){
					var id=jQuery(s).parent().parent().attr("id").substring(4);
					//console.log(id);
					jQuery(".top-nav li").removeClass("selected");
				 	jQuery("#"+id).addClass("selected");
				}
				 /*MMenu.def_label=id; */
				/* var ul = jQuery(s).parent().parent().attr("id").slice(4);
				jQuery("#"+ul).addClass("selected"); */
				jQuery(".top-nav li").on("click", function(e) {
					var target = jQuery(e.currentTarget).attr("id");
					jQuery(".top-nav li").removeClass("selected");
					jQuery("#"+target).addClass("selected");
					jQuery(".top-subnav").hide();
					jQuery("#sub_"+target).show();
				})
				if(urlPathname!='/cesmonitor/formview/index.php'){
					jQuery("#screen-icon").css('display','none');
				}		
			});
						
		</script>
	<script type="text/javascript">
		
			var isShow = true;
			jQuery(document).ready(function() {
				// the chkbxRange.init() method must be called after the inserted post scripts and initializing cookies
				cookie.init();
				chkbxRange.init();
				//getEndDate();
			});
			function showScreenList(){
				if(isShow){
					jQuery("#screen-menu").show();
					jQuery(".screen-icon").css("background","#126fc6 url(../img/icon-sprite.svg) no-repeat -46px -4px");
					isShow = false;
					jQuery("#screen-menu a").click(function(){
						jQuery("#screen-menu").hide();
						jQuery(".screen-icon").css("background","#126fc6 url(../img/icon-sprite.svg) no-repeat -33px -149px");
						isShow = true;
					})
				}else{
					jQuery("#screen-menu").hide();
					jQuery(".screen-icon").css("background","#126fc6 url(../img/icon-sprite.svg) no-repeat -33px -149px");
					isShow = true;
				}
			}
			
			//过期时间-到期时间
<%-- 			function getEndDate(){
			<%
			ResourceBundle resource = ResourceBundle.getBundle("application");
			String key =resource.getString("key.Private") ;
			String endDate = com.cesgroup.cesmonitor.common.Rsa.decrypt(key);
			%>
			jQuery("#cesFoot").html('试用版:'+"<%=endDate%>"+'到期');
			} --%>
			
			//倒计时
		window.onload=function getEndDate(){
				<%
				ResourceBundle resource = ResourceBundle.getBundle("application");
				String key =resource.getString("key.Private") ;
				String date = com.cesgroup.cesmonitor.common.Rsa.decrypt(key);
				SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
				long days = 0L;
				if(!"0".equals(date)){
					Date endDate = sdf.parse(date);
					Date day = new Date();
					long diff = endDate.getTime() - day.getTime();
					 days = diff / (1000 * 60 * 60 * 24);   
				}

				
				//long hours = (diff-days*(1000 * 60 * 60 * 24))/(1000* 60 * 60);  
				//long minutes = (diff-days*(1000 * 60 * 60 * 24)-hours*(1000* 60 * 60))/(1000* 60);  
				%>
				var flag = "<%=date%>";
				if("0"==flag){
					jQuery("#cesFoot").html('CES');
				}else{
					jQuery("#cesFoot").html('CES试用版:'+"<%=days%>"+'天后到期');
				}
			} 

</script>

</body>
</html>