UserForm.jsp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  1. <%--
  2. - FileName : UserForm.jsp
  3. - Author : gyeongmo an
  4. - Date : 2014.06.18
  5. - Copyright : Copyright (c) www.udapsoft.co.kr, Inc.
  6. - All rights reserved.
  7. --%>
  8. <%@ page contentType="text/html; charset=UTF-8" %>
  9. <%@ page import="com.udapsoft.waf.system.HandlerStorage" %>
  10. <%@ page import="kr.co.hsnc.common.sql.*" %>
  11. <%@ page import="kr.co.hsnc.common.util.*"%>
  12. <%@ page import="kr.co.udapsoft.ebid.buyer.common.file.FileManager"%>
  13. <%@ page import="com.udapsoft.waf.common.ui.*" %>
  14. <%@ page import="com.udapsoft.waf.common.util.DateUtil" %>
  15. <jsp:useBean id="ctx" class="com.udapsoft.waf.system.context.SessionContext" scope="session" />
  16. <%
  17. ctx.init(request, response);
  18. String fevent = ctx.get("fevent");
  19. HandlerStorage storage = ctx.getHandlerStorage();
  20. ValueObject params = storage.getParams();
  21. ValueObject user = storage.getValueObject("User");
  22. ValueObject vo = storage.getValueObject("USER_INFO_FILE");
  23. RowSet rightRowSet = storage.getRowSet("RightRowSet");
  24. RowSet userRightRowSet = storage.getRowSet("UserRightRowSet");
  25. RowSet acctTypeRowSet = storage.getRowSet("AcctTypeRowSet"); //계정 타입
  26. %>
  27. <SCRIPT language="JavaScript">
  28. function _onReady(){
  29. jQuery("#btnList").click(function() {
  30. var f = document.form1;
  31. f.fevent.value ="";
  32. f.action = "/sycs/user/UserList.screen";
  33. f.target = "_self";
  34. f.submit();
  35. });
  36. jQuery("#btnTest").click(function() {
  37. alert("1");
  38. submitXmlRequest("/sycs/user/UserList_process.screen", "SMS_TEST", document.form1, "SUCCESS");
  39. });
  40. jQuery("#btnPwdInit").click(function() {
  41. if(confirm("비밀번호 초기화 하시겠습니까?")){ //비밀번호 사번으로 초기화
  42. submitXmlRequest("/sycs/user/UserList_process.screen", "SAVE_PWD_INIT", document.form1, "SUCCESS");
  43. }
  44. });
  45. jQuery("#btnSave").click(function() {
  46. var isModify = <%= (user.get("USER_SABUN")!="")?"true":"false"%>;
  47. var f = document.form1;
  48. if( isEmpty(f.user_sabun) ) { // 사원번호
  49. ErrMsg(f.user_sabun, "사원번호를 입력해 주세요.");
  50. return false;
  51. }
  52. if( isEmpty(f.user_pw) ) { // 암호
  53. ErrMsg(f.user_pw, "비밀번호를 입력해 주세요.");
  54. return false;
  55. }
  56. if( f.user_pw.value != f.user_pw2.value ) { //Verify Password check
  57. ErrMsg(f.user_pw2, "비밀번호가 일치하지 않습니다.");
  58. return false;
  59. }
  60. if( getSelectedValue(f.acct_type_id) == "" ) {
  61. ErrMsg(f.acct_type_id, "계정타입을 선택해 주세요.");
  62. return false;
  63. }
  64. if(!checkTelno(f.tel_no.value)) {
  65. ErrMsg(f.tel_no,"전화번호가 올바르지 않은 형식 입니다.");
  66. return false;
  67. }
  68. if(!checkTelno(f.hand_tel_no.value)) {
  69. ErrMsg(f.hand_tel_no,"휴대폰번호가 올바르지 않은 형식입니다.");
  70. return false;
  71. }
  72. if(!checkTelno(f.fax_no.value)) {
  73. ErrMsg(f.fax_no,"팩스번호가 올바르지 않은 형식입니다.");
  74. return false;
  75. }
  76. var rightIDs = "";
  77. for( var i = 0 ; i < f.right_id.options.length ; i++ ) {
  78. rightIDs += f.right_id.options[i].value;
  79. if( i != f.right_id.options.length - 1 )
  80. rightIDs += ", ";
  81. }
  82. f.selected_right_ids.value = rightIDs;
  83. var port = location.port;
  84. if(port == "") port ="80";
  85. if(confirm("저장하시겠습니까?")){
  86. if(isModify == false){
  87. //저장
  88. submitXmlRequest("/sycs/user/UserList_process.screen", "UserForm_Reg", f, "SUCCESS");
  89. }else{
  90. //수정
  91. submitXmlRequest("/sycs/user/UserList_process.screen", "SAVE_USER_LIST", f, "SUCCESS");
  92. }
  93. }
  94. });
  95. }
  96. function dlgSearchInsaUser(){
  97. //var win_id = "_searchUserPopup";
  98. //var link = "/lib/dlgSearchUserPop.screen";
  99. var win_id = "_searchInsaUser";
  100. var link = "/sycs/user/dlgSearchUser.screen";
  101. link += "?pop_win_id="+win_id;
  102. fLayerPop(win_id, link, 870,500, '', '', 'NO');
  103. }
  104. function SearchUserClose(result) {
  105. fLayerPopClose('_searchUserPopup');
  106. }
  107. function searchInsaUserClose(resultArray){
  108. var f = document.form1;
  109. if( resultArray != null ) {
  110. f.user_sabun.value = resultArray[0];
  111. f.user_name.value = resultArray[1];
  112. f.job_Cd.value = resultArray[2]; //현장코드
  113. f.job_dscr.value = resultArray[3]; //현장명
  114. f.buseo_Cd.value = resultArray[4]; //직책코드
  115. f.buseo_nm.value = resultArray[5]; //직책명
  116. f.tel_no.value = resultArray[6]; //전화번호
  117. f.hand_tel_no.value = resultArray[7]; //핸드폰번호
  118. f.e_mail.value = resultArray[8]; //이메일
  119. f.dept_cd.value = resultArray[10]; //부서코드
  120. f.dept_nm.value = resultArray[11]; //부서명
  121. }
  122. fLayerPopClose('_searchInsaUser');
  123. }
  124. function grantRight() {
  125. var origin = document.form1.right_ids;
  126. var originLength = origin.length;
  127. var target = document.form1.right_id;
  128. var targetLength = target.length;
  129. var flag = true;
  130. var count = 0;
  131. for( i = 0 ; i < originLength ; i++ ) {
  132. flag = true;
  133. if( origin.options[i].selected == true ) {
  134. count++;
  135. for( j = 0 ; j < targetLength ; j++ ) {
  136. if( target.options[j].value == origin.options[i].value ) {
  137. alert(origin.options[i].text+" 권한은 이미 설정되어 있습니다.");
  138. flag = false;
  139. break;
  140. }
  141. }
  142. if(flag) {
  143. target.options[targetLength] = document.createElement("OPTION");
  144. target.options[targetLength].text = origin.options[i].text;
  145. target.options[targetLength].value = origin.options[i].value;
  146. targetLength++;
  147. origin.options[i] = null;
  148. originLength--;
  149. i--;
  150. }
  151. }
  152. }
  153. if( count==0 ) {
  154. alert("부여할 권한을 선택해 주세요.");
  155. }
  156. }
  157. function revokeRight() {
  158. var origin = document.form1.right_ids;
  159. var originLength = origin.length;
  160. var target = document.form1.right_id;
  161. var targetLength = target.length;
  162. var flag = true;
  163. var count = 0;
  164. for( i = 0 ; i < targetLength ; i++ ) {
  165. flag= true;
  166. if( target.options[i].selected == true ) {
  167. count++;
  168. for( j = 0 ; j < originLength ; j++ ) {
  169. if( origin.options[j].value == target.options[i].value ) {
  170. flag = false;
  171. break;
  172. }
  173. }
  174. if( flag ) {
  175. origin.options[originLength] = document.createElement("OPTION")
  176. origin.options[originLength].text = target.options[i].text;
  177. origin.options[originLength].value = target.options[i].value;
  178. originLength++;
  179. target.options[i] = null;
  180. i--;
  181. targetLength--;
  182. }
  183. else {
  184. target.options[i] = null;
  185. i--;
  186. targetLength--;
  187. }
  188. }
  189. }
  190. if( count==0 ) {
  191. alert("제거할 권한을 선택해 주세요.");
  192. }
  193. }
  194. function searchAccDept(){
  195. var win_id = "_searchDept";
  196. var link = "/lib/dlgSearchAccDept.screen";
  197. link += "?pop_win_id="+win_id;
  198. fLayerPop(win_id, link, 620,400, '', '', 'NO');
  199. }
  200. function searchAccDeptClose(result){
  201. if( result == null ){
  202. }else{
  203. document.form1.dept_cd.value = result[0]; //부서코드
  204. document.form1.dept_nm.value = result[1]; //부서명
  205. }
  206. fLayerPopClose('_searchDept');
  207. }
  208. function doResult(resultObj) {
  209. try {
  210. if( resultObj.getRequestEvent() == "UserForm_Reg" || resultObj.getRequestEvent() == "SAVE_USER_LIST") {
  211. if( resultObj.getSuccess() ) {
  212. alert("저장했습니다.");
  213. jQuery("#btnList").click();
  214. }
  215. else {
  216. dlgErrorMsg(resultObj);
  217. }
  218. }else if(resultObj.getRequestEvent() == "GET_FILE_LIST_TEXTAREA"){
  219. var resultVO = resultObj.getValueObject();
  220. document.form1.p_AttachFile.value = resultVO.get("file_txt_list");
  221. }else if(resultObj.getRequestEvent() == "SMS_TEST"){
  222. if(resultObj.getSuccess()){
  223. alert("성공하였습니다.");
  224. }else{
  225. alert(resultObj);
  226. }
  227. }else if(resultObj.getRequestEvent() == "SAVE_PWD_INIT"){
  228. if(resultObj.getSuccess()){
  229. alert("비밀번호 초기화하였습니다.");
  230. jQuery("#btnList").click();
  231. }else{
  232. alert(resultObj);
  233. }
  234. }
  235. document.form1.isSubmit = false;
  236. }
  237. catch(errorObject) {
  238. showErrorDlg("doResult()", errorObject);
  239. }
  240. }
  241. //첨부파일
  242. function doAttachFile(obj) {
  243. if(obj==''){
  244. alert("저장을 한 후 파일을 첨부할 수 있습니다.");
  245. }
  246. else if(obj != ''){
  247. // viewFileListNew('USER_INFO', obj.value, document.form1.p_AttachFile, "Y", "cont/cont-1001");
  248. viewFileList('USER_INFO', obj.value, document.form1.p_AttachFile, "Y");
  249. //viewFileList('USER_INFO', obj.value, document.form1.p_AttachFile, "N", "N", "Y");
  250. }
  251. }
  252. /*win dialog로 뛰울시 필수 예약 함수*/
  253. function doAttachFileListSet(){
  254. var f = document.form1;
  255. var url = "/common/file/FileListData.screen?file_gb=USER_INFO&file_id=<%= params.get("acct_id") %>";
  256. submitXmlRequest(url, "GET_FILE_LIST_TEXTAREA", f, "VALUEOBJECT");
  257. }
  258. function doAttachFileDiv(obj) {
  259. if(obj==''){
  260. alert("저장을 한 후 파일을 첨부할 수 있습니다.");
  261. }
  262. else if(obj != ''){
  263. viewFileListNew('USER_INFO', obj.value, document.getElementById("attach_file_view"), "Y", "");
  264. }
  265. }
  266. /**
  267. * 첨부파일 예약 함수
  268. */
  269. function fileDown(file_id){
  270. var url="/common/file/FileDownloadServlet";
  271. url += "?file_id=" + file_id;
  272. window.open(url, "_fileDown", "toolbar=no, width=400, height=100, top=500, left=400, toolbar=no,directories=no,status=no,scrollbars=yes,resize=no,menubar=no,target=new")
  273. }
  274. </SCRIPT>
  275. <FORM name="form1" method="post">
  276. <INPUT type="hidden" name="fevent" value="<%= params.get("fevent") %>">
  277. <INPUT type="hidden" name="acct_id" value="<%= params.get("acct_id") %>">
  278. <INPUT type="hidden" name="dept_nm" value="<%= params.get("dept_nm") %>">
  279. <INPUT type="hidden" name="selected_right_ids" value="">
  280. <INPUT type="hidden" name="job_Cd" value="<%= user.get("PSOSO")%>">
  281. <INPUT type="hidden" name="buseo_Cd" value="<%= user.get("GRADE_CODE")%>">
  282. <INPUT type="hidden" name="p_dept_cd" value="<%= params.get("p_dept_cd")%>">
  283. <INPUT type="hidden" name="p_dept_nm" value="<%= params.get("p_dept_nm")%>">
  284. <INPUT type="hidden" name="p_acct_type_id" value="<%= params.get("p_acct_type_id")%>">
  285. <INPUT type="hidden" name="p_user_sabun" value="<%= params.get("p_user_sabun")%>">
  286. <INPUT type="hidden" name="p_user_name" value="<%= params.get("p_user_name")%>">
  287. <INPUT type="hidden" name="dept_cd2" value="<%= params.get("dept_cd2")%>">
  288. <INPUT type="hidden" name="dept_nm2" value="<%= params.get("dept_nm2")%>">
  289. <INPUT type="file" name="photo" style="display:none;">
  290. <!-- 제목 및 버튼 -->
  291. <table width="100%">
  292. <colgroup>
  293. <col width="500" />
  294. <col width="*" />
  295. </colgroup>
  296. <tr>
  297. <th>
  298. <div align="left" id="title">
  299. <ul>
  300. <li>사용자 등록</li>
  301. </ul>
  302. </div>
  303. </th>
  304. <td align="right">
  305. <span class="btnSearch center"><a href="javascript:void(0);" id="btnSave">저장</a></span>
  306. <span class="btnSearch center"><a href="javascript:void(0);" id="btnList">목록</a></span>
  307. <span class="btnSearch center"><a href="javascript:void(0);" id="btnTest">smsTest</a></span>
  308. <span class="btnSearch center"><a href="javascript:void(0);" id="btnPwdInit">비밀번호 초기화</a></span>
  309. </td>
  310. </tr>
  311. </table>
  312. <!-- 데이터 영역 : 시작 -->
  313. <TABLE class="form-table">
  314. <colgroup>
  315. <col width="10%" />
  316. <col width="40%" />
  317. <col width="10%" />
  318. <col width="*" />
  319. </colgroup>
  320. <TR height="25">
  321. <th class="required"> 사원번호</th>
  322. <TD>
  323. <%= InputText.get("user_sabun", user.get("user_sabun"), 30, 20, "hangule,desc=사번,readOnly, persize") %>
  324. <% if( fevent.equals("UserForm_Reg") ) { %>
  325. <IMG src="/img/buyer/button/bt_search_right.gif" alt="사번검색" border="0" style="cursor:hand" align="absmiddle" onClick="dlgSearchInsaUser();">
  326. <% } %>
  327. </TD>
  328. <th class="required"> 이름</th>
  329. <TD>
  330. <%= InputText.get("user_name", user.get("user_name_k"), 30, 20, "hangule,readOnly, persize") %>
  331. </TD>
  332. </TR>
  333. <TR height="25">
  334. <th class="required"> 비밀번호</th>
  335. <TD>
  336. <%= InputText.get("user_pw", user.get("user_pw"), 30, 10, "password, persize") %>
  337. </TD>
  338. <th class="required"> 비밀번호 확인</th>
  339. <TD>
  340. <%= InputText.get("user_pw2", user.get("user_pw"), 30, 10, "password, persize") %>
  341. </TD>
  342. </TR>
  343. <TR height="25">
  344. <th>전화번호</th>
  345. <TD>
  346. <%= InputText.get("tel_no", user.get("tel_no"), 30, 20, "tel, persize") %>
  347. </TD>
  348. <th>휴대폰번호</th>
  349. <TD>
  350. <%= InputText.get("hand_tel_no", user.get("hand_tel_no"), 30, 20, "tel, persize") %>
  351. </TD>
  352. </TR>
  353. <TR height="25">
  354. <th>팩스번호</th>
  355. <TD>
  356. <%= InputText.get("fax_no", user.get("fax_no"), 30, 20, "tel, persize") %>
  357. </TD>
  358. <th> E-Mail</th>
  359. <TD>
  360. <%= InputText.get("e_mail", user.get("e_mail"), 30, 50, "persize") %>
  361. </TD>
  362. </TR>
  363. <TR height="25">
  364. <th> 투입프로젝트</th>
  365. <TD>
  366. <%= InputText.get("job_dscr", user.get("Assigned_Dept"), 30, 20, "readOnly, persize") %>
  367. </TD>
  368. <th> 직위</th>
  369. <TD>
  370. <%= InputText.get("buseo_nm", user.get("grade_name"), 30, 50, "readOnly, persize") %>
  371. </TD>
  372. </TR>
  373. <TR height="25">
  374. <th> 계정타입</th>
  375. <TD>
  376. <%= HTMLMaker.getSelectTag(acctTypeRowSet, "ACCT_TYPE_ID", "ACCT_TYPE_NAME", "acct_type_id", "width:150px;height=18;", "<option value=''>--Select--</option>", "") %>
  377. <SCRIPT language="JavaScript"> setSelect(document.form1.acct_type_id, "<%= user.get("acct_type_id") %>"); </SCRIPT>
  378. </TD>
  379. <th> 퇴사일자</th>
  380. <TD>
  381. <%= InputText.get("inactive_date", DateUtil.formatDateTime(user.get("inactive_date"), "yyyy-MM-dd", "yyyy-MM-dd"), 30, 50, "READONLY, persize") %>
  382. <% if(!fevent.equals("UserForm_Reg") ) { %>
  383. <IMG name="start_img" src="/img/buyer/button/bt_calender.gif" border="0" align="absmiddle" onClick="JavaScript:dlgCalendar('inactive_date');">
  384. <% } %>
  385. </TD>
  386. </TR>
  387. <TR height="25">
  388. <th> 부서</th>
  389. <TD colspan="3">
  390. <%= InputText.get("dept_cd", user.get("BUSEO"), 5, 10, "ID,ReadOnly,PerSize") %>
  391. <%= InputText.get("dept_nm", user.get("Dept_NAME"), 10, 27, "ID,ReadOnly,PerSize") %>
  392. <% if(!fevent.equals("UserForm_Reg") ) { %>
  393. <IMG onclick="searchAccDept()" src="/img/buyer/button/bt_search_right.gif" alt="부서찾기" border="0" align="absmiddle" style="cursor:hand;">
  394. <% } %>
  395. </TD>
  396. </TR>
  397. <tr>
  398. <th> 첨부파일</th>
  399. <td width="30%" style="padding-top: 3px;" colspan="2">
  400. <TEXTAREA name="p_AttachFile" style="width:95%" rows="1" class="input" readOnly><%=vo.get("USER_INFO_FILE") %></TEXTAREA>
  401. <IMG src="/img/buyer/icon/icon_plus.gif" alt="adjust size" border="0" align="top" onClick="JavaScript:toggleTextarea(this, document.form1.p_AttachFile, 1, 5);" style="cursor:hand;">
  402. <IMG id='search_spot_button' onClick="doAttachFile(document.form1.acct_id);" src='/img/buyer/button/bt_change.gif' border='0' align="top" align='absmiddle' alt='[Attach File]' style='cursor:hand;'>
  403. </td>
  404. <td>
  405. <table width="100%">
  406. <colgroup>
  407. <col width="90%" />
  408. <col width="10%" />
  409. </colgroup>
  410. <tr>
  411. <td>
  412. <div id="attach_file_view" class="attach_file_view">
  413. <!-- 첨부 파일 화면에 바로보일때 사용 -->
  414. <%=FileManager.getFileListForDiv("USER_INFO", params.get("acct_id")) %>
  415. </div>
  416. </td>
  417. <td>
  418. <IMG id='search_spot_button' onClick="doAttachFileDiv(document.form1.acct_id);" src='/img/buyer/button/bt_change.gif' border='0' align="top" align='absmiddle' alt='[Attach File]' style='cursor:hand;'>
  419. </td>
  420. </tr>
  421. </table>
  422. </td>
  423. </tr>
  424. <TR height="155">
  425. <th >권한</th>
  426. <TD colspan="3">
  427. <TABLE cellspacing="0" cellpadding="0" border="0">
  428. <TR>
  429. <TD width="210" align=left>
  430. <SELECT class="input" name="right_ids" size="10" style="width:210px;font-size:12px;" multiple onDblClick="grantRight()" >
  431. <% for( int i = 0 ; i < rightRowSet.size() ; i++ ) { %>
  432. <OPTION value='<%= rightRowSet.getRow(i).get("RIGHT_ID") %>'><%= rightRowSet.getRow(i).get("DSCR") %></OPTION>
  433. <% } %>
  434. </SELECT>
  435. </TD>
  436. <TD width="50" align=center>
  437. <IMG onClick="grantRight()" src="/img/buyer/button/bt_to_right.gif" border="0" style="cursor:hand;" alt="선택한 권한을 부여합니다.">
  438. <BR><BR>
  439. <IMG onClick="revokeRight()" src="/img/buyer/button/bt_to_left.gif" border="0" style="cursor:hand;" alt="부여된 권한중 선택한 권한을 철회합니다.">
  440. </TD>
  441. <TD width="210" align="left" valign="bottom">
  442. <SELECT class="input" name="right_id" size="10" style="width:210px;font-size:12px;" multiple onDblClick="revokeRight()" >
  443. <% for( int i = 0 ; i < userRightRowSet.size() ; i++ ) { %>
  444. <OPTION value='<%= userRightRowSet.getRow(i).get("right_id") %>'><%= userRightRowSet.getRow(i).get("DSCR") %></OPTION>
  445. <% } %>
  446. </SELECT>
  447. </TD>
  448. </TR>
  449. </TABLE>
  450. </TD>
  451. </TR>
  452. </TABLE>
  453. </FORM>