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
Two Boxes: "comment_controls" and "show_comment_raters" Boxes
By rusty , Section Code []
Posted on Tue Dec 19, 2000 at 12:00:00 PM PST
Two boxes for ya, one brand new, the other updated. The first is the one that actually lets people see who rated each comment what. The second is an update to comment_controls which lets it work properly from op=comments pages as well as op=displaystory.

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 };
< Enhancements to Review Hidden Comments page | Permanent Discussion Boards >

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

Login
Make a new account
Username:
Password:

Related Links
· More on Boxes
· Also by rusty

Story Views
  16 Scoop users have viewed this story.

Display: Sort:
Two Boxes: "comment_controls" and "show_comment_raters" | 5 comments (5 topical, 0 hidden)
Nice (none / 0) (#1)
by KarenHeinz on Thu Jan 05, 2017 at 01:28:17 AM PST

Thank you for providing this long coding part here. I will definitely make use of this programming code in my project. Thank you for helping me. Get professional essays through cheap essay writing service.



Payday Loans (none / 0) (#2)
by Pervez on Sun Apr 22, 2018 at 05:49:48 AM PST

Excellent blog! I simply at this time mostly desire to exercise the majority of people It's my job to mostly analyze a niche site. These days comply with which usually Payday Loans I simply at this time still see the country's very beneficial additionally in fact primary.



This blog post (none / 0) (#3)
by dungmourice on Mon Dec 03, 2018 at 06:53:46 AM PST

This blog post has some interesting graphic design resume tips that you can use in the future projects. Make sure to take a closer look at it



best construction company NYC (none / 0) (#4)
by Pervez on Sat Apr 13, 2019 at 12:47:07 PM PST

Remarkable skills! Time consuming gone I stumbled upon very much good skills right into your internet site many your blog information. The number of options regarding any articles or reviews or possibly feedback! Already go along with right best construction company NYC Regards when indicating.



instalasi pengolahan air limbah biotech (none / 0) (#5)
by hans2000 on Sun Oct 04, 2020 at 07:07:14 AM PST

http://septictankbiomaster.com/2020/09/28/septic-tank-biotech/
http://septictankbiomaster.com/2020/09/23/cara-pemasangan-atau-instalasi-septic-tank-biomaster-biote ch/
https://septictankbiotech.com/pengolahan-limbah-domestik-modern-dan-ramah-lingkungan.html
http://septictankbiofil.com/septic-tank-biofil-asli.html
http://www.septictankbiotechsistem.com/2016/01/video-cara-kerja-septic-tank-biotech.html



Two Boxes: "comment_controls" and "show_comment_raters" | 5 comments (5 topical, 0 hidden)
Display: Sort:

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