Author: tchemit Date: 2012-06-13 19:50:09 +0200 (Wed, 13 Jun 2012) New Revision: 3475 Url: http://chorem.org/repositories/revision/pollen/3475 Log: fixes #616: Use another url for moderate (instead of reusing the votefor one) Added: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ModeratePoll.java Modified: trunk/pollen-persistence/src/main/java/org/chorem/pollen/business/persistence/PollActions.java trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollUrlService.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/VoteForPoll.java trunk/pollen-ui-struts2/src/main/resources/config/struts-poll.xml trunk/pollen-ui-struts2/src/main/resources/shiro.ini trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/summary.jsp trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp Modified: trunk/pollen-persistence/src/main/java/org/chorem/pollen/business/persistence/PollActions.java =================================================================== --- trunk/pollen-persistence/src/main/java/org/chorem/pollen/business/persistence/PollActions.java 2012-06-13 17:49:40 UTC (rev 3474) +++ trunk/pollen-persistence/src/main/java/org/chorem/pollen/business/persistence/PollActions.java 2012-06-13 17:50:09 UTC (rev 3475) @@ -34,7 +34,7 @@ VOTE("poll/votefor"), RESULT("poll/results"), SUMMARY("poll/summary"), - MODERATE("poll/votefor"), + MODERATE("poll/moderate"), EDIT("poll/modification"), CLOSE("poll/close"), CLONE("poll/clone"), 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-13 17:49:40 UTC (rev 3474) +++ trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollUrlService.java 2012-06-13 17:50:09 UTC (rev 3475) @@ -30,8 +30,6 @@ import org.chorem.pollen.business.persistence.PollActions; import org.chorem.pollen.services.PollenServiceSupport; -import java.net.URL; - /** * Service to deal with url used by application. * 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-13 17:49:40 UTC (rev 3474) +++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractVoteAction.java 2012-06-13 17:50:09 UTC (rev 3475) @@ -291,7 +291,7 @@ this.commentAuthor = commentAuthor; } - public String prepareVotePage() throws Exception { + protected String prepareVotePage(boolean moderate) throws Exception { loadPoll(); @@ -302,7 +302,7 @@ // TODO no pagination for the moment, need to retrieve the correct page depends on current pollAccount votes = getVoteService().getAllVotes(poll); - voteAllowed = getVoteService().isVoteAllowed(poll, pollAccount); + voteAllowed = !moderate && getVoteService().isVoteAllowed(poll, pollAccount); // Current vote if (voteAllowed) { @@ -326,20 +326,6 @@ creatorUser = getPollenUserAccount().equals(pollCreator.getUserAccount()); } - // Messages - if (poll.isClosed()) { - addFlashMessage(_("pollen.information.pollClosed")); - } else if (!isPollStarted()) { - addFlashMessage(_("pollen.information.pollNotStarted")); - } else if (isPollFinished()) { - addFlashMessage(_("pollen.information.pollFinished")); - } else if (pollCreator.equals(pollAccount)) { - addFlashWarning(_("pollen.information.vote.creatorUser")); - } - if (isPollChoiceRunning()) { - addFlashMessage(_("pollen.information.pollChoiceRunning")); - } - if (log.isInfoEnabled()) { Date now = serviceContext.getCurrentTime(); log.info("pollChoiceOrVoteStarted = " + isPollChoiceOrVoteStarted()); Added: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ModeratePoll.java =================================================================== --- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ModeratePoll.java (rev 0) +++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ModeratePoll.java 2012-06-13 17:50:09 UTC (rev 3475) @@ -0,0 +1,43 @@ +/* + * #%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; + +/** + * To moderate votes and comment of a given poll. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.4 + */ +public class ModeratePoll extends AbstractVoteAction { + + private static final long serialVersionUID = 1L; + + @Override + public String input() throws Exception { + + prepareVotePage(true); + + addFlashWarning(_("pollen.information.moderate.page")); + return INPUT; + } +} Property changes on: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ModeratePoll.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/VoteForPoll.java =================================================================== --- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/VoteForPoll.java 2012-06-13 17:49:40 UTC (rev 3474) +++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/VoteForPoll.java 2012-06-13 17:50:09 UTC (rev 3475) @@ -51,7 +51,21 @@ @Override public void prepare() throws Exception { - prepareVotePage(); + prepareVotePage(false); + + // Messages + if (getPoll().isClosed()) { + addFlashMessage(_("pollen.information.pollClosed")); + } else if (!isPollStarted()) { + addFlashMessage(_("pollen.information.pollNotStarted")); + } else if (isPollFinished()) { + addFlashMessage(_("pollen.information.pollFinished")); + } else if (isCreatorUser()) { + addFlashWarning(_("pollen.information.vote.creatorUser")); + } + if (isPollChoiceRunning()) { + addFlashMessage(_("pollen.information.pollChoiceRunning")); + } } @Override Modified: trunk/pollen-ui-struts2/src/main/resources/config/struts-poll.xml =================================================================== --- trunk/pollen-ui-struts2/src/main/resources/config/struts-poll.xml 2012-06-13 17:49:40 UTC (rev 3474) +++ trunk/pollen-ui-struts2/src/main/resources/config/struts-poll.xml 2012-06-13 17:50:09 UTC (rev 3475) @@ -180,6 +180,13 @@ <result name="input">/WEB-INF/jsp/poll/vote.jsp</result> </action> + <!-- moderate vote poll (input) --> + <action name="moderate/*" method="input" + class="org.chorem.pollen.ui.actions.poll.ModeratePoll"> + <param name="uriId">{1}</param> + <result name="input">/WEB-INF/jsp/poll/vote.jsp</result> + </action> + <!-- add a choice --> <action name="addChoice/*" class="org.chorem.pollen.ui.actions.poll.AddChoice"> Modified: trunk/pollen-ui-struts2/src/main/resources/shiro.ini =================================================================== --- trunk/pollen-ui-struts2/src/main/resources/shiro.ini 2012-06-13 17:49:40 UTC (rev 3474) +++ trunk/pollen-ui-struts2/src/main/resources/shiro.ini 2012-06-13 17:50:09 UTC (rev 3475) @@ -1,3 +1,26 @@ +### +# #%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% +### + [main] connected=org.chorem.pollen.ui.security.ConnectedUserRequired @@ -49,6 +72,8 @@ # is pollCreator (can admin a poll) /poll/modification/**=poll,pollCreator +/poll/summary/**=poll,pollCreator +/poll/moderate/**=poll,pollCreator /poll/clone/**=poll,pollCreator /poll/resultLink/**=poll,pollCreator /poll/resume/**=poll,pollCreator \ No newline at end of file Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/summary.jsp =================================================================== --- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/summary.jsp 2012-06-13 17:49:40 UTC (rev 3474) +++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/summary.jsp 2012-06-13 17:50:09 UTC (rev 3475) @@ -157,11 +157,11 @@ </s:a> </div> -<div style="margin-top: 30px;"> +<%--div style="margin-top: 30px;"> <s:text name="pollen.label.pollRegisterPage"/> <s:a namespace="/user" action="createdList"> <s:text name="pollen.common.myPolls"/> </s:a>. -</div> +</div--%> <sj:dialog id="confirmDialog" autoOpen="false" modal="true" width="500"/> 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-13 17:49:40 UTC (rev 3474) +++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp 2012-06-13 17:50:09 UTC (rev 3475) @@ -113,10 +113,10 @@ <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}"> + <s:a namespace="/poll" action="summary/%{uriId}"> <img src="<s:url value='/img/editSmall.png'/>" - title="<s:text name='pollen.action.editPoll'/>" - alt="<s:text name='pollen.action.editPoll'/>"/> + title="<s:text name='pollen.action.summaryPoll'/>" + alt="<s:text name='pollen.action.summaryPoll'/>"/> </s:a> </s:if> <s:if test="poll.publicResults">