[Back to main] [Printable version] [Leave a comment]

js-pref-voter [Leave a comment]

A preferential ballot filling UI in Javascript and PHP.
Copyright (C) 2004, 2005 by Jarno Elonen <elonen@iki.fi>

Upd. 2005-03-30: cleaned up the code, made it a class and added a very useful function: Expand_Parties().

This is a preferential ballot filling user interface, mainly useful for Condorset methods, written in Javascript and server-side PHP. It was originally developed for the LFW project and is unfortunately not very well documented. The filler is designed for large elections -- for smaller ones, say, max. 5 candidates, it is definitely an overkill.

Warnings:

  • Programming portable UIs with Javascript is difficult and this one is no exception. It may not work on all browsers! Moreover, I myself am no Javascript expert. If you make any portability fixes, I'd gladly receive some patches.
  • The Print_Ballot_Filler_Table() produces a large chunk of HTML when there are a lot of candidates (this page, for example, is over 70KB). However, it has a lot of repetion, so if you can, compress the resulting page before sending it to the user. PHP and Apache both contain gzip functionality for this purpose.

License:

'js-pref-voter' - Preferential ballot filler UI in Javascript and accompanying PHP functions

Copyright (c) 2004,2005 Jarno Elonen <elonen@iki.fi>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Demonstration:

X \/  
X \/ /\
X \/ /\
X \/ /\
X \/ /\
X \/ /\
X \/ /\
X \/ /\
X \/ /\
X \/ /\
X \/ /\
X \/ /\
X \/ /\
X \/ /\
X \/ /\
X   /\

Want to restart? Clear the form.

Comments on page '/code/js-pref-voter'

Name:
Email (opt):
Message (no HTML support):
Comment type: Public Private (for page author only)
Spam check: + 2 = 8
Email is optional, not visible to other users, and only used for possible replies.
Please note that the comments are not guaranteed to stay on-line. Trivial questions may be removed after answering them. Corrective and additional notes are sometimes integrated into the main article. Thanks and critisicm are welcome, but are pruned away from time to time. Offensive, abusive, distasteful or aggressive messages are of course removed without a second thougt. Messages sometimes disappear for technical reasons and sometimes just because the administrator felt like removing them.