Merge branch 'master' of evan@dev.controlyourself.ca:/var/www/trunk

This commit is contained in:
Evan Prodromou 2009-01-21 14:43:10 -05:00
commit d8ac85d8fc
2 changed files with 46 additions and 27 deletions

View File

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

View File

@ -1110,34 +1110,47 @@ 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;
}
#tagcloud .weight_4 {
font-size:1.9em;
.tag-cloud-4 {
font-size:2.5em;
}
#tagcloud .weight_5 {
font-size:2.2em;
.tag-cloud-5 {
font-size:3em;
}
.tag-cloud-6 {
font-size:3.5em;
}
.tag-cloud-7 {
font-size:4em;
}
#publictagcloud #tagcloud.section dt {
display:none;
}