
<%
/************************************************************@@
  * Program Name	: top.jsp
  * Description		: 시스템 관리자 탑
  * Author				: 
  * Create Date		: 
  * History				:
@@************************************************************/
%>

<%@ page contentType="text/html; charset=UTF-8"
	import="java.net.URLDecoder" import="java.util.List"
	import="javax.jdo.Extent" import="javax.jdo.PersistenceManager"
	import="javax.jdo.Query" import="kr.co.kihyun.beans.entity.*"
	import="kr.co.kihyun.beans.entity.util.*"
	import="kr.co.kihyun.beans.totsys.menu.MenuBean"
	import="kr.co.kihyun.beans.user.HttpSSOLogin"
	import="kr.co.kihyun.beans.user.User"
	import="kr.co.kihyun.lang.MInteger" import="kr.co.kihyun.moumi.MoumiConfig"
	import="kr.co.kihyun.text.html.ServletUtil"%>

<%@ include file="/totsys/common/inc/sec/secure.inc.jsp"%>

<%
PersistenceManager pm = new MPersistenceManager(PMF.get().getPersistenceManager());
try{
	/*********** User HttpSSOLogin check ***********/
	String connURL="location='/totsys/login/login.jsp';";
	if(!HttpSSOLogin.isLogin(request)){		
		out.println(ServletUtil.alert("작업시간이 종료되었습니다.\\n 다시로그인 하시기 바랍니다."));
		out.println(ServletUtil.getJavaScript(connURL));
		return;
	}

	/********** session내의 userId **********/
	String usID = HttpSSOLogin.getLoginID(request);
	String usName = HttpSSOLogin.getUserName(request);
	int sysAuth = HttpSSOLogin.getSysAuth(request);

	if(sysAuth != MoumiConfig.SUB_SYSADM && sysAuth != MoumiConfig.SYSADM){
		out.println(ServletUtil.alert("시스템권한이 충분하지 않습니다.\\n 다시로그인 하시기 바랍니다."));
		out.println(ServletUtil.getJavaScript(connURL));
		return;
	}

	MenuBean orgMenu = new MenuBean(request, "/totsys/sysadm/org/org_view.jsp");

	List<Category> categoryList = pm.getObjectById(Category.class, Category.ID_BOARD).getChildCategories();
%>

<html>
<head>
<link rel="stylesheet" href="/totsys/common/css/kecttep.css"
	type="text/css">
<link href="/totsys/common/css/style.css" rel="stylesheet"
	type="text/css">
<script src="/totsys/common/js/popup.js"></script>
<script language="javascript">
		function startFontSet(){
			for(var i=2; i<=16; i++)
				document.all["linkd"+i].style.color="#666666";
		}

		function folderCH(num){ // 폴더이미지 변경 
			//기본 이미지 셋팅
			<%if(MoumiConfig.isOnLeftMenu()){%>
			document.all["img1"].src="/totsys/common/images/ft.gif";
			<%}%>
			document.all["img3"].src="/totsys/common/images/folder.gif";
			document.all["img4"].src="/totsys/common/images/folder.gif";
			document.all["img6"].src="/totsys/common/images/folder.gif";
			document.all["img7"].src="/totsys/common/images/folder.gif";
			document.all["img8"].src="/totsys/common/images/folder.gif";
			document.all["img9"].src="/totsys/common/images/folder.gif";
			document.all["img11"].src="/totsys/common/images/folder.gif";
			document.all["img12"].src="/totsys/common/images/folder.gif";
			document.all["img13"].src="/totsys/common/images/folder.gif";
			document.all["img14"].src="/totsys/common/images/folder.gif";
			document.all["img15"].src="/totsys/common/images/folder.gif";
			document.all["img16"].src="/totsys/common/images/folder.gif";
			//document.all["img17"].src="/totsys/common/images/folder.gif";
			
			if(num == 1)
			{
				<%if(MoumiConfig.isOnLeftMenu()){%>
				document.all["img1"].src="/totsys/common/images/aft.gif";
				<%}%>
			}
			else
			{
				document.all["img"+num].src="/totsys/common/images/afolder.gif";
			}
		}
	
		function colorCH(num){
			<%if(MoumiConfig.isOnLeftMenu()){%>
			for(var i=1; i<=16; i++){ // 총갯수
			<%}else{%>
			for(var i=2; i<=16; i++){ // 총갯수
			<%}%>
				document.all["linkd"+i].style.color="#666666";
			}
			document.all["linkd"+num].style.color="#4892db";
	
		}
	        
		function bluring(){
			if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG")      
				document.body.focus();      
		}
		document.onfocusin=bluring; 
		
		function swapImg(num){	
			var tmp=document.all["img"+num].src;
			var tmp2= tmp.split("/");
	
			if((tmp2[(tmp2.length)-1]) == "leftmenu_topicon1.gif"){
				document.all["img"+num].src="/totsys/common/images/leftmenu_topicon1.gif";
			}else{
				document.all["img"+num].src="/totsys/common/images/leftmenu_topicon1.gif";
			}
	
			for(var i=1; i<=4; i++){
				if(num != i){
					document.all["img"+i].src="/totsys/common/images/leftmenu_topicon1.gif";
				}	
			}
		}
	
		function openMain(){
			open("/totsys/sysadm/main.jsp","main");	
		}
	</script>
</head>
<body bgcolor="#ffffff" topmargin=0 leftmargin=0 marginwidth=0
	marginheight=0 onload="openMain();startFontSet();">
<!--바디 bg컬러 하늘색은 #ebf4fb 였음-->
<div id="board" style="display: '';">
<table border=0 cellpadding=0 cellspacing=0>
	<tr style="padding-left: 10px">
		<td><span class="f_12_p_Black_L"><a id="linkd2"
			target="main" onclick="openMain();"><img
			src="images/main_img_03.gif" border="0" align="middle" id="img2"></a></span>
		</td>
	</tr>

	<!-- 게시판관리 서브메뉴 -->
	<% for(Category boardCategory : categoryList) { %>
	<tr style="padding-left: 20px; padding-top: 14px">
		<td valign="top"><img src="/totsys/common/images/folder.gif"
			border="0" align="absmiddle" id="img4"> <span
			class="f_12_p_Black_L"><a id="linkd4"
			onclick="colorCH(4); folderCH(4);"
			href="/totsys/sysadm/board/board_list.jsp?boardGroupID=<%= boardCategory.getId() %>"
			target="main"><%= boardCategory.getName() %></a></span></td>
	</tr>
	<tr style="padding-top: 0.5px; padding-left: 10px">
		<td align="center"><img
			src="/totsys/common/inc/totper/left/images/under_line.gif"
			width="130"></td>
	</tr>
	<% } %>
	<!-- 게시판관리 서브메뉴 끝 -->
</table>
</div>

<div id="documents" style="display: none;">
<table border=0 cellpadding=0 cellspacing=0>
	<tr style="padding-left: 10px">
		<td><span class="f_12_p_Black_L"><a id="linkd5"
			target="main" onclick="openMain();"> <img
			src="images/left_document.gif" border="0" align="absmiddle" id="img5"><!--문서관리--></a></span>
		</td>
	</tr>
	<!-- 문서관리 서브메뉴 -->
	<tr style="padding-left: 20px; padding-top: 21px">
		<td valign="top"><img src="/totsys/common/images/folder.gif"
			border="0" align="absmiddle" id="img6"> <span
			class="f_12_p_Black_L"><a id="linkd6"
			onclick="colorCH(6); folderCH(6);"
			href="/totsys/sysadm/prssbox/doc_list.jsp" target="main">진행함</a></span></td>
	</tr>

	<tr style="padding-top: 0.5px; padding-left: 10px">
		<td align="center"><img
			src="/totsys/common/inc/totper/left/images/under_line.gif"
			width="130"></td>
	</tr>

	<tr style="padding-left: 20px; padding-top: 14px">
		<td valign="top"><img src="/totsys/common/images/folder.gif"
			border="0" align="absmiddle" id="img7"> <span
			class="f_12_p_Black_L"><a id="linkd7"
			onclick="colorCH(7); folderCH(7);"
			href="/totsys/sysadm/endbox/doc_list.jsp" target="main">종료함</a></span></td>
	</tr>
	<tr style="padding-top: 0.5px; padding-left: 10px">
		<td align="center"><img
			src="/totsys/common/inc/totper/left/images/under_line.gif"
			width="130"></td>
	</tr>
	<tr tr style="padding-left: 20px; padding-top: 14px">
		<td valign="top"><img src="/totsys/common/images/folder.gif"
			border="0" align="absmiddle" id="img8"> <span
			class="f_12_p_Black_L"><a id="linkd8"
			onclick="colorCH(8); folderCH(8);"
			href="/totsys/sysadm/formbox/doc_list.jsp" target="main">양식함</a></span></td>
	</tr>
	<tr style="padding-top: 0.5px; padding-left: 10px">
		<td align="center"><img
			src="/totsys/common/inc/totper/left/images/under_line.gif"
			width="130"></td>
	</tr>
</table>
</div>
<!-- 문서관리 서브메뉴 끝 -->

<div id="stats" style="display: none;">
<table border=0 cellpadding=0 cellspacing=0>
	<tr style="padding-left: 10px">
		<td valign="middle"><img src="images/left_doc_check.gif"
			border="0" align="absmiddle" onclick="openMain();"></td>
	</tr>
	<tr style="padding-left: 20px; padding-top: 21px">
		<td valign="top"><img src="/totsys/common/images/folder.gif"
			border="0" id="img9"> <span class="f_12_p_Black_L"><a
			id="linkd9" onclick="colorCH(9); folderCH(9);"
			href="/totsys/sysadm/stat/doc_check.jsp" target="main">문서통계</a></span></td>
	</tr>
	<tr style="padding-top: 0.5px; padding-left: 10px">
		<td align="center"><img
			src="/totsys/common/inc/totper/left/images/under_line.gif"
			width="130"></td>
	</tr>
</table>
</div>

<div id="group" style="display: none;">
<table border=0 cellpadding=0 cellspacing=0>
	<tr style="padding-left: 10px">
		<td valign="top"><span class="f_12_p_Black_L"><a
			id="linkd10" target="main" onclick="openMain();"><img
			src="images/left_user.gif" border="0" align="absmiddle" id="img10"><!--조직관리--></a></span>
		</td>
	</tr>
	<!-- 조직관리 서브메뉴 -->
	<tr style="padding-left: 20px; padding-top: 21px">
		<td valign="top"><img src="/totsys/common/images/folder.gif"
			border="0" align="middle" id="img11"> <span
			class="f_12_p_Black_L"><a id="linkd11"
			onclick="colorCH(11); folderCH(11);" href="<%= orgMenu.getUrl() %>"
			target="main"><%= orgMenu %></a></span></td>
	</tr>
	<tr style="padding-top: 0.5px; padding-left: 10px">
		<td align="center"><img
			src="/totsys/common/inc/totper/left/images/under_line.gif"
			width="130"></td>
	</tr>
</table>
</div>
<div id="usergroup" style="display: none;">
<table border=0 cellpadding=0 cellspacing=0>
	<!-- 조직관리 서브메뉴 끝 -->
	<tr style="padding-left: 10px">
		<td valign="middle"><img src="images/left_group.gif" border="0"
			align="middle" onclick="openMain();"></td>
	</tr>
	<tr style="padding-left: 20px; padding-top: 21px">
		<td valign="top"><img src="/totsys/common/images/folder.gif"
			border="0" id="img14"> <span class="f_12_p_Black_L"><a
			id="linkd14" onclick="colorCH(14); folderCH(14);"
			href="/totsys/login/envsetting/group/admin_group_setup.jsp"
			target="main">사용자그룹설정</a></span></td>
	</tr>
	<tr style="padding-top: 0.5px; padding-left: 10px">
		<td align="center"><img
			src="/totsys/common/inc/totper/left/images/under_line.gif"
			width="130"></td>
	</tr>
</table>
</div>
</body>
</html>

<%
}catch(Exception ex){
	ex.printStackTrace();
	out.println(kr.co.kihyun.text.html.ServletUtil.getJavaScript("location='/servlet/kr.co.kihyun.beans.user.HttpSSOLogin?mode=logout';"));
}finally{
	pm.close();
}
%>
