r3464 - in trunk/pollen-ui-struts2/src/main: java/org/chorem/pollen/ui/actions/poll resources/i18n webapp/WEB-INF/jsp/poll webapp/js
Author: tchemit Date: 2012-06-13 14:32:09 +0200 (Wed, 13 Jun 2012) New Revision: 3464 Url: http://chorem.org/repositories/revision/pollen/3464 Log: fixes #610: Improve the interaction between continuous and public result options in poll form fixes #611: Improve the interaction between anonymous and anonymousVoteAllowed options result in poll form - improve poll form options layout Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/SavePoll.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/create.jsp trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp trunk/pollen-ui-struts2/src/main/webapp/js/createPoll.js Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/SavePoll.java =================================================================== --- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/SavePoll.java 2012-06-13 10:23:07 UTC (rev 3463) +++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/SavePoll.java 2012-06-13 12:32:09 UTC (rev 3464) @@ -258,7 +258,7 @@ public String execute() throws Exception { // Save choices and votingLists only if vote is not started - if (!isVoteStarted()) { + if (!isVoteStarted()) { //TODO-tchemit comment me 2012-06-04 A merge would be nicer but more complex to code // Clear previous collections to save those from the form poll.clearChoice(); @@ -284,8 +284,20 @@ } else { // reset value poll.setMaxChoiceNb(0); + } + if (!poll.isPublicResults()) { + + // force to not have continous results + poll.setContinuousResults(false); } + + if (poll.isAnonymous()) { + + // force to not have choice to vote anonymously + poll.setAnonymousVoteAllowed(false); + } + //TODO-tchemit comment me 2012-06-04 A merge would be nicer but more complex to code poll.clearPreventRule(); 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-13 10:23:07 UTC (rev 3463) +++ trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-06-13 12:32:09 UTC (rev 3464) @@ -80,7 +80,7 @@ pollen.common.displayType-normal=Results pollen.common.editAction=Edit pollen.common.email=Em@il -pollen.common.endChoiceDate=end choice date +pollen.common.endChoiceDate=End choice date pollen.common.endDate=End date pollen.common.favoriteList.csvImport.help=The file to upload is a text file that contains one row per participant.<br/><br/>The first line must be <strong>votingId,email</strong>, then each next ones will define the participant's name and his email separated by a comma.<br/><br/>Here is an example \:<br/> pollen.common.firstName=First name @@ -139,6 +139,7 @@ pollen.common.vote.return=Back to poll pollen.common.vote.return-help=Back to poll pollen.common.voteAction=Vote +pollen.common.voteAnonymous=Anonymous vote pollen.common.voteCountingType=Response type pollen.common.voteCountingType.help=Normal\: selecting 1 to n choices among available choices <br/><br/> Percentage\: allocating a percentage to each choice <br/><br/> Condorcet\: ranking choices in order of preference <br/><br/> Number \: Free response. Summed and the average numbers. pollen.common.voteCountingTypeHelp.condorcet=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. @@ -207,15 +208,24 @@ pollen.error.userNotAllowed=You are not allowed to count the votes for this poll. pollen.error.vote.maxChoiceNb=The maximal number of choices is %d. pollen.error.vote.percentage=The sum of the values must be equals to 100. +pollen.fieldset.choice.options=Choices +pollen.fieldset.choice.options.help=Configure choices of the poll pollen.fieldset.connexionInformation=Connexion informations +pollen.fieldset.creator.options=You +pollen.fieldset.creator.options.help=To fill some informations about the creator of this poll pollen.fieldset.login=Login +pollen.fieldset.notification.options=Notifications +pollen.fieldset.notification.options.help=Configure notifications of this poll pollen.fieldset.poll.choices=Choices pollen.fieldset.poll.general=Your poll pollen.fieldset.poll.options=Options -pollen.fieldset.poll.you=You pollen.fieldset.pollAccount.toAddToFavoriteList=Add a new member pollen.fieldset.pollAccount.toDeleteFromFavoriteList=Remove a member pollen.fieldset.pollAccount.toEditToFavoriteList=Edit member +pollen.fieldset.pollDate.options=Date validity of the poll +pollen.fieldset.pollDate.options.help=Configure when vote is authorized +pollen.fieldset.result.options=Results +pollen.fieldset.result.options.help=Configure results of the poll pollen.fieldset.userFavoriteList.toCreate=Create a new list pollen.fieldset.userFavoriteList.toDelete=List de favoris à supprimer pollen.fieldset.userInformation=User information @@ -315,4 +325,3 @@ pollen.title.usersList=Users administration pollen.warning.poll.is.closed.so.read.only=Poll is closed, you can not modifiy it anymore. title=Create a poll -vote.anonymous=Anonymous vote 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-13 10:23:07 UTC (rev 3463) +++ trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-06-13 12:32:09 UTC (rev 3464) @@ -139,6 +139,7 @@ pollen.common.vote.return=Retour au sondage pollen.common.vote.return-help=Retour au sondage pollen.common.voteAction=Vote +pollen.common.voteAnonymous=Vote anonyme pollen.common.voteCountingType=Type de Réponse pollen.common.voteCountingType.help=Normal \: sélection de 1 ou n choix parmis les choix possibles <br/><br/> Pourcentage \: attribution d'un pourcentage à chaque choix <br/><br/> Condorcet \: classement des choix par ordre de préférence <br/><br/> Nombre \: Réponse libre. Fait la somme et la moyenne des nombres pollen.common.voteCountingTypeHelp.condorcet=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. @@ -207,15 +208,24 @@ pollen.error.userNotAllowed=Vous n'êtes pas autorisé à dépouiller ce sondage. pollen.error.vote.maxChoiceNb=Le nombre de choix maximal est de %d. pollen.error.vote.percentage=La somme des valeurs doit être égale à 100. +pollen.fieldset.choice.options=Les choix +pollen.fieldset.creator.options=Vous +pollen.fieldset.choice.options.help=Configurer les choix du sondage pollen.fieldset.connexionInformation=Information de connexion +pollen.fieldset.creator.options.help=Renseigner les informations sur le créateur du sondage pollen.fieldset.login=Connexion +pollen.fieldset.notification.options=Notifications +pollen.fieldset.notification.options.help=Configurer les notifications du sondage pollen.fieldset.poll.choices=Les choix pollen.fieldset.poll.general=Votre sondage pollen.fieldset.poll.options=Les options -pollen.fieldset.poll.you=Vous pollen.fieldset.pollAccount.toAddToFavoriteList=Ajouter un membre pollen.fieldset.pollAccount.toDeleteFromFavoriteList=Supprimer un membre pollen.fieldset.pollAccount.toEditToFavoriteList=Editer le membre +pollen.fieldset.pollDate.options=Plage de validité +pollen.fieldset.pollDate.options.help=Configurer la plage de validité du sondage +pollen.fieldset.result.options=Les résultats +pollen.fieldset.result.options.help=Pour configurer les résultats du sondage pollen.fieldset.userFavoriteList.toCreate=Créer une nouvelle liste pollen.fieldset.userFavoriteList.toDelete=List de favoris à supprimer pollen.fieldset.userInformation=Informations de l'utilisateur @@ -315,4 +325,3 @@ pollen.title.usersList=Gestion des utilisateurs pollen.warning.poll.is.closed.so.read.only=Le sondage est clos, vous ne pouvez plus le modifer title=Création d'un sondage -vote.anonymous=Vote anonyme 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-13 10:23:07 UTC (rev 3463) +++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/create.jsp 2012-06-13 12:32:09 UTC (rev 3464) @@ -52,6 +52,8 @@ 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()}"/>', @@ -119,7 +121,12 @@ <div id="toptions"> <fieldset> - <legend><s:text name="pollen.fieldset.poll.you"/></legend> + <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" @@ -130,36 +137,41 @@ <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" + displayFormat="%{getText('pollen.common.datePickerPattern')}" + label="%{getText('pollen.common.beginDate')}" + timepicker="true" + disabled="%{voteStarted}"/> + <sj:datepicker key="poll.endDate" + displayFormat="%{getText('pollen.common.datePickerPattern')}" + timepicker="true" + label="%{getText('pollen.common.endDate')}"/> + </fieldset> <br/> <fieldset> - <legend><s:text name="pollen.fieldset.poll.options"/></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"/> - <s:checkbox key="poll.continuousResults" - label="%{getText('pollen.common.pollOption.continuousResults')}" - tooltip="%{getText('pollen.common.pollOption.continuousResults.help')}" - tooltipIconPath="/img/tooltip.png"/> - <s:checkbox key="poll.publicResults" - label="%{getText('pollen.common.pollOption.publicResults')}" - tooltip="%{getText('pollen.common.pollOption.publicResults.help')}" - tooltipIconPath="/img/tooltip.png"/> + <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"/> - <div id='addChoiceAddAllowedPanel' class="hidden"> + <%--<div id='addChoiceAddAllowedPanel' class="hidden">--%> <sj:datepicker key="poll.beginChoiceDate" label="%{getText('pollen.common.beginChoiceDate')}" displayFormat="%{getText('pollen.common.datePickerPattern')}" @@ -170,17 +182,48 @@ displayFormat="%{getText('pollen.common.datePickerPattern')}" timepicker="true" disabled="%{voteStarted}"/> - </div> + <%--</div>--%> <s:checkbox key="limitChoice" label="%{getText('pollen.common.pollOption.limitChoice')}" disabled="%{voteStarted}" tooltip="%{getText('pollen.common.pollOption.limitChoice.help')}" tooltipIconPath="/img/tooltip.png"/> - <div id='maxChoiceNbPanel' class="hidden"> + <%--<div id='maxChoiceNbPanel' class="hidden">--%> <s:textfield key="maxChoices" label="%{getText('pollen.common.pollOption.maxChoiceNb')}" disabled="%{voteStarted}"/> - </div> + <%--</div>--%> + </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"/> + <%--<div id='publicPanel' class="hidden">--%> + <s:checkbox key="poll.continuousResults" + label="%{getText('pollen.common.pollOption.continuousResults')}" + tooltip="%{getText('pollen.common.pollOption.continuousResults.help')}" + tooltipIconPath="/img/tooltip.png"/> + <%--</div>--%> + </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')}" @@ -189,29 +232,13 @@ label="%{getText('pollen.common.pollOption.reminder')}" tooltip="%{getText('pollen.common.pollOption.reminder.help')}" tooltipIconPath="/img/tooltip.png"/> - <div id='reminderPanel' class="hidden"> + <%--<div id='reminderPanel' class="hidden">--%> <s:textfield key="reminderHourCountdown" label="%{getText('pollen.common.pollOption.reminderHourCountdown')}"/> - </div> + <%--</div>--%> </fieldset> - <br/> - <fieldset> - <legend><s:text name="pollen.fieldset.poll.general"/></legend> - <sj:datepicker key="poll.beginDate" - displayFormat="%{getText('pollen.common.datePickerPattern')}" - label="%{getText('pollen.common.beginDate')}" - timepicker="true" - disabled="%{voteStarted}"/> - <sj:datepicker key="poll.endDate" - displayFormat="%{getText('pollen.common.datePickerPattern')}" - timepicker="true" - label="%{getText('pollen.common.endDate')}"/> - </fieldset> - - <br/> - <fieldset> <legend> <s:text name="pollen.common.pollType"/> 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-13 10:23:07 UTC (rev 3463) +++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp 2012-06-13 12:32:09 UTC (rev 3464) @@ -418,7 +418,7 @@ <s:if test="voteAllowed"> <div id="buttons"> <s:if test="poll.anonymousVoteAllowed"> - <s:checkbox key="vote.anonymous"/> + <s:checkbox key="vote.anonymous" label='%{getText("pollen.common.voteAnonymous")}'/> <br/> </s:if> <s:submit action="vote/%{uriId}" key="pollen.action.pollVote" Modified: trunk/pollen-ui-struts2/src/main/webapp/js/createPoll.js =================================================================== --- trunk/pollen-ui-struts2/src/main/webapp/js/createPoll.js 2012-06-13 10:23:07 UTC (rev 3463) +++ trunk/pollen-ui-struts2/src/main/webapp/js/createPoll.js 2012-06-13 12:32:09 UTC (rev 3464) @@ -558,33 +558,51 @@ jQuery(document).ready(function () { function changeChoiceAddAllowed(val) { - if (val) { - $('#addChoiceAddAllowedPanel').show(); - } else { - $('#addChoiceAddAllowedPanel').hide(); - } +// if (val) { +// $('#addChoiceAddAllowedPanel').show(); +// } else { +// $('#addChoiceAddAllowedPanel').hide(); +// } $('[name="poll.beginChoiceDate"],[name="poll.endChoiceDate"]').attr( 'disabled', !val); } function changeLimitChoice(val) { - if (val) { - $('#maxChoiceNbPanel').show(); - } else { - $('#maxChoiceNbPanel').hide(); - } +// if (val) { +// $('#maxChoiceNbPanel').show(); +// } else { +// $('#maxChoiceNbPanel').hide(); +// } $('[name="maxChoices"]').attr('disabled', !val); } function changeReminder(val) { - if (val) { - $('#reminderPanel').show(); - } else { - $('#reminderPanel').hide(); - } +// if (val) { +// $('#reminderPanel').show(); +// } else { +// $('#reminderPanel').hide(); +// } $('[name="reminderHourCountdown"]').attr('disabled', !val); } + function changePublicOption(val) { +// if (val) { +// $('#publicPanel').show(); +// } else { +// $('#publicPanel').hide(); +// } + $('[name="poll.continuousResults"]').attr('disabled', !val); + } + + function changeAnonymousOption(val) { +// if (val) { +// $('#anonymousPanel').show(); +// } else { +// $('#anonymousPanel').hide(); +// } + $('[name="poll.anonymousVoteAllowed"]').attr('disabled', !val); + } + function changePollType(type) { $('.pollType').addClass('hidden'); @@ -609,6 +627,10 @@ changeChoiceAddAllowed($(this).prop('checked')); }); + $('[name="poll.publicResults"]').change(function () { + changePublicOption($(this).prop('checked')); + }); + $('[name="limitChoice"]').change(function () { changeLimitChoice($(this).prop('checked')); }); @@ -621,10 +643,10 @@ var val = $(this).prop('checked'); $('[name="poll.anonymousVoteAllowed"]').prop('checked', val); }); - $('[name="poll.continuousResults"]').change(function () { - var val = $(this).prop('checked'); - $('[name="poll.publicResults"]').prop('checked', val); - }); +// $('[name="poll.continuousResults"]').change(function () { +// var val = $(this).prop('checked'); +// $('[name="poll.publicResults"]').prop('checked', val); +// }); $('[name="poll.choiceType"]').change(function () { changeChoiceType($(this).val()); @@ -648,10 +670,13 @@ changeChoiceAddAllowed(datas['choiceAddAllowed'] == 'true'); changeLimitChoice(datas['limitChoice'] == 'true'); changeReminder(datas['reminder'] == 'true'); + changePublicOption(datas['publicOption'] == 'true'); + changeAnonymousOption(datas['anonymousOption'] == 'true'); changeChoiceType(datas['choiceType']); changePollType(datas['pollType']); + $('img[src$="tooltip.png"]').addClass("tooltip"); $('.tooltip').tipTip({ defaultPosition:'top' }); });
participants (1)
-
tchemit@users.chorem.org