
<%@page import="javax.jdo.Transaction"%>
<%
/************************************************************@@
  * Program Name	: doc_view.jsp
  * Description		: /집계자/내문서함/진행함/집계표
  * Author				: 강원중
  * Create Date		: 2004.10.11
  * History				:
@@************************************************************/
%>
<%@ page contentType="text/html; charset=UTF-8"
	import="java.net.URLEncoder"
	import="kr.co.kihyun.beans.user.HttpSSOLogin"
	import="kr.co.kihyun.moumi.Moumi"
    import="kr.co.kihyun.lang.Encoder"
	import="kr.co.kihyun.moumi.doc.MDoc"
	import="kr.co.kihyun.beans.totsys.menu.MenuBean"%>
<%@page import="kr.co.kihyun.beans.entity.TotDoc"%>
<%@page import="kr.co.kihyun.beans.entity.TotDocProcess"%>
<%@page import="kr.co.kihyun.beans.entity.TotDocType"%>
<%@page import="javax.jdo.PersistenceManager"%>

<%@page import="kr.co.kihyun.beans.entity.util.*"%>
<%@page import="kr.co.kihyun.lang.MLong"%>

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

<%
PersistenceManager pm = new MPersistenceManager(PMF.get().getPersistenceManager());
Transaction tx = pm.currentTransaction();
try{
	/********** session내의 userId **********/
	String usID = HttpSSOLogin.getLoginID(request);
	int sysAuth = HttpSSOLogin.getSysAuth(request);
	/****** Parameter ******/
	Long docID = MLong.parseLong(request.getParameter("docID"),null);
	Long deptID = MLong.parseLong(request.getParameter("deptID"),null);
	String docType = clearXSS(request.getParameter("docType"),null);

	TotDoc totDoc = pm.getObjectById(TotDoc.class, docID);
	String regID = totDoc.getUser(pm).getId();
	String docName = totDoc.getName();
	
	MenuBean modifyMenu = new MenuBean(request, "/totsys/totper/mydocbox/prssbox/doc_modify.jsp?docID="+docID+"&docType="+docType);
	MenuBean reportsMenu = new MenuBean(request, "/totsys/totper/mydocbox/prssbox/reports/report_list.jsp?docID="+docID+"&docType="+docType);
	MenuBean totReportsMenu = new MenuBean(request, "/totsys/totper/mydocbox/prssbox/tot_reports/total_reports.jsp?docID="+docID+"&docType="+docType);
	MenuBean totReportMenu = new MenuBean(request, "/totsys/totper/mydocbox/prssbox/tot_report/total_report.jsp?docID="+docID+"&docType="+docType);
%>

<HTML>
<HEAD>
<TITLE><%=Moumi.getTitle()%></TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<link rel="stylesheet" href="/totsys/common/css/text.css"
	type="text/css">
<link rel="stylesheet" href="/totsys/common/css/kecttep.css"
	type="text/css">
<link rel="stylesheet" href="/totsys/common/css/tabs.css"
	type="text/css">
<script src="/totsys/common/js/rollover.js"></script>
<script language="javascript">
	    function modify(){
			if("<%=regID%>" == "<%=usID%>" || <%=sysAuth%> == "<%=Moumi.SYSADM%>"){
				location.href="<%= modifyMenu.getUrl() %>";
			}else{
				alert("자신이 등록한 <%=Moumi.getMessageBundle().getString("moumi.message.doc")%>만 정보수정이 가능합니다.");
			}
		}
		</script>
            <script language="java">
                alert("total reports");
                </script>
</HEAD>
<body style='' BGCOLOR="#FFFFFF" LEFTMARGIN="0" TOPMARGIN="0"
	MARGINWIDTH="0" MARGINHEIGHT="0">
<div>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<jsp:include page="/totsys/common/inc/totper/top/top.jsp" flush="true" />
	<jsp:include page="/totsys/common/inc/title/title.jsp" flush="true" />
</table>
</div>

<div id="header">
<ul id="primary">
	<li><a href="#" onclick="modify();"><%= modifyMenu %></a></li>
	<li><a href="<%= reportsMenu.getUrl() %>"><%= reportsMenu %></a></li>
	<li><a href="<%= totReportsMenu.getUrl() %>"><%= totReportsMenu %></a></li>
	<!--li><span class="kecttep_menu_focous"><%= totReportMenu %></span></li-->
</ul>
</div>

<div id="main">
<div id="contents">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<jsp:include page="/totsys/common/inc/documents/tot_reports/total_reports.jsp" flush="true">
		<jsp:param name="docID" value="<%= docID %>" />
		<jsp:param name="deptID" value="<%= deptID%>" />
		<jsp:param name="docType" value="<%= docType%>" />
	</jsp:include>
</table>
</div>
</div>

<!------------------------------- top menu start ------------------------------->
<%@ include file="/totsys/common/inc/buttom/buttom.jsp"%>
<!------------------------------- top menu end ------------------------------->
</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';"));
	out.println(kr.co.kihyun.text.html.ServletUtil.getJavaScript("alert('해당"+Moumi.getMessageBundle().getString("moumi.message.doc")+"의 오류가 있습니다. 관리자에게 문의 해주십시요');"));
	out.println(kr.co.kihyun.text.html.ServletUtil.getJavaScript("location='/totsys/totper/main.jsp';"));
}finally{
	if (tx.isActive())
	tx.rollback();
	pm.close();
}
%>
