diff options
author | Dries Buytaert <dries@buytaert.net> | 2003-12-01 13:45:33 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2003-12-01 13:45:33 +0000 |
commit | 4e2c0b250e4f080d0bc3c4b587c6b2c53a0db7ac (patch) | |
tree | f057d6143f516349ba72ca67b4e2f4fc736cc95e | |
parent | 4a5dc7e43acac8f2c9f3844035055c609da40370 (diff) | |
download | brdo-4e2c0b250e4f080d0bc3c4b587c6b2c53a0db7ac.tar.gz brdo-4e2c0b250e4f080d0bc3c4b587c6b2c53a0db7ac.tar.bz2 |
- Introduced a drupal_set_message() and drupal_get_message() function.
Contributed themes and modules need to be updated:
- modules: status() is no more; use drupal_set_message() instead.
- themes: use drupal_get_message() to check for status messages and
visualize them.
29 files changed, 187 insertions, 137 deletions
diff --git a/includes/common.inc b/includes/common.inc index 04026a81e..337090710 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -28,6 +28,28 @@ function drupal_get_title() { // @} /** + @name drupal_message + + Functions to get and set the message of the current page. + @{ +**/ +function drupal_set_message($message = NULL, $type = "status") { + static $stored_message; + + if (isset($message)) { + $stored_message->message = $message; + $stored_message->type = $type; + } + + return $stored_message; +} + +function drupal_get_message() { + return drupal_set_message(); +} +// @} + +/** @name drupal_breadcrumb Functions to get and set the breadcrumb trail of the current page. diff --git a/misc/drupal.css b/misc/drupal.css index 885bb52f6..9bcf56b4d 100644 --- a/misc/drupal.css +++ b/misc/drupal.css @@ -208,7 +208,7 @@ fieldset { display: block; width: 95%; } -node-form .standard { +.node-form .standard { clear: both; } .node-form textarea { diff --git a/modules/admin.module b/modules/admin.module index b82fc2f8e..6e28374ad 100644 --- a/modules/admin.module +++ b/modules/admin.module @@ -1,12 +1,6 @@ <?php // $Id$ -function status($message) { - if ($message) { - return "<strong>Status:</strong> $message<hr />\n"; - } -} - function admin_help($section) { switch ($section) { case "admin/system/modules#description": diff --git a/modules/aggregator.module b/modules/aggregator.module index e4a644a6c..bbc2676a1 100644 --- a/modules/aggregator.module +++ b/modules/aggregator.module @@ -588,18 +588,18 @@ function import_admin() { } break; case "remove": - $output = status(import_remove(import_get_feed(arg(5)))); + drupal_set_message(import_remove(import_get_feed(arg(5)))); $output .= import_view(); break; case "update": - $output = status(import_refresh(import_get_feed(arg(5)))); + drupal_set_message(import_refresh(import_get_feed(arg(5)))); $output .= import_view(); break; case "tag": $output = import_tag(); break; case t("Save attributes"): - $output = status(import_save_attributes($edit)); + drupal_set_message(import_save_attributes($edit)); $output .= import_tag(); break; case t("Delete"): @@ -607,10 +607,10 @@ function import_admin() { // fall through: case t("Submit"): if (arg(5) == "bundle") { - $output = status(import_save_bundle($edit)); + drupal_set_message(import_save_bundle($edit)); } else { - $output = status(import_save_feed($edit)); + drupal_set_message(import_save_feed($edit)); } // fall through: default: diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module index e4a644a6c..bbc2676a1 100644 --- a/modules/aggregator/aggregator.module +++ b/modules/aggregator/aggregator.module @@ -588,18 +588,18 @@ function import_admin() { } break; case "remove": - $output = status(import_remove(import_get_feed(arg(5)))); + drupal_set_message(import_remove(import_get_feed(arg(5)))); $output .= import_view(); break; case "update": - $output = status(import_refresh(import_get_feed(arg(5)))); + drupal_set_message(import_refresh(import_get_feed(arg(5)))); $output .= import_view(); break; case "tag": $output = import_tag(); break; case t("Save attributes"): - $output = status(import_save_attributes($edit)); + drupal_set_message(import_save_attributes($edit)); $output .= import_tag(); break; case t("Delete"): @@ -607,10 +607,10 @@ function import_admin() { // fall through: case t("Submit"): if (arg(5) == "bundle") { - $output = status(import_save_bundle($edit)); + drupal_set_message(import_save_bundle($edit)); } else { - $output = status(import_save_feed($edit)); + drupal_set_message(import_save_feed($edit)); } // fall through: default: diff --git a/modules/block.module b/modules/block.module index 9d663824a..130f4e325 100644 --- a/modules/block.module +++ b/modules/block.module @@ -295,17 +295,17 @@ function block_admin() { $output = block_box_form(block_box_get(arg(4))); break; case "delete": - $output = status(block_box_delete(arg(4))); + drupal_set_message(block_box_delete(arg(4))); cache_clear_all(); $output .= block_admin_display(); break; case t("Save block"): - $output = status(block_box_save($edit)); + drupal_set_message(block_box_save($edit)); cache_clear_all(); $output .= block_admin_display(); break; case t("Save blocks"): - $output = status(block_admin_save($edit)); + drupal_set_message(block_admin_save($edit)); cache_clear_all(); // fall through default: diff --git a/modules/block/block.module b/modules/block/block.module index 9d663824a..130f4e325 100644 --- a/modules/block/block.module +++ b/modules/block/block.module @@ -295,17 +295,17 @@ function block_admin() { $output = block_box_form(block_box_get(arg(4))); break; case "delete": - $output = status(block_box_delete(arg(4))); + drupal_set_message(block_box_delete(arg(4))); cache_clear_all(); $output .= block_admin_display(); break; case t("Save block"): - $output = status(block_box_save($edit)); + drupal_set_message(block_box_save($edit)); cache_clear_all(); $output .= block_admin_display(); break; case t("Save blocks"): - $output = status(block_admin_save($edit)); + drupal_set_message(block_admin_save($edit)); cache_clear_all(); // fall through default: diff --git a/modules/book.module b/modules/book.module index 0f36bc357..d27fe6054 100644 --- a/modules/book.module +++ b/modules/book.module @@ -207,17 +207,17 @@ function book_node_link($node = 0) { if ($op == t("Add to book outline")) { db_query("INSERT INTO {book} (nid, parent, weight) VALUES (%d, %d, %d)", $node->nid, $edit["parent"], $edit["weight"]); - $output .= status(t("added the node to the book.")); + drupal_set_message(t("added the node to the book.")); } if ($op == t("Update book outline")) { db_query("UPDATE {book} SET parent = %d, weight = %d WHERE nid = %d", $edit["parent"], $edit["weight"], $node->nid); - $output .= status(t("updated the book outline.")); + drupal_set_message(t("updated the book outline.")); } if ($op == t("Remove from book outline")) { db_query("DELETE FROM {book} WHERE nid = %d", $node->nid); - $output .= status(t("removed the node form the book.")); + drupal_set_message(t("removed the node form the book.")); } $output .= "<h3>". t("Edit book outline for node <i>%booktitle</i>", array("%booktitle" => $node->title)) ."</h3>"; @@ -834,7 +834,7 @@ function book_admin() { $output = book_admin_orphan(); break; case t("Save book pages"): - $output = status(book_admin_save(arg(3), $edit)); + drupal_set_message(book_admin_save(arg(3), $edit)); // fall through: default: $output .= book_admin_view(arg(3)); diff --git a/modules/book/book.module b/modules/book/book.module index 0f36bc357..d27fe6054 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -207,17 +207,17 @@ function book_node_link($node = 0) { if ($op == t("Add to book outline")) { db_query("INSERT INTO {book} (nid, parent, weight) VALUES (%d, %d, %d)", $node->nid, $edit["parent"], $edit["weight"]); - $output .= status(t("added the node to the book.")); + drupal_set_message(t("added the node to the book.")); } if ($op == t("Update book outline")) { db_query("UPDATE {book} SET parent = %d, weight = %d WHERE nid = %d", $edit["parent"], $edit["weight"], $node->nid); - $output .= status(t("updated the book outline.")); + drupal_set_message(t("updated the book outline.")); } if ($op == t("Remove from book outline")) { db_query("DELETE FROM {book} WHERE nid = %d", $node->nid); - $output .= status(t("removed the node form the book.")); + drupal_set_message(t("removed the node form the book.")); } $output .= "<h3>". t("Edit book outline for node <i>%booktitle</i>", array("%booktitle" => $node->title)) ."</h3>"; @@ -834,7 +834,7 @@ function book_admin() { $output = book_admin_orphan(); break; case t("Save book pages"): - $output = status(book_admin_save(arg(3), $edit)); + drupal_set_message(book_admin_save(arg(3), $edit)); // fall through: default: $output .= book_admin_view(arg(3)); diff --git a/modules/comment.module b/modules/comment.module index fd16e3623..14a6223fe 100644 --- a/modules/comment.module +++ b/modules/comment.module @@ -1012,7 +1012,7 @@ function comment_mod_matrix($edit) { } } db_query("INSERT INTO {moderation_roles} (mid, rid, value) VALUES ". implode(", ", $sql)); - $output = status("Vote values saved"); + drupal_set_message("Vote values saved"); } $result = db_query("SELECT r.rid, r.name FROM {role} r, {permission} p WHERE r.rid = p.rid AND p.perm LIKE '%moderate comments%'"); @@ -1048,7 +1048,7 @@ function comment_mod_roles($edit) { if ($edit) { variable_set("comment_roles", $edit); - $output = status("Comment scores saved"); + drupal_set_message("Comment scores saved"); } $start_values = variable_get("comment_roles", array()); @@ -1075,18 +1075,18 @@ function comment_mod_votes($edit) { if ($op == t("Save vote")) { db_query("UPDATE {moderation_votes} SET vote = '%s', weight = %d WHERE mid = %d", $edit["vote"], $edit["weight"], $mid); $mid = 0; - $output = status("Vote saved"); + drupal_set_message("Vote saved"); } else if ($op == t("Delete vote")) { db_query("DELETE FROM {moderation_votes} WHERE mid = %d", $mid); db_query("DELETE FROM {moderation_roles} WHERE mid = %d", $mid); $mid = 0; - $output = status("Vote deleted"); + drupal_set_message("Vote deleted"); } else if ($op == t("Add new vote")) { db_query("INSERT INTO {moderation_votes} (vote, weight) VALUES ('%s', %d)", $edit["vote"], $edit["weight"]); $mid = 0; - $output = status("Vote added"); + drupal_set_message("Vote added"); } $output .= "<h3>". t("Moderation votes overview") ."</h3>"; @@ -1126,17 +1126,17 @@ function comment_mod_filters($edit) { if ($op == t("Save threshold")) { db_query("UPDATE {moderation_filters} SET filter = '%s', minimum = %d WHERE fid = %d", $edit["filter"], $edit["minimum"], $fid); $fid = 0; - $output = status("Saved threshold"); + drupal_set_message("Saved threshold"); } else if ($op == t("Delete threshold")) { db_query("DELETE FROM {moderation_filters} WHERE fid = %d", $fid); $fid = 0; - $output = status("Deleted threshold"); + drupal_set_message("Deleted threshold"); } else if ($op == t("Add new threshold")) { db_query("INSERT INTO {moderation_filters} (filter, minimum) VALUES ('%s', %d)", $edit["filter"], $edit["minimum"]); $fid = 0; - $output = status("Added threshold"); + drupal_set_message("Added threshold"); } $output .= "<h3>Comment threshold overview</h3>"; @@ -1222,11 +1222,11 @@ function comment_admin() { $output = comment_delete(array("cid" => arg(3))); break; case t("Delete"): - $output = status(comment_delete($edit)); + drupal_set_message(comment_delete($edit)); $output .= comment_admin_overview(0); break; case t("Submit"): - $output = status(comment_save(check_query(arg(3)), $edit)); + drupal_set_message(comment_save(check_query(arg(3)), $edit)); $output .= comment_admin_overview(0); break; default: diff --git a/modules/comment/comment.module b/modules/comment/comment.module index fd16e3623..14a6223fe 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -1012,7 +1012,7 @@ function comment_mod_matrix($edit) { } } db_query("INSERT INTO {moderation_roles} (mid, rid, value) VALUES ". implode(", ", $sql)); - $output = status("Vote values saved"); + drupal_set_message("Vote values saved"); } $result = db_query("SELECT r.rid, r.name FROM {role} r, {permission} p WHERE r.rid = p.rid AND p.perm LIKE '%moderate comments%'"); @@ -1048,7 +1048,7 @@ function comment_mod_roles($edit) { if ($edit) { variable_set("comment_roles", $edit); - $output = status("Comment scores saved"); + drupal_set_message("Comment scores saved"); } $start_values = variable_get("comment_roles", array()); @@ -1075,18 +1075,18 @@ function comment_mod_votes($edit) { if ($op == t("Save vote")) { db_query("UPDATE {moderation_votes} SET vote = '%s', weight = %d WHERE mid = %d", $edit["vote"], $edit["weight"], $mid); $mid = 0; - $output = status("Vote saved"); + drupal_set_message("Vote saved"); } else if ($op == t("Delete vote")) { db_query("DELETE FROM {moderation_votes} WHERE mid = %d", $mid); db_query("DELETE FROM {moderation_roles} WHERE mid = %d", $mid); $mid = 0; - $output = status("Vote deleted"); + drupal_set_message("Vote deleted"); } else if ($op == t("Add new vote")) { db_query("INSERT INTO {moderation_votes} (vote, weight) VALUES ('%s', %d)", $edit["vote"], $edit["weight"]); $mid = 0; - $output = status("Vote added"); + drupal_set_message("Vote added"); } $output .= "<h3>". t("Moderation votes overview") ."</h3>"; @@ -1126,17 +1126,17 @@ function comment_mod_filters($edit) { if ($op == t("Save threshold")) { db_query("UPDATE {moderation_filters} SET filter = '%s', minimum = %d WHERE fid = %d", $edit["filter"], $edit["minimum"], $fid); $fid = 0; - $output = status("Saved threshold"); + drupal_set_message("Saved threshold"); } else if ($op == t("Delete threshold")) { db_query("DELETE FROM {moderation_filters} WHERE fid = %d", $fid); $fid = 0; - $output = status("Deleted threshold"); + drupal_set_message("Deleted threshold"); } else if ($op == t("Add new threshold")) { db_query("INSERT INTO {moderation_filters} (filter, minimum) VALUES ('%s', %d)", $edit["filter"], $edit["minimum"]); $fid = 0; - $output = status("Added threshold"); + drupal_set_message("Added threshold"); } $output .= "<h3>Comment threshold overview</h3>"; @@ -1222,11 +1222,11 @@ function comment_admin() { $output = comment_delete(array("cid" => arg(3))); break; case t("Delete"): - $output = status(comment_delete($edit)); + drupal_set_message(comment_delete($edit)); $output .= comment_admin_overview(0); break; case t("Submit"): - $output = status(comment_save(check_query(arg(3)), $edit)); + drupal_set_message(comment_save(check_query(arg(3)), $edit)); $output .= comment_admin_overview(0); break; default: diff --git a/modules/import.module b/modules/import.module index e4a644a6c..bbc2676a1 100644 --- a/modules/import.module +++ b/modules/import.module @@ -588,18 +588,18 @@ function import_admin() { } break; case "remove": - $output = status(import_remove(import_get_feed(arg(5)))); + drupal_set_message(import_remove(import_get_feed(arg(5)))); $output .= import_view(); break; case "update": - $output = status(import_refresh(import_get_feed(arg(5)))); + drupal_set_message(import_refresh(import_get_feed(arg(5)))); $output .= import_view(); break; case "tag": $output = import_tag(); break; case t("Save attributes"): - $output = status(import_save_attributes($edit)); + drupal_set_message(import_save_attributes($edit)); $output .= import_tag(); break; case t("Delete"): @@ -607,10 +607,10 @@ function import_admin() { // fall through: case t("Submit"): if (arg(5) == "bundle") { - $output = status(import_save_bundle($edit)); + drupal_set_message(import_save_bundle($edit)); } else { - $output = status(import_save_feed($edit)); + drupal_set_message(import_save_feed($edit)); } // fall through: default: diff --git a/modules/locale.module b/modules/locale.module index 79da2f23c..1e047cb79 100644 --- a/modules/locale.module +++ b/modules/locale.module @@ -266,7 +266,7 @@ function locale_admin() { switch ($op) { case "delete": - $output = status(locale_delete(check_query(arg(3)))); + drupal_set_message(locale_delete(check_query(arg(3)))); $output .= locale_seek(); break; case "edit": @@ -283,7 +283,7 @@ function locale_admin() { $output .= locale_seek_form(); break; case t("Save translations"): - $output = status(locale_save(check_query(arg(3)))); + drupal_set_message(locale_save(check_query(arg(3)))); $output .= locale_seek(); break; default: diff --git a/modules/locale/locale.module b/modules/locale/locale.module index 79da2f23c..1e047cb79 100644 --- a/modules/locale/locale.module +++ b/modules/locale/locale.module @@ -266,7 +266,7 @@ function locale_admin() { switch ($op) { case "delete": - $output = status(locale_delete(check_query(arg(3)))); + drupal_set_message(locale_delete(check_query(arg(3)))); $output .= locale_seek(); break; case "edit": @@ -283,7 +283,7 @@ function locale_admin() { $output .= locale_seek_form(); break; case t("Save translations"): - $output = status(locale_save(check_query(arg(3)))); + drupal_set_message(locale_save(check_query(arg(3)))); $output .= locale_seek(); break; default: diff --git a/modules/node.module b/modules/node.module index 1423fe2be..a564c0c30 100644 --- a/modules/node.module +++ b/modules/node.module @@ -643,7 +643,7 @@ function node_admin_nodes() { } } - $output = status(t("the update has been performed.")); + drupal_set_message(t("the update has been performed.")); } $filter = $_SESSION["node_overview_filter"]; @@ -709,7 +709,7 @@ function node_admin_settings($edit) { foreach ($edit as $name => $value) { variable_set($name, $value); } - $output = status(t("the content settings have been saved.")); + drupal_set_message(t("the content settings have been saved.")); } if ($op == t("Reset to defaults")) { @@ -720,7 +720,7 @@ function node_admin_settings($edit) { foreach ($edit as $name => $value) { variable_del($name); } - $output = status(t("the content settings have been reset to their default values.")); + drupal_set_message(t("the content settings have been reset to their default values.")); } $header = array_merge(array(t("type")), array_keys(node_invoke_nodeapi($node, "settings"))); @@ -856,7 +856,7 @@ function node_revision_rollback($nid, $revision) { node_save($rev, $filter); - return status(t("rollbacked to revision #%revision of '%title'", array("%revision" => $revision, "%title" => $node->title))); + drupal_set_message(t("rollbacked to revision #%revision of '%title'", array("%revision" => $revision, "%title" => $node->title))); } } @@ -873,7 +873,7 @@ function node_revision_delete($nid, $revision) { node_save($node, array("nid", "revisions")); - return status(t("deleted revision #%revision of '%title'", array("%revision" => $revision, "%title" => $node->title))); + drupal_set_message(t("deleted revision #%revision of '%title'", array("%revision" => $revision, "%title" => $node->title))); } } @@ -1518,14 +1518,12 @@ function node_page() { print theme("page", node_revision_overview(arg(2)), t("Revisions")); break; case "rollback-revision": - $output = node_revision_rollback(arg(2), arg(3)); - $output .= node_revision_overview(arg(2)); - print theme("page", $output, t("Revisions")); + node_revision_rollback(arg(2), arg(3)); + print theme("page", node_revision_overview(arg(2)), t("Revisions")); break; case "delete-revision": - $output = node_revision_delete(arg(2), arg(3)); - $output .= node_revision_overview(arg(2)); - print theme("page", $output, t("Revisions")); + node_revision_delete(arg(2), arg(3)); + print theme("page", node_revision_overview(arg(2)), t("Revisions")); break; case t("Preview"): $edit = node_validate($edit, $error); diff --git a/modules/node/node.module b/modules/node/node.module index 1423fe2be..a564c0c30 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -643,7 +643,7 @@ function node_admin_nodes() { } } - $output = status(t("the update has been performed.")); + drupal_set_message(t("the update has been performed.")); } $filter = $_SESSION["node_overview_filter"]; @@ -709,7 +709,7 @@ function node_admin_settings($edit) { foreach ($edit as $name => $value) { variable_set($name, $value); } - $output = status(t("the content settings have been saved.")); + drupal_set_message(t("the content settings have been saved.")); } if ($op == t("Reset to defaults")) { @@ -720,7 +720,7 @@ function node_admin_settings($edit) { foreach ($edit as $name => $value) { variable_del($name); } - $output = status(t("the content settings have been reset to their default values.")); + drupal_set_message(t("the content settings have been reset to their default values.")); } $header = array_merge(array(t("type")), array_keys(node_invoke_nodeapi($node, "settings"))); @@ -856,7 +856,7 @@ function node_revision_rollback($nid, $revision) { node_save($rev, $filter); - return status(t("rollbacked to revision #%revision of '%title'", array("%revision" => $revision, "%title" => $node->title))); + drupal_set_message(t("rollbacked to revision #%revision of '%title'", array("%revision" => $revision, "%title" => $node->title))); } } @@ -873,7 +873,7 @@ function node_revision_delete($nid, $revision) { node_save($node, array("nid", "revisions")); - return status(t("deleted revision #%revision of '%title'", array("%revision" => $revision, "%title" => $node->title))); + drupal_set_message(t("deleted revision #%revision of '%title'", array("%revision" => $revision, "%title" => $node->title))); } } @@ -1518,14 +1518,12 @@ function node_page() { print theme("page", node_revision_overview(arg(2)), t("Revisions")); break; case "rollback-revision": - $output = node_revision_rollback(arg(2), arg(3)); - $output .= node_revision_overview(arg(2)); - print theme("page", $output, t("Revisions")); + node_revision_rollback(arg(2), arg(3)); + print theme("page", node_revision_overview(arg(2)), t("Revisions")); break; case "delete-revision": - $output = node_revision_delete(arg(2), arg(3)); - $output .= node_revision_overview(arg(2)); - print theme("page", $output, t("Revisions")); + node_revision_delete(arg(2), arg(3)); + print theme("page", node_revision_overview(arg(2)), t("Revisions")); break; case t("Preview"): $edit = node_validate($edit, $error); diff --git a/modules/path.module b/modules/path.module index 24ac11ac0..86039a684 100644 --- a/modules/path.module +++ b/modules/path.module @@ -25,13 +25,13 @@ function path_admin() { break; case "delete": - $output = status(path_delete(arg(3))); + drupal_set_message(path_delete(arg(3))); $output .= path_overview(); break; case t("Create new alias"): case t("Update alias"): - $output .= status(path_save($edit)); + drupal_set_message(path_save($edit)); break; default: diff --git a/modules/path/path.module b/modules/path/path.module index 24ac11ac0..86039a684 100644 --- a/modules/path/path.module +++ b/modules/path/path.module @@ -25,13 +25,13 @@ function path_admin() { break; case "delete": - $output = status(path_delete(arg(3))); + drupal_set_message(path_delete(arg(3))); $output .= path_overview(); break; case t("Create new alias"): case t("Update alias"): - $output .= status(path_save($edit)); + drupal_set_message(path_save($edit)); break; default: diff --git a/modules/system.module b/modules/system.module index 38c858c99..4ed775197 100644 --- a/modules/system.module +++ b/modules/system.module @@ -206,7 +206,7 @@ function system_save_settings($edit = array()) { } cache_clear_all(); - return t("the configuration options have been saved."); + drupal_set_message(t("the configuration options have been saved.")); } function system_reset_default($edit = array()) { @@ -216,7 +216,7 @@ function system_reset_default($edit = array()) { cache_clear_all(); - return t("the configuration options have been reset to their default values."); + drupal_set_message(t("the configuration options have been reset to their default values.")); } function system_view($type, $arg = "") { @@ -348,14 +348,14 @@ function system_admin() { if (user_access("administer site configuration")) { if ($op == t("Reset to defaults")) { - $output = status(system_reset_default($edit)); + system_reset_default($edit); } if ($op == t("Save configuration")) { - $output = status(system_save_settings($edit)); + system_save_settings($edit); } - $output .= system_view(arg(2), arg(3)); + $output = system_view(arg(2), arg(3)); print theme("page", $output); } else { diff --git a/modules/system/system.module b/modules/system/system.module index 38c858c99..4ed775197 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -206,7 +206,7 @@ function system_save_settings($edit = array()) { } cache_clear_all(); - return t("the configuration options have been saved."); + drupal_set_message(t("the configuration options have been saved.")); } function system_reset_default($edit = array()) { @@ -216,7 +216,7 @@ function system_reset_default($edit = array()) { cache_clear_all(); - return t("the configuration options have been reset to their default values."); + drupal_set_message(t("the configuration options have been reset to their default values.")); } function system_view($type, $arg = "") { @@ -348,14 +348,14 @@ function system_admin() { if (user_access("administer site configuration")) { if ($op == t("Reset to defaults")) { - $output = status(system_reset_default($edit)); + system_reset_default($edit); } if ($op == t("Save configuration")) { - $output = status(system_save_settings($edit)); + system_save_settings($edit); } - $output .= system_view(arg(2), arg(3)); + $output = system_view(arg(2), arg(3)); print theme("page", $output); } else { diff --git a/modules/taxonomy.module b/modules/taxonomy.module index f56b55ac1..aebdd1709 100644 --- a/modules/taxonomy.module +++ b/modules/taxonomy.module @@ -112,7 +112,8 @@ function taxonomy_save_vocabulary($edit) { cache_clear_all(); - return $message; + drupal_set_message($message); + return $edit; } function taxonomy_del_vocabulary($vid) { @@ -239,7 +240,8 @@ function taxonomy_save_term($edit) { cache_clear_all(); - return $message; + drupal_set_message($status); + return $edit; } function taxonomy_del_term($tid) { @@ -775,10 +777,10 @@ function taxonomy_admin() { } case t("Submit"): if (arg(3) == "vocabulary") { - $output .= status(taxonomy_save_vocabulary($edit)); + taxonomy_save_vocabulary($edit); } else { - $output .= status(taxonomy_save_term($edit)); + taxonomy_save_term($edit); if (!$edit["tid"]) { // if INSERT show form again $output .= taxonomy_form_term(); diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index f56b55ac1..aebdd1709 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -112,7 +112,8 @@ function taxonomy_save_vocabulary($edit) { cache_clear_all(); - return $message; + drupal_set_message($message); + return $edit; } function taxonomy_del_vocabulary($vid) { @@ -239,7 +240,8 @@ function taxonomy_save_term($edit) { cache_clear_all(); - return $message; + drupal_set_message($status); + return $edit; } function taxonomy_del_term($tid) { @@ -775,10 +777,10 @@ function taxonomy_admin() { } case t("Submit"): if (arg(3) == "vocabulary") { - $output .= status(taxonomy_save_vocabulary($edit)); + taxonomy_save_vocabulary($edit); } else { - $output .= status(taxonomy_save_term($edit)); + taxonomy_save_term($edit); if (!$edit["tid"]) { // if INSERT show form again $output .= taxonomy_form_term(); diff --git a/modules/user.module b/modules/user.module index 1aac76354..602b2ea19 100644 --- a/modules/user.module +++ b/modules/user.module @@ -956,7 +956,7 @@ function user_edit($edit = array()) { $user = user_save($user, array_merge($edit, $data)); - $output .= status(t("your user information changes have been saved.")); + drupal_set_message(t("your user information changes have been saved.")); } } } @@ -1178,19 +1178,19 @@ function user_admin_access($edit = array()) { if ($op == t("Add rule")) { $aid = db_next_id("{access}_aid"); db_query("INSERT INTO {access} (aid, mask, type, status) VALUES ('%s', '%s', '%s', %d)", $aid, $edit["mask"], $type, $edit["status"]); - $output .= status(t("access rule added.")); + drupal_set_message(t("access rule added.")); } else if ($op == t("Check")) { if (user_deny($type, $edit["test"])) { - $output .= status(t("<i>%test</i> is not allowed.", array ("%test" => $edit["test"]))); + drupal_set_message(t("<i>%test</i> is not allowed.", array ("%test" => $edit["test"]))); } else { - $output .= status(t("<i>%test</i> is allowed.", array ("%test" => $edit["test"]))); + drupal_set_message(t("<i>%test</i> is allowed.", array ("%test" => $edit["test"]))); } } else if ($id) { db_query("DELETE FROM {access} WHERE aid = %d", $id); - $output .= status(t("access rule deleted.")); + drupal_set_message(t("access rule deleted.")); } $header = array(t("type"), t("mask"), t("operations")); @@ -1403,7 +1403,7 @@ function user_admin_edit($edit = array()) { unset($edit["pass1"], $edit["pass2"]); if (!$error) { $account = user_save($account, array_merge($edit, $data)); - $output .= status(t("user information changes have been saved.")); + drupal_set_message(t("user information changes have been saved.")); } else { $output .= theme("error", $error); @@ -1413,7 +1413,7 @@ function user_admin_edit($edit = array()) { if ($edit["status"] == 0) { db_query("DELETE FROM {users} WHERE uid = %d", $account->uid); db_query("DELETE FROM {authmap} WHERE uid = %d", $account->uid); - $output .= status(t("the account has been deleted.")); + drupal_set_message(t("the account has been deleted.")); } else { $error = t("Failed to delete account: the account has to be blocked first."); @@ -1513,7 +1513,7 @@ function user_admin() { $output .= user_admin_access($edit); break; case t("Save permissions"): - $output = status(t("user permissions saved.")); + drupal_set_message(t("user permissions saved.")); case "permission": $output .= user_admin_perm($edit); break; @@ -1524,7 +1524,7 @@ function user_admin() { case t("Add role"): case t("Delete role"): case t("Save role"): - $output = status(t("your role changes were saved.")); + drupal_set_message(t("your role changes were saved.")); case "role": $output .= user_admin_role($edit); break; diff --git a/modules/user/user.module b/modules/user/user.module index 1aac76354..602b2ea19 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -956,7 +956,7 @@ function user_edit($edit = array()) { $user = user_save($user, array_merge($edit, $data)); - $output .= status(t("your user information changes have been saved.")); + drupal_set_message(t("your user information changes have been saved.")); } } } @@ -1178,19 +1178,19 @@ function user_admin_access($edit = array()) { if ($op == t("Add rule")) { $aid = db_next_id("{access}_aid"); db_query("INSERT INTO {access} (aid, mask, type, status) VALUES ('%s', '%s', '%s', %d)", $aid, $edit["mask"], $type, $edit["status"]); - $output .= status(t("access rule added.")); + drupal_set_message(t("access rule added.")); } else if ($op == t("Check")) { if (user_deny($type, $edit["test"])) { - $output .= status(t("<i>%test</i> is not allowed.", array ("%test" => $edit["test"]))); + drupal_set_message(t("<i>%test</i> is not allowed.", array ("%test" => $edit["test"]))); } else { - $output .= status(t("<i>%test</i> is allowed.", array ("%test" => $edit["test"]))); + drupal_set_message(t("<i>%test</i> is allowed.", array ("%test" => $edit["test"]))); } } else if ($id) { db_query("DELETE FROM {access} WHERE aid = %d", $id); - $output .= status(t("access rule deleted.")); + drupal_set_message(t("access rule deleted.")); } $header = array(t("type"), t("mask"), t("operations")); @@ -1403,7 +1403,7 @@ function user_admin_edit($edit = array()) { unset($edit["pass1"], $edit["pass2"]); if (!$error) { $account = user_save($account, array_merge($edit, $data)); - $output .= status(t("user information changes have been saved.")); + drupal_set_message(t("user information changes have been saved.")); } else { $output .= theme("error", $error); @@ -1413,7 +1413,7 @@ function user_admin_edit($edit = array()) { if ($edit["status"] == 0) { db_query("DELETE FROM {users} WHERE uid = %d", $account->uid); db_query("DELETE FROM {authmap} WHERE uid = %d", $account->uid); - $output .= status(t("the account has been deleted.")); + drupal_set_message(t("the account has been deleted.")); } else { $error = t("Failed to delete account: the account has to be blocked first."); @@ -1513,7 +1513,7 @@ function user_admin() { $output .= user_admin_access($edit); break; case t("Save permissions"): - $output = status(t("user permissions saved.")); + drupal_set_message(t("user permissions saved.")); case "permission": $output .= user_admin_perm($edit); break; @@ -1524,7 +1524,7 @@ function user_admin() { case t("Add role"): case t("Delete role"): case t("Save role"): - $output = status(t("your role changes were saved.")); + drupal_set_message(t("your role changes were saved.")); case "role": $output .= user_admin_role($edit); break; diff --git a/themes/marvin/marvin.theme b/themes/marvin/marvin.theme index 5c92a6970..c0c969e8f 100644 --- a/themes/marvin/marvin.theme +++ b/themes/marvin/marvin.theme @@ -62,6 +62,10 @@ function marvin_header() { $output .= "<small>$help</small><hr />"; } + if ($message = drupal_get_message()) { + $output .= "<b>". t("Status") ."</b>: ". $message->message ."<hr />"; + } + return $output; } diff --git a/themes/unconed/unconed.theme b/themes/unconed/unconed.theme index cee33d4db..386d9507d 100644 --- a/themes/unconed/unconed.theme +++ b/themes/unconed/unconed.theme @@ -77,9 +77,14 @@ function unconed_header() { <?php print theme("breadcrumb", drupal_get_breadcrumb()); print "<h1>" . drupal_get_title() . "</h1>"; + if ($help = menu_get_active_help()) { print "<small>$help</small><hr />"; } + + if ($message = drupal_get_message()) { + $output .= "<b>". t("Status") ."</b>: ". $message->message ."<hr />"; + } } function unconed_node($node, $main = 0, $page = 0) { diff --git a/themes/xtemplate/xtemplate.css b/themes/xtemplate/xtemplate.css index 4e1c937f0..128f8c952 100644 --- a/themes/xtemplate/xtemplate.css +++ b/themes/xtemplate/xtemplate.css @@ -96,12 +96,12 @@ img { #search .form-submit { height: 1.5em; } -#message { +#mission { background-color: #369; padding: 1.5em 2em; color: #fff; } -#message a, #message a:visited { +#mission a, #mission a:visited { color: #9cf; font-weight: bold; } @@ -109,9 +109,25 @@ img { /* padding in px not ex because IE messes up 100% width tables otherwise */ padding: 10px; } -#message, #main .node .content, .comment .content { +#mission, #main .node .content, .comment .content { line-height: 1.4; } +#help { + font-size: 0.9em; + margin-bottom: 1em; +} +.error-message { + background-color: #eee; + border: 1px solid red; + padding: 0.3em; + margin-bottom: 1em; +} +.status-message { + background-color: #eee; + border: 1px solid #ccc; + padding: 0.3em; + margin-bottom: 1em; +} #sidebar-left, #sidebar-right { background-color: #ddd; width: 16em; @@ -153,7 +169,7 @@ table { color: #777; } .static-node { - background: #eee; + background-color: #eee; border: solid 1px #ddd; padding: 1em; } diff --git a/themes/xtemplate/xtemplate.theme b/themes/xtemplate/xtemplate.theme index 2bc36e7af..99ae8b29b 100644 --- a/themes/xtemplate/xtemplate.theme +++ b/themes/xtemplate/xtemplate.theme @@ -9,7 +9,7 @@ $GLOBALS["xtemplate"]->template = new XTemplate("themes/xtemplate/xtemplate.xtmp $GLOBALS["xtemplate"]->template->SetNullBlock(" "); // "" doesnt work! function xtemplate_settings() { - $output .= form_textarea(t("Message on front page"), "xtemplate_message", variable_get("xtemplate_message", "edit message"), 70, 6, t("This text will be displayed on the front page. It can be used to display a mission statement, announcement or site description..")); + $output .= form_textarea(t("Message on front page"), "xtemplate_mission", variable_get("xtemplate_mission", "edit mission"), 70, 6, t("This text will be displayed on the front page. It can be used to display a mission statement, announcement or site description..")); $output .= form_textfield(t("Stylesheet URL"), "xtemplate_stylesheet", variable_get("xtemplate_stylesheet", "themes/xtemplate/xtemplate.css"), 70, 300, t("The URL for your theme's cascading stylesheet.")); $output .= form_textarea(t("Logo"), "xtemplate_logo", variable_get("xtemplate_logo", "<img src=\"themes/xtemplate/images/druplicon.gif\" alt=\"Druplicon\" />"), 70, 4, t("The HTML code for displaying the logo.")); $output .= form_textarea(t("Primary links"), "xtemplate_primary_links", variable_get("xtemplate_primary_links", l("edit primary links", "admin/system/themes/xtemplate")), 70, 8, t("The HTML code for the primary links.")); @@ -105,11 +105,17 @@ function xtemplate_header() { "breadcrumb" => theme("breadcrumb", drupal_get_breadcrumb()) )); - if (menu_get_active_help()) { - $xtemplate->template->assign("help", menu_get_active_help()); + if ($help = menu_get_active_help()) { + $xtemplate->template->assign("help", $help); $xtemplate->template->parse("header.help"); } + if ($message = drupal_get_message()) { + $xtemplate->template->assign("class", $message->type ."-message"); + $xtemplate->template->assign("message", ucfirst($message->message)); + $xtemplate->template->parse("header.message"); + } + if (variable_get("xtemplate_search_box", 1)) { $xtemplate->template->assign(array( //"search" => search_form(), @@ -119,10 +125,10 @@ function xtemplate_header() { $xtemplate->template->parse("header.search_box"); } - // only parse the message block if we are on the frontpage ... - if ($_GET["q"] == variable_get("site_frontpage", "node") && ($message = variable_get("xtemplate_message", "edit message"))) { - $xtemplate->template->assign("header_message", $message); - $xtemplate->template->parse("header.message"); + // only parse the mission block if we are on the frontpage ... + if ($_GET["q"] == variable_get("site_frontpage", "node") && ($mission = variable_get("xtemplate_mission", "edit mission"))) { + $xtemplate->template->assign("header_mission", $mission); + $xtemplate->template->parse("header.mission"); } if ($blocks = theme("blocks", "left")) { diff --git a/themes/xtemplate/xtemplate.xtmpl b/themes/xtemplate/xtemplate.xtmpl index 8db5d2959..93c051456 100644 --- a/themes/xtemplate/xtemplate.xtmpl +++ b/themes/xtemplate/xtemplate.xtmpl @@ -39,15 +39,18 @@ </td> <!-- END: blocks --> <td valign="top"> - <!-- BEGIN: message --> - <div id="message">{header_message}</div> - <!-- END: message --> + <!-- BEGIN: mission --> + <div id="mission">{mission}</div> + <!-- END: mission --> <div id="main"> {breadcrumb} <h1>{body_title}</h1> <!-- BEGIN: help --> - <small>{help}</small><hr /> + <div id="help">{help}</div> <!-- END: help --> + <!-- BEGIN: message --> + <div class="{class}">{message}</div> + <!-- END: message --> <!-- END: header --> <!-- BEGIN: node --> |