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.

131 lines
4.6 KiB

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
  1. <div class="ax-button-group" data-fit-aside>
  2. <div class="left">
  3. <h2>사이트맵 설정</h2>
  4. </div>
  5. </div>
  6. <p class="alert alert-info" data-fit-aside>
  7. <i class="fal fa-info-circle"></i> 추가로 sitemap.xml 에서 인덱싱하고싶은 URL을 관리하는 페이지입니다.<br>
  8. <i class="fal fa-info-circle"></i> 메인페이지와 게시판은 자동으로 로드하므로 추가할 필요가 없습니다.
  9. </p>
  10. <div class="ax-button-group" data-fit-aside>
  11. <div class="left">
  12. <button type="button" class="btn btn-default" onclick="grid.form()"><i class="fal fa-plus"></i> 추가하기</button>
  13. </div>
  14. <div class="right">
  15. <button type="button" class="btn btn-default" onclick="grid.refresh()"><i class="fal fa-sync"></i> 새로고침</button>
  16. </div>
  17. </div>
  18. <div class="grid-wrapper" data-fit-content>
  19. <div class="grid-container" id="grid-container"></div>
  20. </div>
  21. <script>
  22. var grid = new GRID('#grid-container', {
  23. editing: {
  24. mode: "cell",
  25. allowUpdating: true,
  26. allowDeleting: false,
  27. allowAdding: false
  28. },
  29. columns: [
  30. {caption:'URL', dataField:'sit_loc', width:350, customizeText:function(cell) {return base_url.substr(0, base_url.length -1) + cell.value}},
  31. {caption:'중요도', dataField:'sit_priority', dataFormat:'number', width:100, lookup: {dataSource: [0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9]}},
  32. {caption:'갱신주기', dataField:'sit_changefreq', width:150, lookup: {dataSource: ['daily','weekly','monthly']}},
  33. {caption:'메모', dataField:'sit_memo', minWidth:200},
  34. {caption:'최종수정자', dataField:'upd_username', alignment:'center', width:120, allowEditing:false },
  35. {caption:'최종수정일', dataField:'upd_datetime', alignment:'center', width:120, allowEditing:false},
  36. ],
  37. dataSource: new DevExpress.data.DataSource({
  38. key : 'sit_idx',
  39. load: function(loadOptions) {
  40. var d = $.Deferred();
  41. var params = grid.getSearchParam(loadOptions);
  42. $.ajax({
  43. url : base_url + '/admin/ajax/management/sitemaps',
  44. type: 'GET',
  45. async: false,
  46. cache: false,
  47. data: params
  48. }).done(function(res) {
  49. d.resolve(res.lists, {
  50. totalCount : res.totalCount
  51. });
  52. });
  53. return d.promise();
  54. },
  55. update: function(key, values) {
  56. var d = $.Deferred();
  57. $.ajax({
  58. url : '/admin/ajax/management/updates',
  59. type: 'POST',
  60. async: false,
  61. cache: false,
  62. data : {
  63. table : 'sitemap',
  64. key_column: 'sit_idx',
  65. key : key,
  66. values : values
  67. }
  68. }).done(function(result) {
  69. d.resolve(result);
  70. grid.refresh();
  71. });
  72. return d.promise();
  73. },
  74. }),
  75. onContextMenuPreparing: function(e) {
  76. if (e.row.rowType === "data") {
  77. e.items = [
  78. {
  79. icon : 'trash',
  80. text: "삭제",
  81. onItemClick: function () {
  82. grid.delete(e.row.data);
  83. }
  84. }
  85. ]
  86. }
  87. },
  88. });
  89. grid.form = function() {
  90. APP.MODAL.callback = function() {
  91. APP.MODAL.close();
  92. grid.refresh();
  93. };
  94. APP.MODAL.open({
  95. iframe : {
  96. url : base_url + '/admin/management/sitemap_form'
  97. },
  98. header : {
  99. title : '사이트맵 등록하기'
  100. },
  101. width:600,
  102. height:200
  103. });
  104. };
  105. grid.delete = function(data) {
  106. if(! confirm('선택하신 데이타를 삭제하시겠습니까?\nURL: '+data.sit_loc)) return false;
  107. $.ajax({
  108. url: base_url + '/admin/ajax/management/sitemaps',
  109. type: 'DELETE',
  110. data: {
  111. sit_idx: data.sit_idx
  112. },
  113. success:function() {
  114. toastr.success('삭제되었습니다.');
  115. grid.refresh();
  116. }
  117. })
  118. }
  119. $(function() {
  120. grid.init();
  121. })
  122. </script>