<%@ page contentType="text/html; charset=UTF-8"
         import="kr.co.kihyun.beans.entity.Category"
         import="kr.co.kihyun.beans.user.HttpSSOLogin"
         import="kr.co.kihyun.text.html.ServletUtil"
         import="kr.co.kihyun.moumi.Moumi" import="kr.co.kihyun.lang.Encoder"
         import="kr.co.kihyun.lang.MInteger" import="java.net.URLEncoder"
         import="java.net.URLDecoder" import="kr.co.kihyun.lang.MString"%>

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

<%
            try {
                /*********** User HttpSSOLogin check ***********/
                if (!HttpSSOLogin.isLogin(request)) {
                    //login 성공후 되돌아올 주소
                    String connURL = "location='/totsys/login/login.jsp';";
                    out.println(ServletUtil.getJavaScript(connURL));
                    out.println(ServletUtil.getJavaScript("window.close();"));
                    return;
                }

                /********** session내의 userId **********/
                String usID = HttpSSOLogin.getLoginID(request);
                String reuseDocID = clearXSS(MString.checkNull(request.getParameter("reuseDocID")), "");

                /****** Parameter ******/
                String docID = clearXSS(request.getParameter("docID"), "");
                String docName = clearXSS(URLDecoder.decode(request.getParameter("docName"), "UTF-8"), "");
                String handyName = clearXSS(URLDecoder.decode(request.getParameter("handyName"), "UTF-8"), "");
                String accAuth = clearXSS(request.getParameter("accAuth"), "");
                String totRange = clearXSS(request.getParameter("totRange"), "");
                String stDate = clearXSS(request.getParameter("stDate"), "");
                String edDate = clearXSS(request.getParameter("edDate"), "");
                String deptIDs = clearXSS(URLDecoder.decode(MString.checkNull(request.getParameter("deptIDs")), "UTF-8"), "");
                String userIDs = clearXSS(URLDecoder.decode(MString.checkNull(request.getParameter("userIDs")), "UTF-8"), "");
                String repDocID = clearXSS(request.getParameter("repDocID"), "");
                String docGroupID = clearXSS(request.getParameter("docGroupID"), "");
                String isFromFormBox = clearXSS(request.getParameter("isFromFormBox"), "");

                String choice = clearXSS(request.getParameter("choice"), "");
                String deptNames = clearXSS(URLDecoder.decode(MString.checkNull(request.getParameter("deptNames")), "UTF-8"), "");
                String userNames = clearXSS(URLDecoder.decode(MString.checkNull(request.getParameter("userNames")), "UTF-8"), "");

                String deptTypes = clearXSS(MString.checkNull(request.getParameter("deptTypes")), "");

                String tableCount = clearXSS(request.getParameter("tableCount"), "");
                String isDynaTable = clearXSS(request.getParameter("isDynaTable"), "");
                String mode = clearXSS(request.getParameter("mode"), "");
                String tableDefines = clearXSS(request.getParameter("tableDefines"), "");
                String itemNames = clearXSS(URLDecoder.decode(MString.checkNull(request.getParameter("itemNames")), "UTF-8"), "");
                String tableNums = clearXSS(URLDecoder.decode(MString.checkNull(request.getParameter("tableNums")), "UTF-8"), "");
                String colNums = clearXSS(URLDecoder.decode(MString.checkNull(request.getParameter("colNums")), "UTF-8"), "");
                String rowNums = clearXSS(URLDecoder.decode(MString.checkNull(request.getParameter("rowNums")), "UTF-8"), "");
                String itemSizes = clearXSS(URLDecoder.decode(MString.checkNull(request.getParameter("itemSizes")), "UTF-8"), "");
                String itemDescs = clearXSS(URLDecoder.decode(MString.checkNull(request.getParameter("itemDescs")), "UTF-8"), "");
                String itemExprs = clearXSS(URLDecoder.decode(MString.checkNull(request.getParameter("itemExprs")), "UTF-8"), "");
                String itemTypes = clearXSS(URLDecoder.decode(MString.checkNull(request.getParameter("itemTypes")), "UTF-8"), "");
                String docForm = clearXSS(request.getParameter("docForm"), "");
                String tableType = clearXSS(request.getParameter("tableType"), "");
                String defItemSize = clearXSS(request.getParameter("defItemSize"), "");
                String tableTypes = clearXSS(request.getParameter("tableTypes"), "");

%>
<html>
    <head>
        <title><%=Moumi.getTitle()%></title>
        <link rel="stylesheet" href="/totsys/common/css/text.css"
              type="text/css">
        <script src="/totsys/common/js/rollover.js"></script>
    </head>

    <script>
        function beforeSubmit(){
            dform.target = '_self';
            dform.action = '/totsys/common/web/documents/tot_doc/inform_preview.jsp';
            dform.submit();
        }
    </script>
    <body style='' bgcolor="#FFFFFF" text="#000000" leftmargin="0"
          topmargin="0" marginwidth="0" marginheight="0">


        <!-------------------------------- 본문 시작 ---------------------------------->
        <table width="100%" cellspacing="0" cellpadding="0" border="0">
            <tr>
                <td valign="top" align="left">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0"
                           border="0">
                        <!----- 타이틀 이미지(공지사항 작성) ---->

                        <tr>
                            <td valign="top" align="left">
                                <table cellspacing=0 cellpadding=0 width="100%" align=center
                                       border="0">
                                    <tbody>
                                        <tr>
                                            <td>
                                                <form name="formDept" method="post" action="/totsys/common/web/report_dept/dept_list.jsp" target="_self">
                                                    <input type="hidden" name="docID" value="<%= docID%>">
                                                    <input type="hidden" name="choice" value="<%= choice%>">
                                                    <input type="hidden" name="deptIDs" value='<%= URLEncoder.encode(deptIDs, "UTF-8")%>'>
                                                    <input type="hidden" name="deptNames" value='<%= URLEncoder.encode(deptNames, "UTF-8")%>'>
                                                    <input type="hidden" name="userIDs" value='<%= URLEncoder.encode(userIDs, "UTF-8")%>'>
                                                    <input type="hidden" name="userNames" value='<%= URLEncoder.encode(userNames, "UTF-8")%>'>
                                                    <input type="hidden" name="deptTypes" value="<%= deptTypes%>">
                                                    <input type="hidden" name="docName" value='<%= URLEncoder.encode(docName, "UTF-8")%>'>
                                                    <input type="hidden" name="handyName" value='<%= URLEncoder.encode(handyName, "UTF-8")%>'>
                                                    <input type="hidden" name="stDate" value="<%= stDate%>">
                                                    <input type="hidden" name="edDate" value="<%= edDate%>">
                                                    <input type="hidden" name="accAuth" value="<%= accAuth%>">
                                                    <input type="hidden" name="repDocID" value="<%= repDocID%>">
                                                    <input type="hidden" name="docGroupID" value="<%= docGroupID%>">
                                                    <input type="hidden" name="isFromFormBox" value="<%= isFromFormBox%>">
                                                    <input type="hidden" name="tableCount" value="<%= tableCount%>">
                                                    <input type="hidden" name="isDynaTable" value="<%= isDynaTable%>">
                                                    <input type="hidden" name="mode" value="<%= mode%>">
                                                    <input type="hidden" name="tableDefines" value="<%= tableDefines%>">
                                                    <input type="hidden" name="itemNames" value='<%= URLEncoder.encode(itemNames, "UTF-8")%>'>
                                                    <input type="hidden" name="tableNums" value='<%= URLEncoder.encode(tableNums, "UTF-8")%>'>
                                                    <input type="hidden" name="colNums" value='<%= URLEncoder.encode(colNums, "UTF-8")%>'>
                                                    <input type="hidden" name="rowNums" value='<%= URLEncoder.encode(rowNums, "UTF-8")%>'>
                                                    <input type="hidden" name="itemSizes" value='<%= URLEncoder.encode(itemSizes, "UTF-8")%>'>
                                                    <input type="hidden" name="itemDescs" value='<%= URLEncoder.encode(itemDescs, "UTF-8")%>'>
                                                    <input type="hidden" name="itemExprs" value='<%= URLEncoder.encode(itemExprs, "UTF-8")%>'>
                                                    <input type="hidden" name="itemTypes" value='<%= URLEncoder.encode(itemTypes, "UTF-8")%>'>
                                                    <input type="hidden" name="tableType" value="<%= tableType%>">
                                                    <input type="hidden" name="defItemSize" value="<%= defItemSize%>">
                                                    <input type="hidden" name="tableTypes" value="<%= tableTypes%>">
                                                </form>
                                            </td>
                                        </tr>
                                        <!--스타일시트-->
                                    <link rel="stylesheet" href="/totsys/common/css/kecttep.css" type="text/css">
                                    <!-- 뉴타이틀 -->
                                    <jsp:include page="/totsys/common/inc/title/title.jsp" flush="true" />
                                    <!-- 뉴타이틀 -->

                                    <!---- top bar 버튼 시작 ---->
                                    <tr>
                                        <td>
                                            <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                                <tr>
                                                    <td>
                                                        <a href="/totsys/totper/mydocbox/prssbox/doc_list.jsp">
                                                            <img src="images/bt_doc_list.gif" border="0"></a></td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                    <!---- topbar 버튼 끝 ---->
                                    <tr>
                                        <td height="1"></td>
                                    <tr>
                                    <tr>
                                        <td bgcolor="6891cb" height="2"></td>
                                    </tr>

                                    <tr>
                                        <td height="10"></td>
                                    <tr>
                                    <tr>
                                        <td colspan="4">
                                            <form name="dform" method="post"
                                                  action="/servlet/kr.co.kihyun.beans.totsys.doc.HttpDocRegister"
                                                  target="_self">
                                                <input type="hidden" name="docName" value="<%= docName%>">
                                                <input type="hidden" name="handyName" value="<%= handyName%>">
                                                <input type="hidden" name="stDate" value="<%= stDate%>">
                                                <input type="hidden" name="edDate" value="<%= edDate%>">
                                                <input type="hidden" name="deptIDs" value="<%= deptIDs%>">
                                                <input type="hidden" name="deptTypes" value="<%= deptTypes%>">
                                                <input type="hidden" name="deptNames" value="<%= deptNames%>">
                                                <input type="hidden" name="userIDs" value="<%= userIDs%>">
                                                <input type="hidden" name="userNames" value="<%= userNames%>">
                                                <input type="hidden" name="accAuth" value="<%= accAuth%>">
                                                <input type="hidden" name="totRange" value="<%= totRange%>">
                                                <input type="hidden" name="repDocID" value="<%= repDocID%>">
                                                <input type="hidden" name="docGroupID" value="<%= docGroupID%>">
                                                <input type="hidden" name="isFromFormBox" value="<%= isFromFormBox%>">
                                                <input type="hidden" name="tableCount" value="<%= tableCount%>">
                                                <input type="hidden" name="isDynaTable" value="<%= isDynaTable%>">
                                                <input type="hidden" name="mode" value="regist">
                                                <input type="hidden" name="tableDefines" value="<%=tableDefines%>">
                                                <input type="hidden" name="itemNames" value="<%=itemNames%>">
                                                <input type="hidden" name="tableNums" value="<%=tableNums%>">
                                                <input type="hidden" name="colNums" value="<%=colNums%>">
                                                <input type="hidden" name="rowNums" value="<%=rowNums%>">
                                                <input type="hidden" name="itemSizes" value="<%=itemSizes%>">
                                                <input type="hidden" name="itemDescs" value="<%=itemDescs%>">
                                                <input type="hidden" name="itemExprs" value="<%=itemExprs%>">
                                                <input type="hidden" name="itemTypes" value="<%=itemTypes%>">
                                                <input type="hidden" name="docForm" value="<%=docForm%>">
                                                <input type="hidden" name="tableType" value="<%= tableType%>">
                                                <input type="hidden" name="defItemSize" value="<%= defItemSize%>">
                                                <input type="hidden" name="tableTypes" value="<%= tableTypes%>">
                                                <INPUT type="hidden" name="fileCount">
                                                <INPUT type="hidden" name="usrFilenames">
                                                <INPUT type="hidden" name="svrFilenames">
                                                <INPUT type="hidden" name="fileInfos">
                                                <INPUT type="hidden" name="notify" value="">
                                                <table border="1" bordercolor="#abbddd" width="100%" cellpadding="0" cellspacing="0">
                                                <!----- 제목 ----->
                                                <tr>
                                                    <td class="kecttep_tdmenu" width="120" nowrap height="25">
                                                        <img  src="images/reg_icon.gif" align="absmiddle">제목</td>
                                                    <td align=center>
                                                        <INPUT class=inputtxt style="width: 99%" name="title"></td>
                                                </tr>
                                                <!----- 파일첨부 ---->
                                                <tr>
                                                    <td class="kecttep_tdmenu" width="120" valign="middle">
                                                        <img src="images/reg_icon.gif" align="absmiddle">관련자료 첨부</td>
                                                    <td valign=top>
                                                        <iframe src="./write_file_upload.jsp?boardGroupID=<%= Category.ID_TOT_DOC_COMMENT%>&execMode=init"
                                                                name='subUpload' width="100%" frameborder=0 scrolling=no
                                                                marginheight=0 marginwidth=2 height="45">
                                                        </iframe></td>
                                                </tr>
                                                <!----- 내용 ----->
                                                <tr>
                                                    <td colspan="2" height="370">
                                                        <form name="gocomp0" action="/Mail-bin/send_mail.frame"
                                                              method=post>
                                                            <input type="hidden" name=What value=0>
                                                            <input type="hidden" name=BODY>
                                                            <input type="hidden" name=CMD value=''>
                                                            <input type="hidden" name=MSGID value=''>
                                                            <input type="hidden" name=TO>
                                                            <input type="hidden" name=CC>
                                                            <input type="hidden" name=BCC>
                                                            <input type="hidden" name=SUBJECT>
                                                            <input type="hidden" name=XSUBJECT value=''>
                                                            <input type="hidden" name=PID value='11295'></form>
                                                        <FORM name=Mail_Form target=_parent method=post
                                                              action="/Mail-bin/start_mail/simplehtml">
                                                            <input type="hidden" name=SENDACTION value="">
                                                            <input type="hidden" name=RESV_Y value="">
                                                            <input type="hidden" name=RESV_M value="">
                                                            <input type="hidden" name=RESV_D value="">
                                                            <input type="hidden" name=RESV_H value="">
                                                            <input type="hidden" name=ISLINEANS value="">
                                                            <input type="hidden" name=PID value="11295">
                                                            <input type="hidden" name=MSGID value=>
                                                            <input type="hidden" name=LINKURL value="">
                                                            <input type="hidden" name=LINKCOMMENT value="">
                                                            <input type="hidden" name=KEYWORD value="">
                                                            <input type="hidden" name=KEYTYPE value="">
                                                            <input type="hidden" name=FOLDER value="">
                                                            <input type="hidden" name=mpage value="">
                                                            <input type="hidden" name=UseCompose value="">
                                                            <SCRIPT LANGUAGE='javascript' src='/totsys/common/js/editor.js'></SCRIPT>
                                                            <iframe id='i_fontcolor'
                                                                style='background-color: #ffffff; border: 1px double #BFBFBF; cursor: hand; position: absolute; visibility: hidden;'
                                                                scrolling=no frameborder=0 width=120 height=120>
                                                            </iframe>
                                                            <iframe id='i_backcolor'
                                                                style='background-color: #ffffff; border: 1px double #BFBFBF; cursor: hand; position: absolute; visibility: hidden;'
                                                                scrolling=no frameborder=0 width=120 height=120>
                                                            </iframe>
                                                            <iframe id='i_image'
                                                                style='color: #000000; background-color: #efefef; border: 1px double #BFBFBF; cursor: default; position: absolute; visibility: hidden;'
                                                                scrolling=no frameborder=0 width=325 height=85>
                                                            </iframe>
                                                            <iframe
                                                                id='i_link'
                                                                style='color: #000000; background-color: #efefef; border: 1px double #BFBFBF; cursor: default; position: absolute; visibility: hidden;'
                                                                scrolling=no frameborder=0 width=325 height=70>
                                                            </iframe>
                                                            <iframe
                                                                id='i_emoticon'
                                                                style='background-color: #efefef; border: 1px double #BFBFBF; cursor: hand; position: absolute; visibility: hidden;'
                                                                scrolling=no frameborder=0 width=125 height=125>
                                                            </iframe>

                                                            <div id='editctrl' style='display: show; width : auto; height: auto;'>
                                                                <iframe
                                                                    name='EditCtrl' width='100%' height='100%' scrolling='YES'
                                                                    onfocus='layeroff();' onblur='nowkong.SaveSelection();'
                                                                    frameborder="0"></iframe></div>
                                                            <input type="hidden" name=FORSAVE
                                                                   value="&lt;HEAD&gt;
                                                                            &lt;STYLE&gt;
                                                                            P {margin-top:2px;margin-bottom:2px;}
                                                                            &lt;/STYLE&gt;
                                                                            &lt;/HEAD&gt;
                                                                            &lt;BODY oncontextmenu='return false;' style='background-color: ; background-image: url(); ' topmargin=11 leftmargin=11&gt;
                                                                            &lt;/BODY&gt;">
                                                            <input type="hidden" name=BODY value="">
                                                            <input type="hidden" name=BODYBG value="">
                                                            <input type="hidden" name=BODYBGC value="">
                                                        </FORM>
                                                        <SCRIPT FOR=window EVENT=onbeforeunload LANGUAGE="JScript">
                                                            document.Mail_Form.FORSAVE.value=EditCtrl.document.documentElement.innerHTML;
                                                        </SCRIPT>
                                                        <SCRIPT FOR=window EVENT=onload LANGUAGE="javascript">
                                                            //EditCtrl.document.write("");
                                                            init();
                                                            //document.Mail_Form.FORSAVE.value=document;
                                                            //alert(document.Mail_Form.FORSAVE.value);
                                                        </SCRIPT>
                                                        <SCRIPT>
                                                            function saveform() {
                                                                dform.notify.value = EditCtrl.document.body.innerHTML;
                                                                //dform.notify.value = document.Mail_Form.FORSAVE.value;
                                                                var cfm = confirm('확인을 클릭하시면 해당문서의 집계를 시작합니다.');
                                                                if(cfm){
                                                                    dform.action = '/servlet/kr.co.kihyun.beans.totsys.doc.HttpDocRegister';
                                                                    dform.target = '_self';
                                                                    dform.submit();
                                                                }
                                                            }
                                                        </SCRIPT>
                                                        </form>
                                                    </td>
                                                </tr>

                                                </table>

                                            </form>
                                        </td>
                                    </tr>
                                    <!----- 비밀번호 입력 ----->
                                    <!--tr>
										<td valign=top align=right width=5 style="padding-top:10;"><img src="./images/notice_icon.gif" width="5" height="5"></td>
										<td valign=center width=80>비밀번호</td>
										<td width=400><INPUT onkeydown=ProcKeyDown() type="passwd" size=25 name="passwd" class=inputtxt></td>
									</tr-->
                                    </tbody>
                                </table>
                                </FORM>
                            </td>
                        </tr>
                    </table>
                    <!---- 버튼(확인버튼) ---->
                    <table border="0" cellspacing="0" cellpadding="0" align="center">
                        <tr>
                            <td height="10"></td>
                        </tr>
                        <tr>
                            <td height="10"><a href="#" onclick="beforeSubmit();"><img
                                        name="bt_enter" border="0" src="images/bt_pre.gif"></a></td>
                            <td width="5"></td>
                            <td height="10"><a href="#" onclick="saveform()"><img
                                        name="bt_cancel3.gif" border="0" src="images/btn_completed.gif"></a></td>
                        </tr>
                    </table>
                </td>
                <td width="10"></td>
            </tr>
        </table>

        <script>
            dform.title.value="<%=docName%> 입력요령 및 관련자료";
            dform.title.focus()
        </script>

    </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 {
            }
%>
