Commit 7de41539 authored by Dries's avatar Dries

- Patch #77919 by chx, eaton, moshe, et al: enable programmaticaly submitted...

- Patch #77919 by chx, eaton, moshe, et al: enable programmaticaly submitted forms via the pull model.
parent e2f42cf3
......@@ -44,6 +44,8 @@ Drupal x.x.x, xxxx-xx-xx (development version)
- removed the archive module.
- upgrade system:
* created space for update branches.
- forms API:
* made it possible to programmatically submit forms.
- split up and removed drupal.css.
- added nested lists generation.
......
This diff is collapsed.
......@@ -558,7 +558,7 @@ function st($string, $args = array()) {
/**
* Helper function: apply the appropriate transformation to st() and t() placeholders.
*/
*/
function _st(&$value, $key) {
switch ($key[0]) {
// Escaped only
......
......@@ -75,8 +75,9 @@ function _locale_admin_manage_screen() {
'#default_value' => $isdefault,
);
$form['submit'] = array('#type' => 'submit', '#value' => t('Save configuration'));
$form['#base'] = 'locale_admin_manage_screen';
return drupal_get_form('_locale_admin_manage_screen', $form, 'locale_admin_manage_screen');
return $form;
}
/**
......@@ -123,12 +124,8 @@ function _locale_admin_manage_screen_submit($form_id, $form_values) {
return 'admin/settings/locale/language/overview';
}
/**
* User interface for the language addition screen.
*/
function _locale_admin_manage_add_screen() {
function locale_add_language_form() {
$isocodes = _locale_prepare_iso_list();
$form = array();
$form['language list'] = array('#type' => 'fieldset',
'#title' => t('Language list'),
......@@ -141,9 +138,10 @@ function _locale_admin_manage_add_screen() {
'#description' => t('Select your language here, or add it below, if you are unable to find it.'),
);
$form['language list']['submit'] = array('#type' => 'submit', '#value' => t('Add language'));
return $form;
}
$output = drupal_get_form('locale_add_language_form', $form);
function locale_custom_language_form() {
$form = array();
$form['custom language'] = array('#type' => 'fieldset',
'#title' => t('Custom language'),
......@@ -163,10 +161,17 @@ function _locale_admin_manage_add_screen() {
'#description' => t('Name of the language. Will be available for translation in all languages.'),
);
$form['custom language']['submit'] = array('#type' => 'submit', '#value' => t('Add custom language'));
// Use the validation and submit functions of the add language form.
$output .= drupal_get_form('locale_custom_language_form', $form, 'locale_add_language_form');
$form['#base'] = 'locale_add_language_form';
return $form;
}
/**
* User interface for the language addition screen.
*/
function _locale_admin_manage_add_screen() {
$output = drupal_get_form('locale_add_language_form');
$output .= drupal_get_form('locale_custom_language_form');
return $output;
}
......@@ -205,7 +210,7 @@ function locale_add_language_form_submit($form_id, $form_values) {
/**
* User interface for the translation import screen.
*/
function _locale_admin_import_screen() {
function _locale_admin_import() {
$languages = locale_supported_languages(FALSE, TRUE);
$languages = array_map('t', $languages['name']);
unset($languages['en']);
......@@ -242,7 +247,7 @@ function _locale_admin_import_screen() {
$form['import']['submit'] = array('#type' => 'submit', '#value' => t('Import'));
$form['#attributes']['enctype'] = 'multipart/form-data';
return drupal_get_form('_locale_admin_import', $form);
return $form;
}
/**
......@@ -267,6 +272,32 @@ function _locale_admin_import_submit($form_id, $form_values) {
return 'admin/settings/locale';
}
function _locale_export_po_form() {
$form['export'] = array('#type' => 'fieldset',
'#title' => t('Export translation'),
'#collapsible' => TRUE,
);
$form['export']['langcode'] = array('#type' => 'select',
'#title' => t('Language name'),
'#options' => $languages,
'#description' => t('Select the language you would like to export in gettext Portable Object (.po) format.'),
);
$form['export']['submit'] = array('#type' => 'submit', '#value' => t('Export'));
return $form;
}
function _locale_export_pot_form() {
// Complete template export of the strings
$form['export'] = array('#type' => 'fieldset',
'#title' => t('Export template'),
'#collapsible' => TRUE,
'#description' => t('Generate a gettext Portable Object Template (.pot) file with all the interface strings from the Drupal locale database.'),
);
$form['export']['submit'] = array('#type' => 'submit', '#value' => t('Export'));
$form['#base'] = '_locale_export_po_form';
return $form;
}
/**
* User interface for the translation export screen
*/
......@@ -275,31 +306,13 @@ function _locale_admin_export_screen() {
$languages = array_map('t', $languages['name']);
unset($languages['en']);
$output = '';
// Offer language specific export if any language is set up
if (count($languages)) {
$form = array();
$form['export'] = array('#type' => 'fieldset',
'#title' => t('Export translation'),
'#collapsible' => TRUE,
);
$form['export']['langcode'] = array('#type' => 'select',
'#title' => t('Language name'),
'#options' => $languages,
'#description' => t('Select the language you would like to export in gettext Portable Object (.po) format.'),
);
$form['export']['submit'] = array('#type' => 'submit', '#value' => t('Export'));
$output = drupal_get_form('_locale_export_po', $form);
$output = drupal_get_form('_locale_export_po_form');
}
// Complete template export of the strings
$form = array();
$form['export'] = array('#type' => 'fieldset',
'#title' => t('Export template'),
'#collapsible' => TRUE,
'#description' => t('Generate a gettext Portable Object Template (.pot) file with all the interface strings from the Drupal locale database.'),
);
$form['export']['submit'] = array('#type' => 'submit', '#value' => t('Export'));
$output .= drupal_get_form('_locale_export_pot', $form, '_locale_export_po');
$output .= drupal_get_form('_locale_export_pot_form');
return $output;
}
......@@ -307,7 +320,7 @@ function _locale_admin_export_screen() {
/**
* Process a locale export form submissions.
*/
function _locale_export_po_submit($form_id, $form_values) {
function _locale_export_po_form_submit($form_id, $form_values) {
_locale_export_po($form_values['langcode']);
}
......@@ -346,7 +359,7 @@ function _locale_string_seek_form() {
$form['search']['submit'] = array('#type' => 'submit', '#value' => t('Search'));
$form['#redirect'] = FALSE;
return drupal_get_form('_locale_string_seek', $form);
return $form;
}
/**
......@@ -398,7 +411,7 @@ function _locale_string_edit($lid) {
$form['lid'] = array('#type' => 'value', '#value' => $lid);
$form['submit'] = array('#type' => 'submit', '#value' => t('Save translations'));
return drupal_get_form('_locale_string_edit', $form);
return $form;
}
/**
......@@ -1235,9 +1248,9 @@ function _locale_string_language_list($translation) {
* Build object out of search criteria specified in request variables
*/
function _locale_string_seek_query() {
static $query = NULL;
static $query;
if (is_null($query)) {
if (!isset($query)) {
$fields = array('string', 'language', 'searchin');
$query = new StdClass;
if (is_array($_REQUEST['edit'])) {
......
......@@ -101,7 +101,7 @@ function install_verify_settings() {
$db_path = ltrim(urldecode($url['path']), '/');
$settings_file = './'. conf_path() .'/settings.php';
_install_settings_validate($db_prefix, $db_type, $db_user, $db_pass, $db_host, $db_path, $settings_file);
_install_settings_form_validate($db_prefix, $db_type, $db_user, $db_pass, $db_host, $db_path, $settings_file);
if (!form_get_errors()) {
return TRUE;
}
......@@ -124,11 +124,11 @@ function install_change_settings() {
// We always need this because we want to run form_get_errors.
include_once './includes/form.inc';
drupal_maintenance_theme();
// The existing database settings are not working, so we need write access
// to settings.php to change them.
if (!drupal_verify_install_file($settings_file, FILE_EXIST|FILE_READABLE|FILE_WRITABLE)) {
drupal_maintenance_theme();
drupal_set_message(st('The @drupal installer requires write permissions to %file during the installation process.', array('@drupal' => drupal_install_profile_name(), '%file' => $settings_file)), 'error');
drupal_set_title('Drupal database setup');
......@@ -140,8 +140,17 @@ function install_change_settings() {
if ($db_url == 'mysql://username:password@localhost/databasename') {
$db_user = $db_pass = $db_path = '';
}
$output = drupal_get_form('install_settings_form', $profile, $settings_file, $db_url, $db_type, $db_prefix, $db_user, $db_pass, $db_host);
drupal_set_title('Database configuration');
print theme('install_page', $output);
exit;
}
/**
* Form API array definition for install_settings.
*/
function install_settings_form($profile, $settings_file, $db_url, $db_type, $db_prefix, $db_user, $db_pass, $db_host) {
$db_types = drupal_detect_database_types();
if (count($db_types) == 0) {
$form['no_db_types'] = array(
......@@ -170,7 +179,7 @@ function install_change_settings() {
}
else {
if (count($db_types) == 1) {
$db_types = array_values($db_types);
$db_types = array_values($db_types);
$form['basic_options']['db_type'] = array(
'#type' => 'hidden',
'#value' => $db_types[0],
......@@ -250,26 +259,21 @@ function install_change_settings() {
$form['_db_url'] = array('#type' => 'value');
$form['#action'] = "install.php?profile=$profile";
$form['#redirect'] = NULL;
drupal_maintenance_theme();
}
$output = drupal_get_form('install_settings', $form);
drupal_set_title('Database configuration');
print theme('install_page', $output);
exit;
return $form;
}
/**
* Form API validate for install_settings form.
*/
function install_settings_validate($form_id, $form_values, $form) {
function install_settings_form_validate($form_id, $form_values, $form) {
global $db_url;
_install_settings_validate($form_values['db_prefix'], $form_values['db_type'], $form_values['db_user'], $form_values['db_pass'], $form_values['db_host'], $form_values['db_path'], $form_values['settings_file'], $form);
_install_settings_form_validate($form_values['db_prefix'], $form_values['db_type'], $form_values['db_user'], $form_values['db_pass'], $form_values['db_host'], $form_values['db_path'], $form_values['settings_file'], $form);
}
/**
* Helper function for install_settings_validate.
*/
function _install_settings_validate($db_prefix, $db_type, $db_user, $db_pass, $db_host, $db_path, $settings_file, $form = NULL) {
function _install_settings_form_validate($db_prefix, $db_type, $db_user, $db_pass, $db_host, $db_path, $settings_file, $form = NULL) {
global $db_url;
// Check for default username/password
......@@ -313,7 +317,7 @@ function _install_settings_validate($db_prefix, $db_type, $db_user, $db_pass, $d
/**
* Form API submit for install_settings form.
*/
function install_settings_submit($form_id, $form_values) {
function install_settings_form_submit($form_id, $form_values) {
global $profile;
// Update global settings array and save
......@@ -349,42 +353,46 @@ function install_select_profile() {
return $profile->name;
}
elseif (sizeof($profiles) > 1) {
drupal_maintenance_theme();
$form = '';
foreach ($profiles as $profile) {
include_once($profile->filename);
if ($_POST['edit']['profile'] == $profile->name) {
return $profile->name;
}
// Load profile details.
$function = $profile->name .'_profile_details';
if (function_exists($function)) {
$details = $function();
}
// If set, used defined name. Otherwise use file name.
$name = isset($details['name']) ? $details['name'] : $profile->name;
$form['profile'][$name] = array(
'#type' => 'radio',
'#value' => 'default',
'#return_value' => $profile->name,
'#title' => $name,
'#description' => isset($details['description']) ? $details['description'] : '',
'#parents' => array('profile'),
);
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => 'Save configuration',
);
drupal_maintenance_theme();
drupal_set_title('Select an installation profile');
print theme('install_page', drupal_get_form('install_select_profile', $form));
print theme('install_page', drupal_get_form('install_select_profile_form', $profiles));
exit;
}
}
function install_select_profile_form($profiles) {
foreach ($profiles as $profile) {
include_once($profile->filename);
// Load profile details.
$function = $profile->name .'_profile_details';
if (function_exists($function)) {
$details = $function();
}
// If set, used defined name. Otherwise use file name.
$name = isset($details['name']) ? $details['name'] : $profile->name;
$form['profile'][$name] = array(
'#type' => 'radio',
'#value' => 'default',
'#return_value' => $profile->name,
'#title' => $name,
'#description' => isset($details['description']) ? $details['description'] : '',
'#parents' => array('profile'),
);
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => 'Save configuration',
);
return $form;
}
/**
* Show an error page when there are no profiles available.
*/
......
......@@ -54,12 +54,14 @@ function aggregator_menu($may_cache) {
'access' => $edit);
$items[] = array('path' => 'admin/content/aggregator/add/feed',
'title' => t('add feed'),
'callback' => 'aggregator_form_feed',
'callback' => 'drupal_get_form',
'callback arguments' => array('aggregator_form_feed'),
'access' => $edit,
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'admin/content/aggregator/add/category',
'title' => t('add category'),
'callback' => 'aggregator_form_category',
'callback' => 'drupal_get_form',
'callback arguments' => array('aggregator_form_category'),
'access' => $edit,
'type' => MENU_LOCAL_TASK);
$items[] = array('path' => 'admin/content/aggregator/remove',
......@@ -78,7 +80,8 @@ function aggregator_menu($may_cache) {
'weight' => -10);
$items[] = array('path' => 'admin/content/aggregator/settings',
'title' => t('settings'),
'callback' => 'aggregator_admin_settings',
'callback' => 'drupal_get_form',
'callback arguments' => array('aggregator_admin_settings'),
'type' => MENU_LOCAL_TASK,
'weight' => 10,
'access' => $edit);
......@@ -170,25 +173,25 @@ function aggregator_menu($may_cache) {
}
}
}
else if (arg(1) == 'aggregator' && is_numeric(arg(4))) {
if (arg(3) == 'feed') {
$feed = aggregator_get_feed(arg(4));
else if (arg(2) == 'aggregator' && is_numeric(arg(5))) {
if (arg(4) == 'feed') {
$feed = aggregator_get_feed(arg(5));
if ($feed) {
$items[] = array('path' => 'admin/content/aggregator/edit/feed/'. $feed['fid'],
'title' => t('edit feed'),
'callback' => 'aggregator_form_feed',
'callback arguments' => array($feed),
'callback' => 'drupal_get_form',
'callback arguments' => array('aggregator_form_feed', $feed),
'access' => $edit,
'type' => MENU_CALLBACK);
}
}
else {
$category = aggregator_get_category(arg(4));
$category = aggregator_get_category(arg(5));
if ($category) {
$items[] = array('path' => 'admin/content/aggregator/edit/category/'. $category['cid'],
'title' => t('edit category'),
'callback' => 'aggregator_form_category',
'callback arguments' => array($category),
'callback' => 'drupal_get_form',
'callback arguments' => array('aggregator_form_category', $category),
'access' => $edit,
'type' => MENU_CALLBACK);
}
......@@ -227,7 +230,7 @@ function aggregator_admin_settings() {
'#description' => t('The type of category selection widget which is shown on categorization pages. Checkboxes are easier to use; a multiple selector is good for working with large numbers of categories.')
);
return system_settings_form('aggregator_admin_settings', $form);
return system_settings_form($form);
}
/**
......@@ -336,7 +339,7 @@ function aggregator_form_category($edit = array()) {
$form['cid'] = array('#type' => 'hidden', '#value' => $edit['cid']);
}
return drupal_get_form('aggregator_form_category', $form);
return $form;
}
/**
......@@ -467,7 +470,7 @@ function aggregator_form_feed($edit = array()) {
$form['fid'] = array('#type' => 'hidden', '#value' => $edit['fid']);
}
return drupal_get_form('aggregator_form_feed', $form);
return $form;
}
/**
......@@ -1049,28 +1052,16 @@ function aggregator_page_category() {
return _aggregator_page_list('SELECT i.*, f.title AS ftitle, f.link AS flink FROM {aggregator_category_item} c LEFT JOIN {aggregator_item} i ON c.iid = i.iid LEFT JOIN {aggregator_feed} f ON i.fid = f.fid WHERE cid = '. $category->cid .' ORDER BY timestamp DESC, iid DESC', arg(3));
}
/**
* Prints an aggregator page listing a number of feed items. Various
* menu callbacks use this function to print their feeds.
*/
function _aggregator_page_list($sql, $op, $header = '') {
$categorize = (user_access('administer news feeds') && ($op == 'categorize'));
$output = '<div id="aggregator">';
function aggregator_page_list($sql, $header, $categorize) {
$form['header'] = array('#value' => $header);
$output .= $form['header']['#value'];
$result = pager_query($sql, 20);
$categories = array();
$done = FALSE;
$form['items'] = array();
while ($item = db_fetch_object($result)) {
$form['items'][$item->iid] = array('#value' => theme('aggregator_page_item', $item));
$output .= $form['items'][$item->iid]['#value'];
$form['categories'][$item->iid] = array();
if ($categorize) {
$categories_result = db_query('SELECT c.cid, c.title, ci.iid FROM {aggregator_category} c LEFT JOIN {aggregator_category_item} ci ON c.cid = ci.cid AND ci.iid = %d', $item->iid);
$selected = array();
while ($category = db_fetch_object($categories_result)) {
......@@ -1089,11 +1080,8 @@ function _aggregator_page_list($sql, $op, $header = '') {
);
}
}
$output .= '</div>';
$form['submit'] = array('#type' => 'submit', '#value' => t('Save categories'));
$form['pager'] = array('#value' => theme('pager', NULL, 20, 0));
$output .= $form['pager']['#value'];
// arg(1) is undefined if we are at the top aggregator URL
// is there a better way to do this?
if (!arg(1)) {
......@@ -1102,9 +1090,30 @@ function _aggregator_page_list($sql, $op, $header = '') {
elseif (arg(1) == 'categories' && arg(2) && !arg(3)) {
$form['feed_icon'] = array('#value' => theme('feed_icon', url('aggregator/rss/' . arg(2))));
}
$output .= $form['feed_icon']['#value'];
return $form;
}
return ($categorize) ? drupal_get_form('aggregator_page_list', $form) : $output;
/**
* Prints an aggregator page listing a number of feed items. Various
* menu callbacks use this function to print their feeds.
*/
function _aggregator_page_list($sql, $op, $header = '') {
$categorize = (user_access('administer news feeds') && ($op == 'categorize'));
$form = drupal_retrieve_form('aggregator_page_list', $sql, $header, $categorize);
if ($categorize) {
return $form;
}
else {
$output = '<div id="aggregator">';
$output .= $header;
foreach ($form['items'] as $item) {
$output .= $item['#value'];
}
$output .= '</div>';
$output .= $form['pager']['#value'];
$output .= $form['feed_icon']['#value'];
return $output;
}
}
function theme_aggregator_page_list($form) {
......
......@@ -71,20 +71,24 @@ function block_menu($may_cache) {
'title' => t('blocks'),
'access' => user_access('administer blocks'),
'description' => t('Configure what block content appears in your site\'s sidebars and other regions.'),
'callback' => 'block_admin_display');
'callback' => 'drupal_get_form',
'callback arguments' => array('block_admin_display'));
$items[] = array('path' => 'admin/build/block/list', 'title' => t('list'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'admin/build/block/configure', 'title' => t('configure block'),
'access' => user_access('administer blocks'),
'callback' => 'block_admin_configure',
'callback' => 'drupal_get_form',
'callback arguments' => array('block_admin_configure'),
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/build/block/delete', 'title' => t('delete block'),
'access' => user_access('administer blocks'),
'callback' => 'block_box_delete',
'callback' => 'drupal_get_form',
'callback arguments' => array('block_box_delete'),
'type' => MENU_CALLBACK);
$items[] = array('path' => 'admin/build/block/add', 'title' => t('add block'),
'access' => user_access('administer blocks'),
'callback' => 'block_box_add',
'callback' => 'drupal_get_form',
'callback arguments' => array('block_box_form'),
'type' => MENU_LOCAL_TASK);
foreach (list_themes() as $key => $theme) {
if ($theme->status) {
......@@ -245,7 +249,7 @@ function block_admin_display($theme = NULL) {
}
$form['submit'] = array('#type' => 'submit', '#value' => t('Save blocks'));
return drupal_get_form('block_admin_display', $form);
return $form;
}
/**
......@@ -468,7 +472,7 @@ function block_admin_configure($module = NULL, $delta = 0) {
'#value' => t('Save block'),
);
return drupal_get_form('block_admin_configure', $form);
return $form;
}
function block_admin_configure_validate($form_id, $form_values) {
......@@ -493,23 +497,13 @@ function block_admin_configure_submit($form_id, $form_values) {
}
}
/**
* Menu callback; displays the block creation form.
*/
function block_box_add() {
$form = block_box_form();
$form['submit'] = array('#type' => 'submit', '#value' => t('Save block'));
return drupal_get_form('block_box_add', $form);
}
function block_box_add_validate($form_id, $form_values) {
function block_box_form_validate($form_id, $form_values) {
if (empty($form_values['info']) || db_num_rows(db_query("SELECT info FROM {boxes} WHERE info = '%s'", $form_values['info']))) {
form_set_error('info', t('Please ensure that each block description is unique.'));
}
}
function block_box_add_submit($form_id, $form_values) {
function block_box_form_submit($form_id, $form_values) {
if (!form_get_errors()) {
if (block_box_save($form_values)) {
drupal_set_message(t('The block has been created.'));
......@@ -526,13 +520,13 @@ function block_box_delete($bid = 0) {
$form['info'] = array('#type' => 'hidden', '#value' => $box['info'] ? $box['info'] : $box['title']);
$form['bid'] = array('#type' => 'hidden', '#value' => $bid);
return confirm_form('block_box_delete_confirm', $form, t('Are you sure you want to delete the block %name?', array('%name' => $box['info'])), 'admin/build/block', '', t('Delete'), t('Cancel'));
return confirm_form($form, t('Are you sure you want to delete the block %name?', array('%name' => $box['info'])), 'admin/build/block', '', t('Delete'), t('Cancel'));
}
/**
* Deletion of custom blocks.
*/
function block_box_delete_confirm_submit($form_id, $form_values) {
function block_box_delete_submit($form_id, $form_values) {
db_query('DELETE FROM {boxes} WHERE bid = %d', $form_values['bid']);
drupal_set_message(t('The block %name has been removed.', array('%name' => $form_values['info'])));
cache_clear_all();
......@@ -567,6 +561,7 @@ function block_box_form($edit = array()) {
'#weight' => -17,
);
$form['body_filter']['format'] = filter_form($edit['format'], -16);
$form['submit'] = array('#type' => 'submit', '#value' => t('Save block'));
return $form;
}
......
......@@ -556,7 +556,7 @@ function blogapi_admin_settings() {
'#description' => t('Select the content types for which you wish to enable posting via blogapi. Each type will appear as a different "blog" in the client application (if supported).')
);
return system_settings_form('blogapi_admin_settings', $form);
return system_settings_form($form);
}
function blogapi_menu($may_cache) {
......@@ -580,7 +580,8 @@ function blogapi_menu($may_cache) {
'path' => 'admin/settings/blogapi',
'title' => t('blog APIs'),
'description' => t('Configure which content types and engines external blog clients can use.'),
'callback' => 'blogapi_admin_settings',
'callback' => 'drupal_get_form',
'callback arguments' => array('blogapi_admin_settings'),
'access' => user_access('administer site configuration'),
'type' => MENU_NORMAL_ITEM
);
......
......@@ -102,7 +102,8 @@ function book_menu($may_cache) {
$items[] = array(
'path' => 'admin/content/book/orphan',
'title' => t('orphan pages'),
'callback' => 'book_admin_orphan',
'callback' => 'drupal_get_form',
'callback arguments' => array('book_admin_orphan'),
'type' => MENU_LOCAL_TASK,
'weight' => 8);
$items[] = array(
......@@ -131,8 +132,8 @@ function book_menu($may_cache) {
$items[] = array(
'path' => 'node/'. arg(1) .'/outline',
'title' => t('outline'),
'callback' => 'book_outline',
'callback arguments' => array(arg(1)),
'callback' => 'drupal_get_form',
'callback arguments' => array('book_outline', arg(1)),
'access' => user_access('outline posts in books'),
'type' => MENU_LOCAL_TASK,
'weight' => 2);
......@@ -322,7 +323,7 @@ function book_outline($nid) {
}
drupal_set_title(check_plain($node->title));
return drupal_get_form('book_outline', $form);
return $form;
}
/**
......@@ -889,7 +890,7 @@ function book_admin_edit($nid) {
'#value' => t('Save book pages'),
);
return drupal_get_form('book_admin_edit', $form);
return $form;
}
else {
drupal_not_found();
......@@ -917,19 +918,18 @@ function book_admin_orphan() {
}
if (count($orphans)) {
$form = array();
$form['table'] = _book_admin_table($orphans);
$form['save'] = array(
'#type' => 'submit',
'#value' => t('Save book pages'),
);
return drupal_get_form('book_admin_edit', $form);
}
else {
return '<p>'. t('There are no orphan pages.') .'</p>';
$form['error'] = array('#value' => '<p>'. t('There are no orphan pages.') .'</p>');
}
$form['#base'] = 'book_admin_edit';
return $form;
}
function book_admin_edit_submit($form_id, $form_values) {
......
......@@ -104,7 +104,8 @@ function comment_menu($may_cache) {
'path' => 'admin/content/comment',
'title' => t('comments'),
'description' => t('List and edit site comments and the comment moderation queue.'),
'callback' => 'comment_admin_overview',
'callback' => 'drupal_get_form',
'callback arguments' => array('comment_admin_overview'),
'access' => $access
);
......@@ -116,14 +117,16 @@ function comment_menu($may_cache) {
$items[] = array('path' => 'admin/content/comment/list/new', 'title' => t('published comments'),
'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
$items[] = array('path' => 'admin/content/comment/list/approval', 'title' => t('approval queue'),
'callback' => 'comment_admin_overview', 'access' => $access,
'callback arguments' => array('approval'),
'callback' => 'drupal_get_form',
'callback arguments' => array('comment_admin_overview', 'approval'),
'access' => $access,
'type' => MENU_LOCAL_TASK);
$items[] = array(
'path' => 'admin/content/comment/settings',
'title' => t('settings'),
'callback' => 'comment_admin_settings',
'callback' => 'drupal_get_form',
'callback arguments' => array('comment_admin_settings'),
'access' => $access,
'weight' => 10,