branch develop updated (ed7aad7 -> 570490d)
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 ed7aad7 Fix the "reset" feature new 570490d Make the autosave use the client's local storage instead of saving the file on the repository 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 570490d886eef0ee396cdb8f64d9aa8ffd30f280 Author: Hugo PIGEON <hpigeon@codelutin.com> Date: Wed Jun 3 14:40:25 2015 +0200 Make the autosave use the client's local storage instead of saving the file on the repository Summary of changes: .../i18n/scmwebeditor-ui-web_en_GB.properties | 1 + .../i18n/scmwebeditor-ui-web_fr_FR.properties | 1 + .../src/main/resources/scmwebeditor.properties | 4 +- .../webapp/WEB-INF/content/modificationViewer.jsp | 59 +++++++--------------- swe-ui-web/src/main/webapp/js/autoSave.js | 29 +++++------ swe-ui-web/src/main/webapp/js/editor.js | 1 - 6 files changed, 35 insertions(+), 60 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 570490d886eef0ee396cdb8f64d9aa8ffd30f280 Author: Hugo PIGEON <hpigeon@codelutin.com> Date: Wed Jun 3 14:40:25 2015 +0200 Make the autosave use the client's local storage instead of saving the file on the repository --- .../i18n/scmwebeditor-ui-web_en_GB.properties | 1 + .../i18n/scmwebeditor-ui-web_fr_FR.properties | 1 + .../src/main/resources/scmwebeditor.properties | 4 +- .../webapp/WEB-INF/content/modificationViewer.jsp | 59 +++++++--------------- swe-ui-web/src/main/webapp/js/autoSave.js | 29 +++++------ swe-ui-web/src/main/webapp/js/editor.js | 1 - 6 files changed, 35 insertions(+), 60 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 1ebc305..6af700a 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 @@ -41,6 +41,7 @@ scm.logoutWait=Logout... scm.modificationViewer.betterUseJavascript=For a better use of SCMWebEditor please activate JavaScript. scm.modificationViewer.branch=Working on branch\: scm.modificationViewer.commitOnly=Make a commit only (no push) +scm.modificationViewer.loadAutoSavedFile=This file has been edited without being saved.\\nIf you continue, the file with the unsaved content will be loaded.\\nOtherwise, the version of the repository will be used. scm.modificationViewer.noJavascript=Javascript is not activated. You can only use save and quit, quit, upload a file, remove a file, Create a directory, remove a directory or move a file. scm.modificationViewer.previewPosition=Preview's position\: scm.modificationViewer.previewPosition.below=Below 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 ff4cf2f..ed26f30 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 @@ -41,6 +41,7 @@ scm.logoutWait=Déconnexion... scm.modificationViewer.betterUseJavascript=Activer Javascript pour accéder à toutes les fonctionnalités. scm.modificationViewer.branch=Vous travaillez sur la branche \: scm.modificationViewer.commitOnly=Faire un commit seulement (pas de push) +scm.modificationViewer.loadAutoSavedFile=Ce fichier a été édité sans être sauvegardé.\\nSi vous continuez, le fichier avec les modifications non sauvegardées sera affiché.\\nSinon, la version du dépôt sera utilisée. scm.modificationViewer.noJavascript=Javascript est désactivé. Vous pouvez seulement utiliser les boutons sauvegarder et quitter, quitter, ajouter un fichier, supprimer un fichier, créer un répertoire, supprimer un répertoire ou déplacer un fichier. scm.modificationViewer.previewPosition=Position de l'aperçu \: scm.modificationViewer.previewPosition.below=En dessous diff --git a/swe-ui-web/src/main/resources/scmwebeditor.properties b/swe-ui-web/src/main/resources/scmwebeditor.properties index bd65c9a..8038302 100644 --- a/swe-ui-web/src/main/resources/scmwebeditor.properties +++ b/swe-ui-web/src/main/resources/scmwebeditor.properties @@ -22,8 +22,8 @@ swe.editableFiles=text,xml,javascript,sh,x-tex,x-java swe.cookiePrivateKey=ZvcCyhfRTVZoQz3B/IpYdw== swe.localRepositoriesPath=/var/local/swe -swe.enableAutoSave=false +swe.enableAutoSave=true # the auto save interval is set in milliseconds -swe.autoSaveInterval=300000 +swe.autoSaveInterval=30000 swe.provider.SVN=org.nuiton.scmwebeditor.svn.SvnProvider swe.provider.Git=org.nuiton.scmwebeditor.git.GitProvider \ No newline at end of file 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 516fcd4..757b788 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 @@ -541,7 +541,13 @@ href="%{ajaxCommit}" title="%{scm.saveAndContinueTitle}" > - <s:submit id="Save" value="%{scm.submit}" onclick="return false;"/> + + <s:if test="autoSaveEnabled"> + <s:submit id="Save" value="%{scm.submit}" onclick="removeLocalAutoSave(); return false;"/> + </s:if> + <s:else> + <s:submit id="Save" value="%{scm.submit}" onclick="return false;"/> + </s:else> </sj:a> </form> @@ -583,50 +589,23 @@ </div> -<!-- popin to login for auto save --> -<div class="popin" id="autoSavePopin"> - <span class="closePopin" onclick="closePopin('autoSavePopin')"> - X - </span> - - <h1><s:text name="scm.loginAutoSaveFile"/></h1> - - <form id="autoSaveLoginForm"> - - <input type="hidden" name="commitMessage" value="auto save"/> - <input type="hidden" name="newText" id="newTextIdAutoSave" value=""/> - <s:hidden key="scmType" label=''/> - <s:hidden key="address" label=''/> - <s:hidden key="origText" label=''/> - <s:hidden key="format" label=''/> - - <label for="username"><s:text name="scm.username"/> :</label> <input type="text" name="username" id="usernameAutoSave"/><br/> - <label for="pw"><s:text name="scm.password"/> :</label> <input type="password" id="pwAutoSave" name="pw"/><br/> - <input type="checkbox" name="saveCookie" value="true" id="saveCookieAutoSave"><s:text name="scm.stayLogin"/> - - <s:set id="modificationViewer.save"> - <s:text name="scm.modificationViewer.save"/> - </s:set> - - <s:url id="ajaxAutoSave" value="save.action"/> +<div id="popinBackground"></div> - </form> +<s:if test="autoSaveEnabled"> + <script type="text/javascript"> - <sj:a - id="ajaxAutoSaveButton" - formIds="autoSaveLoginForm" - href="%{ajaxAutoSave}" - targets="autoSaveMessage" - > - <s:submit onclick="loadChange(); closePopin('autoSavePopin');" value="%{modificationViewer.save}"/> - </sj:a> + var address = document.getElementById("address").value; - <input type="hidden" id="autoSaveMessage" value=""/> - -</div> + if (localStorage.getItem(address) != null) { + var loadSavedContent = confirm('<s:text name="scm.modificationViewer.loadAutoSavedFile"/>'); + if (loadSavedContent) { + editor.mirror.setValue(localStorage.getItem(address)); + } + } -<div id="popinBackground"></div> + </script> +</s:if> </body> </html> diff --git a/swe-ui-web/src/main/webapp/js/autoSave.js b/swe-ui-web/src/main/webapp/js/autoSave.js index 79ec8e0..228d9a5 100644 --- a/swe-ui-web/src/main/webapp/js/autoSave.js +++ b/swe-ui-web/src/main/webapp/js/autoSave.js @@ -21,23 +21,18 @@ */ function autoSave() { - loadChange(); - $.post("save.action", { - username: document.getElementById("username").value, - pw: document.getElementById("pw").value, - saveCookie: document.getElementById("saveCookie").value, - commitMessage: "auto save", - newText: document.getElementById("newTextId").value, - origText: document.getElementById("origText").value, - format: document.getElementById("format").value, - scmType: document.getElementById("scmType").value, - address: document.getElementById("address").value - }).done(function(data) { + if (document.getElementById('newTextId').value !== editor.getValue()) { - // if there is an error, we ask the user to login - if (data.contains('<font color="red">')) { - openPopin('autoSavePopin'); - } - }); + var address = document.getElementById("address").value; + var text = editor.getValue(); + + localStorage.setItem(address, text); + } +} + +function removeLocalAutoSave() { + + var address = document.getElementById("address").value; + localStorage.removeItem(address); } \ No newline at end of file diff --git a/swe-ui-web/src/main/webapp/js/editor.js b/swe-ui-web/src/main/webapp/js/editor.js index 34cd2d5..0515f72 100644 --- a/swe-ui-web/src/main/webapp/js/editor.js +++ b/swe-ui-web/src/main/webapp/js/editor.js @@ -25,7 +25,6 @@ var exitAfterCommit = false; /* Changes the value of the new text */ function loadChange() { document.getElementById('newTextId').value = editor.getValue(); - document.getElementById('newTextIdAutoSave').value = editor.getValue(); } /* Opens the popin */ -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
participants (1)
-
nuiton.org scm