sub _show_results ($) {
my $obj = shift;
my $html;
for (split /\|/, $obj->{'p_data'}->{'POLL_ANSWERS'}) {
my ($split, $votes) = split "~=~";
my ($id, $answer) = split /\~\:\:\~/,$split;
my $percentage = $votes == 0 ? 0 : $votes / $obj->{'p_data'}->{'TOTAL_VOTES'} * 100;
$percentage = sprintf '%.2f', $percentage;
my $width = $percentage > 0 ? (split/\./,$percentage)[0] * 2 : 0;
# PEGGY CHANGE
#$html .= PollView::Render_row_results($votes,$id,$answer,$percentage,$width);
$html .= _put_in_thumbnails(PollView::Render_row_results($votes,$id,$answer,$percentage,$width));
}
return $html;
}
sub _show_form ($) {
my $obj = shift;
my $html;
for (split /\|/, $obj->{'p_data'}->{'POLL_ANSWERS'}) {
my ($split, $votes) = split "~=~";
my ($id, $answer) = split /\~\:\:\~/,$split;
#PEGGY CHANGE
#$html .= PollView::Render_row_form($votes,$id,$answer);
$html .= _put_in_thumbnails(PollView::Render_row_form($votes,$id,$answer));
}
$obj->{'.vote_state'} = qq[ ];
return $html;
}
# PEGGY CHANGE - whole new subroutine!
sub _put_in_thumbnails {
my ($html) = @_;
# make images work in polls
if ($iB::INFO->{'ALLOW_IMAGES'}) {
while ($html =~ s{\[img\](.+?)\[\/img\]}
{
my $url = $1;
qq#
#;
}eisgx) {}
}
# make links work in polls
while ($html =~ s{\[url=(\S+?)\](.*?)\[\/url\]}
{
my $url = $1;
my $link = $2;
qq#$link#;
}eisgx) {}
return $html;
}