
<%
/************************************************************@@
  * 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.moumi.doc.MDoc"
	import="kr.co.kihyun.moumi.report.MReport"
	import="kr.co.kihyun.beans.totsys.menu.MenuBean"
	import="kr.co.kihyun.beans.totsys.report.Report"
	import="kr.co.kihyun.lang.MString" import="kr.co.kihyun.lang.MLong"
	import="java.net.URLDecoder" import="javax.jdo.PersistenceManager"
	import="javax.jdo.Transaction"
	import="kr.co.kihyun.beans.entity.util.*"%>

<%@ 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);
	String dtID = HttpSSOLogin.getDeptID(request);

	/****** Parameter ******/
	Long docID = MLong.parseLong(request.getParameter("docID"),null);
	Long deptID = MLong.parseLong(request.getParameter("deptID"),null);
	String url = "prss";

	TotDoc totDoc = null;
	totDoc = docID == null ? null : pm.getObjectById(TotDoc.class, docID);
	String docName = totDoc.getName();

	tx.begin();

	String regID = totDoc.getMasterTotDoc().getUser(pm).getId();

	tx.rollback();

	Report report = new Report();
	Long downDocID = report.getDownDocID(docID, dtID);

	int allReportCount = report.getAllCount(docID);
	int sendReportCount = report.getSendCount(docID);

	MenuBean modifyMenu = new MenuBean(request, "/totsys/totper/mydocbox/prssbox/doc_modify.jsp?docID="+docID);
	MenuBean reportsMenu = new MenuBean(request, "/totsys/totper/mydocbox/prssbox/reports/report_list.jsp?docID="+docID);
	MenuBean totReportsMenu = new MenuBean(request, "/totsys/totper/mydocbox/prssbox/tot_reports/total_reports.jsp?docID="+docID);
	MenuBean totReportMenu = new MenuBean(request, "/totsys/totper/mydocbox/prssbox/tot_report/total_report.jsp?docID="+docID);
	%>


<%@page import="kr.co.kihyun.beans.entity.TotDoc"%><HTML>
<HEAD>
<TITLE><%=Moumi.getTitle()%></TITLE>
<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 cancle(){
				var downDocIDCheck="<%=downDocID%>";
				if(downDocIDCheck==null || downDocIDCheck=="" || downDocIDCheck=="null"){
					if("<%=regID%>" == "<%=usID%>"){
						var frm = document.docCancle;
						if(confirm('집계 진행중인 문서를 취소합니다.\n\n취소문서는 종료함에서 재진행 할 수 있습니다.\n\n계속 진행하시겠습니까?')){
							frm.submit();
						}
					}else{
						alert("자신이 등록한 문서만 취소가 가능합니다.");
					}
				}else{
					alert("연계등록된 문서가 1개 이상 존재하여 취소할 수 없습니다.\n\n연계등록한 제출부서에 문서 삭제를 요청 후 다시 시도하십시오.");
				}
			}
	
			function modify(){
				if("<%=regID%>" == "<%=usID%>"){
					location.href="<%= modifyMenu.getUrl() %>";
				}else{
					alert("자신이 등록한 문서만 정보수정이 가능합니다.");
				}
			}
	
			//function endDoc(docID){
			function endDoc(){
			  var check = confirm("문서를 종료하시겠습니까?")
			  if(check == true){
				 // document.dform.docID.value = docID;
			      document.dform.userID.value = "<%=usID%>";
				  document.dform.submit();
			  }else{
				  return;
			     }
			}
	
			function leftAnc(){
				top.frames['left'].div1.style.display="none";//이 부분
				top.frames['left'].div2.style.display="block";
				top.frames['left'].div3.style.display="none";
				top.frames['left'].div4.style.display="none";
				top.frames['left'].div5.style.display="none";
				for(var i=1; i<=19; i++){
					top.frames['left'].document.all["link"+i].style.fontWeight="";
				}
				top.frames['left'].link7.style.fontWeight="bold"//이 부분
		
				for(var i=1; i<=4; i++){
					top.frames['left'].document.all["img"+i].src="images/leftmenu_topicon1.gif";
				}
				top.frames['left'].img2.src="images/leftmenu_topicon0.gif";//이 부분
		
			}
			
			function autoMove(){
				location.href = "/totsys/totper/mydocbox/prssbox/doc_modify.jsp?docID=<%= docID %>";
			}
		</script>
