summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2003-05-30 21:40:41 +0000
committerDries Buytaert <dries@buytaert.net>2003-05-30 21:40:41 +0000
commit34b51897d2bbc63864934d9af17d00de03f8c535 (patch)
tree440dee1740fef0007a7ed41a26c3485400f6b36d
parent1a8b678b52a2e8ecc284338c759b222d6051b34d (diff)
downloadbrdo-34b51897d2bbc63864934d9af17d00de03f8c535.tar.gz
brdo-34b51897d2bbc63864934d9af17d00de03f8c535.tar.bz2
- Better CSS for the poll module.
-rw-r--r--modules/poll.module23
-rw-r--r--modules/poll/poll.module23
2 files changed, 20 insertions, 26 deletions
diff --git a/modules/poll.module b/modules/poll.module
index d0a617d6b..d58dae7f2 100644
--- a/modules/poll.module
+++ b/modules/poll.module
@@ -293,28 +293,25 @@ function poll_view_results(&$node, $main, $block, $links) {
$votesmax = max($votesmax, 1);
}
- /*
- ** Define CSS classes for the bars
- ** (note: style is not allowed outside <head>, but the alternative is very
- ** ugly and it seems to work in all browsers)
- */
-
+ // Output the divs for the text, bars and percentages
+ $output .= "<div class=\"poll\">";
if ($node->choice) {
foreach ($node->choice as $key => $value) {
if ($value != "") {
$width = round($node->chvotes[$key] * 100 / $votesmax);
$percentage = round($node->chvotes[$key] * 100 / max($votestotal, 1));
-
- $output .= "<div class=\"poll-text\">". filter($value) ."</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>";
+ $output .= "<div class=\"text\">". filter($value) ."</div>";
+ $output .= "<div class=\"bar\">";
+ $output .= "<div style=\"width: ". $width ."%;\" class=\"foreground\"></div>";
+ $output .= "<div style=\"width: ". (100 - $width) ."%;\" class=\"background\"></div>";
+ $output .= "</div>";
+ $output .= "<div class=\"percent\"> $percentage%". (!$block ? " (". format_plural($node->chvotes[$key], "1 vote", "%count votes") .")" : "") ."</div>";
}
}
}
- $output .= "<br /><div align=\"center\">". t("Total votes") .": $votestotal";
+ $output .= "<div class=\"total\">". t("Total votes") .": $votestotal</div>";
- $output .= ($block ? "<br />". theme("links", $links) : "") ."</div>";
+ $output .= ($block ? "<div class=\"links\" />". theme("links", $links) ."</div>" : "") ."</div>";
return $output;
}
diff --git a/modules/poll/poll.module b/modules/poll/poll.module
index d0a617d6b..d58dae7f2 100644
--- a/modules/poll/poll.module
+++ b/modules/poll/poll.module
@@ -293,28 +293,25 @@ function poll_view_results(&$node, $main, $block, $links) {
$votesmax = max($votesmax, 1);
}
- /*
- ** Define CSS classes for the bars
- ** (note: style is not allowed outside <head>, but the alternative is very
- ** ugly and it seems to work in all browsers)
- */
-
+ // Output the divs for the text, bars and percentages
+ $output .= "<div class=\"poll\">";
if ($node->choice) {
foreach ($node->choice as $key => $value) {
if ($value != "") {
$width = round($node->chvotes[$key] * 100 / $votesmax);
$percentage = round($node->chvotes[$key] * 100 / max($votestotal, 1));
-
- $output .= "<div class=\"poll-text\">". filter($value) ."</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>";
+ $output .= "<div class=\"text\">". filter($value) ."</div>";
+ $output .= "<div class=\"bar\">";
+ $output .= "<div style=\"width: ". $width ."%;\" class=\"foreground\"></div>";
+ $output .= "<div style=\"width: ". (100 - $width) ."%;\" class=\"background\"></div>";
+ $output .= "</div>";
+ $output .= "<div class=\"percent\"> $percentage%". (!$block ? " (". format_plural($node->chvotes[$key], "1 vote", "%count votes") .")" : "") ."</div>";
}
}
}
- $output .= "<br /><div align=\"center\">". t("Total votes") .": $votestotal";
+ $output .= "<div class=\"total\">". t("Total votes") .": $votestotal</div>";
- $output .= ($block ? "<br />". theme("links", $links) : "") ."</div>";
+ $output .= ($block ? "<div class=\"links\" />". theme("links", $links) ."</div>" : "") ."</div>";
return $output;
}