[0] | 1 | <?php |
---|
| 2 | # -- BEGIN LICENSE BLOCK --------------------------------------- |
---|
| 3 | # |
---|
| 4 | # This file is part of Dotclear 2. |
---|
| 5 | # |
---|
| 6 | # Copyright (c) 2003-2010 Olivier Meunier & Association Dotclear |
---|
| 7 | # Licensed under the GPL version 2.0 license. |
---|
| 8 | # See LICENSE file or |
---|
| 9 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
| 10 | # |
---|
| 11 | # -- END LICENSE BLOCK ----------------------------------------- |
---|
| 12 | if (!defined('DC_CONTEXT_ADMIN')) { return; } |
---|
| 13 | dcPage::check('pages,contentadmin'); |
---|
| 14 | |
---|
| 15 | /* Pager class |
---|
| 16 | -------------------------------------------------------- */ |
---|
[457] | 17 | class adminPageList extends adminPostList |
---|
[0] | 18 | { |
---|
[457] | 19 | public function setColumns() |
---|
[0] | 20 | { |
---|
[457] | 21 | $this->addColumn('title',__('Title'),array('adminPostList','getTitle'),' class="maximal"',false); |
---|
| 22 | $this->addColumn('date',__('Date'),array('adminPostList','getDate')); |
---|
| 23 | $this->addColumn('author',__('Author'),array('adminPostList','getAuthor')); |
---|
| 24 | $this->addColumn('comment',__('Comments'),array('adminPostList','getComments')); |
---|
| 25 | $this->addColumn('trackback',__('Trackbacks'),array('adminPostList','getTrackbacks')); |
---|
| 26 | $this->addColumn('status',__('Status'),array('adminPostList','getStatus')); |
---|
[0] | 27 | } |
---|
| 28 | |
---|
[457] | 29 | protected function getDefaultCaption() |
---|
[0] | 30 | { |
---|
[457] | 31 | return __('Pages list'); |
---|
[0] | 32 | } |
---|
| 33 | } |
---|
| 34 | |
---|
| 35 | /* Getting pages |
---|
| 36 | -------------------------------------------------------- */ |
---|
| 37 | $params = array( |
---|
| 38 | 'post_type' => 'page' |
---|
| 39 | ); |
---|
| 40 | |
---|
| 41 | $page = !empty($_GET['page']) ? (integer) $_GET['page'] : 1; |
---|
| 42 | $nb_per_page = 30; |
---|
| 43 | |
---|
| 44 | if (!empty($_GET['nb']) && (integer) $_GET['nb'] > 0) { |
---|
| 45 | $nb_per_page = (integer) $_GET['nb']; |
---|
| 46 | } |
---|
| 47 | |
---|
| 48 | $params['limit'] = array((($page-1)*$nb_per_page),$nb_per_page); |
---|
| 49 | $params['no_content'] = true; |
---|
| 50 | $params['order'] = 'post_position ASC, post_title ASC'; |
---|
| 51 | |
---|
| 52 | try { |
---|
| 53 | $pages = $core->blog->getPosts($params); |
---|
| 54 | $counter = $core->blog->getPosts($params,true); |
---|
| 55 | $post_list = new adminPageList($core,$pages,$counter->f(0)); |
---|
| 56 | } catch (Exception $e) { |
---|
| 57 | $core->error->add($e->getMessage()); |
---|
| 58 | } |
---|
| 59 | |
---|
| 60 | # Actions combo box |
---|
| 61 | $combo_action = array(); |
---|
| 62 | if ($core->auth->check('publish,contentadmin',$core->blog->id)) |
---|
| 63 | { |
---|
| 64 | $combo_action[__('publish')] = 'publish'; |
---|
| 65 | $combo_action[__('unpublish')] = 'unpublish'; |
---|
| 66 | $combo_action[__('mark as pending')] = 'pending'; |
---|
| 67 | } |
---|
| 68 | if ($core->auth->check('admin',$core->blog->id)) { |
---|
| 69 | $combo_action[__('change author')] = 'author'; |
---|
| 70 | } |
---|
| 71 | if ($core->auth->check('delete,contentadmin',$core->blog->id)) |
---|
| 72 | { |
---|
| 73 | $combo_action[__('delete')] = 'delete'; |
---|
| 74 | } |
---|
| 75 | |
---|
| 76 | # --BEHAVIOR-- adminPagesActionsCombo |
---|
| 77 | $core->callBehavior('adminPagesActionsCombo',array(&$combo_action)); |
---|
| 78 | |
---|
| 79 | /* Display |
---|
| 80 | -------------------------------------------------------- */ |
---|
| 81 | ?> |
---|
| 82 | <html> |
---|
| 83 | <head> |
---|
| 84 | <title><?php echo __('Pages'); ?></title> |
---|
| 85 | <script type="text/javascript" src="js/_posts_list.js"></script> |
---|
| 86 | <script type="text/javascript"> |
---|
| 87 | //<![CDATA[ |
---|
| 88 | <?php echo dcPage::jsVar('dotclear.msg.confirm_delete_posts',__("Are you sure you want to delete selected pages?")); ?> |
---|
| 89 | //]]> |
---|
| 90 | </script> |
---|
| 91 | </head> |
---|
| 92 | |
---|
| 93 | <body> |
---|
| 94 | <?php |
---|
[3] | 95 | echo '<h2>'.html::escapeHTML($core->blog->name).' › '.__('Pages').'</h2>'. |
---|
[158] | 96 | '<p class="top-add"><a class="button add" href="'.$p_url.'&act=page">'.__('New page').'</a></p>'; |
---|
[0] | 97 | |
---|
| 98 | if (!$core->error->flag()) |
---|
| 99 | { |
---|
| 100 | # Show pages |
---|
| 101 | $post_list->display($page,$nb_per_page, |
---|
| 102 | '<form action="posts_actions.php" method="post" id="form-entries">'. |
---|
| 103 | |
---|
| 104 | '%s'. |
---|
| 105 | |
---|
| 106 | '<div class="two-cols">'. |
---|
| 107 | '<p class="col checkboxes-helpers"></p>'. |
---|
| 108 | |
---|
[96] | 109 | '<p class="col right"><label for="action" class="classic">'.__('Selected pages action:').'</label> '. |
---|
[0] | 110 | form::combo('action',$combo_action). |
---|
| 111 | '<input type="submit" value="'.__('ok').'" /></p>'. |
---|
| 112 | form::hidden(array('post_type'),'page'). |
---|
| 113 | form::hidden(array('redir'),html::escapeHTML($_SERVER['REQUEST_URI'])). |
---|
| 114 | $core->formNonce(). |
---|
| 115 | '</div>'. |
---|
| 116 | '</form>'); |
---|
| 117 | } |
---|
[198] | 118 | dcPage::helpBlock('pages'); |
---|
[0] | 119 | ?> |
---|
| 120 | </body> |
---|
| 121 | </html> |
---|