r218 - in trunk/src/main: java/org/nuiton/scmwebeditor java/org/nuiton/scmwebeditor/actions resources resources/i18n webapp/WEB-INF/content webapp/css
Author: kcardineaud Date: 2011-08-17 18:00:44 +0200 (Wed, 17 Aug 2011) New Revision: 218 Url: http://nuiton.org/repositories/revision/scmwebeditor/218 Log: Add a conflits detection system when commit Added: trunk/src/main/webapp/WEB-INF/content/fileModify.jsp Modified: trunk/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorBaseAction.java trunk/src/main/java/org/nuiton/scmwebeditor/SvnConnection.java trunk/src/main/java/org/nuiton/scmwebeditor/actions/ResetAction.java trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java trunk/src/main/resources/i18n/scmwebeditor_en_GB.properties trunk/src/main/resources/i18n/scmwebeditor_fr_FR.properties trunk/src/main/resources/struts.xml trunk/src/main/webapp/WEB-INF/content/badRstFile.jsp trunk/src/main/webapp/WEB-INF/content/modificationViewer.jsp trunk/src/main/webapp/WEB-INF/content/reset.jsp trunk/src/main/webapp/WEB-INF/content/save.jsp trunk/src/main/webapp/css/main.css Modified: trunk/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorBaseAction.java =================================================================== --- trunk/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorBaseAction.java 2011-08-16 23:13:01 UTC (rev 217) +++ trunk/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorBaseAction.java 2011-08-17 16:00:44 UTC (rev 218) @@ -37,12 +37,17 @@ import org.tmatesoft.svn.core.SVNDepth; import org.tmatesoft.svn.core.SVNException; import org.tmatesoft.svn.core.SVNNodeKind; +import org.tmatesoft.svn.core.SVNProperties; +import org.tmatesoft.svn.core.SVNProperty; import org.tmatesoft.svn.core.SVNURL; import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager; +import org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions; import org.tmatesoft.svn.core.io.SVNRepository; import org.tmatesoft.svn.core.io.SVNRepositoryFactory; +import org.tmatesoft.svn.core.wc.SVNInfo; import org.tmatesoft.svn.core.wc.SVNRevision; import org.tmatesoft.svn.core.wc.SVNUpdateClient; +import org.tmatesoft.svn.core.wc.SVNWCClient; import org.tmatesoft.svn.core.wc.SVNWCUtil; import org.xml.sax.SAXException; @@ -202,19 +207,48 @@ * @param checkoutdir * @throws SVNException */ - public void checkout(SvnConnection svnSess, File checkoutdir) throws SVNException { - + public void checkout(SvnConnection svnSess, File checkoutdir , String numVersion) throws SVNException { + SVNUpdateClient upclient = new SVNUpdateClient(svnSess.getManager(), svnSess.getSvnOption()); - if (log.isDebugEnabled()) { + if (log.isDebugEnabled()) { log.debug("Do Checkout of " + svnSess.getRemoteUrl()); } - upclient.doCheckout(svnSess.getRemoteUrl(), checkoutdir, - SVNRevision.HEAD, SVNRevision.HEAD, SVNDepth.FILES, false); + try { + upclient.doCheckout(svnSess.getRemoteUrl(), checkoutdir, + SVNRevision.create(Long.parseLong(numVersion)), SVNRevision.create(Long.parseLong(numVersion)), SVNDepth.FILES, false); + } + catch (NumberFormatException e) { + if(log.isErrorEnabled()) { + log.error("The number version is not valid."); + } + upclient.doCheckout(svnSess.getRemoteUrl(), checkoutdir, + SVNRevision.HEAD, SVNRevision.HEAD, SVNDepth.FILES, false); + + } + } + /** + * + * @param svnSess + * @param checkoutdir + * @throws SVNException + */ + public void checkout(SvnConnection svnSess, File checkoutdir) throws SVNException { + + SVNUpdateClient upclient = new SVNUpdateClient(svnSess.getManager(), svnSess.getSvnOption()); + + if (log.isDebugEnabled()) { + log.debug("Do Checkout of " + svnSess.getRemoteUrl()); + } + + upclient.doCheckout(svnSess.getRemoteUrl(), checkoutdir, + SVNRevision.HEAD, SVNRevision.HEAD, SVNDepth.FILES, false); + } + /** * * @param svnFile @@ -282,8 +316,13 @@ ByteArrayOutputStream baos = new ByteArrayOutputStream( ); - repository.getFile( file , -1 , null , baos ); + SVNProperties fileProperties = new SVNProperties(); + + repository.getFile( file , -1 , fileProperties , baos ); + fileProperties.getStringValue(SVNProperty.REVISION); + + lastRevision = baos.toString(); try { @@ -298,6 +337,42 @@ } + + public String getHeadNumberRevision(String address, String login, String password) throws SVNException { + + ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager( login , password ); + + DefaultSVNOptions svnOption = new DefaultSVNOptions(); + svnOption.setPropertyValue(SVNProperty.EOL_STYLE, SVNProperty.EOL_STYLE_LF); + + SVNWCClient wcClient = new SVNWCClient(authManager,svnOption); + + SVNInfo info = wcClient.doInfo(SVNURL.parseURIEncoded(address), SVNRevision.HEAD, SVNRevision.HEAD); + + String headRevision = info.getRevision().toString(); + + + return headRevision; + } + + public String getHeadcommiter(String address, String login, String password) throws SVNException { + + ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager( login , password ); + + DefaultSVNOptions svnOption = new DefaultSVNOptions(); + svnOption.setPropertyValue(SVNProperty.EOL_STYLE, SVNProperty.EOL_STYLE_LF); + + SVNWCClient wcClient = new SVNWCClient(authManager,svnOption); + + SVNInfo info = wcClient.doInfo(SVNURL.parseURIEncoded(address), SVNRevision.HEAD, SVNRevision.HEAD); + + String headAuthor = info.getAuthor(); + + + return headAuthor; + } + + /** * Use to delete the checkout temp directory * @param checkoutdir The dir temp directory Modified: trunk/src/main/java/org/nuiton/scmwebeditor/SvnConnection.java =================================================================== --- trunk/src/main/java/org/nuiton/scmwebeditor/SvnConnection.java 2011-08-16 23:13:01 UTC (rev 217) +++ trunk/src/main/java/org/nuiton/scmwebeditor/SvnConnection.java 2011-08-17 16:00:44 UTC (rev 218) @@ -24,9 +24,11 @@ */ package org.nuiton.scmwebeditor; +import org.apache.commons.io.FileUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.util.FileUtil; +import org.tmatesoft.svn.core.SVNDepth; import org.tmatesoft.svn.core.SVNException; import org.tmatesoft.svn.core.SVNProperty; import org.tmatesoft.svn.core.SVNURL; @@ -35,8 +37,11 @@ import org.tmatesoft.svn.core.io.SVNRepository; import org.tmatesoft.svn.core.io.SVNRepositoryFactory; import org.tmatesoft.svn.core.wc.SVNClientManager; +import org.tmatesoft.svn.core.wc.SVNDiffClient; +import org.tmatesoft.svn.core.wc.SVNRevision; import org.tmatesoft.svn.core.wc.SVNWCUtil; +import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; @@ -166,8 +171,58 @@ } + + + public boolean isDifferent(String text) throws IOException { + File pathToFile = new File(checkoutdir, getFileName()); + SVNDiffClient diffClient = new SVNDiffClient(getManager(), getSvnOption()); + + FileUtils.writeStringToFile(pathToFile, text); + + ByteArrayOutputStream diff = new ByteArrayOutputStream(); + + try { + diffClient.doDiff(pathToFile, SVNRevision.UNDEFINED, SVNRevision.WORKING, SVNRevision.HEAD, SVNDepth.INFINITY, true, diff, null); + } catch (SVNException e) { + log.error("Diff fail",e); + return false; + } + if(diff.size()>0) { + return true; + } + else { + return false; + } + + + } + + public ByteArrayOutputStream getDiff(String text) throws IOException { + File pathToFile = new File(checkoutdir, getFileName()); + + SVNDiffClient diffClient = new SVNDiffClient(getManager(), getSvnOption()); + + FileUtils.writeStringToFile(pathToFile, text); + + ByteArrayOutputStream diff = new ByteArrayOutputStream(); + + try { + diffClient.doDiff(pathToFile, SVNRevision.UNDEFINED, SVNRevision.WORKING, SVNRevision.HEAD, SVNDepth.INFINITY, true, diff, null); + } catch (SVNException e) { + log.error("Diff fail",e); + } + + + return diff; + + + + } + + + public ISVNAuthenticationManager getAuthManager() { return authManager; } Modified: trunk/src/main/java/org/nuiton/scmwebeditor/actions/ResetAction.java =================================================================== --- trunk/src/main/java/org/nuiton/scmwebeditor/actions/ResetAction.java 2011-08-16 23:13:01 UTC (rev 217) +++ trunk/src/main/java/org/nuiton/scmwebeditor/actions/ResetAction.java 2011-08-17 16:00:44 UTC (rev 218) @@ -17,6 +17,8 @@ protected String lastRevision; + protected String numRevision; + protected String address; protected String username; @@ -30,6 +32,10 @@ return lastRevision; } + public String getNumRevision() { + return numRevision; + } + public void setAddress(String address) { this.address = address; } @@ -54,6 +60,9 @@ lastRevision = getHeadRevision(address, username, pw); + numRevision=getHeadNumberRevision(address, username, pw); + + } catch (SVNAuthenticationException authexep) { if(log.isErrorEnabled()) { log.error("AUTH FAIL"); @@ -65,6 +74,7 @@ log.error("Can't reach the svn repository"); } error = "errorPath"; + numRevision=null; return "errorPath"; } catch (StringIndexOutOfBoundsException e) { if(log.isErrorEnabled()) { Modified: trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java =================================================================== --- trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java 2011-08-16 23:13:01 UTC (rev 217) +++ trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java 2011-08-17 16:00:44 UTC (rev 218) @@ -1,5 +1,6 @@ package org.nuiton.scmwebeditor.actions; +import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; @@ -14,13 +15,13 @@ import org.nuiton.jrst.JRST; import org.nuiton.scmwebeditor.ScmWebEditorBaseAction; import org.nuiton.scmwebeditor.SvnConnection; -import org.nuiton.util.FileUtil; import org.tmatesoft.svn.core.SVNAuthenticationException; import org.tmatesoft.svn.core.SVNDepth; import org.tmatesoft.svn.core.SVNException; import org.tmatesoft.svn.core.wc.SVNCommitClient; + import com.opensymphony.xwork2.Action; @@ -42,9 +43,14 @@ protected String lastText; protected String format; protected String projectUrl; + protected String diff; + protected String headCommiter; + protected boolean force; + protected String numRevision; + @@ -129,7 +135,22 @@ } + public String getNumRevision() { + return numRevision; + } + public void setNumRevision(String numRevision) { + this.numRevision = numRevision; + } + + public String getDiff() { + return diff; + } + + public String getHeadCommiter() { + return headCommiter; + } + protected boolean isRstValid(String newText) { try { JRST.generate(JRST.TYPE_HTML, newText); @@ -182,8 +203,6 @@ repositoryUUID=address; } - log.info("username : |"+login+"|"); - if( ( login==null || login.equals("") ) && ( password==null || password.equals("") ) ) { if(getScmSession().getUsername(repositoryUUID)!=null && getScmSession().getPassword(repositoryUUID)!=null) { //On recupère les identifiants en session @@ -204,13 +223,14 @@ File checkoutdir = null; try { - checkoutdir = FileUtil.createTempDirectory("scm_", ""); + svnConn.createCheckoutdir(); } catch (IOException e1) { if(log.isErrorEnabled()) { log.error("Can't create checkoutDir",e1); } return "error"; } + checkoutdir = svnConn.getCheckoutdir(); // Avant le commit, il faut checkout le repertoire @@ -253,7 +273,6 @@ request.setAttribute(ATTRIBUTE_ORIG_TEXT, StringEscapeUtils.escapeHtml(originalText)); - // End on first part } catch (FileNotFoundException ee) { /* fichier non trouve, on redirige vers BadFileRedirect.jsp @@ -268,24 +287,54 @@ + + /* + * Diff + */ + if(!force) { + try { + + if(svnConn.isDifferent(origText)) { + ByteArrayOutputStream differents = svnConn.getDiff(newText); + + if(differents.size()>0) { + diff=differents.toString(); + diff = diff.substring(diff.indexOf("@@")); + delTempDirectory(checkoutdir); + try { + headCommiter=getHeadcommiter(address, login, password); + } catch (SVNException e) { + log.error("Can't get head commiter",e); + } + return "fileModify"; + } + } + + } catch (IOException e) { + if(log.isErrorEnabled()) { + log.error("Can't do diff on file, IO error",e); + } + } + } + + + /* * Commit process */ - File pathToFile = new File(checkoutdir, svnConn.getFileName()); +// File pathToFile = new File(checkoutdir, svnConn.getFileName()); SVNCommitClient commitClient = new SVNCommitClient(svnConn.getManager(), svnConn.getSvnOption()); + + File pathToFile = new File(checkoutdir, svnConn.getFileName()); + try { FileUtils.writeStringToFile(pathToFile, newText); - } catch (IOException e) { - if(log.isErrorEnabled()) { - log.error("Can't write in file " , e); - } + } catch (IOException e1) { + delTempDirectory(checkoutdir); return "error"; } - - convertToUnicode(pathToFile); - File[] tabFile = new File[1]; tabFile[0] = pathToFile; @@ -339,6 +388,12 @@ log.info(login + " with IP "+request.getRemoteAddr()+" commit the file "+address+" with message : "+commitMessage); } + try { + numRevision=getHeadNumberRevision(address, login, password); + } catch (SVNException e) { + numRevision=null; + } + return "success"; } Modified: trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java =================================================================== --- trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java 2011-08-16 23:13:01 UTC (rev 217) +++ trunk/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java 2011-08-17 16:00:44 UTC (rev 218) @@ -34,6 +34,11 @@ protected String address; protected String projectUrl; protected String format; + protected String origText; + + + protected String numRevision; + protected String addressSvn; @@ -106,10 +111,18 @@ } + public String getOrigText() { + return origText; + } + + public String getProjectUrl() { return projectUrl; } + public String getNumRevision() { + return numRevision; + } public void setProjectUrl(String projectUrl) { this.projectUrl = projectUrl; @@ -120,6 +133,8 @@ this.fromLoginPage = fromLoginPage; } + + /** * On test si les parametres ne sont pas vide @@ -258,6 +273,7 @@ try { originalText = getHeadRevision(address, username, pw); + numRevision = getHeadNumberRevision(address, username, pw); } catch (SVNAuthenticationException authexep) { @@ -344,7 +360,7 @@ - request.setAttribute(ATTRIBUTE_ORIG_TEXT, StringEscapeUtils.escapeHtml(originalText)); + origText=StringEscapeUtils.escapeHtml(originalText); request.setAttribute(ATTRIBUTE_PROJECT_URL, projectUrl); if(log.isInfoEnabled()) { Modified: trunk/src/main/resources/i18n/scmwebeditor_en_GB.properties =================================================================== --- trunk/src/main/resources/i18n/scmwebeditor_en_GB.properties 2011-08-16 23:13:01 UTC (rev 217) +++ trunk/src/main/resources/i18n/scmwebeditor_en_GB.properties 2011-08-17 16:00:44 UTC (rev 218) @@ -2,6 +2,8 @@ scm.badPathOrFileName=Bad repository path or file name, or the file is not editable \! Please correct it. scm.badUsernameOrPassword=Bad username or password scm.beTransferred=You should be transferred automatically to the new page. If not please +scm.by=By +scm.cannotSave=Can't save modification. scm.clickHere=click here scm.commitMessage=Commit message scm.commitMessageTitle=let a message for commit @@ -9,10 +11,13 @@ scm.exit=Exit scm.exitJavascript=Exit ScmWebEditor without saving ? All modification will be lost. scm.exitTitle=Exit ScmWebEditor without saving. +scm.fileModify=File modify while editing. +scm.forceSave=Force save scm.formTransferred=You should be transferred automatically to the form page. If not please scm.info.ProblemWithRst=For any Problem with RestruturedText visit scm.info.rstWebsite=RST documentation website scm.language=Language +scm.lastChangeSave=Last change save scm.logAs=You are log as \: scm.loginButton=Login scm.modificationViewer.betterUseJavascript=For a better use of SCMWebEditor please activate JavaScript. @@ -25,6 +30,7 @@ scm.outConnection.search=Search scm.password=Password scm.passwordTitle=Repository password +scm.pathError=Path error scm.preview=Preview scm.privateScmAccess=You try to access a Private SCM. Please login scm.redirection=Redirection... @@ -35,6 +41,7 @@ scm.saveAndContinueTitle=Commit modifications and continue editing the file. scm.saveAndQuit=Save and quit scm.saveAndQuitTitle=Save this file and go back to previous page. +scm.showDiff=Show differences scm.text=Text scm.thankUsing=Thank you using SCMWebEditor scm.upload=Upload @@ -42,6 +49,7 @@ scm.uploadPath=Path on Repository scm.uploadSuccess=File upload successful scm.uploadTitle=Upload a file on the repository +scm.uselessSave=It's useless to save the file, file is not modify. scm.username=Username scm.usernameTitle=Repository username scm.welcome=Welcome on SCMWebEditor Modified: trunk/src/main/resources/i18n/scmwebeditor_fr_FR.properties =================================================================== --- trunk/src/main/resources/i18n/scmwebeditor_fr_FR.properties 2011-08-16 23:13:01 UTC (rev 217) +++ trunk/src/main/resources/i18n/scmwebeditor_fr_FR.properties 2011-08-17 16:00:44 UTC (rev 218) @@ -2,6 +2,8 @@ scm.badPathOrFileName=L''adresse du depot ou le nom du fichier est incorrect, ou le fichier n''est pas editable \! scm.badUsernameOrPassword=Identifiant ou mot de passe incorrect scm.beTransferred=Vous devriez etre redirige sur une nouvelle page. si non +scm.by=Par +scm.cannotSave=Modification impossible scm.clickHere=cliquez ici scm.commitMessage=Message associe au commit scm.commitMessageTitle=laisser un message pour le commit @@ -9,13 +11,16 @@ scm.exit=Quitter scm.exitJavascript=Quitter ScmWebEditor sans sauvegarder ? Toutes les modifications serons perdues. scm.exitTitle=Quitter ScmWebEditor sans sauvegarder. +scm.fileModify=Fichier modifie pendant l'edition. +scm.forceSave=Forcer la sauvegarde scm.formTransferred=Vous devriez etre redirige vers la page du formulaire. si non scm.info.ProblemWithRst=Si vous rencontrez des problemes avec RestruturedText, visitez le scm.info.rstWebsite=site de la documentation RST scm.language=Langage +scm.lastChangeSave=Derniere sauvegarde effectuee scm.logAs=Connecte en tant que \: scm.loginButton=Connexion -scm.modificationViewer.betterUseJavascript= +scm.modificationViewer.betterUseJavascript=Activer Javascript pour acceder a toute les fonctionnalitees. scm.modificationViewer.noJavascript=Javascript est desactive. Vous pouvais seulement utiliser les boutons sauvegarder et quitter, quitter ou upload. scm.mustBeLog=Vous devez vous identifier pour parcourir ce depot. scm.no=Non @@ -25,6 +30,7 @@ scm.outConnection.search=Chercher scm.password=Mot de passe scm.passwordTitle=Mot de passe du depot +scm.pathError=erreur dans le chemin scm.preview=Apercu scm.privateScmAccess=Pour modifier ce fichier, veuillez vous connecter. scm.redirection=Redirection... @@ -35,13 +41,15 @@ scm.saveAndContinueTitle=Enregister les modifications sur le depot et continuer d''editer le fichier scm.saveAndQuit=Sauvegarder et quitter scm.saveAndQuitTitle=Sauvegarder le fichier sur le depot et retourner à la page precedente. +scm.showDiff=Voir les differences scm.text=Texte -scm.thankUsing=merci d'avoir utilise SCMWebEditor +scm.thankUsing=merci d''avoir utilise SCMWebEditor scm.upload=Ajouter un fichier scm.uploadFile=Url du fichier scm.uploadPath=Repertoire sur le depot scm.uploadSuccess=Fichier telecharche avec succes scm.uploadTitle=Ajouter un fichier sur le depot +scm.uselessSave=Inutile de sauvegarder le fichier, aucune modification n''ont ete apporte scm.username=Identifiant scm.usernameTitle=Identifiant du depot scm.welcome=Bienvenue sur SCMWebEditor Modified: trunk/src/main/resources/struts.xml =================================================================== --- trunk/src/main/resources/struts.xml 2011-08-16 23:13:01 UTC (rev 217) +++ trunk/src/main/resources/struts.xml 2011-08-17 16:00:44 UTC (rev 218) @@ -22,6 +22,7 @@ <result name="error">/WEB-INF/content/badFileRedirect.jsp</result> <result name="errorPath">/WEB-INF/content/badFileRedirect.jsp</result> <result name="errorRst">/WEB-INF/content/badRstFile.jsp</result> + <result name="fileModify">/WEB-INF/content/fileModify.jsp</result> </action> <action name="save" class="org.nuiton.scmwebeditor.actions.SaveAction" method="save"> Modified: trunk/src/main/webapp/WEB-INF/content/badRstFile.jsp =================================================================== --- trunk/src/main/webapp/WEB-INF/content/badRstFile.jsp 2011-08-16 23:13:01 UTC (rev 217) +++ trunk/src/main/webapp/WEB-INF/content/badRstFile.jsp 2011-08-17 16:00:44 UTC (rev 218) @@ -10,6 +10,8 @@ <link rel="stylesheet" type="text/css" href="css/main.css"> </head> <body> +<a target="_blank" href="http://maven-site.nuiton.org/scmwebeditor/"><img src="img/ScmWebEditor_main.png" alt="$alt" /></a> + <form id="forceCommitForm" method="POST" action="commit.action" > <h4><s:text name="scm.rstNotValidMessage" /></h4> Added: trunk/src/main/webapp/WEB-INF/content/fileModify.jsp =================================================================== --- trunk/src/main/webapp/WEB-INF/content/fileModify.jsp (rev 0) +++ trunk/src/main/webapp/WEB-INF/content/fileModify.jsp 2011-08-17 16:00:44 UTC (rev 218) @@ -0,0 +1,69 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> +<%@ taglib prefix="s" uri="/struts-tags"%> +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<title><s:text name="scm.fileModify" /></title> +<link rel="stylesheet" type="text/css" href="css/main.css"> +</head> +<body> +<a target="_blank" href="http://maven-site.nuiton.org/scmwebeditor/"><img src="img/ScmWebEditor_main.png" alt="$alt" /></a> + + + + + <form id="forceCommitForm" method="POST" action="commit.action" > + <h4><s:text name="scm.fileModify" /> <s:text name="scm.by" /> <s:property value="headCommiter" /></h4> + + <s:set id="scm.showDiff" > + <s:text name="scm.showDiff" /> + </s:set> + <s:submit value="%{scm.showDiff}" onclick="getElementById('diffArea').style.display='inline';return false;" /> + + <s:set id="diff" > + <s:property value="diff" /> + </s:set> + <s:textarea id="diffArea" cssStyle="display:none" rows="20" cols="80" value="%{diff}" /> + + + <input type="hidden" name="force" value="true"/> + <s:hidden name="address" value="%{address}" /> + <s:hidden name="commitMessage" value="%{commitMessage}" /> + <s:hidden name="newText" value="%{newText}" /> + <s:hidden name="lastText" value="%{lastText}" /> + <s:hidden name="fileType" value="%{fileType}" /> + <s:hidden name="projectUrl" value="%{projectUrl}" /> + <s:hidden name="format" value="%{format}" /> + + <s:hidden name="username" value="%{username}" /> + <s:hidden name="pw" value="%{pw}" /> + + + <s:set id="scm.forceSave"> + <s:text name="scm.forceSave"/> + </s:set> + + <input type="hidden" name="force" value="true"/> + <s:submit + id="ajaxForceSaveButton" + formIds="editForm" + indicator="indicator" + button="true" + buttonIcon="ui-icon-refresh" + value="%{scm.forceSave}" + > + </s:submit> + + + <s:set id="scm.exit"> + <s:text name="scm.exit"/> + </s:set> + <s:submit type="button" value="%{scm.exit}" onclick="history.back();return false;" /> + + + </form> + +</body> +</html> \ No newline at end of file Modified: trunk/src/main/webapp/WEB-INF/content/modificationViewer.jsp =================================================================== --- trunk/src/main/webapp/WEB-INF/content/modificationViewer.jsp 2011-08-16 23:13:01 UTC (rev 217) +++ trunk/src/main/webapp/WEB-INF/content/modificationViewer.jsp 2011-08-17 16:00:44 UTC (rev 218) @@ -85,7 +85,8 @@ %> <p> - <s:text name="scm.FileInEditor"/><a href="<%=request.getAttribute("address")%>" ><%=request.getAttribute("address")%></a> + <s:text name="scm.FileInEditor"/><a href="<%=request.getAttribute("address")%>" ><%=request.getAttribute("address")%></a> + at revision <span id="numrevisionDiv"><s:property value="numRevision" /></span> </p> <textarea id="newTextId" rows="50" cols="80" name="newText"><%=valueTextarea%></textarea> @@ -152,12 +153,10 @@ <s:text name="scm.commitMessageTitle"/> </s:set> - <s:textfield required="true" label="%{scm.commitMessage}" name="commitMessage" title="%{scm.commitMessageTitle}" /> + <s:textfield required="true" label="%{scm.commitMessage} " name="commitMessage" title="%{scm.commitMessageTitle}" /> - <p> + <p> - - <s:if test="username==null || pw==null" > <s:set id="scm.username"> <s:text name="scm.username"/> Modified: trunk/src/main/webapp/WEB-INF/content/reset.jsp =================================================================== --- trunk/src/main/webapp/WEB-INF/content/reset.jsp 2011-08-16 23:13:01 UTC (rev 217) +++ trunk/src/main/webapp/WEB-INF/content/reset.jsp 2011-08-17 16:00:44 UTC (rev 218) @@ -16,5 +16,9 @@ editor.mirror.setValue(document.getElementById('valueOfLastRevision').value); + var numrev = <%=request.getAttribute("numRevision")%>; + if(numrev!=null) { + document.getElementById('numrevisionDiv').innerHTML=numrev; + } </script> </s:else> \ No newline at end of file Modified: trunk/src/main/webapp/WEB-INF/content/save.jsp =================================================================== --- trunk/src/main/webapp/WEB-INF/content/save.jsp 2011-08-16 23:13:01 UTC (rev 217) +++ trunk/src/main/webapp/WEB-INF/content/save.jsp 2011-08-17 16:00:44 UTC (rev 218) @@ -4,17 +4,22 @@ <s:if test="result=='login'" > - <h4> <font color="red"> Bad username or password, can't save modification</font> </h4> + <h4> <font color="red"><s:text name="scm.badUsernameOrPassword"/> <s:text name="scm.cannotSave"/></font> </h4> </s:if> <s:elseif test="result=='error'" > - <h4> Can't save modification </h4> + <h4> <s:text name="scm.cannotSave" /></h4> </s:elseif> <s:elseif test="result=='errorRst'" > <h4> <s:text name="scm.rstNotValidMessage" /> </h4> <s:url id="ajaxForceSave" action="save" /> <input type="hidden" name="force" value="true"/> - <sj:submit onclick="loadChange()" + + <s:set id="scm.yes"> + <s:text name="scm.yes"/> + </s:set> + + <sj:submit id="ajaxForceSaveButton" formIds="editForm" targets="htmlcontentCommit" @@ -22,24 +27,63 @@ indicator="indicator" button="true" buttonIcon="ui-icon-refresh" - value="YES" + value="%{scm.yes}" > </sj:submit> </s:elseif> + + <s:elseif test="result=='fileModify'" > + <h4><s:text name="scm.fileModify" /> <s:text name="scm.by" /> <s:property value="headCommiter" /></h4> + + <s:set id="scm.showDiff" > + <s:text name="scm.showDiff" /> + </s:set> + <s:submit value="%{scm.showDiff}" onclick="getElementById('diffArea').style.display='inline';return false;" /> + + <s:set id="diff" > + <s:property value="diff" /> + </s:set> + <s:textarea id="diffArea" cssStyle="display:none" rows="20" cols="80" value="%{diff}" /> + <s:url id="ajaxForceSave" action="save" /> + + <input type="hidden" name="force" value="true"/> + + <s:set id="scm.forceSave"> + <s:text name="scm.forceSave"/> + </s:set> + <sj:submit + id="ajaxForceSaveButton" + formIds="editForm" + targets="htmlcontentCommit" + href="%{ajaxForceSave}" + indicator="indicator" + button="true" + buttonIcon="ui-icon-refresh" + value="%{scm.forceSave}" + > + </sj:submit> + + </s:elseif> + <s:elseif test="result=='errorPath'" > - <h4> Can't save modification, Path Error</h4> + <h4><s:text name="scm.cannotSave"/>, <s:text name="scm.pathError"/></h4> </s:elseif> + <s:elseif test="result=='uselessSave'" > - <h4> It's useless to save the file, file is not modify</h4> + <h4><s:text name="scm.uselessSave"/></h4> </s:elseif> + <s:else> - <h4>Last change save <s:property value="formatDate" /> </h4> + <h4><s:text name="scm.lastChangeSave"/><s:property value="formatDate" /> </h4> <s:set id="lastRevSet" value="newText" /> <s:hidden id="lastRev" value="%{lastRevSet}" /> <script type="text/javascript"> origText = document.getElementById("origText"); origText.value = document.getElementById("lastRev").value; - + var numrev = <%=request.getAttribute("numRevision")%>; + if(numrev!=null) { + document.getElementById('numrevisionDiv').innerHTML=numrev; + } </script> </s:else> \ No newline at end of file Modified: trunk/src/main/webapp/css/main.css =================================================================== --- trunk/src/main/webapp/css/main.css 2011-08-16 23:13:01 UTC (rev 217) +++ trunk/src/main/webapp/css/main.css 2011-08-17 16:00:44 UTC (rev 218) @@ -37,7 +37,7 @@ width:30% } -#wwctrl_Save, #wwctrl_Cancel, #wwctrl_uploadButton { +#wwctrl_Save, #wwctrl_Cancel, #wwctrl_uploadButton, #wwctrl_ { text-align:center; }
participants (1)
-
kcardineaud@users.nuiton.org