From: Julien Moutinho Date: Sat, 15 Mar 2014 03:36:30 +0000 (+0100) Subject: Ajout : supporte id= comme expression rationnelle. X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/%40%20%27icone_supprimer_signature%27%20=%3E%20%27Delete%20this%20signature%27%2C%20%27icone_valider_signature%27%20=%3E%20%27Validate%20this%20signature%27%2C%20%27image_administrer_rubrique%27%20=%3E%20%27You%20can%20manage%20this%20section%27%2C-%27impossible_modifier_login_auteur%27%20=%3E%20%27Login%20cannot%20be%20changed.%27%2C-%27impossible_modifier_pass_auteur%27%20=%3E%20%27Password%20cannot%20be%20changed.%27%2C%20%27info_1_article%27%20=%3E%20%271%20article%27%2C-%27info_1_article_syndique%27%20=%3E%20%271%20syndicated%20article%27%2C%20%27info_1_auteur%27%20=%3E%20%271%20author%27%2C%20%27info_1_message%27%20=%3E%20%271%20message%27%2C%20%27info_1_mot_cle%27%20=%3E%20%271%20keyword%27%2C%20%27info_1_rubrique%27%20=%3E%20%271%20section%27%2C-%27info_1_site%27%20=%3E%20%271%20site%27%2C%20%27info_1_visiteur%27%20=%3E%20%271%20visitor%27%2C%20%27info_activer_cookie%27%20=%3E%20%27You%20can%20activate%20an%20%3Cb%3Eadministration%20cookie%3C/b%3E%2C%20which%20allows%20you%20%20to%20switch%20easily%20between%20the%20public%20site%20and%20the%20private%20area.%27%2C%20%27info_activer_menu_developpement%27%20=%3E%20%27Show%20the%20Development%20menu%27%2C%20%27info_admin_etre_webmestre%27%20=%3E%20%27Give%20me%20web%20administrator%20rights%27%2C-%27info_admin_gere_rubriques%27%20=%3E%20%27This%20administrator%20manages%20the%20following%20sections:%27%2C-%27info_admin_gere_toutes_rubriques%27%20=%3E%20%27This%20administrator%20manages%20%3Cb%3Eall%20the%20sections%3C/b%3E.%27%2C-%27info_admin_gere_toutes_rubriques_2%27%20=%3E%20%27I%20manage%20%3Cb%3Eall%20the%20sections%3C/b%3E%27%2C%20%27info_admin_je_suis_webmestre%27%20=%3E%20%27I%20am%20a%20%3Cb%3Ewebmaster%3C/b%3E%27%2C%20%27info_admin_statuer_webmestre%27%20=%3E%20%27Give%20webmaster%20rights%20to%20this%20administrator%20%27%2C%20%27info_admin_webmestre%27%20=%3E%20%27This%20administrator%20is%20%3Cb%3Ewebmaster%3C/%27.%20sinon%28find_in_path%28%27css/leaflet.markercluster.css%27%29%2Cfind_in_path%28%27lib/leaflet/plugins/leaflet.markercluster.css%27%29%29%20.%27?a=commitdiff_plain;h=7764e02283b706857fc3318af2b6d15c695de426;p=ikiwiki%2Fpoll.git Ajout : supporte id= comme expression rationnelle. --- diff --git a/poll.pm b/poll.pm index 3d50081..411f3bd 100644 --- a/poll.pm +++ b/poll.pm @@ -319,9 +319,13 @@ package IkiWiki::PageSpec; my ($page, $match, %params) = @_; my $polls = $IkiWiki::pagestate{$page}{poll}; if (defined $polls and %$polls) { - my ($match_poll, $match_user, $match_choice) = $match =~ m/^id=(.*?) user=(.*?) choice=(.*?)$/; - if (exists $polls->{$match_poll}) { - my %poll = %{$polls->{$match_poll}}; + my ($match_id, $match_user, $match_choice) = $match =~ m/^id=(.*?) user=(.*?) choice=(.*?)$/; + my $match_id_re = IkiWiki::glob2re($match_id?$match_id:'*'); + my @polls = grep {$_ =~ $match_id_re} (keys %$polls); + return IkiWiki::FailReason->new("no poll match id=`$match_id'", $page => $IkiWiki::DEPEND_CONTENT) + unless @polls > 0; + foreach my $poll (@polls) { + my %poll = %{$polls->{$poll}}; my $match_user_re = IkiWiki::glob2re($match_user?$match_user:'*'); my $match_choice_re = IkiWiki::glob2re($match_choice?$match_choice:'*'); while (my ($choice, $data) = each %poll) { @@ -341,11 +345,8 @@ package IkiWiki::PageSpec; } } } - return IkiWiki::FailReason->new("no user=`$match_user' has voted for choice=`$match_choice'", $page => $IkiWiki::DEPEND_CONTENT); - } - else { - return IkiWiki::FailReason->new("no poll id=`$match_poll'", $page => $IkiWiki::DEPEND_CONTENT); } + return IkiWiki::FailReason->new("no user=`$match_user' has voted for choice=`$match_choice'", $page => $IkiWiki::DEPEND_CONTENT); } else { return IkiWiki::FailReason->new("no poll", $page => $IkiWiki::DEPEND_CONTENT);