From b46bde40ec2d4e760f2f72d851f929b8e55f7f62 Mon Sep 17 00:00:00 2001 From: Tim Steiner <tsteiner2@unl.edu> Date: Fri, 30 Apr 2010 19:01:12 +0000 Subject: [PATCH] Fixes to the status message display code. git-svn-id: file:///tmp/wdn_thm_drupal/branches/drupal-7.x@69 20a16fea-79d4-4915-8869-1ea9d5ebf173 --- sites/all/themes/unl_wdn/page.tpl.php | 17 --------------- sites/all/themes/unl_wdn/template.php | 30 +++++++++++++++++++++++---- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/sites/all/themes/unl_wdn/page.tpl.php b/sites/all/themes/unl_wdn/page.tpl.php index 0ad236710..daf24e541 100644 --- a/sites/all/themes/unl_wdn/page.tpl.php +++ b/sites/all/themes/unl_wdn/page.tpl.php @@ -86,23 +86,6 @@ if (isset($site_slogan) && $site_slogan) { } -if ($messages) { - $messages = <<<EOF -<script type="text/javascript"> -WDN.initializePlugin('notice'); -</script> -<div class="wdn_notice"> - <div class="close"> - <a href="#" title="Close this notice">Close this notice</a> - </div> - <div class="message"> - $messages - </div> -</div> -EOF; - -} - $t->maincontentarea = $messages . PHP_EOL . render($tabs) . PHP_EOL . render($action_links) . PHP_EOL diff --git a/sites/all/themes/unl_wdn/template.php b/sites/all/themes/unl_wdn/template.php index 27b58b0e5..15e5d3ae3 100644 --- a/sites/all/themes/unl_wdn/template.php +++ b/sites/all/themes/unl_wdn/template.php @@ -125,12 +125,19 @@ function unl_wdn_menu_local_task($variables) return '<li' . (!empty($variables['element']['#active']) ? ' class="selected"' : '') . '>' . l($link_text, $link['href'], $link['localized_options']) . "</li>\n"; } - -function unl_wdn_status_messages($display) +function unl_wdn_status_messages() { $output = ''; foreach (drupal_get_messages($display) as $type => $messages) { - $output .= '<div>' . PHP_EOL; + $type = ucfirst($type); + $output .= <<<EOF +<div class="wdn_notice"> + <div class="close"> + <a href="#" title="Close this notice">Close this notice</a> + </div> + <div class="message"> + <h3>$type</h3> +EOF; if (count($messages) > 1) { $output .= '<ul>' . PHP_EOL; foreach ($messages as $message) { @@ -140,7 +147,22 @@ function unl_wdn_status_messages($display) } else { $output .= $messages[0]; } - $output .= '</div>' . PHP_EOL; + $output .= <<<EOF + </div> +</div> +EOF; + } + + if (!$output) { + return ''; } + + $output = <<<EOF +<script type="text/javascript"> +WDN.initializePlugin('notice'); +</script> +$output +EOF; + return $output; } -- GitLab