r2741 - in trunk/pollen-ui/src/main: java/org/chorem/pollen/ui/pages/user resources/org/chorem/pollen/ui/pages/user webapp/user
Author: nrannou Date: 2009-08-24 16:08:45 +0200 (Mon, 24 Aug 2009) New Revision: 2741 Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserPollsParticipated.java trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserPollsParticipated_en.properties trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserPollsParticipated_fr.properties trunk/pollen-ui/src/main/webapp/user/UserPollsParticipated.tml Log: deux tableaux : sondage invit?\195?\169s et sondages particip?\195?\169s Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserPollsParticipated.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserPollsParticipated.java 2009-08-24 12:23:20 UTC (rev 2740) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserPollsParticipated.java 2009-08-24 14:08:45 UTC (rev 2741) @@ -22,8 +22,10 @@ import org.apache.tapestry5.annotations.Property; import org.apache.tapestry5.annotations.SessionState; import org.apache.tapestry5.ioc.annotations.Inject; +import org.chorem.pollen.business.dto.PollAccountDTO; import org.chorem.pollen.business.dto.PollDTO; import org.chorem.pollen.business.dto.UserDTO; +import org.chorem.pollen.business.dto.VotingListDTO; import org.chorem.pollen.business.services.ServicePoll; import org.chorem.pollen.ui.base.Polls; @@ -46,24 +48,48 @@ private boolean userExists; /** - * Liste des sondages de l'utilisateur + * Liste des sondages auxquels l'utilisateur a participé */ + @SuppressWarnings("unused") @Property - private List<PollDTO> polls; + private List<PollDTO> participatedPolls; + /** + * Liste des sondages auxquels l'utilisateur est invité + */ + @SuppressWarnings("unused") + @Property + private List<PollDTO> invitedPolls; + /** Injection des services */ @Inject private ServicePoll servicePoll; /** + * Récupération de l'identifiant de vote du sondage. + * + * @return l'identifiant. + */ + public String getVoteId(PollDTO poll) { + for (VotingListDTO list : poll.getVotingListDTOs()) { + for (PollAccountDTO account : list.getPollAccountDTOs()) { + if (account.getEmail().equals(user.getEmail())) { + return poll.getPollId() + ":" + account.getAccountId(); + } + } + } + return poll.getPollId(); + } + + /** * Méthode d'initialisation des sondages */ @Override public void onActivate() { super.onActivate(); if (userExists) { - polls = servicePoll.findParticipatedPolls(user.getId()); - polls.addAll(servicePoll.findInvitedPolls(user.getId())); + participatedPolls = servicePoll.findParticipatedPolls(user.getId()); + invitedPolls = servicePoll.findInvitedPolls(user.getId()); } } } Modified: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserPollsParticipated_en.properties =================================================================== --- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserPollsParticipated_en.properties 2009-08-24 12:23:20 UTC (rev 2740) +++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserPollsParticipated_en.properties 2009-08-24 14:08:45 UTC (rev 2741) @@ -1,4 +1,5 @@ title=Polls participated -subtitle=Polls in which you are involved +invitedPolls=Polls for which you are invited to vote +participatedPolls=Polls in which you are involved noUser=You must be logged to access to your polls.\n Please fill the form below. -noPolls=You have not participated to any poll. \ No newline at end of file +noPolls=No poll. \ No newline at end of file Modified: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserPollsParticipated_fr.properties =================================================================== --- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserPollsParticipated_fr.properties 2009-08-24 12:23:20 UTC (rev 2740) +++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserPollsParticipated_fr.properties 2009-08-24 14:08:45 UTC (rev 2741) @@ -1,4 +1,5 @@ title=Sondages participés -subtitle=Liste des sondages pour lesquels vous avez voté ou êtes invité à voter +invitedPolls=Liste des sondages pour lesquels vous êtes invité à voter +participatedPolls=Liste des sondages pour lesquels vous avez voté noUser=Vous devez être identifié pour pouvoir accéder à vos sondages.\n Veuillez remplir le formulaire ci-dessous. -noPolls=Vous n'avez participé à aucun sondage. \ No newline at end of file +noPolls=Aucun sondage. \ No newline at end of file Modified: trunk/pollen-ui/src/main/webapp/user/UserPollsParticipated.tml =================================================================== --- trunk/pollen-ui/src/main/webapp/user/UserPollsParticipated.tml 2009-08-24 12:23:20 UTC (rev 2740) +++ trunk/pollen-ui/src/main/webapp/user/UserPollsParticipated.tml 2009-08-24 14:08:45 UTC (rev 2741) @@ -4,10 +4,28 @@ <t:feedback t:id="feedback"/> <h1 class="titleVote">${message:title}</h1> - <h4>${message:subtitle}</h4> <t:if test="userExists"> + + <h4>${message:invitedPolls}</h4> + <t:grid t:id="invitedPollsGrid" t:source="invitedPolls" t:row="poll" model="pollsModel" t:inPlace="true" + t:rowsPerPage="10" t:pagerPosition="bottom" t:rowClass="prop:evenodd.next"> + <p:functionsCell> + <t:PageLink t:page="poll/VoteForPoll" t:context="getVoteId(poll)"> + <img src="${asset:context:img/vote.png}" title="${message:vote-help}" alt="${message:vote}" /> + </t:PageLink> + <t:if test="poll.publicResults"> + <t:PageLink t:page="poll/results" t:context="poll.pollId"> + <img src="${asset:context:img/count.png}" title="${message:count-help}" alt="${message:count}" /> + </t:PageLink> + </t:if> + </p:functionsCell> + <p:empty> + ${message:noPolls} + </p:empty> + </t:grid> - <t:grid t:id="pollsGrid" t:source="polls" t:row="poll" model="pollsModel" t:inPlace="true" + <h4>${message:participatedPolls}</h4> + <t:grid t:id="participatedPollsGrid" t:source="participatedPolls" t:row="poll" model="pollsModel" t:inPlace="true" t:rowsPerPage="10" t:pagerPosition="bottom" t:rowClass="prop:evenodd.next"> <p:functionsCell> <t:PageLink t:page="poll/VoteForPoll" t:context="poll.pollId">
participants (1)
-
nrannou@users.chorem.org