Update of /cvs/scoop/scoop/lib/Scoop/Comments
In directory lithium.sabren.com:/tmp/cvs-serv10201/lib/Scoop/Comments
Modified Files:
Rate.pm
Log Message:
Bug 194, radio button rating option.
Worked first try! and radio button rating in dynamic mode is just plain cool.
-janra
Index: Rate.pm
===================================================================
RCS file: /cvs/scoop/scoop/lib/Scoop/Comments/Rate.pm,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** Rate.pm 21 Jan 2005 14:14:30 -0000 1.30
--- Rate.pm 5 Apr 2006 05:37:13 -0000 1.31
***************
*** 76,79 ****
--- 76,80 ----
return '' unless ($S->have_perm('comment_rate'));
+ my $rate_type = $S->get_comment_option('rating_type');
my $op = $S->{CGI}->param('op');
my $dynamic = ($op eq 'dynamic');
***************
*** 113,139 ****
my ($i, $select, $label);
! if (defined $sub_min) {
! $select = ($rating == $sub_min) ? ' SELECTED' : '';
! $label = shift @labels || $sub_min;
! $form .= qq|
! <OPTION VALUE="$sub_min"$select>$label|;
! } else {
! shift @labels;
! }
! for ($i = $min; $i <= $max; $i++) {
! $select = ($rating == $i) ? ' SELECTED' : '';
! $label = shift @labels || $i;
! $form .= qq|
! <OPTION VALUE="$i"$select>$label|;
! }
! $form .= qq|
! </SELECT>$form_submit
! </SMALL>|;
!
return $form;
}
--- 114,172 ----
my ($i, $select, $label);
! if ($rate_type ne 'radio') {
! $form = qq|
! <SMALL>
! <SELECT NAME="rating_$cid" SIZE=1$form_onchange>
! <OPTION VALUE="none">none|;
!
!
! if (defined $sub_min) {
! $select = ($rating == $sub_min) ? ' SELECTED' : '';
! $label = shift @labels || $sub_min;
! $form .= qq|
! <OPTION VALUE="$sub_min"$select>$label|;
! } else {
! shift @labels;
! }
! for ($i = $min; $i <= $max; $i++) {
! $select = ($rating == $i) ? ' SELECTED' : '';
! $label = shift @labels || $i;
! $form .= qq|
! <OPTION VALUE="$i"$select>$label|;
! }
! $form .= qq|
! </SELECT>$form_submit
! </SMALL>|;
! } else {
! $form = qq|
! <SMALL>|;
!
! if (defined $sub_min) {
! $select = ($rating == $sub_min) ? ' CHECKED' : '';
! $label = shift @labels || $sub_min;
!
! $form .= qq|
! <LABEL><INPUT TYPE="radio" NAME="rating_$cid" VALUE="$sub_min"$select$form_onchange>$label</LABEL>|;
! } else {
! shift @labels;
! }
!
! for ($i = $min; $i <= $max; $i++) {
! $select = ($rating == $i) ? ' CHECKED' : '';
!
! $label = shift @labels || $i;
!
! $form .= qq|
! <LABEL><INPUT TYPE="radio" NAME="rating_$cid" VALUE="$i"$select$form_onchange>$label</LABEL>|;
! }
!
! $form .= qq|\n$form_submit</SMALL>|;
! }
!
return $form;
}