<%@ include file="validate.jsp" %>
<%@ page language="java" contentType="text/html; charset=GBK"
    pageEncoding="GBK"%>
<%@ page import="cn.sendsms.jdsmsserver.web.User"%>
<%@ page import="cn.sendsms.jdsmsserver.*"%>
<%
response.setHeader("Cache-Control","no-store");
response.setHeader("Pragrma","no-cache");
response.setDateHeader("Expires",0);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript">
/*
function display(){ 
   document.getElementById("modifyPassword").style.display=document.getElementById("modifyPassword").style.display=="block"?"none":"block";
   document.getElementById("userInfoDownload").style.display=document.getElementById("userInfoDownload").style.display=="block"?"none":"block";  
}*/
</script>

<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<title>funtions</title>
<link href="css1.css?v=210812v1" type="text/css" rel="stylesheet">
<link href="skin_blue_2.css?v=210812v1" type="text/css" rel="stylesheet">
<style type="text/css">

	.multiNavBar.clearfix span{
		content:"";
		display: inline-block;
		width:32px;
		height:32px;
		background: url(img_new/down.png);
		margin-top:5px;
		margin-right:5px;
	/*	border:1px solid #f00;*/
	}
	img{
		border:none;
	}
	a{
		outline: none;
	}
</style>
</head>
<body>
<div class="logo" style="background: #0c7ea1;">
	<table border="0" width="100%" height="100%" cellpadding="0" cellspacing="0">
		<tr>
			<td rowspan="2"><img src="img/logo.png"></td>
			<td id="title" valign="bottom" >
