r3312 - in trunk/pollen-ui-struts2/src/main: java/org/chorem/pollen/ui/actions/poll resources resources/config resources/i18n webapp/WEB-INF/jsp webapp/WEB-INF/jsp/poll webapp/js
Author: fdesbois Date: 2012-04-24 15:15:22 +0200 (Tue, 24 Apr 2012) New Revision: 3312 Url: http://chorem.org/repositories/revision/pollen/3312 Log: Use redirection on ResultLink page after close action Added: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ResultLink.java trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/resultLink.jsp Removed: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/close.jsp Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ClosePoll.java trunk/pollen-ui-struts2/src/main/resources/config/struts-poll.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/webapp/WEB-INF/jsp/poll/confirmClosePoll.jsp trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/create.jsp trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/pollListHelper.jsp trunk/pollen-ui-struts2/src/main/webapp/js/createPoll.js 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-04-24 11:32:56 UTC (rev 3311) +++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ClosePoll.java 2012-04-24 13:15:22 UTC (rev 3312) @@ -23,7 +23,6 @@ */ package org.chorem.pollen.ui.actions.poll; -import org.chorem.pollen.business.persistence.Poll; import org.chorem.pollen.services.impl.PollService; /** @@ -36,39 +35,25 @@ private static final long serialVersionUID = 1L; - protected PollService pollService; - - protected Poll poll; - - protected String pollResultUrl; + protected String redirectUrl; - protected PollService getPollService() { - if (pollService == null) { - pollService = newService(PollService.class); - } - return pollService; + public String getRedirectUrl() { + return redirectUrl; } - - public Poll getPoll() { - return poll; - } - public String getPollResultUrl() { - return pollResultUrl; + public void setRedirectUrl(String redirectUrl) { + this.redirectUrl = redirectUrl; } @Override public String execute() throws Exception { - - String pollUid = getPollId(); - poll = getPollService().getPollByPollId(pollUid); + PollService service = newService(PollService.class); - pollResultUrl = getPollService().getPollResultUrl(poll).getUrl(); - - getPollService().closePoll(pollUid, - getPollenUserAccount(), - getAccountId()); + service.closePoll(getPollId(), getPollenUserAccount(), getAccountId()); + + addActionMessage(_("pollen.information.poll.closed")); + return SUCCESS; } } Copied: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ResultLink.java (from rev 3311, 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/ResultLink.java (rev 0) +++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ResultLink.java 2012-04-24 13:15:22 UTC (rev 3312) @@ -0,0 +1,77 @@ +/* + * #%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 org.chorem.pollen.business.persistence.Poll; +import org.chorem.pollen.services.impl.PollService; +import org.chorem.pollen.ui.actions.PageSkin; + +/** + * Display the result link page. + * + * @author fdesbois <desbois@codelutin.com> + * @since 1.3 + */ +public class ResultLink extends AbstractPollUriIdAction { + + private static final long serialVersionUID = 1L; + + protected PollService pollService; + + protected Poll poll; + + protected String pollResultUrl; + + protected PollService getPollService() { + if (pollService == null) { + pollService = newService(PollService.class); + } + return pollService; + } + + @Override + public PageSkin getSkin() { + return PageSkin.EDITION; + } + + public Poll getPoll() { + return poll; + } + + public String getPollResultUrl() { + return pollResultUrl; + } + + @Override + public String execute() throws Exception { + + String pollUid = getPollId(); + + poll = getPollService().getPollByPollId(pollUid); + + pollResultUrl = getPollService().getPollResultUrl(poll).getUrl(); + + return SUCCESS; + } +} Modified: trunk/pollen-ui-struts2/src/main/resources/config/struts-poll.xml =================================================================== --- trunk/pollen-ui-struts2/src/main/resources/config/struts-poll.xml 2012-04-24 11:32:56 UTC (rev 3311) +++ trunk/pollen-ui-struts2/src/main/resources/config/struts-poll.xml 2012-04-24 13:15:22 UTC (rev 3312) @@ -98,9 +98,16 @@ <action name="close/*" class="org.chorem.pollen.ui.actions.poll.ClosePoll"> <param name="uriId">{1}</param> - <result>/WEB-INF/jsp/poll/close.jsp</result> + <result type="redirect2"/> </action> + <!-- display result link --> + <action name="resultLink/*" + class="org.chorem.pollen.ui.actions.poll.ResultLink"> + <param name="uriId">{1}</param> + <result>/WEB-INF/jsp/poll/resultLink.jsp</result> + </action> + <!-- confirm delete poll --> <action name="confirmDeletePoll/*" class="org.chorem.pollen.ui.actions.poll.ConfirmPollAction"> 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-04-24 11:32:56 UTC (rev 3311) +++ trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-04-24 13:15:22 UTC (rev 3312) @@ -216,6 +216,7 @@ 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.form.voteStarted=Votes are started, some options can't be updated. pollen.information.poll.updated=Poll modified 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-04-24 11:32:56 UTC (rev 3311) +++ trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-04-24 13:15:22 UTC (rev 3312) @@ -219,6 +219,7 @@ 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.form.voteStarted=Les votes ont commencé, certaines options ne sont pas modifiables. pollen.information.poll.updated=Sondage mise à jour Modified: trunk/pollen-ui-struts2/src/main/resources/shiro.ini =================================================================== --- trunk/pollen-ui-struts2/src/main/resources/shiro.ini 2012-04-24 11:32:56 UTC (rev 3311) +++ trunk/pollen-ui-struts2/src/main/resources/shiro.ini 2012-04-24 13:15:22 UTC (rev 3312) @@ -44,4 +44,5 @@ # is pollCreator (can admin a poll) /poll/modification/**=poll,pollCreator -/poll/clone/**=poll,pollCreator \ No newline at end of file +/poll/clone/**=poll,pollCreator +/poll/resultLink/**=poll,pollCreator \ No newline at end of file Deleted: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/close.jsp =================================================================== --- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/close.jsp 2012-04-24 11:32:56 UTC (rev 3311) +++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/close.jsp 2012-04-24 13:15:22 UTC (rev 3312) @@ -1,47 +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% - --%> -<%@ page language="java" contentType="text/html" pageEncoding="utf-8" %> -<%@ taglib prefix="s" uri="/struts-tags" %> -<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 style="margin-top: 10px;"> - <img src="<s:url value='/img/count.png'/>" - alt="<s:text name='pollen.common.resultAction'/>" - 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> -</div> -<div style="margin-top: 30px;"> - <s:text name="pollen.label.pollRegisterPage"/> - <s:a namespace="/user" action="myPolls"> - <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/confirmClosePoll.jsp =================================================================== --- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmClosePoll.jsp 2012-04-24 11:32:56 UTC (rev 3311) +++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmClosePoll.jsp 2012-04-24 13:15:22 UTC (rev 3312) @@ -32,7 +32,7 @@ <s:form method="POST" namespace="/poll"> <fieldset class="ui-widget-content ui-corner-all"> - <!--<s:hidden key="redirectUrl" label=''/>--> + <s:hidden key="redirectUrl" label=''/> <s:hidden key="uriId" label=''/> <s:text name="pollen.information.confirmClosePoll"/> Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/create.jsp =================================================================== --- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/create.jsp 2012-04-24 11:32:56 UTC (rev 3311) +++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/create.jsp 2012-04-24 13:15:22 UTC (rev 3312) @@ -56,9 +56,10 @@ choiceType:'<s:property value="%{poll.choiceType.name()}"/>', pollType:'<s:property value="%{poll.pollType.name()}"/>', - adminId:'<s:property value="%{poll.adminId}"/>', confirmCloseTitle: "<s:text name='pollen.title.close.poll'/>", confirmCloseUrl: '<s:url action="confirmClosePoll/" namespace="/poll"/>' + + '<s:property value="%{poll.adminId}"/>', + confirmCloseRedirectUrl: '<s:url action="resultLink/" namespace="/poll"/>' + '<s:property value="%{poll.adminId}"/>' } ); Copied: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/resultLink.jsp (from rev 3311, trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/close.jsp) =================================================================== --- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/resultLink.jsp (rev 0) +++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/resultLink.jsp 2012-04-24 13:15:22 UTC (rev 3312) @@ -0,0 +1,47 @@ +<%-- + #%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% + --%> +<%@ page language="java" contentType="text/html" pageEncoding="utf-8" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<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 style="margin-top: 10px;"> + <img src="<s:url value='/img/count.png'/>" + alt="<s:text name='pollen.common.resultAction'/>" + 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> +</div> +<div style="margin-top: 30px;"> + <s:text name="pollen.label.pollRegisterPage"/> + <s:a namespace="/user" action="myPolls"> + <s:text name="pollen.common.myPolls"/> + </s:a>. +</div> \ No newline at end of file Property changes on: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/resultLink.jsp ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/pollListHelper.jsp =================================================================== --- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/pollListHelper.jsp 2012-04-24 11:32:56 UTC (rev 3311) +++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/pollListHelper.jsp 2012-04-24 13:15:22 UTC (rev 3312) @@ -74,7 +74,7 @@ $('.ui-dialog-title').html("<s:text name="pollen.title.close.poll"/>") var dialog = $("#confirmDialog"); var url = "<s:url action='confirmClosePoll/' namespace='/poll'/>"; - url += id; + url += id + '?' + $.param({redirectUrl:redirectUrl}); dialog.load(url); dialog.dialog('open'); return false; Modified: trunk/pollen-ui-struts2/src/main/webapp/js/createPoll.js =================================================================== --- trunk/pollen-ui-struts2/src/main/webapp/js/createPoll.js 2012-04-24 11:32:56 UTC (rev 3311) +++ trunk/pollen-ui-struts2/src/main/webapp/js/createPoll.js 2012-04-24 13:15:22 UTC (rev 3312) @@ -488,7 +488,8 @@ function confirmClose() { $('.ui-dialog-title').html(datas['confirmCloseTitle']) var dialog = $("#confirmDialog"); - var url = datas['confirmCloseUrl']; + var url = datas['confirmCloseUrl'] + '?' + + $.param({redirectUrl:datas['confirmCloseRedirectUrl']}); dialog.load(url); dialog.dialog('open'); return false;
participants (1)
-
fdesbois@users.chorem.org