<%    /**
     * **********************************************************@@ Program Name
     * : doc_list.jsp Description	: /집계자/내문서함/등록함/문서 목록 Author	: 기현테크 Create
     * Date	: 2010.11.27 History	:
     * @@***********************************************************
     */
%>

<%@ page contentType="text/html; charset=UTF-8"
         import="java.net.URLDecoder" import="kr.co.kihyun.lang.MString"
         import="kr.co.kihyun.lang.MLong"
         import="kr.co.kihyun.text.html.HtmlUtil"
         import="kr.co.kihyun.lang.StringConverter"
         import="kr.co.kihyun.text.html.ServletUtil"
         import="kr.co.kihyun.text.html.TagFilter"
         import="kr.co.kihyun.beans.user.HttpSSOLogin"
         import="kr.co.kihyun.moumi.Moumi"
         import="kr.co.kihyun.moumi.report.MReport"
         import="kr.co.kihyun.beans.user.Dept"
         import="kr.co.kihyun.beans.user.UserView"
         import="kr.co.kihyun.beans.totsys.report.Report"
         import="kr.co.kihyun.beans.totsys.report.ReportView"
         import="kr.co.kihyun.beans.totsys.report.ReportViewManager"
         import="javax.jdo.PersistenceManager" import="javax.jdo.Transaction"
         import="kr.co.kihyun.beans.entity.util.*"
         import="kr.co.kihyun.beans.entity.*"%>
<%@ include file="/totsys/common/inc/sec/secure.inc.jsp"%>
<%
    PersistenceManager pm = new MPersistenceManager(PMF.get().getPersistenceManager());
    Transaction tx = pm.currentTransaction();
    try {
    	String report =null;
        String docName =null;
        Long reportID = MLong.parseLong(request.getParameter("reportID"), null);
   		/*
           TotReport totReport = pm.getObjectById(TotReport.class, reportID);
           tx.begin();
           ReportViewManager reportViewManager = new ReportViewManager(totReport.getTotDoc());
           reportViewManager.setReportData(totReport.getDept(pm).getId(), totReport.getUser(pm).getId());

           tx.rollback();

           docName = reportViewManager.getDocName();

           report = reportViewManager.getReport();
           String savePath = Moumi.getRepoPerRoot().getPath() + "/fileUpload";//// 업로드된 파일의 임시 저장 경로


        if (report == null) {
            out.println(ServletUtil.alert(Moumi.getMessageBundle().getString("moumi.message.popup.notReportDoc")));
            out.println(ServletUtil.getJavaScript("history.go(-1);"));
            return;
        }
           */
%>
<html>
    <head>
        <title><%=docName%></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/SquareButtons.css" type="text/css">
        <script type="text/javascript" src="/totsys/common/js/jquery-1.12.4.min.js"></script>
        <style>
            body {
                text-align: center;
            }
            #contents {
                size: portrait;
                width: 210mm;
                height: 297mm;
                padding: 20mm 30mm;
                zoom: 35%;
                border: solid 1px black;
            }
        </style>
        <script type="text/javascript">
            function printPage() {
                document.getElementById("header").style.display = "none";
                document.getElementById("footer").style.display = "none";
                document.getElementById("contents").style.border = "0";
                document.getElementById("contents").style.padding = "0";
                document.getElementById("contents").style.zoom = "100%";
                window.print();
                window.close();
            }
            //인쇄시 부모창에서 html 가져옴 표 테두리 추가
            $(function(){
            	var ttl=opener.$('.trail').text();
            	ttl=$.trim(ttl);
            	ttl=ttl.substring(ttl.indexOf('/')+1);
            	ttl=$.trim(ttl);
            	document.title=ttl;
            	$('h3:first').text(ttl);
            	var infohtml=opener.$('.kecttep_list_table:first')[0].outerHTML;
            	$('#header').html(infohtml);
            	var dochtml=opener.$('#formDiv').html();
            	if($.trim(dochtml)==''||!dochtml){
            		alert('인쇄할 내용이 없습니다.');
            		window.close();
            	}else{
            		$('#contents').html(dochtml);
                	$('#contents td').css('border','1px solid black');
            	}
            });
        </script>
    </head>
    <body>
        <h3></h3>
        <div id="header">
            <%--
            <table>
                <jsp:include page="/totsys/common/inc/totper/tot_repoper.jsp" flush="true">
                    <jsp:param name="reportID" value="<%= reportID%>" />
                </jsp:include>
            </table>
            --%>
            <hr/>
        </div>
        <div id="contents">
        <%--
        <%= TagFilter.borderFilter(report.replaceAll("<td", "<td style='word-break:break-all;' "))%>
         --%>
        </div>
        <div id="footer">
            <hr />
            <a href="#" onclick="printPage();">
                <img src="/totsys/common/images/bt_print2.gif" border="0" alt="<%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.print")%>" />
            </a>
            <a href="#" onclick="window.close();">
                <img src="/totsys/common/images/bt_cancle.gif" border="0" alt="<%=Moumi.getMessageBundle().getString("moumi.message.tot_doc.cancel")%>" />
            </a>
        </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 {
        if (tx.isActive()) {
            tx.rollback();
        }
        pm.close();
    }
%>
