You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

159 lines
7.2 KiB

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
  1. <div class="page-header" data-fit-aside>
  2. <h1 class="page-title">게시판 관리</h1>
  3. </div>
  4. <div class="ax-button-group" data-fit-aside>
  5. <button type="button" class="btn btn-primary" onclick="grid.form();"><i class="fal fa-plus"></i> 게시판 신규등록</button>
  6. </div>
  7. <div class="grid-wrapper" data-fit-content>
  8. <div id="grid-container" class="grid-container"></div>
  9. </div>
  10. <script>
  11. var grid = new GRID('#grid-container', {
  12. columns: [
  13. {caption:'고유KEY', dataField:'brd_key', width:80, alignment:'left'},
  14. {caption:'게시판이름', dataField:'brd_title', minWidth:100, alignment:'left'},
  15. {
  16. caption:'타입', dataField:'brd_type', width:60, alignment:'center',
  17. customizeText:function(cell) {
  18. if(cell.value == 'list') return '목록형';
  19. else if (cell.value == 'gallery') return '앨범형';
  20. else if (cell.value == 'webzine') return '웹진형';
  21. }
  22. },
  23. {
  24. caption:'스킨',
  25. columns: [
  26. {caption:'목록', dataField:'brd_skin_l', width:80, alignment:'left'},
  27. {caption:'목록(M)', dataField:'brd_skin_l_m', width:80, alignment:'left'},
  28. {caption:'글쓰기', dataField:'brd_skin_w', width:80, alignment:'left'},
  29. {caption:'글쓰기(M)', dataField:'brd_skin_w_m', width:80, alignment:'left'},
  30. {caption:'글보기', dataField:'brd_skin_v', width:80, alignment:'left'},
  31. {caption:'글보기(M)', dataField:'brd_skin_v_m', width:80, alignment:'left'},
  32. {caption:'댓글', dataField:'brd_skin_c', width:80, alignment:'left'},
  33. {caption:'댓글 (M)', dataField:'brd_skin_c_m', width:80, alignment:'left'},
  34. ]
  35. },
  36. {caption:'목록개수', dataField:'brd_page_rows', width:60, alignment:'right', dataType:'number', format:'fixedPoint'},
  37. {caption:'현재글수', dataField:'brd_count_post', width:60, alignment:'right', dataType:'number', format:'fixedPoint'},
  38. {
  39. caption:'기능사용',
  40. columns: [
  41. {caption:'카테고리', dataField:'brd_use_category', alignment:'center', width:60, customizeText:function(cell){return cell.value == 'Y'?'사용':''}},
  42. {caption:'답글기능', dataField:'brd_use_reply', alignment:'center', width:60, customizeText:function(cell){return cell.value == 'Y'?'사용':''}},
  43. {caption:'댓글기능', dataField:'brd_use_comment', alignment:'center', width:60, customizeText:function(cell){return cell.value == 'Y'?'사용':''}},
  44. {caption:'익명', dataField:'brd_use_category', alignment:'center', width:60, customizeText:function(cell){return cell.value == 'Y'?'사용':(cell.value == 'A'?'강제사용':'')}},
  45. {caption:'비밀글', dataField:'brd_use_category', alignment:'center', width:60, customizeText:function(cell){return cell.value == 'Y'?'사용':(cell.value == 'A'?'강제사용':'')}},
  46. {caption:'첨부파일', dataField:'brd_use_attach', alignment:'center', width:60, customizeText:function(cell){return cell.value == 'Y'?'사용':''}},
  47. {caption:'이름가리기', dataField:'brd_blind_nickname', alignment:'center', width:75, customizeText:function(cell){return cell.value == 'Y'?'사용':''}},
  48. ]
  49. },
  50. {
  51. caption:'권한레벨',
  52. columns: [
  53. {caption:'목록', dataField:'brd_lv_list', width:60, alignment:'right', dataType:'number', format:'fixedPoint'},
  54. {caption:'글쓰기', dataField:'brd_lv_write', width:60, alignment:'right', dataType:'number', format:'fixedPoint'},
  55. {caption:'글보기', dataField:'brd_lv_read', width:60, alignment:'right', dataType:'number', format:'fixedPoint'},
  56. {caption:'답글', dataField:'brd_lv_reply', width:60, alignment:'right', dataType:'number', format:'fixedPoint'},
  57. {caption:'댓글', dataField:'brd_lv_comment', width:60, alignment:'right', dataType:'number', format:'fixedPoint'},
  58. {caption:'다운로드', dataField:'brd_lv_download', width:60, alignment:'right', dataType:'number', format:'fixedPoint'},
  59. ]
  60. },
  61. ],
  62. dataSource: new DevExpress.data.DataSource({
  63. key : 'brd_key',
  64. load: function(loadOptions) {
  65. var d = $.Deferred();
  66. var params = grid.getSearchParam(loadOptions);
  67. $.ajax({
  68. url : base_url + '/admin/ajax/board',
  69. type: 'GET',
  70. async: false,
  71. cache: false,
  72. data: params
  73. }).done(function(res) {
  74. d.resolve(res.lists, {
  75. totalCount : res.totalCount
  76. });
  77. });
  78. return d.promise();
  79. }
  80. }),
  81. onRowDblClick: function(e) {
  82. grid.form(e.data.brd_key);
  83. },
  84. onContextMenuPreparing: function(e) {
  85. if (e.row.rowType === "data") {
  86. e.items = [
  87. {
  88. icon: 'edit',
  89. text: '정보 수정',
  90. onItemClick: function () {
  91. grid.form(e.row.data.brd_key);
  92. }
  93. },
  94. {
  95. icon: 'edit',
  96. text: '게시판복사',
  97. onItemClick: function () {
  98. grid.copy_board(e.row.data.brd_key);
  99. }
  100. },
  101. {
  102. icon : 'trash',
  103. text: "삭제",
  104. onItemClick: function () {
  105. grid.delete(e.row.data);
  106. }
  107. }
  108. ]
  109. }
  110. },
  111. });
  112. grid.form = function(brd_key) {
  113. brd_key = typeof brd_key != 'undefined' && brd_key ? brd_key : '';
  114. APP.MODAL.callback = function() {
  115. APP.MODAL.close();
  116. grid.refresh();
  117. }
  118. APP.MODAL.open({
  119. iframe: {
  120. url :base_url + '/admin/board/form/' + brd_key
  121. },
  122. width: 940,
  123. height: 600,
  124. header: {
  125. title: '게시판 정보 입력'
  126. }
  127. })
  128. };
  129. grid.copy_board = function(brd_key) {
  130. APP.MODAL.callback = function() {
  131. APP.MODAL.close();
  132. grid.refresh();
  133. };
  134. APP.MODAL.open({
  135. iframe : {
  136. url : base_url + '/admin/board/board_copy/'+brd_key,
  137. param : {
  138. brd_key : brd_key
  139. }
  140. },
  141. header : {
  142. title : '게시판 복사하기'
  143. },
  144. width:400,
  145. height:300
  146. });
  147. };
  148. $(function() {
  149. grid.init();
  150. });
  151. </script>