Box: show_comment_raters
Title: Others have rated this comment as follows:
Content:
my $content = qq{
<table width="100%" border=0 cellpadding=2 cellspacing=0>};
my $cid = $S->{CGI}->param('cid');
my $sid = $S->{CGI}->param('sid');
my $f_cid = $S->{DBH}->quote($cid);
my $f_sid = $S->{DBH}->quote($sid);
#Check for hidden
my ($rv, $sth) = $S->db_select({
WHAT => 'points',
FROM => 'comments',
WHERE => qq{sid = $f_sid AND cid = $f_cid}});
my $points = $sth->fetchrow();
$sth->finish();
if (($points < $S->{UI}->{VARS}->{rating_min}) && ($S->{TRUSTLEV} != 2)) {
return '';
}
my ($rv, $sth) = $S->db_select({
WHAT => 'uid, rating',
FROM => 'commentratings',
WHERE => qq{sid = $f_sid AND cid = $f_cid}});
my $zeros = 0;
while (my $rating = $sth->fetchrow_hashref()) {
my $user = $S->user_data($rating->{uid});
if (($rating->{'rating'} < $S->{UI}->{VARS}->{rating_min}) && ($S->{TRUSTLEV} != 2)) {
$zeros++;
} else {
$content .= qq{
<tr>
<td>
|norm_font|
<A HREF="|rootdir|/?op=user;tool=info;uid=$rating->{uid}">$user->{nickname}</A>
|norm_font_end|
</td>
<td>
|norm_font|
$rating->{rating}|norm_font_end|
</td>
</tr>};
}
}
$sth->finish();
if ($zeros) {
my $word = ($zeros == 1) ? "Rating" : "Ratings";
$content .= qq{
<tr>
<td colspan=2>|norm_font|Zero $word: $zeros|norm_font_end|</td>
</tr>};
}
$content .= qq{
</table>};
return {'content' => $content};
-----------------------------------------------------------------
Box: comment_controls
Title: None
Content:
my $op = $S->{CGI}->param('op');
return '' unless ($op eq 'displaystory' \|\| $op eq 'comments');
my $sid = $S->{CGI}->param('sid');
my $pid = $S->{CGI}->param('pid');
my $cid = $S->{CGI}->param('cid');
my $form_extra;
my $anchor = qq{#$cid};
if ($cid) {
$form_extra = qq{
<INPUT TYPE="hidden" NAME="cid" VALUE="$cid">};
} elsif ($pid) {
$form_extra = qq{
<INPUT TYPE="hidden" NAME="pid" VALUE="$pid">};
}
my $commentmode_select = $S->_comment_mode_select();
my $comment_order_select = $S->_comment_order_select();
my $comment_rating_select = $S->_comment_rating_select();
my $rating_choice = $S->_comment_rating_choice();
my $comment_type_select = $S->_comment_type_select();
my $form_op = 'op';
my $form_op_value = $op;
my $id = 'sid';
if ($S->_does_poll_exist($sid)) {
$form_op = 'op';
$form_op_value = 'view_poll';
$id = 'qid';
}
my $comment_sort = qq\|
<FORM NAME="commentmode" ACTION="|rootdir|/$anchor" METHOD="post">
<INPUT TYPE="hidden" NAME="$form_op" VALUE="$form_op_value">
<INPUT TYPE="hidden" NAME="$id" VALUE="$sid">
$form_extra
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 BGCOLOR="|box_content_bg|" align="center">
<TR>
<TD VALIGN="middle">
|smallfont|View:
<SMALL>
$comment_type_select
</SMALL>
Display:
<SMALL>
$commentmode_select
</SMALL>
Sort:
<SMALL>
$comment_rating_select
</SMALL>
<SMALL>
$comment_order_select
</SMALL>
\|;
if ($S->have_perm( 'comment_rate' )) {
$comment_sort .= qq\|
Rate?
<SMALL>$rating_choice</SMALL>\|;
}
$comment_sort .= qq\|
<INPUT TYPE="submit" NAME="setcomments" VALUE="Set">
|smallfont_end|
</TD></TR>
</TABLE>
</FORM>\|;
$template =~ s/CELLSPACING=0>/CELLSPACING=0 ALIGN="center">/;
return { content => $comment_sort, template => $template };