<%@ page contentType="text/html; charset=UTF-8"%>
<%@ page import="kr.co.kihyun.lang.MString"%>
<%@ page import="kr.co.kihyun.lang.Encoder"%>
<%@ page import="kr.co.kihyun.moumi.MoumiConfig"%>
<%@ page import="kr.co.kihyun.text.html.ServletUtil"%>
<%@ page import="kr.co.kihyun.beans.user.HttpSSOLogin"%>
<%@ page import="java.net.URLEncoder"
         import="java.util.Date"
         import="java.text.SimpleDateFormat" import="kr.co.kihyun.util.MDate"
         import="kr.co.kihyun.lang.MLong" import="kr.co.kihyun.lang.MString"
         import="kr.co.kihyun.moumi.Moumi" import="kr.co.kihyun.moumi.MoumiUtil"
         import="kr.co.kihyun.beans.user.HttpSSOLogin"
         import="kr.co.kihyun.beans.user.UserGroup"
         import="kr.co.kihyun.beans.user.User"
         import="kr.co.kihyun.beans.user.UserGroupList"
         import="kr.co.kihyun.beans.user.Dept"
         import="kr.co.kihyun.lang.Encoder"
         import="kr.co.kihyun.beans.entity.MUser" import="java.util.List"
         import="javax.jdo.PersistenceManager" import="javax.jdo.Transaction"
         import="kr.co.kihyun.beans.entity.*"
         import="kr.co.kihyun.beans.entity.util.*"
         import="kr.co.kihyun.beans.entity.UserPart" import="java.util.HashMap"
         import="java.util.Map"
         import="kr.co.kihyun.moumi.Moumi"
         %>


