r3393 - in trunk/pollen-ui-struts2/src/main: java/org/chorem/pollen/ui/actions/poll resources/i18n resources/org/chorem/pollen/business/persistence
Author: tchemit Date: 2012-05-28 17:00:39 +0200 (Mon, 28 May 2012) New Revision: 3393 Url: http://chorem.org/repositories/revision/pollen/3393 Log: fixes #571: Can not vote with a Number vote type add a error message when no vote is filled Added: trunk/pollen-ui-struts2/src/main/resources/org/chorem/pollen/business/persistence/VoteToChoiceImpl-conversion.properties Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/VoteForPoll.java trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/VoteForPoll.java =================================================================== --- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/VoteForPoll.java 2012-05-28 13:42:01 UTC (rev 3392) +++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/VoteForPoll.java 2012-05-28 15:00:39 UTC (rev 3393) @@ -69,12 +69,15 @@ String name = pollAccount.getVotingId(); if (StringUtils.isBlank(name)) { - addFieldError("pollAccount.votingId", _("pollen.error.pollAccount.votingId.required")); + addFieldError("pollAccount.votingId", + _("pollen.error.pollAccount.votingId.required")); } // check if the new pollAccount (topiaId = null) has already voted - if (pollAccount.getTopiaId() == null && getVoteService().hasAlreadyVoted(name, poll)) { - addFieldError("pollAccount.votingId", _("pollen.error.user.alreadyVoted")); + if (pollAccount.getTopiaId() == null && + getVoteService().hasAlreadyVoted(name, poll)) { + addFieldError("pollAccount.votingId", + _("pollen.error.user.alreadyVoted")); } } @@ -94,9 +97,15 @@ // check that the number of choices is not greater than maxChoiceNb int maxChoice = getPoll().getMaxChoiceNb(); if (maxChoice != 0 && nbVotes > maxChoice) { - addFieldError("vote.choices", _("pollen.error.vote.maxChoiceNb", maxChoice)); + addFieldError("vote.choices", + _("pollen.error.vote.maxChoiceNb", maxChoice)); } + if (nbVotes==0) { + addFieldError("vote.choices", + _("pollen.error.vote.noVote")); + } + // check for percentage that the sum of all values equals 100 if (isPercentageVoteCounting() && totalValues != 100) { addFieldError("vote.choices", _("pollen.error.vote.percentage")); @@ -131,10 +140,13 @@ String updateUrl = getVoteService().getUpdateVoteUrl(pollUri); if (log.isDebugEnabled()) { - log.debug(String.format("UpdateURL for poll '%s' and account '%s' = %s", pollId, accountId, updateUrl)); + log.debug(String.format( + "UpdateURL for poll '%s' and account '%s' = %s", + pollId, accountId, updateUrl)); } - addFlashMessage(_("pollen.information.vote.createdWithUpdateUrl", updateUrl)); + addFlashMessage( + _("pollen.information.vote.createdWithUpdateUrl", updateUrl)); } else{ Modified: trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties =================================================================== --- trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-05-28 13:42:01 UTC (rev 3392) +++ trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-05-28 15:00:39 UTC (rev 3393) @@ -193,6 +193,7 @@ pollen.error.user.restrictedListsForbidden=The poll is restricted and you are not allowed to vote. Check if you have correctly used the link sent to you by email. pollen.error.userNotAllowed=You are not allowed to count the votes for this poll. pollen.error.vote.maxChoiceNb=The maximal number of choices is %d. +pollen.error.vote.noVote=No vote filled pollen.error.vote.percentage=The sum of the values must be equals to 100. pollen.fieldset.connexionInformation=Connexion informations pollen.fieldset.login=Login Modified: trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties =================================================================== --- trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-05-28 13:42:01 UTC (rev 3392) +++ trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-05-28 15:00:39 UTC (rev 3393) @@ -191,6 +191,7 @@ pollen.error.user.restrictedListsForbidden=Le sondage est restreint et vous n'êtes pas autorisé à voter. Vérifiez que vous avez bien utiliser le lien qui vous a été envoyé. pollen.error.userNotAllowed=Vous n'êtes pas autorisé à dépouiller ce sondage. pollen.error.vote.maxChoiceNb=Le nombre de choix maximal est de %d. +pollen.error.vote.noVote=Aucun vote renseigné pollen.error.vote.percentage=La somme des valeurs doit être égale à 100. pollen.fieldset.connexionInformation=Information de connexion pollen.fieldset.login=Connexion Copied: trunk/pollen-ui-struts2/src/main/resources/org/chorem/pollen/business/persistence/VoteToChoiceImpl-conversion.properties (from rev 3391, trunk/pollen-ui-struts2/src/main/resources/org/chorem/pollen/business/persistence/VoteToChoice-conversion.properties) =================================================================== --- trunk/pollen-ui-struts2/src/main/resources/org/chorem/pollen/business/persistence/VoteToChoiceImpl-conversion.properties (rev 0) +++ trunk/pollen-ui-struts2/src/main/resources/org/chorem/pollen/business/persistence/VoteToChoiceImpl-conversion.properties 2012-05-28 15:00:39 UTC (rev 3393) @@ -0,0 +1,24 @@ +### +# #%L +# Pollen :: UI (strust2) +# +# $Id$ +# $HeadURL$ +# %% +# Copyright (C) 2009 - 2012 CodeLutin +# %% +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# #L% +### +voteValue=org.chorem.pollen.ui.actions.BooleanIntegerConverter \ No newline at end of file
participants (1)
-
tchemit@users.chorem.org