Author: fdesbois Date: 2010-03-08 15:42:47 +0100 (Mon, 08 Mar 2010) New Revision: 2901 Log: Ano #130 : Hide votes for an anonymous vote (don't load votes in this case) Modified: branches/pollen-1.2.3-1.2.x/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataPollConverter.java branches/pollen-1.2.3-1.2.x/pollen-business/src/main/java/org/chorem/pollen/business/dto/PollDTO.java branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/VoteForPoll_en.properties branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/VoteForPoll_fr.properties branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/webapp/css/vote.css branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/webapp/poll/VoteForPoll.tml Modified: branches/pollen-1.2.3-1.2.x/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataPollConverter.java =================================================================== --- branches/pollen-1.2.3-1.2.x/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataPollConverter.java 2010-03-08 13:33:31 UTC (rev 2900) +++ branches/pollen-1.2.3-1.2.x/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataPollConverter.java 2010-03-08 14:42:47 UTC (rev 2901) @@ -121,7 +121,12 @@ .getChoice())); } if (ePoll.getVote().size() > 0) { - pollDTO.setVoteDTOs(voteConverter.createVoteDTOs(ePoll.getVote())); + // FD-20100308 Votes are not loaded for an anonymous vote : + // see ref ANO #130 + if (!ePoll.getAnonymous()) { + pollDTO.setVoteDTOs(voteConverter.createVoteDTOs(ePoll.getVote())); + } + pollDTO.setNbVotes(ePoll.getVote().size()); } if (ePoll.getComment().size() > 0) { pollDTO.setCommentDTOs(commentConverter.createCommentDTOs(ePoll Modified: branches/pollen-1.2.3-1.2.x/pollen-business/src/main/java/org/chorem/pollen/business/dto/PollDTO.java =================================================================== --- branches/pollen-1.2.3-1.2.x/pollen-business/src/main/java/org/chorem/pollen/business/dto/PollDTO.java 2010-03-08 13:33:31 UTC (rev 2900) +++ branches/pollen-1.2.3-1.2.x/pollen-business/src/main/java/org/chorem/pollen/business/dto/PollDTO.java 2010-03-08 14:42:47 UTC (rev 2901) @@ -76,6 +76,8 @@ private String creatorEmail = ""; + private int nbVotes; + private List<CommentDTO> commentDTOs = new ArrayList<CommentDTO>(); private List<VotingListDTO> votingListDTOs = new ArrayList<VotingListDTO>(); @@ -284,6 +286,14 @@ this.creatorEmail = creatorEmail; } + public int getNbVotes() { + return nbVotes; + } + + public void setNbVotes(int nbVotes) { + this.nbVotes = nbVotes; + } + public List<CommentDTO> getCommentDTOs() { return commentDTOs; } Modified: branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java =================================================================== --- branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java 2010-03-08 13:33:31 UTC (rev 2900) +++ branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java 2010-03-08 14:42:47 UTC (rev 2901) @@ -295,6 +295,17 @@ return imgContext; } + @InjectComponent + private FeedBack voteFeedback; + + public String getVoteSizeMessage() { + if (log.isDebugEnabled()) { + log.debug("poll voteDTOs list size : " + poll.getVoteDTOs().size()); + log.debug("poll nbVotes : " + poll.getNbVotes()); + } + return messages.format("vote-size", poll.getNbVotes()); + } + /** Méthode appelée après la soumission du vote. */ @Log Object onSuccessFromVoteForm() { @@ -388,6 +399,7 @@ addFeedEntry(PollAction.ADDVOTE, pollAccount.getVotingId(), getResultsAsString()); sendMailNotification(); + voteFeedback.addInfo(messages.get("vote-success")); } voteChoices.clear(); return pollZone.getBody(); Modified: branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/VoteForPoll_en.properties =================================================================== --- branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/VoteForPoll_en.properties 2010-03-08 13:33:31 UTC (rev 2900) +++ branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/VoteForPoll_en.properties 2010-03-08 14:42:47 UTC (rev 2901) @@ -12,12 +12,14 @@ results-help=Display results #vote +vote-size=%d votes has been saved. anonymous=anonymous description=Description voterName=Voter pollAccountName-required-message=You must provide your name. anonymousVote-label=Anonymous vote submitVote=Vote +vote-success=Your vote has been correctly saved. #choices addChoice=Adding a choice Modified: branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/VoteForPoll_fr.properties =================================================================== --- branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/VoteForPoll_fr.properties 2010-03-08 13:33:31 UTC (rev 2900) +++ branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/VoteForPoll_fr.properties 2010-03-08 14:42:47 UTC (rev 2901) @@ -1,23 +1,25 @@ title=Vote -about=à propos du sondage -creator-label=Créateur : -beginDate-label=Date de début : +about=\u00C3\u00A0 propos du sondage +creator-label=Cr\u00C3\u00A9ateur : +beginDate-label=Date de d\u00C3\u00A9but : endDate-label=Date de fin : pollType-label=Type de sondage : -normalVote-help=Vote normal : voter pour le ou les choix préférés. -percentageVote-help=Vote par pourcentage : répartir les choix de manière à obtenir 100% au total. -condorcetVote-help=Vote Condorcet : classer les choix par ordre de préférence de 1 à N (1=préféré). Seul l'ordre des choix compte, peu importe les valeurs. Deux choix peuvent avoir la même valeur. -numberVote-help=Vote par nombre : La réponse est libre, laissez vide ou entrez un nombre entier -results=Résultats -results-help=Voir les résultats +normalVote-help=Vote normal : voter pour le ou les choix pr\u00C3\u00A9f\u00C3\u00A9r\u00C3\u00A9s. +percentageVote-help=Vote par pourcentage : r\u00C3\u00A9partir les choix de mani\u00C3\u00A8re \u00C3\u00A0 obtenir 100% au total. +condorcetVote-help=Vote Condorcet : classer les choix par ordre de pr\u00C3\u00A9f\u00C3\u00A9rence de 1 \u00C3\u00A0 N (1=pr\u00C3\u00A9f\u00C3\u00A9r\u00C3\u00A9). Seul l'ordre des choix compte, peu importe les valeurs. Deux choix peuvent avoir la m\u00C3\u00AAme valeur. +numberVote-help=Vote par nombre : La r\u00C3\u00A9ponse est libre, laissez vide ou entrez un nombre entier +results=R\u00C3\u00A9sultats +results-help=Voir les r\u00C3\u00A9sultats #vote +vote-size=%d votes on \u00E9t\u00E9 enregistr\u00E9s anonymous=anonyme description=Description voterName=Votant pollAccountName-required-message=Vous devez saisir votre nom. anonymousVote-label=Vote anonyme submitVote=Voter +vote-success=Votre vote a bien \u00E9t\u00E9 enregistr\u00E9 #choices addChoice=Ajout d'un choix @@ -26,19 +28,19 @@ textDesc-label=Description imgFile-label=Image * imgFile-regexp=\\.(jpe?g|gif|png|JPE?G|GIF|PNG)$ -imgFile-regexp-message=L'image doit-être au format JPG, GIF ou PNG. +imgFile-regexp-message=L'image doit-\u00C3\u00AAtre au format JPG, GIF ou PNG. imgFile-required-message=Vous devez saisir un choix. imgDesc-label=Description dateDTF-label=Date et heure * dateDTF-regexp=\\d{2}\/\\d{2}\/\\d{4}( \\d{2}\\:\\d{2})? -dateDTF-regexp-message=La date de début doit-être au format 31/12/2000 23:59. +dateDTF-regexp-message=La date de d\u00C3\u00A9but doit-\u00C3\u00AAtre au format 31/12/2000 23:59. dateDTF-required-message=Vous devez saisir un choix. dateDesc-label=Description DTF-pattern=dd/MM/yyyy HH:mm submitChoice=Ajouter #comments -comments=Commentaires à propos du sondage +comments=Commentaires \u00C3\u00A0 propos du sondage commenterName-label=Nom commenterName-required-message=Vous devez saisir votre nom. commentArea-label=Commentaire @@ -46,14 +48,14 @@ submitComment=Ajouter un commentaire #messages -pollNotFound=Il n'y a pas de sondage à cette adresse. Veuillez verifier que vous utilisez le lien correcte et copiez-le complètement dans le champ d'adresse de votre navigateur. +pollNotFound=Il n'y a pas de sondage \u00C3\u00A0 cette adresse. Veuillez verifier que vous utilisez le lien correcte et copiez-le compl\u00C3\u00A8tement dans le champ d'adresse de votre navigateur. anonymousForbidden=Le vote anonyme est interdit pour ce sondage. Saisissez un nom. -restrictedListsForbidden=Le sondage est restreint et le nom %s n'est pas autorisé. -alreadyVoted=Une personne a déjà voté sous le nom %s. +restrictedListsForbidden=Le sondage est restreint et le nom %s n'est pas autoris\u00C3\u00A9. +alreadyVoted=Une personne a d\u00C3\u00A9j\u00C3\u00A0 vot\u00C3\u00A9 sous le nom %s. tooManyChoices=Le nombre de choix maximal est de %d. -not100percent=La somme des valeurs doit être égale à 100. -choiceExists=Le choix %s existe déjà. -pollNotStarted=Ce sondage n'a pas encore commencé. -pollFinished=Ce sondage est terminé. Vous ne pouvez plus voter. +not100percent=La somme des valeurs doit \u00C3\u00AAtre \u00C3\u00A9gale \u00C3\u00A0 100. +choiceExists=Le choix %s existe d\u00C3\u00A9j\u00C3\u00A0. +pollNotStarted=Ce sondage n'a pas encore commenc\u00C3\u00A9. +pollFinished=Ce sondage est termin\u00C3\u00A9. Vous ne pouvez plus voter. pollClosed=Ce sondage est clos. Vous ne pouvez plus voter. pollChoiceRunning=L'ajout de choix est possible. \ No newline at end of file Modified: branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/webapp/css/vote.css =================================================================== --- branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/webapp/css/vote.css 2010-03-08 13:33:31 UTC (rev 2900) +++ branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/webapp/css/vote.css 2010-03-08 14:42:47 UTC (rev 2901) @@ -22,18 +22,22 @@ } #pollZone { - padding: 10px; - text-align: center; - -moz-border-radius: 15px; + /*padding: 10px;*/ + text-align: center; + -moz-border-radius: 15px; } +#pollZone form { + margin-top: 10px; +} + #poll { - border-collapse: collapse; - border-left: 1px solid #aab; - border-top: 1px solid #aab; - background-color: #fff; - font-size: 14px; - margin: auto; + border-collapse: collapse; + border-left: 1px solid #aab; + border-top: 1px solid #aab; + background-color: #fff; + font-size: 14px; + margin: auto; } #poll THEAD, Modified: branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/webapp/poll/VoteForPoll.tml =================================================================== --- branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/webapp/poll/VoteForPoll.tml 2010-03-08 13:33:31 UTC (rev 2900) +++ branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/webapp/poll/VoteForPoll.tml 2010-03-08 14:42:47 UTC (rev 2901) @@ -46,6 +46,8 @@ <!-- Sondage --> <t:zone t:id="pollZone" t:show="show" t:update="show"> + <p>${voteSizeMessage}</p> + <t:feedback t:id="voteFeedback"/> <t:form t:id="voteForm" t:zone="pollZone"> <table id="poll"> <thead> @@ -157,74 +159,76 @@ </tfoot> </t:if> <tbody> - <t:loop t:source="poll.voteDTOs" t:value="vote" volatile="true"> - <tr> - <td class="${evenodd.next}"> - <t:if test="${AccountFieldDisplayed}"> - <t:unless test="${currentVoteAnonymous}"> - ${currentVotingId} - <p:else> - ? - </p:else> + <t:unless t:test="poll.anonymous"> + <t:loop t:source="poll.voteDTOs" t:value="vote" volatile="true"> + <tr> + <td class="${evenodd.next}"> + <t:if test="${AccountFieldDisplayed}"> + <t:unless test="${currentVoteAnonymous}"> + ${currentVotingId} + <p:else> + ? + </p:else> + </t:unless> + </t:if> + <t:unless test="${poll.anonymous}"> + <t:if test="isModifAllowed(currentVotingId)"> + <t:actionlink t:id="editVote" context="${currentVotingId}" t:zone="pollZone"> + <img src="${asset:context:img/editSmall.png}" title="${message:edit}" alt="${message:edit}"/> + </t:actionlink> + </t:if> + <t:if test="creatorUser"> + <t:actionlink t:id="deleteVote" context="vote.id" t:zone="pollZone"> + <img src="${asset:context:img/delete.png}" title="${message:delete}" alt="${message:delete}"/> + </t:actionlink> + </t:if> </t:unless> - </t:if> - <t:unless test="${poll.anonymous}"> - <t:if test="isModifAllowed(currentVotingId)"> - <t:actionlink t:id="editVote" context="${currentVotingId}" t:zone="pollZone"> - <img src="${asset:context:img/editSmall.png}" title="${message:edit}" alt="${message:edit}"/> - </t:actionlink> - </t:if> - <t:if test="creatorUser"> - <t:actionlink t:id="deleteVote" context="vote.id" t:zone="pollZone"> - <img src="${asset:context:img/delete.png}" title="${message:delete}" alt="${message:delete}"/> - </t:actionlink> - </t:if> - </t:unless> - </td> - <t:loop t:source="poll.choiceDTOs" t:value="choiceOfPoll" volatile="true"> - <t:if test="!isChoiceHidden()"> - ${setCurrentVoteChoice()} - <t:if test="${poll.anonymous}"> - <td class="anonymous">?</td> - <p:else> - <t:if test="isNormalVoteCounting()"> - <t:if test="isChoiceInVote(currentVoteChoice)"> - <td class="voted">OK</td> - <p:else> - <td class="notVoted"></td> - </p:else> - </t:if> - </t:if> - <t:if test="isPercentageVoteCounting()"> - <t:if test="isChoiceInVote(currentVoteChoice)"> - <td class="voted">${currentVoteChoice.value} %</td> - <p:else> - <td class="notVoted"></td> - </p:else> - </t:if> - </t:if> - <t:if test="isCondorcetVoteCounting()"> - <t:if test="isChoiceInVote(currentVoteChoice)"> - <td class="voted">${currentVoteChoice.value}</td> - <p:else> - <td class="notVoted"></td> - </p:else> - </t:if> - </t:if> - <t:if test="isNumberVoteCounting()"> - <t:if test="isChoiceInVote(currentVoteChoice)"> - <td class="voted">${currentVoteChoice.value}</td> - <p:else> - <td class="notVoted"></td> - </p:else> - </t:if> - </t:if> - </p:else> - </t:if> - </t:if> - </t:loop> - </tr> - </t:loop> + </td> + <t:loop t:source="poll.choiceDTOs" t:value="choiceOfPoll" volatile="true"> + <t:unless t:test="choiceHidden"> + ${setCurrentVoteChoice()} + <t:if t:test="poll.anonymous"> + <td class="anonymous">?</td> + <p:else> + <t:if test="isNormalVoteCounting()"> + <t:if test="isChoiceInVote(currentVoteChoice)"> + <td class="voted">OK</td> + <p:else> + <td class="notVoted"></td> + </p:else> + </t:if> + </t:if> + <t:if test="isPercentageVoteCounting()"> + <t:if test="isChoiceInVote(currentVoteChoice)"> + <td class="voted">${currentVoteChoice.value} %</td> + <p:else> + <td class="notVoted"></td> + </p:else> + </t:if> + </t:if> + <t:if test="isCondorcetVoteCounting()"> + <t:if test="isChoiceInVote(currentVoteChoice)"> + <td class="voted">${currentVoteChoice.value}</td> + <p:else> + <td class="notVoted"></td> + </p:else> + </t:if> + </t:if> + <t:if test="isNumberVoteCounting()"> + <t:if test="isChoiceInVote(currentVoteChoice)"> + <td class="voted">${currentVoteChoice.value}</td> + <p:else> + <td class="notVoted"></td> + </p:else> + </t:if> + </t:if> + </p:else> + </t:if> + </t:unless> + </t:loop> + </tr> + </t:loop> + </t:unless> <t:if test="poll.continuousResults"> <tr> <td>