r3145 - in branches/pollen-1.2.6-struts2: pollen-services/src/main/java/org/chorem/pollen/services pollen-services/src/main/java/org/chorem/pollen/services/exceptions pollen-services/src/main/java/org/chorem/pollen/services/impl pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll 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/jsp/poll pollen-ui-struts2/src/main
Author: tchemit Date: 2012-02-25 15:59:05 +0100 (Sat, 25 Feb 2012) New Revision: 3145 Url: http://chorem.org/repositories/revision/pollen/3145 Log: votefor page continue (show votes + delete choices + votes) Added: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollChoiceNotFoundException.java branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollVoteNotFoundException.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractPollUriIdAction.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeleteChoice.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeleteVote.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteChoice.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteVote.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ModifyVote.java 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/webapp/WEB-INF/jsp/poll/confirmDeletePollChoice.jsp branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmDeletePollComment.jsp branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmDeletePollVote.jsp Removed: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/Vote.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmDeletePollcomment.jsp Modified: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/PollenServiceSupport.java branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollService.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractVoteAction.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeleteComment.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteComment.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config/struts-poll.xml 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/resources/struts.xml 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/css/main.css Modified: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/PollenServiceSupport.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/PollenServiceSupport.java 2012-02-23 12:31:32 UTC (rev 3144) +++ branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/PollenServiceSupport.java 2012-02-25 14:59:05 UTC (rev 3145) @@ -87,7 +87,8 @@ D dao = PollenDAOHelper.getDAO(getTransaction(), entityType); return dao; } catch (TopiaException e) { - throw new PollenTechnicalException("Could not obtain dao of type " + entityType.getName(), e); + throw new PollenTechnicalException( + "Could not obtain dao of type " + entityType.getName(), e); } } @@ -95,10 +96,20 @@ try { return (T) dao.newInstance(); } catch (TopiaException e) { - throw new PollenTechnicalException("Could not obtain new instance from dao " + dao, e); + throw new PollenTechnicalException( + "Could not obtain new instance from dao " + dao, e); } } + protected <T extends TopiaEntity, D extends TopiaDAO<? super T>> void delete(D dao, T entity) { + try { + dao.delete(entity); + } catch (TopiaException e) { + throw new PollenTechnicalException("Could not delete entity " + + entity.getTopiaId(), e); + } + } + protected TopiaContext getTransaction() { return serviceContext.getTransaction(); } Added: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollChoiceNotFoundException.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollChoiceNotFoundException.java (rev 0) +++ branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollChoiceNotFoundException.java 2012-02-25 14:59:05 UTC (rev 3145) @@ -0,0 +1,34 @@ +/* + * #%L + * Pollen :: Services + * + * $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.services.exceptions; + +/** + * When a poll choice not found. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.2.6 + */ +public class PollChoiceNotFoundException extends Exception { + private static final long serialVersionUID = 1L; +} Property changes on: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollChoiceNotFoundException.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollVoteNotFoundException.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollVoteNotFoundException.java (rev 0) +++ branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollVoteNotFoundException.java 2012-02-25 14:59:05 UTC (rev 3145) @@ -0,0 +1,34 @@ +/* + * #%L + * Pollen :: Services + * + * $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.services.exceptions; + +/** + * When a pooll vote not found. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.2.6 + */ +public class PollVoteNotFoundException extends Exception { + private static final long serialVersionUID = 1L; +} Property changes on: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/exceptions/PollVoteNotFoundException.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollService.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollService.java 2012-02-23 12:31:32 UTC (rev 3144) +++ branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollService.java 2012-02-25 14:59:05 UTC (rev 3145) @@ -29,6 +29,8 @@ import org.apache.commons.logging.LogFactory; import org.chorem.pollen.PollenConfiguration; import org.chorem.pollen.PollenTechnicalException; +import org.chorem.pollen.business.persistence.Choice; +import org.chorem.pollen.business.persistence.ChoiceDAO; import org.chorem.pollen.business.persistence.PersonToList; import org.chorem.pollen.business.persistence.Poll; import org.chorem.pollen.business.persistence.PollAccount; @@ -39,14 +41,15 @@ import org.chorem.pollen.business.persistence.VoteDAO; import org.chorem.pollen.business.persistence.VotingList; import org.chorem.pollen.services.PollenServiceSupport; +import org.chorem.pollen.services.exceptions.PollChoiceNotFoundException; +import org.chorem.pollen.services.exceptions.PollNotFoundException; +import org.chorem.pollen.services.exceptions.PollVoteNotFoundException; import org.nuiton.topia.TopiaException; import org.nuiton.topia.framework.TopiaQuery; import org.nuiton.web.struts2.FilterPagerUtil; import java.util.List; -import static org.nuiton.i18n.I18n._; - public class PollService extends PollenServiceSupport { /** Logger. */ @@ -923,4 +926,60 @@ throw new PollenTechnicalException("Could not find poll with pollId " + pollId); } } + + public PollAccount getNewPollAccount(UserAccount userAccount) { + PollAccountDAO dao = getDAO(PollAccount.class); + PollAccount result = newInstance(dao); + if (userAccount != null) { + String displayName = userAccount.getDisplayName(); + result.setVotingId(displayName); + } + return result; + } + + public PollAccount getPollAccountByAccountId(String accountId) { + PollAccountDAO dao = getDAO(PollAccount.class); + try { + PollAccount result = dao.findByAccountId(accountId); + return result; + } catch (TopiaException e) { + throw new PollenTechnicalException("Could not botain account with this id", e); + } + } + + public void deleteVote(String pollId, String voteId) + throws PollNotFoundException, PollVoteNotFoundException { + + Poll poll = getPollByPollId(pollId); + + if (poll == null) { + throw new PollNotFoundException(); + } + Vote vote = poll.getVoteByTopiaId(voteId); + + if (vote == null) { + throw new PollVoteNotFoundException(); + } + + VoteDAO dao = getDAO(Vote.class); + delete(dao, vote); + } + + public void deleteChoice(String pollId, String choiceId) + throws PollNotFoundException, PollChoiceNotFoundException { + + Poll poll = getPollByPollId(pollId); + + if (poll == null) { + throw new PollNotFoundException(); + } + Choice choice = poll.getChoiceByTopiaId(choiceId); + + if (choice == null) { + throw new PollChoiceNotFoundException(); + } + + ChoiceDAO dao = getDAO(Choice.class); + delete(dao, choice); + } } Added: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractPollUriIdAction.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractPollUriIdAction.java (rev 0) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractPollUriIdAction.java 2012-02-25 14:59:05 UTC (rev 3145) @@ -0,0 +1,70 @@ +/* + * #%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% + */ +package org.chorem.pollen.ui.actions.poll; + +import org.apache.commons.lang3.StringUtils; +import org.chorem.pollen.ui.actions.PollenActionSupport; + +/** + * Abstract action for all actions with a poll uri id. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.2.6 + */ +public abstract class AbstractPollUriIdAction extends PollenActionSupport { + + private static final long serialVersionUID = 1L; + + /** Poll id (not topiaId but uuid, perharps we should use directly topiaId transformed to something smaller ?). */ + protected String pollId; + + /** Account id (not topiaId but uuid, perharps we should use directly topiaId transformed to something smaller ?). */ + protected String accountId; + + public final String getUriId() { + String result = pollId; + if (StringUtils.isNotEmpty(accountId)) { + result += ":" + accountId; + } + return result; + } + + public final void setUriId(String uriId) { + String[] split = uriId.split(":", 2); + if (split.length > 0) { + pollId = split[0]; + if (split.length > 1) { + accountId = split[1]; + } + } + } + + public final String getPollId() { + return pollId; + } + + public final String getAccountId() { + return accountId; + } +} Property changes on: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractPollUriIdAction.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractVoteAction.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractVoteAction.java 2012-02-23 12:31:32 UTC (rev 3144) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractVoteAction.java 2012-02-25 14:59:05 UTC (rev 3145) @@ -23,31 +23,52 @@ */ package org.chorem.pollen.ui.actions.poll; -import com.google.common.base.Preconditions; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.pollen.business.persistence.Choice; import org.chorem.pollen.business.persistence.Poll; +import org.chorem.pollen.business.persistence.PollAccount; import org.chorem.pollen.business.persistence.UserAccount; +import org.chorem.pollen.business.persistence.Vote; +import org.chorem.pollen.business.persistence.VoteToChoice; +import org.chorem.pollen.common.ChoiceType; +import org.chorem.pollen.common.PollType; import org.chorem.pollen.common.VoteCountingType; import org.chorem.pollen.services.exceptions.PollNotFoundException; import org.chorem.pollen.services.impl.PollFeedService; import org.chorem.pollen.services.impl.PollService; import org.chorem.pollen.ui.actions.PollenActionSupport; +import java.util.Date; + /** * Abstract action for actions on the vote poll page. * * @author tchemit <chemit@codelutin.com> * @since 1.2.6 */ -public abstract class AbstractVoteAction extends PollenActionSupport { +public abstract class AbstractVoteAction extends AbstractPollUriIdAction { private static final long serialVersionUID = 1L; - protected String pollId; + /** Logger. */ + private static final Log log = LogFactory.getLog(AbstractVoteAction.class); protected Poll poll; protected boolean feedFileExisting; + protected boolean creatorUser; + + protected boolean pollChoiceOrVoteStarted; + + protected boolean accountFieldDisplayed; + + protected boolean pollChoiceRunning; + + protected boolean pollRunning; + protected String voteCountingTypeHelp; protected String defaultCommentName; @@ -56,27 +77,45 @@ protected String commentName; + protected String voteSizeMessage; + + private PollAccount pollAccount; + + private String pollAccountId; + @Override public final String getPageLogo() { return "Vote"; } - public final String getPollId() { - return pollId; - } +// public final void setPollId(String pollId) { +// this.pollId = pollId; +// } +// +// public void setAccountId(String accountId) { +// this.accountId = accountId; +// } - public final void setPollId(String pollId) { - this.pollId = pollId; + public String getPollAccountId() { + return pollAccountId; } public final Poll getPoll() { return poll; } + public PollAccount getPollAccount() { + return pollAccount; + } + public final boolean isFeedFileExisting() { return feedFileExisting; } + public boolean isPollChoiceOrVoteStarted() { + return pollChoiceOrVoteStarted; + } + public final String getVoteCountingTypeHelp() { return voteCountingTypeHelp; } @@ -93,50 +132,264 @@ loadPoll(); - PollFeedService pollFeedService = newService(PollFeedService.class); + if (poll != null) { - feedFileExisting = pollFeedService.isFeedExists(poll); + loadPollAccount(); + PollFeedService pollFeedService = newService(PollFeedService.class); - VoteCountingType voteCountingType = poll.getVoteCountingType(); - switch (voteCountingType) { + feedFileExisting = pollFeedService.isFeedExists(poll); - case NORMAL: - voteCountingTypeHelp = - _("pollen.common.voteCountingTypeHelp.normal"); - break; - case PERCENTAGE: - voteCountingTypeHelp = - _("pollen.common.voteCountingTypeHelp.percentage"); - break; - case CONDORCET: - voteCountingTypeHelp = - _("pollen.common.voteCountingTypeHelp.condorcet"); - break; - case NUMBER: - voteCountingTypeHelp = - _("pollen.common.voteCountingTypeHelp.number"); - break; + VoteCountingType voteCountingType = poll.getVoteCountingType(); + switch (voteCountingType) { + + case NORMAL: + voteCountingTypeHelp = + _("pollen.common.voteCountingTypeHelp.normal"); + break; + case PERCENTAGE: + voteCountingTypeHelp = + _("pollen.common.voteCountingTypeHelp.percentage"); + break; + case CONDORCET: + voteCountingTypeHelp = + _("pollen.common.voteCountingTypeHelp.condorcet"); + break; + case NUMBER: + voteCountingTypeHelp = + _("pollen.common.voteCountingTypeHelp.number"); + break; + } + + // set default comment name + UserAccount userAccount = getPollenSession().getUserAccount(); + if (userAccount == null) { + defaultCommentName = ""; + } else { + defaultCommentName = userAccount.getDisplayName(); + } + + //TODO Fill this + Date currentTime = serviceContext.getCurrentTime(); + + accountFieldDisplayed = !poll.getAnonymous() || isRestrictedPoll() || isGroupPoll(); + + boolean choicestarted = poll.getBeginChoiceDate() == null || poll.getBeginChoiceDate().before(currentTime); + boolean choiceended = poll.getEndChoiceDate() != null && poll.getEndChoiceDate().before(currentTime); + boolean pollChoiceStarted = choicestarted && !choiceended; + + //TODO Move this is poll entity + pollChoiceOrVoteStarted = pollChoiceStarted || isPollStarted(); + + pollChoiceRunning = poll.getChoiceAddAllowed() && pollChoiceStarted; + + pollRunning = !(poll.getClosed() != null && poll.getClosed()) && + isPollStarted() && !isPollFinished(); + + //TODO Deal the case of the not loggued poll (using the pollAccountId + creatorUser = getPollenSession().getUserAccount() != null && + getPollenSession().getUserAccount().equals(poll.getCreator().getUserAccount()); + + if (log.isInfoEnabled()) { + log.info("pollChoiceOrVoteStarted = " + pollChoiceOrVoteStarted); + log.info("pollChoiceRunning = " + pollChoiceRunning); + log.info("pollRunning = " + pollRunning); + log.info("accountFieldDisplayed = " + accountFieldDisplayed); + log.info("creatorUser = " + creatorUser); + } + creatorName = poll.getCreator().getVotingId(); + + +// voteSizeMessage=XXX; } + } - // set default comment name - UserAccount userAccount = getPollenSession().getUserAccount(); - if (userAccount == null) { - defaultCommentName = ""; + protected void loadPollAccount() { + + PollService service = newService(PollService.class); + + if (StringUtils.isNotEmpty(getAccountId())) { + + pollAccount = service.getPollAccountByAccountId(getAccountId()); + + if (pollAccount != null) { + + pollAccountId = pollAccount.getAccountId(); + + } else { + + + //TODO Do something in case of none free poll ?, not normal :( + addActionError(_("pollen.error.accountNotFound")); + + if (!isFreePoll()) { + + //TODO Should not be able to see the page ? + } + } + } else { - defaultCommentName = userAccount.getDisplayName(); + pollAccount = service.getNewPollAccount(getPollenSession().getUserAccount()); } } + public String escapeLineBreak(String text) { + return text; + } + + /** + * Retourne si le choix fait partie du vote (s'il a été renseigné par le + * votant). + * + * @param choice le choix concerné + * @return true si le choix est dans le vote + */ + public boolean isChoiceInVote(VoteToChoice choice) { + boolean result = false; + if (choice != null) { + switch (poll.getVoteCountingType()) { + case NORMAL: + result = choice.getVoteValue() > 0; + break; + case PERCENTAGE: + result = true; + break; + case CONDORCET: + result = choice.getVoteValue() < 100; + break; + case NUMBER: + result = choice.getVoteValue() >= 0; + } + } + return result; + } + + public boolean isModifAllowed(Vote vote) { + + boolean result = false; + + // can only modify a vote if poll is running. + if (pollRunning) { + PollAccount votePollAccount = vote.getPollAccount(); + + // si le votant du vote correspond au votant actuel (pollAccountId) + if (pollAccountId != null + && pollAccountId.equals(votePollAccount.getAccountId())) { + result = true; + } + + UserAccount userAccount = getPollenSession().getUserAccount(); + + // si l'utilisateur du vote correspond à l'utilisateur actuel (user) + if (userAccount != null) { + UserAccount voteUserAccount = votePollAccount.getUserAccount(); + result = voteUserAccount != null && userAccount.getTopiaId().equals(voteUserAccount.getTopiaId()); + } + } + return result; + } + + public boolean isCreatorUser() { + return creatorUser; + } + + public boolean isAccountFieldDisplayed() { + return accountFieldDisplayed; + } + + public boolean isPollChoiceRunning() { + return pollChoiceRunning; + } + + public boolean isPollRunning() { + return pollRunning; + } + + public String getCreatorName() { + return creatorName; + } + + public String getVoteSizeMessage() { + return voteSizeMessage; + } + protected void loadPoll() throws PollNotFoundException { - Preconditions.checkNotNull(pollId); +// Preconditions.checkNotNull(pollId); PollService service = newService(PollService.class); - poll = service.getPollByPollId(pollId); + if (StringUtils.isNotEmpty(pollId)) { + poll = service.getPollByPollId(pollId); + } if (poll == null) { - throw new PollNotFoundException(); + addActionError(_("pollen.error.poll.notfound")); + } else { + if (poll.getClosed()) { + addActionMessage(_("pollen.information.pollClosed")); + } else if (!isPollStarted()) { + addActionMessage(_("pollen.information.pollNotStarted")); + } else if (isPollFinished()) { + addActionMessage(_("pollen.information.pollFinished")); + } + if (isPollChoiceRunning()) { + addActionMessage(_("pollen.information.pollChoiceRunning")); + } } } + + public boolean isDescNull(Choice choice) { + return StringUtils.isEmpty(choice.getDescription()); + } + + public boolean isFreePoll() { + return poll.getPollType() == PollType.FREE; + } + + public boolean isRestrictedPoll() { + return poll.getPollType() == PollType.RESTRICTED; + } + + public boolean isGroupPoll() { + return poll.getPollType() == PollType.GROUP; + } + + public boolean isTextType() { + return poll.getChoiceType() == ChoiceType.TEXT; + } + + public boolean isDateType() { + return poll.getChoiceType() == ChoiceType.DATE; + } + + public boolean isImageType() { + return poll.getChoiceType() == ChoiceType.IMAGE; + } + + public boolean isNormalVoteCounting() { + return poll.getVoteCountingType() == VoteCountingType.NORMAL; + } + + public boolean isPercentageVoteCounting() { + return poll.getVoteCountingType() == VoteCountingType.PERCENTAGE; + } + + public boolean isCondorcetVoteCounting() { + return poll.getVoteCountingType() == VoteCountingType.CONDORCET; + } + + public boolean isNumberVoteCounting() { + return poll.getVoteCountingType() == VoteCountingType.NUMBER; + } + + public boolean isPollStarted() { + Date now = serviceContext.getCurrentTime(); + return poll.getBeginDate() == null || poll.getBeginDate().before(now); + } + + public boolean isPollFinished() { + Date now = serviceContext.getCurrentTime(); + return poll.getEndDate() != null && poll.getEndDate().before(now); + } + } \ No newline at end of file Added: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeleteChoice.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeleteChoice.java (rev 0) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeleteChoice.java 2012-02-25 14:59:05 UTC (rev 3145) @@ -0,0 +1,69 @@ +/* + * #%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% + */ +package org.chorem.pollen.ui.actions.poll; + +import com.google.common.base.Preconditions; +import org.apache.commons.lang3.StringUtils; +import org.chorem.pollen.business.persistence.Choice; +import org.chorem.pollen.business.persistence.Poll; +import org.chorem.pollen.services.impl.PollService; +import org.chorem.pollen.ui.actions.PollenActionSupport; + +/** + * To confirm delete of a poll choice. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.2.6 + */ +public class ConfirmDeleteChoice extends AbstractPollUriIdAction { + + private static final long serialVersionUID = 1L; + + protected String choiceId; + + protected Choice choice; + + public void setChoiceId(String choiceId) { + this.choiceId = choiceId; + } + + public Choice getChoice() { + return choice; + } + + @Override + public String execute() throws Exception { + + Preconditions.checkNotNull(pollId); + Preconditions.checkNotNull(choiceId); + + PollService service = newService(PollService.class); + + Poll poll = service.getPollByPollId(pollId); + + choice = poll.getChoiceByTopiaId(choiceId); + + return SUCCESS; + } +} Property changes on: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeleteChoice.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeleteComment.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeleteComment.java 2012-02-23 12:31:32 UTC (rev 3144) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeleteComment.java 2012-02-25 14:59:05 UTC (rev 3145) @@ -35,7 +35,7 @@ * @author tchemit <chemit@codelutin.com> * @since 1.2.6 */ -public class ConfirmDeleteComment extends PollenActionSupport { +public class ConfirmDeleteComment extends AbstractPollUriIdAction { private static final long serialVersionUID = 1L; @@ -56,6 +56,7 @@ @Override public String execute() throws Exception { + Preconditions.checkNotNull(pollId); Preconditions.checkNotNull(commentId); PollCommentService service = newService(PollCommentService.class); Added: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeleteVote.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeleteVote.java (rev 0) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeleteVote.java 2012-02-25 14:59:05 UTC (rev 3145) @@ -0,0 +1,69 @@ +/* + * #%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% + */ +package org.chorem.pollen.ui.actions.poll; + +import com.google.common.base.Preconditions; +import org.apache.commons.lang3.StringUtils; +import org.chorem.pollen.business.persistence.Poll; +import org.chorem.pollen.business.persistence.Vote; +import org.chorem.pollen.services.impl.PollService; +import org.chorem.pollen.ui.actions.PollenActionSupport; + +/** + * To confirm delete of a poll vote + * + * @author tchemit <chemit@codelutin.com> + * @since 1.2.6 + */ +public class ConfirmDeleteVote extends AbstractPollUriIdAction { + + private static final long serialVersionUID = 1L; + + protected String voteId; + + protected Vote vote; + + public void setVoteId(String voteId) { + this.voteId = voteId; + } + + public Vote getVote() { + return vote; + } + + @Override + public String execute() throws Exception { + + Preconditions.checkNotNull(pollId); + Preconditions.checkNotNull(voteId); + + PollService service = newService(PollService.class); + + Poll poll = service.getPollByPollId(pollId); + + vote = poll.getVoteByTopiaId(voteId); + + return SUCCESS; + } +} Property changes on: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeleteVote.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteChoice.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteChoice.java (rev 0) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteChoice.java 2012-02-25 14:59:05 UTC (rev 3145) @@ -0,0 +1,58 @@ +/* + * #%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% + */ +package org.chorem.pollen.ui.actions.poll; + +import com.google.common.base.Preconditions; +import org.chorem.pollen.services.impl.PollService; + +/** + * To delete a poll choice + * + * @author tchemit <chemit@codelutin.com> + * @since 1.2.6 + */ +public class DeleteChoice extends AbstractPollUriIdAction { + + private static final long serialVersionUID = 1L; + + protected String choiceId; + + public void setChoiceId(String choiceId) { + this.choiceId = choiceId; + } + + @Override + public String execute() throws Exception { + + Preconditions.checkNotNull(pollId); + Preconditions.checkNotNull(choiceId); + + PollService service = newService(PollService.class); + + service.deleteChoice(pollId, choiceId); + getTransaction().commitTransaction(); + + return SUCCESS; + } +} Property changes on: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteChoice.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteComment.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteComment.java 2012-02-23 12:31:32 UTC (rev 3144) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteComment.java 2012-02-25 14:59:05 UTC (rev 3145) @@ -60,7 +60,7 @@ throw new PollCommentNotFound(); } - setPollId(comment.getPoll().getPollId()); + setUriId(getUriId()); service.deleteComment(commentId); Added: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteVote.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteVote.java (rev 0) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteVote.java 2012-02-25 14:59:05 UTC (rev 3145) @@ -0,0 +1,58 @@ +/* + * #%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% + */ +package org.chorem.pollen.ui.actions.poll; + +import com.google.common.base.Preconditions; +import org.chorem.pollen.services.impl.PollService; + +/** + * To delete a poll vote. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.2.6 + */ +public class DeleteVote extends AbstractPollUriIdAction { + + private static final long serialVersionUID = 1L; + + protected String voteId; + + public void setVoteId(String voteId) { + this.voteId = voteId; + } + + @Override + public String execute() throws Exception { + + Preconditions.checkNotNull(pollId); + Preconditions.checkNotNull(voteId); + + PollService service = newService(PollService.class); + + service.deleteVote(pollId, voteId); + getTransaction().commitTransaction(); + + return SUCCESS; + } +} Property changes on: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteVote.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ModifyVote.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ModifyVote.java (rev 0) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ModifyVote.java 2012-02-25 14:59:05 UTC (rev 3145) @@ -0,0 +1,50 @@ +/* + * #%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% + */ +package org.chorem.pollen.ui.actions.poll; + +/** + * TODO + * + * @author tchemit <chemit@codelutin.com> + * @since TODO + */ +public class ModifyVote extends AbstractVoteAction { + + private static final long serialVersionUID = 1L; + + + @Override + public String execute() throws Exception { + + + loadPoll(); + + + if (poll==null) { + + } + + return SUCCESS; + } +} Property changes on: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ModifyVote.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Deleted: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/Vote.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/Vote.java 2012-02-23 12:31:32 UTC (rev 3144) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/Vote.java 2012-02-25 14:59:05 UTC (rev 3145) @@ -1,59 +0,0 @@ -/* - * #%L - * Pollen :: UI (strust2) - * - * $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.opensymphony.xwork2.Preparable; - -/** - * Votes to a poll. - * - * @author tchemit <chemit@codelutin.com> - * @since 1.2.6 - */ -public class Vote extends AbstractVoteAction implements Preparable { - - private static final long serialVersionUID = 1L; - - @Override - public String input() throws Exception { - - //TODO DO me! - return INPUT; - } - - @Override - public String execute() throws Exception { - - //TODO Do me! - - return SUCCESS; - } - - @Override - public void prepare() throws Exception { - - prepareVotePage(); - commentName = getDefaultCommentName(); - } -} Copied: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/VoteForPoll.java (from rev 3144, branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/Vote.java) =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/VoteForPoll.java (rev 0) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/VoteForPoll.java 2012-02-25 14:59:05 UTC (rev 3145) @@ -0,0 +1,59 @@ +/* + * #%L + * Pollen :: UI (strust2) + * + * $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.opensymphony.xwork2.Preparable; + +/** + * Votes to a poll. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.2.6 + */ +public class VoteForPoll extends AbstractVoteAction implements Preparable { + + private static final long serialVersionUID = 1L; + + @Override + public String input() throws Exception { + + //TODO DO me! + return INPUT; + } + + @Override + public String execute() throws Exception { + + //TODO Do me! + + return SUCCESS; + } + + @Override + public void prepare() throws Exception { + + prepareVotePage(); + commentName = getDefaultCommentName(); + } +} Property changes on: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/VoteForPoll.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config/struts-poll.xml =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config/struts-poll.xml 2012-02-23 12:31:32 UTC (rev 3144) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config/struts-poll.xml 2012-02-25 14:59:05 UTC (rev 3145) @@ -36,9 +36,9 @@ <result-type name="redirectToVote" class="org.apache.struts2.dispatcher.ServletActionRedirectResult"> <param name="namespace">/poll</param> - <param name="actionName">vote</param> + <param name="actionName">votefor/${uriId}</param> <param name="method">input</param> - <param name="pollId">${pollId}</param> + <!--<param name="uriId">${uriId}</param>--> </result-type> </result-types> @@ -58,11 +58,19 @@ <!-- vote poll --> <action name="vote" - class="org.chorem.pollen.ui.actions.poll.Vote"> + class="org.chorem.pollen.ui.actions.poll.VoteForPoll"> <result name="input">/WEB-INF/jsp/poll/vote.jsp</result> <result>/WEB-INF/jsp/poll/vote.jsp</result> </action> + <!-- vote poll --> + <action name="votefor/*" + class="org.chorem.pollen.ui.actions.poll.VoteForPoll"> + <param name="uriId">{1}</param> + <result name="input">/WEB-INF/jsp/poll/vote.jsp</result> + <result>/WEB-INF/jsp/poll/vote.jsp</result> + </action> + <!-- clone poll --> <action name="clone" class="org.chorem.pollen.ui.actions.poll.Clone"> @@ -117,7 +125,7 @@ <!-- confirm delete comment --> <action name="confirmDeleteComment" class="org.chorem.pollen.ui.actions.poll.ConfirmDeleteComment"> - <result>/WEB-INF/jsp/poll/confirmDeletePollcomment.jsp</result> + <result>/WEB-INF/jsp/poll/confirmDeletePollComment.jsp</result> </action> <!-- add a poll comment --> @@ -143,6 +151,36 @@ </result> </action> + <!-- confirm delete poll vote --> + <action name="confirmDeleteVote" + class="org.chorem.pollen.ui.actions.poll.ConfirmDeleteVote"> + <result>/WEB-INF/jsp/poll/confirmDeletePollVote.jsp</result> + </action> + + <!-- delete poll vote --> + <action name="deleteVote" + class="org.chorem.pollen.ui.actions.poll.DeleteVote"> + <result type="redirectToVote"/> + </action> + + <!-- modify poll vote --> + <action name="modifyVote" + class="org.chorem.pollen.ui.actions.poll.ModifyVote"> + <result type="redirectToVote"/> + </action> + + <!-- confirm delete poll choice --> + <action name="confirmDeleteChoice" + class="org.chorem.pollen.ui.actions.poll.ConfirmDeleteChoice"> + <result>/WEB-INF/jsp/poll/confirmDeletePollChoice.jsp</result> + </action> + + <!-- delete poll choice --> + <action name="deleteChoice" + class="org.chorem.pollen.ui.actions.poll.DeleteChoice"> + <result type="redirectToVote"/> + </action> + </package> 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-02-23 12:31:32 UTC (rev 3144) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-02-25 14:59:05 UTC (rev 3145) @@ -13,12 +13,15 @@ pollen.action.createPollAccount=Add a new member pollen.action.createUser=Create a new user pollen.action.delete=Delete +pollen.action.deleteChoice=Delete the choice pollen.action.deleteFavoriteList=Delete a list pollen.action.deletePollAccount=Delete selected member pollen.action.deleteUser=Delete selected user +pollen.action.deleteVote=Supprimer ce vote pollen.action.editFavoriteList=Edit a list pollen.action.editPollAccount=Edit selected member pollen.action.editUser=Edit selected user +pollen.action.editVote=Modifier le vote pollen.action.login=Log me In pollen.action.modify=Modify pollen.action.pollClone=Copy the poll to create a new one @@ -77,6 +80,8 @@ pollen.common.voteCountingTypeHelp.normal=Normal vote\: vote for your favorite choice. pollen.common.voteCountingTypeHelp.number=Voting by number\: The answer is free, leave blank or enter a integer. pollen.common.voteCountingTypeHelp.percentage=Percentage vote\: allocate choices to get a 100%% total. +pollen.common.voterName=Votant +pollen.error.accountNotFound= pollen.error.comment.name.empty=Comment name mandatory pollen.error.comment.text.empty=Comment text mandatory pollen.error.email.required=You must provide an email @@ -91,6 +96,7 @@ pollen.error.password.required=Your must provide a password pollen.error.password2.required=You must repeat your password for confirmation pollen.error.passwords.not.equals=Les deux mots de passe saisis non identiques +pollen.error.poll.notfound=No such poll exists. Please make sure that you are using the correct link and copy it completely into your browser's address field. pollen.error.pollAccount.email.required=Em@il mandatory pollen.error.pollAccount.not.found=Poll account not found pollen.error.pollAccount.votingId.required=Name mandatory @@ -114,12 +120,18 @@ pollen.fieldset.userInformation.toCreate=User informations to create pollen.fieldset.userInformation.toDelete=User informations to delete pollen.fieldset.userInformation.toUpdate=User informations to update +pollen.information.confirmDeleteChoice=Confirm delete of choice %s +pollen.information.confirmDeleteVote=Confirm delete of vote for %s pollen.information.favoriteList.created=Favorite list %s created. pollen.information.favoriteList.deleted=Favorite list %s deleted. pollen.information.need.login=You must be logged to access this page. Please fill the form below. 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. +pollen.information.pollNotStarted=This poll has not started yet. pollen.information.user.created=User %s created. pollen.information.user.deleted=User %s deleted. pollen.information.user.updated=User %s updated. @@ -140,7 +152,9 @@ pollen.menu.register=Register pollen.menu.userFavoriteLists=Voting lists pollen.title.createPoll=New poll -pollen.title.delete.comment=Confirm to delete a poll comment +pollen.title.delete.pollChoice=Confirm to delete a poll choice +pollen.title.delete.pollComment=Confirm to delete a poll comment +pollen.title.delete.pollVote=Confirm to delete a poll vote pollen.title.editFavoriteList=Edition de la liste des favoris pollen.title.favoriteLists=Vos listes de votants pollen.title.myAccount=My account 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-02-23 12:31:32 UTC (rev 3144) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-02-25 14:59:05 UTC (rev 3145) @@ -13,12 +13,15 @@ pollen.action.createPollAccount=Ajouter une membre à la liste pollen.action.createUser=Créer un nouvel utilisateur pollen.action.delete=Supprimer +pollen.action.deleteChoice=Supprimer le choix pollen.action.deleteFavoriteList=Supprimer une liste sélectionnée pollen.action.deletePollAccount=Supprimer une membre de la liste pollen.action.deleteUser=Supprimer un utilisateur sélectionné +pollen.action.deleteVote=Supprimer ce vote pollen.action.editFavoriteList=Editer une liste sélectionnée pollen.action.editPollAccount=Editer le membre sélectionné pollen.action.editUser=Editer un utilisateur sélectionné +pollen.action.editVote=Modifier le vote pollen.action.login=M'identifier pollen.action.modify=Modifier pollen.action.pollClone=Créer un nouveau sondage à partir de celui-ci @@ -51,6 +54,7 @@ pollen.common.login=Identifiant pollen.common.name=Nom pollen.common.nbAccounts=Nombre de membres +pollen.common.nbVotes=vote-size\=%d votes ont été enregistrés pollen.common.newPassword=Nouveau mot de passe pollen.common.newPassword2=Répétez votre nouveau mot de passe pollen.common.or=ou @@ -77,7 +81,9 @@ pollen.common.voteCountingTypeHelp.normal=Vote normal \: voter pour le ou les choix préférés. pollen.common.voteCountingTypeHelp.number=Vote par nombre \: La réponse est libre, laissez vide ou entrez un nombre entier pollen.common.voteCountingTypeHelp.percentage=Vote par pourcentage \: répartir les choix de manière à obtenir 100%% au total. +pollen.common.voterName=Votant pollen.common.x=Dépouillement +pollen.error.accountNotFound= pollen.error.comment.name.empty=Nom du commentaire obligatoire pollen.error.comment.text.empty=Texte du commentaire obligatoire pollen.error.email.required=Courriel obligatoire @@ -92,6 +98,7 @@ pollen.error.password.required=Mot de passe obligatoire pollen.error.password2.required=Mot de passe répété obligatoire pollen.error.passwords.not.equals=Les deux mots de passe saisis non identiques +pollen.error.poll.notfound=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. pollen.error.pollAccount.email.required=Em@il obliqatoire pollen.error.pollAccount.not.found=Membre non trouvé pollen.error.pollAccount.votingId.required=Nom obliqatoire @@ -115,12 +122,18 @@ pollen.fieldset.userInformation.toCreate=Informations de l'utilisateur à créer pollen.fieldset.userInformation.toDelete=Informations de l'utilisateur à supprimer pollen.fieldset.userInformation.toUpdate=Informations de l'utilisateur à mettre à jour +pollen.information.confirmDeletePollChoice=Confirmer la suppression du chois %s +pollen.information.confirmDeletePollVote=Confirmer la suppression du vote de %s pollen.information.favoriteList.created=La liste %s a été créée. pollen.information.favoriteList.deleted=La liste %s a été supprimée. pollen.information.need.login=Vous devez être identifié pour pouvoir accéder à cette page. Veuillez remplir le formulaire ci-dessous. 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. +pollen.information.pollChoiceRunning=L'ajout de choix est possible. +pollen.information.pollClosed=Ce sondage est clos. Vous ne pouvez plus voter. +pollen.information.pollFinished=Ce sondage est terminé. Vous ne pouvez plus voter. +pollen.information.pollNotStarted=Ce sondage n'a pas encore commencé. pollen.information.user.created=L'utilisateur %s a été créé. pollen.information.user.deleted=L'utilisateur %s a été supprimé. pollen.information.user.updated=L'utilisateur %s a été mis à jour. @@ -141,7 +154,9 @@ pollen.menu.register=Inscrivez-vous pollen.menu.userFavoriteLists=Listes de votants pollen.title.createPoll=Nouveau sondage -pollen.title.delete.comment=Confirmer la suppresion d'un commentaire +pollen.title.delete.pollChoice=Confirmer la suppresion d'un choix +pollen.title.delete.pollComment=Confirmer la suppresion d'un commentaire +pollen.title.delete.pollVote=Confirmer la suppresion d'un vote pollen.title.editFavoriteList=Edition de la liste des favoris pollen.title.favoriteLists=Vos listes de votants pollen.title.myAccount=Mon compte Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/struts.xml =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/struts.xml 2012-02-23 12:31:32 UTC (rev 3144) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/struts.xml 2012-02-25 14:59:05 UTC (rev 3145) @@ -42,6 +42,7 @@ <constant name="struts.configuration.xml.reload" value="false"/> <constant name="struts.ui.theme" value="css_xhtml"/> <constant name="struts.multipart.maxSize" value="209715200"/> + <constant name="struts.enable.SlashesInActionNames" value="true"/> <!--Performance tuning--> <!--see http://struts.apache.org/2.2.3/docs/performance-tuning.html--> @@ -97,7 +98,33 @@ <!-- params stack with params--> <interceptor-stack name="pollenParamsPrepareParamsStack"> <interceptor-ref name="i18n"/> - <interceptor-ref name="paramsPrepareParamsStack"/> + <!--<interceptor-ref name="paramsPrepareParamsStack"/>--> + <interceptor-ref name="exception"/> + <interceptor-ref name="alias"/> + <interceptor-ref name="i18n"/> + <interceptor-ref name="checkbox"/> + <interceptor-ref name="multiselect"/> + <interceptor-ref name="params"> + <param name="excludeParams">dojo\..*,^struts\..*</param> + </interceptor-ref> + <interceptor-ref name="servletConfig"/> + <interceptor-ref name="staticParams"/> + <interceptor-ref name="prepare"/> + <interceptor-ref name="chain"/> + <interceptor-ref name="modelDriven"/> + <interceptor-ref name="fileUpload"/> + <!--<interceptor-ref name="staticParams"/>--> + <interceptor-ref name="actionMappingParams"/> + <interceptor-ref name="params"> + <param name="excludeParams">dojo\..*,^struts\..*</param> + </interceptor-ref> + <interceptor-ref name="conversionError"/> + <interceptor-ref name="validation"> + <param name="excludeMethods">input,back,cancel,browse</param> + </interceptor-ref> + <interceptor-ref name="workflow"> + <param name="excludeMethods">input,back,cancel,browse</param> + </interceptor-ref> <interceptor-ref name="store"> <param name="operationMode">STORE</param> </interceptor-ref> Added: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmDeletePollChoice.jsp =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmDeletePollChoice.jsp (rev 0) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmDeletePollChoice.jsp 2012-02-25 14:59:05 UTC (rev 3145) @@ -0,0 +1,44 @@ +<%-- + #%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% + --%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="s" uri="/struts-tags" %> + +<br/> +<s:form method="POST" namespace="/poll" action="deleteChoice"> + + <s:hidden key="uriId" label=''/> + <s:hidden key="choiceId" label=''/> + + <s:text name="pollen.information.confirmDeletePollChoice"> + <s:param> + <s:property value="%{choice.name}"/> + </s:param> + </s:text>. + + <hr/> + + <div class="cleanBoth"> + <s:submit key="pollen.action.delete" align="right"/> + </div> +</s:form> \ No newline at end of file Property changes on: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmDeletePollChoice.jsp ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmDeletePollComment.jsp (from rev 3144, branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmDeletePollcomment.jsp) =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmDeletePollComment.jsp (rev 0) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmDeletePollComment.jsp 2012-02-25 14:59:05 UTC (rev 3145) @@ -0,0 +1,47 @@ +<%-- + #%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% + --%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<br/> +<s:form method="POST" namespace="/poll" action="deleteComment"> + + <s:hidden name="uriId" value='%{uriId}'/> + + <s:hidden name="commentId" value='%{comment.topiaId}'/> + + <s:textfield key='comment.postDate' readonly="true" size="50" + label="%{getText('pollen.common.postDate')}"/> + + <s:textfield key='comment.pollAccount.votingId' readonly="true" size="50" + label="%{getText('pollen.common.commentName')}"/> + + <s:textarea key='comment.text' readonly="true" rows="3" + label="%{getText('pollen.common.commentText')}"/> + + <hr/> + + <div class="cleanBoth"> + <s:submit key="pollen.action.delete" align="right"/> + </div> +</s:form> \ No newline at end of file Property changes on: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmDeletePollComment.jsp ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmDeletePollVote.jsp =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmDeletePollVote.jsp (rev 0) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmDeletePollVote.jsp 2012-02-25 14:59:05 UTC (rev 3145) @@ -0,0 +1,43 @@ +<%-- + #%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% + --%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<br/> +<s:form method="POST" namespace="/poll" action="deleteVote"> + + <s:hidden key="uriId" label=''/> + <s:hidden key="voteId" label=''/> + + <s:text name="pollen.information.confirmDeletePollVote"> + <s:param> + <strong><s:property value="%{vote.pollAccount.votingId}"/></strong> + </s:param> + </s:text>. + + <hr/> + + <div class="cleanBoth"> + <s:submit key="pollen.action.delete" align="right"/> + </div> +</s:form> \ No newline at end of file Property changes on: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmDeletePollVote.jsp ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Deleted: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmDeletePollcomment.jsp =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmDeletePollcomment.jsp 2012-02-23 12:31:32 UTC (rev 3144) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmDeletePollcomment.jsp 2012-02-25 14:59:05 UTC (rev 3145) @@ -1,45 +0,0 @@ -<%-- - #%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% - --%> -<%@ page contentType="text/html;charset=UTF-8" language="java" %> -<%@ taglib prefix="s" uri="/struts-tags" %> - -<s:form method="POST" namespace="/poll" action="deleteComment"> - - <s:hidden name="pollId" value='%{comment.poll.pollId}'/> - - <s:hidden name="commentId" value='%{comment.topiaId}'/> - - <s:textfield key='comment.postDate' readonly="true" size="50" - label="%{getText('pollen.common.postDate')}"/> - - <s:textfield key='comment.pollAccount.votingId' readonly="true" size="50" - label="%{getText('pollen.common.commentName')}"/> - - <s:textarea key='comment.text' readonly="true" rows="3" - label="%{getText('pollen.common.commentText')}"/> - - <div class="cleanBoth"> - <s:submit key="pollen.action.delete" align="center"/> - </div> -</s:form> \ No newline at end of file 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-02-23 12:31:32 UTC (rev 3144) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp 2012-02-25 14:59:05 UTC (rev 3145) @@ -29,7 +29,7 @@ <script type="text/javascript" src="<s:url value='/js/gridHelper.js' />"></script> -<s:url id="deleteUrl" action="confirmDeleteComment" namespace="/poll"/> +<%--<s:url id="deleteCommentUrl" action="confirmDeleteComment" namespace="/poll"/>--%> <s:url id='deleteImg' value='/img/delete.png'/> <s:set id='deleteTitle'><s:text name="pollen.action.pollCommentDelete"/></s:set> @@ -43,7 +43,7 @@ var result = ""; if (cellvalue.indexOf('delete') > -1) { - var url = "openDialog(\""+ id + "\"); return false;"; + var url = "return openDeleteCommentDialog(\"" + id + "\");"; result += formatLink(id, url, "${deleteImg}", "Delete", "${deleteTitle}") } return result; @@ -54,12 +54,41 @@ // return "<a href='" + url + "'><image alt='" + imageAlt + "' title='" + imageTitle + "' src='" + image + "'> </a>"; } - function openDialog(commentId) { + function openDeleteCommentDialog(commentId) { var dialog = $("#deleteCommentDialog"); - var url = $.prepareUrl("${deleteUrl}", {commentId:commentId}); + var uriId = "<s:property value='%{uriId}'/>"; + var url = $.prepareUrl("<s:url action='confirmDeleteComment' namespace='/poll'/>", + {uriId:uriId, commentId:commentId}); dialog.load(url); dialog.dialog('open'); + return false; } + + function openDeleteVoteDialog(voteId) { + var dialog = $("#deleteVoteDialog"); + var uriId = "<s:property value='%{uriId}'/>"; + var url = $.prepareUrl("<s:url action='confirmDeleteVote' namespace='/poll'/>", + {uriId:uriId, voteId:voteId}); + dialog.load(url); + dialog.dialog('open'); + return false; + } + + function openDeleteChoiceDialog(choiceId) { + var dialog = $("#deleteChoiceDialog"); + var uriId = "<s:property value='%{uriId}'/>"; + var url = $.prepareUrl("<s:url action='confirmDeleteChoice' namespace='/poll'/>", + {uriId:uriId, choiceId:choiceId}); + dialog.load(url); + dialog.dialog('open'); + return false; + } + + jQuery(document).ready(function () { + $('#poll tr:even').addClass('even'); + }); + + </script> <h1 class="titleVote"><s:property value="poll.title"/></h1> @@ -82,7 +111,7 @@ alt="<s:text name="poll.common.vote.results"/>"/> </s:a> </s:if> - <t:FeedContextLink t:id="feedContext"/> + <%--<t:FeedContextLink t:id="feedContext"/>--%> <s:if test="feedFileExisting"> <s:a namespace="/poll" action="getFeed"> <s:param name="pollId" value="poll.pollId"/> @@ -100,7 +129,295 @@ </fieldset> </div> +<s:if test="pollChoiceOrVoteStarted"> +<br/> + +<!-- Sondage --> + +<s:if test="poll.anonymous"> + <p> + <s:text name="pollen.common.nbVotes"> + <s:param><s:property value="%{poll.sizeVote()}"/></s:param> + </s:text> + </p> + <%--<t:feedback t:id="voteFeedback"/>--%> +</s:if> +<s:else> + <%--TODO Do me!--%> + <%--<t:pager t:nbRowsPerPage="nbVotesPerPage" t:nbTotalRows="poll.nbVotes"--%> + <%--t:currentPage="page" t:noPagerText="prop:noPagerText"/>--%> +</s:else> + +<sj:dialog id="deleteVoteDialog" height="120" resizable="false" + title="%{getText('pollen.title.delete.pollVote')}" + autoOpen="false" modal="true" width="800"/> + +<sj:dialog id="deleteChoiceDialog" height="100" resizable="false" + title="%{getText('pollen.title.delete.pollChoice')}" + autoOpen="false" modal="true" width="800"/> + +<s:form id="voteForm"> +<table id="poll"> +<thead> +<tr> + <s:if test="accountFieldDisplayed"> + <th style="width:200px;"> + <s:text name="pollen.common.voterName"/> + </th> + </s:if> + <s:else> + <th></th> + </s:else> + <s:if test="textType"> + <s:iterator value="poll.choice" var="choice"> + <s:if test="!isChoiceHidden(#choice)"> + <th> + <s:if test="!isDescNull(#choice)"> + + <span title="<s:text name="pollen.common.description"/>" + value="%{escapeLineBreak(#choice.description)}"> + <span class="desc"> + <s:property value="%{#choice.name}"/> + </span> + </span> + </s:if> + <s:else> + <s:property value="%{#choice.name}"/> + </s:else> + <s:if test="pollChoiceRunning"> + <s:if test="creatorUser"> + <s:a action="deleteChoice" namespace="/poll"> + <s:param name="choiceId"> + <s:property value="%{#choice.id}"/> + </s:param> + <img src="<s:url value="/img/delete.png"/>" + title="<s:text name="pollen.action.deleteChoice"/>" + alt="<s:text name="pollen.action.deleteChoice"/>"/> + </s:a> + </s:if> + </s:if> + </th> + </s:if> + </s:iterator> + </s:if> + + <s:if test="dateType"> + <s:iterator value="poll.choice" var="choice"> + <s:if test="!isChoiceHidden(#choice)"> + <s:if test="!isDescNull(#choice)"> + + <th class="desc"> + <span title="<s:text name="pollen.common.description"/>" + value="%{escapeLineBreak(#choice.description)}"> + <s:property value="%{#choice.choiceNameAsDate}"/> + </span> + </th> + </s:if> + <s:else> + <th> + <s:property value="%{#choice.choiceNameAsDate}"/> + <%--<t:output value="choiceNameAsDate" format="dateFormat"/>--%> + </th> + </s:else> + </s:if> + </s:iterator> + </s:if> + + <s:if test="imageType"> + <s:iterator value="poll.choice" var="choice"> + <s:if test="!isChoiceHidden(#choice)"> + <s:if test="!isDescNull(#choice)"> + + <th class="desc"> + <span title="<s:text name="pollen.common.description"/>" + value="%{escapeLineBreak(#choice.description)}"> + + <%--Obtain image from poll.pollId/choice.name--%> + <s:property value="%{#choice.name}"/> + <%--<t:image--%> + <%--t:src="#choice.name"--%> + <%--alt="#choice.description"--%> + <%--t:dir="poll.pollId"/>--%> + </span> + </th> + </s:if> + <s:else> + <th> + <%--Obtain image from poll.pollId/choice.name--%> + <s:property value="%{#choice.name}"/> + </th> + </s:else> + </s:if> + </s:iterator> + </s:if> +</tr> +</thead> +<s:if test="pollRunning"> + <tfoot> + <tr> + <s:if test="accountFieldDisplayed"> + <th id="voterName"> + <s:textfield id='pollAccountName' required="true" + value="%{pollAccount.votingId}" theme="simple"/> + </th> + </s:if> + <s:else> + <th></th> + </s:else> + <s:iterator value="poll.choice" var="choice"> + + <s:if test="!isChoiceHidden(#choice)"> + <th> + <s:if + test="normalVoteCounting"> + <s:checkbox value="addChoice" theme="simple"/> + </s:if> + <s:if + test="percentageVoteCounting"> + <s:textfield value="#choice.value" size="3" required="true" + theme="simple"/> + <%--t:validate="required, min=0, max=100"/>%--%> + </s:if> + <s:if + test="condorcetVoteCounting"> + <s:textfield id="condorcetInput" value="choice.value" size="3" + theme="simple"/> + <%--t:nulls="zero" t:validate="min=0, max=99"/>--%> + </s:if> + <s:if + test="numberVoteCounting"> + <s:textfield value="addNumberVote" size="3" theme="simple"/> + </s:if> + </th> + </s:if> + </s:iterator> + </tr> + </tfoot> +</s:if> +<tbody> +<s:if test="!poll.anonymous"> + <s:iterator value="poll.vote" var="vote"> + <tr> + <td> + <s:if test="accountFieldDisplayed"> + <s:if test="!#vote.anonymous"> + <s:property value="%{#vote.pollAccount.votingId}"/> + </s:if> + <s:else> + ? + </s:else> + </s:if> + <s:if test="!poll.anonymous"> + <s:if test="isModifAllowed(#vote)"> + <s:a action="editVote" namespace="/poll"> + <s:param name="uriId" value="%{uriId}"/> + <s:param name="voteId" value="%{#vote.topiaId}"/> + <img src="<s:url value="/img/editSmall.png"/>" + title="<s:text name="pollen.action.editVote"/>" + alt="<s:text name="pollen.action.editVote"/>"/> + </s:a> + </s:if> + <s:if test="creatorUser"> + <s:a action="deleteVote" namespace="/poll" href="#" + onclick="return openDeleteVoteDialog('%{#vote.topiaId}');"> + <%--<s:param name="uriId" value="%{uriId}"/>--%> + <%--<s:param name="voteId" value="%{#vote.topiaId}"/>--%> + <img src="<s:url value="/img/delete.png"/>" + title="<s:text name="pollen.action.deleteVote"/>" + alt="<s:text name="pollen.action.deleteVote"/>"/> + </s:a> + </s:if> + </s:if> + </td> + <s:iterator value="poll.choice" var="choice"> + <s:if test="!isChoiceHidden(#choice)"> + <s:set name="currentVoteChoice" + value="%{#vote.getChoiceVoteToChoice(#choice)}"/> + <s:if test="poll.anonymous"> + <td class="anonymous">?</td> + </s:if> + <s:else> + <s:if test="normalVoteCounting"> + <s:if test="isChoiceInVote(#currentVoteChoice)"> + <td class="voted">OK</td> + </s:if> + <s:else> + <td class="notVoted"></td> + </s:else> + </s:if> + <s:if test="percentageVoteCounting"> + <s:if test="isChoiceInVote(#currentVoteChoice)"> + <td class="voted"><s:property + value="%{#currentVoteChoice.voteValue}"/> % + </td> + </s:if> + <s:else> + <td class="notVoted"></td> + </s:else> + </s:if> + <s:if test="condorcetVoteCounting"> + <s:if test="isChoiceInVote(#currentVoteChoice)"> + <td class="voted"><s:property + value="%{#currentVoteChoice.voteValue}"/></td> + </s:if> + <s:else> + <td class="notVoted"></td> + </s:else> + </s:if> + <s:if + test="numberVoteCounting"> + <s:if test="isChoiceInVote(#currentVoteChoice)"> + <td class="voted"><s:property + value="%{#currentVoteChoice.voteValue}"/></td> + </s:if> + <s:else> + <td class="notVoted"></td> + </s:else> + </s:if> + </s:else> + </s:if> + </s:iterator> + </tr> + </s:iterator> +</s:if> +<s:if test="poll.continuousResults"> + <tr> + <td> + <s:a namespace="/poll" action="result" method="input"> + <s:param name="pollId" value="poll.pollId"/> + <s:text name="poll.common.vote.results"/> + </s:a> + <%--<t:PageLink t:page="poll/results"--%> + <%--t:context="${poll.pollId}">${message:results}</t:PageLink>--%> + </td> + + <s:iterator value="poll.choice" var="choice"> + <s:if test="!isChoiceHidden(#choice)"> + <td class="result">TODO ${currentChoiceResult}</td> + </s:if> + </s:iterator> + </tr> +</s:if> +</tbody> +</table> +<div id="voteError"> + <%--<t:errors/>--%> +</div> + +<s:if test="pollRunning"> + <div id="buttons"> + <s:if test="anonymousVoteDisplayed"> + <s:checkbox id="anonymousVote" value="anonymousVote"/> + <%--<t:label for="anonymousVote"/>--%> + <br/> + </s:if> + <s:submit action="vote" key="pollen.action.vote"/> + <%--<input id="submitVote" t:type="Submit" t:value="${message:submitVote}"/>--%> + </div> +</s:if> +</s:form> + <!-- Ajout de commentaires --> <h3><s:text name="poll.common.comments"/></h3> @@ -137,26 +454,27 @@ <br/> -<%--<div id="commentFormDiv">--%> +<div id="commentFormDiv"> -<fieldset> - <legend><s:text name="poll.legend.addNewComment"/></legend> - <s:form id='addCommentForm' method="POST" namespace="/poll"> - <s:hidden key="pollId" label=''/> - <s:textfield key="commentName" required="true" - label="%{getText('pollen.common.commentName')}"/> - <s:textarea key="commentText" required="true" value='' - label="%{getText('pollen.common.commentText')}"/> + <fieldset> + <legend><s:text name="poll.legend.addNewComment"/></legend> + <s:form id='addCommentForm' method="POST" namespace="/poll"> + <s:hidden key="pollId" label=''/> + <s:textfield key="commentName" required="true" + label="%{getText('pollen.common.commentName')}"/> + <s:textarea key="commentText" required="true" value='' + label="%{getText('pollen.common.commentText')}"/> - <div class="cleanBoth"> - <s:submit action="addComment" key="pollen.action.addComment" - align="left"/> - </div> - </s:form> -</fieldset> -<%--</div>--%> + <div class="cleanBoth"> + <s:submit action="addComment" key="pollen.action.addComment" + align="left"/> + </div> + </s:form> + </fieldset> +</div> -<sj:dialog id="deleteCommentDialog" - title="%{getText('pollen.title.delete.comment')}" +<sj:dialog id="deleteCommentDialog" resizable="false" + title="%{getText('pollen.title.delete.pollComment')}" autoOpen="false" modal="true" width="800"/> +</s:if> \ No newline at end of file Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/css/main.css =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/css/main.css 2012-02-23 12:31:32 UTC (rev 3144) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/css/main.css 2012-02-25 14:59:05 UTC (rev 3145) @@ -492,4 +492,98 @@ text-align: center; text-decoration: none; text-shadow: 1px 1px 10px #000000; +} + +#poll { + border-collapse: collapse; + border-left: 1px solid #aab; + border-top: 1px solid #aab; + background-color: #fff; + font-size: 14px; + margin: auto; +} + +#poll THEAD, +#poll TFOOT { + border-top: 1px solid #aab; /* For Firefox */ +} + +#poll THEAD TR { + color: #fff; + background-color: #55cb00; +} + +#poll THEAD TR a { + color: #fff; + background-color: #55cb00; +} + +#poll THEAD TR TH { + text-align: left; + padding: 2px 3px; + white-space: nowrap; + border-right: 1px solid #aab; + border-bottom: 1px solid #aab; + background-color: #55cb00; +} + +#poll THEAD TR TH .desc { + padding: 2px 3px; + text-decoration: overline; +} + +#poll TFOOT TR TH { + padding: 2px 3px; + white-space: nowrap; + border-right: 1px solid #aab; + border-bottom: 1px solid #aab; + background-color: #55cb00; +} + +#poll TFOOT TR #voterName { + text-align: left; +} + +/*#poll TBODY TR {*/ + /*background-color: #fff;*/ +/*}*/ + +#poll TBODY TR .even { + background-color: #b0f580; +} + +#poll TBODY TR .anonymous { + background-color: #ddd; + text-align: center; +} + +#poll TBODY TR .voted { + background-color: #6f6; + color: #242; + text-align: center; +} + +#poll TBODY TR .notVoted { + background-color: #f66; +} + +#poll TBODY TR .result { + background-color: #e5e5e5; + color: #555; + text-align: center; +} + +#poll TBODY TR TD { + border-right: 1px solid #aab; + border-bottom: 1px solid #aab; + padding: 2px 5px; +} + +#choiceFormDiv form { + width: 200px; + margin: auto; + margin-top: 20px; + margin-bottom: 20px; + padding: 10px 50px 10px 50px; + border-top: 1px solid #aab; } \ No newline at end of file
participants (1)
-
tchemit@users.chorem.org