diff --git a/themes/danbooru/comment.theme.php b/themes/danbooru/comment.theme.php index 74ba0ba5..0fcbd0a3 100644 --- a/themes/danbooru/comment.theme.php +++ b/themes/danbooru/comment.theme.php @@ -15,7 +15,6 @@ class CommentListTheme extends Themelet { $page->set_title("Comments"); $page->set_heading("Comments"); - $page->add_block(new Block("Navigation", $nav, "left")); $this->display_paginator($page, "comment/list", null, $page_number, $total_pages); $page->disable_left(); } @@ -103,7 +102,7 @@ class CommentListTheme extends Themelet { $html .= ""; $html .= "
Full List\n";
+ $page->add_block(new Block("Popular Tags", $html, "left", 60));
+ }
+
+ /*
+ * $tag_infos = array(
+ * array('tag' => $tag),
+ * ...
+ * )
+ * $search = the current array of tags being searched for
+ */
+ public function display_refine_block($page, $tag_infos, $search) {
+ global $config;
+
+ $html = "";
+ $n = 0;
+ foreach($tag_infos as $row) {
+ $tag = $row['tag'];
+ $h_tag = html_escape($tag);
+ $h_tag_no_underscores = str_replace("_", " ", $h_tag);
+ if($n++) $html .= "\n
";
+ if(!is_null($config->get_string('info_link'))) {
+ $link = str_replace('$tag', $tag, $config->get_string('info_link'));
+ $html .= " ?";
+ }
+ $link = $this->tag_link($row['tag']);
+ $html .= " $h_tag_no_underscores";
+ $html .= $this->ars($tag, $search);
+ }
+
+ $page->add_block(new Block("Refine Search", $html, "left", 60));
+ }
+
+ private function ars($tag, $tags) {
+ $html = "";
+ $html .= " (";
+ $html .= $this->get_add_link($tags, $tag);
+ $html .= $this->get_remove_link($tags, $tag);
+ $html .= $this->get_subtract_link($tags, $tag);
+ $html .= ")";
+ return $html;
+ }
+
+ private function get_remove_link($tags, $tag) {
+ if(!in_array($tag, $tags) && !in_array("-$tag", $tags)) {
+ return "";
+ }
+ else {
+ $tags = array_remove($tags, $tag);
+ $tags = array_remove($tags, "-$tag");
+ return "R";
+ }
+ }
+
+ private function get_add_link($tags, $tag) {
+ if(in_array($tag, $tags)) {
+ return "";
+ }
+ else {
+ $tags = array_remove($tags, "-$tag");
+ $tags = array_add($tags, $tag);
+ return "A";
+ }
+ }
+
+ private function get_subtract_link($tags, $tag) {
+ if(in_array("-$tag", $tags)) {
+ return "";
+ }
+ else {
+ $tags = array_remove($tags, $tag);
+ $tags = array_add($tags, "-$tag");
+ return "S";
+ }
+ }
+
+ private function tag_link($tag) {
+ $u_tag = url_escape($tag);
+ return make_link("post/list/$u_tag/1");
+ }
+}
+?>
diff --git a/themes/danbooru/upload.theme.php b/themes/danbooru/upload.theme.php
index fbf0e366..2d18dff9 100644
--- a/themes/danbooru/upload.theme.php
+++ b/themes/danbooru/upload.theme.php
@@ -7,6 +7,8 @@ class UploadTheme extends Themelet {
}
public function display_page($page) {
+ $page->disable_left();
+
global $config;
$tl_enabled = ($config->get_string("transload_engine", "none") != "none");