Commit c5a657d9 authored by sun's avatar sun

#329182 by sun: Moved menu items below admin/build.

parent b9bf77ba
......@@ -6,6 +6,7 @@ Demo x.x-x.x, xxxx-xx-xx
Demo 5.x-1.x, xxxx-xx-xx
------------------------
#329182 by sun: Moved menu items below admin/build.
#286781 by alex_b: Added function return value for demo_reset().
#272820 by sun: Increased maxlength for snapshot file names.
#269561 by smk-ka: Performance: Disable indices to speed up import.
......
......@@ -47,7 +47,7 @@ function _demo_admin_settings() {
'#title' => t('Automatically reset site every'),
'#default_value' => variable_get('demo_reset_interval', 0),
'#options' => $period,
'#description' => t('Select how often this demonstration site is automatically reset. Ensure that you have chosen a snapshot for cron runs in <a href="!manage">Manage snapshots</a> first. <strong>Note:</strong> This requires cron to run at least within this interval.', array('!manage' => url('admin/settings/demo/manage'))),
'#description' => t('Select how often this demonstration site is automatically reset. Ensure that you have chosen a snapshot for cron runs in <a href="!manage">Manage snapshots</a> first. <strong>Note:</strong> This requires cron to run at least within this interval.', array('!manage' => url('admin/build/demo/manage'))),
);
$form['dump']['path'] = array(
......@@ -126,7 +126,7 @@ function _demo_dump() {
'#rows' => 2,
'#description' => t('Optionally enter a description for this snapshot here. If no description is given and a snapshot with the same filename already exists, the previous description is used.'),
);
return confirm_form($form, t('Are you sure you want to create a new snapshot?'), 'admin/settings/demo', t('If the above filename already exists, creating a new snapshot will overwrite the existing snapshot. This action cannot be undone.'), t('Create'), t('Cancel'));
return confirm_form($form, t('Are you sure you want to create a new snapshot?'), 'admin/build/demo', t('If the above filename already exists, creating a new snapshot will overwrite the existing snapshot. This action cannot be undone.'), t('Create'), t('Cancel'));
}
function demo_dump_submit($form_id, $values) {
......@@ -157,7 +157,7 @@ function demo_dump_submit($form_id, $values) {
drupal_set_message(t('@engine support not implemented yet.', array('@engine' => ucfirst($engine))), 'error');
}
drupal_goto('admin/settings/demo/manage');
drupal_goto('admin/build/demo/manage');
}
function _demo_reset_confirm() {
......@@ -167,7 +167,7 @@ function _demo_reset_confirm() {
);
$form = array_merge_recursive($form, demo_get_dumps());
return confirm_form($form, t('Are you sure you want to reset the site?'), 'admin/settings/demo', t('Resetting the site will overwrite all changes that have been made to this Drupal installation since the chosen snapshot.<br /><br /><div style="color: red; font-weight: bold; font-size: 18px;"><center>THIS ACTION CANNOT BE UNDONE!</center><br /></div>'), t('Reset'), t('Cancel'));
return confirm_form($form, t('Are you sure you want to reset the site?'), 'admin/build/demo', t('Resetting the site will overwrite all changes that have been made to this Drupal installation since the chosen snapshot.<br /><br /><div style="color: red; font-weight: bold; font-size: 18px;"><center>THIS ACTION CANNOT BE UNDONE!</center><br /></div>'), t('Reset'), t('Cancel'));
}
function demo_reset_confirm_submit($form_id, $values) {
......@@ -179,10 +179,7 @@ function demo_reset_confirm_submit($form_id, $values) {
// Save time of last reset.
variable_set('demo_reset_last', time());
if (isset($values['redirect'])) {
drupal_goto($values['redirect']);
}
drupal_goto('admin/settings/demo');
return (isset($values['redirect']) ? $values['redirect'] : 'admin/build/demo');
}
function demo_reset($filename = 'demo_site', $verbose = TRUE) {
......
......@@ -2,4 +2,3 @@
name = Demo Site
description = Create snapshots and reset the site for demonstration or testing purposes.
package = Development
......@@ -18,11 +18,10 @@ function demo_perm() {
*/
function demo_menu($may_cache) {
$items = array();
if ($may_cache) {
$admin_access = user_access('administer demo settings');
$items[] = array(
'path' => 'admin/settings/demo',
'path' => 'admin/build/demo',
'title' => t('Demonstration site'),
'description' => t('Administer reset interval, create new dumps and manually reset this site.'),
'callback' => 'drupal_get_form',
......@@ -30,13 +29,13 @@ function demo_menu($may_cache) {
'access' => $admin_access,
);
$items[] = array(
'path' => 'admin/settings/demo/maintenance',
'path' => 'admin/build/demo/maintenance',
'title' => t('Status'),
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => 0,
);
$items[] = array(
'path' => 'admin/settings/demo/manage',
'path' => 'admin/build/demo/manage',
'title' => t('Manage snapshots'),
'callback' => 'drupal_get_form',
'callback arguments' => array('demo_manage'),
......@@ -45,7 +44,7 @@ function demo_menu($may_cache) {
'weight' => 1,
);
$items[] = array(
'path' => 'admin/settings/demo/dump',
'path' => 'admin/build/demo/dump',
'title' => t('Create snapshot'),
'callback' => 'drupal_get_form',
'callback arguments' => array('demo_dump'),
......@@ -54,7 +53,7 @@ function demo_menu($may_cache) {
'weight' => 2,
);
$items[] = array(
'path' => 'admin/settings/demo/reset',
'path' => 'admin/build/demo/reset',
'title' => t('Reset site'),
'callback' => 'drupal_get_form',
'callback arguments' => array('demo_reset_confirm'),
......@@ -70,10 +69,12 @@ function demo_menu($may_cache) {
'type' => MENU_CALLBACK,
);
}
return $items;
}
/**
* Implementation of hook_block().
*/
function demo_block($op = 'list', $delta = 0, $edit = array()) {
switch ($op) {
case 'list':
......@@ -90,6 +91,7 @@ function demo_block($op = 'list', $delta = 0, $edit = array()) {
}
function demo_reset_now() {
$form = array();
$form['redirect'] = array(
'#type' => 'value',
'#value' => $_GET['q'],
......@@ -110,7 +112,7 @@ function demo_reset_now() {
function demo_reset_now_submit($form_id, $values) {
require_once drupal_get_path('module', 'demo') .'/demo.admin.inc';
demo_reset_confirm_submit($form_id, $values);
return demo_reset_confirm_submit($form_id, $values);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment