Tatsuki SUGIURA
sugi****@users*****
2006年 7月 12日 (水) 21:22:14 JST
Index: slashjp/plugins/PollBooth/ResKey.pm diff -u /dev/null slashjp/plugins/PollBooth/ResKey.pm:1.2 --- /dev/null Wed Jul 12 21:22:14 2006 +++ slashjp/plugins/PollBooth/ResKey.pm Wed Jul 12 21:22:14 2006 @@ -0,0 +1,48 @@ +# This code is a part of Slash, and is released under the GPL. +# Copyright 1997-2005 by Open Source Technology Group. See README +# and COPYING for more information, or see http://slashcode.com/. +# $Id: ResKey.pm,v 1.2 2006/07/12 12:22:14 sugi Exp $ + +package Slash::PollBooth::ResKey; + +use warnings; +use strict; + +use Slash::Utility; +use Slash::Constants ':reskey'; + +use base 'Slash::ResKey::Key'; + +our($VERSION) = ' $Revision: 1.2 $ ' =~ /\$Revision:\s+([^\s]+)/; + +sub doCheck { + my($self) = @_; + + my $slashdb = getCurrentDB(); + my $constants = getCurrentStatic(); + my $user = getCurrentUser(); + + if ($user->{is_anon} && !$constants->{allow_anon_poll_voting}) { + return(RESKEY_DEATH, ['anon', {}, 'pollBooth']); + } + + my $qid = $self->opts->{qid}; + + return(RESKEY_DEATH, ['no qid', {}, 'pollBooth']) unless $qid; + + my $pollvoter_md5 = getPollVoterHash(); + my $qid_quoted = $slashdb->sqlQuote($qid); + + # Yes, qid/id/uid is a key in pollvoters. + my($voters) = $slashdb->sqlSelect('id', 'pollvoters', + "qid=$qid_quoted AND id='$pollvoter_md5' AND uid=$user->{uid}" + ); + + if ($voters) { + return(RESKEY_DEATH, ['already voted', {}, 'pollBooth']); + } + + return RESKEY_SUCCESS; +} + +1; Index: slashjp/plugins/PollBooth/polls.css diff -u /dev/null slashjp/plugins/PollBooth/polls.css:1.2 --- /dev/null Wed Jul 12 21:22:14 2006 +++ slashjp/plugins/PollBooth/polls.css Wed Jul 12 21:22:14 2006 @@ -0,0 +1,47 @@ +.bar +{ + font-weight: bold; + margin: 0 0 1em 0; + border: 1px #ddd solid; + font-size: 80%; +} + +.barAnswer +{ + font-size: 120%; + text-align: left; + margin: .5em 0 0 0; +} + +.barColor +{ + background: #aaa; + border: 1px #ddd solid; + border-bottom: 1px #555 solid; + border-right: 1px #555 solid; +} + +.barPercent +{ + padding: 0 .3em; + background: #eee; + color: #555; +} + +.barVotes +{ + padding: 0 .3em; + background: #eee; + color: #555; + white-space: nowrap; +} + +.totalVotes { float: right; } +#polls-wide li { margin: 0 0 1em 0; } +.note ul +{ + font-size: 80%; + font-family: arial, sans-serif; +} +#pollBooth .generalbody table {width: 80%; margin: 0 0 1em 10%} +#pollBooth .generalbody caption {margin-left: 10%}