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
June 2012
- 5 participants
- 163 discussions
r3520 - trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll
by ymartel@users.chorem.org 19 Jun '12
by ymartel@users.chorem.org 19 Jun '12
19 Jun '12
Author: ymartel
Date: 2012-06-19 10:52:49 +0200 (Tue, 19 Jun 2012)
New Revision: 3520
Url: http://chorem.org/repositories/revision/pollen/3520
Log:
fix #596 : on image choice, only accept image/* mimetype file for upload
Modified:
trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractPollForm.java
Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractPollForm.java
===================================================================
--- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractPollForm.java 2012-06-19 08:18:29 UTC (rev 3519)
+++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractPollForm.java 2012-06-19 08:52:49 UTC (rev 3520)
@@ -891,7 +891,24 @@
addInformationsError(
choiceErrorField,
_("pollen.error.poll.imageChoice.upload.badContentType"));
- //TODO ymartel 2012/06/18
+ //Remove the file and its thumb
+ PollImageChoice imageChoice = (PollImageChoice) choice;
+ File imageFile = new File(imageChoice.getLocation());
+ File imageThumbFile = getPollService().getImageThumbFile(imageFile);
+ FileUtils.deleteQuietly(imageThumbFile);
+ FileUtils.deleteQuietly(imageFile);
+ // The choice has no more location
+ String choiceId = imageChoice.getTopiaId();
+ if (StringUtils.isBlank(choiceId)) {
+ imageChoice.setLocation(null);
+ // As the name of the choice is the fileName, remove it too.
+ imageChoice.setName(null);
+ } else {
+ // in case of update, get back the old values for name and location and keep the old choice
+ PollImageChoice pollChoice = (PollImageChoice) poll.getChoiceByTopiaId(choiceId);
+ imageChoice.setName(pollChoice.getName());
+ imageChoice.setLocation(pollChoice.getLocation());
+ }
continue;
}
}
1
0
r3519 - in trunk/pollen-ui-struts2/src/main: java/org/chorem/pollen/ui/actions/json java/org/chorem/pollen/ui/actions/poll resources resources/config resources/i18n webapp/WEB-INF/decorators webapp/WEB-INF/jsp webapp/WEB-INF/jsp/admin webapp/WEB-INF/jsp/poll webapp/WEB-INF/jsp/security webapp/WEB-INF/jsp/user webapp/css webapp/js
by tchemit@users.chorem.org 19 Jun '12
by tchemit@users.chorem.org 19 Jun '12
19 Jun '12
Author: tchemit
Date: 2012-06-19 10:18:29 +0200 (Tue, 19 Jun 2012)
New Revision: 3519
Url: http://chorem.org/repositories/revision/pollen/3519
Log:
- refs #562: improve choice layout
- reformat jsp
- do not use jstl anyway in jsp (prefer use struts)
Added:
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/pollForm.jsp
Removed:
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/adminRequired.jsp
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/create.jsp
Modified:
trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetPolls.java
trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractPollForm.java
trunk/pollen-ui-struts2/src/main/resources/config/struts-poll.xml
trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties
trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties
trunk/pollen-ui-struts2/src/main/resources/struts.xml
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators/layout-default.jsp
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/admin/pollsList.jsp
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/admin/usersList.jsp
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/home.jsp
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/createPoll_choices.jsp
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/displayDateChoice.jsp
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/displayImageChoice.jsp
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/displayPersonToList.jsp
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/displayPollComment.jsp
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/displayPollComments.jsp
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/displayTextChoice.jsp
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/displayVotingList.jsp
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/displayVotingListPersons.jsp
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/summary.jsp
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/pollListHelper.jsp
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/security/connected_required.jsp
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/createdList.jsp
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/dialogLostPassword.jsp
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/edit.jsp
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/favoriteList.jsp
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/favoriteLists.jsp
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/invitedList.jsp
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/login.jsp
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/participatedList.jsp
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/register.jsp
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/show.jsp
trunk/pollen-ui-struts2/src/main/webapp/css/pollCreation.css
trunk/pollen-ui-struts2/src/main/webapp/css/summary.css
trunk/pollen-ui-struts2/src/main/webapp/js/createPoll.js
trunk/pollen-ui-struts2/src/main/webapp/js/favoriteList.js
Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetPolls.java
===================================================================
--- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetPolls.java 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetPolls.java 2012-06-19 08:18:29 UTC (rev 3519)
@@ -30,7 +30,6 @@
import java.util.List;
import java.util.Map;
-import java.util.Set;
/**
* Obtain paginated users.
@@ -84,28 +83,11 @@
Map<String, Object> map = pollService.pollToMap(poll, binder);
map.put("adminId", poll.getAdminId());
-
- Set<String> functions = getPollFunctions(poll);
- map.put("functions", functions);
+ map.put("functions", Sets.newHashSet("summary"));
polls[index++] = map;
}
return SUCCESS;
}
- protected Set<String> getPollFunctions(Poll poll) {
- Set<String> result = Sets.newHashSet();
- result.add("summary");
-// result.add("result");
-// if (!poll.isClosed()) {
-//
-// // poll is not closed
-// result.add("edit");
-// result.add("close");
-// }
-// result.add("export");
-// result.add("clone");
- result.add("delete");
- return result;
- }
}
Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractPollForm.java
===================================================================
--- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractPollForm.java 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractPollForm.java 2012-06-19 08:18:29 UTC (rev 3519)
@@ -181,6 +181,13 @@
private Map<Integer, Choice> choices;
/**
+ * Contains the order of choices (given by the xxx.order field.
+ *
+ * @since 1.4
+ */
+ private Map<Integer, Integer> choicesOrder;
+
+ /**
* Indexed voting lists retreive from parameters for the pollType selected
* in form. (Other voting lists are lost).
*
@@ -250,6 +257,8 @@
ChoiceType pollChoiceType = ChoiceType.valueOf(choiceTypeParam);
poll.setChoiceType(pollChoiceType);
+ choicesOrder = Maps.newTreeMap();
+
// build poll choices
switch (pollChoiceType) {
@@ -1356,20 +1365,26 @@
// can keep this none empty text choice name
Integer choiceNumber = Integer.valueOf(matcher.group(1));
+
if (choiceNumber > maxNumber) {
maxNumber = choiceNumber;
}
+ String choicePrefix = fieldPrefix + choiceNumber;
Choice choice = createChoice(new ChoiceImpl(),
- fieldPrefix + choiceNumber,
+ choicePrefix,
paramValue);
if (!isTextChoiceEmpty(choice)) {
// This is not an empty choice keep it
result.put(choiceNumber, choice);
+
+ // keep order
+ int order = getIntegerValue(choicePrefix + ".order");
+ choicesOrder.put(order, choiceNumber);
}
}
}
- result = reindexMap(result, maxNumber);
+ result = reindexChoiceMap(result, maxNumber);
int size = result.size();
if (log.isInfoEnabled()) {
@@ -1400,10 +1415,10 @@
if (choiceNumber > maxNumber) {
maxNumber = choiceNumber;
}
- String choiceFieldPrefix = fieldPrefix + choiceNumber;
+ String choicePrefix = fieldPrefix + choiceNumber;
PollDateChoice choice = createChoice(new PollDateChoice(),
- choiceFieldPrefix,
+ choicePrefix,
paramValue);
if (StringUtils.isNotBlank(paramValue)) {
Date date = DateConverter.convertFromString(paramValue);
@@ -1414,10 +1429,14 @@
// This is not an empty choice keep it
result.put(choiceNumber, choice);
+
+ // keep order
+ int order = getIntegerValue(choicePrefix + ".order");
+ choicesOrder.put(order, choiceNumber);
}
}
}
- result = reindexMap(result, maxNumber);
+ result = reindexChoiceMap(result, maxNumber);
int size = result.size();
if (log.isInfoEnabled()) {
@@ -1451,13 +1470,13 @@
maxNumber = choiceNumber;
}
- String choiceFieldPrefix = fieldPrefix + choiceNumber;
+ String choicePrefix = fieldPrefix + choiceNumber;
PollImageChoice choice = createChoice(new PollImageChoice(),
- choiceFieldPrefix,
+ choicePrefix,
null);
String location = getNonEmptyParameterValue(
- choiceFieldPrefix + ".newLocation");
+ choicePrefix + ".newLocation");
if (StringUtils.isNotBlank(location)) {
// found a real upload file (not jus the location of an
@@ -1466,24 +1485,24 @@
// ok so now use also newName
String paramValue = getNonEmptyParameterValue(
- choiceFieldPrefix + ".newName");
+ choicePrefix + ".newName");
choice.setName(paramValue);
- parametersToSwitch.put(choiceFieldPrefix + ".newLocation",
- choiceFieldPrefix + ".location");
+ parametersToSwitch.put(choicePrefix + ".newLocation",
+ choicePrefix + ".location");
- parametersToSwitch.put(choiceFieldPrefix + ".newName",
- choiceFieldPrefix + ".name");
+ parametersToSwitch.put(choicePrefix + ".newName",
+ choicePrefix + ".name");
} else {
// try with old location
location = getNonEmptyParameterValue(
- choiceFieldPrefix + ".location");
+ choicePrefix + ".location");
choice.setLocation(location);
String paramValue = getNonEmptyParameterValue(
- choiceFieldPrefix + ".name");
+ choicePrefix + ".name");
choice.setName(paramValue);
}
@@ -1491,6 +1510,10 @@
// This is not an empty choice keep it
result.put(choiceNumber, choice);
+
+ // keep order
+ int order = getIntegerValue(choicePrefix + ".order");
+ choicesOrder.put(order, choiceNumber);
}
}
}
@@ -1502,7 +1525,7 @@
String[] valueToSwitch = parameters.remove(paramNameSource);
parameters.put(paramNameTarget, valueToSwitch);
}
- result = reindexMap(result, maxNumber);
+ result = reindexChoiceMap(result, maxNumber);
int size = result.size();
if (log.isInfoEnabled()) {
log.info("nbImageChoices (from request) = " + size);
@@ -1590,6 +1613,24 @@
return result;
}
+ private int getIntegerValue(String parameterName) {
+ String parameterValue = getNonEmptyParameterValue(parameterName);
+ int result = 0;
+ if (StringUtils.isNotEmpty(parameterValue)) {
+
+ try {
+ result = Integer.valueOf(parameterValue);
+ } catch (NumberFormatException e) {
+ //bad conversion, will be treated later
+ if (log.isDebugEnabled()) {
+ log.debug("Bad double conversion from param [" +
+ parameterName + "] : " + parameterValue);
+ }
+ }
+ }
+ return result;
+ }
+
private int buildVotingList(String votingListParameterName,
String votingListPrefix,
int votingListNumber,
@@ -1737,6 +1778,40 @@
return result2;
}
+ protected <T> Map<Integer, T> reindexChoiceMap(Map<Integer, T> result, int maxNumber) {
+ Map<Integer, T> result2 = Maps.newTreeMap();
+
+ for (Integer choiceOrder : choicesOrder.keySet()) {
+ Integer choiceNumber = choicesOrder.get(choiceOrder);
+ T choice = result.get(choiceNumber );
+ if (choice != null) {
+ result2.put(choiceOrder, choice);
+ }
+ }
+
+// if (maxNumber != result.size() - 1) {
+//
+// // means there is a hole inside the result (a empty choice was
+// // submitted)
+//
+// // le'ts remove this
+// List<Integer> numbers = Lists.newArrayList(result.keySet());
+//
+// Collections.sort(numbers);
+//
+// result2 = Maps.newTreeMap();
+// int i = 0;
+// for (Integer number : numbers) {
+// T choice = result.get(number);
+// result2.put(i++, choice);
+// }
+// } else {
+// result2 = result;
+// }
+ return result2;
+ }
+
+
protected String getNonEmptyParameterValue(String paramName) {
String[] paramValues = parameters.get(paramName);
String result = null;
Modified: trunk/pollen-ui-struts2/src/main/resources/config/struts-poll.xml
===================================================================
--- trunk/pollen-ui-struts2/src/main/resources/config/struts-poll.xml 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/resources/config/struts-poll.xml 2012-06-19 08:18:29 UTC (rev 3519)
@@ -37,46 +37,37 @@
<param name="actionName">votefor/${uriId}</param>
</result-type>
+ <result-type name="redirectToSummary"
+ class="org.chorem.pollen.ui.results.PollenServletActionRedirectResult">
+ <param name="namespace">/poll</param>
+ <param name="actionName">summary/${uriId}</param>
+ </result-type>
+
</result-types>
<!-- create poll -->
<action name="create" class="org.chorem.pollen.ui.actions.poll.CreatePoll"
method="execute">
- <result name="input">/WEB-INF/jsp/poll/create.jsp</result>
- <result type="pollenRedirectAction">
- <param name="namespace">/poll</param>
- <param name="actionName">summary/${uriId}</param>
- </result>
+ <result name="input">/WEB-INF/jsp/poll/pollForm.jsp</result>
+ <result type="redirectToSummary"/>
</action>
<!-- edit poll -->
<action name="edit/*" class="org.chorem.pollen.ui.actions.poll.EditPoll"
method="execute">
<param name="uriId">{1}</param>
- <result name="input">/WEB-INF/jsp/poll/create.jsp</result>
- <result type="pollenRedirectAction">
- <param name="namespace">/poll</param>
- <param name="actionName">summary/${uriId}</param>
- </result>
+ <result name="input">/WEB-INF/jsp/poll/pollForm.jsp</result>
+ <result type="redirectToSummary"/>
</action>
<!-- clone poll -->
<action name="clone/*" class="org.chorem.pollen.ui.actions.poll.ClonePoll"
method="execute">
<param name="uriId">{1}</param>
- <result name="input">/WEB-INF/jsp/poll/create.jsp</result>
- <result type="pollenRedirectAction">
- <param name="namespace">/poll</param>
- <param name="actionName">summary/${uriId}</param>
- </result>
+ <result name="input">/WEB-INF/jsp/poll/pollForm.jsp</result>
+ <result type="redirectToSummary"/>
</action>
- <!-- display * -->
- <action name="display*"
- class="org.chorem.pollen.ui.actions.poll.Display{1}">
- <result>/WEB-INF/jsp/poll/display{1}.jsp</result>
- </action>
-
<!-- resume poll -->
<action name="summary/*" method="execute"
class="org.chorem.pollen.ui.actions.poll.SummaryPoll">
@@ -126,19 +117,6 @@
<result type="redirect2"/>
</action>
- <!-- display poll result -->
- <action name="results/*" method="execute"
- class="org.chorem.pollen.ui.actions.poll.ResultForPoll">
- <param name="uriId">{1}</param>
- <result>/WEB-INF/jsp/poll/result.jsp</result>
- </action>
-
- <!-- confirm delete comment -->
- <action name="confirmDeleteComment"
- class="org.chorem.pollen.ui.actions.poll.ConfirmDeleteComment">
- <result>/WEB-INF/jsp/poll/confirmDeletePollComment.jsp</result>
- </action>
-
<!-- vote poll -->
<action name="vote/*" method="execute"
class="org.chorem.pollen.ui.actions.poll.VoteForPoll">
@@ -184,14 +162,24 @@
<result name="input">/WEB-INF/jsp/poll/vote.jsp</result>
</action>
- <!-- add a choice -->
- <action name="addChoice/*"
- class="org.chorem.pollen.ui.actions.poll.AddChoice">
- <param name="uriId">{1}</param>
- <result name="input">/WEB-INF/jsp/poll/vote.jsp</result>
+ <!-- edit poll vote -->
+ <action name="editVote"
+ class="org.chorem.pollen.ui.actions.poll.EditVote">
<result type="redirectToVote"/>
</action>
+ <!-- confirm delete poll vote -->
+ <action name="confirmDeleteVote"
+ class="org.chorem.pollen.ui.actions.poll.ConfirmDeleteVote">
+ <result>/WEB-INF/jsp/poll/confirmDeletePollVote.jsp</result>
+ </action>
+
+ <!-- delete poll vote -->
+ <action name="deleteVote"
+ class="org.chorem.pollen.ui.actions.poll.DeleteVote">
+ <result type="redirectToVote"/>
+ </action>
+
<!-- add a poll comment -->
<action name="addComment/*"
class="org.chorem.pollen.ui.actions.poll.AddComment">
@@ -200,41 +188,26 @@
<result type="redirectToVote"/>
</action>
+ <!-- confirm delete comment -->
+ <action name="confirmDeleteComment"
+ class="org.chorem.pollen.ui.actions.poll.ConfirmDeleteComment">
+ <result>/WEB-INF/jsp/poll/confirmDeletePollComment.jsp</result>
+ </action>
+
<!-- delete a poll comment -->
<action name="deleteComment"
class="org.chorem.pollen.ui.actions.poll.DeleteComment">
<result type="redirectToVote"/>
</action>
- <!-- get the feed of a given poll -->
- <action name="getFeed"
- class="org.chorem.pollen.ui.actions.poll.GetPollFeed">
- <result type="stream">
- <param name="contentCharSet">UTF-8</param>
- <param name="contentType">application/atom+xml</param>
- <param name="encode">true</param>
- <param name="bufferSize">4096</param>
- </result>
- </action>
-
- <!-- confirm delete poll vote -->
- <action name="confirmDeleteVote"
- class="org.chorem.pollen.ui.actions.poll.ConfirmDeleteVote">
- <result>/WEB-INF/jsp/poll/confirmDeletePollVote.jsp</result>
- </action>
-
- <!-- delete poll vote -->
- <action name="deleteVote"
- class="org.chorem.pollen.ui.actions.poll.DeleteVote">
+ <!-- add a choice -->
+ <action name="addChoice/*"
+ class="org.chorem.pollen.ui.actions.poll.AddChoice">
+ <param name="uriId">{1}</param>
+ <result name="input">/WEB-INF/jsp/poll/vote.jsp</result>
<result type="redirectToVote"/>
</action>
- <!-- edit poll vote -->
- <action name="editVote"
- class="org.chorem.pollen.ui.actions.poll.EditVote">
- <result type="redirectToVote"/>
- </action>
-
<!-- confirm delete poll choice -->
<action name="confirmDeleteChoice"
class="org.chorem.pollen.ui.actions.poll.ConfirmDeleteChoice">
@@ -247,6 +220,30 @@
<result type="redirectToVote"/>
</action>
+ <!-- display * -->
+ <action name="display*"
+ class="org.chorem.pollen.ui.actions.poll.Display{1}">
+ <result>/WEB-INF/jsp/poll/display{1}.jsp</result>
+ </action>
+
+ <!-- display poll result -->
+ <action name="results/*" method="execute"
+ class="org.chorem.pollen.ui.actions.poll.ResultForPoll">
+ <param name="uriId">{1}</param>
+ <result>/WEB-INF/jsp/poll/result.jsp</result>
+ </action>
+
+ <!-- get the feed of a given poll -->
+ <action name="getFeed"
+ class="org.chorem.pollen.ui.actions.poll.GetPollFeed">
+ <result type="stream">
+ <param name="contentCharSet">UTF-8</param>
+ <param name="contentType">application/atom+xml</param>
+ <param name="encode">true</param>
+ <param name="bufferSize">4096</param>
+ </result>
+ </action>
+
<!-- Select a favorite list to add to a voting list -->
<action name="selectPersonListToAddToVotingList"
class="org.chorem.pollen.ui.actions.poll.SelectPersonListToVotingList">
Modified: trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties
===================================================================
--- trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-06-19 08:18:29 UTC (rev 3519)
@@ -11,7 +11,9 @@
pollen.action.backToFavoriteLists=Back to favorite lists
pollen.action.cancel=Cancel
pollen.action.clone=Clone poll
+pollen.action.clonePoll.help=Cloner this poll
pollen.action.close=Close the poll
+pollen.action.closePoll.help=Close this poll
pollen.action.create=Create
pollen.action.createFavoriteList=Create a new list
pollen.action.createPoll=Create the poll
@@ -21,14 +23,17 @@
pollen.action.deleteChoice=Delete the choice
pollen.action.deleteFavoriteList=Delete a list
pollen.action.deletePoll=Delete the poll
+pollen.action.deletePoll.help=Delete this poll
pollen.action.deletePollAccount=Delete selected member
pollen.action.deleteUser=Delete selected user
pollen.action.deleteVote=Delete this vote
pollen.action.editFavoriteList=Edit a list
pollen.action.editPoll=Edit the poll
+pollen.action.editPoll.help=Edit this poll
pollen.action.editPollAccount=Edit selected member
pollen.action.editUser=Edit selected user
pollen.action.editVote=Modifier le vote
+pollen.action.exportPoll.help=Export this poll (xml format)
pollen.action.importPersonListToExistingVotingList=Add selected voting list
pollen.action.importPersonListToNewVotingList=Create a new group from the selected voting list
pollen.action.login=Log me In
@@ -44,8 +49,10 @@
pollen.action.pollEdit=Edit poll
pollen.action.pollExport=Export poll
pollen.action.pollModerateVote=Administrate votes
+pollen.action.pollModerateVote.help=Moderate votes and comments for this poll
pollen.action.pollPersonToListDelete=Delete this voter
pollen.action.pollResult=Display poll results
+pollen.action.pollResult.help=vote count and display results for this poll
pollen.action.pollSummary=Poll summary
pollen.action.pollVote=Vote
pollen.action.pollVotingListDelete=Delete the voting list
@@ -54,6 +61,7 @@
pollen.action.send=Send
pollen.action.summaryPoll=Goto administration page of the poll
pollen.action.validate=Submit
+pollen.action.voteAction.help=Share this link with people to vote
pollen.banner.newVersion=New version\!
pollen.common.aboutPoll=About the poll
pollen.common.addingChoices=Adding choices
@@ -287,15 +295,15 @@
pollen.information.vote.deleted=Vote deleted.
pollen.information.your.are.loggued=You are logged.
pollen.label.contact.administrator=Send an email to an administrator
-pollen.label.pollClonePage=<strong>Clone your poll</strong>
-pollen.label.pollClosePage=<strong>Close your poll</strong>
-pollen.label.pollDeletePage=<strong>Delete your poll</strong>
-pollen.label.pollEditPage=<strong>To modify your poll</strong>. Save it to be able to modify your poll later if you need it or to close it\:
-pollen.label.pollExportPage=<strong>Export your poll</strong>
-pollen.label.pollModerateVotePage=<strong>To moderate your poll (you can't vote from this url)</strong>. Save it to be able to delete votes and comments\:
+pollen.label.pollClonePage=Clone your poll
+pollen.label.pollClosePage=Close your poll
+pollen.label.pollDeletePage=Delete your poll
+pollen.label.pollEditPage=Edit your poll
+pollen.label.pollExportPage=Export your poll
+pollen.label.pollModerateVotePage=Moderate your poll
pollen.label.pollRegisterPage=If you are a logged user, you can find these links on the page
-pollen.label.pollResultPage=<strong>To count the vote</strong>.Save it to be able to count the vote later\:
-pollen.label.pollVotePage=<strong>To vote on your poll</strong>. Save it and send it to the people that you want to vote\:
+pollen.label.pollResultPage=Count votes
+pollen.label.pollVotePage=Vote on your poll
pollen.legend.attachPoll=Attach an anonymous poll to your user account
pollen.legend.login=Login
pollen.legend.select.favoriteList.to.add=Sélectionner la liste de favoris à ajouter
Modified: trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties
===================================================================
--- trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-06-19 08:18:29 UTC (rev 3519)
@@ -11,7 +11,9 @@
pollen.action.backToFavoriteLists=Retour à la liste des favoris
pollen.action.cancel=Annuler
pollen.action.clone=Cloner le sondage
+pollen.action.clonePoll.help=Cloner ce sondage
pollen.action.close=Fermer le sondage
+pollen.action.closePoll.help=Fermer ce sondage
pollen.action.create=Créer
pollen.action.createFavoriteList=Créer une ouvelle liste
pollen.action.createPoll=Créer le sondage
@@ -21,14 +23,17 @@
pollen.action.deleteChoice=Supprimer le choix
pollen.action.deleteFavoriteList=Supprimer une liste sélectionnée
pollen.action.deletePoll=Supprimer le sondage
+pollen.action.deletePoll.help=Supprimer ce sondage
pollen.action.deletePollAccount=Supprimer une membre de la liste
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.editPoll.help=Éditer ce sondage
pollen.action.editPollAccount=Editer le membre sélectionné
pollen.action.editUser=Editer un utilisateur sélectionné
pollen.action.editVote=Modifier le vote
+pollen.action.exportPoll.help=Exporter ce sondage au format xml
pollen.action.importPersonListToExistingVotingList=Ajouter la liste sélectionnée de votants
pollen.action.importPersonListToNewVotingList=Créer un groupe à partir de la liste sélectionnée
pollen.action.login=M'identifier
@@ -44,8 +49,10 @@
pollen.action.pollEdit=Editer le sondage
pollen.action.pollExport=Exporter le sondage
pollen.action.pollModerateVote=Administrer les votes
+pollen.action.pollModerateVote.help=Modérer les votes et commentaires du sondage
pollen.action.pollPersonToListDelete=Supprimer ce votant
pollen.action.pollResult=Afficher les résultats du sondage
+pollen.action.pollResult.help=Dépouiller et afficher les résultats du sondage
pollen.action.pollSummary=Résumé du sondage
pollen.action.pollVote=Voter
pollen.action.pollVotingListDelete=Supprimer le groupe de votants
@@ -54,6 +61,7 @@
pollen.action.send=Envoyer
pollen.action.summaryPoll=Aller sur la page d'administration du sondage
pollen.action.validate=Valider
+pollen.action.voteAction.help=Partager ce lien avec ceux que vous voulez voir voter
pollen.banner.newVersion=Nouvelle version \!
pollen.common.aboutPoll=A propos du sondage
pollen.common.addingChoices=Ajout des choix
@@ -287,15 +295,15 @@
pollen.information.vote.deleted=Vote supprimé.
pollen.information.your.are.loggued=Vous êtes connecté.
pollen.label.contact.administrator=Contacter un administrateur
-pollen.label.pollClonePage=<strong>Cloner le sondage</strong>
-pollen.label.pollClosePage=<strong>Fermer le sondage</strong>
-pollen.label.pollDeletePage=<strong>Supprimer le sondage</strong>
-pollen.label.pollEditPage=<strong>Lien pour configurer le sondage</strong>. Enregistrez-le pour pouvoir modifier votre sondage au besoin ou le clore \:
-pollen.label.pollExportPage=<strong>Exporter le sondage</strong>
-pollen.label.pollModerateVotePage=<strong>Lien pour modérer le sondage (ce lien ne permet pas de voter)</strong>. Enregistrez-le pour pouvoir supprimer des votes et commentaires \:
+pollen.label.pollClonePage=Cloner le sondage
+pollen.label.pollClosePage=Fermer le sondage
+pollen.label.pollDeletePage=Supprimer le sondage
+pollen.label.pollEditPage=Configurer le sondage
+pollen.label.pollExportPage=Exporter le sondage
+pollen.label.pollModerateVotePage=Modérer le sondage
pollen.label.pollRegisterPage=Si vous êtes un utilisateur identifié, vous pouvez retrouver ces liens dans la page
-pollen.label.pollResultPage=<strong>Lien pour dépouiller le sondage</strong>. Enregistrez-le pour pouvoir accéder au dépouillement plus tard \:
-pollen.label.pollVotePage=<strong>Lien pour voter</strong>. Enregistrez-le et envoyez-le à ceux que vous voulez voir voter \:
+pollen.label.pollResultPage=Dépouiller le sondage
+pollen.label.pollVotePage=Voter
pollen.legend.attachPoll=Attacher un sondage anonyme à votre compte
pollen.legend.login=Login
pollen.legend.select.favoriteList.to.add=Sélectionner la liste de favoris à ajouter
Modified: trunk/pollen-ui-struts2/src/main/resources/struts.xml
===================================================================
--- trunk/pollen-ui-struts2/src/main/resources/struts.xml 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/resources/struts.xml 2012-06-19 08:18:29 UTC (rev 3519)
@@ -121,14 +121,6 @@
<default-class-ref
class="org.chorem.pollen.ui.actions.PollenActionSupport"/>
- <action name="notLoggued">
- <result>/WEB-INF/jsp/user/login.jsp</result>
- </action>
-
- <action name="notAdmin">
- <result>/WEB-INF/jsp/adminRequired.jsp</result>
- </action>
-
<!-- go to home -->
<action name="home"
class="org.chorem.pollen.ui.actions.PollenActionSupport">
Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators/layout-default.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators/layout-default.jsp 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/decorators/layout-default.jsp 2012-06-19 08:18:29 UTC (rev 3519)
@@ -44,7 +44,9 @@
<%-- TODO AThimel 24/01/2012 Remove this when refactoring is over --%>
<div id="in-progress">
- <a href="http://chorem.org/projects/pollen"><s:text name="pollen.banner.newVersion"/></a>
+ <a href="http://chorem.org/projects/pollen">
+ <s:text name="pollen.banner.newVersion"/>
+ </a>
</div>
@@ -72,10 +74,10 @@
<s:set var="userExists" value="%{#user != null}"/>
<s:set var="userIsAdmin" value="%{#userExists && #user.administrator}"/>
-<body id="${pageLogo}Body">
+<body id="<s:property value="%{pageLogo}"/>Body">
<!-- Langue -->
-<div id="po-header-localization" class="${pageLogo}Localization">
+<div id="po-header-localization" class="<s:property value='%{pageLogo}'/>Localization">
<s:a title="Contacter un administrateur"
href="mailto:%{configuration.adminEmail}">
<img src="<s:url value='/img/contact.png' />" alt="Contact"/>
@@ -100,18 +102,18 @@
</s:a>
</p>
-<div id="top" class="${pageLogo}">
+<div id="top" class="<s:property value="%{pageLogo}"/>">
<!-- Login -->
- <div id="po-header-connection" class="${pageLogo}">
+ <div id="po-header-connection" class="<s:property value='%{pageLogo}'/>">
<s:if test="userExists">
<span class="menu_elt" onmouseover="$('#compte_menu').show()"
onmouseout="$('#compte_menu').hide()">
- ${user.displayName}
+ <s:property value='%{user.displayName}'/>
<div class="dropdown_menu" id="compte_menu" style="display: none;">
- <div class="top_right${pageLogo}"></div>
- <div class="top_left${pageLogo}"></div>
- <ul class="top_middle${pageLogo}">
+ <div class="top_right<s:property value='%{pageLogo}'/>"></div>
+ <div class="top_left<s:property value='%{pageLogo}'/>"></div>
+ <ul class="top_middle<s:property value='%{pageLogo}'/>">
<li>
<s:a action="show" namespace="/user">
<s:text name="pollen.menu.preferences"/>
@@ -132,26 +134,27 @@
</span>
<div class="dropdown_menu" id="login_menu" style="display: none;">
- <div class="top_right${pageLogo}"></div>
- <div class="top_left${pageLogo}"></div>
+ <div class="top_right<s:property value='%{pageLogo}'/>"></div>
+ <div class="top_left<s:property value='%{pageLogo}'/>"></div>
<sj:dialog id="lostPasswordDialog" autoOpen="false" modal="true" width="500"/>
<s:form id="connection" method="POST" namespace="/user" action="login">
<s:hidden name="redirectUrl" value="%{currentUrl}"/>
- <ul class="top_middle${pageLogo}">
+ <ul class="top_middle<s:property value='%{pageLogo}'/>">
<li>
<label for="connection_login">
<s:text name="pollen.common.login"/> :
</label>
<s:textfield key="login" size="10" required="true" theme="simple"
- label=''/>
+ label='' id='connection_login'/>
</li>
<li>
<label for="connection_password">
<s:text name="pollen.common.password"/> :
</label>
<s:password key="password" size="10" required="true"
+ id='connection_password'
label="" theme="simple"/>
</li>
<li>
@@ -186,9 +189,9 @@
<a><s:text name="pollen.menu.polls"/></a>
<div class="dropdown_menu" id="menu1" style="display:none">
- <div class="top_right${pageLogo}"></div>
- <div class="top_left${pageLogo}"></div>
- <ul class="top_middle${pageLogo}">
+ <div class="top_right<s:property value='%{pageLogo}'/>"></div>
+ <div class="top_left<s:property value='%{pageLogo}'/>"></div>
+ <ul class="top_middle<s:property value='%{pageLogo}'/>">
<li>
<s:a action="create" namespace="/poll">
<s:text name="pollen.menu.createPoll"/>
@@ -226,9 +229,9 @@
<a><s:text name="pollen.menu.admin"/></a>
<div class="dropdown_menu" id="menu2" style="display:none">
- <div class="top_right${pageLogo}"></div>
- <div class="top_left${pageLogo}"></div>
- <ul class="top_middle${pageLogo}">
+ <div class="top_right<s:property value='%{pageLogo}'/>"></div>
+ <div class="top_left<s:property value='%{pageLogo}'/>"></div>
+ <ul class="top_middle<s:property value='%{pageLogo}'/>">
<li>
<s:a action="pollsList" namespace="/admin">
<s:text name="pollen.menu.managePolls"/>
@@ -252,7 +255,7 @@
<div id="corps">
<!-- Barre d'adresse -->
- <div id="po-header-addressBar" class="${pageLogo}Address">
+ <div id="po-header-addressBar" class="<s:property value='%{pageLogo}'/>Address">
<%--<t:loop t:source="addressBar.items" t:value="item">--%>
<%-->--%>
<%--<strong>--%>
@@ -267,7 +270,7 @@
</div>
<!-- Contenu -->
- <div id="${pageBodyId}" class="content">
+ <div id="<s:property value='%{pageBobyId}'/>" class="content">
<noscript>
<%--<div t:type="nuiton/feedback" t:id="errorJs" />--%>
</noscript>
@@ -306,7 +309,7 @@
</div>
<!-- Pied de page -->
-<div id="po-footer" class="${pageLogo}" xml:space="preserve">
+<div id="po-footer" class="<s:property value='%{pageLogo}'/>" xml:space="preserve">
<a href="http://maven-site.chorem.org/pollen">Pollen</a>
<a href="http://www.chorem.org/projects/pollen/files">
<%=PollenActionSupport.getApplicationVersion()%>
Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/admin/pollsList.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/admin/pollsList.jsp 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/admin/pollsList.jsp 2012-06-19 08:18:29 UTC (rev 3519)
@@ -26,11 +26,13 @@
<script type="text/javascript">
var redirectUrl = '<s:url namespace="/admin" action="pollsList"/>';
</script>
-<%@include file="/WEB-INF/jsp/pollListHelper.jsp"%>
+<%@include file="/WEB-INF/jsp/pollListHelper.jsp" %>
<title><s:text name="pollen.title.pollsList"/></title>
-<h1 class="title${pageLogo}"><s:text name="pollen.title.pollsList"/></h1>
+<h1 class="title<s:property value='%{pageLogo}'/>">
+ <s:text name="pollen.title.pollsList"/>
+</h1>
<s:url id="loadUrl" action="getPolls" namespace="/json" escapeAmp="false"/>
@@ -45,10 +47,13 @@
rowList="10,15,20,50,100" rowNum="10">
<sjg:gridColumn name="id" title="id" hidden="true"/>
- <sjg:gridColumn name="title" title='%{getText("pollen.common.title")}' />
- <sjg:gridColumn name="description" title='%{getText("pollen.common.description")}'/>
- <sjg:gridColumn name="addingChoices" title='%{getText("pollen.common.addingChoices")}'/>
- <sjg:gridColumn name="beginDate" title='%{getText("pollen.common.beginDate")}'/>
+ <sjg:gridColumn name="title" title='%{getText("pollen.common.title")}'/>
+ <sjg:gridColumn name="description"
+ title='%{getText("pollen.common.description")}'/>
+ <sjg:gridColumn name="addingChoices"
+ title='%{getText("pollen.common.addingChoices")}'/>
+ <sjg:gridColumn name="beginDate"
+ title='%{getText("pollen.common.beginDate")}'/>
<sjg:gridColumn name="endDate" title='%{getText("pollen.common.endDate")}'/>
<sjg:gridColumn name="functions" title='%{getText("pollen.common.functions")}'
formatter="pollFunctions" width="55" sortable="false"/>
Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/admin/usersList.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/admin/usersList.jsp 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/admin/usersList.jsp 2012-06-19 08:18:29 UTC (rev 3519)
@@ -32,7 +32,9 @@
<title><s:text name="pollen.title.usersList"/></title>
-<h1 class="title${pageLogo}"><s:text name="pollen.title.usersList"/></h1>
+<h1 class="title<s:property value='%{pageLogo}'/>">
+ <s:text name="pollen.title.usersList"/>
+</h1>
<s:url id="loadUsers" action="getUsers" namespace="/json" escapeAmp="false"/>
@@ -49,7 +51,8 @@
var deleteImg = '<s:url value='/img/delete.png'/>';
jQuery(document).ready(function () {
- initUsersPage('${action}', '${user.topiaId}');
+ initUsersPage("<s:property value='%{action}'/>",
+ "<s:property value='%{user.topiaId}'/>");
});
</script>
Deleted: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/adminRequired.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/adminRequired.jsp 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/adminRequired.jsp 2012-06-19 08:18:29 UTC (rev 3519)
@@ -1,31 +0,0 @@
-<%--
- #%L
- Pollen :: UI (struts2)
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2009 - 2012 CodeLutin, Tony Chemit
- %%
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- #L%
- --%>
-
-<%@ page language="java" contentType="text/html" pageEncoding="utf-8" %>
-<%@ taglib prefix="s" uri="/struts-tags" %>
-
-<br/>
-
-<div>
- La page demandé n'est accessible que par un administrateur.
-</div>
Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/home.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/home.jsp 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/home.jsp 2012-06-19 08:18:29 UTC (rev 3519)
@@ -27,13 +27,16 @@
<br/>
<div class="center" style="margin-bottom:20px;">
- <img src="<s:url value='/img/pollen_%{safeLanguage}.png' />" alt="Pollen logo"/>
+ <img src="<s:url value='/img/pollen_%{safeLanguage}.png' />"
+ alt="Pollen logo"/>
</div>
<div class="center">
<s:a action="create" namespace="/poll">
- <img src="<s:url value='/img/smallCreation_%{safeLanguage}.png' />" alt="poll creation"/>
+ <img src="<s:url value='/img/smallCreation_%{safeLanguage}.png' />"
+ alt="poll creation"/>
</s:a>
<img src="<s:url value='/img/smallVote_%{safeLanguage}.png' />" alt="vote"/>
- <img src="<s:url value='/img/smallVoteCounting_%{safeLanguage}.png' />" alt="voteCounting"/>
+ <img src="<s:url value='/img/smallVoteCounting_%{safeLanguage}.png' />"
+ alt="voteCounting"/>
</div>
Deleted: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/create.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/create.jsp 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/create.jsp 2012-06-19 08:18:29 UTC (rev 3519)
@@ -1,353 +0,0 @@
-<%--
- #%L
- Pollen :: UI (struts2)
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2009 - 2012 CodeLutin, Tony Chemit
- %%
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- #L%
- --%>
-<%@ page language="java" contentType="text/html" pageEncoding="utf-8" %>
-<%@ taglib prefix="s" uri="/struts-tags" %>
-<%@ taglib prefix="sj" uri="/struts-jquery-tags" %>
-
-<link rel="stylesheet" type="text/css"
- href="<s:url value='/css/pollCreation.css'/>"/>
-<link rel="stylesheet" type="text/css" href="<s:url value='/css/tipTip.css'/>"/>
-
-<script type="text/javascript">
-
- $(document).data(
- {
- selectPersonListToAddToVotingListTitle:'<s:text name="pollen.title.selectPersonListToAddVotingList"/>',
- selectPersonListToCreateNewVotingListTitle:'<s:text name="pollen.title.selectPersonListToCreateVotingList"/>',
-
- votingListText:'<s:text name="pollen.common.votingList"/>',
- personToListText:'<s:text name="pollen.common.personToList"/>',
- choiceText:'<s:text name="pollen.common.choice"/>',
-
- displayVotingListUrl:'<s:url namespace="/poll" action="displayVotingList"/>',
- displayPersonToListUrl:'<s:url namespace="/poll" action="displayPersonToList"/>',
- importPersonListToVotingListUrl:'<s:url namespace="/poll" action="importPersonListToVotingList"/>',
- importPersonListToNewVotingListUrl:'<s:url namespace="/poll" action="importPersonListToNewVotingList"/>',
- displayImageChoiceUrl:'<s:url namespace="/poll" action="displayImageChoice"/>',
- displayDateChoiceUrl:'<s:url namespace="/poll" action="displayDateChoice"/>',
- displayTextChoiceUrl:'<s:url namespace="/poll" action="displayTextChoice"/>',
- selectPersonListToAddToVotingListUrl:'<s:url action="selectPersonListToAddToVotingList" namespace="/poll"/>',
- selectPersonListToCreateNewVotingListUrl:'<s:url action="selectPersonListToCreateNewVotingList" namespace="/poll"/>',
-
- choiceAddAllowed:'<s:property value="%{poll.choiceAddAllowed}"/>',
- limitChoice:'<s:property value="%{limitChoice}"/>',
- reminder:'<s:property value="%{reminder}"/>',
- publicOption:'<s:property value="%{poll.publicResults}"/>',
- anonymousOption:'<s:property value="%{poll.anonymous}"/>',
- voteCountingType:'<s:property value="%{poll.voteCountingType.name()}"/>',
- choiceType:'<s:property value="%{poll.choiceType.name()}"/>',
- pollType:'<s:property value="%{poll.pollType.name()}"/>',
- confirmCloseTitle:"<s:text name='pollen.title.close.poll'/>",
- confirmCloseUrl:'<s:url action="confirmClosePoll/%{poll.adminId}" namespace="/poll"/>',
- confirmCloseRedirectUrl:'<s:url action="summary/%{poll.adminId}" namespace="/poll"/>'
- }
- );
-</script>
-
-<script type="text/javascript"
- src='<s:url value="/js/createPoll.js"/>'></script>
-<script type="text/javascript"
- src='<s:url value="/js/jquery.tipTip.minified.js"/>'></script>
-
-<s:url id='errorImg' value='/img/exclamation.png'/>
-
-<title>
- <s:if test="edit">
- <s:text name="pollen.title.editPoll"/>
- </s:if>
- <s:else>
- <s:text name="pollen.title.createPoll"/>
- </s:else>
-</title>
-
-<h1 class="title${pageLogo}"><s:property value="%{pageTitle}"/></h1>
-
-<s:form method="POST" id="registerForm" namespace="/poll"
- enctype="multipart/form-data">
-
- <s:hidden key="poll.topiaId" label=""/>
-
- <sj:tabbedpanel id="formTabs" selectedTab="%{selectedTab}">
-
- <sj:tab id="tabGeneral" target="tgeneral" key="pollen.tab.poll.general"/>
- <sj:tab id="tabOptions" target="toptions" key="pollen.tab.poll.options"/>
-
- <div id="tgeneral">
-
- <fieldset>
-
- <s:textfield key="poll.title" label="%{getText('pollen.common.title')}"
- required="true" size="80"/>
- <s:textarea key="poll.description" rows="3" cols="54"
- label="%{getText('pollen.common.description')}"/>
- <s:hidden key="poll.pollId" label=""/>
- </fieldset>
-
- <br/>
-
- <fieldset class="disableForVoteStarted">
- <legend>
- <s:text name="pollen.common.voteCountingType"/>
- <img src="<s:url value='/img/tooltip.png'/>" class="tooltip"
- alt="<s:text name='pollen.common.voteCountingType.help'/>"
- title="<s:text name='pollen.common.voteCountingType.help'/>"/>
- </legend>
- <s:radio key='poll.voteCountingType' list="voteCountingTypes"
- label='' theme="simple"/>
- </fieldset>
- <br/>
-
- <%@include file="createPoll_choices.jsp" %>
-
- </div>
-
- <div id="toptions">
-
- <fieldset>
- <legend>
- <s:text name="pollen.fieldset.creator.options"/>
- <img src="<s:url value='/img/tooltip.png'/>" class="tooltip"
- title="<s:text name='pollen.fieldset.creator.options.help'/>"
- alt="<s:text name='pollen.fieldset.creator.options.help'/>"/>
- </legend>
- <s:textfield key="poll.creator.votingId" size="80"
- label="%{getText('pollen.common.login')}"/>
- <s:textfield key="poll.creator.email" size="80"
- label="%{getText('pollen.common.email')}"/>
- <s:hidden key="poll.creator.accountId" label=""/>
- <s:hidden key="poll.creator.topiaId" label=""/>
- <s:if test="creatorUserAccountDefined">
- <s:hidden name="userId" value="%{poll.creator.userAccount.topiaId}"/>
- </s:if>
- </fieldset>
- <br/>
-
- <fieldset>
- <legend>
- <s:text name="pollen.fieldset.pollDate.options"/>
- <img src="<s:url value='/img/tooltip.png'/>" class="tooltip"
- title="<s:text name='pollen.fieldset.pollDate.options.help'/>"
- alt="<s:text name='pollen.fieldset.pollDate.options.help'/>"/>
- </legend>
-
- <sj:datepicker key="poll.beginDate" cssClass="disableForVoteStarted"
- displayFormat="%{getText('pollen.common.datePickerPattern')}"
- label="%{getText('pollen.common.beginDate')}"
- timepicker="true"/>
- <sj:datepicker key="poll.endDate"
- displayFormat="%{getText('pollen.common.datePickerPattern')}"
- timepicker="true"
- label="%{getText('pollen.common.endDate')}"/>
- </fieldset>
- <br/>
-
- <fieldset class="disableForVoteStarted">
- <legend>
- <s:text name="pollen.fieldset.choice.options"/>
- <img src="<s:url value='/img/tooltip.png'/>" class="tooltip"
- title="<s:text name='pollen.fieldset.choice.options.help'/>"
- alt="<s:text name='pollen.fieldset.choice.options.help'/>"/>
- </legend>
- <s:checkbox key="poll.choiceAddAllowed"
- label="%{getText('pollen.common.pollOption.choiceAddAllowed')}"
- disabled="%{voteStarted}"
- tooltip="%{getText('pollen.common.pollOption.choiceAddAllowed.help')}"
- tooltipIconPath="/img/tooltip.png"/>
- <sj:datepicker key="poll.beginChoiceDate"
- label="%{getText('pollen.common.beginChoiceDate')}"
- displayFormat="%{getText('pollen.common.datePickerPattern')}"
- timepicker="true"
- disabled="%{voteStarted}"/>
- <sj:datepicker key="poll.endChoiceDate"
- label="%{getText('pollen.common.endChoiceDate')}"
- displayFormat="%{getText('pollen.common.datePickerPattern')}"
- timepicker="true"
- disabled="%{voteStarted}"/>
- <s:checkbox key="limitChoice"
- label="%{getText('pollen.common.pollOption.limitChoice')}"
- disabled="%{voteStarted}"
- tooltip="%{getText('pollen.common.pollOption.limitChoice.help')}"
- tooltipIconPath="/img/tooltip.png"/>
- <s:textfield key="maxChoices"
- label="%{getText('pollen.common.pollOption.maxChoiceNb')}"
- disabled="%{voteStarted}"/>
- </fieldset>
- <br/>
-
- <fieldset class="disableForVoteStarted">
- <legend>
- <s:text name="pollen.fieldset.vote.options"/>
- <img src="<s:url value='/img/tooltip.png'/>" class="tooltip"
- title="<s:text name='pollen.fieldset.vote.options.help'/>"
- alt="<s:text name='pollen.fieldset.vote.options.help'/>"/>
- </legend>
-
- <s:checkbox key="poll.anonymous"
- label="%{getText('pollen.common.pollOption.anonymous')}"
- disabled="%{voteStarted}"
- tooltip="%{getText('pollen.common.pollOption.anonymous.help')}"
- tooltipIconPath="/img/tooltip.png"/>
- <s:checkbox key="poll.anonymousVoteAllowed"
- label="%{getText('pollen.common.pollOption.anonymousVoteAllowed')}"
- disabled="%{voteStarted}"
- tooltip="%{getText('pollen.common.pollOption.anonymousVoteAllowed.help')}"
- tooltipIconPath="/img/tooltip.png"/>
- </fieldset>
- <br/>
- <fieldset>
- <legend>
- <s:text name="pollen.fieldset.result.options"/>
- <img src="<s:url value='/img/tooltip.png'/>" class="tooltip"
- title="<s:text name='pollen.fieldset.result.options.help'/>"
- alt="<s:text name='pollen.fieldset.result.options.help'/>"/>
- </legend>
-
- <s:checkbox key="poll.publicResults"
- label="%{getText('pollen.common.pollOption.publicResults')}"
- tooltip="%{getText('pollen.common.pollOption.publicResults.help')}"
- tooltipIconPath="/img/tooltip.png"/>
- <s:checkbox key="poll.continuousResults"
- label="%{getText('pollen.common.pollOption.continuousResults')}"
- tooltip="%{getText('pollen.common.pollOption.continuousResults.help')}"
- tooltipIconPath="/img/tooltip.png"/>
- </fieldset>
- <br/>
-
- <fieldset>
- <legend>
- <s:text name="pollen.fieldset.notification.options"/>
- <img src="<s:url value='/img/tooltip.png'/>" class="tooltip"
- title="<s:text name='pollen.fieldset.notification.options.help'/>"
- alt="<s:text name='pollen.fieldset.notification.options.help'/>"/>
- </legend>
- <s:checkbox key="notification"
- label="%{getText('pollen.common.pollOption.notification')}"
- tooltip="%{getText('pollen.common.pollOption.notification.help')}"
- tooltipIconPath="/img/tooltip.png"/>
- <s:checkbox key="reminder"
- label="%{getText('pollen.common.pollOption.reminder')}"
- tooltip="%{getText('pollen.common.pollOption.reminder.help')}"
- tooltipIconPath="/img/tooltip.png"/>
- <s:textfield key="reminderHourCountdown"
- label="%{getText('pollen.common.pollOption.reminderHourCountdown')}"/>
- </fieldset>
- <br/>
-
- <fieldset class="disableForVoteStarted">
- <legend>
- <s:text name="pollen.common.pollType"/>
- <img src="<s:url value='/img/tooltip.png'/>" class="tooltip"
- title="<s:text name='pollen.common.pollType.help'/>"
- alt="<s:text name='pollen.common.pollType.help'/>"/>
- </legend>
- <s:radio key='poll.pollType' list="pollTypes"
- label='%{getText("pollen.common.pollType")}'/>
- <hr/>
-
- <div id="pollTypeFREE" class="pollType">
- <%--Nothing to show for a free poll--%>
- </div>
-
- <div id="pollTypeRESTRICTED" class="pollType">
- <s:iterator value="restrictedVotingList" status="status"
- var="votingList">
- <s:set name="votingListNumber"><s:property
- value="%{#status.index}"/></s:set>
- <s:set name="votingListType">RESTRICTED</s:set>
- <%@include file="displayVotingList.jsp" %>
- </s:iterator>
- </div>
-
- <div id="pollTypeGROUP" class="pollType">
- <div id="votingListGROUP">
- <s:iterator value="groupVotingList" status="status"
- var="votingList">
- <s:set name="votingListNumber"><s:property
- value="%{#status.index}"/></s:set>
- <s:set name="votingListType">GROUP</s:set>
- <%@include file="displayVotingList.jsp" %>
- </s:iterator>
- </div>
- <div align="center">
- <s:submit key="pollen.action.addVotingList" theme="simple"
- onclick="return addNewVotingList();"/>
- <s:if test="userLoggued">
- <s:submit key="pollen.action.addVotingListFromPersonList"
- onclick='return selectPersonListToCreateNewVotingList();'
- theme="simple"/>
- </s:if>
- </div>
- </div>
- </fieldset>
- </div>
-
- </sj:tabbedpanel>
-
- <br/>
- <s:if test="edit">
- <s:submit action="edit/%{uriId}" value="%{actionLabel}" align="center"/>
- <div align="center" style="margin-top: 10px">
- <button onclick="return confirmClose();">
- <s:text name="pollen.action.close"/>
- </button>
- </div>
- </s:if>
- <s:elseif test="clone">
- <s:submit action="clone/%{uriId}" value="%{actionLabel}" align="center"/>
- </s:elseif>
- <s:else>
- <s:submit action="create" value="%{actionLabel}" align="center"/>
- </s:else>
-</s:form>
-
-<script type="text/javascript">
-
- jQuery(document).ready(function () {
-
- function addErrorImage(element) {
- element.append(
- '<image src="${errorImg}">'
- );
- element.attr('title', '<s:text name="pollen.error.pollTabErrorFound"/>');
- }
-
- if (<s:property value="%{informationsError}"/>) {
- addErrorImage($('#tabGeneral a'));
- }
- if (<s:property value="%{optionsError}"/>) {
- addErrorImage($('#tabOptions a'));
- }
-
- if (<s:property value="%{poll.closed}"/>) {
- disablePoll();
- }
- if (<s:property value="%{voteStarted}"/>) {
- disableWhenVoteStarted();
- }
- });
-</script>
-
-<sj:dialog id="selectPersonListDialog" resizable="true" autoOpen="false"
- modal="true" width="500"/>
-
-<sj:dialog id="confirmDialog" autoOpen="false" modal="true" width="500"/>
Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/createPoll_choices.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/createPoll_choices.jsp 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/createPoll_choices.jsp 2012-06-19 08:18:29 UTC (rev 3519)
@@ -25,211 +25,216 @@
<%@ taglib prefix="sp" uri="/nuiton-tags" %>
<%@ taglib prefix="sj" uri="/struts-jquery-tags" %>
<fieldset class="disableForVoteStarted">
- <legend><s:text name="pollen.fieldset.poll.choices"/></legend>
- <s:radio key='poll.choiceType' list="choiceTypes" label='' theme="simple"/>
- <hr/>
- <s:fielderror fieldName="poll.choices" id="poll_choices_error"/>
+<legend><s:text name="pollen.fieldset.poll.choices"/></legend>
+<s:radio key='poll.choiceType' list="choiceTypes" label='' theme="simple"/>
+<hr/>
+<s:fielderror fieldName="poll.choices" id="poll_choices_error"/>
- <s:set id='deleteTitle'><s:text
- name="pollen.action.pollChoiceDelete"/></s:set>
- <s:set id='upTitle'><s:text name="pollen.action.pollChoiceUp"/></s:set>
- <s:set id='downTitle'><s:text name="pollen.action.pollChoiceDown"/></s:set>
+<s:set id='deleteTitle'><s:text
+ name="pollen.action.pollChoiceDelete"/></s:set>
+<s:set id='upTitle'><s:text name="pollen.action.pollChoiceUp"/></s:set>
+<s:set id='downTitle'><s:text name="pollen.action.pollChoiceDown"/></s:set>
- <div id="choicesTEXT" class="choices">
- <s:iterator value="textChoices" status="status" var="choice">
- <s:set name="choiceNumber"><s:property value="%{#status.index}"/></s:set>
- <s:set name="prefix">textChoice_<s:property
- value="%{#choiceNumber}"/></s:set>
- <div id='choicesTEXT_<s:property value="choiceNumber"/>'>
- <s:hidden key='%{#prefix}.topiaId' value='%{#choice.topiaId}' label=''/>
- <sp:fielderror fieldName="%{#prefix}" id="%{#prefix}_error"/>
- <div class="fleft choiceName">
- <sp:fielderror fieldName="%{#prefix}.name"
- id="%{#prefix}.name_error"/>
- <s:label for="%{#prefix}.name" id="choicesTEXT_label_%{#choiceNumber}"
- theme="simple" value=''/>
- <s:textfield cssClass="nameField" id='%{#prefix}.name' theme="simple"
- key="%{#prefix}.name" label='' value="%{#choice.name}"/>
- -
- <s:label for="%{#prefix}.description" key="pollen.common.description"
- theme="simple"/>
- <%--/div>
- <div class="fleft"--%>
- <s:textarea cols="30" id="%{#prefix}.description" label=''
- theme="simple" key="%{#prefix}.description"
- value="%{#choice.description}"/>
+<div id="choicesTEXT" class="choices">
+ <s:iterator value="textChoices" status="status" var="choice">
+ <s:set name="choiceNumber"><s:property value="%{#status.index}"/></s:set>
+ <s:set name="prefix">textChoice_<s:property
+ value="%{#choiceNumber}"/></s:set>
+ <div id='choicesTEXT_<s:property value="choiceNumber"/>' class="ui-state-default">
+ <%--<div id='choicesTEXT_<s:property value="choiceNumber"/>'>--%>
+ <s:hidden key='%{#prefix}.topiaId' value='%{#choice.topiaId}' label=''/>
+ <s:hidden key='%{#prefix}.order' value='%{#choiceNumber}' label=''/>
+ <sp:fielderror fieldName="%{#prefix}" id="%{#prefix}_error"/>
+ <div class="fleft choiceName">
+ <sp:fielderror fieldName="%{#prefix}.name" id="%{#prefix}.name_error"/>
+ <span class="choicesImage ui-icon ui-icon-arrowthick-2-n-s"></span>
+ <s:label for="%{#prefix}.name" id="choicesTEXT_label_%{#choiceNumber}"
+ theme="simple" value=''/>
+ <s:textfield cssClass="nameField" id='%{#prefix}.name' theme="simple"
+ key="%{#prefix}.name" label='' value="%{#choice.name}"/>
+ -
+ <s:label for="%{#prefix}.description" key="pollen.common.description"
+ theme="simple"/>
+ <%--/div>
+ <div class="fleft"--%>
+ <s:textarea cols="30" id="%{#prefix}.description" label=''
+ theme="simple" key="%{#prefix}.description"
+ value="%{#choice.description}"/>
+ </div>
+ <s:if test="!voteStarted">
+ <div class="fright">
+ <%--s:a id='choicesTEXT_down_%{choiceNumber}'
+ cssClass="hidden" href='#'
+ onclick="return downChoice('choicesTEXT_%{choiceNumber}')">
+ <image alt='<s:property value="downTitle"/>'
+ title='<s:property value="downTitle"/>'
+ src="<s:url value='/img/1downarrow.png'/>"></image>
+ </s:a>
+ <s:a id='choicesTEXT_up_%{choiceNumber}' href='#' cssClass="hidden"
+ onclick="return upChoice('choicesTEXT_%{choiceNumber}')">
+ <image alt='<s:property value="upTitle"/>'
+ title='<s:property value="upTitle"/>'
+ src="<s:url value='/img/1uparrow.png'/>"></image>
+ </s:a--%>
+ <s:a href='#'
+ onclick="return deleteChoice('choicesTEXT_%{choiceNumber}')">
+ <image alt='<s:property value="deleteTitle"/>'
+ title='<s:property value="deleteTitle"/>'
+ src="<s:url value='/img/delete.png'/>"></image>
+ </s:a>
</div>
- <s:if test="!voteStarted">
- <div class="fright">
- <s:a id='choicesTEXT_down_%{choiceNumber}'
- cssClass="hidden" href='#'
- onclick="return downChoice('choicesTEXT_%{choiceNumber}')">
- <image alt='<s:property value="downTitle"/>'
- title='<s:property value="downTitle"/>'
- src="<s:url value='/img/1downarrow.png'/>"></image>
- </s:a>
- <s:a id='choicesTEXT_up_%{choiceNumber}' href='#' cssClass="hidden"
- onclick="return upChoice('choicesTEXT_%{choiceNumber}')">
- <image alt='<s:property value="upTitle"/>'
- title='<s:property value="upTitle"/>'
- src="<s:url value='/img/1uparrow.png'/>"></image>
- </s:a>
- <s:a href='#'
- onclick="return deleteChoice('choicesTEXT_%{choiceNumber}')">
- <image alt='<s:property value="deleteTitle"/>'
- title='<s:property value="deleteTitle"/>'
- src="<s:url value='/img/delete.png'/>"></image>
- </s:a>
- </div>
- </s:if>
- <div class="cleanBoth"></div>
+ </s:if>
+ <div class="cleanBoth"></div>
+ </div>
+ </s:iterator>
+</div>
+<div id="choicesDATE" class="choices">
+ <s:iterator value="dateChoices" status="status" var="choice">
+ <s:set name="choiceNumber"><s:property value="%{#status.index}"/></s:set>
+ <s:set name="prefix">dateChoice_<s:property
+ value="%{#choiceNumber}"/></s:set>
+ <div id='choicesDATE_<s:property value="choiceNumber"/>'
+ class="ui-state-default">
+ <s:hidden key='%{#prefix}.topiaId' id='%{#prefix}.topiaId'
+ theme="simple" value='%{#choice.topiaId}' label=''/>
+ <s:hidden key='%{#prefix}.order' value='%{#choiceNumber}' label=''/>
+ <sp:fielderror fieldName="%{#prefix}" id="%{#prefix}_error"/>
+ <div class="fleft choiceName">
+ <sp:fielderror fieldName="%{#prefix}.name" id="%{#prefix}.name_error"/>
+ <span class="choicesImage ui-icon ui-icon-arrowthick-2-n-s"> </span>
+ <s:label for="%{#prefix}.name" id="choicesDATE_label_%{choiceNumber}"
+ theme="simple" value=''/>
+ <sj:datepicker id='%{#prefix}.name' key="%{#prefix}.name" label=""
+ changeMonth="true" changeYear="true" labelSeparator=""
+ theme="simple" timepicker="true"
+ value="%{#choice.name}"
+ displayFormat="%{getText('pollen.common.datePickerPattern')}"/>
+ -
+ <s:label for="%{#prefix}.description" key="pollen.common.description"
+ theme="simple"/>
</div>
- </s:iterator>
- </div>
- <div id="choicesDATE" class="choices">
- <s:iterator value="dateChoices" status="status" var="choice">
- <s:set name="choiceNumber"><s:property value="%{#status.index}"/></s:set>
- <s:set name="prefix">dateChoice_<s:property
- value="%{#choiceNumber}"/></s:set>
- <div id='choicesDATE_<s:property value="choiceNumber"/>'>
- <s:hidden key='%{#prefix}.topiaId' id='%{#prefix}.topiaId'
- theme="simple"
- value='%{#choice.topiaId}' label=''/>
- <sp:fielderror fieldName="%{#prefix}" id="%{#prefix}_error"/>
- <div class="fleft choiceName">
- <sp:fielderror fieldName="%{#prefix}.name"
- id="%{#prefix}.name_error"/>
- <s:label for="%{#prefix}.name" id="choicesDATE_label_%{choiceNumber}"
- theme="simple" value=''/>
- <sj:datepicker id='%{#prefix}.name' key="%{#prefix}.name" label=""
- changeMonth="true" changeYear="true" labelSeparator=""
- theme="simple" timepicker="true"
- value="%{#choice.name}"
- displayFormat="%{getText('pollen.common.datePickerPattern')}"/>
- -
- <s:label for="%{#prefix}.description" key="pollen.common.description"
- theme="simple"/>
+ <div class="fleft">
+ <s:textarea cols="30" id="%{#prefix}.description" theme="simple"
+ key="%{#prefix}.description" label=''
+ value="%{#choice.description}"/>
+ </div>
+ <s:if test="!voteStarted">
+ <div class="fright">
+ <%--s:a id='choicesDATE_down_%{choiceNumber}' cssClass="hidden"
+ href='#'
+ onclick="return downChoice('choicesDATE_%{choiceNumber}')">
+ <image alt='<s:property value="downTitle"/>'
+ title='<s:property value="downTitle"/>'
+ src="<s:url value='/img/1downarrow.png'/>"></image>
+ </s:a>
+ <s:a id='choicesDATE_up_%{choiceNumber}' href='#' cssClass="hidden"
+ onclick="return upChoice('choicesDATE_%{choiceNumber}')">
+ <image alt='<s:property value="upTitle"/>'
+ title='<s:property value="upTitle"/>'
+ src="<s:url value='/img/1uparrow.png'/>"></image>
+ </s:a--%>
+ <s:a href='#'
+ onclick="return deleteChoice('choicesDATE_%{choiceNumber}')">
+ <image alt='<s:property value="deleteTitle"/>'
+ title='<s:property value="deleteTitle"/>'
+ src="<s:url value='/img/delete.png'/>"></image>
+ </s:a>
</div>
- <div class="fleft">
- <s:textarea cols="30" id="%{#prefix}.description" theme="simple"
- key="%{#prefix}.description" label=''
- value="%{#choice.description}"/>
- </div>
- <s:if test="!voteStarted">
- <div class="fright">
- <s:a id='choicesDATE_down_%{choiceNumber}' cssClass="hidden"
- href='#'
- onclick="return downChoice('choicesDATE_%{choiceNumber}')">
- <image alt='<s:property value="downTitle"/>'
- title='<s:property value="downTitle"/>'
- src="<s:url value='/img/1downarrow.png'/>"></image>
- </s:a>
- <s:a id='choicesDATE_up_%{choiceNumber}' href='#' cssClass="hidden"
- onclick="return upChoice('choicesDATE_%{choiceNumber}')">
- <image alt='<s:property value="upTitle"/>'
- title='<s:property value="upTitle"/>'
- src="<s:url value='/img/1uparrow.png'/>"></image>
- </s:a>
- <s:a href='#'
- onclick="return deleteChoice('choicesDATE_%{choiceNumber}')">
- <image alt='<s:property value="deleteTitle"/>'
- title='<s:property value="deleteTitle"/>'
- src="<s:url value='/img/delete.png'/>"></image>
- </s:a>
- </div>
- </s:if>
- <div class="cleanBoth"></div>
- </div>
- </s:iterator>
- </div>
- <div id="choicesIMAGE" class="choices">
- <s:iterator value="imageChoices" status="status" var="choice">
- <s:set name="choiceNumber"><s:property value="%{#status.index}"/></s:set>
- <s:set name="prefix">imageChoice_<s:property
- value="%{#choiceNumber}"/></s:set>
- <div id='choicesIMAGE_<s:property value="choiceNumber"/>'>
- <s:hidden key='%{#prefix}.topiaId' value='%{#choice.topiaId}' label=''/>
- <sp:fielderror fieldName="%{#prefix}" id="%{#prefix}_error"/>
- <div class="fleft choiceName">
- <sp:fielderror fieldName="%{#prefix}.name"
- id="%{#prefix}.name_error"/>
- <s:label for="%{#prefix}.name" id="choicesIMAGE_label_%{choiceNumber}"
- theme="simple" value=''/>
- <s:if test="#choice.name != null">
+ </s:if>
+ <div class="cleanBoth"></div>
+ </div>
+ </s:iterator>
+</div>
+<div id="choicesIMAGE" class="choices">
+ <s:iterator value="imageChoices" status="status" var="choice">
+ <s:set name="choiceNumber"><s:property value="%{#status.index}"/></s:set>
+ <s:set name="prefix">imageChoice_<s:property
+ value="%{#choiceNumber}"/></s:set>
+ <div id='choicesIMAGE_<s:property value="choiceNumber"/>'
+ class="ui-state-default">
+ <s:hidden key='%{#prefix}.order' value='%{#choiceNumber}' label=''/>
+ <s:hidden key='%{#prefix}.topiaId' value='%{#choice.topiaId}' label=''/>
+ <sp:fielderror fieldName="%{#prefix}" id="%{#prefix}_error"/>
+ <div class="fleft choiceName">
+ <sp:fielderror fieldName="%{#prefix}.name" id="%{#prefix}.name_error"/>
+ <span class="choicesImage ui-icon ui-icon-arrowthick-2-n-s"></span>
+ <s:label for="%{#prefix}.name" id="choicesIMAGE_label_%{choiceNumber}"
+ theme="simple" value=''/>
+ <s:if test="#choice.name != null">
- <%--Uploaded image--%>
- <s:hidden id="%{#prefix}.name" name="%{#prefix}.name"
- value="%{#choice.name}" label='' theme="simple"/>
+ <%--Uploaded image--%>
+ <s:hidden id="%{#prefix}.name" name="%{#prefix}.name"
+ value="%{#choice.name}" label='' theme="simple"/>
- <s:hidden id="%{#prefix}.location" name="%{#prefix}.location"
- value="%{#choice.location}" label='' theme="simple"/>
- <s:url id="imageUrl" namespace="/io" action="getPollChoiceImage"
- escapeAmp="true">
- <s:param name="choiceTokenId">
- imagechoicesThumb_<s:property value='name'/>
- </s:param>
- </s:url>
- <img name="<s:property value="#prefix"/>.thumb"
- alt="<s:property value='name'/>"
- title="<s:property value='name'/>"
- src="<s:property value='imageUrl'/>">
+ <s:hidden id="%{#prefix}.location" name="%{#prefix}.location"
+ value="%{#choice.location}" label='' theme="simple"/>
+ <s:url id="imageUrl" namespace="/io" action="getPollChoiceImage"
+ escapeAmp="true">
+ <s:param name="choiceTokenId">
+ imagechoicesThumb_<s:property value='name'/>
+ </s:param>
+ </s:url>
+ <img name="<s:property value="#prefix"/>.thumb"
+ alt="<s:property value='name'/>"
+ title="<s:property value='name'/>"
+ src="<s:property value='imageUrl'/>">
- <s:file key='imageChoice[%{#choiceNumber}]' label='' theme="simple"
- cssClass="nameField fleft" cssStyle="margin-left:50px;"/>
- </s:if>
- <s:else>
- <%--New image--%>
- <s:url id="imageUrl" namespace="/io" action="getPollChoiceImage"
- escapeAmp="false" value="/img/7ter.jpg"/>
- <img name="<s:property value="#prefix"/>.thumb"
- alt="<s:text name='pollen.image.not.loaded'/>"
- title="<s:text name='pollen.image.not.loaded'/>"
- src="<s:property value='imageUrl'/>" width="100px"
- height="75px">
- <s:file key='imageChoice[%{#choiceNumber}]' label='' theme="simple"
- cssClass="nameField fleft"
- cssStyle="margin-left:50px;"/>
+ <s:file key='imageChoice[%{#choiceNumber}]' label='' theme="simple"
+ cssClass="nameField fleft" cssStyle="margin-left:50px;"/>
+ </s:if>
+ <s:else>
+ <%--New image--%>
+ <s:url id="imageUrl" namespace="/io" action="getPollChoiceImage"
+ escapeAmp="false" value="/img/7ter.jpg"/>
+ <img name="<s:property value="#prefix"/>.thumb"
+ alt="<s:text name='pollen.image.not.loaded'/>"
+ title="<s:text name='pollen.image.not.loaded'/>"
+ src="<s:property value='imageUrl'/>" width="100px"
+ height="75px">
+ <s:file key='imageChoice[%{#choiceNumber}]' label='' theme="simple"
+ cssClass="nameField fleft"
+ cssStyle="margin-left:50px;"/>
- </s:else>
+ </s:else>
+ </div>
+ <div class="fleft">
+ -
+ <s:label for="%{#prefix}.description" key="pollen.common.description"
+ theme="simple"/>
+ <s:textarea cols="30" id="%{#prefix}.description" label=''
+ theme="simple" key="%{#prefix}.description"
+ value="%{#choice.description}"/>
+ </div>
+ <s:if test="!voteStarted">
+ <div class="fright">
+ <%--s:a id='choicesIMAGE_down_%{choiceNumber}' cssClass="hidden"
+ href='#'
+ onclick="return downChoice('choicesIMAGE_%{choiceNumber}')">
+ <image alt='<s:property value="downTitle"/>'
+ title='<s:property value="downTitle"/>'
+ src="<s:url value='/img/1downarrow.png'/>"></image>
+ </s:a>
+ <s:a id='choicesIMAGE_up_%{choiceNumber}' href='#' cssClass="hidden"
+ onclick="return upChoice('choicesIMAGE_%{choiceNumber}')">
+ <image alt='<s:property value="upTitle"/>'
+ title='<s:property value="upTitle"/>'
+ src="<s:url value='/img/1uparrow.png'/>"></image>
+ </s:a--%>
+ <s:a href='#'
+ onclick="return deleteChoice('choicesIMAGE_%{choiceNumber}')">
+ <image alt='<s:property value="deleteTitle"/>'
+ title='<s:property value="deleteTitle"/>'
+ src="<s:url value='/img/delete.png'/>"></image>
+ </s:a>
</div>
- <div class="fleft">
- -
- <s:label for="%{#prefix}.description" key="pollen.common.description"
- theme="simple"/>
- <s:textarea cols="30" id="%{#prefix}.description" label=''
- theme="simple" key="%{#prefix}.description"
- value="%{#choice.description}"/>
- </div>
- <s:if test="!voteStarted">
- <div class="fright">
- <s:a id='choicesIMAGE_down_%{choiceNumber}' cssClass="hidden"
- href='#'
- onclick="return downChoice('choicesIMAGE_%{choiceNumber}')">
- <image alt='<s:property value="downTitle"/>'
- title='<s:property value="downTitle"/>'
- src="<s:url value='/img/1downarrow.png'/>"></image>
- </s:a>
- <s:a id='choicesIMAGE_up_%{choiceNumber}' href='#' cssClass="hidden"
- onclick="return upChoice('choicesIMAGE_%{choiceNumber}')">
- <image alt='<s:property value="upTitle"/>'
- title='<s:property value="upTitle"/>'
- src="<s:url value='/img/1uparrow.png'/>"></image>
- </s:a>
- <s:a href='#'
- onclick="return deleteChoice('choicesIMAGE_%{choiceNumber}')">
- <image alt='<s:property value="deleteTitle"/>'
- title='<s:property value="deleteTitle"/>'
- src="<s:url value='/img/delete.png'/>"></image>
- </s:a>
- </div>
- </s:if>
+ </s:if>
- <div class="cleanBoth"></div>
- </div>
- </s:iterator>
- </div>
- <hr/>
- <s:submit key="pollen.action.addChoice" align="center"
- onclick="return addNewChoice();"/>
+ <div class="cleanBoth"></div>
+ </div>
+ </s:iterator>
+</div>
+<hr/>
+<s:submit key="pollen.action.addChoice" align="center"
+ onclick="return addNewChoice();"/>
</fieldset>
Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/displayDateChoice.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/displayDateChoice.jsp 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/displayDateChoice.jsp 2012-06-19 08:18:29 UTC (rev 3519)
@@ -28,9 +28,12 @@
<s:set id='deleteTitle'><s:text name="pollen.action.pollChoiceDelete"/></s:set>
<s:set id='upTitle'><s:text name="pollen.action.pollChoiceUp"/></s:set>
<s:set id='downTitle'><s:text name="pollen.action.pollChoiceDown"/></s:set>
-<div id='choicesDATE_<s:property value="choiceNumber"/>'>
+<div id='choicesDATE_<s:property value="choiceNumber"/>'
+ class="ui-state-default">
<s:hidden key='%{#prefix}.topiaId' value='%{choice.topiaId}' label=''/>
+ <s:hidden key='%{#prefix}.order' value='%{#choiceNumber}' label=''/>
<div class="fleft choiceName">
+ <span class="choicesImage ui-icon ui-icon-arrowthick-2-n-s"></span>
<s:label for="%{#prefix}.name" id="choicesDATE_label_%{choiceNumber}"
theme="simple" value=''/>
<sj:datepicker id='%{#prefix}.name' key="%{#prefix}.name" changeMonth="true"
@@ -47,7 +50,7 @@
value="%{choice.description}"/>
</div>
<div class="fright">
- <s:a id='choicesDATE_down_%{choiceNumber}'
+ <%--s:a id='choicesDATE_down_%{choiceNumber}'
cssClass="hidden" href='#'
onclick="return downChoice('choicesDATE_%{choiceNumber}')">
<image alt='<s:property value="downTitle"/>'
@@ -59,7 +62,7 @@
<image alt='<s:property value="upTitle"/>'
title='<s:property value="upTitle"/>'
src="<s:url value='/img/1uparrow.png'/>"></image>
- </s:a>
+ </s:a--%>
<s:a href='#' onclick="return deleteChoice('choicesDATE_%{choiceNumber}')">
<image alt='<s:property value="deleteTitle"/>'
title='<s:property value="deleteTitle"/>'
Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/displayImageChoice.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/displayImageChoice.jsp 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/displayImageChoice.jsp 2012-06-19 08:18:29 UTC (rev 3519)
@@ -28,40 +28,26 @@
<s:set id='deleteTitle'><s:text name="pollen.action.pollChoiceDelete"/></s:set>
<s:set id='upTitle'><s:text name="pollen.action.pollChoiceUp"/></s:set>
<s:set id='downTitle'><s:text name="pollen.action.pollChoiceDown"/></s:set>
-<div id='choicesIMAGE_<s:property value="choiceNumber"/>'>
+<div id='choicesIMAGE_<s:property value="choiceNumber"/>'
+ class="ui-state-default">
<s:hidden key='%{#prefix}.topiaId' value='%{choice.topiaId}' label=''/>
+ <s:hidden key='%{#prefix}.order' value='%{#choiceNumber}' label=''/>
<div class="fleft choiceName">
+ <span class="choicesImage ui-icon ui-icon-arrowthick-2-n-s"></span>
<s:label for="%{#prefix}.name" id="choicesIMAGE_label_%{choiceNumber}"
theme="simple" value=''/>
- <%--<s:if test="choice.name != ''">--%>
-
- <%--<%–Uploaded image–%>--%>
- <%--<s:hidden id="%{#prefix}.name" name="%{#prefix}.name"--%>
- <%--value="%{choice.name}" label='' theme="simple"/>--%>
-
- <%--<s:hidden id="%{#prefix}.location" name="%{#prefix}.location"--%>
- <%--value="%{choice.location}" label='' theme="simple"/>--%>
-
- <%--<s:label label='' theme="simple" cssClass="nameField"--%>
- <%--value="%{choice.name}" readonly="true"/>--%>
- <%--</s:if>--%>
- <%--<s:else>--%>
- <%--New image--%>
- <s:url id="imageUrl" namespace="/io" action="getPollChoiceImage"
- escapeAmp="false" value="/img/7ter.jpg"/>
- <img name="<s:property value="#prefix"/>.thumb"
- alt="<s:text name='pollen.image.not.loaded'/>"
- title="<s:text name='pollen.image.not.loaded'/>"
- src="<s:property value='imageUrl'/>" width="100px" height="75">
+ <s:url id="imageUrl" namespace="/io" action="getPollChoiceImage"
+ escapeAmp="false" value="/img/7ter.jpg"/>
+ <img name="<s:property value="#prefix"/>.thumb"
+ alt="<s:text name='pollen.image.not.loaded'/>"
+ title="<s:text name='pollen.image.not.loaded'/>"
+ src="<s:property value='imageUrl'/>" width="100px" height="75">
<span style="float: left; margin-left:50px; ">
<s:file key='%{#prefix2}' label=''
theme="simple"
cssClass="nameField"
disabled="%{voteStarted}" cssStyle="clear: both;"/>
</span>
-
- <%--<s:file key='%{#prefix2}' label='' theme="simple" cssClass="nameField"/>--%>
- <%--</s:else>--%>
</div>
<div class="fleft">
-
@@ -71,7 +57,7 @@
key="%{#prefix}.description" value="%{choice.description}"/>
</div>
<div class="fright">
- <s:a id='choicesIMAGE_down_%{choiceNumber}'
+ <%--s:a id='choicesIMAGE_down_%{choiceNumber}'
cssClass="hidden" href='#'
onclick="return downChoice('choicesIMAGE_%{choiceNumber}')">
<image alt='<s:property value="downTitle"/>'
@@ -83,7 +69,7 @@
<image alt='<s:property value="upTitle"/>'
title='<s:property value="upTitle"/>'
src="<s:url value='/img/1uparrow.png'/>"></image>
- </s:a>
+ </s:a--%>
<s:a href='#' onclick="return deleteChoice('choicesIMAGE_%{choiceNumber}')">
<image alt='<s:property value="deleteTitle"/>'
title='<s:property value="deleteTitle"/>'
Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/displayPersonToList.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/displayPersonToList.jsp 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/displayPersonToList.jsp 2012-06-19 08:18:29 UTC (rev 3519)
@@ -24,7 +24,10 @@
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sp" uri="/nuiton-tags" %>
-<s:set name="personPrefix">votingList<s:property value="votingListType"/>_<s:property value="votingListNumber"/>PersonToList_<s:property value="personToListNumber"/>
+<s:set name="personPrefix">votingList<s:property
+ value="votingListType"/>_<s:property
+ value="votingListNumber"/>PersonToList_<s:property
+ value="personToListNumber"/>
</s:set>
<s:set name="personToList" value="%{personToList}"/>
@@ -32,25 +35,32 @@
<s:text name="pollen.action.pollPersonToListDelete"/>
</s:set>
<s:div id='%{#personPrefix}' cssClass="personToList">
- <s:hidden key='%{#personPrefix}.topiaId' value='%{#personToList.topiaId}' label=''/>
- <s:hidden key='%{#personPrefix}.accountId' value='%{#personToList.pollAccount.accountId}' label=''/>
+ <s:hidden key='%{#personPrefix}.topiaId' value='%{#personToList.topiaId}'
+ label=''/>
+ <s:hidden key='%{#personPrefix}.accountId'
+ value='%{#personToList.pollAccount.accountId}' label=''/>
<sp:fielderror fieldName="%{#personPrefix}"/>
<div class="fleft choiceName">
- <s:label for="%{#personPrefix}.votingId" id="%{#personPrefix}_label" theme="simple"
+ <s:label for="%{#personPrefix}.votingId" id="%{#personPrefix}_label"
+ theme="simple"
value=''/>
<s:textfield cssClass="nameField" id='%{#personPrefix}.votingId'
key="%{#personPrefix}.votingId" label='' theme="simple"
value="%{#personToList.pollAccount.votingId}"
disabled="%{voteStarted}"/>
-
- <s:label for="%{#personPrefix}.email" key="pollen.common.email" theme="simple"/>
- <s:textfield cols="30" id="%{#personPrefix}.email" key="%{#personPrefix}.email"
+ <s:label for="%{#personPrefix}.email" key="pollen.common.email"
+ theme="simple"/>
+ <s:textfield cols="30" id="%{#personPrefix}.email"
+ key="%{#personPrefix}.email"
label='' theme="simple" size="30"
value="%{#personToList.pollAccount.email}"
disabled="%{voteStarted}"/>
-
- <s:label for="%{#personPrefix}.weight" key="pollen.common.weight" theme="simple"/>
- <s:textfield id="%{#personPrefix}.weight" key="%{#personPrefix}.weight" size="1"
+ <s:label for="%{#personPrefix}.weight" key="pollen.common.weight"
+ theme="simple"/>
+ <s:textfield id="%{#personPrefix}.weight" key="%{#personPrefix}.weight"
+ size="1"
label='' theme="simple" value="%{#personToList.weight}"
disabled="%{voteStarted}"/>
</div>
Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/displayPollComment.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/displayPollComment.jsp 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/displayPollComment.jsp 2012-06-19 08:18:29 UTC (rev 3519)
@@ -37,7 +37,6 @@
<span class="name"><s:property value='%{#comment.author}'/></span> :
<span class="date">
<s:property value='#comment.postDate'/>
- <%--<s:property value='%{formatDateTime(#postDate)}'/>--%>
</span>
<p>
Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/displayPollComments.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/displayPollComments.jsp 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/displayPollComments.jsp 2012-06-19 08:18:29 UTC (rev 3519)
@@ -25,7 +25,7 @@
<%--<link rel="stylesheet" href="<s:url value='/css/pagination.css'/>"/>--%>
<%--<script type="text/javascript"--%>
- <%--src="<s:url value='/js/jquery.pagination.js' />"></script>--%>
+<%--src="<s:url value='/js/jquery.pagination.js' />"></script>--%>
<%--
<input type="text" value="5" name="items_per_page" id="items_per_page" class="numeric"/>
Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/displayTextChoice.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/displayTextChoice.jsp 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/displayTextChoice.jsp 2012-06-19 08:18:29 UTC (rev 3519)
@@ -27,9 +27,12 @@
<s:set id='deleteTitle'><s:text name="pollen.action.pollChoiceDelete"/></s:set>
<s:set id='upTitle'><s:text name="pollen.action.pollChoiceUp"/></s:set>
<s:set id='downTitle'><s:text name="pollen.action.pollChoiceDown"/></s:set>
-<div id='choicesTEXT_<s:property value="choiceNumber"/>'>
+<div id='choicesTEXT_<s:property value="choiceNumber"/>'
+ class="ui-state-default">
<s:hidden key='%{#prefix}.topiaId' value='%{choice.topiaId}' label=''/>
+ <s:hidden key='%{#prefix}.order' value='%{#choiceNumber}' label=''/>
<div class="fleft choiceName">
+ <span class="choicesImage ui-icon ui-icon-arrowthick-2-n-s"></span>
<s:label for="%{#prefix}.name" id="choicesTEXT_label_%{choiceNumber}"
theme="simple" value=''/>
<s:textfield cssClass="nameField" id='%{#prefix}.name' key="%{#prefix}.name"
@@ -43,7 +46,7 @@
key="%{#prefix}.description" value="%{choice.description}"/>
</div>
<div class="fright">
- <s:a id='choicesTEXT_down_%{choiceNumber}'
+ <%--s:a id='choicesTEXT_down_%{choiceNumber}'
cssClass="hidden" href='#'
onclick="return downChoice('choicesTEXT_%{choiceNumber}')">
<image alt='<s:property value="downTitle"/>'
@@ -55,7 +58,7 @@
<image alt='<s:property value="upTitle"/>'
title='<s:property value="upTitle"/>'
src="<s:url value='/img/1uparrow.png'/>"></image>
- </s:a>
+ </s:a--%>
<s:a href='#' onclick="return deleteChoice('choicesTEXT_%{choiceNumber}')">
<image alt='<s:property value="deleteTitle"/>'
title='<s:property value="deleteTitle"/>'
Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/displayVotingList.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/displayVotingList.jsp 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/displayVotingList.jsp 2012-06-19 08:18:29 UTC (rev 3519)
@@ -39,25 +39,25 @@
<sp:fielderror fieldName="%{#prefix}"/>
<s:if test='%{#votingListType == "GROUP"}'>
<%--<div>--%>
- <div class="fleft choiceName">
- <s:label for="%{#prefix}.name" theme="simple" id="%{#prefix}_label"/>
- <s:textfield id='%{#prefix}.name' key="%{#prefix}.name" label=''
- theme="simple" value="%{#votingList.name}"/>
- -
- <s:label for="%{#prefix}.weight" key="pollen.common.weight"
- theme="simple"/>
- <s:textfield id="%{#prefix}.weight" key="%{#prefix}.weight"
- value="%{#votingList.weight}"
- size="1" label='' theme="simple"/>
- </div>
- <div id='<s:property value="%{#prefix}"/>_actions' class="fright">
- <s:a href='#' onclick="return deleteVotingList('%{#prefix}')">
- <image alt='<s:property value="deleteVotingListTitle"/>'
- title='<s:property value="deleteVotingListTitle"/>'
- src="<s:url value='/img/delete.png'/>"></image>
- </s:a>
- </div>
- <hr/>
+ <div class="fleft choiceName">
+ <s:label for="%{#prefix}.name" theme="simple" id="%{#prefix}_label"/>
+ <s:textfield id='%{#prefix}.name' key="%{#prefix}.name" label=''
+ theme="simple" value="%{#votingList.name}"/>
+ -
+ <s:label for="%{#prefix}.weight" key="pollen.common.weight"
+ theme="simple"/>
+ <s:textfield id="%{#prefix}.weight" key="%{#prefix}.weight"
+ value="%{#votingList.weight}"
+ size="1" label='' theme="simple"/>
+ </div>
+ <div id='<s:property value="%{#prefix}"/>_actions' class="fright">
+ <s:a href='#' onclick="return deleteVotingList('%{#prefix}')">
+ <image alt='<s:property value="deleteVotingListTitle"/>'
+ title='<s:property value="deleteVotingListTitle"/>'
+ src="<s:url value='/img/delete.png'/>"></image>
+ </s:a>
+ </div>
+ <hr/>
<%--</div>--%>
</s:if>
<s:else>
@@ -74,7 +74,8 @@
status="pstatus" var="personToList">
<s:set name="personToListNumber"><s:property value="%{#pstatus.index}"/></s:set>
- <s:set name="personPrefix"><s:property value="%{#prefix}"/>PersonToList_<s:property value="%{#personToListNumber}"/></s:set>
+ <s:set name="personPrefix"><s:property value="%{#prefix}"/>PersonToList_<s:property
+ value="%{#personToListNumber}"/></s:set>
<%@include file="displayPersonToList.jsp" %>
</s:iterator>
</s:div>
Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/displayVotingListPersons.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/displayVotingListPersons.jsp 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/displayVotingListPersons.jsp 2012-06-19 08:18:29 UTC (rev 3519)
@@ -36,7 +36,8 @@
<s:property value="%{#pstatus.index + #startNumber}"/>
</s:set>
<s:set name="personPrefix">
- <s:property value="%{#prefix}"/>PersonToList_<s:property value="%{#personToListNumber}"/></s:set>
+ <s:property value="%{#prefix}"/>PersonToList_<s:property
+ value="%{#personToListNumber}"/></s:set>
<%@include file="displayPersonToList.jsp" %>
</s:iterator>
Copied: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/pollForm.jsp (from rev 3518, trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/create.jsp)
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/pollForm.jsp (rev 0)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/pollForm.jsp 2012-06-19 08:18:29 UTC (rev 3519)
@@ -0,0 +1,355 @@
+<%--
+ #%L
+ Pollen :: UI (struts2)
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2009 - 2012 CodeLutin, Tony Chemit
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ --%>
+<%@ page language="java" contentType="text/html" pageEncoding="utf-8" %>
+<%@ taglib prefix="s" uri="/struts-tags" %>
+<%@ taglib prefix="sj" uri="/struts-jquery-tags" %>
+
+<link rel="stylesheet" type="text/css"
+ href="<s:url value='/css/pollCreation.css'/>"/>
+<link rel="stylesheet" type="text/css" href="<s:url value='/css/tipTip.css'/>"/>
+
+<script type="text/javascript">
+
+ $(document).data(
+ {
+ selectPersonListToAddToVotingListTitle:'<s:text name="pollen.title.selectPersonListToAddVotingList"/>',
+ selectPersonListToCreateNewVotingListTitle:'<s:text name="pollen.title.selectPersonListToCreateVotingList"/>',
+
+ votingListText:'<s:text name="pollen.common.votingList"/>',
+ personToListText:'<s:text name="pollen.common.personToList"/>',
+ choiceText:'<s:text name="pollen.common.choice"/>',
+
+ displayVotingListUrl:'<s:url namespace="/poll" action="displayVotingList"/>',
+ displayPersonToListUrl:'<s:url namespace="/poll" action="displayPersonToList"/>',
+ importPersonListToVotingListUrl:'<s:url namespace="/poll" action="importPersonListToVotingList"/>',
+ importPersonListToNewVotingListUrl:'<s:url namespace="/poll" action="importPersonListToNewVotingList"/>',
+ displayImageChoiceUrl:'<s:url namespace="/poll" action="displayImageChoice"/>',
+ displayDateChoiceUrl:'<s:url namespace="/poll" action="displayDateChoice"/>',
+ displayTextChoiceUrl:'<s:url namespace="/poll" action="displayTextChoice"/>',
+ selectPersonListToAddToVotingListUrl:'<s:url action="selectPersonListToAddToVotingList" namespace="/poll"/>',
+ selectPersonListToCreateNewVotingListUrl:'<s:url action="selectPersonListToCreateNewVotingList" namespace="/poll"/>',
+
+ choiceAddAllowed:'<s:property value="%{poll.choiceAddAllowed}"/>',
+ limitChoice:'<s:property value="%{limitChoice}"/>',
+ reminder:'<s:property value="%{reminder}"/>',
+ publicOption:'<s:property value="%{poll.publicResults}"/>',
+ anonymousOption:'<s:property value="%{poll.anonymous}"/>',
+ voteCountingType:'<s:property value="%{poll.voteCountingType.name()}"/>',
+ choiceType:'<s:property value="%{poll.choiceType.name()}"/>',
+ pollType:'<s:property value="%{poll.pollType.name()}"/>',
+ confirmCloseTitle:"<s:text name='pollen.title.close.poll'/>",
+ confirmCloseUrl:'<s:url action="confirmClosePoll/%{poll.adminId}" namespace="/poll"/>',
+ confirmCloseRedirectUrl:'<s:url action="summary/%{poll.adminId}" namespace="/poll"/>'
+ }
+ );
+</script>
+
+<script type="text/javascript"
+ src='<s:url value="/js/createPoll.js"/>'></script>
+<script type="text/javascript"
+ src='<s:url value="/js/jquery.tipTip.minified.js"/>'></script>
+
+<s:url id='errorImg' value='/img/exclamation.png'/>
+
+<title>
+ <s:if test="edit">
+ <s:text name="pollen.title.editPoll"/>
+ </s:if>
+ <s:else>
+ <s:text name="pollen.title.createPoll"/>
+ </s:else>
+</title>
+
+<h1 class="title<s:property value='%{pageLogo}'/>">
+ <s:property value="%{pageTitle}"/>
+</h1>
+
+<s:form method="POST" id="registerForm" namespace="/poll"
+ enctype="multipart/form-data">
+
+<s:hidden key="poll.topiaId" label=""/>
+
+<sj:tabbedpanel id="formTabs" selectedTab="%{selectedTab}">
+
+<sj:tab id="tabGeneral" target="tgeneral" key="pollen.tab.poll.general"/>
+<sj:tab id="tabOptions" target="toptions" key="pollen.tab.poll.options"/>
+
+<div id="tgeneral">
+
+ <fieldset>
+
+ <s:textfield key="poll.title" label="%{getText('pollen.common.title')}"
+ required="true" size="80"/>
+ <s:textarea key="poll.description" rows="3" cols="54"
+ label="%{getText('pollen.common.description')}"/>
+ <s:hidden key="poll.pollId" label=""/>
+ </fieldset>
+
+ <br/>
+
+ <fieldset class="disableForVoteStarted">
+ <legend>
+ <s:text name="pollen.common.voteCountingType"/>
+ <img src="<s:url value='/img/tooltip.png'/>" class="tooltip"
+ alt="<s:text name='pollen.common.voteCountingType.help'/>"
+ title="<s:text name='pollen.common.voteCountingType.help'/>"/>
+ </legend>
+ <s:radio key='poll.voteCountingType' list="voteCountingTypes"
+ label='' theme="simple"/>
+ </fieldset>
+ <br/>
+
+ <%@include file="createPoll_choices.jsp" %>
+
+</div>
+
+<div id="toptions">
+
+ <fieldset>
+ <legend>
+ <s:text name="pollen.fieldset.creator.options"/>
+ <img src="<s:url value='/img/tooltip.png'/>" class="tooltip"
+ title="<s:text name='pollen.fieldset.creator.options.help'/>"
+ alt="<s:text name='pollen.fieldset.creator.options.help'/>"/>
+ </legend>
+ <s:textfield key="poll.creator.votingId" size="80"
+ label="%{getText('pollen.common.login')}"/>
+ <s:textfield key="poll.creator.email" size="80"
+ label="%{getText('pollen.common.email')}"/>
+ <s:hidden key="poll.creator.accountId" label=""/>
+ <s:hidden key="poll.creator.topiaId" label=""/>
+ <s:if test="creatorUserAccountDefined">
+ <s:hidden name="userId" value="%{poll.creator.userAccount.topiaId}"/>
+ </s:if>
+ </fieldset>
+ <br/>
+
+ <fieldset>
+ <legend>
+ <s:text name="pollen.fieldset.pollDate.options"/>
+ <img src="<s:url value='/img/tooltip.png'/>" class="tooltip"
+ title="<s:text name='pollen.fieldset.pollDate.options.help'/>"
+ alt="<s:text name='pollen.fieldset.pollDate.options.help'/>"/>
+ </legend>
+
+ <sj:datepicker key="poll.beginDate" cssClass="disableForVoteStarted"
+ displayFormat="%{getText('pollen.common.datePickerPattern')}"
+ label="%{getText('pollen.common.beginDate')}"
+ timepicker="true"/>
+ <sj:datepicker key="poll.endDate"
+ displayFormat="%{getText('pollen.common.datePickerPattern')}"
+ timepicker="true"
+ label="%{getText('pollen.common.endDate')}"/>
+ </fieldset>
+ <br/>
+
+ <fieldset class="disableForVoteStarted">
+ <legend>
+ <s:text name="pollen.fieldset.choice.options"/>
+ <img src="<s:url value='/img/tooltip.png'/>" class="tooltip"
+ title="<s:text name='pollen.fieldset.choice.options.help'/>"
+ alt="<s:text name='pollen.fieldset.choice.options.help'/>"/>
+ </legend>
+ <s:checkbox key="poll.choiceAddAllowed"
+ label="%{getText('pollen.common.pollOption.choiceAddAllowed')}"
+ disabled="%{voteStarted}"
+ tooltip="%{getText('pollen.common.pollOption.choiceAddAllowed.help')}"
+ tooltipIconPath="/img/tooltip.png"/>
+ <sj:datepicker key="poll.beginChoiceDate"
+ label="%{getText('pollen.common.beginChoiceDate')}"
+ displayFormat="%{getText('pollen.common.datePickerPattern')}"
+ timepicker="true"
+ disabled="%{voteStarted}"/>
+ <sj:datepicker key="poll.endChoiceDate"
+ label="%{getText('pollen.common.endChoiceDate')}"
+ displayFormat="%{getText('pollen.common.datePickerPattern')}"
+ timepicker="true"
+ disabled="%{voteStarted}"/>
+ <s:checkbox key="limitChoice"
+ label="%{getText('pollen.common.pollOption.limitChoice')}"
+ disabled="%{voteStarted}"
+ tooltip="%{getText('pollen.common.pollOption.limitChoice.help')}"
+ tooltipIconPath="/img/tooltip.png"/>
+ <s:textfield key="maxChoices"
+ label="%{getText('pollen.common.pollOption.maxChoiceNb')}"
+ disabled="%{voteStarted}"/>
+ </fieldset>
+ <br/>
+
+ <fieldset class="disableForVoteStarted">
+ <legend>
+ <s:text name="pollen.fieldset.vote.options"/>
+ <img src="<s:url value='/img/tooltip.png'/>" class="tooltip"
+ title="<s:text name='pollen.fieldset.vote.options.help'/>"
+ alt="<s:text name='pollen.fieldset.vote.options.help'/>"/>
+ </legend>
+
+ <s:checkbox key="poll.anonymous"
+ label="%{getText('pollen.common.pollOption.anonymous')}"
+ disabled="%{voteStarted}"
+ tooltip="%{getText('pollen.common.pollOption.anonymous.help')}"
+ tooltipIconPath="/img/tooltip.png"/>
+ <s:checkbox key="poll.anonymousVoteAllowed"
+ label="%{getText('pollen.common.pollOption.anonymousVoteAllowed')}"
+ disabled="%{voteStarted}"
+ tooltip="%{getText('pollen.common.pollOption.anonymousVoteAllowed.help')}"
+ tooltipIconPath="/img/tooltip.png"/>
+ </fieldset>
+ <br/>
+ <fieldset>
+ <legend>
+ <s:text name="pollen.fieldset.result.options"/>
+ <img src="<s:url value='/img/tooltip.png'/>" class="tooltip"
+ title="<s:text name='pollen.fieldset.result.options.help'/>"
+ alt="<s:text name='pollen.fieldset.result.options.help'/>"/>
+ </legend>
+
+ <s:checkbox key="poll.publicResults"
+ label="%{getText('pollen.common.pollOption.publicResults')}"
+ tooltip="%{getText('pollen.common.pollOption.publicResults.help')}"
+ tooltipIconPath="/img/tooltip.png"/>
+ <s:checkbox key="poll.continuousResults"
+ label="%{getText('pollen.common.pollOption.continuousResults')}"
+ tooltip="%{getText('pollen.common.pollOption.continuousResults.help')}"
+ tooltipIconPath="/img/tooltip.png"/>
+ </fieldset>
+ <br/>
+
+ <fieldset>
+ <legend>
+ <s:text name="pollen.fieldset.notification.options"/>
+ <img src="<s:url value='/img/tooltip.png'/>" class="tooltip"
+ title="<s:text name='pollen.fieldset.notification.options.help'/>"
+ alt="<s:text name='pollen.fieldset.notification.options.help'/>"/>
+ </legend>
+ <s:checkbox key="notification"
+ label="%{getText('pollen.common.pollOption.notification')}"
+ tooltip="%{getText('pollen.common.pollOption.notification.help')}"
+ tooltipIconPath="/img/tooltip.png"/>
+ <s:checkbox key="reminder"
+ label="%{getText('pollen.common.pollOption.reminder')}"
+ tooltip="%{getText('pollen.common.pollOption.reminder.help')}"
+ tooltipIconPath="/img/tooltip.png"/>
+ <s:textfield key="reminderHourCountdown"
+ label="%{getText('pollen.common.pollOption.reminderHourCountdown')}"/>
+ </fieldset>
+ <br/>
+
+ <fieldset class="disableForVoteStarted">
+ <legend>
+ <s:text name="pollen.common.pollType"/>
+ <img src="<s:url value='/img/tooltip.png'/>" class="tooltip"
+ title="<s:text name='pollen.common.pollType.help'/>"
+ alt="<s:text name='pollen.common.pollType.help'/>"/>
+ </legend>
+ <s:radio key='poll.pollType' list="pollTypes"
+ label='%{getText("pollen.common.pollType")}'/>
+ <hr/>
+
+ <div id="pollTypeFREE" class="pollType">
+ <%--Nothing to show for a free poll--%>
+ </div>
+
+ <div id="pollTypeRESTRICTED" class="pollType">
+ <s:iterator value="restrictedVotingList" status="status"
+ var="votingList">
+ <s:set name="votingListNumber"><s:property
+ value="%{#status.index}"/></s:set>
+ <s:set name="votingListType">RESTRICTED</s:set>
+ <%@include file="displayVotingList.jsp" %>
+ </s:iterator>
+ </div>
+
+ <div id="pollTypeGROUP" class="pollType">
+ <div id="votingListGROUP">
+ <s:iterator value="groupVotingList" status="status"
+ var="votingList">
+ <s:set name="votingListNumber"><s:property
+ value="%{#status.index}"/></s:set>
+ <s:set name="votingListType">GROUP</s:set>
+ <%@include file="displayVotingList.jsp" %>
+ </s:iterator>
+ </div>
+ <div align="center">
+ <s:submit key="pollen.action.addVotingList" theme="simple"
+ onclick="return addNewVotingList();"/>
+ <s:if test="userLoggued">
+ <s:submit key="pollen.action.addVotingListFromPersonList"
+ onclick='return selectPersonListToCreateNewVotingList();'
+ theme="simple"/>
+ </s:if>
+ </div>
+ </div>
+ </fieldset>
+</div>
+
+</sj:tabbedpanel>
+
+<br/>
+<s:if test="edit">
+ <s:submit action="edit/%{uriId}" value="%{actionLabel}" align="center"/>
+ <div align="center" style="margin-top: 10px">
+ <button onclick="return confirmClose();">
+ <s:text name="pollen.action.close"/>
+ </button>
+ </div>
+</s:if>
+<s:elseif test="clone">
+ <s:submit action="clone/%{uriId}" value="%{actionLabel}" align="center"/>
+</s:elseif>
+<s:else>
+ <s:submit action="create" value="%{actionLabel}" align="center"/>
+</s:else>
+</s:form>
+
+<script type="text/javascript">
+
+ jQuery(document).ready(function () {
+
+ function addErrorImage(element) {
+ element.append(
+ '<image src="${errorImg}">'
+ );
+ element.attr('title', '<s:text name="pollen.error.pollTabErrorFound"/>');
+ }
+
+ if (<s:property value="%{informationsError}"/>) {
+ addErrorImage($('#tabGeneral a'));
+ }
+ if (<s:property value="%{optionsError}"/>) {
+ addErrorImage($('#tabOptions a'));
+ }
+
+ if (<s:property value="%{poll.closed}"/>) {
+ disablePoll();
+ }
+ if (<s:property value="%{voteStarted}"/>) {
+ disableWhenVoteStarted();
+ }
+ });
+</script>
+
+<sj:dialog id="selectPersonListDialog" resizable="true" autoOpen="false"
+ modal="true" width="500"/>
+
+<sj:dialog id="confirmDialog" autoOpen="false" modal="true" width="500"/>
Property changes on: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/pollForm.jsp
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/summary.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/summary.jsp 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/summary.jsp 2012-06-19 08:18:29 UTC (rev 3519)
@@ -55,6 +55,32 @@
dialog.dialog('open');
return false;
}
+
+ var autoSelect = function () {
+ var el = $(this)[0];
+ if (/textarea/i.test(el.tagName) || (/input/i.test(el.tagName) && /text/i.test(el.type))) {
+ el.select();
+ } else if (!!window.getSelection) { // FF, Safari, Chrome, Opera
+ var sel = window.getSelection();
+ var range = document.createRange();
+ range.selectNodeContents(el);
+ sel.removeAllRanges();
+ sel.addRange(range);
+ } else if (!!document.selection) { // IE
+ document.selection.empty();
+ var range = document.body.createTextRange();
+ range.moveToElementText(el);
+ range.select();
+ }
+ };
+
+ $(document).load(function() {
+
+
+ $('.url').click(autoSelect);
+
+ })
+
</script>
<h1 class="titleCreation"><s:property value="poll.title"/></h1>
@@ -72,13 +98,14 @@
<s:if test="canVote">
<div class="ui-widget-content-green ui-corner-all">
<img src="<s:url value='/img/vote.png'/>" class="imgAction"
- alt="<s:text name='pollen.common.voteAction'/>"
- title="<s:text name='pollen.common.voteAction'/>"/>
- <s:text name="pollen.label.pollVotePage"/>
- <br/>
+ alt="<s:text name='pollen.action.voteAction.help'/>"
+ title="<s:text name='pollen.action.voteAction.help'/>"/>
<s:a href="%{voteUrl}">
+ <strong><s:text name="pollen.label.pollVotePage"/></strong>
+ </s:a>
+ <span class="fright url" id='voteUrl'>
<s:property value="%{voteUrl}"/>
- </s:a>
+ </span>
</div>
</s:if>
@@ -86,57 +113,60 @@
<s:if test="canShowResult">
<div class="ui-widget-content-green ui-corner-all">
<img src="<s:url value='/img/count.png'/>" class="imgAction"
- alt="<s:text name='pollen.action.pollResult'/>"
- title="<s:text name='pollen.action.pollResult'/>"/>
- <s:text name='pollen.label.pollResultPage'/>
- <br/>
+ alt="<s:text name='pollen.action.pollResult.help'/>"
+ title="<s:text name='pollen.action.pollResult.help'/>"/>
<s:a href="%{resultUrl}">
+ <strong><s:text name='pollen.label.pollResultPage'/></strong>
+ </s:a>
+ <span class="fright url" id='voteUrl'>
<s:property value="%{resultUrl}"/>
- </s:a>
+ </span>
</div>
</s:if>
<%--Moderate--%>
<div class="ui-widget-content-yellow ui-corner-all">
<img src="<s:url value='/img/moderate.png'/>" class="imgAction"
- alt="<s:text name='pollen.action.pollModerateVote'/>"
- title="<s:text name='pollen.action.pollModerateVote'/>"/>
- <s:text name='pollen.label.pollModerateVotePage'/>
- <br/>
+ alt="<s:text name='pollen.action.pollModerateVote.help'/>"
+ title="<s:text name='pollen.action.pollModerateVote.help'/>"/>
<s:a href="%{moderateUrl}">
- <s:property value="%{moderateUrl}"/>
+ <strong><s:text name='pollen.label.pollModerateVotePage'/></strong>
</s:a>
+ <span class="fright url" id='voteUrl'>
+ <s:property value="%{moderateUrl}"/>
+ </span>
</div>
<%--Edit--%>
<div class="ui-widget-content-yellow ui-corner-all">
<img src="<s:url value='/img/edit.png'/>" class="imgAction"
- alt="<s:text name='pollen.action.editPoll'/>"
- title="<s:text name='pollen.action.editPoll'/>"/>
- <s:text name='pollen.label.pollEditPage'/>
- <br/>
+ alt="<s:text name='pollen.action.editPoll.help'/>"
+ title="<s:text name='pollen.action.editPoll.help'/>"/>
<s:a href="%{editUrl}">
- <s:property value="%{editUrl}"/>
+ <strong><s:text name='pollen.label.pollEditPage'/></strong>
</s:a>
+ <span class="fright url" id='voteUrl'>
+ <s:property value="%{editUrl}"/>
+ </span>
</div>
<%--Export--%>
<div class="ui-widget-content-blue ui-corner-all">
<img src="<s:url value='/img/export.png'/>" class="imgAction"
- alt="<s:text name='pollen.action.pollExport'/>"
- title="<s:text name='pollen.action.pollExport'/>"/>
+ alt="<s:text name='pollen.action.exportPoll.help'/>"
+ title="<s:text name='pollen.action.exportPoll.help'/>"/>
<s:a href="%{exportUrl}">
- <s:text name='pollen.label.pollExportPage'/>
+ <strong><s:text name='pollen.label.pollExportPage'/></strong>
</s:a>
</div>
<%--Clone--%>
<div class="ui-widget-content-blue ui-corner-all">
<img src="<s:url value='/img/copy.png'/>" class="imgAction"
- alt="<s:text name='pollen.action.clone'/>"
- title="<s:text name='pollen.action.clone'/>"/>
+ alt="<s:text name='pollen.action.clonePoll.help'/>"
+ title="<s:text name='pollen.action.clonePoll.help'/>"/>
<s:a href="%{cloneUrl}">
- <s:text name='pollen.label.pollClonePage'/>
+ <strong> <s:text name='pollen.label.pollClonePage'/></strong>
</s:a>
</div>
@@ -144,10 +174,10 @@
<s:if test="canClose">
<div class="ui-widget-content-red ui-corner-all">
<img src="<s:url value='/img/close.png'/>" class="imgAction"
- alt="<s:text name='pollen.action.close'/>"
- title="<s:text name='pollen.action.close'/>"/>
+ alt="<s:text name='pollen.action.closePoll.help'/>"
+ title="<s:text name='pollen.action.closePoll.help'/>"/>
<s:a href="#" onclick="return confirmClosePoll('%{uriId}')">
- <s:text name='pollen.label.pollClosePage'/>
+ <strong><s:text name='pollen.label.pollClosePage'/></strong>
</s:a>
</div>
@@ -156,8 +186,8 @@
<%--Delete --%>
<div class="ui-widget-content-red ui-corner-all">
<img src="<s:url value='/img/delete.png'/>" class="imgAction"
- alt="<s:text name='pollen.action.deletePoll'/>"
- title="<s:text name='pollen.action.deletePoll'/>"/>
+ alt="<s:text name='pollen.action.deletePoll.help'/>"
+ title="<s:text name='pollen.action.deletePoll.help'/>"/>
<s:a href="#" onclick="return confirmDeletePoll('%{uriId}')">
<s:text name='pollen.label.pollDeletePage'/>
</s:a>
Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/pollListHelper.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/pollListHelper.jsp 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/pollListHelper.jsp 2012-06-19 08:18:29 UTC (rev 3519)
@@ -27,7 +27,7 @@
<script type="text/javascript"
src="<s:url value='/js/gridHelper.js' />"></script>
-<s:url id="loadUrl" action="getPolls" namespace="/json" method="input"/>
+<s:url id="loadUrl" action="getPolls" namespace="/json"/>
<s:url id="voteUrl" action="votefor/" namespace="/poll"/>
<s:url id='voteImg' value='/img/vote.png'/>
@@ -83,7 +83,7 @@
result += formatLink("${voteUrl}" + voteId, "${voteImg}", "Vote", "${voteTitle}")
}
if (cellvalue.indexOf('novote') > -1) {
- result +="<image src='${blankImg}'>";
+ result += "<image src='${blankImg}'>";
}
if (cellvalue.indexOf('summary') > -1) {
result += formatLink("${summaryUrl}" + adminId, "${summaryImg}", "Moderate", "${summaryTitle}")
Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/security/connected_required.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/security/connected_required.jsp 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/security/connected_required.jsp 2012-06-19 08:18:29 UTC (rev 3519)
@@ -28,6 +28,6 @@
<span>
<s:text name="pollen.security.error.connected_required"/>
</span>
- </li>
+ </li>
</ul>
</div>
Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/createdList.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/createdList.jsp 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/createdList.jsp 2012-06-19 08:18:29 UTC (rev 3519)
@@ -37,7 +37,7 @@
<script type="text/javascript">
var redirectUrl = '<s:url namespace="/user" action="createdList"/>';
- $(function(){
+ $(function () {
$('img[src$="tooltip.png"]').addClass('tooltip');
$(".tooltip").tipTip();
});
@@ -46,7 +46,9 @@
<title><s:text name="pollen.title.pollsCreatedList"/></title>
-<h1 class="title${pageLogo}"><s:text name="pollen.title.pollsCreatedList"/></h1>
+<h1 class="title<s:property value='%{pageLogo}'/>">
+ <s:text name="pollen.title.pollsCreatedList"/>
+</h1>
<h4><s:text name="pollen.title.pollsCreatedList.legend"/></h4>
Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/dialogLostPassword.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/dialogLostPassword.jsp 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/dialogLostPassword.jsp 2012-06-19 08:18:29 UTC (rev 3519)
@@ -38,7 +38,9 @@
<hr/>
<div align="right">
- <button onclick="return cancel();"><s:text name="pollen.action.cancel"/></button>
+ <button onclick="return cancel();">
+ <s:text name="pollen.action.cancel"/>
+ </button>
<s:submit key="pollen.action.send" theme="simple"
action="lostPassword"/>
</div>
Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/edit.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/edit.jsp 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/edit.jsp 2012-06-19 08:18:29 UTC (rev 3519)
@@ -25,7 +25,9 @@
<title><s:text name="pollen.title.myAccount"/></title>
-<h1 class="title${pageLogo}"><s:text name="pollen.title.myAccount"/></h1>
+<h1 class="title<s:property value='%{pageLogo}'/>">
+ <s:text name="pollen.title.myAccount"/>
+</h1>
<s:form method="POST" namespace="/user">
Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/favoriteList.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/favoriteList.jsp 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/favoriteList.jsp 2012-06-19 08:18:29 UTC (rev 3519)
@@ -42,7 +42,7 @@
<script type="text/javascript">
var favoriteListId = '<s:property value="favoriteList.topiaId"/>';
- var redirectUrl = '${editPollAccounts}';
+ var redirectUrl = "<s:property value='%{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"/>';
@@ -52,7 +52,7 @@
jQuery(document).ready(function () {
- initFavoritePage('${action}');
+ initFavoritePage("<s:property value='%{action}'/>");
});
</script>
@@ -61,7 +61,7 @@
value="favoriteList.name"/>
</title>
-<h1 class="title${pageLogo}">
+<h1 class="title<s:property value='%{pageLogo}'/>">
<s:text name="pollen.title.editFavoriteList"/> <s:property
value="favoriteList.name"/>
</h1>
Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/favoriteLists.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/favoriteLists.jsp 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/favoriteLists.jsp 2012-06-19 08:18:29 UTC (rev 3519)
@@ -37,7 +37,9 @@
<title><s:text name="pollen.title.favoriteLists"/></title>
-<h1 class="title${pageLogo}"><s:text name="pollen.title.favoriteLists"/></h1>
+<h1 class="title<s:property value='%{pageLogo}'/>">
+ <s:text name="pollen.title.favoriteLists"/>
+</h1>
<s:url id="loadFavoriteLists" action="getFavoriteLists" namespace="/json"/>
@@ -51,11 +53,11 @@
var editTitle = '<s:text name="pollen.action.editFavoriteList"/>';
var deleteImg = '<s:url value='/img/delete.png'/>';
var csvHelp = "<div><s:text name='pollen.common.favoriteList.csvImport.help'/>" +
- "<br/><img src=\"<s:url value="/img/import_csv_help.png"/>\"/></div>";
+ "<br/><img src=\"<s:url value="/img/import_csv_help.png"/>\"/></div>";
jQuery(document).ready(function () {
- initFavoritesPage('${action}');
+ initFavoritesPage("<s:property value='%{action}'/>");
});
</script>
@@ -82,8 +84,7 @@
<br/>
<s:form id='createForm' method="POST" namespace="/user"
- cssClass="hidden favoriteForm"
- enctype="multipart/form-data">
+ cssClass="hidden favoriteForm" enctype="multipart/form-data">
<s:hidden name="action" value="create"/>
<fieldset>
Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/invitedList.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/invitedList.jsp 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/invitedList.jsp 2012-06-19 08:18:29 UTC (rev 3519)
@@ -26,11 +26,13 @@
<script type="text/javascript">
var redirectUrl = '<s:url namespace="/user" action="invitedList"/>';
</script>
-<%@include file="/WEB-INF/jsp/pollListHelper.jsp"%>
+<%@include file="/WEB-INF/jsp/pollListHelper.jsp" %>
<title><s:text name="pollen.title.pollsInvitedList"/></title>
-<h1 class="title${pageLogo}"><s:text name="pollen.title.pollsInvitedList"/></h1>
+<h1 class="title<s:property value='%{pageLogo}'/>">
+ <s:text name="pollen.title.pollsInvitedList"/>
+</h1>
<h4><s:text name="pollen.title.pollsInvitedList.legend"/></h4>
@@ -48,10 +50,13 @@
rowList="10,15,20,50,100" rowNum="10">
<sjg:gridColumn name="id" title="id" hidden="true"/>
- <sjg:gridColumn name="title" title='%{getText("pollen.common.title")}' />
- <sjg:gridColumn name="description" title='%{getText("pollen.common.description")}'/>
- <sjg:gridColumn name="addingChoices" title='%{getText("pollen.common.addingChoices")}'/>
- <sjg:gridColumn name="beginDate" title='%{getText("pollen.common.beginDate")}'/>
+ <sjg:gridColumn name="title" title='%{getText("pollen.common.title")}'/>
+ <sjg:gridColumn name="description"
+ title='%{getText("pollen.common.description")}'/>
+ <sjg:gridColumn name="addingChoices"
+ title='%{getText("pollen.common.addingChoices")}'/>
+ <sjg:gridColumn name="beginDate"
+ title='%{getText("pollen.common.beginDate")}'/>
<sjg:gridColumn name="endDate" title='%{getText("pollen.common.endDate")}'/>
<sjg:gridColumn name="functions" title='%{getText("pollen.common.functions")}'
formatter="pollFunctions" width="55" sortable="false"/>
Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/login.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/login.jsp 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/login.jsp 2012-06-19 08:18:29 UTC (rev 3519)
@@ -34,8 +34,8 @@
<s:form id="connection" action="login" method="POST" namespace="/user">
-<fieldset>
- <legend><s:text name="pollen.fieldset.login"/></legend>
+ <fieldset>
+ <legend><s:text name="pollen.fieldset.login"/></legend>
<s:textfield key="login" size="10" label="%{getText('pollen.common.login')}"
required="true"/>
@@ -44,11 +44,11 @@
required="true"/>
-</fieldset>
+ </fieldset>
<br/>
<s:submit id="submitform" action="login" key="pollen.action.login"
align="center"/>
- </s:form>
+</s:form>
<div class="center" style="margin-bottom:20px;">
<img src="<s:url value='/img/pollen_%{safeLanguage}.png' />"
alt="Pollen logo"/>
Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/participatedList.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/participatedList.jsp 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/participatedList.jsp 2012-06-19 08:18:29 UTC (rev 3519)
@@ -26,11 +26,13 @@
<script type="text/javascript">
var redirectUrl = '<s:url namespace="/user" action="participatedList"/>';
</script>
-<%@include file="/WEB-INF/jsp/pollListHelper.jsp"%>
+<%@include file="/WEB-INF/jsp/pollListHelper.jsp" %>
<title><s:text name="pollen.title.pollsParticipatedList"/></title>
-<h1 class="title${pageLogo}"><s:text name="pollen.title.pollsParticipatedList"/></h1>
+<h1 class="title<s:property value='%{pageLogo}'/>">
+ <s:text name="pollen.title.pollsParticipatedList"/>
+</h1>
<h4><s:text name="pollen.title.pollsParticipatedList.legend"/></h4>
@@ -48,10 +50,13 @@
rowList="10,15,20,50,100" rowNum="10">
<sjg:gridColumn name="id" title="id" hidden="true"/>
- <sjg:gridColumn name="title" title='%{getText("pollen.common.title")}' />
- <sjg:gridColumn name="description" title='%{getText("pollen.common.description")}'/>
- <sjg:gridColumn name="addingChoices" title='%{getText("pollen.common.addingChoices")}'/>
- <sjg:gridColumn name="beginDate" title='%{getText("pollen.common.beginDate")}'/>
+ <sjg:gridColumn name="title" title='%{getText("pollen.common.title")}'/>
+ <sjg:gridColumn name="description"
+ title='%{getText("pollen.common.description")}'/>
+ <sjg:gridColumn name="addingChoices"
+ title='%{getText("pollen.common.addingChoices")}'/>
+ <sjg:gridColumn name="beginDate"
+ title='%{getText("pollen.common.beginDate")}'/>
<sjg:gridColumn name="endDate" title='%{getText("pollen.common.endDate")}'/>
<sjg:gridColumn name="functions" title='%{getText("pollen.common.functions")}'
formatter="pollFunctions" width="55" sortable="false"/>
Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/register.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/register.jsp 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/register.jsp 2012-06-19 08:18:29 UTC (rev 3519)
@@ -25,7 +25,9 @@
<title><s:text name="pollen.title.register"/></title>
-<h1 class="title${pageLogo}"><s:text name="pollen.title.register"/></h1>
+<h1 class="title<s:property value='%{pageLogo}'/>">
+ <s:text name="pollen.title.register"/>
+</h1>
<s:form method="POST" key="registerForm">
@@ -33,7 +35,8 @@
<legend><s:text name="pollen.fieldset.connexionInformation"/></legend>
<s:textfield name="user.login" key="pollen.common.login" required="true"/>
- <s:password name="user.password" key="pollen.common.password" required="true"/>
+ <s:password name="user.password" key="pollen.common.password"
+ required="true"/>
<s:password name="password2" key="pollen.common.password2" required="true"/>
</fieldset>
Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/show.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/show.jsp 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/user/show.jsp 2012-06-19 08:18:29 UTC (rev 3519)
@@ -25,23 +25,27 @@
<title><s:text name="pollen.title.myAccount"/></title>
-<h1 class="title${pageLogo}"><s:text name="pollen.title.myAccount"/></h1>
+<h1 class="title<s:property value='%{pageLogo}'/>">
+ <s:text name="pollen.title.myAccount"/>
+</h1>
<s:form method="POST" namespace="/user">
<fieldset>
<legend><s:text name="pollen.fieldset.connexionInformation"/></legend>
- <s:hidden key="user.topiaId" label="" />
+ <s:hidden key="user.topiaId" label=""/>
<s:label name="user.login" key="pollen.common.login"/>
</fieldset>
<fieldset>
<legend><s:text name="pollen.fieldset.userInformation"/></legend>
- <s:label name="user.email" key="pollen.common.email" />
- <s:label name="user.firstName" value="%{user.firstName}" key="pollen.common.firstName" />
- <s:label name="user.lastName" value="%{user.lastName}" key="pollen.common.lastName" />
+ <s:label name="user.email" key="pollen.common.email"/>
+ <s:label name="user.firstName" value="%{user.firstName}"
+ key="pollen.common.firstName"/>
+ <s:label name="user.lastName" value="%{user.lastName}"
+ key="pollen.common.lastName"/>
</fieldset>
<br/>
<s:submit action="edit" method="input"
Modified: trunk/pollen-ui-struts2/src/main/webapp/css/pollCreation.css
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/css/pollCreation.css 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/webapp/css/pollCreation.css 2012-06-19 08:18:29 UTC (rev 3519)
@@ -20,6 +20,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
+.choicesImage { position: absolute; margin-left: 1.3em; }
+.choices div { height: 4em; line-height: 1.2em; }
+.ui-state-highlight { height: 4em; line-height: 1.2em; }
+
#pollCreationZone {
width: 550px;
margin: auto;
Modified: trunk/pollen-ui-struts2/src/main/webapp/css/summary.css
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/css/summary.css 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/webapp/css/summary.css 2012-06-19 08:18:29 UTC (rev 3519)
@@ -20,27 +20,61 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
-.ui-widget-content-green { border: 1px solid #aaaaaa; background: #b0f580 url(images/ui-bg_flat_75_b0f580_40x100.png) 50% 50% repeat-x; color: #222222; }
-.ui-widget-content-green a { color: #222222; }
+.ui-widget-content-green {
+ border: 1px solid #aaaaaa;
+ background: #b0f580 url(images/ui-bg_flat_75_b0f580_40x100.png) 50% 50% repeat-x;
+ color: #222222;
+}
-.ui-widget-content-yellow { border: 1px solid #aaaaaa; background: #ffffaa url(images/ui-bg_flat_75_ffffaa_40x100.png) 50% 50% repeat-x; color: #222222; }
-.ui-widget-content-yellow a { color: #222222; }
+.ui-widget-content-green a {
+ color: #222222;
+}
-.ui-widget-content-red { border: 1px solid #aaaaaa; background: #FFAAAA url(images/ui-bg_flat_75_ffffaa_40x100.png) 50% 50% repeat-x; color: #222222; }
-.ui-widget-content-red a { color: #222222; }
+.ui-widget-content-yellow {
+ border: 1px solid #aaaaaa;
+ background: #ffffaa url(images/ui-bg_flat_75_ffffaa_40x100.png) 50% 50% repeat-x;
+ color: #222222;
+}
-.ui-widget-content-blue { border: 1px solid #dddddd; background: #A9D4E3 url(images/ui-bg_highlight-hard_100_f2f5f7_1x100.png) 50% top repeat-x; color: #362b36; }
-.ui-widget-content-blue a { color: #362b36; }
+.ui-widget-content-yellow a {
+ color: #222222;
+}
+.ui-widget-content-red {
+ border: 1px solid #aaaaaa;
+ background: #FFAAAA url(images/ui-bg_flat_75_ffffaa_40x100.png) 50% 50% repeat-x;
+ color: #222222;
+}
+
+.ui-widget-content-red a {
+ color: #222222;
+}
+
+.ui-widget-content-blue {
+ border: 1px solid #dddddd;
+ background: #A9D4E3 url(images/ui-bg_highlight-hard_100_f2f5f7_1x100.png) 50% top repeat-x;
+ color: #362b36;
+}
+
+.ui-widget-content-blue a {
+ color: #362b36;
+}
+
.ui-corner-all {
margin-top: 10px;
padding: 10px;
}
.showResultIcon {
- background: #FFE3E3 url(../img/count.png) 80% 80% repeat-x;
+ background: #FFE3E3 url(../img/count.png) 80% 80% repeat-x;
}
+
.imgAction {
margin-right: 20px;
}
+.url {
+ margin-left: 2em;
+ background-color: #ffffff;
+}
+
Modified: trunk/pollen-ui-struts2/src/main/webapp/js/createPoll.js
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/js/createPoll.js 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/webapp/js/createPoll.js 2012-06-19 08:18:29 UTC (rev 3519)
@@ -354,7 +354,8 @@
function updateUpdownActions(containerId) {
- var firstChoice = getFirstChoice(containerId);
+ reorder(containerId);
+ /*var firstChoice = getFirstChoice(containerId);
var lastChoice = getLastChoice(containerId);
getAllChoices(containerId).each(function (index) {
@@ -381,7 +382,7 @@
//show down
downWidget.removeClass('hidden');
}
- });
+ });*/
}
@@ -467,7 +468,7 @@
return false;
}
-function upChoice(choiceId) {
+/*function upChoice(choiceId) {
var choice = $('#' + choiceId);
var choicePrefix = choice.data('choicePrefix');
var choiceNumber = choice.data('choiceNumber');
@@ -483,9 +484,9 @@
var newChoiceNumber = (choiceNumber + 1);
return switchChoices(choicePrefix, choiceNumber, newChoiceNumber);
-}
+}*/
-function switchChoices( choicePrefix, choiceNumber, newChoiceNumber) {
+/*function switchChoices(choicePrefix, choiceNumber, newChoiceNumber) {
// change topiaId
switchValue(choicePrefix, choiceNumber, newChoiceNumber, '.topiaId');
@@ -537,7 +538,7 @@
//console.info("switch " + choiceTIVal + " to " + newChoiceTIVal);
choiceTI.attr("src", newChoiceTIVal);
newChoiceTI.attr("src", choiceTIVal);
-}
+}*/
function confirmClose() {
$('.ui-dialog-title').html(datas['confirmCloseTitle']);
@@ -566,6 +567,25 @@
$('#registerForm .disableForVoteStarted input[type="file"]').hide();
}
+function reorder(containerId) {
+
+ var choices = getAllChoices(containerId);
+
+ choices.each(function (index) {
+
+ var currentChoiceNumber = $(this).data('choiceNumber');
+
+ var choicePrefix = $(this).data('choicePrefix');
+
+ $('#' + containerId + "_label_" + currentChoiceNumber).html(
+ datas['choiceText'] + ' ' + (index + 1));
+
+ var orderWidget = $('[name="' + choicePrefix + currentChoiceNumber +".order" + '"]');
+
+ orderWidget.val(index);
+ });
+
+}
jQuery(document).ready(function () {
function changeChoiceAddAllowed(val) {
@@ -668,4 +688,19 @@
$('img[src$="tooltip.png"]').addClass("tooltip");
$('.tooltip').tipTip({ defaultPosition:'top' });
+
+ $.struts2_jquery.require('js/base/jquery.ui.sortable.js', function () {
+
+ $(".choices").sortable({placeholder:"ui-state-highlight",
+ update:function (event, ui) {
+ var item = $(ui.item);
+ var container = item.data('choiceType');
+ var choiceNumber = item.data('choiceNumber');
+ console.info('Moved ' + container + ' -- ' + choiceNumber);
+ reorder(container);
+ }
+ }).disableSelection();
+ });
+
+
});
Modified: trunk/pollen-ui-struts2/src/main/webapp/js/favoriteList.js
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/js/favoriteList.js 2012-06-18 17:25:39 UTC (rev 3518)
+++ trunk/pollen-ui-struts2/src/main/webapp/js/favoriteList.js 2012-06-19 08:18:29 UTC (rev 3519)
@@ -20,7 +20,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
-function initFavoritePage(action, loadPollActionUrl) {
+function initFavoritePage(action) {
if (action == 'create') {
$('#createForm').show();
} else if (action == 'edit') {
@@ -47,7 +47,7 @@
});
// to create a new row
- $.listenRowTopic('pollAccounts-addRow', function (event) {
+ $.listenRowTopic('pollAccounts-addRow', function () {
$('#createForm [name="createPollAccount.votingId"]').val("");
$('#createForm [name="createPollAccount.email"]').val("");
$('#deleteForm').hide();
@@ -92,7 +92,7 @@
}
function confirmDelete(id) {
- $('.ui-dialog-title').html(deleteTitle)
+ $('.ui-dialog-title').html(deleteTitle);
var dialog = $("#confirmDialog");
var url = deleteUrl + '?' + $.param({favoriteListId:favoriteListId,
pollAccountId:id,
1
0
r3518 - in trunk/pollen-ui-struts2/src/main: java/org/chorem/pollen/ui/actions/poll resources/i18n
by ymartel@users.chorem.org 18 Jun '12
by ymartel@users.chorem.org 18 Jun '12
18 Jun '12
Author: ymartel
Date: 2012-06-18 19:25:39 +0200 (Mon, 18 Jun 2012)
New Revision: 3518
Url: http://chorem.org/repositories/revision/pollen/3518
Log:
refs #596 : dont allow non image file
Modified:
trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractPollForm.java
trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties
trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties
Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractPollForm.java
===================================================================
--- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractPollForm.java 2012-06-18 16:59:38 UTC (rev 3517)
+++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractPollForm.java 2012-06-18 17:25:39 UTC (rev 3518)
@@ -531,6 +531,8 @@
@Override
public void addFileContentType(int index, String contentType) {
+ parameters.put("imageChoice_" + index + ".newContentType",
+ new String[]{contentType});
// not used here
}
@@ -873,6 +875,16 @@
continue;
}
choiceNames.add(choiceName);
+ String contentTypeField = choicePrefix + choiceIndex + ".newContentType";
+ String contentTypes = getNonEmptyParameterValue(contentTypeField);
+ if (contentTypes != null && !contentTypes.startsWith("image/")) {
+ // Bad content Type
+ addInformationsError(
+ choiceErrorField,
+ _("pollen.error.poll.imageChoice.upload.badContentType"));
+ //TODO ymartel 2012/06/18
+ continue;
+ }
}
}
Modified: trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties
===================================================================
--- trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-06-18 16:59:38 UTC (rev 3517)
+++ trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-06-18 17:25:39 UTC (rev 3518)
@@ -185,6 +185,7 @@
pollen.error.poll.endDate.before.beginDate=The poll end date must be later than the begin date.
pollen.error.poll.endDate.before.now=The poll end date must be later than current date.
pollen.error.poll.imageChoice.already.used=Image choice name already used.
+pollen.error.poll.imageChoice.upload.badContentType=Only images are allowed.
pollen.error.poll.imageChoice.upload.required=Upload an image is mandatory.
pollen.error.poll.maxChoice.greater.than.0=Number of choices must be strictly greater than 0
pollen.error.poll.maxChoice.required=Number of choices mandatory
Modified: trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties
===================================================================
--- trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-06-18 16:59:38 UTC (rev 3517)
+++ trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-06-18 17:25:39 UTC (rev 3518)
@@ -185,6 +185,7 @@
pollen.error.poll.endDate.before.beginDate=La date de fin du sondage doit-être postérieure à la date de début.
pollen.error.poll.endDate.before.now=La date de fin du sondage doit-être postérieure à la date actuelle.
pollen.error.poll.imageChoice.already.used=Choix d'image déjà utilisé (les noms doivent être tous différents).
+pollen.error.poll.imageChoice.upload.badContentType=Seules les images sont autorisées.
pollen.error.poll.imageChoice.upload.required=Le choix d'une image est obligatoire.
pollen.error.poll.maxChoice.greater.than.0=Nombre de choix maximum doit être strictement supérieur à 0
pollen.error.poll.maxChoice.required=Nombre de choix maximum obligatoire
1
0
r3517 - in trunk: pollen-persistence/src/main/java/org/chorem/pollen pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll pollen-ui-struts2/src/main/resources/i18n
by tchemit@users.chorem.org 18 Jun '12
by tchemit@users.chorem.org 18 Jun '12
18 Jun '12
Author: tchemit
Date: 2012-06-18 18:59:38 +0200 (Mon, 18 Jun 2012)
New Revision: 3517
Url: http://chorem.org/repositories/revision/pollen/3517
Log:
refs #576 (NPE if no values) + improve validation for condorcet
Modified:
trunk/pollen-persistence/src/main/java/org/chorem/pollen/PollenFunctions.java
trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/VoteForPoll.java
trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties
trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties
Modified: trunk/pollen-persistence/src/main/java/org/chorem/pollen/PollenFunctions.java
===================================================================
--- trunk/pollen-persistence/src/main/java/org/chorem/pollen/PollenFunctions.java 2012-06-18 16:19:22 UTC (rev 3516)
+++ trunk/pollen-persistence/src/main/java/org/chorem/pollen/PollenFunctions.java 2012-06-18 16:59:38 UTC (rev 3517)
@@ -164,10 +164,12 @@
new VotingPersonDTO(input.getPollAccount().getVotingId(), input.getWeight());
result.setEmail(input.getPollAccount().getEmail());
- for (VoteToChoice vToChoice : input.getChoiceVoteToChoice()) {
- if (vToChoice != null && vToChoice.getChoice() != null) {
- VoteToChoiceDTO bean = VOTE_TO_CHOICE_TO_BEAN.apply(vToChoice);
- result.getChoices().add(bean);
+ if (!input.isChoiceVoteToChoiceEmpty()) {
+ for (VoteToChoice vToChoice : input.getChoiceVoteToChoice()) {
+ if (vToChoice != null && vToChoice.getChoice() != null) {
+ VoteToChoiceDTO bean = VOTE_TO_CHOICE_TO_BEAN.apply(vToChoice);
+ result.getChoices().add(bean);
+ }
}
}
return result;
@@ -185,7 +187,7 @@
}
};
- public static final Function<Map.Entry<Poll,PollAccount>,Pair<Poll,PollAccount>> MAP_ENTRY_TO_PAIR_FUNCTION = new Function<Map.Entry<Poll, PollAccount>, Pair<Poll, PollAccount>>() {
+ public static final Function<Map.Entry<Poll, PollAccount>, Pair<Poll, PollAccount>> MAP_ENTRY_TO_PAIR_FUNCTION = new Function<Map.Entry<Poll, PollAccount>, Pair<Poll, PollAccount>>() {
@Override
public Pair<Poll, PollAccount> apply(Map.Entry<Poll, PollAccount> input) {
return Pair.of(input.getKey(), input.getValue());
Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/VoteForPoll.java
===================================================================
--- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/VoteForPoll.java 2012-06-18 16:19:22 UTC (rev 3516)
+++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/VoteForPoll.java 2012-06-18 16:59:38 UTC (rev 3517)
@@ -65,12 +65,6 @@
addFlashMessage(_("pollen.information.pollNotStarted"));
} else if (isPollFinished()) {
addFlashMessage(_("pollen.information.pollFinished"));
- } else if (isCreatorUser()) {
-// if (getUriId().isAccountIdNotBlank()) {
-//
-// // account Id setted in url, so should not be abel to vote
-// addFlashWarning(_("pollen.information.vote.creatorUser"));
-// }
}
if (isPollChoiceRunning()) {
addFlashMessage(_("pollen.information.pollChoiceRunning"));
@@ -124,8 +118,8 @@
totalValues += value;
} else {
- // otherwise does not take account of this choice
- voteToChoice.setVoteValue(null);
+ addFieldError("vote.choices",
+ _("pollen.error.vote.invalidCondorcetVoteValue"));
}
// for other vote type, value must be > 0
} else if (value != 0) {
@@ -147,6 +141,7 @@
}
}
+ // @InputConfig(methodName = PREPARE_VOTE_PAGE)
@Override
public String execute() throws Exception {
Modified: trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties
===================================================================
--- trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-06-18 16:19:22 UTC (rev 3516)
+++ trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-06-18 16:59:38 UTC (rev 3517)
@@ -216,6 +216,7 @@
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.invalidCondorcetVoteValue=Invalid position\: in a condorcet vote, you can let empty values, or put values greater than zero.
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.choice.options=Choices
Modified: trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties
===================================================================
--- trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-06-18 16:19:22 UTC (rev 3516)
+++ trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-06-18 16:59:38 UTC (rev 3517)
@@ -216,6 +216,7 @@
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.invalidCondorcetVoteValue=Position invalide \: dans un vote condorcet, vous pouvez soit laisser laisser vide un choix, soit mettre une valeur strictement positive.
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.choice.options=Les choix
1
0
Author: tchemit
Date: 2012-06-18 18:19:22 +0200 (Mon, 18 Jun 2012)
New Revision: 3516
Url: http://chorem.org/repositories/revision/pollen/3516
Log:
- fixes #609: Review security access for administrator (should review it when using shiro permissions)
- continuous results have nothing to see with public results
- have same actions on results page than in vote-moderate page
- remove Dummy ChoiceHelper class (at last!)
- remove ResultLink action (at last!)
Removed:
trunk/pollen-services/src/main/java/org/chorem/pollen/bean/ChoiceHelper.java
trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ResultLink.java
Modified:
trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/SecurityService.java
trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenUIUtils.java
trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractPollForm.java
trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractVoteAction.java
trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AddChoice.java
trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AddComment.java
trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteComment.java
trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ModeratePoll.java
trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ResultForPoll.java
trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/SummaryPoll.java
trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/VoteForPoll.java
trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/security/PollCreatorAccessRequired.java
trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/security/PollResultAccessRequired.java
trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/security/PollVoteAccessRequired.java
trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties
trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/result.jsp
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp
trunk/pollen-ui-struts2/src/main/webapp/js/createPoll.js
trunk/src/site/rst/security.rst
Deleted: trunk/pollen-services/src/main/java/org/chorem/pollen/bean/ChoiceHelper.java
===================================================================
--- trunk/pollen-services/src/main/java/org/chorem/pollen/bean/ChoiceHelper.java 2012-06-18 14:16:41 UTC (rev 3515)
+++ trunk/pollen-services/src/main/java/org/chorem/pollen/bean/ChoiceHelper.java 2012-06-18 16:19:22 UTC (rev 3516)
@@ -1,106 +0,0 @@
-/*
- * #%L
- * Pollen :: Services
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2009 - 2012 CodeLutin, Tony Chemit
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-package org.chorem.pollen.bean;
-
-import com.google.common.collect.Iterables;
-import org.chorem.pollen.business.persistence.Choice;
-import org.chorem.pollen.common.ChoiceType;
-import org.chorem.pollen.services.PollenServiceFunctions;
-
-/**
- * Used to manage all objects from {@link Choice} inheritance tree depends
- * on {@link ChoiceType}.
- * <p/>
- * Created: 30/03/12
- *
- * @author fdesbois <desbois(a)codelutin.com>
- * @since 1.3
- * @deprecated will be removed soon a class form this is not required :(
- */
-@Deprecated
-public final class ChoiceHelper {
-
- private ChoiceHelper() {
- }
-
-// public static Object toValue(Choice choice, ChoiceType choiceType) {
-// Object result;
-// switch (choiceType) {
-// case DATE:
-// if (choice instanceof PollDateChoice) {
-// result = ((PollDateChoice) choice).getDate();
-// } else {
-// result = new Date(Long.parseLong(choice.getName()));
-// }
-// break;
-// case IMAGE:
-// if (choice instanceof PollImageChoice) {
-// result = ((PollImageChoice) choice).getLocation();
-// } else {
-// result = choice.getName();
-// }
-// break;
-// case TEXT:
-// default:
-// result = choice.getName();
-// }
-// return result;
-// }
-
-// public static Function<Choice, Object> toValue(final ChoiceType type) {
-// return new Function<Choice, Object>() {
-//
-// @Override
-// public Object apply(Choice input) {
-// return toValue(input, type);
-// }
-// };
-// }
-
-// public static Iterable<Object> toValues(Iterable<Choice> choices,
-// ChoiceType choiceType) {
-// return Iterables.transform(choices, toValue(choiceType));
-// }
-
- public static Iterable<String> toNames(Iterable<Choice> choices) {
- return Iterables.transform(choices,
- PollenServiceFunctions.CHOICE_TO_NAME);
- }
-
-// public static String getValuePropertyName(ChoiceType choiceType) {
-// String result;
-// switch (choiceType) {
-// case DATE:
-// result = PollDateChoice.PROPERTY_DATE;
-// break;
-// case IMAGE:
-// result = PollImageChoice.PROPERTY_LOCATION;
-// break;
-// case TEXT:
-// default:
-// result = Choice.PROPERTY_NAME;
-// }
-// return result;
-// }
-
-}
Modified: trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/SecurityService.java
===================================================================
--- trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/SecurityService.java 2012-06-18 14:16:41 UTC (rev 3515)
+++ trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/SecurityService.java 2012-06-18 16:19:22 UTC (rev 3516)
@@ -27,6 +27,7 @@
import org.apache.commons.lang3.StringUtils;
import org.chorem.pollen.PollenTechnicalException;
import org.chorem.pollen.bean.PollUri;
+import org.chorem.pollen.bean.PollUrl;
import org.chorem.pollen.business.persistence.Comment;
import org.chorem.pollen.business.persistence.Poll;
import org.chorem.pollen.business.persistence.PollAccount;
@@ -50,12 +51,12 @@
*/
public class SecurityService extends PollenServiceSupport {
- public boolean isPollCreator(Poll poll, PollUri uriId,
+ public boolean isPollCreator(Poll poll, String accountId,
UserAccount pollenUserAccount) {
PollAccount creator = poll.getCreator();
- boolean result = creator.getAccountId().equals(uriId.getAccountId());
+ boolean result = creator.getAccountId().equals(accountId);
if (!result) {
if (pollenUserAccount != null) {
@@ -67,7 +68,28 @@
return result;
}
+ public boolean isCanClosePoll(Poll poll, AccountIdRole accountIdRole) {
+ boolean result = !poll.isClosed();
+
+ if (result) {
+
+ // poll can be closed, check user can do action
+ result = accountIdRole == AccountIdRole.CREATOR;
+ }
+
+ return result;
+ }
+
+ public void removeAccountIdWhenConnected(PollUrl url,
+ UserAccount userAccount) {
+ if (userAccount != null) {
+
+ // remove accountId from url
+ url.getPollUri().setAccountId(null);
+ }
+ }
+
/**
* To define meaning of a accountId.
*
@@ -99,83 +121,6 @@
AccountIdRole.CREATOR
);
-// public void checkPoll(PollUri uri) throws PollNotFoundException {
-//
-// getExistingPoll(uri);
-// }
-
-// public void checkPollResult(PollUri uri) throws PollNotFoundException, UnauthorizedPollAccessException {
-//
-// Poll poll = getExistingPoll(uri);
-//
-// if (!poll.isPublicResults()) {
-// throw new UnauthorizedPollAccessException();
-// }
-// }
-
-// public void checkPollAccount(PollUri uri) throws PollNotFoundException, UnauthorizedPollAccessException {
-//
-//
-// String accountId = uri.getAccountId();
-//
-// Poll poll = getExistingPoll(uri);
-//
-// PollAccountDAO dao = getDAO(PollAccount.class);
-//
-// String pollId = uri.getPollId();
-//
-// if (poll.getPollType() == PollType.FREE) {
-//
-// // free poll
-// if (accountId != null) {
-//
-// // account Id is given check there is a such vote for this account
-//
-// try {
-//
-// if (!dao.existsByPollVoteAccountId(pollId, accountId)) {
-// throw new UnauthorizedPollAccessException();
-// }
-// } catch (TopiaException e) {
-// throw new PollenTechnicalException(
-// "Could not check pollAccount existence from poll '" +
-// pollId + "' and account '" + accountId + "'", e);
-// }
-// }
-// } else {
-//
-// // check that uri contains a correct poll account for this
-//
-// // Use PersonToList association entity to find coherence between
-// // the poll and votingId
-//
-// try {
-// PollAccount result =
-// dao.getRestrictedPollAccount(pollId, accountId);
-//
-// if (result == null) {
-// throw new UnauthorizedPollAccessException();
-// }
-// } catch (TopiaException e) {
-// throw new PollenTechnicalException(
-// "Could not obtain restricted pollAccount", e);
-// }
-// }
-// }
-
-// public void checkPollCreator(PollUri uri) throws PollNotFoundException, UnauthorizedPollAccessException {
-//
-// String accountId = uri.getAccountId();
-//
-// Poll poll = getExistingPoll(uri);
-//
-// String creatorId = poll.getCreator().getAccountId();
-//
-// if (!creatorId.equals(accountId)) {
-// throw new UnauthorizedPollAccessException();
-// }
-// }
-
public AccountIdRole getAccountIdRole(Poll poll, String accountId) {
Preconditions.checkNotNull(poll);
@@ -248,7 +193,9 @@
return null;
}
- public String isCanAccessVote(Poll poll, String accountId, AccountIdRole accountIdRole) {
+ public String isCanAccessVote(Poll poll,
+ String accountId,
+ AccountIdRole accountIdRole) {
if (AccountIdRole.CREATOR == accountIdRole) {
@@ -275,7 +222,6 @@
String accountId,
AccountIdRole accountIdRole) {
-
Date now = serviceContext.getCurrentTime();
if (!poll.isRunning(now)) {
Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenUIUtils.java
===================================================================
--- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenUIUtils.java 2012-06-18 14:16:41 UTC (rev 3515)
+++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenUIUtils.java 2012-06-18 16:19:22 UTC (rev 3516)
@@ -22,14 +22,10 @@
*/
package org.chorem.pollen.ui;
-import org.apache.struts2.ServletActionContext;
-import org.chorem.pollen.PollenTechnicalException;
+import org.chorem.pollen.services.impl.SecurityService;
import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.net.MalformedURLException;
-import java.net.URL;
+import javax.servlet.ServletRequest;
/**
* Useful ui methods.
@@ -42,6 +38,8 @@
/** Keep the servlet context */
private static ServletContext servletContext;
+ private static final String ACCOUNT_ID_ROLE = "accountIdRole";
+
public static ServletContext getServletContext() {
return servletContext;
}
@@ -50,39 +48,18 @@
PollenUIUtils.servletContext = servletContext;
}
- public static void redirect(String url) throws Exception {
-
- HttpServletResponse response = ServletActionContext.getResponse();
- HttpServletRequest request = ServletActionContext.getRequest();
-
- String path = request.getContextPath();
- if (!url.startsWith("/")) {
- path += "/";
- }
- response.sendRedirect(path + url);
+ public static void setAccountIdRole(ServletRequest request,
+ SecurityService.AccountIdRole accountIdRole) {
+ request.setAttribute(ACCOUNT_ID_ROLE, accountIdRole);
}
- public static URL getApplicationBase(HttpServletRequest request) {
-
- // get port
- String port;
- if ("http".equalsIgnoreCase(request.getScheme()) && request.getServerPort() != 80 ||
- "https".equalsIgnoreCase(request.getScheme()) && request.getServerPort() != 443) {
- port = ":" + request.getServerPort();
- } else {
- port = "";
- }
-
- String applicationBase = request.getScheme() + "://" + request.getServerName() +
- port + request.getContextPath();
- try {
- return new URL(applicationBase);
- } catch (MalformedURLException e) {
- throw new PollenTechnicalException(
- "Could not compute pollen url", e);
- }
+ public static SecurityService.AccountIdRole getAccountIdRole(ServletRequest request) {
+ SecurityService.AccountIdRole result = (SecurityService.AccountIdRole)
+ request.getAttribute(ACCOUNT_ID_ROLE);
+ return result;
}
protected PollenUIUtils() {
+ // helper can not be instanciated
}
}
Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractPollForm.java
===================================================================
--- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractPollForm.java 2012-06-18 14:16:41 UTC (rev 3515)
+++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractPollForm.java 2012-06-18 16:19:22 UTC (rev 3516)
@@ -459,12 +459,12 @@
poll.setMaxChoiceNb(0);
}
- if (!poll.isPublicResults()) {
+// if (!poll.isPublicResults()) {
+//
+// // force to not have continous results
+// poll.setContinuousResults(false);
+// }
- // force to not have continous results
- poll.setContinuousResults(false);
- }
-
if (poll.isAnonymous()) {
// force to not have choice to vote anonymously
Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractVoteAction.java
===================================================================
--- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractVoteAction.java 2012-06-18 14:16:41 UTC (rev 3515)
+++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractVoteAction.java 2012-06-18 16:19:22 UTC (rev 3516)
@@ -30,6 +30,7 @@
import org.apache.struts2.interceptor.ServletRequestAware;
import org.chorem.pollen.bean.PollResult;
import org.chorem.pollen.bean.PollResultList;
+import org.chorem.pollen.bean.PollUrl;
import org.chorem.pollen.business.persistence.Choice;
import org.chorem.pollen.business.persistence.Comment;
import org.chorem.pollen.business.persistence.Poll;
@@ -43,8 +44,8 @@
import org.chorem.pollen.services.exceptions.PollAccountNotFound;
import org.chorem.pollen.services.exceptions.PollNotFoundException;
import org.chorem.pollen.services.impl.SecurityService;
+import org.chorem.pollen.ui.PollenUIUtils;
import org.chorem.pollen.ui.actions.PageSkin;
-import org.chorem.pollen.ui.security.PollVoteAccessRequired;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
@@ -65,6 +66,8 @@
/** Logger. */
private static final Log log = LogFactory.getLog(AbstractVoteAction.class);
+ public static final String PREPARE_VOTE_PAGE = "prepareVotePage";
+
/**
* Loaded poll.
*
@@ -73,7 +76,7 @@
private Poll poll;
/**
- * Is feed existfor this poll ?
+ * Is feed exists for this poll ?
*
* @since 1.3
*/
@@ -93,17 +96,21 @@
*/
private PollAccount pollAccount;
- //TODO-thcemit-2012-06-03 Do we use this ? nobody set it... so always false
- private boolean alreadyVoted;
-
/**
- * Is votr allowed for current user?
+ * Is vote allowed for current user?
*
* @since 1.3
*/
private boolean voteAllowed;
/**
+ * Is current user can go to results.
+ *
+ * @since 1.4
+ */
+ private boolean resultAllowed;
+
+ /**
* All votes for the poll.
*
* @since 1.3
@@ -159,6 +166,11 @@
*/
private transient HttpServletRequest request;
+ /**
+ * @return {@code true} if moderation is possible, {@code false} otherwise
+ * @since 1.4
+ */
+ public abstract boolean isModerate();
@Override
public PageSkin getSkin() {
@@ -179,10 +191,6 @@
return poll;
}
- public boolean isFeedFileExisting() {
- return feedFileExisting;
- }
-
public PollAccount getPollAccount() {
return pollAccount;
}
@@ -195,27 +203,57 @@
return vote;
}
- public boolean isPollChoiceOrVoteStarted() {
- Date now = serviceContext.getCurrentTime();
- return poll.isAddChoiceStarted(now) || poll.isStarted(now);
+ public List<PollResult> getResults() {
+ return results;
}
- public boolean isAlreadyVoted() {
- return alreadyVoted;
+ public List<Comment> getComments() {
+ return comments;
}
- public boolean isAnonymousVote() {
- return poll.isAnonymous();
+ public String getCreatorName() {
+ return poll.getCreator().getVotingId();
}
- public List<PollResult> getResults() {
- return results;
+ public String getVoteSizeMessage() {
+ return _("pollen.common.voteNbVotes", getPoll().sizeVote());
}
- public List<Comment> getComments() {
- return comments;
+ public String getCommentAuthor() {
+ if (commentAuthor == null) {
+
+ UserAccount user = getPollenUserAccount();
+ if (user == null) {
+
+ // Use current pollAccount name for comment
+ commentAuthor = getPollAccount().getVotingId();
+
+ } else {
+
+ // Connecter user name
+ commentAuthor = user.getDisplayName();
+ }
+ }
+ return commentAuthor;
}
+ public String getSummaryUrl() {
+ PollUrl url = getPollUrlService().getPollSummaryUrl(poll);
+ getSecurityService().removeAccountIdWhenConnected(url, getPollenUserAccount());
+ return url.getUrl();
+ }
+
+ public String getResultUrl() {
+ PollUrl url = getPollUrlService().getPollResultUrl(poll);
+ url.getPollUri().setAccountId(getAccountId());
+ getSecurityService().removeAccountIdWhenConnected(url, getPollenUserAccount());
+ return url.getUrl();
+ }
+
+ public boolean isFeedFileExisting() {
+ return feedFileExisting;
+ }
+
public boolean isCreatorUser() {
return creatorUser;
}
@@ -224,17 +262,28 @@
return !poll.isAnonymous() || isRestrictedPoll() || isGroupPoll();
}
+ public boolean isPollChoiceOrVoteStarted() {
+ Date now = serviceContext.getCurrentTime();
+ return poll.isAddChoiceStarted(now) || poll.isStarted(now);
+ }
+
+ public boolean isAnonymousVote() {
+ return poll.isAnonymous();
+ }
+
public boolean isPollChoiceRunning() {
Date now = serviceContext.getCurrentTime();
return poll.isAddChoiceRunning(now);
}
- public String getCreatorName() {
- return poll.getCreator().getVotingId();
+ public boolean isPollStarted() {
+ Date now = serviceContext.getCurrentTime();
+ return poll.getBeginDate() == null || poll.getBeginDate().before(now);
}
- public String getVoteSizeMessage() {
- return _("pollen.common.voteNbVotes", getPoll().sizeVote());
+ public boolean isPollFinished() {
+ Date now = serviceContext.getCurrentTime();
+ return poll.getEndDate() != null && poll.getEndDate().before(now);
}
public boolean isDescNull(Choice choice) {
@@ -281,80 +330,37 @@
return poll.getVoteCountingType() == VoteCountingType.NUMBER;
}
- public boolean isPollStarted() {
- Date now = serviceContext.getCurrentTime();
- return poll.getBeginDate() == null || poll.getBeginDate().before(now);
+ public boolean isVoteAllowed() {
+ return voteAllowed;
}
- public boolean isPollFinished() {
- Date now = serviceContext.getCurrentTime();
- return poll.getEndDate() != null && poll.getEndDate().before(now);
+ public boolean isResultAllowed() {
+ return resultAllowed;
}
- public String getCommentAuthor() {
- if (commentAuthor == null) {
-
- UserAccount user = getPollenUserAccount();
- if (user == null) {
-
- // Use current pollAccount name for comment
- commentAuthor = getPollAccount().getVotingId();
-
- } else {
-
- // Connecter user name
- commentAuthor = user.getDisplayName();
- }
- }
- return commentAuthor;
+ public boolean isModifyVoteAllowed(Vote vote) {
+ return getSecurityService().isCanModifyVote(
+ getPoll(),
+ vote.getTopiaId(),
+ getAccountId(),
+ getPollenUserAccount());
}
- public void setCommentAuthor(String commentAuthor) {
- this.commentAuthor = commentAuthor;
+ public boolean isDeleteCommentAllowed(Comment comment) {
+ return getSecurityService().isCanDeleteComment(
+ comment,
+ getUriId().getAccountId(),
+ accountIdRole,
+ getPollenUserAccount());
}
- protected String prepareVotePage(boolean moderate) throws Exception {
-
- loadPoll();
-
- // Current poll account
- loadPollAccount();
-
- // All votes
- // TODO no pagination for the moment, need to retrieve the correct page depends on current pollAccount
- votes = getVoteService().getAllVotes(poll);
-
- accountIdRole = (SecurityService.AccountIdRole)
- request.getAttribute(PollVoteAccessRequired.ACCOUNT_ID_ROLE);
-
- voteAllowed = !moderate &&
- getSecurityService().isCanVote(poll,
- getAccountId(),
- accountIdRole);
-
- // Current vote
- if (voteAllowed) {
- vote = getVoteService().getVoteEditable(poll, pollAccount);
- }
-
- loadPollResults();
- loadPollComments();
-
- feedFileExisting = getPollFeedService().isFeedExists(poll);
-
- creatorUser = getSecurityService().isPollCreator(poll,
- getUriId(),
- getPollenUserAccount());
-
- if (log.isInfoEnabled()) {
- Date now = serviceContext.getCurrentTime();
- log.info("pollChoiceOrVoteStarted = " + isPollChoiceOrVoteStarted());
- log.info("pollChoiceRunning = " + isPollChoiceRunning());
- log.info("pollRunning = " + poll.isRunning(now));
- log.info("accountFieldDisplayed = " + isAccountFieldDisplayed());
- log.info("creatorUser = " + creatorUser);
- }
- return INPUT;
+ public boolean isDeleteVoteAllowed(Vote vote) {
+ return getSecurityService().isCanDeleteVote(
+ getPoll(),
+ vote.getTopiaId(),
+ getUriId().getAccountId(),
+ accountIdRole,
+ getPollenUserAccount());
}
public String getResultValue(Choice choice) {
@@ -390,45 +396,93 @@
return result;
}
- public boolean isModifyVoteAllowed(Vote vote) {
- return getSecurityService().isCanModifyVote(
- getPoll(),
- vote.getTopiaId(),
- getAccountId(),
- getPollenUserAccount());
+ public Date getChoiceAsDate(Choice choice) {
+ return new Date(Long.valueOf(choice.getName()));
}
- public boolean isVoteAllowed() {
- return voteAllowed;
+ public void setCommentAuthor(String commentAuthor) {
+ this.commentAuthor = commentAuthor;
}
- public boolean isDeleteCommentAllowed(Comment comment) {
- return getSecurityService().isCanDeleteComment(
- comment,
- getUriId().getAccountId(),
- accountIdRole,
- getPollenUserAccount());
- }
+ public String prepareVotePage() throws Exception {
- public boolean isDeleteVoteAllowed(Vote vote) {
- return getSecurityService().isCanDeleteVote(
- getPoll(),
- vote.getTopiaId(),
- getUriId().getAccountId(),
- accountIdRole,
- getPollenUserAccount());
-// // can delete a vote if admin or poll creator
-// return isUserAdmin() || isCreatorUser();
+ boolean moderate = isModerate();
+
+ loadPoll();
+
+ // Current poll account
+ loadPollAccount();
+
+ // All votes
+ // TODO no pagination for the moment, need to retrieve the correct page depends on current pollAccount
+ votes = getVoteService().getAllVotes(poll);
+
+ accountIdRole = PollenUIUtils.getAccountIdRole(request);
+
+ // is vote allowed ?
+ if (moderate) {
+ voteAllowed = false;
+ } else {
+ String accountId = getAccountId();
+ if (accountIdRole == SecurityService.AccountIdRole.CREATOR) {
+
+ // remove accountId (can vote even if creator ?)
+ accountId = null;
+ }
+ voteAllowed = getSecurityService().isCanVote(poll,
+ null,
+ accountIdRole);
+ }
+
+ // is can display result link ?
+ resultAllowed =
+ getSecurityService().isCanAccessResult(poll, accountIdRole)
+ == null;
+
+ if (voteAllowed) {
+
+ // load modifiable vote
+ vote = getVoteService().getVoteEditable(poll, pollAccount);
+ }
+
+ // load poll results
+ PollResultList pollResultList =
+ getPollResultsService().getResults(poll);
+
+ results = pollResultList.getPollResults();
+
+ if (log.isDebugEnabled()) {
+ for (PollResult res : results) {
+ log.debug(res.getName() + ": " + res.getValue()
+ + ", (voteCounting=" + res.getVoteCountingType()
+ + ", byGroup=" + res.isByGroup() + ")");
+ }
+ }
+
+ // load comments
+ comments = getPollCommentService().getAllComments(poll.getPollId());
+
+ feedFileExisting = getPollFeedService().isFeedExists(poll);
+
+ creatorUser = getSecurityService().isPollCreator(poll,
+ getAccountId(),
+ getPollenUserAccount());
+
+ if (log.isInfoEnabled()) {
+ Date now = serviceContext.getCurrentTime();
+ log.info("pollChoiceOrVoteStarted = " + isPollChoiceOrVoteStarted());
+ log.info("pollChoiceRunning = " + isPollChoiceRunning());
+ log.info("pollRunning = " + poll.isRunning(now));
+ log.info("accountFieldDisplayed = " + isAccountFieldDisplayed());
+ log.info("creatorUser = " + creatorUser);
+ }
+ return INPUT;
}
public String escapeLineBreak(String text) {
return text;
}
- public Date getChoiceAsDate(Choice choice) {
- return new Date(Long.valueOf(choice.getName()));
- }
-
protected void loadPollAccount() throws PollAccountNotFound {
// Current poll account
@@ -453,24 +507,4 @@
}
}
- protected void loadPollComments() {
-
- comments = getPollCommentService().getAllComments(poll.getPollId());
- }
-
- protected void loadPollResults() throws PollNotFoundException {
-
- PollResultList pollResultList =
- getPollResultsService().getResults(poll);
-
- results = pollResultList.getPollResults();
-
- if (log.isDebugEnabled()) {
- for (PollResult res : results) {
- log.debug(res.getName() + ": " + res.getValue()
- + ", (voteCounting=" + res.getVoteCountingType()
- + ", byGroup=" + res.isByGroup() + ")");
- }
- }
- }
}
Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AddChoice.java
===================================================================
--- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AddChoice.java 2012-06-18 14:16:41 UTC (rev 3515)
+++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AddChoice.java 2012-06-18 16:19:22 UTC (rev 3516)
@@ -22,11 +22,9 @@
*/
package org.chorem.pollen.ui.actions.poll;
-import com.google.common.collect.Iterables;
import com.opensymphony.xwork2.Preparable;
import com.opensymphony.xwork2.interceptor.annotations.InputConfig;
import org.apache.commons.lang3.StringUtils;
-import org.chorem.pollen.bean.ChoiceHelper;
import org.chorem.pollen.bean.PollImageChoice;
import org.chorem.pollen.business.persistence.Choice;
import org.chorem.pollen.common.ChoiceType;
@@ -74,6 +72,11 @@
}
@Override
+ public boolean isModerate() {
+ return false;
+ }
+
+ @Override
public void prepare() throws PollNotFoundException {
loadPoll();
@@ -107,24 +110,23 @@
_("pollen.error.choice.empty", typeLabel));
} else {
- //TODO-tchemit-2012-06-16 Remove this code and perfomr a real validation (name not empty, name not duplicated)
- // Retrieve existing values to check if the new choice not already exists
- Iterable<String> pollChoiceValues = ChoiceHelper.toNames(
- getPoll().getChoice());
+ if (!getPoll().isChoiceEmpty()) {
- // -- Validate value notExists
- if (Iterables.contains(pollChoiceValues, choiceName)) {
- addFieldError("choice." + propName,
- _("pollen.error.poll.detected.duplicate.choice.name"));
+ // check that the choice is not already used
+
+ for (Choice pollChoice : getPoll().getChoice()) {
+ String pollChoiceName = pollChoice.getName();
+ if (pollChoiceName.equals(choiceName)) {
+ addFieldError("choice." + propName,
+ _("pollen.error.poll.choice.already.used.name"));
+ break;
+ }
+ }
}
}
}
- public String prepareVotePage() throws Exception {
- return prepareVotePage(false);
- }
-
- @InputConfig(methodName = "prepareVotePage")
+ @InputConfig(methodName = PREPARE_VOTE_PAGE)
@Override
public String execute() throws Exception {
Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AddComment.java
===================================================================
--- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AddComment.java 2012-06-18 14:16:41 UTC (rev 3515)
+++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AddComment.java 2012-06-18 16:19:22 UTC (rev 3516)
@@ -53,6 +53,11 @@
}
@Override
+ public boolean isModerate() {
+ return false;
+ }
+
+ @Override
public void prepare() throws Exception {
loadPoll();
@@ -71,7 +76,7 @@
}
}
- @InputConfig(methodName = "prepareVotePage")
+ @InputConfig(methodName = PREPARE_VOTE_PAGE)
@Override
public String execute() throws Exception {
Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteComment.java
===================================================================
--- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteComment.java 2012-06-18 14:16:41 UTC (rev 3515)
+++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/DeleteComment.java 2012-06-18 16:19:22 UTC (rev 3516)
@@ -58,8 +58,13 @@
this.reason = reason;
}
- @InputConfig(methodName = "prepareVotePage")
@Override
+ public boolean isModerate() {
+ return false;
+ }
+
+ @InputConfig(methodName = PREPARE_VOTE_PAGE)
+ @Override
public String execute() throws Exception {
Preconditions.checkNotNull(getPollId());
Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ModeratePoll.java
===================================================================
--- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ModeratePoll.java 2012-06-18 14:16:41 UTC (rev 3515)
+++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ModeratePoll.java 2012-06-18 16:19:22 UTC (rev 3516)
@@ -35,9 +35,14 @@
@Override
public String input() throws Exception {
- prepareVotePage(true);
+ prepareVotePage();
addFlashWarning(_("pollen.information.moderate.page"));
return INPUT;
}
+
+ @Override
+ public boolean isModerate() {
+ return true;
+ }
}
Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ResultForPoll.java
===================================================================
--- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ResultForPoll.java 2012-06-18 14:16:41 UTC (rev 3515)
+++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ResultForPoll.java 2012-06-18 16:19:22 UTC (rev 3516)
@@ -36,6 +36,7 @@
import org.apache.struts2.views.util.UrlHelper;
import org.chorem.pollen.bean.PollResult;
import org.chorem.pollen.bean.PollResultList;
+import org.chorem.pollen.bean.PollUrl;
import org.chorem.pollen.business.persistence.Poll;
import org.chorem.pollen.common.ChoiceType;
import org.chorem.pollen.common.PollType;
@@ -82,13 +83,20 @@
private boolean userAllowed;
/**
- * Is user is poll(s creator ?
+ * Is user is poll's creator ?
*
* @since 1.4
*/
private boolean creatorUser;
/**
+ * Is feed exists for this poll ?
+ *
+ * @since 1.4
+ */
+ private boolean feedFileExisting;
+
+ /**
* Résultats du sondage.
* <p/>
* La map est indexée par les noms de choix.
@@ -150,6 +158,29 @@
return creatorUser;
}
+ public boolean isFeedFileExisting() {
+ return feedFileExisting;
+ }
+
+ public String getSummaryUrl() {
+ PollUrl url = getPollUrlService().getPollSummaryUrl(poll);
+ url.getPollUri().setAccountId(getAccountId());
+ getSecurityService().removeAccountIdWhenConnected(url, getPollenUserAccount());
+ return url.getUrl();
+ }
+
+ public String getVoteUrl() {
+ PollUrl url = getPollUrlService().getPollVoteUrl(poll);
+ url.getPollUri().setAccountId(getAccountId());
+ if (poll.getPollType() == PollType.FREE) {
+
+ // can removed accountId only for free poll
+ //FIXME Should found out in ohter case the accountId (if exists for the connected id) if no accountId is given
+ getSecurityService().removeAccountIdWhenConnected(url, getPollenUserAccount());
+ }
+ return url.getUrl();
+ }
+
public List<PollResult> getResults() {
return results;
}
@@ -206,6 +237,8 @@
poll = getPollService().getExistingPollByPollId(pollId);
+ feedFileExisting = getPollFeedService().isFeedExists(poll);
+
if (byGroup == null) {
// default byGroup value
Deleted: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ResultLink.java
===================================================================
--- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ResultLink.java 2012-06-18 14:16:41 UTC (rev 3515)
+++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/ResultLink.java 2012-06-18 16:19:22 UTC (rev 3516)
@@ -1,68 +0,0 @@
-/*
- * #%L
- * Pollen :: UI (struts2)
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2009 - 2012 CodeLutin, Tony Chemit
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-package org.chorem.pollen.ui.actions.poll;
-
-import com.google.common.base.Preconditions;
-import org.chorem.pollen.business.persistence.Poll;
-import org.chorem.pollen.ui.actions.PageSkin;
-
-/**
- * Display the result link page.
- *
- * @author fdesbois <desbois(a)codelutin.com>
- * @since 1.3
- */
-public class ResultLink extends AbstractPollUriIdAction {
-
- private static final long serialVersionUID = 1L;
-
- protected Poll poll;
-
- protected String pollResultUrl;
-
- @Override
- public PageSkin getSkin() {
- return PageSkin.EDITION;
- }
-
- public Poll getPoll() {
- return poll;
- }
-
- public String getPollResultUrl() {
- return pollResultUrl;
- }
-
- @Override
- public String execute() throws Exception {
-
- String pollUid = getPollId();
- Preconditions.checkNotNull(pollUid);
-
- poll = getPollService().getExistingPollByPollId(pollUid);
-
- pollResultUrl = getPollUrlService().getPollResultUrl(poll).getUrl();
-
- return SUCCESS;
- }
-}
Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/SummaryPoll.java
===================================================================
--- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/SummaryPoll.java 2012-06-18 14:16:41 UTC (rev 3515)
+++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/SummaryPoll.java 2012-06-18 16:19:22 UTC (rev 3516)
@@ -23,18 +23,23 @@
package org.chorem.pollen.ui.actions.poll;
import com.google.common.base.Preconditions;
+import org.apache.struts2.interceptor.ServletRequestAware;
+import org.chorem.pollen.bean.PollUrl;
import org.chorem.pollen.business.persistence.Poll;
import org.chorem.pollen.common.PollType;
import org.chorem.pollen.services.impl.SecurityService;
+import org.chorem.pollen.ui.PollenUIUtils;
import org.chorem.pollen.ui.actions.PageSkin;
+import javax.servlet.http.HttpServletRequest;
+
/**
* Action to display summary of a poll for his creator (or an admin).
*
* @author tchemit <chemit(a)codelutin.com>
* @since 1.4
*/
-public class SummaryPoll extends AbstractPollUriIdAction {
+public class SummaryPoll extends AbstractPollUriIdAction implements ServletRequestAware {
private static final long serialVersionUID = 1L;
@@ -45,8 +50,23 @@
*/
private Poll poll;
- public Poll getPoll() {
- return poll;
+ /**
+ * The accountId role on this page.
+ *
+ * @since 1.4
+ */
+ private SecurityService.AccountIdRole accountIdRole;
+
+ /**
+ * The incoming request (some stuff are store in it from security filters).
+ *
+ * @since 1.4
+ */
+ private transient HttpServletRequest request;
+
+ @Override
+ public void setServletRequest(HttpServletRequest request) {
+ this.request = request;
}
@Override
@@ -54,55 +74,69 @@
return PageSkin.EDITION;
}
+ public Poll getPoll() {
+ return poll;
+ }
+
public String getVoteUrl() {
- return getPollUrlService().getPollVoteUrl(poll).getUrl();
+ PollUrl url = getPollUrlService().getPollVoteUrl(poll);
+ if (poll.getPollType() == PollType.FREE) {
+
+ // can removed accountId only for free poll
+ //FIXME Should found out in ohter case the accountId (if exists for the connected id) if no accountId is given
+ getSecurityService().removeAccountIdWhenConnected(url, getPollenUserAccount());
+ }
+ return url.getUrl();
}
public String getModerateUrl() {
- return getPollUrlService().getPollModerateUrl(poll).getUrl();
+ PollUrl url = getPollUrlService().getPollModerateUrl(poll);
+ getSecurityService().removeAccountIdWhenConnected(url, getPollenUserAccount());
+ return url.getUrl();
}
public String getEditUrl() {
- return getPollUrlService().getPollEditUrl(poll).getUrl();
+ PollUrl url = getPollUrlService().getPollEditUrl(poll);
+ getSecurityService().removeAccountIdWhenConnected(url, getPollenUserAccount());
+ return url.getUrl();
}
public String getCloneUrl() {
- return getPollUrlService().getPollCloneUrl(poll).getUrl();
+ PollUrl url = getPollUrlService().getPollCloneUrl(poll);
+ getSecurityService().removeAccountIdWhenConnected(url, getPollenUserAccount());
+ return url.getUrl();
}
public String getExportUrl() {
- return getPollUrlService().getPollExportUrl(poll).getUrl();
+ PollUrl url = getPollUrlService().getPollExportUrl(poll);
+ getSecurityService().removeAccountIdWhenConnected(url, getPollenUserAccount());
+ return url.getUrl();
}
public String getResultUrl() {
- return getPollUrlService().getPollResultUrl(poll).getUrl();
+ PollUrl url = getPollUrlService().getPollResultUrl(poll);
+ getSecurityService().removeAccountIdWhenConnected(url, getPollenUserAccount());
+ return url.getUrl();
}
public boolean isCanClose() {
- return !poll.isClosed();
+ return getSecurityService().isCanClosePoll(poll, accountIdRole);
}
public boolean isCanShowResult() {
String errorMessage = getSecurityService().isCanAccessResult(
- poll, SecurityService.AccountIdRole.CREATOR);
+ poll, accountIdRole);
return errorMessage == null;
}
public boolean isCanVote() {
- //FIXME-tchemit-2012-06-05 Should check that creator can vote instead
- PollType pollType = poll.getPollType();
- return pollType == PollType.FREE;
-
-// boolean result;
-// try {
-// getSecurityService().checkPollAccount(getUriId());
-// result = true;
-// } catch (PollNotFoundException e) {
-// result = false;
-// } catch (UnauthorizedPollAccessException e) {
-// result = false;
-// }
-// return result;
+ String accountId = getAccountId();
+ if (accountIdRole == SecurityService.AccountIdRole.CREATOR) {
+ accountId = null;
+ }
+ return getSecurityService().isCanVote(poll,
+ accountId,
+ accountIdRole);
}
@Override
@@ -114,6 +148,8 @@
poll = getPollService().getExistingPollByPollId(pollId);
+ accountIdRole = PollenUIUtils.getAccountIdRole(request);
+
return SUCCESS;
}
}
Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/VoteForPoll.java
===================================================================
--- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/VoteForPoll.java 2012-06-18 14:16:41 UTC (rev 3515)
+++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/VoteForPoll.java 2012-06-18 16:19:22 UTC (rev 3516)
@@ -49,9 +49,14 @@
private static final long serialVersionUID = 1L;
@Override
+ public boolean isModerate() {
+ return false;
+ }
+
+ @Override
public void prepare() throws Exception {
- prepareVotePage(false);
+ prepareVotePage();
// Messages
if (getPoll().isClosed()) {
@@ -61,11 +66,11 @@
} else if (isPollFinished()) {
addFlashMessage(_("pollen.information.pollFinished"));
} else if (isCreatorUser()) {
- if (getUriId().isAccountIdNotBlank()) {
-
- // account Id setted in url, so should not be abel to vote
- addFlashWarning(_("pollen.information.vote.creatorUser"));
- }
+// if (getUriId().isAccountIdNotBlank()) {
+//
+// // account Id setted in url, so should not be abel to vote
+// addFlashWarning(_("pollen.information.vote.creatorUser"));
+// }
}
if (isPollChoiceRunning()) {
addFlashMessage(_("pollen.information.pollChoiceRunning"));
Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/security/PollCreatorAccessRequired.java
===================================================================
--- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/security/PollCreatorAccessRequired.java 2012-06-18 14:16:41 UTC (rev 3515)
+++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/security/PollCreatorAccessRequired.java 2012-06-18 16:19:22 UTC (rev 3516)
@@ -27,6 +27,7 @@
import org.chorem.pollen.business.persistence.UserAccount;
import org.chorem.pollen.services.PollenServiceContext;
import org.chorem.pollen.services.impl.SecurityService;
+import org.chorem.pollen.ui.PollenUIUtils;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
@@ -129,8 +130,7 @@
if (isAccessAllowed) {
// store accountIdRole in request
- request.setAttribute(PollVoteAccessRequired.ACCOUNT_ID_ROLE,
- accountIdRole);
+ PollenUIUtils.setAccountIdRole(request, accountIdRole);
}
return isAccessAllowed;
Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/security/PollResultAccessRequired.java
===================================================================
--- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/security/PollResultAccessRequired.java 2012-06-18 14:16:41 UTC (rev 3515)
+++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/security/PollResultAccessRequired.java 2012-06-18 16:19:22 UTC (rev 3516)
@@ -26,6 +26,7 @@
import org.chorem.pollen.business.persistence.Poll;
import org.chorem.pollen.services.PollenServiceContext;
import org.chorem.pollen.services.impl.SecurityService;
+import org.chorem.pollen.ui.PollenUIUtils;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
@@ -121,8 +122,7 @@
if (isAccessAllowed) {
// store accountIdRole in request
- request.setAttribute(PollVoteAccessRequired.ACCOUNT_ID_ROLE,
- accountIdRole);
+ PollenUIUtils.setAccountIdRole(request, accountIdRole);
}
return isAccessAllowed;
}
Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/security/PollVoteAccessRequired.java
===================================================================
--- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/security/PollVoteAccessRequired.java 2012-06-18 14:16:41 UTC (rev 3515)
+++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/security/PollVoteAccessRequired.java 2012-06-18 16:19:22 UTC (rev 3516)
@@ -26,6 +26,7 @@
import org.chorem.pollen.business.persistence.Poll;
import org.chorem.pollen.services.PollenServiceContext;
import org.chorem.pollen.services.impl.SecurityService;
+import org.chorem.pollen.ui.PollenUIUtils;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
@@ -40,8 +41,6 @@
*/
public class PollVoteAccessRequired extends AbstractPollenAuthorization {
- public static final String ACCOUNT_ID_ROLE = "accountIdRole";
-
protected final AdminUserRequired adminFilter;
public PollVoteAccessRequired() {
@@ -121,7 +120,7 @@
if (isAccessAllowed) {
// store accountIdRole in request
- request.setAttribute(ACCOUNT_ID_ROLE, accountIdRole);
+ PollenUIUtils.setAccountIdRole(request, accountIdRole);
}
return isAccessAllowed;
Modified: trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties
===================================================================
--- trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-06-18 14:16:41 UTC (rev 3515)
+++ trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-06-18 16:19:22 UTC (rev 3516)
@@ -32,6 +32,7 @@
pollen.action.importPersonListToExistingVotingList=Add selected voting list
pollen.action.importPersonListToNewVotingList=Create a new group from the selected voting list
pollen.action.login=Log me In
+pollen.action.moderatePoll=Moderate the poll
pollen.action.modify=Modify
pollen.action.pollChoiceDelete=Delete this choice
pollen.action.pollChoiceDown=Down this choice
Modified: trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties
===================================================================
--- trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-06-18 14:16:41 UTC (rev 3515)
+++ trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-06-18 16:19:22 UTC (rev 3516)
@@ -32,6 +32,7 @@
pollen.action.importPersonListToExistingVotingList=Ajouter la liste sélectionnée de votants
pollen.action.importPersonListToNewVotingList=Créer un groupe à partir de la liste sélectionnée
pollen.action.login=M'identifier
+pollen.action.moderatePoll=Modérer le sondage
pollen.action.modify=Modifier
pollen.action.pollChoiceDelete=Supprimer ce choix
pollen.action.pollChoiceDown=Descendre ce choix
Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/result.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/result.jsp 2012-06-18 14:16:41 UTC (rev 3515)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/result.jsp 2012-06-18 16:19:22 UTC (rev 3516)
@@ -80,17 +80,23 @@
<legend><s:text name="pollen.common.aboutPoll"/></legend>
<div style="float: right">
<s:if test="creatorUser or userAdmin">
- <s:a namespace="/poll" action="summary/%{uriId}">
+ <s:a href="%{summaryUrl}">
<img src="<s:url value='/img/editSmall.png'/>"
- title="<s:text name='pollen.action.editPoll'/>"
- alt="<s:text name='pollen.action.editPoll'/>"/>
+ title="<s:text name='pollen.action.summaryPoll'/>"
+ alt="<s:text name='pollen.action.summaryPoll'/>"/>
</s:a>
</s:if>
- <s:a namespace="/poll" action="votefor/%{uriId}">
+ <s:a href='%{voteUrl}'>
<img src="<s:url value='/img/vote.png'/>"
title="<s:text name="pollen.common.vote.return-help"/>"
alt="<s:text name="pollen.common.vote.return"/>"/>
</s:a>
+ <s:if test="feedFileExisting">
+ <s:a namespace="/poll" action="getFeed">
+ <s:param name="pollId" value="poll.pollId"/>
+ <img src="<s:url value='/img/feed.png'/>" title="Atom" alt="Atom"/>
+ </s:a>
+ </s:if>
</div>
<s:label value="%{poll.creator.votingId}"
key='pollen.common.pollCreator'/>
Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp 2012-06-18 14:16:41 UTC (rev 3515)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp 2012-06-18 16:19:22 UTC (rev 3516)
@@ -124,14 +124,14 @@
<legend><s:text name="pollen.common.aboutPoll"/></legend>
<div style="float: right">
<s:if test="creatorUser or userAdmin">
- <s:a namespace="/poll" action="summary/%{uriId}">
+ <s:a href="%{summaryUrl}">
<img src="<s:url value='/img/editSmall.png'/>"
title="<s:text name='pollen.action.summaryPoll'/>"
alt="<s:text name='pollen.action.summaryPoll'/>"/>
</s:a>
</s:if>
- <s:if test="poll.publicResults">
- <s:a namespace="/poll" action="results/%{uriId}">
+ <s:if test="resultAllowed">
+ <s:a href="%{resultUrl}">
<img src="<s:url value='/img/count.png'/>"
title="<s:text name='pollen.common.vote.results-help'/>"
alt="<s:text name='pollen.common.vote.results'/>"/>
@@ -405,10 +405,10 @@
</tr>
</s:iterator>
</s:if>
-<s:if test="poll.continuousResults">
+<s:if test="resultAllowed">
<tr>
<td>
- <s:a namespace="/poll" action="results/%{poll.pollId}">
+ <s:a href='%{resultUrl}'>
<s:text name="pollen.common.vote.results"/>
</s:a>
</td>
Modified: trunk/pollen-ui-struts2/src/main/webapp/js/createPoll.js
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/js/createPoll.js 2012-06-18 14:16:41 UTC (rev 3515)
+++ trunk/pollen-ui-struts2/src/main/webapp/js/createPoll.js 2012-06-18 16:19:22 UTC (rev 3516)
@@ -581,10 +581,6 @@
$('[name="reminderHourCountdown"]').attr('disabled', !val);
}
- function changePublicOption(val) {
- $('[name="poll.continuousResults"]').attr('disabled', !val);
- }
-
function changeAnonymousOption(val) {
$('[name="poll.anonymousVoteAllowed"]').attr('disabled', val);
}
@@ -630,9 +626,6 @@
changeChoiceAddAllowed($(this).prop('checked'));
});
- $('[name="poll.publicResults"]').change(function () {
- changePublicOption($(this).prop('checked'));
- });
$('[name="poll.anonymous"]').change(function () {
changeAnonymousOption($(this).prop('checked'));
});
@@ -667,7 +660,6 @@
changeChoiceAddAllowed(datas['choiceAddAllowed'] == 'true');
changeLimitChoice(datas['limitChoice'] == 'true');
changeReminder(datas['reminder'] == 'true');
- changePublicOption(datas['publicOption'] == 'true');
changeAnonymousOption(datas['anonymousOption'] == 'true');
changeChoiceType(datas['choiceType']);
Modified: trunk/src/site/rst/security.rst
===================================================================
--- trunk/src/site/rst/security.rst 2012-06-18 14:16:41 UTC (rev 3515)
+++ trunk/src/site/rst/security.rst 2012-06-18 16:19:22 UTC (rev 3516)
@@ -105,6 +105,7 @@
- poll:create
- poll:modify
+- poll:accesVote
- poll:vote
- poll:close
- poll:delete
1
0
r3515 - trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its
by ymartel@users.chorem.org 18 Jun '12
by ymartel@users.chorem.org 18 Jun '12
18 Jun '12
Author: ymartel
Date: 2012-06-18 16:16:41 +0200 (Mon, 18 Jun 2012)
New Revision: 3515
Url: http://chorem.org/repositories/revision/pollen/3515
Log:
refs #606 : add ITs for text poll with groups
Added:
trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/CreateTextPollForGroupSIT.java
Modified:
trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/CreateRestrictedTextPollSIT.java
trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/PollenBaseWebDriverIT.java
Modified: trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/CreateRestrictedTextPollSIT.java
===================================================================
--- trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/CreateRestrictedTextPollSIT.java 2012-06-18 12:44:50 UTC (rev 3514)
+++ trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/CreateRestrictedTextPollSIT.java 2012-06-18 14:16:41 UTC (rev 3515)
@@ -52,8 +52,8 @@
}
/**
- * This test create a simple free text poll.
- * At the end, should be on summary page.
+ * This test create a text poll with restriction on participant but no participant.
+ * At the end, should stay on create poll page, cause at least one participant is needed.
*
* @throws Exception
*/
@@ -300,21 +300,4 @@
checkWebElementValue(By.id("votingListRESTRICTED_0PersonToList_0.email"), participantOneEmail);
}
- /**
- * Prepare the poll with general data : one title and two choices
- */
- void preparePoll() {
- // Go on home page
- gotoUrl(fixtures.createPollURL());
-
- // Set title
- sendKeysByName("poll.title", "My Poll");
-
- // Set first choice
- sendKeysByName("textChoice_0.name", "Choix numero un");
-
- // Set second choice
- sendKeysByName("textChoice_1.name", "Choix numero deux");
- }
-
}
Added: trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/CreateTextPollForGroupSIT.java
===================================================================
--- trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/CreateTextPollForGroupSIT.java (rev 0)
+++ trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/CreateTextPollForGroupSIT.java 2012-06-18 14:16:41 UTC (rev 3515)
@@ -0,0 +1,487 @@
+/*
+ * #%L
+ * Pollen :: UI (struts2)
+ * $Id: CreateFreeTextPollSIT.java 3507 2012-06-18 09:45:47Z ymartel $
+ * $HeadURL: http://svn.chorem.org/svn/pollen/trunk/pollen-ui-struts2/src/test/java/org/… $
+ * %%
+ * 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.its;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+
+import java.util.List;
+
+/**
+ * Test the well work of a text poll creation page with the use of groups.
+ * <p/>
+ * Tested cases :
+ * <ul>
+ * <li>Creation with a nonamed group (KO)</li>
+ * <li>Creation with two group with same name (KO)</li>
+ * <li>Creation with a participant without email (KO)</li>
+ * <li>Creation with a participant with only an email (no name) (KO)</li>
+ * <li>Creation with two participants with same name in same group (KO)</li>
+ * <li>Creation with two participants with same email (KO)</li>
+ * <li>Creation with two participants with same name in different group (KO)</li>
+ * <li>Creation with two participants with same email in different group (KO)</li>
+ * </ul>
+ *
+ * @author ymartel <martel(a)codelutin.com>
+ * @since 1.4
+ */
+public class CreateTextPollForGroupSIT extends PollenBaseWebDriverIT {
+
+ public CreateTextPollForGroupSIT(Class<? extends WebDriver> driverType) {
+ super(driverType);
+ }
+
+ /**
+ * This test create a text poll with group of participant but with no name on group.
+ * At the end, should stay on create page cause the group name is mandatory
+ *
+ * @throws Exception
+ */
+ @Test
+ public void createTextPollWithNoNamedGroup() throws Exception {
+
+ // Prepare the poll
+ preparePoll();
+
+ // Go to option panel and display group form
+ goToGroupForm();
+
+ // Check that the group form is displayed
+ WebElement groupNameElement = findElement(By.id("votingListGROUP_0.name"));
+ Assert.assertEquals("input", groupNameElement.getTagName());
+ Assert.assertTrue(groupNameElement.isDisplayed());
+
+ // Set a participant in the group
+ // send name
+ String participantOneName = "toto";
+ sendKeysById("votingListGROUP_0PersonToList_0.votingId", participantOneName);
+ // send email
+ String participantOneEmail = "toto(a)codelutin.com";
+ sendKeysById("votingListGROUP_0PersonToList_0.email", participantOneEmail);
+
+ // Submit form
+ WebElement submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // All good, should be on summary page !
+ checkCurrentUrl(fixtures.createPollURL(), false);
+ // Check an error message has been displayed
+ WebElement errorMessage = findElement(By.className("errorMessage"));
+ Assert.assertNotNull(errorMessage);
+ // Check we are in good table, and group form is still displayed
+ groupNameElement = findElement(By.id("votingListGROUP_0.name"));
+ Assert.assertEquals("input", groupNameElement.getTagName());
+ Assert.assertTrue(groupNameElement.isDisplayed());
+ // check the participant is still here
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_0.votingId"), participantOneName);
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_0.email"), participantOneEmail);
+ }
+
+ /**
+ * This test create a group text poll, with two groups with same name.
+ * At the end, should stay on create poll page, cause the group name should be unique.
+ * The group names and participants should not be lost.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void createGroupTextPollWithGroupsWithSameName() throws Exception {
+
+ // Prepare the poll
+ preparePoll();
+
+ // Go to option panel and display group form
+ goToGroupForm();
+
+ // Set First group name
+ String groupOneName = "my group";
+ sendKeysById("votingListGROUP_0.name", groupOneName);
+ // Set first participant in Group 1
+ // send name
+ String participantOneName = "toto";
+ sendKeysById("votingListGROUP_0PersonToList_0.votingId", participantOneName);
+ // send email
+ String participantOneEmail = "toto(a)codelutin.com";
+ sendKeysById("votingListGROUP_0PersonToList_0.email", participantOneEmail);
+
+ // Add a group
+ WebElement addGroupElement = findElement(By.name("pollen.action.addVotingList"));
+ Assert.assertEquals("input", addGroupElement.getTagName());
+ Assert.assertTrue(addGroupElement.isDisplayed());
+ addGroupElement.click();
+
+ // Set name of the second group: same as first one
+ sendKeysById("votingListGROUP_1.name", groupOneName);
+ // Set second participant in second group
+ // send name
+ String participantTwoName = "toto2";
+ sendKeysById("votingListGROUP_1PersonToList_0.votingId", participantTwoName);
+ // send email
+ String participantTwoEmail = "toto2(a)codelutin.com";
+ sendKeysById("votingListGROUP_1PersonToList_0.email", participantTwoEmail);
+
+ // Submit form
+ WebElement submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // All good, should be on summary page !
+ checkCurrentUrl(fixtures.createPollURL(), false);
+ // Check an error message has been displayed
+ WebElement errorMessage = findElement(By.className("errorMessage"));
+ Assert.assertNotNull(errorMessage);
+ // Check we are in good table
+ checkWebElementValue(By.id("votingListGROUP_0.name"), groupOneName);
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_0.votingId"), participantOneName);
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_0.email"), participantOneEmail);
+ checkWebElementValue(By.id("votingListGROUP_1.name"), groupOneName);
+ checkWebElementValue(By.id("votingListGROUP_1PersonToList_0.votingId"), participantTwoName);
+ checkWebElementValue(By.id("votingListGROUP_1PersonToList_0.email"), participantTwoEmail);
+ }
+
+ /**
+ * This test create a group text poll, with one participant without email.
+ * At the end, should stay on create poll page, cause the mail is mandatory.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void createGroupTextPollWithParticipantWithoutMail() throws Exception {
+
+ // Prepare the poll
+ preparePoll();
+
+ // Go to option panel and display group form
+ goToGroupForm();
+
+ // Set group name
+ String groupName = "my group";
+ sendKeysById("votingListGROUP_0.name", groupName);
+
+ // Set first participant
+ // send name
+ String participantName = "toto";
+ sendKeysById("votingListGROUP_0PersonToList_0.votingId", participantName);
+ // send an empty email
+ sendKeysById("votingListGROUP_0PersonToList_0.email", "");
+
+ // Submit form
+ WebElement submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // All good, should be on summary page !
+ checkCurrentUrl(fixtures.createPollURL(), false);
+ // Check an error message has been displayed
+ WebElement errorMessage = findElement(By.className("errorMessage"));
+ Assert.assertNotNull(errorMessage);
+ // Check we are in good table
+ checkWebElementValue(By.id("votingListGROUP_0.name"), groupName); // group name still here
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_0.votingId"), participantName); // participant name still here
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_0.email"), ""); // still no email
+ }
+
+ /**
+ * This test create a group text poll, with one participant without name.
+ * At the end, should stay on create poll page, cause the mail is mandatory.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void createGroupTextPollWithParticipantWithoutName() throws Exception {
+
+ // Prepare the poll
+ preparePoll();
+ // Go to option panel and display group form
+ goToGroupForm();
+
+
+ // Set group name
+ String groupName = "my group";
+ sendKeysById("votingListGROUP_0.name", groupName);
+
+ // Set a participant
+ // send name
+ sendKeysById("votingListGROUP_0PersonToList_0.votingId", "");
+ // send an empty email
+ String participantEmail = "toto(a)codelutin.com";
+ sendKeysById("votingListGROUP_0PersonToList_0.email", participantEmail);
+
+ // Submit form
+ WebElement submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // All good, should be on summary page !
+ checkCurrentUrl(fixtures.createPollURL(), false);
+ // Check an error message has been displayed
+ WebElement errorMessage = findElement(By.className("errorMessage"));
+ Assert.assertNotNull(errorMessage);
+ // Check we are in good table
+ checkWebElementValue(By.id("votingListGROUP_0.name"), groupName); // group name still here
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_0.votingId"), ""); // participant name still empty
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_0.email"), participantEmail); // still the mail
+ }
+
+ /**
+ * This test create a group text poll, with two participants with same email in same group.
+ * At the end, should stay on create poll page, cause the email should be unique.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void createTextPollWithSameGroupParticipantsWithSameEmail() throws Exception {
+
+ // Prepare the poll
+ preparePoll();
+
+ // Go to option panel and display group form
+ goToGroupForm();
+
+ // Set group name
+ String groupName = "my group";
+ sendKeysById("votingListGROUP_0.name", groupName);
+ // Set first participant in Group
+ // send name
+ String participantOneName = "toto";
+ sendKeysById("votingListGROUP_0PersonToList_0.votingId", participantOneName);
+ // send email
+ String participantEmail = "toto(a)codelutin.com";
+ sendKeysById("votingListGROUP_0PersonToList_0.email", participantEmail);
+
+ // Set second participant in Group with same email
+ // send name
+ String participantTwoName = "toto2";
+ sendKeysById("votingListGROUP_0PersonToList_1.votingId", participantTwoName);
+ // send email
+ sendKeysById("votingListGROUP_0PersonToList_1.email", participantEmail);
+
+ // Submit form
+ WebElement submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // All good, should be on summary page !
+ checkCurrentUrl(fixtures.createPollURL(), false);
+ // Check an error message has been displayed
+ WebElement errorMessage = findElement(By.className("errorMessage"));
+ Assert.assertNotNull(errorMessage);
+ // Check we are in good table
+ checkWebElementValue(By.id("votingListGROUP_0.name"), groupName);
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_0.votingId"), participantOneName);
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_0.email"), participantEmail);
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_1.votingId"), participantTwoName);
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_1.email"), participantEmail);
+ }
+
+ /**
+ * This test create a group text poll, with two participants on different group with same email.
+ * At the end, should stay on create poll page, cause the participant names should be unique.
+ * The group names and participants should not be lost.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void createGroupTextPollWithParticipantsWithSameEmail() throws Exception {
+
+ // Prepare the poll
+ preparePoll();
+
+ // Go to option panel and display group form
+ goToGroupForm();
+
+ // Set First group name
+ String groupOneName = "my group";
+ sendKeysById("votingListGROUP_0.name", groupOneName);
+ // Set first participant in Group 1
+ // send name
+ String participantOneName = "toto";
+ sendKeysById("votingListGROUP_0PersonToList_0.votingId", participantOneName);
+ // send email
+ String participantEmail = "toto(a)codelutin.com";
+ sendKeysById("votingListGROUP_0PersonToList_0.email", participantEmail);
+
+ // Add a group
+ WebElement addGroupElement = findElement(By.name("pollen.action.addVotingList"));
+ Assert.assertEquals("input", addGroupElement.getTagName());
+ Assert.assertTrue(addGroupElement.isDisplayed());
+ addGroupElement.click();
+
+ // Set name of the second group
+ String groupTwoName = "my other group";
+ sendKeysById("votingListGROUP_1.name", groupTwoName);
+ // Set second participant in second group
+ // send name
+ String participantTwoName = "toto2";
+ sendKeysById("votingListGROUP_1PersonToList_0.votingId", participantTwoName);
+ // send email
+ sendKeysById("votingListGROUP_1PersonToList_0.email", participantEmail);
+
+ // Submit form
+ WebElement submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // All good, should be on summary page !
+ checkCurrentUrl(fixtures.createPollURL(), false);
+ // Check an error message has been displayed
+ WebElement errorMessage = findElement(By.className("errorMessage"));
+ Assert.assertNotNull(errorMessage);
+ // Check we are in good table
+ checkWebElementValue(By.id("votingListGROUP_0.name"), groupOneName);
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_0.votingId"), participantOneName);
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_0.email"), participantEmail);
+ checkWebElementValue(By.id("votingListGROUP_1.name"), groupTwoName);
+ checkWebElementValue(By.id("votingListGROUP_1PersonToList_0.votingId"), participantTwoName);
+ checkWebElementValue(By.id("votingListGROUP_1PersonToList_0.email"), participantEmail);
+ }
+
+ /**
+ * This test create a group text poll, with two participant with same name in a group.
+ * At the end, should stay on create poll page, cause the email should be unique.
+ * The group name and participant info must be not lost
+ *
+ * @throws Exception
+ */
+ @Test
+ public void createTextPollWithSameGroupParticipantsWithSameName() throws Exception {
+
+ // Prepare the poll
+ preparePoll();
+
+ // Go to option panel and display option panel
+ goToGroupForm();
+
+ // Set group name
+ String groupName = "my group";
+ sendKeysById("votingListGROUP_0.name", groupName);
+ // Set first participant in Group
+ // send name
+ String participantName = "toto";
+ sendKeysById("votingListGROUP_0PersonToList_0.votingId", participantName);
+ // send email
+ String participantOneEmail = "toto(a)codelutin.com";
+ sendKeysById("votingListGROUP_0PersonToList_0.email", participantOneEmail);
+
+ // Set second participant in Group with same email
+ // send name
+ sendKeysById("votingListGROUP_0PersonToList_1.votingId", participantName);
+ // send email
+ String participantTwoEmail = "toto(a)codelutin.com";
+ sendKeysById("votingListGROUP_0PersonToList_1.email", participantTwoEmail);
+
+ // Submit form
+ WebElement submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // All good, should be on summary page !
+ checkCurrentUrl(fixtures.createPollURL(), false);
+ // Check an error message has been displayed
+ WebElement errorMessage = findElement(By.className("errorMessage"));
+ Assert.assertNotNull(errorMessage);
+ // Check we are in good table
+ checkWebElementValue(By.id("votingListGROUP_0.name"), groupName);
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_0.votingId"), participantName);
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_0.email"), participantOneEmail);
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_1.votingId"), participantName);
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_1.email"), participantTwoEmail);
+ }
+
+ /**
+ * This test create a group text poll, with two participants of different group with same name.
+ * At the end, should stay on create poll page, cause the participant name should be unique.
+ * The group names and participants should not be lost.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void createGroupTextPollWithParticipantsWithSameName() throws Exception {
+
+ // Prepare the poll
+ preparePoll();
+
+ // Go to option panel and group form
+ goToGroupForm();
+
+ // Set First group name
+ String groupOneName = "my group";
+ sendKeysById("votingListGROUP_0.name", groupOneName);
+ // Set first participant in Group 1
+ // send name
+ String participantName = "toto";
+ sendKeysById("votingListGROUP_0PersonToList_0.votingId", participantName);
+ // send email
+ String participantOneEmail = "toto(a)codelutin.com";
+ sendKeysById("votingListGROUP_0PersonToList_0.email", participantOneEmail);
+
+ // Add a group
+ WebElement addGroupElement = findElement(By.name("pollen.action.addVotingList"));
+ Assert.assertEquals("input", addGroupElement.getTagName());
+ Assert.assertTrue(addGroupElement.isDisplayed());
+ addGroupElement.click();
+
+ // Set name of the second group
+ String groupTwoName = "my other group";
+ sendKeysById("votingListGROUP_1.name", groupTwoName);
+ // Set second participant in second group
+ // send name
+ sendKeysById("votingListGROUP_1PersonToList_0.votingId", participantName);
+ // send email
+ String participantTwoEmail = "toto(a)codelutin.com";
+ sendKeysById("votingListGROUP_1PersonToList_0.email", participantTwoEmail);
+
+ // Submit form
+ WebElement submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // All good, should be on summary page !
+ checkCurrentUrl(fixtures.createPollURL(), false);
+ // Check an error message has been displayed
+ WebElement errorMessage = findElement(By.className("errorMessage"));
+ Assert.assertNotNull(errorMessage);
+ // Check we are in good table
+ checkWebElementValue(By.id("votingListGROUP_0.name"), groupOneName);
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_0.votingId"), participantName);
+ checkWebElementValue(By.id("votingListGROUP_0PersonToList_0.email"), participantOneEmail);
+ checkWebElementValue(By.id("votingListGROUP_1.name"), groupTwoName);
+ checkWebElementValue(By.id("votingListGROUP_1PersonToList_0.votingId"), participantName);
+ checkWebElementValue(By.id("votingListGROUP_1PersonToList_0.email"), participantTwoEmail);
+ }
+
+ /**
+ * Click on option panel, and select Group type to restrict the poll participation
+ */
+ void goToGroupForm() {
+ // Go to option panel : click on it
+ WebElement optionsClick = findElement(By.xpath("//a[@href=\"#toptions\"]"));
+ optionsClick.click();
+
+ // Switch to group type
+ List<WebElement> pollTypesElement = findElements(By.name("poll.pollType"));
+ Assert.assertEquals(3, pollTypesElement.size());
+ WebElement restrictedTypeElement = pollTypesElement.get(2);
+ Assert.assertEquals("input", restrictedTypeElement.getTagName());
+ Assert.assertEquals("GROUP", restrictedTypeElement.getAttribute("value"));
+ Assert.assertTrue(restrictedTypeElement.isDisplayed());
+ restrictedTypeElement.click();
+ }
+
+}
Modified: trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/PollenBaseWebDriverIT.java
===================================================================
--- trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/PollenBaseWebDriverIT.java 2012-06-18 12:44:50 UTC (rev 3514)
+++ trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/PollenBaseWebDriverIT.java 2012-06-18 14:16:41 UTC (rev 3515)
@@ -161,6 +161,23 @@
}
/**
+ * Prepare the poll with general data : one title and two choices
+ */
+ void preparePoll() {
+ // Go on home page
+ gotoUrl(fixtures.createPollURL());
+
+ // Set title
+ sendKeysByName("poll.title", "My Poll");
+
+ // Set first choice
+ sendKeysByName("textChoice_0.name", "Choix numero un");
+
+ // Set second choice
+ sendKeysByName("textChoice_1.name", "Choix numero deux");
+ }
+
+ /**
* Set a value for a WebElement.
* This operations does 3 steps :
* <ul>
@@ -240,7 +257,7 @@
if (safeDrivers == null) {
List<Class<? extends WebDriver>> allDrivers = Lists.newArrayList();
-// allDrivers.add(HtmlUnitDriver.class);
+ allDrivers.add(HtmlUnitDriver.class);
allDrivers.add(FirefoxDriver.class);
// allDrivers.add(ChromeDriver.class);
// allDrivers.add(InternetExplorerDriver.class);
1
0
r3514 - in trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui: . its
by ymartel@users.chorem.org 18 Jun '12
by ymartel@users.chorem.org 18 Jun '12
18 Jun '12
Author: ymartel
Date: 2012-06-18 14:44:50 +0200 (Mon, 18 Jun 2012)
New Revision: 3514
Url: http://chorem.org/repositories/revision/pollen/3514
Log:
refs #606 : add ITs for text restricted poll
Added:
trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/CreateRestrictedTextPollSIT.java
Modified:
trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/PollenFixtures.java
trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/PollenBaseWebDriverIT.java
Modified: trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/PollenFixtures.java
===================================================================
--- trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/PollenFixtures.java 2012-06-18 11:38:22 UTC (rev 3513)
+++ trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/PollenFixtures.java 2012-06-18 12:44:50 UTC (rev 3514)
@@ -162,4 +162,5 @@
public String date(int year, int month, int day) {
return date(year, month, day, 0, 0);
}
+
}
Added: trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/CreateRestrictedTextPollSIT.java
===================================================================
--- trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/CreateRestrictedTextPollSIT.java (rev 0)
+++ trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/CreateRestrictedTextPollSIT.java 2012-06-18 12:44:50 UTC (rev 3514)
@@ -0,0 +1,320 @@
+/*
+ * #%L
+ * Pollen :: UI (struts2)
+ * $Id: CreateFreeTextPollSIT.java 3507 2012-06-18 09:45:47Z ymartel $
+ * $HeadURL: http://svn.chorem.org/svn/pollen/trunk/pollen-ui-struts2/src/test/java/org/… $
+ * %%
+ * 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.its;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+
+import java.util.List;
+
+/**
+ * Test the well work of a text poll creation page with a restricted list of participant.
+ * <p/>
+ * Tested cases :
+ * <ul>
+ * <li>Creation without participant (KO)</li>
+ * <li>Creation with two participants with same name (KO)</li>
+ * <li>Creation with two participants with same email (KO)</li>
+ * <li>Creation with a participant without email (KO)</li>
+ * <li>Creation with a participant with only an email (no name) (KO)</li>
+ * </ul>
+ *
+ * @author ymartel <martel(a)codelutin.com>
+ * @since 1.4
+ */
+public class CreateRestrictedTextPollSIT extends PollenBaseWebDriverIT {
+
+ public CreateRestrictedTextPollSIT(Class<? extends WebDriver> driverType) {
+ super(driverType);
+ }
+
+ /**
+ * This test create a simple free text poll.
+ * At the end, should be on summary page.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void createRestrictedTextPollWithoutParticipant() throws Exception {
+
+ // Prepare the poll
+ preparePoll();
+
+ // Go to option panel : click on it
+ WebElement optionsClick = findElement(By.xpath("//a[@href=\"#toptions\"]"));
+ optionsClick.click();
+
+ // Switch to restricted type
+ List<WebElement> pollTypesElement = findElements(By.name("poll.pollType"));
+ Assert.assertEquals(3, pollTypesElement.size());
+ WebElement restrictedTypeElement = pollTypesElement.get(1);
+ Assert.assertEquals("input", restrictedTypeElement.getTagName());
+ Assert.assertEquals("RESTRICTED", restrictedTypeElement.getAttribute("value"));
+ Assert.assertTrue(restrictedTypeElement.isDisplayed());
+ restrictedTypeElement.click();
+
+ // Check that the participant form is displayed
+ WebElement participantOneNameElement = findElement(By.id("votingListRESTRICTED_0PersonToList_0.votingId"));
+ Assert.assertEquals("input", participantOneNameElement.getTagName());
+ Assert.assertTrue(participantOneNameElement.isDisplayed());
+
+ // Submit form
+ WebElement submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // All good, should be on summary page !
+ checkCurrentUrl(fixtures.createPollURL(), false);
+ // Check an error message has been displayed
+ WebElement errorMessage = findElement(By.className("errorMessage"));
+ Assert.assertNotNull(errorMessage);
+ // Check we are in good table
+ participantOneNameElement = findElement(By.id("votingListRESTRICTED_0PersonToList_0.votingId"));
+ Assert.assertEquals("input", participantOneNameElement.getTagName());
+ Assert.assertTrue(participantOneNameElement.isDisplayed());
+ }
+
+ /**
+ * This test create a restricted text poll, with two participant with same name.
+ * At the end, should stay on create poll page, cause the name should be unique.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void createRestrictedTextPollWithParticipantsWithSameName() throws Exception {
+
+ // Prepare the poll
+ preparePoll();
+
+ // Go to option panel : click on it
+ WebElement optionsClick = findElement(By.xpath("//a[@href=\"#toptions\"]"));
+ optionsClick.click();
+
+ // Switch to restricted type
+ List<WebElement> pollTypesElement = findElements(By.name("poll.pollType"));
+ Assert.assertEquals(3, pollTypesElement.size());
+ WebElement restrictedTypeElement = pollTypesElement.get(1);
+ Assert.assertEquals("input", restrictedTypeElement.getTagName());
+ Assert.assertEquals("RESTRICTED", restrictedTypeElement.getAttribute("value"));
+ Assert.assertTrue(restrictedTypeElement.isDisplayed());
+ restrictedTypeElement.click();
+
+ // Set first participant
+ // send name
+ String participantOneName = "toto";
+ sendKeysById("votingListRESTRICTED_0PersonToList_0.votingId", participantOneName);
+ // send email
+ String participantOneEmail = "toto(a)codelutin.com";
+ sendKeysById("votingListRESTRICTED_0PersonToList_0.email", participantOneEmail);
+ // Set second participant
+ // send name
+ sendKeysById("votingListRESTRICTED_0PersonToList_1.votingId", participantOneName);
+ // send email
+ String participantTwoEmail = "toto2(a)codelutin.com";
+ sendKeysById("votingListRESTRICTED_0PersonToList_1.email", participantTwoEmail);
+
+ // Submit form
+ WebElement submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // All good, should be on summary page !
+ checkCurrentUrl(fixtures.createPollURL(), false);
+ // Check an error message has been displayed
+ WebElement errorMessage = findElement(By.className("errorMessage"));
+ Assert.assertNotNull(errorMessage);
+ // Check we are in good table
+ checkWebElementValue(By.id("votingListRESTRICTED_0PersonToList_0.votingId"), participantOneName);
+ checkWebElementValue(By.id("votingListRESTRICTED_0PersonToList_0.email"), participantOneEmail);
+ checkWebElementValue(By.id("votingListRESTRICTED_0PersonToList_1.votingId"), participantOneName);
+ checkWebElementValue(By.id("votingListRESTRICTED_0PersonToList_1.email"), participantTwoEmail);
+ }
+
+ /**
+ * This test create a restricted text poll, with two participant with same email.
+ * At the end, should stay on create poll page, cause the email should be unique.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void createRestrictedTextPollWithParticipantsWithSameEmail() throws Exception {
+
+ // Prepare the poll
+ preparePoll();
+
+ // Go to option panel : click on it
+ WebElement optionsClick = findElement(By.xpath("//a[@href=\"#toptions\"]"));
+ optionsClick.click();
+
+ // Switch to restricted type
+ List<WebElement> pollTypesElement = findElements(By.name("poll.pollType"));
+ Assert.assertEquals(3, pollTypesElement.size());
+ WebElement restrictedTypeElement = pollTypesElement.get(1);
+ Assert.assertEquals("input", restrictedTypeElement.getTagName());
+ Assert.assertEquals("RESTRICTED", restrictedTypeElement.getAttribute("value"));
+ Assert.assertTrue(restrictedTypeElement.isDisplayed());
+ restrictedTypeElement.click();
+
+ // Set first participant
+ // send name
+ String participantOneName = "toto";
+ sendKeysById("votingListRESTRICTED_0PersonToList_0.votingId", participantOneName);
+ // send email
+ String participantOneEmail = "toto(a)codelutin.com";
+ sendKeysById("votingListRESTRICTED_0PersonToList_0.email", participantOneEmail);
+ // Set second participant
+ // send name
+ String participantTwoName = "toto2";
+ sendKeysById("votingListRESTRICTED_0PersonToList_1.votingId", participantTwoName);
+ // send email
+ sendKeysById("votingListRESTRICTED_0PersonToList_1.email", participantOneEmail);
+
+ // Submit form
+ WebElement submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // All good, should be on summary page !
+ checkCurrentUrl(fixtures.createPollURL(), false);
+ // Check an error message has been displayed
+ WebElement errorMessage = findElement(By.className("errorMessage"));
+ Assert.assertNotNull(errorMessage);
+ // Check we are in good table
+ checkWebElementValue(By.id("votingListRESTRICTED_0PersonToList_0.votingId"), participantOneName);
+ checkWebElementValue(By.id("votingListRESTRICTED_0PersonToList_0.email"), participantOneEmail);
+ checkWebElementValue(By.id("votingListRESTRICTED_0PersonToList_1.votingId"), participantTwoName);
+ checkWebElementValue(By.id("votingListRESTRICTED_0PersonToList_1.email"), participantOneEmail);
+ }
+
+ /**
+ * This test create a restricted text poll, with one participant without email.
+ * At the end, should stay on create poll page, cause the mail is mandatory.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void createRestrictedTextPollWithParticipantWithoutMail() throws Exception {
+
+ // Prepare the poll
+ preparePoll();
+
+ // Go to option panel : click on it
+ WebElement optionsClick = findElement(By.xpath("//a[@href=\"#toptions\"]"));
+ optionsClick.click();
+
+ // Switch to restricted type
+ List<WebElement> pollTypesElement = findElements(By.name("poll.pollType"));
+ Assert.assertEquals(3, pollTypesElement.size());
+ WebElement restrictedTypeElement = pollTypesElement.get(1);
+ Assert.assertEquals("input", restrictedTypeElement.getTagName());
+ Assert.assertEquals("RESTRICTED", restrictedTypeElement.getAttribute("value"));
+ Assert.assertTrue(restrictedTypeElement.isDisplayed());
+ restrictedTypeElement.click();
+
+ // Set first participant
+ // send name
+ String participantOneName = "toto";
+ sendKeysById("votingListRESTRICTED_0PersonToList_0.votingId", participantOneName);
+ // send email
+ String participantOneEmail = " ";
+ sendKeysById("votingListRESTRICTED_0PersonToList_0.email", participantOneEmail);
+
+ // Submit form
+ WebElement submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // All good, should be on summary page !
+ checkCurrentUrl(fixtures.createPollURL(), false);
+ // Check an error message has been displayed
+ WebElement errorMessage = findElement(By.className("errorMessage"));
+ Assert.assertNotNull(errorMessage);
+ // Check we are in good table
+ checkWebElementValue(By.id("votingListRESTRICTED_0PersonToList_0.votingId"), participantOneName);
+ checkWebElementValue(By.id("votingListRESTRICTED_0PersonToList_0.email"), participantOneEmail);
+ }
+
+ /**
+ * This test create a restricted text poll, with one participant without email.
+ * At the end, should stay on create poll page, cause the mail is mandatory.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void createRestrictedTextPollWithParticipantWithoutName() throws Exception {
+
+ // Prepare the poll
+ preparePoll();
+
+ // Go to option panel : click on it
+ WebElement optionsClick = findElement(By.xpath("//a[@href=\"#toptions\"]"));
+ optionsClick.click();
+
+ // Switch to restricted type
+ List<WebElement> pollTypesElement = findElements(By.name("poll.pollType"));
+ Assert.assertEquals(3, pollTypesElement.size());
+ WebElement restrictedTypeElement = pollTypesElement.get(1);
+ Assert.assertEquals("input", restrictedTypeElement.getTagName());
+ Assert.assertEquals("RESTRICTED", restrictedTypeElement.getAttribute("value"));
+ Assert.assertTrue(restrictedTypeElement.isDisplayed());
+ restrictedTypeElement.click();
+
+ // Set first participant
+ // send name
+ String participantOneName = "";
+ sendKeysById("votingListRESTRICTED_0PersonToList_0.votingId", participantOneName);
+ // send email
+ String participantOneEmail = "toto(a)codelutin.com";
+ sendKeysById("votingListRESTRICTED_0PersonToList_0.email", participantOneEmail);
+
+ // Submit form
+ WebElement submit = findElement(By.name("action:create"));
+ submit.click();
+
+ // All good, should be on summary page !
+ checkCurrentUrl(fixtures.createPollURL(), false);
+ // Check an error message has been displayed
+ WebElement errorMessage = findElement(By.className("errorMessage"));
+ Assert.assertNotNull(errorMessage);
+ // Check we are in good table
+ checkWebElementValue(By.id("votingListRESTRICTED_0PersonToList_0.votingId"), participantOneName);
+ checkWebElementValue(By.id("votingListRESTRICTED_0PersonToList_0.email"), participantOneEmail);
+ }
+
+ /**
+ * Prepare the poll with general data : one title and two choices
+ */
+ void preparePoll() {
+ // Go on home page
+ gotoUrl(fixtures.createPollURL());
+
+ // Set title
+ sendKeysByName("poll.title", "My Poll");
+
+ // Set first choice
+ sendKeysByName("textChoice_0.name", "Choix numero un");
+
+ // Set second choice
+ sendKeysByName("textChoice_1.name", "Choix numero deux");
+ }
+
+}
Modified: trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/PollenBaseWebDriverIT.java
===================================================================
--- trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/PollenBaseWebDriverIT.java 2012-06-18 11:38:22 UTC (rev 3513)
+++ trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/its/PollenBaseWebDriverIT.java 2012-06-18 12:44:50 UTC (rev 3514)
@@ -161,6 +161,67 @@
}
/**
+ * Set a value for a WebElement.
+ * This operations does 3 steps :
+ * <ul>
+ * <li>Get the WebElement thanks to its id (given in parameter)</li>
+ * <li>check the element is an input</li>
+ * <li>check the element is displayed</li>
+ * <li>clear the element</li>
+ * <li>send the wanted keys</li>
+ * </ul>
+ */
+ protected void sendKeysById(String webElementId, String value) {
+ sendKeysBy(By.id(webElementId), value);
+ }
+
+ /**
+ * Set a value for a WebElement.
+ * This operations does 3 steps :
+ * <ul>
+ * <li>Get the WebElement thanks to its name (given in parameter)</li>
+ * <li>check the element is an input</li>
+ * <li>check the element is displayed</li>
+ * <li>clear the element</li>
+ * <li>send the wanted keys</li>
+ * </ul>
+ */
+ protected void sendKeysByName(String webElementName, String value) {
+ By byName = By.name(webElementName);
+ sendKeysBy(byName, value);
+ }
+
+ /**
+ * Set a value for a WebElement.
+ * This operations does 3 steps :
+ * <ul>
+ * <li>Get the WebElement thanks to a {@link By} locator</li>
+ * <li>check the element is an input</li>
+ * <li>check the element is displayed</li>
+ * <li>clear the element</li>
+ * <li>send the wanted keys</li>
+ * </ul>
+ */
+ protected void sendKeysBy(By by, String value) {
+ WebElement webElement = findElement(by);
+ Assert.assertEquals("input", webElement.getTagName());
+ Assert.assertTrue(webElement.isDisplayed());
+ webElement.sendKeys(value);
+ Assert.assertEquals(value, webElement.getAttribute("value"));
+ }
+
+ /**
+ * Get a WebElement with a {@link By} locator, and check it is an input and that is value is the one expected.
+ *
+ */
+ protected void checkWebElementValue(By by, String expectedValue) {
+ WebElement webElement = findElement(by);
+ Assert.assertEquals("input", webElement.getTagName());
+ Assert.assertTrue(webElement.isDisplayed());
+ Assert.assertEquals(expectedValue, webElement.getAttribute("value"));
+ }
+
+ /**
* Web driver resource.
*
* @author tchemit <chemit(a)codelutin.com>
@@ -179,7 +240,7 @@
if (safeDrivers == null) {
List<Class<? extends WebDriver>> allDrivers = Lists.newArrayList();
- allDrivers.add(HtmlUnitDriver.class);
+// allDrivers.add(HtmlUnitDriver.class);
allDrivers.add(FirefoxDriver.class);
// allDrivers.add(ChromeDriver.class);
// allDrivers.add(InternetExplorerDriver.class);
1
0
r3513 - in trunk: pollen-services/src/main/java/org/chorem/pollen/bean pollen-services/src/main/java/org/chorem/pollen/services/impl pollen-ui-struts2/src/main/resources/i18n
by tchemit@users.chorem.org 18 Jun '12
by tchemit@users.chorem.org 18 Jun '12
18 Jun '12
Author: tchemit
Date: 2012-06-18 13:38:22 +0200 (Mon, 18 Jun 2012)
New Revision: 3513
Url: http://chorem.org/repositories/revision/pollen/3513
Log:
- remove the suffixUrl stuff
- can now change image choice
- i18n
Modified:
trunk/pollen-services/src/main/java/org/chorem/pollen/bean/PollUrl.java
trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollService.java
trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollUrlService.java
trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties
trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties
Modified: trunk/pollen-services/src/main/java/org/chorem/pollen/bean/PollUrl.java
===================================================================
--- trunk/pollen-services/src/main/java/org/chorem/pollen/bean/PollUrl.java 2012-06-18 10:42:01 UTC (rev 3512)
+++ trunk/pollen-services/src/main/java/org/chorem/pollen/bean/PollUrl.java 2012-06-18 11:38:22 UTC (rev 3513)
@@ -22,8 +22,6 @@
*/
package org.chorem.pollen.bean;
-import org.apache.commons.lang3.StringUtils;
-
/**
* Created: 12/04/12
*
@@ -33,8 +31,6 @@
private String baseUrl;
- private String suffixUrl;
-
private PollUri pollUri;
/**
@@ -65,7 +61,6 @@
result.baseUrl = pollUrl.getBaseUrl();
String pollId = pollUrl.getPollUri().getPollId();
result.pollUri = PollUri.newPollUri(pollId, accountId);
- result.suffixUrl = pollUrl.suffixUrl;
return result;
}
@@ -80,19 +75,8 @@
return pollUri;
}
- public String getSuffixUrl() {
- return suffixUrl;
- }
-
- public void setSuffixUrl(String suffixUrl) {
- this.suffixUrl = suffixUrl;
- }
-
public String getUrl() {
String result = getBaseUrl() + getPollUri().getUri();
- if (StringUtils.isNotBlank(suffixUrl)) {
- result += suffixUrl;
- }
return result;
}
Modified: trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollService.java
===================================================================
--- trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollService.java 2012-06-18 10:42:01 UTC (rev 3512)
+++ trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollService.java 2012-06-18 11:38:22 UTC (rev 3513)
@@ -28,6 +28,7 @@
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.commons.logging.Log;
@@ -73,7 +74,6 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
-import java.util.UUID;
import static org.nuiton.i18n.I18n.l_;
@@ -793,7 +793,10 @@
ChoiceType choiceType = poll.getChoiceType();
ChoiceDAO dao = getDAO(Choice.class);
Choice choiceLoaded;
- if (choice.getTopiaId() == null) {
+
+ boolean newChoice = choice.getTopiaId() == null;
+
+ if (newChoice) {
choiceLoaded = create(dao);
poll.addChoice(choiceLoaded);
@@ -803,18 +806,20 @@
if (choiceType == ChoiceType.IMAGE) {
-
PollImageChoice imageChoice = (PollImageChoice) choice;
- imageChoice.toChoice(choiceLoaded);
- if (choice.getTopiaId() == null) {
+ if (newChoice ||
+ !ObjectUtils.equals(choice.getName(),
+ choiceLoaded.getName())) {
// copy image where it belong and generate the thumb
- // only if choice is to create
+ // only if choice is to create or name has change (so image too...)
try {
saveImages(poll, imageChoice);
} catch (IOException e) {
throw new PollenTechnicalException(
"Could not create image choice", e);
}
+ // bind other fields
+ imageChoice.toChoice(choiceLoaded);
}
} else if (choiceType == ChoiceType.DATE) {
Modified: trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollUrlService.java
===================================================================
--- trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollUrlService.java 2012-06-18 10:42:01 UTC (rev 3512)
+++ trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollUrlService.java 2012-06-18 11:38:22 UTC (rev 3513)
@@ -45,7 +45,6 @@
public PollUrl getPollCloneUrl(Poll poll) {
PollUrl result = newPollUrl(PollActions.CLONE, poll, true);
- result.setSuffixUrl("!input");
return result;
}
@@ -71,7 +70,6 @@
public PollUrl getPollEditUrl(Poll poll) {
PollUrl result = newPollUrl(PollActions.EDIT, poll, true);
- result.setSuffixUrl("!input");
return result;
}
Modified: trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties
===================================================================
--- trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-06-18 10:42:01 UTC (rev 3512)
+++ trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-06-18 11:38:22 UTC (rev 3513)
@@ -327,13 +327,13 @@
pollen.tab.poll.options=Options
pollen.title.clone.poll=Clone a poll
pollen.title.close.poll=Close a poll
-pollen.title.editPoll=Edit a poll
pollen.title.createPoll=New poll
pollen.title.delete.poll=Delete a poll
pollen.title.delete.pollChoice=Delete a poll choice
pollen.title.delete.pollComment=Delete a poll comment
pollen.title.delete.pollVote=Delete a poll vote
pollen.title.editFavoriteList=Edit a favorite list
+pollen.title.editPoll=Edit a poll
pollen.title.favoriteLists=Your favorite lists
pollen.title.myAccount=My account
pollen.title.pollsCreatedList=Polls created
Modified: trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties
===================================================================
--- trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-06-18 10:42:01 UTC (rev 3512)
+++ trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-06-18 11:38:22 UTC (rev 3513)
@@ -327,13 +327,13 @@
pollen.tab.poll.options=Options
pollen.title.clone.poll=Clonage d'un sondage
pollen.title.close.poll=Fermeture d'un sondage
-pollen.title.editPoll=Modifier un sondage
pollen.title.createPoll=Nouveau sondage
pollen.title.delete.poll=Suppression d'un sondage
pollen.title.delete.pollChoice=Suppression d'un choix
pollen.title.delete.pollComment=Suppression d'un commentaire
pollen.title.delete.pollVote=Suppression d'un vote
pollen.title.editFavoriteList=Edition de la liste des favoris
+pollen.title.editPoll=Modifier un sondage
pollen.title.favoriteLists=Vos listes de votants
pollen.title.myAccount=Mon compte
pollen.title.pollsCreatedList=Sondages créés
1
0
r3512 - in trunk/pollen-ui-struts2/src/main: resources/i18n webapp/WEB-INF/jsp/poll
by tchemit@users.chorem.org 18 Jun '12
by tchemit@users.chorem.org 18 Jun '12
18 Jun '12
Author: tchemit
Date: 2012-06-18 12:42:01 +0200 (Mon, 18 Jun 2012)
New Revision: 3512
Url: http://chorem.org/repositories/revision/pollen/3512
Log:
change page name when edit a poll + improve a javascript
Modified:
trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties
trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/create.jsp
Modified: trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties
===================================================================
--- trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-06-18 10:35:27 UTC (rev 3511)
+++ trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-06-18 10:42:01 UTC (rev 3512)
@@ -327,6 +327,7 @@
pollen.tab.poll.options=Options
pollen.title.clone.poll=Clone a poll
pollen.title.close.poll=Close a poll
+pollen.title.editPoll=Edit a poll
pollen.title.createPoll=New poll
pollen.title.delete.poll=Delete a poll
pollen.title.delete.pollChoice=Delete a poll choice
Modified: trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties
===================================================================
--- trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-06-18 10:35:27 UTC (rev 3511)
+++ trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-06-18 10:42:01 UTC (rev 3512)
@@ -327,6 +327,7 @@
pollen.tab.poll.options=Options
pollen.title.clone.poll=Clonage d'un sondage
pollen.title.close.poll=Fermeture d'un sondage
+pollen.title.editPoll=Modifier un sondage
pollen.title.createPoll=Nouveau sondage
pollen.title.delete.poll=Suppression d'un sondage
pollen.title.delete.pollChoice=Suppression d'un choix
Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/create.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/create.jsp 2012-06-18 10:35:27 UTC (rev 3511)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/create.jsp 2012-06-18 10:42:01 UTC (rev 3512)
@@ -58,10 +58,8 @@
choiceType:'<s:property value="%{poll.choiceType.name()}"/>',
pollType:'<s:property value="%{poll.pollType.name()}"/>',
confirmCloseTitle:"<s:text name='pollen.title.close.poll'/>",
- confirmCloseUrl:'<s:url action="confirmClosePoll/" namespace="/poll"/>'
- + '<s:property value="%{poll.adminId}"/>',
- confirmCloseRedirectUrl:'<s:url action="summary/" namespace="/poll"/>'
- + '<s:property value="%{poll.adminId}"/>'
+ confirmCloseUrl:'<s:url action="confirmClosePoll/%{poll.adminId}" namespace="/poll"/>',
+ confirmCloseRedirectUrl:'<s:url action="summary/%{poll.adminId}" namespace="/poll"/>'
}
);
</script>
@@ -73,7 +71,14 @@
<s:url id='errorImg' value='/img/exclamation.png'/>
-<title><s:text name="pollen.title.createPoll"/></title>
+<title>
+ <s:if test="edit">
+ <s:text name="pollen.title.editPoll"/>
+ </s:if>
+ <s:else>
+ <s:text name="pollen.title.createPoll"/>
+ </s:else>
+</title>
<h1 class="title${pageLogo}"><s:property value="%{pageTitle}"/></h1>
1
0
r3511 - trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/security
by tchemit@users.chorem.org 18 Jun '12
by tchemit@users.chorem.org 18 Jun '12
18 Jun '12
Author: tchemit
Date: 2012-06-18 12:35:27 +0200 (Mon, 18 Jun 2012)
New Revision: 3511
Url: http://chorem.org/repositories/revision/pollen/3511
Log:
propagate the AccountIdRole obtained by security filters
Modified:
trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/security/PollCreatorAccessRequired.java
trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/security/PollResultAccessRequired.java
Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/security/PollCreatorAccessRequired.java
===================================================================
--- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/security/PollCreatorAccessRequired.java 2012-06-18 10:34:48 UTC (rev 3510)
+++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/security/PollCreatorAccessRequired.java 2012-06-18 10:35:27 UTC (rev 3511)
@@ -126,6 +126,13 @@
}
}
+ if (isAccessAllowed) {
+
+ // store accountIdRole in request
+ request.setAttribute(PollVoteAccessRequired.ACCOUNT_ID_ROLE,
+ accountIdRole);
+ }
+
return isAccessAllowed;
}
Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/security/PollResultAccessRequired.java
===================================================================
--- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/security/PollResultAccessRequired.java 2012-06-18 10:34:48 UTC (rev 3510)
+++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/security/PollResultAccessRequired.java 2012-06-18 10:35:27 UTC (rev 3511)
@@ -117,6 +117,13 @@
registerError(request, errorMessage);
}
}
+
+ if (isAccessAllowed) {
+
+ // store accountIdRole in request
+ request.setAttribute(PollVoteAccessRequired.ACCOUNT_ID_ROLE,
+ accountIdRole);
+ }
return isAccessAllowed;
}
1
0