<%	if(JDSMSServer.getInstance().getProperties().getString("settings.machine_model", "").equals("AIO")) {
		out.println(ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.menu_AIO_Title"));
	}else{
		out.println(ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.menu_Title"));
	}%>
	</td>
		</tr>
		<tr>
			<td id="subtitle" valign="top" ><%
		out.println(ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.menu_version"));
	%></td>
		</tr>
	</table>
</div>
<div id="leftNav">
<div id="leftMenu">
	<ul class="menuList">
	<!--普通菜单 -->
	<li class="menuItem"><a href="welcome.jsp" target="main"><img src="img_new/home.png"><%
		out.println(ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.menu_home"));
	%></a></li>
	<li class="menuItem" ><a href="/smsAction?action=Init" target="main"><img src="img_new/send_small.png"><%
			out.println(ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.menu_send_msg"));
		%></a></li>
	<li class="menuItem"><a href="/smsAction?action=unsentRecord&pageIndex=1" target="main"><img src="img_new/queue.png"><%
			out.println(ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.menu_usent_msg"));
		%></a></li>
	<li class="menuItem"><a href="/smsAction?action=msgRecord" target="main"><img src="img_new/record.png"><%
			out.println(ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.menu_msg"));
		%></a></li>
	<% 
		User user1=(User)session.getAttribute("user");
		if(user.getFlag() == 1 || "admin".equals(user1.getUserId()))
		{
			 if(user.getFlag() != 1){ /*getFlag()==1是有管理权限的普通用户，能配置设备和中间件，但不给他用户管理权限*/
	%>
			<li class="menuItem"><a href="/systemManager?action=userList&pageIndex=1" target="main"><img src="img_new/account.png"><%
				out.println(ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.menu_account_management1"));
			%></a></li>
			<% }
			if(!JDSMSServer.getInstance().getProperties().getString("settings.machine_model", "").equals("AIO")) {/*如果不是一体机，显示所有发送通道菜单，如果是一体机，只显示设备配置 */
			%>
		<!--【发送通道】下拉菜单 -->
		<li>
			<div class="multiNavBar clearfix"><img src="img_new/func_menu_info.png">
				<%
			out.println(ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.menu_device_settings"));
		%><span class="downTrig rotateTimer"></span></div>
			<ul class="multiItem" style="display: none;">
				<li class="menuItem subItem" >
					<a href="/device-config?action=refresh" target="main"><img src="img_new/sms_device.png"><%
						out.println(ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.menu_message_device_settings"));
					%></a></li>
					<li class="menuItem subItem">
					<a href="gatewaymain.jsp" target="main"> <img src="img_new/gateway.png"><%
						out.println(ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.menu_gateway"));
					%></a></li>
				<!-- MARK 2015.11.11-->
				<li class="menuItem subItem">
					<a href="/phoneInfoPage?action=refreshTest" target="main"><img src="img_new/phone_device.png"><%
						out.println(ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.menu_phone"));
					%></a></li>
				<!-- MARK 2019.06.03-->
				<li class="menuItem subItem">
					<a href="/loraInfoPage?action=refreshLoRa" target="main"><img src="img_new/LORA.png"><%
						out.println(ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.menu_lora_settings"));
					%></a></li>
				<!-- MARK 2019.09.05-->
				<li class="menuItem subItem">
					<a href="/nbiotInfoPage?action=refreshNbIoT" target="main"><img src="img_new/NBIOT.png"><%
						out.println(ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.menu_nbiot_settings"));
					%></a></li>
				<li class="menuItem subItem" >
				<a href="/bigdipperInfo?action=refreshBD" target="main"><img src="img_new/BeiDou.png"><%
					out.println(ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.menu_bd_settings"));
					out.println(ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.bd_using"));
					%></a></li>
			</ul>
		</li>
		<%}else{%>
			<li class="menuItem"><a href="/device-config?action=refresh" target="main"><img src="img_new/sms_device.png"><%
			out.println(ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.menu_device_settings"));
		%></a></li>		
		<%}%>
		<!--【配置与日志】下拉菜单 -->
		<li>
			<div class="multiNavBar clearfix"><img src="img_new/func_menu_conf.png"><%
			out.println(ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.menu_midware_settings"));
			%><span class="downTrig rotateTimer"></span></div>
			<ul class="multiItem" style="display: none;">
				<li class="menuItem subItem"><a href="/datasource-config?action=Init" target="main"><img src="img_new/db_config.png"><%
					out.println(ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.menu_db"));
				%></a></li>
				<li class="menuItem subItem"><a href="/system?action=Init" target="main"> <img src="img_new/settings.png"><%
					out.println(ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.menu_system_settings"));
				%></a></li>
				<li class="menuItem subItem"><a href="/log?action=init&pageIndex1=1" target="main"><img src="img_new/logs.png"><%
					out.println(ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.menu_log"));
				%></a></li>
			</ul>
		</li>
		
		<!--【地址本管理】下拉菜单 -->
		<li>
			<div class="multiNavBar clearfix"><img src="img_new/func_menu_address.png"><%
			out.println(ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.menu_address"));
			%><span class="downTrig rotateTimer"></span></div>
			<ul class="multiItem" style="display: none;">
				<li class="menuItem subItem"><a href="/addrmain.jsp?curfoldertype=public" target="main"><img src="img_new/comm_book.png"><%
					out.println(ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.menu_public_address"));
				%></a></li>
				<li class="menuItem subItem"><a href="/addrmain.jsp?curfoldertype=personal" target="main"><img src="img_new/addr_book.png"><%
					out.println(ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.menu_address1"));
				%></a></li>
						
			</ul>
		</li>
		<% 	
	}else{
	%>
		<li class="menuItem"><a href="/addrmain.jsp?curfoldertype=personal" target="main"><img src="img_new/addr_book.png"><%
				out.println(ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.menu_address1"));
		%></a></li>	
	<% 
	}
	%>
	</ul>
</div>
<div id="menuSettings">
	<ul id="settings">
	<li>
	<a href="modify-password.jsp" target="main"> <img src="img_new/password.png" title="<%
		out.println(ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.menu_modify_psw"));
	%>"></a></li>
	<li><a href="about.jsp" target="main"> <img src="img_new/about.png" title="<%
		out.println(ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.menu_about"));
	%>"></a></li>
	<li><a href="/logout" target="_top"> <img src="img_new/exit.png" title="<%
		out.println(ResourceManager.getInstance().getBykey(ResourceManager.getInstance().m_sDefault).getString("settings.menu_exit"));
	%>"></a></li>
	</ul>
</div>
</div>

<script type="text/javascript" src="js/jQuery-1.12.4.js"></script>
<script type="text/javascript" >$(function() {

	$('.multiNavBar').click(function(e) {
		$('.multiNavBar').removeClass("clicked");
		$(this).addClass("clicked");
		dropSwift($(this), '.multiItem');
		e.stopPropagation();
	});

	function dropSwift(dom, drop) {
		$('.menuItem a').css({'background':'#258faf'});
		dom.next().find('a').css({'background':'#1c7590'});
		var clickColor = dom.next().css("display");
		$('.multiNavBar').css({'background':'#258faf'});
		//点击当前元素，收起或者伸展下一级菜单	
		dom.next().slideToggle();
		//判断subMenu
		if(clickColor == "none"){
			dom.css({'background':'#33b1d8'});
		}else if(clickColor == "block"){
			dom.css({'background':'#258faf'});
		}

		dom.parent().siblings().find('.downTrig').removeClass('rotateDeg');
		//2.点击该层，将其他显示的下滑层隐藏		
		dom.parent().siblings().find(drop).slideUp();

		var iconChevron = dom.find('.downTrig');
		if(iconChevron.hasClass('rotateDeg')) {			
			iconChevron.removeClass('rotateDeg');
		} else {
			iconChevron.addClass('rotateDeg');
		}
	}
	
	$('.menuItem').click(function(){
		
		if(!($(this).hasClass('subItem'))){
			$('.multiNavBar').next().slideUp();
		}
		$(".menuItem").find('a').removeClass("clicked");
		$('.multiNavBar').css({'background':'#258faf'});
		$('.menuItem a').css({'background':'#258faf'});
		$('.menuItem.subItem a').css({'background':'#1c7590'});
		$(this).find('a').css({'background':'#33b1d8'});
		$(this).find('a').addClass("clicked");
	});

	$('.menuItem a').hover(function(){
		if($(this).hasClass("clicked")){return false;}
		$(this).css({'background':'#4ecbcd'});
	},function(){
		if($(this).hasClass("clicked")){return false;}
		if($(this).parent().hasClass("subItem")){$(this).css({'background':'#1c7590'});return false;}
		$(this).css({'background':'#258faf'});
	});
	$('.multiNavBar').hover(function(){
		if($(this).hasClass("clicked")){return false;}
		$(this).css({'background':'#4ecbcd'});
	},function(){
		if($(this).hasClass("clicked")){return false;}
		$(this).css({'background':'#258faf'});
	});

})</script>
<script type="text/javascript">
	function opens_modal(){
		$(top.window.frames['func'].document).find('body').append('<div id="modal" style="width:100%;height:100%;background:#000;opacity:0.3;position:absolute;top:0;z-index:1;filter:alpha(opacity=30)">&nbsp;</div>');
		$(top.window.frames['main'].document).find('body').append('<div id="modal" style="width:100%;height:100%;background:#000;opacity:0.3;position:absolute;top:0;z-index:1;filter:alpha(opacity=30)">&nbsp;</div>');
	}
	function close_modal(){
		$(top.window.frames['main'].document).find('#smodal').remove();
		$(top.window.frames['func'].document).find('#modal').remove();
		$(top.window.frames['main'].document).find('#modal').remove();
	}
	function msize(){
		var mwidth = top.window.document.body.clientWidth;
		var mheight = top.window.document.body.clientHeight;
		var funcwidth = top.window.func.window.document.body.clientWidth;
		var mainw = mwidth/2-funcwidth - 200;
		mainw = mainw >0 ?mainw:'0';
		var mainh = mheight/2 - 127;
		return [mainw,mainh];
	}
	function smodal(result=""){
		var ar = msize();
		var str = "";
		var fontsize = "36";
		var status = "";

		if(!result){
			result = "成功";
		}else{
			if(result.length > 5){fontsize = "24";}
		}
		// status = result.indexOf("成功") != -1 ? "modals.png":"modale.png";
		if(result.indexOf("成功") != -1 || result.indexOf("已添加") != -1 || result.indexOf("succe") != -1){
			status = "modals.png";
		}else{
			status = "modale.png";
		}
		// str = '<div id="smodal" style="width:400px;height:254px;background:#f9f9f9;border-radius:5px;position:absolute;top:'+ar[1]+'px;left:'+ar[0]+'px;z-index:1;filter:alpha(opacity=30)"><div style="width:100%;overflow:hidden;border-bottom:2px solid #e3e3e3;padding:20px 0px;"><div style="margin:0 auto;width:94px;height:94px;overflow:hidden;"><img src="w_img/modals.png" width="100%"></div><center style="margin-top:15px;font-size:36px;">成功</center></div><div onclick="top.window.func.window.close_modal();" style="width:30%;margin:0 auto;text-align:center;padding:10px 0px;margin-top:5px;margin-bottom:5px;font-size:21px;letter-spacing:1px;color:#333;cursor:pointer;">关闭</div></div>';
		// if(result){
		// 	var fontsize = "36";
		// 	if(result.length > 4){fontsize = "24";}
		// 	str = '<div id="smodal" style="width:400px;height:254px;background:#f9f9f9;border-radius:5px;position:absolute;top:'+ar[1]+'px;left:'+ar[0]+'px;z-index:1;filter:alpha(opacity=30)"><div style="width:100%;overflow:hidden;border-bottom:2px solid #e3e3e3;padding:20px 0px;"><div style="margin:0 auto;width:94px;height:94px;overflow:hidden;"><img src="w_img/modals.png" width="100%"></div><center style="margin-top:15px;font-size:'+fontsize+'px;">'+result+'</center></div><div onclick="top.window.func.window.close_modal();" style="width:30%;margin:0 auto;text-align:center;padding:10px 0px;margin-top:5px;margin-bottom:5px;font-size:21px;letter-spacing:1px;color:#333;cursor:pointer;">关闭</div></div>';
		// }
		
		str = '<div id="smodal" style="width:400px;height:254px;background:#f9f9f9;border-radius:5px;position:absolute;top:'+ar[1]+'px;left:'+ar[0]+'px;z-index:1;filter:alpha(opacity=30)"><div style="width:100%;overflow:hidden;border-bottom:2px solid #e3e3e3;padding:20px 0px;"><div style="margin:0 auto;width:94px;height:94px;overflow:hidden;"><img src="w_img/'+status+'" width="100%"></div><center style="height:40px;margin-top:15px;font-size:'+fontsize+'px !important;">'+result+'</center></div><div onclick="top.window.func.window.close_modal();" style="width:30%;margin:0 auto;text-align:center;padding:10px 0px !important;margin-top:5px !important;margin-bottom:5px;font-size:21px;letter-spacing:1px;color:#333;cursor:pointer;">关闭</div></div>';


		$(top.window.frames['main'].document).find('body').append(str);
	}

	function open_modal(result=""){
		opens_modal();
		smodal(result);
	}
	
</script>
</body>
</html>