<%@page import="com.zky.util.jdbc.JDBCUtils"%>
<%@page import="com.zky.zhyw.smtj.Jdbc"%>
<%@page import="com.zky.zhyw.smsj.WorkDB"%>
<%@page import="com.zky.util.jdbc.HashFmlBufResultSetHandler"%>
<%@page import="com.zky.util.PageQuery"%>
<%@page import="java.sql.Connection"%>
<%@ page import="com.zky.pub.*"%>
<%@ page import="com.zky.manager.*"%>
<%@ page import="java.util.*"%>
<%@ page language="java" contentType="text/html;charset=utf-8"%>
<jsp:useBean id="getPara" scope="application" class="com.zky.para.SyncPara"/>
<%
    String ls_url1 = "",outstr1 = "";
    Login login_obj = (Login)session.getAttribute("login");
    //验证session是否过期
    if(login_obj == null) {
        ls_url1 = "/error.jsp?errorinfo=" + "<table><tr><td><font size='3' color='red'>"+Common.toGb("您尚未登录或已经过期!")+"</font></td></tr><tr><td align='center'> <a href='/login.jsp' target='_parent'>"+Common.toGb("重新登录")+"</a></td></tr></table>";
        //outstr1 = new String(ls_url1.getBytes("gb2312"),"iso8859-1");
        outstr1 = Common.GbConvertIso(ls_url1);
        response.sendRedirect(outstr1);
        return;
    }
    //验证口令是否验证通过
    if(login_obj.checkPasstag() == false) {
        ls_url1 = "/error.jsp?errorinfo=" + Common.toGb("您没有成功登录!")+"<br> <a href='/login.jsp' target='_parent'>"+Common.toGb("重新登录")+"</a>";
        //outstr1 = new String(ls_url1.getBytes("gb2312"),"iso8859-1");
        outstr1 = Common.GbConvertIso(ls_url1);
        response.sendRedirect(outstr1);
        return;
    }
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> 
<meta http-equiv="X-UA-Compatible" content="IE=7" /> 
<meta http-equiv="X-UA-Compatible" content="IE=6" />
<meta http-equiv="X-UA-Compatible" content="IE=5" />  
<title>管理页面</title>
<script src="js/prototype.lite.js" type="text/javascript"></script>
<script src="js/moo.fx.js" type="text/javascript"></script>
<script src="js/moo.fx.pack.js" type="text/javascript"></script>

<style>
body {
	font:12px Arial, Helvetica, sans-serif;
	color: #000;
	background-color: #EEF2FB;
	margin: 0px;
	width: 182px;
}
#container {
	width: 182px;
}
H1 {
	font-size: 12px;
	margin: 0px;
	width: 182px;
	cursor: pointer;
	height: 30px;
	line-height: 20px;	
}
H1 a {
	display: block;
	width: 182px;
	color: #000;
	height: 30px;
	text-decoration: none;
	moz-outline-style: none;
	background-image: url(images/menu_bgs.gif);
	background-repeat: no-repeat;
	line-height: 30px;
	text-align: center;
	margin: 0px;
	padding: 0px;
}
.content{
	width: 182px;
	height: 16px;
	
}
.MM ul {
	list-style-type: none;
	margin: 0px;
	padding: 0px;
	display: block;
}
.MM  li {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	line-height: 26px;
	color: #333333;
	list-style-type: none;
	display: block;
	text-decoration: none;
	height: 26px;
	width: 182px;
	padding-left: 0px;
text-align:center; 
}
.MM {
	width: 182px;
	margin: 0px;
	padding: 0px;
	left: 0px;
	top: 0px;
	right: 0px;
	bottom: 0px;
	clip: rect(0px,0px,0px,0px);
}
.MM a:link {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	line-height: 26px;
	color: #333333;
	background-image: url(images/menu_bg1.gif);
	background-repeat: no-repeat;
	height: 26px;
	width: 182px;
	display: block;
	text-align: center;
	margin: 0px;
	padding: 0px;
	overflow: hidden;
	text-decoration: none;
}
.MM a:visited {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	line-height: 26px;
	color: #333333;
	background-image: url(images/menu_bg1.gif);
	background-repeat: no-repeat;
	display: block;
	text-align: center;
	margin: 0px;
	padding: 0px;
	height: 26px;
	width: 182px;
	text-decoration: none;
}
.MM a:active {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	line-height: 26px;
	color: #333333;
	background-image: url(images/menu_bg1.gif);
	background-repeat: no-repeat;
	height: 26px;
	width: 182px;
	display: block;
	text-align: center;
	margin: 0px;
	padding: 0px;
	overflow: hidden;
	text-decoration: none;
}
.MM a:hover {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	line-height: 26px;
	font-weight: bold;
	color: #006600;
	background-image: url(images/menu_bg2.gif);
	background-repeat: no-repeat;
	text-align: center;
	display: block;
	margin: 0px;
	padding: 0px;
	height: 26px;
	width: 182px;
	text-decoration: none;
}
</style>
</head>

