<%@ 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.Moumi"%>
<%@ page import="kr.co.kihyun.text.html.ServletUtil" %>
<%@ page import="kr.co.kihyun.beans.user.HttpSSOLogin" %>
<%@ page import="java.net.URLEncoder" %>

<jsp:useBean id="userView" class="kr.co.kihyun.beans.totsys.sysadm.user.UserView" scope="page"/>

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

<%
try{
	/************ Parameter ************/
	String strPage	= "";
	String findOption		= "";
	String findWord	= "";
	String userID = "";

	String dirPath = URLEncoder.encode("<a href=\"/totsys/sysadm/user/user_list.jsp\" class=\"d11_blue\">사용자관리</a>");
	String uri = URLEncoder.encode("./user_list.jsp?findOption="+findOption+"&findWord="+findWord);

	strPage	 = clearXSS(request.getParameter("strPage"),"");
	findOption = clearXSS(MString.checkNull(request.getParameter("findOption")),"");
	findWord = clearXSS(Encoder.toJava(request.getParameter("findWord")),"");
	userID = clearXSS(Encoder.toJava(request.getParameter("userID")),"");


	/************ User values ************/
	String passWord = "";
	String userName = "";
	//String slNo1 = "";
	//String slNo2 = "";
	String email = "";
	String phone = "";
	//String handTell = "";
	int sysAuth = 0;

	String deptID = "";
	String deptName = "";
	String passcode = "";
	String partID = "";
	String partName = "";
	String domainName = "";
	int partSysAuth = 0;
	String dutyName = "";
	int priority = 0;
        
        //v2. 13.SQL 삽입 : userView.executeQuery()에서 prepare SQL 문으로 되어 있다.
	userView.executeQuery(userID);
        //=================
        
	passWord = userView.getPasswd();
	userName = userView.getName();
	email = userView.getEmail();
	phone = userView.getPhone();
	sysAuth = userView.getSysAuth();
	deptID = userView.getDeptID();
	deptName = userView.getDeptName();
	passcode = userView.getPasscode();
	partSysAuth = userView.getPartSysAuth();
	domainName = MString.checkNull(userView.getDomainName());
	dutyName = userView.getDutyName();
	priority = userView.getPriority();
%>



<%@page import="kr.co.kihyun.beans.entity.MUser"%><HTML>
	<HEAD>
		<TITLE><%=Moumi.getTitle()%></TITLE>
		<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
	    <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 language="javascript">
			function formSubmit(){
				if(modifyForm.userID.value == ''){
					alert('사용자ID를 입력해 주세요');
					modifyForm.userID.focus();
				}else if(modifyForm.userName.value == ''){
					alert('사용자명을 입력해 주세요');
					modifyForm.userName.focus();
				}else if(modifyForm.deptID.value == ''){
					alert('소속부서를 입력해 주세요');
					partOpen('/totsys/common/web/dept_search/popup_admuser_part_search.jsp');
				} else{
					modifyForm.submit();
				}
			}

			function userDocDel(userID){
				if (confirm('해당 사용자의 모든 문서를 삭제하시겠습니까?')) {
					document.location.replace('/servlet/kr.co.kihyun.beans.totsys.sysadm.user.HttpUserDocDeleter?strPage=<%= strPage %>&findOption=<%= findOption %>&findWord=<%= findWord%>&userID='+userID);
					return true;
				} else {
					return false;
				}
			}

			function partOpen(url){
				window.open(url ,'' ,'width=384 ,height=450 ,toolbar=no, directories=yes, status=yes, menubar=no, resizable=no');
			}
		</SCRIPT>
	</HEAD>

	<body style='overflow:auto' BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 >
		<table width="100%" height="70" border="0" cellpadding="0" cellspacing="0">
			<!---- top menu 시작 ---->
			<jsp:include page="/totsys/common/inc/sysadm/top/top.jsp" flush="true">
				<jsp:param name="dirPath" value="<%= dirPath %>"/>
			</jsp:include>
			<!---- top menu  끝 ---->

			<tr>
				<td  nowrap width="0"></td>
				<td valign="top">
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td >
								<jsp:include page="toolbar.jsp" flush="true">
									<jsp:param name="userID" value="<%= userID %>"/>
								</jsp:include>
							</td>
						</tr>
						<tr>
							<td height="31" valign="top">
								<FORM name="modifyForm" action="/servlet/kr.co.kihyun.tree.HttpUserModifier" method="post">
									<INPUT type="hidden" name="userID" value="<%= userID %>">
									<INPUT type="hidden" name="deptID" value="<%= deptID %>">
									<input type="hidden" name="dept_Old" value="<%= deptID %>">
								<table border="1px" class="kecttep_list_table" bordercolor="#e3e3e3" width="100%" cellpadding="0" cellspacing="0">
									<!---- 아이디 ---->
									<tr>
										<td width="100" height="31" class="kecttep_tdmenu" style="padding-left:10;"><img src="/totsys/common/images/icon.gif" align="middle">&nbsp;&nbsp;<b>ID</b></td>
										<td class="kecttep_last_graytd" style="padding-left:10;"><%= MString.checkNull(userID) %>&nbsp;&nbsp;&nbsp;<!--a href="#" onclick="userDocDel('<%--= userID--%>');"><img src="/totsys/common/images/bt_file_del.gif" border="0" align="middle"></a--></td>
									</tr>
									<!---- 이름 ---->
									<tr>
										<td height="31" class="kecttep_tdmenu" style="padding-left:10;"><img src="/totsys/common/images/icon.gif" align="middle">&nbsp;&nbsp;<b>이 름</b></td>
										<td class="kecttep_last_graytd" style="padding-left:10;"><input name="userName" class=inputtxt value="<%= MString.checkNull(userName) %>"></td>
									</tr>
										<!---- 소속기관/부서 ---->
									<tr>
										<td height="31" class="kecttep_tdmenu" style="padding-left:10;"><img src="/totsys/common/images/icon.gif" align="middle">&nbsp;&nbsp;<b>소속기관/부서</b></td>
										<td class="kecttep_last_graytd" style="padding-left:10;">
											<input size=31 readonly name="deptName" class=inputtxt value="<%= MString.checkNull(deptName) %>" onclick="partOpen('/totsys/sysadm/org/popup_dept_list.jsp?formName=modifyForm');">
										</td>
									</tr>
									<!---- 전화번호---->
									<tr>
										<td height="31" class="kecttep_tdmenu" style="padding-left:10;"><img src="/totsys/common/images/icon.gif" align="middle">&nbsp;&nbsp;<b>전화번호 </b></td>
										<td class="kecttep_last_graytd" style="padding-left:10;">
											<input name="phone" class=inputtxt size="14" maxlength="13" value=<%=MString.checkNull(phone) %>>
										</td>
									</tr>
										<!---- E-MAIL ---->
									<tr>
										<td height="31" class="kecttep_tdmenu" style="padding-left:10;"><img src="/totsys/common/images/icon.gif" align="middle">&nbsp;&nbsp;<b>E-MAIL</b></td>
										<td class="kecttep_last_graytd" style="padding-left:10;"><input size=35 name="email" class=inputtxt value="<%= MString.checkNull(email) %>"></td>
									</tr>
										<!---- 직위명 ---->
									<tr>
										<td height="31" class="kecttep_tdmenu" style="padding-left:10;"><img src="/totsys/common/images/icon.gif" align="middle">&nbsp;&nbsp;<b>직위명</b></td>
										<td class="kecttep_last_graytd" style="padding-left:10;"><input size=35 name="dutyName" class=inputtxt value="<%= MString.checkNull(dutyName) %>"></td>
									</tr>
									<!-- 문서수발담당자 -->
									<tr>
										<td height="31" class="kecttep_tdmenu"><img src="/totsys/common/images/icon.gif" align="middle">&nbsp;&nbsp;<b>문서수발담당자</b></td>
                                                                                 <%--
										<%
										<td class="kecttep_last_graytd"><input name="naraAuth" type="checkbox"<%= MUser.NaraAuth.MOUMI_DOCUMENTS_OFFICER.getCode().equals(userView.getNaraAuth()) ? " checked=\"yes\"" : ""%>/></td>
										%>
										--%>

										<td class="kecttep_last_graytd"><input name="naraAuth" type="checkbox"/></td>
									</tr>
									<!---- 정렬순위 ---->
									<tr>
										<td height="31" class="kecttep_tdmenu" style="padding-left:10;"><img src="/totsys/common/images/icon.gif" align="middle">&nbsp;&nbsp;<b>정렬순위</b></td>
										<td class="kecttep_last_graytd" style="padding-left:10;"><input name="priority" type="text" class="inputtxt" size="10" maxlength="10" value="<%= priority %>"/></td>
									</tr>
										<!---- 권한 ---->
										<input type="hidden" name="sysAuth" value="<%= sysAuth %>"/>
									<!--
									<tr>
										<td height="31" class="kecttep_tdmenu" style="padding-left:10;"><img src="/totsys/common/images/icon.gif" align="middle">&nbsp;&nbsp;<b>권한</b></td>
										<td class="kecttep_last_graytd" style="padding-left:10;">
											<input type="radio" name="sysAuth" value="radiobutton">상위집계자
											<input type="radio" name="sysAuth" value="radiobutton">하위집계자
											<input type="radio" name="sysAuth" value="radiobutton">보고자
										<%
										if(sysAuth == Moumi.SYSADM){	%>
														시스템 관리자 <INPUT type="hidden" name="sysAuth" value="<%= Moumi.SYSADM %>">
										<%	}else if(sysAuth == Moumi.TOTADM){	%>
														집계 관리자	<INPUT type="hidden" name="sysAuth" value="<%= Moumi.TOTADM %>">
										<%	}else if(sysAuth == Moumi.SUB_SYSADM){	%>
														자료집계 담당자<INPUT type="hidden" name="sysAuth" value="<%= Moumi.SUB_SYSADM %>">
										<%	}else if(sysAuth == Moumi.SUB_TOTADM){	%>
														기관 집계 관리자	<INPUT type="hidden" name="sysAuth" value="<%= Moumi.SUB_TOTADM %>">
										<%	}else if(sysAuth == Moumi.REPOADM){	%>
														보고 관리자	<INPUT type="hidden" name="sysAuth" value="<%= Moumi.REPOADM %>">
										<%	}else if(sysAuth == Moumi.TOTPER){	%>
														<INPUT type=radio CHECKED value="<%= Moumi.TOTPER %>" name="sysAuth">상위 집계자
														<INPUT type=radio value="<%= Moumi.SUB_SYSADM %>" name="sysAuth">자료집계 담당자
														<INPUT type=radio value="<%= Moumi.SUB_TOTPER %>" name="sysAuth">하위 집계자
														<INPUT type=radio value="<%= Moumi.REPOPER %>" name="sysAuth">보고자
										<%	}else if(sysAuth == Moumi.SUB_TOTPER){	%>
														<INPUT type=radio value="<%= Moumi.TOTPER %>" name="sysAuth">상위 집계자
														<INPUT type=radio CHECKED value="<%= Moumi.SUB_TOTPER %>" name="sysAuth">하위 집계자
														<INPUT type=radio value="<%= Moumi.REPOPER %>" name="sysAuth">보고자
										<%	}else{	%>
														<INPUT type=radio value="<%= Moumi.TOTPER %>" name="sysAuth">상위 집계자
														<INPUT type=radio value="<%= Moumi.SUB_TOTPER %>" name="sysAuth">하위 집계자
														<INPUT type=radio CHECKED value="<%= Moumi.REPOPER %>" name="sysAuth">보고자
										<%	}	%>
										</td>
									</tr>
									-->
								</table>
								</FORM>
							</td>
						</tr>
						<tr>
							<td>
								<table border="0" cellspacing="0" cellpadding="0" align="center">
									<!----  버튼 (확인, 취소) ---->
									<tr align="center">
										<td height="10" style="padding: 5px;"><a href="#" onclick="javascript:formSubmit();" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('bt_enter','','./images/bt_enter.gif',1)"><img name="bt_enter" border="0" src="./images/bt_enter.gif" ></a></td>
										<td height="10" style="padding: 5px;"><a href="#" onclick="javascript:history.go(-1)" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('bt_cancel3.gif','','./images/bt_cancel3.gif',1)"><img name="bt_cancel3.gif" border="0" src="./images/bt_cancel3.gif" ></a></td>
									</tr>
								</table>
							</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){
        //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{
}
%>
