<%@page import="kr.co.kihyun.lang.MInteger"%>
<%@ page contentType="text/html; charset=UTF-8"
         import="kr.co.kihyun.beans.user.HttpSSOLogin"
         import="kr.co.kihyun.text.html.ServletUtil"
         import="kr.co.kihyun.beans.user.UserView"
         import="kr.co.kihyun.beans.user.RepoAdmUser"
         import="kr.co.kihyun.moumi.MoumiConfig" import="kr.co.kihyun.lang.MLong"
         import="kr.co.kihyun.lang.Encoder"%>

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

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

        /**
         * ******** session내의 userId *********
         */
        String usID = HttpSSOLogin.getLoginID(request);

        /**
         * **** Parameter *****
         */
        Long docID = MLong.parseLong(request.getParameter("docID"), null);
        Long deptID = MLong.parseLong(request.getParameter("deptID"), null);
        String userID = clearXSS(request.getParameter("userID"), "");
        String isRecog = MString.checkNull(request.getParameter("isRecog"));
        int strPage = MInteger.parseInt(request.getParameter("strPage"), 1);
        String findOption = clearXSS(request.getParameter("findOption"), "");
        String findWord = clearXSS(Encoder.toJava(request.getParameter("findWord")), "");

        /**
         * ***** 집계자 정보 ********
         */
        UserView userView = new UserView();
        userView.executeQuery(usID);

        String deptName = userView.getDeptName();
        String userName = userView.getName();
        String phone = userView.getPhone();
        String email = userView.getEmail();

        /**
         * ***** 재보고/재배정 구분 ********
         */
        String groupID = "555";

        /**
         * ***** 보고관리자 정보 *******
         */
        int sys_auth = 5;
        RepoAdmUser admUser = new RepoAdmUser();
        String admUserID = admUser.getID(deptID, sys_auth);
%>

<%@page import="kr.co.kihyun.lang.MString"%><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">
        <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">

            function checkForm() {
                var frm = document.rereport;
                var contents = $.trim(frm.contents.value);
                frm.contents.value = contents;

                if (contents.length <= 0) {
              //if (frm.contents.value == "        ") {
                    alert("<%=MoumiConfig.getMessageBundle().getString("moumi.message.popup.inputContent")%>");
                    frm.contents.focus();
                    return;
                } else {
            <%if ("RECOG".equals(isRecog)) {%>
                    opener.dform.contents.value = frm.contents.value;
                    opener.dform.action = "/servlet/kr.co.kihyun.beans.totsys.repoadm.HttpRecogUpdate";
                    opener.dform.submit();
                    self.close();
            <%} else {%>
                    opener.prssChange.contents.value = frm.contents.value;
                    opener.prssChange.submit();
                    self.close();
            <%}%>
                }
            }

//            $(document).ready(function() {
//               resizeTo(620, 370);
//            });
        </script>


    </head>
    <body style='' bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="rereport.contents.focus();">
        <FORM name="rereport" action="/servlet/kr.co.kihyun.beans.totsys.memo.HttpReReport" method="post">
            <INPUT type="hidden" name="docID" value="<%= docID%>">
            <INPUT type="hidden" name="groupID" value="<%= groupID%>">
            <INPUT type="hidden" name="userID" value="<%= Encoder.toJava(usID)%>">
            <INPUT type="hidden" name="deptID" value="<%= deptID%>">
            <INPUT type="hidden" name="admUserID" value="<%= admUserID%>">
            <INPUT type="hidden" name="approveUserID" value="<%= Encoder.toJava(userID)%>">
            <table width="600" border="0" cellspacing="0" cellpadding="0" height="350">
                <tr>
                    <td width="29">
                        <img src="images/popupt_top_left.gif" width="29" height="19">
                    </td>
                    <td background="images/popupt_top_center.gif" height="19">&nbsp;</td>
                    <td width="30">
                        <img src="images/popupt_top_right.gif" width="30" height="19">
                    </td>
                </tr>
                <tr>
                    <td background="images/popupt_center_left.gif">&nbsp;</td>
                    <td valign="top">
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <!--타이틀-->
                            <tr>
                                <td style="padding-top: 10px; padding-bottom: 10px">
                                    <table width="100%" height="29" border="0" cellpadding="0" cellspacing="0">
                                        <tr>
                                            <td width="39" background="images/title1.gif">&nbsp;</td>
                                            <td class="kecttep_title" background="images/titlebg.gif">
                                                <%if ("RECOG".equals(isRecog)) {%><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_report.giveBack")%>&nbsp;<%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.reason")%>
                                                <%} else {%>
                                                <%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_report.reinput")%><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.request")%>
                                                &nbsp;<%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.reason")%>
                                                <%}%>
                                            </td>
                                            <td width="13" background="images/title2.gif">&nbsp;</td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <!--타이틀 끝-->

                            <tr>
                                <td height="66" valign="top">
                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                        <tr>
                                            <td height="150" colspan="4" valign="top">
                                                <textarea name="contents" cols="80" rows="11" STYLE="ime-mode: active"></textarea>
                                            </td>
                                        </tr>
                                        <!---- 요청사유 끝 ---->
                                    </table>
                                </td>
                            </tr>
                        </table>
                        <!---- 확인,취소버튼 테이블 시작 ---->
                        <table border="0" cellspacing="0" cellpadding="0" align="center">
                            <tr>
                            <br>
                            <td>
                                <a href="#" onclick="javascript:checkForm();">
                                    <img name="bt_enter" border="0" src="/totsys/common/images/bt_ok.gif" alt="확인" />
                                </a>
                            </td>
                            <td width="10">&nbsp;</td>
                            <td>
                                <a href="#" onclick="javascript:window.close();">
                                    <img name="bt_cancel3" border="0" src="/totsys/common/images/bt_cancle.gif" alt="취소" />
                                </a>
                            </td>
                </tr>
            </table>
            <!---- 확인,취소버튼 테이블  끝 ----></td>
        <td background="images/popupt_center_right.gif">&nbsp;</td>
    </tr>
    <tr>
        <td><img src="images/popupt_bottom_left.gif" width="29" height="24"></td>
        <td background="images/popupt_bottom_center.gif" height="24">&nbsp;</td>
        <td><img src="images/popupt_bottom_right.gif" width="30" height="24"></td>
    </tr>
</table>
</FORM>
</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 {
    }
%>
