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
Scoop Box Exchange - Show Box: poll_box 1.00

Author: Scoop Developers

Description:

This box chooses which is the correct poll to display, and displays it. It will show the current poll if on the front page, the poll attached to a story if on a story page, or the poll that you're working on if on a story preview page. This code is rather complex and hard to maintain, I wouldn't suggest making changes to it unless you're either a masochist or you have a ton of spare time.

Box Code:

my $pollqid = shift @ARGS;
my $preview = 0;

my ($pollqid, $action) = $S->get_qid_to_show();
$preview = 1 if ($action eq 'preview');
return '' if ($pollqid == 0);

my $poll_hash = $S->get_poll_hash( $pollqid, $action );

# first get the poll form all set up except for the answers
my $poll_form = qq|
<!-- begin poll form -->
<FORM ACTION="%%rootdir%%/" METHOD="POST">
<INPUT TYPE="hidden" NAME="op" VALUE="view_poll">
<INPUT TYPE="hidden" NAME="qid" VALUE="$poll_hash->{'qid'}">
<INPUT type="hidden" name="ispoll" value="1">|;

$poll_form .= "<b>$poll_hash->{'question'}</b><br>";

# here is where all the answer fields get filled in
my $answer_array = $S->get_poll_answers($poll_hash->{'qid'}, $action);

# now check if they have already voted or haven't logged in
my $row;
if ( $S->_can_vote($poll_hash->{'qid'}) ) {
foreach $row ( @{$answer_array} ) {
$poll_form .= qq|
<INPUT TYPE="radio" NAME="aid" VALUE="$row->{'aid'}"> $row->{'answer'}<BR>|;
}
} else {
my $total_votes = $poll_hash->{'voters'};

if($total_votes == 0) {
$total_votes = 1; # so we don't get a divide by 0 error
}

$poll_form .= qq|
<TABLE BORDER=0 CELLPADDING=2 CELLSPACING=0>|;

foreach $row ( @{$answer_array} ) {
my $percent = int($row->{'votes'} / $total_votes * 100);
$poll_form .= qq|
<TR>
<TD valign="top">%%norm_font%%%%dot%%%%norm_font_end%%</TD>
<TD valign="top">%%norm_font%%$row->{'answer'}%%norm_font_end%%</TD>
<TD valign="top">%%norm_font%% $percent% %%norm_font_end%%</TD>
</TR>|;
}
$poll_form .= qq|
</TABLE>|;

}

# get the # of comments
my $comment_num = $S->poll_comment_num($poll_hash->{'qid'});

# only show the vote button if they havn't voted
if ( $S->_can_vote($poll_hash->{'qid'}) && ! $preview ) {
$poll_form .= qq|<BR><INPUT TYPE="submit" name="vote" VALUE="Vote">|;
}


# now finish up the form
my $op = $S->{CGI}->param('op');
my $comm_disp = ($op ne 'displaystory') ?
qq{
<TD>%%norm_font%%Votes: <b>$poll_hash->{'voters'}</b>%%norm_font_end%%</TD>
<TD ALIGN="center" WIDTH=15>%%norm_font%%|%%norm_font_end%%</TD>
<TD ALIGN="right">%%norm_font%% Comments: <b>$comment_num</b>%%norm_font_end%%</TD></TR>
} :
qq{
<TD COLSPAN="3" ALIGN="center">%%norm_font%%Votes: <b>$poll_hash->{'voters'}</b>%%norm_font_end%%</TD>
};

$poll_form .= qq{
</FORM>
<!-- end poll form -->
<P>
%%norm_font%%
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 ALIGN="center">
<TR>
$comm_disp
<TR> };

if( $preview ) {
$poll_form .= qq{
<TD>%%norm_font%%Results%%norm_font_end%%</TD>
<TD ALIGN="center" WIDTH=15>%%norm_font%%|%%norm_font_end%%</TD>
<TD ALIGN="right">%%norm_font%% Other Polls%%norm_font_end%%</TD></TR>
};

} else {
$poll_form .= qq{
<TD>%%norm_font%%<a href="%%rootdir%%/poll/$poll_hash->{'qid'}">Results</a>%%norm_font_end%%</TD>
<TD ALIGN="center" WIDTH=15>%%norm_font%%|%%norm_font_end%%</TD>
<TD ALIGN="right">%%norm_font%% <a href="%%rootdir%%/?op=search;type=polls;search=Search">Other Polls</a>%%norm_font_end%%</TD></TR>
};
}

$poll_form .= qq{
</TABLE>
%%norm_font_end%%
<!-- end poll content -->};

## don't forget to tell them its a poll preview if it is
if( $preview ) {
$title = "Poll Preview";
}

