From e82ff7d3fbfc49a8c602ced3151d2819fea57023 Mon Sep 17 00:00:00 2001 From: Shish Date: Sun, 18 Apr 2010 03:47:19 +0100 Subject: [PATCH 1/4] mincount paramater --- ext/tag_list/main.php | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/ext/tag_list/main.php b/ext/tag_list/main.php index f9216a7d..960857c0 100644 --- a/ext/tag_list/main.php +++ b/ext/tag_list/main.php @@ -88,6 +88,16 @@ class TagList implements Extension { $u_tag = url_escape($tag); return make_link("post/list/$u_tag/1"); } + + private function get_tags_min() { + if(isset($_GET['mincount'])) { + return int_escape($_GET['mincount']); + } + else { + global $config; + return $config->get_int('tags_min'); + } + } // }}} // maps {{{ private function build_navigation() { @@ -101,9 +111,8 @@ class TagList implements Extension { private function build_tag_map() { global $database; - global $config; - $tags_min = $config->get_int('tags_min'); + $tags_min = $this->get_tags_min(); $result = $database->execute(" SELECT tag, @@ -128,9 +137,8 @@ class TagList implements Extension { private function build_tag_alphabetic() { global $database; - global $config; - $tags_min = $config->get_int('tags_min'); + $tags_min = $this->get_tags_min(); $result = $database->execute( "SELECT tag,count FROM tags WHERE count >= ? ORDER BY tag", array($tags_min)); @@ -154,9 +162,8 @@ class TagList implements Extension { private function build_tag_popularity() { global $database; - global $config; - $tags_min = $config->get_int('tags_min'); + $tags_min = $this->get_tags_min(); $result = $database->execute( "SELECT tag,count,FLOOR(LOG(count)) AS scaled FROM tags WHERE count >= ? ORDER BY count DESC, tag ASC", array($tags_min)); @@ -181,9 +188,8 @@ class TagList implements Extension { private function build_tag_categories() { global $database; - global $config; - $tags_min = $config->get_int('tags_min'); + $tags_min = $this->get_tags_min(); $result = $database->execute("SELECT tag,count FROM tags ORDER BY count DESC, tag ASC LIMIT 9"); $tag_data = $result->GetArray(); From 92695ae495c332c256e7ca588293b0cf85d5731f Mon Sep 17 00:00:00 2001 From: Shish Date: Sun, 18 Apr 2010 03:49:58 +0100 Subject: [PATCH 2/4] note for later --- ext/tag_list/test.php | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/tag_list/test.php b/ext/tag_list/test.php index 660473d2..76db3a68 100644 --- a/ext/tag_list/test.php +++ b/ext/tag_list/test.php @@ -14,6 +14,7 @@ class TagListTest extends ShimmieWebTestCase { $this->assert_title('Tag List'); # FIXME: test that these show the right stuff + # FIXME: test mincount } } ?> From 4e05d7748470447acef39b26a1547235a80c3a98 Mon Sep 17 00:00:00 2001 From: Shish Date: Sun, 18 Apr 2010 03:54:55 +0100 Subject: [PATCH 3/4] link to all --- ext/tag_list/main.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ext/tag_list/main.php b/ext/tag_list/main.php index 960857c0..95a8cfdb 100644 --- a/ext/tag_list/main.php +++ b/ext/tag_list/main.php @@ -106,7 +106,8 @@ class TagList implements Extension { $h_alphabetic = "Alphabetic"; $h_popularity = "Popularity"; $h_cats = "Categories"; - return "$h_index
$h_map
$h_alphabetic
$h_popularity
$h_cats"; + $h_all = "Show All"; + return "$h_index
 
$h_map
$h_alphabetic
$h_popularity
$h_cats
 
$h_all"; } private function build_tag_map() { From 9caa3ca560abe1019f062d440186ff03766345d7 Mon Sep 17 00:00:00 2001 From: Shish Date: Wed, 21 Apr 2010 17:09:58 +0100 Subject: [PATCH 4/4] test mincount param --- ext/tag_list/test.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/ext/tag_list/test.php b/ext/tag_list/test.php index 76db3a68..fc574eab 100644 --- a/ext/tag_list/test.php +++ b/ext/tag_list/test.php @@ -1,5 +1,7 @@ get_page('tags/map'); $this->assert_title('Tag List'); @@ -14,7 +16,22 @@ class TagListTest extends ShimmieWebTestCase { $this->assert_title('Tag List'); # FIXME: test that these show the right stuff - # FIXME: test mincount + } + + function testMinCount() { + foreach($this->pages as $page) { + $this->get_page("tags/$page?mincount=999999"); + $this->assert_title("Tag List"); + + $this->get_page("tags/$page?mincount=1"); + $this->assert_title("Tag List"); + + $this->get_page("tags/$page?mincount=0"); + $this->assert_title("Tag List"); + + $this->get_page("tags/$page?mincount=-1"); + $this->assert_title("Tag List"); + } } } ?>