r3216 - in branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main: java/org/chorem/pollen/ui/actions/poll resources/i18n webapp/WEB-INF/jsp/poll
Author: fdesbois Date: 2012-03-28 18:39:54 +0200 (Wed, 28 Mar 2012) New Revision: 3216 Url: http://chorem.org/repositories/revision/pollen/3216 Log: - Add anonymous checkbox Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/VoteForPoll.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/VoteForPoll.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/VoteForPoll.java 2012-03-28 16:39:46 UTC (rev 3215) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/VoteForPoll.java 2012-03-28 16:39:54 UTC (rev 3216) @@ -64,15 +64,18 @@ Poll poll = getPoll(); - String name = pollAccount.getVotingId(); - if (StringUtils.isBlank(name)) { - addFieldError("pollAccount.votingId", _("pollen.error.pollAccount.votingId.required")); - } + if (!vote.isAnonymous()) { - // 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")); - } + String name = pollAccount.getVotingId(); + if (StringUtils.isBlank(name)) { + 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")); + } + } } @Override Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-03-28 16:39:46 UTC (rev 3215) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-03-28 16:39:54 UTC (rev 3216) @@ -236,3 +236,4 @@ pollen.title.selectPersonListToAddVotingList=Select a voter list to import in voting list pollen.title.selectPersonListToCreateVotingList=Select a favorite list to import in a new voting list pollen.title.usersList=Users administration +vote.anonymous=Anonymous vote Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-03-28 16:39:46 UTC (rev 3215) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-03-28 16:39:54 UTC (rev 3216) @@ -246,3 +246,4 @@ pollen.title.selectPersonListToCreateVotingList=Sélectionner une liste de votants pour créer un nouveau groupe pollen.title.usersList=Gestion des utilisateurs title=Création d'un sondage +vote.anonymous=Vote anonyme Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp 2012-03-28 16:39:46 UTC (rev 3215) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp 2012-03-28 16:39:54 UTC (rev 3216) @@ -86,7 +86,18 @@ } jQuery(document).ready(function () { + $('#poll tr:even').addClass('even'); + + var $anonymousField = $('#voteForm [name="vote.anonymous"]'); + var $votingIdField = $('#voteForm [name="pollAccount.votingId"]'); + + $votingIdField.attr('disabled', $anonymousField.prop('checked')); + + $anonymousField.change(function() { + $votingIdField.attr('disabled', $(this).prop('checked')); + }); + }); @@ -407,8 +418,8 @@ <s:if test="pollRunning"> <div id="buttons"> - <s:if test="anonymousVoteDisplayed"> - <s:checkbox id="anonymousVote" value="anonymousVote"/> + <s:if test="poll.anonymousVoteAllowed"> + <s:checkbox key="vote.anonymous"/> <%--<t:label for="anonymousVote"/>--%> <br/> </s:if>
participants (1)
-
fdesbois@users.chorem.org