make build_thumb_html be part of the themelet class
git-svn-id: file:///home/shish/svn/shimmie2/trunk@570 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
13383a56fe
commit
1cacc2d247
10 changed files with 39 additions and 17 deletions
|
@ -112,16 +112,6 @@ function make_link($page=null, $query=null) {
|
|||
}
|
||||
}
|
||||
|
||||
function build_thumb_html($image, $query=null) {
|
||||
global $config;
|
||||
$h_view_link = make_link("post/view/{$image->id}", $query);
|
||||
$h_tip = html_escape($image->get_tooltip());
|
||||
$h_thumb_link = $image->get_thumb_link();
|
||||
$tsize = get_thumbnail_size($image->width, $image->height);
|
||||
return "<a href='$h_view_link'><img title='$h_tip' alt='$h_tip' ".
|
||||
"width='{$tsize[0]}' height='{$tsize[1]}' src='$h_thumb_link' /></a>";
|
||||
}
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
|
||||
* Misc *
|
||||
|
|
|
@ -56,7 +56,7 @@ class CommentListTheme extends Themelet {
|
|||
*/
|
||||
public function add_comment_list($page, $image, $comments, $position, $with_postbox) {
|
||||
$html = "<div style='text-align: left'>";
|
||||
$html .= "<div style='float: left; margin-right: 16px;'>" . build_thumb_html($image) . "</div>";
|
||||
$html .= "<div style='float: left; margin-right: 16px;'>" . $this->build_thumb_html($image) . "</div>";
|
||||
$html .= $this->comments_to_html($comments);
|
||||
$html .= "</div>";
|
||||
if($with_postbox) {
|
||||
|
|
|
@ -183,7 +183,7 @@ class ImageIO extends Extension {
|
|||
$existing = $database->get_image_by_hash($image->hash);
|
||||
if(!is_null($existing)) {
|
||||
$error = "Image <a href='".make_link("post/view/{$existing->id}")."'>{$existing->id}</a> ".
|
||||
"already has hash {$image->hash}:<p>".build_thumb_html($existing);
|
||||
"already has hash {$image->hash}:<p>".Themelet::build_thumb_html($existing);
|
||||
return $error;
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ class IndexTheme extends Themelet {
|
|||
for($j=0; $j<$width; $j++) {
|
||||
$image = isset($images[$i*$width+$j]) ? $images[$i*$width+$j] : null;
|
||||
if(!is_null($image)) {
|
||||
$table .= "\t<td>" . build_thumb_html($image, $query) . "</td>\n";
|
||||
$table .= "\t<td>" . $this->build_thumb_html($image, $query) . "</td>\n";
|
||||
}
|
||||
else {
|
||||
$table .= "\t<td> </td>\n";
|
||||
|
|
|
@ -27,7 +27,7 @@ class RegenThumbTheme extends Themelet {
|
|||
$page->set_heading("Thumbnail Regenerated");
|
||||
$page->add_header("<meta http-equiv=\"cache-control\" content=\"no-cache\">");
|
||||
$page->add_block(new NavBlock());
|
||||
$page->add_block(new Block("Thumbnail", build_thumb_html($image)));
|
||||
$page->add_block(new Block("Thumbnail", $this->build_thumb_html($image)));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -33,7 +33,7 @@ class RSS_Images extends Extension {
|
|||
$owner = $image->get_owner();
|
||||
$posted = strftime("%a, %d %b %Y %T %Z", $image->posted_timestamp);
|
||||
$content = html_escape(
|
||||
"<p>" . build_thumb_html($image) . "</p>" .
|
||||
"<p>" . Themelet::build_thumb_html($image) . "</p>" .
|
||||
"<p>Uploaded by " . $owner->name . "</p>"
|
||||
);
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ class CustomCommentListTheme extends CommentListTheme {
|
|||
$count = count($comments);
|
||||
|
||||
$html = "<div style='text-align: left'>";
|
||||
$html .= "<div style='float: left; margin-right: 16px;'>" . build_thumb_html($image) . "</div>";
|
||||
$html .= "<div style='float: left; margin-right: 16px;'>" . $this->build_thumb_html($image) . "</div>";
|
||||
$html .= "<div style='float: right; margin-left: 16px; width: 200px; margin-bottom: 32px;'>";
|
||||
foreach($image->get_tag_array() as $tag) {
|
||||
$u_tag = url_escape($tag);
|
||||
|
|
|
@ -51,7 +51,7 @@ class CustomIndexTheme extends IndexTheme {
|
|||
protected function build_table($images, $query) {
|
||||
$table = "";
|
||||
foreach($images as $image) {
|
||||
$table .= "\t<span class=\"thumb\">" . build_thumb_html($image, $query) . "</span>\n";
|
||||
$table .= "\t<span class=\"thumb\">" . $this->build_thumb_html($image, $query) . "</span>\n";
|
||||
}
|
||||
return $table;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,17 @@ class Themelet {
|
|||
}
|
||||
|
||||
|
||||
public function build_thumb_html($image, $query=null) {
|
||||
global $config;
|
||||
$h_view_link = make_link("post/view/{$image->id}", $query);
|
||||
$h_tip = html_escape($image->get_tooltip());
|
||||
$h_thumb_link = $image->get_thumb_link();
|
||||
$tsize = get_thumbnail_size($image->width, $image->height);
|
||||
return "<a href='$h_view_link'><img title='$h_tip' alt='$h_tip' ".
|
||||
"width='{$tsize[0]}' height='{$tsize[1]}' src='$h_thumb_link' /></a>";
|
||||
}
|
||||
|
||||
|
||||
public function display_paginator($page, $base, $query, $page_number, $total_pages) {
|
||||
if($total_pages == 0) $total_pages = 1;
|
||||
$body = $this->build_paginator($page_number, $total_pages, $base, $query);
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
<?php
|
||||
|
||||
class Themelet {
|
||||
/**
|
||||
* Generic error message display
|
||||
*/
|
||||
public function display_error($page, $title, $message) {
|
||||
$page->set_title($title);
|
||||
$page->set_heading($title);
|
||||
|
@ -9,6 +12,24 @@ class Themelet {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generic thumbnail code; returns HTML rather than adding
|
||||
* a block since thumbs tend to go inside blocks...
|
||||
*/
|
||||
public function build_thumb_html($image, $query=null) {
|
||||
global $config;
|
||||
$h_view_link = make_link("post/view/{$image->id}", $query);
|
||||
$h_tip = html_escape($image->get_tooltip());
|
||||
$h_thumb_link = $image->get_thumb_link();
|
||||
$tsize = get_thumbnail_size($image->width, $image->height);
|
||||
return "<a href='$h_view_link'><img title='$h_tip' alt='$h_tip' ".
|
||||
"width='{$tsize[0]}' height='{$tsize[1]}' src='$h_thumb_link' /></a>";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a generic paginator
|
||||
*/
|
||||
public function display_paginator($page, $base, $query, $page_number, $total_pages) {
|
||||
if($total_pages == 0) $total_pages = 1;
|
||||
$body = $this->build_paginator($page_number, $total_pages, $base, $query);
|
||||
|
|
Reference in a new issue