danbooru theme tweaks
git-svn-id: file:///home/shish/svn/shimmie2/trunk@414 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
ff5f41c91e
commit
e171fc98de
@ -15,7 +15,6 @@ class CommentListTheme extends Themelet {
|
|||||||
|
|
||||||
$page->set_title("Comments");
|
$page->set_title("Comments");
|
||||||
$page->set_heading("Comments");
|
$page->set_heading("Comments");
|
||||||
$page->add_block(new Block("Navigation", $nav, "left"));
|
|
||||||
$this->display_paginator($page, "comment/list", null, $page_number, $total_pages);
|
$this->display_paginator($page, "comment/list", null, $page_number, $total_pages);
|
||||||
$page->disable_left();
|
$page->disable_left();
|
||||||
}
|
}
|
||||||
@ -103,7 +102,7 @@ class CommentListTheme extends Themelet {
|
|||||||
$html .= "</div>";
|
$html .= "</div>";
|
||||||
$html .= "<div style='clear: both; display: block; height: 64px;'> </div>";
|
$html .= "<div style='clear: both; display: block; height: 64px;'> </div>";
|
||||||
|
|
||||||
$page->add_block(new Block(null, $html, "main", $position));
|
$page->add_block(new Block(" ", $html, "main", $position));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -59,15 +59,13 @@ class Layout {
|
|||||||
$left_block_html = "";
|
$left_block_html = "";
|
||||||
$main_block_html = "";
|
$main_block_html = "";
|
||||||
|
|
||||||
$firstmain = true;
|
|
||||||
foreach($page->blocks as $block) {
|
foreach($page->blocks as $block) {
|
||||||
switch($block->section) {
|
switch($block->section) {
|
||||||
case "left":
|
case "left":
|
||||||
$left_block_html .= $this->block_to_html($block, true);
|
$left_block_html .= $this->block_to_html($block, true);
|
||||||
break;
|
break;
|
||||||
case "main":
|
case "main":
|
||||||
if($firstmain) {
|
if($block->header == "Images") {
|
||||||
$firstmain = false;
|
|
||||||
$block->header = " ";
|
$block->header = " ";
|
||||||
}
|
}
|
||||||
$main_block_html .= $this->block_to_html($block, false);
|
$main_block_html .= $this->block_to_html($block, false);
|
||||||
@ -168,7 +166,7 @@ EOD;
|
|||||||
else {
|
else {
|
||||||
$i = str_replace(' ', '_', $h);
|
$i = str_replace(' ', '_', $h);
|
||||||
if(!is_null($h)) $html .= "\n<h3>$h</h3>\n";
|
if(!is_null($h)) $html .= "\n<h3>$h</h3>\n";
|
||||||
if(!is_null($b)) $html .= "<div>$b</div>\n";
|
if(!is_null($b)) $html .= "<div id='$i'>$b</div>\n";
|
||||||
}
|
}
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
167
themes/danbooru/tag_list.theme.php
Normal file
167
themes/danbooru/tag_list.theme.php
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class TagListTheme extends Themelet {
|
||||||
|
var $heading = "";
|
||||||
|
var $list = "";
|
||||||
|
|
||||||
|
public function set_heading($text) {
|
||||||
|
$this->heading = $text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function set_tag_list($list) {
|
||||||
|
$this->list = $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function set_navigation($nav) {
|
||||||
|
$this->navigation = $nav;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function display_page($page) {
|
||||||
|
$page->disable_left();
|
||||||
|
$page->set_title("Tag List");
|
||||||
|
$page->set_heading($this->heading);
|
||||||
|
$page->add_block(new Block("Navigation", str_replace("<br>", " ", $this->navigation), "main", 0));
|
||||||
|
$page->add_block(new Block(" ", $this->list));
|
||||||
|
}
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
|
||||||
|
/*
|
||||||
|
* $tag_infos = array(
|
||||||
|
* array('tag' => $tag, 'count' => $number_of_uses),
|
||||||
|
* ...
|
||||||
|
* )
|
||||||
|
*/
|
||||||
|
public function display_related_block($page, $tag_infos) {
|
||||||
|
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);
|
||||||
|
$count = $row['count'];
|
||||||
|
if($n++) $html .= "\n<br/>";
|
||||||
|
if(!is_null($config->get_string('info_link'))) {
|
||||||
|
$link = str_replace('$tag', $tag, $config->get_string('info_link'));
|
||||||
|
$html .= " <a class='tag_info_link' href='$link'>?</a>";
|
||||||
|
}
|
||||||
|
$link = $this->tag_link($row['tag']);
|
||||||
|
$html .= " <a class='tag_name' href='$link'>$h_tag_no_underscores</a>";
|
||||||
|
}
|
||||||
|
|
||||||
|
$page->add_block(new Block("Related", $html, "left"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* $tag_infos = array(
|
||||||
|
* array('tag' => $tag, 'count' => $number_of_uses),
|
||||||
|
* ...
|
||||||
|
* )
|
||||||
|
*/
|
||||||
|
public function display_popular_block($page, $tag_infos) {
|
||||||
|
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);
|
||||||
|
$count = $row['count'];
|
||||||
|
if($n++) $html .= "\n<br/>";
|
||||||
|
if(!is_null($config->get_string('info_link'))) {
|
||||||
|
$link = str_replace('$tag', $tag, $config->get_string('info_link'));
|
||||||
|
$html .= " <a class='tag_info_link' href='$link'>?</a>";
|
||||||
|
}
|
||||||
|
$link = $this->tag_link($row['tag']);
|
||||||
|
$html .= " <a class='tag_name' href='$link'>$h_tag_no_underscores</a>";
|
||||||
|
if($config->get_bool("tag_list_numbers")) {
|
||||||
|
$html .= " <span class='tag_count'>$count</span>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$html .= "<p><a class='more' href='".make_link("tags")."'>Full List</a>\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<br/>";
|
||||||
|
if(!is_null($config->get_string('info_link'))) {
|
||||||
|
$link = str_replace('$tag', $tag, $config->get_string('info_link'));
|
||||||
|
$html .= " <a class='tag_info_link' href='$link'>?</a>";
|
||||||
|
}
|
||||||
|
$link = $this->tag_link($row['tag']);
|
||||||
|
$html .= " <a class='tag_name' href='$link'>$h_tag_no_underscores</a>";
|
||||||
|
$html .= $this->ars($tag, $search);
|
||||||
|
}
|
||||||
|
|
||||||
|
$page->add_block(new Block("Refine Search", $html, "left", 60));
|
||||||
|
}
|
||||||
|
|
||||||
|
private function ars($tag, $tags) {
|
||||||
|
$html = "";
|
||||||
|
$html .= " <span class='ars'>(";
|
||||||
|
$html .= $this->get_add_link($tags, $tag);
|
||||||
|
$html .= $this->get_remove_link($tags, $tag);
|
||||||
|
$html .= $this->get_subtract_link($tags, $tag);
|
||||||
|
$html .= ")</span>";
|
||||||
|
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 "<a href='".$this->tag_link(join(' ', $tags))."' title='Remove' rel='nofollow'>R</a>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 href='".$this->tag_link(join(' ', $tags))."' title='Add' rel='nofollow'>A</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 "<a href='".$this->tag_link(join(' ', $tags))."' title='Subtract' rel='nofollow'>S</a>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function tag_link($tag) {
|
||||||
|
$u_tag = url_escape($tag);
|
||||||
|
return make_link("post/list/$u_tag/1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
@ -7,6 +7,8 @@ class UploadTheme extends Themelet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function display_page($page) {
|
public function display_page($page) {
|
||||||
|
$page->disable_left();
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
$tl_enabled = ($config->get_string("transload_engine", "none") != "none");
|
$tl_enabled = ($config->get_string("transload_engine", "none") != "none");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user