mirror of
https://github.com/monstra-cms/monstra.git
synced 2025-08-08 06:06:53 +02:00
Pages Manager: added ability to quickly update status and access.
This commit is contained in:
@@ -458,7 +458,7 @@ class PagesAdmin extends Backend
|
|||||||
case "delete_page":
|
case "delete_page":
|
||||||
|
|
||||||
// Error 404 page can not be removed
|
// Error 404 page can not be removed
|
||||||
if (Request::get('name') !== 'error404') {
|
if (Request::get('slug') !== 'error404') {
|
||||||
|
|
||||||
if (Security::check(Request::get('token'))) {
|
if (Security::check(Request::get('token'))) {
|
||||||
|
|
||||||
@@ -490,6 +490,54 @@ class PagesAdmin extends Backend
|
|||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Update page access
|
||||||
|
// -------------------------------------
|
||||||
|
case "update_access":
|
||||||
|
|
||||||
|
if (Request::get('slug') !== 'error404') {
|
||||||
|
|
||||||
|
if (Security::check(Request::get('token'))) {
|
||||||
|
|
||||||
|
$pages->updateWhere('[slug="'.Request::get('slug').'"]', array('access' => Request::get('access')));
|
||||||
|
|
||||||
|
// Run delete extra actions
|
||||||
|
Action::run('admin_pages_action_update_access');
|
||||||
|
|
||||||
|
// Send notification
|
||||||
|
Notification::set('success', __('Your changes to the page <i>:page</i> have been saved.', 'pages', array(':page' => Request::get('slug'))));
|
||||||
|
|
||||||
|
// Redirect
|
||||||
|
Request::redirect('index.php?id=pages');
|
||||||
|
|
||||||
|
} else { die('Request was denied because it contained an invalid security token. Please refresh the page and try again.'); }
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Update page status
|
||||||
|
// -------------------------------------
|
||||||
|
case "update_status":
|
||||||
|
|
||||||
|
if (Request::get('name') !== 'error404') {
|
||||||
|
|
||||||
|
if (Security::check(Request::get('token'))) {
|
||||||
|
|
||||||
|
$pages->updateWhere('[slug="'.Request::get('slug').'"]', array('status' => Request::get('status')));
|
||||||
|
|
||||||
|
// Run delete extra actions
|
||||||
|
Action::run('admin_pages_action_update_status');
|
||||||
|
|
||||||
|
// Send notification
|
||||||
|
Notification::set('success', __('Your changes to the page <i>:page</i> have been saved.', 'pages', array(':page' => Request::get('slug'))));
|
||||||
|
|
||||||
|
// Redirect
|
||||||
|
Request::redirect('index.php?id=pages');
|
||||||
|
|
||||||
|
} else { die('Request was denied because it contained an invalid security token. Please refresh the page and try again.'); }
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Its mean that you can add your own actions for this plugin
|
// Its mean that you can add your own actions for this plugin
|
||||||
@@ -512,6 +560,8 @@ class PagesAdmin extends Backend
|
|||||||
|
|
||||||
$pages_array[$count]['title'] = $page['title'];
|
$pages_array[$count]['title'] = $page['title'];
|
||||||
$pages_array[$count]['parent'] = $page['parent'];
|
$pages_array[$count]['parent'] = $page['parent'];
|
||||||
|
$pages_array[$count]['_status'] = $page['status'];
|
||||||
|
$pages_array[$count]['_access'] = $page['access'];
|
||||||
$pages_array[$count]['status'] = $status_array[$page['status']];
|
$pages_array[$count]['status'] = $status_array[$page['status']];
|
||||||
$pages_array[$count]['access'] = isset($access_array[$page['access']]) ? $access_array[$page['access']] : $access_array['public']; // hack for old Monstra Versions
|
$pages_array[$count]['access'] = isset($access_array[$page['access']]) ? $access_array[$page['access']] : $access_array['public']; // hack for old Monstra Versions
|
||||||
$pages_array[$count]['date'] = $page['date'];
|
$pages_array[$count]['date'] = $page['date'];
|
||||||
|
@@ -77,7 +77,22 @@
|
|||||||
<li><a href="index.php?id=pages&action=add_page&parent_page=<?php echo $page['slug']; ?>" title="<?php echo __('Create New Page', 'pages'); ?>"><?php echo __('Add', 'pages'); ?></a></li>
|
<li><a href="index.php?id=pages&action=add_page&parent_page=<?php echo $page['slug']; ?>" title="<?php echo __('Create New Page', 'pages'); ?>"><?php echo __('Add', 'pages'); ?></a></li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<li><?php echo Html::anchor(__('Clone', 'pages'), 'index.php?id=pages&action=clone_page&name='.$page['slug'].'&token='.Security::token(), array('title' => __('Clone', 'pages'))); ?></li>
|
<li><?php echo Html::anchor(__('Clone', 'pages'), 'index.php?id=pages&action=clone_page&name='.$page['slug'].'&token='.Security::token(), array('title' => __('Clone', 'pages'))); ?></li>
|
||||||
</ul>
|
<li class="divider"></li>
|
||||||
|
<li class="dropdown-submenu pull-left">
|
||||||
|
<a href=""><?php echo __('Status', 'pages'); ?></a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li><a href="index.php?id=pages&action=update_status&slug=<?php echo $page['slug']; ?>&status=published&token=<?php echo Security::token(); ?>"><?php echo __('Published', 'pages'); ?> <?php if ($page['_status'] == 'published') { ?><i class="icon-ok"></i><?php } ?></a></li>
|
||||||
|
<li><a href="index.php?id=pages&action=update_status&slug=<?php echo $page['slug']; ?>&status=draft&token=<?php echo Security::token(); ?>"><?php echo __('Draft', 'pages'); ?> <?php if ($page['_status'] == 'draft') { ?><i class="icon-ok"></i><?php } ?></a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="dropdown-submenu pull-left">
|
||||||
|
<a href=""><?php echo __('Access', 'pages'); ?></a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li><a href="index.php?id=pages&action=update_access&slug=<?php echo $page['slug']; ?>&access=public&token=<?php echo Security::token(); ?>"><?php echo __('Public', 'pages'); ?> <?php if ($page['_access'] == 'public') { ?><i class="icon-ok"></i><?php } ?></a></li>
|
||||||
|
<li><a href="index.php?id=pages&action=update_access&slug=<?php echo $page['slug']; ?>&access=registered&token=<?php echo Security::token(); ?>"><?php echo __('Registered', 'pages'); ?> <?php if ($page['_access'] == 'registered') { ?><i class="icon-ok"></i><?php } ?></a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
<?php echo Html::anchor(__('Delete', 'pages'),
|
<?php echo Html::anchor(__('Delete', 'pages'),
|
||||||
'index.php?id=pages&action=delete_page&name='.$page['slug'].'&token='.Security::token(),
|
'index.php?id=pages&action=delete_page&name='.$page['slug'].'&token='.Security::token(),
|
||||||
array('class' => 'btn btn-actions btn-small btn-actions-default', 'onclick' => "return confirmDelete('".__("Delete page: :page", 'pages', array(':page' => Html::toText($page['title'])))."')"));
|
array('class' => 'btn btn-actions btn-small btn-actions-default', 'onclick' => "return confirmDelete('".__("Delete page: :page", 'pages', array(':page' => Html::toText($page['title'])))."')"));
|
||||||
|
Reference in New Issue
Block a user