mirror of
https://github.com/pasky/brmelect.git
synced 2025-06-07 17:44:54 +02:00
Add support for election labels
This commit is contained in:
parent
d4e238a86f
commit
dbff2fe1b0
3 changed files with 15 additions and 7 deletions
11
README.md
11
README.md
|
@ -1,13 +1,18 @@
|
||||||
Initialization
|
Initialization
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
Decide on label of the election. We will refer to that as `$label`;
|
||||||
|
this label is to be passed as a parameter to `gen-ballot.pl` and
|
||||||
|
updated near the top of `web-ballot.pl`. The generated `votes.txt`
|
||||||
|
file contains this in its filename.
|
||||||
|
|
||||||
Copy `names-sample.txt` to `names.txt` or create your own `names.txt`.
|
Copy `names-sample.txt` to `names.txt` or create your own `names.txt`.
|
||||||
Clobber your `~/votes.txt` file.
|
Clobber your `~/votes $label.txt` file.
|
||||||
|
|
||||||
Generating Ballots
|
Generating Ballots
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
./gen-ballot.pl 15 <names.txt >tokens.txt
|
./gen-ballot.pl 15 "testovaci komise" <names.txt >tokens.txt
|
||||||
|
|
||||||
Web Ballot CGI Script
|
Web Ballot CGI Script
|
||||||
---------------------
|
---------------------
|
||||||
|
@ -25,4 +30,4 @@ Counting Votes
|
||||||
|
|
||||||
This script will show just the final vote for each token:
|
This script will show just the final vote for each token:
|
||||||
|
|
||||||
perl -nle 'chomp; @b = split/,/; $a{$b[0]} = [@b]; END { for (values %a) { print join(",", @$_); } }' ~/votes.txt
|
perl -nle 'chomp; @b = split/,/; $a{$b[0]} = [@b]; END { for (values %a) { print join(",", @$_); } }' ~/'votes testovaci komise'.txt
|
||||||
|
|
|
@ -20,7 +20,7 @@ our $fontface = 'Arial';
|
||||||
our $ffontface = 'Courier New';
|
our $ffontface = 'Courier New';
|
||||||
# large, normal, small
|
# large, normal, small
|
||||||
our @fontsize = (26, 11, 8);
|
our @fontsize = (26, 11, 8);
|
||||||
our @linespacing = (18, 13, 8);
|
our @linespacing = (18, 13, 3);
|
||||||
our $topmargin = 2;
|
our $topmargin = 2;
|
||||||
|
|
||||||
our $contact = 'brmelect: your votes are safe with us';
|
our $contact = 'brmelect: your votes are safe with us';
|
||||||
|
@ -33,7 +33,8 @@ use List::Util qw(min);
|
||||||
use List::MoreUtils qw(pairwise);
|
use List::MoreUtils qw(pairwise);
|
||||||
use Cairo;
|
use Cairo;
|
||||||
|
|
||||||
my $n_ballots = pop @ARGV;
|
my $n_ballots = shift @ARGV;
|
||||||
|
my $label = shift @ARGV;
|
||||||
my @names;
|
my @names;
|
||||||
while (<>) {
|
while (<>) {
|
||||||
chomp;
|
chomp;
|
||||||
|
@ -136,6 +137,7 @@ sub ballot {
|
||||||
my $tok = gen_token();
|
my $tok = gen_token();
|
||||||
print($tok."\n");
|
print($tok."\n");
|
||||||
ballot_text_centered($cr, \$ypos, $fontface, 'italic', 'normal', 2, $tok);
|
ballot_text_centered($cr, \$ypos, $fontface, 'italic', 'normal', 2, $tok);
|
||||||
|
ballot_text_centered($cr, \$ypos, $fontface, 'normal', 'bold', 2, $label);
|
||||||
ballot_text_centered($cr, \$ypos, $fontface, 'italic', 'normal', 2, $contact);
|
ballot_text_centered($cr, \$ypos, $fontface, 'italic', 'normal', 2, $contact);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,8 @@ use v5.10;
|
||||||
|
|
||||||
use CGI;
|
use CGI;
|
||||||
|
|
||||||
my $votefile = '/home/pasky/votes.txt';
|
my $label = 'testovaci komise';
|
||||||
|
my $votefile = "/home/pasky/votes $label.txt";
|
||||||
|
|
||||||
our @names;
|
our @names;
|
||||||
open my $fh, "names.txt" or die "$!";
|
open my $fh, "names.txt" or die "$!";
|
||||||
|
@ -39,7 +40,7 @@ print <<EOT;
|
||||||
td { border: 1pt solid; padding: 0.5ex 0.5em; }
|
td { border: 1pt solid; padding: 0.5ex 0.5em; }
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body><h1 align="center">brmelect Web Ballot</h1>
|
<body><h1 align="center">brmelect Web Ballot: $label</h1>
|
||||||
|
|
||||||
<div id="blurb">
|
<div id="blurb">
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue