Author: fdesbois Date: 2010-03-02 21:14:34 +0100 (Tue, 02 Mar 2010) New Revision: 2893 Added: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/AddressBar.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/AddressBarItem.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/mixins/ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/mixins/ZoneUpdater.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollForm.java trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollForm.properties trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollForm_en.properties trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollForm_fr.properties trunk/pollen-ui/src/main/webapp/css/poll.css trunk/pollen-ui/src/main/webapp/js/ZoneUpdater.js trunk/pollen-ui/src/main/webapp/poll/PollForm.tml Removed: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/Lien.java Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePoll.java trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollImpl.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/Polls.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Border.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/Index.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin/UsersAdmin.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/CloseValidation.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/ConfirmPoll.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/CreationValidation.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/ImageDisplay.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/ModificationValidation.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollCreation.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollModification.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/Results.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/Account.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/Register.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserLists.java trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/Border.tml trunk/pollen-ui/src/main/webapp/css/main.css trunk/pollen-ui/src/main/webapp/poll/PollCreation.tml Log: - Evo #122 : Begin creation of new page for pollForm - Refactor Lien class in AddressBarItem + add AddressBar smoother managment - Use ZoneUpdater mixin for pollForm interactions Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePoll.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePoll.java 2010-02-26 18:01:14 UTC (rev 2892) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePoll.java 2010-03-02 20:14:34 UTC (rev 2893) @@ -21,6 +21,7 @@ import org.chorem.pollen.business.dto.CommentDTO; import org.chorem.pollen.business.dto.PollDTO; +import org.chorem.pollen.business.dto.UserDTO; /** * Interface du service de gestion des sondages. @@ -55,6 +56,21 @@ public boolean deletePoll(String pollId); /** + * Get a new poll for creation form. + * + * @return a new PollDTO with params initialized + */ + public PollDTO getNewPoll(); + + /** + * Get a new poll which is a copy from the {@code poll}. + * + * @param poll to copy + * @return a new poll which is a copy from the one in argument + */ + public PollDTO getNewPoll(PollDTO poll); + + /** * Récupération d'un sondage à partir de son identifiant. * * @param pollId identifiant du sondage (différent du topiaId) Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollImpl.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollImpl.java 2010-02-26 18:01:14 UTC (rev 2892) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/business/services/ServicePollImpl.java 2010-03-02 20:14:34 UTC (rev 2893) @@ -55,6 +55,9 @@ import org.chorem.pollen.business.persistence.VotingListDAO; import org.chorem.pollen.business.utils.ContextUtil; import org.chorem.pollen.business.PollenContext; +import org.chorem.pollen.business.dto.UserDTO; +import org.chorem.pollen.common.PollType; +import org.chorem.pollen.common.VoteCountingType; import org.nuiton.topia.TopiaContext; import org.nuiton.topia.TopiaException; import org.nuiton.topia.framework.TopiaQuery; @@ -284,6 +287,20 @@ } @Override + public PollDTO getNewPoll() { + PollDTO newPoll = new PollDTO(); + newPoll.setVoteCounting(VoteCountingType.NORMAL); + newPoll.setPollType(PollType.FREE); + return newPoll; + } + + @Override + public PollDTO getNewPoll(PollDTO poll) { + PollDTO newPoll = new PollDTO(); + return newPoll; + } + + @Override public boolean deletePoll(String pollId) { TopiaContext transaction = null; try { Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/Polls.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/Polls.java 2010-02-26 18:01:14 UTC (rev 2892) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/Polls.java 2010-03-02 20:14:34 UTC (rev 2893) @@ -41,7 +41,7 @@ import org.chorem.pollen.business.services.ServicePollAccount; import org.chorem.pollen.business.services.ServiceResults; import org.chorem.pollen.ui.data.EvenOdd; -import org.chorem.pollen.ui.data.Lien; +import org.chorem.pollen.ui.data.AddressBarItem; import org.chorem.pollen.ui.data.PollAction; import org.chorem.pollen.ui.pages.admin.PollsAdmin; import org.chorem.pollen.ui.pages.poll.ConfirmPoll; @@ -93,7 +93,7 @@ @SuppressWarnings("unused") @Property - private Lien[] address; + private AddressBarItem[] address; /** * Sert à créer pollsModel @@ -208,8 +208,8 @@ * Initialisation de l'affichage */ public void setupRender() { - address = new Lien[] { new Lien("Pollen", "Index"), - new Lien(title, null) }; + address = new AddressBarItem[] { new AddressBarItem("Pollen", "Index"), + new AddressBarItem(title, null) }; pollsModel = beanModelSource.createDisplayModel(PollDTO.class, componentResources.getMessages()); Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Border.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Border.java 2010-02-26 18:01:14 UTC (rev 2892) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Border.java 2010-03-02 20:14:34 UTC (rev 2893) @@ -24,6 +24,7 @@ import java.util.Locale; import org.apache.tapestry5.BindingConstants; +import org.apache.tapestry5.Link; import org.apache.tapestry5.annotations.Component; import org.apache.tapestry5.annotations.IncludeStylesheet; import org.apache.tapestry5.annotations.InjectComponent; @@ -40,7 +41,7 @@ import org.chorem.pollen.business.services.ServiceAuth; import org.chorem.pollen.business.utils.MD5; import org.chorem.pollen.ui.base.ContextLink; -import org.chorem.pollen.ui.data.Lien; +import org.chorem.pollen.ui.data.AddressBarItem; /** * Classe du Layout Component Border. @@ -79,7 +80,7 @@ @SuppressWarnings("unused") @Parameter(required = false) @Property - private Lien[] address; + private AddressBarItem[] address; /** * Chaine définissant le style de la page @@ -88,6 +89,11 @@ @Property private String pageLogo; + /** Title of the page **/ + @Parameter(defaultPrefix = BindingConstants.LITERAL) + @Property + private String pageTitle; + /** * Chaine definissant le logo de la page */ @@ -100,7 +106,7 @@ */ @SuppressWarnings("unused") @Property - private Lien lien; + private AddressBarItem lien; /** * Champ login du formulaire d'identification Added: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/AddressBar.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/AddressBar.java (rev 0) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/AddressBar.java 2010-03-02 20:14:34 UTC (rev 2893) @@ -0,0 +1,53 @@ + +package org.chorem.pollen.ui.data; + +import java.util.ArrayList; +import java.util.List; + +/** + * AddressBar + * + * Created: 2 mars 2010 + * + * @author fdesbois + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ + */ +public class AddressBar { + + public List<AddressBarItem> items; + + public AddressBar() { + appendHome(); + } + + protected List<AddressBarItem> getListItems() { + if (items == null) { + items = new ArrayList<AddressBarItem>(); + } + return items; + } + + protected AddressBar appendHome() { + append("Pollen", "index"); + return this; + } + + public AddressBar appendCurrent(String name) { + append(name, null); + return this; + } + + public AddressBar append(String name, String page) { + getListItems().add(new AddressBarItem(name, page)); + return this; + } + + public AddressBarItem[] getItems() { + return getListItems().toArray( + new AddressBarItem[getListItems().size()]); + } + +} Property changes on: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/AddressBar.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL" Copied: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/AddressBarItem.java (from rev 2891, trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/Lien.java) =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/AddressBarItem.java (rev 0) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/AddressBarItem.java 2010-03-02 20:14:34 UTC (rev 2893) @@ -0,0 +1,92 @@ +/* *##% 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; + +/** + * Classe représentant un item de l'adresse dans la classe Border. + * + * @author kmorin + * @version $Id$ + */ +public class AddressBarItem { + + /** + * nom sous lequel apparait le lien dans la barre d'adresse. + */ + private String name; + + /** + * adresse où mène le lien + */ + private String address; + + /** + * Constructeur + * + * @param name nom du lien + * @param address adresse du lien + */ + public AddressBarItem(String name, String address) { + this.name = name; + this.address = address; + } + + /** + * Retourn le nom du lien + * + * @return name + */ + public String getName() { + return name; + } + + /** + * Modifie la valeur de name + * + * @param name la nouvelle valeur de name + */ + public void setName(String name) { + this.name = name; + } + + /** + * Retourne l'adresse du lien + * + * @return address + */ + public String getAddress() { + return address; + } + + /** + * Modifie l'adresse du lien + * + * @param address la nouvelle valeur du lien + */ + public void setAddress(String address) { + this.address = address; + } + + /** + * Renvoie si l'adresse du lien est nulle. + * + * @return vrai si l'adresse est nulle + */ + public boolean isLienNull() { + return address == null; + } +} Property changes on: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/AddressBarItem.java ___________________________________________________________________ Added: svn:keywords + Date Author Revision Rev Id Added: svn:mergeinfo + Deleted: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/Lien.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/Lien.java 2010-02-26 18:01:14 UTC (rev 2892) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/Lien.java 2010-03-02 20:14:34 UTC (rev 2893) @@ -1,92 +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; - -/** - * Classe représentant un item de l'adresse dans la classe Border. - * - * @author kmorin - * @version $Id$ - */ -public class Lien { - - /** - * nom sous lequel apparait le lien dans la barre d'adresse. - */ - private String name; - - /** - * adresse où mène le lien - */ - private String address; - - /** - * Constructeur - * - * @param name nom du lien - * @param address adresse du lien - */ - public Lien(String name, String address) { - this.name = name; - this.address = address; - } - - /** - * Retourn le nom du lien - * - * @return name - */ - public String getName() { - return name; - } - - /** - * Modifie la valeur de name - * - * @param name la nouvelle valeur de name - */ - public void setName(String name) { - this.name = name; - } - - /** - * Retourne l'adresse du lien - * - * @return address - */ - public String getAddress() { - return address; - } - - /** - * Modifie l'adresse du lien - * - * @param address la nouvelle valeur du lien - */ - public void setAddress(String address) { - this.address = address; - } - - /** - * Renvoie si l'adresse du lien est nulle. - * - * @return vrai si l'adresse est nulle - */ - public boolean isLienNull() { - return address == null; - } -} Added: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/mixins/ZoneUpdater.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/mixins/ZoneUpdater.java (rev 0) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/mixins/ZoneUpdater.java 2010-03-02 20:14:34 UTC (rev 2893) @@ -0,0 +1,101 @@ +/** + * *##% + * Wao :: Web Interface + * Copyright (C) 2009 - 2010 Ifremer + * + * 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 Lesser 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/gpl-3.0.html>. + * ##%* + */ +package org.chorem.pollen.ui.mixins; + +import org.apache.commons.lang.ArrayUtils; +import org.apache.tapestry5.BindingConstants; +import org.apache.tapestry5.ClientElement; +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; +import org.apache.tapestry5.annotations.InjectContainer; +import org.apache.tapestry5.annotations.Parameter; +import org.apache.tapestry5.ioc.annotations.Inject; + +/** + * ZoneUpdater.java + * + * From http://tinybits.blogspot.com/2009/05/update-zone-on-any-client-side-event.ht... by ingesol + * + * @author ingesol + * @version $Revision$ + * + * Last update: $Date$ + * by : $Author: fdesbois $ + */ +@IncludeJavaScriptLibrary("context:js/ZoneUpdater.js") +public class ZoneUpdater { + + public static final String PLACEHOLDER = "XXX"; + + @Inject + private ComponentResources resources; + + @Environmental + private RenderSupport renderSupport; + + @Parameter(defaultPrefix = BindingConstants.LITERAL) + private String clientEvent; + + @Parameter(defaultPrefix = BindingConstants.LITERAL, required = true) + private String event; + + @InjectContainer + private ClientElement element; + + @Parameter + private Object[] context; + + @Parameter(defaultPrefix = BindingConstants.LITERAL) + // To enable popups to fire events on this document, enter "document" here. + private String listeningElement; + + @Parameter(defaultPrefix = BindingConstants.LITERAL, required = true) + private String zone; + + protected Link createLink(Object[] context) { + + if (context == null) { + context = new Object[]{PLACEHOLDER}; + } else { + context = ArrayUtils.add(context, PLACEHOLDER); // To be replaced by javascript + } + + return resources.createEventLink(event, context); + + } + + void afterRender() { + String link = createLink(context).toAbsoluteURI(); + String elementId = element.getClientId(); + if (clientEvent == null) { + clientEvent = event; + } + + if (listeningElement == null) { + listeningElement = "$('" + elementId + "')"; + } + renderSupport.addScript("new ZoneUpdater('%s', %s, '%s', '%s', '%s', '%s')", elementId, listeningElement, clientEvent, link, zone, PLACEHOLDER); + + } +} Property changes on: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/mixins/ZoneUpdater.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL" Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/Index.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/Index.java 2010-02-26 18:01:14 UTC (rev 2892) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/Index.java 2010-03-02 20:14:34 UTC (rev 2893) @@ -17,7 +17,7 @@ package org.chorem.pollen.ui.pages; import org.apache.tapestry5.annotations.Property; -import org.chorem.pollen.ui.data.Lien; +import org.chorem.pollen.ui.data.AddressBarItem; /** * Page de départ de l'application. @@ -30,5 +30,5 @@ @SuppressWarnings("unused") @Property - private Lien[] address = new Lien[] { new Lien("Pollen", null) }; + private AddressBarItem[] address = new AddressBarItem[] { new AddressBarItem("Pollen", null) }; } Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin/UsersAdmin.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin/UsersAdmin.java 2010-02-26 18:01:14 UTC (rev 2892) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin/UsersAdmin.java 2010-03-02 20:14:34 UTC (rev 2893) @@ -39,7 +39,7 @@ import org.chorem.pollen.business.services.ServiceUser; import org.chorem.pollen.business.utils.MD5; import org.chorem.pollen.ui.components.FeedBack; -import org.chorem.pollen.ui.data.Lien; +import org.chorem.pollen.ui.data.AddressBarItem; import org.chorem.pollen.ui.utils.PasswordGenerator; /** @@ -83,7 +83,7 @@ */ @SuppressWarnings("unused") @Property - private Lien[] address; + private AddressBarItem[] address; /** * Liste des utilisateurs. @@ -242,7 +242,7 @@ public void setupRender() { accounts = serviceUser.selectUsers(null); - address = new Lien[] { new Lien("Pollen", "Index"), - new Lien(title, null) }; + address = new AddressBarItem[] { new AddressBarItem("Pollen", "Index"), + new AddressBarItem(title, null) }; } } Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/CloseValidation.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/CloseValidation.java 2010-02-26 18:01:14 UTC (rev 2892) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/CloseValidation.java 2010-03-02 20:14:34 UTC (rev 2893) @@ -28,7 +28,7 @@ import org.chorem.pollen.business.dto.PollDTO; import org.chorem.pollen.business.services.ServicePollAccount; import org.chorem.pollen.ui.components.FeedBack; -import org.chorem.pollen.ui.data.Lien; +import org.chorem.pollen.ui.data.AddressBarItem; /** * Classe de la page de confirmation de la cloture d'un sondage. @@ -69,7 +69,7 @@ @SuppressWarnings("unused") @Property - private Lien[] address; + private AddressBarItem[] address; /** Localisation */ @Inject @@ -115,8 +115,8 @@ * Initialisation de l'affichage */ void setupRender() { - address = new Lien[] { new Lien("Pollen", "Index"), - new Lien(title, null) }; + address = new AddressBarItem[] { new AddressBarItem("Pollen", "Index"), + new AddressBarItem(title, null) }; } } Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/ConfirmPoll.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/ConfirmPoll.java 2010-02-26 18:01:14 UTC (rev 2892) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/ConfirmPoll.java 2010-03-02 20:14:34 UTC (rev 2893) @@ -28,7 +28,7 @@ import org.chorem.pollen.business.dto.ChoiceDTO; import org.chorem.pollen.business.dto.PollDTO; import org.chorem.pollen.business.services.ServicePoll; -import org.chorem.pollen.ui.data.Lien; +import org.chorem.pollen.ui.data.AddressBarItem; import org.chorem.pollen.ui.data.PollAction; /** @@ -49,7 +49,7 @@ @SuppressWarnings("unused") @Property - private Lien[] address; + private AddressBarItem[] address; /** Page précédente */ @Persist @@ -152,7 +152,7 @@ * Initialisation de l'affichage */ void setupRender() { - address = new Lien[] { new Lien("Pollen", "Index"), - new Lien(title, null) }; + address = new AddressBarItem[] { new AddressBarItem("Pollen", "Index"), + new AddressBarItem(title, null) }; } } Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/CreationValidation.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/CreationValidation.java 2010-02-26 18:01:14 UTC (rev 2892) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/CreationValidation.java 2010-03-02 20:14:34 UTC (rev 2893) @@ -28,7 +28,7 @@ import org.chorem.pollen.business.dto.PollDTO; import org.chorem.pollen.business.services.ServicePollAccount; import org.chorem.pollen.ui.components.FeedBack; -import org.chorem.pollen.ui.data.Lien; +import org.chorem.pollen.ui.data.AddressBarItem; /** * Classe de la page de confirmation de la création d'un sondage. @@ -69,7 +69,7 @@ @SuppressWarnings("unused") @Property - private Lien[] address; + private AddressBarItem[] address; /** Localisation */ @Inject @@ -115,8 +115,8 @@ * Initialisation de l'affichage */ void setupRender() { - address = new Lien[] { new Lien("Pollen", "Index"), - new Lien(title, null) }; + address = new AddressBarItem[] { new AddressBarItem("Pollen", "Index"), + new AddressBarItem(title, null) }; } } Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/ImageDisplay.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/ImageDisplay.java 2010-02-26 18:01:14 UTC (rev 2892) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/ImageDisplay.java 2010-03-02 20:14:34 UTC (rev 2893) @@ -28,7 +28,7 @@ import org.chorem.pollen.business.dto.ChoiceDTO; import org.chorem.pollen.business.dto.PollDTO; import org.chorem.pollen.ui.components.ImageContextLink; -import org.chorem.pollen.ui.data.Lien; +import org.chorem.pollen.ui.data.AddressBarItem; /** * Classe de la page de visualisation d'une image. @@ -46,7 +46,7 @@ @SuppressWarnings("unused") @Property - private Lien[] address; + private AddressBarItem[] address; @Inject private Messages messages; @@ -117,8 +117,8 @@ * Initialisation de l'affichage */ void setupRender() { - address = new Lien[] { new Lien("Pollen", "Index"), - new Lien(title, null), new Lien(messages.get("title2"), null) }; + address = new AddressBarItem[] { new AddressBarItem("Pollen", "Index"), + new AddressBarItem(title, null), new AddressBarItem(messages.get("title2"), null) }; } } Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/ModificationValidation.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/ModificationValidation.java 2010-02-26 18:01:14 UTC (rev 2892) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/ModificationValidation.java 2010-03-02 20:14:34 UTC (rev 2893) @@ -28,7 +28,7 @@ import org.chorem.pollen.business.dto.PollDTO; import org.chorem.pollen.business.services.ServicePollAccount; import org.chorem.pollen.ui.components.FeedBack; -import org.chorem.pollen.ui.data.Lien; +import org.chorem.pollen.ui.data.AddressBarItem; /** * Classe de la page de confirmation de la modification d'un sondage. @@ -69,7 +69,7 @@ @SuppressWarnings("unused") @Property - private Lien[] address; + private AddressBarItem[] address; /** Localisation */ @Inject @@ -115,8 +115,8 @@ * Initialisation de l'affichage */ void setupRender() { - address = new Lien[] { new Lien("Pollen", "Index"), - new Lien(title, null) }; + address = new AddressBarItem[] { new AddressBarItem("Pollen", "Index"), + new AddressBarItem(title, null) }; } } Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollCreation.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollCreation.java 2010-02-26 18:01:14 UTC (rev 2892) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollCreation.java 2010-03-02 20:14:34 UTC (rev 2893) @@ -67,7 +67,7 @@ import org.chorem.pollen.ui.components.FeedBack; import org.chorem.pollen.ui.components.ImageContextLink; import org.chorem.pollen.ui.data.GenericSelectModel; -import org.chorem.pollen.ui.data.Lien; +import org.chorem.pollen.ui.data.AddressBarItem; import org.chorem.pollen.ui.data.PollHelper; import org.chorem.pollen.ui.data.PollStep; import org.chorem.pollen.ui.data.uio.DateChoiceUIO; @@ -312,7 +312,7 @@ @SuppressWarnings("unused") @Property - private Lien[] address; + private AddressBarItem[] address; @Inject private PropertyAccess _propertyAccess; @@ -1154,8 +1154,8 @@ * Initialisation de l'affichage */ void setupRender() { - address = new Lien[] { new Lien("Pollen", "Index"), - new Lien(title, null) }; + address = new AddressBarItem[] { new AddressBarItem("Pollen", "Index"), + new AddressBarItem(title, null) }; if (!addChoiceSelected && !uploadExceptionCatched && !choicesCreationForm.getHasErrors()) { Added: 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 (rev 0) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollForm.java 2010-03-02 20:14:34 UTC (rev 2893) @@ -0,0 +1,577 @@ + +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.annotations.IncludeStylesheet; +import org.apache.tapestry5.annotations.InjectComponent; +import org.apache.tapestry5.annotations.Persist; +import org.apache.tapestry5.annotations.Property; +import org.apache.tapestry5.annotations.SessionState; +import org.apache.tapestry5.corelib.components.Form; +import org.apache.tapestry5.ioc.Messages; +import org.apache.tapestry5.ioc.annotations.Inject; +import org.chorem.pollen.business.business.PreventRuleManager; +import org.chorem.pollen.business.dto.PollDTO; +import org.chorem.pollen.business.dto.PreventRuleDTO; +import org.chorem.pollen.business.dto.UserDTO; +import org.chorem.pollen.business.services.ServicePoll; +import org.chorem.pollen.common.PollType; +import org.chorem.pollen.common.VoteCountingType; +import org.chorem.pollen.ui.data.AddressBar; +import org.slf4j.Logger; + +/** + * PollForm : Creation and Modification. + * + * For modification, the poll is getting from using pollUID set in url + * (activate/passivate context). + * + * This page is mostly dynamic, so all fields in the form used zoneUpdate mixin + * to refresh the form zone if necessary (for selects or some checkbox options). + * + * This page is composed of three parts : + * <pre> + * - Main informations : title, creator, begin and end dates, types, ... + * - Options : anonymous, addchoice, reminder, notification, ... + * - Choices of the poll (depends on type : DATE, IMAGE, TEXT). + * - Lists/Groups for pollType different from FREE. + * </pre> + * + * Created: 2 mars 2010 + * + * @author fdesbois + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ + */ +@IncludeStylesheet("context:css/poll.css") +public class PollForm { + + @Inject + private Logger log; + + @SessionState + private UserDTO user; + + @Property + private boolean userExists; + + @Inject + private Messages messages; + + @Inject + private ServicePoll servicePoll; + + private String pollUID; + + @Persist + private PollDTO poll; + + void onActivate(String id) { + pollUID = id; + } + + String onPassivate() { + return pollUID; + } + + void setupRender() { + poll = null; + initMainInfos(); + initOptions(); + } + + /** + * Get the main poll used in the form. The existing poll is loaded if + * the pollUID exist. + * + * @return poll existing or a new one + */ + public PollDTO getPoll() { + if (poll == null) { + if (StringUtils.isNotEmpty(pollUID)) { + if (log.isDebugEnabled()) { + log.debug("Get existing poll with pollUID = " + pollUID); + } + poll = servicePoll.findPollByPollId(pollUID); + // TODO : init advancedOptions + } else { + if (log.isDebugEnabled()) { + log.debug("Init new poll"); + } + poll = servicePoll.getNewPoll(); + if (userExists) { + String creatorName = + user.getFirstName() + " " + user.getLastName(); + poll.setCreatorName(creatorName); + poll.setCreatorEmail(user.getEmail()); + poll.setUserId(user.getId()); + } + } + } + return poll; + } + + /** + * Test if the form mode is for creation : new poll. + * + * @return true if it's the create mode, false otherwise + */ + public boolean isCreateMode() { + return StringUtils.isEmpty(getPoll().getId()); + } + + /** + * Page title for border component. + * + * @return the page title depends on create or update mode. + */ + public String getPageTitle() { + String title = ""; + if (isCreateMode()) { + title = messages.get("pageTitle-create"); + } else { + title = messages.format("pageTitle-update", getPoll().getTitle()); + } + return title; + } + + /** + * AddressBar for border component. + * + * @return the address bar. + */ + public AddressBar getAddressBar() { + return new AddressBar().appendCurrent(getPageTitle()); + } + + public void setPollCopyFromPoll(PollDTO poll) { + this.poll = servicePoll.getNewPoll(poll); + } + + public Date getCurrentDate() { + return new Date(); + } + + public DateFormat getDateFormat() { + return new SimpleDateFormat(messages.get("date-pattern")); + } + + /**************************** MAIN INFOS **********************************/ + + @InjectComponent + private Form mainForm; + + private Date beginDateValidation; + + @Persist + @Property + private boolean advancedOptions; + + protected void initMainInfos() { + 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 **/ + @Property + @Persist + private boolean anonymousVoteAllowedDisabled; + + /** Synchronization with continuousResults and publicResults options **/ + @Property + @Persist + private boolean publicResultsDisabled; + + /** ChoiceNb option **/ + @Property + @Persist + private boolean hasChoiceNb; + + /** Notification option **/ + @Property + @Persist + private boolean hasNotification; + + @Persist + private PreventRuleDTO notification; + + /** Reminder option **/ + @Property + @Persist + private boolean hasReminder; + + @Persist + private PreventRuleDTO reminder; + + protected void initOptions() { + anonymousVoteAllowedDisabled = false; + publicResultsDisabled = false; + hasChoiceNb = false; + hasNotification = false; + 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 + */ + public PreventRuleDTO getNotification() { + if (notification == null) { + notification = new PreventRuleDTO("vote", 0, true, + PreventRuleManager.EMAIL_ACTION); + } + return notification; + } + + /** + * Condition to enable or not the notification option. + * + * @return true if the mail is not defined + */ + public boolean isNotificationDisabled() { + // no email defined + 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 + */ + public PreventRuleDTO getReminder() { + if (reminder == null) { + reminder = new PreventRuleDTO("rappel", 0, false, + PreventRuleManager.EMAIL_ACTION); + } + return reminder; + } + + /** + * Condition to enable or not the reminder option. + * + * @return true if the poll has a FREE pollType + */ + public boolean isReminderDisabled() { + // pollType is FREE + 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; +// } +// } +// } + + +} Property changes on: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollForm.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL" Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollModification.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollModification.java 2010-02-26 18:01:14 UTC (rev 2892) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/PollModification.java 2010-03-02 20:14:34 UTC (rev 2893) @@ -54,7 +54,7 @@ import org.chorem.pollen.common.ChoiceType; import org.chorem.pollen.common.PollType; import org.chorem.pollen.ui.components.FeedBack; -import org.chorem.pollen.ui.data.Lien; +import org.chorem.pollen.ui.data.AddressBarItem; import org.chorem.pollen.ui.data.PollAction; import org.chorem.pollen.ui.data.PollStep; @@ -74,7 +74,7 @@ @SuppressWarnings("unused") @Property - private Lien[] address; + private AddressBarItem[] address; /** Paramètres de la page */ private String param; @@ -635,8 +635,8 @@ * Initialisation de l'affichage */ void setupRender() { - address = new Lien[] { new Lien("Pollen", "Index"), - new Lien(title, null) }; + address = new AddressBarItem[] { new AddressBarItem("Pollen", "Index"), + new AddressBarItem(title, null) }; dateFormat = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, currentLocale); Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/Results.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/Results.java 2010-02-26 18:01:14 UTC (rev 2892) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/Results.java 2010-03-02 20:14:34 UTC (rev 2893) @@ -54,7 +54,7 @@ import org.chorem.pollen.ui.components.Chart; import org.chorem.pollen.ui.components.FeedBack; import org.chorem.pollen.ui.components.ImageContextLink; -import org.chorem.pollen.ui.data.Lien; +import org.chorem.pollen.ui.data.AddressBarItem; import org.chorem.pollen.votecounting.business.NumberMethod; import org.chorem.pollen.votecounting.dto.VoteCountingResultDTO; import org.slf4j.Logger; @@ -74,7 +74,7 @@ @SuppressWarnings("unused") @Property - private Lien[] address; + private AddressBarItem[] address; /** Paramètres de la page */ private String param; @@ -512,8 +512,8 @@ * Initialisation de l'affichage */ void setupRender() { - address = new Lien[] { new Lien("Pollen", "Index"), - new Lien(title, null) }; + address = new AddressBarItem[] { new AddressBarItem("Pollen", "Index"), + new AddressBarItem(title, null) }; dateFormat = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, currentLocale); Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java 2010-02-26 18:01:14 UTC (rev 2892) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java 2010-03-02 20:14:34 UTC (rev 2893) @@ -73,7 +73,7 @@ import org.chorem.pollen.ui.components.FeedBack; import org.chorem.pollen.ui.components.ImageContextLink; import org.chorem.pollen.ui.data.EvenOdd; -import org.chorem.pollen.ui.data.Lien; +import org.chorem.pollen.ui.data.AddressBarItem; import org.chorem.pollen.ui.data.PollAction; import org.chorem.pollen.ui.data.uio.DateChoiceUIO; import org.chorem.pollen.ui.data.uio.ImageChoiceUIO; @@ -102,7 +102,7 @@ @SuppressWarnings("unused") @Property - private Lien[] address; + private AddressBarItem[] address; /** Paramètres de la page */ private String param; @@ -1139,8 +1139,8 @@ * Initialisation de l'affichage */ void setupRender() { - address = new Lien[] { new Lien("Pollen", "Index"), - new Lien(title, null) }; + address = new AddressBarItem[] { new AddressBarItem("Pollen", "Index"), + new AddressBarItem(title, null) }; dateFormat = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, currentLocale); Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/Account.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/Account.java 2010-02-26 18:01:14 UTC (rev 2892) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/Account.java 2010-03-02 20:14:34 UTC (rev 2893) @@ -33,7 +33,7 @@ import org.chorem.pollen.business.services.ServiceAuth; import org.chorem.pollen.business.services.ServiceUser; import org.chorem.pollen.business.utils.MD5; -import org.chorem.pollen.ui.data.Lien; +import org.chorem.pollen.ui.data.AddressBarItem; /** * Classe de la page d'un utilisateur. @@ -107,7 +107,7 @@ @SuppressWarnings("unused") @Property - private Lien[] address; + private AddressBarItem[] address; /** * Vrai lorsque l'utilisateur modifie son compte. @@ -180,8 +180,8 @@ * Initialisation de l'affichage */ void setupRender() { - address = new Lien[] { new Lien("Pollen", "Index"), - new Lien(title, null) }; + address = new AddressBarItem[] { new AddressBarItem("Pollen", "Index"), + new AddressBarItem(title, null) }; if (userExists) { newUser = user; oldEmail = user.getEmail(); Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/Register.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/Register.java 2010-02-26 18:01:14 UTC (rev 2892) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/Register.java 2010-03-02 20:14:34 UTC (rev 2893) @@ -37,7 +37,7 @@ import org.chorem.pollen.business.services.ServiceAuth; import org.chorem.pollen.business.services.ServiceUser; import org.chorem.pollen.business.utils.MD5; -import org.chorem.pollen.ui.data.Lien; +import org.chorem.pollen.ui.data.AddressBarItem; /** * Classe de la page d'enregistrement d'un utilisateur. @@ -103,7 +103,7 @@ @SuppressWarnings("unused") @Property - private Lien[] address; + private AddressBarItem[] address; /** Injection des services */ @Inject @@ -170,7 +170,7 @@ * Initialisation de l'affichage */ void setupRender() { - address = new Lien[] { new Lien("Pollen", "Index"), - new Lien(title, null) }; + address = new AddressBarItem[] { new AddressBarItem("Pollen", "Index"), + new AddressBarItem(title, null) }; } } Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserLists.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserLists.java 2010-02-26 18:01:14 UTC (rev 2892) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserLists.java 2010-03-02 20:14:34 UTC (rev 2893) @@ -44,7 +44,7 @@ import org.chorem.pollen.business.services.ServicePollAccount; import org.chorem.pollen.ui.components.FeedBack; import org.chorem.pollen.ui.data.EvenOdd; -import org.chorem.pollen.ui.data.Lien; +import org.chorem.pollen.ui.data.AddressBarItem; import org.chorem.pollen.ui.utils.CSVAccountUtil; import org.chorem.pollen.ui.utils.LDAPAccountUtil; @@ -152,7 +152,7 @@ @SuppressWarnings("unused") @Property - private Lien[] address; + private AddressBarItem[] address; /** * Sert à créer listModel. @@ -333,8 +333,8 @@ * Initialisation de l'affichage */ void setupRender() { - address = new Lien[] { new Lien("Pollen", "Index"), - new Lien(title, null) }; + address = new AddressBarItem[] { new AddressBarItem("Pollen", "Index"), + new AddressBarItem(title, null) }; listModel = beanModelSource.createDisplayModel(PollAccountDTO.class, componentResources.getMessages()); Modified: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/Border.tml =================================================================== --- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/Border.tml 2010-02-26 18:01:14 UTC (rev 2892) +++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/Border.tml 2010-03-02 20:14:34 UTC (rev 2893) @@ -2,7 +2,7 @@ <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter"> <head> - <title>Pollen</title> + <title>Pollen<t:if t:test="pageTitle"> :: ${pageTitle}</t:if></title> <link rel="icon" type="image/png" href="${asset:context:favicon.png}" /> <t:FeedContextLink t:id="feedContext" /> <t:if test="${feedFileExisting}"> Added: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollForm.properties =================================================================== --- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollForm.properties (rev 0) +++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollForm.properties 2010-03-02 20:14:34 UTC (rev 2893) @@ -0,0 +1 @@ + Added: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollForm_en.properties =================================================================== --- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollForm_en.properties (rev 0) +++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollForm_en.properties 2010-03-02 20:14:34 UTC (rev 2893) @@ -0,0 +1 @@ + Added: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollForm_fr.properties =================================================================== --- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollForm_fr.properties (rev 0) +++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/poll/PollForm_fr.properties 2010-03-02 20:14:34 UTC (rev 2893) @@ -0,0 +1,76 @@ +pageTitle-create=Cr\u00E9ation d'un nouveau sondage +mainTitle-create=Nouveau sondage + +pageTitle-update=Modification du sondage %s + +date-pattern=dd/MM/yyyy HH:mm + +# Main Infos +legend-mainInfos=Informations du sondage +creatorName-label=Votre nom * +creatorName-required-message=Vous devez fournir un nom. +email-label=Votre em@il +email-regexp=^([a-zA-Z0-9_.+-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$ +email-regexp-message=Email invalide. +title-label=Titre * +title-required-message=Vous devez fournir un titre pour le sondage. +description-label=Description +beginDate-label=Date de d\u00E9but +beginDate-regexp=\\d{2}\/\\d{2}\/\\d{4}( \\d{2}\\:\\d{2})? +beginDate-regexp-message=La date de d\u00E9but doit-\u00EAtre au format 31/12/2000 23:59. +beginDate-validate=La date de d\u00E9but doit-\u00EAtre post\u00E9rieure \u00E0 la date actuelle. +endDate-label=Date de fin +endDate-regexp=\\d{2}\/\\d{2}\/\\d{4}( \\d{2}\\:\\d{2})? +endDate-regexp-message=La date de fin doit-\u00EAtre au format 31/12/2000 23:59. +endDate-validate=La date de fin doit-\u00EAtre post\u00E9rieure \u00E0 la date de d\u00E9but. +pollType-label=Type de sondage +pollType-help=Libre : accessible \u00E0 tout le monde<br/>Liste restreinte : accessible uniquement \u00E0 une liste de votants<br/>Par groupes : accessible \u00E0 plusieurs listes de votants +voteCounting-label=Type de d\u00E9pouillement +voteCounting-help=Simple : s\u00E9lection de 1 ou n choix parmis les choix possibles<br/>Pourcentage : attribution d\'un pourcentage \u00E0 chaque choix<br/>Condorcet : classement des choix par ordre de pr\u00E9f\u00E9rence<br/>Nombre : R\u00E9ponse libre. Fait la somme et la moyenne des nombres. +advancedOptions-label=Options avanc\u00E9es ? + +# Labels for enums +PollType.FREE=Libre +PollType.RESTRICTED=Liste restreinte +PollType.GROUP=Par groupes +VoteCountingType.NORMAL=Simple +VoteCountingType.PERCENTAGE=Pourcentage +VoteCountingType.CONDORCET=Condorcet +VoteCountingType.NUMBER=Nombre +ChoiceType.TEXT=Texte +ChoiceType.DATE=Date +ChoiceType.IMAGE=Image + +# Options +legend-options=Options avanc\u00E9es +anonymous-label=Sondage anonyme +anonymous-help=Les votants ainsi que leurs votes sont anonymes +anonymousVoteAllowed-label=Autoriser le vote anonyme +anonymousVoteAllowed-help=Les votants peuvent \u00EAtre anonymes +continuousResults-label=R\u00E9sultats continus +continuousResults-help=Les r\u00E9sultats du sondage sont affich\u00E9s en continu au moment du vote +publicResults-label=R\u00E9sultats publics +publicResults-help=Les r\u00E9sultats du sondage sont consultables par tout le monde +choiceAddAllowed-label=Autoriser l'ajout de choix +choiceAddAllowed-help=Il est possible d\'ajouter des choix au sondage. +beginChoiceDate-label=Date de d\u00E9but +beginChoiceDate-regexp=\\d{2}\/\\d{2}\/\\d{4}( \\d{2}\\:\\d{2})? +beginChoiceDate-regexp-message=La date de d\u00E9but doit-\u00EAtre au format 31/12/2000 23:59. +beginChoiceDate-validate=La date d'ajout de choix doit-\u00EAtre ant\u00E9rieure \u00E0 la date de d\u00E9but du sondage. +endChoiceDate-label=Date de fin +endChoiceDate-regexp=\\d{2}\/\\d{2}\/\\d{4}( \\d{2}\\:\\d{2})? +endChoiceDate-regexp-message=La date de fin doit-\u00EAtre au format 31/12/2000 23:59. +endChoiceDate-validate=La date de fin d'ajout de choix doit-\u00EAtre post\u00E9rieure \u00E0 la date de d\u00E9but. +choiceNb-label=Limiter le nombre de choix par vote +choiceNb-help=Le nombre de choix que l\'utilisateur peut s\u00E9lectionner est limit\u00E9. Option disponible uniquement pour un d\u00E9pouillement simple. +maxChoiceNb-label=Limite +maxChoiceNb-min-message=La valeur doit-\u00EAtre sup\u00E9rieure \u00E0 0. +sendNotification-label=Recevoir des emails de notification +sendNotification-help=Un email vous est envoy\u00E9 tous les N votes pour vous permettre de suivre l'avanc\u00E9e du sondage. Vous devez pr\u00E9ciser votre email pour acc\u00E9der \u00E0 cette option. +notification-label=Tous les +notification-label2=votes +notification-min-message=La valeur doit-\u00EAtre sup\u00E9rieure \u00E0 0. +sendReminder-label=Envoyer des emails de rappel +sendReminder-help=Un email de rappel est envoy\u00E9 aux votants qui n\'ont pas encore vot\u00E9 N heures avant la fin du sondage. Option disponible uniquement pour un sondage restreint ou par groupes. +reminder-label=heures avant la fin +reminder-min-message=La valeur doit-\u00EAtre sup\u00E9rieure \u00E0 0. \ No newline at end of file Modified: trunk/pollen-ui/src/main/webapp/css/main.css =================================================================== --- trunk/pollen-ui/src/main/webapp/css/main.css 2010-02-26 18:01:14 UTC (rev 2892) +++ trunk/pollen-ui/src/main/webapp/css/main.css 2010-03-02 20:14:34 UTC (rev 2893) @@ -18,10 +18,30 @@ float: right; } +.clearfix { + display:block; +} + +.clearfix:after { + content:"."; + display:block; + height:0; + clear:both; + visibility:hidden; +} + .clr { clear: both; } +.hidden { + display: none; +} + +.display { + display: block; +} + #CreationBody { background-image: url("../img/bigCreation.png"); } @@ -344,6 +364,8 @@ font-weight: bold; } +/* TODO : refactor titleCreation usage by titlePoll */ +#corps .titlePoll, #corps .titleCreation { color: #32b5c9; font-weight: bold; Added: trunk/pollen-ui/src/main/webapp/css/poll.css =================================================================== --- trunk/pollen-ui/src/main/webapp/css/poll.css (rev 0) +++ trunk/pollen-ui/src/main/webapp/css/poll.css 2010-03-02 20:14:34 UTC (rev 2893) @@ -0,0 +1,54 @@ +/* + Document : poll + Created on : 2 mars 2010, 14:10:25 + Author : fdesbois + Description: + Stylesheet for poll pages. +*/ + +legend { + color: #727a7e; + font-weight: bold; +} + +.disabled { + color: #555; +} + +#pollForm-mainInfos fieldset { + border: 1px solid #aab; + padding: 15px; + width: 410px; + margin-left: 30px; + vertical-align: top; + text-align: left; +} + +#pollForm-mainInfos label { + display: block; + width: 150px; + float: left; +} + +#pollForm-mainInfos div, +#pollForm-options div, +#listsCreationFormDiv div { + margin-bottom: 10px; +} + +#pollForm-options fieldset { + border: 1px solid #aab; + padding: 15px; + width: 410px; + margin-left: 20px; + vertical-align: top; + text-align: left; +} + +/*#choiceDateDiv, +#choiceNbDiv, +#notificationDiv, +#reminderDiv { + color: #555; +}*/ + Added: trunk/pollen-ui/src/main/webapp/js/ZoneUpdater.js =================================================================== --- trunk/pollen-ui/src/main/webapp/js/ZoneUpdater.js (rev 0) +++ trunk/pollen-ui/src/main/webapp/js/ZoneUpdater.js 2010-03-02 20:14:34 UTC (rev 2893) @@ -0,0 +1,103 @@ +var ZoneUpdater = Class.create(); + +ZoneUpdater.prototype = { + + initialize: function(zoneElementId, listeningElement, event, link, zone, placeholder) { + + this.zoneElement = $(zoneElementId); + + this.event = event; + + this.link = link; + + this.placeholder = placeholder; + + $T(this.zoneElement).zoneId = zone; + + listeningElement.observe(this.event, this.updateZone.bindAsEventListener(this)); + + }, + + updateZone: function(event) { + + var zoneObject = Tapestry.findZoneManager(this.zoneElement); + + if ( !zoneObject ) return; + + var param; + + if (this.zoneElement.value) { + + param = this.zoneElement.value; + + } + + if (!param) param = ' '; + + param = this.encodeForUrl(param); + + var updatedLink = this.link.gsub(this.placeholder, param); + + zoneObject.updateFromURL(updatedLink); + + }, + + encodeForUrl: function(string) { + + /** + + * See equanda.js for updated version of this + + */ + + string = string.replace(/\r\n/g,"\n"); + + var res = ""; + + for (var n = 0; n < string.length; n++) + + { + + var c = string.charCodeAt( n ); + + if ( '$' == string.charAt( n ) ) + + { + + res += '$$'; + + } + + else if ( this.inRange( c, "AZ" ) || this.inRange( c, "az" ) || this.inRange( c, "09" ) || this.inRange( c, ".." ) ) + + { + + res += string.charAt( n ) + + } + + else + + { + + var tmp = c.toString(16); + + while ( tmp.length < 4 ) tmp = "0" + tmp; + + res += '$' + tmp; + + } + + } + + return res; + + }, + + inRange: function(code, range) { + + return code >= range.charCodeAt( 0 ) && code <= range.charCodeAt( 1 ); + + } + +} \ No newline at end of file Modified: trunk/pollen-ui/src/main/webapp/poll/PollCreation.tml =================================================================== --- trunk/pollen-ui/src/main/webapp/poll/PollCreation.tml 2010-02-26 18:01:14 UTC (rev 2892) +++ trunk/pollen-ui/src/main/webapp/poll/PollCreation.tml 2010-03-02 20:14:34 UTC (rev 2893) @@ -1,12 +1,12 @@ <t:border t:address="address" t:pageLogo="literal:Creation" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter"> - + <t:feedback t:id="feedback"/> <h1 class="titleCreation">${message:title-new}</h1> <t:zone t:id="pollCreationZone" show="show" update="show"> <t:form t:id="pollCreationForm" t:zone="pollCreationZone"> - + <!-- Étape POLL --> <t:formfragment visible="inPoll"> <div id="pollCreationFormDiv"> @@ -60,7 +60,7 @@ </div> </div> </t:formfragment> - + <!-- Étape OPTIONS --> <t:formfragment visible="inOptions"> <div id="optionsCreationFormDiv"> @@ -164,7 +164,7 @@ </div> </div> </t:formfragment> - + <!-- Étape LISTS --> <t:formfragment visible="inLists"> <div id="listsCreationFormDiv"> @@ -222,8 +222,8 @@ </t:formfragment> </t:form> - + <!-- Étape CHOICES - Formulaire différent car t:upload ne fonctionne pas en ajax --> <t:if test="inChoices"> <t:FeedContextLink t:id="feedContext" /> @@ -232,7 +232,7 @@ <t:if test="!isNumberVoteCounting()"> <div> <t:label for="choiceType" />: - <t:select t:id="choiceType" t:value="poll.choiceType" t:validate="required" + <t:select t:id="choiceType" t:value="poll.choiceType" t:validate="required" t:mixins="ck/OnEvent" event="change" onCompleteCallback="onCompleteZoneUpdate"> </t:select> </div> @@ -295,7 +295,7 @@ </div> </t:form> </t:if> - - + + </t:zone> </t:border> \ No newline at end of file Added: trunk/pollen-ui/src/main/webapp/poll/PollForm.tml =================================================================== --- trunk/pollen-ui/src/main/webapp/poll/PollForm.tml (rev 0) +++ trunk/pollen-ui/src/main/webapp/poll/PollForm.tml 2010-03-02 20:14:34 UTC (rev 2893) @@ -0,0 +1,205 @@ +<!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> + <!-- <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> + + </div> + </form> + </t:zone> +</t:border>