category-display.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. {template 'common/header'}
  2. <ul class="we7-page-tab">
  3. {loop $active_sub_permission $active_menu}
  4. {if permission_check_account_user($active_menu['permission_name'], false) && (empty($active_menu['is_display']) || is_array($active_menu['is_display']) && in_array($_W['account']['type'], $active_menu['is_display']))}
  5. <li {if $action == $active_menu['active']}class="active"{/if}><a href="{$active_menu['url']}">{$active_menu['title']}</a></li>
  6. {/if}
  7. {/loop}
  8. </ul>
  9. <div class="we7-page-search we7-padding-bottom clearfix">
  10. <div class="pull-right">
  11. {if empty($id)}<a href="{php echo url('site/category/post')}" class="btn btn-primary we7-padding-horizontal">+新建文章分类</a>{/if}
  12. {if !empty($id)}<a href="{php echo url('site/category/post', array('id' => $id))}" class="btn btn-primary we7-padding-horizontal">编辑文章分类</a>{/if}
  13. </div>
  14. </div>
  15. <form action="./index.php?c=site&a=category&do=delete" class="we7-form" method="post">
  16. <table class="table we7-table table-hover article-list vertical-middle" id="js-wesite-category-display">
  17. <col width="80px">
  18. <col width="130px"/>
  19. <col width="235px">
  20. <col width="90px"/>
  21. <col width=""/>
  22. <tr>
  23. <th></th>
  24. <th class="text-left">排序</th>
  25. <th class="text-left">分类名称</th>
  26. <th>设为栏目</th>
  27. <th class="text-right">操作</th>
  28. </tr>
  29. {loop $category $row}
  30. <tr>
  31. <td>
  32. <input type="checkbox" we7-check-all="1" name="rid[]" id="rid-{$row['id']}" value="{$row['id']}">
  33. <label for="rid-{$row['id']}">&nbsp;</label>
  34. </td>
  35. <td class="text-left">{$row['displayorder']}</td>
  36. <td class="text-left">
  37. <span>{$row['name']}</span>
  38. </td>
  39. <td>
  40. <label>
  41. <div class="switch switch{php echo $row['enabled'] ? 'On' : 'Off'}" onclick="changeStatus({$row['id']})"></div>
  42. </label>
  43. </td>
  44. <td style="position: relative;">
  45. <div class="link-group">
  46. {if empty($row['parentid'])}
  47. <a href="{php echo url('site/category/post', array('parentid' => $row['id']))}" >&nbsp;+添加子分类</a>
  48. {/if}
  49. <a href="javascript:;" data-url="{php echo murl('site/site', array('cid' => $row['id']), true, true)}" class="js-clip">复制链接</a>
  50. <a href="{php echo url('site/article/post', array('pcate' => $row['id']));}" >添加文章</a>
  51. <a href="{php echo url('site/category/post', array('id' => $row['id']));}" >编辑</a>
  52. <a href="javascript:void(0);" class="del" onclick="delArtCat('{php echo url("site/category/delete", array("id" => $row["id"]));}')">删除</a>
  53. </div>
  54. </td>
  55. </tr>
  56. {loop $children[$row['id']] $row}
  57. <tr class="bg-light-gray">
  58. <td>
  59. <input type="checkbox" name="rid[]" id="rid-{$row['id']}" value="{$row['id']}">
  60. <label for="rid-{$row['id']}">&nbsp;</label>
  61. </td>
  62. <td class="text-left">
  63. <div class="pad-left">
  64. {$row['displayorder']}
  65. </div>
  66. </td>
  67. <td class="text-left"><span class="color-gray" style="margin-left: 50px;">{$row['name']}</span></td>
  68. <td>
  69. <label>
  70. <div class="switch switch{php echo $row['enabled'] ? 'On' : 'Off'}" onclick="changeStatus({$row['id']})"></div>
  71. </label>
  72. </td>
  73. <td style="position: relative;" class="text-right">
  74. <div class="link-group">
  75. <a href="javascript:;" data-url="{php echo murl('site/site', array('cid' => $row['id']), true, true)}" class="we7-margin-right-sm js-clip">复制链接</a>
  76. <a href="{php echo url('site/article/post', array('pcate' => $row['parentid'], 'ccate' => $row['id']));}" class="we7-margin-right-sm">添加文章</a>
  77. <a href="{php echo url('site/category/post', array('id' => $row['id'], 'parentid' => $row['parentid']));}" class="we7-margin-right-sm">编辑</a>
  78. <a href="{php echo url('site/category/delete', array('id' => $row['id']));}" class="del" onclick="return confirm('确认删除此分类吗?');return false;">删除</a>
  79. </div>
  80. </td>
  81. </tr>
  82. {/loop}
  83. {/loop}
  84. </table>
  85. <div class="clearfix"></div>
  86. <div class="checkboxall">
  87. <input type="checkbox" we7-check-all="1" name="rid[]" id="select_all" value="1">
  88. <label for="select_all">&nbsp;</label>
  89. <input type="submit" class="btn btn-danger" name="submit" value="删除" onclick="if(!confirm('确定删除选中的规则吗?')) return false;"/>
  90. <input type="hidden" name="token" value="{$_W['token']}" />
  91. </div>
  92. </form>
  93. <script>
  94. function delArtCat(url) {
  95. util.confirm(function () {
  96. window.location.href = url;
  97. }, function () {
  98. return false;
  99. }, '确认删除吗?');
  100. }
  101. $('#select_all').click(function(){
  102. $('.article-list :checkbox').prop('checked', $(this).prop('checked'));
  103. });
  104. // $('.js-clip').each(function(){
  105. // util.clip(this, $(this).attr('data-url'));
  106. // });
  107. var changeStatus = function(id) {
  108. var id = parseInt(id);
  109. $.post('./index.php?c=site&a=category&do=change_status', {id: id},function(data) {
  110. if (data.message.errno == 0){
  111. util.message(data.message.message, data.redirect, 'success');
  112. } else {
  113. if (data.message.errno == 1) util.toast('更改失败!', 'error');
  114. if (data.message.errno == -1) util.toast('分类不存在,请刷新重试!');
  115. }
  116. }, 'json');
  117. }
  118. </script>
  119. {template 'common/footer'}