diff --git a/themes/futaba/comment.theme.php b/themes/futaba/comment.theme.php new file mode 100644 index 00000000..7497fd85 --- /dev/null +++ b/themes/futaba/comment.theme.php @@ -0,0 +1,100 @@ +get_string('title'); + $page->set_title($page_title); + $page->set_heading($page_title); + $page->add_block(new Block(null, $this->build_upload_box(), "main", 0)); + $page->add_block(new Block(null, "
", "main", 2)); + $this->display_paginator($page, "comment/list", null, $page_number, $total_pages, 5); + $page->add_block(new Block(null, "
", "main", 80)); + $this->display_paginator($page, "comment/list", null, $page_number, $total_pages, 90); + } + + private function build_upload_box() { + return "upload"; + } + + /* + * Add a block with thumbnail and comments, as part of the comment + * list page + */ + public function add_comment_list($page, $image, $comments, $position, $with_postbox) { + $h_filename = html_escape($image->filename); + $h_filesize = to_shorthand_int($image->filesize); + $w = $image->width; + $h = $image->height; + + $html = "
"; + $html .= "File: id}")."\">$h_filename - ($h_filesize, {$w}x{$h}) - "; + $html .= html_escape($image->get_tag_list()); + $html .= "
"; + $html .= "
" . $this->build_thumb_html($image) . "
"; + $html .= "
" . $this->comments_to_html($comments) . "
"; + $html .= "
"; + if($with_postbox) { + $html .= "
".($this->build_postbox($image->id))."
"; + } + else { + $html .= "

 

"; + } + + $page->add_block(new Block(null, $html, "main", $position)); + } + + protected function comments_to_html($comments, $trim=false) { + $html = ""; + foreach($comments as $comment) { + $html .= $this->comment_to_html($comment, $trim); + } + return $html; + } + + protected function comment_to_html($comment, $trim=false) { + global $user; + + $tfe = new TextFormattingEvent($comment->comment); + send_event($tfe); + + $i_uid = int_escape($comment->owner_id); + $h_name = html_escape($comment->owner_name); + $h_poster_ip = html_escape($comment->poster_ip); + $h_comment = ($trim ? substr($tfe->stripped, 0, 50)."..." : $tfe->formatted); + $i_comment_id = int_escape($comment->comment_id); + $i_image_id = int_escape($comment->image_id); + + $h_userlink = "$h_name"; + $h_date = $comment->posted; + $h_dellink = $user->is_admin() ? + " ($h_poster_ip, stripped."');\" ". + "href='".make_link("comment/delete/$i_comment_id/$i_image_id")."'>Del)" : ""; + $h_imagelink = $trim ? ">>>\n" : ""; + return "
>>". + "
$h_userlink$h_dellink $h_date No.$i_comment_id [Reply]

$h_comment

" . + "
"; + } + + protected function build_postbox($image_id) { + $i_image_id = int_escape($image_id); + return " +
+ + +
+
+ "; + } +} +?> diff --git a/themes/futaba/layout.class.php b/themes/futaba/layout.class.php index a8d7c2b3..bd4d61ae 100644 --- a/themes/futaba/layout.class.php +++ b/themes/futaba/layout.class.php @@ -57,7 +57,6 @@ $header_html

{$page->heading}

$subheading -
$main_block_html