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 c4a969b8f2544f44d9778c867333f7342840b7ac Author: Hugo PIGEON <hpigeon@codelutin.com> Date: Fri May 29 16:07:18 2015 +0200 Make the shortcut to open a file on the editor use the root of the repository --- .../java/org/nuiton/scmwebeditor/git/GitConnection.java | 1 + .../nuiton/scmwebeditor/uiweb/actions/EditAction.java | 17 +++++++++-------- swe-ui-web/src/main/webapp/WEB-INF/content/browse.jsp | 5 +++-- swe-ui-web/src/main/webapp/WEB-INF/content/logout.jsp | 4 ++-- .../main/webapp/WEB-INF/content/modificationViewer.jsp | 9 ++++++--- .../WEB-INF/content/popups/createDirectorySuccess.jsp | 3 ++- .../webapp/WEB-INF/content/popups/moveFileSuccess.jsp | 3 ++- .../WEB-INF/content/popups/removeDirectorySuccess.jsp | 3 ++- .../webapp/WEB-INF/content/popups/removeFileSuccess.jsp | 3 ++- .../webapp/WEB-INF/content/popups/uploadFileSuccess.jsp | 3 ++- .../main/webapp/WEB-INF/content/privateScmRedirect.jsp | 4 ++++ 11 files changed, 35 insertions(+), 20 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 fadcc9b..59b645f 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 @@ -792,6 +792,7 @@ public class GitConnection implements ScmConnection { try { emptyFile.createNewFile(); + FileUtils.writeStringToFile(emptyFile, " "); } catch (IOException e) { if (log.isErrorEnabled()) { log.error("Can not create file '" + emptyFile.getAbsolutePath() + "'"); 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 980d8ba..242a80f 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 @@ -56,8 +56,8 @@ public class EditAction extends ScmWebEditorMainAction { /** equals true if the SCM allows to choose when the commits are pushed to the server */ protected boolean scmSupportsPush; - /** the full path to the directory which contains the editoed file */ - protected String directoryPath; + /** the full path to the root of the repository */ + protected String repositoryRoot; public String getSelectedBranch() { return selectedBranch; } @@ -72,9 +72,9 @@ public class EditAction extends ScmWebEditorMainAction { public void setScmSupportsPush(boolean scmSupportsPush) { this.scmSupportsPush = scmSupportsPush; } - public String getDirectoryPath() { return directoryPath; } + public String getRepositoryRoot() { return repositoryRoot; } - public void setDirectoryPath(String directoryPath) { this.directoryPath = directoryPath; } + public void setRepositoryRoot(String repositoryRoot) { this.repositoryRoot = repositoryRoot; } /** * Execution of the edit action @@ -102,12 +102,13 @@ public class EditAction extends ScmWebEditorMainAction { if (repositoryUUID == null) { repositoryUUID = address.replace(' ', '_'); repositoryUUID = Normalizer.normalize(repositoryUUID, Normalizer.Form.NFD).replaceAll("[\u0300-\u036F]", ""); - if (log.isDebugEnabled()) { - log.debug("mydebug nom de cookie : " + repositoryUUID); - } } - directoryPath = address.substring(0, address.lastIndexOf('/')); + if (repositoryRoot == null) { + repositoryRoot = address.substring(0, address.lastIndexOf('/')); + } else if (repositoryRoot.equals("")) { + repositoryRoot = address.substring(0, address.lastIndexOf('/')); + } if (log.isDebugEnabled()) { log.debug("Login : " + username); 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 bbbff4b..804aaaa 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 @@ -39,11 +39,12 @@ var classAttr = item[0].getAttribute("class"); if (classAttr.contains("jstree-leaf")) { - var scmType = $("#scmType").val(); + var scmType = document.getElementById("scmType").value; var selectedBranch = $("#selectedBranchDisplay").text().trim(); + var repositoryRoot = document.getElementById("addressInput").value; document.location.href = ("edit.action?address=" + item.attr("id") + "&scmType=" + scmType - + "&selectedBranch=" + selectedBranch); + + "&selectedBranch=" + selectedBranch + "&repositoryRoot=" + repositoryRoot); } } diff --git a/swe-ui-web/src/main/webapp/WEB-INF/content/logout.jsp b/swe-ui-web/src/main/webapp/WEB-INF/content/logout.jsp index 5f625b4..7c86c4a 100644 --- a/swe-ui-web/src/main/webapp/WEB-INF/content/logout.jsp +++ b/swe-ui-web/src/main/webapp/WEB-INF/content/logout.jsp @@ -34,7 +34,7 @@ <meta http-equiv="Refresh" - content="0;URL=edit.action?address=<%=request.getAttribute("address")%>&scmType=<%=request.getAttribute("scmType")%>&selectedBranch=<%=request.getParameter("selectedBranch")%>"> + content="0;URL=edit.action?address=<%=request.getAttribute("address")%>&scmType=<%=request.getAttribute("scmType")%>&selectedBranch=<%=request.getParameter("selectedBranch")%>&repositoryRoot=<%=request.getParameter("repositoryRoot")%>"> </head> @@ -44,7 +44,7 @@ <p><s:text name="scm.logoutWait"/><a - href="edit.action?address=<%=request.getAttribute("address")%>&scmType=<%=request.getAttribute("scmType")%>&selectedBranch=<%=request.getParameter("selectedBranch")%>"> + href="edit.action?address=<%=request.getAttribute("address")%>&scmType=<%=request.getAttribute("scmType")%>&selectedBranch=<%=request.getParameter("selectedBranch")%>&repositoryRoot=<%=request.getAttribute("repositoryRoot")%>"> <s:text name="scm.clickHere"/> </a>.</p> <p>©2004-2015 CodeLutin</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 e7e8768..adfd4cd 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 @@ -107,10 +107,10 @@ var classAttr = item[0].getAttribute("class"); if (classAttr.contains("jstree-leaf")) { - var scmType = $("#scmType").val(); + var scmType = document.getElementById("scmType").value; document.location.href = ("edit.action?address=" + item.attr("id") + "&scmType=" + scmType - + '&selectedBranch=<s:property value="selectedBranch"/>'); + + '&selectedBranch=<s:property value="selectedBranch"/>&repositoryRoot=<s:property value="repositoryRoot"/>'); } } @@ -150,6 +150,7 @@ <s:param name="address"><s:property value="address"/></s:param> <s:param name="scmType"><s:property value="scmType"/></s:param> <s:param name="selectedBranch"><s:property value="selectedBranch"/></s:param> + <s:param name="repositoryRoot"><s:property value="repositoryRoot"/></s:param> <s:param name="request_locale">en_GB</s:param> <img src="img/flag-i18n-uk.png"/> </s:a> @@ -165,6 +166,7 @@ <s:param name="address"><s:property value="address"/></s:param> <s:param name="scmType"><s:property value="scmType"/></s:param> <s:param name="selectedBranch"><s:property value="selectedBranch"/></s:param> + <s:param name="repositoryRoot"><s:property value="repositoryRoot"/></s:param> <s:param name="request_locale">fr_FR</s:param> <img src="img/flag-i18n-fr.png"/> </s:a> @@ -445,6 +447,7 @@ <s:hidden key="origText" label=''/> <s:hidden key="scmEditorUrl" label=''/> <s:hidden key="selectedBranch" label=''/> + <s:hidden key="repositoryRoot" label=''/> <div id="scmButton"></div> @@ -522,7 +525,7 @@ <div id="searchTree"> <s:url id="searchTreeUrl" - action="browse?address=%{directoryPath}&username=%{username}&pw=%{pw}&selectedBranch=%{selectedBranch}&scmType=%{scmType}"/> + action="browse?address=%{repositoryRoot}&username=%{username}&pw=%{pw}&selectedBranch=%{selectedBranch}&scmType=%{scmType}"/> <sjt:tree id="scmTree" htmlTitles="true" jstreetheme="classic" diff --git a/swe-ui-web/src/main/webapp/WEB-INF/content/popups/createDirectorySuccess.jsp b/swe-ui-web/src/main/webapp/WEB-INF/content/popups/createDirectorySuccess.jsp index a2d17a8..0f1a5ef 100644 --- a/swe-ui-web/src/main/webapp/WEB-INF/content/popups/createDirectorySuccess.jsp +++ b/swe-ui-web/src/main/webapp/WEB-INF/content/popups/createDirectorySuccess.jsp @@ -37,9 +37,10 @@ var address = window.opener.document.getElementById("address").value; var scmType = window.opener.document.getElementById("scmType").value; var selectedBranch = window.opener.document.getElementById("selectedBranch").value; + var repositoryRoot = window.opener.document.getElementById("repositoryRoot").value; window.opener.document.location.href = "edit.action?address=" + address + "&scmType=" + scmType - + "&selectedBranch=" + selectedBranch; + + "&selectedBranch=" + selectedBranch + "&repositoryRoot=" + repositoryRoot; } else { window.opener.document.location.reload(true); diff --git a/swe-ui-web/src/main/webapp/WEB-INF/content/popups/moveFileSuccess.jsp b/swe-ui-web/src/main/webapp/WEB-INF/content/popups/moveFileSuccess.jsp index bf94320..47adc8f 100644 --- a/swe-ui-web/src/main/webapp/WEB-INF/content/popups/moveFileSuccess.jsp +++ b/swe-ui-web/src/main/webapp/WEB-INF/content/popups/moveFileSuccess.jsp @@ -37,9 +37,10 @@ var address = window.opener.document.getElementById("address").value; var scmType = window.opener.document.getElementById("scmType").value; var selectedBranch = window.opener.document.getElementById("selectedBranch").value; + var repositoryRoot = window.opener.document.getElementById("repositoryRoot").value; window.opener.document.location.href = "edit.action?address=" + address + "&scmType=" + scmType - + "&selectedBranch=" + selectedBranch; + + "&selectedBranch=" + selectedBranch + "&repositoryRoot=" + repositoryRoot; } else { window.opener.document.location.reload(true); diff --git a/swe-ui-web/src/main/webapp/WEB-INF/content/popups/removeDirectorySuccess.jsp b/swe-ui-web/src/main/webapp/WEB-INF/content/popups/removeDirectorySuccess.jsp index 1ff99e3..08307b3 100644 --- a/swe-ui-web/src/main/webapp/WEB-INF/content/popups/removeDirectorySuccess.jsp +++ b/swe-ui-web/src/main/webapp/WEB-INF/content/popups/removeDirectorySuccess.jsp @@ -37,9 +37,10 @@ var address = window.opener.document.getElementById("address").value; var scmType = window.opener.document.getElementById("scmType").value; var selectedBranch = window.opener.document.getElementById("selectedBranch").value; + var repositoryRoot = window.opener.document.getElementById("repositoryRoot").value; window.opener.document.location.href = "edit.action?address=" + address + "&scmType=" + scmType - + "&selectedBranch=" + selectedBranch; + + "&selectedBranch=" + selectedBranch + "&repositoryRoot=" + repositoryRoot; } else { window.opener.document.location.reload(true); diff --git a/swe-ui-web/src/main/webapp/WEB-INF/content/popups/removeFileSuccess.jsp b/swe-ui-web/src/main/webapp/WEB-INF/content/popups/removeFileSuccess.jsp index 1a3c511..41f741b 100644 --- a/swe-ui-web/src/main/webapp/WEB-INF/content/popups/removeFileSuccess.jsp +++ b/swe-ui-web/src/main/webapp/WEB-INF/content/popups/removeFileSuccess.jsp @@ -37,9 +37,10 @@ var address = window.opener.document.getElementById("address").value; var scmType = window.opener.document.getElementById("scmType").value; var selectedBranch = window.opener.document.getElementById("selectedBranch").value; + var repositoryRoot = window.opener.document.getElementById("repositoryRoot").value; window.opener.document.location.href = "edit.action?address=" + address + "&scmType=" + scmType - + "&selectedBranch=" + selectedBranch; + + "&selectedBranch=" + selectedBranch + "&repositoryRoot=" + repositoryRoot; } else { window.opener.document.location.reload(true); diff --git a/swe-ui-web/src/main/webapp/WEB-INF/content/popups/uploadFileSuccess.jsp b/swe-ui-web/src/main/webapp/WEB-INF/content/popups/uploadFileSuccess.jsp index c6d2d0b..d7f19b4 100644 --- a/swe-ui-web/src/main/webapp/WEB-INF/content/popups/uploadFileSuccess.jsp +++ b/swe-ui-web/src/main/webapp/WEB-INF/content/popups/uploadFileSuccess.jsp @@ -37,9 +37,10 @@ var address = window.opener.document.getElementById("address").value; var scmType = window.opener.document.getElementById("scmType").value; var selectedBranch = window.opener.document.getElementById("selectedBranch").value; + var repositoryRoot = window.opener.document.getElementById("repositoryRoot").value; window.opener.document.location.href = "edit.action?address=" + address + "&scmType=" + scmType - + "&selectedBranch=" + selectedBranch; + + "&selectedBranch=" + selectedBranch + "&repositoryRoot=" + repositoryRoot; } else { window.opener.document.location.reload(true); diff --git a/swe-ui-web/src/main/webapp/WEB-INF/content/privateScmRedirect.jsp b/swe-ui-web/src/main/webapp/WEB-INF/content/privateScmRedirect.jsp index d8554de..cf5dba6 100644 --- a/swe-ui-web/src/main/webapp/WEB-INF/content/privateScmRedirect.jsp +++ b/swe-ui-web/src/main/webapp/WEB-INF/content/privateScmRedirect.jsp @@ -44,6 +44,10 @@ <input type="hidden" id="ProjectUrl" name="ProjectUrl" value="checkout.action"/> + <input type="hidden" name="selectedBranch" value="<%=request.getAttribute("selectedBranch")%>"/> + + <input type="hidden" name="repositoryRoot" value="<%=request.getAttribute("repositoryRoot")%>"/> + <script src="js/cancelRedirect.js"></script> <p><s:text name="scm.privateScmAccess"/></p> -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.