Flexible Squares Quickreply

Sep 18, 2005 23:24

Having had a bit of a look through the comm, I don't think I've seen code for quickreply appear yet - and I imagine someone else might've been somewhat keen on finding out how to get it. After a bit of a look through the public and system layers and a bit of testing, this code should give you quickreply boxes for replies to comments. Top-level comments will still go to the reply page.

For the convenience of people who already use their own function to print comments, the edited lines are written in blue. The red text is an optional classname, so that you can style your reply box as desired. The black text is just snipped out of the Flexible Squares source.

function EntryPage::print_comment (Comment comment) {

var string subject = $comment.subject ? $comment.subject : $*text_nosubject;
var string date = $comment.time->date_format();
var string poster = isnull $comment.poster ? $*text_poster_anonymous : $comment.poster->as_string();

#Comment Userpic
if (defined $comment.userpic and $*show_entry_userpic)
{
var int w = $comment.userpic.width;
var int h = $comment.userpic.height;
var string alt = $comment.metadata{"picture_keyword"};
if ($*comment_userpic_style == "small")
{
$w = $w / 2;
$h = $h / 2;
}
if ($alt != "")
{
$alt = ": " + $alt;
}
"""


""";
print """$poster on """;
print $comment.time->date_format("long") + " - " + $comment.time->time_format();
}
else
{
print """

$poster on """;
print $comment.time->date_format("long") + " - " + $comment.time->time_format();
}
if (defined $comment.subject_icon or $comment.subject != "")
{
print "
$comment.subject_icon $comment.subject" + "
";
}
if ($comment.metadata{"poster_ip"})
{
print "
" + $*text_comment_ipaddr + "(" + $comment.metadata{"poster_ip"} + ")" + "
";
}
"";

print """

$comment.text\n""";
var string alignlinks = "";
if ($*userpic_position == "left")
{
$alignlinks = "right";
}
else
{
$alignlinks = "left";
}
"
";
if ($comment.frozen)
{
"($*text_comment_frozen)";
}
else
{
"("; $comment->print_reply_link({"linktext" => $*text_comment_reply}); ")";
}

if ($comment.parent_url != "")
{
"( $*text_comment_parent) ";
}

if ($comment.thread_url != "")
{
"""( $*text_comment_thread) """;
}

"( $*text_permalink)";

"""
""";
if ($this.multiform_on)
{
"""$*text_multiform_check""";
$comment->print_multiform_check();
}
$comment->print_linkbar();

""; $comment->print_reply_container({"class" => "quickreply_box"}); "\n";
}
HTML-wise, the automatically generated quickreply form is a table wrapped up in a div; the div is the element that gets whatever class you pick, so write selectors with that in mind. As far as styles go, I'm personally using:

div.quickreply_box table
{border-spacing: 5px;}which is the equivalent of setting the table to cellspacing="5", and keeps everything nice and neat.

comments

Previous post Next post
Up