VotePlugin

Chair for Computer Aided Medical Procedures & Augmented Reality
Lehrstuhl für Informatikanwendungen in der Medizin & Augmented Reality

VotePlugin

This plugin might be used to establish an online-voting system. Votes are collected in a separate file ... basically inspired by the TWiki:Plugins/PollPlugin.

Example

If the plugin is installed, you can see what you get if you put the following in a topic:

%VOTE{id="FavoritMeal" select1="Drink" options1="Beer,Wine,Milk,Water" select2="Food" options2="Steak,Bread,Pasta,Pizza"}%

Drink   
Food   
Drink
Beer
leftbarmainbarrightbar60% (3)
Milk
leftbarmainbarrightbar40% (2)
Food
Steak
leftbarmainbarrightbar50% (2)
Pizza
leftbarmainbarrightbar25% (1)
Bread
leftbarmainbarrightbar25% (1)

foo   
foo
bar
leftbarmainbarrightbar50% (2)
baz
leftbarmainbarrightbar50% (2)

foo   
foo
bar 2
baz 2

foo   
foo
bar 2
baz 2

Syntax Rules

The %VOTE{ ... }% macro defines a poll using the following options:
name description example
id The identifier of a poll. This must be unique per topic. You can thus have multiple independent votes on the same topic page. FaroritMeal
style Possible values are a combination of bar, perc, total, sum, voters and list to specify the display style of the poll results (default bar,perc,total). bar
freq How often people can vote. Values: once, daily. Default once. daily
anon Record votes anonymously. Default on. off
select<n> As you can see in the above example multiple decisions can be made within the same poll. This identifier must be unique within a poll. You can have up to 5 selects per vote (sorry hardcoded;)) Drinks
options<n> Each select<n> corresponds to set of options that you must specify. Beer,Wine,Milk

select and option might use the pseudo variables $percnt, $dollar, $quote and $doublequote to render the respective characters in the vote output otherwise not allowed in an argument to a TWiki tag.

The %VOTE{ ... }% will generate the selection box(es) and the poll results. The plugin will count only your latest vote.

The voters style will show the people who voted for each value, and the list style will show a list of votes by users. Since that is pointless for anonymous votes, those styles are disabled if the votes are anonymous.

Warning: Anonymous voting just creates an obfuscation of the person who voted. Dedicated people could retrieve the voter list given the list of votes. Do not use this plugin for important polls.

Plugin Installation Instructions

  • Download the ZIP file
  • Unzip it in your twiki installation directory. Content:
    File: Description:
    bin/vote  
    data/TWiki/VotePlugin.txt  
    lib/TWiki/Plugins/VotePlugin/Core.pm  
    lib/TWiki/Plugins/VotePlugin.pm  
    pub/TWiki/VotePlugin/leftbar.gif  
    pub/TWiki/VotePlugin/mainbar.gif  
    pub/TWiki/VotePlugin/rightbar.gif  

  • (Dakar) Visit configure in your TWiki installation, and enable the plugin in the {Plugins} section.

Plugin Info

Plugin Author: TWiki:Main/MichaelDaum
Copyright ©: 2005-2006, Michael Daum
License: GPL (GNU General Public License)
Plugin Version: v1.32
Change History:  
31 Aug 2006: added NO_PREFS_IN_TOPIC
15 Aug 2006: added "use strict" and fixed revealing errors
27 Apr 2006: added lazy compilation
7 Dec 2005: added gif bar; removed debug flag
9 Oct 2005: fixed invocation of normalizeFileName
8 Oct 2005: added added a little more style flexibility
7 Oct 2005: storing votes into _Vote*.txt now (was Vote*.txt before) ; fixed error messaging on empty argument lists
14 Sep 2005: fixes for dakar
14 Apr 2005: incorporated getLocaldate() function
16 Mar 2005: use Cache API only if its there; delayed use <package>
7 Mar 2005: Initial version
TWiki Dependency: $TWiki::Plugins::VERSION 1.024
CPAN Dependencies: none
Other Dependencies: none
Perl Version: >=5.6.1
TWiki:Plugins/Benchmark: TWiki:TWiki/GoodStyle nn%, TWiki:TWiki/FormattedSearch nn%, VotePlugin nn%
Plugin Home: TWiki:Plugins/VotePlugin
Feedback: TWiki:Plugins/VotePluginDev
Appraisal: TWiki:Plugins/VotePluginAppraisal

-- TWiki:Main.MichaelDaum - 31 Aug 2006

I Attachment sort Action Size Date Who Comment
rightbar.gif manage 0.2 K 31 Aug 2006 - 14:30 UnknownUser?  
leftbar.gif manage 0.2 K 31 Aug 2006 - 14:30 UnknownUser?  
mainbar.gif manage 0.1 K 31 Aug 2006 - 14:30 UnknownUser?  

Edit | Attach | Refresh | Diffs | More | Revision r1.1 - 02 Feb 2007 - 06:57 - MartinBauer