option to sort taglists alphabetically rather than by tag count

This commit is contained in:
Daku 2012-03-02 08:44:18 +00:00
parent e5e27a7804
commit 0dd7d086f2
2 changed files with 13 additions and 0 deletions

View File

@ -14,6 +14,8 @@ class TagList extends Extension {
$config->set_default_int("tags_min", 3);
$config->set_default_string("info_link", 'http://en.wikipedia.org/wiki/$tag');
$config->set_default_string("tag_list_image_type", 'related');
$config->set_default_string("tag_list_related_sort", 'alphabetical');
$config->set_default_string("tag_list_popular_sort", 'tagcount');
$config->set_default_bool("tag_list_pages", false);
}
@ -98,6 +100,14 @@ class TagList extends Extension {
"Image's tags only" => "tags",
"Show related" => "related"
), "<br>Image tag list: ");
$sb->add_choice_option("tag_list_related_sort", array(
"Tag Count" => "tagcount",
"Alphabetical" => "alphabetical"
), "<br>Sort related list by: ");
$sb->add_choice_option("tag_list_popular_sort", array(
"Tag Count" => "tagcount",
"Alphabetical" => "alphabetical"
), "<br>Sort popular list by: ");
$sb->add_bool_option("tag_list_numbers", "<br>Show tag counts: ");
$event->panel->add_block($sb);
}

View File

@ -36,6 +36,8 @@ class TagListTheme extends Themelet {
$html = "";
$n = 0;
if($config->get_string('tag_list_related_sort') == 'alphabetical') asort($tag_infos);
foreach($tag_infos as $row) {
$tag = $row['tag'];
$h_tag = html_escape($tag);
@ -77,6 +79,7 @@ class TagListTheme extends Themelet {
$html = "";
$n = 0;
if($config->get_string('tag_list_popular_sort') == 'alphabetical') asort($tag_infos);
foreach($tag_infos as $row) {
$tag = $row['tag'];