[0] | 1 | <?php |
---|
| 2 | # -- BEGIN LICENSE BLOCK --------------------------------------- |
---|
| 3 | # |
---|
| 4 | # This file is part of Dotclear 2. |
---|
| 5 | # |
---|
[1179] | 6 | # Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear |
---|
[0] | 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 | /* Getting pages |
---|
| 16 | -------------------------------------------------------- */ |
---|
| 17 | $params = array( |
---|
| 18 | 'post_type' => 'page' |
---|
| 19 | ); |
---|
| 20 | |
---|
[1912] | 21 | $page = !empty($_GET['page']) ? max(1,(integer) $_GET['page']) : 1; |
---|
[0] | 22 | $nb_per_page = 30; |
---|
| 23 | |
---|
| 24 | if (!empty($_GET['nb']) && (integer) $_GET['nb'] > 0) { |
---|
| 25 | $nb_per_page = (integer) $_GET['nb']; |
---|
| 26 | } |
---|
| 27 | |
---|
| 28 | $params['limit'] = array((($page-1)*$nb_per_page),$nb_per_page); |
---|
| 29 | $params['no_content'] = true; |
---|
| 30 | $params['order'] = 'post_position ASC, post_title ASC'; |
---|
| 31 | |
---|
| 32 | try { |
---|
| 33 | $pages = $core->blog->getPosts($params); |
---|
| 34 | $counter = $core->blog->getPosts($params,true); |
---|
[2232] | 35 | $post_list = new adminPagesList($core,$pages,$counter->f(0)); |
---|
[0] | 36 | } catch (Exception $e) { |
---|
| 37 | $core->error->add($e->getMessage()); |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | # Actions combo box |
---|
[1903] | 41 | |
---|
| 42 | $pages_actions_page = new dcPagesActionsPage($core,'plugin.php',array('p'=>'pages')); |
---|
| 43 | |
---|
[2048] | 44 | if (!$pages_actions_page->process()) { |
---|
[1903] | 45 | |
---|
[0] | 46 | |
---|
| 47 | # --BEHAVIOR-- adminPagesActionsCombo |
---|
| 48 | $core->callBehavior('adminPagesActionsCombo',array(&$combo_action)); |
---|
| 49 | |
---|
| 50 | /* Display |
---|
| 51 | -------------------------------------------------------- */ |
---|
| 52 | ?> |
---|
| 53 | <html> |
---|
| 54 | <head> |
---|
| 55 | <title><?php echo __('Pages'); ?></title> |
---|
[1882] | 56 | <?php |
---|
[2495] | 57 | echo |
---|
| 58 | dcPage::jsLoad('js/jquery/jquery-ui.custom.js'). |
---|
| 59 | dcPage::jsLoad('js/jquery/jquery.ui.touch-punch.js'). |
---|
[2056] | 60 | dcPage::jsLoad('index.php?pf=pages/list.js'). |
---|
| 61 | '<script type="text/javascript">'. |
---|
[2250] | 62 | "\n".'//<![CDATA['."\n". |
---|
[2056] | 63 | dcPage::jsVar('dotclear.msg.confirm_delete_posts',__("Are you sure you want to delete selected pages?")). |
---|
[2250] | 64 | "\n".'//]]>'."\n". |
---|
| 65 | '</script>'; |
---|
[2056] | 66 | |
---|
[1882] | 67 | ?> |
---|
[0] | 68 | </head> |
---|
| 69 | |
---|
| 70 | <body> |
---|
| 71 | <?php |
---|
[1358] | 72 | echo dcPage::breadcrumb( |
---|
[1339] | 73 | array( |
---|
| 74 | html::escapeHTML($core->blog->name) => '', |
---|
[2166] | 75 | __('Pages') => '' |
---|
[2256] | 76 | )).dcPage::notices(); |
---|
[1339] | 77 | |
---|
[1903] | 78 | if (!empty($_GET['upd'])) { |
---|
| 79 | dcPage::success(__('Selected pages have been successfully updated.')); |
---|
| 80 | } elseif (!empty($_GET['del'])) { |
---|
| 81 | dcPage::success(__('Selected pages have been successfully deleted.')); |
---|
| 82 | } elseif (!empty($_GET['reo'])) { |
---|
| 83 | dcPage::success(__('Selected pages have been successfully reordered.')); |
---|
| 84 | } |
---|
[1339] | 85 | echo |
---|
[158] | 86 | '<p class="top-add"><a class="button add" href="'.$p_url.'&act=page">'.__('New page').'</a></p>'; |
---|
[0] | 87 | |
---|
| 88 | if (!$core->error->flag()) |
---|
| 89 | { |
---|
| 90 | # Show pages |
---|
| 91 | $post_list->display($page,$nb_per_page, |
---|
[1903] | 92 | '<form action="plugin.php" method="post" id="form-entries">'. |
---|
[2495] | 93 | |
---|
[0] | 94 | '%s'. |
---|
[2495] | 95 | |
---|
[0] | 96 | '<div class="two-cols">'. |
---|
| 97 | '<p class="col checkboxes-helpers"></p>'. |
---|
[2495] | 98 | |
---|
[96] | 99 | '<p class="col right"><label for="action" class="classic">'.__('Selected pages action:').'</label> '. |
---|
[1903] | 100 | form::combo('action',$pages_actions_page->getCombo()). |
---|
[2442] | 101 | '<input type="submit" value="'.__('ok').'" />'. |
---|
[0] | 102 | form::hidden(array('post_type'),'page'). |
---|
[1903] | 103 | form::hidden(array('p'),'pages'). |
---|
[2048] | 104 | form::hidden(array('act'),'list'). |
---|
[0] | 105 | $core->formNonce(). |
---|
[2442] | 106 | '</p></div>'. |
---|
[2036] | 107 | '<p class="clear form-note hidden-if-js">'. |
---|
| 108 | __('To rearrange pages order, change number at the begining of the line, then click on “Save pages order” button.').'</p>'. |
---|
| 109 | '<p class="clear form-note hidden-if-no-js">'. |
---|
| 110 | __('To rearrange pages order, move items by drag and drop, then click on “Save pages order” button.').'</p>'. |
---|
[2442] | 111 | '<p><input type="submit" value="'.__('Save pages order').'" name="reorder" class="clear" /></p>'. |
---|
[0] | 112 | '</form>'); |
---|
| 113 | } |
---|
[198] | 114 | dcPage::helpBlock('pages'); |
---|
[0] | 115 | ?> |
---|
| 116 | </body> |
---|
[2048] | 117 | </html> |
---|
| 118 | <?php |
---|
| 119 | } |
---|
[2495] | 120 | ?> |
---|