|
I was just about to change the theme css when i noticed that the system only gave me 6 of the 20 possible css tags to use.
This is because the tag in my block that should have been the smallest, with just one user, is marked as .s14 instead of .s1. Is there a logic to this, i.e. is a tag weighted more if its on a users interests page compared to if its been used for a singe blog entry? Or is the intention not to use more than 6 font sizes from noow on? There is a logic .. If the least common is marked .s14, there's a bug. http://moodle.org/tag/search.php
I didn't code that part of the tag library, but the code is fairly small, you can have a look at http://cvs.moodle.org/moodle/tag/locallib.php?annotate=1.1.2.13#l18 Weird. I just looked at the moodle.org search cloud and it seemed fine, with tags down to s2. My own one (attached) shows nothing below s16. I'll have a poke about...
Seems to be that I have a couple of tags with extra things added, but lots with just one thing. This leads to a very flat hierarchy. The code currently starts at the biggest size and allocates smaller and smaller sizes to groups of tags with similar importance. My problem is that the lowest possible importance is reached after 4-5 iterations because tags are not used a lot yet. A better solution would be to either start the iteration at the smallest size or use a mor complicated algorithm to allocate based on proportion of total hierarchical levels. I will have a further poke about...
New version of tag_print_cloud(). The old one ranked all tags and allocated class based on position in the sequence so it was stuck for instances with only a small number of positions in the hierarchy. This one allocates based on (tag count / count of most used tag * 20), so it still works for a very flat hierarchy.
Sorry its not a proper patch! function tag_print_cloud($nr_of_tags=150, $return=false) { global $CFG; $can_manage_tags = has_capability('moodle/tag:manage', get_context_instance(CONTEXT_SYSTEM)); if ( !$tagcloud = get_records_sql('SELECT tg.rawname, tg.id, tg.name, tg.tagtype, COUNT(ti.id) AS count, tg.flag '. $tagkeys = array_keys($tagcloud); $etags = array(); foreach ($tagcloud as $tag) { $size = ((int)((($tag->count) / $maxcount) * 20)); $tag->class = "$tag->tagtype s$size"; $etags[] = $tag; } usort($etags, "tag_cloud_sort"); $link = $CFG->wwwroot .'/tag/index.php?tag='. rawurlencode($tag->name); if ($return) {
return $output;
} else {
echo $output;
} Thanks, I finally gave this a try and committed it.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The default size might not be optimal, but I am really not the best one for this. I think the default size haven't really changed.. Though, both tag blocks have been made to use the same css styles, for consistency reasons (and to make it easier the day they get merged).
I'm adding Urs to this discussion, he'll have a better idea than me of what the default css should be like.