Author: fdesbois Date: 2010-05-19 20:25:58 +0200 (Wed, 19 May 2010) New Revision: 3003 Url: http://chorem.org/repositories/revision/pollen/3003 Log: - Use listeners to check changes on lists - Uncomment choices managment -> other formFragment - Inversion of subForm boolean Removed: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/PollStep.java Modified: trunk/pollen-business/src/main/xmi/pollen.zargo trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/SubForm.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/models/ParticipantListModel.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/models/PollFormModel.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollForm.java trunk/pollen-ui/src/main/resources/i18n/pollen-ui-fr_FR.properties trunk/pollen-ui/src/main/webapp/js/pollen.js trunk/pollen-ui/src/main/webapp/poll/PollForm.tml Modified: trunk/pollen-business/src/main/xmi/pollen.zargo =================================================================== (Binary files differ) Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/SubForm.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/SubForm.java 2010-05-19 13:25:45 UTC (rev 3002) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/SubForm.java 2010-05-19 18:25:58 UTC (rev 3003) @@ -30,8 +30,8 @@ logger.debug("form already visible : " + visible); } if (visible) { - return noFormBlock; + return formBlock; } - return formBlock; + return noFormBlock; } } Deleted: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/PollStep.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/PollStep.java 2010-05-19 13:25:45 UTC (rev 3002) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/PollStep.java 2010-05-19 18:25:58 UTC (rev 3003) @@ -1,32 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.ui.data; - -/** Énumération représentant les étapes du formulaire de création de sondage. */ -public enum PollStep { - POLL(1), OPTIONS(2), LISTS(3), CHOICES(4); - - protected Integer index; - - private PollStep(Integer index) { - this.index = index; - } - - public Integer getIndex() { - return index; - } -} Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/models/ParticipantListModel.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/models/ParticipantListModel.java 2010-05-19 13:25:45 UTC (rev 3002) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/models/ParticipantListModel.java 2010-05-19 18:25:58 UTC (rev 3003) @@ -6,9 +6,13 @@ import org.chorem.pollen.entity.ParticipantList; import org.chorem.pollen.service.ServicePoll; import org.chorem.pollen.ui.services.PollenManager; +import org.nuiton.topia.persistence.TopiaEntity; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; import java.util.Collection; import java.util.HashMap; import java.util.LinkedHashMap; @@ -25,6 +29,8 @@ private static final Logger logger = LoggerFactory.getLogger(ParticipantListModel.class); + public static final String PROPERTY_PARTICIPANTS = "participants"; + protected ServicePoll service; protected PollenManager manager; @@ -33,6 +39,16 @@ protected ParticipantMap participants; + protected final PropertyChangeSupport pcs = new PropertyChangeSupport(this); + + protected final PropertyChangeListener participantsListener = + new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + firePropertyChange(PROPERTY_PARTICIPANTS, participants); + } + }; + public ParticipantListModel(ServicePoll service, PollenManager manager) { this.service = service; this.manager = manager; @@ -43,6 +59,8 @@ Participant newParticipant = service.getNewPollParticipant(); String id = manager.createPollenId(); participants.put(id, newParticipant); + ((TopiaEntity) newParticipant).addPropertyListener(participantsListener); + firePropertyChange(PROPERTY_PARTICIPANTS, participants); return newParticipant; } @@ -51,6 +69,8 @@ logger.debug("Remove participant : " + participant); } participants.remove(participant); + ((TopiaEntity) participant).removePropertyListener(participantsListener); + firePropertyChange(PROPERTY_PARTICIPANTS, participants); } public Collection<Participant> getParticipants() { @@ -115,6 +135,34 @@ } /** + * addPropertyChangeListener : + * + * @param listener + */ + public void addPropertyChangeListener(PropertyChangeListener listener) { + pcs.addPropertyChangeListener(listener); + } + + /** + * removePropertyChangeListener : + * + * @param listener + */ + public void removePropertyChangeListener(PropertyChangeListener listener) { + pcs.removePropertyChangeListener(listener); + } + + /** + * firePropertyChange : + * + * @param propertyName + * @param newValue + */ + protected void firePropertyChange(String propertyName, Object newValue) { + pcs.firePropertyChange(propertyName, null, newValue); + } + + /** * Participant map is a BidiMap ordered on values inserted using a {@link * LinkedHashMap}. */ Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/models/PollFormModel.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/models/PollFormModel.java 2010-05-19 13:25:45 UTC (rev 3002) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/models/PollFormModel.java 2010-05-19 18:25:58 UTC (rev 3003) @@ -13,6 +13,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; import java.util.Collection; import java.util.LinkedHashMap; import java.util.Map; @@ -38,6 +40,8 @@ /** Default listName for Restricted Poll */ private static final String DEFAULT_LIST_NAME = "LIST"; + public static final String PROPERTY_LISTS = "lists"; + /** Service to manage poll */ protected ServicePoll service; @@ -52,6 +56,16 @@ protected boolean createMode; + protected boolean listsChanged; + + protected final PropertyChangeListener listsListener = + new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + listsChanged = true; + } + }; + /** * Constructor of PollFormModel. Need services {@code servicePoll} and * {@code manager} to manage the current edited poll. Use {@link @@ -64,7 +78,8 @@ PollenManager manager) { this.service = servicePoll; lists = new LinkedHashMap<String, ParticipantList>(); - this.listModel = new ParticipantListModel(service, manager); + listModel = new ParticipantListModel(service, manager); + listModel.addPropertyChangeListener(listsListener); } /** @@ -130,8 +145,13 @@ listModel.reset(); } poll.setPollType(type); + listsChanged = false; } + public boolean isListsChanged() { + return listsChanged; + } + /** * Retrieve a collection of {@link ParticipantList} of current lists. * @@ -176,6 +196,7 @@ logger.debug("Add list : " + listName); } lists.put(listName, list); + listsChanged = true; result = true; } else if (logger.isDebugEnabled()) { logger.debug("Refuse adding list : " + listName); @@ -238,6 +259,7 @@ getLists().remove(listModel.getList()); listModel.reset(); + listsChanged = true; } /** 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-05-19 13:25:45 UTC (rev 3002) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollForm.java 2010-05-19 18:25:58 UTC (rev 3003) @@ -1,7 +1,9 @@ package org.chorem.pollen.ui.pages.poll; import org.apache.commons.lang.StringUtils; +import org.apache.tapestry5.Block; import org.apache.tapestry5.ComponentResources; +import org.apache.tapestry5.Link; import org.apache.tapestry5.RenderSupport; import org.apache.tapestry5.annotations.Environmental; import org.apache.tapestry5.annotations.IncludeJavaScriptLibrary; @@ -14,9 +16,12 @@ import org.apache.tapestry5.corelib.components.Zone; import org.apache.tapestry5.ioc.Messages; import org.apache.tapestry5.ioc.annotations.Inject; +import org.apache.tapestry5.json.JSONObject; import org.chorem.pollen.PollenBusinessException; +import org.chorem.pollen.common.ChoiceType; import org.chorem.pollen.common.PollType; import org.chorem.pollen.common.VoteCountingType; +import org.chorem.pollen.entity.Choice; import org.chorem.pollen.entity.Participant; import org.chorem.pollen.entity.ParticipantList; import org.chorem.pollen.entity.Poll; @@ -27,6 +32,7 @@ import org.chorem.pollen.ui.base.AbstractPollenPage; import org.chorem.pollen.ui.components.Border; import org.chorem.pollen.ui.data.AddressBar; +import org.chorem.pollen.ui.data.ChoiceField; import org.chorem.pollen.ui.models.ParticipantListModel; import org.chorem.pollen.ui.models.PollFormModel; import org.chorem.pollen.ui.services.PollenManager; @@ -35,8 +41,10 @@ import java.text.DateFormat; import java.text.SimpleDateFormat; +import java.util.ArrayList; import java.util.Collection; import java.util.Date; +import java.util.List; /** * PollForm : Creation and Modification. @@ -115,6 +123,7 @@ model = null; initOptions(); listsFeedback.clearErrors(); + step = PollStep.MAIN; } /** @@ -206,7 +215,8 @@ } if (formId != null) { // Script for form interactions : see "webapp/js/pollForm.js" - renderSupport.addScript("new PollForm('%s', '%s', '%s', '%s');", + renderSupport.addScript("var pollForm = " + + "new PollForm('%s', '%s', '%s', '%s');", formId, VoteCountingType.NORMAL, PollType.FREE, @@ -225,71 +235,6 @@ // advancedOptions = false; // } - /************************** CHOIX *****************************************/ - -// @Property -// private ChoiceField choice; -// -// private List<ChoiceField> choices; -// -// @Inject -// private Block choiceText; -// -// @Inject -// private Block choiceDate; -// -// @Inject -// private Block choiceImage; -// -// private boolean refresh; -// -// /** -// * Get choices from poll if it exists or initialized 4 choices with the -// * default type : TEXT. -// * -// * @return a list of ChoiceDTO -// */ -// public List<ChoiceField> getChoices() throws PollenBusinessException { -// if (choices == null) { -// choices = new ArrayList<ChoiceField>(); -// if (isCreateMode()) { -// // Initialized to choice TEXT type -// for (int i = 0; i < 4; i++) { -// choices.add(ChoiceField.getChoiceText()); -// } -// } else { -// for (Choice current : getPoll().getChoice()) { -// choices.add(new ChoiceField(getPoll(), current)); -// } -// } -// } -// return choices; -// } -// -// public Block getChoiceTypeBlock() { -// switch(poll.getChoiceType()) { -// case DATE: -// return choiceDate; -// case IMAGE: -// return choiceImage; -// default: -// return choiceText; -// } -// } -// -// void onSelectedFromRefreshOptions() { -// refresh = true; -// } -// -// // TEMP -// @Log -// Object onSuccessFromMainForm() { -// if (!refresh) { -// -// } -// return mainForm; -// } - /************************** OPTIONS ***************************************/ /** Synchronization with anonymous and anonymousVoteAllowed options * */ @@ -397,7 +342,7 @@ return getPoll().getPollType().isFree(); } - /** ******************** LISTS **************************************** */ + /** ******************* LISTS **************************************** */ @Inject private ComponentResources resources; @@ -422,11 +367,13 @@ /** Flag for subForm used for lists managment */ @Property - private boolean formActivate; + private boolean refreshListsZone; /** Flag if submit comes from lists edition */ private boolean editLists; + protected static final String EVENT_UPDATE_POLL_TYPE = "updatePollType"; + /** DATA ** */ public ParticipantListModel getListModel() { @@ -448,14 +395,28 @@ /** PollType change ** */ @Log - Object onChangeFromPollType(String value) { - PollType type = PollType.valueOf(value); - getModel().setPollType(type); - if (type.isRestrictedOrGroup()) { - listsFeedback.addInfo("Edition en cours d'une liste restreinte. " + - "Attention un changement de type de restriction provoquera" + - " une remise à zéro de la/les liste(s) en cours d'édition."); + JSONObject onChangeFromPollType(String value) { + if (logger.isDebugEnabled()) { + logger.debug("Lists changed : " + getModel().isListsChanged()); } + // Prepare Json response for javascript callback method + JSONObject json = new JSONObject(); + Link link = resources.createEventLink(EVENT_UPDATE_POLL_TYPE, value); + json.put("link", link.toAbsoluteURI()); + json.put("zoneId", "p-pollForm-lists-zone"); + // Add confirm message only if changed appears + if (getModel().isListsChanged()) { + // A dialog box will appeared for user confirmation on changing poll + // type with data unsaved. + json.put("confirm", + messages.get("pollen.ui.poll.listChanged.confirmMessage")); + } + return json; + } + + @Log + Object onUpdatePollType(String value) { + getModel().setPollType(PollType.valueOf(value)); return refreshListZone(); } @@ -522,17 +483,114 @@ getListModel().removeParticipant(participant); } - protected Object refreshListZone() { - formActivate = false; + Object refreshListZone() { + refreshListsZone = true; return listsZone.getBody(); } protected void setEditListsFlag() { - formActivate = true; editLists = true; } + /** *********************** CHOIX **************************************** */ + + @Property + private ChoiceField choice; + + private List<ChoiceField> choices; + + @Inject + private Block choiceText; + + @Inject + private Block choiceDate; + + @Inject + private Block choiceImage; + + private boolean refresh; + + /** + * Get choices from poll if it exists or initialized 4 choices with the + * default type : TEXT. TODO-fdesbois-2010-05-19 : put this treatment in + * PollFormModel + * + * @return a list of ChoiceDTO + */ + public List<ChoiceField> getChoices() throws PollenBusinessException { + if (choices == null) { + choices = new ArrayList<ChoiceField>(); + if (isCreateMode()) { + // Initialized to choice TEXT type + for (int i = 0; i < 4; i++) { + choices.add(ChoiceField.getChoiceText()); + } + } else { + for (Choice current : getPoll().getChoice()) { + choices.add(new ChoiceField(getPoll(), current)); + } + } + } + return choices; + } + + public Block getChoiceTypeBlock() { + switch (getPoll().getChoiceType()) { + case DATE: + return choiceDate; + case IMAGE: + return choiceImage; + default: + return choiceText; + } + } + + private enum PollStep { + + MAIN, CHOICES; + } + + private PollStep step; + + @Property + private boolean refreshChoicesZone; + + @InjectComponent + private Zone choicesZone; + @Log + Object onChangeFromChoiceType(String value) { + ChoiceType type = ChoiceType.valueOf(value); + getPoll().setChoiceType(type); + refreshChoicesZone = true; + return choicesZone.getBody(); + } + + @Log + void onSelected() { + refreshListsZone = false; + refreshChoicesZone = false; + } + + @Log + void onSelectedFromChoiceStep() { + step = PollStep.CHOICES; + } + + @Log + void onSelectedFromMainStep() { + step = PollStep.MAIN; + } + + public boolean isChoiceStep() { + return step.equals(PollStep.CHOICES); + } + + public boolean isMainStep() { + return step.equals(PollStep.MAIN); + } + + @Log Object onSuccess() { // if (!editLists) { // saveCurrentList(); Modified: trunk/pollen-ui/src/main/resources/i18n/pollen-ui-fr_FR.properties =================================================================== --- trunk/pollen-ui/src/main/resources/i18n/pollen-ui-fr_FR.properties 2010-05-19 13:25:45 UTC (rev 3002) +++ trunk/pollen-ui/src/main/resources/i18n/pollen-ui-fr_FR.properties 2010-05-19 18:25:58 UTC (rev 3003) @@ -51,11 +51,14 @@ pollen.ui.list.update.removeParticipant=Supprimer ce votant pollen.ui.list.update.removeParticipant.confirmMessage=Etes-vous s\u00fbr de vouloir supprimer %1$s de la liste ? pollen.ui.list.update.removeParticipant.success=Le votant a \u00e9t\u00e9 supprim\u00e9 avec succ\u00e8s. + pollen.ui.participant.name-label=Nom pollen.ui.participant.email-label=Email pollen.ui.participant.weight-label=Poids pollen.ui.participant.add=Nouveau participant +pollen.ui.poll.listChanged.confirmMessage=Des changements ont été effectués sur la/les liste(s), un changement de restriction supprimera les modifications. Voulez-vous continuer ? + # OLD LOGIN_COMPONENT connectionLegend=Connexion loginSubmit=Me connecter @@ -65,6 +68,9 @@ passwordComp-required-message=Vous devez entrer votre mot de passe. loginFailed=Mauvais identifiant ou mot de passe. +# FORM:: poll +groupName-label=Nom du groupe + # FORM:: user firstName-label=Pr\u00e9nom lastName-label=Nom Modified: trunk/pollen-ui/src/main/webapp/js/pollen.js =================================================================== --- trunk/pollen-ui/src/main/webapp/js/pollen.js 2010-05-19 13:25:45 UTC (rev 3002) +++ trunk/pollen-ui/src/main/webapp/js/pollen.js 2010-05-19 18:25:58 UTC (rev 3003) @@ -38,6 +38,19 @@ zoneManager.updateFromURL(response.link); } +function onConfirmRefreshZone(response) { + var zoneManager = Tapestry.findZoneManagerForZone(response.zoneId); + + if (response.confirm) { + // Show confirm dialog for refresh + if (confirm(response.confirm)) { + zoneManager.updateFromURL(response.link); + } + } else { + zoneManager.updateFromURL(response.link); + } +} + function triggerFragment(checkbox, fragment) { fragment.toggle(); } Modified: trunk/pollen-ui/src/main/webapp/poll/PollForm.tml =================================================================== --- trunk/pollen-ui/src/main/webapp/poll/PollForm.tml 2010-05-19 13:25:45 UTC (rev 3002) +++ trunk/pollen-ui/src/main/webapp/poll/PollForm.tml 2010-05-19 18:25:58 UTC (rev 3003) @@ -15,6 +15,8 @@ <t:zone t:id="mainZone" t:update="show"> <form t:type="form" t:id="mainForm" t:zone="mainZone" action="post"> <t:errors /> +<t:formFragment t:id="mainFormFragment" t:visible="mainStep"> + <!-- MAIN INFOS --> <div id="p-pollForm-mainInfos"> <fieldset> @@ -247,74 +249,35 @@ </div> </fieldset> </div> -<!-- CHOICES --> -<!--<div id="p-pollForm-choices">--> -<!--<fieldset>--> -<!--<legend>--> -<!--<label t:type="label" t:for="choiceType" />: --> -<!--<select t:type="select" t:id="choiceType" t:value="poll.choiceType" t:validate="required">--> -<!--<option></option>--> -<!--</select> --> -<!--<input type="image" t:type="submit" class="ico refresh" t:id="refreshChoices" value="Refresh choices" title="${message:refreshChoices-button}"/>--> -<!--</legend>--> -<!--<div t:type="loop" t:source="choices" t:value="choice" t:volatile="true" class="clearfix">--> -<!--<div class="fleft choiceName">--> -<!--<t:delegate t:to="choiceTypeBlock" />--> -<!--<t:block t:id="choiceText">--> -<!--<label t:type="label" t:for="choiceTextField" />: --> -<!--<input type="text" class="nameField" t:type="textfield" t:id="choiceTextField" value="choice.text" />--> -<!--</t:block>--> -<!--<t:block t:id="choiceDate">--> -<!--<label t:type="label" t:for="choiceDateField" />: --> -<!--<input t:type="ck/dateTimeField" t:id="choiceDateField" value="choice.date" t:validate="regexp"--> -<!--t:datePattern="message:date-pattern" t:timePicker="true" t:timePickerAdjacent="true"/>--> -<!--</t:block>--> -<!--<t:block t:id="choiceImage">--> -<!--<label t:type="label" t:for="choiceImageField" />: --> -<!--<input type="file" class="nameField" t:type="upload" t:id="choiceImageField" value="choice.image" t:validate="regexp" />--> -<!--</t:block>--> -<!--<t:block t:id="choiceDisplay">--> -<!--${choice.name}--> -<!--</t:block>--> -<!-- --> -<!--<t:label t:for="choiceDescription" />: --> -<!--</div>--> -<!--<div class="fleft">--> -<!--<t:textarea cols="34" rows="1" t:id="choiceDescription" t:value="choice.description" />--> -<!--</div>--> -<!--</div>--> -<!--</fieldset>--> -<!--</div>--> <!-- LISTS --> <div id="p-pollForm-lists"> <fieldset> <legend> <label t:type="label" t:for="pollType" />: - <select t:type="select" class="list-select" t:id="pollType" - t:value="poll.pollType" t:validate="required" - t:mixins="nuiton/zoneUpdater" t:event="change" - t:zone="p-pollForm-lists-zone" /> - <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> + <!--<select t:type="select" t:id="pollType" class="list-select" t:value="poll.pollType" t:validate="required"--> + <!--t:mixins="nuiton/zoneUpdater" t:event="change" t:zone="p-pollForm-lists-zone" />--> + <select t:type="select" t:id="pollType" t:value="poll.pollType" + t:validate="required" + t:mixins="ck/onEvent" t:event="change" + t:onCompleteCallback="onConfirmRefreshZone" /> + <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> </legend> - <div t:type="zone" id="p-pollForm-lists-zone" t:id="listsZone" + <div t:type="zone" t:id="listsZone" id="p-pollForm-lists-zone" class="form-block" t:update="show"> <t:if t:test="canDisplayLists()"> <t:nuiton.feedback t:id="listsFeedback" /> <br /> - <t:subForm t:visible="formActivate"> + <t:subForm t:visible="refreshListsZone"> <t:if t:test="poll.pollType.group"> <p> - <label t:type="label" t:for="listName" />: - <input t:type="textfield" t:id="listName" + <label t:type="label" t:for="groupName" />: + <input t:type="textfield" t:id="groupName" value="listName" /> - <input t:type="submit" t:id="addList" value="ADD" /> - <!--<a t:type="actionlink" t:id="addList" t:zone="p-pollForm-lists-zone">--> - <!--ADD--> - <!--</a>--> + <input t:type="submit" t:id="addList" + value="${message:pollen.ui.button.add}" /> </p> <p class="center"> @@ -324,18 +287,14 @@ t:type="nuiton/submitContext" t:context="list.name" t:id="editList" value="${list.name}" /> - <!--<span t:type="any" t:mixins="nuiton/confirm">--> - <!--<input t:type="nuiton/submitContext" t:id="removeList" t:image="context:img/delete.png" t:context="list.name" value="${message:delete}" />--> - <!--</span>--> <t:if t:test="currentListSelected"> - <!--<input t:type="submit" t:id="saveList" t:image="context:img/save.png" />--> <a t:type="actionlink" t:id="removeList" t:zone="p-pollForm-lists-zone"> - <span t:type="any" - t:mixins="nuiton/confirm"> - <img src="${asset:context:img/delete.png}" - alt="${message:delete}" /> - </span> + <span t:type="any" + t:mixins="nuiton/confirm"> + <img src="${asset:context:img/delete.png}" + alt="${message:delete}" /> + </span> </a> </t:if> </t:loop> @@ -398,32 +357,75 @@ </t:if> </t:subForm> </t:if> - <!--<t:delegate t:to="listsBlock" />--> - <!--<t:block t:id="listsForm">--> - <!--<form t:type="form" action="tapestry">--> - <!--<t:delegate t:to="listsFields" />--> - <!--</form>--> - <!--</t:block>--> - <!--<t:block t:id="listsFields">--> - <!--<t:if t:test="poll.pollType.group">--> - <!--<p>--> - <!--<label t:type="label" t:for="listName" />: --> - <!--<input t:type="textfield" t:id="listName" value="listName"/> --> - <!--<input t:type="submit" t:id="addList" value="ADD"/>--> - <!--</p>--> - <!--<p>--> - <!--<t:loop t:source="lists.values()" t:value="list" t:volatile="true">--> - <!--${list.name} --> - <!--</t:loop>--> - <!--</p>--> - <!--<p:else>--> - <!--COOL--> - <!--</p:else>--> - <!--</t:if>--> - <!--</t:block> --> </div> </fieldset> + <p class="center"><input t:type="submit" t:id="choiceStep" value="CHOICE" /> + </p> </div> +</t:formFragment> +<t:formFragment t:id="choiceFormFragment" t:visible="choiceStep"> + + <!-- CHOICES --> + <div id="p-pollForm-choices"> + <fieldset> + <legend> + <label t:type="label" t:for="choiceType" />: + <select t:type="select" t:id="choiceType" + t:value="poll.choiceType" t:validate="required" + t:mixins="nuiton/zoneUpdater" t:event="change" + t:zone="p-pollForm-choices-zone" /> + </legend> + <t:zone t:id="choicesZone" id="p-pollForm-choices-zone"> + <t:subForm t:visible="refreshChoicesZone"> + <div t:type="loop" t:source="choices" t:value="choice" + t:volatile="true" class="clearfix"> + <div class="fleft choiceName"> + <t:delegate t:to="choiceTypeBlock" /> + <t:block t:id="choiceText"> + <label t:type="label" t:for="choiceTextField" />: + <input type="text" class="nameField" + t:type="textfield" t:id="choiceTextField" + value="choice.text" /> + </t:block> + <t:block t:id="choiceDate"> + <label t:type="label" t:for="choiceDateField" />: + <input t:type="ck/dateTimeField" + t:id="choiceDateField" + value="choice.date" t:validate="regexp" + t:datePattern="message:date-pattern" + t:timePicker="true" + t:timePickerAdjacent="true" /> + </t:block> + <t:block t:id="choiceImage"> + <label t:type="label" + t:for="choiceImageField" />: + <input type="file" class="nameField" + t:type="upload" t:id="choiceImageField" + value="choice.image" + t:validate="regexp" /> + </t:block> + <t:block t:id="choiceDisplay"> + ${choice.name} + </t:block> + + <t:label t:for="choiceDescription" /> + : + </div> + <div class="fleft"> + <t:textarea cols="34" rows="1" + t:id="choiceDescription" + t:value="choice.description" /> + </div> + </div> + </t:subForm> + </t:zone> + </fieldset> + </div> + <p class="center"> + <input t:type="submit" t:id="mainStep" value="PREVIOUS" /> + <input t:type="submit" t:id="save" value="SAVE" /> + </p> +</t:formFragment> </form> </t:zone> </html>