
<%
/************************************************************@@
  * Program Name	: doc_view.jsp
  * Description		: /등록자/진행함/기본정보 보기
  * Author			: 기현테크
  * Create Date		: 2010.11.25
  * History			:
@@************************************************************/
%>

<%@ page contentType="text/html; charset=UTF-8"
	import="java.net.URLEncoder"
	import="kr.co.kihyun.beans.user.HttpSSOLogin"
	import="kr.co.kihyun.lang.MLong" import="kr.co.kihyun.moumi.Moumi"
	import="kr.co.kihyun.lang.Encoder" import="kr.co.kihyun.moumi.doc.MDoc"
	import="javax.jdo.PersistenceManager" import="javax.jdo.Transaction"
	import="kr.co.kihyun.beans.entity.util.*"%>
<%@page import="kr.co.kihyun.beans.entity.TotDoc"%>
<%@page import="kr.co.kihyun.beans.entity.TotDocProcess"%>

<%@ 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);
		String dirPath = URLEncoder.encode("<a href=\"/totsys/totper/mydocbox/index.html\" class=\"d11_blue\">"+Moumi.getMessageBundle().getString("moumi.message.tot_doc.myDoc")+"</a> &gt; <a href=\"/totsys/totper/mydocbox/formbox/doc_list.jsp\" class=\"d11_blue\">"+Moumi.getMessageBundle().getString("moumi.message.tot_doc.formBox")+"</a>", "UTF-8");

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

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

                //LJH
                docName=URLEncoder.encode(docName,"UTF-8");

		/*********** session setup ************/
		session.setAttribute("formConTagetURL", "/totsys/totper/mydocbox/formbox/doc_view.jsp");
%>

<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">
<link rel="stylesheet" href="/totsys/common/css/SquareButtons.css"
	type="text/css">
<script src="/totsys/common/js/rollover.js"></script>
<script type="text/javascript" src="/totsys/common/js/jquery-1.12.4.min.js"></script>
<script language="javascript">
    /*
    $(document).ready(function(){
        var text=$("#formDiv").text();
        if(text.length==1)
        {
            $("#menuButton").hide();
        }
        else $("#menuButton").show();
    });
    */
		function formContentModify(){
			location.href="/totsys/common/web/documents/form_content_modify/form_content_modify.jsp?docID=<%=docID%>&gubun=form";
		}

		function docDel(){
			var frm = document.Del;
			if(confirm('<%=Moumi.getMessageBundle().getString("moumi.message.popup.formDelete")%>')){
				frm.submit();
			}
		}

		function formView(){
			location.href="/totsys/totper/mydocbox/formbox/doc_view.jsp?docID=<%=docID%>";
		}

		function reg_use(){
			if(confirm('<%=Moumi.getMessageBundle().getString("moumi.message.popup.reuse")%>'))
				location.href="/totsys/totper/mydocbox/regbox/doc_regist.jsp?reuseDocID=<%=docID%>&reuseDocName=<%=docName%>&isFromFormBox=true";

		}

		function propertiesUpdate(){
			location.href="/totsys/totper/mydocbox/formbox/doc_form_modify.jsp?docID=<%=docID%>";
		}
	</script>
</HEAD>
<body style='' BGCOLOR="#FFFFFF" LEFTMARGIN="0" TOPMARGIN="0"
	MARGINWIDTH="0" MARGINHEIGHT="0">
<div>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<!------------------------------- top menu start ------------------------------->
	<jsp:include page="/totsys/common/inc/totper/top/top.jsp" flush="true">
		<jsp:param name="dirPath" value="<%= dirPath %>" />
	</jsp:include>
	<jsp:include page="/totsys/common/inc/title/title.jsp" flush="true" />
	<!------------------------------- top menu end ------------------------------->
</table>
</div>

<div id="header">
<ul id="primary">
	<li><span class="kecttep_menu_focous"><%=TotDocProcess.FORM%><%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.info")%></span></li>
	<li><a href="#" onclick="formContentModify();"><%=TotDocProcess.FORM%><%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.modify")%></a></li>
	<!--<li><a href="#" onclick="propertiesUpdate();"><%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.value")%><%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.modify")%></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">
            <div id="menuButton" style="display:block">
		<table border="0" cellspacing="0" cellpadding="0">
			<tr>
				<%if(sysAuth == Moumi.TOTPER){%>
				<td><a class="simplebutton" href="#" onclick="reg_use();"><span
					class="recall">서식재사용</span></a>
				</td>
				<%}%>
				<td <%if(sysAuth == Moumi.TOTPER){%> class="kecttep_button_td" <%}%>>
				<a class="simplebutton" href="#" onclick="docDel();"><span
					class="remove"><%=Moumi.getMessageBundle().getString("moumi.message.button_small.docDel")%></span></a>
				</td>
			</tr>
		</table>
            </div>
		</td>
	</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<!------------------------------- form view start ------------------------------->
	<jsp:include page="/totsys/common/inc/documents/tot_doc/form_view.jsp"
		flush="true">
		<jsp:param name="docID" value="<%= docID %>" />

	</jsp:include>
	<!------------------------------- form view end ------------------------------->
</table>

<FORM name="Del"
	action="/servlet/kr.co.kihyun.beans.totsys.doc.HttpDocDeleter"
	method="post"><INPUT type="hidden" name="docID"
	value="<%= docID %>"> <INPUT type="hidden" name="userID"
	value="<%= usID %>"> <INPUT type="hidden" name="url"
	value="<%= url %>"></FORM>
</div>
</div>
<!------------------------------- top menu start ------------------------------->
<%@ include file="/totsys/common/inc/buttom/buttom.jsp"%>
<!------------------------------- top menu end ------------------------------->
</table>
</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();
	}
%>
