Author: tchemit Date: 2012-03-15 07:48:52 +0100 (Thu, 15 Mar 2012) New Revision: 3194 Url: http://chorem.org/repositories/revision/pollen/3194 Log: add close action add clone action (just begin of it, must be done...) use getPollenUserAccount method in actions fix date choice date format fix tooltip for text choices And much much more... Added: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmPollAction.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmClonePoll.jsp branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmClosePoll.jsp Removed: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeletePoll.java Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/PollenActionSupport.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/io/GetPollImageChoice.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/AbstractJSONPaginedAction.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetCreatedPolls.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetFavoriteLists.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetInvitedPolls.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetParticipatedPolls.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetPollComments.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/AddComment.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ClonePoll.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ClosePoll.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/ConfirmDeleteComment.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/CreatePoll.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeletePoll.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DisplayPersonToList.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DisplayVotingList.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/EditPoll.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ImportPersonListToVotingList.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/SelectPersonListToVotingList.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/Edit.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/ManageFavoriteList.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/ManageFavoriteLists.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/Show.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/interceptors/CheckUserIsAdmin.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/interceptors/CheckUserIsLogguedInterceptor.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/webapp/WEB-INF/decorators.xml branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmDeletePoll.jsp branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/create.jsp branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/dateChoice.jsp 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/pollListHelper.jsp Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/PollenActionSupport.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/PollenActionSupport.java 2012-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/PollenActionSupport.java 2012-03-15 06:48:52 UTC (rev 3194) @@ -44,6 +44,7 @@ import javax.servlet.http.HttpServletRequest; import java.net.URL; import java.text.DateFormat; +import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; @@ -130,6 +131,15 @@ return pollenSession; } + public UserAccount getPollenUserAccount() { + return getPollenSession().getUserAccount(); + } + + public boolean isUserLoggued() { + UserAccount userAccount = getPollenUserAccount(); + return userAccount != null; + } + public static String getApplicationVersion() { return getPollenApplicationContext().getConfiguration().getVersion().toString(); } @@ -191,16 +201,6 @@ this.transaction = transaction; } -// public String formatDate(Date date) { -// String result = getDateFormat().format(date); -// return result; -// } -// -// public String formatMonth(Date date) { -// String result = getMonthFormat().format(date); -// return result; -// } - public static final List<String> SAFE_LANGUAGES = Lists.newArrayList("en", "fr"); @@ -244,13 +244,18 @@ return result; } + public Date parseDate(String date) throws ParseException { + Date result = getDateFormat().parse(date); + return result; + } + + public Date parseDateTime(String date) throws ParseException { + Date result = getDateTimeFormat().parse(date); + return result; + } + public String formatDateTime(Date date) { String result = getDateTimeFormat().format(date); return result; } - - public boolean isUserLoggued() { - UserAccount userAccount = getPollenSession().getUserAccount(); - return userAccount != null; - } } Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/io/GetPollImageChoice.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/io/GetPollImageChoice.java 2012-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/io/GetPollImageChoice.java 2012-03-15 06:48:52 UTC (rev 3194) @@ -45,7 +45,7 @@ protected String pollId; protected String choiceId; - + protected boolean thumb; protected transient InputStream inputStream; @@ -79,7 +79,7 @@ Preconditions.checkNotNull(choiceId); PollService service = newService(PollService.class); - + File file = service.getPollChoiceImageFile(pollId, choiceId, thumb); MimetypesFileTypeMap mimes = new MimetypesFileTypeMap(); Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/AbstractJSONPaginedAction.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/AbstractJSONPaginedAction.java 2012-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/AbstractJSONPaginedAction.java 2012-03-15 06:48:52 UTC (rev 3194) @@ -28,7 +28,6 @@ import org.apache.struts2.json.JSONUtil; import org.chorem.pollen.ui.actions.PollenActionSupport; import org.nuiton.topia.persistence.TopiaFilterPagerUtil; -import org.nuiton.web.struts2.FilterPagerUtil; /** * Abstract JSON action with pagination support. Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetCreatedPolls.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetCreatedPolls.java 2012-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetCreatedPolls.java 2012-03-15 06:48:52 UTC (rev 3194) @@ -75,7 +75,7 @@ PollService pollService = newService(PollService.class); List<Poll> pollList = pollService.getCreatedPolls(pager, - getPollenSession().getUserAccount()); + getPollenUserAccount()); polls = new Map[pollList.size()]; Binder<Poll, Poll> binder = Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetFavoriteLists.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetFavoriteLists.java 2012-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetFavoriteLists.java 2012-03-15 06:48:52 UTC (rev 3194) @@ -72,7 +72,7 @@ FavoriteService service = newService(FavoriteService.class); List<PersonList> allFavoriteLists = service.getFavoriteLists( - getPollenSession().getUserAccount(), + getPollenUserAccount(), pager); favoriteLists = new Map[allFavoriteLists.size()]; Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetInvitedPolls.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetInvitedPolls.java 2012-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetInvitedPolls.java 2012-03-15 06:48:52 UTC (rev 3194) @@ -78,7 +78,7 @@ PollService pollService = newService(PollService.class); List<Poll> pollList = pollService.getInvitedPolls(pager, - getPollenSession().getUserAccount()); + getPollenUserAccount()); polls = new Map[pollList.size()]; Binder<Poll, Poll> binder = @@ -94,7 +94,7 @@ Poll.PROPERTY_BEGIN_DATE, Poll.PROPERTY_END_DATE ); - String userEmail = getPollenSession().getUserAccount().getEmail(); + String userEmail = getPollenUserAccount().getEmail(); map.put("adminId", poll.getAdminId()); map.put("voteId", getVoteId(poll, userEmail)); map.put("id", poll.getTopiaId()); Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetParticipatedPolls.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetParticipatedPolls.java 2012-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetParticipatedPolls.java 2012-03-15 06:48:52 UTC (rev 3194) @@ -75,7 +75,7 @@ PollService pollService = newService(PollService.class); List<Poll> pollList = pollService.getParticipatedPolls( - pager, getPollenSession().getUserAccount()); + pager, getPollenUserAccount()); polls = new Map[pollList.size()]; Binder<Poll, Poll> binder = Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetPollComments.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetPollComments.java 2012-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetPollComments.java 2012-03-15 06:48:52 UTC (rev 3194) @@ -87,7 +87,7 @@ List<Comment> commentList = pollService.getComments(pager, pollId); - UserAccount userAccount = getPollenSession().getUserAccount(); + UserAccount userAccount = getPollenUserAccount(); comments = new Map[commentList.size()]; Binder<Comment, Comment> binder = 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-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractVoteAction.java 2012-03-15 06:48:52 UTC (rev 3194) @@ -109,7 +109,7 @@ if (pollAccount == null) { PollService service = newService(PollService.class); pollAccount = service.getNewPollAccount( - getPollenSession().getUserAccount()); + getPollenUserAccount()); } return pollAccount; } @@ -190,7 +190,7 @@ } // set default comment name - UserAccount userAccount = getPollenSession().getUserAccount(); + UserAccount userAccount = getPollenUserAccount(); if (userAccount == null) { defaultCommentName = ""; } else { @@ -213,8 +213,8 @@ pollRunning = !poll.isClosed() && isPollStarted() && !isPollFinished(); //TODO Deal the case of the not loggued poll (using the pollAccountId - creatorUser = getPollenSession().getUserAccount() != null && - getPollenSession().getUserAccount().equals(poll.getCreator().getUserAccount()); + creatorUser = getPollenUserAccount() != null && + getPollenUserAccount().equals(poll.getCreator().getUserAccount()); if (log.isInfoEnabled()) { log.info("pollChoiceOrVoteStarted = " + pollChoiceOrVoteStarted); @@ -381,8 +381,9 @@ result = true; } - UserAccount userAccount = getPollenSession().getUserAccount(); + UserAccount userAccount = getPollenUserAccount(); + // si l'utilisateur du vote correspond à l'utilisateur actuel (user) if (userAccount != null) { UserAccount voteUserAccount = votePollAccount.getUserAccount(); Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AddComment.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AddComment.java 2012-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AddComment.java 2012-03-15 06:48:52 UTC (rev 3194) @@ -67,7 +67,7 @@ // prepare a new poll account for the comment PollAccount pollAccount = service.getNewPollAccount( - getPollenSession().getUserAccount(), commentName); + getPollenUserAccount(), commentName); // prepare a new comment Comment comment = service.getNewComment(pollAccount, commentText); Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ClonePoll.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ClonePoll.java 2012-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ClonePoll.java 2012-03-15 06:48:52 UTC (rev 3194) @@ -23,7 +23,7 @@ */ package org.chorem.pollen.ui.actions.poll; -import org.chorem.pollen.ui.actions.PollenActionSupport; +import org.chorem.pollen.services.impl.PollService; /** * Creates a new poll by cloning an existing one. @@ -35,4 +35,24 @@ private static final long serialVersionUID = 1L; + protected String redirectUrl; + + public String getRedirectUrl() { + return redirectUrl; + } + + public void setRedirectUrl(String redirectUrl) { + this.redirectUrl = redirectUrl; + } + + @Override + public String execute() throws Exception { + + PollService service = newService(PollService.class); + + //TODO +// service.clonePoll(pollId, getPollenUserAccount(), accountId); + + return SUCCESS; + } } Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ClosePoll.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ClosePoll.java 2012-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ClosePoll.java 2012-03-15 06:48:52 UTC (rev 3194) @@ -23,7 +23,7 @@ */ package org.chorem.pollen.ui.actions.poll; -import org.chorem.pollen.ui.actions.PollenActionSupport; +import org.chorem.pollen.services.impl.PollService; /** * Closes an existing poll. @@ -34,4 +34,23 @@ public class ClosePoll extends AbstractPollUriIdAction { private static final long serialVersionUID = 1L; + + protected String redirectUrl; + + public String getRedirectUrl() { + return redirectUrl; + } + + public void setRedirectUrl(String redirectUrl) { + this.redirectUrl = redirectUrl; + } + + @Override + public String execute() throws Exception { + + PollService service = newService(PollService.class); + + service.closePoll(pollId, getPollenUserAccount(), accountId); + return SUCCESS; + } } Modified: 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 2012-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeleteChoice.java 2012-03-15 06:48:52 UTC (rev 3194) @@ -24,11 +24,9 @@ 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. 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-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeleteComment.java 2012-03-15 06:48:52 UTC (rev 3194) @@ -27,7 +27,6 @@ import org.chorem.pollen.business.persistence.Comment; import org.chorem.pollen.services.exceptions.PollCommentNotFound; import org.chorem.pollen.services.impl.PollCommentService; -import org.chorem.pollen.ui.actions.PollenActionSupport; /** * To confirm a comment delete. Deleted: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeletePoll.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeletePoll.java 2012-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeletePoll.java 2012-03-15 06:48:52 UTC (rev 3194) @@ -1,62 +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% - */ -package org.chorem.pollen.ui.actions.poll; - -import com.google.common.base.Preconditions; -import org.chorem.pollen.business.persistence.Poll; -import org.chorem.pollen.services.impl.PollService; - -/** - * Confirm to delete a poll. - * - * @author tchemit <chemit@codelutin.com> - * @since 1.2.6 - */ -public class ConfirmDeletePoll extends AbstractPollUriIdAction { - - private static final long serialVersionUID = 1L; - - protected Poll poll; - - protected String redirectUrl; - - public String getRedirectUrl() { - return redirectUrl; - } - - public void setRedirectUrl(String redirectUrl) { - this.redirectUrl = redirectUrl; - } - - public Poll getPoll() { - return poll; - } - - @Override - public String execute() throws Exception { - Preconditions.checkNotNull(pollId); - poll = newService(PollService.class).getPollByPollId(pollId); - return SUCCESS; - } -} Modified: 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 2012-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeleteVote.java 2012-03-15 06:48:52 UTC (rev 3194) @@ -24,11 +24,9 @@ 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 Copied: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmPollAction.java (from rev 3191, branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeletePoll.java) =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmPollAction.java (rev 0) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmPollAction.java 2012-03-15 06:48:52 UTC (rev 3194) @@ -0,0 +1,62 @@ +/* + * #%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.business.persistence.Poll; +import org.chorem.pollen.services.impl.PollService; + +/** + * To confirm a poll action (such as delete or close). + * + * @author tchemit <chemit@codelutin.com> + * @since 1.2.6 + */ +public class ConfirmPollAction extends AbstractPollUriIdAction { + + private static final long serialVersionUID = 1L; + + protected Poll poll; + + protected String redirectUrl; + + public String getRedirectUrl() { + return redirectUrl; + } + + public void setRedirectUrl(String redirectUrl) { + this.redirectUrl = redirectUrl; + } + + public Poll getPoll() { + return poll; + } + + @Override + public String execute() throws Exception { + Preconditions.checkNotNull(pollId); + poll = newService(PollService.class).getPollByPollId(pollId); + return SUCCESS; + } +} Property changes on: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmPollAction.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/CreatePoll.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/CreatePoll.java 2012-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/CreatePoll.java 2012-03-15 06:48:52 UTC (rev 3194) @@ -57,6 +57,7 @@ import org.nuiton.util.StringUtil; import java.io.File; +import java.text.ParseException; import java.util.Collections; import java.util.Date; import java.util.List; @@ -151,7 +152,7 @@ public Poll getPoll() { if (poll == null) { // create poll - UserAccount userAccount = getPollenSession().getUserAccount(); + UserAccount userAccount = getPollenUserAccount(); poll = getPollService().getNewPoll(userAccount); } return poll; @@ -1023,7 +1024,15 @@ String name) { createChoice(choice, prefix, name); if (StringUtils.isNotEmpty(name)) { - choice.setDate(new Date(Long.valueOf(name))); + Date date = null; + try { + date = parseDateTime(name); + } catch (ParseException e) { + if (log.isErrorEnabled()) { + log.error("Unparseable date " + name, e); + } + } + choice.setDate(date); } return choice; } Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeletePoll.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeletePoll.java 2012-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeletePoll.java 2012-03-15 06:48:52 UTC (rev 3194) @@ -50,10 +50,9 @@ PollService service = newService(PollService.class); - service.deletePoll(pollId, getPollenSession().getUserAccount(), accountId); - -// String fullUrl = getApplicationUrl() + redirectUrl; -// setRedirectUrl(fullUrl); + service.deletePoll(pollId, getPollenUserAccount(), accountId); return SUCCESS; } + + } Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DisplayPersonToList.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DisplayPersonToList.java 2012-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DisplayPersonToList.java 2012-03-15 06:48:52 UTC (rev 3194) @@ -28,8 +28,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.pollen.business.persistence.PersonToList; -import org.chorem.pollen.business.persistence.PersonToListImpl; -import org.chorem.pollen.business.persistence.PollAccountImpl; import org.chorem.pollen.services.impl.PollService; import org.chorem.pollen.ui.actions.PollenActionSupport; Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DisplayVotingList.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DisplayVotingList.java 2012-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DisplayVotingList.java 2012-03-15 06:48:52 UTC (rev 3194) @@ -139,7 +139,7 @@ String fieldName = e.getKey(); String errorMessage = e.getValue(); if (log.isInfoEnabled()) { - log.info("Transmit error on " + fieldName+" ["+errorMessage+"]"); + log.info("Transmit error on " + fieldName + " [" + errorMessage + "]"); } addFieldError(fieldName, errorMessage); } Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/EditPoll.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/EditPoll.java 2012-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/EditPoll.java 2012-03-15 06:48:52 UTC (rev 3194) @@ -23,8 +23,6 @@ */ package org.chorem.pollen.ui.actions.poll; -import org.chorem.pollen.ui.actions.PollenActionSupport; - /** * Display a poll. * Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ImportPersonListToVotingList.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ImportPersonListToVotingList.java 2012-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ImportPersonListToVotingList.java 2012-03-15 06:48:52 UTC (rev 3194) @@ -97,7 +97,7 @@ FavoriteService service = newService(FavoriteService.class); PollenSession session = getPollenSession(); PersonList favoriteList = - service.getFavoriteList(session.getUserAccount(), personListId); + service.getFavoriteList(getPollenUserAccount(), personListId); nbPersonToLists = favoriteList.sizePollAccount(); if (nbPersonToLists > 0) { Modified: 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 2012-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ModifyVote.java 2012-03-15 06:48:52 UTC (rev 3194) @@ -40,9 +40,9 @@ loadPoll(); - - if (poll==null) { + if (poll == null) { + } return SUCCESS; Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/SelectPersonListToVotingList.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/SelectPersonListToVotingList.java 2012-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/SelectPersonListToVotingList.java 2012-03-15 06:48:52 UTC (rev 3194) @@ -63,7 +63,7 @@ public String execute() throws Exception { FavoriteService service = newService(FavoriteService.class); - UserAccount userAccount = getPollenSession().getUserAccount(); + UserAccount userAccount = getPollenUserAccount(); List<PersonList> personLists = service.getFavoriteLists(userAccount); personList = Maps.uniqueIndex(personLists, PollenFunctions.ENTITY_BY_ID); Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/Edit.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/Edit.java 2012-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/Edit.java 2012-03-15 06:48:52 UTC (rev 3194) @@ -74,7 +74,7 @@ } public String input() throws Exception { - UserAccount userAccount = getPollenSession().getUserAccount(); + UserAccount userAccount = getPollenUserAccount(); UserService userService = newService(UserService.class); user = userService.getEntityById(UserAccount.class, userAccount.getTopiaId()); return INPUT; @@ -85,7 +85,7 @@ // let's push back admin property to user to save user.setAdministrator( - getPollenSession().getUserAccount().isAdministrator()); + getPollenUserAccount().isAdministrator()); UserService service = newService(UserService.class); Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/ManageFavoriteList.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/ManageFavoriteList.java 2012-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/ManageFavoriteList.java 2012-03-15 06:48:52 UTC (rev 3194) @@ -97,7 +97,7 @@ try { favoriteList = service.getFavoriteList( - getPollenSession().getUserAccount(), favoriteListId); + getPollenUserAccount(), favoriteListId); } catch (FavoriteListNotFoundException e) { addActionError(_("pollen.error.favoriteList.not.found")); } catch (FavoriteListNotOwnedByUserException e) { Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/ManageFavoriteLists.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/ManageFavoriteLists.java 2012-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/ManageFavoriteLists.java 2012-03-15 06:48:52 UTC (rev 3194) @@ -102,7 +102,7 @@ String result = INPUT; FavoriteService service = newService(FavoriteService.class); try { - service.createFavoriteList(getPollenSession().getUserAccount(), + service.createFavoriteList(getPollenUserAccount(), favoriteList.getName()); getTransaction().commitTransaction(); @@ -124,7 +124,7 @@ FavoriteService service = newService(FavoriteService.class); - PersonList deletedFavoritedList = service.deleteFavoriteList(getPollenSession().getUserAccount(), + PersonList deletedFavoritedList = service.deleteFavoriteList(getPollenUserAccount(), favoriteList); getTransaction().commitTransaction(); Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/Show.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/Show.java 2012-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/Show.java 2012-03-15 06:48:52 UTC (rev 3194) @@ -41,7 +41,7 @@ } public UserAccount getUser() { - return getPollenSession().getUserAccount(); + return getPollenUserAccount(); } } Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/interceptors/CheckUserIsAdmin.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/interceptors/CheckUserIsAdmin.java 2012-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/interceptors/CheckUserIsAdmin.java 2012-03-15 06:48:52 UTC (rev 3194) @@ -58,9 +58,7 @@ PollenActionSupport action = (PollenActionSupport) invocation.getAction(); - PollenSession echoBaseSession = action.getPollenSession(); - - UserAccount user = echoBaseSession.getUserAccount(); + UserAccount user = action.getPollenUserAccount(); Preconditions.checkNotNull(user, "No user found is session"); boolean check = user.isAdministrator(); Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/interceptors/CheckUserIsLogguedInterceptor.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/interceptors/CheckUserIsLogguedInterceptor.java 2012-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/interceptors/CheckUserIsLogguedInterceptor.java 2012-03-15 06:48:52 UTC (rev 3194) @@ -66,8 +66,7 @@ PollenActionSupport action = (PollenActionSupport) invocation.getAction(); - PollenSession echoBaseSession = action.getPollenSession(); - boolean userLoggued = echoBaseSession.getUserAccount() != null; + boolean userLoggued = action.getPollenUserAccount() != null; if (!userLoggued && log.isInfoEnabled()) { log.info("No user loggued!"); 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-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config/struts-poll.xml 2012-03-15 06:48:52 UTC (rev 3194) @@ -100,12 +100,21 @@ <result>/WEB-INF/jsp/poll/vote.jsp</result> </action> + <!-- confirm clone poll --> + <action name="confirmClonePoll/*" + class="org.chorem.pollen.ui.actions.poll.ConfirmPollAction"> + <param name="uriId">{1}</param> + <result>/WEB-INF/jsp/poll/confirmClonePoll.jsp</result> + </action> + <!-- clone poll --> <action name="clone/*" class="org.chorem.pollen.ui.actions.poll.ClonePoll"> <param name="uriId">{1}</param> - <result name="input">/WEB-INF/jsp/poll/clone.jsp</result> - <result>/WEB-INF/jsp/home.jsp</result> + <result type="redirect"> + <param name="location">${redirectUrl}</param> + <param name="prependServletContext">false</param> + </result> </action> <!-- export poll --> @@ -122,17 +131,26 @@ </result> </action> + <!-- confirm close poll --> + <action name="confirmClosePoll/*" + class="org.chorem.pollen.ui.actions.poll.ConfirmPollAction"> + <param name="uriId">{1}</param> + <result>/WEB-INF/jsp/poll/confirmClosePoll.jsp</result> + </action> + <!-- close poll --> <action name="close/*" class="org.chorem.pollen.ui.actions.poll.ClosePoll"> <param name="uriId">{1}</param> - <result name="input">/WEB-INF/jsp/poll/close.jsp</result> - <result>/WEB-INF/jsp/home.jsp</result> + <result type="redirect"> + <param name="location">${redirectUrl}</param> + <param name="prependServletContext">false</param> + </result> </action> <!-- confirm delete poll --> <action name="confirmDeletePoll/*" - class="org.chorem.pollen.ui.actions.poll.ConfirmDeletePoll"> + class="org.chorem.pollen.ui.actions.poll.ConfirmPollAction"> <param name="uriId">{1}</param> <result>/WEB-INF/jsp/poll/confirmDeletePoll.jsp</result> </action> 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-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-03-15 06:48:52 UTC (rev 3194) @@ -4,6 +4,8 @@ pollen.action.addVotingList=Add a group pollen.action.backToFavoriteLists=Back to favorite lists pollen.action.cancel=Cancel +pollen.action.clone=Clone poll +pollen.action.close=Close the poll pollen.action.create=Create pollen.action.createFavoriteList=Create a new list pollen.action.createPoll=Create the poll @@ -172,6 +174,8 @@ pollen.fieldset.userInformation.toUpdate=User informations to update pollen.info.poll.created=Poll created pollen.info.poll.updated=Poll modified +pollen.information.confirmClonePoll=Confirm clone of poll\: +pollen.information.confirmClosePoll=Confirm close of poll\: pollen.information.confirmDeleteChoice=Confirm delete of choice %s pollen.information.confirmDeletePoll=Confirm delete of poll\: pollen.information.confirmDeleteVote=Confirm delete of vote for %s @@ -210,6 +214,8 @@ pollen.menu.preferences=My account pollen.menu.register=Register pollen.menu.userFavoriteLists=Voting lists +pollen.title.clone.poll=Clone a poll +pollen.title.close.poll=Close a poll pollen.title.createPoll=New poll pollen.title.delete.poll=Delete a poll pollen.title.delete.pollChoice=Delete a poll choice 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-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-03-15 06:48:52 UTC (rev 3194) @@ -7,6 +7,8 @@ pollen.action.addVotingListFromPersonList=Ajouter un groupe à partir d'une liste de votants pollen.action.backToFavoriteLists=Retour à la liste des favoris pollen.action.cancel=Annuler +pollen.action.clone=Cloner le sondage +pollen.action.close=Fermer le sondage pollen.action.create=Créer pollen.action.createFavoriteList=Créer une ouvelle liste pollen.action.createPoll=Créer le sondage @@ -179,6 +181,8 @@ pollen.fieldset.userInformation.toUpdate=Informations de l'utilisateur à mettre à jour pollen.info.poll.created=Sondage créé pollen.info.poll.updated=Sondage mise à jour +pollen.information.confirmClonePoll=Confirmer le clonage du sondage \: +pollen.information.confirmClosePoll=Confirmer la fermeture du sondage \: pollen.information.confirmDeletePoll=Confirmer la suppression du sondage \: pollen.information.confirmDeletePollChoice=Confirmer la suppression du choix %s pollen.information.confirmDeletePollVote=Confirmer la suppression du vote de %s @@ -219,6 +223,8 @@ pollen.menu.userFavoriteLists=Listes de votants pollen.tab.poll.general=Informations pollen.tab.poll.options=Options +pollen.title.clone.poll=Clonage d'un sondage +pollen.title.close.poll=Fermeture d'un sondage pollen.title.createPoll=Nouveau sondage pollen.title.delete.poll=Suppression d'un sondage pollen.title.delete.pollChoice=Suppression d'un choix Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators.xml =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators.xml 2012-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators.xml 2012-03-15 06:48:52 UTC (rev 3194) @@ -29,7 +29,7 @@ <pattern>/images/*</pattern> <pattern>/config-browser/*</pattern> <pattern>/json/*</pattern> - <pattern>/poll/confirmDelete*</pattern> + <pattern>/poll/confirm*</pattern> <pattern>/poll/display*</pattern> <pattern>/poll/selectPersonListTo*</pattern> <pattern>/io/*</pattern> Added: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmClonePoll.jsp =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmClonePoll.jsp (rev 0) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmClonePoll.jsp 2012-03-15 06:48:52 UTC (rev 3194) @@ -0,0 +1,59 @@ +<%-- + #%L + Pollen :: UI (strust2) + + $Id: confirmDeletePoll.jsp 3185 2012-03-14 14:43:26Z tchemit $ + $HeadURL: http://svn.chorem.org/svn/pollen/branches/pollen-1.2.6-struts2/pollen-ui-str... $ + %% + 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" %> +<script type="text/javascript"> + function cancel() { + $('#confirmDialog').dialog('close'); + return false; + } +</script> +<s:form method="POST" namespace="/poll"> + <fieldset class="ui-widget-content ui-corner-all"> + + <s:hidden key="redirectUrl" label=''/> + <s:hidden key="uriId" label=''/> + + <s:text name="pollen.information.confirmClonePoll"/> + <div align="center" style="padding-top: 1em;"> + "<strong><s:property value="poll.title"/></strong>" + </div> + <br/> + + <strong>TODO Select new poll title + options to clone...</strong> + <br/> + + <div style="padding-top: 1em;"> + <strong><s:text + name="pollen.information.irreversible.operation"/></strong> + </div> + <hr/> + <div align="right"> + <s:submit onclick="return cancel();" theme="simple" + key="pollen.action.cancel"/> + <s:submit key="pollen.action.clone" theme="simple" disabled="true" + action="clone/%{pollId}"/> + </div> + </fieldset> +</s:form> \ No newline at end of file Added: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmClosePoll.jsp =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmClosePoll.jsp (rev 0) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmClosePoll.jsp 2012-03-15 06:48:52 UTC (rev 3194) @@ -0,0 +1,56 @@ +<%-- + #%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" %> +<script type="text/javascript"> + function cancel() { + $('#confirmDialog').dialog('close'); + return false; + } +</script> +<s:form method="POST" namespace="/poll"> + <fieldset class="ui-widget-content ui-corner-all"> + + <s:hidden key="redirectUrl" label=''/> + <s:hidden key="uriId" label=''/> + + <s:text name="pollen.information.confirmClosePoll"/> + <div align="center" style="padding-top: 1em;"> + "<strong><s:property value="poll.title"/></strong>" + </div> + <br/> + + <div style="padding-top: 1em;"> + <strong><s:text + name="pollen.information.irreversible.operation"/></strong> + </div> + <hr/> + <div align="right"> + <s:submit onclick="return cancel();" theme="simple" + key="pollen.action.cancel"/> + <s:submit key="pollen.action.close" theme="simple" + action="close/%{pollId}"/> + </div> + </fieldset> +</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/confirmClosePoll.jsp ___________________________________________________________________ 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/webapp/WEB-INF/jsp/poll/confirmDeletePoll.jsp =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmDeletePoll.jsp 2012-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmDeletePoll.jsp 2012-03-15 06:48:52 UTC (rev 3194) @@ -25,7 +25,7 @@ <%@ taglib prefix="s" uri="/struts-tags" %> <script type="text/javascript"> function cancel() { - $('#confirmDeletePollDialog').dialog('close'); + $('#confirmDialog').dialog('close'); return false; } </script> Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/create.jsp =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/create.jsp 2012-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/create.jsp 2012-03-15 06:48:52 UTC (rev 3194) @@ -34,11 +34,6 @@ <script type="text/javascript"> - function addPersonListToVotingList(personListId) { - console.info("person list to add into votingList : " + personListId); - return closeDialog(); - } - function selectPersonListToAddToVotingList(votingListNumber) { $('.ui-dialog-title').html('<s:text name="pollen.title.selectPersonListToAddVotingList"/>') var dialog = $("#selectPersonListDialog"); Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/dateChoice.jsp =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/dateChoice.jsp 2012-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/dateChoice.jsp 2012-03-15 06:48:52 UTC (rev 3194) @@ -36,7 +36,7 @@ theme="simple" value=''/> <sj:datepicker id='%{#prefix}.name' key="%{#prefix}.name" changeMonth="true" changeYear="true" labelSeparator="" theme="simple" label="" - timepicker="true" value="%{choice.date}"/> + timepicker="true" value="%{choice.date}" displayFormat="dd/mm/yy"/> - <s:label for="%{#prefix}.description" key="pollen.common.description" theme="simple"/> 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-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp 2012-03-15 06:48:52 UTC (rev 3194) @@ -178,11 +178,8 @@ <th> <s:if test="!isDescNull(#choice)"> - <span title="<s:text name="pollen.common.description"/>" - value="%{escapeLineBreak(#choice.description)}"> - <span class="desc"> + <span title='<s:property value="escapeLineBreak(#choice.description)"/>'> <s:property value="name"/> - </span> </span> </s:if> <s:else> Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/pollListHelper.jsp =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/pollListHelper.jsp 2012-03-15 06:47:10 UTC (rev 3193) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/pollListHelper.jsp 2012-03-15 06:48:52 UTC (rev 3194) @@ -38,11 +38,11 @@ <s:url id='resultImg' value='/img/count.png'/> <s:set id='resultTitle'><s:text name="pollen.action.pollResult"/></s:set> -<s:url id="editUrl" action="modification/" namespace="/poll" method="input"/> +<s:url id="editUrl" action="modification/" namespace="/poll"/> <s:url id='editImg' value='/img/edit.png'/> <s:set id='editTitle'><s:text name="pollen.action.pollEdit"/></s:set> -<s:url id="closeUrl" action="close/" namespace="/poll" method="input"/> +<s:url id="closeUrl" action="confirmClosePoll/" namespace="/poll"/> <s:url id='closeImg' value='/img/close.png'/> <s:set id='closeTitle'><s:text name="pollen.action.pollClose"/></s:set> @@ -61,7 +61,8 @@ <script type="text/javascript"> function confirmDelete(id) { - var dialog = $("#confirmDeletePollDialog"); + $('.ui-dialog-title').html("<s:text name="pollen.title.delete.poll"/>") + var dialog = $("#confirmDialog"); var url = "<s:url action='confirmDeletePoll/' namespace='/poll'/>"; url += id + '?' + $.param({redirectUrl:redirectUrl}); dialog.load(url); @@ -69,12 +70,31 @@ return false; } + function confirmClose(id) { + $('.ui-dialog-title').html("<s:text name="pollen.title.close.poll"/>") + var dialog = $("#confirmDialog"); + var url = "<s:url action='confirmClosePoll/' namespace='/poll'/>"; + url += id + '?' + $.param({redirectUrl:redirectUrl}); + dialog.load(url); + dialog.dialog('open'); + return false; + } + + function confirmClone(id) { + $('.ui-dialog-title').html("<s:text name="pollen.title.clone.poll"/>") + var dialog = $("#confirmDialog"); + var url = "<s:url action='confirmClonePoll/' namespace='/poll'/>"; + url += id + '?' + $.param({redirectUrl:redirectUrl}); + dialog.load(url); + dialog.dialog('open'); + return false; + } + function pollFunctions(cellvalue, options, rowObject) { var id = rowObject.pollId; var adminId = rowObject.adminId; - console.info("adminId = "+adminId); var result = ""; if (rowObject['voteId']) { @@ -91,13 +111,15 @@ result += formatLink("${editUrl}" + adminId, "${editImg}", "Edit", "${editTitle}") } if (cellvalue.indexOf('close') > -1) { - result += formatLink("${closeUrl}" + adminId, "${closeImg}", "Close", "${closeTitle}") + var script = 'return confirmClose("' + adminId + '");' + result += formatLinkByScript(script, "${closeImg}", "Close", "${closeTitle}") } if (cellvalue.indexOf('export') > -1) { result += formatLink("${exportUrl}" + id, "${exportImg}", "Export", "${exportTitle}") } if (cellvalue.indexOf('clone') > -1) { - result += formatLink("${cloneUrl}" + adminId, "${cloneImg}", "Clone", "${cloneTitle}") + var script = 'return confirmClone("' + adminId + '");' + result += formatLinkByScript(script, "${cloneImg}", "Clone", "${cloneTitle}") } if (cellvalue.indexOf('delete') > -1) { var script = 'return confirmDelete("' + adminId + '");' @@ -113,7 +135,5 @@ } </script> -<sj:dialog id="confirmDeletePollDialog" resizable="true" autoOpen="false" - title="%{getText('pollen.title.delete.poll')}" - modal="true" width="500"/> +<sj:dialog id="confirmDialog" autoOpen="false" modal="true" width="500"/>