summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2003-05-29 10:18:38 +0000
committerDries Buytaert <dries@buytaert.net>2003-05-29 10:18:38 +0000
commit1fc8a18c2d74ec4ce5247b6abedddaadbcde3e34 (patch)
tree746f550c09c4a827c859d32384b055e35db1fcd0
parentf7e11d3bb763d0f8c3b0551b7f5848f72c557ac0 (diff)
downloadbrdo-1fc8a18c2d74ec4ce5247b6abedddaadbcde3e34.tar.gz
brdo-1fc8a18c2d74ec4ce5247b6abedddaadbcde3e34.tar.bz2
- 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).
-rw-r--r--includes/common.inc4
-rw-r--r--includes/theme.inc18
-rw-r--r--misc/drupal.css15
-rw-r--r--modules/aggregator.module15
-rw-r--r--modules/aggregator/aggregator.module15
-rw-r--r--modules/archive.module6
-rw-r--r--modules/archive/archive.module6
-rw-r--r--modules/cloud.module31
-rw-r--r--modules/forum.module1
-rw-r--r--modules/forum/forum.module1
-rw-r--r--modules/import.module15
-rw-r--r--modules/poll.module4
-rw-r--r--modules/poll/poll.module4
-rw-r--r--modules/user.module12
-rw-r--r--modules/user/user.module12
15 files changed, 100 insertions, 59 deletions
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 "<p>". ($title ? "<b>$title:</b><br />" : "") . $value . ($description ? "<br /><small><i>$description</i></small>" : "") ."</p>\n";
+ return "<div class=\"form-item\">". ($title ? "<div class=\"title\">$title:</div>" : "") . $value . ($description ? "<div class=\"description\">$description</div>" : "") ."</div>\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 .= "<div class=\"item-list\">";
if (isset($title)) {
- $output .= "<b>$title</b><br />";
+ $output .= "<div class=\"title\">$title</div>";
}
if (isset($items)) {
+ $output .= "<ul>";
foreach ($items as $item) {
- $output .= "- $item<br />";
+ $output .= "<li>$item</li>";
}
+ $output .= "</ul>";
}
-
+ $output .= "</div>";
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 .= "<base href=\"$base_url/\" />\n";
+ $output .= "<style type=\"text/css\">\n";
+ $output .= "@import url(misc/drupal.css);\n";
+ $output .= "</style>\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("<img src=\"". theme("image", "blog.gif") ."\" border=\"0\" width=\"12\" height=\"16\" alt=\"". t("Blog this item") ."\" />", "node/add/blog&amp;iid=$item->iid", array("title" => t("Comment on this news item in your personal blog.")));
+// $output .= "&nbsp;". l("<img src=\"". theme("image", "blog.gif") ."\" border=\"0\" width=\"12\" height=\"16\" alt=\"". t("Blog this item") ."\" />", "node/add/blog&amp;iid=$item->iid", array("title" => t("Comment on this news item in your personal blog.")));
+ $output .= "<div class=\"blog-it\">(". l("b", "node/add/blog&amp;iid=$item->iid", array("title" => t("Comment on this news item in your personal blog."))) .")</div>";
}
// external link
$output .= "<a href=\"$item->link\">$item->title</a>";
- return $output ."<br />";
+ 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 = "<div class=\"item-list\"><ul>";
while ($item = db_fetch_object($result)) {
- $output .= import_format_item($item);
+ $output .= "<li>". import_format_item($item) ."</li>";
}
+ $output .= "</ul></div>";
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 = "<div class=\"item-list\"><ul>";
while ($item = db_fetch_object($result)) {
- $output .= import_format_item($item);
+ $output .= "<li>". import_format_item($item) ."</li>";
}
-
+ $output .= "</ul></div>";
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("<img src=\"". theme("image", "blog.gif") ."\" border=\"0\" width=\"12\" height=\"16\" alt=\"". t("Blog this item") ."\" />", "node/add/blog&amp;iid=$item->iid", array("title" => t("Comment on this news item in your personal blog.")));
+// $output .= "&nbsp;". l("<img src=\"". theme("image", "blog.gif") ."\" border=\"0\" width=\"12\" height=\"16\" alt=\"". t("Blog this item") ."\" />", "node/add/blog&amp;iid=$item->iid", array("title" => t("Comment on this news item in your personal blog.")));
+ $output .= "<div class=\"blog-it\">(". l("b", "node/add/blog&amp;iid=$item->iid", array("title" => t("Comment on this news item in your personal blog."))) .")</div>";
}
// external link
$output .= "<a href=\"$item->link\">$item->title</a>";
- return $output ."<br />";
+ 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 = "<div class=\"item-list\"><ul>";
while ($item = db_fetch_object($result)) {
- $output .= import_format_item($item);
+ $output .= "<li>". import_format_item($item) ."</li>";
}
+ $output .= "</ul></div>";
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 = "<div class=\"item-list\"><ul>";
while ($item = db_fetch_object($result)) {
- $output .= import_format_item($item);
+ $output .= "<li>". import_format_item($item) ."</li>";
}
-
+ $output .= "</ul></div>";
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 = "<div class=\"inline-container\">";
+ $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 .= "</div>";
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 = "<div class=\"inline-container\">";
+ $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 .= "</div>";
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 .= "<div class=\"item-list\">";
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 .= "</ul>";
+ $inlist = false;
+ }
if ($hour == 0) {
- $output .= "<br />". t("Updated less than one hour ago:");
- }
- else {
- $output .= "<br />". 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 .= "<br />". format_plural($hour, "Updated more than an hour ago:", "Updated more than %count hours ago:");
+ if ($inlist) {
+ $output .= "</ul>";
+ $inlist = false;
+ }
+ $output .= format_plural($hour, "Updated more than an hour ago:", "Updated more than %count hours ago:");
$list = 0;
}
}
- $output .= "<div style=\"padding-left: 10px;\"><a href=\"$site->link\">$site->name</a></div>";
+ if (!$inlist) {
+ $output .= "<ul>";
+ $inlist = true;
+ }
+ $output .= "<li><a href=\"$site->link\">$site->name</a></li>";
}
+ if ($inlist) $output .= "</ul>";
+ $output .= "</div>";
return $output;
}
@@ -180,7 +195,7 @@ function cloud_block($op = "list", $delta = 0) {
}
else {
$block["subject"] = t("Site cloud");
- $block["content"] = cloud_list(20) ."<br /><div align=\"right\">". l(t("more"), "cloud", array("title" => t("Monitor other sites in the cloud."))) ."</div>";
+ $block["content"] = cloud_list(20) ."<div align=\"right\">". l(t("more"), "cloud", array("title" => t("Monitor other sites in the cloud."))) ."</div>";
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 .= "<br />";
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 .= "<br />";
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("<img src=\"". theme("image", "blog.gif") ."\" border=\"0\" width=\"12\" height=\"16\" alt=\"". t("Blog this item") ."\" />", "node/add/blog&amp;iid=$item->iid", array("title" => t("Comment on this news item in your personal blog.")));
+// $output .= "&nbsp;". l("<img src=\"". theme("image", "blog.gif") ."\" border=\"0\" width=\"12\" height=\"16\" alt=\"". t("Blog this item") ."\" />", "node/add/blog&amp;iid=$item->iid", array("title" => t("Comment on this news item in your personal blog.")));
+ $output .= "<div class=\"blog-it\">(". l("b", "node/add/blog&amp;iid=$item->iid", array("title" => t("Comment on this news item in your personal blog."))) .")</div>";
}
// external link
$output .= "<a href=\"$item->link\">$item->title</a>";
- return $output ."<br />";
+ 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 = "<div class=\"item-list\"><ul>";
while ($item = db_fetch_object($result)) {
- $output .= import_format_item($item);
+ $output .= "<li>". import_format_item($item) ."</li>";
}
+ $output .= "</ul></div>";
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 = "<div class=\"item-list\"><ul>";
while ($item = db_fetch_object($result)) {
- $output .= import_format_item($item);
+ $output .= "<li>". import_format_item($item) ."</li>";
}
-
+ $output .= "</ul></div>";
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 .= "<div class=\"poll-text\">". filter($value) ."</div>";
- $output .= "<div style=\"float:left; width:". $width ."%; height: 1em;\" class=\"poll-foreground\"></div>";
- $output .= "<div style=\"float:left; width:". (100 - $width) ."%; height: 1em;\" class=\"poll-background\"></div>";
+ $output .= "<div style=\"width:". $width ."%;\" class=\"poll-foreground\"></div>";
+ $output .= "<div style=\"width:". (100 - $width) ."%;\" class=\"poll-background\"></div>";
$output .= "<div align=\"right\"> $percentage%". (!$block ? " (". format_plural($node->chvotes[$key], "1 vote", "%count votes") .")" : "") ."</div>";
}
}
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 .= "<div class=\"poll-text\">". filter($value) ."</div>";
- $output .= "<div style=\"float:left; width:". $width ."%; height: 1em;\" class=\"poll-foreground\"></div>";
- $output .= "<div style=\"float:left; width:". (100 - $width) ."%; height: 1em;\" class=\"poll-background\"></div>";
+ $output .= "<div style=\"width:". $width ."%;\" class=\"poll-foreground\"></div>";
+ $output .= "<div style=\"width:". (100 - $width) ."%;\" class=\"poll-background\"></div>";
$output .= "<div align=\"right\"> $percentage%". (!$block ? " (". format_plural($node->chvotes[$key], "1 vote", "%count votes") .")" : "") ."</div>";
}
}
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, "<br />");
+ $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"] = "<div style=\"{ white-space: nowrap; }\">$output</div>";
+ $block["content"] = "<div style=\"white-space: nowrap;\">$output</div>";
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, "<br />");
+ $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"] = "<div style=\"{ white-space: nowrap; }\">$output</div>";
+ $block["content"] = "<div style=\"white-space: nowrap;\">$output</div>";
return $block;
}
break;