r211 - in trunk/src/main: java/org/nuiton/scmwebeditor/actions resources resources/i18n webapp/WEB-INF/content webapp/css
Author: kcardineaud Date: 2011-08-11 15:11:10 +0200 (Thu, 11 Aug 2011) New Revision: 211 Url: http://nuiton.org/repositories/revision/scmwebeditor/211 Log: Add a confirmation message when rst is not valid, before commit and quit Added: trunk/src/main/webapp/WEB-INF/content/badRstFile.jsp Modified: trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java trunk/src/main/resources/i18n/scmwebeditor_en_GB.properties trunk/src/main/resources/i18n/scmwebeditor_fr_FR.properties trunk/src/main/resources/struts.xml trunk/src/main/webapp/WEB-INF/content/modificationViewer.jsp trunk/src/main/webapp/WEB-INF/content/privateSvnRedirect.jsp trunk/src/main/webapp/WEB-INF/content/save.jsp trunk/src/main/webapp/css/main.css Modified: trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java =================================================================== --- trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java 2011-08-10 13:01:51 UTC (rev 210) +++ trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java 2011-08-11 13:11:10 UTC (rev 211) @@ -130,7 +130,7 @@ - protected boolean testRstParsing(String newText) { + protected boolean isRstValid(String newText) { try { JRST.generate(JRST.TYPE_HTML, newText); if(log.isDebugEnabled()) { @@ -153,7 +153,7 @@ if(!force) { if(format.equals("rst")) { - if(!testRstParsing(newText)) { + if(!isRstValid(newText)) { return "errorRst"; } } @@ -184,7 +184,7 @@ log.info("username : |"+login+"|"); - if( ( login==null ) && ( password==null ) ) { + if( ( login==null || login.equals("") ) && ( password==null || password.equals("") ) ) { if(getScmSession().getUsername(repositoryUUID)!=null && getScmSession().getPassword(repositoryUUID)!=null) { //On recupère les identifiants en session login = getScmSession().getUsername(repositoryUUID); Modified: trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java =================================================================== --- trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java 2011-08-10 13:01:51 UTC (rev 210) +++ trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java 2011-08-11 13:11:10 UTC (rev 211) @@ -9,10 +9,8 @@ import java.util.Map.Entry; import java.util.Properties; - import javax.servlet.http.HttpServletRequest; - import org.apache.commons.lang.StringEscapeUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -28,6 +26,7 @@ import org.tmatesoft.svn.core.io.SVNRepository; import org.tmatesoft.svn.core.io.SVNRepositoryFactory; + import com.opensymphony.xwork2.Action; @@ -61,7 +60,7 @@ protected String repositoryId; - + protected boolean fromLoginPage; @@ -123,8 +122,11 @@ } - + public void setFromLoginPage(boolean fromLoginPage) { + this.fromLoginPage = fromLoginPage; + } + /** * On test si les parametres ne sont pas vide * @return @@ -160,8 +162,11 @@ // } - projectUrl=request.getHeader("referer"); + if(!this.fromLoginPage) { + projectUrl=request.getHeader("referer"); + } + if(log.isDebugEnabled()) { log.debug("ProjectUrl= "+projectUrl); } @@ -409,7 +414,7 @@ } - + return "editPage"; @@ -422,10 +427,5 @@ } - - - - - } Modified: trunk/src/main/resources/i18n/scmwebeditor_en_GB.properties =================================================================== --- trunk/src/main/resources/i18n/scmwebeditor_en_GB.properties 2011-08-10 13:01:51 UTC (rev 210) +++ trunk/src/main/resources/i18n/scmwebeditor_en_GB.properties 2011-08-11 13:11:10 UTC (rev 211) @@ -18,6 +18,7 @@ scm.modificationViewer.betterUseJavascript=For a better use of SCMWebEditor please activate JavaScript. scm.modificationViewer.noJavascript=Javascript is not activated. You can't only use Save and Quit or upload button. scm.mustBeLog=You must be login to see this repository. +scm.no=No scm.outConnection.enterRepo=Please enter your repository address. scm.outConnection.noJavascript=Javascript is not activated. Please activate it for a fully use of ScmWebEditor. scm.outConnection.scmPath=SCM path \: @@ -29,6 +30,7 @@ scm.redirection=Redirection... scm.reset=Reset scm.resetTitle=Go back to the last revision of the file +scm.rstNotValidMessage=The rst is not valid, do you still want to continue ? scm.saveAndContinue=Save and Continue Editing scm.saveAndContinueTitle=Commit modifications and continue editing the file. scm.saveAndQuit=Save and quit @@ -43,3 +45,4 @@ scm.username=Username scm.usernameTitle=Repository username scm.welcome=Welcome on SCMWebEditor +scm.yes=Yes Modified: trunk/src/main/resources/i18n/scmwebeditor_fr_FR.properties =================================================================== --- trunk/src/main/resources/i18n/scmwebeditor_fr_FR.properties 2011-08-10 13:01:51 UTC (rev 210) +++ trunk/src/main/resources/i18n/scmwebeditor_fr_FR.properties 2011-08-11 13:11:10 UTC (rev 211) @@ -18,6 +18,7 @@ scm.modificationViewer.betterUseJavascript= scm.modificationViewer.noJavascript=Javascript est desactive. Vous pouvais seulement utiliser les boutons sauvegarder et quitter, quitter ou upload. scm.mustBeLog=Vous devez vous identifier pour parcourir ce depot. +scm.no=Non scm.outConnection.enterRepo=Entrez l''adresse de votre depot. scm.outConnection.noJavascript=Javascript n''est pas active. Certaines fonctions ne serons pas accessible. scm.outConnection.scmPath=Repertoire SCM \: @@ -29,6 +30,7 @@ scm.redirection=Redirection... scm.reset=Reinitialiser scm.resetTitle=Retour a la derniere revision du fichier +scm.rstNotValidMessage=The Rst n''est pas valide, voulez-vous continuer ? scm.saveAndContinue=Sauvegarder et continuer scm.saveAndContinueTitle=Enregister les modifications sur le depot et continuer d''editer le fichier scm.saveAndQuit=Sauvegarder et quitter @@ -43,3 +45,4 @@ scm.username=Identifiant scm.usernameTitle=Identifiant du depot scm.welcome=Bienvenue sur SCMWebEditor +scm.yes=Oui Modified: trunk/src/main/resources/struts.xml =================================================================== --- trunk/src/main/resources/struts.xml 2011-08-10 13:01:51 UTC (rev 210) +++ trunk/src/main/resources/struts.xml 2011-08-11 13:11:10 UTC (rev 211) @@ -21,7 +21,7 @@ <result name="login" >/WEB-INF/content/modificationViewer.jsp</result> <result name="error">/WEB-INF/content/badFileRedirect.jsp</result> <result name="errorPath">/WEB-INF/content/badFileRedirect.jsp</result> - <result name="errorRst">/WEB-INF/content/badFileRedirect.jsp</result> + <result name="errorRst">/WEB-INF/content/badRstFile.jsp</result> </action> <action name="save" class="org.nuiton.scmwebeditor.actions.SaveAction" method="save"> Added: trunk/src/main/webapp/WEB-INF/content/badRstFile.jsp =================================================================== --- trunk/src/main/webapp/WEB-INF/content/badRstFile.jsp (rev 0) +++ trunk/src/main/webapp/WEB-INF/content/badRstFile.jsp 2011-08-11 13:11:10 UTC (rev 211) @@ -0,0 +1,50 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> +<%@ taglib prefix="s" uri="/struts-tags"%> +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title>RST is not valid</title> +<link rel="icon" href="img/ScmWebEditor_little.png" type="image/png"> +<link rel="stylesheet" type="text/css" href="css/main.css"> +</head> +<body> + <form id="forceCommitForm" method="POST" action="commit.action" > + <h4><s:text name="scm.rstNotValidMessage" /></h4> + + <input type="hidden" name="force" value="true"/> + <s:hidden name="address" value="%{address}" /> + <s:hidden name="commitMessage" value="%{commitMessage}" /> + <s:hidden name="newText" value="%{newText}" /> + <s:hidden name="lastText" value="%{lastText}" /> + <s:hidden name="fileType" value="%{fileType}" /> + <s:hidden name="projectUrl" value="%{projectUrl}" /> + <s:hidden name="format" value="%{format}" /> + + <s:hidden name="username" value="%{username}" /> + <s:hidden name="pw" value="%{pw}" /> + + + <s:set id="scm.yes"> + <s:text name="scm.yes"/> + </s:set> + + <s:submit + id="ajaxForceCommitButton" + formIds="forceCommitForm" + indicator="indicator" + button="true" + buttonIcon="ui-icon-refresh" + value="%{scm.yes}" + > + </s:submit> + + <s:set id="scm.no"> + <s:text name="scm.no"/> + </s:set> + <s:submit type="button" value="%{scm.no}" onclick="history.back();return false;" /> + + </form> +</body> +</html> \ No newline at end of file Modified: trunk/src/main/webapp/WEB-INF/content/modificationViewer.jsp =================================================================== --- trunk/src/main/webapp/WEB-INF/content/modificationViewer.jsp 2011-08-10 13:01:51 UTC (rev 210) +++ trunk/src/main/webapp/WEB-INF/content/modificationViewer.jsp 2011-08-11 13:11:10 UTC (rev 211) @@ -65,7 +65,7 @@ </center> - <form method="POST" action="commit.action?force=true" id="editForm"> + <form method="POST" action="commit.action" id="editForm"> <% if (request.getAttribute("format")!=null){ @@ -153,8 +153,6 @@ </s:set> <s:textfield required="true" label="%{scm.commitMessage}" name="commitMessage" title="%{scm.commitMessageTitle}" /> - - <p> @@ -204,7 +202,7 @@ } else { %> <s:text name="scm.logAs" /> <%=usernameSvn%> <br/> - + <% } %> Modified: trunk/src/main/webapp/WEB-INF/content/privateSvnRedirect.jsp =================================================================== --- trunk/src/main/webapp/WEB-INF/content/privateSvnRedirect.jsp 2011-08-10 13:01:51 UTC (rev 210) +++ trunk/src/main/webapp/WEB-INF/content/privateSvnRedirect.jsp 2011-08-11 13:11:10 UTC (rev 211) @@ -16,6 +16,7 @@ <a target="_blank" href="http://maven-site.nuiton.org/scmwebeditor/"><img src="img/ScmWebEditor_main.png" alt="$alt" /></a> <form method="post" action="checkout.action" > <input type="hidden" name="address" value="<%=request.getAttribute("address")%>"/> +<input type="hidden" name="fromLoginPage" value="true"> <% if(request.getAttribute("projectUrl")!=null) { %> <input type="hidden" name="ProjectUrl" value="<%=request.getAttribute("projectUrl")%>"/> Modified: trunk/src/main/webapp/WEB-INF/content/save.jsp =================================================================== --- trunk/src/main/webapp/WEB-INF/content/save.jsp 2011-08-10 13:01:51 UTC (rev 210) +++ trunk/src/main/webapp/WEB-INF/content/save.jsp 2011-08-11 13:11:10 UTC (rev 211) @@ -11,7 +11,7 @@ </s:elseif> <s:elseif test="result=='errorRst'" > - <h4> The rst is not valid, do you still want to continue ? </h4> + <h4> <s:text name="scm.rstNotValidMessage" /> </h4> <s:url id="ajaxForceSave" action="save" /> <input type="hidden" name="force" value="true"/> <sj:submit onclick="loadChange()" Modified: trunk/src/main/webapp/css/main.css =================================================================== --- trunk/src/main/webapp/css/main.css 2011-08-10 13:01:51 UTC (rev 210) +++ trunk/src/main/webapp/css/main.css 2011-08-11 13:11:10 UTC (rev 211) @@ -8,15 +8,15 @@ img { - border:none; - } + border:none; + } .wwlbl , .wwctrl { display:inline; } .ui-icon-document { - background-image:url("../img/file.png") !important; + background-image:url("../img/file.png") !important; background-position: 0 1px !important ; } @@ -28,6 +28,15 @@ text-align:center; } +#forceCommitForm { + width:70%; + margin:auto; + display:block; + padding:1%; + text-align:center; + width:30% +} + #wwctrl_Save, #wwctrl_Cancel, #wwctrl_uploadButton { text-align:center; }
participants (1)
-
kcardineaud@users.nuiton.org