Commit 93b56f50 authored by Steven Wittens's avatar Steven Wittens
Browse files

- Fixing some usability bugs with aggregator admin: some forms lacked status...

- Fixing some usability bugs with aggregator admin: some forms lacked status messages, and redirected to themselves
- Now uses drupal_goto after every form submission [1]. Patches for other modules will follow.

[1] http://lists.drupal.org/archives/drupal-devel/2004-06/msg01147.html
parent 6a00c7c2
...@@ -686,6 +686,8 @@ function aggregator_edit() { ...@@ -686,6 +686,8 @@ function aggregator_edit() {
aggregator_save_feed($_POST['edit']); aggregator_save_feed($_POST['edit']);
drupal_set_message(t('The feed has been updated.')); drupal_set_message(t('The feed has been updated.'));
} }
drupal_goto($_GET['q']);
} }
else if ($_POST['op'] == t('Delete')) { else if ($_POST['op'] == t('Delete')) {
// Unset the title: // Unset the title:
...@@ -700,7 +702,7 @@ function aggregator_edit() { ...@@ -700,7 +702,7 @@ function aggregator_edit() {
drupal_set_message(t('The feed has been deleted.')); drupal_set_message(t('The feed has been deleted.'));
} }
drupal_goto('aggregator'); drupal_goto('aggregator/'. arg(1));
} }
if (arg(1) == 'categories') { if (arg(1) == 'categories') {
...@@ -716,7 +718,7 @@ function aggregator_edit() { ...@@ -716,7 +718,7 @@ function aggregator_edit() {
/** /**
* Menu callback; displays the category edit form, or saves changes and * Menu callback; displays the category edit form, or saves changes and
* displays the overview page. * redirects to the overview page.
*/ */
function aggregator_admin_edit_category($category = 0) { function aggregator_admin_edit_category($category = 0) {
$edit = $_POST['edit']; $edit = $_POST['edit'];
...@@ -728,7 +730,9 @@ function aggregator_admin_edit_category($category = 0) { ...@@ -728,7 +730,9 @@ function aggregator_admin_edit_category($category = 0) {
// Fall through: // Fall through:
case t('Submit'): case t('Submit'):
aggregator_save_category($edit); aggregator_save_category($edit);
$output = aggregator_view(); drupal_set_message($edit['title'] ? t('The category has been updated.') : t('The category has been deleted.'));
drupal_goto('admin/aggregator');
break;
default: default:
if ($category) { if ($category) {
$output = aggregator_form_category(aggregator_get_category($category)); $output = aggregator_form_category(aggregator_get_category($category));
...@@ -743,7 +747,7 @@ function aggregator_admin_edit_category($category = 0) { ...@@ -743,7 +747,7 @@ function aggregator_admin_edit_category($category = 0) {
/** /**
* Menu callback; displays the feed edit form. * Menu callback; displays the feed edit form.
* *
* After editing, saves changes and displays the overview page. * After editing, saves changes and redirects to the overview page.
*/ */
function aggregator_admin_edit_feed($feed = 0) { function aggregator_admin_edit_feed($feed = 0) {
$edit = $_POST['edit']; $edit = $_POST['edit'];
...@@ -755,7 +759,9 @@ function aggregator_admin_edit_feed($feed = 0) { ...@@ -755,7 +759,9 @@ function aggregator_admin_edit_feed($feed = 0) {
// Fall through: // Fall through:
case t('Submit'): case t('Submit'):
aggregator_save_feed($edit); aggregator_save_feed($edit);
$output = aggregator_view(); drupal_set_message($edit['title'] ? t('The feed has been updated.') : t('The feed has been deleted.'));
drupal_goto('admin/aggregator');
break;
default: default:
if ($feed) { if ($feed) {
$output = aggregator_form_feed(aggregator_get_feed($feed)); $output = aggregator_form_feed(aggregator_get_feed($feed));
...@@ -768,19 +774,19 @@ function aggregator_admin_edit_feed($feed = 0) { ...@@ -768,19 +774,19 @@ function aggregator_admin_edit_feed($feed = 0) {
} }
/** /**
* Menu callback; removes all items from a feed, then displays the overview page. * Menu callback; removes all items from a feed, then redirects to the overview page.
*/ */
function aggregator_admin_remove_feed($feed) { function aggregator_admin_remove_feed($feed) {
aggregator_remove(aggregator_get_feed($feed)); aggregator_remove(aggregator_get_feed($feed));
print theme('page', aggregator_view()); drupal_goto('admin/aggregator');
} }
/** /**
* Menu callback; refreshes a feed, then displays the overview page. * Menu callback; refreshes a feed, then redirects to the overview page.
*/ */
function aggregator_admin_refresh_feed($feed) { function aggregator_admin_refresh_feed($feed) {
aggregator_refresh(aggregator_get_feed($feed)); aggregator_refresh(aggregator_get_feed($feed));
print theme('page', aggregator_view()); drupal_goto('admin/aggregator');
} }
/** /**
...@@ -831,6 +837,8 @@ function _aggregator_page_list($sql, $op, $header = '') { ...@@ -831,6 +837,8 @@ function _aggregator_page_list($sql, $op, $header = '') {
} }
} }
} }
drupal_set_message(t('The categories have been saved.'));
drupal_goto($_GET['q']);
} }
else { else {
$categorize = true; $categorize = true;
......
...@@ -686,6 +686,8 @@ function aggregator_edit() { ...@@ -686,6 +686,8 @@ function aggregator_edit() {
aggregator_save_feed($_POST['edit']); aggregator_save_feed($_POST['edit']);
drupal_set_message(t('The feed has been updated.')); drupal_set_message(t('The feed has been updated.'));
} }
drupal_goto($_GET['q']);
} }
else if ($_POST['op'] == t('Delete')) { else if ($_POST['op'] == t('Delete')) {
// Unset the title: // Unset the title:
...@@ -700,7 +702,7 @@ function aggregator_edit() { ...@@ -700,7 +702,7 @@ function aggregator_edit() {
drupal_set_message(t('The feed has been deleted.')); drupal_set_message(t('The feed has been deleted.'));
} }
drupal_goto('aggregator'); drupal_goto('aggregator/'. arg(1));
} }
if (arg(1) == 'categories') { if (arg(1) == 'categories') {
...@@ -716,7 +718,7 @@ function aggregator_edit() { ...@@ -716,7 +718,7 @@ function aggregator_edit() {
/** /**
* Menu callback; displays the category edit form, or saves changes and * Menu callback; displays the category edit form, or saves changes and
* displays the overview page. * redirects to the overview page.
*/ */
function aggregator_admin_edit_category($category = 0) { function aggregator_admin_edit_category($category = 0) {
$edit = $_POST['edit']; $edit = $_POST['edit'];
...@@ -728,7 +730,9 @@ function aggregator_admin_edit_category($category = 0) { ...@@ -728,7 +730,9 @@ function aggregator_admin_edit_category($category = 0) {
// Fall through: // Fall through:
case t('Submit'): case t('Submit'):
aggregator_save_category($edit); aggregator_save_category($edit);
$output = aggregator_view(); drupal_set_message($edit['title'] ? t('The category has been updated.') : t('The category has been deleted.'));
drupal_goto('admin/aggregator');
break;
default: default:
if ($category) { if ($category) {
$output = aggregator_form_category(aggregator_get_category($category)); $output = aggregator_form_category(aggregator_get_category($category));
...@@ -743,7 +747,7 @@ function aggregator_admin_edit_category($category = 0) { ...@@ -743,7 +747,7 @@ function aggregator_admin_edit_category($category = 0) {
/** /**
* Menu callback; displays the feed edit form. * Menu callback; displays the feed edit form.
* *
* After editing, saves changes and displays the overview page. * After editing, saves changes and redirects to the overview page.
*/ */
function aggregator_admin_edit_feed($feed = 0) { function aggregator_admin_edit_feed($feed = 0) {
$edit = $_POST['edit']; $edit = $_POST['edit'];
...@@ -755,7 +759,9 @@ function aggregator_admin_edit_feed($feed = 0) { ...@@ -755,7 +759,9 @@ function aggregator_admin_edit_feed($feed = 0) {
// Fall through: // Fall through:
case t('Submit'): case t('Submit'):
aggregator_save_feed($edit); aggregator_save_feed($edit);
$output = aggregator_view(); drupal_set_message($edit['title'] ? t('The feed has been updated.') : t('The feed has been deleted.'));
drupal_goto('admin/aggregator');
break;
default: default:
if ($feed) { if ($feed) {
$output = aggregator_form_feed(aggregator_get_feed($feed)); $output = aggregator_form_feed(aggregator_get_feed($feed));
...@@ -768,19 +774,19 @@ function aggregator_admin_edit_feed($feed = 0) { ...@@ -768,19 +774,19 @@ function aggregator_admin_edit_feed($feed = 0) {
} }
/** /**
* Menu callback; removes all items from a feed, then displays the overview page. * Menu callback; removes all items from a feed, then redirects to the overview page.
*/ */
function aggregator_admin_remove_feed($feed) { function aggregator_admin_remove_feed($feed) {
aggregator_remove(aggregator_get_feed($feed)); aggregator_remove(aggregator_get_feed($feed));
print theme('page', aggregator_view()); drupal_goto('admin/aggregator');
} }
/** /**
* Menu callback; refreshes a feed, then displays the overview page. * Menu callback; refreshes a feed, then redirects to the overview page.
*/ */
function aggregator_admin_refresh_feed($feed) { function aggregator_admin_refresh_feed($feed) {
aggregator_refresh(aggregator_get_feed($feed)); aggregator_refresh(aggregator_get_feed($feed));
print theme('page', aggregator_view()); drupal_goto('admin/aggregator');
} }
/** /**
...@@ -831,6 +837,8 @@ function _aggregator_page_list($sql, $op, $header = '') { ...@@ -831,6 +837,8 @@ function _aggregator_page_list($sql, $op, $header = '') {
} }
} }
} }
drupal_set_message(t('The categories have been saved.'));
drupal_goto($_GET['q']);
} }
else { else {
$categorize = true; $categorize = true;
......
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