Scoop -- the swiss army chainsaw of content management
Front Page · Everything · News · Code · Help! · Wishlist · Project · Scoop Sites · Dev Notes · Latest CVS changes · Development Activities
Scoop Box Exchange - Show Box: show_comment_raters 1.00

Author: Scoop Developers

Description:

This box is designed to display on its own page, it will show all the people that rated a certain comment and what they rated it.

Box Code:

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%%/user/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};
Display: Sort:
Menu
· create account
· faq
· search
· report bugs
· Scoop Administrators Guide
· Scoop Box Exchange

Scoop Site Scroller: Get one yourself!
Satanosphere
/* You are not expected to understand this. */

Login
Make a new account
Username:
Password:

Hosted by ScoopHost.com Powered by Scoop
All trademarks and copyrights on this page are owned by their respective companies. Comments are owned by the Poster. The Rest © 1999 The Management

create account | faq | search