From 0b0f25ce93bdf583336266f3ef9851d6a3e843dd Mon Sep 17 00:00:00 2001 From: sarven Date: Wed, 21 Jan 2009 18:35:45 +0000 Subject: [PATCH] Public tagcloud and tag cloud styles --- actions/publictagcloud.php | 34 ++++++++++++++++++++-------------- theme/base/css/display.css | 34 +++++++++++++++++++++------------- 2 files changed, 41 insertions(+), 27 deletions(-) diff --git a/actions/publictagcloud.php b/actions/publictagcloud.php index ec28edbadc..6f5fc75413 100644 --- a/actions/publictagcloud.php +++ b/actions/publictagcloud.php @@ -103,7 +103,8 @@ class PublictagcloudAction extends Action $cnt = $tags->find(); if ($cnt > 0) { - $this->elementStart('p', 'tagcloud'); + $this->elementStart('div', array('id' => 'tagcloud', + 'class' => 'section')); $tw = array(); $sum = 0; @@ -114,36 +115,41 @@ class PublictagcloudAction extends Action ksort($tw); + $this->elementStart('dl'); + $this->element('dt', null, _('Tag cloud')); + $this->elementStart('dd'); + $this->elementStart('ul', 'tags xoxo tag-cloud'); foreach ($tw as $tag => $weight) { $this->showTag($tag, $weight, $weight/$sum); } - - $this->elementEnd('p'); + $this->elementEnd('ul'); + $this->elementEnd('dd'); + $this->elementEnd('dl'); + $this->elementEnd('div'); } } function showTag($tag, $weight, $relative) { - # XXX: these should probably tune to the size of the site if ($relative > 0.1) { - $cls = 'largest'; + $rel = 'tag-cloud-7'; } else if ($relative > 0.05) { - $cls = 'verylarge'; + $rel = 'tag-cloud-6'; } else if ($relative > 0.02) { - $cls = 'large'; + $rel = 'tag-cloud-5'; } else if ($relative > 0.01) { - $cls = 'medium'; + $rel = 'tag-cloud-4'; } else if ($relative > 0.005) { - $cls = 'small'; + $rel = 'tag-cloud-3'; } else if ($relative > 0.002) { - $cls = 'verysmall'; + $rel = 'tag-cloud-2'; } else { - $cls = 'smallest'; + $rel = 'tag-cloud-1'; } - $this->element('a', array('class' => "$cls weight-$weight relative-$relative", - 'href' => common_local_url('tag', array('tag' => $tag))), + $this->elementStart('li', $rel); + $this->element('a', array('href' => common_local_url('tag', array('tag' => $tag))), $tag); - $this->text(' '); + $this->elementEnd('li'); } } diff --git a/theme/base/css/display.css b/theme/base/css/display.css index c60097145a..59f3240f10 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -1110,33 +1110,41 @@ width:24px; /* tagcloud */ -#tagcloud ul { +.tag-cloud { list-style-type:none; } -#tagcloud ul li { +.tag-cloud li { display:inline; margin-right:7px; -line-height:1.4; +line-height:1; +} +.tag-cloud li a { +text-decoration:none; } - #tagcloud.section dt { text-transform:uppercase; font-weight:bold; } -#tagcloud .weight_1 { +.tag-cloud-1 { font-size:1em; } -#tagcloud .weight_2 { -font-size:1.3em; +.tag-cloud-2 { +font-size:1.5em; } -#tagcloud .weight_3 { -font-size:1.6em; +.tag-cloud-3 { +font-size:2em; +} +.tag-cloud-4 { +font-size:2.5em; +} +.tag-cloud-5 { +font-size:3em; } -#tagcloud .weight_4 { -font-size:1.9em; +.tag-cloud-6 { +font-size:3.5em; } -#tagcloud .weight_5 { -font-size:2.2em; +.tag-cloud-7 { +font-size:4em; } -- 2.39.5