Pollen-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
April 2012
- 5 participants
- 111 discussions
r3232 - in branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main: java/org/chorem/pollen/ui/actions/poll java/org/chorem/pollen/ui/security resources/config resources/i18n webapp/WEB-INF/jsp webapp/WEB-INF/jsp/poll
by fdesbois@users.chorem.org 03 Apr '12
by fdesbois@users.chorem.org 03 Apr '12
03 Apr '12
Author: fdesbois
Date: 2012-04-03 20:16:13 +0200 (Tue, 03 Apr 2012)
New Revision: 3232
Url: http://chorem.org/repositories/revision/pollen/3232
Log:
- implement ClonePoll action based on EditPoll code
- manage input method for edit and clone actions
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/CreatePoll.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/security/AbstractPollenAuthorization.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/pollListHelper.jsp
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-04-03 18:16:07 UTC (rev 3231)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ClonePoll.java 2012-04-03 18:16:13 UTC (rev 3232)
@@ -23,36 +23,204 @@
*/
package org.chorem.pollen.ui.actions.poll;
-import org.chorem.pollen.services.impl.PollService;
+import com.google.common.base.Function;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
+import org.chorem.pollen.bean.PollImageChoice;
+import org.chorem.pollen.bean.PollUri;
+import org.chorem.pollen.business.persistence.Choice;
+import org.chorem.pollen.business.persistence.PersonToList;
+import org.chorem.pollen.business.persistence.Poll;
+import org.chorem.pollen.business.persistence.PollAccount;
+import org.chorem.pollen.business.persistence.VotingList;
+import org.chorem.pollen.common.ChoiceType;
+import org.chorem.pollen.common.PollType;
+import java.util.List;
+
/**
* Creates a new poll by cloning an existing one.
*
* @author tchemit <chemit(a)codelutin.com>
+ * @author fdesbois <desbois(a)codelutin.com>
* @since 1.2.6
*/
-public class ClonePoll extends AbstractPollUriIdAction {
+public class ClonePoll extends CreatePoll {
private static final long serialVersionUID = 1L;
- protected String redirectUrl;
+ private static final String PREFIX_CHOICE = "%sChoice_%d";
- public String getRedirectUrl() {
- return redirectUrl;
+ private static final String PREFIX_VOTING_LIST = "votingList_%d";
+
+ private static final String PREFIX_PERSON_TO_LIST = "personToList_%d_%d";
+
+ protected PollUri pollUri;
+
+ public final PollUri getUriId() {
+ return pollUri;
}
- public void setRedirectUrl(String redirectUrl) {
- this.redirectUrl = redirectUrl;
+ public final void setUriId(PollUri pollUri) {
+ this.pollUri = pollUri;
}
+ public String getPollUid() {
+ return pollUri.getPollId();
+ }
+
+ protected boolean keepTopiaId() {
+ return false;
+ }
+
@Override
- public String execute() throws Exception {
+ public Poll getPoll() {
+ if (poll == null) {
+ poll = getPollService().getPollByPollId(getPollUid());
+
+ if (!keepTopiaId()) {
+ poll.setTopiaId(null);
+
+ // Use a new pollId
+ String pollUid = serviceContext.createPollenUrlId();
+ poll.setPollId(pollUid);
+ }
+ }
+ return poll;
+ }
- PollService service = newService(PollService.class);
+ @Override
+ public void prepare() throws Exception {
- //TODO
-// service.clonePoll(pollId, getPollenUserAccount(), accountId);
+ // -- Choice --
+ ChoiceType choiceType = getPoll().getChoiceType();
+ prepareParams(getPoll().getChoice(), withChoicePrefix(choiceType));
- return SUCCESS;
+ // -- VotingList --
+ if (getPoll().getPollType() != PollType.FREE) {
+ prepareParams(getPoll().getVotingList(), withVotingListPrefix());
+ }
+
+ super.prepare();
}
+
+ private Function<Choice, String> withChoicePrefix(final ChoiceType choiceType) {
+ final String choiceTypeName = choiceType.name().toLowerCase();
+ return new IndexedFunction<Choice, String>() {
+
+ @Override
+ protected String apply(Choice input, int index) {
+
+ String prefix = String.format(PREFIX_CHOICE, choiceTypeName, index);
+ if (keepTopiaId()) {
+ putParameter(prefix, Choice.TOPIA_ID, input.getTopiaId());
+ }
+ putParameter(prefix, Choice.PROPERTY_NAME, input.getName());
+ putParameter(prefix, Choice.PROPERTY_DESCRIPTION, input.getDescription());
+
+ if (choiceType == ChoiceType.IMAGE) {
+ putParameter(prefix, PollImageChoice.PROPERTY_LOCATION, input.getName());
+ }
+
+ return prefix;
+ }
+ };
+ }
+
+ private Function<VotingList, String> withVotingListPrefix() {
+ return new IndexedFunction<VotingList, String>() {
+
+ @Override
+ protected String apply(VotingList input, int index) {
+
+ String prefix = String.format(PREFIX_VOTING_LIST, index);
+ if (keepTopiaId()) {
+ putParameter(prefix, VotingList.TOPIA_ID, input.getTopiaId());
+ }
+ putParameter(prefix, VotingList.PROPERTY_NAME, input.getName());
+ putParameter(prefix, VotingList.PROPERTY_WEIGHT, String.valueOf(input.getWeight()));
+
+ prepareParams(input.getPollAccountPersonToList(), withPersonToListPrefix(index));
+
+ return prefix;
+ }
+ };
+ }
+
+ private Function<PersonToList, String> withPersonToListPrefix(final int votingListIndex) {
+ return new IndexedFunction<PersonToList, String>() {
+
+ @Override
+ protected String apply(PersonToList input, int index) {
+
+ PollAccount pollAccount = input.getPollAccount();
+
+ String prefix = String.format(PREFIX_PERSON_TO_LIST, votingListIndex, index);
+ if (keepTopiaId()) {
+ putParameter(prefix, PersonToList.TOPIA_ID, input.getTopiaId());
+ }
+ putParameter(prefix, PersonToList.PROPERTY_WEIGHT, String.valueOf(input.getWeight()));
+ putParameter(prefix, PollAccount.PROPERTY_ACCOUNT_ID, pollAccount.getAccountId());
+ putParameter(prefix, PollAccount.PROPERTY_VOTING_ID, pollAccount.getVotingId());
+ putParameter(prefix, PollAccount.PROPERTY_EMAIL, pollAccount.getEmail());
+
+ return prefix;
+ }
+ };
+ }
+
+ /**
+ * Prepare the {@code source} for parameters using the {@code function} to
+ * push necessary data.
+ *
+ * @param source List of elements
+ * @param function Function used to push element data using {@link #putParameter(String, String, String)}
+ * @param <T> Type of data
+ * @see #putParameter(String, String, String)
+ */
+ private <T> void prepareParams(List<T> source, Function<T, String> function) {
+ ImmutableList.copyOf(Lists.transform(source, function));
+ }
+
+ /**
+ * Put some data in the {@code parameters} with name built using
+ * {@code prefix} and {@code property}. The {@code value} will be put for
+ * this parameter.
+ *
+ * @param prefix Prefix to use for the parameter name
+ * @param property Name of the {@code property} to push in parameters
+ * @param value Value of this {@code property}
+ */
+ private void putParameter(String prefix, String property, String value) {
+ parameters.put(prefix + "." + property, new String[]{value});
+ }
+
+ /**
+ * Guava {@link Function} that keeps index on each {@link Function#apply(Object)} call.
+ * You just have to implement {@link #apply(Object, int)} to have the current
+ * index of the {@code input} value.
+ *
+ * @param <F> Type of data where function will be applied on
+ * @param <T> Resulting type
+ */
+ private abstract static class IndexedFunction<F, T> implements Function<F, T> {
+
+ private int index;
+
+ @Override
+ public T apply(F input) {
+ T result = apply(input, index);
+ index++;
+ return result;
+ }
+
+ /**
+ * Called during {@link #apply(Object)} method with current {@code index}.
+ *
+ * @param input current value
+ * @param index current index
+ * @return the result of the function applied on the {@code input} object
+ */
+ protected abstract T apply(F input, int index);
+ }
}
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-04-03 18:16:07 UTC (rev 3231)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/CreatePoll.java 2012-04-03 18:16:13 UTC (rev 3232)
@@ -519,7 +519,7 @@
// remove all stuff from session
getPollenSession().clearDynamicData();
- addActionMessage(_("pollen.info.poll.created"));
+ addActionMessage(_("pollen.information.poll.created"));
return SUCCESS;
}
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-04-03 18:16:07 UTC (rev 3231)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/EditPoll.java 2012-04-03 18:16:13 UTC (rev 3232)
@@ -23,21 +23,8 @@
*/
package org.chorem.pollen.ui.actions.poll;
-import com.google.common.base.Function;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
-import org.chorem.pollen.bean.PollImageChoice;
-import org.chorem.pollen.bean.PollUri;
-import org.chorem.pollen.business.persistence.Choice;
-import org.chorem.pollen.business.persistence.PersonToList;
-import org.chorem.pollen.business.persistence.Poll;
-import org.chorem.pollen.business.persistence.PollAccount;
-import org.chorem.pollen.business.persistence.VotingList;
-import org.chorem.pollen.common.ChoiceType;
-import org.chorem.pollen.common.PollType;
import org.chorem.pollen.ui.actions.PollUriConverter;
-import java.util.List;
import java.util.Map;
/**
@@ -47,26 +34,10 @@
* @author fdesbois <desbois(a)codelutin.com>
* @since 1.2.6
*/
-public class EditPoll extends CreatePoll {
+public class EditPoll extends ClonePoll {
- private static final String PREFIX_CHOICE = "%sChoice_%d";
-
- private static final String PREFIX_VOTING_LIST = "votingList_%d";
-
- private static final String PREFIX_PERSON_TO_LIST = "personToList_%d_%d";
-
private static final long serialVersionUID = 1L;
- protected PollUri pollUri;
-
- public final PollUri getUriId() {
- return pollUri;
- }
-
- public final void setUriId(PollUri pollUri) {
- this.pollUri = pollUri;
- }
-
protected void preparePollUri(Map<String, String[]> parameters) {
if (pollUri == null) {
String[] values = parameters.get("uriId");
@@ -74,39 +45,20 @@
}
}
- protected boolean needTopiaId() {
+ @Override
+ protected boolean keepTopiaId() {
return true;
}
public boolean isVoteStarted() {
return getPoll().sizeVote() > 0;
}
-
+
@Override
- public Poll getPoll() {
- if (poll == null) {
- poll = getPollService().getPollByPollId(pollUri.getPollId());
- if (!needTopiaId()) {
- poll.setTopiaId(null);
- }
- }
- return poll;
- }
-
- @Override
public void prepare() throws Exception {
preparePollUri(parameters);
- // -- Choice --
- ChoiceType choiceType = getPoll().getChoiceType();
- prepareParams(getPoll().getChoice(), withChoicePrefix(choiceType));
-
- // -- VotingList --
- if (getPoll().getPollType() != PollType.FREE) {
- prepareParams(getPoll().getVotingList(), withVotingListPrefix());
- }
-
super.prepare();
}
@@ -118,127 +70,7 @@
// remove all stuff from session
getPollenSession().clearDynamicData();
- addActionMessage(_("pollen.info.poll.created"));
+ addActionMessage(_("pollen.information.poll.updated"));
return SUCCESS;
}
-
- private Function<Choice, String> withChoicePrefix(final ChoiceType choiceType) {
- final String choiceTypeName = choiceType.name().toLowerCase();
- return new IndexedFunction<Choice, String>() {
-
- @Override
- protected String apply(Choice input, int index) {
-
- String prefix = String.format(PREFIX_CHOICE, choiceTypeName, index);
- if (needTopiaId()) {
- putParameter(prefix, Choice.TOPIA_ID, input.getTopiaId());
- }
- putParameter(prefix, Choice.PROPERTY_NAME, input.getName());
- putParameter(prefix, Choice.PROPERTY_DESCRIPTION, input.getDescription());
-
- if (choiceType == ChoiceType.IMAGE) {
- putParameter(prefix, PollImageChoice.PROPERTY_LOCATION, input.getName());
- }
-
- return prefix;
- }
- };
- }
-
- private Function<VotingList, String> withVotingListPrefix() {
- return new IndexedFunction<VotingList, String>() {
-
- @Override
- protected String apply(VotingList input, int index) {
-
- String prefix = String.format(PREFIX_VOTING_LIST, index);
- if (needTopiaId()) {
- putParameter(prefix, VotingList.TOPIA_ID, input.getTopiaId());
- }
- putParameter(prefix, VotingList.PROPERTY_NAME, input.getName());
- putParameter(prefix, VotingList.PROPERTY_WEIGHT, String.valueOf(input.getWeight()));
-
- prepareParams(input.getPollAccountPersonToList(), withPersonToListPrefix(index));
-
- return prefix;
- }
- };
- }
-
- private Function<PersonToList, String> withPersonToListPrefix(final int votingListIndex) {
- return new IndexedFunction<PersonToList, String>() {
-
- @Override
- protected String apply(PersonToList input, int index) {
-
- PollAccount pollAccount = input.getPollAccount();
-
- String prefix = String.format(PREFIX_PERSON_TO_LIST, votingListIndex, index);
- if (needTopiaId()) {
- putParameter(prefix, PersonToList.TOPIA_ID, input.getTopiaId());
- }
- putParameter(prefix, PersonToList.PROPERTY_WEIGHT, String.valueOf(input.getWeight()));
- putParameter(prefix, PollAccount.PROPERTY_ACCOUNT_ID, pollAccount.getAccountId());
- putParameter(prefix, PollAccount.PROPERTY_VOTING_ID, pollAccount.getVotingId());
- putParameter(prefix, PollAccount.PROPERTY_EMAIL, pollAccount.getEmail());
-
- return prefix;
- }
- };
- }
-
- /**
- * Prepare the {@code source} for parameters using the {@code function} to
- * push necessary data.
- *
- * @param source List of elements
- * @param function Function used to push element data using {@link #putParameter(String, String, String)}
- * @param <T> Type of data
- * @see #putParameter(String, String, String)
- */
- private <T> void prepareParams(List<T> source, Function<T, String> function) {
- ImmutableList.copyOf(Lists.transform(source, function));
- }
-
- /**
- * Put some data in the {@code parameters} with name built using
- * {@code prefix} and {@code property}. The {@code value} will be put for
- * this parameter.
- *
- * @param prefix Prefix to use for the parameter name
- * @param property Name of the {@code property} to push in parameters
- * @param value Value of this {@code property}
- */
- private void putParameter(String prefix, String property, String value) {
- parameters.put(prefix + "." + property, new String[]{value});
- }
-
- /**
- * Guava {@link Function} that keeps index on each {@link Function#apply(Object)} call.
- * You just have to implement {@link #apply(Object, int)} to have the current
- * index of the {@code input} value.
- *
- * @param <F> Type of data where function will be applied on
- * @param <T> Resulting type
- */
- private abstract static class IndexedFunction<F, T> implements Function<F, T> {
-
- private int index;
-
- @Override
- public T apply(F input) {
- T result = apply(input, index);
- index++;
- return result;
- }
-
- /**
- * Called during {@link #apply(Object)} method with current {@code index}.
- *
- * @param input current value
- * @param index current index
- * @return the result of the function applied on the {@code input} object
- */
- protected abstract T apply(F input, int index);
- }
}
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/security/AbstractPollenAuthorization.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/security/AbstractPollenAuthorization.java 2012-04-03 18:16:07 UTC (rev 3231)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/security/AbstractPollenAuthorization.java 2012-04-03 18:16:13 UTC (rev 3232)
@@ -50,7 +50,7 @@
public abstract class AbstractPollenAuthorization extends AuthorizationFilter {
public static final Pattern URI_PATTERN =
- Pattern.compile("/.*/(.[^/]+)/(.+)");
+ Pattern.compile("/.*/(.[^/]+)/(.[^!]+)");
/** Logger. */
private static final Log log =
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-04-03 18:16:07 UTC (rev 3231)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config/struts-poll.xml 2012-04-03 18:16:13 UTC (rev 3232)
@@ -103,7 +103,8 @@
<action name="clone/*"
class="org.chorem.pollen.ui.actions.poll.ClonePoll">
<param name="uriId">{1}</param>
- <result type="redirect2"/>
+ <result name="input">/WEB-INF/jsp/poll/create.jsp</result>
+ <result>/WEB-INF/jsp/poll/resume.jsp</result>
</action>
<!-- export poll -->
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-04-03 18:16:07 UTC (rev 3231)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-04-03 18:16:13 UTC (rev 3232)
@@ -18,6 +18,7 @@
pollen.action.deleteUser=Delete selected user
pollen.action.deleteVote=Supprimer ce vote
pollen.action.editFavoriteList=Edit a list
+pollen.action.editPoll=Edit the poll
pollen.action.editPollAccount=Edit selected member
pollen.action.editUser=Edit selected user
pollen.action.editVote=Modifier le vote
@@ -178,8 +179,8 @@
pollen.fieldset.userInformation.toCreate=User informations to create
pollen.fieldset.userInformation.toDelete=User informations to delete
pollen.fieldset.userInformation.toUpdate=User informations to update
-pollen.info.poll.created=Poll created
-pollen.info.poll.updated=Poll modified
+pollen.information.poll.created=Poll created
+pollen.information.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
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-04-03 18:16:07 UTC (rev 3231)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-04-03 18:16:13 UTC (rev 3232)
@@ -21,6 +21,7 @@
pollen.action.deleteUser=Supprimer un utilisateur sélectionné
pollen.action.deleteVote=Supprimer ce vote
pollen.action.editFavoriteList=Editer une liste sélectionnée
+pollen.action.editPoll=Modifier le sondage
pollen.action.editPollAccount=Editer le membre sélectionné
pollen.action.editUser=Editer un utilisateur sélectionné
pollen.action.editVote=Modifier le vote
@@ -185,8 +186,8 @@
pollen.fieldset.userInformation.toCreate=Informations de l'utilisateur à créer
pollen.fieldset.userInformation.toDelete=Informations de l'utilisateur à supprimer
pollen.fieldset.userInformation.toUpdate=Informations de l'utilisateur à mettre à jour
-pollen.info.poll.created=Sondage créé
-pollen.info.poll.updated=Sondage mise à jour
+pollen.information.poll.created=Sondage créé
+pollen.information.poll.updated=Sondage mise à jour
pollen.information.confirmClonePoll=Confirmer le clonage du sondage \:
pollen.information.confirmClosePoll=Confirmer la fermeture du sondage \:
pollen.information.confirmDeleteFavoriteList=Confirmer la suppression de la liste de votants \:
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-04-03 18:16:07 UTC (rev 3231)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/create.jsp 2012-04-03 18:16:13 UTC (rev 3232)
@@ -185,6 +185,8 @@
<s:form method="POST" id="registerForm" namespace="/poll"
enctype="multipart/form-data">
+ <s:hidden key="poll.topiaId"/>
+
<sj:tabbedpanel id="formTabs" selectedTab="%{selectedTab}">
<sj:tab id="tabGeneral" target="tgeneral" key="pollen.tab.poll.general"/>
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-04-03 18:16:07 UTC (rev 3231)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/pollListHelper.jsp 2012-04-03 18:16:13 UTC (rev 3232)
@@ -40,6 +40,7 @@
<s:url id="editUrl" action="modification/" namespace="/poll"/>
<s:url id='editImg' value='/img/edit.png'/>
+<s:set id="editMethod" value="input"/>
<s:set id='editTitle'><s:text name="pollen.action.pollEdit"/></s:set>
<s:url id="closeUrl" action="confirmClosePoll/" namespace="/poll"/>
@@ -50,8 +51,9 @@
<s:url id='exportImg' value='/img/export.png'/>
<s:set id='exportTitle'><s:text name="pollen.action.pollExport"/></s:set>
-<s:url id="cloneUrl" action="clone/" namespace="/poll" method="input"/>
+<s:url id="cloneUrl" action="clone/" namespace="/poll"/>
<s:url id='cloneImg' value='/img/copy.png'/>
+<s:set id="cloneMethod" value="input"/>
<s:set id='cloneTitle'><s:text name="pollen.action.pollClone"/></s:set>
<s:url id="deleteUrl" action="confirmDeletePoll/" namespace="/poll"/>
@@ -80,15 +82,15 @@
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 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) {
@@ -108,7 +110,7 @@
result += formatLink("${resultUrl}" + id, "${resultImg}", "Result", "${resultTitle}")
}
if (cellvalue.indexOf('edit') > -1) {
- result += formatLink("${editUrl}" + adminId, "${editImg}", "Edit", "${editTitle}")
+ result += formatLink("${editUrl}" + adminId + "!${editMethod}", "${editImg}", "Edit", "${editTitle}")
}
if (cellvalue.indexOf('close') > -1) {
var script = 'return confirmClose("' + adminId + '");'
@@ -118,8 +120,9 @@
result += formatLink("${exportUrl}" + id, "${exportImg}", "Export", "${exportTitle}")
}
if (cellvalue.indexOf('clone') > -1) {
- var script = 'return confirmClone("' + adminId + '");'
- result += formatLinkByScript(script, "${cloneImg}", "Clone", "${cloneTitle}")
+// var script = 'return confirmClone("' + adminId + '");'
+// result += formatLinkByScript(script, "${cloneImg}", "Clone", "${cloneTitle}")
+ result += formatLink("${cloneUrl}" + id + "!${cloneMethod}", "${cloneImg}", "Clone", "${cloneTitle}")
}
if (cellvalue.indexOf('delete') > -1) {
var script = 'return confirmDelete("' + adminId + '");'
1
0
r3231 - in branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources: . org/chorem/pollen/ui/actions/poll
by fdesbois@users.chorem.org 03 Apr '12
by fdesbois@users.chorem.org 03 Apr '12
03 Apr '12
Author: fdesbois
Date: 2012-04-03 20:16:07 +0200 (Tue, 03 Apr 2012)
New Revision: 3231
Url: http://chorem.org/repositories/revision/pollen/3231
Log:
Use global conversion configuration for PollUri
Added:
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/xwork-conversion.properties
Removed:
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/poll/AbstractPollUriIdAction-conversion.properties
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/poll/CreatePoll-conversion.properties
Deleted: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/poll/AbstractPollUriIdAction-conversion.properties
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/poll/AbstractPollUriIdAction-conversion.properties 2012-04-03 16:47:41 UTC (rev 3230)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/poll/AbstractPollUriIdAction-conversion.properties 2012-04-03 18:16:07 UTC (rev 3231)
@@ -1,24 +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%
-###
-uriId=org.chorem.pollen.ui.actions.PollUriConverter
\ No newline at end of file
Deleted: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/poll/CreatePoll-conversion.properties
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/poll/CreatePoll-conversion.properties 2012-04-03 16:47:41 UTC (rev 3230)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/poll/CreatePoll-conversion.properties 2012-04-03 18:16:07 UTC (rev 3231)
@@ -1,24 +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%
-###
-uriId=org.chorem.pollen.ui.actions.PollUriConverter
\ No newline at end of file
Copied: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/xwork-conversion.properties (from rev 3230, branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/poll/AbstractPollUriIdAction-conversion.properties)
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/xwork-conversion.properties (rev 0)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/xwork-conversion.properties 2012-04-03 18:16:07 UTC (rev 3231)
@@ -0,0 +1,24 @@
+###
+# #%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%
+###
+org.chorem.pollen.bean.PollUri=org.chorem.pollen.ui.actions.PollUriConverter
\ No newline at end of file
1
0
r3230 - branches/pollen-1.2.6-struts2/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration
by tchemit@users.chorem.org 03 Apr '12
by tchemit@users.chorem.org 03 Apr '12
03 Apr '12
Author: tchemit
Date: 2012-04-03 18:47:41 +0200 (Tue, 03 Apr 2012)
New Revision: 3230
Url: http://chorem.org/repositories/revision/pollen/3230
Log:
rename inner class copy from t3
Modified:
branches/pollen-1.2.6-struts2/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallback.java
Modified: branches/pollen-1.2.6-struts2/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallback.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallback.java 2012-04-02 17:30:25 UTC (rev 3229)
+++ branches/pollen-1.2.6-struts2/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallback.java 2012-04-03 16:47:41 UTC (rev 3230)
@@ -50,7 +50,7 @@
};
public PollenMigrationCallback() {
- super(new T3MigrationCallBackForVersionResolver());
+ super(new PollenMigrationCallBackForVersionResolver());
}
@Override
@@ -74,7 +74,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 1.0.1
*/
- public static class T3MigrationCallBackForVersionResolver implements MigrationCallBackForVersionResolver {
+ public static class PollenMigrationCallBackForVersionResolver implements MigrationCallBackForVersionResolver {
@Override
public Class<? extends MigrationCallBackForVersion> getCallBack(Version version) {
1
0
Author: tchemit
Date: 2012-04-02 19:30:25 +0200 (Mon, 02 Apr 2012)
New Revision: 3229
Url: http://chorem.org/repositories/revision/pollen/3229
Log:
- use same behaviour for actions in grids
- fix EditPoll action (need to add the correct PollUri convertor)
- add svn properties + headers
Added:
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/Confirm.java
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/DeleteUser.java
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/Confirm.java
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/DeleteFavoriteList.java
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/DeletePollAccount.java
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/poll/CreatePoll-conversion.properties
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/admin/confirmDeleteUser.jsp
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/confirmDeleteFavoriteList.jsp
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/confirmDeletePollAccount.jsp
Modified:
branches/pollen-1.2.6-struts2/pollen-persistence/src/main/java/org/chorem/pollen/business/persistence/PersonToListDAOImpl.java
branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/bean/ChoiceHelper.java
branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/bean/PollUri.java
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/FileUploadAware.java
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/ManageUsers.java
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetUsers.java
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AddChoice.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/resources/config/struts-admin.xml
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-user.xml
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/struts.xml
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators.xml
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/admin/usersList.jsp
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/favoriteList.jsp
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/favoriteLists.jsp
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/js/favoriteList.js
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/js/favoriteLists.js
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/js/usersList.js
Modified: branches/pollen-1.2.6-struts2/pollen-persistence/src/main/java/org/chorem/pollen/business/persistence/PersonToListDAOImpl.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-persistence/src/main/java/org/chorem/pollen/business/persistence/PersonToListDAOImpl.java 2012-04-02 16:42:38 UTC (rev 3228)
+++ branches/pollen-1.2.6-struts2/pollen-persistence/src/main/java/org/chorem/pollen/business/persistence/PersonToListDAOImpl.java 2012-04-02 17:30:25 UTC (rev 3229)
@@ -1,3 +1,26 @@
+/*
+ * #%L
+ * Pollen :: Persistence
+ *
+ * $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.business.persistence;
import java.util.List;
Property changes on: branches/pollen-1.2.6-struts2/pollen-persistence/src/main/java/org/chorem/pollen/business/persistence/PersonToListDAOImpl.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/bean/ChoiceHelper.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/bean/ChoiceHelper.java 2012-04-02 16:42:38 UTC (rev 3228)
+++ branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/bean/ChoiceHelper.java 2012-04-02 17:30:25 UTC (rev 3229)
@@ -1,3 +1,26 @@
+/*
+ * #%L
+ * Pollen :: Services
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2012 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
package org.chorem.pollen.bean;
import com.google.common.base.Function;
Property changes on: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/bean/ChoiceHelper.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/bean/PollUri.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/bean/PollUri.java 2012-04-02 16:42:38 UTC (rev 3228)
+++ branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/bean/PollUri.java 2012-04-02 17:30:25 UTC (rev 3229)
@@ -26,14 +26,18 @@
import com.google.common.base.Preconditions;
import org.apache.commons.lang3.StringUtils;
+import java.io.Serializable;
+
/**
* TODO
*
* @author tchemit <chemit(a)codelutin.com>
* @since 1.2.6
*/
-public class PollUri {
+public class PollUri implements Serializable {
+ private static final long serialVersionUID = 1L;
+
public static PollUri newPollUri(String uri) {
PollUri result = new PollUri();
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/FileUploadAware.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/FileUploadAware.java 2012-04-02 16:42:38 UTC (rev 3228)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/FileUploadAware.java 2012-04-02 17:30:25 UTC (rev 3229)
@@ -1,3 +1,26 @@
+/*
+ * #%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;
import java.io.File;
Property changes on: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/FileUploadAware.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/Confirm.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/Confirm.java (rev 0)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/Confirm.java 2012-04-02 17:30:25 UTC (rev 3229)
@@ -0,0 +1,97 @@
+/*
+ * #%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.admin;
+
+import org.apache.commons.lang.StringUtils;
+import org.chorem.pollen.business.persistence.Poll;
+import org.chorem.pollen.business.persistence.UserAccount;
+import org.chorem.pollen.services.impl.PollService;
+import org.chorem.pollen.services.impl.UserService;
+import org.chorem.pollen.ui.actions.PollenActionSupport;
+
+/**
+ * Action for confirmation
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.2.6
+ */
+public class Confirm extends PollenActionSupport {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String userId;
+
+ protected String pollId;
+
+ protected UserAccount user;
+
+ protected Poll poll;
+
+ protected String redirectUrl;
+
+ public void setRedirectUrl(String redirectUrl) {
+ this.redirectUrl = redirectUrl;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+ public void setPollId(String pollId) {
+ this.pollId = pollId;
+ }
+
+ public String getRedirectUrl() {
+ return redirectUrl;
+ }
+
+ public UserAccount getUser() {
+ return user;
+ }
+
+ public Poll getPoll() {
+ return poll;
+ }
+
+ @Override
+ public String execute() throws Exception {
+
+ if (StringUtils.isNotEmpty(userId)) {
+
+ // load user
+ UserService service = newService(UserService.class);
+
+ user = service.getEntityById(UserAccount.class, userId);
+ }
+
+ if (StringUtils.isNotEmpty(pollId)) {
+
+ // load poll
+ PollService servcie = newService(PollService.class);
+
+ poll = servcie.getPollByPollId(pollId);
+ }
+
+ return SUCCESS;
+ }
+}
Property changes on: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/Confirm.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/DeleteUser.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/DeleteUser.java (rev 0)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/DeleteUser.java 2012-04-02 17:30:25 UTC (rev 3229)
@@ -0,0 +1,82 @@
+/*
+ * #%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.admin;
+
+import com.google.common.base.Preconditions;
+import org.chorem.pollen.business.persistence.UserAccount;
+import org.chorem.pollen.services.exceptions.UserNotFoundException;
+import org.chorem.pollen.services.impl.UserService;
+import org.chorem.pollen.ui.actions.PollenActionSupport;
+
+/**
+ * Delete a selected user.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.2.6
+ */
+public class DeleteUser extends PollenActionSupport {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String userId;
+
+ protected String redirectUrl;
+
+ public void setRedirectUrl(String redirectUrl) {
+ this.redirectUrl = redirectUrl;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ public String getRedirectUrl() {
+ return redirectUrl;
+ }
+
+ public String execute() throws Exception {
+
+ Preconditions.checkNotNull(userId);
+
+ UserService service = newService(UserService.class);
+
+ String result = INPUT;
+
+ try {
+ UserAccount user =
+ service.getEntityById(UserAccount.class, userId);
+
+ service.deleteUser(userId);
+ getTransaction().commitTransaction();
+ addActionMessage(
+ _("pollen.information.user.deleted", user.getDisplayName()));
+
+ result = SUCCESS;
+ } catch (UserNotFoundException e) {
+ addFieldError("deleteUser.login",
+ _("pollen.error.user.not.found"));
+ }
+ return result;
+ }
+}
Property changes on: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/DeleteUser.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/admin/ManageUsers.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/ManageUsers.java 2012-04-02 16:42:38 UTC (rev 3228)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/ManageUsers.java 2012-04-02 17:30:25 UTC (rev 3229)
@@ -28,7 +28,6 @@
import org.chorem.pollen.services.exceptions.UserEmailAlreadyUsedException;
import org.chorem.pollen.services.exceptions.UserInvalidPasswordException;
import org.chorem.pollen.services.exceptions.UserLoginAlreadyUsedException;
-import org.chorem.pollen.services.exceptions.UserNotFoundException;
import org.chorem.pollen.services.impl.UserService;
import org.chorem.pollen.ui.actions.PollenActionSupport;
@@ -60,9 +59,9 @@
return getUser();
}
- public UserAccount getDeleteUser() {
- return getUser();
- }
+// public UserAccount getDeleteUser() {
+// return getUser();
+// }
public String getAction() {
return action;
@@ -129,28 +128,28 @@
return result;
}
- public String delete() throws Exception {
-
- Preconditions.checkNotNull(user);
-
- UserService service = newService(UserService.class);
-
- String result = INPUT;
-
- try {
- service.deleteUser(user.getTopiaId());
- getTransaction().commitTransaction();
- addActionMessage(
- _("pollen.information.user.deleted", user.getDisplayName()));
-
- // remove this user, otherwise it will be reused in the user lists
- user = null;
- action = null;
- result = SUCCESS;
- } catch (UserNotFoundException e) {
- addFieldError("deleteUser.login",
- _("pollen.error.user.not.found"));
- }
- return result;
- }
+// public String delete() throws Exception {
+//
+// Preconditions.checkNotNull(user);
+//
+// UserService service = newService(UserService.class);
+//
+// String result = INPUT;
+//
+// try {
+// service.deleteUser(user.getTopiaId());
+// getTransaction().commitTransaction();
+// addActionMessage(
+// _("pollen.information.user.deleted", user.getDisplayName()));
+//
+// // remove this user, otherwise it will be reused in the user lists
+// user = null;
+// action = null;
+// result = SUCCESS;
+// } catch (UserNotFoundException e) {
+// addFieldError("deleteUser.login",
+// _("pollen.error.user.not.found"));
+// }
+// return result;
+// }
}
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetUsers.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetUsers.java 2012-04-02 16:42:38 UTC (rev 3228)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetUsers.java 2012-04-02 17:30:25 UTC (rev 3229)
@@ -23,6 +23,7 @@
*/
package org.chorem.pollen.ui.actions.json;
+import com.google.common.collect.Sets;
import org.chorem.pollen.business.persistence.UserAccount;
import org.chorem.pollen.entities.PollenBinderHelper;
import org.chorem.pollen.services.impl.UserService;
@@ -30,6 +31,7 @@
import java.util.List;
import java.util.Map;
+import java.util.Set;
/**
* Obtain paginated users.
@@ -74,6 +76,7 @@
List<UserAccount> allUsers = userService.getUsers(pager);
+ UserAccount userAccount = getPollenUserAccount();
users = new Map[allUsers.size()];
Binder<UserAccount, UserAccount> binder =
PollenBinderHelper.getSimpleTopiaBinder(UserAccount.class);
@@ -83,9 +86,24 @@
user
);
map.put("id", user.getTopiaId());
+ Set<String> functions = getUserFunctions(userAccount, user);
+ map.put("functions", functions);
+
users[index++] = map;
}
return SUCCESS;
}
+
+ protected Set<String> getUserFunctions(UserAccount connectedUser, UserAccount user) {
+ Set<String> result = Sets.newHashSet();
+ result.add("edit");
+ if (!user.equals(connectedUser)) {
+
+ // can not delete current connected user
+
+ result.add("delete");
+ }
+ return result;
+ }
}
Property changes on: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AddChoice.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/EditPoll.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/EditPoll.java 2012-04-02 16:42:38 UTC (rev 3228)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/EditPoll.java 2012-04-02 17:30:25 UTC (rev 3229)
@@ -55,6 +55,8 @@
private static final String PREFIX_PERSON_TO_LIST = "personToList_%d_%d";
+ private static final long serialVersionUID = 1L;
+
protected PollUri pollUri;
public final PollUri getUriId() {
Added: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/Confirm.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/Confirm.java (rev 0)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/Confirm.java 2012-04-02 17:30:25 UTC (rev 3229)
@@ -0,0 +1,96 @@
+/*
+ * #%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.user;
+
+import org.apache.commons.lang.StringUtils;
+import org.chorem.pollen.business.persistence.PersonList;
+import org.chorem.pollen.business.persistence.PollAccount;
+import org.chorem.pollen.services.impl.FavoriteService;
+import org.chorem.pollen.ui.actions.PollenActionSupport;
+
+/**
+ * Action for confirmation
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.2.6
+ */
+public class Confirm extends PollenActionSupport {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String favoriteListId;
+
+ protected String pollAccountId;
+
+ protected PersonList favoriteList;
+
+ protected PollAccount pollAccount;
+
+ protected String redirectUrl;
+
+ public void setRedirectUrl(String redirectUrl) {
+ this.redirectUrl = redirectUrl;
+ }
+
+ public void setPollAccountId(String pollAccountId) {
+ this.pollAccountId = pollAccountId;
+ }
+
+ public void setFavoriteListId(String favoriteListId) {
+ this.favoriteListId = favoriteListId;
+ }
+
+ public String getRedirectUrl() {
+ return redirectUrl;
+ }
+
+ public PersonList getFavoriteList() {
+ return favoriteList;
+ }
+
+ public PollAccount getPollAccount() {
+ return pollAccount;
+ }
+
+ @Override
+ public String execute() throws Exception {
+
+ FavoriteService service = newService(FavoriteService.class);
+
+ if (StringUtils.isNotEmpty(favoriteListId)) {
+
+ // load favorite list
+ favoriteList = service.getEntityById(PersonList.class,
+ favoriteListId);
+ }
+
+ if (StringUtils.isNotEmpty(pollAccountId)) {
+
+ // load poll account
+ pollAccount = service.getEntityById(PollAccount.class,
+ pollAccountId);
+ }
+ return SUCCESS;
+ }
+}
Property changes on: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/Confirm.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/DeleteFavoriteList.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/DeleteFavoriteList.java (rev 0)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/DeleteFavoriteList.java 2012-04-02 17:30:25 UTC (rev 3229)
@@ -0,0 +1,85 @@
+/*
+ * #%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.user;
+
+import com.google.common.base.Preconditions;
+import org.chorem.pollen.business.persistence.PersonList;
+import org.chorem.pollen.services.exceptions.UserNotFoundException;
+import org.chorem.pollen.services.impl.FavoriteService;
+import org.chorem.pollen.ui.actions.PollenActionSupport;
+
+/**
+ * Delete a selected favorite list for the connected user.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.2.6
+ */
+public class DeleteFavoriteList extends PollenActionSupport {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String favoriteListId;
+
+ protected String redirectUrl;
+
+ public void setRedirectUrl(String redirectUrl) {
+ this.redirectUrl = redirectUrl;
+ }
+
+ public void setFavoriteListId(String favoriteListId) {
+ this.favoriteListId = favoriteListId;
+ }
+
+ public String getRedirectUrl() {
+ return redirectUrl;
+ }
+
+ public String execute() throws Exception {
+
+ Preconditions.checkNotNull(favoriteListId);
+
+ String result = INPUT;
+
+ try {
+ FavoriteService service = newService(FavoriteService.class);
+
+ PersonList favoriteList = service.getEntityById(
+ PersonList.class, favoriteListId);
+
+ PersonList deletedFavoritedList = service.deleteFavoriteList(
+ getPollenUserAccount(), favoriteList);
+
+ getTransaction().commitTransaction();
+
+ addActionMessage(_("pollen.information.favoriteList.deleted",
+ deletedFavoritedList.getName()));
+
+ result = SUCCESS;
+ } catch (UserNotFoundException e) {
+ addFieldError("deleteUser.login",
+ _("pollen.error.user.not.found"));
+ }
+ return result;
+ }
+}
Property changes on: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/DeleteFavoriteList.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/DeletePollAccount.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/DeletePollAccount.java (rev 0)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/DeletePollAccount.java 2012-04-02 17:30:25 UTC (rev 3229)
@@ -0,0 +1,86 @@
+/*
+ * #%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.user;
+
+import com.google.common.base.Preconditions;
+import org.chorem.pollen.business.persistence.PersonList;
+import org.chorem.pollen.business.persistence.PollAccount;
+import org.chorem.pollen.services.impl.FavoriteService;
+import org.chorem.pollen.ui.actions.PollenActionSupport;
+
+/**
+ * Delete a selected favorite list for the connected user.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.2.6
+ */
+public class DeletePollAccount extends PollenActionSupport {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String favoriteListId;
+
+ protected String pollAccountId;
+
+ protected String redirectUrl;
+
+ public void setRedirectUrl(String redirectUrl) {
+ this.redirectUrl = redirectUrl;
+ }
+
+ public void setFavoriteListId(String favoriteListId) {
+ this.favoriteListId = favoriteListId;
+ }
+
+ public void setPollAccountId(String pollAccountId) {
+ this.pollAccountId = pollAccountId;
+ }
+
+ public String getRedirectUrl() {
+ return redirectUrl;
+ }
+
+ public String execute() throws Exception {
+
+ Preconditions.checkNotNull(pollAccountId);
+
+ FavoriteService service = newService(FavoriteService.class);
+
+ PersonList favoriteList = service.getEntityById(PersonList.class,
+ favoriteListId);
+
+ PollAccount pollAccount = service.getEntityById(PollAccount.class,
+ pollAccountId);
+
+ service.removePollAccountToFavoriteList(favoriteList, pollAccount);
+
+ getTransaction().commitTransaction();
+
+ addActionMessage(
+ _("pollen.information.pollAccount.removedFromFavoriteList",
+ pollAccount.getVotingId()));
+
+ return SUCCESS;
+ }
+}
Property changes on: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/DeletePollAccount.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config/struts-admin.xml
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config/struts-admin.xml 2012-04-02 16:42:38 UTC (rev 3228)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config/struts-admin.xml 2012-04-02 17:30:25 UTC (rev 3229)
@@ -62,11 +62,18 @@
<result>/WEB-INF/jsp/admin/usersList.jsp</result>
</action>
+ <!-- confirm delete user -->
+ <action name="confirmDeleteUser"
+ class="org.chorem.pollen.ui.actions.admin.Confirm">
+ <result>/WEB-INF/jsp/admin/confirmDeleteUser.jsp</result>
+ </action>
+
<!-- delete user -->
- <action name="delete" method="delete"
- class="org.chorem.pollen.ui.actions.admin.ManageUsers">
- <result name="input">/WEB-INF/jsp/admin/usersList.jsp</result>
- <result>/WEB-INF/jsp/admin/usersList.jsp</result>
+ <action name="deleteUser"
+ class="org.chorem.pollen.ui.actions.admin.DeleteUser">
+ <!--<result name="input">/WEB-INF/jsp/admin/usersList.jsp</result>-->
+ <result type="redirect2"/>
+ <!--<result>/WEB-INF/jsp/admin/usersList.jsp</result>-->
</action>
</package>
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-04-02 16:42:38 UTC (rev 3228)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config/struts-poll.xml 2012-04-02 17:30:25 UTC (rev 3229)
@@ -39,11 +39,6 @@
<param name="actionName">votefor/${uriId}</param>
</result-type>
- <result-type name="redirect2"
- class="org.apache.struts2.dispatcher.ServletRedirectResult">
- <param name="location">${redirectUrl}</param>
- <param name="prependServletContext">false</param>
- </result-type>
</result-types>
<!-- create poll -->
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config/struts-user.xml
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config/struts-user.xml 2012-04-02 16:42:38 UTC (rev 3228)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config/struts-user.xml 2012-04-02 17:30:25 UTC (rev 3229)
@@ -79,12 +79,19 @@
<result>/WEB-INF/jsp/user/favoriteLists.jsp</result>
</action>
+ <!-- confirm delete favorite list -->
+ <action name="confirmDeleteFavoriteList"
+ class="org.chorem.pollen.ui.actions.user.Confirm">
+ <result>/WEB-INF/jsp/user/confirmDeleteFavoriteList.jsp</result>
+ </action>
+
<!-- delete favorite list -->
- <action name="deleteFavoriteList" method="delete"
- class="org.chorem.pollen.ui.actions.user.ManageFavoriteLists">
+ <action name="deleteFavoriteList"
+ class="org.chorem.pollen.ui.actions.user.DeleteFavoriteList">
<interceptor-ref name="pollenParamsPrepareParamsStack"/>
- <result name="input">/WEB-INF/jsp/user/favoriteLists.jsp</result>
- <result>/WEB-INF/jsp/user/favoriteLists.jsp</result>
+ <!--<result name="input">/WEB-INF/jsp/user/favoriteLists.jsp</result>-->
+ <result type="redirect2"/>
+ <!--<result>/WEB-INF/jsp/user/favoriteLists.jsp</result>-->
</action>
<!-- edit favorite list -->
@@ -110,12 +117,19 @@
<result>/WEB-INF/jsp/user/favoriteList.jsp</result>
</action>
+ <!-- confirm delete poll account from a favorite list -->
+ <action name="confirmDeletePollAccount"
+ class="org.chorem.pollen.ui.actions.user.Confirm">
+ <result>/WEB-INF/jsp/user/confirmDeletePollAccount.jsp</result>
+ </action>
+
<!-- remove poll account from a favorite list -->
- <action name="removePollAccount" method="delete"
- class="org.chorem.pollen.ui.actions.user.ManageFavoriteList">
+ <action name="deletePollAccount"
+ class="org.chorem.pollen.ui.actions.user.DeletePollAccount">
<interceptor-ref name="pollenParamsPrepareParamsStack"/>
- <result name="input">/WEB-INF/jsp/user/favoriteList.jsp</result>
- <result>/WEB-INF/jsp/user/favoriteList.jsp</result>
+ <!--<result name="input">/WEB-INF/jsp/user/favoriteList.jsp</result>-->
+ <!--<result>/WEB-INF/jsp/user/favoriteList.jsp</result>-->
+ <result type="redirect2"/>
</action>
<!-- display createds 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-04-02 16:42:38 UTC (rev 3228)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-04-02 17:30:25 UTC (rev 3229)
@@ -183,7 +183,9 @@
pollen.information.confirmClonePoll=Confirm clone of poll\:
pollen.information.confirmClosePoll=Confirm close of poll\:
pollen.information.confirmDeleteChoice=Confirm delete of choice %s
+pollen.information.confirmDeleteFavoriteList=Confirm delete of favorite list\:
pollen.information.confirmDeletePoll=Confirm delete of poll\:
+pollen.information.confirmDeleteUser=Confirm delete of user %s
pollen.information.confirmDeleteVote=Confirm delete of vote for %s
pollen.information.favoriteList.created=Favorite list %s created.
pollen.information.favoriteList.deleted=Favorite list %s deleted.
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-04-02 16:42:38 UTC (rev 3228)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-04-02 17:30:25 UTC (rev 3229)
@@ -189,9 +189,12 @@
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.confirmDeleteFavoriteList=Confirmer la suppression de la liste de votants \:
pollen.information.confirmDeletePoll=Confirmer la suppression du sondage \:
+pollen.information.confirmDeletePollAccount=Confirmer la suppression du votant \:
pollen.information.confirmDeletePollChoice=Confirmer la suppression du choix %s
pollen.information.confirmDeletePollVote=Confirmer la suppression du vote de %s
+pollen.information.confirmDeleteUser=Confirmer la suppression de l'utilisateur \:
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.
Added: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/poll/CreatePoll-conversion.properties
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/poll/CreatePoll-conversion.properties (rev 0)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/poll/CreatePoll-conversion.properties 2012-04-02 17:30:25 UTC (rev 3229)
@@ -0,0 +1,24 @@
+###
+# #%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%
+###
+uriId=org.chorem.pollen.ui.actions.PollUriConverter
\ No newline at end of file
Property changes on: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/poll/CreatePoll-conversion.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/struts.xml
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/struts.xml 2012-04-02 16:42:38 UTC (rev 3228)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/struts.xml 2012-04-02 17:30:25 UTC (rev 3229)
@@ -57,6 +57,12 @@
<param name="namespace">/</param>
<param name="actionName">home</param>
</result-type>
+
+ <result-type name="redirect2"
+ class="org.apache.struts2.dispatcher.ServletRedirectResult">
+ <param name="location">${redirectUrl}</param>
+ <param name="prependServletContext">false</param>
+ </result-type>
</result-types>
<interceptors>
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-04-02 16:42:38 UTC (rev 3228)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators.xml 2012-04-02 17:30:25 UTC (rev 3229)
@@ -29,6 +29,8 @@
<pattern>/images/*</pattern>
<pattern>/config-browser/*</pattern>
<pattern>/json/*</pattern>
+ <pattern>/user/confirm*</pattern>
+ <pattern>/admin/confirm*</pattern>
<pattern>/poll/confirm*</pattern>
<pattern>/poll/display*</pattern>
<pattern>/poll/selectPersonListTo*</pattern>
Added: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/admin/confirmDeleteUser.jsp
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/admin/confirmDeleteUser.jsp (rev 0)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/admin/confirmDeleteUser.jsp 2012-04-02 17:30:25 UTC (rev 3229)
@@ -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="/admin">
+ <fieldset class="ui-widget-content ui-corner-all">
+
+ <s:hidden key="redirectUrl" label=''/>
+ <s:hidden key="userId" value='%{user.topiaId}' label=''/>
+
+ <s:text name="pollen.information.confirmDeleteUser"/>
+ <div align="center" style="padding-top: 1em;">
+ "<strong><s:property value="user.displayName"/></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="deleteUser"/>
+ </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/admin/confirmDeleteUser.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/admin/usersList.jsp
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/admin/usersList.jsp 2012-04-02 16:42:38 UTC (rev 3228)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/admin/usersList.jsp 2012-04-02 17:30:25 UTC (rev 3229)
@@ -24,6 +24,7 @@
<%@page contentType="text/html" pageEncoding="UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags" %>
+<%@ taglib prefix="sj" uri="/struts-jquery-tags" %>
<script type="text/javascript"
src="<s:url value='/js/gridHelper.js' />"></script>
@@ -39,11 +40,17 @@
<s:set var="user" value="%{#session.pollenSession.userAccount}"/>
<script type="text/javascript">
+
+ var redirectUrl = '<s:url namespace="/admin" action="usersList"/>';
+ var deleteTitle = '<s:text name="pollen.action.deleteUser"/>';
+ var deleteUrl = '<s:url action="confirmDeleteUser" namespace="/admin"/>';
+ var loadUserUrl = '<s:url action="getUser" namespace="/json"/>';
+ var editImg = '<s:url value='/img/edit.png'/>';
+ var editTitle = '<s:text name="pollen.action.editUser"/>';
+ var deleteImg = '<s:url value='/img/delete.png'/>';
+
jQuery(document).ready(function () {
- initUsersPage(
- '${action}',
- '<s:url action="getUser" namespace="/json"/>'
- );
+ initUsersPage('${action}', '${user.topiaId}');
});
</script>
@@ -57,69 +64,70 @@
navigatorAdd="false" viewrecords="true"
rowList="10,15,20,50,100" rowNum="10"
navigatorExtraButtons="{
- add: { title: '%{getText(\"pollen.action.createUser\")}', icon: 'ui-icon-plus', topic: 'users-addRow' },
- edit: { title: '%{getText(\"pollen.action.editUser\")}', icon: 'ui-icon-pencil', topic: 'users-editRow' },
- delete:{ title: '%{getText(\"pollen.action.deleteUser\")}', icon: 'ui-icon-trash', topic: 'users-deleteRow' }}">
+ add: { title: '%{getText(\"pollen.action.createUser\")}', icon: 'ui-icon-plus', topic: 'users-addRow' }}">
<sjg:gridColumn name="id" title="id" hidden="true"/>
<sjg:gridColumn name="login" title='%{getText("pollen.common.login")}'/>
- <sjg:gridColumn name="firstName" title='%{getText("pollen.common.firstName")}'/>
+ <sjg:gridColumn name="firstName"
+ title='%{getText("pollen.common.firstName")}'/>
<sjg:gridColumn name="lastName" title='%{getText("pollen.common.lastName")}'/>
<sjg:gridColumn name="email" title='%{getText("pollen.common.email")}'/>
- <sjg:gridColumn name="administrator" width="100" formatter="checkbox"
- title='%{getText("pollen.common.administrator")}' />
+ <sjg:gridColumn name="administrator" width="20" formatter="checkbox"
+ title='%{getText("pollen.common.administrator")}'/>
+ <sjg:gridColumn name="functions" title='%{getText("pollen.common.functions")}'
+ formatter="userFunctions" width="40" sortable="false"/>
</sjg:grid>
<br/>
-<s:form id='createForm' method="POST" namespace="/admin" cssClass="hidden userForm">
+<s:form id='createForm' method="POST" namespace="/admin"
+ cssClass="hidden userForm">
<s:hidden name="action" value="create"/>
<fieldset>
<legend><s:text name="pollen.fieldset.userInformation.toCreate"/></legend>
- <s:textfield key="createUser.login" label="%{getText('pollen.common.login')}" required="true" size="40"/>
- <s:textfield key="createUser.email" label="%{getText('pollen.common.email')}" required="true" size="40"/>
- <s:textfield key="createUser.firstName" label="%{getText('pollen.common.firstName')}" size="40"/>
- <s:textfield key="createUser.lastName" label="%{getText('pollen.common.lastName')}" size="40"/>
- <s:checkbox key="createUser.administrator" label="%{getText('pollen.common.administrator')}"/>
+ <s:textfield key="createUser.login"
+ label="%{getText('pollen.common.login')}" required="true"
+ size="40"/>
+ <s:textfield key="createUser.email"
+ label="%{getText('pollen.common.email')}" required="true"
+ size="40"/>
+ <s:textfield key="createUser.firstName"
+ label="%{getText('pollen.common.firstName')}" size="40"/>
+ <s:textfield key="createUser.lastName"
+ label="%{getText('pollen.common.lastName')}" size="40"/>
+ <s:checkbox key="createUser.administrator"
+ label="%{getText('pollen.common.administrator')}"/>
</fieldset>
<br/>
<s:submit action="create" key="pollen.action.create" align="center"/>
</s:form>
-<s:form id='editForm' method="POST" namespace="/admin" cssClass="hidden userForm">
+<s:form id='editForm' method="POST" namespace="/admin"
+ cssClass="hidden userForm">
<s:hidden name="action" value="edit"/>
<s:hidden key="editUser.topiaId" label=""/>
<fieldset>
<legend><s:text name="pollen.fieldset.userInformation.toUpdate"/></legend>
- <s:textfield key="editUser.login" label="%{getText('pollen.common.login')}" required="true" readonly="true" size="40"/>
- <s:textfield key="editUser.email" label="%{getText('pollen.common.email')}" required="true" size="40"/>
- <s:textfield key="editUser.firstName" label="%{getText('pollen.common.firstName')}" size="40"/>
- <s:textfield key="editUser.lastName" label="%{getText('pollen.common.lastName')}" size="40"/>
- <s:checkbox key="editUser.administrator" label="%{getText('pollen.common.administrator')}"/>
+ <s:textfield key="editUser.login" label="%{getText('pollen.common.login')}"
+ required="true" readonly="true" size="40"/>
+ <s:textfield key="editUser.email" label="%{getText('pollen.common.email')}"
+ required="true" size="40"/>
+ <s:textfield key="editUser.firstName"
+ label="%{getText('pollen.common.firstName')}" size="40"/>
+ <s:textfield key="editUser.lastName"
+ label="%{getText('pollen.common.lastName')}" size="40"/>
+ <s:checkbox key="editUser.administrator"
+ label="%{getText('pollen.common.administrator')}"/>
</fieldset>
<br/>
<s:submit action="edit" key="pollen.action.validate" align="center"/>
</s:form>
-<s:form id='deleteForm' method="POST" namespace="/admin" cssClass="hidden userForm">
+<sj:dialog id="confirmDialog" autoOpen="false" modal="true" width="500"/>
- <s:hidden name="action" value="delete"/>
- <s:hidden key="deleteUser.topiaId" label=""/>
- <fieldset>
- <legend><s:text name="pollen.fieldset.userInformation.toDelete"/></legend>
- <s:textfield key="deleteUser.login" label="%{getText('pollen.common.login')}" required="true" readonly="true" size="40"/>
- <s:textfield key="deleteUser.email" label="%{getText('pollen.common.email')}" required="true" readonly="true" size="40"/>
- <s:textfield key="deleteUser.firstName" label="%{getText('pollen.common.firstName')}" readonly="true" size="40"/>
- <s:textfield key="deleteUser.lastName" label="%{getText('pollen.common.lastName')}" readonly="true" size="40"/>
- <s:checkbox key="deleteUser.administrator" label="%{getText('pollen.common.administrator')}" disabled="true"/>
- </fieldset>
- <br/>
- <s:submit action="delete" key="pollen.action.delete" align="center"/>
-</s:form>
-
Added: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/confirmDeleteFavoriteList.jsp
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/confirmDeleteFavoriteList.jsp (rev 0)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/confirmDeleteFavoriteList.jsp 2012-04-02 17:30:25 UTC (rev 3229)
@@ -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="/user">
+ <fieldset class="ui-widget-content ui-corner-all">
+
+ <s:hidden key="redirectUrl" label=''/>
+ <s:hidden key="favoriteListId" value='%{favoriteList.topiaId}' label=''/>
+
+ <s:text name="pollen.information.confirmDeleteFavoriteList"/>
+ <div align="center" style="padding-top: 1em;">
+ "<strong><s:property value="favoriteList.name"/></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="deleteFavoriteList"/>
+ </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/user/confirmDeleteFavoriteList.jsp
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/confirmDeletePollAccount.jsp
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/confirmDeletePollAccount.jsp (rev 0)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/confirmDeletePollAccount.jsp 2012-04-02 17:30:25 UTC (rev 3229)
@@ -0,0 +1,57 @@
+<%--
+ #%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="/user">
+ <fieldset class="ui-widget-content ui-corner-all">
+
+ <s:hidden key="redirectUrl" label=''/>
+ <s:hidden key="favoriteListId" value='%{favoriteList.topiaId}' label=''/>
+ <s:hidden key="pollAccountId" value='%{pollAccount.topiaId}' label=''/>
+
+ <s:text name="pollen.information.confirmDeletePollAccount"/>
+ <div align="center" style="padding-top: 1em;">
+ "<strong><s:property value="pollAccount.votingId"/></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="deletePollAccount"/>
+ </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/user/confirmDeletePollAccount.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/user/favoriteList.jsp
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/favoriteList.jsp 2012-04-02 16:42:38 UTC (rev 3228)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/favoriteList.jsp 2012-04-02 17:30:25 UTC (rev 3229)
@@ -24,6 +24,7 @@
<%@page contentType="text/html" pageEncoding="UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags" %>
+<%@ taglib prefix="sj" uri="/struts-jquery-tags" %>
<script type="text/javascript"
src="<s:url value='/js/gridHelper.js' />"></script>
@@ -35,14 +36,24 @@
<s:param name="favoriteListId" value="%{favoriteList.topiaId}"/>
</s:url>
+<s:url id="editPollAccounts" action="editPollAccount" namespace="/user">
+ <s:param name="favoriteListId" value="%{favoriteList.topiaId}"/>
+</s:url>
+
<script type="text/javascript">
+ var favoriteListId = '<s:property value="favoriteList.topiaId"/>';
+ var redirectUrl = '${editPollAccounts}';
+ var deleteTitle = '<s:text name="pollen.action.deletePollAccount"/>';
+ var deleteUrl = '<s:url action="confirmDeletePollAccount" namespace="/user" />';
+ var loadPollActionUrl = '<s:url action="getFavoriteListPollAccount" namespace="/json"/>';
+ var editImg = '<s:url value='/img/edit.png'/>';
+ var editTitle = '<s:text name="pollen.action.editPollAccount"/>';
+ var deleteImg = '<s:url value='/img/delete.png'/>';
+
jQuery(document).ready(function () {
- initFavoritePage(
- '${action}',
- '<s:url action="getFavoriteListPollAccount" namespace="/json"/>'
- );
+ initFavoritePage('${action}');
});
</script>
@@ -67,13 +78,14 @@
navigatorAdd="false" viewrecords="true"
rowList="10,15,20,50,100" rowNum="10"
navigatorExtraButtons="{
- add: { title: '%{getText(\"pollen.action.createPollAccount\")}', icon: 'ui-icon-plus', topic: 'pollAccounts-addRow' },
- edit: { title: '%{getText(\"pollen.action.editPollAccount\")}', icon: 'ui-icon-pencil', topic: 'pollAccounts-editRow' },
- delete:{ title: '%{getText(\"pollen.action.deletePollAccount\")}', icon: 'ui-icon-trash', topic: 'pollAccounts-deleteRow'}}">
+ add: { title: '%{getText(\"pollen.action.createPollAccount\")}', icon: 'ui-icon-plus', topic: 'pollAccounts-addRow' }}">
<sjg:gridColumn name="id" title="id" hidden="true"/>
<sjg:gridColumn name="votingId" title='%{getText("pollen.common.name")}'/>
<sjg:gridColumn name="email" title='%{getText("pollen.common.email")}'/>
+ <sjg:gridColumn name="functions" title='%{getText("pollen.common.functions")}'
+ formatter="favoriteListFunctions" width="40"
+ sortable="false"/>
</sjg:grid>
<br/>
@@ -119,31 +131,11 @@
align="center"/>
</s:form>
-<s:form id='deleteForm' method="POST" namespace="/user"
- cssClass="hidden pollAccountForm">
-
- <s:hidden name="action" value="delete"/>
- <s:hidden key="deletePollAccount.topiaId" label=""/>
- <s:hidden key="favoriteListId" label=""/>
-
- <fieldset>
- <legend>
- <s:text name="pollen.fieldset.pollAccount.toDeleteFromFavoriteList"/>
- </legend>
- <s:textfield key="deletePollAccount.votingId" required="true" size="40"
- label="%{getText('pollen.common.name')}" readonly="true"/>
- <s:textfield key="deletePollAccount.email" required="true" readonly="true"
- label="%{getText('pollen.common.email')}" size="40"/>
- </fieldset>
- <br/>
-
- <s:submit action="removePollAccount" key="pollen.action.delete"
- align="center"/>
-</s:form>
-
<br/>
<s:form method="POST" namespace="/user">
<s:submit action="favoriteLists"
key="pollen.action.backToFavoriteLists" align="center"/>
</s:form>
+
+<sj:dialog id="confirmDialog" autoOpen="false" modal="true" width="500"/>
\ No newline at end of file
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/favoriteLists.jsp
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/favoriteLists.jsp 2012-04-02 16:42:38 UTC (rev 3228)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/favoriteLists.jsp 2012-04-02 17:30:25 UTC (rev 3229)
@@ -24,6 +24,7 @@
<%@page contentType="text/html" pageEncoding="UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags" %>
+<%@ taglib prefix="sj" uri="/struts-jquery-tags" %>
<script type="text/javascript"
src="<s:url value='/js/gridHelper.js' />"></script>
@@ -38,12 +39,17 @@
<script type="text/javascript">
+ var redirectUrl = '<s:url namespace="/user" action="favoriteLists"/>';
+ var deleteTitle = '<s:text name="pollen.action.deleteFavoriteList"/>';
+ var deleteUrl = '<s:url action="confirmDeleteFavoriteList" namespace="/user"/>';
+ var loadUserUrl = '<s:url action="getFavoriteList" namespace="/json"/>';
+ var editImg = '<s:url value='/img/edit.png'/>';
+ var editTitle = '<s:text name="pollen.action.editFavoriteList"/>';
+ var deleteImg = '<s:url value='/img/delete.png'/>';
+
jQuery(document).ready(function () {
- initFavoritesPage(
- '${action}',
- '<s:url action="getFavoriteList" namespace="/json"/>'
- );
+ initFavoritesPage('${action}');
});
</script>
@@ -57,14 +63,15 @@
navigatorSearch="false" navigatorRefresh="false"
navigatorAdd="false" rowList="10,15,20,50,100" rowNum="10"
navigatorExtraButtons="{
- add: { title: '%{getText(\"pollen.action.createFavoriteList\")}', icon: 'ui-icon-plus', topic: 'favoriteLists-addRow' },
- edit: { title: '%{getText(\"pollen.action.editFavoriteList\")}', icon: 'ui-icon-pencil', topic: 'favoriteLists-editRow' },
- delete:{ title: '%{getText(\"pollen.action.deleteFavoriteList\")}', icon: 'ui-icon-trash', topic: 'favoriteLists-deleteRow'}}">
+ add: { title: '%{getText(\"pollen.action.createFavoriteList\")}', icon: 'ui-icon-plus', topic: 'favoriteLists-addRow' }}">
<sjg:gridColumn name="id" title="id" hidden="true"/>
<sjg:gridColumn name="name" title='%{getText("pollen.common.name")}'/>
<sjg:gridColumn name="nbAccounts"
title='%{getText("pollen.common.nbAccounts")}'/>
+ <sjg:gridColumn name="functions" title='%{getText("pollen.common.functions")}'
+ formatter="favoriteListsFunctions" width="40"
+ sortable="false"/>
</sjg:grid>
<br/>
@@ -87,32 +94,13 @@
align="center"/>
</s:form>
-<s:form id='deleteForm' method="POST" namespace="/user"
- cssClass="hidden favoriteForm">
+<s:form id='editForm' method="POST" namespace="/user" theme="simple"
+ action="editFavoriteList" cssClass="hidden">
- <s:hidden name="action" value="delete"/>
- <s:hidden key="deleteFavoriteList.topiaId" label=""/>
-
- <fieldset>
- <legend>
- <s:text name="pollen.fieldset.userFavoriteList.toDelete"/>
- </legend>
- <s:textfield key="deleteFavoriteList.name" required="true" readonly="true"
- size="40" label="%{getText('pollen.common.name')}"/>
- </fieldset>
- <br/>
- <s:submit action="deleteFavoriteList" key="pollen.action.delete"
- align="center"/>
-</s:form>
-
-<s:form id='editForm' method="POST" namespace="/user"
- action="editFavoriteList" theme="simple"
- cssClass="hidden">
-
<s:hidden key="favoriteListId" label=""/>
<s:submit action="editFavoriteList"/>
</s:form>
+<sj:dialog id="confirmDialog" autoOpen="false" modal="true" width="500"/>
-
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/js/favoriteList.js
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/js/favoriteList.js 2012-04-02 16:42:38 UTC (rev 3228)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/js/favoriteList.js 2012-04-02 17:30:25 UTC (rev 3229)
@@ -26,12 +26,17 @@
$('#createForm').show();
} else if (action == 'edit') {
$('#editForm').show();
- } else if (action == 'delete') {
- $('#deleteForm').show();
}
// listen row selection
- $.addRowSelectTopic('pollAccounts');
+ $.addRowSelectTopic('pollAccounts', function () {
+ if (action != '') {
+ // come back from action
+ action = '';
+ return;
+ }
+ $(".pollAccountForm").hide();
+ });
$.addClearSelectTopic('pollAccounts', function () {
if (action != '') {
@@ -50,50 +55,50 @@
$('#editForm').hide();
$('#createForm').show();
});
+}
- // to edit the selected row
- $.listenRowTopic('pollAccounts-editRow', function (event) {
- var id = $.getSelectedId('pollAccounts');
- if (!id) {
+function favoriteListFunctions(cellvalue, options, rowObject) {
- // no row selected
- return;
- }
+ var id = rowObject.id;
- jQuery.getJSON(loadPollActionUrl, { "pollAccountId":id },
- function (result) {
+ var result = "";
- var pollAccount = result.pollAccount;
- $('#editForm [name="editPollAccount.topiaId"]').val(pollAccount.id);
- $('#editForm [name="editPollAccount.votingId"]').val(pollAccount.votingId);
- $('#editForm [name="editPollAccount.email"]').val(pollAccount.email);
- $('#deleteForm').hide();
- $('#createForm').hide();
- $('#editForm').show();
- }
- );
- });
+ var script = 'return editPollAccount("' + id + '");';
+ result += formatLinkByScript(script, editImg, "Edit", editTitle);
- // to delete the selected row
- $.listenRowTopic('pollAccounts-deleteRow', function (event) {
- var id = $.getSelectedId('pollAccounts');
- if (!id) {
+ script = 'return confirmDelete("' + id + '");';
+ result += formatLinkByScript(script, deleteImg, "Delete", deleteTitle);
+ return result;
+}
- // no row selected
- return;
- }
+function formatLinkByScript(script, image, imageAlt, imageTitle) {
+ return "<a href='#' onclick='" + script + "'><image alt='" + imageAlt + "' title='" + imageTitle + "' src='" + image + "'> </a>";
+}
- jQuery.getJSON(loadPollActionUrl, { "pollAccountId":id },
- function (result) {
+// to edit the selected row
+function editPollAccount(id) {
- var pollAccount = result.pollAccount;
- $('#deleteForm [name="deletePollAccount.topiaId"]').val(pollAccount.id);
- $('#deleteForm [name="deletePollAccount.votingId"]').val(pollAccount.votingId);
- $('#deleteForm [name="deletePollAccount.email"]').val(pollAccount.email);
- $('#editForm').hide();
- $('#createForm').hide();
- $('#deleteForm').show();
- }
- );
- });
+ jQuery.getJSON(
+ loadPollActionUrl, { "pollAccountId":id }, function (result) {
+
+ var pollAccount = result.pollAccount;
+ $('#editForm [name="editPollAccount.topiaId"]').val(pollAccount.id);
+ $('#editForm [name="editPollAccount.votingId"]').val(pollAccount.votingId);
+ $('#editForm [name="editPollAccount.email"]').val(pollAccount.email);
+ $('#deleteForm').hide();
+ $('#createForm').hide();
+ $('#editForm').show();
+ }
+ );
+}
+
+function confirmDelete(id) {
+ $('.ui-dialog-title').html(deleteTitle)
+ var dialog = $("#confirmDialog");
+ var url = deleteUrl + '?' + $.param({favoriteListId:favoriteListId,
+ pollAccountId:id,
+ redirectUrl:redirectUrl});
+ dialog.load(url);
+ dialog.dialog('open');
+ return false;
}
\ No newline at end of file
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/js/favoriteLists.js
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/js/favoriteLists.js 2012-04-02 16:42:38 UTC (rev 3228)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/js/favoriteLists.js 2012-04-02 17:30:25 UTC (rev 3229)
@@ -21,16 +21,21 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
-function initFavoritesPage(action, loadFavoriteList) {
+function initFavoritesPage(action) {
if (action == 'create') {
$('#createForm').show();
- } else if (action == 'delete') {
- $('#deleteForm').show();
}
// listen row selection
- $.addRowSelectTopic('favoriteLists');
+ $.addRowSelectTopic('favoriteLists', function () {
+ if (action != '') {
+ // come back from action
+ action = '';
+ return;
+ }
+ $(".userForm").hide();
+ });
$.addClearSelectTopic('favoriteLists', function () {
if (action != '') {
@@ -51,34 +56,38 @@
$('#deleteForm').hide();
$('#createForm').show();
});
+}
- // to edit a selected row
- $.listenRowTopic('favoriteLists-editRow', function (event) {
- var id = $.getSelectedId('favoriteLists');
- if (!id) {
- // no row selected
- return;
- }
+function favoriteListsFunctions(cellvalue, options, rowObject) {
- $('#editForm [name="favoriteListId"]').val(id);
- $('#editForm').submit();
- });
+ var id = rowObject.id;
- // to delete the selected row
- $.listenRowTopic('favoriteLists-deleteRow', function (event) {
- var id = $.getSelectedId('favoriteLists');
- if (!id) {
- // no row selected
- return;
- }
- jQuery.getJSON(loadFavoriteList, { favoriteListId:id },
- function (result) {
- var user = result.favoriteList;
- $('#deleteForm [name="deleteFavoriteList.topiaId"]').val(user.id);
- $('#deleteForm [name="deleteFavoriteList.name"]').val(user.name);
- $('#createForm').hide();
- $('#deleteForm').show();
- }
- );
- });
+ var result = "";
+
+ var script = 'return editFavoriteList("' + id + '");';
+ result += formatLinkByScript(script, editImg, "Edit", editTitle);
+
+ script = 'return confirmDelete("' + id + '");';
+ result += formatLinkByScript(script, deleteImg, "Delete", deleteTitle);
+ return result;
+}
+
+function formatLinkByScript(script, image, imageAlt, imageTitle) {
+ return "<a href='#' onclick='" + script + "'><image alt='" + imageAlt + "' title='" + imageTitle + "' src='" + image + "'> </a>";
+}
+
+function editFavoriteList(id) {
+ $('#editForm [name="favoriteListId"]').val(id);
+ $('#editForm').submit();
+ return false;
+}
+
+function confirmDelete(id) {
+ $('.ui-dialog-title').html(deleteTitle)
+ var dialog = $("#confirmDialog");
+ var url = deleteUrl + '?' + $.param({favoriteListId:id,
+ redirectUrl:redirectUrl});
+ dialog.load(url);
+ dialog.dialog('open');
+ return false;
}
\ No newline at end of file
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/js/usersList.js
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/js/usersList.js 2012-04-02 16:42:38 UTC (rev 3228)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/js/usersList.js 2012-04-02 17:30:25 UTC (rev 3229)
@@ -21,7 +21,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
-function initUsersPage(action, loadUserUrl) {
+function initUsersPage(action, userId) {
if (action == 'create') {
$('#createForm').show();
@@ -29,12 +29,16 @@
if (action == 'edit') {
$('#editForm').show();
}
- if (action == 'delete') {
- $('#deleteForm').show();
- }
// listen row selection
- $.addRowSelectTopic('users');
+ $.addRowSelectTopic('users', function () {
+ if (action != '') {
+ // come back from action
+ action = '';
+ return;
+ }
+ $(".userForm").hide();
+ });
$.addClearSelectTopic('users', function () {
if (action != '') {
@@ -58,65 +62,54 @@
$('#deleteForm').hide();
$('#createForm').show();
});
+}
- // to edit a selected row
- $.listenRowTopic('users-editRow', function (event) {
- var id = $.getSelectedId('users');
- if (!id) {
+function userFunctions(cellvalue, options, rowObject) {
- // no user selected
- return;
- }
- $('#editForm .errorMessage').hide();
- jQuery.getJSON(loadUserUrl, { "userId":id }, function (result) {
+ var id = rowObject.id;
- var user = result.user;
- $('#editForm [name="editUser.topiaId"]').val(user.id);
- $('#editForm [name="editUser.login"]').val(user.login);
- $('#editForm [name="editUser.email"]').val(user.email);
- $('#editForm [name="editUser.firstName"]').val(user.firstName);
- $('#editForm [name="editUser.lastName"]').val(user.lastName);
- $('#editForm [name="editUser.administrator"]').prop('checked', false);
- $('#editForm [name="editUser.administrator"]').prop('checked', user.administrator);
- $('#editForm').show();
- $('#createForm').hide();
- $('#deleteForm').hide();
- }
- );
- });
+ var result = "";
- // to delete the selected row
- $.listenRowTopic('users-deleteRow', function (event) {
- var id = $.getSelectedId('users');
- if (!id) {
+ if (cellvalue.indexOf('edit') > -1) {
+ var script = 'return editUser("' + id + '");'
+ result += formatLinkByScript(script, editImg, "Edit", editTitle)
+ }
+ if (cellvalue.indexOf('delete') > -1) {
+ var script = 'return confirmDelete("' + id + '");'
+ result += formatLinkByScript(script, deleteImg, "Delete", deleteTitle)
+ }
+ return result;
+}
- // no user selected
- return;
- }
+function formatLinkByScript(script, image, imageAlt, imageTitle) {
+ return "<a href='#' onclick='" + script + "'><image alt='" + imageAlt + "' title='" + imageTitle + "' src='" + image + "'> </a>";
+}
- var userId = '${user.topiaId}';
+function editUser(id) {
+ $('#editForm .errorMessage').hide();
+ jQuery.getJSON(
+ loadUserUrl, { "userId":id }, function (result) {
- if (id == userId) {
+ var user = result.user;
+ $('#editForm [name="editUser.topiaId"]').val(user.id);
+ $('#editForm [name="editUser.login"]').val(user.login);
+ $('#editForm [name="editUser.email"]').val(user.email);
+ $('#editForm [name="editUser.firstName"]').val(user.firstName);
+ $('#editForm [name="editUser.lastName"]').val(user.lastName);
+ $('#editForm [name="editUser.administrator"]').prop('checked', false);
+ $('#editForm [name="editUser.administrator"]').prop('checked', user.administrator);
+ $('#editForm').show();
+ $('#createForm').hide();
+ }
+ );
+ return false;
+}
- // can not delete connected user
- return;
- }
- $('#deleteForm .errorMessage').hide();
-
- jQuery.getJSON(loadUserUrl, { "userId":id }, function (result) {
-
- var user = result.user;
- $('#deleteForm [name="deleteUser.topiaId"]').val(user.id);
- $('#deleteForm [name="deleteUser.login"]').val(user.login);
- $('#deleteForm [name="deleteUser.email"]').val(user.email);
- $('#deleteForm [name="deleteUser.firstName"]').val(user.firstName);
- $('#deleteForm [name="deleteUser.lastName"]').val(user.lastName);
- $('#deleteForm [name="deleteUser.administrator"]').prop('checked', false);
- $('#deleteForm [name="deleteUser.administrator"]').prop('checked', user.administrator);
- $('#editForm').hide();
- $('#createForm').hide();
- $('#deleteForm').show();
- }
- );
- });
-}
\ No newline at end of file
+function confirmDelete(id) {
+ $('.ui-dialog-title').html(deleteTitle)
+ var dialog = $("#confirmDialog");
+ var url = deleteUrl + '?' + $.param({userId:id, redirectUrl:redirectUrl});
+ dialog.load(url);
+ dialog.dialog('open');
+ return false;
+}
1
0
r3228 - in branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main: java/org/chorem/pollen/ui/actions/poll resources/config
by fdesbois@users.chorem.org 02 Apr '12
by fdesbois@users.chorem.org 02 Apr '12
02 Apr '12
Author: fdesbois
Date: 2012-04-02 18:42:38 +0200 (Mon, 02 Apr 2012)
New Revision: 3228
Url: http://chorem.org/repositories/revision/pollen/3228
Log:
Begin EditPoll action
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/EditPoll.java
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config/struts-poll.xml
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-04-02 16:42:32 UTC (rev 3227)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/CreatePoll.java 2012-04-02 16:42:38 UTC (rev 3228)
@@ -138,7 +138,7 @@
* All the parameters send by request used to build back choices of the
* poll.
*/
- private Map<String, String[]> parameters;
+ protected Map<String, String[]> parameters;
private boolean informationsError;
@@ -311,7 +311,16 @@
}
return result;
}
+
+ protected int getNbChoices() {
+ //TODO tchemit-2012-03-05 use a default value from configuration
+ return 5;
+ }
+ protected int getDefaultNbVotingLists() {
+ return 1;
+ }
+
@Override
public void prepare() throws Exception {
@@ -322,9 +331,8 @@
choiceTypes = decorateToName(ChoiceType.values());
voteCountingTypes = decorateToName(VoteCountingType.values());
- //TODO tchemit-2012-03-05 use a default value from configuration
- nbTextChoices = nbDateChoices = nbImageChoices = 5;
- nbVotingLists = 1;
+ nbTextChoices = nbDateChoices = nbImageChoices = getNbChoices();
+ nbVotingLists = getDefaultNbVotingLists();
String tokenSuffix = getServiceContext().createPollenUrlId();
@@ -358,15 +366,15 @@
switch (pollChoiceType) {
case TEXT:
- choices = buildTextChoices(5);
+ choices = buildTextChoices(nbTextChoices);
tokenId = textChoiceTokenId;
break;
case DATE:
- choices = buildDateChoices(5);
+ choices = buildDateChoices(nbDateChoices);
tokenId = dateChoiceTokenId;
break;
case IMAGE:
- choices = buildImageChoices(5);
+ choices = buildImageChoices(nbImageChoices);
tokenId = imageChoiceTokenId;
break;
}
@@ -376,7 +384,7 @@
votingListTokenId = DisplayVotingList.VOTING_LIST_TOKEN + "_" +
tokenSuffix;
- Map<Integer, VotingList> votingLists = buildVotingLists(1);
+ Map<Integer, VotingList> votingLists = buildVotingLists(nbVotingLists);
getPollenSession().putDynamicData(votingListTokenId, votingLists);
}
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-04-02 16:42:32 UTC (rev 3227)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/EditPoll.java 2012-04-02 16:42:38 UTC (rev 3228)
@@ -23,13 +23,220 @@
*/
package org.chorem.pollen.ui.actions.poll;
+import com.google.common.base.Function;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
+import org.chorem.pollen.bean.PollImageChoice;
+import org.chorem.pollen.bean.PollUri;
+import org.chorem.pollen.business.persistence.Choice;
+import org.chorem.pollen.business.persistence.PersonToList;
+import org.chorem.pollen.business.persistence.Poll;
+import org.chorem.pollen.business.persistence.PollAccount;
+import org.chorem.pollen.business.persistence.VotingList;
+import org.chorem.pollen.common.ChoiceType;
+import org.chorem.pollen.common.PollType;
+import org.chorem.pollen.ui.actions.PollUriConverter;
+
+import java.util.List;
+import java.util.Map;
+
/**
- * Display a poll.
+ * Edit a poll.
*
* @author tchemit <chemit(a)codelutin.com>
+ * @author fdesbois <desbois(a)codelutin.com>
* @since 1.2.6
*/
-public class EditPoll extends AbstractPollUriIdAction {
+public class EditPoll extends CreatePoll {
- private static final long serialVersionUID = 1L;
+ private static final String PREFIX_CHOICE = "%sChoice_%d";
+
+ private static final String PREFIX_VOTING_LIST = "votingList_%d";
+
+ private static final String PREFIX_PERSON_TO_LIST = "personToList_%d_%d";
+
+ protected PollUri pollUri;
+
+ public final PollUri getUriId() {
+ return pollUri;
+ }
+
+ public final void setUriId(PollUri pollUri) {
+ this.pollUri = pollUri;
+ }
+
+ protected void preparePollUri(Map<String, String[]> parameters) {
+ if (pollUri == null) {
+ String[] values = parameters.get("uriId");
+ pollUri = PollUriConverter.convertFromString(values);
+ }
+ }
+
+ protected boolean needTopiaId() {
+ return true;
+ }
+
+ public boolean isVoteStarted() {
+ return getPoll().sizeVote() > 0;
+ }
+
+ @Override
+ public Poll getPoll() {
+ if (poll == null) {
+ poll = getPollService().getPollByPollId(pollUri.getPollId());
+ if (!needTopiaId()) {
+ poll.setTopiaId(null);
+ }
+ }
+ return poll;
+ }
+
+ @Override
+ public void prepare() throws Exception {
+
+ preparePollUri(parameters);
+
+ // -- Choice --
+ ChoiceType choiceType = getPoll().getChoiceType();
+ prepareParams(getPoll().getChoice(), withChoicePrefix(choiceType));
+
+ // -- VotingList --
+ if (getPoll().getPollType() != PollType.FREE) {
+ prepareParams(getPoll().getVotingList(), withVotingListPrefix());
+ }
+
+ super.prepare();
+ }
+
+ @Override
+ public String execute() throws Exception {
+
+// getPollService().updatePoll(poll):
+
+ // remove all stuff from session
+ getPollenSession().clearDynamicData();
+
+ addActionMessage(_("pollen.info.poll.created"));
+ return SUCCESS;
+ }
+
+ private Function<Choice, String> withChoicePrefix(final ChoiceType choiceType) {
+ final String choiceTypeName = choiceType.name().toLowerCase();
+ return new IndexedFunction<Choice, String>() {
+
+ @Override
+ protected String apply(Choice input, int index) {
+
+ String prefix = String.format(PREFIX_CHOICE, choiceTypeName, index);
+ if (needTopiaId()) {
+ putParameter(prefix, Choice.TOPIA_ID, input.getTopiaId());
+ }
+ putParameter(prefix, Choice.PROPERTY_NAME, input.getName());
+ putParameter(prefix, Choice.PROPERTY_DESCRIPTION, input.getDescription());
+
+ if (choiceType == ChoiceType.IMAGE) {
+ putParameter(prefix, PollImageChoice.PROPERTY_LOCATION, input.getName());
+ }
+
+ return prefix;
+ }
+ };
+ }
+
+ private Function<VotingList, String> withVotingListPrefix() {
+ return new IndexedFunction<VotingList, String>() {
+
+ @Override
+ protected String apply(VotingList input, int index) {
+
+ String prefix = String.format(PREFIX_VOTING_LIST, index);
+ if (needTopiaId()) {
+ putParameter(prefix, VotingList.TOPIA_ID, input.getTopiaId());
+ }
+ putParameter(prefix, VotingList.PROPERTY_NAME, input.getName());
+ putParameter(prefix, VotingList.PROPERTY_WEIGHT, String.valueOf(input.getWeight()));
+
+ prepareParams(input.getPollAccountPersonToList(), withPersonToListPrefix(index));
+
+ return prefix;
+ }
+ };
+ }
+
+ private Function<PersonToList, String> withPersonToListPrefix(final int votingListIndex) {
+ return new IndexedFunction<PersonToList, String>() {
+
+ @Override
+ protected String apply(PersonToList input, int index) {
+
+ PollAccount pollAccount = input.getPollAccount();
+
+ String prefix = String.format(PREFIX_PERSON_TO_LIST, votingListIndex, index);
+ if (needTopiaId()) {
+ putParameter(prefix, PersonToList.TOPIA_ID, input.getTopiaId());
+ }
+ putParameter(prefix, PersonToList.PROPERTY_WEIGHT, String.valueOf(input.getWeight()));
+ putParameter(prefix, PollAccount.PROPERTY_ACCOUNT_ID, pollAccount.getAccountId());
+ putParameter(prefix, PollAccount.PROPERTY_VOTING_ID, pollAccount.getVotingId());
+ putParameter(prefix, PollAccount.PROPERTY_EMAIL, pollAccount.getEmail());
+
+ return prefix;
+ }
+ };
+ }
+
+ /**
+ * Prepare the {@code source} for parameters using the {@code function} to
+ * push necessary data.
+ *
+ * @param source List of elements
+ * @param function Function used to push element data using {@link #putParameter(String, String, String)}
+ * @param <T> Type of data
+ * @see #putParameter(String, String, String)
+ */
+ private <T> void prepareParams(List<T> source, Function<T, String> function) {
+ ImmutableList.copyOf(Lists.transform(source, function));
+ }
+
+ /**
+ * Put some data in the {@code parameters} with name built using
+ * {@code prefix} and {@code property}. The {@code value} will be put for
+ * this parameter.
+ *
+ * @param prefix Prefix to use for the parameter name
+ * @param property Name of the {@code property} to push in parameters
+ * @param value Value of this {@code property}
+ */
+ private void putParameter(String prefix, String property, String value) {
+ parameters.put(prefix + "." + property, new String[]{value});
+ }
+
+ /**
+ * Guava {@link Function} that keeps index on each {@link Function#apply(Object)} call.
+ * You just have to implement {@link #apply(Object, int)} to have the current
+ * index of the {@code input} value.
+ *
+ * @param <F> Type of data where function will be applied on
+ * @param <T> Resulting type
+ */
+ private abstract static class IndexedFunction<F, T> implements Function<F, T> {
+
+ private int index;
+
+ @Override
+ public T apply(F input) {
+ T result = apply(input, index);
+ index++;
+ return result;
+ }
+
+ /**
+ * Called during {@link #apply(Object)} method with current {@code index}.
+ *
+ * @param input current value
+ * @param index current index
+ * @return the result of the function applied on the {@code input} object
+ */
+ protected abstract T apply(F input, int index);
+ }
}
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-04-02 16:42:32 UTC (rev 3227)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/config/struts-poll.xml 2012-04-02 16:42:38 UTC (rev 3228)
@@ -93,7 +93,7 @@
<action name="modification/*"
class="org.chorem.pollen.ui.actions.poll.EditPoll">
<param name="uriId">{1}</param>
- <result name="input">/WEB-INF/jsp/poll/edit.jsp</result>
+ <result name="input">/WEB-INF/jsp/poll/create.jsp</result>
<result>/WEB-INF/jsp/poll/resume.jsp</result>
</action>
1
0
r3227 - in branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main: java/org/chorem/pollen/ui/actions/poll resources/i18n webapp/WEB-INF/jsp/poll
by fdesbois@users.chorem.org 02 Apr '12
by fdesbois@users.chorem.org 02 Apr '12
02 Apr '12
Author: fdesbois
Date: 2012-04-02 18:42:32 +0200 (Mon, 02 Apr 2012)
New Revision: 3227
Url: http://chorem.org/repositories/revision/pollen/3227
Log:
Vote validation for maxChoiceNb and percentage
Modified:
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/VoteForPoll.java
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/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/vote.jsp
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/VoteForPoll.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/VoteForPoll.java 2012-04-02 16:42:25 UTC (rev 3226)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/VoteForPoll.java 2012-04-02 16:42:32 UTC (rev 3227)
@@ -32,6 +32,7 @@
import org.chorem.pollen.business.persistence.Poll;
import org.chorem.pollen.business.persistence.PollAccount;
import org.chorem.pollen.business.persistence.Vote;
+import org.chorem.pollen.business.persistence.VoteToChoice;
/**
* Votes to a poll.
@@ -75,6 +76,29 @@
addFieldError("pollAccount.votingId", _("pollen.error.user.alreadyVoted"));
}
}
+
+
+ int nbVotes = 0;
+ int totalValues = 0;
+ for (VoteToChoice voteToChoice : vote.getChoiceVoteToChoice()) {
+
+ Integer value = voteToChoice.getVoteValue();
+ if (value != null && value != 0) {
+ nbVotes++;
+ totalValues += value;
+ }
+ }
+
+ // check that the number of choices is not greater than maxChoiceNb
+ int maxChoice = getPoll().getMaxChoiceNb();
+ if (maxChoice != 0 && nbVotes > maxChoice) {
+ addFieldError("vote.choices", _("pollen.error.vote.maxChoiceNb", maxChoice));
+ }
+
+ // check for percentage that the sum of all values equals 100
+ if (isPercentageVoteCounting() && totalValues != 100) {
+ addFieldError("vote.choices", _("pollen.error.vote.percentage"));
+ }
}
@Override
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-04-02 16:42:25 UTC (rev 3226)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-04-02 16:42:32 UTC (rev 3227)
@@ -161,6 +161,8 @@
pollen.error.user.not.found=User not found
pollen.error.user.restrictedListsForbidden=The poll is restricted and you are not allowed to vote. Check if you have correctly used the link sent to you by email.
pollen.error.userNotAllowed=You are not allowed to count the votes for this poll.
+pollen.error.vote.maxChoiceNb=The maximal number of choices is %d.
+pollen.error.vote.percentage=The sum of the values must be equals to 100.
pollen.fieldset.connexionInformation=Connexion informations
pollen.fieldset.login=Login
pollen.fieldset.poll.choices=Choices
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-04-02 16:42:25 UTC (rev 3226)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-04-02 16:42:32 UTC (rev 3227)
@@ -168,6 +168,8 @@
pollen.error.user.not.found=Utilisateur non trouvé
pollen.error.user.restrictedListsForbidden=Le sondage est restreint et vous n'êtes pas autorisé à voter. Vérifiez que vous avez bien utiliser le lien qui vous a été envoyé.
pollen.error.userNotAllowed=Vous n'êtes pas autorisé à dépouiller ce sondage.
+pollen.error.vote.maxChoiceNb=Le nombre de choix maximal est de %d.
+pollen.error.vote.percentage=La somme des valeurs doit être égale à 100.
pollen.fieldset.connexionInformation=Information de connexion
pollen.fieldset.login=Connexion
pollen.fieldset.poll.choices=Les choix
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-04-02 16:42:25 UTC (rev 3226)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp 2012-04-02 16:42:32 UTC (rev 3227)
@@ -413,7 +413,8 @@
</table>
<div id="voteError">
<s:fielderror fieldName="pollAccount.votingId"/>
- <%--<t:errors/>--%>
+ <s:fielderror fieldName="vote.choices"/>
+ <%--<t:errors/>--%>
</div>
<s:if test="voteAllowed">
1
0
r3226 - in branches/pollen-1.2.6-struts2: pollen-persistence/src/main/java/org/chorem/pollen/business/persistence pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions pollen-ui-struts2/src/main/webapp/WEB-INF/decorators pollen-ui-struts2/src/main/webapp/css
by fdesbois@users.chorem.org 02 Apr '12
by fdesbois@users.chorem.org 02 Apr '12
02 Apr '12
Author: fdesbois
Date: 2012-04-02 18:42:25 +0200 (Mon, 02 Apr 2012)
New Revision: 3226
Url: http://chorem.org/repositories/revision/pollen/3226
Log:
- missing has methods for messages
- do not use <s:actionmessage/> and <s:actionerror/> struts tags
- problem with some poll flags
Modified:
branches/pollen-1.2.6-struts2/pollen-persistence/src/main/java/org/chorem/pollen/business/persistence/PollImpl.java
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/webapp/WEB-INF/decorators/layout-default.jsp
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/css/common.css
Modified: branches/pollen-1.2.6-struts2/pollen-persistence/src/main/java/org/chorem/pollen/business/persistence/PollImpl.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-persistence/src/main/java/org/chorem/pollen/business/persistence/PollImpl.java 2012-04-02 09:44:30 UTC (rev 3225)
+++ branches/pollen-1.2.6-struts2/pollen-persistence/src/main/java/org/chorem/pollen/business/persistence/PollImpl.java 2012-04-02 16:42:25 UTC (rev 3226)
@@ -71,7 +71,7 @@
@Override
public boolean isFinished(Date currentDate) {
- return endDate != null && endDate.after(currentDate);
+ return endDate != null && currentDate.after(endDate);
}
@Override
@@ -81,7 +81,7 @@
@Override
public boolean isAddChoiceRunning(Date currentDate) {
- return isAddChoiceStarted(currentDate) && !isAddChoiceFinished(currentDate);
+ return !isClosed() && !isFinished(currentDate) && isAddChoiceStarted(currentDate) && !isAddChoiceFinished(currentDate);
}
@Override
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-04-02 09:44:30 UTC (rev 3225)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/PollenActionSupport.java 2012-04-02 16:42:25 UTC (rev 3226)
@@ -25,6 +25,7 @@
import com.google.common.collect.Lists;
import com.opensymphony.xwork2.ActionContext;
+import org.apache.commons.collections.CollectionUtils;
import org.apache.struts2.StrutsStatics;
import org.chorem.pollen.PollenConfiguration;
import org.chorem.pollen.business.persistence.UserAccount;
@@ -78,7 +79,7 @@
return getPollenApplicationContext().getConfiguration();
}
- /** Pollen User session. */
+ /** Pollen User getPollenSession(). */
private transient PollenSession pollenSession;
/**
@@ -234,9 +235,9 @@
@Override
public void addActionMessage(String message) {
- List<String> messages = getPollenSession().getDynamicData(PollenSession.SESSION_TOKEN_MESSAGES);
+ List<String> messages = getPollenSession().getDynamicData(PollenSession.SESSION_TOKEN_MESSAGES);
if (messages == null) {
- messages = Lists.newArrayList(message);
+ messages = Lists.newArrayList(message);
getPollenSession().putDynamicData(PollenSession.SESSION_TOKEN_MESSAGES, messages);
} else {
messages.add(message);
@@ -255,24 +256,36 @@
}
@Override
- public Collection<String> getActionErrors() {
- List<String> result = getPollenSession().getDynamicData(PollenSession.SESSION_TOKEN_ERRORS);
- if (result != null) {
- getPollenSession().removeDynamicData(PollenSession.SESSION_TOKEN_ERRORS);
+ public Collection<String> getActionMessages() {
+ List<String> result = getPollenSession().getDynamicData(PollenSession.SESSION_TOKEN_MESSAGES);
+ if (result == null) {
+ result = Collections.emptyList();
} else {
- result = Collections.emptyList();
+ getPollenSession().removeDynamicData(PollenSession.SESSION_TOKEN_MESSAGES);
}
return result;
}
@Override
- public Collection<String> getActionMessages() {
- List<String> result = getPollenSession().getDynamicData(PollenSession.SESSION_TOKEN_MESSAGES);
- if (result != null) {
- getPollenSession().removeDynamicData(PollenSession.SESSION_TOKEN_MESSAGES);
- } else {
+ public Collection<String> getActionErrors() {
+ List<String> result = getPollenSession().getDynamicData(PollenSession.SESSION_TOKEN_ERRORS);
+ if (result == null) {
result = Collections.emptyList();
+ } else {
+ getPollenSession().removeDynamicData(PollenSession.SESSION_TOKEN_ERRORS);
}
return result;
}
+
+ @Override
+ public boolean hasActionMessages() {
+ List<String> result = getPollenSession().getDynamicData(PollenSession.SESSION_TOKEN_MESSAGES);
+ return CollectionUtils.isNotEmpty(result);
+ }
+
+ @Override
+ public boolean hasActionErrors() {
+ List<String> result = getPollenSession().getDynamicData(PollenSession.SESSION_TOKEN_ERRORS);
+ return CollectionUtils.isNotEmpty(result);
+ }
}
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators/layout-default.jsp
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators/layout-default.jsp 2012-04-02 09:44:30 UTC (rev 3225)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators/layout-default.jsp 2012-04-02 16:42:25 UTC (rev 3226)
@@ -245,14 +245,22 @@
<%--<div t:type="nuiton/feedback" t:id="borderFeedback" t:autoClear="false"/>--%>
<s:if test="hasActionMessages()">
- <div class="fb-info">
- <s:actionmessage/>
+ <div class="info_success">
+ <ul class="actionMessages">
+ <s:iterator value="actionMessages" var="message">
+ <li><span><s:property value="#message" escapeHtml="false"/></span></li>
+ </s:iterator>
+ </ul>
</div>
</s:if>
<s:if test="hasActionErrors()">
- <div class="fb-error">
- <s:actionerror/>
+ <div class="info_error">
+ <ul class="actionErrors">
+ <s:iterator value="actionErrors" var="message">
+ <li><span><s:property value="#message" escapeHtml="false"/></span></li>
+ </s:iterator>
+ </ul>
</div>
</s:if>
<d:body/>
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/css/common.css
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/css/common.css 2012-04-02 09:44:30 UTC (rev 3225)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/css/common.css 2012-04-02 16:42:25 UTC (rev 3226)
@@ -111,7 +111,7 @@
.info_success {
background: no-repeat scroll 8px 5px #DFFFDF;
border: 2px solid #9FCF9F;
- width: 800px;
+ width: 970px;
margin-bottom: 5px;
}
.info_success ul{
@@ -130,7 +130,7 @@
.info_error {
background: no-repeat scroll 8px 5px #FFE3E3;
border: 2px solid #DD0000;
- width: 800px;
+ width: 970px;
margin-bottom: 5px;
}
.info_error ul{
1
0
r3225 - branches/pollen-1.2.6-struts2/pollen-persistence/src/main/java/org/chorem/pollen
by fdesbois@users.chorem.org 02 Apr '12
by fdesbois@users.chorem.org 02 Apr '12
02 Apr '12
Author: fdesbois
Date: 2012-04-02 11:44:30 +0200 (Mon, 02 Apr 2012)
New Revision: 3225
Url: http://chorem.org/repositories/revision/pollen/3225
Log:
Use author for commentDTO xml export
Modified:
branches/pollen-1.2.6-struts2/pollen-persistence/src/main/java/org/chorem/pollen/PollenFunctions.java
Modified: branches/pollen-1.2.6-struts2/pollen-persistence/src/main/java/org/chorem/pollen/PollenFunctions.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-persistence/src/main/java/org/chorem/pollen/PollenFunctions.java 2012-04-02 09:44:26 UTC (rev 3224)
+++ branches/pollen-1.2.6-struts2/pollen-persistence/src/main/java/org/chorem/pollen/PollenFunctions.java 2012-04-02 09:44:30 UTC (rev 3225)
@@ -116,7 +116,7 @@
@Override
public CommentDTO apply(Comment input) {
CommentDTO result = new CommentDTO(
- input.getPollAccount().getVotingId(), input.getText());
+ input.getAuthor(), input.getText());
return result;
}
};
1
0
r3224 - branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl
by fdesbois@users.chorem.org 02 Apr '12
by fdesbois@users.chorem.org 02 Apr '12
02 Apr '12
Author: fdesbois
Date: 2012-04-02 11:44:26 +0200 (Mon, 02 Apr 2012)
New Revision: 3224
Url: http://chorem.org/repositories/revision/pollen/3224
Log:
Use comment author for feed
Modified:
branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollFeedService.java
Modified: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollFeedService.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollFeedService.java 2012-04-02 09:29:44 UTC (rev 3223)
+++ branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollFeedService.java 2012-04-02 09:44:26 UTC (rev 3224)
@@ -117,9 +117,8 @@
public void onAddComment(Comment comment, String pollVoteUrl) {
- //TODO Validate this is ok
String title = _("pollen.feed.addCommentTitle",
- comment.getPollAccount().getVotingId());
+ comment.getAuthor());
String content = _("pollen.feed.addCommentContent",
comment.getText());
1
0
Author: fdesbois
Date: 2012-04-02 11:29:44 +0200 (Mon, 02 Apr 2012)
New Revision: 3223
Url: http://chorem.org/repositories/revision/pollen/3223
Log:
- add comment author new column
- improve pollAccount link with comment
- add comment validation in action instead of xml
Removed:
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/poll/AddComment-addComment-validation.xml
Modified:
branches/pollen-1.2.6-struts2/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallbackV1_2_6.java
branches/pollen-1.2.6-struts2/pollen-persistence/src/main/xmi/pollen.zargo
branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollCommentService.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/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/confirmDeletePollComment.jsp
branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp
Modified: branches/pollen-1.2.6-struts2/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallbackV1_2_6.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallbackV1_2_6.java 2012-04-02 09:29:31 UTC (rev 3222)
+++ branches/pollen-1.2.6-struts2/pollen-persistence/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallbackV1_2_6.java 2012-04-02 09:29:44 UTC (rev 3223)
@@ -82,8 +82,20 @@
// add foreign key indexes
addForeignKeyIndexes(queries);
+
+ // add author column for Comment
+ addCommentAuthorColumn(queries);
}
+
+ private void addCommentAuthorColumn(List<String> queries) {
+ queries.add("ALTER TABLE comment ADD COLUMN author VARCHAR(255);");
+
+ queries.add("UPDATE comment c SET c.author = (SELECT p.votingId FROM pollAccount p WHERE c.pollAccount = p.topiaId);");
+
+ queries.add("ALTER TABLE comment ALTER COLUMN author VARCHAR(255) NOT NULL;");
+ }
+
private void addForeignKeyIndexes(List<String> queries) {
queries.add("CREATE INDEX idx_PollAccount_pollsCreated ON poll(creator);");
Modified: branches/pollen-1.2.6-struts2/pollen-persistence/src/main/xmi/pollen.zargo
===================================================================
(Binary files differ)
Modified: branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollCommentService.java
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollCommentService.java 2012-04-02 09:29:31 UTC (rev 3222)
+++ branches/pollen-1.2.6-struts2/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollCommentService.java 2012-04-02 09:29:44 UTC (rev 3223)
@@ -29,7 +29,6 @@
import org.chorem.pollen.business.persistence.CommentDAO;
import org.chorem.pollen.business.persistence.Poll;
import org.chorem.pollen.business.persistence.PollAccount;
-import org.chorem.pollen.business.persistence.PollAccountDAO;
import org.chorem.pollen.business.persistence.PollDAO;
import org.chorem.pollen.business.persistence.UserAccount;
import org.chorem.pollen.services.PollenServiceSupport;
@@ -52,31 +51,42 @@
Preconditions.checkNotNull(poll);
PollDAO pollDAO = getDAO(Poll.class);
- PollAccountDAO pollAccountDAO = getDAO(PollAccount.class);
CommentDAO dao = getDAO(Comment.class);
try {
- // creates poll account
- PollAccount pollAccountCreated =
- pollAccountDAO.create(comment.getPollAccount());
-
// get last version of the poll
Poll pollToUpdate = pollDAO.findByTopiaId(poll.getTopiaId());
// creates the poll comment
Comment commentCreated = dao.create(
- Comment.PROPERTY_POLL_ACCOUNT, pollAccountCreated,
Comment.PROPERTY_POLL, pollToUpdate,
Comment.PROPERTY_POST_DATE, comment.getPostDate(),
+ Comment.PROPERTY_AUTHOR, comment.getAuthor(),
Comment.PROPERTY_TEXT, comment.getText()
);
// add it to poll
pollToUpdate.addComment(commentCreated);
- commitTransaction("Could not create comment " + comment.getText());
+ // attach poll account if exists
+ PollAccount pollAccount = comment.getPollAccount();
+ if (pollAccount.getTopiaId() != null) {
+ PollAccount pollAccountLoaded = getEntityById(PollAccount.class, pollAccount.getTopiaId());
+
+ // attach the userAccount
+ if (pollAccountLoaded.getUserAccount() == null && pollAccount.getUserAccount() != null) {
+ String userId = pollAccount.getUserAccount().getTopiaId();
+ UserAccount userAccountLoaded = getEntityById(UserAccount.class, userId);
+ pollAccountLoaded.setUserAccount(userAccountLoaded);
+ }
+
+ commentCreated.setPollAccount(pollAccountLoaded);
+ }
+
+ commitTransaction("Could not create comment (" + comment.getAuthor() + ") " + comment.getText());
+
// feed notification
PollService pollService = newService(PollService.class);
@@ -105,7 +115,6 @@
throw new PollCommentNotFound();
}
- //FIXME Should we also delete the associated pollAccount ?
dao.delete(comment);
commitTransaction("Could not delete comment " + comment.getText());
@@ -115,7 +124,7 @@
}
}
- public Comment getNewComment(PollAccount account, String text) {
+ public Comment getNewComment(PollAccount account, String author, String text) {
CommentDAO dao = getDAO(Comment.class);
Comment result = newInstance(dao);
@@ -123,49 +132,35 @@
if (account != null) {
result.setPollAccount(account);
}
+ result.setAuthor(author);
result.setText(text);
result.setPostDate(serviceContext.getCurrentTime());
return result;
}
- public PollAccount getNewPollAccount(UserAccount user, String votingId) {
- PollAccountDAO dao = getDAO(PollAccount.class);
- PollAccount result = newInstance(dao);
- if (user != null) {
- result.setVotingId(user.getDisplayName());
- result.setAccountId(serviceContext.createPollenUrlId());
- result.setEmail(user.getEmail());
- result.setUserAccount(user);
- }
- if (votingId != null) {
- result.setVotingId(votingId);
- }
- return result;
- }
-
public boolean isCanDeleteComment(Comment comment,
+ PollAccount pollAccount,
UserAccount userAccount) {
- boolean result = false;
+ boolean result;
+ PollAccount commentAccount = comment.getPollAccount();
+
+ // loggued
if (userAccount != null) {
- // loggued
+ boolean isAdmin = userAccount.isAdministrator();
+ boolean isCommentAccount = userAccount.equals(commentAccount.getUserAccount());
- if (userAccount.isAdministrator()) {
+ result = isAdmin || isCommentAccount;
- // administrator can always delete everything
- result = true;
+ } else if (pollAccount != null) {
- } else {
+ result = pollAccount.equals(commentAccount);
- PollAccount pollAccount = comment.getPollAccount();
- if (userAccount.equals(pollAccount.getUserAccount())) {
- result = true;
- }
- }
+ } else {
+ result = false;
}
-
return result;
}
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-04-02 09:29:31 UTC (rev 3222)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetPollComments.java 2012-04-02 09:29:44 UTC (rev 3223)
@@ -117,6 +117,7 @@
UserAccount userAccount) {
Set<String> result = Sets.newHashSet();
boolean canDelete = pollService.isCanDeleteComment(comment,
+ null,
userAccount);
if (canDelete) {
result.add("delete");
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-04-02 09:29:31 UTC (rev 3222)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractVoteAction.java 2012-04-02 09:29:44 UTC (rev 3223)
@@ -39,6 +39,7 @@
import org.chorem.pollen.common.ChoiceType;
import org.chorem.pollen.common.PollType;
import org.chorem.pollen.common.VoteCountingType;
+import org.chorem.pollen.services.exceptions.PollAccountNotFound;
import org.chorem.pollen.services.exceptions.PollNotFoundException;
import org.chorem.pollen.services.impl.PollCommentService;
import org.chorem.pollen.services.impl.PollFeedService;
@@ -70,6 +71,8 @@
private transient PollService pollService;
private transient VoteService voteService;
+
+ private transient PollCommentService pollCommentService;
private Poll poll;
@@ -87,7 +90,7 @@
private Vote vote;
- private String commentName;
+ private String commentAuthor;
private String voteSizeMessage;
@@ -123,6 +126,13 @@
return voteService;
}
+ protected PollCommentService getPollCommentService() {
+ if (pollCommentService == null) {
+ pollCommentService = newService(PollCommentService.class);
+ }
+ return pollCommentService;
+ }
+
@Override
public void setParameters(Map<String, String[]> parameters) {
this.parameters = parameters;
@@ -248,19 +258,19 @@
return poll.getEndDate() != null && poll.getEndDate().before(now);
}
- public String getCommentName() {
- return commentName;
+ public String getCommentAuthor() {
+ if (commentAuthor == null) {
+ // Use current pollAccount name for comment
+ commentAuthor = getPollAccount().getVotingId();
+ }
+ return commentAuthor;
}
- public void setCommentName(String commentName) {
- this.commentName = commentName;
+ public void setCommentAuthor(String commentAuthor) {
+ this.commentAuthor = commentAuthor;
}
-
- public void resetCommentName() {
- setCommentName(getPollAccount().getVotingId());
- }
- public void prepareVotePage() throws Exception {
+ public String prepareVotePage() throws Exception {
loadPoll();
@@ -269,7 +279,7 @@
DateFormat.SHORT, getLocale()));
// Current poll account
- pollAccount = getPollService().getPollAccountEditable(getAccountId(), getPollenUserAccount(), poll);
+ loadPollAccount();
// All votes
// TODO no pagination for the moment, need to retrieve the correct page depends on current pollAccount
@@ -309,8 +319,6 @@
creatorUser = getPollenUserAccount() != null &&
getPollenUserAccount().equals(poll.getCreator().getUserAccount());
- resetCommentName();
-
if (log.isInfoEnabled()) {
Date now = serviceContext.getCurrentTime();
log.info("pollChoiceOrVoteStarted = " + isPollChoiceOrVoteStarted());
@@ -319,6 +327,7 @@
log.info("accountFieldDisplayed = " + isAccountFieldDisplayed());
log.info("creatorUser = " + creatorUser);
}
+ return INPUT;
}
public String getResultValue(Choice choice) {
@@ -362,6 +371,10 @@
return getVoteService().isVoteAllowed(getPoll(), getPollAccount());
}
+ public boolean isDeleteCommentAllowed(Comment comment) {
+ return isCreatorUser() || getPollCommentService().isCanDeleteComment(comment, getPollAccount(), getPollenUserAccount());
+ }
+
public String escapeLineBreak(String text) {
return text;
}
@@ -370,6 +383,12 @@
return formatDate(new Date(Long.valueOf(choice.getName())));
}
+ protected void loadPollAccount() throws PollAccountNotFound {
+
+ // Current poll account
+ pollAccount = getPollService().getPollAccountEditable(getAccountId(), getPollenUserAccount(), poll);
+ }
+
protected void loadPoll() throws PollNotFoundException {
// Ensure uri for poll and pollAccount loading
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-04-02 09:29:31 UTC (rev 3222)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AddComment.java 2012-04-02 09:29:44 UTC (rev 3223)
@@ -23,11 +23,10 @@
*/
package org.chorem.pollen.ui.actions.poll;
-import com.google.common.base.Preconditions;
+import com.opensymphony.xwork2.Preparable;
import com.opensymphony.xwork2.interceptor.annotations.InputConfig;
+import org.apache.commons.lang3.StringUtils;
import org.chorem.pollen.business.persistence.Comment;
-import org.chorem.pollen.business.persistence.PollAccount;
-import org.chorem.pollen.services.impl.PollCommentService;
/**
* To add a poll comment.
@@ -35,43 +34,50 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 1.2.6
*/
-public class AddComment extends AbstractVoteAction {
+public class AddComment extends AbstractVoteAction implements Preparable {
private static final long serialVersionUID = 1L;
+
+ private String commentText;
- /** Text of the comment. */
- protected String commentText;
+ public void setCommentText(String commentText) {
+ this.commentText = commentText;
+ }
public String getCommentText() {
return commentText;
}
- public void setCommentText(String commentText) {
- this.commentText = commentText;
+ @Override
+ public void prepare() throws Exception {
+
+ loadPoll();
+ loadPollAccount();
}
- @InputConfig(methodName = "prepareVotePage")
@Override
- public String execute() throws Exception {
+ public void validate() {
- loadPoll();
+ if (StringUtils.isBlank(getCommentAuthor())) {
+ addFieldError("commentAuthor", _("pollen.error.comment.name.empty"));
+ }
- Preconditions.checkNotNull(getCommentName());
- Preconditions.checkNotNull(getCommentText());
+ if (StringUtils.isBlank(getCommentText())) {
+ addFieldError("commentText", _("pollen.error.comment.text.empty"));
+ }
+ }
- PollCommentService service = newService(PollCommentService.class);
+ @InputConfig(methodName = "prepareVotePage")
+ @Override
+ public String execute() throws Exception {
- // prepare a new poll account for the comment
- PollAccount pollAccount = service.getNewPollAccount(
- getPollenUserAccount(), getCommentName());
-
// prepare a new comment
- Comment comment = service.getNewComment(pollAccount, getCommentText());
+ Comment comment = getPollCommentService().getNewComment(
+ getPollAccount(), getCommentAuthor(), getCommentText());
// create the comment
- service.createComment(getPoll(), comment);
+ getPollCommentService().createComment(getPoll(), comment);
return SUCCESS;
}
-
}
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-04-02 09:29:31 UTC (rev 3222)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-04-02 09:29:44 UTC (rev 3223)
@@ -53,7 +53,7 @@
pollen.common.choice.date=Date
pollen.common.choice.image=Image
pollen.common.choice.text=Label
-pollen.common.commentName=Name
+pollen.common.commentAuthor=Name
pollen.common.commentText=Comment
pollen.common.comments=Comments about this poll
pollen.common.csvImport=CSV import
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-04-02 09:29:31 UTC (rev 3222)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-04-02 09:29:44 UTC (rev 3223)
@@ -58,7 +58,7 @@
pollen.common.choice.date=Date
pollen.common.choice.image=Image
pollen.common.choice.text=Libellé
-pollen.common.commentName=Nom
+pollen.common.commentAuthor=Nom
pollen.common.commentText=Commentaire
pollen.common.comments=Commentaire à propos du sondage
pollen.common.csvImport=Import CSV
Deleted: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/poll/AddComment-addComment-validation.xml
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/poll/AddComment-addComment-validation.xml 2012-04-02 09:29:31 UTC (rev 3222)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/resources/org/chorem/pollen/ui/actions/poll/AddComment-addComment-validation.xml 2012-04-02 09:29:44 UTC (rev 3223)
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- #%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%
- -->
-
-
-<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.3//EN"
- "http://www.opensymphony.com/xwork/xwork-validator-1.0.3.dtd">
-
-<validators>
-
- <field name="commentName">
-
- <field-validator type="requiredstring">
- <message key="pollen.error.comment.name.empty"/>
- </field-validator>
- </field>
-
- <field name="commentText">
-
- <field-validator type="requiredstring">
- <message key="pollen.error.comment.text.empty"/>
- </field-validator>
- </field>
-
-</validators>
\ No newline at end of file
Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmDeletePollComment.jsp
===================================================================
--- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmDeletePollComment.jsp 2012-04-02 09:29:31 UTC (rev 3222)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/confirmDeletePollComment.jsp 2012-04-02 09:29:44 UTC (rev 3223)
@@ -33,8 +33,8 @@
<s:textfield key='comment.postDate' readonly="true" size="50"
label="%{getText('pollen.common.postDate')}"/>
- <s:textfield key='comment.pollAccount.votingId' readonly="true" size="50"
- label="%{getText('pollen.common.commentName')}"/>
+ <s:textfield key='comment.author' readonly="true" size="50"
+ label="%{getText('pollen.common.commentAuthor')}"/>
<s:textarea key='comment.text' readonly="true" rows="3"
label="%{getText('pollen.common.commentText')}"/>
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-04-02 09:29:31 UTC (rev 3222)
+++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp 2012-04-02 09:29:44 UTC (rev 3223)
@@ -472,7 +472,7 @@
<s:if test="#status.even">class="even"</s:if>
<s:else>class="odd"</s:else>
>
- <s:if test="creatorUser">
+ <s:if test="isDeleteCommentAllowed(#comment)">
<span class="cmd">
<s:a href="#"
onclick="return openDeleteCommentDialog('%{#comment.topiaId}');">
@@ -482,7 +482,7 @@
</s:a>
</span>
</s:if>
- <span class="name"><s:property value='pollAccount.votingId'/></span> :
+ <span class="name"><s:property value='#comment.author'/></span> :
<span class="date">
<s:property value='%{formatDateTime(postDate)}'/>
</span>
@@ -530,8 +530,8 @@
<div id="commentFormDiv">
<s:form id='addCommentForm' method="POST" namespace="/poll" validate="true">
- <s:textfield key="commentName" required="true" size="78"
- label="%{getText('pollen.common.commentName')}"/>
+ <s:textfield key="commentAuthor" required="true" size="78"
+ label="%{getText('pollen.common.commentAuthor')}"/>
<s:textarea key="commentText" required="true" value=''
label="%{getText('pollen.common.commentText')}"/>
1
0