if ($poll_form) {
return {content => qq{%%norm_font%%$poll_form%%norm_font_end%%}, title => $title};
} else {
return '';
}
Display: Sort:
rtyrt (none / 0) (#1)
by jacketsy on Tue Jan 23, 2018 at 04:14:02 AM PST

If the car reform can not mcm backpack replica save the taxpayer, the reform will have little meaning. Bus idle waste in the news



  • aaa by barristersge, 07/23/2020 02:03:35 AM PST (none / 0)
  • aaa by barristersge, 07/28/2020 01:56:19 AM PST (none / 0)
  • aaa by barristersge, 08/01/2020 05:12:00 AM PST (none / 0)
jams (none / 0) (#2)
by regiyef on Sat Jul 18, 2020 at 11:30:06 AM PST

Thank you for taking the time to publish this information very useful! ecstasy test kit



  • aaa by barristersge, 07/26/2020 03:33:36 AM PST (none / 0)
  • aaa by barristersge, 08/17/2020 12:17:39 AM PST (none / 0)
  • aaa by barristersge, 08/17/2020 12:17:39 AM PST (none / 0)
  • aaa by barristersge, 08/17/2020 12:17:43 AM PST (none / 0)
jams (none / 0) (#3)
by regiyef on Sun Jul 19, 2020 at 01:05:43 AM PST

I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often. Amphetamine test kit



  • aaa by barristersge, 07/21/2020 10:13:28 PM PST (none / 0)
  • aaa by barristersge, 07/23/2020 10:02:43 PM PST (none / 0)
  • aaa by barristersge, 07/31/2020 12:54:17 AM PST (none / 0)
  • aaa by barristersge, 07/31/2020 12:54:17 AM PST (none / 0)
  • aaa by barristersge, 07/31/2020 12:54:20 AM PST (none / 0)
  • aaa by barristersge, 07/31/2020 10:06:43 AM PST (none / 0)
  • aaa by barristersge, 07/31/2020 10:06:43 AM PST (none / 0)
  • aaa by barristersge, 08/01/2020 09:06:48 PM PST (none / 0)
  • aaa by barristersge, 08/05/2020 09:16:01 PM PST (none / 0)
  • aaa by barristersge, 08/10/2020 07:49:09 AM PST (none / 0)
  • aaa by barristersge, 08/11/2020 12:43:32 PM PST (none / 0)
  • aaa by barristersge, 08/11/2020 12:43:41 PM PST (none / 0)
jams (none / 0) (#4)
by regiyef on Mon Jul 20, 2020 at 01:03:32 AM PST

I like this post,And I guess that they having fun to read this post,they shall take a good site to make a information,thanks for sharing it to me. kiếm tiền với Wefinex



AAA (none / 0) (#5)
by barristersge on Mon Jul 20, 2020 at 12:25:17 PM PST

Please share more like that. Delray Beach Personal Training



  • aaa by barristersge, 08/01/2020 09:46:49 AM PST (none / 0)
  • aaa by barristersge, 08/01/2020 09:46:50 AM PST (none / 0)
  • aaa by barristersge, 08/11/2020 01:28:30 AM PST (none / 0)
  • aaa by barristersge, 08/11/2020 01:28:30 AM PST (none / 0)
  • aaa by barristersge, 08/11/2020 06:04:03 AM PST (none / 0)
  • asds by ftyuoketyy, 01/19/2021 12:34:35 PM PST (none / 0)
AAA (none / 0) (#6)
by beri on Tue Jul 21, 2020 at 02:36:45 AM PST

I am very happy to discover your post as it will become on top in my collection of favorite blogs to visit. best fashion influencers



  • aaa by barristersge, 07/30/2020 09:05:31 PM PST (none / 0)
  • aaa by barristersge, 07/30/2020 09:05:31 PM PST (none / 0)
  • aaa by barristersge, 07/30/2020 09:05:46 PM PST (none / 0)
aaa (none / 0) (#7)
by barristersge on Tue Jul 21, 2020 at 05:44:44 AM PST

Great post. and great website. Thanks for the information! https://nstecnologie.us



AAA (none / 0) (#8)
by beri on Tue Jul 21, 2020 at 10:07:35 PM PST

i read a lot of stuff and i found that the way of writing to clearifing that exactly want to say was very good so i am impressed and ilike to come again in future.. Boca Raton Gym



aaa (none / 0) (#12)
by barristersge on Sun Jul 26, 2020 at 02:40:21 AM PST

I high appreciate this post. It's hard to find the good from the bad sometimes. but I think you've nailed it! would you mind updating your blog with more information? All Seasons Pest Control Kent WA



aaa (none / 0) (#34)
by barristersge on Fri Aug 14, 2020 at 11:53:13 AM PST

I have read your article. it is very informative and helpful for me.I admire the valuable information you offer in your articles. Thanks for posting it.. gépszállítás Gyöngyös rövid határidővel



jams (none / 0) (#35)
by regiyef on Sun Aug 16, 2020 at 10:42:01 AM PST

This is really a nice and informative, containing all information and also has a great impact on the new technology. Thanks for sharing it, logo designers



sadsd (none / 0) (#39)
by nacaj on Wed Sep 09, 2020 at 12:25:19 PM PST

I admire this article for the well-researched content and excellent wording. I got so involved in this material that I couldn't stop reading. I am impressed with your work and skill. Thank you so much. quầy kệ sięu thị



asdasd (none / 0) (#40)
by nacaj on Thu Oct 22, 2020 at 11:39:45 AM PST

Most of the time I don't make comments on websites, but I'd like to say that this article really forced me to do so. Really nice post! nội thất nogi



sadsa (none / 0) (#41)
by nacaj on Sun Nov 01, 2020 at 03:24:00 AM PST

Thank you a bunch for sharing this with all of us you actually realize what you are talking about! Bookmarked. Please also seek advice from my site =). We could have a hyperlink change contract between us! đi du lịch quy nhơn



asdas (none / 0) (#42)
by nacaj on Mon Nov 02, 2020 at 08:36:30 AM PST

Thanks for posting this info. I just want to let you know that I just check out your site and I find it very interesting and informative. I can't wait to read lots of your posts. fender-bender accident lawyer in connecticut



assada (none / 0) (#43)
by nacaj on Tue Nov 03, 2020 at 07:57:43 AM PST

Nice post! This is a very nice blog that I will definitively come back to more times this year! Thanks for informative post. lọ thủy tinh giá rẻ



asdsa (none / 0) (#44)
by nacaj on Sat Nov 07, 2020 at 01:55:37 PM PST

Interesting post. I Have Been wondering about this issue, so thanks for posting. Pretty cool post.It 's really very nice and Useful post.Thanks plus size dashiki



asdsa (none / 0) (#45)
by nacaj on Mon Nov 09, 2020 at 03:20:50 PM PST

I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business. derby leaflet printing



asdsad (none / 0) (#46)
by nacaj on Wed Nov 25, 2020 at 09:25:11 AM PST

This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value. Im glad to have found this post as its such an interesting one! I am always on the lookout for quality posts and articles so i suppose im lucky to have found this! I hope you will be adding more in the future... sofa cleaning Leeds



good (none / 0) (#47)
by AnaMattice on Tue Dec 01, 2020 at 12:59:30 PM PST

Considering the reviews they have been getting its no surprise. Its such a great service and at https://fr.altopdf.com/reviews and just seem to be pulling it off. Reviews are so positive and looks like I found my next one.



  • lovely by azharsk, 12/10/2020 07:30:04 AM PST (none / 0)
asdad (none / 0) (#50)
by nacaj on Tue Jan 26, 2021 at 07:42:03 AM PST

Great write-up, I am a big believer in commenting on blogs to inform the blog writers know that they've added something worthwhile to the world wide web!.. din-psykolog.dk/psykolog-randers



asad (none / 0) (#51)
by nacaj on Fri Jan 29, 2021 at 04:31:25 PM PST

I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business. Carl Robert Scholz



asdsa (none / 0) (#52)
by nacaj on Sat Jan 30, 2021 at 08:03:51 AM PST

Great write-up, I am a big believer in commenting on blogs to inform the blog writers know that they've added something worthwhile to the world wide web!.. uwin



asdas (none / 0) (#53)
by nacaj on Sat Feb 06, 2021 at 11:32:55 AM PST

This content is written very well. Your use of formatting when making your points makes your observations very clear and easy to understand. Thank you. Wedding Dresses



asdas (none / 0) (#54)
by nacaj on Sat Feb 06, 2021 at 11:54:28 AM PST

I was reading your article and wondered if you had considered creating an ebook on this subject. Your writing would sell it fast. You have a lot of writing talent. lyft



asdsd (none / 0) (#55)
by nacaj on Sun Feb 14, 2021 at 11:21:19 AM PST

I wanted to thank you for this excellent read!! I definitely loved every little bit of it. I have you bookmarked your site to check out the new stuff you post. Bronx orthodontist



aasd (none / 0) (#56)
by nacaj on Sun Feb 21, 2021 at 05:39:29 AM PST

I am happy to find this post Very useful for me, as it contains lot of information. I Always prefer to read The Quality and glad I found this thing in you post. Thanks beste markise



asd (none / 0) (#57)
by nacaj on Sun Feb 21, 2021 at 11:28:09 AM PST

You completed a few fine points there. I did a search on the subject and found nearly all persons will go along with with your blog. Aussie Tree Lopping Ballarat



asdd (none / 0) (#58)
by nacaj on Thu Feb 25, 2021 at 08:09:19 AM PST

Thank you for some other informative website. The place else may just I get that kind of information written in such a perfect method? I have a venture that I am simply now running on, and I've been at the glance out for such info. Milkshakes



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

Scoop Site Scroller: Get one yourself!
Scoop
The swiss army chainsaw of Content Managment.

Login
Make a new account
Username:
Password:

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