Author: tchemit Date: 2012-06-13 17:59:38 +0200 (Wed, 13 Jun 2012) New Revision: 3469 Url: http://chorem.org/repositories/revision/pollen/3469 Log: readd lost options + disable all hidden input (pass from 126 fields to 65\!) Modified: trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties trunk/pollen-ui-struts2/src/main/webapp/js/createPoll.js 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 15:58:45 UTC (rev 3468) +++ trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-06-13 15:59:38 UTC (rev 3469) @@ -232,6 +232,8 @@ pollen.fieldset.userInformation.toCreate=User informations to create pollen.fieldset.userInformation.toDelete=User informations to delete pollen.fieldset.userInformation.toUpdate=User informations to update +pollen.fieldset.vote.options=Votes +pollen.fieldset.vote.options.help=Configure votes of the poll pollen.image.not.loaded=Image not loaded pollen.information.choice.deleted=Choice deleted. pollen.information.comment.added=Comment added. 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 15:58:45 UTC (rev 3468) +++ trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-06-13 15:59:38 UTC (rev 3469) @@ -232,6 +232,8 @@ pollen.fieldset.userInformation.toCreate=Informations de l'utilisateur à créer pollen.fieldset.userInformation.toDelete=Informations de l'utilisateur à supprimer pollen.fieldset.userInformation.toUpdate=Informations de l'utilisateur à mettre à jour +pollen.fieldset.vote.options=Les votes +pollen.fieldset.vote.options.help=Configurer les votes du sondage pollen.image.not.loaded=Image non chargée pollen.information.choice.deleted=Choix supprimé. pollen.information.comment.added=Commentaire ajouté. Modified: trunk/pollen-ui-struts2/src/main/webapp/js/createPoll.js =================================================================== --- trunk/pollen-ui-struts2/src/main/webapp/js/createPoll.js 2012-06-13 15:58:45 UTC (rev 3468) +++ trunk/pollen-ui-struts2/src/main/webapp/js/createPoll.js 2012-06-13 15:59:38 UTC (rev 3469) @@ -490,8 +490,8 @@ function switchChoices(containerId, choicePrefix, choiceNumber, newChoiceNumber) { - console.info("will switch (" + choicePrefix + ") [" + choiceNumber - + "] to [" + newChoiceNumber + "]"); + //console.info("will switch (" + choicePrefix + ") [" + choiceNumber + // + "] to [" + newChoiceNumber + "]"); // change topiaId switchValue(choicePrefix, choiceNumber, newChoiceNumber, '.topiaId'); @@ -517,7 +517,7 @@ var choiceTIVal = choiceTI.val(); var newChoiceTI = $('[name="' + choicePrefix + newChoiceNumber + suffix + '"]'); var newChoiceTIVal = newChoiceTI.val(); - console.info("switch " + choiceTIVal + " to " + newChoiceTIVal); + //console.info("switch " + choiceTIVal + " to " + newChoiceTIVal); choiceTI.val(newChoiceTIVal); newChoiceTI.val(choiceTIVal); } @@ -528,19 +528,19 @@ var choiceTIVal = choiceTI.attr("alt"); var newChoiceTIVal = newChoiceTI.attr("alt"); - console.info("switch " + choiceTIVal + " to " + newChoiceTIVal); + //console.info("switch " + choiceTIVal + " to " + newChoiceTIVal); choiceTI.attr("alt", newChoiceTIVal); newChoiceTI.attr("alt", choiceTIVal); choiceTIVal = choiceTI.attr("title"); newChoiceTIVal = newChoiceTI.attr("title"); - console.info("switch " + choiceTIVal + " to " + newChoiceTIVal); + //console.info("switch " + choiceTIVal + " to " + newChoiceTIVal); choiceTI.attr("title", newChoiceTIVal); newChoiceTI.attr("title", choiceTIVal); choiceTIVal = choiceTI.attr("src"); newChoiceTIVal = newChoiceTI.attr("src"); - console.info("switch " + choiceTIVal + " to " + newChoiceTIVal); + //console.info("switch " + choiceTIVal + " to " + newChoiceTIVal); choiceTI.attr("src", newChoiceTIVal); newChoiceTI.attr("src", choiceTIVal); } @@ -558,67 +558,59 @@ jQuery(document).ready(function () { function changeChoiceAddAllowed(val) { -// 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(); -// } $('[name="maxChoices"]').attr('disabled', !val); } function changeReminder(val) { -// 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); + $('[name="poll.anonymousVoteAllowed"]').attr('disabled', val); } + function disableAll() { + $("#" + $(this).attr('id') + " :input").attr('disabled', true); + } + + function undisableAll() { + $("#" + $(this).attr('id') + " :input").attr('disabled', false); + } + function changePollType(type) { + var container = $('#pollType' + type); - $('.pollType').addClass('hidden'); - $('.pollType').removeClass('thispoll'); - $('#pollType' + type).removeClass('hidden'); - $('#pollType' + type).addClass('thispoll'); + // traitement des autres containers de type + $('.pollType').not(container). + addClass('hidden').removeClass('thispoll'). + each(disableAll); + // traitement du nouveau container de type + container.removeClass('hidden').addClass('thispoll'). + each(undisableAll); $('[name="poll.pollType"]').attr('checked', false); $('[name="poll.pollType"][value="' + type + '"]').attr('checked', 'checked'); } function changeChoiceType(type) { - $('.choices').addClass('hidden'); - $('.choices').removeClass('thischoice'); - $('#choices' + type).removeClass('hidden'); - $('#choices' + type).addClass('thischoice'); + var container = $('#choices' + type); + // traitement des autres containers de choix + $('.choices').not(container). + addClass('hidden').removeClass('thischoice'). + each(disableAll); + // traitement du nouveau container de choix + container.removeClass('hidden'). + addClass('thischoice').each(undisableAll); + $('[name="poll.choiceType"]').attr('checked', false); $('[name="poll.choiceType"][value="' + type + '"]').attr('checked', 'checked'); } @@ -630,6 +622,9 @@ $('[name="poll.publicResults"]').change(function () { changePublicOption($(this).prop('checked')); }); + $('[name="poll.anonymous"]').change(function () { + changeAnonymousOption($(this).prop('checked')); + }); $('[name="limitChoice"]').change(function () { changeLimitChoice($(this).prop('checked')); @@ -639,15 +634,6 @@ changeReminder($(this).prop('checked')); }); - $('[name="poll.anonymous"]').change(function () { - 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.choiceType"]').change(function () { changeChoiceType($(this).val()); });