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
March 2010
- 5 participants
- 71 discussions
r2903 - branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll
by echatellier@users.chorem.org 08 Mar '10
by echatellier@users.chorem.org 08 Mar '10
08 Mar '10
Author: echatellier
Date: 2010-03-08 16:29:40 +0100 (Mon, 08 Mar 2010)
New Revision: 2903
Log:
Send mail in a thread (to not block client)
Modified:
branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollCreation.java
Modified: branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollCreation.java
===================================================================
--- branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollCreation.java 2010-03-08 15:19:16 UTC (rev 2902)
+++ branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollCreation.java 2010-03-08 15:29:40 UTC (rev 2903)
@@ -815,9 +815,26 @@
// Mise à jour du sondage
poll = servicePoll.findPollById(poll.getId());
+ addFeedEntry();
+
+ // on les passe en parametres car au
+ // moment de l'execution du thread, il y a des NPE
+ // à l'utilisation des valeurs
+ final String localSiteURL = siteURL;
+ final ServicePollAccount localServicePollAccount = servicePollAccount;
+ final PollDTO localPoll = poll;
+ final Configuration localConf = conf;
+ final Messages localMessages = messages;
+
// Mise à jour du flux Atom et envoi d'un mail de confirmation
- addFeedEntry();
- sendMailNotification();
+ // FIXME replace this ugly thread code !!!
+ new Thread() {
+ @Override
+ public void run() {
+ sendMailNotification(localSiteURL, localServicePollAccount,
+ localPoll, localConf, localMessages);
+ }
+ }.start();
}
}
@@ -825,7 +842,7 @@
private void addFeedEntry() {
PollAccountDTO creator = servicePollAccount.findPollAccountById(poll
.getCreatorId());
- String voteURL = siteURL + "poll/VoteFor/" + poll.getPollId();
+ String voteURL = siteURL + "poll/votefor/" + poll.getPollId();
File feedFile = feedContext.getFile(poll.getPollId());
FeedUtil.createFeed(feedFile, "atom_1.0", messages.format(
@@ -837,11 +854,12 @@
}
/** Envoi du mail de notification */
- private void sendMailNotification() {
+ private void sendMailNotification(String siteURL, ServicePollAccount servicePollAccount,
+ PollDTO poll, Configuration conf, Messages messages) {
PollAccountDTO creator = servicePollAccount.findPollAccountById(poll
.getCreatorId());
- String voteURL = siteURL + "poll/VoteFor/" + poll.getPollId();
- String modifURL = siteURL + "poll/Modification/" + poll.getPollId()
+ String voteURL = siteURL + "poll/votefor/" + poll.getPollId();
+ String modifURL = siteURL + "poll/modification/" + poll.getPollId()
+ ":" + creator.getAccountId();
Map<String, String> data = new HashMap<String, String>();
data.put("host", conf.getProperty("email_host"));
@@ -856,6 +874,8 @@
data.put("msg", messages.format("creatorEmail_msg",
poll.getTitle(), voteURL, modifURL));
+ // FIXME call directly MailUtil.sendMail()
+ // skip fill map, get from map...
PreventRuleManager.emailAction(data);
}
@@ -863,17 +883,17 @@
for (VotingListDTO list : poll.getVotingListDTOs()) {
for (PollAccountDTO account : list.getPollAccountDTOs()) {
if (account.getEmail() != null) {
- String accountVoteURL = voteURL + ":"
- + account.getAccountId();
+ String accountVoteURL = voteURL + ":" + account.getAccountId();
data.put("to", account.getEmail());
data.put("title", messages.format("votingEmail_subject",
poll.getTitle()));
- data
- .put("msg", messages.format("votingEmail_msg", poll
+ data.put("msg", messages.format("votingEmail_msg", poll
.getTitle(), account.getVotingId(),
accountVoteURL));
+ // FIXME call directly MailUtil.sendMail()
+ // skip fill map, get from map...
PreventRuleManager.emailAction(data);
}
}
1
0
r2902 - branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll
by echatellier@users.chorem.org 08 Mar '10
by echatellier@users.chorem.org 08 Mar '10
08 Mar '10
Author: echatellier
Date: 2010-03-08 16:19:16 +0100 (Mon, 08 Mar 2010)
New Revision: 2902
Log:
Format de % en %
Modified:
branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/VoteForPoll_en.properties
branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/VoteForPoll_fr.properties
Modified: branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/VoteForPoll_en.properties
===================================================================
--- branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/VoteForPoll_en.properties 2010-03-08 14:42:47 UTC (rev 2901)
+++ branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/VoteForPoll_en.properties 2010-03-08 15:19:16 UTC (rev 2902)
@@ -5,7 +5,7 @@
endDate-label=End Date:
pollType-label=Poll type:
normalVote-help=Normal vote: vote for your favorite choice.
-percentageVote-help=Percentage vote: allocate choices to get a 100% total.
+percentageVote-help=Percentage vote: allocate choices to get a 100%% total.
condorcetVote-help=Condorcet vote: rank choices by preference order from 1 to N (1=favorite). Only the rank is taken into account, not the values. Two choices can have the same value.
numberVote-help=Voting by number: The answer is free, leave blank or enter a integer.
results=Results
Modified: branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/VoteForPoll_fr.properties
===================================================================
--- branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/VoteForPoll_fr.properties 2010-03-08 14:42:47 UTC (rev 2901)
+++ branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/VoteForPoll_fr.properties 2010-03-08 15:19:16 UTC (rev 2902)
@@ -5,7 +5,7 @@
endDate-label=Date de fin :
pollType-label=Type de sondage :
normalVote-help=Vote normal : voter pour le ou les choix pr\u00C3\u00A9f\u00C3\u00A9r\u00C3\u00A9s.
-percentageVote-help=Vote par pourcentage : r\u00C3\u00A9partir les choix de mani\u00C3\u00A8re \u00C3\u00A0 obtenir 100% au total.
+percentageVote-help=Vote par pourcentage : r\u00C3\u00A9partir les choix de mani\u00C3\u00A8re \u00C3\u00A0 obtenir 100%% au total.
condorcetVote-help=Vote Condorcet : classer les choix par ordre de pr\u00C3\u00A9f\u00C3\u00A9rence de 1 \u00C3\u00A0 N (1=pr\u00C3\u00A9f\u00C3\u00A9r\u00C3\u00A9). Seul l'ordre des choix compte, peu importe les valeurs. Deux choix peuvent avoir la m\u00C3\u00AAme valeur.
numberVote-help=Vote par nombre : La r\u00C3\u00A9ponse est libre, laissez vide ou entrez un nombre entier
results=R\u00C3\u00A9sultats
1
0
r2901 - in branches/pollen-1.2.3-1.2.x: pollen-business/src/main/java/org/chorem/pollen/business/converters pollen-business/src/main/java/org/chorem/pollen/business/dto pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll pollen-ui/src/main/webapp/css pollen-ui/src/main/webapp/poll
by fdesbois@users.chorem.org 08 Mar '10
by fdesbois@users.chorem.org 08 Mar '10
08 Mar '10
Author: fdesbois
Date: 2010-03-08 15:42:47 +0100 (Mon, 08 Mar 2010)
New Revision: 2901
Log:
Ano #130 : Hide votes for an anonymous vote (don't load votes in this case)
Modified:
branches/pollen-1.2.3-1.2.x/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataPollConverter.java
branches/pollen-1.2.3-1.2.x/pollen-business/src/main/java/org/chorem/pollen/business/dto/PollDTO.java
branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java
branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/VoteForPoll_en.properties
branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/VoteForPoll_fr.properties
branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/webapp/css/vote.css
branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/webapp/poll/VoteForPoll.tml
Modified: branches/pollen-1.2.3-1.2.x/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataPollConverter.java
===================================================================
--- branches/pollen-1.2.3-1.2.x/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataPollConverter.java 2010-03-08 13:33:31 UTC (rev 2900)
+++ branches/pollen-1.2.3-1.2.x/pollen-business/src/main/java/org/chorem/pollen/business/converters/DataPollConverter.java 2010-03-08 14:42:47 UTC (rev 2901)
@@ -121,7 +121,12 @@
.getChoice()));
}
if (ePoll.getVote().size() > 0) {
- pollDTO.setVoteDTOs(voteConverter.createVoteDTOs(ePoll.getVote()));
+ // FD-20100308 Votes are not loaded for an anonymous vote :
+ // see ref ANO #130
+ if (!ePoll.getAnonymous()) {
+ pollDTO.setVoteDTOs(voteConverter.createVoteDTOs(ePoll.getVote()));
+ }
+ pollDTO.setNbVotes(ePoll.getVote().size());
}
if (ePoll.getComment().size() > 0) {
pollDTO.setCommentDTOs(commentConverter.createCommentDTOs(ePoll
Modified: branches/pollen-1.2.3-1.2.x/pollen-business/src/main/java/org/chorem/pollen/business/dto/PollDTO.java
===================================================================
--- branches/pollen-1.2.3-1.2.x/pollen-business/src/main/java/org/chorem/pollen/business/dto/PollDTO.java 2010-03-08 13:33:31 UTC (rev 2900)
+++ branches/pollen-1.2.3-1.2.x/pollen-business/src/main/java/org/chorem/pollen/business/dto/PollDTO.java 2010-03-08 14:42:47 UTC (rev 2901)
@@ -76,6 +76,8 @@
private String creatorEmail = "";
+ private int nbVotes;
+
private List<CommentDTO> commentDTOs = new ArrayList<CommentDTO>();
private List<VotingListDTO> votingListDTOs = new ArrayList<VotingListDTO>();
@@ -284,6 +286,14 @@
this.creatorEmail = creatorEmail;
}
+ public int getNbVotes() {
+ return nbVotes;
+ }
+
+ public void setNbVotes(int nbVotes) {
+ this.nbVotes = nbVotes;
+ }
+
public List<CommentDTO> getCommentDTOs() {
return commentDTOs;
}
Modified: branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java
===================================================================
--- branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java 2010-03-08 13:33:31 UTC (rev 2900)
+++ branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java 2010-03-08 14:42:47 UTC (rev 2901)
@@ -295,6 +295,17 @@
return imgContext;
}
+ @InjectComponent
+ private FeedBack voteFeedback;
+
+ public String getVoteSizeMessage() {
+ if (log.isDebugEnabled()) {
+ log.debug("poll voteDTOs list size : " + poll.getVoteDTOs().size());
+ log.debug("poll nbVotes : " + poll.getNbVotes());
+ }
+ return messages.format("vote-size", poll.getNbVotes());
+ }
+
/** Méthode appelée après la soumission du vote. */
@Log
Object onSuccessFromVoteForm() {
@@ -388,6 +399,7 @@
addFeedEntry(PollAction.ADDVOTE, pollAccount.getVotingId(),
getResultsAsString());
sendMailNotification();
+ voteFeedback.addInfo(messages.get("vote-success"));
}
voteChoices.clear();
return pollZone.getBody();
Modified: branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/VoteForPoll_en.properties
===================================================================
--- branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/VoteForPoll_en.properties 2010-03-08 13:33:31 UTC (rev 2900)
+++ branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/VoteForPoll_en.properties 2010-03-08 14:42:47 UTC (rev 2901)
@@ -12,12 +12,14 @@
results-help=Display results
#vote
+vote-size=%d votes has been saved.
anonymous=anonymous
description=Description
voterName=Voter
pollAccountName-required-message=You must provide your name.
anonymousVote-label=Anonymous vote
submitVote=Vote
+vote-success=Your vote has been correctly saved.
#choices
addChoice=Adding a choice
Modified: branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/VoteForPoll_fr.properties
===================================================================
--- branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/VoteForPoll_fr.properties 2010-03-08 13:33:31 UTC (rev 2900)
+++ branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/VoteForPoll_fr.properties 2010-03-08 14:42:47 UTC (rev 2901)
@@ -1,23 +1,25 @@
title=Vote
-about=à propos du sondage
-creator-label=Créateur :
-beginDate-label=Date de début :
+about=\u00C3\u00A0 propos du sondage
+creator-label=Cr\u00C3\u00A9ateur :
+beginDate-label=Date de d\u00C3\u00A9but :
endDate-label=Date de fin :
pollType-label=Type de sondage :
-normalVote-help=Vote normal : voter pour le ou les choix préférés.
-percentageVote-help=Vote par pourcentage : répartir les choix de manière à obtenir 100% au total.
-condorcetVote-help=Vote Condorcet : classer les choix par ordre de préférence de 1 à N (1=préféré). Seul l'ordre des choix compte, peu importe les valeurs. Deux choix peuvent avoir la même valeur.
-numberVote-help=Vote par nombre : La réponse est libre, laissez vide ou entrez un nombre entier
-results=Résultats
-results-help=Voir les résultats
+normalVote-help=Vote normal : voter pour le ou les choix pr\u00C3\u00A9f\u00C3\u00A9r\u00C3\u00A9s.
+percentageVote-help=Vote par pourcentage : r\u00C3\u00A9partir les choix de mani\u00C3\u00A8re \u00C3\u00A0 obtenir 100% au total.
+condorcetVote-help=Vote Condorcet : classer les choix par ordre de pr\u00C3\u00A9f\u00C3\u00A9rence de 1 \u00C3\u00A0 N (1=pr\u00C3\u00A9f\u00C3\u00A9r\u00C3\u00A9). Seul l'ordre des choix compte, peu importe les valeurs. Deux choix peuvent avoir la m\u00C3\u00AAme valeur.
+numberVote-help=Vote par nombre : La r\u00C3\u00A9ponse est libre, laissez vide ou entrez un nombre entier
+results=R\u00C3\u00A9sultats
+results-help=Voir les r\u00C3\u00A9sultats
#vote
+vote-size=%d votes on \u00E9t\u00E9 enregistr\u00E9s
anonymous=anonyme
description=Description
voterName=Votant
pollAccountName-required-message=Vous devez saisir votre nom.
anonymousVote-label=Vote anonyme
submitVote=Voter
+vote-success=Votre vote a bien \u00E9t\u00E9 enregistr\u00E9
#choices
addChoice=Ajout d'un choix
@@ -26,19 +28,19 @@
textDesc-label=Description
imgFile-label=Image *
imgFile-regexp=\\.(jpe?g|gif|png|JPE?G|GIF|PNG)$
-imgFile-regexp-message=L'image doit-être au format JPG, GIF ou PNG.
+imgFile-regexp-message=L'image doit-\u00C3\u00AAtre au format JPG, GIF ou PNG.
imgFile-required-message=Vous devez saisir un choix.
imgDesc-label=Description
dateDTF-label=Date et heure *
dateDTF-regexp=\\d{2}\/\\d{2}\/\\d{4}( \\d{2}\\:\\d{2})?
-dateDTF-regexp-message=La date de début doit-être au format 31/12/2000 23:59.
+dateDTF-regexp-message=La date de d\u00C3\u00A9but doit-\u00C3\u00AAtre au format 31/12/2000 23:59.
dateDTF-required-message=Vous devez saisir un choix.
dateDesc-label=Description
DTF-pattern=dd/MM/yyyy HH:mm
submitChoice=Ajouter
#comments
-comments=Commentaires à propos du sondage
+comments=Commentaires \u00C3\u00A0 propos du sondage
commenterName-label=Nom
commenterName-required-message=Vous devez saisir votre nom.
commentArea-label=Commentaire
@@ -46,14 +48,14 @@
submitComment=Ajouter un commentaire
#messages
-pollNotFound=Il n'y a pas de sondage à cette adresse. Veuillez verifier que vous utilisez le lien correcte et copiez-le complètement dans le champ d'adresse de votre navigateur.
+pollNotFound=Il n'y a pas de sondage \u00C3\u00A0 cette adresse. Veuillez verifier que vous utilisez le lien correcte et copiez-le compl\u00C3\u00A8tement dans le champ d'adresse de votre navigateur.
anonymousForbidden=Le vote anonyme est interdit pour ce sondage. Saisissez un nom.
-restrictedListsForbidden=Le sondage est restreint et le nom %s n'est pas autorisé.
-alreadyVoted=Une personne a déjà voté sous le nom %s.
+restrictedListsForbidden=Le sondage est restreint et le nom %s n'est pas autoris\u00C3\u00A9.
+alreadyVoted=Une personne a d\u00C3\u00A9j\u00C3\u00A0 vot\u00C3\u00A9 sous le nom %s.
tooManyChoices=Le nombre de choix maximal est de %d.
-not100percent=La somme des valeurs doit être égale à 100.
-choiceExists=Le choix %s existe déjà.
-pollNotStarted=Ce sondage n'a pas encore commencé.
-pollFinished=Ce sondage est terminé. Vous ne pouvez plus voter.
+not100percent=La somme des valeurs doit \u00C3\u00AAtre \u00C3\u00A9gale \u00C3\u00A0 100.
+choiceExists=Le choix %s existe d\u00C3\u00A9j\u00C3\u00A0.
+pollNotStarted=Ce sondage n'a pas encore commenc\u00C3\u00A9.
+pollFinished=Ce sondage est termin\u00C3\u00A9. Vous ne pouvez plus voter.
pollClosed=Ce sondage est clos. Vous ne pouvez plus voter.
pollChoiceRunning=L'ajout de choix est possible.
\ No newline at end of file
Modified: branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/webapp/css/vote.css
===================================================================
--- branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/webapp/css/vote.css 2010-03-08 13:33:31 UTC (rev 2900)
+++ branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/webapp/css/vote.css 2010-03-08 14:42:47 UTC (rev 2901)
@@ -22,18 +22,22 @@
}
#pollZone {
- padding: 10px;
- text-align: center;
- -moz-border-radius: 15px;
+ /*padding: 10px;*/
+ text-align: center;
+ -moz-border-radius: 15px;
}
+#pollZone form {
+ margin-top: 10px;
+}
+
#poll {
- border-collapse: collapse;
- border-left: 1px solid #aab;
- border-top: 1px solid #aab;
- background-color: #fff;
- font-size: 14px;
- margin: auto;
+ border-collapse: collapse;
+ border-left: 1px solid #aab;
+ border-top: 1px solid #aab;
+ background-color: #fff;
+ font-size: 14px;
+ margin: auto;
}
#poll THEAD,
Modified: branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/webapp/poll/VoteForPoll.tml
===================================================================
--- branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/webapp/poll/VoteForPoll.tml 2010-03-08 13:33:31 UTC (rev 2900)
+++ branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/webapp/poll/VoteForPoll.tml 2010-03-08 14:42:47 UTC (rev 2901)
@@ -46,6 +46,8 @@
<!-- Sondage -->
<t:zone t:id="pollZone" t:show="show" t:update="show">
+ <p>${voteSizeMessage}</p>
+ <t:feedback t:id="voteFeedback"/>
<t:form t:id="voteForm" t:zone="pollZone">
<table id="poll">
<thead>
@@ -157,74 +159,76 @@
</tfoot>
</t:if>
<tbody>
- <t:loop t:source="poll.voteDTOs" t:value="vote" volatile="true">
- <tr>
- <td class="${evenodd.next}">
- <t:if test="${AccountFieldDisplayed}">
- <t:unless test="${currentVoteAnonymous}">
- ${currentVotingId}
- <p:else>
- ?
- </p:else>
+ <t:unless t:test="poll.anonymous">
+ <t:loop t:source="poll.voteDTOs" t:value="vote" volatile="true">
+ <tr>
+ <td class="${evenodd.next}">
+ <t:if test="${AccountFieldDisplayed}">
+ <t:unless test="${currentVoteAnonymous}">
+ ${currentVotingId}
+ <p:else>
+ ?
+ </p:else>
+ </t:unless>
+ </t:if>
+ <t:unless test="${poll.anonymous}">
+ <t:if test="isModifAllowed(currentVotingId)">
+ <t:actionlink t:id="editVote" context="${currentVotingId}" t:zone="pollZone">
+ <img src="${asset:context:img/editSmall.png}" title="${message:edit}" alt="${message:edit}"/>
+ </t:actionlink>
+ </t:if>
+ <t:if test="creatorUser">
+ <t:actionlink t:id="deleteVote" context="vote.id" t:zone="pollZone">
+ <img src="${asset:context:img/delete.png}" title="${message:delete}" alt="${message:delete}"/>
+ </t:actionlink>
+ </t:if>
</t:unless>
- </t:if>
- <t:unless test="${poll.anonymous}">
- <t:if test="isModifAllowed(currentVotingId)">
- <t:actionlink t:id="editVote" context="${currentVotingId}" t:zone="pollZone">
- <img src="${asset:context:img/editSmall.png}" title="${message:edit}" alt="${message:edit}"/>
- </t:actionlink>
- </t:if>
- <t:if test="creatorUser">
- <t:actionlink t:id="deleteVote" context="vote.id" t:zone="pollZone">
- <img src="${asset:context:img/delete.png}" title="${message:delete}" alt="${message:delete}"/>
- </t:actionlink>
- </t:if>
- </t:unless>
- </td>
- <t:loop t:source="poll.choiceDTOs" t:value="choiceOfPoll" volatile="true">
- <t:if test="!isChoiceHidden()">
- ${setCurrentVoteChoice()}
- <t:if test="${poll.anonymous}">
- <td class="anonymous">?</td>
- <p:else>
- <t:if test="isNormalVoteCounting()">
- <t:if test="isChoiceInVote(currentVoteChoice)">
- <td class="voted">OK</td>
- <p:else>
- <td class="notVoted"></td>
- </p:else>
- </t:if>
- </t:if>
- <t:if test="isPercentageVoteCounting()">
- <t:if test="isChoiceInVote(currentVoteChoice)">
- <td class="voted">${currentVoteChoice.value} %</td>
- <p:else>
- <td class="notVoted"></td>
- </p:else>
- </t:if>
- </t:if>
- <t:if test="isCondorcetVoteCounting()">
- <t:if test="isChoiceInVote(currentVoteChoice)">
- <td class="voted">${currentVoteChoice.value}</td>
- <p:else>
- <td class="notVoted"></td>
- </p:else>
- </t:if>
- </t:if>
- <t:if test="isNumberVoteCounting()">
- <t:if test="isChoiceInVote(currentVoteChoice)">
- <td class="voted">${currentVoteChoice.value}</td>
- <p:else>
- <td class="notVoted"></td>
- </p:else>
- </t:if>
- </t:if>
- </p:else>
- </t:if>
- </t:if>
- </t:loop>
- </tr>
- </t:loop>
+ </td>
+ <t:loop t:source="poll.choiceDTOs" t:value="choiceOfPoll" volatile="true">
+ <t:unless t:test="choiceHidden">
+ ${setCurrentVoteChoice()}
+ <t:if t:test="poll.anonymous">
+ <td class="anonymous">?</td>
+ <p:else>
+ <t:if test="isNormalVoteCounting()">
+ <t:if test="isChoiceInVote(currentVoteChoice)">
+ <td class="voted">OK</td>
+ <p:else>
+ <td class="notVoted"></td>
+ </p:else>
+ </t:if>
+ </t:if>
+ <t:if test="isPercentageVoteCounting()">
+ <t:if test="isChoiceInVote(currentVoteChoice)">
+ <td class="voted">${currentVoteChoice.value} %</td>
+ <p:else>
+ <td class="notVoted"></td>
+ </p:else>
+ </t:if>
+ </t:if>
+ <t:if test="isCondorcetVoteCounting()">
+ <t:if test="isChoiceInVote(currentVoteChoice)">
+ <td class="voted">${currentVoteChoice.value}</td>
+ <p:else>
+ <td class="notVoted"></td>
+ </p:else>
+ </t:if>
+ </t:if>
+ <t:if test="isNumberVoteCounting()">
+ <t:if test="isChoiceInVote(currentVoteChoice)">
+ <td class="voted">${currentVoteChoice.value}</td>
+ <p:else>
+ <td class="notVoted"></td>
+ </p:else>
+ </t:if>
+ </t:if>
+ </p:else>
+ </t:if>
+ </t:unless>
+ </t:loop>
+ </tr>
+ </t:loop>
+ </t:unless>
<t:if test="poll.continuousResults">
<tr>
<td>
1
0
r2900 - in branches/pollen-1.2.3-1.2.x/pollen-ui/src/main: java/org/chorem/pollen/ui/pages/poll resources/org/chorem/pollen/ui/pages/poll webapp/poll
by fdesbois@users.chorem.org 08 Mar '10
by fdesbois@users.chorem.org 08 Mar '10
08 Mar '10
Author: fdesbois
Date: 2010-03-08 14:33:31 +0100 (Mon, 08 Mar 2010)
New Revision: 2900
Log:
Ano #131 : can't update a big list when updating the poll
Modified:
branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollModification.java
branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollModification_en.properties
branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollModification_fr.properties
branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/webapp/poll/PollModification.tml
Modified: branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollModification.java
===================================================================
--- branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollModification.java 2010-03-08 13:23:02 UTC (rev 2899)
+++ branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollModification.java 2010-03-08 13:33:31 UTC (rev 2900)
@@ -489,6 +489,11 @@
}
}
+ public boolean isListSizeAlert() {
+ return votingList.getPollAccountDTOs().size() >
+ PollCreation.LIST_MAX_SHOW_PERSONS;
+ }
+
public boolean isInPoll() {
return step == PollStep.POLL;
}
Modified: branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollModification_en.properties
===================================================================
--- branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollModification_en.properties 2010-03-08 13:23:02 UTC (rev 2899)
+++ branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollModification_en.properties 2010-03-08 13:33:31 UTC (rev 2900)
@@ -63,6 +63,7 @@
groupWeight-label=Weight
list-validate=Persons names must be unique.
lists-validate=Lists names must be unique.
+list-maxSize-cant-update=The voting list is too large to be updated.
#choices
choicesLegend=Step %d: poll choices
Modified: branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollModification_fr.properties
===================================================================
--- branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollModification_fr.properties 2010-03-08 13:23:02 UTC (rev 2899)
+++ branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollModification_fr.properties 2010-03-08 13:33:31 UTC (rev 2900)
@@ -63,6 +63,7 @@
groupWeight-label=Poids
list-validate=Les noms des votants doivent \u00EAtre uniques.
lists-validate=Les noms des listes doivent \u00EAtre uniques.
+list-maxSize-cant-update=La liste de votants est trop grande pour \u00EAtre modifi\u00E9e.
#choices
choicesLegend=\u00C9tape %d : les choix de votre sondage
Modified: branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/webapp/poll/PollModification.tml
===================================================================
--- branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/webapp/poll/PollModification.tml 2010-03-08 13:23:02 UTC (rev 2899)
+++ branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/webapp/poll/PollModification.tml 2010-03-08 13:33:31 UTC (rev 2900)
@@ -128,16 +128,21 @@
<t:textfield t:id="groupName" t:value="votingList.name" validate="required" />
- ${message:groupWeight-label} ${weightAsInt}
</div>
- <div t:type="loop" t:source="votingList.pollAccountDTOs" t:value="votingListPerson" t:volatile="true">
- <t:label for="personName" />
- <t:textfield t:id="personName" t:value="votingListPerson.votingId" validate="required" t:disabled="votingListPerson.hasVoted"/>
- -
- <t:label for="personEmail" />
- <t:textfield t:id="personEmail" t:value="votingListPerson.email" validate="regexp" t:disabled="votingListPerson.hasVoted"/>
- -
- <t:label for="personWeight" />
- <t:textfield t:id="personWeight" t:value="votingListPerson.weight" t:size="1" validate="required,min=1" t:disabled="votingListPerson.hasVoted"/>
- </div>
+ <t:unless t:test="listSizeAlert">
+ <div t:type="loop" t:source="votingList.pollAccountDTOs" t:value="votingListPerson" t:volatile="true">
+ <t:label for="personName" />
+ <t:textfield t:id="personName" t:value="votingListPerson.votingId" validate="required" t:disabled="votingListPerson.hasVoted"/>
+ -
+ <t:label for="personEmail" />
+ <t:textfield t:id="personEmail" t:value="votingListPerson.email" validate="regexp" t:disabled="votingListPerson.hasVoted"/>
+ -
+ <t:label for="personWeight" />
+ <t:textfield t:id="personWeight" t:value="votingListPerson.weight" t:size="1" validate="required,min=1" t:disabled="votingListPerson.hasVoted"/>
+ </div>
+ <p:else>
+ ${message:list-maxSize-cant-update}
+ </p:else>
+ </t:unless>
</div>
</fieldset>
<div class="buttons">
1
0
r2899 - in branches/pollen-1.2.3-1.2.x/pollen-ui/src/main: java/org/chorem/pollen/ui/pages/poll resources/org/chorem/pollen/ui/pages/poll webapp/js webapp/poll
by fdesbois@users.chorem.org 08 Mar '10
by fdesbois@users.chorem.org 08 Mar '10
08 Mar '10
Author: fdesbois
Date: 2010-03-08 14:23:02 +0100 (Mon, 08 Mar 2010)
New Revision: 2899
Log:
Ano #131 : display a message if the list is greater than 20 persons when creating the poll
Modified:
branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollCreation.java
branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollCreation_en.properties
branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollCreation_fr.properties
branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/webapp/js/pollen.js
branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/webapp/poll/PollCreation.tml
Modified: branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollCreation.java
===================================================================
--- branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollCreation.java 2010-03-05 17:42:37 UTC (rev 2898)
+++ branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollCreation.java 2010-03-08 13:23:02 UTC (rev 2899)
@@ -47,6 +47,7 @@
import org.apache.tapestry5.ioc.annotations.Symbol;
import org.apache.tapestry5.ioc.services.PropertyAccess;
import org.apache.tapestry5.json.JSONObject;
+import org.apache.tapestry5.services.Request;
import org.apache.tapestry5.upload.services.UploadSymbols;
import org.chorem.pollen.business.business.PreventRuleManager;
import org.chorem.pollen.business.dto.ChoiceDTO;
@@ -1013,6 +1014,7 @@
* zone.
*/
public JSONObject onChangeFromListSelect(String value) {
+ JSONObject result = new JSONObject();
if (!"".equals(value)) {
personList = serviceList.findPersonListById(value);
@@ -1024,11 +1026,45 @@
votingLists.get(currentList).setPollAccountDTOs(
personList.getPollAccountDTOs());
+
+ int size = personList.getPollAccountDTOs().size();
+
+ if (log.isDebugEnabled()) {
+ log.debug("List size : " + size);
+ }
+
+ // If the list size is too large, an alert message will be shown
+ if (size > LIST_MAX_SHOW_PERSONS) {
+ result.put("listAlert", messages.format("list-maxSize-alert",
+ personList.getName(), size));
+ }
}
- return createParamsForCallback();
+ return createParamsForCallback(result);
}
+ /** TODO : move this value to pollen.properties, waiting for 1.3 version **/
+ public static final int LIST_MAX_SHOW_PERSONS = 20;
+
/**
+ * Test if the list size made an alert (too large to be shown).
+ *
+ * @return true if the current list size is > to LIST_MAX_SHOW_PERSONS
+ */
+ public boolean isListSizeAlert() {
+ return votingList.getPollAccountDTOs().size() > LIST_MAX_SHOW_PERSONS;
+ }
+
+ /**
+ * Get the message to show when the too large list size is loaded.
+ *
+ * @return the localized message to show when big list is loaded.
+ */
+ public String getListMaxSizeLoadedMessage() {
+ return messages.format("list-maxSize-loaded", votingList.getName(),
+ votingList.getPollAccountDTOs().size());
+ }
+
+ /**
* Méthode appelée à la sélection d'un type de choix. Le mixin ck/OnEvent ne
* permet pas de retourner le contenu d'une zone. Il faut donc passer par
* une fonction JavaScript pour activer un event link. Un lien est créé. Il
@@ -1040,7 +1076,7 @@
*/
public JSONObject onChangeFromChoiceType(String value) {
poll.setChoiceType(ChoiceType.valueOf(value));
- return createParamsForCallback();
+ return createParamsForCallback(new JSONObject());
}
/**
@@ -1049,8 +1085,8 @@
*
* @return un JSONObject contenant un zoneId et une url.
*/
- private JSONObject createParamsForCallback() {
- JSONObject json = new JSONObject();
+ private JSONObject createParamsForCallback(JSONObject json) {
+ //JSONObject json = new JSONObject();
Link link = resources.createEventLink("updatePollCreationZone");
json.put("link", link.toAbsoluteURI());
json.put("zoneId", "pollCreationZone");
Modified: branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollCreation_en.properties
===================================================================
--- branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollCreation_en.properties 2010-03-05 17:42:37 UTC (rev 2898)
+++ branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollCreation_en.properties 2010-03-08 13:23:02 UTC (rev 2899)
@@ -83,6 +83,8 @@
noList-validate=A list must contain at least one person.
list-validate=Persons names must be unique.
lists-validate=Lists names must be unique.
+list-maxSize-alert=The list %s contains too many persons (%d) to be shown. You can manage your list on page 'Voting Lists' in 'Polls' menu.
+list-maxSize-loaded=List %s with %d persons is correctly loaded, you can go to the next step.
#choices
choicesLegend=Step %d : poll choices
Modified: branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollCreation_fr.properties
===================================================================
--- branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollCreation_fr.properties 2010-03-05 17:42:37 UTC (rev 2898)
+++ branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollCreation_fr.properties 2010-03-08 13:23:02 UTC (rev 2899)
@@ -83,6 +83,8 @@
noList-validate=Une liste doit contenir au moins un votant.
list-validate=Les noms des votants doivent \u00EAtre uniques.
lists-validate=Les noms des listes doivent \u00EAtre uniques.
+list-maxSize-alert=La liste %s contient trop de votants (%d) pour \u00EAtre affich\u00E9e. Vous pouvez g\u00E9rer votre liste sur la page 'Liste de votants' dans le menu 'Sondages'.
+list-maxSize-loaded=Liste %s de %d votants correctement charg\u00E9, vous pouvez passer \u00E0 l'\u00E9tape suivante.
#choices
choicesLegend=\u00C9tape %d : les choix de votre sondage
Modified: branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/webapp/js/pollen.js
===================================================================
--- branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/webapp/js/pollen.js 2010-03-05 17:42:37 UTC (rev 2898)
+++ branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/webapp/js/pollen.js 2010-03-08 13:23:02 UTC (rev 2899)
@@ -30,5 +30,10 @@
*/
function onCompleteZoneUpdate(response) {
var zoneManager = Tapestry.findZoneManagerForZone(response.zoneId);
+
+ if (response.listAlert) {
+ alert(response.listAlert);
+ }
+
zoneManager.updateFromURL(response.link);
}
\ No newline at end of file
Modified: branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/webapp/poll/PollCreation.tml
===================================================================
--- branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/webapp/poll/PollCreation.tml 2010-03-05 17:42:37 UTC (rev 2898)
+++ branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/webapp/poll/PollCreation.tml 2010-03-08 13:23:02 UTC (rev 2899)
@@ -195,17 +195,22 @@
<t:label for="groupWeight" />
<t:textfield t:id="groupWeight" t:value="votingList.weight" t:size="1" validate="required,min=1" />
</div>
- <div t:type="loop" t:source="votingList.pollAccountDTOs" t:value="votingListPerson" t:volatile="true">
- <t:label for="personName" />
- <t:textfield t:id="personName" t:value="votingListPerson.votingId" />
- -
- <t:label for="personEmail" />
- <t:textfield t:id="personEmail" t:value="votingListPerson.email" validate="regexp" />
- -
- <t:label for="personWeight" />
- <t:textfield t:id="personWeight" t:value="votingListPerson.weight" t:size="1" validate="required,min=1" />
- </div>
- <t:submit t:id="addPerson" t:value="${message:addPerson}" t:context="${votingListIndex}" t:defer="false"/>
+ <t:unless t:test="listSizeAlert">
+ <div t:type="loop" t:source="votingList.pollAccountDTOs" t:value="votingListPerson" t:volatile="true">
+ <t:label for="personName" />
+ <t:textfield t:id="personName" t:value="votingListPerson.votingId" />
+ -
+ <t:label for="personEmail" />
+ <t:textfield t:id="personEmail" t:value="votingListPerson.email" validate="regexp" />
+ -
+ <t:label for="personWeight" />
+ <t:textfield t:id="personWeight" t:value="votingListPerson.weight" t:size="1" validate="required,min=1" />
+ </div>
+ <t:submit t:id="addPerson" t:value="${message:addPerson}" t:context="${votingListIndex}" t:defer="false"/>
+ <p:else>
+ ${listMaxSizeLoadedMessage}
+ </p:else>
+ </t:unless>
</div>
</fieldset>
<div class="buttons">
1
0
r2898 - branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources
by echatellier@users.chorem.org 05 Mar '10
by echatellier@users.chorem.org 05 Mar '10
05 Mar '10
Author: echatellier
Date: 2010-03-05 18:42:37 +0100 (Fri, 05 Mar 2010)
New Revision: 2898
Log:
On utilise pas free si possible
Modified:
branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/pollen.properties
Modified: branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/pollen.properties
===================================================================
--- branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/pollen.properties 2010-03-05 15:19:37 UTC (rev 2897)
+++ branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/resources/pollen.properties 2010-03-05 17:42:37 UTC (rev 2898)
@@ -38,7 +38,7 @@
upload.requestsize-max=10485760
## Configuration de l'envoi d'emails automatiques
-email_host=smtp.free.fr
+email_host=smtp
email_port=25
email_from=bot(a)pollen.org
1
0
r2897 - in trunk/pollen-ui/src/main: java/org/chorem/pollen/ui/pages/poll webapp/js webapp/poll
by fdesbois@users.chorem.org 05 Mar '10
by fdesbois@users.chorem.org 05 Mar '10
05 Mar '10
Author: fdesbois
Date: 2010-03-05 16:19:37 +0100 (Fri, 05 Mar 2010)
New Revision: 2897
Log:
Evo #122 : use custom pollForm.js instead of mixin zoneUpdater to manage interactions internal to the form.
Added:
trunk/pollen-ui/src/main/webapp/js/pollForm.js
Modified:
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollForm.java
trunk/pollen-ui/src/main/webapp/js/pollen.js
trunk/pollen-ui/src/main/webapp/poll/PollForm.tml
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollForm.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollForm.java 2010-03-05 09:55:30 UTC (rev 2896)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollForm.java 2010-03-05 15:19:37 UTC (rev 2897)
@@ -2,13 +2,15 @@
package org.chorem.pollen.ui.pages.poll;
import java.text.DateFormat;
-import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.apache.commons.lang.StringUtils;
-import org.apache.tapestry5.ValidationException;
+import org.apache.tapestry5.RenderSupport;
+import org.apache.tapestry5.annotations.Environmental;
+import org.apache.tapestry5.annotations.IncludeJavaScriptLibrary;
import org.apache.tapestry5.annotations.IncludeStylesheet;
import org.apache.tapestry5.annotations.InjectComponent;
+import org.apache.tapestry5.annotations.Log;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.annotations.SessionState;
@@ -51,6 +53,7 @@
* par : $Author$
*/
@IncludeStylesheet("context:css/poll.css")
+@IncludeJavaScriptLibrary("context:js/pollForm.js")
public class PollForm {
@Inject
@@ -163,13 +166,32 @@
return new SimpleDateFormat(messages.get("date-pattern"));
}
+ @Environmental
+ private RenderSupport renderSupport;
+
+ /**
+ * Action when rendering form. A script is added to manage form interactions
+ */
+ @Log
+ void onPrepareForRender() {
+ String formId = mainForm.getClientId();
+ if (log.isDebugEnabled()) {
+ log.debug("form id : " + formId);
+ }
+ if (formId != null) {
+ // Script for form interactions : see "webapp/js/pollForm.js"
+ renderSupport.addScript("new PollForm('%s', '%s', '%s');",
+ formId,
+ VoteCountingType.NORMAL,
+ PollType.FREE);
+ }
+ }
+
/**************************** MAIN INFOS **********************************/
@InjectComponent
private Form mainForm;
- private Date beginDateValidation;
-
@Persist
@Property
private boolean advancedOptions;
@@ -178,109 +200,6 @@
advancedOptions = false;
}
- void onChangeFromCreatorName(String value) {
- getPoll().setCreatorName(value);
- }
-
- /**
- * Action on creatorEmail textfield. This action refresh the form to
- * actualize options, only if needed {@link #isNotificationDisabled()}
- *
- * @param value of the email
- * @return the form to refresh
- */
- Object onChangeFromEmail(String value) {
- boolean notificationDisabled = isNotificationDisabled();
- getPoll().setCreatorEmail(value);
- // The notification option depends on email change
- // If it must be disabled and sendNotification checkbox is activated,
- // execute change on notification fields
- if (isNotificationDisabled() && hasNotification) {
- return onChangeFromSendNotification("");
- }
- return null;
- }
-
- void onChangeFromTitle(String value) {
- getPoll().setTitle(value);
- }
-
- void onChangeFromDescription(String value) {
- getPoll().setDescription(value);
- }
-
- void onChangeFromBeginDate(String value) {
- getPoll().setBeginDate(getDateFromChangeValue(value));
- }
-
- void onChangeFromEndDate(String value) {
- getPoll().setEndDate(getDateFromChangeValue(value));
- }
-
- /**
- * Util method to simplify date change.
- *
- * @param value of the date to parse
- * @return the date resulted from the value
- */
- protected Date getDateFromChangeValue(String value) {
- Date result = null;
- if (StringUtils.isNotEmpty(value)) {
- try {
- result = getDateFormat().parse(value);
- } catch (ParseException eee) {
- log.warn("Syntax error for poll date : " + value, eee);
- }
- }
- return result;
- }
-
- /**
- * Action on voteCounting select. This action refresh the form to actualize
- * options.
- *
- * @param value of the selected PollType
- * @return the form to refresh
- */
- Object onChangeFromVoteCounting(String value) {
- if (log.isDebugEnabled()) {
- log.debug("voteCounting change to value : " + value);
- }
- getPoll().setVoteCounting(VoteCountingType.valueOf(value));
- // The choiceNb option depends on VoteCounting type
- // If it must be disabled and choiceNb checkbox is activated,
- // execute change on choiceNb fields
- if (isChoiceNbDisabled() && hasChoiceNb) {
- return onChangeFromChoiceNb("");
- }
- return mainForm;
- }
-
- /**
- * Action on pollType select. This action refresh the form to actualize
- * options.
- *
- * @param value of the selected PollType
- * @return the form to refresh
- */
- Object onChangeFromPollType(String value) {
- if (log.isDebugEnabled()) {
- log.debug("pollType change to value : " + value);
- }
- getPoll().setPollType(PollType.valueOf(value));
- // The reminder option depends on PollType
- // If it must be disabled and reminder checkbox is activated, execute
- // change on reminder fields
- if (isReminderDisabled() && hasReminder) {
- return onChangeFromSendReminder("");
- }
- return mainForm;
- }
-
- void onChangeFromAdvancedOptions(String value) {
- advancedOptions = !advancedOptions;
- }
-
/************************** OPTIONS ***************************************/
/** Synchronization with anonymous and anonymousVoteAllowed options **/
@@ -322,132 +241,15 @@
hasReminder = false;
}
- //~~~~~~~~ OPTIONS ANONYMOUS ~~~~~~//
-
- /**
- * Action on anonymous checkbox. The anonymousVoteAllowed is synchronized
- * with this option.
- *
- * @param value not used in this case
- * @return the form to refresh
- */
- Object onChangeFromAnonymous(String value) {
- boolean anonymous = !getPoll().getAnonymous();
- getPoll().setAnonymous(anonymous);
- // Synchro with anonymousVoteAllowed option
- // Will be disabled and set to true if anonymous option is set
- getPoll().setAnonymousVoteAllowed(anonymous);
- anonymousVoteAllowedDisabled = anonymous;
- return mainForm;
- }
-
- void onChangeFromAnonymousVoteAllowed(String value) {
- getPoll().setAnonymousVoteAllowed(!getPoll().getAnonymousVoteAllowed());
- }
-
- //~~~~~~~~ OPTIONS SHOW RESULTS ~~~~~~//
-
- /**
- * Action on continuousResults checkbox. The publicResults is synchronized
- * with this option.
- *
- * @param value not used in this case
- * @return the form to refresh
- */
- Object onChangeFromContinuousResults(String value) {
- boolean continuous = !getPoll().getContinuousResults();
- getPoll().setContinuousResults(continuous);
- // Synchro with publicResults option
- // Will be disabled and set to true if continousResults option is set
- getPoll().setPublicResults(continuous);
- publicResultsDisabled = continuous;
- return mainForm;
- }
-
- void onChangeFromPublicResults(String value) {
- getPoll().setPublicResults(!getPoll().getPublicResults());
- }
-
- //~~~~~~~~ OPTION ADD_CHOICE_ALLOWED ~~~~~~//
-
- /**
- * Action on choiceAddAllowed checkbox. The beginChoiceDate and
- * endChoiceDate of the poll depends on this value.
- * If the value becomes to false, the dates will be reinitialized.
- *
- * @param value not used in this case
- * @return the form to refresh
- */
- Object onChangeFromChoiceAddAllowed(String value) {
- boolean choiceAddAllowed = !getPoll().getChoiceAddAllowed();
- getPoll().setChoiceAddAllowed(choiceAddAllowed);
- if (!choiceAddAllowed) {
- getPoll().setBeginChoiceDate(null);
- getPoll().setEndChoiceDate(null);
- }
- return mainForm;
- }
-
- public String getChoiceDateStyle() {
- return getPoll().getChoiceAddAllowed() ? "display" : "hidden";
- }
-
- void onChangeFromBeginChoiceDate(String value) {
- getPoll().setBeginChoiceDate(getDateFromChangeValue(value));
- }
-
- void onChangeFromEndChoiceDate(String value) {
- getPoll().setEndChoiceDate(getDateFromChangeValue(value));
- }
-
- //~~~~~~~~ OPTION NB_CHOICES ~~~~~~~~~~~~~~//
-
- /**
- * Action on choiceNb checkbox to activate the maxChoiceNb for the poll.
- * If the value becomes to false, the maxChoiceNb will be reinitialized
- *
- * @param value not used in this case
- * @return the form to refresh
- */
- Object onChangeFromChoiceNb(String value) {
- hasChoiceNb = !hasChoiceNb;
- if (!hasChoiceNb) {
- getPoll().setMaxChoiceNb(null);
- }
- return mainForm;
- }
-
public boolean isChoiceNbDisabled() {
// voteCounting not set to NORMAL
return getPoll().getVoteCounting() != VoteCountingType.NORMAL;
}
- public String getChoiceNbLabelStyle() {
- return isChoiceNbDisabled() ? "disabled" : "";
- }
- void onChangeFromMaxChoiceNb(String value) {
- getPoll().setMaxChoiceNb(Integer.parseInt(value));
- }
-
//~~~~~~~~ OPTION NOTIFICATION ~~~~~~~~~~~~//
/**
- * Action on sendNotification checkbox to activate the notification.
- * If the value becomes to false, the notification will be reinitialized
- *
- * @param value not used in this case
- * @return the form to refresh
- */
- Object onChangeFromSendNotification(String value) {
- hasNotification = !hasNotification;
- if (!hasNotification) {
- notification = null;
- }
- return mainForm;
- }
-
- /**
* Get the current notification or init a new one based on PreventRule.
*
* @return the notification
@@ -470,32 +272,9 @@
return StringUtils.isEmpty(getPoll().getCreatorEmail());
}
- public String getNotificationLabelStyle() {
- return isNotificationDisabled() ? "disabled" : "";
- }
-
- public void onChangeFromNotification(String value) {
- getNotification().setSensibility(Integer.parseInt(value));
- }
-
//~~~~~~~~ OPTION REMINDER ~~~~~~~~~~~~~~~~//
/**
- * Action on sendReminder checkbox to activate the reminder.
- * If the value becomes to false, the reminder will be reinitialized
- *
- * @param value not used in this case
- * @return the form to refresh
- */
- Object onChangeFromSendReminder(String value) {
- hasReminder = !hasReminder;
- if (!hasReminder) {
- reminder = null;
- }
- return mainForm;
- }
-
- /**
* Get the current reminder or init a new one based on PreventRule.
*
* @return the reminder
@@ -518,60 +297,5 @@
return getPoll().getPollType() == PollType.FREE;
}
- public String getReminderLabelStyle() {
- return isReminderDisabled() ? "disabled" : "";
- }
-
- public void onChangeFromReminder(String value) {
- getReminder().setSensibility(Integer.parseInt(value));
- }
-
-// /**
-// * Ajax validation from beginChoiceDate input. The date must be before the
-// * beginDate.
-// *
-// * @throws ValidationException
-// */
-// void onValidateFromBeginChoiceDate(Date value) throws ValidationException {
-// if (beginDateValidation == null) {
-// beginDateValidation = getCurrentDate();
-// }
-// beginChoiceDateValidation = value;
-// if (value != null && value.after(beginDateValidation)) {
-// throw new ValidationException(
-// messages.get("beginChoiceDate-validate"));
-// }
-// }
-//
-// /**
-// * Ajax validation from endChoiceDate input. The date must be after the
-// * beginChoiceDate.
-// *
-// * @throws ValidationException
-// */
-// void onValidateFromEndChoiceDate(Date value) throws ValidationException {
-// if (beginChoiceDateValidation == null) {
-// beginChoiceDateValidation = getCurrentDate();
-// }
-//
-// if (value != null && value.before(beginChoiceDateValidation)) {
-// throw new ValidationException(
-// messages.get("endChoiceDate-validate"));
-// }
-// }
-
-// private void initNotificationRule() {
-// notificationCheckBox = false;
-// newRule = new PreventRuleDTO("vote", 0, true,
-// PreventRuleManager.EMAIL_ACTION);
-// newRule.setPollId(poll.getId());
-// for (PreventRuleDTO rule : poll.getPreventRuleDTOs()) {
-// if ("vote".equals(rule.getScope())) {
-// notificationCheckBox = true;
-// newRule = rule;
-// }
-// }
-// }
-
}
Added: trunk/pollen-ui/src/main/webapp/js/pollForm.js
===================================================================
--- trunk/pollen-ui/src/main/webapp/js/pollForm.js (rev 0)
+++ trunk/pollen-ui/src/main/webapp/js/pollForm.js 2010-03-05 15:19:37 UTC (rev 2897)
@@ -0,0 +1,101 @@
+var PollForm = Class.create();
+
+PollForm.prototype = {
+
+ initialize: function(formId, voteCountingNormal, pollTypeFree) {
+
+// Tapestry.debug('Form id : ' + formId);
+
+ this.form = $(formId);
+
+// Tapestry.debug('Form : ' + this.form);
+
+ // Attributes for email and notification synchronization
+ this.email = this.form.email;
+ this.notification = this.form.sendNotification;
+ this.notificationFragmentId = 'notificationFragment';
+
+ // Attributes for voteCounting and choiceNb synchronization
+ this.voteCounting = this.form.voteCounting;
+ this.voteCountingNormal = voteCountingNormal;
+ this.choiceNbFragmentId = 'choiceNbFragment';
+ this.choiceNb = this.form.choiceNb;
+
+ // Attributes for anonymous options
+ this.anonymous = this.form.anonymous;
+ this.anonymousVoteAllowed = this.form.anonymousVoteAllowed;
+
+ // Attributes for continuousResults and publicResults options
+ this.continuousResults = this.form.continuousResults;
+ this.publicResults = this.form.publicResults;
+
+ // Attributes for pollType and reminder synchronization
+ this.pollType = this.form.pollType;
+ this.pollTypeFree = pollTypeFree;
+ this.reminder = this.form.sendReminder;
+ this.reminderFragmentId = 'reminderFragment';
+
+ this.voteCounting.observe('change', this.updateFromVoteCounting.bindAsEventListener(this));
+ this.pollType.observe('change', this.updateFromPollType.bindAsEventListener(this));
+ this.email.observe('blur', this.updateFromEmail.bindAsEventListener(this));
+ this.anonymous.observe('change', this.updateFromAnonymous.bindAsEventListener(this));
+ this.continuousResults.observe('change', this.updateFromContinuousResults.bindAsEventListener(this));
+ },
+
+ /*
+ * Action when voteCounting select change. This change affects choiceNb
+ * checkbox : choiceNb is only available if voteCounting is 'NORMAL'.
+ */
+ updateFromVoteCounting: function(event) {
+// Tapestry.debug('VoteCounting change to : ' + this.voteCounting.value);
+
+ if (this.voteCounting.value != this.voteCountingNormal) {
+ this.choiceNb.disabled = true;
+ this.choiceNb.checked = false;
+ $(this.choiceNbFragmentId).hide();
+ } else {
+ this.choiceNb.disabled = false;
+ }
+ },
+
+ /*
+ * Action when pollType select change. This change affects reminder
+ * checkbox : reminder is only available if pollType is not 'FREE'.
+ */
+ updateFromPollType: function(event) {
+// Tapestry.debug('PollType change to : ' + this.pollType.value);
+
+ if (this.pollType.value == this.pollTypeFree) {
+ this.reminder.disabled = true;
+ this.reminder.checked = false;
+ $(this.reminderFragmentId).hide();
+ } else {
+ this.reminder.disabled = false;
+ }
+ },
+
+ updateFromEmail: function(event) {
+// Tapestry.debug('Email change to : ' + this.email.value);
+
+ if (this.email.value && this.email.value != ' ') {
+ this.notification.disabled = false;
+ } else {
+ this.notification.disabled = true;
+ this.notification.checked = false;
+ $(this.notificationFragmentId).hide();
+ }
+ },
+
+ updateFromAnonymous: function(event) {
+ this.syncCheckboxes(this.anonymous, this.anonymousVoteAllowed);
+ },
+
+ updateFromContinuousResults: function(event) {
+ this.syncCheckboxes(this.continuousResults, this.publicResults);
+ },
+
+ syncCheckboxes: function(checkbox1, checkbox2) {
+ checkbox2.disabled = checkbox1.checked;
+ checkbox2.checked = checkbox1.checked;
+ }
+}
\ No newline at end of file
Modified: trunk/pollen-ui/src/main/webapp/js/pollen.js
===================================================================
--- trunk/pollen-ui/src/main/webapp/js/pollen.js 2010-03-05 09:55:30 UTC (rev 2896)
+++ trunk/pollen-ui/src/main/webapp/js/pollen.js 2010-03-05 15:19:37 UTC (rev 2897)
@@ -31,4 +31,26 @@
function onCompleteZoneUpdate(response) {
var zoneManager = Tapestry.findZoneManagerForZone(response.zoneId);
zoneManager.updateFromURL(response.link);
-}
\ No newline at end of file
+}
+
+function triggerFragment(checkbox, fragment) {
+ fragment.toggle();
+}
+
+function changeVoteCounting(element) {
+ var choiceNbCheckbox = element.form.choiceNb;
+
+ if (element.value != 'NORMAL') {
+ choiceNbCheckbox.disabled = true;
+ choiceNbCheckbox.checked = false;
+ $('choiceNbFragment').hide();
+ } else {
+ choiceNbCheckbox.disabled = false;
+ }
+}
+
+function synchronizeCheckboxes(checkbox1, checkbox2) {
+ checkbox2.disabled = checkbox1.checked;
+ checkbox2.checked = checkbox1.checked;
+}
+
Modified: trunk/pollen-ui/src/main/webapp/poll/PollForm.tml
===================================================================
--- trunk/pollen-ui/src/main/webapp/poll/PollForm.tml 2010-03-05 09:55:30 UTC (rev 2896)
+++ trunk/pollen-ui/src/main/webapp/poll/PollForm.tml 2010-03-05 15:19:37 UTC (rev 2897)
@@ -1,205 +1,191 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<t:border t:address="addressBar.items" t:pageLogo="literal:Creation" t:pageTitle="prop:pageTitle"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter">
- <t:feedback t:id="feedback"/>
- <h1 class="titlePoll">
- <t:if t:test="createMode">
- ${message:mainTitle-create}
- <p:else>${poll.title}</p:else>
- </t:if>
- </h1>
- <t:zone t:id="mainZone" t:update="show">
- <form t:type="form" t:id="mainForm" t:zone="mainZone" action="post">
- <t:errors/>
- <div class="clearfix">
- <!-- MAIN INFOS -->
- <div id="pollForm-mainInfos" class="fleft">
- <fieldset>
- <legend>${message:legend-mainInfos}</legend>
- <div>
- <label t:type="label" for="creatorName" />
- <input type="text" t:type="textfield" t:id="creatorName" value="poll.creatorName" t:validate="required,minlength=2"
- t:mixins="zoneUpdater" t:event="change" t:clientEvent="keyup" t:zone="mainZone"/>
- </div>
- <div>
- <label t:type="label" for="email" />
- <input type="text" t:type="textfield" t:id="email" value="poll.creatorEmail" t:validate="regexp"
- t:mixins="zoneUpdater" t:event="change" t:clientEvent="keyup" t:zone="mainZone"/>
- </div>
- <br />
- <div>
- <label t:type="label" for="title" />
- <input type="text" t:type="textfield" t:id="title" value="poll.title" t:validate="required"
- t:mixins="zoneUpdater" t:event="change" t:clientEvent="keyup" t:zone="mainZone" />
- </div>
- <div>
- <label t:type="label" for="description" />
- <textarea t:type="textarea" cols="23" rows="1" t:id="description" t:value="poll.description"
- t:mixins="zoneUpdater" t:event="change" t:clientEvent="keyup" t:zone="mainZone" >${poll.description}</textarea>
- </div>
- <div>
- <!-- FIXME : validate by regexp doesn't work : seems to be caused by dateTimeField component -->
- <label t:type="label" for="beginDate" />
- <input t:type="ck/dateTimeField" t:id="beginDate" value="poll.beginDate" t:validate="regexp"
- t:datePattern="message:date-pattern" t:timePicker="true" t:timePickerAdjacent="true"
- t:mixins="zoneUpdater" t:event="change" t:clientEvent="blur" t:zone="mainZone" />
- </div>
- <div>
- <!-- FIXME : validate by regexp doesn't work : seems to be caused by dateTimeField component -->
- <label t:type="label" for="endDate" />
- <input t:type="ck/dateTimeField" t:id="endDate" value="poll.endDate" t:validate="regexp"
- t:datePattern="message:date-pattern" t:timePicker="true" t:timePickerAdjacent="true"
- t:mixins="zoneUpdater" t:event="change" t:clientEvent="blur" t:zone="mainZone"/>
- </div>
- <div>
- <label t:type="label" for="pollType" />
- <select t:type="select" t:id="pollType" t:value="poll.pollType" t:validate="required"
- t:mixins="zoneUpdater" t:event="change" t:zone="mainZone">
- <option></option>
- </select>
- <span t:type="ck/Tooltip" title="message:help" t:value="message:pollType-help" t:effect="appear">
- <img src="${asset:context:img/help.png}" alt="message:help"/>
- </span>
- </div>
- <div>
- <label t:type="label" for="voteCounting" />
- <select t:type="select" t:id="voteCounting" t:value="poll.voteCounting" t:validate="required"
- t:mixins="zoneUpdater" t:event="change" t:zone="mainZone">
- <option></option>
- </select>
- <span t:type="ck/Tooltip" title="${message:help}" t:value="${message:voteCounting-help}" t:effect="appear">
- <img src="${asset:context:img/help.png}" alt="${message:help}"/>
- </span>
- </div>
- <div>
- <label t:type="label" for="advancedOptions" />
- <input t:type="checkbox" t:id="advancedOptions" t:mixins="triggerfragment,zoneUpdater" t:fragment="optionsFragment"
- t:event="change" t:zone="mainZone"/>
- </div>
- </fieldset>
+<t:feedback t:id="feedback"/>
+<h1 class="titlePoll">
+ <t:if t:test="createMode">
+ ${message:mainTitle-create}
+ <p:else>${poll.title}</p:else>
+ </t:if>
+</h1>
+<t:zone t:id="mainZone" t:update="show">
+<form t:type="form" t:id="mainForm" t:zone="mainZone" action="post">
+<t:errors/>
+<div class="clearfix">
+<!-- MAIN INFOS -->
+<div id="pollForm-mainInfos" class="fleft">
+ <fieldset>
+ <legend>${message:legend-mainInfos}</legend>
+ <div>
+ <label t:type="label" for="creatorName"/>
+ <input type="text" t:type="textfield" t:id="creatorName" value="poll.creatorName" t:validate="required,minlength=2"/>
+ </div>
+ <div>
+ <label t:type="label" for="email"/>
+ <input type="text" t:type="textfield" t:id="email" value="poll.creatorEmail" t:validate="regexp"/>
+ </div>
+ <br/>
+
+ <div>
+ <label t:type="label" for="title"/>
+ <input type="text" t:type="textfield" t:id="title" value="poll.title" t:validate="required"/>
+ </div>
+ <div>
+ <label t:type="label" for="description"/>
+ <textarea t:type="textarea" cols="23" rows="1" t:id="description" t:value="poll.description">${poll.description}</textarea>
+ </div>
+ <div>
+ <!-- FIXME : validate by regexp doesn't work : seems to be caused by dateTimeField component -->
+ <label t:type="label" for="beginDate"/>
+ <input t:type="ck/dateTimeField" t:id="beginDate" value="poll.beginDate" t:validate="regexp"
+ t:datePattern="message:date-pattern" t:timePicker="true" t:timePickerAdjacent="true"/>
+ </div>
+ <div>
+ <!-- FIXME : validate by regexp doesn't work : seems to be caused by dateTimeField component -->
+ <label t:type="label" for="endDate"/>
+ <input t:type="ck/dateTimeField" t:id="endDate" value="poll.endDate" t:validate="regexp"
+ t:datePattern="message:date-pattern" t:timePicker="true" t:timePickerAdjacent="true"/>
+ </div>
+ <div>
+ <label t:type="label" for="pollType"/>
+ <select t:type="select" t:id="pollType" t:value="poll.pollType" t:validate="required">
+ <option></option>
+ </select>
+ <span t:type="ck/Tooltip" title="message:help" t:value="message:pollType-help"
+ t:effect="appear">
+ <img src="${asset:context:img/help.png}" alt="message:help"/>
+ </span>
+ </div>
+ <div>
+ <label t:type="label" for="voteCounting"/>
+ <select t:type="select" t:id="voteCounting" t:value="poll.voteCounting" t:validate="required">
+ <option></option>
+ </select>
+ <span t:type="ck/Tooltip" title="${message:help}" t:value="${message:voteCounting-help}"
+ t:effect="appear">
+ <img src="${asset:context:img/help.png}" alt="${message:help}"/>
+ </span>
+ </div>
+ </fieldset>
<!-- <div class="buttons">
- <input t:type="submit" value="${message:next-button}" />
- </div>-->
- </div>
- <!-- OPTIONS -->
- <t:formfragment t:id="optionsFragment" visible="advancedOptions">
- <div id="pollForm-options" class="fleft">
- <fieldset>
- <legend>${message:legend-options}</legend>
- <div>
- <input t:type="checkbox" t:id="anonymous" value="poll.anonymous" t:mixins="zoneUpdater" t:event="change" t:zone="mainZone"/>
- <label t:type="label" for="anonymous" />
- <span t:type="ck/Tooltip" title="message:help" t:value="message:anonymous-help" t:effect="appear">
- <img src="${asset:context:img/help.png}" alt="message:help"/>
- </span>
- </div>
- <div>
- <input t:type="checkbox" t:id="anonymousVoteAllowed" value="poll.anonymousVoteAllowed" disabled="anonymousVoteAllowedDisabled"
- t:mixins="zoneUpdater" t:event="change" t:zone="mainZone"/>
- <label t:type="label" for="anonymousVoteAllowed" />
- <span t:type="ck/Tooltip" title="message:help" t:value="message:anonymousVoteAllowed-help" t:effect="appear">
- <img src="${asset:context:img/help.png}" alt="message:help"/>
- </span>
- </div>
- <div>
- <input t:type="checkbox" t:id="continuousResults" value="poll.continuousResults"
- t:mixins="zoneUpdater" t:event="change" t:zone="mainZone" />
- <label t:type="label" for="continuousResults" />
- <span t:type="ck/Tooltip" title="message:help" t:value="message:continuousResults-help" t:effect="appear">
- <img src="${asset:context:img/help.png}" alt="message:help"/>
- </span>
- </div>
- <div>
- <input t:type="checkbox" t:id="publicResults" value="poll.publicResults" disabled="publicResultsDisabled"
- t:mixins="zoneUpdater" t:event="change" t:zone="mainZone"/>
- <label t:type="label" for="publicResults" />
- <span t:type="ck/Tooltip" title="message:help" t:value="message:publicResults-help" t:effect="appear">
- <img src="${asset:context:img/help.png}" alt="message:help"/>
- </span>
- </div>
- <div>
- <input t:type="checkbox" t:id="choiceAddAllowed" value="poll.choiceAddAllowed"
- t:mixins="triggerfragment,zoneUpdater" t:fragment="choiceDateFragment" t:event="change" t:zone="mainZone"/>
- <label t:type="label" for="choiceAddAllowed" />
- <span t:type="ck/Tooltip" title="message:help" t:value="message:choiceAddAllowed-help}" t:effect="appear">
- <img src="${asset:context:img/help.png}" alt="message:help"/>
- </span>
- <br/>
- <t:formFragment t:id="choiceDateFragment" t:visible="poll.choiceAddAllowed">
- <label t:type="label" for="beginChoiceDate" />
- <input t:type="ck/dateTimeField" t:id="beginChoiceDate" value="poll.beginChoiceDate" t:validate="regexp"
- t:datePattern="message:date-pattern" t:timePicker="true" t:timePickerAdjacent="true"
- t:mixins="zoneUpdater" t:event="change" t:clientEvent="blur" t:zone="mainZone"/>
- <br />
- <label t:type="label" for="endChoiceDate" />
- <input t:type="ck/dateTimeField" t:id="endChoiceDate" value="poll.endChoiceDate" t:validate="regexp"
- t:datePattern="message:date-pattern" t:timePicker="true" t:timePickerAdjacent="true"
- t:mixins="zoneUpdater" t:event="change" t:clientEvent="blur" t:zone="mainZone"/>
- </t:formFragment>
-<!-- <span id="choiceDateDiv" style="display: none;">
-
- </span>-->
- </div>
- <!--<t:if test="normalVoteCounting">-->
- <div>
- <input t:type="checkbox" t:id="choiceNb" value="hasChoiceNb" disabled="choiceNbDisabled"
- t:mixins="triggerfragment,zoneUpdater" t:fragment="choiceNbFragment" t:event="change" t:zone="mainZone"/>
- <label t:type="label" for="choiceNb" class="${choiceNbLabelStyle}" />
- <span t:type="ck/Tooltip" title="message:help" t:value="message:choiceNb-help" t:effect="appear">
- <img src="${asset:context:img/help.png}" alt="message:help"/>
- </span>
- <br/>
- <t:formFragment t:id="choiceNbFragment" t:visible="hasChoiceNb">
- <label t:type="label" for="maxChoiceNb" />
- <input t:type="textfield" t:id="maxChoiceNb" t:value="poll.maxChoiceNb" t:size="1" t:validate="min=0"
- t:mixins="zoneUpdater" t:event="change" t:zone="mainZone"/>
- </t:formFragment>
- </div>
- <!--</t:if>-->
- <!--<t:if test="poll.creatorEmail">-->
- <div>
- <input t:type="checkbox" t:id="sendNotification" value="hasNotification" disabled="notificationDisabled"
- t:mixins="triggerfragment,zoneUpdater" t:fragment="notificationFragment" t:event="change" t:zone="mainZone"/>
- <label t:type="label" for="sendNotification" class="${notificationLabelStyle}" />
- <span t:type="ck/Tooltip" title="message:help" t:value="message:sendNotification-help" t:effect="appear">
- <img src="${asset:context:img/help.png}" alt="message:help"/>
- </span>
- <br/>
- <t:formFragment t:id="notificationFragment" t:visible="hasNotification">
- <label t:type="label" for="notification" />
- <input t:type="textfield" t:id="notification" value="notification.sensibility" t:size="3" t:validate="min=0"
- t:mixins="zoneUpdater" t:event="change" t:zone="mainZone"/>
- ${message:notification-label2}
- </t:formFragment>
- </div>
- <!--</t:if>-->
- <!--<t:unless test="freePoll">-->
- <div>
- <input t:type="checkbox" t:id="sendReminder" t:value="hasReminder" disabled="reminderDisabled"
- t:mixins="triggerfragment,zoneUpdater" t:fragment="reminderFragment" t:event="change" t:zone="mainZone"/>
- <label t:type="label" for="sendReminder" class="${reminderLabelStyle}" />
- <span t:type="ck/Tooltip" title="message:help" t:value="message:sendReminder-help" t:effect="appear">
- <img src="${asset:context:img/help.png}" alt="message:help"/>
- </span>
- <br/>
- <t:formFragment t:id="reminderFragment" t:visible="hasReminder">
- <input t:type="textfield" t:id="reminder" t:value="reminder.sensibility" t:size="1" t:validate="min=0"
- t:mixins="zoneUpdater" t:event="change" t:zone="mainZone"/>
- <label t:type="label" for="reminder" />
- </t:formFragment>
- </div>
- <!--</t:unless>-->
- </fieldset>
- <!-- <div class="buttons">
- <t:eventLink t:event="previous" t:zone="pollCreationZone" style="text-decoration: none;">
- <input type="button" value="${message:prev-button}" />
- </t:eventLink>
- <t:submit t:value="${message:next-button}" t:zone="pollCreationZone" />
- </div>-->
- </div>
- </t:formfragment>
+ <input t:type="submit" value="${message:next-button}" />
+ </div>-->
+</div>
+<!-- OPTIONS -->
+<div id="pollForm-options" class="fleft">
+ <fieldset>
+ <legend>
+ <input t:type="checkbox" t:id="advancedOptions" t:mixins="triggerfragment" t:fragment="optionsFragment"/>
+ <label t:type="label" for="advancedOptions"/>
+ </legend>
+ <t:formFragment t:id="optionsFragment" visible="advancedOptions">
+ <div>
+ <input t:type="checkbox" t:id="anonymous" value="poll.anonymous" />
+ <label t:type="label" for="anonymous"/>
+ <span t:type="ck/Tooltip" title="message:help" t:value="message:anonymous-help" t:effect="appear">
+ <img src="${asset:context:img/help.png}" alt="message:help"/>
+ </span>
</div>
- </form>
- </t:zone>
+ <div>
+ <input t:type="checkbox" t:id="anonymousVoteAllowed" value="poll.anonymousVoteAllowed" disabled="anonymousVoteAllowedDisabled"/>
+ <label t:type="label" for="anonymousVoteAllowed"/>
+ <span t:type="ck/Tooltip" title="message:help" t:value="message:anonymousVoteAllowed-help" t:effect="appear">
+ <img src="${asset:context:img/help.png}" alt="message:help"/>
+ </span>
+ </div>
+ <div>
+ <input t:type="checkbox" t:id="continuousResults" value="poll.continuousResults"/>
+ <label t:type="label" for="continuousResults"/>
+ <span t:type="ck/Tooltip" title="message:help" t:value="message:continuousResults-help" t:effect="appear">
+ <img src="${asset:context:img/help.png}" alt="message:help"/>
+ </span>
+ </div>
+ <div>
+ <input t:type="checkbox" t:id="publicResults" value="poll.publicResults" disabled="publicResultsDisabled"/>
+ <label t:type="label" for="publicResults"/>
+ <span t:type="ck/Tooltip" title="message:help" t:value="message:publicResults-help" t:effect="appear">
+ <img src="${asset:context:img/help.png}" alt="message:help"/>
+ </span>
+ </div>
+ <div>
+ <input t:type="checkbox" t:id="choiceAddAllowed" value="poll.choiceAddAllowed"
+ t:mixins="triggerfragment" t:fragment="choiceDateFragment"/>
+ <label t:type="label" for="choiceAddAllowed"/>
+ <span t:type="ck/Tooltip" title="message:help" t:value="message:choiceAddAllowed-help}" t:effect="appear">
+ <img src="${asset:context:img/help.png}" alt="message:help"/>
+ </span>
+ <br/>
+ <t:formFragment t:id="choiceDateFragment" t:visible="poll.choiceAddAllowed">
+ <label t:type="label" for="beginChoiceDate"/>
+ <input t:type="ck/dateTimeField" t:id="beginChoiceDate" value="poll.beginChoiceDate" t:validate="regexp"
+ t:datePattern="message:date-pattern" t:timePicker="true" t:timePickerAdjacent="true"/>
+ <br/>
+ <label t:type="label" for="endChoiceDate"/>
+ <input t:type="ck/dateTimeField" t:id="endChoiceDate" value="poll.endChoiceDate" t:validate="regexp"
+ t:datePattern="message:date-pattern" t:timePicker="true" t:timePickerAdjacent="true"/>
+ </t:formFragment>
+ <!-- <span id="choiceDateDiv" style="display: none;">
+
+ </span>-->
+ </div>
+ <!--<t:if test="normalVoteCounting">-->
+ <div>
+ <input t:type="checkbox" t:id="choiceNb" value="hasChoiceNb" disabled="choiceNbDisabled"
+ t:mixins="triggerFragment" t:fragment="choiceNbFragment"/>
+ <label t:type="label" for="choiceNb"/>
+ <span t:type="ck/Tooltip" title="message:help" t:value="message:choiceNb-help" t:effect="appear">
+ <img src="${asset:context:img/help.png}" alt="message:help"/>
+ </span>
+ <br/>
+ <t:formFragment t:id="choiceNbFragment" t:visible="hasChoiceNb">
+ <label t:type="label" for="maxChoiceNb"/>
+ <input t:type="textfield" t:id="maxChoiceNb" t:value="poll.maxChoiceNb" t:size="1" t:validate="min=0"/>
+ </t:formFragment>
+ </div>
+ <!--</t:if>-->
+ <!--<t:if test="poll.creatorEmail">-->
+ <div>
+ <input t:type="checkbox" t:id="sendNotification" value="hasNotification"
+ disabled="notificationDisabled" t:mixins="triggerfragment" t:fragment="notificationFragment"/>
+ <label t:type="label" for="sendNotification"/>
+ <span t:type="ck/Tooltip" title="message:help" t:value="message:sendNotification-help" t:effect="appear">
+ <img src="${asset:context:img/help.png}" alt="message:help"/>
+ </span>
+ <br/>
+ <t:formFragment t:id="notificationFragment" t:visible="hasNotification">
+ <label t:type="label" for="notification"/>
+ <input t:type="textfield" t:id="notification" value="notification.sensibility" t:size="3" t:validate="min=0"/>
+ ${message:notification-label2}
+ </t:formFragment>
+ </div>
+ <!--</t:if>-->
+ <!--<t:unless test="freePoll">-->
+ <div>
+ <input t:type="checkbox" t:id="sendReminder" t:value="hasReminder" disabled="reminderDisabled"
+ t:mixins="triggerfragment" t:fragment="reminderFragment"/>
+ <label t:type="label" for="sendReminder"/>
+ <span t:type="ck/Tooltip" title="message:help" t:value="message:sendReminder-help" t:effect="appear">
+ <img src="${asset:context:img/help.png}" alt="message:help"/>
+ </span>
+ <br/>
+ <t:formFragment t:id="reminderFragment" t:visible="hasReminder">
+ <input t:type="textfield" t:id="reminder" t:value="reminder.sensibility" t:size="1" t:validate="min=0"/>
+ <label t:type="label" for="reminder"/>
+ </t:formFragment>
+ </div>
+ <!--</t:unless>-->
+ </t:formFragment>
+ </fieldset>
+ <!-- <div class="buttons">
+ <t:eventLink t:event="previous" t:zone="pollCreationZone" style="text-decoration: none;">
+ <input type="button" value="${message:prev-button}" />
+ </t:eventLink>
+ <t:submit t:value="${message:next-button}" t:zone="pollCreationZone" />
+ </div>-->
+</div>
+
+</div>
+</form>
+</t:zone>
</t:border>
1
0
r2896 - in branches/pollen-1.2.3-1.2.x: . pollen-business pollen-ui pollen-ui/src/main/java/org/chorem/pollen/ui/utils pollen-ui/src/test pollen-ui/src/test/java/org/chorem/pollen/ui pollen-ui/src/test/java/org/chorem/pollen/ui/utils pollen-ui/src/test/resources pollen-votecounting
by fdesbois@users.chorem.org 05 Mar '10
by fdesbois@users.chorem.org 05 Mar '10
05 Mar '10
Author: fdesbois
Date: 2010-03-05 10:55:30 +0100 (Fri, 05 Mar 2010)
New Revision: 2896
Log:
Ano #127 : Import CSV problem
Added:
branches/pollen-1.2.3-1.2.x/pollen-ui/src/test/java/org/chorem/pollen/ui/utils/
branches/pollen-1.2.3-1.2.x/pollen-ui/src/test/java/org/chorem/pollen/ui/utils/CSVAccountUtilTest.java
branches/pollen-1.2.3-1.2.x/pollen-ui/src/test/resources/
branches/pollen-1.2.3-1.2.x/pollen-ui/src/test/resources/import.csv
Modified:
branches/pollen-1.2.3-1.2.x/pollen-business/pom.xml
branches/pollen-1.2.3-1.2.x/pollen-ui/pom.xml
branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/java/org/chorem/pollen/ui/utils/CSVAccountUtil.java
branches/pollen-1.2.3-1.2.x/pollen-votecounting/pom.xml
branches/pollen-1.2.3-1.2.x/pom.xml
Modified: branches/pollen-1.2.3-1.2.x/pollen-business/pom.xml
===================================================================
--- branches/pollen-1.2.3-1.2.x/pollen-business/pom.xml 2010-03-05 09:29:40 UTC (rev 2895)
+++ branches/pollen-1.2.3-1.2.x/pollen-business/pom.xml 2010-03-05 09:55:30 UTC (rev 2896)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.chorem</groupId>
<artifactId>pollen</artifactId>
- <version>1.2.3</version>
+ <version>1.2.4-SNAPSHOT</version>
</parent>
<groupId>org.chorem.pollen</groupId>
Modified: branches/pollen-1.2.3-1.2.x/pollen-ui/pom.xml
===================================================================
--- branches/pollen-1.2.3-1.2.x/pollen-ui/pom.xml 2010-03-05 09:29:40 UTC (rev 2895)
+++ branches/pollen-1.2.3-1.2.x/pollen-ui/pom.xml 2010-03-05 09:55:30 UTC (rev 2896)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.chorem</groupId>
<artifactId>pollen</artifactId>
- <version>1.2.3</version>
+ <version>1.2.4-SNAPSHOT</version>
</parent>
<groupId>org.chorem.pollen</groupId>
Modified: branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/java/org/chorem/pollen/ui/utils/CSVAccountUtil.java
===================================================================
--- branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/java/org/chorem/pollen/ui/utils/CSVAccountUtil.java 2010-03-05 09:29:40 UTC (rev 2895)
+++ branches/pollen-1.2.3-1.2.x/pollen-ui/src/main/java/org/chorem/pollen/ui/utils/CSVAccountUtil.java 2010-03-05 09:55:30 UTC (rev 2896)
@@ -41,10 +41,12 @@
private static final Log log = LogFactory.getLog(CSVAccountUtil.class);
/**
- * Import d'une liste de votants à partir d'un flux (fichier CSV).
+ * CSV import from a reader. The CSV file contains three columns
+ * corresponding to 'votingId', 'email' and 'weight'.No header column is
+ * needed, the separator is ','. Ex : "toto","toto(a)titi.fr","3"
*
- * @param reader le flux
- * @return la liste de votants
+ * @param reader which contains the input stream
+ * @return the new PollAccountDTO list from results imported
*/
public static List<PollAccountDTO> importList(Reader reader) {
List<PollAccountDTO> accounts = null;
@@ -53,6 +55,7 @@
ColumnPositionMappingStrategy<PollAccountDTO> strat =
new ColumnPositionMappingStrategy<PollAccountDTO>();
String[] columns = new String[] { "votingId", "email", "weight" };
+ strat.setType(PollAccountDTO.class);
strat.setColumnMapping(columns);
// Parsing du fichier CSV
@@ -78,6 +81,8 @@
* Import d'une liste de votants à partir d'un fichier CSV.
*
* @param file le fichier CSV
+ * @return a PollAccountDTO list
+ * @see #importList(java.io.Reader)
*/
public static List<PollAccountDTO> importList(UploadedFile file) {
if (log.isInfoEnabled()) {
Added: branches/pollen-1.2.3-1.2.x/pollen-ui/src/test/java/org/chorem/pollen/ui/utils/CSVAccountUtilTest.java
===================================================================
--- branches/pollen-1.2.3-1.2.x/pollen-ui/src/test/java/org/chorem/pollen/ui/utils/CSVAccountUtilTest.java (rev 0)
+++ branches/pollen-1.2.3-1.2.x/pollen-ui/src/test/java/org/chorem/pollen/ui/utils/CSVAccountUtilTest.java 2010-03-05 09:55:30 UTC (rev 2896)
@@ -0,0 +1,69 @@
+
+package org.chorem.pollen.ui.utils;
+
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.List;
+import org.chorem.pollen.business.dto.PollAccountDTO;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ *
+ * @author fdesbois
+ */
+public class CSVAccountUtilTest {
+
+ public CSVAccountUtilTest() {
+ }
+
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+ }
+
+ @AfterClass
+ public static void tearDownClass() throws Exception {
+ }
+
+ @Before
+ public void setUp() {
+ }
+
+ @After
+ public void tearDown() {
+ }
+
+ /**
+ * Test of importList method, of class CSVAccountUtil.
+ */
+ @Test
+ public void testImportList_Reader() {
+ System.out.println("importList");
+
+ InputStream input = getClass().getResourceAsStream("/import.csv");
+ InputStreamReader reader = new InputStreamReader(input);
+
+ List<PollAccountDTO> accounts = CSVAccountUtil.importList(reader);
+
+ Assert.assertEquals(3, accounts.size());
+
+ PollAccountDTO account = accounts.get(0);
+
+ Assert.assertEquals("toto", account.getVotingId());
+ Assert.assertEquals("toto(a)titi.fr", account.getEmail());
+ Assert.assertEquals(3., account.getWeight(), 0.1);
+ }
+
+ /**
+ * Test of importList method, of class CSVAccountUtil.
+ */
+ @Test
+ public void testImportList_UploadedFile() {
+ System.out.println("importList");
+ }
+
+}
\ No newline at end of file
Property changes on: branches/pollen-1.2.3-1.2.x/pollen-ui/src/test/java/org/chorem/pollen/ui/utils/CSVAccountUtilTest.java
___________________________________________________________________
Added: svn:keywords
+ "Author Date Id Revision HeadURL"
Added: branches/pollen-1.2.3-1.2.x/pollen-ui/src/test/resources/import.csv
===================================================================
--- branches/pollen-1.2.3-1.2.x/pollen-ui/src/test/resources/import.csv (rev 0)
+++ branches/pollen-1.2.3-1.2.x/pollen-ui/src/test/resources/import.csv 2010-03-05 09:55:30 UTC (rev 2896)
@@ -0,0 +1,3 @@
+toto,"toto(a)titi.fr","3"
+John Locke,john(a)locke.fr,1
+"Jack Pot","jackpot(a)bloum.fr","1"
\ No newline at end of file
Modified: branches/pollen-1.2.3-1.2.x/pollen-votecounting/pom.xml
===================================================================
--- branches/pollen-1.2.3-1.2.x/pollen-votecounting/pom.xml 2010-03-05 09:29:40 UTC (rev 2895)
+++ branches/pollen-1.2.3-1.2.x/pollen-votecounting/pom.xml 2010-03-05 09:55:30 UTC (rev 2896)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.chorem</groupId>
<artifactId>pollen</artifactId>
- <version>1.2.3</version>
+ <version>1.2.4-SNAPSHOT</version>
</parent>
<groupId>org.chorem.pollen</groupId>
Modified: branches/pollen-1.2.3-1.2.x/pom.xml
===================================================================
--- branches/pollen-1.2.3-1.2.x/pom.xml 2010-03-05 09:29:40 UTC (rev 2895)
+++ branches/pollen-1.2.3-1.2.x/pom.xml 2010-03-05 09:55:30 UTC (rev 2896)
@@ -15,7 +15,7 @@
<groupId>org.chorem</groupId>
<artifactId>pollen</artifactId>
- <version>1.2.3</version>
+ <version>1.2.4-SNAPSHOT</version>
<modules>
<module>pollen-ui</module>
1
0
Author: fdesbois
Date: 2010-03-05 10:29:40 +0100 (Fri, 05 Mar 2010)
New Revision: 2895
Log:
Create branch to test and add features for massive vote : 3000
Added:
branches/pollen-1.2.3-1.2.x/
Property changes on: branches/pollen-1.2.3-1.2.x
___________________________________________________________________
Added: svn:ignore
+ target
nbactions.xml
.settings
.classpath
.project
*.ipr
*.iws
*.iml
Added: svn:mergeinfo
+
1
0
r2894 - trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/utils
by bpoussin@users.chorem.org 04 Mar '10
by bpoussin@users.chorem.org 04 Mar '10
04 Mar '10
Author: bpoussin
Date: 2010-03-04 18:45:39 +0100 (Thu, 04 Mar 2010)
New Revision: 2894
Log:
ajout d'une ligne en commentaire qui doit manquer pour que l'import CSV fonctionne (a verfier)
Modified:
trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/utils/CSVAccountUtil.java
Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/utils/CSVAccountUtil.java
===================================================================
--- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/utils/CSVAccountUtil.java 2010-03-02 20:14:34 UTC (rev 2893)
+++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/utils/CSVAccountUtil.java 2010-03-04 17:45:39 UTC (rev 2894)
@@ -53,6 +53,7 @@
ColumnPositionMappingStrategy<PollAccountDTO> strat =
new ColumnPositionMappingStrategy<PollAccountDTO>();
String[] columns = new String[] { "votingId", "email", "weight" };
+// strat.setType(PollAccountDTO.class); // <---- cette ligne doit etre manquante a verifier par un Test unitaire
strat.setColumnMapping(columns);
// Parsing du fichier CSV
1
0