
<%    /**
     * **********************************************************@@ Program Name
     * : doc_regist.jsp Description	: /집계자/자료 등록 Author	: 기현테크 Create Date	:
     * 2010.11.18 History	:
     * @@***********************************************************
     */
%>

<%@ page contentType="text/html; charset=UTF-8"
         import="java.net.URLEncoder" import="java.net.URLDecoder"
         import="kr.co.kihyun.beans.user.HttpSSOLogin"
         import="java.util.Calendar" import="java.text.SimpleDateFormat"
         import="java.util.*" import="kr.co.kihyun.lang.Encoder"
         import="kr.co.kihyun.lang.MString" import="kr.co.kihyun.lang.MInteger"
         import="kr.co.kihyun.lang.MLong"
         import="kr.co.kihyun.text.html.ServletUtil"
         import="kr.co.kihyun.moumi.MoumiConfig" import="kr.co.kihyun.moumi.doc.MDoc"
         import="kr.co.kihyun.util.MDate" import="kr.co.kihyun.text.excel.Excel"
         import="kr.co.kihyun.text.html.TagFilter"
         import="kr.co.kihyun.text.html.HtmlUtil"
         import="kr.co.kihyun.lang.StringConverter"
         import="kr.co.kihyun.text.html.CallbackHandler"
         import="java.util.ResourceBundle" import="kr.co.kihyun.beans.entity.*"
         import="javax.jdo.PersistenceManager" import="javax.jdo.Transaction"
         import="kr.co.kihyun.beans.entity.util.*"
         import="org.slf4j.Logger"
         import="org.slf4j.LoggerFactory"
         %>

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

