Description:
This box is what displays the comment control bar. Without this bar users cannot
change the sort order of the comments on a story, or whether its threaded or not,
etc. They have to use the defaults you set in the Site Controls
Box Code:
my $op = $S->{CGI}->param('op');
my $tool = $S->{CGI}->param('tool');
return '' unless ($op eq 'displaystory' ||
$op eq 'comments' ||
$op eq 'view_poll' ||
$op eq 'poll_vote' );
return '' if( $op eq 'comments' && $tool eq 'post' );
my $sid = $S->{CGI}->param('sid');
my $pid = $S->{CGI}->param('pid');
my $cid = $S->{CGI}->param('cid');
my $qid = $S->{CGI}->param('qid');
return '' unless( $S->have_section_perm('norm_read_comments',$S->_get_story_section($sid)));
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 ( $qid ) {
$form_op = 'op';
$form_op_value = 'view_poll';
$id = 'qid';
$sid = $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 };
|