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.

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