<%@ include file="/totsys/common/inc/sec/secure.inc.jsp"%>
<%  PersistenceManager pm = new MPersistenceManager(PMF.get().getPersistenceManager());
    Transaction tx = pm.currentTransaction();
    try {
        /**
         * ********** Parameter ***********
         */
        String strPage = clearXSS(request.getParameter("strPage"), "");
        String findOption = clearXSS(MString.checkNull(request.getParameter("findOption")), "");
        String findWord = clearXSS(Encoder.toJava(request.getParameter("findWord")), "");
//        String userID = clearXSS(Encoder.toJava(request.getParameter("userID")), "");
        String returnSysAuth = clearXSS(Encoder.toJava(request.getParameter("sysAuth")), "");

        /**
         * *** user Login check ****************
         */
        if (!HttpSSOLogin.isLogin(request)) {
            String connURL = "parent.location='/totsys/login/login.jsp';";
            out.println(ServletUtil.getJavaScript(connURL));
            return;
        }

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

        tx.begin();

        /**
         * ********** User values ***********
         */
        MUser mUser = pm.getObjectById(MUser.class, userID);
        String passwd = mUser.getPassword();
        String userName = mUser.getName(pm);
        String email = mUser.getEmail();
        String phone = mUser.getPhone();
        SysAuth sysAuth = mUser.getSysAuth();
        String deptID = mUser.getUpperDept(pm).getId();
        String deptName = mUser.getUpperDept(pm).getName();
        String dutyName = mUser.getDutyName();
        Long priority = mUser.getPriority();

        tx.rollback();
%>
<!DOCTYPE html>
	<html lang="ko">
		<head>
		<meta charset="UTF-8">
		<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">
        <link rel="stylesheet" href="/totsys/common/css/popup.css" type="text/css">
		<link rel="stylesheet" href="/totsys/common/css/basic.css" type="text/css">
        <script src="/totsys/common/js/rollover.js"></script>
        <script src="/totsys/common/js/popup.js"></script>
        <script src="/totsys/common/js/find.js"></script>
        <script src="/totsys/common/js/mouse.js"></script>
        <script src="/totsys/common/js/jquery-1.12.4.min.js"></script>
        <SCRIPT>
            function userModify() {
                if (confirm("사용자 정보를 변경하시겠습니까?"))
                {
                    dform.submit();
                }
            }
        </SCRIPT>
    </HEAD>
    <body>
        <table style="width: 100%">
            <jsp:include page="/totsys/common/inc/sysadm/top/top.jsp" flush="true" />
            <tr>
                <td>
                	<form name="dform" action="/servlet/kr.co.kihyun.beans.user.HttpUserModifyPer" method="post">
                	<div class="title">
                    	<div>개인정보</div>
                    </div>
                    <table style="width: 100%">
                            <input type="hidden" name="userID" value="<%=URLEncoder.encode(userID, "UTF-8")%>">
                            <tr>
                                <td style="height: 31px; vertical-align: top;">
                                    <table class="kecttep_list_table" style="width: 100%">
                                        <!-- 아이디 -->
                                        <tr>
                                            <td class="kecttep_tdmenu_middle" style="padding-left: 10px; width: 100px; height: 31px;">
                                                <img alt="글머리" src="/totsys/common/images/icon.gif" align="middle">&nbsp;&nbsp;<b>ID</b>
                                            </td>
                                            <td class="kecttep_last_graytd" style="padding-left: 10px;">&nbsp;<%= MString.checkNull(userID)%></td>
                                        </tr>
                                        <!-- 이름 -->
                                        <tr>
                                            <td class="kecttep_tdmenu_middle" style="padding-left: 10px; height: 31px;">
                                            	<img alt="글머리" src="/totsys/common/images/icon.gif" align="middle">&nbsp;&nbsp;<b><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.userName")%></b>
                                        	</td>
                                            <td class="kecttep_last_graytd" style="padding-left: 10px;">&nbsp;<%= MString.checkNull(userName)%></td>
                                        </tr>
                                        <!-- 소속기관/부서 -->
                                        <tr>
                                            <td class="kecttep_tdmenu_middle" style="padding-left: 10px; height: 31px;">
                                            	<img alt="글머리" src="/totsys/common/images/icon.gif" align="middle">&nbsp;&nbsp;<b><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.belongTo")%><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.coporation")%>/<%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.devision")%></b>
                                        	</td>
                                            <td class="kecttep_last_graytd" style="padding-left: 10px;">&nbsp;<%= MString.checkNull(deptName)%></td>
                                        </tr>
                                        <!-- 전화번호-->
                                        <tr>
                                            <td class="kecttep_tdmenu_middle" style="padding-left: 10px; height: 31px;">
                                             	<img alt="글머리" src="/totsys/common/images/icon.gif" align="middle">&nbsp;&nbsp;<b><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.telNumber")%></b>
                                            </td>
                                            <td class="kecttep_last_graytd" style="padding-left: 10px;">&nbsp;
                                            	<input type="text"  name="phone" class="inputtxt tac" value="<%=MString.checkNull(phone)%>">
                                            </td>
                                        </tr>
                                        <!-- E-MAIL -->
                                        <tr>
                                            <td class="kecttep_tdmenu_middle" style="padding-left: 10px; height: 31px;">
                                            	<img alt="글머리" src="/totsys/common/images/icon.gif" align="middle">&nbsp;&nbsp;<b>E-MAIL</b></td>
                                            <td class="kecttep_last_graytd" style="padding-left: 10px;">&nbsp;
                                            	<input type="text"  name="email" class="inputtxt tac" value="<%= MString.checkNull(email)%>">
                                        	</td>
                                        </tr>
                                        <!-- 권한 -->
                                        <tr>
                                            <td class="kecttep_tdmenu" style="padding-left: 10px; height: 31px;">
                                                <img src="/totsys/common/images/icon.gif" align="middle">&nbsp;&nbsp;<b>권한</b></td>
                                            <td class="kecttep_last_graytd_bottom" style="padding-left: 10px;">
                                                &nbsp;<%= sysAuth%>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                    	</table>
                    </form>
                </td>
            </tr>
            <!-- top menu start -->
            <%@ include file="/totsys/common/inc/buttom/buttom.jsp"%>
            <!-- top menu end -->
        </table>
         
        <div class="mt_10 tac">
        	<a href="#" onclick="userModify()">
               <img src="/totsys/common/images/bt_save.gif" title="<%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.info")%><%=MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.change")%>" />
           </a>
           <a href="javascript:window.close()">
               <img src="/totsys/common/images/bt_cancle.gif" title="취소" />
           </a>
       	</div>
    </BODY>
</HTML>
<%
    } catch (Exception ex) {
        //38.오류메세지를 통한 정보 노출(getMessage)_CWE-209 : Update by YOUNGJUN,CHO
        ex.printStackTrace();
        //out.println(ex);
        //out.println("<html><body style='overflow=auto' bgcolor='white'><h1>Can't contact servlet runner</h1><br><br>Message : " + ex.getMessage() + "</body></html>");
        //out.println("<META HTTP-EQUIV='refresh' CONTENT='0.1; URL=/error/exception.jsp'>");
        //================================================
    } finally {
        if (tx.isActive()) {
            tx.rollback();
        }
        pm.close();
    }
%>
