From 4e2c0b250e4f080d0bc3c4b587c6b2c53a0db7ac Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Mon, 1 Dec 2003 13:45:33 +0000 Subject: - 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. --- themes/marvin/marvin.theme | 4 ++++ themes/unconed/unconed.theme | 5 +++++ themes/xtemplate/xtemplate.css | 24 ++++++++++++++++++++---- themes/xtemplate/xtemplate.theme | 20 +++++++++++++------- themes/xtemplate/xtemplate.xtmpl | 11 +++++++---- 5 files changed, 49 insertions(+), 15 deletions(-) (limited to 'themes') 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 .= "$help
"; } + if ($message = drupal_get_message()) { + $output .= "". t("Status") .": ". $message->message ."
"; + } + 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() { " . drupal_get_title() . ""; + if ($help = menu_get_active_help()) { print "$help
"; } + + if ($message = drupal_get_message()) { + $output .= "". t("Status") .": ". $message->message ."
"; + } } 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", "\"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 @@ - -
{header_message}
- + +
{mission}
+
{breadcrumb}

{body_title}

- {help}
+
{help}
+ +
{message}
+ -- cgit v1.2.3