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 f58047b76b4e59c8e70097547295366af465f4e3 Author: Hugo PIGEON <hpigeon@codelutin.com> Date: Thu May 21 14:06:11 2015 +0200 The page is reloaded after uploading or removing a file and after creating a branch to avoid errors --- .../main/java/org/nuiton/scmwebeditor/git/GitConnection.java | 4 ++++ .../main/java/org/nuiton/scmwebeditor/svn/SvnConnection.java | 2 +- .../org/nuiton/scmwebeditor/uiweb/actions/EditAction.java | 5 +++++ swe-ui-web/src/main/webapp/WEB-INF/content/browse.jsp | 12 ++++++++---- .../src/main/webapp/WEB-INF/content/createBranchSuccess.jsp | 6 ++++++ .../src/main/webapp/WEB-INF/content/modificationViewer.jsp | 4 ++-- swe-ui-web/src/main/webapp/WEB-INF/content/removeSuccess.jsp | 6 ++++++ swe-ui-web/src/main/webapp/WEB-INF/content/uploadSuccess.jsp | 6 ++++++ swe-ui-web/src/main/webapp/js/popup.js | 10 +++++----- 9 files changed, 43 insertions(+), 12 deletions(-) diff --git a/swe-git/src/main/java/org/nuiton/scmwebeditor/git/GitConnection.java b/swe-git/src/main/java/org/nuiton/scmwebeditor/git/GitConnection.java index 221f6e7..7867bd6 100644 --- a/swe-git/src/main/java/org/nuiton/scmwebeditor/git/GitConnection.java +++ b/swe-git/src/main/java/org/nuiton/scmwebeditor/git/GitConnection.java @@ -750,6 +750,10 @@ public class GitConnection implements ScmConnection { File fileToEdit = new File(localDirectory.getAbsolutePath() + File.separator + fileName); + if (!fileToEdit.exists()) { + throw new IllegalArgumentException("There is no entry at '" + path + "'."); + } + return fileToEdit; } diff --git a/swe-svn/src/main/java/org/nuiton/scmwebeditor/svn/SvnConnection.java b/swe-svn/src/main/java/org/nuiton/scmwebeditor/svn/SvnConnection.java index 1854095..7111d63 100644 --- a/swe-svn/src/main/java/org/nuiton/scmwebeditor/svn/SvnConnection.java +++ b/swe-svn/src/main/java/org/nuiton/scmwebeditor/svn/SvnConnection.java @@ -437,7 +437,7 @@ public class SvnConnection implements ScmConnection { resultDto.setScmRoot(svnPath); } - if (!svnPath.endsWith("/")) { + if (svnPath.endsWith("/")) { resultDto.setFileRoot(svnPath.substring(0, svnPath.lastIndexOf('/'))); } else { resultDto.setFileRoot(svnPath); diff --git a/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/EditAction.java b/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/EditAction.java index b0b1e5f..c198061 100644 --- a/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/EditAction.java +++ b/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/EditAction.java @@ -190,6 +190,11 @@ public class EditAction extends ScmWebEditorMainAction { if (log.isErrorEnabled()) { log.error("Can not read content file", e); } + } catch (IllegalArgumentException e) { + if (log.isErrorEnabled()) { + log.error("The file does not exist", e); + } + return ERROR_PATH; } mimeType = null; diff --git a/swe-ui-web/src/main/webapp/WEB-INF/content/browse.jsp b/swe-ui-web/src/main/webapp/WEB-INF/content/browse.jsp index fffb523..d5da160 100644 --- a/swe-ui-web/src/main/webapp/WEB-INF/content/browse.jsp +++ b/swe-ui-web/src/main/webapp/WEB-INF/content/browse.jsp @@ -30,7 +30,6 @@ <sj:head debug="true" jquerytheme="default"/> <script> - $.subscribe('treeClicked', function(event, data) { var item = event.originalEvent.data.rslt.obj; @@ -66,6 +65,11 @@ $("#load-icon").hide(); + scmAddress = document.getElementById('addressInput').value; + if (!scmAddress.endsWith("/")) { + scmAddress += "/"; + } + </script> <script src="js/popup.js" type="text/javascript"></script> @@ -96,7 +100,7 @@ <s:text name="scm.createBranch"/> </s:set> <s:submit type="button" value="%{createBranch}" - onClick="javascript:open_popup('createBranch.action', 'create branch' , getElementById('addressInput'), '%{scmType}' );"/> + onClick="javascript:open_popup('createBranch.action', 'create branch' , getElementById('addressInput').value, '%{scmType}' );"/> </s:if> @@ -151,10 +155,10 @@ </s:set> <center> <s:submit name="uploadButton" value="%{scm.upload}" title="%{scm.uploadTitle}" - onClick="javascript:open_popup('doUpload.action', 'upload' , getElementById('addressInput'), '%{scmType}' );"/> + onClick="javascript:open_popup('doUpload.action', 'upload' , scmAddress, '%{scmType}' );"/> <s:submit name="removeButton" value="%{scm.removeFile}" title="%{scm.removeFileTitle}" - onClick="javascript:open_popup('doRemove.action', 'remove' , getElementById('addressInput'), '%{scmType}' );"/> + onClick="javascript:open_popup('doRemove.action', 'remove' , scmAddress, '%{scmType}' );"/> </center> </s:else> diff --git a/swe-ui-web/src/main/webapp/WEB-INF/content/createBranchSuccess.jsp b/swe-ui-web/src/main/webapp/WEB-INF/content/createBranchSuccess.jsp index 332117b..0ee4d22 100644 --- a/swe-ui-web/src/main/webapp/WEB-INF/content/createBranchSuccess.jsp +++ b/swe-ui-web/src/main/webapp/WEB-INF/content/createBranchSuccess.jsp @@ -28,7 +28,13 @@ <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" type="text/css" href="css/main.css"> + <script type="text/javascript" src="js/popup.js"></script> <title><s:text name="scm.titles.success"/></title> + + <script type="text/javascript"> + window.onbeforeunload = close_popup; + </script> + </head> <body> <p><s:text name="scm.createBranchSuccess"/></p> 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 d8efd2b..878b750 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 @@ -450,10 +450,10 @@ </s:set> <center> <s:submit name="uploadButton" value="%{scm.upload}" title="%{scm.uploadTitle}" - onClick="javascript:open_popup('doUpload.action', 'upload' , getElementById('address'), '%{scmType}' );"/> + onClick="javascript:open_popup('doUpload.action', 'upload' , getElementById('address').value, '%{scmType}' );"/> <s:submit name="removeButton" value="%{scm.removeFile}" title="%{scm.removeFileTitle}" - onClick="javascript:open_popup('doRemove.action', 'remove' , getElementById('address'), '%{scmType}' );"/> + onClick="javascript:open_popup('doRemove.action', 'remove' , getElementById('address').value, '%{scmType}' );"/> </center> diff --git a/swe-ui-web/src/main/webapp/WEB-INF/content/removeSuccess.jsp b/swe-ui-web/src/main/webapp/WEB-INF/content/removeSuccess.jsp index b8a8798..6eb3aae 100644 --- a/swe-ui-web/src/main/webapp/WEB-INF/content/removeSuccess.jsp +++ b/swe-ui-web/src/main/webapp/WEB-INF/content/removeSuccess.jsp @@ -28,7 +28,13 @@ <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" type="text/css" href="css/main.css"> + <script type="text/javascript" src="js/popup.js"></script> <title><s:text name="scm.titles.success"/></title> + + <script type="text/javascript"> + window.onbeforeunload = close_popup; + </script> + </head> <body> <p><s:text name="scm.removeSuccess"/></p> diff --git a/swe-ui-web/src/main/webapp/WEB-INF/content/uploadSuccess.jsp b/swe-ui-web/src/main/webapp/WEB-INF/content/uploadSuccess.jsp index 32ae236..f3b3843 100644 --- a/swe-ui-web/src/main/webapp/WEB-INF/content/uploadSuccess.jsp +++ b/swe-ui-web/src/main/webapp/WEB-INF/content/uploadSuccess.jsp @@ -28,7 +28,13 @@ <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" type="text/css" href="css/main.css"> + <script type="text/javascript" src="js/popup.js"></script> <title><s:text name="scm.titles.success"/></title> + + <script type="text/javascript"> + window.onbeforeunload = close_popup; + </script> + </head> <body> <p><s:text name="scm.uploadSuccess"/></p> diff --git a/swe-ui-web/src/main/webapp/js/popup.js b/swe-ui-web/src/main/webapp/js/popup.js index 2775807..46eb6c3 100644 --- a/swe-ui-web/src/main/webapp/js/popup.js +++ b/swe-ui-web/src/main/webapp/js/popup.js @@ -21,11 +21,11 @@ */ function open_popup(page, name, fileAddress, scmType) { - var address = fileAddress.value; + window.open (page+'?address=' + fileAddress + '&scmType=' + scmType, name, config='top=200, left=300, height=600, width=700, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no') +} - if (!address.endsWith("/")) { - address += "/"; - } +function close_popup() { - window.open (page+'?address=' + address + '&scmType=' + scmType, name, config='top=200, left=300, height=600, width=700, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no') + window.opener.document.location.reload(true); + window.close(); } -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.