[Suiviobsmer-commits] r510 - in trunk/wao-ui/src/main: java/fr/ifremer/wao/ui/mixins resources/fr/ifremer/wao/ui/pages webapp webapp/js
Author: fdesbois Date: 2010-06-12 14:43:58 +0000 (Sat, 12 Jun 2010) New Revision: 510 Log: Use confirm mixin from nuiton-web Removed: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/mixins/Confirm.java trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/mixins/PopupPageLink.java trunk/wao-ui/src/main/webapp/js/dialog.js Modified: trunk/wao-ui/src/main/resources/fr/ifremer/wao/ui/pages/SamplingPlan.properties trunk/wao-ui/src/main/webapp/Administration.tml trunk/wao-ui/src/main/webapp/Contacts.tml trunk/wao-ui/src/main/webapp/Index.tml trunk/wao-ui/src/main/webapp/SamplingPlan.tml Deleted: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/mixins/Confirm.java =================================================================== --- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/mixins/Confirm.java 2010-06-11 16:20:21 UTC (rev 509) +++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/mixins/Confirm.java 2010-06-12 14:43:58 UTC (rev 510) @@ -1,67 +0,0 @@ -/* - * #%L - * Wao :: Web Interface - * - * $Id$ - * $HeadURL$ - * %% - * 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 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>. - * #L% - */ - -package fr.ifremer.wao.ui.mixins; - -import org.apache.tapestry5.BindingConstants; -import org.apache.tapestry5.ClientElement; -import org.apache.tapestry5.RenderSupport; -import org.apache.tapestry5.annotations.AfterRender; -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; - -/** - * Confirm.java - * - * A simple mixin for attaching a javascript confirmation box to the onclick - * event of any component that implements ClientElement. - * - * @author fdesbois <fdesbois at codelutin.com> - */ - at IncludeJavaScriptLibrary("context:js/dialog.js") -public class Confirm { - - @Parameter(value = "Are you sure?", defaultPrefix = BindingConstants.LITERAL) - private String message; - - @Inject - private RenderSupport renderSupport; - - @InjectContainer - private ClientElement element; - - @Parameter - private boolean wDisabled; - - @AfterRender - public void afterRender() { - if (!wDisabled) { - renderSupport.addScript(String.format("new Confirm('%s', '%s');",element.getClientId(), message)); - } - } - -} Deleted: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/mixins/PopupPageLink.java =================================================================== --- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/mixins/PopupPageLink.java 2010-06-11 16:20:21 UTC (rev 509) +++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/mixins/PopupPageLink.java 2010-06-12 14:43:58 UTC (rev 510) @@ -1,88 +0,0 @@ -/* - * #%L - * Wao :: Web Interface - * - * $Id$ - * $HeadURL$ - * %% - * 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 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>. - * #L% - */ - -package fr.ifremer.wao.ui.mixins; - -/** - * PopupPageLink - * - * Created: 17 janv. 2010 - * - * @author fdesbois <fdesbois at codelutin.com> - */ -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; -import org.apache.tapestry5.services.PageRenderLinkSource; - - at IncludeJavaScriptLibrary("context:js/dialog.js") -public class PopupPageLink { - - @Inject - private ComponentResources resources; - - @Environmental - private RenderSupport renderSupport; - - @InjectContainer - private ClientElement container; - - @Parameter(required = true, defaultPrefix = BindingConstants.LITERAL) - private String page; - - @Parameter(defaultPrefix = BindingConstants.LITERAL, value="800") - private String width; - - @Parameter(defaultPrefix = BindingConstants.LITERAL, value="600") - private String height; - - @Parameter - private Object[] context; - - @Inject - private PageRenderLinkSource pageRender; - - void afterRender() { - Link link = null; - if (context != null) { - link = pageRender.createPageRenderLinkWithContext(page, context); - } else { - link = pageRender.createPageRenderLink(page); - } -// Link link = null; -// pageRender.createPageLink(page, true, context); - - renderSupport.addScript("new PopupPageLink('%s', '%s', %s, %s);", container.getClientId(), link, width, height); - - } - -} Modified: trunk/wao-ui/src/main/resources/fr/ifremer/wao/ui/pages/SamplingPlan.properties =================================================================== --- trunk/wao-ui/src/main/resources/fr/ifremer/wao/ui/pages/SamplingPlan.properties 2010-06-11 16:20:21 UTC (rev 509) +++ trunk/wao-ui/src/main/resources/fr/ifremer/wao/ui/pages/SamplingPlan.properties 2010-06-12 14:43:58 UTC (rev 510) @@ -32,3 +32,5 @@ facadeName-label: Fa\u00e7ade sectorName-label: Zone sampleRow-label: Code ligne + +sampleRow-delete-confirmMessage: Etes-vous s\u00fbr de vouloir supprimer d\u00e9finitivement la ligne %1$s du plan d\'\u00e9chantillonnage ? Modified: trunk/wao-ui/src/main/webapp/Administration.tml =================================================================== --- trunk/wao-ui/src/main/webapp/Administration.tml 2010-06-11 16:20:21 UTC (rev 509) +++ trunk/wao-ui/src/main/webapp/Administration.tml 2010-06-12 14:43:58 UTC (rev 510) @@ -81,7 +81,7 @@ <!--</a>--> <input t:type="submit" t:id="showUser" class="ico search" value="Show Details" t:title="Afficher détails" /> <input t:type="submit" t:id="deleteUser" class="ico22px delete" value="Delete user" t:title="Supprimer cet utilisateur" - t:mixins="Confirm" t:message="Etes-vous sûr de vouloir supprimer définitivement cet utilisateur ?" /> + t:mixins="nuiton/confirm" t:message="literal:Etes-vous sûr de vouloir supprimer définitivement cet utilisateur ?" /> <input t:type="submit" t:id="addNewUser" class="ico add" value="Add new company" t:title="Ajouter un nouvel utilisateur" /> </div> </form> Modified: trunk/wao-ui/src/main/webapp/Contacts.tml =================================================================== --- trunk/wao-ui/src/main/webapp/Contacts.tml 2010-06-11 16:20:21 UTC (rev 509) +++ trunk/wao-ui/src/main/webapp/Contacts.tml 2010-06-12 14:43:58 UTC (rev 510) @@ -303,7 +303,7 @@ t:context="contact.topiaId" title="Modifier le contact" /> <input t:type="submitContext" t:id="deleteContact" class="ico22px delete" value="Delete" t:context="contact.topiaId" title="Supprimer le contact" - t:mixins="confirm" t:message="Etes-vous sûr de vouloir supprimer définitivement ce contact ?" /> + t:mixins="nuiton/confirm" t:message="literal:Etes-vous sûr de vouloir supprimer définitivement ce contact ?" /> </p:else> </t:if> <p:else> Modified: trunk/wao-ui/src/main/webapp/Index.tml =================================================================== --- trunk/wao-ui/src/main/webapp/Index.tml 2010-06-11 16:20:21 UTC (rev 509) +++ trunk/wao-ui/src/main/webapp/Index.tml 2010-06-12 14:43:58 UTC (rev 510) @@ -69,7 +69,7 @@ <img src="${asset:context:img/edit.png}" alt="Edit" /> </a> <a t:type="actionlink" t:id="deleteNews" t:context="rowIndex" title="Supprimer l'article" - t:mixins="confirm" t:message="Etes-vous sûr de vouloir supprimer définitivement cet article ?"> + t:mixins="nuiton/confirm" t:message="literal:Etes-vous sûr de vouloir supprimer définitivement cet article ?"> <img src="${asset:context:img/delete2.png}" alt="Delete" /> </a> </p:else> Modified: trunk/wao-ui/src/main/webapp/SamplingPlan.tml =================================================================== --- trunk/wao-ui/src/main/webapp/SamplingPlan.tml 2010-06-11 16:20:21 UTC (rev 509) +++ trunk/wao-ui/src/main/webapp/SamplingPlan.tml 2010-06-12 14:43:58 UTC (rev 510) @@ -286,7 +286,7 @@ </a> <t:unless t:test="row.hasSampleMonthRealTideTime()"> <a t:type="actionlink" t:id="deleteSampleRow" t:context="rowIndex" title="Supprimer la ligne d'échantillon" - t:mixins="confirm" t:message="Etes-vous sûr de vouloir supprimer définitivement la ligne ${row.code} du plan d\'échantillonnage ?"> + t:mixins="nuiton/confirm" t:message="format:sampleRow-delete-confirmMessage=row.code"> <img src="${asset:context:}/img/delete2.png" alt="Supprimer" title="Supprimer la ligne"/> </a> <p:else> Deleted: trunk/wao-ui/src/main/webapp/js/dialog.js =================================================================== --- trunk/wao-ui/src/main/webapp/js/dialog.js 2010-06-11 16:20:21 UTC (rev 509) +++ trunk/wao-ui/src/main/webapp/js/dialog.js 2010-06-12 14:43:58 UTC (rev 510) @@ -1,92 +0,0 @@ -/* - * #%L - * Wao :: Web Interface - * - * $Id$ - * $HeadURL$ - * %% - * 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 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>. - * #L% - */ -/** - * Dialogue de confirmation - */ -var Confirm = Class.create({ - /** - * element : Element DOM depuis lequel le dialogue de confirmation va s'ouvrir - * message : Message à afficher dans la boîte de dialogue - */ - initialize: function(element, message) { - this.message = message; - Event.observe($(element), 'click', this.doConfirm.bindAsEventListener(this)); - }, - doConfirm: function(e) { - //Tapestry.debug('click ' + element); - if(! confirm(this.message)) { - //Tapestry.debug('STOP ' + e); - Event.stop(e); - } - } -}); - -//var BlockPopup = Class.create({ -// initialize: function(linkElement, title, width, height, blockElement) { -// this.window = new Window({ -// className: 'alphacube', -// title: title, -// hideEffect:Element.hide, -// showEffect:Element.show, -// width: width, -// height: height -// }); -// -// this.block = $(blockElement).innerHTML; -// $(linkElement).observe('click',this.openWindow.bindAsEventListener(this)); -// }, -// openWindow: function(e) { -// this.window.getContent().update(this.block); -// this.window.showCenter(true); -// } -//}); -// -//var PopupPageLink = Class.create({ -// -// initialize: function(id, link, width, height) { -// -// this.element = $(id); -// -// this.link = link; -// -// this.width = width; -// -// this.height = height; -// -// Event.observe(this.element, 'click', this.onclick.bindAsEventListener(this)); -// -// }, -// -// onclick: function() { -// -// var name = 'dialogWindow'; -// -// var win = window.open(this.link,name,'width=' + this.width + ',height=' + this.height + ',resizable=yes,scrollbars=yes,menubar=no,screenX=0,screenY=0,left=0,top=0' ); -// -// win.focus(); -// -// } -// -//});
participants (1)
-
fdesbois@users.labs.libre-entreprise.org