From 1fc8a18c2d74ec4ce5247b6abedddaadbcde3e34 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Thu, 29 May 2003 10:18:38 +0000 Subject: - Al's CSS patches. This commit improves the themability of some core components such as lists, form items, removes an ugly hack from the archive module and should fix the poll problem (although it doesn't Opera/Konqueror). --- includes/common.inc | 4 ++-- includes/theme.inc | 18 +++++++++++++----- misc/drupal.css | 15 +++++++++++++++ modules/aggregator.module | 15 +++++++++------ modules/aggregator/aggregator.module | 15 +++++++++------ modules/archive.module | 6 +++--- modules/archive/archive.module | 6 +++--- modules/cloud.module | 31 +++++++++++++++++++++++-------- modules/forum.module | 1 - modules/forum/forum.module | 1 - modules/import.module | 15 +++++++++------ modules/poll.module | 4 ++-- modules/poll/poll.module | 4 ++-- modules/user.module | 12 +++++------- modules/user/user.module | 12 +++++------- 15 files changed, 100 insertions(+), 59 deletions(-) create mode 100644 misc/drupal.css diff --git a/includes/common.inc b/includes/common.inc index 35af870e2..80d842c03 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -427,7 +427,7 @@ function drupal_goto($url) { /* ** The "Location" header sends a REDIRECT status code to the http - ** deamon. In some cases this can go wrong, so we make sure none + ** daemon. In some cases this can go wrong, so we make sure none ** of the code /below/ gets executed when we redirect. */ @@ -773,7 +773,7 @@ function form($form, $method = "post", $action = 0, $options = 0) { } function form_item($title, $value, $description = 0) { - return "

". ($title ? "$title:
" : "") . $value . ($description ? "
$description" : "") ."

\n"; + return "
". ($title ? "
$title:
" : "") . $value . ($description ? "
$description
" : "") ."
\n"; } function form_radio($title, $name, $value = 1, $checked = 0, $description = 0) { diff --git a/includes/theme.inc b/includes/theme.inc index 2f1569b44..f85412621 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -99,17 +99,19 @@ function theme_item_list($items = array(), $title = NULL) { /* ** Return a formatted array of items. */ - + $output .= "
"; if (isset($title)) { - $output .= "$title
"; + $output .= "
$title
"; } if (isset($items)) { + $output .= ""; } - + $output .= "
"; return $output; } @@ -141,8 +143,14 @@ function theme_list($refresh = 0) { } function theme_head($main = 0) { + global $base_url; $head = module_invoke_all("head", $main); - return implode($head, "\n"); + $output .= "\n"; + $output .= "\n"; + $output .= implode($head, "\n"); + return $output; } /* diff --git a/misc/drupal.css b/misc/drupal.css new file mode 100644 index 000000000..76c81a8a8 --- /dev/null +++ b/misc/drupal.css @@ -0,0 +1,15 @@ +.item-list .title { font-weight: bold; } +.item-list ul { margin: 0 0 0.75em 0; padding: 0; } +.item-list ul li { margin: 0 0 0.25em 1.5em; padding: 0; list-style: disc; } + +.blog-it { color: #555; float: right; padding-left: 0.25em; } +.blog-it a { color: #000; text-decoration: none; } +.blog-it a:hover { color: #000; text-decoration: none; } + +.poll-foreground { background-color: #000; } +.poll-background { background-color: #ddd; } + +.form-item .title { font-weight: bold; margin-top: 1.1em; margin-bottom: 1px; } +.form-item .description { font-size: 0.85em; } + +.inline-container div { display: inline; } diff --git a/modules/aggregator.module b/modules/aggregator.module index ed70162b4..3dc3b22cc 100644 --- a/modules/aggregator.module +++ b/modules/aggregator.module @@ -71,13 +71,14 @@ function import_format_item($item, $feed = 0) { global $user; if ($user->uid && user_access("maintain personal blog")) { - $output .= l("\"".", "node/add/blog&iid=$item->iid", array("title" => t("Comment on this news item in your personal blog."))); +// $output .= " ". l("\"".", "node/add/blog&iid=$item->iid", array("title" => t("Comment on this news item in your personal blog."))); + $output .= "
(". l("b", "node/add/blog&iid=$item->iid", array("title" => t("Comment on this news item in your personal blog."))) .")
"; } // external link $output .= "link\">$item->title"; - return $output ."
"; + return $output; } function import_bundle_block($attributes) { @@ -89,20 +90,22 @@ function import_bundle_block($attributes) { $result = db_query_range("SELECT * FROM item WHERE ". implode(" OR ", $where) ." ORDER BY iid DESC", 0, variable_get("import_block_limit", 15)); } + $output = "
"; return $output; } function import_feed_block($feed) { $result = db_query_range("SELECT * FROM item WHERE fid = %d ORDER BY iid DESC ", $feed->fid, 0, variable_get("import_block_limit", 15)); - + $output = "
"; return $output; } diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module index ed70162b4..3dc3b22cc 100644 --- a/modules/aggregator/aggregator.module +++ b/modules/aggregator/aggregator.module @@ -71,13 +71,14 @@ function import_format_item($item, $feed = 0) { global $user; if ($user->uid && user_access("maintain personal blog")) { - $output .= l("\"".", "node/add/blog&iid=$item->iid", array("title" => t("Comment on this news item in your personal blog."))); +// $output .= " ". l("\"".", "node/add/blog&iid=$item->iid", array("title" => t("Comment on this news item in your personal blog."))); + $output .= "
(". l("b", "node/add/blog&iid=$item->iid", array("title" => t("Comment on this news item in your personal blog."))) .")
"; } // external link $output .= "link\">$item->title"; - return $output ."
"; + return $output; } function import_bundle_block($attributes) { @@ -89,20 +90,22 @@ function import_bundle_block($attributes) { $result = db_query_range("SELECT * FROM item WHERE ". implode(" OR ", $where) ." ORDER BY iid DESC", 0, variable_get("import_block_limit", 15)); } + $output = "
"; return $output; } function import_feed_block($feed) { $result = db_query_range("SELECT * FROM item WHERE fid = %d ORDER BY iid DESC ", $feed->fid, 0, variable_get("import_block_limit", 15)); - + $output = "
"; return $output; } diff --git a/modules/archive.module b/modules/archive.module index 5953223ba..45391227d 100644 --- a/modules/archive.module +++ b/modules/archive.module @@ -170,9 +170,9 @@ function archive_page() { $months = array(1 => t("January"), 2 => t("February"), 3 => t("March"), 4 => t("April"), 5 => t("May"), 6 => t("June"), 7 => t("July"), 8 => t("August"), 9 => t("September"), 10 => t("October"), 11 => t("November"), 12 => t("December")); for ($i = 1; $i <= 31; $i++) $days[$i] = $i; - $start = form_select("", "year", ($year ? $year : date("Y")), $years). form_select("", "month", ($month ? $month : date("m")), $months) . form_select("", "day", ($day ? $day : date("d")), $days) . form_submit(t("Show")); - $start = ereg_replace("<[/]?p>", "", $start); - + $start = "
"; + $start .= form_select("", "year", ($year ? $year : date("Y")), $years). form_select("", "month", ($month ? $month : date("m")), $months) . form_select("", "day", ($day ? $day : date("d")), $days) . form_submit(t("Show")); + $start .= "
"; theme("box", t("Archives"), form($start)); /* diff --git a/modules/archive/archive.module b/modules/archive/archive.module index 5953223ba..45391227d 100644 --- a/modules/archive/archive.module +++ b/modules/archive/archive.module @@ -170,9 +170,9 @@ function archive_page() { $months = array(1 => t("January"), 2 => t("February"), 3 => t("March"), 4 => t("April"), 5 => t("May"), 6 => t("June"), 7 => t("July"), 8 => t("August"), 9 => t("September"), 10 => t("October"), 11 => t("November"), 12 => t("December")); for ($i = 1; $i <= 31; $i++) $days[$i] = $i; - $start = form_select("", "year", ($year ? $year : date("Y")), $years). form_select("", "month", ($month ? $month : date("m")), $months) . form_select("", "day", ($day ? $day : date("d")), $days) . form_submit(t("Show")); - $start = ereg_replace("<[/]?p>", "", $start); - + $start = "
"; + $start .= form_select("", "year", ($year ? $year : date("Y")), $years). form_select("", "month", ($month ? $month : date("m")), $months) . form_select("", "day", ($day ? $day : date("d")), $days) . form_submit(t("Show")); + $start .= "
"; theme("box", t("Archives"), form($start)); /* diff --git a/modules/cloud.module b/modules/cloud.module index 339fedc38..45e5ae764 100644 --- a/modules/cloud.module +++ b/modules/cloud.module @@ -141,25 +141,40 @@ function cloud_list($limit = 10) { $hour = -1; $list = -1; - + $inlist = false; + $output .= "
"; while ($site = db_fetch_object($result)) { if ($hour != floor((time() - $site->timestamp) / 3600)) { $hour = floor((time() - $site->timestamp) / 3600); if ($hour < 12) { + if ($inlist) { + $output .= ""; + $inlist = false; + } if ($hour == 0) { - $output .= "
". t("Updated less than one hour ago:"); - } - else { - $output .= "
". format_plural($hour, "Updated an hour ago:", "Updated %count hours ago:"); + $output .= t("Updated less than one hour ago:"); + } + else { + $output .= format_plural($hour, "Updated an hour ago:", "Updated %count hours ago:"); } } else if ($list) { - $output .= "
". format_plural($hour, "Updated more than an hour ago:", "Updated more than %count hours ago:"); + if ($inlist) { + $output .= ""; + $inlist = false; + } + $output .= format_plural($hour, "Updated more than an hour ago:", "Updated more than %count hours ago:"); $list = 0; } } - $output .= "
link\">$site->name
"; + if (!$inlist) { + $output .= ""; + $output .= "
"; return $output; } @@ -180,7 +195,7 @@ function cloud_block($op = "list", $delta = 0) { } else { $block["subject"] = t("Site cloud"); - $block["content"] = cloud_list(20) ."
". l(t("more"), "cloud", array("title" => t("Monitor other sites in the cloud."))) ."
"; + $block["content"] = cloud_list(20) ."
". l(t("more"), "cloud", array("title" => t("Monitor other sites in the cloud."))) ."
"; return $block; } } diff --git a/modules/forum.module b/modules/forum.module index a1ea30a38..862c5b4e4 100644 --- a/modules/forum.module +++ b/modules/forum.module @@ -87,7 +87,6 @@ function forum_block($op = "list", $delta = 0) { if (empty($cache)) { unset($items); $content = node_title_list(db_query_range("SELECT n.nid, n.title, u.uid, u.name, GREATEST(n.created, MAX(c.timestamp)) AS sort FROM node n, forum f LEFT JOIN comments c ON c.nid = n.nid LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'forum' AND n.nid = f.nid AND n.status = 1 GROUP BY n.nid ORDER BY sort DESC", 0, variable_get("forum_block_num", "5")), t("Active forum topics:")); - $content .= "
"; unset ($items); $content .= node_title_list(db_query_range("SELECT n.nid, n.title, u.uid, u.name FROM node n LEFT JOIN forum f ON n.nid = f.nid LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'forum' ORDER BY n.nid DESC", 0, variable_get("forum_block_num", "5")), t("New forum topics:")); diff --git a/modules/forum/forum.module b/modules/forum/forum.module index a1ea30a38..862c5b4e4 100644 --- a/modules/forum/forum.module +++ b/modules/forum/forum.module @@ -87,7 +87,6 @@ function forum_block($op = "list", $delta = 0) { if (empty($cache)) { unset($items); $content = node_title_list(db_query_range("SELECT n.nid, n.title, u.uid, u.name, GREATEST(n.created, MAX(c.timestamp)) AS sort FROM node n, forum f LEFT JOIN comments c ON c.nid = n.nid LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'forum' AND n.nid = f.nid AND n.status = 1 GROUP BY n.nid ORDER BY sort DESC", 0, variable_get("forum_block_num", "5")), t("Active forum topics:")); - $content .= "
"; unset ($items); $content .= node_title_list(db_query_range("SELECT n.nid, n.title, u.uid, u.name FROM node n LEFT JOIN forum f ON n.nid = f.nid LEFT JOIN users u ON n.uid = u.uid WHERE n.type = 'forum' ORDER BY n.nid DESC", 0, variable_get("forum_block_num", "5")), t("New forum topics:")); diff --git a/modules/import.module b/modules/import.module index ed70162b4..3dc3b22cc 100644 --- a/modules/import.module +++ b/modules/import.module @@ -71,13 +71,14 @@ function import_format_item($item, $feed = 0) { global $user; if ($user->uid && user_access("maintain personal blog")) { - $output .= l("\"".", "node/add/blog&iid=$item->iid", array("title" => t("Comment on this news item in your personal blog."))); +// $output .= " ". l("\"".", "node/add/blog&iid=$item->iid", array("title" => t("Comment on this news item in your personal blog."))); + $output .= "
(". l("b", "node/add/blog&iid=$item->iid", array("title" => t("Comment on this news item in your personal blog."))) .")
"; } // external link $output .= "link\">$item->title"; - return $output ."
"; + return $output; } function import_bundle_block($attributes) { @@ -89,20 +90,22 @@ function import_bundle_block($attributes) { $result = db_query_range("SELECT * FROM item WHERE ". implode(" OR ", $where) ." ORDER BY iid DESC", 0, variable_get("import_block_limit", 15)); } + $output = "
"; return $output; } function import_feed_block($feed) { $result = db_query_range("SELECT * FROM item WHERE fid = %d ORDER BY iid DESC ", $feed->fid, 0, variable_get("import_block_limit", 15)); - + $output = "
"; return $output; } diff --git a/modules/poll.module b/modules/poll.module index d0fa6f9ef..d0a617d6b 100644 --- a/modules/poll.module +++ b/modules/poll.module @@ -306,8 +306,8 @@ function poll_view_results(&$node, $main, $block, $links) { $percentage = round($node->chvotes[$key] * 100 / max($votestotal, 1)); $output .= "
". filter($value) ."
"; - $output .= "
"; - $output .= "
"; + $output .= "
"; + $output .= "
"; $output .= "
$percentage%". (!$block ? " (". format_plural($node->chvotes[$key], "1 vote", "%count votes") .")" : "") ."
"; } } diff --git a/modules/poll/poll.module b/modules/poll/poll.module index d0fa6f9ef..d0a617d6b 100644 --- a/modules/poll/poll.module +++ b/modules/poll/poll.module @@ -306,8 +306,8 @@ function poll_view_results(&$node, $main, $block, $links) { $percentage = round($node->chvotes[$key] * 100 / max($votestotal, 1)); $output .= "
". filter($value) ."
"; - $output .= "
"; - $output .= "
"; + $output .= "
"; + $output .= "
"; $output .= "
$percentage%". (!$block ? " (". format_plural($node->chvotes[$key], "1 vote", "%count votes") .")" : "") ."
"; } } diff --git a/modules/user.module b/modules/user.module index acb08673b..0e1fa4647 100644 --- a/modules/user.module +++ b/modules/user.module @@ -352,15 +352,13 @@ function user_block($op = "list", $delta = 0) { break; case 1: if ($user->uid) { - $content[] = theme("theme_menu_list", module_invoke_all("link", "menu.create")); - $content[] = theme("theme_menu_list", module_invoke_all("link", "menu.view")); - $content[] = theme("theme_menu_list", module_invoke_all("link", "menu.settings")); - $content[] = theme("theme_menu_list", module_invoke_all("link", "menu.misc")); - - $output = implode($content, "
"); + $output .= theme("theme_menu_list", module_invoke_all("link", "menu.create")); + $output .= theme("theme_menu_list", module_invoke_all("link", "menu.view")); + $output .= theme("theme_menu_list", module_invoke_all("link", "menu.settings")); + $output .= theme("theme_menu_list", module_invoke_all("link", "menu.misc")); $block["subject"] = $user->name; - $block["content"] = "
$output
"; + $block["content"] = "
$output
"; return $block; } break; diff --git a/modules/user/user.module b/modules/user/user.module index acb08673b..0e1fa4647 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -352,15 +352,13 @@ function user_block($op = "list", $delta = 0) { break; case 1: if ($user->uid) { - $content[] = theme("theme_menu_list", module_invoke_all("link", "menu.create")); - $content[] = theme("theme_menu_list", module_invoke_all("link", "menu.view")); - $content[] = theme("theme_menu_list", module_invoke_all("link", "menu.settings")); - $content[] = theme("theme_menu_list", module_invoke_all("link", "menu.misc")); - - $output = implode($content, "
"); + $output .= theme("theme_menu_list", module_invoke_all("link", "menu.create")); + $output .= theme("theme_menu_list", module_invoke_all("link", "menu.view")); + $output .= theme("theme_menu_list", module_invoke_all("link", "menu.settings")); + $output .= theme("theme_menu_list", module_invoke_all("link", "menu.misc")); $block["subject"] = $user->name; - $block["content"] = "
$output
"; + $block["content"] = "
$output
"; return $block; } break; -- cgit v1.2.3