r3417 - in trunk: pollen-services/src/main/java/org/chorem/pollen/bean pollen-services/src/main/java/org/chorem/pollen/services/impl pollen-services/src/main/resources/i18n pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user pollen-ui-struts2/src/main/resources pollen-ui-struts2/src/main/resources/config pollen-ui-struts2/src/main/resources/i18n pollen-ui-struts2/src/main/webapp/WEB-INF/decorators pollen-ui-stru
Author: tchemit Date: 2012-06-03 21:26:50 +0200 (Sun, 03 Jun 2012) New Revision: 3417 Url: http://chorem.org/repositories/revision/pollen/3417 Log: fixes #530: ajouter ou d?\195?\169placer un sondage sur un compte fixes #581: Add an edit link for creator or admin on vote and result page fixes #580: When changing lang, it should redirect to last page and not on home page. fixes #573: Liens pas clairs apr?\195?\168s cr?\195?\169ation de sondage - ajout javadocs Added: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AttachPoll.java trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/ChangeLang.java trunk/pollen-ui-struts2/src/main/webapp/css/resume.css Modified: trunk/pollen-services/src/main/java/org/chorem/pollen/bean/PollUri.java trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/EmailService.java trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollService.java trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollUrlService.java trunk/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties trunk/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractDisplayChoice.java trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractVoteAction.java trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AddComment.java trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ClosePoll.java trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteChoice.java trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteComment.java trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteVote.java trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ResultForPoll.java trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/SavePoll.java trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/Login.java trunk/pollen-ui-struts2/src/main/resources/config/struts-user.xml 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 trunk/pollen-ui-struts2/src/main/resources/shiro.ini trunk/pollen-ui-struts2/src/main/resources/struts.xml trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators/layout-default.jsp trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/result.jsp trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/resultLink.jsp trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/resume.jsp trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/createdList.jsp Modified: trunk/pollen-services/src/main/java/org/chorem/pollen/bean/PollUri.java =================================================================== --- trunk/pollen-services/src/main/java/org/chorem/pollen/bean/PollUri.java 2012-06-03 15:40:54 UTC (rev 3416) +++ trunk/pollen-services/src/main/java/org/chorem/pollen/bean/PollUri.java 2012-06-03 19:26:50 UTC (rev 3417) @@ -92,4 +92,9 @@ } return result; } + + @Override + public String toString() { + return getUri(); + } } Modified: trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/EmailService.java =================================================================== --- trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/EmailService.java 2012-06-03 15:40:54 UTC (rev 3416) +++ trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/EmailService.java 2012-06-03 19:26:50 UTC (rev 3417) @@ -143,7 +143,7 @@ subject = l_(locale, "pollen.email.createPoll.subject", pollTitle); content = l_(locale, "pollen.email.createPoll.content", - pollTitle, voteURL, moderateUrl, modifURL); + pollTitle, poll.getPollId(), voteURL, moderateUrl, modifURL); } else { subject = l_(locale, "pollen.email.createRestrictedPoll.subject", Modified: trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollService.java =================================================================== --- trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollService.java 2012-06-03 15:40:54 UTC (rev 3416) +++ trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollService.java 2012-06-03 19:26:50 UTC (rev 3417) @@ -774,6 +774,28 @@ commitTransaction("Could not close poll " + poll.getTitle()); } + public void attachPoll(Poll poll, UserAccount userAccount) { + + Preconditions.checkNotNull(poll); + Preconditions.checkNotNull(userAccount); + + // just link poll creator account to given user account + PollAccount creator = poll.getCreator(); + creator.setUserAccount(userAccount); + + // fill votingId from user account + if (StringUtils.isEmpty(creator.getVotingId())) { + creator.setVotingId(userAccount.getDisplayName()); + } + + // fill email from user account + if (StringUtils.isEmpty(creator.getEmail())) { + creator.setEmail(userAccount.getEmail()); + } + commitTransaction("Could not attach poll " + poll.getTitle() + + " to user account " + userAccount.getDisplayName()); + } + public Choice getNewChoice(ChoiceType choiceType) { Choice result; switch (choiceType) { Modified: trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollUrlService.java =================================================================== --- trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollUrlService.java 2012-06-03 15:40:54 UTC (rev 3416) +++ trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollUrlService.java 2012-06-03 19:26:50 UTC (rev 3417) @@ -1,3 +1,25 @@ +/* + * #%L + * Pollen :: Services + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 CodeLutin, Tony Chemit + * %% + * 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% + */ package org.chorem.pollen.services.impl; import com.google.common.base.Preconditions; Property changes on: trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollUrlService.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: trunk/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties =================================================================== --- trunk/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties 2012-06-03 15:40:54 UTC (rev 3416) +++ trunk/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties 2012-06-03 19:26:50 UTC (rev 3417) @@ -11,7 +11,7 @@ pollen.common.numberVote-total-votes=Total votes pollen.common.unauthorized=unauthorized pollen.common.undefined=undefined -pollen.email.createPoll.content=You had just created the new poll\: "%s".\nYou can access to this poll by following the links below.\n\nVote page\: \n%s\nModerate votes page\: \n%s\nEdit page\: \n%s +pollen.email.createPoll.content=You had just created the new poll\: "%s" (id %s).\n\nYou can access to this poll by following the links below.\n\nVote page\: \n%s\nModerate votes page\: \n%s\nEdit page\: \n%s pollen.email.createPoll.subject=[Pollen] Poll creation (%s) pollen.email.createRestrictedPoll.content=You had just created the new poll\: "%s".\nYou can access to this poll by following the links below.\n\nModerate votes page\: \n%s\nEdit page\: \n%s pollen.email.createRestrictedPoll.subject=[Pollen] Restricted poll creation (%s) Modified: trunk/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties =================================================================== --- trunk/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties 2012-06-03 15:40:54 UTC (rev 3416) +++ trunk/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties 2012-06-03 19:26:50 UTC (rev 3417) @@ -11,7 +11,7 @@ pollen.common.numberVote-total-votes=Nombre total de votes pollen.common.unauthorized=Non autorisé pollen.common.undefined=Non défini -pollen.email.createPoll.content=Vous venez de créer le sondage "%1$s".\nVous pouvez y accéder en suivant les liens ci-dessous.\n\nPage de vote \: \n%2$s\nModération des votes \: \n%3$s\nPage de modification \: \n%4$s +pollen.email.createPoll.content=Vous venez de créer le sondage "%1$s" (identifiant %2$s).\n\nVous pouvez y accéder en suivant les liens ci-dessous.\n\nPage de vote \: \n%3$s\nModération des votes \: \n%4$s\nPage de modification \: \n%5$s pollen.email.createPoll.subject=[Pollen] Création d'un sondage (%1$s) pollen.email.createRestrictedPoll.content=Vous venez de créer le sondage "%s".\nVous pouvez y accéder en suivant les liens ci-dessous.\n\nModération des votes \: \n%s\nPage de modification \: \n%s pollen.email.createRestrictedPoll.subject=[Pollen] Création d'un sondage restreint (%s) Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractDisplayChoice.java =================================================================== --- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractDisplayChoice.java 2012-06-03 15:40:54 UTC (rev 3416) +++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractDisplayChoice.java 2012-06-03 19:26:50 UTC (rev 3417) @@ -40,15 +40,25 @@ private static final long serialVersionUID = 1L; - /** Where to find dynamic data (says choices in this case). */ + /** + * Where to find dynamic data (says choices in this case). + * + * @since 1.3 + */ protected String tokenId; - /** Number of choice to display. */ + /** + * Number of choice to display. + * + * @since 1.3 + */ protected int choiceNumber; /** * Choice to display in ui (come from dynamic data if exists, or fresh * created one). + * + * @since 1.3 */ protected Choice choice; Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractVoteAction.java =================================================================== --- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractVoteAction.java 2012-06-03 15:40:54 UTC (rev 3416) +++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractVoteAction.java 2012-06-03 19:26:50 UTC (rev 3417) @@ -62,30 +62,86 @@ /** Logger. */ private static final Log log = LogFactory.getLog(AbstractVoteAction.class); + /** + * Loaded poll. + * + * @since 1.3 + */ private Poll poll; + /** + * Is feed existfor this poll ? + * + * @since 1.3 + */ private boolean feedFileExisting; + /** + * Is user the poll's creator ? + * + * @since 1.3 + */ private boolean creatorUser; + /** + * Loaded poll account (from the pollUri). + * + * @since 1.3 + */ private PollAccount pollAccount; + //TODO-thcemit-2012-06-03 Do we use this ? nobody set it... so always false private boolean alreadyVoted; + /** + * Is votr allowed for current user? + * + * @since 1.3 + */ private boolean voteAllowed; + /** + * All votes for the poll. + * + * @since 1.3 + */ private List<Vote> votes; + /** + * Current vote to treat (for create/updatevote action). + * + * @since 1.3 + */ private Vote vote; + /** + * Comment author to display in UI. + * + * @since 1.3 + */ private String commentAuthor; // private String voteSizeMessage; + /** + * Results of the poll. + * + * @since 1.3 + */ private List<PollResult> results; + /** + * List of comments to display. + * + * @since 1.3 + */ private List<Comment> comments; + /** + * Injected parameters from request. + * + * @since 1.3 + */ private Map<String, String[]> parameters; @Override Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AddComment.java =================================================================== --- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AddComment.java 2012-06-03 15:40:54 UTC (rev 3416) +++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AddComment.java 2012-06-03 19:26:50 UTC (rev 3417) @@ -83,7 +83,7 @@ // create the comment getPollCommentService().createComment(getPoll(), comment); - addFlashMessage(_("pollen.info.comment.added")); + addFlashMessage(_("pollen.information.comment.added")); return SUCCESS; } } Added: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AttachPoll.java =================================================================== --- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AttachPoll.java (rev 0) +++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AttachPoll.java 2012-06-03 19:26:50 UTC (rev 3417) @@ -0,0 +1,112 @@ +/* + * #%L + * Pollen :: UI (struts2) + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 CodeLutin, Tony Chemit + * %% + * 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% + */ +package org.chorem.pollen.ui.actions.poll; + +import com.google.common.base.Preconditions; +import org.apache.commons.lang3.StringUtils; +import org.chorem.pollen.bean.PollUri; +import org.chorem.pollen.business.persistence.Poll; +import org.chorem.pollen.business.persistence.UserAccount; +import org.chorem.pollen.services.exceptions.PollNotFoundException; +import org.chorem.pollen.ui.actions.PageSkin; +import org.chorem.pollen.ui.actions.PollenActionSupport; + +/** + * To attach a anonymous poll to a connected user account. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.4 + */ +public class AttachPoll extends PollenActionSupport { + + private static final long serialVersionUID = 1L; + + /** + * Id of the poll to attach to connected user account. + * + * @since 1.4 + */ + private PollUri pollUri; + + public void setPollUri(PollUri pollUri) { + this.pollUri = pollUri; + } + + public String getPollId() { + return pollUri == null ? null : pollUri.getPollId(); + } + + @Override + public PageSkin getSkin() { + return PageSkin.EDITION; + } + + @Override + public String execute() throws Exception { + + Preconditions.checkNotNull(pollUri); + + String pollId = pollUri.getPollId(); + + Poll poll = getPollService().getExistingPollByPollId(pollId); + + UserAccount userAccount = getPollenSession().getUserAccount(); + + getPollService().attachPoll(poll, userAccount); + + addFlashMessage(_("pollen.information.poll.attached", poll.getTitle())); + + return SUCCESS; + } + + @Override + public void validate() { + + + if (pollUri == null || StringUtils.isEmpty(pollUri.getPollId())) { + addFieldError("pollUri", _("pollen.error.pollId.empty")); + } else { + + String pollId = pollUri.getPollId(); + + try { + + // check that poll exists + Poll poll = getPollService().getExistingPollByPollId(pollId); + + // check that poll is not yet attached to another user account + + UserAccount userAccount = poll.getCreator().getUserAccount(); + if (userAccount != null) { + + addFieldError("pollUri", + _("pollen.error.pollAlreadyAttached")); + } + } catch (PollNotFoundException e) { + + addFieldError("pollUri", _("pollen.error.pollNotFound")); + } + + } + } +} Property changes on: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AttachPoll.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ClosePoll.java =================================================================== --- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ClosePoll.java 2012-06-03 15:40:54 UTC (rev 3416) +++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ClosePoll.java 2012-06-03 19:26:50 UTC (rev 3417) @@ -23,6 +23,8 @@ */ package org.chorem.pollen.ui.actions.poll; +import org.chorem.pollen.business.persistence.Poll; + /** * Closes an existing poll. * @@ -33,6 +35,11 @@ private static final long serialVersionUID = 1L; + /** + * Redirect url. + * + * @since 1.3 + */ protected String redirectUrl; public String getRedirectUrl() { @@ -46,11 +53,13 @@ @Override public String execute() throws Exception { + Poll poll = getPollService().getExistingPollByPollId(getPollId()); + getPollService().closePoll(getPollId(), getPollenUserAccount(), getAccountId()); - addFlashMessage(_("pollen.information.poll.closed")); + addFlashMessage(_("pollen.information.poll.closed", poll.getTitle())); return SUCCESS; } Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteChoice.java =================================================================== --- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteChoice.java 2012-06-03 15:40:54 UTC (rev 3416) +++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteChoice.java 2012-06-03 19:26:50 UTC (rev 3417) @@ -50,7 +50,7 @@ getPollService().deleteChoice(pollId, choiceId); - addFlashMessage(_("pollen.info.choice.deleted")); + addFlashMessage(_("pollen.information.choice.deleted")); return SUCCESS; } } Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteComment.java =================================================================== --- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteComment.java 2012-06-03 15:40:54 UTC (rev 3416) +++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteComment.java 2012-06-03 19:26:50 UTC (rev 3417) @@ -70,7 +70,7 @@ getPollCommentService().deleteComment(poll, commentId, reason); - addFlashMessage(_("pollen.info.comment.deleted")); + addFlashMessage(_("pollen.information.comment.deleted")); return SUCCESS; } } Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteVote.java =================================================================== --- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteVote.java 2012-06-03 15:40:54 UTC (rev 3416) +++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteVote.java 2012-06-03 19:26:50 UTC (rev 3417) @@ -68,7 +68,7 @@ getVoteService().deleteVote(poll, voteId, reason); - addFlashMessage(_("pollen.info.vote.deleted")); + addFlashMessage(_("pollen.information.vote.deleted")); return SUCCESS; } } Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ResultForPoll.java =================================================================== --- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ResultForPoll.java 2012-06-03 15:40:54 UTC (rev 3416) +++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ResultForPoll.java 2012-06-03 19:26:50 UTC (rev 3417) @@ -38,7 +38,6 @@ import org.chorem.pollen.bean.PollResult; import org.chorem.pollen.bean.PollResultList; import org.chorem.pollen.business.persistence.Poll; -import org.chorem.pollen.business.persistence.PollAccount; import org.chorem.pollen.common.ChoiceType; import org.chorem.pollen.common.PollType; import org.chorem.pollen.common.VoteCountingType; @@ -67,26 +66,71 @@ /** Logger. */ private static final Log log = LogFactory.getLog(ResultForPoll.class); + /** + * Is result by group ? + * + * @since 1.3 + */ private Boolean byGroup; - protected boolean userAllowed; + /** + * Can user be on this page ? + * <p/> + * TODO-tchemit-2012-06-03 Security is managed by shiro, why doing it here again ? + * + * @since 1.3 + */ + private boolean userAllowed; /** + * Is user is poll(s creator ? + * + * @since 1.4 + */ + private boolean creatorUser; + + /** * Résultats du sondage. * <p/> * La map est indexée par les noms de choix. + * + * @since 1.3 */ private transient Multimap<String, String> choicesResults; - /** Résultats du sondage. */ + /** + * Résultats du sondage. + * + * @since 1.3 + */ private transient Multimap<String, String> subtitles; + /** + * Loaded poll. + * + * @since 1.3 + */ private Poll poll; + /** + * Poll results. + * + * @since 1.3 + */ private List<PollResult> results; + /** + * Top ranking results. + * + * @since 1.3 + */ private List<PollResult> topRanking; + /** + * Url helper (to build new url) + * + * @since 1.3.1 + */ @Inject(required = true) private UrlHelper urlHelper; @@ -103,6 +147,10 @@ return userAllowed; } + public boolean isCreatorUser() { + return creatorUser; + } + public List<PollResult> getResults() { return results; } @@ -159,37 +207,38 @@ poll = getPollService().getExistingPollByPollId(pollId); - if (poll == null) { - addFlashError(_("pollen.error.pollNotFound")); - } else { + if (byGroup == null) { - if (byGroup == null) { + // default byGroup value + byGroup = isGroupPoll(); + } - // default byGroup value - byGroup = isGroupPoll(); - } + String accountId = getAccountId(); - String accountId = getAccountId(); - if (poll.isPublicResults()) { - userAllowed = true; - } else if (StringUtils.isNotEmpty(accountId)) { + creatorUser = poll.getCreator().getAccountId().equals(accountId); - PollAccount creator = poll.getCreator(); - if (accountId.equals(creator.getAccountId())) { - userAllowed = true; - } - } + if (poll.isPublicResults()) { + userAllowed = true; + } else if (StringUtils.isNotEmpty(accountId)) { - if (!userAllowed) { - addFlashError(_("pollen.error.userNotAllowed")); + // create is allowed to be ther + userAllowed = creatorUser; - } else if (poll.isRunning(serviceContext.getCurrentTime())) { - addFlashWarning(_("pollen.information.pollRunning")); - loadResults(); +// PollAccount creator = poll.getCreator(); +// if (accountId.equals(creator.getAccountId())) { +// userAllowed = true; +// } + } - } else { - loadResults(); - } + if (!userAllowed) { + addFlashError(_("pollen.error.userNotAllowed")); + + } else if (poll.isRunning(serviceContext.getCurrentTime())) { + addFlashWarning(_("pollen.information.pollRunning")); + loadResults(); + + } else { + loadResults(); } return SUCCESS; Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/SavePoll.java =================================================================== --- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/SavePoll.java 2012-06-03 15:40:54 UTC (rev 3416) +++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/SavePoll.java 2012-06-03 19:26:50 UTC (rev 3417) @@ -265,11 +265,11 @@ if (isEdit()) { getPollService().updatePoll(poll); - addFlashMessage(_("pollen.information.poll.updated")); + addFlashMessage(_("pollen.information.poll.updated", poll.getTitle())); } else { getPollService().createPoll(poll); - addFlashMessage(_("pollen.information.poll.created")); + addFlashMessage(_("pollen.information.poll.created", poll.getTitle())); } // remove all stuff from session Added: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/ChangeLang.java =================================================================== --- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/ChangeLang.java (rev 0) +++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/ChangeLang.java 2012-06-03 19:26:50 UTC (rev 3417) @@ -0,0 +1,67 @@ +/* + * #%L + * Pollen :: UI (struts2) + * $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% + */ +package org.chorem.pollen.ui.actions.user; + +import org.chorem.pollen.ui.actions.PollenActionSupport; + +/** + * To change lang and redirect to current page. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.4 + */ +public class ChangeLang extends PollenActionSupport { + + private static final long serialVersionUID = 1L; + + /** + * Where to redirect after having chang lang. + * + * @since 1.4 + */ + protected String redirectUrl; + + public String getRedirectUrl() { + return redirectUrl; + } + + public void setRedirectUrl(String redirectUrl) { + this.redirectUrl = redirectUrl; + } + + @Override + public String execute() throws Exception { + String result; + if (redirectUrl == null || redirectUrl.contains("/security")) { + + // After security problem, redirect to home + result = Login.HOME; + + } else { + + // Stay on the same page identified by redirectUrl + result = SUCCESS; + } + return result; + } +} Property changes on: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/ChangeLang.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/Login.java =================================================================== --- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/Login.java 2012-06-03 15:40:54 UTC (rev 3416) +++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/Login.java 2012-06-03 19:26:50 UTC (rev 3417) @@ -39,7 +39,7 @@ private static final long serialVersionUID = 1L; - private static final String HOME = "home"; + public static final String HOME = "home"; protected String login; Modified: trunk/pollen-ui-struts2/src/main/resources/config/struts-user.xml =================================================================== --- trunk/pollen-ui-struts2/src/main/resources/config/struts-user.xml 2012-06-03 15:40:54 UTC (rev 3416) +++ trunk/pollen-ui-struts2/src/main/resources/config/struts-user.xml 2012-06-03 19:26:50 UTC (rev 3417) @@ -32,6 +32,20 @@ <package name="user" extends="default" namespace="/user"> + <!-- change lang--> + <action name="changeLang" method="execute" + class="org.chorem.pollen.ui.actions.user.ChangeLang"> + + <result name="home" type="redirectToHome"/> + <result type="redirect2"/> + + <interceptor-ref name="i18nStack"/> + <!-- remove the request_locale parameter from request --> + <interceptor-ref name="paramRemover"> + <param name="paramNames">request_locale</param> + </interceptor-ref> + </action> + <!-- login --> <action name="login" class="org.chorem.pollen.ui.actions.user.Login"> <result name="home" type="redirectToHome"/> @@ -134,6 +148,16 @@ <result type="redirect2"/> </action> + <!-- attach poll to the connected user account --> + <action name="attachPoll" + class="org.chorem.pollen.ui.actions.poll.AttachPoll"> + <result name="input">/WEB-INF/jsp/user/createdList.jsp</result> + <result type="redirectAction"> + <param name="namespace">/user</param> + <param name="actionName">createdList</param> + </result> + </action> + <!-- display createds polls --> <action name="createdList" class="org.chorem.pollen.ui.actions.poll.CreatedList"> 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-06-03 15:40:54 UTC (rev 3416) +++ trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-06-03 19:26:50 UTC (rev 3417) @@ -1,10 +1,13 @@ email=E-mail +poll.help.attachPoll=To reattach a poll created anonymously to your user account. +poll.help.pollId=Poll id can be found at different place\:<br/><br/>- Inside the email send after poll creation (since version 1.4)<br/><br/>- On resume page after poll creation or modification (since version 1.4)<br/><br/>,- On any url to access the poll actions (administration, vote, result). pollen.action.addChoice=Add choice pollen.action.addComment=Add a comment pollen.action.addPersonListFromVotingList=Add voters from a favorite list pollen.action.addPersonToList=Add a voter pollen.action.addVotingList=Add a group pollen.action.addVotingListFromPersonList=Add a group from a favorite list +pollen.action.attachPoll=Attach poll pollen.action.backToFavoriteLists=Back to favorite lists pollen.action.cancel=Cancel pollen.action.clone=Clone poll @@ -21,7 +24,7 @@ pollen.action.deleteUser=Delete selected user pollen.action.deleteVote=Supprimer ce vote pollen.action.editFavoriteList=Edit a list -pollen.action.editPoll=Edit the pollLes deux mots de passe saisis non identiques +pollen.action.editPoll=Edit the poll pollen.action.editPollAccount=Edit selected member pollen.action.editUser=Edit selected user pollen.action.editVote=Modifier le vote @@ -98,6 +101,7 @@ pollen.common.personList=Voting lists pollen.common.personToList=Voter pollen.common.pollCreator=Creator +pollen.common.pollId=Poll id pollen.common.pollOption.anonymous=Anonymous pollen.common.pollOption.anonymous.help=Voting persons and their votes are anonymous pollen.common.pollOption.anonymousVoteAllowed=Anonymous vote allowed @@ -181,7 +185,9 @@ pollen.error.poll.votingList.weight.not.valid=The group's weight is not valid (must be greater than 0) pollen.error.pollAccount.not.found=Poll account not found pollen.error.pollAccount.votingId.required=Name mandatory -pollen.error.pollNotFound=The poll you want to count does not exist. +pollen.error.pollAlreadyAttached=The poll is already attached to another user account +pollen.error.pollId.empty=Poll id is mandatory +pollen.error.pollNotFound=The poll with given id does not exist. pollen.error.pollTabErrorFound=Some errors were found on this tab, please fix them to finalize the poll creation. pollen.error.user.alreadyVoted=Someone has already used the name %s to vote. pollen.error.user.bad.login.or.password=Login or password invalid. @@ -210,10 +216,9 @@ pollen.fieldset.userInformation.toDelete=User informations to delete pollen.fieldset.userInformation.toUpdate=User informations to update pollen.image.not.loaded=Image not loaded -pollen.info.choice.deleted=Choice deleted -pollen.info.comment.added=Comment added -pollen.info.comment.deleted=Comment deleted -pollen.info.vote.deleted=Vote deleted +pollen.information.choice.deleted=Choice deleted. +pollen.information.comment.added=Comment added. +pollen.information.comment.deleted=Comment deleted. pollen.information.confirmClonePoll=Confirm clone of poll\: pollen.information.confirmClosePoll=Confirm close of poll\: pollen.information.confirmDeleteFavoriteList=Confirm delete of favorite list\: @@ -228,13 +233,14 @@ pollen.information.lostPassword=You will receive a new password to the given email pollen.information.lostPassword.success=An e-mail was sent with your new password. You can change it on your user account page. pollen.information.need.login=You must be logged to access this page. Please fill the form below. -pollen.information.poll.closed=Poll closed -pollen.information.poll.created=Poll created +pollen.information.poll.attached=Poll '%s' attached to your user account. +pollen.information.poll.closed=Poll '%s' closed. +pollen.information.poll.created=Poll '%s' created. pollen.information.poll.form.voteStarted=Votes are started, some options can't be updated. -pollen.information.poll.updated=Poll modified -pollen.information.pollAccount.addedTofavoriteList=Member '%s was added to favorite list. -pollen.information.pollAccount.removedFromFavoriteList=Member %s was removed from favorite list. -pollen.information.pollAccount.updatedTofavoriteList=Member %s was updated in favorite list. +pollen.information.poll.updated=Poll '%s' modified. +pollen.information.pollAccount.addedTofavoriteList=Member '%s' was added to favorite list. +pollen.information.pollAccount.removedFromFavoriteList=Member '%s' was removed from favorite list. +pollen.information.pollAccount.updatedTofavoriteList=Member '%s' was updated in favorite list. pollen.information.pollChoiceRunning=Adding choices is allowed. pollen.information.pollClosed=This poll is closed. You can not vote anymore. pollen.information.pollFinished=This poll is finished. You can not vote anymore. @@ -244,15 +250,17 @@ pollen.information.user.deleted=User %s deleted. pollen.information.user.updated=User %s updated. pollen.information.vote.created=Vote saved -pollen.information.vote.createdWithUpdateUrl=Vote saved, you can modify it using this address \: <br/> <a href\="%1$s">%1$s</a> +pollen.information.vote.createdWithUpdateUrl=Vote saved, you can modify it using this address\: <br/> <a href\="%1$s">%1$s</a> pollen.information.vote.creatorUser=You are identified as the poll's creator. You can't vote with this URL. +pollen.information.vote.deleted=Vote deleted. pollen.information.your.are.loggued=You are logged. pollen.label.contact.administrator=Send an email to an administrator -pollen.label.pollEditPage=The link below leads to the page to modify your poll. Save it to be able to modify your poll later if you need it or to close it \: -pollen.label.pollModerateVotePage=The link below leads to the page to vote for your poll. This access is available only for you as poll's creator \: +pollen.label.pollEditPage=<strong>To modify your poll</strong>. Save it to be able to modify your poll later if you need it or to close it\: +pollen.label.pollModerateVotePage=<strong>To moderate your poll (you can't vote from this url)</strong>. Save it to be able to delete votes and comments\: pollen.label.pollRegisterPage=If you are a logged user, you can find these links on the page -pollen.label.pollResultPage=The link below leads to the page to count the votes. Save it to be able to count the vote later \: -pollen.label.pollVotePage=The link below leads to the page to vote for your poll. Save it and send it to the people that you want to vote \: +pollen.label.pollResultPage=The link below leads to the page to count the votes. Save it to be able to count the vote later\: +pollen.label.pollVotePage=<strong>To vote on your poll</strong>. Save it and send it to the people that you want to vote\: +pollen.legend.attachPoll=Attach an anonymous poll to your user account pollen.legend.login=Login pollen.legend.select.favoriteList.to.add=Sélectionner la liste de favoris à ajouter pollen.legend.select.personList.to.create.votingList=Sélectionner la liste des votant à importer dans le nouveau groupe 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-06-03 15:40:54 UTC (rev 3416) +++ trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-06-03 19:26:50 UTC (rev 3417) @@ -1,10 +1,13 @@ email=E-mail +poll.help.attachPoll=Pour rattacher un sondage précedemment créé (sans être connecté) à son compte utilisateur. +poll.help.pollId=L'identifiant du sondage peut être retrouvé à différents endroits\:<br/><br/>- dans le courriel qui vous a été envoyé suite à la création du sondage (à partir de la version 1.4)<br/><br/>- sur la page de résumé du sondage après sa création ou modification (à partir de la version 1.4)<br/><br/>- Ou encore dans les urls d'accès au sondage (administration, vote, résultat). pollen.action.addChoice=Ajouter un choix pollen.action.addComment=Ajouter un commentaire pollen.action.addPersonListFromVotingList=Ajouter des votants à partir d'une liste de votants pollen.action.addPersonToList=Ajouter un votant pollen.action.addVotingList=Ajouter un groupe pollen.action.addVotingListFromPersonList=Ajouter un groupe à partir d'une liste de votants +pollen.action.attachPoll=Attacher le sondage pollen.action.backToFavoriteLists=Retour à la liste des favoris pollen.action.cancel=Annuler pollen.action.clone=Cloner le sondage @@ -98,6 +101,7 @@ pollen.common.personList=Liste de votants pollen.common.personToList=Votant pollen.common.pollCreator=Créateur +pollen.common.pollId=Identifiant du sondage pollen.common.pollOption.anonymous=Sondage anonyme pollen.common.pollOption.anonymous.help=Les votants ainsi que leurs votes sont anonymes pollen.common.pollOption.anonymousVoteAllowed=Autoriser le vote anonyme @@ -181,7 +185,9 @@ pollen.error.poll.votingList.weight.not.valid=Poids du groupe votant non valide (doit être une nombre supérieur à 0). pollen.error.pollAccount.not.found=Membre non trouvé pollen.error.pollAccount.votingId.required=Nom obliqatoire -pollen.error.pollNotFound=Le sondage que vous voulez dépouiller n'existe pas. +pollen.error.pollAlreadyAttached=Le sondage est déjà attaché à un autre compte utilisateur +pollen.error.pollId.empty=L'identifiant du sondage est obligatoire +pollen.error.pollNotFound=Il n'existe pas de sondage avec cet identifiant. pollen.error.pollTabErrorFound=Des erreurs ont été detectées dans cet onglet, veuillez les corriger pour valider la création du sondage. pollen.error.user.alreadyVoted=Une personne a déjà voté sous le nom %s. pollen.error.user.bad.login.or.password=Mauvais identifiant ou mot de passe. @@ -210,10 +216,9 @@ pollen.fieldset.userInformation.toDelete=Informations de l'utilisateur à supprimer pollen.fieldset.userInformation.toUpdate=Informations de l'utilisateur à mettre à jour pollen.image.not.loaded=Image non chargée -pollen.info.choice.deleted=Choix supprimé -pollen.info.comment.added=Commentaire ajouté -pollen.info.comment.deleted=Commentaire supprimé -pollen.info.vote.deleted=Vote supprimé +pollen.information.choice.deleted=Choix supprimé. +pollen.information.comment.added=Commentaire ajouté. +pollen.information.comment.deleted=Commentaire supprimé. pollen.information.confirmClonePoll=Confirmer le clonage du sondage \: pollen.information.confirmClosePoll=Confirmer la fermeture du sondage \: pollen.information.confirmDeleteFavoriteList=Confirmer la suppression de la liste de votants \: @@ -228,10 +233,11 @@ pollen.information.lostPassword=Vous allez recevoir un nouveau mot de passe sur l'e-mail suivant pollen.information.lostPassword.success=Un e-mail vous a été envoyé avec votre nouveau mot de passe. Vous pouvez le changer sur la page d'édition de votre compte. pollen.information.need.login=Vous devez être identifié pour pouvoir accéder à cette page. Veuillez remplir le formulaire ci-dessous. -pollen.information.poll.closed=Sondage clos -pollen.information.poll.created=Sondage créé +pollen.information.poll.attached=Sondage '%s' rattaché à votre compte. +pollen.information.poll.closed=Sondage '%s' clos. +pollen.information.poll.created=Sondage '%s' créé. pollen.information.poll.form.voteStarted=Les votes ont commencé, certaines options ne sont pas modifiables. -pollen.information.poll.updated=Sondage mise à jour +pollen.information.poll.updated=Sondage '%s' mise à jour. pollen.information.pollAccount.addedTofavoriteList=Le membre %s a été ajoutée à la liste des favoris. pollen.information.pollAccount.removedFromFavoriteList=Le membre %s a été supprimé de la liste des favoris. pollen.information.pollAccount.updatedTofavoriteList=Le membre %s a été mise à jour dans la liste des favoris. @@ -246,13 +252,15 @@ pollen.information.vote.created=Vote enregistré pollen.information.vote.createdWithUpdateUrl=Vote enregistré, vous pourrez le modifier à l'adresse suivante \: <br/> <a href\="%1$s">%1$s</a> pollen.information.vote.creatorUser=Vous êtes identifié comme le créateur du sondage. Vous ne pouvez pas voter avec cette URL. +pollen.information.vote.deleted=Vote supprimé. pollen.information.your.are.loggued=Vous êtes connecté. pollen.label.contact.administrator=Contacter un administrateur -pollen.label.pollEditPage=Le lien ci-dessous mène à la page de modification du sondage. Enregistrez-le pour pouvoir modifier votre sondage au besoin ou le clore \: -pollen.label.pollModerateVotePage=Le lien ci-dessous mène à la page de vote. Cet accès n'est valable que pour vous en tant que créateur du sondage \: +pollen.label.pollEditPage=<strong>Lien pour configurer le sondage</strong>. Enregistrez-le pour pouvoir modifier votre sondage au besoin ou le clore \: +pollen.label.pollModerateVotePage=<strong>Lien pour modérer le sondage (ce lien ne permet pas de voter)</strong>. Enregistrez-le pour pouvoir supprimer des votes et commentaires \: pollen.label.pollRegisterPage=Si vous êtes un utilisateur identifié, vous pouvez retrouver ces liens dans la page pollen.label.pollResultPage=Le lien ci-dessous mène à la page de dépouillement. Enregistrez-le pour pouvoir accéder au dépouillement plus tard \: -pollen.label.pollVotePage=Le lien ci-dessous mène à la page de vote. Enregistrez-le et envoyez-le à ceux que vous voulez voir voter \: +pollen.label.pollVotePage=<strong>Lien pour voter</strong>. Enregistrez-le et envoyez-le à ceux que vous voulez voir voter \: +pollen.legend.attachPoll=Attacher un sondage anonyme à votre compte pollen.legend.login=Login pollen.legend.select.favoriteList.to.add=Sélectionner la liste de favoris à ajouter pollen.legend.select.personList.to.create.votingList=Sélectionner la liste des votant à importer dans le nouveau groupe Modified: trunk/pollen-ui-struts2/src/main/resources/shiro.ini =================================================================== --- trunk/pollen-ui-struts2/src/main/resources/shiro.ini 2012-06-03 15:40:54 UTC (rev 3416) +++ trunk/pollen-ui-struts2/src/main/resources/shiro.ini 2012-06-03 19:26:50 UTC (rev 3417) @@ -22,6 +22,7 @@ # anon urls /user/login=anon +/user/changeLang=anon /user/register**=anon /user/lostPassword**=anon Modified: trunk/pollen-ui-struts2/src/main/resources/struts.xml =================================================================== --- trunk/pollen-ui-struts2/src/main/resources/struts.xml 2012-06-03 15:40:54 UTC (rev 3416) +++ trunk/pollen-ui-struts2/src/main/resources/struts.xml 2012-06-03 19:26:50 UTC (rev 3417) @@ -135,19 +135,6 @@ <interceptor-ref name="basicStack"/> </action> - <!-- change lang--> - <action name="changeLang" - class="org.chorem.pollen.ui.actions.PollenActionSupport"> - - <result type="redirectToHome"/> - - <interceptor-ref name="i18nStack"/> - <!-- remove the request_locale parameter from request --> - <interceptor-ref name="paramRemover"> - <param name="paramNames">request_locale</param> - </interceptor-ref> - </action> - </package> <package name="security" extends="default" namespace="/security"> Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators/layout-default.jsp =================================================================== --- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators/layout-default.jsp 2012-06-03 15:40:54 UTC (rev 3416) +++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators/layout-default.jsp 2012-06-03 19:26:50 UTC (rev 3417) @@ -78,11 +78,13 @@ <img src="<s:url value='/img/contact.png' />" alt="Contact"/> </s:a> | <%=PollenActionSupport.getCurrentDateTime()%> | - <s:a action="changeLang" id="localeFr"> + <s:a action="changeLang" namespace="/user" id="localeFr"> <s:param name="request_locale">fr_FR</s:param> + <s:param name="redirectUrl" value="%{currentUrl}"/> <img src="<s:url value='/img/fr.png' />" alt="Français"/> - </s:a> | <s:a action="changeLang" id="localeEn"> + </s:a> | <s:a action="changeLang" namespace="/user" id="localeEn"> <s:param name="request_locale">en_GB</s:param> + <s:param name="redirectUrl" value="%{currentUrl}"/> <img src="<s:url value='/img/en.png' />" alt="English"/> </s:a> </div> Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/result.jsp =================================================================== --- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/result.jsp 2012-06-03 15:40:54 UTC (rev 3416) +++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/result.jsp 2012-06-03 19:26:50 UTC (rev 3417) @@ -29,15 +29,8 @@ <script type="text/javascript"> - <%--function displayNormalChartUrl(type) {--%> - <%--var url = "<s:url value='%{getNormalPollResultChartUrl(400, 300)}' escapeAmp='false'/>&type=" + type;--%> - <%--$('#normalChartImg').attr('src', url);--%> - <%--return false;--%> - <%--}--%> - function displayCharts(type) { $.each(chartUrls, function (key, value) { - console.info("display url [" + key + "] : " + value); var url = value + "&type=" + type; $('#' + key).attr("src", url); }); @@ -73,6 +66,13 @@ <fieldset> <legend><s:text name="pollen.common.aboutPoll"/></legend> <div style="float: right"> + <s:if test="creatorUser or userAdmin"> + <s:a namespace="/poll" action="modification/%{uriId}"> + <img src="<s:url value='/img/editSmall.png'/>" + title="<s:text name='pollen.action.editPoll'/>" + alt="<s:text name='pollen.action.editPoll'/>"/> + </s:a> + </s:if> <s:a namespace="/poll" action="votefor/%{uriId}"> <img src="<s:url value='/img/vote.png'/>" title="<s:text name="pollen.common.vote.return-help"/>" Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/resultLink.jsp =================================================================== --- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/resultLink.jsp 2012-06-03 15:40:54 UTC (rev 3416) +++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/resultLink.jsp 2012-06-03 19:26:50 UTC (rev 3417) @@ -34,14 +34,13 @@ style="margin-right: 18px;"/> <s:text name='pollen.label.pollResultPage'/> <br/> - <s:set name="resultUrl" value="%{pollResultUrl}"/> - <s:a href="%{resultUrl}" cssStyle="margin-left:50px;"> - <s:property value="resultUrl"/> + <s:a href="%{pollResultUrl}" cssStyle="margin-left:50px;"> + <s:property value="%{pollResultUrl}"/> </s:a> </div> <div style="margin-top: 30px;"> <s:text name="pollen.label.pollRegisterPage"/> - <s:a namespace="/user" action="myPolls"> + <s:a namespace="/user" action="createdList"> <s:text name="pollen.common.myPolls"/> </s:a>. </div> \ No newline at end of file Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/resume.jsp =================================================================== --- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/resume.jsp 2012-06-03 15:40:54 UTC (rev 3416) +++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/resume.jsp 2012-06-03 19:26:50 UTC (rev 3417) @@ -23,44 +23,49 @@ --%> <%@ page language="java" contentType="text/html" pageEncoding="utf-8" %> <%@ taglib prefix="s" uri="/struts-tags" %> +<link rel="stylesheet" type="text/css" href="<s:url value='/css/resume.css'/>"/> + <h1 class="titleCreation"><s:property value="poll.title"/></h1> <h3><s:property value="poll.title"/> <s:text name="pollen.common.by"/> <s:property value="poll.creator.votingId"/></h3> +<div class="ui-widget-content ui-corner-all"> + + <s:label key="pollen.common.pollId" value="%{poll.pollId}"/> + <br/> +</div> + <s:if test="freePoll"> - <div style="margin-top: 10px;"> + <div class="ui-widget-content-green ui-corner-all"> <img src="<s:url value='/img/vote.png'/>" alt="<s:text name='pollen.common.voteAction'/>" style="margin-right: 18px;"/> - <s:property value="pollen.label.pollVotePage"/> + <s:text name="pollen.label.pollVotePage"/> <br/> - <s:set name="voteUrl" value="%{pollVoteUrl}"/> - <s:a href="%{voteUrl}" cssStyle="margin-left:50px;"> - <s:property value="voteUrl"/> + <s:a href="%{pollVoteUrl}" cssStyle="margin-left:50px;"> + <s:property value="%{pollVoteUrl}"/> </s:a> </div> </s:if> -<div style="margin-top: 10px;"> +<div class="ui-widget-content-yellow ui-corner-all"> <img src="<s:url value='/img/moderate.png'/>" alt="<s:text name='pollen.action.pollModerateVote'/>" style="margin-right: 20px;"/> <s:text name='pollen.label.pollModerateVotePage'/> <br/> - <s:set name="moderateUrl" value="%{pollModerateUrl}"/> - <s:a href="%{moderateUrl}" cssStyle="margin-left:50px;"> - <s:property value="moderateUrl"/> + <s:a href="%{pollModerateUrl}" cssStyle="margin-left:50px;"> + <s:property value="%{pollModerateUrl}"/> </s:a> </div> -<div style="margin-top: 10px;"> +<div class="ui-widget-content ui-corner-all"> <img src="<s:url value='/img/edit.png'/>" alt="<s:text name='pollen.common.editAction'/>" style="margin-right: 20px;"/> <s:text name='pollen.label.pollEditPage'/> <br/> - <s:set name="editUrl" value="%{pollEditUrl}"/> - <s:a href="%{editUrl}" cssStyle="margin-left:50px;"> - <s:property value="editUrl"/> + <s:a href="%{pollEditUrl}" cssStyle="margin-left:50px;"> + <s:property value="%{pollEditUrl}"/> </s:a> </div> <div style="margin-top: 30px;"> Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp =================================================================== --- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp 2012-06-03 15:40:54 UTC (rev 3416) +++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp 2012-06-03 19:26:50 UTC (rev 3417) @@ -113,12 +113,18 @@ <fieldset> <legend><s:text name="pollen.common.aboutPoll"/></legend> <div style="float: right"> + <s:if test="creatorUser or userAdmin"> + <s:a namespace="/poll" action="modification/%{uriId}"> + <img src="<s:url value='/img/editSmall.png'/>" + title="<s:text name='pollen.action.editPoll'/>" + alt="<s:text name='pollen.action.editPoll'/>"/> + </s:a> + </s:if> <s:if test="poll.publicResults"> - <s:a namespace="/poll" action="results/%{uriId}"> <img src="<s:url value='/img/count.png'/>" - title="<s:text name="pollen.common.vote.results-help"/>" - alt="<s:text name="pollen.common.vote.results"/>"/> + title="<s:text name='pollen.common.vote.results-help'/>" + alt="<s:text name='pollen.common.vote.results'/>"/> </s:a> </s:if> <s:if test="feedFileExisting"> Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/createdList.jsp =================================================================== --- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/createdList.jsp 2012-06-03 15:40:54 UTC (rev 3416) +++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/createdList.jsp 2012-06-03 19:26:50 UTC (rev 3417) @@ -25,10 +25,25 @@ <%@ taglib prefix="s" uri="/struts-tags" %> <%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags" %> +<link rel="stylesheet" type="text/css" href="<s:url value='/css/tipTip.css'/>"/> + +<style type="text/css"> + legend { + color: #727a7e; + font-weight: bold; + } +</style> +<script type="text/javascript" + src='<s:url value="/js/jquery.tipTip.minified.js"/>'></script> + <script type="text/javascript"> -var redirectUrl = '<s:url namespace="/user" action="createdList"/>'; + var redirectUrl = '<s:url namespace="/user" action="createdList"/>'; + $(function(){ + $('img[src$="tooltip.png"]').addClass('tooltip'); + $(".tooltip").tipTip(); + }); </script> -<%@include file="/WEB-INF/jsp/pollListHelper.jsp"%> +<%@include file="/WEB-INF/jsp/pollListHelper.jsp" %> <title><s:text name="pollen.title.pollsCreatedList"/></title> @@ -36,7 +51,8 @@ <h4><s:text name="pollen.title.pollsCreatedList.legend"/></h4> -<s:url id="loadUrl" action="getCreatedPolls" namespace="/json" escapeAmp="false"/> +<s:url id="loadUrl" action="getCreatedPolls" namespace="/json" + escapeAmp="false"/> <sjg:grid id="polls" dataType="json" href="%{loadUrl}" gridModel="polls" sortable="true" pager="true" pagerButtons="true" pagerInput="true" @@ -49,11 +65,34 @@ rowList="10,15,20,50,100" rowNum="10"> <sjg:gridColumn name="id" title="id" hidden="true"/> - <sjg:gridColumn name="title" title='%{getText("pollen.common.title")}' /> - <sjg:gridColumn name="description" title='%{getText("pollen.common.description")}'/> - <sjg:gridColumn name="addingChoices" title='%{getText("pollen.common.addingChoices")}'/> - <sjg:gridColumn name="beginDate" title='%{getText("pollen.common.beginDate")}'/> + <sjg:gridColumn name="title" title='%{getText("pollen.common.title")}'/> + <sjg:gridColumn name="description" + title='%{getText("pollen.common.description")}'/> + <sjg:gridColumn name="addingChoices" + title='%{getText("pollen.common.addingChoices")}'/> + <sjg:gridColumn name="beginDate" + title='%{getText("pollen.common.beginDate")}'/> <sjg:gridColumn name="endDate" title='%{getText("pollen.common.endDate")}'/> <sjg:gridColumn name="functions" title='%{getText("pollen.common.functions")}' formatter="pollFunctions" width="200" sortable="false"/> </sjg:grid> + +<br/> +<fieldset> + <legend><s:text name="pollen.legend.attachPoll"/> + <img src="<s:url value='/img/tooltip.png'/>" + title="<s:text name='poll.help.attachPoll'/>" + alt="<s:text name='poll.help.attachPoll'/>"/> + </legend> + + <s:form namespace="/user" method="POST"> + + <s:textfield key="pollUri" label='%{getText("pollen.common.pollId")}' + required="true" size="80" value='%{pollId}' + tooltip='%{getText("poll.help.pollId")}' + tooltipIconPath="/img/tooltip.png"/> + + <br/> + <s:submit action="attachPoll" key="pollen.action.attachPoll"/> + </s:form> +</fieldset> Added: trunk/pollen-ui-struts2/src/main/webapp/css/resume.css =================================================================== --- trunk/pollen-ui-struts2/src/main/webapp/css/resume.css (rev 0) +++ trunk/pollen-ui-struts2/src/main/webapp/css/resume.css 2012-06-03 19:26:50 UTC (rev 3417) @@ -0,0 +1,33 @@ +/* + * #%L + * Pollen :: UI (struts2) + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 CodeLutin, Tony Chemit + * %% + * 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% + */ +.ui-widget-content-green { border: 1px solid #aaaaaa; background: #b0f580 url(images/ui-bg_flat_75_b0f580_40x100.png) 50% 50% repeat-x; color: #222222; } +.ui-widget-content-green a { color: #222222; } + +.ui-widget-content-yellow { border: 1px solid #aaaaaa; background: #ffffaa url(images/ui-bg_flat_75_ffffaa_40x100.png) 50% 50% repeat-x; color: #222222; } +.ui-widget-content-yellow a { color: #222222; } + +.ui-corner-all { + margin-top: 10px; + padding: 10px; +} + Property changes on: trunk/pollen-ui-struts2/src/main/webapp/css/resume.css ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native
participants (1)
-
tchemit@users.chorem.org