AuthBatchList.jsp 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  1. <%--
  2. - FileName : AuthBatchList.jsp
  3. - Author(s) : gyeongmo an
  4. - Date : 2014.06.22
  5. - Description: 일괄 권한 등록
  6. --%>
  7. <%@ page contentType="text/html; charset=utf-8" %>
  8. <%@ page import="com.udapsoft.waf.system.HandlerStorage" %>
  9. <%@ page import="com.udapsoft.waf.common.ui.*" %>
  10. <%@ page import="kr.co.hsnc.common.util.*"%>
  11. <%@ page import="kr.co.hsnc.common.sql.*" %>
  12. <%@ page import="kr.co.udapsoft.common.code.*" %>
  13. <%@ include file="/jsp/work/taglib.jsp" %>
  14. <jsp:useBean id="ctx" class="com.udapsoft.waf.system.context.SessionContext" scope="session" />
  15. <%
  16. ctx.init(request, response);
  17. HandlerStorage storage = ctx.getHandlerStorage();
  18. ValueObject params = storage.getParams();
  19. ValueObject user = storage.getUser();
  20. String event = storage.getEvent();
  21. RowSet acctTypeRowSet = storage.getRowSet("AcctTypeRowSet"); //계정 타입
  22. //권한
  23. RowSet userRight_rs = storage.getRowSet("userRight_rs"); //전체목록
  24. %>
  25. <SCRIPT language="JavaScript">
  26. /*예약함수*/
  27. var sheet1;
  28. var sheet1Row;
  29. var sheet1PageNo = 1;
  30. var pageLastRowIndex = 1;
  31. var validationResult = false;
  32. var filterShow = false;
  33. function _onReady(){
  34. gridInit(sheet1);
  35. jQuery("#btnSearch").click(function() {
  36. jQuery("#fevent").val("GET_USER_LIST");
  37. var url = Modular.model.PageContext.CONTEXT_ROOT + "/sycs/security/AuthBatchList_sheet.screen";
  38. Modular.view.IBSheet7.doSearch(sheet1, url, jQuery("#form1"), 30, "");
  39. });
  40. jQuery("#btnClear").click(function() {
  41. jQuery("#dept_cd").val("");
  42. jQuery("#dept_nm").val("");
  43. jQuery("#user_sabun").val("");
  44. jQuery("#user_name").val("");
  45. });
  46. jQuery("#btnSave").click(function() {
  47. var target = document.form1.right_id;
  48. var targetLength = target.length;
  49. if (!sheet1.IsDataModified()){
  50. alert("저장할 내역이 없습니다.");
  51. return;
  52. }
  53. document.form1.target_v.value='';
  54. for( j = 0 ; j < targetLength ; j++ ) {
  55. document.form1.target_v.value += target.options[j].value + '/';
  56. }
  57. jQuery("#fevent").val("SAVE_USER_LIST");
  58. var url = Modular.model.PageContext.CONTEXT_ROOT + "/sycs/security/AuthBatchList_sheet.screen";
  59. var result = Modular.view.IBSheet7.doSave(sheet1, url, jQuery("#form1"), false);
  60. });
  61. jQuery("#btnSearchUser").click(function() {
  62. var win_id = "_searchUserPopup";
  63. var link = "/lib/dlgSearchUserPop.screen";
  64. link += "?pop_win_id="+win_id;
  65. fLayerPop(win_id, link, 850,560, '', '', 'NO');
  66. });
  67. jQuery("#btnSearch").click();
  68. }
  69. function gridInit(sheetName){
  70. var init_sheet = {};
  71. init_sheet.Cfg = {SearchMode:2, Page:30};
  72. init_sheet.Cols = [
  73. {Header:'삭제', Type:"Text", SaveName:"DEL_CHECK", Width:50, Align:"Center", Hidden:"True"},
  74. {Header:'상태', Type:"Status", SaveName:"STATUS", Width:80, Align:"Center", Hidden:"True"},
  75. {Header:'선택', Type:"CheckBox", SaveName:"CHECK", Width:70, Align:"Center"},
  76. {Header:'사원번호', Type:"Text", SaveName:"user_sabun", Width:80, Align:"Center"},
  77. {Header:'비밀번호', Type:"Text", SaveName:"user_pw", Width:80, Align:"Center", Hidden:"True"},
  78. {Header:'이름', Type:"Text", SaveName:"user_name", Width:100, Align:"Center" },
  79. {Header:'부서', Type:"Text", SaveName:"dept_nm", Width:100, Align:"Left" },
  80. {Header:'투입프로젝트', Type:"Text", SaveName:"buseo_nm", Width:150, Align:"Left" },
  81. {Header:'직위', Type:"Text", SaveName:"job_dscr", Width:80, Align:"Center" },
  82. {Header:'전화번호', Type:"Text", SaveName:"tel_no", Width:100, Align:"Center"},
  83. {Header:'휴대폰번호', Type:"Text", SaveName:"hand_tel_no", Width:100, Align:"Center"},
  84. {Header:'E-mail', Type:"Text", SaveName:"e_mail", Width:150, Align:"Left"},
  85. {Header:'등록일자', Type:"Text", SaveName:"cre_date", Width:100, Align:"Center"},
  86. {Header:'계정ID', Type:"Text", SaveName:"acct_id", Width:0, Align:"Left", Hidden:"True"}
  87. ];
  88. init_sheet.HeaderMode = {Sort:1};
  89. IBS_InitSheet(sheetName, init_sheet);
  90. sheetName.SetDataAutoTrim(0);
  91. setGridSize();
  92. }
  93. function setGridSize() {
  94. sheet1.FitColWidth();
  95. }
  96. /*예약함수*/
  97. // 저장 처리 결과를 받는 예약 함수
  98. // objects.js, result.xml 참조
  99. function doResult(resultObj) {
  100. try {
  101. if( resultObj.getRequestEvent() == "GET_RIGHT_DATA" ) {
  102. var f = document.form1;
  103. var vo = resultObj.getValueObject();
  104. injectSelect(vo, document.form1.right_id_pre,"RIGHT_ID","RIGHT_NAME");
  105. document.form1.isSubmit = false;
  106. }
  107. }
  108. catch(errorObject) {
  109. showErrorDlg("doResult()", errorObject);
  110. }
  111. }
  112. function removeSelect(){
  113. var selectObj = document.form1.right_id;
  114. while(selectObj.options.length){
  115. selectObj.remove(0);
  116. }
  117. }
  118. //사용자 권한 변경
  119. function injectSelect(vo, selectObj, code, value){
  120. var Code = vo.get(code);
  121. var Value = vo.get(value);
  122. var arrCd = Code.split('|');
  123. var arrValue = Value.split('|');
  124. while(selectObj.options.length){
  125. selectObj.remove(0);
  126. }
  127. var newOpt;
  128. newOpt = document.createElement('option');
  129. if (arrCd == '') {
  130. selectObj.length = 1;
  131. } else {
  132. for(var i = 0; i < arrCd.length; i++){
  133. newOpt = document.createElement('option');
  134. newOpt.text = arrCd[i];
  135. newOpt.value = arrValue[i];
  136. selectObj.options.add(newOpt);
  137. }
  138. }
  139. }
  140. function doKeyPress() {
  141. if( event.keyCode == 13 ) {
  142. jQuery("#btnSearch").click();
  143. }
  144. }
  145. function grantAdd() {
  146. var origin = document.form1.right_id_all;
  147. var originLength = origin.length;
  148. var target = document.form1.right_id;
  149. var targetLength = target.length;
  150. var flag = true;
  151. var count = 0;
  152. for( i = 0 ; i < originLength ; i++ ) {
  153. flag = true;
  154. if( origin.options[i].selected == true ) {
  155. count++;
  156. if(flag) {
  157. for( var ti = 0; ti < targetLength; ti++ ){
  158. if( target.options[ti].value == origin.options[i].value ){
  159. alert('이미 선택한 권한입니다.');
  160. return;
  161. }
  162. }
  163. target.options[targetLength] = document.createElement("OPTION");
  164. target.options[targetLength].text = origin.options[i].text;
  165. target.options[targetLength].value = origin.options[i].value;
  166. targetLength++;
  167. }
  168. }
  169. }
  170. if( count==0 ) {
  171. alert("부여할 권한을 선택하세요!");
  172. }
  173. }
  174. function grantDel() {
  175. var origin = document.form1.right_id_all;
  176. var originLength = origin.length;
  177. var target = document.form1.right_id;
  178. var targetLength = target.length;
  179. var flag = true;
  180. var count = 0;
  181. for( i = 0 ; i < targetLength ; i++ ) {
  182. flag= true;
  183. if( target.options[i].selected == true ) {
  184. count++;
  185. for( j = 0 ; j < originLength ; j++ ) {
  186. if( origin.options[j].value == target.options[i].value ) {
  187. flag = false;
  188. break;
  189. }
  190. }
  191. if( flag ) {
  192. target.options[i] = null;
  193. i--;
  194. targetLength--;
  195. }
  196. else {
  197. target.options[i] = null;
  198. i--;
  199. targetLength--;
  200. }
  201. }
  202. }
  203. if( count==0 ) {
  204. alert("철회할 권한을 선택하세요!");
  205. }
  206. }
  207. //선택된 사용자의 권한 검색
  208. function doChangeRIGHT() {
  209. submitXmlRequest("/sycs/security/AuthBatchList_getRight.screen", "GET_RIGHT_DATA", document.form1, "VALUEOBJECT"); //xmlhttp.js
  210. }
  211. //부서 찾기
  212. function searchAccDept(dept_cd, dept_nm){
  213. var win_id = "_searchAccDept";
  214. var link = "/lib/dlgSearchAccDept.screen";
  215. link += "?pop_win_id="+win_id;
  216. fLayerPop(win_id, link, 600,400, '', '', 'NO');
  217. }
  218. function searchAccDeptClose(result) {
  219. var f = document.form1;
  220. if( result == null ){
  221. f.dept_cd.value = ""; //부서코드
  222. f.dept_nm.value = ""; //부서명
  223. }else{
  224. f.dept_cd.value = result[0]; //부서코드
  225. f.dept_nm.value = result[1]; //부서명
  226. }
  227. fLayerPopClose('_searchAccDept');
  228. }
  229. function sheet1_OnSearchEnd(code, message) {
  230. if(code == 0) {
  231. for(var i=0; i<sheet1.RowCount(); i++) {
  232. sheet1.SetCellEditable(i+1, "user_sabun", false);
  233. sheet1.SetCellEditable(i+1, "user_pw", false);
  234. sheet1.SetCellEditable(i+1, "user_name", false);
  235. sheet1.SetCellEditable(i+1, "dept_nm", false);
  236. sheet1.SetCellEditable(i+1, "buseo_nm", false);
  237. sheet1.SetCellEditable(i+1, "job_dscr", false);
  238. sheet1.SetCellEditable(i+1, "tel_no", false);
  239. sheet1.SetCellEditable(i+1, "hand_tel_no", false);
  240. sheet1.SetCellEditable(i+1, "e_mail", false);
  241. sheet1.SetCellEditable(i+1, "cre_date", false);
  242. sheet1.SetCellEditable(i+1, "acct_id", false);
  243. }
  244. setGridSize();
  245. if(sheet1.LastRow()>1){
  246. document.form1.f_acct_id.value = sheet1.GetCellValue(1, "acct_id");
  247. doChangeRIGHT();
  248. }
  249. } else {
  250. //alert(message);
  251. alert("조회 실패");
  252. }
  253. }
  254. function sheet1_OnClick(Row, Col, Value, CellX, CellY, CellW, CellH) {
  255. var f = document.form1;
  256. if ( sheet1.ColSaveName(Col) != "CHECK" ) {
  257. document.form1.f_acct_id.value = sheet1.GetCellValue(Row, "acct_id");
  258. doChangeRIGHT();
  259. }
  260. }
  261. function sheet1_OnSaveEnd(code, msg) {
  262. if(code >= 0) {
  263. document.form1.isSubmit = false;
  264. alert("저장 성공");
  265. removeSelect();
  266. jQuery("#btnSearch").click();
  267. } else {
  268. //alert(msg);
  269. alert("저장 실패");
  270. }
  271. }
  272. function SearchUserClose(result) {
  273. fLayerPopClose('_searchUserPopup');
  274. }
  275. function autoResize(){
  276. var t1_height = document.getElementById("search-table").scrollHeight + document.getElementById("title").scrollHeight + 24;
  277. var iframeHeight= document.body.scrollHeight - t1_height;
  278. sheet1.SetSheetHeight(iframeHeight);
  279. }
  280. function sheet1_OnSmartResize(Width, Height) {
  281. sheet1.FitColWidth();
  282. autoResize();
  283. }
  284. document.body.onresize = addEvent( document.body.onresize, "autoResize()");
  285. </SCRIPT>
  286. <modular:search id="form1">
  287. <modular:key id="fevent" />
  288. </modular:search>
  289. <form id="form1" name="form1" method="post" modular:type="search" style="width:100%;height:100%;">
  290. <INPUT type="hidden" name="p_user_sabun" value="">
  291. <INPUT type="hidden" name="fevent" value="">
  292. <INPUT type="hidden" name="p_user_pw" value="">
  293. <INPUT type="hidden" name="p_buseo_nm" value="">
  294. <INPUT type="hidden" name="p_job_dscr" value="">
  295. <INPUT type="hidden" name="p_tel_no" value="">
  296. <INPUT type="hidden" name="p_hand_tel_no" value="">
  297. <INPUT type="hidden" name="p_e_mail" value="">
  298. <INPUT type="hidden" name="p_user_name" value="">
  299. <INPUT type="hidden" name="acct_id" value="">
  300. <INPUT type="hidden" name="j_usertype" value="head">
  301. <input type='hidden' name='login_id' >
  302. <input type='hidden' name='login_pw' >
  303. <INPUT type="hidden" name="j_admin_login_gb" value="Y">
  304. <INPUT type="hidden" name="f_acct_id" value="">
  305. <INPUT type="hidden" name="target_v" value="">
  306. <div align="left" id="title">
  307. <ul>
  308. <li>권한 일괄 관리</li>
  309. </ul>
  310. </div>
  311. <!-- 검색조건 시작 -->
  312. <table id="search-table" class="search-form-table" style="width:100%;">
  313. <colgroup>
  314. <col width="100" />
  315. <col width="400" />
  316. <col width="100" />
  317. <col width="*" />
  318. <col width="300" />
  319. </colgroup>
  320. <tr>
  321. <th>부서</th>
  322. <td>
  323. <%= InputText.get("dept_cd", params.get("dept_cd"), 12, 10, "ID,ReadOnly,PerSize") %>
  324. <%= InputText.get("dept_nm", DeptCodeManager.getDeptName(params.get("dept_cd")), 50, 30, "ID,ReadOnly,PerSize") %>
  325. <IMG onclick="searchAccDept(document.form1.dept_cd, document.form1.dept_nm)" src="/img/buyer/button/bt_search_right.gif" alt="부서찾기" border="0" align="absmiddle" style="cursor:hand;">
  326. </td>
  327. <th>계정타입</th>
  328. <td>
  329. <%= HTMLMaker.getSelectTag(acctTypeRowSet, "ACCT_TYPE_ID", "ACCT_TYPE_NAME", "acct_type_id", "width:40%;height=18;", "<option value=''>--선택--</option>", "") %>
  330. </td>
  331. <td class="button" rowspan="2">
  332. <span class="btnSearch center"><a href="javascript:void(0);" id="btnSearch">검색</a></span>
  333. <span class="btnSearch center"><a href="javascript:void(0);" id="btnClear">초기화</a></span>
  334. <span class="btnSearch center"><a href="javascript:void(0);" id="btnSave">저장</a></span>
  335. <!-- <span class="btnSearch center"><a href="javascript:void(0);" id="btnSearchUser">유저검색</a></span> -->
  336. </td>
  337. </tr>
  338. <tr>
  339. <th>사원번호</th>
  340. <td>
  341. <%= InputText.get("user_sabun", "", 65, 50, "hangule, desc=사번, PerSize") %>
  342. </td>
  343. <th>이름</th>
  344. <td>
  345. <INPUT type="text" name="user_name" value="<%=params.get("user_name") %>" maxlength="50" class="input" style="IME-MODE : active;width:39%;" desc='성명' onKeyPress="doKeyPress();">
  346. </td>
  347. </tr>
  348. </table>
  349. <!-- 검색조건 종료 -->
  350. <TABLE border="0" cellspacing="0" cellpadding="0" width="100%">
  351. <TR >
  352. <TD width="*" rowspan="5">
  353. <div id="sheet1_div" style="padding-top:5px; height: auto; min-height: 680px; overflow: auto;">
  354. <SCRIPT>createIBSheet('sheet1', '98%', '680px');</SCRIPT>
  355. </div>
  356. </TD>
  357. <TD width="10px" rowspan="5">
  358. </TD>
  359. <TD width="200px" height="30%">
  360. <TABLE width="100%" cellspacing="0" cellpadding="0" bordercolordark="#FFFFF" bordercolorlight="#d2d2d2" border="1">
  361. <TR height="26">
  362. <Th>현재 권한</Th>
  363. </TR>
  364. <TR height="180">
  365. <TD align=center valing=center class="search_table_input2">
  366. <select name="right_id_pre" size="10" style="width:220px;">
  367. <OPTION value=''></OPTION>
  368. </select>
  369. </TD>
  370. </TR>
  371. </TABLE>
  372. </TD>
  373. </TR>
  374. <TR>
  375. <td height="5%">
  376. </td>
  377. </TR>
  378. <TR>
  379. <td height="30%">
  380. <TABLE width="100%" cellspacing="0" cellpadding="0" bordercolordark="#FFFFF" bordercolorlight="#d2d2d2" border="1">
  381. <TR height="26">
  382. <th>권한 종류</th>
  383. </TR>
  384. <TR height="180">
  385. <TD align=center valing=center class="search_table_input2">
  386. <select name="right_id_all" size="10" onDblClick="grantAdd()" style="width:220px;">
  387. <% for( int i = 0 ; i < userRight_rs.size(); i++ ) { %>
  388. <OPTION value='<%=userRight_rs.getRow(i).get("RIGHT_ID")%>'><%=userRight_rs.getRow(i).get("RIGHT_NAME")%></OPTION>
  389. <% } %>
  390. </select>
  391. </TD>
  392. </TR>
  393. </TABLE>
  394. </td>
  395. </TR>
  396. <TR>
  397. <td height="5%" align="center">
  398. <IMG onClick="grantAdd()" src="/img/buyer/button/bt_to_down.gif" border="0" style="cursor:hand;" alt="선택한 권한을 부여합니다.">
  399. <IMG onClick="grantDel()" src="/img/buyer/button/bt_to_up.gif" border="0" style="cursor:hand;" alt="부여된 권한중 선택한 권한을 철회합니다.">
  400. </td>
  401. </TR>
  402. <TR>
  403. <td height="30%">
  404. <TABLE width="100%" cellspacing="0" cellpadding="0" bordercolordark="#FFFFF" bordercolorlight="#d2d2d2" border="1">
  405. <TR height="26">
  406. <th>적용할 권한</th>
  407. </TR>
  408. <TR height="180">
  409. <TD align=center valing=center class="search_table_input2">
  410. <select name="right_id" size="10" onDblClick="grantDel()" style="width:220px;">
  411. </select>
  412. </TD>
  413. </TR>
  414. </TABLE>
  415. </td>
  416. </TR>
  417. </TABLE>
  418. </FORM>