diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 7ca96fc74d71a19..30bc4331e51a7dc 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -22,11 +22,14 @@ Drupal x.x.x, xxxx-xx-xx * added support for multiple database connections. - theme system: * changed all GIFs to PNGs. +- blocks: + * added 'recent comments' block. + * added 'categories' block. - blogger API: * added support for auto-discovery of blogger API via RSD. - accessibility: * improved the accessibility of the archive module's calendar. - * improved form handling. + * improved form handling and error reporting. Drupal 4.4.2, 2004-07-04 diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index 968f0d29f4145ce..7a4518a51fae870 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -261,12 +261,16 @@ function watchdog($type, $message, $link = NULL) { * @{ */ function drupal_set_message($message = NULL, $type = "status") { - if (!isset($_SESSION['messages'])) { - $_SESSION['messages'] = array(); - } - if (isset($message)) { - $_SESSION['messages'][] = array($message, $type); + if (!isset($_SESSION['messages'])) { + $_SESSION['messages'] = array(); + } + + if (!isset($_SESSION['messages'][$type])) { + $_SESSION['messages'][$type] = array(); + } + + $_SESSION['messages'][$type][] = $message; } return $_SESSION['messages']; diff --git a/includes/theme.inc b/includes/theme.inc index 494ee78b27ef36d..c7c7c48872f38db 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -183,6 +183,35 @@ function theme_page($content, $title = NULL, $breadcrumb = NULL) { return $output; } +/** + * Returns themed set of status and/or error messages. The messages are grouped + * by type. + * + * @return a string containing the messages. + */ +function theme_status_messages() { + if ($data = drupal_get_messages()) { + $output = ''; + foreach ($data as $type => $messages) { + $output .= "
\n"; + if (count($messages) > 1) { + $output .= " \n"; + } + else { + $output .= ucfirst($messages[0]); + } + $output .= "
\n"; + } + + return $output; + } +} + + /** * Returns themed set of links. * @@ -283,7 +312,6 @@ function theme_node($node, $main = 0, $page = 0) { function theme_form_element($title, $value, $description = NULL, $id = NULL, $required = FALSE, $error = FALSE) { $output = "
\n"; - $required = $required ? theme('mark') : ''; if ($title) { @@ -446,6 +474,7 @@ function theme_item_list($items = array(), $title = NULL) { /** * Returns themed error message. + * REMOVE: this function is deprecated an no longer used in core. * * @param $message the error message to be themed. * diff --git a/themes/chameleon/chameleon.theme b/themes/chameleon/chameleon.theme index 3f24f74068cdc24..8af17edf0ce6755 100644 --- a/themes/chameleon/chameleon.theme +++ b/themes/chameleon/chameleon.theme @@ -77,10 +77,7 @@ function chameleon_page($content, $title = NULL, $breadcrumb = NULL) { $output .= "
$help

"; } - foreach (drupal_get_messages() as $message) { - list($message, $type) = $message; - $output .= "
". ucfirst($message) ."
"; - } + $output .= theme_status_messages(); $output .= "\n\n"; $output .= $content; diff --git a/themes/chameleon/common.css b/themes/chameleon/common.css index ece5c3ab3383f93..7ed4e4ff89ae862 100644 --- a/themes/chameleon/common.css +++ b/themes/chameleon/common.css @@ -99,17 +99,17 @@ br { .block { width: 180px; } -.message { +.messages { padding: 0.3em; - margin: 1em 0em 1em 0em; + margin: 0.5em 0em 0.5em 0em; } .status { - border: 1px solid #696; - color: #696; + border: 1px solid #3a3; + color: #3a3; } .error, form-item input.error { - border: 1px solid #930; - color: #930; + border: 1px solid red; + color: red; } /* diff --git a/themes/xtemplate/default/xtemplate.css b/themes/xtemplate/default/xtemplate.css index 5e2e7b2c2849a76..8828323a48cea5d 100644 --- a/themes/xtemplate/default/xtemplate.css +++ b/themes/xtemplate/default/xtemplate.css @@ -142,7 +142,7 @@ table { .breadcrumb { margin-bottom: .5em; } -.message { +.messages { background-color: #eee; border: 1px solid #ccc; padding: 0.3em; diff --git a/themes/xtemplate/default/xtemplate.xtmpl b/themes/xtemplate/default/xtemplate.xtmpl index c05d345347e738a..e01129a38733007 100644 --- a/themes/xtemplate/default/xtemplate.xtmpl +++ b/themes/xtemplate/default/xtemplate.xtmpl @@ -53,7 +53,7 @@
{help}
-
{message}
+ {message} diff --git a/themes/xtemplate/pushbutton/xtemplate.css b/themes/xtemplate/pushbutton/xtemplate.css index a78cb095fe249df..cdf464eec54e075 100644 --- a/themes/xtemplate/pushbutton/xtemplate.css +++ b/themes/xtemplate/pushbutton/xtemplate.css @@ -177,7 +177,7 @@ td#home a:hover img { .breadcrumb { margin-bottom: .5em; } -.message { +.messages { background-color: #eee; border: 1px solid #ccc; padding: 0.3em; diff --git a/themes/xtemplate/pushbutton/xtemplate.xtmpl b/themes/xtemplate/pushbutton/xtemplate.xtmpl index f847c51c3ae1d22..5e148eaac8b83ea 100644 --- a/themes/xtemplate/pushbutton/xtemplate.xtmpl +++ b/themes/xtemplate/pushbutton/xtemplate.xtmpl @@ -59,7 +59,7 @@
{help}
-
{message}
+ {message} diff --git a/themes/xtemplate/xtemplate.theme b/themes/xtemplate/xtemplate.theme index 60efdeeb561ae25..1ef3a591ceacdf9 100644 --- a/themes/xtemplate/xtemplate.theme +++ b/themes/xtemplate/xtemplate.theme @@ -164,10 +164,8 @@ function xtemplate_page($content, $title = NULL, $breadcrumb = NULL) { $xtemplate->template->parse("header.help"); } - foreach (drupal_get_messages() as $message) { - list($message, $type) = $message; - $xtemplate->template->assign("message", ucfirst($message)); - $xtemplate->template->assign("type", $type); + if ($message = theme_status_messages()) { + $xtemplate->template->assign("message", $message); $xtemplate->template->parse("header.message"); }