Board Index Showcase Poll Addon Mod for Polls v2 Mod 0.9 "Showcase's" a poll selected by the Admin to be displayed on the Board Index page. Showcase a poll by clicking "Showcase Poll?" in lower right hand corner of existing polls. Remove the current "Showcase Poll" by clicking "Remove Showcase Poll?" in lower right hand corner of the currently showcased poll on the Board Index page. Current "Showcase Poll's" are designated in the thread display page of the poll which is the current "Showcase Poll" with "Currently Being Showcased" in the lower right hand corner of the poll(visible to all users). Only the Admin can "Showcase" or remove a "Showcase" poll, similiar to other forum features that are restricted to Admin decisions. However, all Admin/Global Moderator functions that are normally accessible to polls remain accessible in the "Showcase Poll" ("lock/unlock", "modify" and for Admins, "view voters"). Link to the thread of which the poll is associated is provided under the "Submit" button. If a poll that is currently being "Showcased", is in a thread that resides in a Category for which the guest or member does not have access to, then the "Showcase" poll will not be displayed to that user on the Board Index page. THIS MOD REQUIRES POLLS V2Final By Shoeb Omar (Omario) Version 0.9 - First Release Files modified: english.lng YaBB.pl Sources/Display Sources/BoardIndex.pl Sources/Poll.pl Credit obviously goes to Shoeb Omar (Omario) and Sam Holman (Samm) for Polls Mod v2 (Thanks Guys!) Big Thank You goes to all the mod writers that I have learned from, especially BHRA! DummyProof http://cgi.tripod.com/yabbsp1_1/cgi-bin/YaBB.pl YaBB.pl elsif ($action eq 'showvoters') { require "$sourcedir/Poll.pl"; &votedetails; } elsif ($action eq 'scpoll') { require "$sourcedir/Poll.pl"; &showcasepoll; } elsif ($action eq 'scpolldel') { require "$sourcedir/Poll.pl"; &delshowcasepoll; } Sources/BoardIndex.pl ~; } ########showcase poll start # Look for a showcase.poll file. if (-e "$datadir/showcase.poll") { my $board = ''; my $viewnum = ''; fopen (FILE, "$datadir/showcase.poll"); @showdata = ; fclose (FILE); $showcasepoll = $showdata[0]; $showcasepoll =~ s~\n~~g; ($board, $viewnum) = split(/\|/, $showcasepoll); # Look for a valid poll file. if (-e "$datadir/$viewnum.poll") { $pollthread = 1; unless( &BoardAccessGet($board) ) { $pollthread = 0; } } if ($pollthread) { fopen (FILE, "$datadir/$viewnum.poll"); @polldata = ; fclose (FILE); $pollquestion = $polldata[0]; $pollquestion =~ s~\n~~g; ($question, $lockstatus) = split(/\|/, $pollquestion); $num = 1; $line = 0; my @options; my @votes; foreach $pointer (@polldata) { ($vote, $option) = split(/\|/, $polldata[$num]); $options[$line] = $option; $votes[$line] = $vote; $line++; $num++; } $search = -1; my $found; $usersemail = $settings[2]; $userstatus = $settings[7]; $found = &CheckVoted($viewnum); if ($found) { $userhasvoted = 1; } $viewresults = $INFO{'viewresults'}; if ($lockstatus eq "Locked") { $pollislocked = 1; } my $boardpoll = ''; if ($userstatus eq "Administrator" ) { $boardpoll = qq~$scpolltxt{'2'} ~; } if ($username ne "Guest" && ($username eq $susername) || ($userstatus eq "Administrator" or $userstatus eq "Global Moderator" or exists $moderators{$username})) { $modifypoll = qq~$img{'modifypoll'} ~; } if (($userstatus eq "Administrator" || $userstatus eq "Global Moderator" || exists $moderators{$username}) && ($pollislocked ne 1)) { $lockpoll = qq~$img{'polliconclosed'} $polltxt{'20'} ~; } if (($userstatus eq "Administrator" || $userstatus eq "Global Moderator" || exists $moderators{$username}) && ($pollislocked eq 1)) { $lockpoll = qq~$img{'polliconclosed'} $polltxt{'21'} ~; } if ($userstatus eq "Administrator"){ $displayvoters = qq~$img{'viewvoters'}~;} $vresults = qq~$polltxt{'19'}~; $vthread = qq~$scpolltxt{'1'}~; if ($pollislocked eq 1) { $endedtext = $polltxt{'22'}; } $poll_icon = qq~$img{'pollicon'}~; if ($pollislocked == 1) { $poll_icon = qq~$img{'polliconclosed'}~; } $yymain.= qq~
 $poll_icon $polltxt{'15'} $endedtext $lockpoll   $displayvoters   $modifypoll
~; # Censor the question. foreach (@censored) { ($tmpa,$tmpb) = @{$_}; $question =~ s~\Q$tmpa\E~$tmpb~gi; } if (($userhasvoted) || $viewresults eq 'yes' || $pollislocked eq 1 ) { $yymain.= qq~
$polltxt{'16'}: $question