<body>
<% 
Connection conn = null;
conn =DbConn.getConn();
String frameworkid = login_obj.frameworkid;
String departid = login_obj.departid;
String empid = login_obj.optrid;
String sql3 = "select a.empid,e.empname,a.departid,b.jobcode,b.jobname from tab_employee e,tab_empdept a,tab_job b where e.empid=a.empid and a.jobcode=b.jobcode  and e.empstate='1' and b.frameworkid="+frameworkid+" and a.departid="+departid+" and a.empid='"+empid+"' order by b.jobname,e.empname";
HashFmlBuf buf3=(HashFmlBuf)JDBCUtils.query(conn,sql3.toString(),new HashFmlBufResultSetHandler());
request.setAttribute("buf3",buf3);	
String jobcode="";
if (buf3 != null) {
	
	for (int i=0; i<buf3.getRowCount(); i++) {
		jobcode = buf3.fget("jobcode",i);
	}
}
   StringBuffer sql = new StringBuffer("SELECT t1.menuname ,t2.jobcode FROM tab_menuitem t1  LEFT JOIN tab_jobmenu t2 ON t1.menuitem=t2.menuitem  WHERE t1.menulevel='1'")
   .append("and t2.jobcode="+"'"+jobcode+"'");
   HashFmlBuf buf=(HashFmlBuf)JDBCUtils.query(conn,sql.toString(),new HashFmlBufResultSetHandler());
   request.setAttribute("buf",buf);			
%>
<table width="100%"  height="280" border="0" cellpadding="0" cellspacing="0" bgcolor="#EEF2FB">
  <tr>
    <td width="182" valign="top"><div id="container">
    <%
    for(int i=0;i<buf.getRowCount();i++){
    %>
      <h1 class="type"><a href="javascript:void(0)"><%=buf.fget("menuname",i) %></a></h1>
      <div class="content">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td align="left"><img src="images/menu_topline.gif" width="182" height="5" /></td>
          </tr>
        </table>
            <%
            String tempEmpid = buf.fget("menuname",i);
               StringBuffer sql1 = new StringBuffer("SELECT t2.menuname,t4.web_workobject FROM tab_menu t1 LEFT JOIN tab_menuitem t2 ON t1.submenuid=t2.uplevel LEFT JOIN tab_jobmenu t3 ON t2.menuitem=t3.menuitem  LEFT JOIN tab_funcmodu t4 ON t2.menuid=t4.funcmoducode WHERE  t2.menulevel='2'")  
              .append("and t1.submenuname="+"'"+tempEmpid+"' and t3.jobcode="+"'"+jobcode+"'");
               HashFmlBuf buf1=(HashFmlBuf)JDBCUtils.query(conn,sql1.toString(),new HashFmlBufResultSetHandler());
               request.setAttribute("buf1",buf1);		
             %>
             <%
             for(int j=0;j<buf1.getRowCount();j++){
 				//加入登陆日志
             %>
        <ul class="MM">
          <li>
                  <a target="c_main"   onClick="javascript:top.myTab.Cts('<%=buf1.fget("menuname", j) %>','<%=buf1.fget("web_workobject", j) %>')"
                    style="cursor: hand;" ><%=buf1.fget("menuname", j) %></a>
          </li>
        </ul>
        <%} %>
      </div>
      <%} %>
        <script type="text/javascript">
		var contents = document.getElementsByClassName('content');
		var toggles = document.getElementsByClassName('type');
	
		var myAccordion = new fx.Accordion(
			toggles, contents, {opacity: true, duration: 400}
		);
	</script>
        </td>
  </tr>
</table>
</body>
</html>