From b00b7d6de5f3597d5a6644485ee33c410cb24b3a Mon Sep 17 00:00:00 2001 From: Thomas Hochstein Date: Mon, 16 Aug 2010 23:14:40 +0200 Subject: [PATCH] From upstream: missing fixes. * UVrules.pm, usevote.rul: add H, h. * messages.cfg: add COUNT_ERR_GROUPCOUNT. * uvvote.pl: TMP/DIR, $msgid. Signed-off-by: Thomas Hochstein --- UVrules.pm | 36 +++++++++++++++++++++++++----------- messages.cfg | 1 + usevote.rul | 2 ++ uvvote.pl | 10 +++++----- 4 files changed, 33 insertions(+), 16 deletions(-) diff --git a/UVrules.pm b/UVrules.pm index 4325867..76e260f 100644 --- a/UVrules.pm +++ b/UVrules.pm @@ -149,10 +149,10 @@ sub read_rulefile { die $errortext . ": $_\n\n" if ($errortext); # check for correct characters in conditions - if ($if !~ /^[JjNnEeSsIi\.]+$/) { + if ($if !~ /^[JjNnEeSsHhIi\.]+$/) { die UVmessage::get ("RULES_INVCHARS", (NUM=>$num+1, TYPE=>"if")) . ": $if\n\n"; - } elsif ($then !~ /^[JjNnEeSsIi\.]+$/) { + } elsif ($then !~ /^[JjNnEeSsHhIi\.]+$/) { die UVmessage::get ("RULES_INVCHARS", (NUM=>$num+1, TYPE=>"if")) . ": $then\n\n"; } @@ -194,8 +194,9 @@ sub read_rulefile { sub make_regex_pos { my $pat = $_[0]; - $pat =~ s/[jens]/./g; + $pat =~ s/[hijens]/./g; $pat =~ s/S/[JN]/g; + $pat =~ s/H/[EJ]/g; $pat =~ s/I/[EN]/g; return $pat; @@ -216,22 +217,19 @@ sub make_regex_neg { # upper case characters are replaced with dots # (are covered by make_regex_pos) - $pat =~ s/[JENS]/./g; + $pat =~ s/[HIJENS]/./g; # reverse lower case characters $pat =~ s/j/[NE]/g; $pat =~ s/n/[JE]/g; $pat =~ s/e/[JN]/g; $pat =~ s/s/E/g; + $pat =~ s/h/N/g; $pat =~ s/i/J/g; - # to be translated: - # Falls keine Kleinbuchstaben vorkamen (es sind nur Punkte uebrig): - # Wenn keine optionalen Forderungen vorhanden sind, wuerde der Regex - # immer matchen und somit die Stimme immer als nicht passend erkannt - # werden. Deswegen wird versucht auf den leeren String zu ueberpruefen, - # was durch die Negation dazu fuehrt, dass die Stimme als passend - # gewertet wird. + # If the string contained only upper case characters they are now all + # replaced with dots and the RegEx would match everything, i.e. declare + # every vote as invalid. In this case an empty pattern is returned. $pat =~ s/^\.+$//; return $pat; @@ -305,6 +303,10 @@ sub rule_print { $fill = " $and "; $text1 = UVmessage::get ("RULES_IFCLAUSE", (VOTE=>"$yes $or $no", GROUP=>$groups[$i])); + } elsif ($rule[$i] eq 'H') { + $fill = " $and "; + $text1 = UVmessage::get ("RULES_IFCLAUSE", + (VOTE=>"$abst $or $yes", GROUP=>$groups[$i])); } elsif ($rule[$i] eq 'I') { $fill = " $and "; $text1 = UVmessage::get ("RULES_IFCLAUSE", @@ -322,6 +324,10 @@ sub rule_print { $fill = " $or "; $text1 = UVmessage::get ("RULES_IFCLAUSE", (VOTE=>"$yes $or $no", GROUP=>$groups[$i])); + } elsif ($rule[$i] eq 'h') { + $fill = " $or "; + $text1 = UVmessage::get ("RULES_IFCLAUSE", + (VOTE=>"$abst $or $yes", GROUP=>$groups[$i])); } elsif ($rule[$i] eq 'i') { $fill = " $or "; $text1 = UVmessage::get ("RULES_IFCLAUSE", @@ -357,6 +363,10 @@ sub rule_print { $fill = " $and "; $text1 = UVmessage::get ("RULES_THENCLAUSE", (VOTE=>"$yes $or $no", GROUP=>$groups[$i])); + } elsif ($rule[$i] eq 'H') { + $fill = " $and "; + $text1 = UVmessage::get ("RULES_THENCLAUSE", + (VOTE=>"$abst $or $yes", GROUP=>$groups[$i])); } elsif ($rule[$i] eq 'I') { $fill = " $and "; $text1 = UVmessage::get ("RULES_THENCLAUSE", @@ -374,6 +384,10 @@ sub rule_print { $fill = " $or "; $text1 = UVmessage::get ("RULES_THENCLAUSE", (VOTE=>"$yes $or $no", GROUP=>$groups[$i])); + } elsif ($rule[$i] eq 'h') { + $fill = " $or "; + $text1 = UVmessage::get ("RULES_THENCLAUSE", + (VOTE=>"$abst $or $yes", GROUP=>$groups[$i])); } elsif ($rule[$i] eq 'i') { $fill = " $or "; $text1 = UVmessage::get ("RULES_THENCLAUSE", diff --git a/messages.cfg b/messages.cfg index 1ea665e..6b1dd5d 100644 --- a/messages.cfg +++ b/messages.cfg @@ -154,6 +154,7 @@ CFV_SUBJECT = Wahlschein # COUNT_ERR_OPEN = Kann Ergebnisdatei ${FILE} nicht oeffnen! COUNT_ERR_RESULT = Fehler in ${FILE} Zeile ${LINE} +COUNT_ERR_GROUPCOUNT = Bei Stimme von <${ADDR}>: ${NUM1} statt ${NUM2} Stimmen gefunden (${RESULTFILE} kontrollieren!) COUNT_DELETED = ${NUM} Stimme(n) geloescht. # # uvvote.pl diff --git a/usevote.rul b/usevote.rul index e8f4501..4d9a6c6 100644 --- a/usevote.rul +++ b/usevote.rul @@ -30,12 +30,14 @@ # N eine NEIN-Stimme # E eine Enthaltung # S eine JA- oder NEIN-Stimme +# H eine Enthaltung oder JA-Stimme # I eine Enthaltung oder NEIN-Stimme # . egal (Ja, nein oder Enthaltung) # j eine oder mehrere der markierten Gruppen hat JA-Stimme # n "" "" "" "" "" "" "" NEIN-Stimme # e "" "" "" "" "" "" "" Enthaltung # s "" "" "" "" "" "" "" Ja- oder Nein-Stimme +# h "" "" "" "" "" "" "" Enthaltung oder Ja-Stimme # i "" "" "" "" "" "" "" Enthaltung oder Nein-Stimme # # Alles klar? Jede Stimme wird mit den Symbolen verglichen, und wenn alle diff --git a/uvvote.pl b/uvvote.pl index 5dd26ff..a86ef43 100644 --- a/uvvote.pl +++ b/uvvote.pl @@ -1,8 +1,8 @@ #!/usr/bin/perl -w ############################################################################### -# UseVoteGer 4.07 Wahldurchfuehrung -# (c) 2001-2004 Marc Langer +# UseVoteGer 4.09 Wahldurchfuehrung +# (c) 2001-2005 Marc Langer # # This script package is free software; you can redistribute it and/or # modify it under the terms of the GNU Public License as published by the @@ -37,7 +37,7 @@ use UVtemplate; my $clean = 0; my %opt_ctl = (); -print "\n$usevote_version Wahldurchfuehrung - (c) 2001-2004 Marc Langer\n\n"; +print "\n$usevote_version Wahldurchfuehrung - (c) 2001-2005 Marc Langer\n\n"; # unknown parameters remain in @ARGV (for "help") Getopt::Long::Configure(qw(pass_through bundling)); @@ -123,7 +123,7 @@ if ($clean) { my $ext = time; opendir (TMP, $config{tmpdir}); - my @tmpfiles = readdir (TMP); + my @tmpfiles = readdir (DIR); closedir (TMP); opendir (FERTIG, $config{archivedir}); my @fertigfiles = readdir (FERTIG); @@ -216,7 +216,7 @@ sub process_vote { my @header = split(/\n/, $entity->stringify_header); my $head = $entity->head; my $msgid = $head->get('Message-ID'); - chomp($msgid) if defined($msgid); + chomp($msgid) if ($msgid); my @votes = (); # the votes my @set; # interactively changed fields -- 2.20.1