branch develop updated (babafe3 -> 5eb5084)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository scmwebeditor. See http://git.nuiton.org/scmwebeditor.git from babafe3 Make the SvnConnection's code shorter and easier to understand new 5eb5084 Add a confirmation message when closing the editor tab or window The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 5eb50843bc3aea92c2ee7857d89f673ba86ae122 Author: Hugo PIGEON <hpigeon@codelutin.com> Date: Tue May 26 10:01:34 2015 +0200 Add a confirmation message when closing the editor tab or window Summary of changes: .../i18n/scmwebeditor-ui-web_en_GB.properties | 3 ++- .../i18n/scmwebeditor-ui-web_fr_FR.properties | 3 ++- .../webapp/WEB-INF/content/modificationViewer.jsp | 22 ++++++++++++++++++++-- swe-ui-web/src/main/webapp/js/cancelRedirect.js | 17 +++++++---------- 4 files changed, 31 insertions(+), 14 deletions(-) -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository scmwebeditor. See http://git.nuiton.org/scmwebeditor.git commit 5eb50843bc3aea92c2ee7857d89f673ba86ae122 Author: Hugo PIGEON <hpigeon@codelutin.com> Date: Tue May 26 10:01:34 2015 +0200 Add a confirmation message when closing the editor tab or window --- .../i18n/scmwebeditor-ui-web_en_GB.properties | 3 ++- .../i18n/scmwebeditor-ui-web_fr_FR.properties | 3 ++- .../webapp/WEB-INF/content/modificationViewer.jsp | 22 ++++++++++++++++++++-- swe-ui-web/src/main/webapp/js/cancelRedirect.js | 17 +++++++---------- 4 files changed, 31 insertions(+), 14 deletions(-) diff --git a/swe-ui-web/src/main/resources/i18n/scmwebeditor-ui-web_en_GB.properties b/swe-ui-web/src/main/resources/i18n/scmwebeditor-ui-web_en_GB.properties index bd2d338..9b54b17 100644 --- a/swe-ui-web/src/main/resources/i18n/scmwebeditor-ui-web_en_GB.properties +++ b/swe-ui-web/src/main/resources/i18n/scmwebeditor-ui-web_en_GB.properties @@ -16,7 +16,8 @@ scm.createBranch.branchName=Name of the new branch\: scm.createBranch.originBranch=Original branch for the new branch\: scm.createBranchSuccess=Branch successfully created scm.exit=Exit -scm.exitJavascript=Exit ScmWebEditor without saving ? All modification will be lost. +scm.exitJavascript=Exit ScmWebEditor? +scm.exitJavascriptChanges=Exit ScmWebEditor without saving? All modification will be lost. scm.exitTitle=Exit ScmWebEditor without saving. scm.fileModify=File modify while editing. scm.forceSave=Force save diff --git a/swe-ui-web/src/main/resources/i18n/scmwebeditor-ui-web_fr_FR.properties b/swe-ui-web/src/main/resources/i18n/scmwebeditor-ui-web_fr_FR.properties index f54a5aa..65878bb 100644 --- a/swe-ui-web/src/main/resources/i18n/scmwebeditor-ui-web_fr_FR.properties +++ b/swe-ui-web/src/main/resources/i18n/scmwebeditor-ui-web_fr_FR.properties @@ -16,7 +16,8 @@ scm.createBranch.branchName=Nom de la nouvelle branche \: scm.createBranch.originBranch=Branche d'origine pour la nouvelle branche \: scm.createBranchSuccess=Branche créée avec succès scm.exit=Quitter -scm.exitJavascript=Quitter ScmWebEditor sans sauvegarder ? Toutes les modifications seront perdues. +scm.exitJavascript=Quitter ScmWebEditor ? +scm.exitJavascriptChanges=Quitter ScmWebEditor sans sauvegarder ? Toutes les modifications seront perdues. scm.exitTitle=Quitter ScmWebEditor sans sauvegarder. scm.fileModify=Fichier modifié pendant l'édition. scm.forceSave=Forcer la sauvegarde diff --git a/swe-ui-web/src/main/webapp/WEB-INF/content/modificationViewer.jsp b/swe-ui-web/src/main/webapp/WEB-INF/content/modificationViewer.jsp index b353946..5bc5708 100644 --- a/swe-ui-web/src/main/webapp/WEB-INF/content/modificationViewer.jsp +++ b/swe-ui-web/src/main/webapp/WEB-INF/content/modificationViewer.jsp @@ -63,6 +63,24 @@ function loadChange() { document.getElementById('newTextId').value = editor.getValue(); } + + function confirmExit() { + var text = '<s:text name="scm.exitJavascript"/>'; + + if (document.getElementById('newTextId').value != editor.getValue()) { + text = '<s:text name="scm.exitJavascriptChanges"/>'; + } + + return cancelRedirect(text, document.getElementById('projectUrl')); + } + + function confirmExitUnload() { + if (document.getElementById('newTextId').value != editor.getValue()) { + return '<s:text name="scm.exitJavascript"/>'; + } + } + + window.onbeforeunload = confirmExitUnload; </script> <s:if test="format == 'rst'"> @@ -125,7 +143,7 @@ <h1 id="editorTitle">SCMWebEditor</h1> -<!-- authentification --> +<!-- authentication --> <div id="headLogin"> <div id="authDiv"> @@ -295,7 +313,7 @@ title="%{scm.exitTitle}" value="%{scm.exit}" name="Cancel" - onclick="return cancelRedirect('%{scm.exitJavascript}',document.getElementById('projectUrl'));"> + onclick="confirmExit();"> <div id="exitButton"></div> </s:a> diff --git a/swe-ui-web/src/main/webapp/js/cancelRedirect.js b/swe-ui-web/src/main/webapp/js/cancelRedirect.js index c3e9c49..5465ea6 100644 --- a/swe-ui-web/src/main/webapp/js/cancelRedirect.js +++ b/swe-ui-web/src/main/webapp/js/cancelRedirect.js @@ -2,7 +2,7 @@ * #%L * ScmWebEditor * %% - * Copyright (C) 2009 - 2011 CodeLutin + * Copyright (C) 2009 - 2015 CodeLutin * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -19,16 +19,13 @@ * <http://www.gnu.org/licenses/lgpl-3.0.html>. * #L% */ -/** - * @author geoffroy lorieux - */ function cancelRedirect(text, url) - { - if (confirm(text)){ - document.location.href=url.value; - return false; - } - else {return false}; +{ + if (confirm(text)){ + document.location.href=url.value; } + + return false; +} -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
participants (1)
-
nuiton.org scm