- 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).
4.2.x
Dries Buytaert 2003-05-29 10:18:38 +00:00
parent f7e11d3bb7
commit 1fc8a18c2d
15 changed files with 100 additions and 59 deletions

View File

@ -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) {

View File

@ -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;
}
/*

15
misc/drupal.css Normal file
View File

@ -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; }

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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));
/*

View File

@ -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));
/*

View File

@ -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;
}
}

View File

@ -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:"));

View File

@ -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:"));

View File

@ -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;
}

View File

@ -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>";
}
}

View File

@ -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>";
}
}

View File

@ -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;

View File

@ -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;