<%    Logger LOG = LoggerFactory.getLogger(this.getClass());

    PersistenceManager pm = new MPersistenceManager(PMF.get().getPersistenceManager());
    Transaction tx = pm.currentTransaction();
    try {
        /**
         * ******** session내의 userId *********
         */
        String usID = HttpSSOLogin.getLoginID(request);
        int sysAuth = HttpSSOLogin.getSysAuth(request);

        if (sysAuth == MoumiConfig.SUB_TOTPER && MoumiConfig.isMonitor()) {
            String connURL = "history.go(-1);";
            out.println(ServletUtil.alert(MoumiConfig.getMessageBundle().getString("moumi.message.tot_report.submit") + MoumiConfig.getMessageBundle().getString("moumi.message.popup.doc_regist_jsp_AuthCheck")));
            out.println(ServletUtil.getJavaScript(connURL));
            return;
        }

        /**
         * ********** Parameter values ***********
         */
        String docID = clearXSS(request.getParameter("docID"), "");
        String choice = clearXSS(request.getParameter("choice"), "");
        String deptIDs = clearXSS(URLDecoder.decode(MString.checkNull(request.getParameter("deptIDs")), "UTF-8"), "");
        String execNum = clearXSS(request.getParameter("execNum"), "");
        String execDate = clearXSS(request.getParameter("execDate"), "");
        String userIDs = clearXSS(URLDecoder.decode(MString.checkNull(request.getParameter("userIDs")), "UTF-8"), "");
        String userNames = clearXSS(URLDecoder.decode(MString.checkNull(request.getParameter("userNames")), "UTF-8"), "");
        String deptTypes = clearXSS(MString.checkNull(request.getParameter("deptTypes")), "");
        String handyName = clearXSS(Encoder.toJava(request.getParameter("handyName")), "");
        String totRange = clearXSS(MString.checkNull(request.getParameter("totRange")), "");
        String appendType = clearXSS(MString.checkNull(request.getParameter("appendType")), TotDocAppendType.COPY.toString());
        String docName = clearXSS(Encoder.toJava(MString.checkNull(request.getParameter("docName"))), "");
        String usrFilenames = clearXSS(Encoder.toJava(MString.checkNull(request.getParameter("usrFilenames"))), "");
        String svrFilenames = clearXSS(Encoder.toJava(MString.checkNull(request.getParameter("svrFilenames"))), "");
        String[] usrFileNameList = usrFilenames.split(";");
        String[] svrFileNameList = svrFilenames.split(";");
        String accAuth = clearXSS(request.getParameter("accAuth"), "0");
        String repDocID = clearXSS(request.getParameter("repDocID"), "");
        String docGroupID = clearXSS(request.getParameter("docGroupID"), "");
        String isFromFormBox = clearXSS(request.getParameter("isFromFormBox"), "");
        String tableCount = clearXSS(request.getParameter("tableCount"), "");
        String isDynaTable = clearXSS(request.getParameter("isDynaTable"), "");
        String mode = clearXSS(request.getParameter("mode"), "");
        String notify = Encoder.toJava(MString.checkNull(request.getParameter("notify")));
        String tableDefines = MString.checkNull(request.getParameter("tableDefines"));
        String itemNames = MString.checkNull(Encoder.toJava(request.getParameter("itemNames")));
        String tableNums = MString.checkNull(Encoder.toJava(request.getParameter("tableNums")));
        String colNums = MString.checkNull(Encoder.toJava(request.getParameter("colNums")));
        String rowNums = MString.checkNull(Encoder.toJava(request.getParameter("rowNums")));
        String itemSizes = MString.checkNull(Encoder.toJava(request.getParameter("itemSizes")));
        String itemDescs = MString.checkNull(Encoder.toJava(request.getParameter("itemDescs")));

        String itemExprs = MString.checkNull(Encoder.toJava(request.getParameter("itemExprs")));
        String itemTypes = MString.checkNull(Encoder.toJava(request.getParameter("itemTypes")));
        String docForm = MString.checkNull(Encoder.toJava(request.getParameter("docForm")));
        String backDash = MString.checkNull(Encoder.toJava(request.getParameter("backDash")));
        String step = MString.checkNull(request.getParameter("step"));
        String startMethod = clearXSS(request.getParameter("startMethod"), "0");
        String endMethod = clearXSS(request.getParameter("endMethod"), LimitByDeadlineStrategy.class.getSimpleName().toString());

        if ("1".equals(step)) {
            session.removeAttribute("docForm");
            session.removeAttribute("notify");
        }

        if (backDash.equals("back")) {
            if ((String) session.getAttribute("docForm") == "" || (String) session.getAttribute("docForm") == null) {
            } else {
                docForm = (String) session.getAttribute("docForm");
            }
        }

        /**
         * ************** 추가 끝 *************
         */
        Long reuseDocID = MLong.parseLong(request.getParameter("reuseDocID"), null);
        //String reuseDocName = Encoder.toJava(clearXSS(request.getParameter("reuseDocName"),""));

        //LJH
        //String reuseDocName = clearXSS(URLDecoder.decode(request.getParameter("reuseDocName"), "UTF-8"),"");
        String reuseDocName = clearXSS(URLDecoder.decode(MString.checkNull(request.getParameter("reuseDocName")), "UTF-8"), "");

        //String isFromFormBox = request.getParameter("isFromFormBox");
        String totType = clearXSS(request.getParameter("totType"), "");
        if (MString.isNull(totType)) {
            totType = "1step";
        }

        /**
         * ********* doc value ****************
         */
        String repDocForm = "";

        if (reuseDocID != null) {
            TotDoc totDoc = null;
            //totDoc = reuseDocID == null ? null : pm.getObjectById(TotDoc.class, reuseDocID);

            if (reuseDocID == null) {
                totDoc = null;
            } else {
                totDoc = (TotDoc) pm.getObjectById(TotDoc.class, reuseDocID);
            }

            repDocForm = totDoc.getForm();
            repDocForm = TagFilter.convertSingle(repDocForm);
            repDocForm = StringConverter.toOneLine(repDocForm);
        }

        /**
         * ******** 현재 년, 월, 일 *********
         */
        int ONE_DAY = 1000 * 60 * 60 * 24;
        Long today = new Date().getTime();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        SimpleDateFormat timeFormat = new SimpleDateFormat("HH");

        String deptCount = "0";
        String userCount = "0";
        if (!deptIDs.equals("")) {
            String[] dtcount = deptIDs.split(",");
            deptCount = Integer.toString(dtcount.length);
        }
        if (!userIDs.equals("")) {
            String[] uscount = userIDs.split(",");
            userCount = Integer.toString(uscount.length);
        }

%>

<HTML>
    <HEAD>
        <TITLE><%=MoumiConfig.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/SquareButtons.css"
              type="text/css">
        <script defer="defer"src="/totsys/common/js/rollover.js"></script>
        <script defer="defer" src="/totsys/common/js/util.js"></script>
        <script defer="defer" src="/totsys/common/js/calendar.js"></script>
        <script defer="defer" src="/totsys/common/js/drag.js"></script>
        <script defer="defer" src="/totsys/common/js/date.js"></script>
        <script defer="defer" src="/totsys/common/js/checkNum.js"></script>
        <SCRIPT defer="defer" src='/totsys/common/js/editor.js'></SCRIPT>
        <script defer="defer" language="javascript">
            var isEdited = false;
            <%
                                    if (backDash.equals("back")) {
                                        if (!MString.isNull((String) session.getAttribute("docForm"))) {
            %>
            isEdited = true;
            <%
                                        }
                                    }
            %>
            EditCtrl.document.body.disabled = isEdited;
            function setValue() {
                if ("<%= docName%>" != "") {
                    dform.docName.value = "<%= docName%>";
                    dform.deptIDs.value = "<%= deptIDs%>";
                    dform.deptCount.value = "<%= deptCount%>";
                    dform.deptTypes.value = "<%= deptTypes%>";
                    dform.userIDs.value = "<%= userIDs%>";
                    dform.userNames.value = "<%= userNames%>";
                    dform.userCount.value = "<%= userCount%>";
                    //dform.handyName.value="<%= handyName%>";
                    //dform.notify.value="<%--= notify --%>";
                    dform.accAuth["<%= accAuth%>"].checked = true;
                    //dform.totRange["<%= totRange%>"].checked = true;
                    dform.usrFilenames.value = "<%= usrFilenames%>";
                    dform.svrFilenames.value = "<%= svrFilenames%>";
                } else {
                    init();
                    //EditCtrl.document.body.innerHTML = '<center><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.formCopy")%></center>';
                    EditCtrl.document.body.innerHTML = '<center>아래한글,엑셀,워드등에서 작성한 조사서식을 복사하여 붙여넣는 창 입니다.</center>';
                }
            }

            function viewNote() {
                var width = 600;
                var height = 410;
                var leftpos = (screen.width - width) / 2;
                var toppos = (screen.height - height) / 2;
                window.open("/totsys/common/web/note/popup_manual.jsp", "", "width=" + width + ", height=" + height + ", toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,left= " + leftpos + " ,top= " + toppos);
            }

            function openWin(theURL, features) { //v2.0
                var farwindow = null;
                farwindow = window.open(theURL, 'farwindow', features);
                farwindow.focus();
            }

            function browseFile() { //v2.0
                document.write('<input type="file" name = "upFile" >');
            }

            function browseOld() { //v2.0
                document.write('<input type="file" name = "upFile" >');
            }

            function formSubmit() {
                //var fn = dform.formFileName.value;
                //ban lower case var ext = fn.substring(fn.indexOf('.')+1,fn.length).toLowerCase();
                dform.copyForm.value = EditCtrl.document.body.innerHTML;
                var dformData = dform.copyForm.value;
                var array_table = dformData.split("<TABLE ");

                if (array_table.length == 1 && dformData.indexOf("\"DataInput\"") == -1) {
                    alert("<%=MoumiConfig.getMessageBundle().getString("moumi.message.popup.formCheck")%>");
                    return;
                } else if (array_table.length > 16) {
                    alert("<%=MoumiConfig.getMessageBundle().getString("moumi.message.popup.totalCount15")%>");
                    return;
                } else if (dform.docName.value == '') {
                    alert("<%=MoumiConfig.getMessageBundle().getString("moumi.message.popup.dataNameCheck")%>");
                    dform.docName.focus();
                    return;
                    //}else if (containsChars(dform.docName,'￦/?"<>|!,*&^%$#@~;')) {
                } else if (containsChars(dform.docName, '\'\\')) {
                    alert("<%=MoumiConfig.getMessageBundle().getString("moumi.message.popup.dataNameSymboleCheck")%>");
                    dform.docName.focus();
                    return;
                } else if (dform.accAuth[0].checked == false && dform.accAuth[1].checked == false && dform.accAuth[2].checked == false) {
                    alert("<%=MoumiConfig.getMessageBundle().getString("moumi.message.popup.publicCheck")%>");
                    return;
                } else if (dform.deptIDs.value.length == '') {
                    alert("<%=MoumiConfig.getMessageBundle().getString("moumi.message.popup.submitDevisionCheck")%>");
                    deptSelect();
                    return;
                } else {
                    dform.submit();
                }
            }

            function containsChars(input, chars) {
                for (var inx = 0; inx < input.value.length; inx++) {
                    if (chars.indexOf(input.value.charAt(inx)) != -1)
                        return true;
                }
                return false;
            }

            function AllDataRemove() {
                dform.deptIDs.value = '';
            }

            function ShowDocPool(accAuth) {
                isEdited = true;
                //document.all.type1.style.display="none";
                //document.all.type2.style.display="inline";
                //document.all.type3.style.display="none";
                document.dform.isFromFormBox.value = "true";
                window.open('./popup_form_list.jsp?accAuth=' + accAuth, 'makepoll', 'width=800,height=480,scrollbars=yes,resizable=yes');
            }

            function ShowFile() {
                //document.all.type3.style.display="none";
                //document.all.type2.style.display="none";
                //document.all.type1.style.display="inline";
                document.dform.isFromFormBox.value = "false";
            }

            function FileCopy() {
                //document.all.type3.style.display="none";
                //document.all.type2.style.display="none";
                //document.all.type1.style.display="inline";
                EditCtrl.document.body.innerHTML = '"DataInput"';
                EditCtrl.document.body.disabled = true;
                isEdited = true;
            }

            function ShowCopy() {
                //document.all.type1.style.display="none";
                //document.all.type2.style.display="none";
                //document.all.type3.style.display="inline";
                document.dform.isFromFormBox.value = "false";
                EditCtrl.document.body.disabled = false;
                //EditCtrl.document.body.innerHTML = '<center><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.formCopy")%></center>';
                EditCtrl.document.body.innerHTML = '<center>아래한글,엑셀,워드등에서 작성한 조사서식을 복사하여 붙여넣는 창 입니다.</center>';
                isEdited = false;
                //window.open('./popup_copy_form.jsp','makecopy','width=950,height=595,scrollbars=no,resizable=no');
            }

            function inputText() {
                window.open('./popup_input_form.jsp', 'makepoll', 'width=800,height=480,scrollbars=yes,resizable=yes');
            }

            function deptSelect() {
                /*
                 var urlname = "/totsys/common/web/report_dept/new_dept_list.jsp?formName=dform&section=1&deptIDs="+dform.deptIDs.value+"&deptTypes="+dform.deptTypes.value;
                 var height = screen.height;
                 var width = screen.width;
                 var leftpos = width / 2 - 350;
                 var toppos = height / 2 - 350;
                 post= window.open(urlname, "post","width=713, height=475, toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,left=" + leftpos + ",top=" + toppos);				
                 post.focus();
                 */
                etc.deptIDs.value = dform.deptIDs.value;
                etc.deptTypes.value = dform.deptTypes.value;
                var height = screen.height;
                var width = screen.width;
                var leftpos = width / 2 - 350;
                var toppos = height / 2 - 350;
                post = window.open("", "post", "width=713, height=475, toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,left=" + leftpos + ",top=" + toppos);
                etc.target = "post";
                etc.submit();


            }

            function fromFormBox(reuseDocID, reuseDocName) {
                if (reuseDocID != 'null') {
                    EditCtrl.document.body.focus();
                    if (confirm(reuseDocName + "<%=MoumiConfig.getMessageBundle().getString("moumi.message.popup.dataReuse")%>")) {
                        //document.all.type1.style.display="none";
                        //document.all.type2.style.display="inline";
                        //document.all.type3.style.display="none";

                        dform.docName.value = reuseDocName;
                        dform.reuseDocID.value = reuseDocID;
                        //dform.oldFormName.value = reuseDocName;
                        dform.appendType[2].checked = true;             //서식함 활용 체크되게
                        //window.open('./popup_copy_form.jsp?reuseDocID=','makecopy','width=950,height=595,scrollbars=no,resizable=no');

                        EditCtrl.document.body.innerHTML = '<%= repDocForm%>';
                    } else {
                        history.go(-1);
                    }
                } else {
            <%if (!docForm.equals("") && docForm != null) {%>
            <% if (TotDocAppendType.valueOf(appendType) == TotDocAppendType.FILE) {%>
                    init();
                    EditCtrl.document.body.innerHTML = '"DataInput"';
                    EditCtrl.document.body.disabled = true;
            <% } else {%>
                    init();
                    //init2();
                    EditCtrl.document.body.innerHTML = '<%=StringConverter.toOneLine(TagFilter.convertSingle(docForm))%>';
                    //EditCtrl2.document.body.innerHTML = '<%--=StringConverter.toOneLine(TagFilter.convertSingle(notify))--%>';
            <%}%>
            <%}%>
                }
            }
            function pageInit() {
                setValue();
                dform.docName.focus();
            }
        </script>
    </HEAD>

    <body BGCOLOR="#FFFFFF"
          onload="init();
                  setValue();
                  dform.docName.focus();
                  fromFormBox('<%= reuseDocID%>', '<%= reuseDocName%>');">
        <span id="SetWin"
              style="position: absolute; z-index: 10; Visibility: hidden; background: silver; border: 1px #333333 solid; line-height: 1.4em; padding: 3px 3px"></span>
        <table width="100%" border="0" cellpadding="0" cellspacing="0">
            <jsp:include page="/totsys/common/inc/totper/top/top.jsp" flush="true" />
            <tr>
                <td nowrap width="10"></td>
                <td valign="top">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <jsp:include page="/totsys/common/inc/title/title.jsp" flush="true" />
                        <tr>
                            <!---- 내용---->
                            <td height="5" valign="top">
                                <form name="etc" method="post" action="/totsys/common/web/report_dept/new_dept_list.jsp">
                                    <input type="hidden" name="formName" value="dform">
                                    <input type="hidden" name="section" value="1">
                                    <input type="hidden" name="deptTypes">
                                    <input type="hidden"	name="deptIDs">
                                </form>
                                <form name="dform"	action="/servlet/kr.co.kihyun.beans.totsys.doc.HttpFormReader"	method="post" enctype="multipart/form-data">                    
                                    <input	type="hidden" name="docGroupID" value="<%=MDoc.TOT_DOC%>">
                                    <input type="hidden" name="isFromFormBox" value="<%=isFromFormBox%>">
                                    <input type="hidden" name="totType" value="<%=totType%>"> <input
                                        type="hidden" name="copyForm"> <input type="hidden"
                                        name="deptIDs">
                                    <input type="hidden" name="deptTypes"> <input type="hidden"
                                                                                  name="deptCount"> <input type="hidden" name="userIDs">
                                    <input type="hidden" name="userNames"> <input type="hidden"
                                                                                  name="userCount"> <input type="hidden" name="userID"
                                                                                  value="usID"> <input type="hidden" name="reuseDocID"
                                                                                  value="<%=reuseDocID%>"> <INPUT type="hidden"
                                                                                  name="fileCount"
                                                                                  value="<%=MString.isNull(usrFileNameList[0]) == true ? 0 : usrFileNameList.length%>">
                                    <INPUT type="hidden" name="usrFilenames" value="<%=usrFilenames%>">
                                    <INPUT type="hidden" name="svrFilenames" value="<%=svrFilenames%>">
                                    <INPUT type="hidden" name="fileInfos"> <INPUT type="hidden"
                                                                                  name="notify"> <!-- 새로 추가된 부분 --> <INPUT type="hidden"
                                                                                  name="choice" value="<%=choice%>"> <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="tableCount" value="<%=tableCount%>">
                                    <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="backDash" value="<%=backDash%>"> <INPUT
                                        type="hidden" name="totRange" value="1">
                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                        <tr>
                                            <td colspan="2">
                                                <table width="100%" border="2px" bordercolor="#dedcec" class="kecttep_list_table2" cellpadding="0" cellspacing="0">
                                                    <tr>
                                                        <td align="left" class="kecttep_tdmenu" width="100"  style="padding-left: 20px" nowrap>
                                                            <%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.doc")%><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.name")%></td>
                                                        <td align="left" valign="top" nowrap class="kecttep_list_graytd" style="padding-left: 10px; padding-right: 10px; width: 30%">
                                                            <input name="docName" type="text"
                                                                   class="inputtxt" value="<%=reuseDocName%>" size="55">
                                                        </td>
                                                        <td align="left" class="kecttep_tdmenu" width="100"  style="padding-left: 20px" nowrap>
                                                            <%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.executionCode")%></td>
                                                        <td align="left" valign="top" nowrap class="kecttep_list_graytd" style="padding-left: 15px;">
                                                            <%= HttpSSOLogin.getDeptName(request)%>_
                                                            <input name="execNum" type="text" class="inputtxt" style="width: 50px" value="<%=execNum%>">
                                                            (<input name="execDate" type="text" size="10" value="<%=execDate%>"
                                                                    readonly onclick="showSetWin('dform.execDate');"
                                                                    style="cursor: hand;" class="inputtxt"><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.day")%>&nbsp;<a
                                                                    href="#" onclick="showSetWin('dform.execDate');"><img
                                                                    src="/totsys/common/images/date.gif" align="middle"></a>)
                                                        </td>
                                                    </tr>

                                                    <tr>
                                                        <td align="left" class="kecttep_tdmenu" width="100"  style="padding-left: 20px"><%= TotDocType.FORM_DOC%><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.form")%></td>
                                                        <td align="left" valign="top" nowrap class="kecttep_list_graytd" style="padding-left: 15;">
                                                            <input type="radio" name="appendType" value="<%= TotDocAppendType.COPY%>" onclick="ShowCopy();"
                                                                   <%= TotDocAppendType.valueOf(appendType) == TotDocAppendType.COPY ? " checked" : ""%>>
                                                            <%= TotDocType.FORM_DOC%><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.copy")%>&nbsp;

                                                            <input type="radio" name="appendType" value="<%= TotDocAppendType.FILE%>" onclick="FileCopy();"
                                                                   <%-- <%= reuseDocID == null && TotDocAppendType.valueOf(appendType) == TotDocAppendType.FILE ?  " checked" : "" %>> --%>
                                                                   <%= TotDocAppendType.valueOf(appendType) == TotDocAppendType.FILE ? " checked" : ""%>>
                                                            <%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.file")%><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.tot_doc")%>&nbsp;

                                                            <input type="radio" name="appendType" value="<%= TotDocAppendType.REUSE%>" onclick="ShowDocPool('<%= MoumiConfig.PER%>');"
                                                                   <%-- <%= reuseDocID != null  && TotDocAppendType.valueOf(appendType) == TotDocAppendType.REUSE ? " checked" : ""%>> --%>
                                                                   <%= TotDocAppendType.valueOf(appendType) == TotDocAppendType.REUSE ? " checked" : ""%>>
                                                            <%= TotDocType.FORM_DOC%><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.box")%><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.upTake")%>
                                                        </td>
                                                        <td align="left" class="kecttep_tdmenu" width="100"  style="padding-left: 20px"><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.type.form_doc")%><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.type.share")%></td>
                                                        <td align="left" valign="top" nowrap class="kecttep_list_graytd" style="padding-left: 15;">
                                                            <input name="accAuth" value="0" type="radio"<%= "0".equals(accAuth) ? " checked" : ""%>><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.personal")%>&nbsp;
                                                            <input name="accAuth" value="1" type="radio"<%= "1".equals(accAuth) ? " checked" : ""%>><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.devision")%>&nbsp;
                                                            <input name="accAuth" value="2" type="radio"<%= "2".equals(accAuth) ? " checked" : ""%>><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.coporation")%>&nbsp;
                                                        </td>
                                                    </tr>

                                                    <tr>
                                                        <td align="left" class="kecttep_tdmenu" width="100"  style="padding-left: 20px"><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.dataInputDevision")%></td>
                                                        <td align="left" valign="top" nowrap class="kecttep_list_graytd" style="padding-left: 15;">
                                                            <table border=0 cellpadding=0 cellspacing=0>
                                                                <tr valign="middle">
                                                                    <td ><a  href="#"
                                                                             onClick="javascript:deptSelect();"><img src="/totsys/common/images/bt_dept_select2.gif" width="114" height="24" border="0" align="absmiddle"></a>
                                                                    </td>
                                                                    <td>
                                                                        <%if (deptCount.equals("0")) {%> <input name="deptCountText"
                                                                               type="text"
                                                                               style="width: 180px; border: 0; color: black; padding-top: 3px; padding-left: 2px;"
                                                                               value="&nbsp;&nbsp;<%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.submitDevision")%>"
                                                                               align="middle"> <%} else {%> <input name="deptCountText"
                                                                               type="text"
                                                                               style="width: 180px; border: 0; color: black; padding-top: 3px;"
                                                                               value="&nbsp;&nbsp;<%=deptCount%><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.devisionSelect")%>"
                                                                               align="middle"> <%}%>
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                        <td align="left" class="kecttep_tdmenu" width="100"  style="padding-left: 20px"><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.input")%><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.trick")%></td>
                                                        <td align="left" valign="top" nowrap class="kecttep_last_graytd" style="padding-left: 15;"><a
                                                                href="#" onClick="javascript:inputText();"><img src="/totsys/common/images/bt_psd.gif" width="158" height="24" border="0" align="absmiddle"></a></td>
                                                    </tr>
                                                    <tr>
                                                        <td colspan="4" nowrap></td>
                                                    </tr>

                                                    <tr>
                                                        <td colspan="4">
                                                            <table width="100%" border=0 cellpadding=0 cellspacing=0 >
                                                                <tr>
                                                                    <td></td>
                                                                </tr>
                                                                <!----- 내용 ----->
                                                                <tr>
                                                                    <td><iframe id='i_fontcolor' style='background-color: #ffffff; border: 1px double #BFBFBF; cursor: hand; position: absolute; visibility: hidden;'
                                                                                scrolling=no frameborder=1 height=60></iframe> <iframe
                                                                                id='i_backcolor'
                                                                                style='background-color: #ffffff; border: 1px double #BFBFBF; cursor: hand; position: absolute; visibility: hidden;'
                                                                                scrolling=no frameborder=1 height=60></iframe> <iframe
                                                                                id='i_image'
                                                                                style='color: #000000; background-color: #efefef; border: 1px double #BFBFBF; cursor: default; position: absolute; visibility: hidden;'
                                                                                scrolling=no frameborder=1 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=1 height=70></iframe> <iframe
                                                                                id='i_emoticon'
                                                                                style='background-color: #efefef; border: 1px double #BFBFBF; cursor: hand; position: absolute; visibility: hidden;'
                                                                                scrolling=no frameborder=1 height=125></iframe>
                                                                        <div id='editctrl' style='display: show; width: auto; height: auto;'>
                                                                            <!--                                          <iframe name='EditCtrl' style="width:100%;height:expression(document.body.clientHeight-190)" scrolling='YES'
                                                                                                                                                                onfocus='if(isEdited==false) EditCtrl.document.body.innerHTML = ""; isEdited=true;' onblur='nowkong.SaveSelection();' frameborder="0">
                                                                                                                          </iframe>-->
                                                                            <iframe name='EditCtrl' id="ifrm_EditCtrl" style="width:100%;" scrolling='YES'
                                                                                    onfocus='if (isEdited == false)
                                                                                                EditCtrl.document.body.innerHTML = "";
                                                                                            isEdited = true;' onblur='nowkong.SaveSelection();' frameborder="0">
                                                                            </iframe>
                                                                        </div>
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>

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

                                        <tr>
                                            <td align="center" valign="top"><!---- 이전, 다음단계 ---->
                                                <table border="0" cellpadding="0" cellspacing="0">
                                                    <tr>
                                                        <td><a  href="#" onclick="formSubmit();"><img src="/totsys/common/images/bt_next.gif" width="62" height="24" border="0" align="absmiddle"></a></td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                    </table>
                                </form>
                            </td>
                        </tr>
                    </table>
                </td>
                <td nowrap width="10"></td>
            </tr>
            <!------------------------------- 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();
        }
        /**
         * ******** session내의 doc info reset *********
         */
        MDoc.initSession(session);
    }
%>
