Scmwebeditor-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- 439 discussions
Author: tchemit
Date: 2011-08-18 08:17:53 +0200 (Thu, 18 Aug 2011)
New Revision: 219
Url: http://nuiton.org/repositories/revision/scmwebeditor/219
Log:
add third-parties
Added:
trunk/src/license/THIRD-PARTY.properties
Added: trunk/src/license/THIRD-PARTY.properties
===================================================================
--- trunk/src/license/THIRD-PARTY.properties (rev 0)
+++ trunk/src/license/THIRD-PARTY.properties 2011-08-18 06:17:53 UTC (rev 219)
@@ -0,0 +1,44 @@
+# Generated by org.codehaus.mojo.license.AddThirdPartyMojo
+#-------------------------------------------------------------------------------
+# Already used licenses in project :
+# - BSD License
+# - BSD licence
+# - BSD-style license
+# - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
+# - Common Public License Version 1.0
+# - GPL
+# - Indiana University Extreme! Lab Software License, vesion 1.1.1
+# - JDom license (Apache-like)
+# - Lesser General Public License (LGPL) v 3.0
+# - Lesser General Public License (LPGL)
+# - Lesser General Public License (LPGL) v 2.1
+# - Lesser General Public License v2.1
+# - MIT License
+# - Mozilla Public License 1.1 (MPL 1.1)
+# - Mozilla Public License version 1.1
+# - The Apache Software License, Version 1.1
+# - The Apache Software License, Version 2.0
+# - http://asm.ow2.org/license.html
+# - http://source.icu-project.org/repos/icu/icu/trunk/license.html
+# - http://sqljet.com/
+# - http://svnkit.com/license.html
+# - http://www.trilead.com/Products/Trilead_SSH_for_Java/License/
+#-------------------------------------------------------------------------------
+# Please fill the missing licenses for dependencies :
+#
+#
+#Thu Aug 18 08:16:13 CEST 2011
+asm--asm--3.1=http\://asm.ow2.org/license.html
+asm--asm-commons--3.1=http\://asm.ow2.org/license.html
+asm--asm-tree--3.1=http\://asm.ow2.org/license.html
+com.ibm.icu--icu4j--2.6.1=http\://source.icu-project.org/repos/icu/icu/trunk/license.html
+commons-primitives--commons-primitives--1.0=The Apache Software License, Version 2.0
+dom4j--dom4j--1.6.1=BSD License
+javassist--javassist--3.11.0.GA=Lesser General Public License v2.1
+javax.servlet--servlet-api--2.5=COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
+jaxen--jaxen--1.1.1=The Apache Software License, Version 2.0
+jdom--jdom--1.0=JDom license (Apache-like)
+net.java.dev.jna--jna--3.2.3=The Apache Software License, Version 2.0
+org.antlr--antlr-runtime--3.1.3=BSD License
+oro--oro--2.0.8=The Apache Software License, Version 2.0
+xerces--xercesImpl--2.6.2=The Apache Software License, Version 2.0
Property changes on: trunk/src/license/THIRD-PARTY.properties
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
1
0
r218 - in trunk/src/main: java/org/nuiton/scmwebeditor java/org/nuiton/scmwebeditor/actions resources resources/i18n webapp/WEB-INF/content webapp/css
by kcardineaud@users.nuiton.org 17 Aug '11
by kcardineaud@users.nuiton.org 17 Aug '11
17 Aug '11
Author: kcardineaud
Date: 2011-08-17 18:00:44 +0200 (Wed, 17 Aug 2011)
New Revision: 218
Url: http://nuiton.org/repositories/revision/scmwebeditor/218
Log:
Add a conflits detection system when commit
Added:
trunk/src/main/webapp/WEB-INF/content/fileModify.jsp
Modified:
trunk/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorBaseAction.java
trunk/src/main/java/org/nuiton/scmwebeditor/SvnConnection.java
trunk/src/main/java/org/nuiton/scmwebeditor/actions/ResetAction.java
trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java
trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java
trunk/src/main/resources/i18n/scmwebeditor_en_GB.properties
trunk/src/main/resources/i18n/scmwebeditor_fr_FR.properties
trunk/src/main/resources/struts.xml
trunk/src/main/webapp/WEB-INF/content/badRstFile.jsp
trunk/src/main/webapp/WEB-INF/content/modificationViewer.jsp
trunk/src/main/webapp/WEB-INF/content/reset.jsp
trunk/src/main/webapp/WEB-INF/content/save.jsp
trunk/src/main/webapp/css/main.css
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorBaseAction.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorBaseAction.java 2011-08-16 23:13:01 UTC (rev 217)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorBaseAction.java 2011-08-17 16:00:44 UTC (rev 218)
@@ -37,12 +37,17 @@
import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNNodeKind;
+import org.tmatesoft.svn.core.SVNProperties;
+import org.tmatesoft.svn.core.SVNProperty;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager;
+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.SVNInfo;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc.SVNUpdateClient;
+import org.tmatesoft.svn.core.wc.SVNWCClient;
import org.tmatesoft.svn.core.wc.SVNWCUtil;
import org.xml.sax.SAXException;
@@ -202,19 +207,48 @@
* @param checkoutdir
* @throws SVNException
*/
- public void checkout(SvnConnection svnSess, File checkoutdir) throws SVNException {
-
+ public void checkout(SvnConnection svnSess, File checkoutdir , String numVersion) throws SVNException {
+
SVNUpdateClient upclient = new SVNUpdateClient(svnSess.getManager(), svnSess.getSvnOption());
- if (log.isDebugEnabled()) {
+ if (log.isDebugEnabled()) {
log.debug("Do Checkout of " + svnSess.getRemoteUrl());
}
- upclient.doCheckout(svnSess.getRemoteUrl(), checkoutdir,
- SVNRevision.HEAD, SVNRevision.HEAD, SVNDepth.FILES, false);
+ try {
+ upclient.doCheckout(svnSess.getRemoteUrl(), 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(svnSess.getRemoteUrl(), checkoutdir,
+ SVNRevision.HEAD, SVNRevision.HEAD, SVNDepth.FILES, false);
+
+ }
+
}
+ /**
+ *
+ * @param svnSess
+ * @param checkoutdir
+ * @throws SVNException
+ */
+ public void checkout(SvnConnection svnSess, File checkoutdir) throws SVNException {
+
+ SVNUpdateClient upclient = new SVNUpdateClient(svnSess.getManager(), svnSess.getSvnOption());
+
+ if (log.isDebugEnabled()) {
+ log.debug("Do Checkout of " + svnSess.getRemoteUrl());
+ }
+
+ upclient.doCheckout(svnSess.getRemoteUrl(), checkoutdir,
+ SVNRevision.HEAD, SVNRevision.HEAD, SVNDepth.FILES, false);
+ }
+
/**
*
* @param svnFile
@@ -282,8 +316,13 @@
ByteArrayOutputStream baos = new ByteArrayOutputStream( );
- repository.getFile( file , -1 , null , baos );
+ SVNProperties fileProperties = new SVNProperties();
+
+ repository.getFile( file , -1 , fileProperties , baos );
+ fileProperties.getStringValue(SVNProperty.REVISION);
+
+
lastRevision = baos.toString();
try {
@@ -298,6 +337,42 @@
}
+
+ public String getHeadNumberRevision(String address, String login, String password) throws SVNException {
+
+ ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager( login , password );
+
+ DefaultSVNOptions svnOption = new DefaultSVNOptions();
+ svnOption.setPropertyValue(SVNProperty.EOL_STYLE, SVNProperty.EOL_STYLE_LF);
+
+ SVNWCClient wcClient = new SVNWCClient(authManager,svnOption);
+
+ SVNInfo info = wcClient.doInfo(SVNURL.parseURIEncoded(address), SVNRevision.HEAD, SVNRevision.HEAD);
+
+ String headRevision = info.getRevision().toString();
+
+
+ return headRevision;
+ }
+
+ public String getHeadcommiter(String address, String login, String password) throws SVNException {
+
+ ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager( login , password );
+
+ DefaultSVNOptions svnOption = new DefaultSVNOptions();
+ svnOption.setPropertyValue(SVNProperty.EOL_STYLE, SVNProperty.EOL_STYLE_LF);
+
+ SVNWCClient wcClient = new SVNWCClient(authManager,svnOption);
+
+ SVNInfo info = wcClient.doInfo(SVNURL.parseURIEncoded(address), SVNRevision.HEAD, SVNRevision.HEAD);
+
+ String headAuthor = info.getAuthor();
+
+
+ return headAuthor;
+ }
+
+
/**
* Use to delete the checkout temp directory
* @param checkoutdir The dir temp directory
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/SvnConnection.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/SvnConnection.java 2011-08-16 23:13:01 UTC (rev 217)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/SvnConnection.java 2011-08-17 16:00:44 UTC (rev 218)
@@ -24,9 +24,11 @@
*/
package org.nuiton.scmwebeditor;
+import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.util.FileUtil;
+import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNProperty;
import org.tmatesoft.svn.core.SVNURL;
@@ -35,8 +37,11 @@
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.SVNDiffClient;
+import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc.SVNWCUtil;
+import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
@@ -166,8 +171,58 @@
}
+
+
+ public boolean isDifferent(String text) throws IOException {
+ File pathToFile = new File(checkoutdir, getFileName());
+ SVNDiffClient diffClient = new SVNDiffClient(getManager(), getSvnOption());
+
+ FileUtils.writeStringToFile(pathToFile, 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);
+ return false;
+ }
+ if(diff.size()>0) {
+ return true;
+ }
+ else {
+ return false;
+ }
+
+
+ }
+
+ public ByteArrayOutputStream getDiff(String text) throws IOException {
+ File pathToFile = new File(checkoutdir, getFileName());
+
+ SVNDiffClient diffClient = new SVNDiffClient(getManager(), getSvnOption());
+
+ FileUtils.writeStringToFile(pathToFile, 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);
+ }
+
+
+ return diff;
+
+
+
+ }
+
+
+
public ISVNAuthenticationManager getAuthManager() {
return authManager;
}
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/actions/ResetAction.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/actions/ResetAction.java 2011-08-16 23:13:01 UTC (rev 217)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/actions/ResetAction.java 2011-08-17 16:00:44 UTC (rev 218)
@@ -17,6 +17,8 @@
protected String lastRevision;
+ protected String numRevision;
+
protected String address;
protected String username;
@@ -30,6 +32,10 @@
return lastRevision;
}
+ public String getNumRevision() {
+ return numRevision;
+ }
+
public void setAddress(String address) {
this.address = address;
}
@@ -54,6 +60,9 @@
lastRevision = getHeadRevision(address, username, pw);
+ numRevision=getHeadNumberRevision(address, username, pw);
+
+
} catch (SVNAuthenticationException authexep) {
if(log.isErrorEnabled()) {
log.error("AUTH FAIL");
@@ -65,6 +74,7 @@
log.error("Can't reach the svn repository");
}
error = "errorPath";
+ numRevision=null;
return "errorPath";
} catch (StringIndexOutOfBoundsException e) {
if(log.isErrorEnabled()) {
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java 2011-08-16 23:13:01 UTC (rev 217)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java 2011-08-17 16:00:44 UTC (rev 218)
@@ -1,5 +1,6 @@
package org.nuiton.scmwebeditor.actions;
+import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
@@ -14,13 +15,13 @@
import org.nuiton.jrst.JRST;
import org.nuiton.scmwebeditor.ScmWebEditorBaseAction;
import org.nuiton.scmwebeditor.SvnConnection;
-import org.nuiton.util.FileUtil;
import org.tmatesoft.svn.core.SVNAuthenticationException;
import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.wc.SVNCommitClient;
+
import com.opensymphony.xwork2.Action;
@@ -42,9 +43,14 @@
protected String lastText;
protected String format;
protected String projectUrl;
+ protected String diff;
+ protected String headCommiter;
+
protected boolean force;
+ protected String numRevision;
+
@@ -129,7 +135,22 @@
}
+ public String getNumRevision() {
+ return numRevision;
+ }
+ public void setNumRevision(String numRevision) {
+ this.numRevision = numRevision;
+ }
+
+ public String getDiff() {
+ return diff;
+ }
+
+ public String getHeadCommiter() {
+ return headCommiter;
+ }
+
protected boolean isRstValid(String newText) {
try {
JRST.generate(JRST.TYPE_HTML, newText);
@@ -182,8 +203,6 @@
repositoryUUID=address;
}
- log.info("username : |"+login+"|");
-
if( ( login==null || login.equals("") ) && ( password==null || password.equals("") ) ) {
if(getScmSession().getUsername(repositoryUUID)!=null && getScmSession().getPassword(repositoryUUID)!=null) {
//On recupère les identifiants en session
@@ -204,13 +223,14 @@
File checkoutdir = null;
try {
- checkoutdir = FileUtil.createTempDirectory("scm_", "");
+ svnConn.createCheckoutdir();
} catch (IOException e1) {
if(log.isErrorEnabled()) {
log.error("Can't create checkoutDir",e1);
}
return "error";
}
+ checkoutdir = svnConn.getCheckoutdir();
// Avant le commit, il faut checkout le repertoire
@@ -253,7 +273,6 @@
request.setAttribute(ATTRIBUTE_ORIG_TEXT, StringEscapeUtils.escapeHtml(originalText));
- // End on first part
} catch (FileNotFoundException ee) {
/* fichier non trouve, on redirige vers BadFileRedirect.jsp
@@ -268,24 +287,54 @@
+
+ /*
+ * Diff
+ */
+ if(!force) {
+ try {
+
+ if(svnConn.isDifferent(origText)) {
+ ByteArrayOutputStream differents = svnConn.getDiff(newText);
+
+ if(differents.size()>0) {
+ diff=differents.toString();
+ diff = diff.substring(diff.indexOf("@@"));
+ delTempDirectory(checkoutdir);
+ try {
+ headCommiter=getHeadcommiter(address, login, password);
+ } catch (SVNException e) {
+ log.error("Can't get head commiter",e);
+ }
+ return "fileModify";
+ }
+ }
+
+ } catch (IOException e) {
+ if(log.isErrorEnabled()) {
+ log.error("Can't do diff on file, IO error",e);
+ }
+ }
+ }
+
+
+
/*
* Commit process
*/
- File pathToFile = new File(checkoutdir, svnConn.getFileName());
+// File pathToFile = new File(checkoutdir, svnConn.getFileName());
SVNCommitClient commitClient = new SVNCommitClient(svnConn.getManager(), svnConn.getSvnOption());
+
+ File pathToFile = new File(checkoutdir, svnConn.getFileName());
+
try {
FileUtils.writeStringToFile(pathToFile, newText);
- } catch (IOException e) {
- if(log.isErrorEnabled()) {
- log.error("Can't write in file " , e);
- }
+ } catch (IOException e1) {
+ delTempDirectory(checkoutdir);
return "error";
}
-
- convertToUnicode(pathToFile);
-
File[] tabFile = new File[1];
tabFile[0] = pathToFile;
@@ -339,6 +388,12 @@
log.info(login + " with IP "+request.getRemoteAddr()+" commit the file "+address+" with message : "+commitMessage);
}
+ try {
+ numRevision=getHeadNumberRevision(address, login, password);
+ } catch (SVNException e) {
+ numRevision=null;
+ }
+
return "success";
}
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java 2011-08-16 23:13:01 UTC (rev 217)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java 2011-08-17 16:00:44 UTC (rev 218)
@@ -34,6 +34,11 @@
protected String address;
protected String projectUrl;
protected String format;
+ protected String origText;
+
+
+ protected String numRevision;
+
protected String addressSvn;
@@ -106,10 +111,18 @@
}
+ public String getOrigText() {
+ return origText;
+ }
+
+
public String getProjectUrl() {
return projectUrl;
}
+ public String getNumRevision() {
+ return numRevision;
+ }
public void setProjectUrl(String projectUrl) {
this.projectUrl = projectUrl;
@@ -120,6 +133,8 @@
this.fromLoginPage = fromLoginPage;
}
+
+
/**
* On test si les parametres ne sont pas vide
@@ -258,6 +273,7 @@
try {
originalText = getHeadRevision(address, username, pw);
+ numRevision = getHeadNumberRevision(address, username, pw);
} catch (SVNAuthenticationException authexep) {
@@ -344,7 +360,7 @@
- request.setAttribute(ATTRIBUTE_ORIG_TEXT, StringEscapeUtils.escapeHtml(originalText));
+ origText=StringEscapeUtils.escapeHtml(originalText);
request.setAttribute(ATTRIBUTE_PROJECT_URL, projectUrl);
if(log.isInfoEnabled()) {
Modified: trunk/src/main/resources/i18n/scmwebeditor_en_GB.properties
===================================================================
--- trunk/src/main/resources/i18n/scmwebeditor_en_GB.properties 2011-08-16 23:13:01 UTC (rev 217)
+++ trunk/src/main/resources/i18n/scmwebeditor_en_GB.properties 2011-08-17 16:00:44 UTC (rev 218)
@@ -2,6 +2,8 @@
scm.badPathOrFileName=Bad repository path or file name, or the file is not editable \! Please correct it.
scm.badUsernameOrPassword=Bad username or password
scm.beTransferred=You should be transferred automatically to the new page. If not please
+scm.by=By
+scm.cannotSave=Can't save modification.
scm.clickHere=click here
scm.commitMessage=Commit message
scm.commitMessageTitle=let a message for commit
@@ -9,10 +11,13 @@
scm.exit=Exit
scm.exitJavascript=Exit ScmWebEditor without saving ? All modification will be lost.
scm.exitTitle=Exit ScmWebEditor without saving.
+scm.fileModify=File modify while editing.
+scm.forceSave=Force save
scm.formTransferred=You should be transferred automatically to the form page. If not please
scm.info.ProblemWithRst=For any Problem with RestruturedText visit
scm.info.rstWebsite=RST documentation website
scm.language=Language
+scm.lastChangeSave=Last change save
scm.logAs=You are log as \:
scm.loginButton=Login
scm.modificationViewer.betterUseJavascript=For a better use of SCMWebEditor please activate JavaScript.
@@ -25,6 +30,7 @@
scm.outConnection.search=Search
scm.password=Password
scm.passwordTitle=Repository password
+scm.pathError=Path error
scm.preview=Preview
scm.privateScmAccess=You try to access a Private SCM. Please login
scm.redirection=Redirection...
@@ -35,6 +41,7 @@
scm.saveAndContinueTitle=Commit modifications and continue editing the file.
scm.saveAndQuit=Save and quit
scm.saveAndQuitTitle=Save this file and go back to previous page.
+scm.showDiff=Show differences
scm.text=Text
scm.thankUsing=Thank you using SCMWebEditor
scm.upload=Upload
@@ -42,6 +49,7 @@
scm.uploadPath=Path on Repository
scm.uploadSuccess=File upload successful
scm.uploadTitle=Upload a file on the repository
+scm.uselessSave=It's useless to save the file, file is not modify.
scm.username=Username
scm.usernameTitle=Repository username
scm.welcome=Welcome on SCMWebEditor
Modified: trunk/src/main/resources/i18n/scmwebeditor_fr_FR.properties
===================================================================
--- trunk/src/main/resources/i18n/scmwebeditor_fr_FR.properties 2011-08-16 23:13:01 UTC (rev 217)
+++ trunk/src/main/resources/i18n/scmwebeditor_fr_FR.properties 2011-08-17 16:00:44 UTC (rev 218)
@@ -2,6 +2,8 @@
scm.badPathOrFileName=L''adresse du depot ou le nom du fichier est incorrect, ou le fichier n''est pas editable \!
scm.badUsernameOrPassword=Identifiant ou mot de passe incorrect
scm.beTransferred=Vous devriez etre redirige sur une nouvelle page. si non
+scm.by=Par
+scm.cannotSave=Modification impossible
scm.clickHere=cliquez ici
scm.commitMessage=Message associe au commit
scm.commitMessageTitle=laisser un message pour le commit
@@ -9,13 +11,16 @@
scm.exit=Quitter
scm.exitJavascript=Quitter ScmWebEditor sans sauvegarder ? Toutes les modifications serons perdues.
scm.exitTitle=Quitter ScmWebEditor sans sauvegarder.
+scm.fileModify=Fichier modifie pendant l'edition.
+scm.forceSave=Forcer la sauvegarde
scm.formTransferred=Vous devriez etre redirige vers la page du formulaire. si non
scm.info.ProblemWithRst=Si vous rencontrez des problemes avec RestruturedText, visitez le
scm.info.rstWebsite=site de la documentation RST
scm.language=Langage
+scm.lastChangeSave=Derniere sauvegarde effectuee
scm.logAs=Connecte en tant que \:
scm.loginButton=Connexion
-scm.modificationViewer.betterUseJavascript=
+scm.modificationViewer.betterUseJavascript=Activer Javascript pour acceder a toute les fonctionnalitees.
scm.modificationViewer.noJavascript=Javascript est desactive. Vous pouvais seulement utiliser les boutons sauvegarder et quitter, quitter ou upload.
scm.mustBeLog=Vous devez vous identifier pour parcourir ce depot.
scm.no=Non
@@ -25,6 +30,7 @@
scm.outConnection.search=Chercher
scm.password=Mot de passe
scm.passwordTitle=Mot de passe du depot
+scm.pathError=erreur dans le chemin
scm.preview=Apercu
scm.privateScmAccess=Pour modifier ce fichier, veuillez vous connecter.
scm.redirection=Redirection...
@@ -35,13 +41,15 @@
scm.saveAndContinueTitle=Enregister les modifications sur le depot et continuer d''editer le fichier
scm.saveAndQuit=Sauvegarder et quitter
scm.saveAndQuitTitle=Sauvegarder le fichier sur le depot et retourner à la page precedente.
+scm.showDiff=Voir les differences
scm.text=Texte
-scm.thankUsing=merci d'avoir utilise SCMWebEditor
+scm.thankUsing=merci d''avoir utilise SCMWebEditor
scm.upload=Ajouter un fichier
scm.uploadFile=Url du fichier
scm.uploadPath=Repertoire sur le depot
scm.uploadSuccess=Fichier telecharche avec succes
scm.uploadTitle=Ajouter un fichier sur le depot
+scm.uselessSave=Inutile de sauvegarder le fichier, aucune modification n''ont ete apporte
scm.username=Identifiant
scm.usernameTitle=Identifiant du depot
scm.welcome=Bienvenue sur SCMWebEditor
Modified: trunk/src/main/resources/struts.xml
===================================================================
--- trunk/src/main/resources/struts.xml 2011-08-16 23:13:01 UTC (rev 217)
+++ trunk/src/main/resources/struts.xml 2011-08-17 16:00:44 UTC (rev 218)
@@ -22,6 +22,7 @@
<result name="error">/WEB-INF/content/badFileRedirect.jsp</result>
<result name="errorPath">/WEB-INF/content/badFileRedirect.jsp</result>
<result name="errorRst">/WEB-INF/content/badRstFile.jsp</result>
+ <result name="fileModify">/WEB-INF/content/fileModify.jsp</result>
</action>
<action name="save" class="org.nuiton.scmwebeditor.actions.SaveAction" method="save">
Modified: trunk/src/main/webapp/WEB-INF/content/badRstFile.jsp
===================================================================
--- trunk/src/main/webapp/WEB-INF/content/badRstFile.jsp 2011-08-16 23:13:01 UTC (rev 217)
+++ trunk/src/main/webapp/WEB-INF/content/badRstFile.jsp 2011-08-17 16:00:44 UTC (rev 218)
@@ -10,6 +10,8 @@
<link rel="stylesheet" type="text/css" href="css/main.css">
</head>
<body>
+<a target="_blank" href="http://maven-site.nuiton.org/scmwebeditor/"><img src="img/ScmWebEditor_main.png" alt="$alt" /></a>
+
<form id="forceCommitForm" method="POST" action="commit.action" >
<h4><s:text name="scm.rstNotValidMessage" /></h4>
Added: trunk/src/main/webapp/WEB-INF/content/fileModify.jsp
===================================================================
--- trunk/src/main/webapp/WEB-INF/content/fileModify.jsp (rev 0)
+++ trunk/src/main/webapp/WEB-INF/content/fileModify.jsp 2011-08-17 16:00:44 UTC (rev 218)
@@ -0,0 +1,69 @@
+<%@ page language="java" contentType="text/html; charset=UTF-8"
+ pageEncoding="UTF-8"%>
+<%@ taglib prefix="s" uri="/struts-tags"%>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title><s:text name="scm.fileModify" /></title>
+<link rel="stylesheet" type="text/css" href="css/main.css">
+</head>
+<body>
+<a target="_blank" href="http://maven-site.nuiton.org/scmwebeditor/"><img src="img/ScmWebEditor_main.png" alt="$alt" /></a>
+
+
+
+
+ <form id="forceCommitForm" method="POST" action="commit.action" >
+ <h4><s:text name="scm.fileModify" /> <s:text name="scm.by" /> <s:property value="headCommiter" /></h4>
+
+ <s:set id="scm.showDiff" >
+ <s:text name="scm.showDiff" />
+ </s:set>
+ <s:submit value="%{scm.showDiff}" onclick="getElementById('diffArea').style.display='inline';return false;" />
+
+ <s:set id="diff" >
+ <s:property value="diff" />
+ </s:set>
+ <s:textarea id="diffArea" cssStyle="display:none" rows="20" cols="80" value="%{diff}" />
+
+
+ <input type="hidden" name="force" value="true"/>
+ <s:hidden name="address" value="%{address}" />
+ <s:hidden name="commitMessage" value="%{commitMessage}" />
+ <s:hidden name="newText" value="%{newText}" />
+ <s:hidden name="lastText" value="%{lastText}" />
+ <s:hidden name="fileType" value="%{fileType}" />
+ <s:hidden name="projectUrl" value="%{projectUrl}" />
+ <s:hidden name="format" value="%{format}" />
+
+ <s:hidden name="username" value="%{username}" />
+ <s:hidden name="pw" value="%{pw}" />
+
+
+ <s:set id="scm.forceSave">
+ <s:text name="scm.forceSave"/>
+ </s:set>
+
+ <input type="hidden" name="force" value="true"/>
+ <s:submit
+ id="ajaxForceSaveButton"
+ formIds="editForm"
+ indicator="indicator"
+ button="true"
+ buttonIcon="ui-icon-refresh"
+ value="%{scm.forceSave}"
+ >
+ </s:submit>
+
+
+ <s:set id="scm.exit">
+ <s:text name="scm.exit"/>
+ </s:set>
+ <s:submit type="button" value="%{scm.exit}" onclick="history.back();return false;" />
+
+
+ </form>
+
+</body>
+</html>
\ No newline at end of file
Modified: trunk/src/main/webapp/WEB-INF/content/modificationViewer.jsp
===================================================================
--- trunk/src/main/webapp/WEB-INF/content/modificationViewer.jsp 2011-08-16 23:13:01 UTC (rev 217)
+++ trunk/src/main/webapp/WEB-INF/content/modificationViewer.jsp 2011-08-17 16:00:44 UTC (rev 218)
@@ -85,7 +85,8 @@
%>
<p>
- <s:text name="scm.FileInEditor"/><a href="<%=request.getAttribute("address")%>" ><%=request.getAttribute("address")%></a>
+ <s:text name="scm.FileInEditor"/><a href="<%=request.getAttribute("address")%>" ><%=request.getAttribute("address")%></a>
+ at revision <span id="numrevisionDiv"><s:property value="numRevision" /></span>
</p>
<textarea id="newTextId" rows="50" cols="80" name="newText"><%=valueTextarea%></textarea>
@@ -152,12 +153,10 @@
<s:text name="scm.commitMessageTitle"/>
</s:set>
- <s:textfield required="true" label="%{scm.commitMessage}" name="commitMessage" title="%{scm.commitMessageTitle}" />
+ <s:textfield required="true" label="%{scm.commitMessage} " name="commitMessage" title="%{scm.commitMessageTitle}" />
- <p>
+ <p>
-
-
<s:if test="username==null || pw==null" >
<s:set id="scm.username">
<s:text name="scm.username"/>
Modified: trunk/src/main/webapp/WEB-INF/content/reset.jsp
===================================================================
--- trunk/src/main/webapp/WEB-INF/content/reset.jsp 2011-08-16 23:13:01 UTC (rev 217)
+++ trunk/src/main/webapp/WEB-INF/content/reset.jsp 2011-08-17 16:00:44 UTC (rev 218)
@@ -16,5 +16,9 @@
editor.mirror.setValue(document.getElementById('valueOfLastRevision').value);
+ var numrev = <%=request.getAttribute("numRevision")%>;
+ if(numrev!=null) {
+ document.getElementById('numrevisionDiv').innerHTML=numrev;
+ }
</script>
</s:else>
\ No newline at end of file
Modified: trunk/src/main/webapp/WEB-INF/content/save.jsp
===================================================================
--- trunk/src/main/webapp/WEB-INF/content/save.jsp 2011-08-16 23:13:01 UTC (rev 217)
+++ trunk/src/main/webapp/WEB-INF/content/save.jsp 2011-08-17 16:00:44 UTC (rev 218)
@@ -4,17 +4,22 @@
<s:if test="result=='login'" >
- <h4> <font color="red"> Bad username or password, can't save modification</font> </h4>
+ <h4> <font color="red"><s:text name="scm.badUsernameOrPassword"/> <s:text name="scm.cannotSave"/></font> </h4>
</s:if>
<s:elseif test="result=='error'" >
- <h4> Can't save modification </h4>
+ <h4> <s:text name="scm.cannotSave" /></h4>
</s:elseif>
<s:elseif test="result=='errorRst'" >
<h4> <s:text name="scm.rstNotValidMessage" /> </h4>
<s:url id="ajaxForceSave" action="save" />
<input type="hidden" name="force" value="true"/>
- <sj:submit onclick="loadChange()"
+
+ <s:set id="scm.yes">
+ <s:text name="scm.yes"/>
+ </s:set>
+
+ <sj:submit
id="ajaxForceSaveButton"
formIds="editForm"
targets="htmlcontentCommit"
@@ -22,24 +27,63 @@
indicator="indicator"
button="true"
buttonIcon="ui-icon-refresh"
- value="YES"
+ value="%{scm.yes}"
>
</sj:submit>
</s:elseif>
+
+ <s:elseif test="result=='fileModify'" >
+ <h4><s:text name="scm.fileModify" /> <s:text name="scm.by" /> <s:property value="headCommiter" /></h4>
+
+ <s:set id="scm.showDiff" >
+ <s:text name="scm.showDiff" />
+ </s:set>
+ <s:submit value="%{scm.showDiff}" onclick="getElementById('diffArea').style.display='inline';return false;" />
+
+ <s:set id="diff" >
+ <s:property value="diff" />
+ </s:set>
+ <s:textarea id="diffArea" cssStyle="display:none" rows="20" cols="80" value="%{diff}" />
+ <s:url id="ajaxForceSave" action="save" />
+
+ <input type="hidden" name="force" value="true"/>
+
+ <s:set id="scm.forceSave">
+ <s:text name="scm.forceSave"/>
+ </s:set>
+ <sj:submit
+ id="ajaxForceSaveButton"
+ formIds="editForm"
+ targets="htmlcontentCommit"
+ href="%{ajaxForceSave}"
+ indicator="indicator"
+ button="true"
+ buttonIcon="ui-icon-refresh"
+ value="%{scm.forceSave}"
+ >
+ </sj:submit>
+
+ </s:elseif>
+
<s:elseif test="result=='errorPath'" >
- <h4> Can't save modification, Path Error</h4>
+ <h4><s:text name="scm.cannotSave"/>, <s:text name="scm.pathError"/></h4>
</s:elseif>
+
<s:elseif test="result=='uselessSave'" >
- <h4> It's useless to save the file, file is not modify</h4>
+ <h4><s:text name="scm.uselessSave"/></h4>
</s:elseif>
+
<s:else>
- <h4>Last change save <s:property value="formatDate" /> </h4>
+ <h4><s:text name="scm.lastChangeSave"/><s:property value="formatDate" /> </h4>
<s:set id="lastRevSet" value="newText" />
<s:hidden id="lastRev" value="%{lastRevSet}" />
<script type="text/javascript">
origText = document.getElementById("origText");
origText.value = document.getElementById("lastRev").value;
-
+ var numrev = <%=request.getAttribute("numRevision")%>;
+ if(numrev!=null) {
+ document.getElementById('numrevisionDiv').innerHTML=numrev;
+ }
</script>
</s:else>
\ No newline at end of file
Modified: trunk/src/main/webapp/css/main.css
===================================================================
--- trunk/src/main/webapp/css/main.css 2011-08-16 23:13:01 UTC (rev 217)
+++ trunk/src/main/webapp/css/main.css 2011-08-17 16:00:44 UTC (rev 218)
@@ -37,7 +37,7 @@
width:30%
}
-#wwctrl_Save, #wwctrl_Cancel, #wwctrl_uploadButton {
+#wwctrl_Save, #wwctrl_Cancel, #wwctrl_uploadButton, #wwctrl_ {
text-align:center;
}
1
0
Author: tchemit
Date: 2011-08-17 01:13:01 +0200 (Wed, 17 Aug 2011)
New Revision: 217
Url: http://nuiton.org/repositories/revision/scmwebeditor/217
Log:
Update mavenpom4redmine to 3.0.1.
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-08-16 10:31:44 UTC (rev 216)
+++ trunk/pom.xml 2011-08-16 23:13:01 UTC (rev 217)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmine</artifactId>
- <version>3.0</version>
+ <version>3.0.1</version>
</parent>
<artifactId>scmwebeditor</artifactId>
1
0
r216 - trunk/src/main/java/org/nuiton/scmwebeditor/actions
by kcardineaud@users.nuiton.org 16 Aug '11
by kcardineaud@users.nuiton.org 16 Aug '11
16 Aug '11
Author: kcardineaud
Date: 2011-08-16 12:31:44 +0200 (Tue, 16 Aug 2011)
New Revision: 216
Url: http://nuiton.org/repositories/revision/scmwebeditor/216
Log:
It is now possible to create directory on repository when upload a file
Modified:
trunk/src/main/java/org/nuiton/scmwebeditor/actions/UploadAction.java
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/actions/UploadAction.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/actions/UploadAction.java 2011-08-16 08:49:20 UTC (rev 215)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/actions/UploadAction.java 2011-08-16 10:31:44 UTC (rev 216)
@@ -217,9 +217,9 @@
try {
if (log.isDebugEnabled()) {
- log.debug("Do Checkout of " + svnPath);
+ log.debug("Do Checkout of " + svnRoot);
}
- upclient.doCheckout(SVNURL.parseURIEncoded(svnPath), checkoutDir,
+ upclient.doCheckout(SVNURL.parseURIEncoded(svnRoot), checkoutDir,
SVNRevision.HEAD, SVNRevision.HEAD, SVNDepth.INFINITY, false);
} catch (SVNAuthenticationException authexep) {
@@ -244,22 +244,22 @@
- //On test si le chemin commence par un / si non, on l'ajoute
- if(!svnPath.startsWith("/")) {
- svnPath="/"+svnPath;
- }
+// //On test si le chemin commence par un / si non, on l'ajoute
+// if(!svnPath.startsWith("/")) {
+// svnPath="/"+svnPath;
+// }
//On test si le chemin se termine par un / si non, on l'ajoute
if(!svnPath.endsWith("/")) {
svnPath+=("/");
}
-
+
//Copy file in checkourdir
String checkoutPath = checkoutDir.getAbsolutePath();
-// File file = new File(checkoutPath+svnPath,uploadFileName);
- File file = new File(checkoutPath,uploadFileName);
+ File file = new File(checkoutPath+svnPath.replace(svnRoot, ""),uploadFileName);
+
try {
FileUtils.copyFile(upload, file);
} catch (IOException e) {
@@ -281,7 +281,7 @@
try {
if(log.isDebugEnabled()) {
- log.debug("leSvnPath : "+checkoutPath+uploadFileName);
+ log.debug("leSvnPath : "+file.toString());
}
//On ajoute le repertoire
@@ -289,7 +289,7 @@
if(log.isDebugEnabled()) {
log.debug("Add success !");
}
- //On ajoute l'image aux fichiers versionnés
+ //On ajoute le fichier aux fichiers versionnés
}
catch (SVNException e) {
1
0
r215 - in trunk/src/main: java/org/nuiton/scmwebeditor java/org/nuiton/scmwebeditor/actions webapp/WEB-INF/content webapp/js
by kcardineaud@users.nuiton.org 16 Aug '11
by kcardineaud@users.nuiton.org 16 Aug '11
16 Aug '11
Author: kcardineaud
Date: 2011-08-16 10:49:20 +0200 (Tue, 16 Aug 2011)
New Revision: 215
Url: http://nuiton.org/repositories/revision/scmwebeditor/215
Log:
svn tree can now be use with repository that is read/write protect
Modified:
trunk/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorBaseAction.java
trunk/src/main/java/org/nuiton/scmwebeditor/SvnConnection.java
trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java
trunk/src/main/java/org/nuiton/scmwebeditor/actions/UploadAction.java
trunk/src/main/webapp/WEB-INF/content/save.jsp
trunk/src/main/webapp/WEB-INF/content/uploadForm.jsp
trunk/src/main/webapp/js/pictureUpload.js
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorBaseAction.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorBaseAction.java 2011-08-12 14:29:54 UTC (rev 214)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorBaseAction.java 2011-08-16 08:49:20 UTC (rev 215)
@@ -211,7 +211,7 @@
}
upclient.doCheckout(svnSess.getRemoteUrl(), checkoutdir,
SVNRevision.HEAD, SVNRevision.HEAD, SVNDepth.FILES, false);
-
+
}
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/SvnConnection.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/SvnConnection.java 2011-08-12 14:29:54 UTC (rev 214)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/SvnConnection.java 2011-08-16 08:49:20 UTC (rev 215)
@@ -155,6 +155,18 @@
return repositoryRoot;
}
+
+
+ public void testConnection() throws SVNException {
+ SVNRepository repository = SVNRepositoryFactory.create(SVNURL.parseURIDecoded(addressSvn));
+ repository.setAuthenticationManager(this.authManager);
+
+
+ repository.testConnection();
+
+
+ }
+
public ISVNAuthenticationManager getAuthManager() {
return authManager;
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java 2011-08-12 14:29:54 UTC (rev 214)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java 2011-08-16 08:49:20 UTC (rev 215)
@@ -232,6 +232,9 @@
return Action.LOGIN;
} catch (SVNException e) {
+ if(log.isErrorEnabled()) {
+ log.error("Can't checkout the file",e);
+ }
//Suppression du repertoire temporaire
delTempDirectory(checkoutdir);
return "errorPath";
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/actions/UploadAction.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/actions/UploadAction.java 2011-08-12 14:29:54 UTC (rev 214)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/actions/UploadAction.java 2011-08-16 08:49:20 UTC (rev 215)
@@ -164,7 +164,19 @@
svnConn.updateAuthentication( username, pw);
+ try {
+ svnConn.testConnection();
+ } catch (SVNException e) {
+ if(log.isDebugEnabled()) {
+ log.debug("Test connection fail",e);
+ }
+ getScmSession().delScmUser(repositoryUUID);
+ username = null;
+ pw = null;
+ }
+
+
//Si il n'y a pas de fichier à uploader on retourne sur le formulaire d'upload
if(upload==null) {
return "redirect";
@@ -309,6 +321,7 @@
badLogin=true;
//Suppression du repertoire temporaire
delTempDirectory(checkoutDir);
+ getScmSession().delScmUser(repositoryUUID);
return Action.LOGIN;
}
catch (SVNException e) {
Modified: trunk/src/main/webapp/WEB-INF/content/save.jsp
===================================================================
--- trunk/src/main/webapp/WEB-INF/content/save.jsp 2011-08-12 14:29:54 UTC (rev 214)
+++ trunk/src/main/webapp/WEB-INF/content/save.jsp 2011-08-16 08:49:20 UTC (rev 215)
@@ -28,7 +28,7 @@
</s:elseif>
<s:elseif test="result=='errorPath'" >
- <h4> Can't save modification, RST is not valid</h4>
+ <h4> Can't save modification, Path Error</h4>
</s:elseif>
<s:elseif test="result=='uselessSave'" >
<h4> It's useless to save the file, file is not modify</h4>
Modified: trunk/src/main/webapp/WEB-INF/content/uploadForm.jsp
===================================================================
--- trunk/src/main/webapp/WEB-INF/content/uploadForm.jsp 2011-08-12 14:29:54 UTC (rev 214)
+++ trunk/src/main/webapp/WEB-INF/content/uploadForm.jsp 2011-08-16 08:49:20 UTC (rev 215)
@@ -13,6 +13,9 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>UploadFile</title>
<link rel="stylesheet" type="text/css" href="css/main.css">
+
+
+
</head>
<body>
@@ -23,15 +26,18 @@
var item = event.originalEvent.data.rslt.obj;
if(item.text().indexOf("/") != -1) {
- window.document.getElementById("svnPath").value=item.attr("id");
+ window.document.getElementById("svnPath").value=item.attr("id");
}
});
</script>
+ <s:set id="scm.upload">
+ <s:text name="scm.upload"/>
+ </s:set>
+ <center><h1><s:text name="%{scm.upload}" ></s:text></h1></center>
-
<form method="POST" id="uploadForm" action="doUpload.action" enctype="multipart/form-data">
<label><s:text name="scm.uploadFile" /> : <input type="file" name="upload"/></label><br/>
<label><s:text name="scm.uploadPath" /> : <s:textfield size="50px" type="text" name="svnPath" id="svnPath" value="%{fileRoot}" /></label><br/>
@@ -39,7 +45,7 @@
<div id="searchTree">
- <s:url id="searchTreeUrl" action="search?address=%{svnRoot}" />
+ <s:url id="searchTreeUrl" action="search?address=%{svnRoot}&username=%{username}&pw=%{pw}" />
<sjt:tree id="svnTree"
htmlTitles="true"
jstreetheme="classic"
Modified: trunk/src/main/webapp/js/pictureUpload.js
===================================================================
--- trunk/src/main/webapp/js/pictureUpload.js 2011-08-12 14:29:54 UTC (rev 214)
+++ trunk/src/main/webapp/js/pictureUpload.js 2011-08-16 08:49:20 UTC (rev 215)
@@ -1,5 +1,5 @@
function upload_popup(page, name, fileAddress)
{
var address = fileAddress.value;
- window.open (page+'?address='+address, name, config='top=300, left=300, height=300, width=500, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no')
+ window.open (page+'?address='+address, name, config='top=200, left=300, height=600, width=700, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no')
}
\ No newline at end of file
1
0
r214 - in trunk/src/main: java/org/nuiton/scmwebeditor/actions webapp/WEB-INF/content
by kcardineaud@users.nuiton.org 12 Aug '11
by kcardineaud@users.nuiton.org 12 Aug '11
12 Aug '11
Author: kcardineaud
Date: 2011-08-12 16:29:54 +0200 (Fri, 12 Aug 2011)
New Revision: 214
Url: http://nuiton.org/repositories/revision/scmwebeditor/214
Log:
Remove java code, use for authentification, from jsp
Modified:
trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java
trunk/src/main/java/org/nuiton/scmwebeditor/actions/UploadAction.java
trunk/src/main/webapp/WEB-INF/content/modificationViewer.jsp
trunk/src/main/webapp/WEB-INF/content/uploadForm.jsp
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java 2011-08-12 13:25:23 UTC (rev 213)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java 2011-08-12 14:29:54 UTC (rev 214)
@@ -133,8 +133,11 @@
return false;
}
}
-
+// public void prepare() {
+//
+// }
+
/**
* Methode principale de la classe
* @return
@@ -225,9 +228,6 @@
String originalText = "";
- String login = this.getUsername();
- String password = this.getPw();
-
//Si le repo n'est pas protege en ecriture on recupere sont UUID
String repositoryUUID = svnConn.getUUID();
if (repositoryUUID==null) {
@@ -235,25 +235,25 @@
}
if(log.isDebugEnabled()) {
- log.debug("Login : "+login);
+ log.debug("Login : "+username);
}
- if(login==null && password==null) {
+ if(username==null && pw==null) {
if(getScmSession().getUsername(repositoryUUID)!=null && getScmSession().getPassword(repositoryUUID)!=null) {
//On recupère les identifiants en session
- login = getScmSession().getUsername(repositoryUUID);
- password = getScmSession().getPassword(repositoryUUID);
+ username = getScmSession().getUsername(repositoryUUID);
+ pw = getScmSession().getPassword(repositoryUUID);
}
else {
- login = "anonymous";
- password = "anonymous";
+ username = null;
+ pw = null;
}
}
else {
- getScmSession().addScmUser(repositoryUUID, login , password);
+ getScmSession().addScmUser(repositoryUUID, username , pw);
}
- svnConn.updateAuthentication(login, password);
+ svnConn.updateAuthentication(username, pw);
try {
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/actions/UploadAction.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/actions/UploadAction.java 2011-08-12 13:25:23 UTC (rev 213)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/actions/UploadAction.java 2011-08-12 14:29:54 UTC (rev 214)
@@ -106,6 +106,11 @@
}
+// public void prepare() {
+//
+// }
+
+
public String execute() {
SvnConnection svnConnection = new SvnConnection(address);
@@ -118,19 +123,7 @@
}
- if(upload==null) {
- return "redirect";
- }
- badLogin=false;
- error=false;
-
- if(log.isDebugEnabled()) {
- log.debug("FileName : "+uploadFileName);
- log.debug("ContentType : "+uploadContentType);
- }
-
-
SvnConnection svnConn = null;
try {
@@ -145,34 +138,50 @@
}
- String login = this.getUsername();
- String password = this.getPw();
-
+
//Si le repo n'est pas protege en ecriture on recupere sont UUID
String repositoryUUID = svnConn.getUUID();
if (repositoryUUID==null) {
repositoryUUID=address;
}
-
- if(login==null && password==null) {
+
+ if(username==null && pw==null) {
if(getScmSession().getUsername(repositoryUUID)!=null && getScmSession().getPassword(repositoryUUID)!=null) {
//On recupère les identifiants en session
- login = getScmSession().getUsername(repositoryUUID);
- password = getScmSession().getPassword(repositoryUUID);
+ username = getScmSession().getUsername(repositoryUUID);
+ pw = getScmSession().getPassword(repositoryUUID);
}
else {
- login = "anonymous";
- password = "anonymous";
+ username = null;
+ pw = null;
}
}
else {
- getScmSession().addScmUser(repositoryUUID, login , password);
+ getScmSession().addScmUser(repositoryUUID, username , pw);
}
+
- svnConn.updateAuthentication( login, password);
+ svnConn.updateAuthentication( username, pw);
+ //Si il n'y a pas de fichier à uploader on retourne sur le formulaire d'upload
+ if(upload==null) {
+ return "redirect";
+ }
+
+ badLogin=false;
+ error=false;
+
+ if(log.isDebugEnabled()) {
+ log.debug("FileName : "+uploadFileName);
+ log.debug("ContentType : "+uploadContentType);
+ }
+
+
+
+
+
/*
* Checkout process
*/
@@ -321,7 +330,7 @@
}
if(log.isInfoEnabled()) {
- log.info(login + " with IP "+request.getRemoteAddr()+" add the file "+this.getUploadFileName()+" on the repository.");
+ log.info(username + " with IP "+request.getRemoteAddr()+" add the file "+this.getUploadFileName()+" on the repository.");
}
return SUCCESS;
Modified: trunk/src/main/webapp/WEB-INF/content/modificationViewer.jsp
===================================================================
--- trunk/src/main/webapp/WEB-INF/content/modificationViewer.jsp 2011-08-12 13:25:23 UTC (rev 213)
+++ trunk/src/main/webapp/WEB-INF/content/modificationViewer.jsp 2011-08-12 14:29:54 UTC (rev 214)
@@ -157,31 +157,8 @@
<p>
-<%
-Object obj = session.getAttribute("ScmSession");
-String usernameSvn = null;
-String passwordSvn = null;
-if(obj!=null) {
- ScmSession scmSession = (ScmSession) obj;
-
- if(request.getAttribute("address")!=null) {
- String address = request.getAttribute("address").toString();
- address = scmSession.getUUID(address);
-
- if(address==null) {
- address = request.getAttribute("address").toString();
- }
- usernameSvn = scmSession.getUsername(address);
- passwordSvn = scmSession.getPassword(address);
-
- }
-
-}
-%>
-<%
- if (usernameSvn==null || passwordSvn==null) {
-%>
+ <s:if test="username==null || pw==null" >
<s:set id="scm.username">
<s:text name="scm.username"/>
</s:set>
@@ -198,53 +175,12 @@
<s:textfield accesskey="U" size="12" label="%{scm.username}" name="username" title="%{scm.usernameTitle}" />
<s:password accesskey="P" size="12" label="%{scm.password}" name="pw" title="%{scm.passwordTitle}" />
</div>
- <%
- } else {
-%>
- <s:text name="scm.logAs" /> <%=usernameSvn%> <br/>
+ </s:if>
+ <s:else >
+ <s:text name="scm.logAs" /> <s:property value="username" /> <br/>
+ </s:else>
-<% } %>
-
-
-
-<%-- <s:set name="addressSvn"> --%>
-<%-- <s:property value="address" /> --%>
-<%-- </s:set> --%>
-<%-- <s:set name="usernameSvn"> --%>
-<%-- <s:property value="#session.ScmSession"/> --%>
-<%-- </s:set> --%>
-<%-- <s:set name="passwordSvn"> --%>
-<%-- <s:property value="#session.ScmSession"/> --%>
-<%-- </s:set> --%>
-<%-- <h1><s:property value="%{usernameSvn}" /></h1> --%>
-<%-- <h1><s:property value="%{passwordSvn}" /></h1> --%>
-
-<%-- <s:if test="%{username}==null"> --%>
-<%-- <s:set id="scm.username"> --%>
-<%-- <s:text name="scm.username"/> --%>
-<%-- </s:set> --%>
-<%-- <s:set id="scm.usernameTitle"> --%>
-<%-- <s:text name="scm.usernameTitle"/> --%>
-<%-- </s:set> --%>
-<%-- <s:set id="scm.password"> --%>
-<%-- <s:text name="scm.password"/> --%>
-<%-- </s:set> --%>
-<%-- <s:set id="scm.passwordTitle"> --%>
-<%-- <s:text name="scm.passwordTitle"/> --%>
-<%-- </s:set> --%>
-<!-- <div id="loginDiv"> -->
-<%-- <s:textfield accesskey="U" size="12" label="%{scm.username}" name="username" title="%{scm.usernameTitle}" /> --%>
-<%-- <s:password accesskey="P" size="12" label="%{scm.password}" name="pw" title="%{scm.passwordTitle}" /> --%>
-<!-- </div> -->
-<%-- </s:if> --%>
-<%-- <s:else> --%>
-<%-- Login as : <s:property value="%{username}" /><br/> --%>
-
-<%-- <s:hidden value="%{username}" label="%{scm.username}" name="username" /> --%>
-<%-- <s:hidden value="%{tototo}" label="%{scm.password}" name="pw" /> --%>
-<%-- </s:else> --%>
-
<input type="hidden" name="address" value="<%=request.getAttribute("address")%>"/>
<input type="hidden" id="origText" name="origText" value="<%=request.getAttribute("OrigText")%>"/>
Modified: trunk/src/main/webapp/WEB-INF/content/uploadForm.jsp
===================================================================
--- trunk/src/main/webapp/WEB-INF/content/uploadForm.jsp 2011-08-12 13:25:23 UTC (rev 213)
+++ trunk/src/main/webapp/WEB-INF/content/uploadForm.jsp 2011-08-12 14:29:54 UTC (rev 214)
@@ -49,36 +49,15 @@
</div>
-
- <%
- Object obj = session.getAttribute("ScmSession");
- String usernameSvn = null;
- String passwordSvn = null;
- if(obj!=null) {
- ScmSession scmSession = (ScmSession) obj;
- if(request.getParameter("address")!=null) {
- String address = request.getParameter("address").toString();
- address = scmSession.getUUID(address);
-
- if(address==null) {
- address = request.getParameter("address").toString();
- }
- usernameSvn = scmSession.getUsername(address);
- passwordSvn = scmSession.getPassword(address);
- }
- }
-
- if (usernameSvn==null || passwordSvn==null) {
- %>
+
+ <s:if test="username==null || pw==null" >
<label><s:text name="scm.username" /> : <input type="text" name="username" /></label><br/>
<label><s:text name="scm.password" /> : <input type="password" name="pw" /></label><br/>
- <%
- } else {
- %>
- <s:text name="scm.logAs" /> <%=usernameSvn%> <br/>
- <input type="hidden" value="<%=usernameSvn%>" name="username" />
- <input type="hidden" value="<%=passwordSvn%>" name="pw" />
- <% } %>
+ </s:if>
+
+ <s:else>
+ <s:text name="scm.logAs" /> <s:property value="username" /> <br/>
+ </s:else>
<input type="hidden" name="address" value="<%=request.getParameter("address") %>" />
1
0
r213 - in trunk/src/main: java/org/nuiton/scmwebeditor java/org/nuiton/scmwebeditor/actions webapp/WEB-INF/content
by kcardineaud@users.nuiton.org 12 Aug '11
by kcardineaud@users.nuiton.org 12 Aug '11
12 Aug '11
Author: kcardineaud
Date: 2011-08-12 15:25:23 +0200 (Fri, 12 Aug 2011)
New Revision: 213
Url: http://nuiton.org/repositories/revision/scmwebeditor/213
Log:
Change upload system to a better one that use jquery tree
Modified:
trunk/src/main/java/org/nuiton/scmwebeditor/SvnConnection.java
trunk/src/main/java/org/nuiton/scmwebeditor/actions/UploadAction.java
trunk/src/main/webapp/WEB-INF/content/uploadForm.jsp
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/SvnConnection.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/SvnConnection.java 2011-08-12 08:50:11 UTC (rev 212)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/SvnConnection.java 2011-08-12 13:25:23 UTC (rev 213)
@@ -110,6 +110,10 @@
setManager(SVNClientManager.newInstance(getSvnOption(), getAuthManager()));
}
+ /**
+ *
+ * @return
+ */
public String getUUID() {
String repositoryUUID = null;
try {
@@ -128,6 +132,29 @@
return repositoryUUID;
}
+
+ /**
+ *
+ * @return
+ */
+ public String getSvnRoot() {
+ String repositoryRoot = null;
+ try {
+ SVNRepository repository = SVNRepositoryFactory.create(SVNURL.parseURIDecoded(addressSvn));
+ ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager();
+ repository.setAuthenticationManager(authManager);
+
+ repositoryRoot = repository.getRepositoryRoot(true).toString();
+ }
+ catch (SVNException e) {
+ if(log.isDebugEnabled()) {
+ log.debug("Can't get SvnRoot");
+ }
+ return null;
+ }
+
+ return repositoryRoot;
+ }
public ISVNAuthenticationManager getAuthManager() {
return authManager;
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/actions/UploadAction.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/actions/UploadAction.java 2011-08-12 08:50:11 UTC (rev 212)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/actions/UploadAction.java 2011-08-12 13:25:23 UTC (rev 213)
@@ -12,10 +12,10 @@
import org.apache.struts2.interceptor.ServletRequestAware;
import org.nuiton.scmwebeditor.ScmWebEditorBaseAction;
import org.nuiton.scmwebeditor.SvnConnection;
-import org.nuiton.util.FileUtil;
import org.tmatesoft.svn.core.SVNAuthenticationException;
import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.SVNException;
+import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.wc.SVNClientManager;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc.SVNUpdateClient;
@@ -36,6 +36,8 @@
protected String pw;
protected String svnPath;
protected String address;
+ protected String svnRoot;
+ protected String fileRoot;
protected boolean badLogin;
protected boolean error;
@@ -83,6 +85,10 @@
public void setAddress(String address) {
this.address = address;
}
+
+ public String getAddress() {
+ return this.address;
+ }
public boolean isBadLogin() {
return badLogin;
@@ -90,9 +96,28 @@
public boolean isError() {
return error;
}
-
+
+ public String getSvnRoot() {
+ return svnRoot;
+ }
+
+ public String getFileRoot() {
+ return fileRoot;
+ }
+
+
public String execute() {
+ SvnConnection svnConnection = new SvnConnection(address);
+ svnRoot = svnConnection.getSvnRoot();
+
+ fileRoot = svnConnection.getSvnPath();
+
+ if(svnRoot==null) {
+ svnRoot=fileRoot;
+ }
+
+
if(upload==null) {
return "redirect";
}
@@ -155,8 +180,8 @@
File checkoutDir = null;
try {
- checkoutDir = FileUtil.createTempDirectory("scm_", "");
svnConn.createCheckoutdir();
+ checkoutDir = svnConn.getCheckoutdir();
} catch (IOException e1) {
if(log.isErrorEnabled()) {
log.error("Can't create checkoutDir",e1);
@@ -171,9 +196,9 @@
try {
if (log.isDebugEnabled()) {
- log.debug("Do Checkout of " + svnConn.getRemoteUrl());
+ log.debug("Do Checkout of " + svnPath);
}
- upclient.doCheckout(svnConn.getRemoteUrl(), checkoutDir,
+ upclient.doCheckout(SVNURL.parseURIEncoded(svnPath), checkoutDir,
SVNRevision.HEAD, SVNRevision.HEAD, SVNDepth.INFINITY, false);
} catch (SVNAuthenticationException authexep) {
@@ -211,7 +236,8 @@
//Copy file in checkourdir
String checkoutPath = checkoutDir.getAbsolutePath();
- File file = new File(checkoutPath+svnPath,uploadFileName);
+// File file = new File(checkoutPath+svnPath,uploadFileName);
+ File file = new File(checkoutPath,uploadFileName);
try {
FileUtils.copyFile(upload, file);
@@ -234,7 +260,7 @@
try {
if(log.isDebugEnabled()) {
- log.debug("leSvnPath : "+checkoutPath+svnPath+uploadFileName);
+ log.debug("leSvnPath : "+checkoutPath+uploadFileName);
}
//On ajoute le repertoire
Modified: trunk/src/main/webapp/WEB-INF/content/uploadForm.jsp
===================================================================
--- trunk/src/main/webapp/WEB-INF/content/uploadForm.jsp 2011-08-12 08:50:11 UTC (rev 212)
+++ trunk/src/main/webapp/WEB-INF/content/uploadForm.jsp 2011-08-12 13:25:23 UTC (rev 213)
@@ -1,19 +1,55 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@page import="org.nuiton.scmwebeditor.ScmSession"%>
+ <%@page import="org.nuiton.scmwebeditor.SvnConnection"%>
+
<%@ taglib prefix="s" uri="/struts-tags"%>
+ <%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
+ <%@ taglib prefix="sjt" uri="/struts-jquery-tree-tags" %>
+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>UploadFile</title>
+<link rel="stylesheet" type="text/css" href="css/main.css">
</head>
<body>
+<sj:head debug="true" jquerytheme="default"/>
+
+<script>
+$.subscribe('treeClicked', function(event, data) {
+ var item = event.originalEvent.data.rslt.obj;
+
+ if(item.text().indexOf("/") != -1) {
+ window.document.getElementById("svnPath").value=item.attr("id");
+ }
+
+});
+
+</script>
+
+
+
<form method="POST" id="uploadForm" action="doUpload.action" enctype="multipart/form-data">
<label><s:text name="scm.uploadFile" /> : <input type="file" name="upload"/></label><br/>
- <label><s:text name="scm.uploadPath" /> : <input type="text" name="svnPath" /></label><br/>
+ <label><s:text name="scm.uploadPath" /> : <s:textfield size="50px" type="text" name="svnPath" id="svnPath" value="%{fileRoot}" /></label><br/>
+
+ <div id="searchTree">
+
+ <s:url id="searchTreeUrl" action="search?address=%{svnRoot}" />
+ <sjt:tree id="svnTree"
+ htmlTitles="true"
+ jstreetheme="classic"
+ href="%{searchTreeUrl}"
+ onClickTopics="treeClicked"
+ />
+
+ </div>
+
+
<%
Object obj = session.getAttribute("ScmSession");
String usernameSvn = null;
1
0
r212 - in trunk/src/main/java/org/nuiton/scmwebeditor: . actions
by kcardineaud@users.nuiton.org 12 Aug '11
by kcardineaud@users.nuiton.org 12 Aug '11
12 Aug '11
Author: kcardineaud
Date: 2011-08-12 10:50:11 +0200 (Fri, 12 Aug 2011)
New Revision: 212
Url: http://nuiton.org/repositories/revision/scmwebeditor/212
Log:
Add a method that get the last revision of a file, on the repository, in base action
Modified:
trunk/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorBaseAction.java
trunk/src/main/java/org/nuiton/scmwebeditor/actions/ResetAction.java
trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorBaseAction.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorBaseAction.java 2011-08-11 13:11:10 UTC (rev 211)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorBaseAction.java 2011-08-12 08:50:11 UTC (rev 212)
@@ -36,8 +36,14 @@
import org.apache.tika.sax.BodyContentHandler;
import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.SVNException;
+import org.tmatesoft.svn.core.SVNNodeKind;
+import org.tmatesoft.svn.core.SVNURL;
+import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager;
+import org.tmatesoft.svn.core.io.SVNRepository;
+import org.tmatesoft.svn.core.io.SVNRepositoryFactory;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc.SVNUpdateClient;
+import org.tmatesoft.svn.core.wc.SVNWCUtil;
import org.xml.sax.SAXException;
import com.opensymphony.xwork2.ActionContext;
@@ -190,7 +196,12 @@
}
}
-
+ /**
+ *
+ * @param svnSess
+ * @param checkoutdir
+ * @throws SVNException
+ */
public void checkout(SvnConnection svnSess, File checkoutdir) throws SVNException {
SVNUpdateClient upclient = new SVNUpdateClient(svnSess.getManager(), svnSess.getSvnOption());
@@ -204,6 +215,93 @@
}
+ /**
+ *
+ * @param svnFile
+ * @param username
+ * @param password
+ * @return
+ * @throws SVNException
+ * @throws IOException
+ */
+ public String getHeadRevision(String address, String login, String password) throws SVNException {
+
+ String lastRevision = "";
+
+ SvnConnection svnConn = null;
+
+ svnConn = new SvnConnection(address);
+
+
+ String url = svnConn.getSvnPath();
+ String file = svnConn.getFileName();
+
+ //Si le repo n'est pas protege en ecriture on recupere sont UUID
+ String repositoryUUID = svnConn.getUUID();
+ if (repositoryUUID==null) {
+ repositoryUUID=address;
+ }
+
+
+ if(login==null && password==null) {
+ if(getScmSession().getUsername(repositoryUUID)!=null && getScmSession().getPassword(repositoryUUID)!=null) {
+ //On recupère les identifiants en session
+ login = getScmSession().getUsername(repositoryUUID);
+ password = getScmSession().getPassword(repositoryUUID);
+ }
+ else {
+ login = "anonymous";
+ password = "anonymous";
+ }
+ }
+ else {
+ getScmSession().addScmUser(repositoryUUID, login , password);
+ }
+
+
+
+ SVNRepository repository = SVNRepositoryFactory.create( SVNURL.parseURIEncoded( url ));
+ ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager( login , password );
+ repository.setAuthenticationManager( authManager );
+
+ SVNNodeKind nodeKind = repository.checkPath( file , -1 );
+
+
+ if ( nodeKind == SVNNodeKind.NONE ) {
+ if(log.isErrorEnabled()) {
+ log.error( "There is no entry at '" + url + "'." );
+ }
+ throw new IllegalArgumentException("There is no entry at '" + url + "'.");
+ } else if ( nodeKind == SVNNodeKind.DIR ) {
+ if(log.isErrorEnabled()) {
+ log.error( "The entry at '" + url + "' is a file while a directory was expected." );
+ }
+ throw new IllegalArgumentException("The entry at '" + url + "' is a file while a directory was expected.");
+ }
+
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream( );
+
+ repository.getFile( file , -1 , null , baos );
+
+ lastRevision = baos.toString();
+
+ try {
+ baos.close();
+ } catch (IOException e) {
+ if(log.isDebugEnabled()) {
+ log.debug("Can't close stream",e);
+ }
+ }
+
+ return lastRevision;
+ }
+
+
+ /**
+ * Use to delete the checkout temp directory
+ * @param checkoutdir The dir temp directory
+ */
public void delTempDirectory(File checkoutdir) {
try {
FileUtils.deleteDirectory(checkoutdir);
@@ -354,6 +452,8 @@
return getScmSession().getPassword(url);
}
+
+
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/actions/ResetAction.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/actions/ResetAction.java 2011-08-11 13:11:10 UTC (rev 211)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/actions/ResetAction.java 2011-08-12 08:50:11 UTC (rev 212)
@@ -1,19 +1,10 @@
package org.nuiton.scmwebeditor.actions;
-import java.io.ByteArrayOutputStream;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.scmwebeditor.ScmWebEditorBaseAction;
-import org.nuiton.scmwebeditor.SvnConnection;
import org.tmatesoft.svn.core.SVNAuthenticationException;
import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.SVNNodeKind;
-import org.tmatesoft.svn.core.SVNURL;
-import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager;
-import org.tmatesoft.svn.core.io.SVNRepository;
-import org.tmatesoft.svn.core.io.SVNRepositoryFactory;
-import org.tmatesoft.svn.core.wc.SVNWCUtil;
import com.opensymphony.xwork2.Action;
@@ -59,94 +50,39 @@
public String execute() {
- SvnConnection svnConn = null;
-
try {
- svnConn = new SvnConnection(address);
- } catch (StringIndexOutOfBoundsException e) {
- if(log.isErrorEnabled()) {
- log.error("Can't reach the svn repository");
- }
- error = "errorPath";
- return "errorPath";
- }
+
+ lastRevision = getHeadRevision(address, username, pw);
- String url = svnConn.getSvnPath();
- String file = svnConn.getFileName();
-
- String login = this.username;
- String password = this.pw;
-
- //Si le repo n'est pas protege en ecriture on recupere sont UUID
- String repositoryUUID = svnConn.getUUID();
- if (repositoryUUID==null) {
- repositoryUUID=address;
- }
-
-
- if(login==null && password==null) {
- if(getScmSession().getUsername(repositoryUUID)!=null && getScmSession().getPassword(repositoryUUID)!=null) {
- //On recupère les identifiants en session
- login = getScmSession().getUsername(repositoryUUID);
- password = getScmSession().getPassword(repositoryUUID);
- }
- else {
- login = "anonymous";
- password = "anonymous";
- }
- }
- else {
- getScmSession().addScmUser(repositoryUUID, login , password);
- }
-
-
- try {
- SVNRepository repository = SVNRepositoryFactory.create( SVNURL.parseURIEncoded( url ) );
- ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager( login , password );
- repository.setAuthenticationManager( authManager );
-
- SVNNodeKind nodeKind = repository.checkPath( file , -1 );
-
-
- if ( nodeKind == SVNNodeKind.NONE ) {
+ } catch (SVNAuthenticationException authexep) {
if(log.isErrorEnabled()) {
- log.error( "There is no entry at '" + url + "'." );
- }
- return Action.SUCCESS;
- } else if ( nodeKind == SVNNodeKind.DIR ) {
- if(log.isErrorEnabled()) {
- log.error( "The entry at '" + url + "' is a file while a directory was expected." );
- }
- return Action.SUCCESS;
- }
-
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream( );
-
- repository.getFile( file , -1 , null , baos );
-
- lastRevision=baos.toString();
-
-
- }
- catch (SVNAuthenticationException authexep) {
- if(log.isErrorEnabled()) {
log.error("AUTH FAIL");
}
error = "authError";
return "authError";
- }
- catch (SVNException e) {
+ } catch (SVNException e1) {
if(log.isErrorEnabled()) {
log.error("Can't reach the svn repository");
}
error = "errorPath";
return "errorPath";
- }
+ } catch (StringIndexOutOfBoundsException e) {
+ if(log.isErrorEnabled()) {
+ log.error("Can't reach the svn repository");
+ }
+ error = "errorPath";
+ return "errorPath";
+ } catch (IllegalArgumentException e) {
+ if(log.isErrorEnabled()) {
+ log.error("Problem with file path",e);
+ }
+ error = "errorPath";
+ return "errorPath";
+ }
return Action.SUCCESS;
-
+
}
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java 2011-08-11 13:11:10 UTC (rev 211)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java 2011-08-12 08:50:11 UTC (rev 212)
@@ -1,6 +1,5 @@
package org.nuiton.scmwebeditor.actions;
-import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.URL;
import java.util.HashMap;
@@ -20,11 +19,6 @@
import org.nuiton.scmwebeditor.urlResolver.ScmUrlResolverEngine;
import org.tmatesoft.svn.core.SVNAuthenticationException;
import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.SVNNodeKind;
-import org.tmatesoft.svn.core.SVNURL;
-import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager;
-import org.tmatesoft.svn.core.io.SVNRepository;
-import org.tmatesoft.svn.core.io.SVNRepositoryFactory;
import com.opensymphony.xwork2.Action;
@@ -233,8 +227,6 @@
String login = this.getUsername();
String password = this.getPw();
- String url = svnConn.getSvnPath();
- String file = svnConn.getFileName();
//Si le repo n'est pas protege en ecriture on recupere sont UUID
String repositoryUUID = svnConn.getUUID();
@@ -263,44 +255,9 @@
svnConn.updateAuthentication(login, password);
- SVNRepository repository = null;
try {
- repository = SVNRepositoryFactory.create( SVNURL.parseURIEncoded( url ) );
- ISVNAuthenticationManager authManager = svnConn.getAuthManager();
- repository.setAuthenticationManager( authManager );
-
- SVNNodeKind nodeKind = repository.checkPath( file , -1 );
-
-
-
-
- if ( nodeKind == SVNNodeKind.NONE ) {
- if(log.isErrorEnabled()) {
- log.error( "There is no entry at '" + url + "'." );
- }
- request.setAttribute("projectUrl", projectUrl);
- return "errorPath";
-
- } else if ( nodeKind == SVNNodeKind.DIR ) {
- if(log.isErrorEnabled()) {
- log.error( "The entry at '" + url + "' is a file while a directory was expected." );
- }
- request.setAttribute("projectUrl", projectUrl);
- if(log.isErrorEnabled()) {
- log.error("Error with svn path or file ");
- }
- return "errorPath";
- }
-
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream( );
-
- //On récupere le contenu du fichier, et on le met dans un outputStream
- repository.getFile( file , -1 , null , baos );
-
- originalText=baos.toString();
- baos.close();
+ originalText = getHeadRevision(address, username, pw);
} catch (SVNAuthenticationException authexep) {
@@ -308,8 +265,10 @@
// if svn authentication failed user is redirected on login page
if(log.isDebugEnabled()) {
- log.debug("Private SCM on reading " + svnConn.getRemoteUrl());
+ log.debug("Auth Fail " ,authexep);
}
+
+ getScmSession().delScmUser(repositoryUUID);
//redirect to a login page
return Action.LOGIN;
@@ -320,12 +279,7 @@
log.error("SVN error ",e);
}
return "errorPath";
- } catch (IOException e) {
- if(log.isErrorEnabled()) {
- log.error("IO error ",e);
- }
- return "errorPath";
- }
+ }
@@ -342,22 +296,6 @@
}
- /*
- String[] mimeTypes =null;
- try {
- mimeTypes = getMimeTypes(originalText, svnConn.getFileName());
-
- log.info("size : "+mimeTypes.length);
-
- for (String element : mimeTypes){
- log.info("Type : "+element);
- }
- } catch (Exception e) {
- log.error("tika error",e);
- }
- */
-
-
Properties properties=null;
String[] editableFiles=null;
1
0
r211 - in trunk/src/main: java/org/nuiton/scmwebeditor/actions resources resources/i18n webapp/WEB-INF/content webapp/css
by kcardineaud@users.nuiton.org 11 Aug '11
by kcardineaud@users.nuiton.org 11 Aug '11
11 Aug '11
Author: kcardineaud
Date: 2011-08-11 15:11:10 +0200 (Thu, 11 Aug 2011)
New Revision: 211
Url: http://nuiton.org/repositories/revision/scmwebeditor/211
Log:
Add a confirmation message when rst is not valid, before commit and quit
Added:
trunk/src/main/webapp/WEB-INF/content/badRstFile.jsp
Modified:
trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java
trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java
trunk/src/main/resources/i18n/scmwebeditor_en_GB.properties
trunk/src/main/resources/i18n/scmwebeditor_fr_FR.properties
trunk/src/main/resources/struts.xml
trunk/src/main/webapp/WEB-INF/content/modificationViewer.jsp
trunk/src/main/webapp/WEB-INF/content/privateSvnRedirect.jsp
trunk/src/main/webapp/WEB-INF/content/save.jsp
trunk/src/main/webapp/css/main.css
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java 2011-08-10 13:01:51 UTC (rev 210)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java 2011-08-11 13:11:10 UTC (rev 211)
@@ -130,7 +130,7 @@
- protected boolean testRstParsing(String newText) {
+ protected boolean isRstValid(String newText) {
try {
JRST.generate(JRST.TYPE_HTML, newText);
if(log.isDebugEnabled()) {
@@ -153,7 +153,7 @@
if(!force) {
if(format.equals("rst")) {
- if(!testRstParsing(newText)) {
+ if(!isRstValid(newText)) {
return "errorRst";
}
}
@@ -184,7 +184,7 @@
log.info("username : |"+login+"|");
- if( ( login==null ) && ( password==null ) ) {
+ if( ( login==null || login.equals("") ) && ( password==null || password.equals("") ) ) {
if(getScmSession().getUsername(repositoryUUID)!=null && getScmSession().getPassword(repositoryUUID)!=null) {
//On recupère les identifiants en session
login = getScmSession().getUsername(repositoryUUID);
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java 2011-08-10 13:01:51 UTC (rev 210)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java 2011-08-11 13:11:10 UTC (rev 211)
@@ -9,10 +9,8 @@
import java.util.Map.Entry;
import java.util.Properties;
-
import javax.servlet.http.HttpServletRequest;
-
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -28,6 +26,7 @@
import org.tmatesoft.svn.core.io.SVNRepository;
import org.tmatesoft.svn.core.io.SVNRepositoryFactory;
+
import com.opensymphony.xwork2.Action;
@@ -61,7 +60,7 @@
protected String repositoryId;
-
+ protected boolean fromLoginPage;
@@ -123,8 +122,11 @@
}
-
+ public void setFromLoginPage(boolean fromLoginPage) {
+ this.fromLoginPage = fromLoginPage;
+ }
+
/**
* On test si les parametres ne sont pas vide
* @return
@@ -160,8 +162,11 @@
// }
- projectUrl=request.getHeader("referer");
+ if(!this.fromLoginPage) {
+ projectUrl=request.getHeader("referer");
+ }
+
if(log.isDebugEnabled()) {
log.debug("ProjectUrl= "+projectUrl);
}
@@ -409,7 +414,7 @@
}
-
+
return "editPage";
@@ -422,10 +427,5 @@
}
-
-
-
-
-
}
Modified: trunk/src/main/resources/i18n/scmwebeditor_en_GB.properties
===================================================================
--- trunk/src/main/resources/i18n/scmwebeditor_en_GB.properties 2011-08-10 13:01:51 UTC (rev 210)
+++ trunk/src/main/resources/i18n/scmwebeditor_en_GB.properties 2011-08-11 13:11:10 UTC (rev 211)
@@ -18,6 +18,7 @@
scm.modificationViewer.betterUseJavascript=For a better use of SCMWebEditor please activate JavaScript.
scm.modificationViewer.noJavascript=Javascript is not activated. You can't only use Save and Quit or upload button.
scm.mustBeLog=You must be login to see this repository.
+scm.no=No
scm.outConnection.enterRepo=Please enter your repository address.
scm.outConnection.noJavascript=Javascript is not activated. Please activate it for a fully use of ScmWebEditor.
scm.outConnection.scmPath=SCM path \:
@@ -29,6 +30,7 @@
scm.redirection=Redirection...
scm.reset=Reset
scm.resetTitle=Go back to the last revision of the file
+scm.rstNotValidMessage=The rst is not valid, do you still want to continue ?
scm.saveAndContinue=Save and Continue Editing
scm.saveAndContinueTitle=Commit modifications and continue editing the file.
scm.saveAndQuit=Save and quit
@@ -43,3 +45,4 @@
scm.username=Username
scm.usernameTitle=Repository username
scm.welcome=Welcome on SCMWebEditor
+scm.yes=Yes
Modified: trunk/src/main/resources/i18n/scmwebeditor_fr_FR.properties
===================================================================
--- trunk/src/main/resources/i18n/scmwebeditor_fr_FR.properties 2011-08-10 13:01:51 UTC (rev 210)
+++ trunk/src/main/resources/i18n/scmwebeditor_fr_FR.properties 2011-08-11 13:11:10 UTC (rev 211)
@@ -18,6 +18,7 @@
scm.modificationViewer.betterUseJavascript=
scm.modificationViewer.noJavascript=Javascript est desactive. Vous pouvais seulement utiliser les boutons sauvegarder et quitter, quitter ou upload.
scm.mustBeLog=Vous devez vous identifier pour parcourir ce depot.
+scm.no=Non
scm.outConnection.enterRepo=Entrez l''adresse de votre depot.
scm.outConnection.noJavascript=Javascript n''est pas active. Certaines fonctions ne serons pas accessible.
scm.outConnection.scmPath=Repertoire SCM \:
@@ -29,6 +30,7 @@
scm.redirection=Redirection...
scm.reset=Reinitialiser
scm.resetTitle=Retour a la derniere revision du fichier
+scm.rstNotValidMessage=The Rst n''est pas valide, voulez-vous continuer ?
scm.saveAndContinue=Sauvegarder et continuer
scm.saveAndContinueTitle=Enregister les modifications sur le depot et continuer d''editer le fichier
scm.saveAndQuit=Sauvegarder et quitter
@@ -43,3 +45,4 @@
scm.username=Identifiant
scm.usernameTitle=Identifiant du depot
scm.welcome=Bienvenue sur SCMWebEditor
+scm.yes=Oui
Modified: trunk/src/main/resources/struts.xml
===================================================================
--- trunk/src/main/resources/struts.xml 2011-08-10 13:01:51 UTC (rev 210)
+++ trunk/src/main/resources/struts.xml 2011-08-11 13:11:10 UTC (rev 211)
@@ -21,7 +21,7 @@
<result name="login" >/WEB-INF/content/modificationViewer.jsp</result>
<result name="error">/WEB-INF/content/badFileRedirect.jsp</result>
<result name="errorPath">/WEB-INF/content/badFileRedirect.jsp</result>
- <result name="errorRst">/WEB-INF/content/badFileRedirect.jsp</result>
+ <result name="errorRst">/WEB-INF/content/badRstFile.jsp</result>
</action>
<action name="save" class="org.nuiton.scmwebeditor.actions.SaveAction" method="save">
Added: trunk/src/main/webapp/WEB-INF/content/badRstFile.jsp
===================================================================
--- trunk/src/main/webapp/WEB-INF/content/badRstFile.jsp (rev 0)
+++ trunk/src/main/webapp/WEB-INF/content/badRstFile.jsp 2011-08-11 13:11:10 UTC (rev 211)
@@ -0,0 +1,50 @@
+<%@ page language="java" contentType="text/html; charset=UTF-8"
+ pageEncoding="UTF-8"%>
+<%@ taglib prefix="s" uri="/struts-tags"%>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>RST is not valid</title>
+<link rel="icon" href="img/ScmWebEditor_little.png" type="image/png">
+<link rel="stylesheet" type="text/css" href="css/main.css">
+</head>
+<body>
+ <form id="forceCommitForm" method="POST" action="commit.action" >
+ <h4><s:text name="scm.rstNotValidMessage" /></h4>
+
+ <input type="hidden" name="force" value="true"/>
+ <s:hidden name="address" value="%{address}" />
+ <s:hidden name="commitMessage" value="%{commitMessage}" />
+ <s:hidden name="newText" value="%{newText}" />
+ <s:hidden name="lastText" value="%{lastText}" />
+ <s:hidden name="fileType" value="%{fileType}" />
+ <s:hidden name="projectUrl" value="%{projectUrl}" />
+ <s:hidden name="format" value="%{format}" />
+
+ <s:hidden name="username" value="%{username}" />
+ <s:hidden name="pw" value="%{pw}" />
+
+
+ <s:set id="scm.yes">
+ <s:text name="scm.yes"/>
+ </s:set>
+
+ <s:submit
+ id="ajaxForceCommitButton"
+ formIds="forceCommitForm"
+ indicator="indicator"
+ button="true"
+ buttonIcon="ui-icon-refresh"
+ value="%{scm.yes}"
+ >
+ </s:submit>
+
+ <s:set id="scm.no">
+ <s:text name="scm.no"/>
+ </s:set>
+ <s:submit type="button" value="%{scm.no}" onclick="history.back();return false;" />
+
+ </form>
+</body>
+</html>
\ No newline at end of file
Modified: trunk/src/main/webapp/WEB-INF/content/modificationViewer.jsp
===================================================================
--- trunk/src/main/webapp/WEB-INF/content/modificationViewer.jsp 2011-08-10 13:01:51 UTC (rev 210)
+++ trunk/src/main/webapp/WEB-INF/content/modificationViewer.jsp 2011-08-11 13:11:10 UTC (rev 211)
@@ -65,7 +65,7 @@
</center>
- <form method="POST" action="commit.action?force=true" id="editForm">
+ <form method="POST" action="commit.action" id="editForm">
<%
if (request.getAttribute("format")!=null){
@@ -153,8 +153,6 @@
</s:set>
<s:textfield required="true" label="%{scm.commitMessage}" name="commitMessage" title="%{scm.commitMessageTitle}" />
-
-
<p>
@@ -204,7 +202,7 @@
} else {
%>
<s:text name="scm.logAs" /> <%=usernameSvn%> <br/>
-
+
<% } %>
Modified: trunk/src/main/webapp/WEB-INF/content/privateSvnRedirect.jsp
===================================================================
--- trunk/src/main/webapp/WEB-INF/content/privateSvnRedirect.jsp 2011-08-10 13:01:51 UTC (rev 210)
+++ trunk/src/main/webapp/WEB-INF/content/privateSvnRedirect.jsp 2011-08-11 13:11:10 UTC (rev 211)
@@ -16,6 +16,7 @@
<a target="_blank" href="http://maven-site.nuiton.org/scmwebeditor/"><img src="img/ScmWebEditor_main.png" alt="$alt" /></a>
<form method="post" action="checkout.action" >
<input type="hidden" name="address" value="<%=request.getAttribute("address")%>"/>
+<input type="hidden" name="fromLoginPage" value="true">
<% if(request.getAttribute("projectUrl")!=null) { %>
<input type="hidden" name="ProjectUrl" value="<%=request.getAttribute("projectUrl")%>"/>
Modified: trunk/src/main/webapp/WEB-INF/content/save.jsp
===================================================================
--- trunk/src/main/webapp/WEB-INF/content/save.jsp 2011-08-10 13:01:51 UTC (rev 210)
+++ trunk/src/main/webapp/WEB-INF/content/save.jsp 2011-08-11 13:11:10 UTC (rev 211)
@@ -11,7 +11,7 @@
</s:elseif>
<s:elseif test="result=='errorRst'" >
- <h4> The rst is not valid, do you still want to continue ? </h4>
+ <h4> <s:text name="scm.rstNotValidMessage" /> </h4>
<s:url id="ajaxForceSave" action="save" />
<input type="hidden" name="force" value="true"/>
<sj:submit onclick="loadChange()"
Modified: trunk/src/main/webapp/css/main.css
===================================================================
--- trunk/src/main/webapp/css/main.css 2011-08-10 13:01:51 UTC (rev 210)
+++ trunk/src/main/webapp/css/main.css 2011-08-11 13:11:10 UTC (rev 211)
@@ -8,15 +8,15 @@
img {
- border:none;
- }
+ border:none;
+ }
.wwlbl , .wwctrl {
display:inline;
}
.ui-icon-document {
- background-image:url("../img/file.png") !important;
+ background-image:url("../img/file.png") !important;
background-position: 0 1px !important ;
}
@@ -28,6 +28,15 @@
text-align:center;
}
+#forceCommitForm {
+ width:70%;
+ margin:auto;
+ display:block;
+ padding:1%;
+ text-align:center;
+ width:30%
+}
+
#wwctrl_Save, #wwctrl_Cancel, #wwctrl_uploadButton {
text-align:center;
}
1
0
r210 - in trunk/src/main: java/org/nuiton/scmwebeditor java/org/nuiton/scmwebeditor/actions webapp/WEB-INF/content
by kcardineaud@users.nuiton.org 10 Aug '11
by kcardineaud@users.nuiton.org 10 Aug '11
10 Aug '11
Author: kcardineaud
Date: 2011-08-10 15:01:51 +0200 (Wed, 10 Aug 2011)
New Revision: 210
Url: http://nuiton.org/repositories/revision/scmwebeditor/210
Log:
Fix an issue when login fail
Modified:
trunk/src/main/java/org/nuiton/scmwebeditor/ScmSession.java
trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java
trunk/src/main/webapp/WEB-INF/content/modificationViewer.jsp
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/ScmSession.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/ScmSession.java 2011-08-09 13:56:44 UTC (rev 209)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/ScmSession.java 2011-08-10 13:01:51 UTC (rev 210)
@@ -20,6 +20,10 @@
scmUsers.put(address, new ScmUser(login,password));
}
+ public void delScmUser(String address) {
+ scmUsers.remove(address);
+ }
+
public String getUsername(String url) {
if(scmUsers.containsKey(url)) {
return scmUsers.get(url).getUsername();
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java 2011-08-09 13:56:44 UTC (rev 209)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java 2011-08-10 13:01:51 UTC (rev 210)
@@ -40,7 +40,7 @@
protected String pw;
protected String address;
protected String lastText;
- protected String fileType;
+ protected String format;
protected String projectUrl;
protected boolean force;
@@ -63,12 +63,12 @@
return newText;
}
- public String getFileType() {
- return fileType;
+ public String getFormat() {
+ return format;
}
- public void setFileType(String fileType) {
- this.fileType = fileType;
+ public void setFormat(String format) {
+ this.format = format;
}
public void setNewText(String newText) {
@@ -152,7 +152,7 @@
public String execute() {
if(!force) {
- if(fileType.equals("rst")) {
+ if(format.equals("rst")) {
if(!testRstParsing(newText)) {
return "errorRst";
}
@@ -226,8 +226,11 @@
//On supprime le repertoire temporaire
delTempDirectory(checkoutdir);
//redirect to a login page
- return Action.LOGIN;
+ getScmSession().delScmUser(repositoryUUID);
+
+ return Action.LOGIN;
+
} catch (SVNException e) {
//Suppression du repertoire temporaire
delTempDirectory(checkoutdir);
@@ -304,6 +307,9 @@
request.setAttribute(ATTRIBUTE_BAD_LOGIN, true);
//Suppression du repertoire temporaire
delTempDirectory(checkoutdir);
+
+ //on supprime la valeur stocke en session
+ getScmSession().delScmUser(repositoryUUID);
return Action.LOGIN;
} catch (SVNException e) {
if(log.isErrorEnabled()) {
Modified: trunk/src/main/webapp/WEB-INF/content/modificationViewer.jsp
===================================================================
--- trunk/src/main/webapp/WEB-INF/content/modificationViewer.jsp 2011-08-09 13:56:44 UTC (rev 209)
+++ trunk/src/main/webapp/WEB-INF/content/modificationViewer.jsp 2011-08-10 13:01:51 UTC (rev 210)
@@ -66,16 +66,14 @@
<form method="POST" action="commit.action?force=true" id="editForm">
- <%
- if (request.getAttribute("format")!=null && request.getAttribute("format").equals("rst")){
+
+ <%
+ if (request.getAttribute("format")!=null){
%>
- <input type="hidden" name="fileType" value="rst" />
- <% } else { %>
- <input type="hidden" name="fileType" value="other" />
+ <input type="hidden" name="format" value="<%=request.getAttribute("format")%>" />
<% } %>
-
<%
String valueTextarea;
if(request.getAttribute("lastText")!=null) {
@@ -137,7 +135,15 @@
<div id="form">
- <div id="htmlcontentCommit"></div>
+ <div id="htmlcontentCommit">
+ <%if (request.getAttribute("badLogin")!=null && request.getAttribute("badLogin").equals(true)) { %>
+ <p>
+ <font color="red">
+ Bad username or password
+ </font>
+ </p>
+ <%} %>
+ </div>
<s:set id="scm.commitMessage">
<s:text name="scm.commitMessage"/>
@@ -149,13 +155,7 @@
<s:textfield required="true" label="%{scm.commitMessage}" name="commitMessage" title="%{scm.commitMessageTitle}" />
- <%if (request.getAttribute("badLogin")!=null && request.getAttribute("badLogin").equals(true)) { %>
- <p>
- <font color="red">
- Bad username or password
- </font>
- </p>
- <% } %>
+
<p>
1
0