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
- 436 discussions
r126 - in trunk/src/main: java/org/nuiton/scmwebeditor/actions resources webapp webapp/css
by kcardineaud@users.nuiton.org 20 Jun '11
by kcardineaud@users.nuiton.org 20 Jun '11
20 Jun '11
Author: kcardineaud
Date: 2011-06-20 11:40:04 +0200 (Mon, 20 Jun 2011)
New Revision: 126
Url: http://nuiton.org/repositories/revision/scmwebeditor/126
Log:
Add preview functionality in modification page
Added:
trunk/src/main/java/org/nuiton/scmwebeditor/actions/PreviewAction.java
Modified:
trunk/src/main/resources/struts.xml
trunk/src/main/webapp/ModificationViewer.jsp
trunk/src/main/webapp/Preview.js
trunk/src/main/webapp/css/main.css
Added: trunk/src/main/java/org/nuiton/scmwebeditor/actions/PreviewAction.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/actions/PreviewAction.java (rev 0)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/actions/PreviewAction.java 2011-06-20 09:40:04 UTC (rev 126)
@@ -0,0 +1,108 @@
+package org.nuiton.scmwebeditor.actions;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.struts2.interceptor.ServletRequestAware;
+import org.nuiton.jrst.JRST;
+import org.nuiton.scmwebeditor.AbstractScmWebEditor;
+
+
+import com.opensymphony.xwork2.Action;
+
+public class PreviewAction extends AbstractScmWebEditor implements ServletRequestAware {
+
+ HttpServletRequest request;
+ InputStream XMLResponse;
+
+
+ private static final Log log = LogFactory.getLog(PreviewAction.class);
+
+ public String execute() {
+ setResponse();
+ return Action.SUCCESS;
+ }
+
+ public void setResponse() {
+
+ if(log.isDebugEnabled()) {
+ log.debug("Enter in Servlet Action");
+ }
+
+ HttpSession httpSession = request.getSession(true);
+ File tmpDir = getTempDir(httpSession);
+ //Text recuperation
+ String myData = request.getParameter(PARAMETER_TEXT);
+ //Text formating and tempfile creating
+ String myDataWithoutcrlf = myData.replace("\r", "");
+ File fileInDirCopy = new File(tmpDir, "copy" + httpSession.getId() + ".rst");
+ File httpFile = new File(tmpDir, "preview" + httpSession.getId() + ".html");
+ try {
+ fileInDirCopy.createNewFile();
+ httpFile.createNewFile();
+ FileUtils.writeStringToFile(fileInDirCopy, myDataWithoutcrlf);
+ } catch (IOException e) {
+ if(log.isErrorEnabled()) {
+ log.error("Erreur de lecture/ecriture",e);
+ }
+ }
+
+ convertToUnicode(fileInDirCopy);
+
+ File copy = new File(tmpDir, "copy" + httpSession.getId() + ".rst");
+
+ //Using jrst for generate html document
+ try {
+ JRST.generate(JRST.TYPE_HTML, copy, httpFile, JRST.Overwrite.ALLTIME);
+ if(log.isDebugEnabled()) {
+ log.debug("RST generate");
+ }
+ } catch (Exception eee) {
+ if(log.isWarnEnabled()) {
+ log.warn("RST generate fail",eee);
+ }
+ XMLResponse = new ByteArrayInputStream("<h4>Parsing error, please read RST specification<h4>".getBytes());
+ return;
+ }
+ copy.delete();
+
+
+ try {
+ XMLResponse = new ByteArrayInputStream(FileUtils.readFileToString(httpFile).getBytes());
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ httpFile.delete();
+
+
+
+ }
+
+ public InputStream getXMLResponse() {
+ return XMLResponse;
+ }
+
+ public void setXMLResponse(InputStream xMLResponse) {
+ XMLResponse = xMLResponse;
+ }
+
+ @Override
+ public void setServletRequest(HttpServletRequest request) {
+ this.request = request;
+ }
+
+
+
+
+
+}
Modified: trunk/src/main/resources/struts.xml
===================================================================
--- trunk/src/main/resources/struts.xml 2011-06-17 15:24:35 UTC (rev 125)
+++ trunk/src/main/resources/struts.xml 2011-06-20 09:40:04 UTC (rev 126)
@@ -16,5 +16,11 @@
<result name="authError" >/ModificationViewer.jsp</result>
<result name="erreur">/BadFileRedirect.jsp</result>
</action>
+ <action name="preview" class="org.nuiton.scmwebeditor.actions.PreviewAction" method="execute">
+ <result type="stream" >
+ <param name="contentType">text/xml</param>
+ <param name="inputName">XMLResponse</param>
+ </result>
+ </action>
</package>
</struts>
\ No newline at end of file
Modified: trunk/src/main/webapp/ModificationViewer.jsp
===================================================================
--- trunk/src/main/webapp/ModificationViewer.jsp 2011-06-17 15:24:35 UTC (rev 125)
+++ trunk/src/main/webapp/ModificationViewer.jsp 2011-06-20 09:40:04 UTC (rev 126)
@@ -18,7 +18,7 @@
<center>
<form method="post" action=commit.action>
<script src="GereFormSize.js" type="text/javascript"></script>
- <textarea name="newText" id="newText" rows="20" cols="150"><%=request.getAttribute("OrigText")%></textarea>
+ <textarea name="newText" id="newText"><%=request.getAttribute("OrigText")%></textarea>
<script src="Preview.js" type="text/javascript"></script>
<script src="Saver.js" type="text/javascript"></script>
<script src="GereSession.js" type="text/javascript"></script>
@@ -49,16 +49,16 @@
<input type="hidden" name="origText" value=<%=request.getAttribute("OrigText")%>/>
<input type="hidden" name="scmEditorUrl" value="<%=request.getAttribute("scmEditorUrl")%>"/>
<input type="hidden" name="previewServletUrl" value="<%=request.getAttribute("previewServletUrl")%>"/>
- <input title="Save your work and continue editing this file." type="button" value="Save and Continue Editing" name="SaveandC" onclick="javascript:saver(this.form.newText, this.form.username, this.form.pw, this.form.commitMessage, this.form.Orig_text, this.form.scmEditorUrl);"/>
+ <input title="Save your work and continue editing this file." type="button" value="Save and Continue Editing" name="SaveandC" onclick="javascript:saver(this.form.newText, this.form.username, this.form.pw, this.form.commitMessage, this.form.origText, this.form.scmEditorUrl);"/>
<input title="Save this file and go back to previous page." type="submit" value="Save and Quit" name="Save"/>
<%if (request.getAttribute("format")!=null && request.getAttribute("format")!=null && request.getAttribute("format").equals("rst") == true){
%><input title="html preview of the current rst file state." type="button" value="Preview" name="Preview" onclick="javascript:preview(this.form.newText, this.form.previewServletUrl);"/><%}%>
<input title="Reset text as current repository HEAD revision." type="reset" value="Reset" name="Reset" alt="Test plop plop plop"/>
- <input type="hidden" value="<%=request.getAttribute("Project_url")%>" name="Project_url">
- <input title="Exit ScmWebEditor without saving." type="button" value="Exit" name="Cancel" onclick="javascript:cancelRedirectDelete(this.form.Orig_text, this.form.username, this.form.pw, this.form.commitMessage, this.form.Project_url, this.form.scmEditorUrl);"/>
+ <input type="hidden" value="<%=request.getAttribute("ProjectUrl")%>" name="ProjectUrl">
+ <input title="Exit ScmWebEditor without saving." type="button" value="Exit" name="Cancel" onclick="javascript:cancelRedirectDelete(this.form.origText, this.form.username, this.form.pw, this.form.commitMessage, this.form.ProjectUrl, this.form.scmEditorUrl);"/>
</form></center>
<%--Title and div for rst preview--%>
- <h4 id="prevtitle" ></h4>
+ <h3 id="prevtitle" ></h3>
<div id="prev" title="Preview"></div>
<p align="right">©2004-2009 CodeLutin</p>
</body>
Modified: trunk/src/main/webapp/Preview.js
===================================================================
--- trunk/src/main/webapp/Preview.js 2011-06-17 15:24:35 UTC (rev 125)
+++ trunk/src/main/webapp/Preview.js 2011-06-20 09:40:04 UTC (rev 126)
@@ -29,7 +29,7 @@
function sendRequest(method, url, text)
{
- http.open(method, url.value, true);
+ http.open(method, url, true);
http.onreadystatechange = handleResponse;
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.send("text="+text.value);
@@ -41,7 +41,7 @@
{
var response = http.responseText;
document.getElementById("prevtitle").innerHTML = "Preview : ";
- document.getElementById("prev").innerHTML = response;
+ document.getElementById("prev").innerHTML ="<div id=\"preview\" "+response+"</div>";
}
else if (http.readyState == 4 && http.status == 406)
{
@@ -51,6 +51,6 @@
function preview(my_text, url)
{
- sendRequest("POST", url, my_text);
+ sendRequest("POST", "preview.action", my_text);
}
Modified: trunk/src/main/webapp/css/main.css
===================================================================
--- trunk/src/main/webapp/css/main.css 2011-06-17 15:24:35 UTC (rev 125)
+++ trunk/src/main/webapp/css/main.css 2011-06-20 09:40:04 UTC (rev 126)
@@ -4,3 +4,22 @@
background-color: #b8b1b1;
}
+textarea {
+ width:72%;
+ margin:auto;
+ display:block;
+ min-height: 150px;
+}
+
+#prevtitle {
+ margin-left:12%;
+}
+
+#preview {
+ width:70%;
+ margin:auto;
+ display:block;
+ padding:1%;
+ border : solid 3px black;
+}
+
1
0
r125 - in trunk/src/main: java/org/nuiton/scmwebeditor java/org/nuiton/scmwebeditor/actions resources
by kcardineaud@users.nuiton.org 17 Jun '11
by kcardineaud@users.nuiton.org 17 Jun '11
17 Jun '11
Author: kcardineaud
Date: 2011-06-17 17:24:35 +0200 (Fri, 17 Jun 2011)
New Revision: 125
Url: http://nuiton.org/repositories/revision/scmwebeditor/125
Log:
Add a method in AbstractScmWebEditor to delete the temporary directory
Modified:
trunk/src/main/java/org/nuiton/scmwebeditor/AbstractScmWebEditor.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/struts.xml
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/AbstractScmWebEditor.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/AbstractScmWebEditor.java 2011-06-17 14:43:57 UTC (rev 124)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/AbstractScmWebEditor.java 2011-06-17 15:24:35 UTC (rev 125)
@@ -25,6 +25,8 @@
package org.nuiton.scmwebeditor;
import info.monitorenter.cpdetector.io.*;
+
+import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -77,6 +79,7 @@
protected static final String ATTRIBUTE_INVALIDATE_MAX_TIME = "InvalidateMaxTime";
protected static final String ATTRIBUTE_LOGIN = "Login";
protected static final String ATTRIBUTE_IS_LOGIN = "IsLogin";
+ protected static final String ATTRIBUTE_BAD_LOGIN = "badLogin";
protected static final String ATTRIBUTE_PROJECT_URL = "Project_url";
protected static final String ATTRIBUTE_SCM_EDITOR_URI = "scmEditorUri";
protected static final String ATTRIBUTE_PREVIEW_SERVLET_URL = "previewServletUrl";
@@ -173,6 +176,17 @@
}
}
}
+
+ public void delTempDirectory(SvnSession svnSess) {
+ try {
+ FileUtils.deleteDirectory(svnSess.getCheckoutdir());
+ } catch (IOException e) {
+ if(log.isErrorEnabled()) {
+ log.error("Can't delete temp directory");
+ }
+ }
+ }
+
protected SvnSession getSvnSession(HttpSession httpSession) {
SvnSession svnSess = (SvnSession) httpSession.getAttribute(ATTRIBUTE_SVN_SESSION);
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java 2011-06-17 14:43:57 UTC (rev 124)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java 2011-06-17 15:24:35 UTC (rev 125)
@@ -116,7 +116,6 @@
svnSess.setLogin(null);
svnSess.setPassword(null);
// if authentication failed edition page is reload form user's relogin
- log.debug("AUTH REDIRECT"+getRedirectUrl(svnSess));
request.setAttribute(PARAMETER_FORMAT, svnSess.getFormat());
request.setAttribute(ATTRIBUTE_ORIG_TEXT, StringEscapeUtils.escapeHtml(newText));
request.setAttribute(ATTRIBUTE_INVALIDATE_MAX_TIME, (httpSession.getMaxInactiveInterval() / 60));
@@ -127,28 +126,22 @@
request.setAttribute(ATTRIBUTE_SCM_EDITOR_URI, request.getRequestURI());
request.setAttribute(ATTRIBUTE_PREVIEW_SERVLET_URL, request.getContextPath() + "/previewservlet");
- request.setAttribute("badLogin", true);
+ request.setAttribute(ATTRIBUTE_BAD_LOGIN, true);
return "authError";
} catch (SVNException e) {
if(log.isErrorEnabled()) {
log.error("SVN FAIL",e);
}
+ //Suppression du repertoire temporaire
+ delTempDirectory(svnSess);
request.setAttribute(ATTRIBUTE_REDIRECT_URL, getRedirectUrl(svnSess));
- return "ko";
+ return "erreur";
}
}
if (svnSess.getCheckoutdir() != null) {
- if(log.isDebugEnabled()) {
- log.debug("Delete tempdir");
- }
- try {
- FileUtils.deleteDirectory(svnSess.getCheckoutdir());
- } catch (IOException e) {
- if(log.isErrorEnabled()) {
- log.error("Can't delete the temp dir",e);
- }
- }
+ //Suppression du repertoire temporaire
+ delTempDirectory(svnSess);
}
//if commit success user is redirect on the project page
request.setAttribute(ATTRIBUTE_REDIRECTION_URL, svnSess.getProjectUrl());
@@ -156,6 +149,8 @@
if(log.isDebugEnabled()) {
log.debug("End of commit");
}
+ //Suppression du repertoire temporaire
+ delTempDirectory(svnSess);
return "success";
}
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java 2011-06-17 14:43:57 UTC (rev 124)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java 2011-06-17 15:24:35 UTC (rev 125)
@@ -142,25 +142,13 @@
log.debug("Private SCM on reading " + svnSess.getRemoteUrl());
}
//Suppression du repertoire temporaire
- try {
- svnSess.cleanCheckoutDir();
- } catch (IOException e) {
- if (log.isErrorEnabled()) {
- log.error("Can't delete temp directory",e);
- }
- }
+ delTempDirectory(svnSess);
//redirect to a login page
return "login";
} catch (SVNException e) {
//Suppression du repertoire temporaire
- try {
- svnSess.cleanCheckoutDir();
- } catch (IOException ee) {
- if(log.isErrorEnabled()) {
- log.error("Can't delete temp directory");
- }
- }
+ delTempDirectory(svnSess);
return "erreurPath";
}
@@ -187,13 +175,7 @@
/* fichier non trouve, on redirige vers BadFileRedirect.jsp
* après avoir supprimé le repertoire temporaire
*/
- try {
- FileUtils.deleteDirectory(svnSess.getCheckoutdir());
- } catch (IOException e) {
- if(log.isErrorEnabled()) {
- log.error("Can't delete temp directory");
- }
- }
+ delTempDirectory(svnSess);
request.setAttribute(PARAMETER_SCM_EDITOR_URL, svnSess.getProjectUrl());
return "erreurPath";
} catch (IOException e) {
@@ -213,5 +195,6 @@
}
+
}
Modified: trunk/src/main/resources/struts.xml
===================================================================
--- trunk/src/main/resources/struts.xml 2011-06-17 14:43:57 UTC (rev 124)
+++ trunk/src/main/resources/struts.xml 2011-06-17 15:24:35 UTC (rev 125)
@@ -14,7 +14,7 @@
<action name="commit" class="org.nuiton.scmwebeditor.actions.ScmWebEditorCommitAction" method="execute">
<result name="success" >/Redirect.jsp</result>
<result name="authError" >/ModificationViewer.jsp</result>
- <result name="ko">/BadFileRedirect.jsp</result>
+ <result name="erreur">/BadFileRedirect.jsp</result>
</action>
</package>
</struts>
\ No newline at end of file
1
0
r124 - in trunk/src/main: java/org/nuiton/scmwebeditor java/org/nuiton/scmwebeditor/actions resources webapp
by kcardineaud@users.nuiton.org 17 Jun '11
by kcardineaud@users.nuiton.org 17 Jun '11
17 Jun '11
Author: kcardineaud
Date: 2011-06-17 16:43:57 +0200 (Fri, 17 Jun 2011)
New Revision: 124
Url: http://nuiton.org/repositories/revision/scmwebeditor/124
Log:
Modify the login system for commit a file
Modified:
trunk/src/main/java/org/nuiton/scmwebeditor/AbstractScmWebEditor.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/struts.xml
trunk/src/main/webapp/ModificationViewer.jsp
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/AbstractScmWebEditor.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/AbstractScmWebEditor.java 2011-06-17 12:56:21 UTC (rev 123)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/AbstractScmWebEditor.java 2011-06-17 14:43:57 UTC (rev 124)
@@ -51,9 +51,9 @@
private static final Log log = LogFactory.getLog(AbstractScmWebEditor.class);
//TODO-TC200924 : uniformize all this different parameter and attribute, this is a bit messy...
- protected static final String PARAMETER_ADRESSE = "adresse";
+ protected static final String PARAMETER_ADRESSE = "address";
protected static final String PARAMETER_SCM_EDITOR_URL = "scmEditorUrl";
- protected static final String PARAMETER_PROJECT_URL = "project_url";
+ protected static final String PARAMETER_PROJECT_URL = "projectUrl";
protected static final String PARAMETER_FILE_NAME = "file_name";
protected static final String PARAMETER_LANG = "lang";
protected static final String PARAMETER_DEFAULT_LANG = "defaultLang";
@@ -197,8 +197,7 @@
protected String getRedirectUrl(SvnSession svnSess) {
StringBuilder buffer = new StringBuilder();
buffer.append(svnSess.getScmEditorUrl());
- buffer.append('?').append(PARAMETER_ADRESSE).append('=').append(svnSess.getSvnPath());
- buffer.append("&").append(PARAMETER_FILE_NAME).append('=').append(svnSess.getFileName());
+ buffer.append('?').append(PARAMETER_ADRESSE).append('=').append(svnSess.getSvnPath()+svnSess.getFileName());
buffer.append("&").append(PARAMETER_PROJECT_URL).append('=').append(svnSess.getProjectUrl());
String url = buffer.toString();
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java 2011-06-17 12:56:21 UTC (rev 123)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java 2011-06-17 14:43:57 UTC (rev 124)
@@ -113,9 +113,22 @@
if(log.isErrorEnabled()) {
log.error("AUTH FAIL",authexep);
}
+ svnSess.setLogin(null);
+ svnSess.setPassword(null);
// if authentication failed edition page is reload form user's relogin
- request.setAttribute(ATTRIBUTE_REDIRECT_URL, getRedirectUrl(svnSess));
- return "ko";
+ log.debug("AUTH REDIRECT"+getRedirectUrl(svnSess));
+ request.setAttribute(PARAMETER_FORMAT, svnSess.getFormat());
+ request.setAttribute(ATTRIBUTE_ORIG_TEXT, StringEscapeUtils.escapeHtml(newText));
+ request.setAttribute(ATTRIBUTE_INVALIDATE_MAX_TIME, (httpSession.getMaxInactiveInterval() / 60));
+ request.setAttribute(ATTRIBUTE_LOGIN, (svnSess.getLogin() != null && !svnSess.getLogin().equalsIgnoreCase("") ? svnSess.getLogin() : null));
+ request.setAttribute(ATTRIBUTE_IS_LOGIN, false);
+ request.setAttribute(ATTRIBUTE_PROJECT_URL, svnSess.getProjectUrl());
+ request.setAttribute(PARAMETER_SCM_EDITOR_URL, svnSess.getScmEditorUrl());
+ request.setAttribute(ATTRIBUTE_SCM_EDITOR_URI, request.getRequestURI());
+ request.setAttribute(ATTRIBUTE_PREVIEW_SERVLET_URL, request.getContextPath() + "/previewservlet");
+
+ request.setAttribute("badLogin", true);
+ return "authError";
} catch (SVNException e) {
if(log.isErrorEnabled()) {
log.error("SVN FAIL",e);
@@ -126,7 +139,9 @@
}
if (svnSess.getCheckoutdir() != null) {
- log.debug("Delete tempdir");
+ if(log.isDebugEnabled()) {
+ log.debug("Delete tempdir");
+ }
try {
FileUtils.deleteDirectory(svnSess.getCheckoutdir());
} catch (IOException e) {
@@ -141,7 +156,7 @@
if(log.isDebugEnabled()) {
log.debug("End of commit");
}
- return "ok";
+ return "success";
}
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java 2011-06-17 12:56:21 UTC (rev 123)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java 2011-06-17 14:43:57 UTC (rev 124)
@@ -107,7 +107,7 @@
tmp_log = svnSess.getLogin();
tmp_pass = svnSess.getPassword();
}
-
+
svnSess = new SvnSession(
relativePath,
scmFileName,
Modified: trunk/src/main/resources/struts.xml
===================================================================
--- trunk/src/main/resources/struts.xml 2011-06-17 12:56:21 UTC (rev 123)
+++ trunk/src/main/resources/struts.xml 2011-06-17 14:43:57 UTC (rev 124)
@@ -12,7 +12,8 @@
<result name="editPage" >/ModificationViewer.jsp</result>
</action>
<action name="commit" class="org.nuiton.scmwebeditor.actions.ScmWebEditorCommitAction" method="execute">
- <result name="ok" >/accueil.jsp</result>
+ <result name="success" >/Redirect.jsp</result>
+ <result name="authError" >/ModificationViewer.jsp</result>
<result name="ko">/BadFileRedirect.jsp</result>
</action>
</package>
Modified: trunk/src/main/webapp/ModificationViewer.jsp
===================================================================
--- trunk/src/main/webapp/ModificationViewer.jsp 2011-06-17 12:56:21 UTC (rev 123)
+++ trunk/src/main/webapp/ModificationViewer.jsp 2011-06-17 14:43:57 UTC (rev 124)
@@ -13,7 +13,7 @@
<body onload="cleanForm();geresession(<%=request.getAttribute("InvalidateMaxTime")%>, 5);">
<a title="ScmWebEditor Project Website" target="_blank" href="http://maven-site.nuiton.org/scmwebeditor/"><img src="img/ScmWebEditor_main.png" alt="ScmWebEditor logo"/></a>
<center><h2>Welcome on SCMWebEditor</h2>
- <%if (request.getAttribute("format").equals("rst") == true){
+ <%if (request.getAttribute("format")!=null && request.getAttribute("format").equals("rst") == true){
%><h4>For any Problem with RestruturedText visit <a href="http://docutils.sourceforge.net/rst.html">RST documentation website</a>.</h4></center><%}%>
<center>
<form method="post" action=commit.action>
@@ -29,7 +29,17 @@
<p>Commit Message: <input type="text" name="commitMessage" title="Let a commit message with this file."/></p>
<%if (request.getAttribute("IsLogin").equals(false) == true){
- %><p><label ACCESSKEY=U>User name: <input TYPE=text NAME=username SIZE=12 title="Commit Username."/></label>
+ %>
+ <%if (request.getAttribute("badLogin")!=null && request.getAttribute("badLogin").equals(true)) { %>
+ <p>
+ <font color="red">
+ Bad username or password
+ </font>
+ </p>
+ <% } %>
+ <p>
+
+ <label ACCESSKEY=U>User name: <input TYPE=text NAME=username SIZE=12 title="Commit Username."/></label>
<label ACCESSKEY=P>Password: <input TYPE=password NAME=pw SIZE=12 title="Commit Password."/></label> </p><%
} else {
%><p>You are log as: <%=request.getAttribute("Login")%></p>
@@ -41,7 +51,7 @@
<input type="hidden" name="previewServletUrl" value="<%=request.getAttribute("previewServletUrl")%>"/>
<input title="Save your work and continue editing this file." type="button" value="Save and Continue Editing" name="SaveandC" onclick="javascript:saver(this.form.newText, this.form.username, this.form.pw, this.form.commitMessage, this.form.Orig_text, this.form.scmEditorUrl);"/>
<input title="Save this file and go back to previous page." type="submit" value="Save and Quit" name="Save"/>
- <%if (request.getAttribute("format").equals("rst") == true){
+ <%if (request.getAttribute("format")!=null && request.getAttribute("format")!=null && request.getAttribute("format").equals("rst") == true){
%><input title="html preview of the current rst file state." type="button" value="Preview" name="Preview" onclick="javascript:preview(this.form.newText, this.form.previewServletUrl);"/><%}%>
<input title="Reset text as current repository HEAD revision." type="reset" value="Reset" name="Reset" alt="Test plop plop plop"/>
<input type="hidden" value="<%=request.getAttribute("Project_url")%>" name="Project_url">
1
0
r123 - in trunk/src/main: java/org/nuiton/scmwebeditor java/org/nuiton/scmwebeditor/actions resources webapp
by kcardineaud@users.nuiton.org 17 Jun '11
by kcardineaud@users.nuiton.org 17 Jun '11
17 Jun '11
Author: kcardineaud
Date: 2011-06-17 14:56:21 +0200 (Fri, 17 Jun 2011)
New Revision: 123
Url: http://nuiton.org/repositories/revision/scmwebeditor/123
Log:
File commit is now in struts
Added:
trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java
Modified:
trunk/src/main/java/org/nuiton/scmwebeditor/SvnSession.java
trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java
trunk/src/main/resources/struts.xml
trunk/src/main/webapp/ModificationViewer.jsp
trunk/src/main/webapp/OutConnection.jsp
trunk/src/main/webapp/fileSearch.js
trunk/src/main/webapp/index.jsp
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/SvnSession.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/SvnSession.java 2011-06-17 07:43:45 UTC (rev 122)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/SvnSession.java 2011-06-17 12:56:21 UTC (rev 123)
@@ -118,7 +118,7 @@
this.login = login;
this.password = password;
try {
- this.checkoutdir = FileUtil.createTempDirectory("", "");
+ this.checkoutdir = FileUtil.createTempDirectory("scm_", "");
} catch (IOException e) {
e.printStackTrace();
}
Added: trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java (rev 0)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java 2011-06-17 12:56:21 UTC (rev 123)
@@ -0,0 +1,154 @@
+package org.nuiton.scmwebeditor.actions;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.struts2.interceptor.ServletRequestAware;
+import org.nuiton.scmwebeditor.AbstractScmWebEditor;
+import org.nuiton.scmwebeditor.SvnSession;
+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;
+
+public class ScmWebEditorCommitAction extends AbstractScmWebEditor implements ServletRequestAware {
+ private static final Log log = LogFactory.getLog(ScmWebEditorCommitAction.class);
+
+ protected String newText;
+ protected String commitMessage;
+ protected String origText;
+ protected String username;
+ protected String pw;
+
+
+ protected HttpServletRequest request;
+
+ public String getCommitMessage() {
+ return commitMessage;
+ }
+
+ public void setCommitMessage(String commitMessage) {
+ this.commitMessage = commitMessage;
+ }
+
+
+ public String getNewText() {
+ return newText;
+ }
+
+ public void setNewText(String newText) {
+ this.newText = newText;
+ }
+
+ public String getOrigText() {
+ return origText;
+ }
+
+ public void setOrigText(String origText) {
+ this.origText = origText;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getPw() {
+ return pw;
+ }
+
+ public void setPw(String pw) {
+ this.pw = pw;
+ }
+
+ public String execute() {
+ System.setProperty("file.encoding", "UTF-8");
+ HttpSession httpSession = request.getSession(true);
+ SvnSession svnSess = getSvnSession(httpSession);
+
+// Resetting authentification information and manager
+ svnSess.updateAuthentication(
+ svnSess.getLogin() != null && !svnSess.getLogin().equalsIgnoreCase("") ? svnSess.getLogin() : username,
+ svnSess.getPassword() != null && !svnSess.getPassword().equalsIgnoreCase("") ? svnSess.getPassword() : pw);
+
+ String originalText = StringEscapeUtils.unescapeHtml(origText);
+ String myText = StringEscapeUtils.unescapeHtml(newText);
+
+ File pathToFile = new File(svnSess.getCheckoutdir(), svnSess.getFileName());
+
+ SVNCommitClient commitClient = new SVNCommitClient(svnSess.getManager(), svnSess.getSvnOption());
+ try {
+ FileUtils.writeStringToFile(pathToFile, newText);
+ } catch (IOException e) {
+ if(log.isErrorEnabled()) {
+ log.error("Can't write in file " , e);
+ }
+ return "ko";
+ }
+
+
+ convertToUnicode(pathToFile);
+
+ File[] tabFile = new File[1];
+ tabFile[0] = pathToFile;
+// Sending Data to SVN
+
+ if (!myText.equals(originalText)) {
+ try {
+ if(log.isDebugEnabled()) {
+ log.debug("Try to commit");
+ }
+ commitClient.doCommit(tabFile, false, "From scmwebeditor -- "+commitMessage, null, null, false, true, SVNDepth.FILES);
+ } catch (SVNAuthenticationException authexep) {
+ if(log.isErrorEnabled()) {
+ log.error("AUTH FAIL",authexep);
+ }
+ // if authentication failed edition page is reload form user's relogin
+ request.setAttribute(ATTRIBUTE_REDIRECT_URL, getRedirectUrl(svnSess));
+ return "ko";
+ } catch (SVNException e) {
+ if(log.isErrorEnabled()) {
+ log.error("SVN FAIL",e);
+ }
+ request.setAttribute(ATTRIBUTE_REDIRECT_URL, getRedirectUrl(svnSess));
+ return "ko";
+ }
+ }
+
+ if (svnSess.getCheckoutdir() != null) {
+ log.debug("Delete tempdir");
+ try {
+ FileUtils.deleteDirectory(svnSess.getCheckoutdir());
+ } catch (IOException e) {
+ if(log.isErrorEnabled()) {
+ log.error("Can't delete the temp dir",e);
+ }
+ }
+ }
+ //if commit success user is redirect on the project page
+ request.setAttribute(ATTRIBUTE_REDIRECTION_URL, svnSess.getProjectUrl());
+
+ if(log.isDebugEnabled()) {
+ log.debug("End of commit");
+ }
+ return "ok";
+ }
+
+
+
+ @Override
+ public void setServletRequest(HttpServletRequest request) {
+ this.request = request;
+ }
+
+}
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java 2011-06-17 07:43:45 UTC (rev 122)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java 2011-06-17 12:56:21 UTC (rev 123)
@@ -6,6 +6,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
+import javax.swing.Action;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringEscapeUtils;
@@ -18,7 +19,6 @@
import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory;
-import org.tmatesoft.svn.core.wc.ISVNRepositoryPool;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc.SVNUpdateClient;
@@ -95,21 +95,12 @@
//SvnSession object creation if doesn't already exist
SvnSession svnSess = getSvnSession(httpSession);
-
String relativePath = address.substring(0,address.lastIndexOf("/"));
-
- log.debug("RELATIVEPATH : "+relativePath);
- //String scmPath = address.endsWith(relativePath) ? "" : relativePath;
-
String scmFileName = address.substring(address.lastIndexOf("/")+1);
-
- log.debug("SCMFILENAME : "+scmFileName);
format = scmFileName.substring(scmFileName.lastIndexOf(".")+1);
- log.debug("FORMAT : "+scmFileName);
-
String tmp_log = null;
String tmp_pass = null;
if (svnSess != null) {
@@ -147,21 +138,28 @@
SVNRevision.HEAD, SVNRevision.HEAD, SVNDepth.FILES, false);
} catch (SVNAuthenticationException authexep) {
// if svn authentication failed user is redirected on login page
- log.debug("Private SCM on reading " + svnSess.getRemoteUrl());
+ if(log.isDebugEnabled()) {
+ log.debug("Private SCM on reading " + svnSess.getRemoteUrl());
+ }
//Suppression du repertoire temporaire
try {
svnSess.cleanCheckoutDir();
} catch (IOException e) {
- e.printStackTrace();
+ if (log.isErrorEnabled()) {
+ log.error("Can't delete temp directory",e);
+ }
}
-
- return "private";
+ //redirect to a login page
+ return "login";
+
} catch (SVNException e) {
//Suppression du repertoire temporaire
try {
svnSess.cleanCheckoutDir();
} catch (IOException ee) {
- e.printStackTrace();
+ if(log.isErrorEnabled()) {
+ log.error("Can't delete temp directory");
+ }
}
return "erreurPath";
}
@@ -186,16 +184,20 @@
// End on first part
} catch (FileNotFoundException ee) {
- // fichier non trouve, on redirige vers BadFileRedirect.jsp
+ /* fichier non trouve, on redirige vers BadFileRedirect.jsp
+ * après avoir supprimé le repertoire temporaire
+ */
try {
FileUtils.deleteDirectory(svnSess.getCheckoutdir());
} catch (IOException e) {
- e.printStackTrace();
+ if(log.isErrorEnabled()) {
+ log.error("Can't delete temp directory");
+ }
}
request.setAttribute(PARAMETER_SCM_EDITOR_URL, svnSess.getProjectUrl());
return "erreurPath";
} catch (IOException e) {
- e.printStackTrace();
+ log.error("Can't find the checkout file",e);
}
return "editPage";
Modified: trunk/src/main/resources/struts.xml
===================================================================
--- trunk/src/main/resources/struts.xml 2011-06-17 07:43:45 UTC (rev 122)
+++ trunk/src/main/resources/struts.xml 2011-06-17 12:56:21 UTC (rev 123)
@@ -5,11 +5,15 @@
<struts>
<package name="action" extends="struts-default">
- <action name="main" class="org.nuiton.scmwebeditor.actions.ScmWebEditorMainAction" method="execute">
+ <action name="checkout" class="org.nuiton.scmwebeditor.actions.ScmWebEditorMainAction" method="execute">
<result name="noParameter" >/OutConnection.jsp</result>
- <result name="private" >/PrivateSvnRedirect.jsp</result>
+ <result name="login" >/PrivateSvnRedirect.jsp</result>
<result name="erreurPath" >/BadFileRedirect.jsp</result>
<result name="editPage" >/ModificationViewer.jsp</result>
</action>
+ <action name="commit" class="org.nuiton.scmwebeditor.actions.ScmWebEditorCommitAction" method="execute">
+ <result name="ok" >/accueil.jsp</result>
+ <result name="ko">/BadFileRedirect.jsp</result>
+ </action>
</package>
</struts>
\ No newline at end of file
Modified: trunk/src/main/webapp/ModificationViewer.jsp
===================================================================
--- trunk/src/main/webapp/ModificationViewer.jsp 2011-06-17 07:43:45 UTC (rev 122)
+++ trunk/src/main/webapp/ModificationViewer.jsp 2011-06-17 12:56:21 UTC (rev 123)
@@ -15,9 +15,10 @@
<center><h2>Welcome on SCMWebEditor</h2>
<%if (request.getAttribute("format").equals("rst") == true){
%><h4>For any Problem with RestruturedText visit <a href="http://docutils.sourceforge.net/rst.html">RST documentation website</a>.</h4></center><%}%>
- <center><form method="post" action=<%=request.getAttribute("scmEditorUri")%>>
+ <center>
+ <form method="post" action=commit.action>
<script src="GereFormSize.js" type="text/javascript"></script>
- <textarea name="Mytext" id="Mytext" rows="20" cols="150"><%=request.getAttribute("OrigText")%></textarea>
+ <textarea name="newText" id="newText" rows="20" cols="150"><%=request.getAttribute("OrigText")%></textarea>
<script src="Preview.js" type="text/javascript"></script>
<script src="Saver.js" type="text/javascript"></script>
<script src="GereSession.js" type="text/javascript"></script>
@@ -25,7 +26,7 @@
<script src="pictureUpload.js" type="text/javascript"></script>
<noscript><h4>Javascript is not activated. You can't only use Save and Quit or Reset button.</h4></noscript>
<noscript><h4>For a better use of SCMWebEditor please activate JavaScript.</h4></noscript>
- <p>Commit Message: <input type="text" name="Commit_message" title="Let a commit message with this file."/></p>
+ <p>Commit Message: <input type="text" name="commitMessage" title="Let a commit message with this file."/></p>
<%if (request.getAttribute("IsLogin").equals(false) == true){
%><p><label ACCESSKEY=U>User name: <input TYPE=text NAME=username SIZE=12 title="Commit Username."/></label>
@@ -35,16 +36,16 @@
<input type="hidden" NAME=username />
<input type="hidden" NAME=pw /><%
}%>
- <input type="hidden" name="Orig_text" value=<%=request.getAttribute("OrigText")%>/>
+ <input type="hidden" name="origText" value=<%=request.getAttribute("OrigText")%>/>
<input type="hidden" name="scmEditorUrl" value="<%=request.getAttribute("scmEditorUrl")%>"/>
<input type="hidden" name="previewServletUrl" value="<%=request.getAttribute("previewServletUrl")%>"/>
- <input title="Save your work and continue editing this file." type="button" value="Save and Continue Editing" name="SaveandC" onclick="javascript:saver(this.form.Mytext, this.form.username, this.form.pw, this.form.Commit_message, this.form.Orig_text, this.form.scmEditorUrl);"/>
+ <input title="Save your work and continue editing this file." type="button" value="Save and Continue Editing" name="SaveandC" onclick="javascript:saver(this.form.newText, this.form.username, this.form.pw, this.form.commitMessage, this.form.Orig_text, this.form.scmEditorUrl);"/>
<input title="Save this file and go back to previous page." type="submit" value="Save and Quit" name="Save"/>
<%if (request.getAttribute("format").equals("rst") == true){
- %><input title="html preview of the current rst file state." type="button" value="Preview" name="Preview" onclick="javascript:preview(this.form.Mytext, this.form.previewServletUrl);"/><%}%>
+ %><input title="html preview of the current rst file state." type="button" value="Preview" name="Preview" onclick="javascript:preview(this.form.newText, this.form.previewServletUrl);"/><%}%>
<input title="Reset text as current repository HEAD revision." type="reset" value="Reset" name="Reset" alt="Test plop plop plop"/>
<input type="hidden" value="<%=request.getAttribute("Project_url")%>" name="Project_url">
- <input title="Exit ScmWebEditor without saving." type="button" value="Exit" name="Cancel" onclick="javascript:cancelRedirectDelete(this.form.Orig_text, this.form.username, this.form.pw, this.form.Commit_message, this.form.Project_url, this.form.scmEditorUrl);"/>
+ <input title="Exit ScmWebEditor without saving." type="button" value="Exit" name="Cancel" onclick="javascript:cancelRedirectDelete(this.form.Orig_text, this.form.username, this.form.pw, this.form.commitMessage, this.form.Project_url, this.form.scmEditorUrl);"/>
</form></center>
<%--Title and div for rst preview--%>
<h4 id="prevtitle" ></h4>
Modified: trunk/src/main/webapp/OutConnection.jsp
===================================================================
--- trunk/src/main/webapp/OutConnection.jsp 2011-06-17 07:43:45 UTC (rev 122)
+++ trunk/src/main/webapp/OutConnection.jsp 2011-06-17 12:56:21 UTC (rev 123)
@@ -21,8 +21,8 @@
</h4>
</center>
<center>
-<form method="get" action="main.action">
- <p><label>SCM path: <input TYPE=text name="address" SIZE=100></label><input type="button" value="Search Files" name="search" onclick="javascript:fileSearch(this.form.address, this.form.searchServletUrl);"/></p>
+<form method="get" action="checkout.action">
+ <p><label>SCM path: <input TYPE=text name="address" SIZE=100></label><input disabled="disabled" type="button" value="Search Files" name="search" onclick="javascript:fileSearch(this.form.address, 'SearchServlet');"/></p>
<input type="hidden" name="projectUrl" value="<%=request.getRequestURL()%>" />
Modified: trunk/src/main/webapp/fileSearch.js
===================================================================
--- trunk/src/main/webapp/fileSearch.js 2011-06-17 07:43:45 UTC (rev 122)
+++ trunk/src/main/webapp/fileSearch.js 2011-06-17 12:56:21 UTC (rev 123)
@@ -24,7 +24,7 @@
function sendRequestToFileSearchServlet(scmPath, scmEditorUrl)
{
- http.open("POST", scmEditorUrl.value, true);
+ http.open("POST", scmEditorUrl, true);
http.onreadystatechange = handleResponseFromFileSearchServlet;
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.send("adresse="+scmPath.value);
@@ -42,6 +42,6 @@
function fileSearch(scmPath, scmEditorUrl)
{
alert(scmPath.value);
- alert(scmEditorUrl.value);
+ alert(scmEditorUrl);
sendRequestToFileSearchServlet(scmPath, scmEditorUrl);
}
Modified: trunk/src/main/webapp/index.jsp
===================================================================
--- trunk/src/main/webapp/index.jsp 2011-06-17 07:43:45 UTC (rev 122)
+++ trunk/src/main/webapp/index.jsp 2011-06-17 12:56:21 UTC (rev 123)
@@ -1,3 +1,3 @@
<%
-response.sendRedirect("main.action");
+response.sendRedirect("checkout.action");
%>
\ No newline at end of file
1
0
r122 - trunk/src/main/java/org/nuiton/scmwebeditor/actions
by kcardineaud@users.nuiton.org 17 Jun '11
by kcardineaud@users.nuiton.org 17 Jun '11
17 Jun '11
Author: kcardineaud
Date: 2011-06-17 09:43:45 +0200 (Fri, 17 Jun 2011)
New Revision: 122
Url: http://nuiton.org/repositories/revision/scmwebeditor/122
Log:
Correction of a problem with import in ScmWebEditorMainAction
Modified:
trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java 2011-06-16 14:28:44 UTC (rev 121)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java 2011-06-17 07:43:45 UTC (rev 122)
@@ -13,7 +13,6 @@
import org.apache.commons.logging.LogFactory;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.nuiton.scmwebeditor.AbstractScmWebEditor;
-import org.nuiton.scmwebeditor.ScmWebEditorMainServlet;
import org.nuiton.scmwebeditor.SvnSession;
import org.tmatesoft.svn.core.SVNAuthenticationException;
import org.tmatesoft.svn.core.SVNDepth;
1
0
r121 - in trunk/src/main: java/org/nuiton/scmwebeditor java/org/nuiton/scmwebeditor/actions resources webapp
by kcardineaud@users.nuiton.org 16 Jun '11
by kcardineaud@users.nuiton.org 16 Jun '11
16 Jun '11
Author: kcardineaud
Date: 2011-06-16 16:28:44 +0200 (Thu, 16 Jun 2011)
New Revision: 121
Url: http://nuiton.org/repositories/revision/scmwebeditor/121
Log:
ScmWebEditor can only be use with the complete url
Modified:
trunk/src/main/java/org/nuiton/scmwebeditor/AbstractScmWebEditor.java
trunk/src/main/java/org/nuiton/scmwebeditor/SvnSession.java
trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java
trunk/src/main/resources/struts.xml
trunk/src/main/webapp/OutConnection.jsp
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/AbstractScmWebEditor.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/AbstractScmWebEditor.java 2011-06-16 08:31:07 UTC (rev 120)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/AbstractScmWebEditor.java 2011-06-16 14:28:44 UTC (rev 121)
@@ -200,9 +200,6 @@
buffer.append('?').append(PARAMETER_ADRESSE).append('=').append(svnSess.getSvnPath());
buffer.append("&").append(PARAMETER_FILE_NAME).append('=').append(svnSess.getFileName());
buffer.append("&").append(PARAMETER_PROJECT_URL).append('=').append(svnSess.getProjectUrl());
- buffer.append("&").append(PARAMETER_LANG).append('=').append(svnSess.getLang());
- buffer.append("&").append(PARAMETER_DEFAULT_LANG).append('=').append(svnSess.getDefaultLang());
- buffer.append("&").append(PARAMETER_FORMAT).append('=').append(svnSess.getFormat());
String url = buffer.toString();
return url;
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/SvnSession.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/SvnSession.java 2011-06-16 08:31:07 UTC (rev 120)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/SvnSession.java 2011-06-16 14:28:44 UTC (rev 121)
@@ -57,14 +57,6 @@
*/
protected String format;
/**
- * locale language
- */
- protected String lang;
- /**
- * default lang used by maven site (used to build the relative path to the resource
- */
- protected String defaultLang;
- /**
* svn path without fileName
*/
protected String svnPath;
@@ -115,15 +107,11 @@
String login,
String password,
String id,
- String lang,
- String defaultLang,
String format,
StringBuffer scmEditorUrl) {
this.scmEditorUrl = scmEditorUrl;
this.id = id;
this.format = format;
- this.lang = lang;
- this.defaultLang = defaultLang;
this.svnPath = svnPath;
this.fileName = fileName;
this.projectUrl = projectUrl;
@@ -241,14 +229,6 @@
this.svnPath = svnPath;
}
- public String getLang() {
- return lang;
- }
-
- public void setLang(String lang) {
- this.lang = lang;
- }
-
public String getFormat() {
return format;
}
@@ -274,11 +254,4 @@
}
- public String getDefaultLang() {
- return defaultLang;
- }
-
- public void setDefaultLang(String defaultLang) {
- this.defaultLang = defaultLang;
- }
}
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java 2011-06-16 08:31:07 UTC (rev 120)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java 2011-06-16 14:28:44 UTC (rev 121)
@@ -1,11 +1,14 @@
package org.nuiton.scmwebeditor.actions;
import java.io.File;
+import java.io.FileNotFoundException;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts2.interceptor.ServletRequestAware;
@@ -26,10 +29,8 @@
protected String address;
protected String projectUrl;
- protected String fileName;
protected String format;
- protected String lang;
- protected String defaultLang;
+
protected HttpServletRequest request;
@@ -54,53 +55,14 @@
}
- public String getFileName() {
- return fileName;
- }
+
-
- public void setFileName(String fileName) {
- this.fileName = fileName;
- }
-
-
- public String getFormat() {
- return format;
- }
-
-
- public void setFormat(String format) {
- this.format = format;
- }
-
-
- public String getLang() {
- return lang;
- }
-
-
- public void setLang(String lang) {
- this.lang = lang;
- }
-
-
- public String getDefaultLang() {
- return defaultLang;
- }
-
-
- public void setDefaultLang(String defaultLang) {
- this.defaultLang = defaultLang;
- }
-
-
/**
* On test si les parametres ne sont pas vide
* @return
*/
private boolean testParameters() {
- if (address == null || address.length() == 0
- || fileName == null || fileName.length() == 0) {
+ if (address == null || address.length() == 0) {
return true;
}
else {
@@ -109,6 +71,10 @@
}
+ /**
+ * Methode principale de la classe
+ * @return
+ */
public String execute() {
@@ -129,21 +95,22 @@
//SvnSession object creation if doesn't already exist
SvnSession svnSess = getSvnSession(httpSession);
- String scmUrl = address.startsWith("scm:svn:") ? address.replace("scm:svn:", "") : address;
+
- format = request.getParameter(PARAMETER_FORMAT) != null ? request.getParameter(PARAMETER_FORMAT) : "";
+ String relativePath = address.substring(0,address.lastIndexOf("/"));
+
+ log.debug("RELATIVEPATH : "+relativePath);
- String relativePath = "/src/site/" + lang + "/" +( format.equals("") ? "" : format+"/");
- if (lang.equals(defaultLang)) {
- // on a maven site, default locale is on root
- relativePath = "/src/site/" +( format.equals("") ? "" : format+"/");
- projectUrl = projectUrl.replace("/"+defaultLang+"/", "/");
- }
+ //String scmPath = address.endsWith(relativePath) ? "" : relativePath;
- String scmPath = address.endsWith(relativePath) ? "" : relativePath;
-
- String scmFilename = fileName.endsWith(".html") ? fileName.replace(".html", "." + format) : fileName;
+ String scmFileName = address.substring(address.lastIndexOf("/")+1);
+ log.debug("SCMFILENAME : "+scmFileName);
+
+ format = scmFileName.substring(scmFileName.lastIndexOf(".")+1);
+
+ log.debug("FORMAT : "+scmFileName);
+
String tmp_log = null;
String tmp_pass = null;
if (svnSess != null) {
@@ -152,18 +119,16 @@
}
svnSess = new SvnSession(
- scmUrl + scmPath,
- scmFilename,
+ relativePath,
+ scmFileName,
projectUrl,
tmp_log,
tmp_pass,
httpSession.getId(),
- lang,
- defaultLang,
format,
request.getRequestURL());
- log.debug("VALEUR SVNSESS 1: "+svnSess);
+
setSvnSession(httpSession, svnSess);
// Tempdir creation on servlet default temporary directory
@@ -173,7 +138,7 @@
SVNUpdateClient upclient = new SVNUpdateClient(svnSess.getManager(), svnSess.getSvnOption());
- log.debug("VALEUR SVNSESS 2: "+svnSess);
+
// Checkout svn and file organisation
try {
if (log.isDebugEnabled()) {
@@ -184,23 +149,56 @@
} catch (SVNAuthenticationException authexep) {
// if svn authentication failed user is redirected on login page
log.debug("Private SCM on reading " + svnSess.getRemoteUrl());
+ //Suppression du repertoire temporaire
try {
svnSess.cleanCheckoutDir();
} catch (IOException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
return "private";
} catch (SVNException e) {
-
+ //Suppression du repertoire temporaire
+ try {
+ svnSess.cleanCheckoutDir();
+ } catch (IOException ee) {
+ e.printStackTrace();
+ }
return "erreurPath";
}
- File file_in_dir = new File(svnSess.getCheckoutdir(), svnSess.getFileName());
+ File CheckOutFile = new File(svnSess.getCheckoutdir(), svnSess.getFileName());
+ try {
+ String originalText = FileUtils.readFileToString(CheckOutFile);
+ request.setAttribute(PARAMETER_FORMAT, svnSess.getFormat());
+ request.setAttribute(ATTRIBUTE_ORIG_TEXT, StringEscapeUtils.escapeHtml(originalText));
+ request.setAttribute(ATTRIBUTE_INVALIDATE_MAX_TIME, (httpSession.getMaxInactiveInterval() / 60));
+ request.setAttribute(ATTRIBUTE_LOGIN, (svnSess.getLogin() != null && !svnSess.getLogin().equalsIgnoreCase("") ? svnSess.getLogin() : null));
+ request.setAttribute(ATTRIBUTE_IS_LOGIN, (svnSess.getLogin() != null && svnSess.getPassword() != null && !svnSess.getLogin().equalsIgnoreCase("") && !svnSess.getPassword().equalsIgnoreCase("")));
+ request.setAttribute(ATTRIBUTE_PROJECT_URL, svnSess.getProjectUrl());
+ request.setAttribute(PARAMETER_SCM_EDITOR_URL, svnSess.getScmEditorUrl());
+ if (log.isDebugEnabled()) {
+ log.debug("l'url est : " + svnSess.getScmEditorUrl());
+ }
+ request.setAttribute(ATTRIBUTE_SCM_EDITOR_URI, request.getRequestURI());
+ request.setAttribute(ATTRIBUTE_PREVIEW_SERVLET_URL, request.getContextPath() + "/previewservlet");
+
+ // End on first part
+
+ } catch (FileNotFoundException ee) {
+ // fichier non trouve, on redirige vers BadFileRedirect.jsp
+ try {
+ FileUtils.deleteDirectory(svnSess.getCheckoutdir());
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ request.setAttribute(PARAMETER_SCM_EDITOR_URL, svnSess.getProjectUrl());
+ return "erreurPath";
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
-
return "editPage";
Modified: trunk/src/main/resources/struts.xml
===================================================================
--- trunk/src/main/resources/struts.xml 2011-06-16 08:31:07 UTC (rev 120)
+++ trunk/src/main/resources/struts.xml 2011-06-16 14:28:44 UTC (rev 121)
@@ -8,8 +8,8 @@
<action name="main" class="org.nuiton.scmwebeditor.actions.ScmWebEditorMainAction" method="execute">
<result name="noParameter" >/OutConnection.jsp</result>
<result name="private" >/PrivateSvnRedirect.jsp</result>
- <result name="erreurPath" >/BadFileRedirect.jsp?scmEditorUrl=index.jsp</result>
- <result name="editPage" >/accueil.jsp</result>
+ <result name="erreurPath" >/BadFileRedirect.jsp</result>
+ <result name="editPage" >/ModificationViewer.jsp</result>
</action>
</package>
</struts>
\ No newline at end of file
Modified: trunk/src/main/webapp/OutConnection.jsp
===================================================================
--- trunk/src/main/webapp/OutConnection.jsp 2011-06-16 08:31:07 UTC (rev 120)
+++ trunk/src/main/webapp/OutConnection.jsp 2011-06-16 14:28:44 UTC (rev 121)
@@ -22,21 +22,9 @@
</center>
<center>
<form method="get" action="main.action">
- <p><label>SCM path: <input TYPE=text name="address" SIZE=100></label><input type="button" value="Search Files" name="search" onclick="javascript:fileSearch(this.form.adresse, this.form.searchServletUrl);"/></p>
- <p><label>File name: <input TYPE=text NAME=fileName SIZE=20></label>
-<label>File type: <select name=format>
-<option value="rst">Rst
-<option value="apt">Apt
-</select></label></p>
-<p><label>Lang: <select name=lang>
-<option value="fr">Fr
-<option value="en">En
-</select></label>
-<label>Default Lang: <select name=defaultLang>
-<option value="fr">Fr
-<option value="en">En
-</select></label></p>
+ <p><label>SCM path: <input TYPE=text name="address" SIZE=100></label><input type="button" value="Search Files" name="search" onclick="javascript:fileSearch(this.form.address, this.form.searchServletUrl);"/></p>
+
<input type="hidden" name="projectUrl" value="<%=request.getRequestURL()%>" />
<input type="hidden" name="searchServletUrl" value="<%=request.getAttribute("searchServletUrl")%>"/>
<input type="submit" name="Save" /></form>
1
0
16 Jun '11
Author: kcardineaud
Date: 2011-06-16 10:31:07 +0200 (Thu, 16 Jun 2011)
New Revision: 120
Url: http://nuiton.org/repositories/revision/scmwebeditor/120
Log:
Delete the useless file ScmWebEditorMainServlet
Removed:
trunk/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorMainServlet.java
Deleted: trunk/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorMainServlet.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorMainServlet.java 2011-06-16 08:20:00 UTC (rev 119)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorMainServlet.java 2011-06-16 08:31:07 UTC (rev 120)
@@ -1,287 +0,0 @@
-/*
- * #%L
- * Nuiton-ScmWebEditor
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2009 - 2010 CodeLutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * #L%
- */
-package org.nuiton.scmwebeditor;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.tmatesoft.svn.core.SVNAuthenticationException;
-import org.tmatesoft.svn.core.SVNDepth;
-import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory;
-import org.tmatesoft.svn.core.wc.SVNCommitClient;
-import org.tmatesoft.svn.core.wc.SVNRevision;
-import org.tmatesoft.svn.core.wc.SVNUpdateClient;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import org.apache.commons.lang.StringEscapeUtils;
-
-/**
- * @author geoffroy lorieux
- */
-public class ScmWebEditorMainServlet extends AbstractScmWebEditor {
-
- private static final long serialVersionUID = 1L;
-
- private static final Log log = LogFactory.getLog(ScmWebEditorMainServlet.class);
-
- /**
- * Handles the HTTP <code>GET</code> method.
- * Do checkout on a private or not scm and call modification jsp page
- *
- * @param request servlet request
- * @param response servlet response
- * @throws ServletException if a servlet-specific error occurs
- * @throws IOException if an I/O error occurs
- */
- @Override
- protected void doGet(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
-
- if (log.isDebugEnabled()) {
- log.debug("--------------------------");
- log.debug("Connection to SCMWebEditor");
- log.debug("--------------------------");
- }
- HttpSession httpSession = request.getSession(true);
- try {
-
-// First Part Svn checkout and JSP call
- //FIXME-TC20091124 why doing this at each request ?, this is weird :)
- System.setProperty("file.encoding", "UTF-8");
-
-// Redirect if the SCMWebEditor is not call from an other website
- String paramAdresse = request.getParameter(PARAMETER_ADRESSE);
- String paramFileName = request.getParameter(PARAMETER_FILE_NAME);
- String paramProjectUrl = request.getParameter(PARAMETER_PROJECT_URL);
-
- if (paramAdresse == null || paramFileName == null || paramProjectUrl == null) {
- // il manque des paramètres pour editer une ressource
-
- SvnSession svnSess = getSvnSession(httpSession);
- if (svnSess != null) {
- // on nettoye le répertoire de checkout
- svnSess.cleanCheckoutDir();
- }
- // on redirige vers la page OutConnection.jsp
- request.setAttribute(ATTRIBUTE_SCM_EDITOR_URI, request.getRequestURI());
- request.setAttribute(ATTRIBUTE_FILESEARCH_SERVLET_URL, request.getContextPath() + "/searchservlet");
- log.debug("l'uri est: " + request.getRequestURI());
- redirect(request, response, "/OutConnection.jsp");
- return;
- }
-
- if (paramAdresse.equals("") || paramFileName.equals("") || paramProjectUrl.equals("")) {
- // les paramètres sont invalides, impossible d'éditer la ressource
- // on redirige sur la page BadFileRedirect.jsp
- request.setAttribute(PARAMETER_SCM_EDITOR_URL, paramProjectUrl);
- redirect(request, response, "/BadFileRedirect.jsp");
- return;
- }
-
-// SvnSession object creation if doesn't already exist
- SvnSession svnSess = getSvnSession(httpSession);
-
- String scmUrl = paramAdresse.startsWith("scm:svn:") ? paramAdresse.replace("scm:svn:", "") : paramAdresse;
-
- String paramLang = request.getParameter(PARAMETER_LANG);
- String paramDefaultLang = request.getParameter(PARAMETER_DEFAULT_LANG);
- String paramFormat = request.getParameter(PARAMETER_FORMAT) != null ? request.getParameter(PARAMETER_FORMAT) : "";
-
- String relativePath = "/src/site/" + paramLang + "/" +( paramFormat.equals("") ? "" : paramFormat+"/");
- if (paramLang.equals(paramDefaultLang)) {
- // on a maven site, default locale is on root
- relativePath = "/src/site/" +( paramFormat.equals("") ? "" : paramFormat+"/");
- paramProjectUrl = paramProjectUrl.replace("/"+paramDefaultLang+"/", "/");
- }
-
- String scmPath = paramAdresse.endsWith(relativePath) ? "" : relativePath;
-
- String scmFilename = paramFileName.endsWith(".html") ? paramFileName.replace(".html", "." + paramFormat) : paramFileName;
- File tempDir = getTempDir();
- String tmp_log = null;
- String tmp_pass = null;
- if (svnSess != null) {
- tmp_log = svnSess.getLogin();
- tmp_pass = svnSess.getPassword();
- }
- svnSess = new SvnSession(
- scmUrl + scmPath,
- scmFilename,
- paramProjectUrl,
- tmp_log,
- tmp_pass,
- tempDir,
- httpSession.getId(),
- paramLang,
- paramDefaultLang,
- paramFormat,
- request.getRequestURL());
-
- setSvnSession(httpSession, svnSess);
-// Tempdir creation on servlet default temporary directory
-
- svnSess.getCheckoutdir().mkdir();
-// update client initialisation
-
- DAVRepositoryFactory.setup();
- SVNUpdateClient upclient = new SVNUpdateClient(svnSess.getManager(), svnSess.getSvnOption());
-
-// Checkout svn and file organisation
- try {
- if (log.isDebugEnabled()) {
- log.debug("Do Checkout of " + svnSess.getRemoteUrl());
- }
- upclient.doCheckout(svnSess.getRemoteUrl(), svnSess.getCheckoutdir(),
- SVNRevision.HEAD, SVNRevision.HEAD, SVNDepth.FILES, false);
- } catch (SVNAuthenticationException authexep) {
- // if svn authentication failed user is redirected on login page
- log.debug("Private SCM on reading " + svnSess.getRemoteUrl());
- svnSess.cleanCheckoutDir();
-
- request.setAttribute(ATTRIBUTE_PRIVATE_SERVLET_URI, request.getContextPath() + "/privatesvnservlet");
- redirect(request, response, "/PrivateSvnRedirect.jsp");
-
- return;
- }
-
- File file_in_dir = new File(svnSess.getCheckoutdir(), svnSess.getFileName());
- try {
- String original_text = FileUtils.readFileToString(file_in_dir);
- request.setAttribute(PARAMETER_FORMAT, svnSess.getFormat());
- request.setAttribute(ATTRIBUTE_ORIG_TEXT, StringEscapeUtils.escapeHtml(original_text));
- request.setAttribute(ATTRIBUTE_INVALIDATE_MAX_TIME, (httpSession.getMaxInactiveInterval() / 60));
- request.setAttribute(ATTRIBUTE_LOGIN, (svnSess.getLogin() != null && !svnSess.getLogin().equalsIgnoreCase("") ? svnSess.getLogin() : null));
- request.setAttribute(ATTRIBUTE_IS_LOGIN, (svnSess.getLogin() != null && svnSess.getPassword() != null && !svnSess.getLogin().equalsIgnoreCase("") && !svnSess.getPassword().equalsIgnoreCase("")));
- request.setAttribute(ATTRIBUTE_PROJECT_URL, svnSess.getProjectUrl());
- request.setAttribute(PARAMETER_SCM_EDITOR_URL, svnSess.getScmEditorUrl());
- if (log.isDebugEnabled()) {
- log.debug("l'url est:" + svnSess.getScmEditorUrl());
- }
- request.setAttribute(ATTRIBUTE_SCM_EDITOR_URI, request.getRequestURI());
- request.setAttribute(ATTRIBUTE_PREVIEW_SERVLET_URL, request.getContextPath() + "/previewservlet");
- redirect(request, response, "/ModificationViewer.jsp");
- // End on first part
-
- } catch (FileNotFoundException ee) {
- // fichier non trouve, on redirige vers BadFileRedirect.jsp
- FileUtils.deleteDirectory(svnSess.getCheckoutdir());
- request.setAttribute(PARAMETER_SCM_EDITOR_URL, svnSess.getProjectUrl());
- redirect(request, response, "/BadFileRedirect.jsp");
- }
-// JSP data transfert
-
- } catch (SVNException ex) {
- // probleme svn, on redirige vers BadUseRedirect.jsp
- if (log.isErrorEnabled()) {
- log.error(ex);
- }
- SvnSession svnSess = getSvnSession(httpSession);
- FileUtils.deleteDirectory(svnSess.getCheckoutdir());
- request.setAttribute(PARAMETER_SCM_EDITOR_URL, svnSess.getProjectUrl());
- redirect(request, response, "/BadUseRedirect.jsp");
- }
- }
-
- /**
- * Handles the HTTP <code>POST</code> method.
- * Receve the new text and commit it to scm
- *
- * @param request servlet request
- * @param response servlet response
- * @throws ServletException if a servlet-specific error occurs
- * @throws IOException if an I/O error occurs
- */
- @Override
- protected void doPost(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
- try {
-
-// Second Part Client response and SVN commit
- //FIXME-TC20091124 why doing this at each request ?, this is weird :)
- System.setProperty("file.encoding", "UTF-8");
- HttpSession httpSession = request.getSession(true);
- SvnSession svnSess = getSvnSession(httpSession);
-
-// Resetting authentification information and manager
- svnSess.updateAuthentication(
- svnSess.getLogin() != null && !svnSess.getLogin().equalsIgnoreCase("") ? svnSess.getLogin() : request.getParameter(PARAMETER_USERNAME),
- svnSess.getPassword() != null && !svnSess.getPassword().equalsIgnoreCase("") ? svnSess.getPassword() : request.getParameter(PARAMETER_PW));
-
- String originalText = StringEscapeUtils.unescapeHtml(request.getParameter(PARAMETER_ORIG_TEXT));
- String myText = StringEscapeUtils.unescapeHtml(request.getParameter(PARAMETER_MYTEXT));
-
- File pathToFile = new File(svnSess.getCheckoutdir(), svnSess.getFileName());
-
- SVNCommitClient commitClient = new SVNCommitClient(svnSess.getManager(), svnSess.getSvnOption());
- FileUtils.writeStringToFile(pathToFile, request.getParameter(PARAMETER_MYTEXT));
-
- convertToUnicode(pathToFile);
-
- File[] tabFile = new File[1];
- tabFile[0] = pathToFile;
-// Sending Data to SVN
-
- if (!myText.equals(originalText)) {
- try {
- log.debug("Je commit");
- //TODO-TC20091124 Should add a prefix to the commit file ? something like from scmwebeditor --
- commitClient.doCommit(tabFile, false, request.getParameter(PARAMETER_COMMIT_MESSAGE), null, null, false, true, SVNDepth.FILES);
- } catch (SVNAuthenticationException authexep) {
- // if authentication failed edition page is reload form user's relogin
- response.setStatus(401);
- String url = getRedirectUrl(svnSess);
- request.setAttribute(ATTRIBUTE_REDIRECT_URL, url);
- redirect(request, response, "/Error.jsp");
- return;
- }
- }
-
- if (svnSess.getCheckoutdir() != null) {
- log.debug("Je delete le tempdir");
- FileUtils.deleteDirectory(svnSess.getCheckoutdir());
- }
-// if commit success user is redirect on the project page
- request.setAttribute(ATTRIBUTE_REDIRECTION_URL, svnSess.getProjectUrl());
- redirect(request, response, "/Redirect.jsp");
-
-// End of Second part
-
- log.debug("Exit RSTEditor");
-
- } catch (SVNException ex) {
- Logger.getLogger(ScmWebEditorMainServlet.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
-
-}
1
0
r119 - in trunk: . src/main/java/org/nuiton/scmwebeditor src/main/java/org/nuiton/scmwebeditor/actions src/main/resources src/main/webapp src/main/webapp/WEB-INF
by kcardineaud@users.nuiton.org 16 Jun '11
by kcardineaud@users.nuiton.org 16 Jun '11
16 Jun '11
Author: kcardineaud
Date: 2011-06-16 10:20:00 +0200 (Thu, 16 Jun 2011)
New Revision: 119
Url: http://nuiton.org/repositories/revision/scmwebeditor/119
Log:
First commit to prepare conversion to struts2
Added:
trunk/src/main/java/org/nuiton/scmwebeditor/AbstractScmWebEditor.java
trunk/src/main/java/org/nuiton/scmwebeditor/actions/
trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java
trunk/src/main/java/org/nuiton/scmwebeditor/interceptors/
trunk/src/main/resources/struts.xml
trunk/src/main/webapp/accueil.jsp
trunk/src/main/webapp/index.jsp
Removed:
trunk/src/main/java/org/nuiton/scmwebeditor/AbstractScmWebEditorServlet.java
Modified:
trunk/pom.xml
trunk/src/main/java/org/nuiton/scmwebeditor/PreviewServlet.java
trunk/src/main/java/org/nuiton/scmwebeditor/PrivateSvnServlet.java
trunk/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorMainServlet.java
trunk/src/main/java/org/nuiton/scmwebeditor/SearchServlet.java
trunk/src/main/java/org/nuiton/scmwebeditor/SvnSession.java
trunk/src/main/webapp/BadFileRedirect.jsp
trunk/src/main/webapp/ModificationViewer.jsp
trunk/src/main/webapp/OutConnection.jsp
trunk/src/main/webapp/WEB-INF/web.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-06-07 20:09:55 UTC (rev 118)
+++ trunk/pom.xml 2011-06-16 08:20:00 UTC (rev 119)
@@ -52,6 +52,12 @@
<artifactId>jrst</artifactId>
<version>${jrstPluginVersion}</version>
<scope>compile</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>net.sourceforge.saxon</groupId>
+ <artifactId>saxon</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
@@ -67,6 +73,35 @@
<version>1.2.1</version>
</dependency>
+
+ <!-- Struts -->
+
+ <dependency>
+ <groupId>org.apache.struts</groupId>
+ <artifactId>struts2-core</artifactId>
+ <version>${struts2Version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.struts</groupId>
+ <artifactId>struts2-sitemesh-plugin</artifactId>
+ <version>${struts2Version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.jgeppert.struts2.jquery</groupId>
+ <artifactId>struts2-jquery-plugin</artifactId>
+ <version>${struts2jqueryVersion}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.struts.xwork</groupId>
+ <artifactId>xwork-core</artifactId>
+ <version>${strutsxworksVersion}</version>
+ </dependency>
+
</dependencies>
<!-- ************************************************************* -->
@@ -130,12 +165,18 @@
<!--Multilanguage maven-site -->
<siteLocales>fr,en</siteLocales>
+ <struts2Version>2.2.3</struts2Version>
+ <struts2jqueryVersion>3.0.2</struts2jqueryVersion>
+ <strutsxworksVersion>2.2.3</strutsxworksVersion>
<!-- extra files to include in release -->
<redmine.releaseFiles>${redmine.libReleaseFiles}</redmine.releaseFiles>
</properties>
+
+
+
<build>
<pluginManagement>
<plugins>
Added: trunk/src/main/java/org/nuiton/scmwebeditor/AbstractScmWebEditor.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/AbstractScmWebEditor.java (rev 0)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/AbstractScmWebEditor.java 2011-06-16 08:20:00 UTC (rev 119)
@@ -0,0 +1,211 @@
+/*
+ * #%L
+ * Nuiton-ScmWebEditor
+ *
+ * $Id: AbstractScmWebEditorServlet.java 89 2010-04-21 12:12:20Z ymartel $
+ * $HeadURL: http://svn.nuiton.org/svn/scmwebeditor/trunk/src/main/java/org/nuiton/scmwe… $
+ * %%
+ * Copyright (C) 2009 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+package org.nuiton.scmwebeditor;
+
+import info.monitorenter.cpdetector.io.*;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.io.*;
+import java.net.MalformedURLException;
+import java.nio.charset.Charset;
+
+/**
+ * User: chemit
+ * Date: 24 nov. 2009
+ * Time: 21:24:39
+ */
+public class AbstractScmWebEditor {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final Log log = LogFactory.getLog(AbstractScmWebEditor.class);
+
+ //TODO-TC200924 : uniformize all this different parameter and attribute, this is a bit messy...
+ protected static final String PARAMETER_ADRESSE = "adresse";
+ protected static final String PARAMETER_SCM_EDITOR_URL = "scmEditorUrl";
+ protected static final String PARAMETER_PROJECT_URL = "project_url";
+ protected static final String PARAMETER_FILE_NAME = "file_name";
+ protected static final String PARAMETER_LANG = "lang";
+ protected static final String PARAMETER_DEFAULT_LANG = "defaultLang";
+ protected static final String PARAMETER_FORMAT = "format";
+ protected static final String PARAMETER_USERNAME = "username";
+ protected static final String PARAMETER_PW = "pw";
+ protected static final String PARAMETER_MYTEXT = "Mytext";
+ protected static final String PARAMETER_ORIG_TEXT = "Orig_text";
+ protected static final String PARAMETER_COMMIT_MESSAGE = "Commit_message";
+ protected static final String PARAMETER_TEXT = "text";
+
+ //protected static final String ATTRIBUTE_TEMPDIR = "javax.servlet.context.tempdir";
+ // protected static final String ATTRIBUTE_SVN_PATH_URL = "svnPath_url";
+// protected static final String ATTRIBUTE_FILE_NAME_URL = "fileName_url";
+ protected static final String ATTRIBUTE_REDIRECTION_URL = "Redirection_url";
+ // protected static final String ATTRIBUTE_LANG = "Lang";
+ // protected static final String ATTRIBUTE_FORMAT = "Format";
+ private static final String ATTRIBUTE_SVN_SESSION = "myInfo";
+
+ protected static final String ATTRIBUTE_ORIG_TEXT = "OrigText";
+ protected static final String ATTRIBUTE_INVALIDATE_MAX_TIME = "InvalidateMaxTime";
+ protected static final String ATTRIBUTE_LOGIN = "Login";
+ protected static final String ATTRIBUTE_IS_LOGIN = "IsLogin";
+ protected static final String ATTRIBUTE_PROJECT_URL = "Project_url";
+ protected static final String ATTRIBUTE_SCM_EDITOR_URI = "scmEditorUri";
+ protected static final String ATTRIBUTE_PREVIEW_SERVLET_URL = "previewServletUrl";
+ protected static final String ATTRIBUTE_FILESEARCH_SERVLET_URL = "searchServletUrl";
+ protected static final String ATTRIBUTE_REDIRECT_URL = "Redirect_url";
+ protected static final String ATTRIBUTE_PRIVATE_SERVLET_URI = "privateServletUri";
+
+ protected static CodepageDetectorProxy detector;
+
+ protected CodepageDetectorProxy getCodepageDetector() {
+
+ if (detector == null) {
+ detector = CodepageDetectorProxy.getInstance(); // A singleton.
+
+ // Add the implementations of info.monitorenter.cpdetector.io.ICodepageDetector:
+ // This one is quick if we deal with unicode codepages:
+ detector.add(new ByteOrderMarkDetector());
+ // The first instance delegated to tries to detect the meta charset attribut in html pages.
+ detector.add(new ParsingDetector(true)); // be verbose about parsing.
+ // This one does the tricks of exclusion and frequency detection, if first implementation is
+ // unsuccessful:
+ detector.add(JChardetFacade.getInstance()); // Another singleton.
+ detector.add(ASCIIDetector.getInstance()); // Fallback, see javadoc.
+ }
+ return detector;
+ }
+
+
+ /**
+ * Convert all files to UTF-8.
+ *
+ * @param files fiels to convert
+ */
+ protected void convertToUnicode(File... files) {
+
+ CodepageDetectorProxy myDetector = getCodepageDetector();
+
+ for (File file : files) {
+ try {
+ Charset charset = myDetector.detectCodepage(file.toURI().toURL());
+
+ if (log.isDebugEnabled()) {
+ log.debug("Charset for " + file.getAbsolutePath() + " is " + charset);
+ }
+
+ if (charset != null && !charset.name().equalsIgnoreCase("UTF-8")) {
+
+ if (log.isDebugEnabled()) {
+ log.debug("Convert " + file.getAbsolutePath() + " to unicode");
+ }
+
+ File tmpFile = File.createTempFile(file.getName(), ".copy");
+ tmpFile.deleteOnExit();
+
+ // direct copy
+ InputStream is = new FileInputStream(file);
+ OutputStream os = new FileOutputStream(tmpFile);
+ try {
+ IOUtils.copy(is, os);
+ }
+ finally {
+ is.close();
+ os.close();
+ }
+
+ // copy using cp transaltion
+ is = new FileInputStream(tmpFile);
+ os = new FileOutputStream(file);
+ Reader ir = new InputStreamReader(is, charset);
+ Writer ow = new OutputStreamWriter(new FileOutputStream(file), "UTF-8");
+ try {
+ IOUtils.copy(ir, ow);
+ }
+ finally {
+ ir.close();
+ ow.close();
+ is.close();
+ os.close();
+ }
+
+ } else {
+ if (log.isDebugEnabled()) {
+ log.debug("File " + file.getAbsolutePath() + " already in unicode : skip");
+ }
+ }
+ } catch (MalformedURLException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't convert file in unicode", e);
+ }
+ } catch (IOException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't convert file in unicode", e);
+ }
+ }
+ }
+ }
+
+ protected SvnSession getSvnSession(HttpSession httpSession) {
+ SvnSession svnSess = (SvnSession) httpSession.getAttribute(ATTRIBUTE_SVN_SESSION);
+ return svnSess;
+ }
+
+ protected void setSvnSession(HttpSession httpSession, SvnSession svnSess) {
+ httpSession.setAttribute(ATTRIBUTE_SVN_SESSION, svnSess);
+ }
+
+ protected File getTempDir(HttpSession httpSession) {
+ File tmp_dir = getSvnSession(httpSession).getCheckoutdir();
+ return tmp_dir;
+ }
+
+/*
+ protected void redirect(HttpServletRequest request, HttpServletResponse response, String path) throws IOException, ServletException {
+ RequestDispatcher requestDispacher = getServletContext().getRequestDispatcher(path);
+ requestDispacher.forward(request, response);
+ }
+*/
+ protected String getRedirectUrl(SvnSession svnSess) {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append(svnSess.getScmEditorUrl());
+ buffer.append('?').append(PARAMETER_ADRESSE).append('=').append(svnSess.getSvnPath());
+ buffer.append("&").append(PARAMETER_FILE_NAME).append('=').append(svnSess.getFileName());
+ buffer.append("&").append(PARAMETER_PROJECT_URL).append('=').append(svnSess.getProjectUrl());
+ buffer.append("&").append(PARAMETER_LANG).append('=').append(svnSess.getLang());
+ buffer.append("&").append(PARAMETER_DEFAULT_LANG).append('=').append(svnSess.getDefaultLang());
+ buffer.append("&").append(PARAMETER_FORMAT).append('=').append(svnSess.getFormat());
+
+ String url = buffer.toString();
+ return url;
+ }
+
+}
Deleted: trunk/src/main/java/org/nuiton/scmwebeditor/AbstractScmWebEditorServlet.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/AbstractScmWebEditorServlet.java 2011-06-07 20:09:55 UTC (rev 118)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/AbstractScmWebEditorServlet.java 2011-06-16 08:20:00 UTC (rev 119)
@@ -1,210 +0,0 @@
-/*
- * #%L
- * Nuiton-ScmWebEditor
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2009 - 2010 CodeLutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * #L%
- */
-package org.nuiton.scmwebeditor;
-
-import info.monitorenter.cpdetector.io.*;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-import java.io.*;
-import java.net.MalformedURLException;
-import java.nio.charset.Charset;
-
-/**
- * User: chemit
- * Date: 24 nov. 2009
- * Time: 21:24:39
- */
-public class AbstractScmWebEditorServlet extends HttpServlet {
-
- private static final long serialVersionUID = 1L;
-
- private static final Log log = LogFactory.getLog(AbstractScmWebEditorServlet.class);
-
- //TODO-TC200924 : uniformize all this different parameter and attribute, this is a bit messy...
- protected static final String PARAMETER_ADRESSE = "adresse";
- protected static final String PARAMETER_SCM_EDITOR_URL = "scmEditorUrl";
- protected static final String PARAMETER_PROJECT_URL = "project_url";
- protected static final String PARAMETER_FILE_NAME = "file_name";
- protected static final String PARAMETER_LANG = "lang";
- protected static final String PARAMETER_DEFAULT_LANG = "defaultLang";
- protected static final String PARAMETER_FORMAT = "format";
- protected static final String PARAMETER_USERNAME = "username";
- protected static final String PARAMETER_PW = "pw";
- protected static final String PARAMETER_MYTEXT = "Mytext";
- protected static final String PARAMETER_ORIG_TEXT = "Orig_text";
- protected static final String PARAMETER_COMMIT_MESSAGE = "Commit_message";
- protected static final String PARAMETER_TEXT = "text";
-
- //protected static final String ATTRIBUTE_TEMPDIR = "javax.servlet.context.tempdir";
- // protected static final String ATTRIBUTE_SVN_PATH_URL = "svnPath_url";
-// protected static final String ATTRIBUTE_FILE_NAME_URL = "fileName_url";
- protected static final String ATTRIBUTE_REDIRECTION_URL = "Redirection_url";
- // protected static final String ATTRIBUTE_LANG = "Lang";
- // protected static final String ATTRIBUTE_FORMAT = "Format";
- private static final String ATTRIBUTE_SVN_SESSION = "myInfo";
-
- protected static final String ATTRIBUTE_ORIG_TEXT = "OrigText";
- protected static final String ATTRIBUTE_INVALIDATE_MAX_TIME = "InvalidateMaxTime";
- protected static final String ATTRIBUTE_LOGIN = "Login";
- protected static final String ATTRIBUTE_IS_LOGIN = "IsLogin";
- protected static final String ATTRIBUTE_PROJECT_URL = "Project_url";
- protected static final String ATTRIBUTE_SCM_EDITOR_URI = "scmEditorUri";
- protected static final String ATTRIBUTE_PREVIEW_SERVLET_URL = "previewServletUrl";
- protected static final String ATTRIBUTE_FILESEARCH_SERVLET_URL = "searchServletUrl";
- protected static final String ATTRIBUTE_REDIRECT_URL = "Redirect_url";
- protected static final String ATTRIBUTE_PRIVATE_SERVLET_URI = "privateServletUri";
-
- protected static CodepageDetectorProxy detector;
-
- protected CodepageDetectorProxy getCodepageDetector() {
-
- if (detector == null) {
- detector = CodepageDetectorProxy.getInstance(); // A singleton.
-
- // Add the implementations of info.monitorenter.cpdetector.io.ICodepageDetector:
- // This one is quick if we deal with unicode codepages:
- detector.add(new ByteOrderMarkDetector());
- // The first instance delegated to tries to detect the meta charset attribut in html pages.
- detector.add(new ParsingDetector(true)); // be verbose about parsing.
- // This one does the tricks of exclusion and frequency detection, if first implementation is
- // unsuccessful:
- detector.add(JChardetFacade.getInstance()); // Another singleton.
- detector.add(ASCIIDetector.getInstance()); // Fallback, see javadoc.
- }
- return detector;
- }
-
-
- /**
- * Convert all files to UTF-8.
- *
- * @param files fiels to convert
- */
- protected void convertToUnicode(File... files) {
-
- CodepageDetectorProxy myDetector = getCodepageDetector();
-
- for (File file : files) {
- try {
- Charset charset = myDetector.detectCodepage(file.toURI().toURL());
-
- if (log.isDebugEnabled()) {
- log.debug("Charset for " + file.getAbsolutePath() + " is " + charset);
- }
-
- if (charset != null && !charset.name().equalsIgnoreCase("UTF-8")) {
-
- if (log.isDebugEnabled()) {
- log.debug("Convert " + file.getAbsolutePath() + " to unicode");
- }
-
- File tmpFile = File.createTempFile(file.getName(), ".copy");
- tmpFile.deleteOnExit();
-
- // direct copy
- InputStream is = new FileInputStream(file);
- OutputStream os = new FileOutputStream(tmpFile);
- try {
- IOUtils.copy(is, os);
- }
- finally {
- is.close();
- os.close();
- }
-
- // copy using cp transaltion
- is = new FileInputStream(tmpFile);
- os = new FileOutputStream(file);
- Reader ir = new InputStreamReader(is, charset);
- Writer ow = new OutputStreamWriter(new FileOutputStream(file), "UTF-8");
- try {
- IOUtils.copy(ir, ow);
- }
- finally {
- ir.close();
- ow.close();
- is.close();
- os.close();
- }
-
- } else {
- if (log.isDebugEnabled()) {
- log.debug("File " + file.getAbsolutePath() + " already in unicode : skip");
- }
- }
- } catch (MalformedURLException e) {
- if (log.isErrorEnabled()) {
- log.error("Can't convert file in unicode", e);
- }
- } catch (IOException e) {
- if (log.isErrorEnabled()) {
- log.error("Can't convert file in unicode", e);
- }
- }
- }
- }
-
- protected SvnSession getSvnSession(HttpSession httpSession) {
- SvnSession svnSess = (SvnSession) httpSession.getAttribute(ATTRIBUTE_SVN_SESSION);
- return svnSess;
- }
-
- protected void setSvnSession(HttpSession httpSession, SvnSession svnSess) {
- httpSession.setAttribute(ATTRIBUTE_SVN_SESSION, svnSess);
- }
-
- protected File getTempDir() {
- File tmp_dir = (File) getServletContext().getAttribute("javax.servlet.context.tempdir");
- return tmp_dir;
- }
-
- protected void redirect(HttpServletRequest request, HttpServletResponse response, String path) throws IOException, ServletException {
- RequestDispatcher requestDispacher = getServletContext().getRequestDispatcher(path);
- requestDispacher.forward(request, response);
- }
-
- protected String getRedirectUrl(SvnSession svnSess) {
- StringBuilder buffer = new StringBuilder();
- buffer.append(svnSess.getScmEditorUrl());
- buffer.append('?').append(PARAMETER_ADRESSE).append('=').append(svnSess.getSvnPath());
- buffer.append("&").append(PARAMETER_FILE_NAME).append('=').append(svnSess.getFileName());
- buffer.append("&").append(PARAMETER_PROJECT_URL).append('=').append(svnSess.getProjectUrl());
- buffer.append("&").append(PARAMETER_LANG).append('=').append(svnSess.getLang());
- buffer.append("&").append(PARAMETER_DEFAULT_LANG).append('=').append(svnSess.getDefaultLang());
- buffer.append("&").append(PARAMETER_FORMAT).append('=').append(svnSess.getFormat());
-
- String url = buffer.toString();
- return url;
- }
-
-}
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/PreviewServlet.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/PreviewServlet.java 2011-06-07 20:09:55 UTC (rev 118)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/PreviewServlet.java 2011-06-16 08:20:00 UTC (rev 119)
@@ -40,7 +40,7 @@
/**
* @author geoffroy lorieux
*/
-public class PreviewServlet extends AbstractScmWebEditorServlet {
+public class PreviewServlet extends AbstractScmWebEditor {
private static final long serialVersionUID = 1L;
@@ -54,12 +54,11 @@
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
- @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
log.debug("je suis dans la previewservlet");
HttpSession httpSession = request.getSession(true);
- File tmp_dir = getTempDir();
+ File tmp_dir = getTempDir(httpSession);
log.debug("Le tmp dir est :" + tmp_dir);
log.debug("Le content type est : " + request.getContentType());
// Text recuperation
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/PrivateSvnServlet.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/PrivateSvnServlet.java 2011-06-07 20:09:55 UTC (rev 118)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/PrivateSvnServlet.java 2011-06-16 08:20:00 UTC (rev 119)
@@ -37,13 +37,13 @@
/**
* @author geoffroy lorieux
*/
-public class PrivateSvnServlet extends AbstractScmWebEditorServlet {
+public class PrivateSvnServlet extends AbstractScmWebEditor {
private static final long serialVersionUID = 1L;
private static final Log log = LogFactory.getLog(PrivateSvnServlet.class);
- @Override
+
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
if (log.isDebugEnabled()) {
log.debug("New Log setting");
@@ -64,7 +64,7 @@
log.debug("redirect url = " + url);
}
request.setAttribute(ATTRIBUTE_REDIRECT_URL, url);
- redirect(request, response, "/Recall.jsp");
+ //redirect(request, response, "/Recall.jsp");
out.close();
}
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorMainServlet.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorMainServlet.java 2011-06-07 20:09:55 UTC (rev 118)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorMainServlet.java 2011-06-16 08:20:00 UTC (rev 119)
@@ -49,7 +49,7 @@
/**
* @author geoffroy lorieux
*/
-public class ScmWebEditorMainServlet extends AbstractScmWebEditorServlet {
+public class ScmWebEditorMainServlet extends AbstractScmWebEditor {
private static final long serialVersionUID = 1L;
@@ -75,7 +75,7 @@
}
HttpSession httpSession = request.getSession(true);
try {
-
+
// First Part Svn checkout and JSP call
//FIXME-TC20091124 why doing this at each request ?, this is weird :)
System.setProperty("file.encoding", "UTF-8");
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/SearchServlet.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/SearchServlet.java 2011-06-07 20:09:55 UTC (rev 118)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/SearchServlet.java 2011-06-16 08:20:00 UTC (rev 119)
@@ -43,7 +43,7 @@
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc.SVNWCUtil;
-public class SearchServlet extends AbstractScmWebEditorServlet {
+public class SearchServlet extends AbstractScmWebEditor {
private static final Log log = LogFactory.getLog(SearchServlet.class);
@@ -55,7 +55,7 @@
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
*/
- @Override
+
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException {
try {
String adresse = request.getParameter(PARAMETER_ADRESSE);
Modified: trunk/src/main/java/org/nuiton/scmwebeditor/SvnSession.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/SvnSession.java 2011-06-07 20:09:55 UTC (rev 118)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/SvnSession.java 2011-06-16 08:20:00 UTC (rev 119)
@@ -25,6 +25,10 @@
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.scmwebeditor.actions.ScmWebEditorMainAction;
+import org.nuiton.util.FileUtil;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNProperty;
import org.tmatesoft.svn.core.SVNURL;
@@ -38,6 +42,8 @@
public class SvnSession {
+
+ private static final Log log = LogFactory.getLog(SvnSession.class);
/**
* Url of scm editor
*/
@@ -79,10 +85,6 @@
*/
protected String password;
/**
- * Temp directory path
- */
- protected File tmpDir;
- /**
* Temp directory for checkout
*/
protected File checkoutdir;
@@ -112,12 +114,11 @@
String projectUrl,
String login,
String password,
- File tmpDir,
String id,
String lang,
String defaultLang,
String format,
- StringBuffer scmEditorUrl) throws SVNException {
+ StringBuffer scmEditorUrl) {
this.scmEditorUrl = scmEditorUrl;
this.id = id;
this.format = format;
@@ -128,9 +129,16 @@
this.projectUrl = projectUrl;
this.login = login;
this.password = password;
- this.tmpDir = tmpDir;
- this.checkoutdir = new File(this.tmpDir, "temp_rst" + id);
- this.remoteUrl = SVNURL.parseURIEncoded(svnPath);
+ try {
+ this.checkoutdir = FileUtil.createTempDirectory("", "");
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ try {
+ this.remoteUrl = SVNURL.parseURIEncoded(svnPath);
+ } catch (SVNException e) {
+ log.debug("SVNSESS NULL");
+ }
this.authManager = SVNWCUtil.createDefaultAuthenticationManager(this.checkoutdir, this.login, this.password, false);
this.svnOption = SVNWCUtil.createDefaultOptions(this.checkoutdir, false);
this.svnOption.setPropertyValue(SVNProperty.EOL_STYLE, SVNProperty.EOL_STYLE_LF);
@@ -233,14 +241,6 @@
this.svnPath = svnPath;
}
- public File getTmpDir() {
- return tmpDir;
- }
-
- public void setTmpDir(File tmpDir) {
- this.tmpDir = tmpDir;
- }
-
public String getLang() {
return lang;
}
Added: trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java
===================================================================
--- trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java (rev 0)
+++ trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java 2011-06-16 08:20:00 UTC (rev 119)
@@ -0,0 +1,218 @@
+package org.nuiton.scmwebeditor.actions;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.struts2.interceptor.ServletRequestAware;
+import org.nuiton.scmwebeditor.AbstractScmWebEditor;
+import org.nuiton.scmwebeditor.ScmWebEditorMainServlet;
+import org.nuiton.scmwebeditor.SvnSession;
+import org.tmatesoft.svn.core.SVNAuthenticationException;
+import org.tmatesoft.svn.core.SVNDepth;
+import org.tmatesoft.svn.core.SVNException;
+import org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory;
+import org.tmatesoft.svn.core.wc.ISVNRepositoryPool;
+import org.tmatesoft.svn.core.wc.SVNRevision;
+import org.tmatesoft.svn.core.wc.SVNUpdateClient;
+
+public class ScmWebEditorMainAction extends AbstractScmWebEditor implements ServletRequestAware {
+
+ private static final Log log = LogFactory.getLog(ScmWebEditorMainAction.class);
+
+ protected String address;
+ protected String projectUrl;
+ protected String fileName;
+ protected String format;
+ protected String lang;
+ protected String defaultLang;
+
+ protected HttpServletRequest request;
+
+
+ public String getAddress() {
+ return address;
+ }
+
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+
+ public String getProjectUrl() {
+ return projectUrl;
+ }
+
+
+ public void setProjectUrl(String projectUrl) {
+ this.projectUrl = projectUrl;
+ }
+
+
+ public String getFileName() {
+ return fileName;
+ }
+
+
+ public void setFileName(String fileName) {
+ this.fileName = fileName;
+ }
+
+
+ public String getFormat() {
+ return format;
+ }
+
+
+ public void setFormat(String format) {
+ this.format = format;
+ }
+
+
+ public String getLang() {
+ return lang;
+ }
+
+
+ public void setLang(String lang) {
+ this.lang = lang;
+ }
+
+
+ public String getDefaultLang() {
+ return defaultLang;
+ }
+
+
+ public void setDefaultLang(String defaultLang) {
+ this.defaultLang = defaultLang;
+ }
+
+
+ /**
+ * On test si les parametres ne sont pas vide
+ * @return
+ */
+ private boolean testParameters() {
+ if (address == null || address.length() == 0
+ || fileName == null || fileName.length() == 0) {
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+
+ public String execute() {
+
+
+
+ log.debug("--------------------------");
+ log.debug("Connection to SCMWebEditor");
+ log.debug("--------------------------");
+
+ /* Si il n'y a pas de parametre, l'utilisateur est renvoyé
+ * vers la page de configuration (OutConnection)
+ */
+ if(testParameters()) {
+ return "noParameter";
+ }
+
+ HttpSession httpSession = request.getSession(true);
+ System.setProperty("file.encoding", "UTF-8");
+
+ //SvnSession object creation if doesn't already exist
+ SvnSession svnSess = getSvnSession(httpSession);
+ String scmUrl = address.startsWith("scm:svn:") ? address.replace("scm:svn:", "") : address;
+
+ format = request.getParameter(PARAMETER_FORMAT) != null ? request.getParameter(PARAMETER_FORMAT) : "";
+
+ String relativePath = "/src/site/" + lang + "/" +( format.equals("") ? "" : format+"/");
+ if (lang.equals(defaultLang)) {
+ // on a maven site, default locale is on root
+ relativePath = "/src/site/" +( format.equals("") ? "" : format+"/");
+ projectUrl = projectUrl.replace("/"+defaultLang+"/", "/");
+ }
+
+ String scmPath = address.endsWith(relativePath) ? "" : relativePath;
+
+ String scmFilename = fileName.endsWith(".html") ? fileName.replace(".html", "." + format) : fileName;
+
+ String tmp_log = null;
+ String tmp_pass = null;
+ if (svnSess != null) {
+ tmp_log = svnSess.getLogin();
+ tmp_pass = svnSess.getPassword();
+ }
+
+ svnSess = new SvnSession(
+ scmUrl + scmPath,
+ scmFilename,
+ projectUrl,
+ tmp_log,
+ tmp_pass,
+ httpSession.getId(),
+ lang,
+ defaultLang,
+ format,
+ request.getRequestURL());
+
+ log.debug("VALEUR SVNSESS 1: "+svnSess);
+
+ setSvnSession(httpSession, svnSess);
+// Tempdir creation on servlet default temporary directory
+
+
+ DAVRepositoryFactory.setup();
+ SVNUpdateClient upclient = new SVNUpdateClient(svnSess.getManager(), svnSess.getSvnOption());
+
+
+ log.debug("VALEUR SVNSESS 2: "+svnSess);
+// Checkout svn and file organisation
+ try {
+ if (log.isDebugEnabled()) {
+ log.debug("Do Checkout of " + svnSess.getRemoteUrl());
+ }
+ upclient.doCheckout(svnSess.getRemoteUrl(), svnSess.getCheckoutdir(),
+ SVNRevision.HEAD, SVNRevision.HEAD, SVNDepth.FILES, false);
+ } catch (SVNAuthenticationException authexep) {
+ // if svn authentication failed user is redirected on login page
+ log.debug("Private SCM on reading " + svnSess.getRemoteUrl());
+ try {
+ svnSess.cleanCheckoutDir();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ return "private";
+ } catch (SVNException e) {
+
+ return "erreurPath";
+ }
+
+
+ File file_in_dir = new File(svnSess.getCheckoutdir(), svnSess.getFileName());
+
+
+ return "editPage";
+
+
+ }
+
+
+ @Override
+ public void setServletRequest(HttpServletRequest request) {
+ this.request = request;
+
+ }
+
+
+
+}
Added: trunk/src/main/resources/struts.xml
===================================================================
--- trunk/src/main/resources/struts.xml (rev 0)
+++ trunk/src/main/resources/struts.xml 2011-06-16 08:20:00 UTC (rev 119)
@@ -0,0 +1,15 @@
+<!DOCTYPE struts PUBLIC
+"-//Apache Software Foundation//DTD Struts Configuration
+2.0//EN"
+"http://struts.apache.org/dtds/struts-2.0.dtd">
+<struts>
+ <package name="action" extends="struts-default">
+
+ <action name="main" class="org.nuiton.scmwebeditor.actions.ScmWebEditorMainAction" method="execute">
+ <result name="noParameter" >/OutConnection.jsp</result>
+ <result name="private" >/PrivateSvnRedirect.jsp</result>
+ <result name="erreurPath" >/BadFileRedirect.jsp?scmEditorUrl=index.jsp</result>
+ <result name="editPage" >/accueil.jsp</result>
+ </action>
+ </package>
+</struts>
\ No newline at end of file
Modified: trunk/src/main/webapp/BadFileRedirect.jsp
===================================================================
--- trunk/src/main/webapp/BadFileRedirect.jsp 2011-06-07 20:09:55 UTC (rev 118)
+++ trunk/src/main/webapp/BadFileRedirect.jsp 2011-06-16 08:20:00 UTC (rev 119)
@@ -11,13 +11,13 @@
<link rel="icon" href="img/ScmWebEditor_little.png" type="image/png">
<link rel="stylesheet" type="text/css" href="css/main.css">
<meta http-equiv="Refresh" content="3; url=
-<%=request.getAttribute("scmEditorUrl")%>">
+<%=request.getParameter("scmEditorUrl")%>">
</head>
<body>
<a target="_blank" href="http://maven-site.nuiton.org/scmwebeditor/"><img src="img/ScmWebEditor_main.png" alt="$alt" /></a>
<p>Bad SCM path or file name! Please correct it.</p>
<p>You should be transferred automatically to the form page. If not
-please <a href="<%=request.getAttribute("scmEditorUrl")%>">click
+please <a href="<%=request.getParameter("scmEditorUrl")%>">click
this link</a>.</p>
<p>©2004-2009 CodeLutin</p>
</body>
Modified: trunk/src/main/webapp/ModificationViewer.jsp
===================================================================
--- trunk/src/main/webapp/ModificationViewer.jsp 2011-06-07 20:09:55 UTC (rev 118)
+++ trunk/src/main/webapp/ModificationViewer.jsp 2011-06-16 08:20:00 UTC (rev 119)
@@ -41,7 +41,7 @@
<input title="Save your work and continue editing this file." type="button" value="Save and Continue Editing" name="SaveandC" onclick="javascript:saver(this.form.Mytext, this.form.username, this.form.pw, this.form.Commit_message, this.form.Orig_text, this.form.scmEditorUrl);"/>
<input title="Save this file and go back to previous page." type="submit" value="Save and Quit" name="Save"/>
<%if (request.getAttribute("format").equals("rst") == true){
- %><input title="html preview of the curretn rst file state." type="button" value="Preview" name="Preview" onclick="javascript:preview(this.form.Mytext, this.form.previewServletUrl);"/><%}%>
+ %><input title="html preview of the current rst file state." type="button" value="Preview" name="Preview" onclick="javascript:preview(this.form.Mytext, this.form.previewServletUrl);"/><%}%>
<input title="Reset text as current repository HEAD revision." type="reset" value="Reset" name="Reset" alt="Test plop plop plop"/>
<input type="hidden" value="<%=request.getAttribute("Project_url")%>" name="Project_url">
<input title="Exit ScmWebEditor without saving." type="button" value="Exit" name="Cancel" onclick="javascript:cancelRedirectDelete(this.form.Orig_text, this.form.username, this.form.pw, this.form.Commit_message, this.form.Project_url, this.form.scmEditorUrl);"/>
Modified: trunk/src/main/webapp/OutConnection.jsp
===================================================================
--- trunk/src/main/webapp/OutConnection.jsp 2011-06-07 20:09:55 UTC (rev 118)
+++ trunk/src/main/webapp/OutConnection.jsp 2011-06-16 08:20:00 UTC (rev 119)
@@ -21,9 +21,9 @@
</h4>
</center>
<center>
-<form method="get" action=<%=request.getAttribute("scmEditorUri")%>>
- <p><label>SCM path: <input TYPE=text name="adresse" SIZE=100></label><input type="button" value="Search Files" name="search" onclick="javascript:fileSearch(this.form.adresse, this.form.searchServletUrl);"/></p>
- <p><label>File name: <input TYPE=text NAME=file_name SIZE=20></label>
+<form method="get" action="main.action">
+ <p><label>SCM path: <input TYPE=text name="address" SIZE=100></label><input type="button" value="Search Files" name="search" onclick="javascript:fileSearch(this.form.adresse, this.form.searchServletUrl);"/></p>
+ <p><label>File name: <input TYPE=text NAME=fileName SIZE=20></label>
<label>File type: <select name=format>
<option value="rst">Rst
<option value="apt">Apt
@@ -37,6 +37,7 @@
<option value="en">En
</select></label></p>
+<input type="hidden" name="projectUrl" value="<%=request.getRequestURL()%>" />
<input type="hidden" name="searchServletUrl" value="<%=request.getAttribute("searchServletUrl")%>"/>
<input type="submit" name="Save" /></form>
</center>
Modified: trunk/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/src/main/webapp/WEB-INF/web.xml 2011-06-07 20:09:55 UTC (rev 118)
+++ trunk/src/main/webapp/WEB-INF/web.xml 2011-06-16 08:20:00 UTC (rev 119)
@@ -1,44 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http:/java.sun.com/dtd/web-app_2_3.dtd">
- <servlet>
- <servlet-name>ScmWebEditorMainServlet</servlet-name>
- <servlet-class>org.nuiton.scmwebeditor.ScmWebEditorMainServlet</servlet-class>
- </servlet>
- <servlet>
- <servlet-name>PreviewServlet</servlet-name>
- <servlet-class>org.nuiton.scmwebeditor.PreviewServlet</servlet-class>
- </servlet>
- <servlet>
- <servlet-name>PrivateSvnServlet</servlet-name>
- <servlet-class>org.nuiton.scmwebeditor.PrivateSvnServlet</servlet-class>
- </servlet>
-<!-- <servlet>-->
-<!-- <servlet-name>PictureUpload</servlet-name>-->
-<!-- <servlet-class>org.nuiton.scmwebeditor.PictureUpload</servlet-class>-->
-<!-- </servlet>-->
+
+
+ <filter>
+ <filter-name>struts2</filter-name>
+ <filter-class>
+ org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
+ </filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>struts2</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+
+ <welcome-file-list>
+ <welcome-file>index.jsp</welcome-file>
+ </welcome-file-list>
+
+ <!--
<servlet>
+ <servlet-name>ScmWebEditorMainServlet</servlet-name>
+ <servlet-class>org.nuiton.scmwebeditor.ScmWebEditorMainServlet</servlet-class>
+ </servlet>
+ <servlet>
+ <servlet-name>PreviewServlet</servlet-name>
+ <servlet-class>org.nuiton.scmwebeditor.PreviewServlet</servlet-class>
+ </servlet>
+ <servlet>
+ <servlet-name>PrivateSvnServlet</servlet-name>
+ <servlet-class>org.nuiton.scmwebeditor.PrivateSvnServlet</servlet-class>
+ </servlet>
+ -->
+
+<!-- <servlet>-->
+<!-- <servlet-name>PictureUpload</servlet-name>-->
+<!-- <servlet-class>org.nuiton.scmwebeditor.PictureUpload</servlet-class>-->
+<!-- </servlet>-->
+<!--
+ <servlet>
<servlet-name>SearchServlet</servlet-name>
<servlet-class>org.nuiton.scmwebeditor.SearchServlet</servlet-class>
</servlet>
<servlet-mapping>
- <servlet-name>ScmWebEditorMainServlet</servlet-name>
- <url-pattern>/scmwebeditor</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>PreviewServlet</servlet-name>
- <url-pattern>/previewservlet</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>PrivateSvnServlet</servlet-name>
- <url-pattern>/privatesvnservlet</url-pattern>
- </servlet-mapping>
-<!-- <servlet-mapping>-->
-<!-- <servlet-name>PictureUpload</servlet-name>-->
-<!-- <url-pattern>/pictureUpload</url-pattern>-->
-<!-- </servlet-mapping>-->
-
+ <servlet-name>ScmWebEditorMainServlet</servlet-name>
+ <url-pattern>/scmwebeditor</url-pattern>
+ </servlet-mapping>
<servlet-mapping>
+ <servlet-name>PreviewServlet</servlet-name>
+ <url-pattern>/previewservlet</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>PrivateSvnServlet</servlet-name>
+ <url-pattern>/privatesvnservlet</url-pattern>
+ </servlet-mapping>
+-->
+<!-- <servlet-mapping>-->
+<!-- <servlet-name>PictureUpload</servlet-name>-->
+<!-- <url-pattern>/pictureUpload</url-pattern>-->
+<!-- </servlet-mapping>-->
+<!--
+ <servlet-mapping>
<servlet-name>SearchServlet</servlet-name>
<url-pattern>/searchservlet</url-pattern>
</servlet-mapping>
- </web-app>
+ -->
+
+</web-app>
Added: trunk/src/main/webapp/accueil.jsp
===================================================================
--- trunk/src/main/webapp/accueil.jsp (rev 0)
+++ trunk/src/main/webapp/accueil.jsp 2011-06-16 08:20:00 UTC (rev 119)
@@ -0,0 +1,9 @@
+<%@ page contentType="text/html; charset=UTF-8" %>
+<html>
+ <head>
+ </head>
+
+ <body>
+ <p>Parametres detectés</p>
+ </body>
+</html>
\ No newline at end of file
Added: trunk/src/main/webapp/index.jsp
===================================================================
--- trunk/src/main/webapp/index.jsp (rev 0)
+++ trunk/src/main/webapp/index.jsp 2011-06-16 08:20:00 UTC (rev 119)
@@ -0,0 +1,3 @@
+<%
+response.sendRedirect("main.action");
+%>
\ No newline at end of file
1
0
Author: tchemit
Date: 2011-06-07 22:09:55 +0200 (Tue, 07 Jun 2011)
New Revision: 118
Url: http://nuiton.org/repositories/revision/scmwebeditor/118
Log:
Update mavenpom4redmine to 2.5.5.
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-05-25 08:28:43 UTC (rev 117)
+++ trunk/pom.xml 2011-06-07 20:09:55 UTC (rev 118)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmine</artifactId>
- <version>2.5.4</version>
+ <version>2.5.5</version>
</parent>
<artifactId>scmwebeditor</artifactId>
1
0
Author: echatellier
Date: 2011-05-25 10:28:43 +0200 (Wed, 25 May 2011)
New Revision: 117
Url: http://nuiton.org/repositories/revision/scmwebeditor/117
Log:
Modify project name
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-05-14 11:45:29 UTC (rev 116)
+++ trunk/pom.xml 2011-05-25 08:28:43 UTC (rev 117)
@@ -73,7 +73,7 @@
<!-- *** Project Information ************************************* -->
<!-- ************************************************************* -->
- <name>Nuiton-ScmWebEditor</name>
+ <name>ScmWebEditor</name>
<description>ScmWebEditor is a web based sources editor.</description>
<inceptionYear>2009</inceptionYear>
<url>http://maven-site.nuiton.org/${project.artifactId}</url>
1
0