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