This is an automated email from the git hooks/post-receive script. New commit to branch feature/GIT in repository scmwebeditor. See http://git.nuiton.org/scmwebeditor.git commit 8a1df0a02f88220bf3e80af5c2ede108fb85ba0d Author: Hugo PIGEON <hpigeon@codelutin.com> Date: Mon May 11 14:25:16 2015 +0200 Fix the display of the lists for the preview of RST files and refactor the code a little bit --- .../org/nuiton/scmwebeditor/SvnConnection.java | 55 ++++------------------ .../actions/AbstractScmWebEditorAction.java | 2 +- .../nuiton/scmwebeditor/actions/BrowseAction.java | 12 ----- .../actions/ScmWebEditorCommitAction.java | 2 - .../webapp/WEB-INF/content/modificationViewer.jsp | 2 +- src/main/webapp/WEB-INF/content/outConnection.jsp | 2 +- src/main/webapp/css/main.css | 4 +- 7 files changed, 15 insertions(+), 64 deletions(-) diff --git a/src/main/java/org/nuiton/scmwebeditor/SvnConnection.java b/src/main/java/org/nuiton/scmwebeditor/SvnConnection.java index a973ee4..faa79f6 100644 --- a/src/main/java/org/nuiton/scmwebeditor/SvnConnection.java +++ b/src/main/java/org/nuiton/scmwebeditor/SvnConnection.java @@ -74,8 +74,6 @@ public class SvnConnection implements ScmConnection { */ protected SVNClientManager manager; - public File getCheckoutdir() { return checkoutdir; } - public SvnConnection(String address, String sessionId) throws SVNException { @@ -610,6 +608,7 @@ public class SvnConnection implements ScmConnection { if (log.isInfoEnabled()) { log.info(dto.getUsername() + " add the file " + dto.getUploadFileName() + " on the repository."); } + return resultDto; } @@ -799,18 +798,10 @@ public class SvnConnection implements ScmConnection { public boolean isDifferent(String text) throws IOException { - File pathToFile = new File(checkoutdir, fileName); - SVNDiffClient diffClient = new SVNDiffClient(manager, svnOption); - - FileUtils.writeStringToFile(pathToFile, text, "UTF-8"); + ByteArrayOutputStream diff = getDiff(text); - ByteArrayOutputStream diff = new ByteArrayOutputStream(); - - try { - diffClient.doDiff(pathToFile, SVNRevision.UNDEFINED, SVNRevision.WORKING, SVNRevision.HEAD, SVNDepth.INFINITY, true, diff, null); - } catch (SVNException e) { - log.error("Diff fail", e); + if (diff == null) { return false; } @@ -819,8 +810,6 @@ public class SvnConnection implements ScmConnection { } else { return false; } - - } public ByteArrayOutputStream getDiff(String text) throws IOException { @@ -838,42 +827,12 @@ public class SvnConnection implements ScmConnection { log.error("Diff fail", e); } - return diff; - - } /** * @param checkoutdir - * @param numVersion - * @throws SVNException - */ - public void checkout(File checkoutdir, String numVersion) throws SVNException { - - SVNUpdateClient upclient = new SVNUpdateClient(manager, svnOption); - - if (log.isDebugEnabled()) { - log.debug("Do Checkout of " + remoteUrl); - } - try { - upclient.doCheckout(remoteUrl, checkoutdir, - SVNRevision.create(Long.parseLong(numVersion)), SVNRevision.create(Long.parseLong(numVersion)), SVNDepth.FILES, false); - } catch (NumberFormatException e) { - if (log.isErrorEnabled()) { - log.error("The number version is not valid."); - } - upclient.doCheckout(remoteUrl, checkoutdir, - SVNRevision.HEAD, SVNRevision.HEAD, SVNDepth.FILES, false); - - } - - - } - - /** - * @param checkoutdir * @throws SVNException */ public void checkout(File checkoutdir) throws SVNException { @@ -890,7 +849,13 @@ public class SvnConnection implements ScmConnection { public void createCheckoutdir() throws IOException { - checkoutdir = FileUtil.createTempDirectory("scm_", ""); + File localDirectory = new File(ScmWebEditorConfig.getLocalRepositoriesPath() + "/" + sessionId); + + if (!localDirectory.exists()) { + localDirectory.mkdir(); + } + + checkoutdir = FileUtil.createTempDirectory(localDirectory.getAbsolutePath() + "/scm_", ""); } diff --git a/src/main/java/org/nuiton/scmwebeditor/actions/AbstractScmWebEditorAction.java b/src/main/java/org/nuiton/scmwebeditor/actions/AbstractScmWebEditorAction.java index 6e3e32a..2069560 100644 --- a/src/main/java/org/nuiton/scmwebeditor/actions/AbstractScmWebEditorAction.java +++ b/src/main/java/org/nuiton/scmwebeditor/actions/AbstractScmWebEditorAction.java @@ -221,7 +221,7 @@ public abstract class AbstractScmWebEditorAction extends BaseAction implements S } - protected String getMimeType(File file) throws IOException, SAXException, TikaException { + protected String getMimeType(File file) throws IOException { InputStream is = new FileInputStream(file); String result = null; try { diff --git a/src/main/java/org/nuiton/scmwebeditor/actions/BrowseAction.java b/src/main/java/org/nuiton/scmwebeditor/actions/BrowseAction.java index 95319fa..a57bafa 100644 --- a/src/main/java/org/nuiton/scmwebeditor/actions/BrowseAction.java +++ b/src/main/java/org/nuiton/scmwebeditor/actions/BrowseAction.java @@ -333,18 +333,6 @@ public class BrowseAction extends AbstractScmWebEditorAction implements ServletR } - public static String replaceLast(String string, String toReplace, String replacement) { - int pos = string.lastIndexOf(toReplace); - if (pos > -1) { - return string.substring(0, pos) - + replacement - + string.substring(pos + toReplace.length(), string.length()); - } else { - return string; - } - } - - @Override public void setServletResponse(HttpServletResponse response) { this.response = response; diff --git a/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java b/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java index ab0a286..27875f0 100644 --- a/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java +++ b/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java @@ -301,8 +301,6 @@ public class ScmWebEditorCommitAction extends AbstractScmWebEditorAction impleme username = usernamePw[0]; pw = usernamePw[1]; - String returnCode; - CommitDto dto = new CommitDto(); dto.setUsername(username); dto.setPassword(pw); diff --git a/src/main/webapp/WEB-INF/content/modificationViewer.jsp b/src/main/webapp/WEB-INF/content/modificationViewer.jsp index 2c20eb9..fa130fe 100644 --- a/src/main/webapp/WEB-INF/content/modificationViewer.jsp +++ b/src/main/webapp/WEB-INF/content/modificationViewer.jsp @@ -84,7 +84,7 @@ <div id="flagEdit"> - <ul> + <ul class="flags"> <li> <s:if test="%{#session['WW_TRANS_I18N_LOCALE'] != null && #session['WW_TRANS_I18N_LOCALE'].language == 'en'}"> diff --git a/src/main/webapp/WEB-INF/content/outConnection.jsp b/src/main/webapp/WEB-INF/content/outConnection.jsp index bc16e89..8be197d 100644 --- a/src/main/webapp/WEB-INF/content/outConnection.jsp +++ b/src/main/webapp/WEB-INF/content/outConnection.jsp @@ -47,7 +47,7 @@ <div id="flagHome"> - <ul> + <ul class="flags"> <li> <s:if test="%{#session['WW_TRANS_I18N_LOCALE'] != null && #session['WW_TRANS_I18N_LOCALE'].language == 'en'}"> diff --git a/src/main/webapp/css/main.css b/src/main/webapp/css/main.css index a2ee71d..a459f34 100644 --- a/src/main/webapp/css/main.css +++ b/src/main/webapp/css/main.css @@ -36,13 +36,13 @@ h3, p { margin:0; } -ul { +ul.flags { list-style: none ; margin: 0 ; padding: 0 ; } -li { +ul.flags li { display: inline ; } -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.