manage-posts.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <?php
  2. include 'common.php';
  3. include 'header.php';
  4. include 'menu.php';
  5. $stat = \Widget\Stat::alloc();
  6. $posts = \Widget\Contents\Post\Admin::alloc();
  7. $isAllPosts = ('on' == $request->get('__typecho_all_posts') || 'on' == \Typecho\Cookie::get('__typecho_all_posts'));
  8. ?>
  9. <div class="main">
  10. <div class="body container">
  11. <?php include 'page-title.php'; ?>
  12. <div class="row typecho-page-main" role="main">
  13. <div class="col-mb-12 typecho-list">
  14. <div class="clearfix">
  15. <ul class="typecho-option-tabs right">
  16. <?php if ($user->pass('editor', true) && !isset($request->uid)): ?>
  17. <li class="<?php if ($isAllPosts): ?> current<?php endif; ?>"><a
  18. href="<?php echo $request->makeUriByRequest('__typecho_all_posts=on&page=1'); ?>"><?php _e('所有'); ?></a>
  19. </li>
  20. <li class="<?php if (!$isAllPosts): ?> current<?php endif; ?>"><a
  21. href="<?php echo $request->makeUriByRequest('__typecho_all_posts=off&page=1'); ?>"><?php _e('我的'); ?></a>
  22. </li>
  23. <?php endif; ?>
  24. </ul>
  25. <ul class="typecho-option-tabs">
  26. <li<?php if (!isset($request->status) || 'all' == $request->get('status')): ?> class="current"<?php endif; ?>>
  27. <a href="<?php $options->adminUrl('manage-posts.php'
  28. . (isset($request->uid) ? '?uid=' . $request->filter('encode')->uid : '')); ?>"><?php _e('可用'); ?></a>
  29. </li>
  30. <li<?php if ('waiting' == $request->get('status')): ?> class="current"<?php endif; ?>><a
  31. href="<?php $options->adminUrl('manage-posts.php?status=waiting'
  32. . (isset($request->uid) ? '&uid=' . $request->filter('encode')->uid : '')); ?>"><?php _e('待审核'); ?>
  33. <?php if (!$isAllPosts && $stat->myWaitingPostsNum > 0 && !isset($request->uid)): ?>
  34. <span class="balloon"><?php $stat->myWaitingPostsNum(); ?></span>
  35. <?php elseif ($isAllPosts && $stat->waitingPostsNum > 0 && !isset($request->uid)): ?>
  36. <span class="balloon"><?php $stat->waitingPostsNum(); ?></span>
  37. <?php elseif (isset($request->uid) && $stat->currentWaitingPostsNum > 0): ?>
  38. <span class="balloon"><?php $stat->currentWaitingPostsNum(); ?></span>
  39. <?php endif; ?>
  40. </a></li>
  41. <li<?php if ('draft' == $request->get('status')): ?> class="current"<?php endif; ?>><a
  42. href="<?php $options->adminUrl('manage-posts.php?status=draft'
  43. . (isset($request->uid) ? '&uid=' . $request->filter('encode')->uid : '')); ?>"><?php _e('草稿'); ?>
  44. <?php if (!$isAllPosts && $stat->myDraftPostsNum > 0 && !isset($request->uid)): ?>
  45. <span class="balloon"><?php $stat->myDraftPostsNum(); ?></span>
  46. <?php elseif ($isAllPosts && $stat->draftPostsNum > 0 && !isset($request->uid)): ?>
  47. <span class="balloon"><?php $stat->draftPostsNum(); ?></span>
  48. <?php elseif (isset($request->uid) && $stat->currentDraftPostsNum > 0): ?>
  49. <span class="balloon"><?php $stat->currentDraftPostsNum(); ?></span>
  50. <?php endif; ?>
  51. </a></li>
  52. </ul>
  53. </div>
  54. <div class="typecho-list-operate clearfix">
  55. <form method="get">
  56. <div class="operate">
  57. <label><i class="sr-only"><?php _e('全选'); ?></i><input type="checkbox"
  58. class="typecho-table-select-all"/></label>
  59. <div class="btn-group btn-drop">
  60. <button class="btn dropdown-toggle btn-s" type="button"><i
  61. class="sr-only"><?php _e('操作'); ?></i><?php _e('选中项'); ?> <i
  62. class="i-caret-down"></i></button>
  63. <ul class="dropdown-menu">
  64. <li><a lang="<?php _e('你确认要删除这些文章吗?'); ?>"
  65. href="<?php $security->index('/action/contents-post-edit?do=delete'); ?>"><?php _e('删除'); ?></a>
  66. </li>
  67. <?php if ($user->pass('editor', true)): ?>
  68. <li>
  69. <a href="<?php $security->index('/action/contents-post-edit?do=mark&status=publish'); ?>"><?php _e('标记为<strong>%s</strong>', _t('公开')); ?></a>
  70. </li>
  71. <li>
  72. <a href="<?php $security->index('/action/contents-post-edit?do=mark&status=waiting'); ?>"><?php _e('标记为<strong>%s</strong>', _t('待审核')); ?></a>
  73. </li>
  74. <li>
  75. <a href="<?php $security->index('/action/contents-post-edit?do=mark&status=hidden'); ?>"><?php _e('标记为<strong>%s</strong>', _t('隐藏')); ?></a>
  76. </li>
  77. <li>
  78. <a href="<?php $security->index('/action/contents-post-edit?do=mark&status=private'); ?>"><?php _e('标记为<strong>%s</strong>', _t('私密')); ?></a>
  79. </li>
  80. <?php endif; ?>
  81. </ul>
  82. </div>
  83. </div>
  84. <div class="search" role="search">
  85. <?php if ('' != $request->keywords || '' != $request->category): ?>
  86. <a href="<?php $options->adminUrl('manage-posts.php'
  87. . (isset($request->status) || isset($request->uid) ? '?' .
  88. (isset($request->status) ? 'status=' . $request->filter('encode')->status : '') .
  89. (isset($request->uid) ? (isset($request->status) ? '&' : '') . 'uid=' . $request->filter('encode')->uid : '') : '')); ?>"><?php _e('&laquo; 取消筛选'); ?></a>
  90. <?php endif; ?>
  91. <input type="text" class="text-s" placeholder="<?php _e('请输入关键字'); ?>"
  92. value="<?php echo $request->filter('html')->keywords; ?>" name="keywords"/>
  93. <select name="category">
  94. <option value=""><?php _e('所有分类'); ?></option>
  95. <?php \Widget\Metas\Category\Rows::alloc()->to($category); ?>
  96. <?php while ($category->next()): ?>
  97. <option
  98. value="<?php $category->mid(); ?>"<?php if ($request->get('category') == $category->mid): ?> selected="true"<?php endif; ?>><?php $category->name(); ?></option>
  99. <?php endwhile; ?>
  100. </select>
  101. <button type="submit" class="btn btn-s"><?php _e('筛选'); ?></button>
  102. <?php if (isset($request->uid)): ?>
  103. <input type="hidden" value="<?php echo $request->filter('html')->uid; ?>"
  104. name="uid"/>
  105. <?php endif; ?>
  106. <?php if (isset($request->status)): ?>
  107. <input type="hidden" value="<?php echo $request->filter('html')->status; ?>"
  108. name="status"/>
  109. <?php endif; ?>
  110. </div>
  111. </form>
  112. </div><!-- end .typecho-list-operate -->
  113. <form method="post" name="manage_posts" class="operate-form">
  114. <div class="typecho-table-wrap">
  115. <table class="typecho-list-table">
  116. <colgroup>
  117. <col width="20" class="kit-hidden-mb"/>
  118. <col width="6%" class="kit-hidden-mb"/>
  119. <col width="45%"/>
  120. <col width="" class="kit-hidden-mb"/>
  121. <col width="18%" class="kit-hidden-mb"/>
  122. <col width="16%"/>
  123. </colgroup>
  124. <thead>
  125. <tr>
  126. <th class="kit-hidden-mb"></th>
  127. <th class="kit-hidden-mb"></th>
  128. <th><?php _e('标题'); ?></th>
  129. <th class="kit-hidden-mb"><?php _e('作者'); ?></th>
  130. <th class="kit-hidden-mb"><?php _e('分类'); ?></th>
  131. <th><?php _e('日期'); ?></th>
  132. </tr>
  133. </thead>
  134. <tbody>
  135. <?php if ($posts->have()): ?>
  136. <?php while ($posts->next()): ?>
  137. <tr id="<?php $posts->theId(); ?>">
  138. <td class="kit-hidden-mb"><input type="checkbox" value="<?php $posts->cid(); ?>"
  139. name="cid[]"/></td>
  140. <td class="kit-hidden-mb"><a
  141. href="<?php $options->adminUrl('manage-comments.php?cid=' . ($posts->parentId ? $posts->parentId : $posts->cid)); ?>"
  142. class="balloon-button size-<?php echo \Typecho\Common::splitByCount($posts->commentsNum, 1, 10, 20, 50, 100); ?>"
  143. title="<?php $posts->commentsNum(); ?> <?php _e('评论'); ?>"><?php $posts->commentsNum(); ?></a>
  144. </td>
  145. <td>
  146. <a href="<?php $options->adminUrl('write-post.php?cid=' . $posts->cid); ?>"><?php $posts->title(); ?></a>
  147. <?php
  148. if ($posts->hasSaved || 'post_draft' == $posts->type) {
  149. echo '<em class="status">' . _t('草稿') . '</em>';
  150. }
  151. if ('hidden' == $posts->status) {
  152. echo '<em class="status">' . _t('隐藏') . '</em>';
  153. } elseif ('waiting' == $posts->status) {
  154. echo '<em class="status">' . _t('待审核') . '</em>';
  155. } elseif ('private' == $posts->status) {
  156. echo '<em class="status">' . _t('私密') . '</em>';
  157. } elseif ($posts->password) {
  158. echo '<em class="status">' . _t('密码保护') . '</em>';
  159. }
  160. ?>
  161. <a href="<?php $options->adminUrl('write-post.php?cid=' . $posts->cid); ?>"
  162. title="<?php _e('编辑 %s', htmlspecialchars($posts->title)); ?>"><i
  163. class="i-edit"></i></a>
  164. <?php if ('post_draft' != $posts->type): ?>
  165. <a href="<?php $posts->permalink(); ?>"
  166. title="<?php _e('浏览 %s', htmlspecialchars($posts->title)); ?>"><i
  167. class="i-exlink"></i></a>
  168. <?php endif; ?>
  169. </td>
  170. <td class="kit-hidden-mb"><a
  171. href="<?php $options->adminUrl('manage-posts.php?__typecho_all_posts=off&uid=' . $posts->author->uid); ?>"><?php $posts->author(); ?></a>
  172. </td>
  173. <td class="kit-hidden-mb"><?php $categories = $posts->categories;
  174. $length = count($categories); ?>
  175. <?php foreach ($categories as $key => $val): ?>
  176. <?php echo '<a href="';
  177. $options->adminUrl('manage-posts.php?category=' . $val['mid']
  178. . (isset($request->uid) ? '&uid=' . $request->filter('encode')->uid : '')
  179. . (isset($request->status) ? '&status=' . $request->filter('encode')->status : ''));
  180. echo '">' . $val['name'] . '</a>' . ($key < $length - 1 ? ', ' : ''); ?>
  181. <?php endforeach; ?>
  182. </td>
  183. <td>
  184. <?php if ($posts->hasSaved): ?>
  185. <span class="description">
  186. <?php $modifyDate = new \Typecho\Date($posts->modified); ?>
  187. <?php _e('保存于 %s', $modifyDate->word()); ?>
  188. </span>
  189. <?php else: ?>
  190. <?php $posts->dateWord(); ?>
  191. <?php endif; ?>
  192. </td>
  193. </tr>
  194. <?php endwhile; ?>
  195. <?php else: ?>
  196. <tr>
  197. <td colspan="6"><h6 class="typecho-list-table-title"><?php _e('没有任何文章'); ?></h6>
  198. </td>
  199. </tr>
  200. <?php endif; ?>
  201. </tbody>
  202. </table>
  203. </div>
  204. </form><!-- end .operate-form -->
  205. <div class="typecho-list-operate clearfix">
  206. <form method="get">
  207. <div class="operate">
  208. <label><i class="sr-only"><?php _e('全选'); ?></i><input type="checkbox"
  209. class="typecho-table-select-all"/></label>
  210. <div class="btn-group btn-drop">
  211. <button class="btn dropdown-toggle btn-s" type="button"><i
  212. class="sr-only"><?php _e('操作'); ?></i><?php _e('选中项'); ?> <i
  213. class="i-caret-down"></i></button>
  214. <ul class="dropdown-menu">
  215. <li><a lang="<?php _e('你确认要删除这些文章吗?'); ?>"
  216. href="<?php $security->index('/action/contents-post-edit?do=delete'); ?>"><?php _e('删除'); ?></a>
  217. </li>
  218. <?php if ($user->pass('editor', true)): ?>
  219. <li>
  220. <a href="<?php $security->index('/action/contents-post-edit?do=mark&status=publish'); ?>"><?php _e('标记为<strong>%s</strong>', _t('公开')); ?></a>
  221. </li>
  222. <li>
  223. <a href="<?php $security->index('/action/contents-post-edit?do=mark&status=waiting'); ?>"><?php _e('标记为<strong>%s</strong>', _t('待审核')); ?></a>
  224. </li>
  225. <li>
  226. <a href="<?php $security->index('/action/contents-post-edit?do=mark&status=hidden'); ?>"><?php _e('标记为<strong>%s</strong>', _t('隐藏')); ?></a>
  227. </li>
  228. <li>
  229. <a href="<?php $security->index('/action/contents-post-edit?do=mark&status=private'); ?>"><?php _e('标记为<strong>%s</strong>', _t('私密')); ?></a>
  230. </li>
  231. <?php endif; ?>
  232. </ul>
  233. </div>
  234. </div>
  235. <?php if ($posts->have()): ?>
  236. <ul class="typecho-pager">
  237. <?php $posts->pageNav(); ?>
  238. </ul>
  239. <?php endif; ?>
  240. </form>
  241. </div><!-- end .typecho-list-operate -->
  242. </div><!-- end .typecho-list -->
  243. </div><!-- end .typecho-page-main -->
  244. </div>
  245. </div>
  246. <?php
  247. include 'copyright.php';
  248. include 'common-js.php';
  249. include 'table-js.php';
  250. include 'footer.php';
  251. ?>