hax~
git-svn-id: file:///home/shish/svn/shimmie2/trunk@843 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
2ab8e256eb
commit
4e3ecd9458
100
themes/futaba/comment.theme.php
Normal file
100
themes/futaba/comment.theme.php
Normal file
@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
class CustomCommentListTheme extends CommentListTheme {
|
||||
/*
|
||||
* Do the basics of the comments page
|
||||
*
|
||||
* $page_number = the current page number
|
||||
* $total_pages = the total number of comment pages
|
||||
*/
|
||||
public function display_page_start($page, $page_number, $total_pages) {
|
||||
$prev = $page_number - 1;
|
||||
$next = $page_number + 1;
|
||||
|
||||
global $config;
|
||||
$page_title = $config->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, "<hr>", "main", 2));
|
||||
$this->display_paginator($page, "comment/list", null, $page_number, $total_pages, 5);
|
||||
$page->add_block(new Block(null, "<hr>", "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 = "<hr height='1'>";
|
||||
$html .= "File: <a href=\"".make_link("post/view/{$image->id}")."\">$h_filename</a> - ($h_filesize, {$w}x{$h}) - ";
|
||||
$html .= html_escape($image->get_tag_list());
|
||||
$html .= "<div style='text-align: left'>";
|
||||
$html .= "<div style='float: left; margin-left: 16px; margin-right: 16px;'>" . $this->build_thumb_html($image) . "</div>";
|
||||
$html .= "<div class='commentset'>" . $this->comments_to_html($comments) . "</div>";
|
||||
$html .= "</div>";
|
||||
if($with_postbox) {
|
||||
$html .= "<div style='clear:both;'>".($this->build_postbox($image->id))."</div>";
|
||||
}
|
||||
else {
|
||||
$html .= "<div style='clear:both;'><p> </p></div>";
|
||||
}
|
||||
|
||||
$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 = "<a href='".make_link("user/$h_name")."'>$h_name</a>";
|
||||
$h_date = $comment->posted;
|
||||
$h_dellink = $user->is_admin() ?
|
||||
" ($h_poster_ip, <a ".
|
||||
"onclick=\"return confirm('Delete comment by $h_name:\\n".$tfe->stripped."');\" ".
|
||||
"href='".make_link("comment/delete/$i_comment_id/$i_image_id")."'>Del</a>)" : "";
|
||||
$h_imagelink = $trim ? "<a href='".make_link("post/view/$i_image_id")."'>>>></a>\n" : "";
|
||||
return "<table><tr><td nowrap class='doubledash'>>></td><td>".
|
||||
"<div class='comment'>$h_userlink$h_dellink $h_date No.$i_comment_id [Reply]<p>$h_comment</p></div>" .
|
||||
"</td></tr></table>";
|
||||
}
|
||||
|
||||
protected function build_postbox($image_id) {
|
||||
$i_image_id = int_escape($image_id);
|
||||
return "
|
||||
<form action='".make_link("comment/add")."' method='POST'>
|
||||
<input type='hidden' name='image_id' value='$i_image_id' />
|
||||
<textarea name='comment' rows='5' cols='50'></textarea>
|
||||
<br><input type='submit' value='Post' />
|
||||
</form>
|
||||
";
|
||||
}
|
||||
}
|
||||
?>
|
@ -57,7 +57,6 @@ $header_html
|
||||
<h1>{$page->heading}</h1>
|
||||
$subheading
|
||||
|
||||
<div id="nav">$left_block_html</div>
|
||||
<div id="body">$main_block_html</div>
|
||||
|
||||
<div id="footer">
|
||||
|
@ -4,49 +4,19 @@
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
BODY {
|
||||
background: #EEE;
|
||||
font-family: "Arial", sans-serif;
|
||||
font-size: 14px;
|
||||
}
|
||||
H1, H3 {
|
||||
border: 1px solid black;
|
||||
background: #DDD;
|
||||
text-align: center;
|
||||
font-family: arial,helvetica,sans-serif;
|
||||
font-size: 10pt;
|
||||
background: #FFFFEE;
|
||||
color: #800000;
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
margin-right: 0px;
|
||||
margin-left: 0px;
|
||||
margin-top: 5px;
|
||||
}
|
||||
H1 {
|
||||
margin-top: 0px;
|
||||
margin-bottom: 0px;
|
||||
padding: 2px;
|
||||
}
|
||||
H1 A {
|
||||
color: black;
|
||||
}
|
||||
H3 {
|
||||
margin-top: 32px;
|
||||
padding: 1px;
|
||||
}
|
||||
THEAD {
|
||||
background: #DEDEDE;
|
||||
font-weight: bold;
|
||||
}
|
||||
TD {
|
||||
vertical-align: top;
|
||||
text-align: center;
|
||||
}
|
||||
#subtitle {
|
||||
width: 256px;
|
||||
font-size: 0.75em;
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
border: 1px solid black;
|
||||
border-top: none;
|
||||
background: #DDD;
|
||||
}
|
||||
#body SELECT {width: 150px;}
|
||||
TD>INPUT[type="submit"] {width: 100%;}
|
||||
TD>INPUT[type="text"] {width: 100%;}
|
||||
TD>INPUT[type="password"] {width: 100%;}
|
||||
TD>SELECT {width: 100%;}
|
||||
|
||||
#footer {
|
||||
clear: both;
|
||||
@ -58,92 +28,34 @@ TD>SELECT {width: 100%;}
|
||||
*[onclick] {cursor: pointer;}
|
||||
IMG {border: none;}
|
||||
FORM {margin: 0px;}
|
||||
A {text-decoration: none;}
|
||||
A:hover {text-decoration: underline;}
|
||||
|
||||
BLOCKQUOTE {
|
||||
border: 1px solid black;
|
||||
padding: 8px;
|
||||
background: #DDD;
|
||||
}
|
||||
|
||||
UL {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* the navigation bar, and all its blocks *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#nav {
|
||||
width: 150px;
|
||||
float: left;
|
||||
text-align: center;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
#nav TABLE {
|
||||
width: 150px;
|
||||
}
|
||||
#nav TD {
|
||||
vertical-align: middle;
|
||||
}
|
||||
#nav INPUT {
|
||||
width: 100%;
|
||||
padding: 0px;
|
||||
}
|
||||
#nav SELECT {
|
||||
width: 100%;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
#comments P {
|
||||
text-align: left;
|
||||
width: 150px;
|
||||
max-width: 150px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.more:after {
|
||||
content: " >>>";
|
||||
}
|
||||
|
||||
.tag_count:before {
|
||||
content: "(";
|
||||
}
|
||||
.tag_count:after {
|
||||
content: ")";
|
||||
}
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* the main part of each page *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#body {
|
||||
margin-left: 160px;
|
||||
text-align: center;
|
||||
height: 1%;
|
||||
}
|
||||
#body TABLE {
|
||||
width: 90%;
|
||||
margin: auto;
|
||||
}
|
||||
A, A:visited {text-decoration: none; color: #0000EE;}
|
||||
A:hover {text-decoration: underline; color: #DD0000;}
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* specific page types *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#pagelist {
|
||||
margin-top: 32px;
|
||||
.doubledash {
|
||||
color: #D9BFB7;
|
||||
vertical-align: top;
|
||||
clear: both;
|
||||
float: left;
|
||||
}
|
||||
|
||||
#tagmap A {
|
||||
padding: 8px 4px 8px 4px;
|
||||
.commentset TABLE:first-child TR TD .comment {
|
||||
background: #FFFFEE;
|
||||
border-width: 0px;
|
||||
}
|
||||
|
||||
.comment {
|
||||
text-align: left;
|
||||
margin-bottom: 2px;
|
||||
font-size: 10pt;
|
||||
padding: 0px 5px;
|
||||
background: #F0E0D6;
|
||||
color: #800000;
|
||||
border: 1px solid #D9BFB7;
|
||||
border-left: none;
|
||||
border-top: none;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
.setupblock {
|
||||
@ -153,15 +65,6 @@ UL {
|
||||
width: 350px;
|
||||
}
|
||||
|
||||
.helpable {
|
||||
border-bottom: 1px dashed gray;
|
||||
.paginator {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.ok {
|
||||
background: #AFA;
|
||||
}
|
||||
.bad {
|
||||
background: #FAA;
|
||||
}
|
||||
|
||||
|
||||
|
@ -30,10 +30,10 @@ class Themelet {
|
||||
/**
|
||||
* Add a generic paginator
|
||||
*/
|
||||
public function display_paginator($page, $base, $query, $page_number, $total_pages) {
|
||||
public function display_paginator($page, $base, $query, $page_number, $total_pages, $position=90) {
|
||||
if($total_pages == 0) $total_pages = 1;
|
||||
$body = $this->build_paginator($page_number, $total_pages, $base, $query);
|
||||
$page->add_block(new Block(null, $body, "main", 90));
|
||||
$page->add_block(new Block(null, $body, "main", $position));
|
||||
}
|
||||
|
||||
private function gen_page_link($base_url, $query, $page, $name) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user