</HEAD>

<body style='' BGCOLOR="#FFFFFF" LEFTMARGIN="0" TOPMARGIN="0"
	MARGINWIDTH="0" MARGINHEIGHT="0">
<FORM name="docCancle"
	action="/servlet/kr.co.kihyun.beans.totsys.totper.HttpDocCancle"
	method="post"><INPUT type="hidden" name="docID"
	value="<%= docID %>"> <INPUT type="hidden" name="userID"
	value="<%= usID %>"></FORM>
<Form name="dform" method="post"
	action="/servlet/kr.co.kihyun.beans.totsys.totper.HttpDocEnd"><INPUT
	type="hidden" name="docID" value="<%= docID %>"> <INPUT
	type="hidden" name="userID" value="<%= usID %>"></Form>

<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><span class="kecttep_menu_focous"><%= modifyMenu %></span></li>
	<li><a href="<%= reportsMenu.getUrl() %>"><%= reportsMenu %></a></li>
	<li><a href="<%= totReportsMenu.getUrl() %>"><%= totReportsMenu %></a></li>
	<li><a href="<%= totReportMenu.getUrl() %>"><%= totReportMenu %></a></li>
</ul>
</div>

<div id="main">
<div id="contents">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr class="toolbar">
		<td align="left">
		<table>
			<tr>
				<td><a href="#" onclick="modify()"><img
					src="images/bt_doc_modify.gif" border="0" style="cursor: hand"></a>
				<a href="#" onclick="javascript:cancle();"><img
					src="/totsys/common/images/bt_tot_cancel.gif" border="0"></a> <a
					href="#" onClick="endDoc()"><img src="images/bt_tot_end.gif"
					border="0" style="cursor: hand"></a></td>
			</tr>
		</table>
		</td>
	</tr>

	<tr>
		<!---- 내용---->
		<td height="31" valign="top">
		<table width="100%" border="0" cellspacing="0" cellpadding="0">

			<tr nowrap height="10">
				<td height="10"></td>
				<td></td>
				<td></td>
				<td></td>
			</tr>

			<!------------------------------- 문서 기본정보 시작 ------------------------------->
			<jsp:include
				page="/totsys/common/inc/documents/tot_doc/totper_base_info.jsp"
				flush="true">
				<jsp:param name="docID" value="<%= docID %>" />
				<jsp:param name="deptID" value="<%= deptID %>" />
			</jsp:include>
			<!------------------------------- 문서 기본정보 끝 ------------------------------->

			<!--tr>
									<td height="20"></td>
								</tr>
								<!------------------------------- 선택부서/기관 시작 ------------------------------->
			<!--jsp:include page="/totsys/common/inc/documents/tot_doc/totper_selected_info.jsp" flush="true">
									<!--jsp:param name="docID" value="<%= docID %>"/>
									<!--jsp:param name="deptID" value="<%= deptID %>"/>
								<!--/jsp:include>
								<!------------------------------- 선택부서/기관 끝 ------------------------------->

			<tr>
				<td height="20"></td>
			</tr>

			<!------------------------------- 입력시 주의사항 목록 시작 ------------------------------->
			<%
								session.setAttribute("writeTargetURI","opener.location='/totsys/totper/mydocbox/prssbox/doc_view.jsp?docID="+docID+"'");
								session.setAttribute("delTargetURI","opener.location='/totsys/totper/mydocbox/prssbox/doc_view.jsp?docID="+docID+"'");
								session.setAttribute("modifyTargetURI","parent.opener.opener.location.replace('/totsys/totper/mydocbox/prssbox/doc_view.jsp?docID="+docID+"')");
								%>
			<jsp:include page="/totsys/common/inc/board/doc/list2.jsp"
				flush="true">
				<jsp:param name="docID" value="<%= docID %>" />
				<jsp:param name="url" value="<%= url %>" />
			</jsp:include>
			<!------------------------------- 입력시 주의사항 목록 끝 ------------------------------->
		</table>
		</td>
	</tr>
</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';"));
}finally{
	if(tx.isActive())
		tx.rollback();
	pm.close();
}
%>
