r3185 - in branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main: java/org/chorem/pollen/ui java/org/chorem/pollen/ui/actions/json java/org/chorem/pollen/ui/actions/poll resources/config resources/i18n webapp/WEB-INF/jsp webapp/WEB-INF/jsp/poll
Author: tchemit Date: 2012-03-14 15:43:26 +0100 (Wed, 14 Mar 2012) New Revision: 3185 Url: http://chorem.org/repositories/revision/pollen/3185 Log: - add delete poll action - add adminId for poll in json actions - remove some javascript logs - change session log levels Added: 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/webapp/WEB-INF/jsp/poll/confirmDeletePoll.jsp Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenSession.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/GetInvitedPolls.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/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/jsp/poll/create.jsp branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/createdList.jsp branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/participatedList.jsp branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/selectPersonListToAddToVotingList.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/PollenSession.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenSession.java 2012-03-14 14:41:51 UTC (rev 3184) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenSession.java 2012-03-14 14:43:26 UTC (rev 3185) @@ -62,21 +62,24 @@ public void putDynamicData(String token, Object data) { getDynamicData().put(token, data); - if (log.isInfoEnabled()) { - log.info("Dynamic attributes size : " + getDynamicData().size()); + if (log.isDebugEnabled()) { + log.debug("Dynamic attributes size : " + getDynamicData().size()); } } public void removeDynamicData(String token) { getDynamicData().remove(token); - if (log.isInfoEnabled()) { - log.info("Dynamic attributes size : " + getDynamicData().size()); + if (log.isDebugEnabled()) { + log.debug("Dynamic attributes size : " + getDynamicData().size()); } } public void clearDynamicData() { if (dynamicData != null) { dynamicData.clear(); + if (log.isDebugEnabled()) { + log.debug("Dynamic attributes size : " + dynamicData.size()); + } } } 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-14 14:41:51 UTC (rev 3184) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/AbstractJSONPaginedAction.java 2012-03-14 14:43:26 UTC (rev 3185) @@ -27,6 +27,7 @@ import org.apache.struts2.json.JSONException; 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; /** @@ -47,8 +48,8 @@ public abstract Integer getRecords(); - protected FilterPagerUtil.FilterPagerBean pager = - FilterPagerUtil.newFilterPagerBean(); + protected TopiaFilterPagerUtil.FilterPagerBean pager = + TopiaFilterPagerUtil.newFilterPagerBean(); protected String filters; 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-14 14:41:51 UTC (rev 3184) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetCreatedPolls.java 2012-03-14 14:43:26 UTC (rev 3185) @@ -92,6 +92,7 @@ Poll.PROPERTY_END_DATE ); map.put("id", poll.getTopiaId()); + map.put("adminId", poll.getAdminId()); Set<String> functions = getPollFunctions(poll); map.put("functions", functions); polls[index++] = map; 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-14 14:41:51 UTC (rev 3184) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetInvitedPolls.java 2012-03-14 14:43:26 UTC (rev 3185) @@ -95,6 +95,7 @@ Poll.PROPERTY_END_DATE ); String userEmail = getPollenSession().getUserAccount().getEmail(); + map.put("adminId", poll.getAdminId()); map.put("voteId", getVoteId(poll, userEmail)); map.put("id", poll.getTopiaId()); Set<String> functions = getPollFunctions(poll); Added: 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 (rev 0) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeletePoll.java 2012-03-14 14:43:26 UTC (rev 3185) @@ -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; + +/** + * 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; + } +} Property changes on: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ConfirmDeletePoll.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/DeletePoll.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeletePoll.java 2012-03-14 14:41:51 UTC (rev 3184) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeletePoll.java 2012-03-14 14:43:26 UTC (rev 3185) @@ -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; /** * Deletes an existing poll. @@ -34,4 +34,26 @@ public class DeletePoll 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.deletePoll(pollId, getPollenSession().getUserAccount(), accountId); + +// String fullUrl = getApplicationUrl() + redirectUrl; +// setRedirectUrl(fullUrl); + return SUCCESS; + } } 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-14 14:41:51 UTC (rev 3184) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config/struts-poll.xml 2012-03-14 14:43:26 UTC (rev 3185) @@ -130,12 +130,21 @@ <result>/WEB-INF/jsp/home.jsp</result> </action> + <!-- confirm delete poll --> + <action name="confirmDeletePoll/*" + class="org.chorem.pollen.ui.actions.poll.ConfirmDeletePoll"> + <param name="uriId">{1}</param> + <result>/WEB-INF/jsp/poll/confirmDeletePoll.jsp</result> + </action> + <!-- delete poll --> <action name="delete/*" class="org.chorem.pollen.ui.actions.poll.DeletePoll"> <param name="uriId">{1}</param> - <result name="input">/WEB-INF/jsp/poll/delete.jsp</result> - <result>/WEB-INF/jsp/home.jsp</result> + <result type="redirect"> + <param name="location">${redirectUrl}</param> + <param name="prependServletContext">false</param> + </result> </action> <!-- display poll result --> @@ -149,8 +158,7 @@ <action name="createdList" class="org.chorem.pollen.ui.actions.poll.CreatedList"> <interceptor-ref name="pollenBasicLogguedStack"/> - <result name="input">/WEB-INF/jsp/poll/createdList.jsp</result> - <result>/WEB-INF/jsp/home.jsp</result> + <result>/WEB-INF/jsp/poll/createdList.jsp</result> </action> <!-- display participated polls --> 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-14 14:41:51 UTC (rev 3184) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-03-14 14:43:26 UTC (rev 3185) @@ -173,9 +173,11 @@ pollen.info.poll.created=Poll created pollen.info.poll.updated=Poll modified pollen.information.confirmDeleteChoice=Confirm delete of choice %s +pollen.information.confirmDeletePoll=Confirm delete of poll\: 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.irreversible.operation=Be ware, this operation is irreversible. 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. @@ -209,11 +211,12 @@ pollen.menu.register=Register pollen.menu.userFavoriteLists=Voting lists pollen.title.createPoll=New poll -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.delete.poll=Delete a poll +pollen.title.delete.pollChoice=Delete a poll choice +pollen.title.delete.pollComment=Delete a poll comment +pollen.title.delete.pollVote=Delete a poll vote +pollen.title.editFavoriteList=Edit a favorite list +pollen.title.favoriteLists=Your favorite lists pollen.title.myAccount=My account pollen.title.pollsCreatedList=Polls created pollen.title.pollsCreatedList.legend=Polls you have proposed @@ -222,6 +225,6 @@ pollen.title.pollsParticipatedList=Polls participated pollen.title.pollsParticipatedList.legend=Polls in which you are involved pollen.title.register=Register -pollen.title.selectPersonListToAddVotingList=Sélectionner une liste de votant à ajouter -pollen.title.selectPersonListToCreateVotingList=Sélectionner une liste de votant pour créer un nouveau groupe +pollen.title.selectPersonListToAddVotingList=Select a voter list to import in voting list +pollen.title.selectPersonListToCreateVotingList=Select a favorite list to import in a new voting list pollen.title.usersList=Users administration 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-14 14:41:51 UTC (rev 3184) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-03-14 14:43:26 UTC (rev 3185) @@ -179,10 +179,12 @@ 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.confirmDeletePollChoice=Confirmer la suppression du chois %s +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 pollen.information.favoriteList.created=La liste %s a été créée. pollen.information.favoriteList.deleted=La liste %s a été supprimée. +pollen.information.irreversible.operation=Attention, Cette opération est irréversible. 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. @@ -218,9 +220,10 @@ pollen.tab.poll.general=Informations pollen.tab.poll.options=Options pollen.title.createPoll=Nouveau sondage -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.delete.poll=Suppression d'un sondage +pollen.title.delete.pollChoice=Suppression d'un choix +pollen.title.delete.pollComment=Suppression d'un commentaire +pollen.title.delete.pollVote=Suppression d'un vote pollen.title.editFavoriteList=Edition de la liste des favoris pollen.title.favoriteLists=Vos listes de votants pollen.title.myAccount=Mon compte Added: 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 (rev 0) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmDeletePoll.jsp 2012-03-14 14:43:26 UTC (rev 3185) @@ -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() { + $('#confirmDeletePollDialog').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.confirmDeletePoll"/> + <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.delete" theme="simple" + action="delete/%{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/confirmDeletePoll.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/create.jsp =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/create.jsp 2012-03-14 14:41:51 UTC (rev 3184) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/create.jsp 2012-03-14 14:43:26 UTC (rev 3185) @@ -40,7 +40,6 @@ } function selectPersonListToAddToVotingList(votingListNumber) { - console.info("Add to votingList "+votingListNumber); $('.ui-dialog-title').html('<s:text name="pollen.title.selectPersonListToAddVotingList"/>') var dialog = $("#selectPersonListDialog"); var url = "<s:url action='selectPersonListToAddToVotingList' namespace='/poll'/>"; Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/createdList.jsp =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/createdList.jsp 2012-03-14 14:41:51 UTC (rev 3184) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/createdList.jsp 2012-03-14 14:43:26 UTC (rev 3185) @@ -25,6 +25,9 @@ <%@ taglib prefix="s" uri="/struts-tags" %> <%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags" %> +<script type="text/javascript"> +var redirectUrl = '<s:url namespace="/poll" action="createdList" method="input"/>'; +</script> <%@include file="/WEB-INF/jsp/pollListHelper.jsp"%> <title><s:text name="pollen.title.pollsCreatedList"/></title> Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/participatedList.jsp =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/participatedList.jsp 2012-03-14 14:41:51 UTC (rev 3184) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/participatedList.jsp 2012-03-14 14:43:26 UTC (rev 3185) @@ -24,7 +24,10 @@ <%@page contentType="text/html" pageEncoding="UTF-8" %> <%@ taglib prefix="s" uri="/struts-tags" %> <%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags" %> - +<script type="text/javascript"> + var redirectUrl = + '<s:url namespace="/poll" action="participatedList" method="input"/>'; +</script> <%@include file="/WEB-INF/jsp/pollListHelper.jsp"%> <title><s:text name="pollen.title.pollsParticipatedList"/></title> Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/selectPersonListToAddToVotingList.jsp =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/selectPersonListToAddToVotingList.jsp 2012-03-14 14:41:51 UTC (rev 3184) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/selectPersonListToAddToVotingList.jsp 2012-03-14 14:43:26 UTC (rev 3185) @@ -24,7 +24,6 @@ <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ taglib prefix="s" uri="/struts-tags" %> - <script type="text/javascript"> var votingListNumber = parseInt('<s:property value='%{votingListNumber}'/>'); 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-14 14:41:51 UTC (rev 3184) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/pollListHelper.jsp 2012-03-14 14:43:26 UTC (rev 3185) @@ -23,6 +23,7 @@ --%> <%@page contentType="text/html" pageEncoding="UTF-8" %> <%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> <script type="text/javascript" src="<s:url value='/js/gridHelper.js' />"></script> @@ -53,16 +54,27 @@ <s:url id='cloneImg' value='/img/copy.png'/> <s:set id='cloneTitle'><s:text name="pollen.action.pollClone"/></s:set> -<s:url id="deleteUrl" action="delete/" namespace="/poll" method="input"/> +<s:url id="deleteUrl" action="confirmDeletePoll/" namespace="/poll"/> <s:url id='deleteImg' value='/img/delete.png'/> <s:set id='deleteTitle'><s:text name="pollen.action.pollDelete"/></s:set> <script type="text/javascript"> + function confirmDelete(id) { + var dialog = $("#confirmDeletePollDialog"); + var url = "<s:url action='confirmDeletePoll/' 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']) { @@ -76,23 +88,32 @@ result += formatLink("${resultUrl}" + id, "${resultImg}", "Result", "${resultTitle}") } if (cellvalue.indexOf('edit') > -1) { - result += formatLink("${editUrl}" + id, "${editImg}", "Edit", "${editTitle}") + result += formatLink("${editUrl}" + adminId, "${editImg}", "Edit", "${editTitle}") } if (cellvalue.indexOf('close') > -1) { - result += formatLink("${closeUrl}" + id, "${closeImg}", "Close", "${closeTitle}") + result += formatLink("${closeUrl}" + adminId, "${closeImg}", "Close", "${closeTitle}") } if (cellvalue.indexOf('export') > -1) { result += formatLink("${exportUrl}" + id, "${exportImg}", "Export", "${exportTitle}") } if (cellvalue.indexOf('clone') > -1) { - result += formatLink("${cloneUrl}" + id, "${cloneImg}", "Clone", "${cloneTitle}") + result += formatLink("${cloneUrl}" + adminId, "${cloneImg}", "Clone", "${cloneTitle}") } if (cellvalue.indexOf('delete') > -1) { - result += formatLink("${deleteUrl}" + id, "${deleteImg}", "Delete", "${deleteTitle}") + var script = 'return confirmDelete("' + adminId + '");' + result += formatLinkByScript(script, "${deleteImg}", "Delete", "${deleteTitle}") } return result; } function formatLink(url, image, imageAlt, imageTitle) { return "<a href='" + url + "'><image alt='" + imageAlt + "' title='" + imageTitle + "' src='" + image + "'> </a>"; } + function formatLinkByScript(script, image, imageAlt, imageTitle) { + return "<a href='#' onclick='" + script + "'><image alt='" + imageAlt + "' title='" + imageTitle + "' src='" + image + "'> </a>"; + } </script> + +<sj:dialog id="confirmDeletePollDialog" resizable="true" autoOpen="false" + title="%{getText('pollen.title.delete.poll')}" + modal="true" width="500"/> +
participants (1)
-
tchemit@users.chorem.org