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: mod_stats 1.00

Author: Scoop Developers

Description:

This is the box that displays the statistics of who voted what for each story.

Box Code:

my $sid = $ARGS[0];
$sid = $S->{CGI}->param('sid') unless $sid;
return unless $sid;

my $q_sid = $S->{DBH}->quote($sid);

my ($rv, $t_sth) = $S->db_select({
WHAT => 'displaystatus',
FROM => 'stories',
WHERE => qq{sid = $q_sid}});

my $disp = $t_sth->fetchrow();

return unless ($disp == '-2');

my ($stat, $trash) = $S->_mod_or_show($sid);
return '' unless ($stat eq 'show');

my ($totalvotes, $score) = $S->_get_total_votes($sid);
my $sth = $S->_get_story_mods($sid);

my $head = $S->{UI}->{BLOCKS}->{moderate_head};

$head =~ s/%%votes%%/$totalvotes/g;
$head =~ s/%%score%%/$score/g;

my ($this_row, $user);

my $for = qq{<FORM NAME="mod_stat_show" ACTION="%%rootdir%%/" METHOD="get">
<INPUT TYPE="hidden" NAME="op" VALUE="user">
<INPUT TYPE="hidden" NAME="tool" VALUE="info">};
my $against = qq{<FORM NAME="mod_stat_show" ACTION="%%rootdir%%/" METHOD="get">
<INPUT TYPE="hidden" NAME="op" VALUE="user">
<INPUT TYPE="hidden" NAME="tool" VALUE="info">};
my $neutral = qq{<FORM NAME="mod_stat_show" ACTION="%%rootdir%%/" METHOD="get">
<INPUT TYPE="hidden" NAME="op" VALUE="user">
<INPUT TYPE="hidden" NAME="tool" VALUE="info">};
#'
my $f = 0;
my $a = 0;
my $n = 0;

$for .= qq{<small>
<SELECT NAME="uid" SIZE=1>
<OPTION VALUE="">Voted for: (%%for%%)};
$against .= qq{<small>
<SELECT NAME="uid" SIZE=1>
<OPTION VALUE="">Voted against: (%%against%%)};
$neutral .= qq{<small>
<SELECT NAME="uid" SIZE=1>
<OPTION VALUE="">Didn't care: (%%neutral%%)};

while (my $mod_rec = $sth->fetchrow_hashref) {
my $nick = $S->get_nick($mod_rec->{uid});
$nick =~ s/^(.{0,20})/$1/;
my $link = qq{
<OPTION VALUE="$mod_rec->{uid}">$nick};
if ($mod_rec->{vote} == 1) {
$for .= qq|
$link|;
$f++;
} elsif ($mod_rec->{vote} == 0) {
$neutral .= qq|
$link|;
$n++;
} elsif ($mod_rec->{vote} == -1) {
$against .= qq|
$link|;
$a++;
}
}
$sth->finish;

$for .= qq{</SELECT> <INPUT TYPE="submit" NAME="get" VALUE="Get User Info"></small></FORM>};
$against .= qq{</SELECT> <INPUT TYPE="submit" NAME="get" VALUE="Get User Info"></small></FORM>};
$neutral .= qq{</SELECT> <INPUT TYPE="submit" NAME="get" VALUE="Get User Info"></small></FORM>};

$for =~ s/%%for%%/$f/;
$against =~ s/%%against%%/$a/;
$neutral =~ s/%%neutral%%/$n/;

my $content = $head.'%%smallfont%%'.$for.$against.$neutral.'%%smallfont_end%%';

return { content => $content };
Display: Sort:
Micro (none / 0) (#1)
by MichaelHoward on Tue Apr 10, 2018 at 10:04:39 AM PST

Excellent! only Microsoft can do this as their every software is just suitable and user-friendly like this one too. Thanks to the developer of Microsoft Azure for offering the essay writing service uk reviews amazing structures.



gcu student portal login (none / 0) (#2)
by hinofevav on Wed Apr 18, 2018 at 12:48:35 PM PST

New users or new students can found gcu student portal login difficult and for such people, we have provided the complete login procedure in detail. Check the further information in the below section.



great (none / 0) (#3)
by heenacruzl on Sat Dec 14, 2019 at 01:43:49 AM PST

I think I have the same opinion as you. This is probably a coincidence. return man 3



Menu
create account
faq
search
report bugs
Scoop Administrators Guide
Scoop Box Exchange

Scoop Site Scroller: Get one yourself!
Kuro5hin.org
Cooler than Adequacy.org

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