3 ###############################################################################
4 # UseVoteGer 4.09 Wahlscheingenerierung
5 # (c) 2001-2005 Marc Langer <uv@marclanger.de>
7 # This script package is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Public License as published by the
9 # Free Software Foundation.
11 # Use this script to create the ballot which can be inserted into the CfV.
12 # Not for personal ballots (personal=1 in usevote.cfg), use uvcfv.pl instead.
15 # - Ron Dippold (Usevote 3.0, 1993/94)
16 # - Frederik Ramm (German translation, 1994)
17 # - Wolfgang Behrens (UseVoteGer 3.1, based on Frederik's translation, 1998/99)
18 # - Cornell Binder for some good advice and code fragments
20 # This is a complete rewrite of UseVoteGer 3.1 in Perl (former versions were
21 # written in C). Not all functions of Usevote/UseVoteGer 3.x are implemented!
22 ###############################################################################
26 use Text::Wrap qw(wrap $columns);
34 print STDERR "\n$usevote_version Wahlscheingenerierung - (c) 2001-2005 Marc Langer\n\n";
36 # unknown parameters remain in @ARGV (for "help")
37 Getopt::Long::Configure(qw(pass_through bundling));
39 # Put known parameters in %opt_ctl
40 GetOptions(\%opt_ctl, qw(t|template c|config-file=s));
42 # Additional parameters or invalid options? Show help and exit.
45 # Get name auf config file (default: usevote.cfg) and read it
46 my $cfgfile = $opt_ctl{c} || "usevote.cfg";
47 UVconfig::read_config($cfgfile);
49 # Set columns for Text::Wrap
50 $columns = $config{rightmargin};
52 if ($config{personal}) {
53 print_ballot_personal();
61 ##############################################################################
62 # Print out a proper ballot #
63 ##############################################################################
67 my $template = UVtemplate->new();
69 $template->setKey('votename' => $config{votename});
70 $template->setKey('nametext' => $config{nametext});
71 $template->setKey('bdsg' => $config{bdsg});
72 $template->setKey('bdsgtext' => $config{bdsgtext});
73 $template->setKey('bdsginfo' => $config{bdsginfo});
75 for (my $n=0; $n<@groups; $n++) {
76 $template->addListItem('groups', pos=>$n+1, group=>$groups[$n]);
79 print $template->processTemplate($config{'tpl_ballot'});
84 ##############################################################################
85 # Generate a ballot request (if personalized ballots are activated) #
86 ##############################################################################
88 sub print_ballot_personal {
89 my $template = UVtemplate->new();
90 $template->setKey('mailaddress' => $config{mailfrom});
91 print $template->processTemplate($config{'tpl_ballot_request'});
95 ##############################################################################
96 # Print help text (options and syntax) on -h or --help #
97 ##############################################################################
101 Usage: uvballot.pl [-c config_file]
104 Generiert den Wahlschein fuer den CfV. Bei personalisierten Wahlscheinen
105 (personal = 1 in usevote.cfg) wird nur ein Dummy-Abschnitt mit Hinweisen
106 zur Wahlscheinanforderung ausgegeben.
108 -c config_file liest die Konfiguration aus config_file
109 (usevote.cfg falls nicht angegeben)
111 -h, --help zeigt diesen Hilfetext an