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 635def17d283883c89f2a7dd90172e1b3d43b251 Author: Hugo PIGEON <hpigeon@codelutin.com> Date: Thu Apr 30 10:50:42 2015 +0200 Changed the editor's style for RST files and translated french comments to english --- .../org/nuiton/scmwebeditor/GitConnection.java | 4 ++- .../org/nuiton/scmwebeditor/ScmConnection.java | 4 ++- .../java/org/nuiton/scmwebeditor/ScmSession.java | 1 - .../scmwebeditor/ScmWebEditorBaseAction.java | 12 +++---- .../nuiton/scmwebeditor/ScmWebEditorConfig.java | 1 - .../scmwebeditor/ScmWebEditorConfigOption.java | 2 -- .../org/nuiton/scmwebeditor/SvnConnection.java | 39 ++++++++++------------ .../nuiton/scmwebeditor/actions/LogoutAction.java | 6 ++-- .../actions/ScmWebEditorMainAction.java | 28 ++++++---------- .../nuiton/scmwebeditor/actions/SearchAction.java | 9 ++--- .../nuiton/scmwebeditor/actions/UploadAction.java | 5 ++- .../webapp/WEB-INF/content/modificationViewer.jsp | 32 +++++++++--------- src/main/webapp/css/main.css | 34 ++++++++++++++++--- src/main/webapp/js/autoPreview.js | 4 ++- .../org/nuiton/scmwebeditor/BaseActionTest.java | 18 ++++------ 15 files changed, 104 insertions(+), 95 deletions(-) diff --git a/src/main/java/org/nuiton/scmwebeditor/GitConnection.java b/src/main/java/org/nuiton/scmwebeditor/GitConnection.java index a96742c..b35ec22 100644 --- a/src/main/java/org/nuiton/scmwebeditor/GitConnection.java +++ b/src/main/java/org/nuiton/scmwebeditor/GitConnection.java @@ -465,7 +465,7 @@ public class GitConnection implements ScmConnection { action.setFileRoot(addressGit); action.setScmRoot(addressGit); - //Si il n'y a pas de fichier à uploader on retourne sur le formulaire d'upload + // if there is no file to upload, we get back to the upload form if (action.getUpload() == null) { return UploadAction.REDIRECT; } @@ -688,6 +688,8 @@ public class GitConnection implements ScmConnection { /** * Gives a list of a remote repository's branches * @param address the URL to the remote repository + * @param username the username to connect with + * @param password the password to connect with * @return a list of the repository's branches */ public static List<String> getBranches(String address, String username, String password) { diff --git a/src/main/java/org/nuiton/scmwebeditor/ScmConnection.java b/src/main/java/org/nuiton/scmwebeditor/ScmConnection.java index 5134f03..f7fce5b 100644 --- a/src/main/java/org/nuiton/scmwebeditor/ScmConnection.java +++ b/src/main/java/org/nuiton/scmwebeditor/ScmConnection.java @@ -1,6 +1,8 @@ package org.nuiton.scmwebeditor; -import org.nuiton.scmwebeditor.actions.*; +import org.nuiton.scmwebeditor.actions.ScmWebEditorCommitAction; +import org.nuiton.scmwebeditor.actions.SearchAction; +import org.nuiton.scmwebeditor.actions.UploadAction; import javax.naming.AuthenticationException; diff --git a/src/main/java/org/nuiton/scmwebeditor/ScmSession.java b/src/main/java/org/nuiton/scmwebeditor/ScmSession.java index 0bc0c8e..f3f991d 100644 --- a/src/main/java/org/nuiton/scmwebeditor/ScmSession.java +++ b/src/main/java/org/nuiton/scmwebeditor/ScmSession.java @@ -21,7 +21,6 @@ */ package org.nuiton.scmwebeditor; -import javax.servlet.http.HttpSession; import java.util.HashMap; import java.util.Map; diff --git a/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorBaseAction.java b/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorBaseAction.java index 9ec9ea6..60618ec 100644 --- a/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorBaseAction.java +++ b/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorBaseAction.java @@ -296,10 +296,10 @@ public class ScmWebEditorBaseAction extends BaseAction implements ServletRequest } /** - * Recuperation des propriétés dans un fichier properties + * Getting the properties from a properties file * - * @param file le fichier contenant les propriétés - * @return un objet Properties contenant les propriétés du fichier + * @param file the file containing the properties + * @return a Properties object containing the properties from the file * @throws IOException */ public static Properties loadProperties(String file) throws IOException { @@ -316,10 +316,10 @@ public class ScmWebEditorBaseAction extends BaseAction implements ServletRequest } /** - * Recuperation des propriétés dans un fichier properties + * Getting the properties from a properties file * - * @param inStream le fichier contenant les propriétés - * @return un objet Properties contenant les propriétés du fichier + * @param inStream the file containing the properties + * @return a Properties object containing the properties from the file * @throws IOException * @throws NullPointerException */ diff --git a/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorConfig.java b/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorConfig.java index 6788c43..d34f2d3 100644 --- a/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorConfig.java +++ b/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorConfig.java @@ -21,7 +21,6 @@ */ package org.nuiton.scmwebeditor; -import javafx.application.Application; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.config.ApplicationConfig; diff --git a/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorConfigOption.java b/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorConfigOption.java index 9f7f419..e22a3ad 100644 --- a/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorConfigOption.java +++ b/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorConfigOption.java @@ -24,8 +24,6 @@ package org.nuiton.scmwebeditor; import org.nuiton.config.ApplicationConfig; import org.nuiton.config.ConfigOptionDef; -import java.util.List; - public enum ScmWebEditorConfigOption implements ConfigOptionDef { CONFIG_FILE(ApplicationConfig.CONFIG_FILE_NAME, "The file name", "scmwebeditor.properties", String.class, false, false), diff --git a/src/main/java/org/nuiton/scmwebeditor/SvnConnection.java b/src/main/java/org/nuiton/scmwebeditor/SvnConnection.java index cf8fc52..8a6732b 100644 --- a/src/main/java/org/nuiton/scmwebeditor/SvnConnection.java +++ b/src/main/java/org/nuiton/scmwebeditor/SvnConnection.java @@ -292,8 +292,8 @@ public class SvnConnection implements ScmConnection { } catch (FileNotFoundException ee) { - /* fichier non trouve, on redirige vers BadFileRedirect.jsp - * après avoir supprimé le repertoire temporaire + /* file not found, redirecting to BadFileRedirect.jsp + * after deleting the temporary directory */ delTempDirectory(checkoutdir); @@ -339,7 +339,6 @@ public class SvnConnection implements ScmConnection { /* * Commit process */ -// File pathToFile = new File(checkoutdir, svnConn.getFileName()); SVNCommitClient commitClient = new SVNCommitClient(manager, svnOption); @@ -373,7 +372,7 @@ public class SvnConnection implements ScmConnection { action.setOrigText(action.getNewText()); action.setBadLogin(true); - // deleteing temporary directory + // deleting temporary directory delTempDirectory(checkoutdir); action.setUsername(null); action.setPw(null); @@ -384,21 +383,21 @@ public class SvnConnection implements ScmConnection { if (log.isErrorEnabled()) { log.error("SVN FAIL", e); } - // deleteing temporary directory + // deleting temporary directory delTempDirectory(checkoutdir); return action.ERROR; } if (checkoutdir != null) { - // deleteing temporary directory + // deleting temporary directory delTempDirectory(checkoutdir); } if (log.isDebugEnabled()) { log.debug("End of commit"); } - // deleteing temporary directory + // deleting temporary directory delTempDirectory(checkoutdir); if (log.isInfoEnabled()) { @@ -445,7 +444,7 @@ public class SvnConnection implements ScmConnection { } - //Si il n'y a pas de fichier à uploader on retourne sur le formulaire d'upload + // if there is no file to upload we get back to the upload form if (action.getUpload() == null) { return UploadAction.REDIRECT; } @@ -487,27 +486,27 @@ public class SvnConnection implements ScmConnection { if (log.isDebugEnabled()) { log.debug("Private SCM on reading " + remoteUrl); } - //On supprime le repertoire temporaire + // deleting the temporary directory delTempDirectory(checkoutDir); //redirect to a login page action.setError(true); return UploadAction.ERROR; } catch (SVNException e) { - //Suppression du repertoire temporaire + // deleting the temporary directory delTempDirectory(checkoutDir); action.setError(true); return UploadAction.ERROR; } - //On test si le chemin se termine par un / si non, on l'ajoute + // checking whether the path ends with /, if not we add it if (!svnPath.endsWith("/")) { svnPath += "/"; } - //Copy file in checkourdir + //Copy file in checkoutdir String checkoutPath = checkoutDir.getAbsolutePath(); @@ -533,19 +532,19 @@ public class SvnConnection implements ScmConnection { log.debug("leSvnPath : " + file.toString()); } - //On ajoute le repertoire + // adding the directory manager.getWCClient().doAdd(file, false, false, false, SVNDepth.EMPTY, false, true); if (log.isDebugEnabled()) { log.debug("Add success !"); } - //On ajoute le fichier aux fichiers versionnés + // adding the file to the versioned files } catch (SVNException e) { if (log.isErrorEnabled()) { log.error("Erreur SVN Add", e); } action.setError(true); - //Suppression du repertoire temporaire + // deleting the temporary directory delTempDirectory(checkoutDir); return UploadAction.ERROR; } @@ -566,7 +565,7 @@ public class SvnConnection implements ScmConnection { log.error("authentification fail"); } action.setBadLogin(true); - //Suppression du repertoire temporaire + // deleting the temporary directory delTempDirectory(checkoutDir); action.getScmSession().delScmUser(repositoryUUID); return UploadAction.LOGIN; @@ -575,13 +574,13 @@ public class SvnConnection implements ScmConnection { log.error("Erreur SVN commit", e); } action.setError(true); - //Suppression du repertoire temporaire + // deleting the temporary directory delTempDirectory(checkoutDir); return UploadAction.ERROR; } - //Suppression du repertoire temporaire + // deleting the temporary directory delTempDirectory(checkoutDir); if (log.isDebugEnabled()) { @@ -908,10 +907,8 @@ public class SvnConnection implements ScmConnection { if (entry.getKind() == SVNNodeKind.DIR) { action.getDirectories().put(action.getAddressUnique(fichier), fichier); - - //listEntries(repository, (path.equals("")) ? entry.getName() : path + "/" + entry.getName()); } else { - // On ajoute dans la liste files seulement les fichiers et pas les répertoires + // only adding the files to the files list and not the directories action.getFiles().add(fichier); } } diff --git a/src/main/java/org/nuiton/scmwebeditor/actions/LogoutAction.java b/src/main/java/org/nuiton/scmwebeditor/actions/LogoutAction.java index 4859568..dd5dd80 100644 --- a/src/main/java/org/nuiton/scmwebeditor/actions/LogoutAction.java +++ b/src/main/java/org/nuiton/scmwebeditor/actions/LogoutAction.java @@ -84,10 +84,10 @@ public class LogoutAction extends ScmWebEditorBaseAction implements ServletReque repositoryId = address; } - //suppression des cookies pour ce dépot + // deleting the cookies for this repository for (Cookie c : request.getCookies()) { if (c.getName().equals(repositoryId)) { - c.setMaxAge(0);//On supprime le cookie + c.setMaxAge(0);// deleting the cookie response.addCookie(c); if (log.isDebugEnabled()) { log.debug("Cookie supprimé"); @@ -95,7 +95,7 @@ public class LogoutAction extends ScmWebEditorBaseAction implements ServletReque } } - //Suppression des identifiants stockés en session + // deleting the authentication info in session getScmSession().delScmUser(repositoryId); return SUCCESS; diff --git a/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java b/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java index 3753d12..f0c8812 100644 --- a/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java +++ b/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java @@ -33,7 +33,6 @@ import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.io.IOException; -import java.util.ArrayList; import java.util.LinkedList; import java.util.List; @@ -146,7 +145,7 @@ public class ScmWebEditorMainAction extends ScmWebEditorBaseAction implements Se public List<String> getSupportedScms() { return ScmWebEditorConfig.getSupportedScms(); } /** - * On test si les parametres ne sont pas vide + * We check whether the parameters are empty * * @return */ @@ -159,7 +158,7 @@ public class ScmWebEditorMainAction extends ScmWebEditorBaseAction implements Se } /** - * Methode principale de la classe + * Main method of the class * * @return */ @@ -171,14 +170,6 @@ public class ScmWebEditorMainAction extends ScmWebEditorBaseAction implements Se } - /* Si il n'y a pas de parametre, l'utilisateur est renvoyé - * vers la page de configuration (OutConnection) - */ -// if(testParameters()) { -// return "noParameter"; -// } - - if (!fromLoginPage && projectUrl == null) { projectUrl = request.getHeader("referer"); } @@ -188,6 +179,7 @@ public class ScmWebEditorMainAction extends ScmWebEditorBaseAction implements Se log.debug("ProjectUrl= " + projectUrl); } + // if there is no parameter, the user is redirected to the search page if (testParameters()) { return NO_PARAMETER; } @@ -209,7 +201,7 @@ public class ScmWebEditorMainAction extends ScmWebEditorBaseAction implements Se String originalText = ""; - //Si le repo n'est pas protege en ecriture on recupere sont UUID + // if the repository is not protected, we get its UUID String repositoryUUID = scmConn.getRepositoryId(); if (repositoryUUID == null) { repositoryUUID = address; @@ -221,12 +213,12 @@ public class ScmWebEditorMainAction extends ScmWebEditorBaseAction implements Se /* - * Lecture du cookie + * Reading the cookie */ String usernamepwCookie = null; - // lire cookies + // read the cookies BlowfishCipherService bf = new BlowfishCipherService(); @@ -263,7 +255,7 @@ public class ScmWebEditorMainAction extends ScmWebEditorBaseAction implements Se /* - * Récuperation des informations en session + * Getting the information in session */ if (username == null && pw == null) { if (getScmSession().getUsername(repositoryUUID) != null && getScmSession().getPassword(repositoryUUID) != null) { @@ -280,7 +272,7 @@ public class ScmWebEditorMainAction extends ScmWebEditorBaseAction implements Se /* - * Recuperation du fichier et de sa revision + * Getting the file and its revision */ try { @@ -294,7 +286,7 @@ public class ScmWebEditorMainAction extends ScmWebEditorBaseAction implements Se log.debug("Auth Fail ", e); } - //suppression des cookies pour ce dépot + // deleting the cookies for this repository for (Cookie c : request.getCookies()) { if (c.getName().equals(repositoryUUID)) { c.setMaxAge(0);//On supprime le cookie @@ -340,7 +332,7 @@ public class ScmWebEditorMainAction extends ScmWebEditorBaseAction implements Se } - // Si le fichier n'est pas de type texte, on ne peut pas l'éditer + // if the file is not of text type, we can't edit it if (mimeType == null || !editable) { if (log.isErrorEnabled()) { diff --git a/src/main/java/org/nuiton/scmwebeditor/actions/SearchAction.java b/src/main/java/org/nuiton/scmwebeditor/actions/SearchAction.java index 5a41ba7..d2d6a70 100644 --- a/src/main/java/org/nuiton/scmwebeditor/actions/SearchAction.java +++ b/src/main/java/org/nuiton/scmwebeditor/actions/SearchAction.java @@ -25,14 +25,11 @@ import com.jgeppert.struts2.jquery.tree.result.TreeNode; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.scmwebeditor.*; -import org.tmatesoft.svn.core.SVNDirEntry; -import org.tmatesoft.svn.core.SVNException; -import org.tmatesoft.svn.core.SVNNodeKind; -import org.tmatesoft.svn.core.io.SVNRepository; import javax.servlet.http.HttpSession; -import java.util.*; -import java.util.Map.Entry; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; public class SearchAction extends ScmWebEditorBaseAction { diff --git a/src/main/java/org/nuiton/scmwebeditor/actions/UploadAction.java b/src/main/java/org/nuiton/scmwebeditor/actions/UploadAction.java index 3825e84..fdb58f7 100644 --- a/src/main/java/org/nuiton/scmwebeditor/actions/UploadAction.java +++ b/src/main/java/org/nuiton/scmwebeditor/actions/UploadAction.java @@ -24,7 +24,10 @@ package org.nuiton.scmwebeditor.actions; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.struts2.interceptor.ServletRequestAware; -import org.nuiton.scmwebeditor.*; +import org.nuiton.scmwebeditor.ScmConnection; +import org.nuiton.scmwebeditor.ScmConnectionFactory; +import org.nuiton.scmwebeditor.ScmNotFoundException; +import org.nuiton.scmwebeditor.ScmWebEditorBaseAction; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; diff --git a/src/main/webapp/WEB-INF/content/modificationViewer.jsp b/src/main/webapp/WEB-INF/content/modificationViewer.jsp index b62f5a8..a414601 100644 --- a/src/main/webapp/WEB-INF/content/modificationViewer.jsp +++ b/src/main/webapp/WEB-INF/content/modificationViewer.jsp @@ -335,9 +335,8 @@ <s:if test="format == 'rst'"> - <table> - <tr> - <td> + <div id="largeEditor"> + <div id="largeEditorCode"> </s:if> @@ -347,25 +346,19 @@ <script type="text/javascript"> var textarea = document.getElementById('newTextId'); - /* - var editor = CodeMirror.fromTextArea(textarea, { - lineNumbers: true - }); - */ var uiOptions = { path : 'codemirror-ui/js/', searchMode : 'inline', imagePath: 'codemirror-ui/images/silk', buttons: ['undo', 'redo', 'jump', 'reindentSelection', 'reindent'] } - var codeMirrorOptions = { mode: "null", lineNumbers: true } + var codeMirrorOptions = { mode: "null", lineNumbers: true, lineWrapping: true } var editor = new CodeMirrorUI(textarea, uiOptions, codeMirrorOptions); </script> <s:if test="format == 'rst'"> - </td> - <td> - <div id="htmlcontentPreview"></div> - </td> - </tr> - </table> + </div> + <div id="largeEditorPreview"> + <div id="htmlcontentPreview"></div> + </div> + </div> <script type="text/javascript"> @@ -373,8 +366,13 @@ if (editors.length == 1) { var edit = editors[0]; - edit.style.width = "40em"; - edit.style.height = "100%"; + var findBar = document.getElementsByClassName("codemirror-ui-find-bar") + + if (findBar.length == 1) { + var findBarHeight = findBar[0].offsetHeight; + + edit.style.height = (600 - findBarHeight) + "px"; + } } </script> diff --git a/src/main/webapp/css/main.css b/src/main/webapp/css/main.css index e161d76..66842be 100644 --- a/src/main/webapp/css/main.css +++ b/src/main/webapp/css/main.css @@ -297,11 +297,6 @@ li { border : solid 1px black; margin-right:15px; } -/* -.CodeMirror { - width: 80em; - height: 50em; -}*/ #branches { display: none; @@ -310,3 +305,32 @@ li { .wwgrp { display: inline; } + +#largeEditor { + width: 100%; + margin: auto; + height: 600px; +} + +#largeEditorCode { + width: 490px; + display: inline-block; + vertical-align: top; + height: 600px; +} + +#largeEditorPreview { + width: 490px; + display: inline-block; + float: right; + height: 600px; +} + +#language { + margin-top: 20px; +} + +#preview { + overflow: scroll; + height: 568px; +} diff --git a/src/main/webapp/js/autoPreview.js b/src/main/webapp/js/autoPreview.js index 6ed097e..23d2053 100644 --- a/src/main/webapp/js/autoPreview.js +++ b/src/main/webapp/js/autoPreview.js @@ -11,7 +11,7 @@ $(document).ready(function() { lastValue = editor.getValue(); loadChange(); - $.post("preview.action", { + var request = $.post("preview.action", { scmType: $("#scmType").val(), username: $("#username").val(), pw: $("#pw").val(), @@ -33,4 +33,6 @@ $(document).ready(function() { window.setInterval(updatePreview, 2000); updatePreview(); + + }); \ No newline at end of file diff --git a/src/test/java/org/nuiton/scmwebeditor/BaseActionTest.java b/src/test/java/org/nuiton/scmwebeditor/BaseActionTest.java index 22d1797..788932f 100644 --- a/src/test/java/org/nuiton/scmwebeditor/BaseActionTest.java +++ b/src/test/java/org/nuiton/scmwebeditor/BaseActionTest.java @@ -21,12 +21,6 @@ */ package org.nuiton.scmwebeditor; -import static org.junit.Assert.assertTrue; - -import java.io.File; -import java.io.IOException; -import java.util.LinkedList; - import org.apache.commons.io.FileUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -44,13 +38,15 @@ import org.tmatesoft.svn.core.internal.io.fs.FSRepositoryFactory; import org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions; import org.tmatesoft.svn.core.io.SVNRepository; import org.tmatesoft.svn.core.io.SVNRepositoryFactory; -import org.tmatesoft.svn.core.wc.SVNClientManager; -import org.tmatesoft.svn.core.wc.SVNCommitClient; -import org.tmatesoft.svn.core.wc.SVNRevision; -import org.tmatesoft.svn.core.wc.SVNUpdateClient; -import org.tmatesoft.svn.core.wc.SVNWCUtil; +import org.tmatesoft.svn.core.wc.*; import org.tmatesoft.svn.core.wc.admin.SVNAdminClient; +import java.io.File; +import java.io.IOException; +import java.util.LinkedList; + +import static org.junit.Assert.assertTrue; + -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.