<%@ 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"/> %>
<jsp:useBean id="userView" class="kr.co.kihyun.beans.user.UserView" scope="page"/>

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

<%
try{
	/************ Parameter ************/
	String userID = clearXSS(Encoder.toJava(request.getParameter("userID")),"");
	String dirPath = URLEncoder.encode("<a href=\"/totsys/sysadm/user/user_list.jsp\" class=\"d11_blue\">사용자관리</a>");

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

	String deptID = "";
	String deptName = "";
	String passcode = "";
	String domainName = "";
	int partSysAuth = 0;
%>


<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">
		<style>
			td { padding: 2 3 2 3; }
		</style>
	    <script src="/totsys/common/js/rollover.js"></script>
		<SCRIPT language="javascript">
			function formSubmit(){
				if(parent.leftFrame.selected_type == 'dept')
					modifyForm.deptID.value = parent.leftFrame.selected_id;
				if(modifyForm.deptID.value == 'root')
					modifyForm.deptID.value = '';

				if(modifyForm.userID.value == ''){
					alert('사용자ID를 입력해 주세요');
					modifyForm.userID.focus();
				}else if(modifyForm.userName.value == ''){
					alert('사용자명을 입력해 주세요');
					modifyForm.userName.focus();
				}else if(modifyForm.deptID.value == ''){
					alert('소속부서를 선택해주세요.');
				}else if(modifyForm.passwd.value != modifyForm.passwdConfirm.value){
					alert('패스워드가 일치하지 않습니다.');
					modifyForm.passwd.focus();
//				}else if(modifyForm.passcode.value == ''){
//					alert('부서코드를 입력해 주세요');
//					modifyForm.passcode.focus();
//				}else	if(!Check_Num(modifyForm.id.value)){
//						alert('부서ID에 숫자만 입력해 주세요');
//						modifyForm.id.focus();
				}else{
					modifyForm.submit();
				}
			}

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

			function partOpen(url){
				window.open(url ,'' ,'width=384 ,height=457 ,toolbar=no, directories=no, status=no, 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 class="toolbar" align="right">
							<td class="kecttep_title" align="right">사용자등록</td>
						</tr>

						<tr>
							<td height="31" valign="top">
								<FORM name="modifyForm" action="/servlet/kr.co.kihyun.tree.HttpUserRegister" method="post">
									<INPUT type="hidden" name="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;"><input name="userID" class="inputtxt"/></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 bgcolor="F8F8F8" style="padding-left:10;"><input type="password" name="passwd" class="inputtxt"/ ></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 bgcolor="F8F8F8" style="padding-left:10;"><input type="password" name="passwdConfirm" class="inputtxt"/ ></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"/></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"/>
										</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"/></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"/></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="0"/></td>
									</tr>
										<!---- 권한 ---->
										<input type="hidden" name="sysAuth" value="<%= Moumi.TOTPER %>"/>
									<!--
									<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{
}
%>