~; $nums = 0; my $Key; my $Total; $maxvote = 0; foreach $Key (@votes) { $Total += $Key; if ($Key >= $maxvote) { $maxvote = $Key;} } $totalvotes = $Total; pop (@options); foreach (@options) { # Censor the options. foreach (@censored) { ($tmpa,$tmpb) = @{$_}; $options[$nums] =~ s~\Q$tmpa\E~$tmpb~gi; } $message = $options[$nums]; # put the message back into the proper variable to do ubbc on it if(!$yyYaBBCloaded) { require "$sourcedir/YaBBC.pl"; } &MakeSmileys; $options[$nums] = $message; $options[$nums] =~ s~\n~~g; $options[$nums] =~ s~
~~g; $yymain .= qq~ ~; $nums++; } $yymain .= qq~
$options[$nums] ~; # Now lets calculate how many devisions by the total number of votes are needed to make the bar graphs stay nicely sized in the browser window: $pollpercent = 0; $pollbar = 0; if ($totalvotes ne 0 && $maxvote ne 0) { $pollpercent = int(1000 * $votes[$nums] / $totalvotes); $pollpercent = $pollpercent / 10; $pollbar = int( 150 * $votes[$nums] / $maxvote); } $yymain .= qq~   $votes[$nums] ($pollpercent%)

$polltxt{'17'}: $totalvotes
  $vthread $boardpoll
~; } else { $yymain.= qq~
$polltxt{'16'}: $question
~; $nums = 0; pop (@options); foreach (@options) { # Censor the options. foreach (@censored) { ($tmpa,$tmpb) = @{$_}; $options[$nums] =~ s~\Q$tmpa\E~$tmpb~gi; } $options[$nums] =~ s~\n~~g; $options[$nums] =~ s~
~~g; $message = $options[$nums]; # put the message back into the proper variable to do ubbc on it if(!$yyYaBBCloaded) { require "$sourcedir/YaBBC.pl"; } &MakeSmileys; $options[$nums] = $message; $yymain .= qq~ ~; $nums++; } $yymain .= qq~
  $options[$nums]

$vresults
  $vthread $boardpoll
~; } $yymain .= qq~
~; } } #########showcase poll end
Sources/Display.pl if ($lockstatus eq "Locked") { $pollislocked = 1; } ########showcase poll # Look for a showcase.poll file. if (-e "$datadir/showcase.poll") { fopen (FILE, "$datadir/showcase.poll"); @showdata = ; fclose (FILE); $showcasepoll = $showdata[0]; $showcasepoll =~ s~\n~~g; ($scboard, $scviewnum) = split(/\|/, $showcasepoll); } my $boardpoll = ''; if ($scviewnum == $viewnum) { $boardpoll = qq~$scpolltxt{'3'} ~; } if ($userstatus eq "Administrator" && ($scviewnum != $viewnum)) { $boardpoll = qq~$scpolltxt{'4'} ~; } ########showcase poll $yymain.= qq~ $yymain.= qq~
$polltxt{'16'}: $question

$polltxt{'16'}: $question

~; # Now lets calculate how many devisions by the total number of votes are needed to make the bar graphs stay nicely sized in the browser window: ~; # Now lets calculate how many devisions by the total number of votes are needed to make the bar graphs stay nicely sized in the browser window:
$polltxt{'17'}: $totalvotes
  $vthread $boardpoll
$polltxt{'16'}: $question
~;
$polltxt{'16'}: $question
~; ~; ~;
$options[$nums]
  $options[$nums]

$vresults

$vresults
$boardpoll
Sources/Poll.pl 1; sub showcasepoll{ my $brdid = $FORM{'brd'}; my $thrdid = $FORM{'num'}; fopen (FILE, ">$datadir/showcase.poll"); print FILE "$brdid|$thrdid\n"; fclose (FILE); $yySetLocation = qq~$cgi;action=display;num=$thrdid;start=0~; &redirectexit; exit; } sub delshowcasepoll{ if (-e "$datadir/showcase.poll") { unlink("$datadir/showcase.poll"); } $yySetLocation = qq~$scripturl~; &redirectexit; exit; } english.lng $polltxt{'42'} = "Poll Details"; $scpolltxt{'1'} = "View Thread"; $scpolltxt{'2'} = "Remove Showcase Poll?"; $scpolltxt{'3'} = "Currently Being Showcased"; $scpolltxt{'4'} = "Showcase Poll?"; $img{'createpoll'} = qq~$polltxt{'1'}~; $img{'pollicon'} = qq~$polltxt{'15'}~; $img{'polliconclosed'} = qq~~; $img{'modifypoll'} = qq~$polltxt{'39'} $polltxt{'39'}~; $img{'viewvoters'} = qq~$polltxt{'33'} $polltxt{'33'}~; $img{'pollicon'} = qq~$polltxt{'24'}~; $img{'polliconclosed'} = qq~$polltxt{'23'}~; $img{'pollicon'} = qq~$polltxt{'15'}~; $img{'polliconclosed'} = qq~~; $img{'modifypoll'} = qq~$polltxt{'39'} $polltxt{'39'}~; $img{'viewvoters'} = qq~$polltxt{'33'} $polltxt{'33'}~;