This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository scmwebeditor. See http://git.nuiton.org/scmwebeditor.git commit 1516b0f728260e84b8b7d62b11e90e169da02aff Author: Hugo PIGEON <hpigeon@codelutin.com> Date: Wed Jun 17 10:45:10 2015 +0200 Add the ability to compare 2 revisions of the edited file --- .../org/nuiton/scmwebeditor/git/GitConnection.java | 96 ++++++++++++++++-- .../org/nuiton/scmwebeditor/api/ScmConnection.java | 14 +++ .../org/nuiton/scmwebeditor/svn/SvnConnection.java | 107 ++++++++++++++++++++- .../scmwebeditor/uiweb/actions/EditAction.java | 15 ++- ...ViewHistoryAction.java => ViewDiffsAction.java} | 25 +++-- ...wHistoryAction.java => ViewRevisionAction.java} | 36 +++++-- .../i18n/scmwebeditor-ui-web_en_GB.properties | 5 +- .../i18n/scmwebeditor-ui-web_fr_FR.properties | 5 +- swe-ui-web/src/main/resources/struts.xml | 6 +- .../main/webapp/WEB-INF/content/loginBrowse.jsp | 7 +- .../webapp/WEB-INF/content/modificationViewer.jsp | 45 +++++++-- swe-ui-web/src/main/webapp/css/main.css | 8 +- 12 files changed, 319 insertions(+), 50 deletions(-) diff --git a/swe-git/src/main/java/org/nuiton/scmwebeditor/git/GitConnection.java b/swe-git/src/main/java/org/nuiton/scmwebeditor/git/GitConnection.java index 0bb91cd..39cb295 100644 --- a/swe-git/src/main/java/org/nuiton/scmwebeditor/git/GitConnection.java +++ b/swe-git/src/main/java/org/nuiton/scmwebeditor/git/GitConnection.java @@ -27,16 +27,16 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.eclipse.jgit.api.*; import org.eclipse.jgit.api.errors.*; -import org.eclipse.jgit.lib.Constants; -import org.eclipse.jgit.lib.ObjectId; -import org.eclipse.jgit.lib.ObjectLoader; -import org.eclipse.jgit.lib.Repository; +import org.eclipse.jgit.diff.DiffEntry; +import org.eclipse.jgit.diff.DiffFormatter; +import org.eclipse.jgit.lib.*; import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.revwalk.RevTree; import org.eclipse.jgit.revwalk.RevWalk; import org.eclipse.jgit.storage.file.FileRepositoryBuilder; import org.eclipse.jgit.transport.CredentialsProvider; import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider; +import org.eclipse.jgit.treewalk.CanonicalTreeParser; import org.eclipse.jgit.treewalk.TreeWalk; import org.eclipse.jgit.treewalk.filter.PathFilter; import org.nuiton.scmwebeditor.api.RepositoryNotFoundException; @@ -600,7 +600,7 @@ public class GitConnection implements ScmConnection { DateFormat displayDf = new SimpleDateFormat("dd/MM/yyyy HH:mm"); String formattedDate = displayDf.format(commitDate); - msg += " - " + formattedDate; + msg = formattedDate + " - " + msg; // adding the revision to the Map ScmRevision scmRev = new ScmRevision(commit.getName(), commitTime); @@ -653,15 +653,15 @@ public class GitConnection implements ScmConnection { String tempFileName = localDirectory.getAbsolutePath() + File.separator + pathOnRepo + "_" + revision; File tempFile = new File(tempFileName); - ObjectId lastCommitId; + ObjectId commitId; try { - lastCommitId = gitRepo.resolve(revision); + commitId = gitRepo.resolve(revision); // a RevWalk allows to walk over commits based on some filtering that is defined RevWalk revWalk = new RevWalk(gitRepo); - RevCommit commit = revWalk.parseCommit(lastCommitId); + RevCommit commit = revWalk.parseCommit(commitId); // and using commit's tree find the path RevTree tree = commit.getTree(); @@ -692,6 +692,86 @@ public class GitConnection implements ScmConnection { return tempFile; } + @Override + public File getDiffs(String path, String username, String password, String revision1, + String revision2) throws AuthenticationException { + + try { + updateRepository(username, password); + } catch (RepositoryNotFoundException e) { + + if (log.isErrorEnabled()) { + log.error("Error while cloning or pulling the repository", e); + } + + } catch (IOException e) { + + if (log.isErrorEnabled()) { + log.error("Error while cloning or pulling the repository", e); + } + + } catch (AuthenticationException e) { + + if (log.isErrorEnabled()) { + log.error("Error while cloning or pulling the repository", e); + } + } + + String pathOnRepo = path.replace(addressGit + "/", ""); + + String tempFileName = localDirectory.getAbsolutePath() + File.separator + pathOnRepo + + "_" + revision1 + "_" + revision2; + File tempFile = new File(tempFileName); + + ObjectId commitId1, commitId2; + + try { + + commitId1 = gitRepo.resolve(revision1 + "^{tree}"); + commitId2 = gitRepo.resolve(revision2 + "^{tree}"); + + Git git = Git.open(localDirectory); + + ObjectReader reader = gitRepo.newObjectReader(); + + CanonicalTreeParser oldTreeIter = new CanonicalTreeParser(); + oldTreeIter.reset(reader, commitId2); + CanonicalTreeParser newTreeIter = new CanonicalTreeParser(); + newTreeIter.reset(reader, commitId1); + + DiffCommand diffCommand = git.diff(); + PathFilter pathFilter = PathFilter.create(pathOnRepo); + diffCommand.setPathFilter(pathFilter); + diffCommand.setNewTree(newTreeIter); + diffCommand.setOldTree(oldTreeIter); + + List<DiffEntry> diffs = diffCommand.call(); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + DiffFormatter df = new DiffFormatter(baos); + df.setRepository(gitRepo); + + for(DiffEntry diff : diffs) { + df.format(diff); + String diffText = baos.toString("UTF-8"); + FileUtils.writeStringToFile(tempFile, diffText); + baos.reset(); + } + + } catch (IOException e) { + if (log.isErrorEnabled()) { + log.error("Error while getting file '" + pathOnRepo + "' content at revisions " + revision1 + + " and " + revision2, e); + } + } catch (GitAPIException e) { + if (log.isErrorEnabled()) { + log.error("Can not get revisions for address " + path, e); + } + } + + return tempFile; + } + /** * Changing for another branch diff --git a/swe-scm-api/src/main/java/org/nuiton/scmwebeditor/api/ScmConnection.java b/swe-scm-api/src/main/java/org/nuiton/scmwebeditor/api/ScmConnection.java index fb152a8..e4d9a24 100644 --- a/swe-scm-api/src/main/java/org/nuiton/scmwebeditor/api/ScmConnection.java +++ b/swe-scm-api/src/main/java/org/nuiton/scmwebeditor/api/ScmConnection.java @@ -120,4 +120,18 @@ public interface ScmConnection { */ File getFileContentAtRevision(String path, String username, String password, String revision) throws AuthenticationException; + + + /** + * Gives the content of a file at the specified revision + * @param path the path to the file to get the content from + * @param username the user's login for the SCM + * @param password the user's password for the SCM + * @param revision1 one of the revisions ID to compare + * @param revision2 the other revision ID to compare + * @return a String which contains the file's content + * @throws AuthenticationException if there is a problem during the authentication process + */ + File getDiffs(String path, String username, String password, String revision1,String revision2) + throws AuthenticationException; } diff --git a/swe-svn/src/main/java/org/nuiton/scmwebeditor/svn/SvnConnection.java b/swe-svn/src/main/java/org/nuiton/scmwebeditor/svn/SvnConnection.java index 4ef9e19..e201352 100644 --- a/swe-svn/src/main/java/org/nuiton/scmwebeditor/svn/SvnConnection.java +++ b/swe-svn/src/main/java/org/nuiton/scmwebeditor/svn/SvnConnection.java @@ -577,7 +577,7 @@ public class SvnConnection implements ScmConnection { } long revNum = ((SVNFileRevision) fileRev).getRevision(); - msg += " (rev " + revNum + ")"; + msg = " (rev " + revNum + ") - " + msg; // getting the date String date = ((SVNFileRevision) fileRev).getRevisionProperties().getStringValue(SVNRevisionProperty.DATE); @@ -594,7 +594,7 @@ public class SvnConnection implements ScmConnection { DateFormat displayDf = new SimpleDateFormat("dd/MM/yyyy HH:mm"); String formattedDate = displayDf.format(commitDate); - msg += " - " + formattedDate; + msg = formattedDate + " - " + msg; // adding the revision to the Map ScmRevision scmRev = new ScmRevision(String.valueOf(revNum), commitDate.getTime()); @@ -653,7 +653,6 @@ public class SvnConnection implements ScmConnection { SVNNodeKind nodeKind = repository.checkPath(file, rev); - if (nodeKind == SVNNodeKind.NONE) { if (log.isErrorEnabled()) { log.error("There is no entry at '" + url + "'."); @@ -666,7 +665,6 @@ public class SvnConnection implements ScmConnection { return null; } - // writing the result to a temp file ByteArrayOutputStream baos = new ByteArrayOutputStream(); @@ -687,6 +685,107 @@ public class SvnConnection implements ScmConnection { } } + try { + baos.close(); + } catch (IOException e) { + if (log.isDebugEnabled()) { + log.debug("Can't close stream", e); + } + } + } catch (SVNAuthenticationException e) { + throw new AuthenticationException("Auth fail"); + } catch (SVNException e) { + if (log.isErrorEnabled()) { + log.error("Can not get file content from SVN repository", e); + } + } + + return tempFile; + } + + + @Override + public File getDiffs(String path, String username, String password, + String revision1, String revision2) throws AuthenticationException { + + String url = path.substring(0, path.lastIndexOf('/')); + String file = path.substring(path.lastIndexOf('/') + 1); + + long rev1 = Long.parseLong(revision1); + long rev2 = Long.parseLong(revision2); + + // storing the file content to the user's local directory + File localDirectory = new File(pathToLocalRepos); + + if (!localDirectory.exists()) { + boolean localDirectoryCreated = localDirectory.mkdir(); + if (!localDirectoryCreated && log.isDebugEnabled()) { + log.debug("Could not create directory " + localDirectory.getAbsolutePath()); + } + } + + String tempFileName = localDirectory.getAbsolutePath() + File.separator + file; + File tempFile = new File(tempFileName); + + if (tempFile.exists()) { + boolean tempFileDeleted = tempFile.delete(); + if (!tempFileDeleted && log.isDebugEnabled()) { + log.debug("Could not delete temp file " + tempFileName); + } + } + + updateAuthentication(username, password); + + SVNRepository repository; + + try { + repository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded(url)); + + ISVNAuthenticationManager svnAuthManager = SVNWCUtil.createDefaultAuthenticationManager(username, password); + repository.setAuthenticationManager(svnAuthManager); + + SVNNodeKind nodeKind1 = repository.checkPath(file, rev1); + SVNNodeKind nodeKind2 = repository.checkPath(file, rev2); + + + if (nodeKind1 == SVNNodeKind.NONE || nodeKind2 == SVNNodeKind.NONE) { + if (log.isErrorEnabled()) { + log.error("There is no entry at '" + url + "'."); + } + return null; + } else if (nodeKind1 == SVNNodeKind.DIR || nodeKind2 == SVNNodeKind.DIR) { + if (log.isErrorEnabled()) { + log.error("The entry at '" + url + "' is a file while a directory was expected."); + } + return null; + } + + + // writing the result to a temp file + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + + SVNDiffClient diffClient = new SVNDiffClient(authManager, null); + + String encodedUrl = SVNEncodingUtil.autoURIEncode(addressSvn); + SVNURL fileUrl = SVNURL.parseURIEncoded(encodedUrl); + SVNRevision svnRev1 = SVNRevision.create(rev1); + SVNRevision svnRev2 = SVNRevision.create(rev2); + + diffClient.doDiff(fileUrl, SVNRevision.HEAD, svnRev2, svnRev1, SVNDepth.INFINITY, false, baos); + + try { + OutputStream fileOutput = new FileOutputStream(tempFileName); + baos.writeTo(fileOutput); + } catch (FileNotFoundException e) { + if (log.isErrorEnabled()) { + log.error("Can not find file " + tempFileName, e); + } + } catch (IOException e) { + if (log.isErrorEnabled()) { + log.error("Can not write to file " + tempFileName, e); + } + } + try { baos.close(); diff --git a/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/EditAction.java b/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/EditAction.java index 9eec74b..79f3cad 100644 --- a/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/EditAction.java +++ b/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/EditAction.java @@ -70,8 +70,11 @@ public class EditAction extends ScmWebEditorMainAction { /** a list of the revision which can be used to view the file's history */ protected Map<ScmRevision, String> revisions; - /** the selected revision to view */ - protected String revision; + /** one of the revisions to use to get the differences */ + protected String revision1; + + /** the other revision to use to get the differences */ + protected String revision2; /** equals true if this file is directly accessible from its address */ protected boolean fileDirectlyAccessible; @@ -102,9 +105,13 @@ public class EditAction extends ScmWebEditorMainAction { public void setRevisions( Map<ScmRevision, String> revisions) { this.revisions = revisions; } - public String getRevision() { return revision; } + public String getRevision1() { return revision1; } + + public void setRevision1(String revision1) { this.revision1 = revision1; } + + public String getRevision2() { return revision2; } - public void setRevision(String revision) { this.revision = revision; } + public void setRevision2(String revision2) { this.revision2 = revision2; } public boolean isFileDirectlyAccessible() { return fileDirectlyAccessible; } diff --git a/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/ViewHistoryAction.java b/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/ViewDiffsAction.java similarity index 89% copy from swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/ViewHistoryAction.java copy to swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/ViewDiffsAction.java index 9fdb086..9c51f2f 100644 --- a/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/ViewHistoryAction.java +++ b/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/ViewDiffsAction.java @@ -41,15 +41,18 @@ import java.text.Normalizer; /** * Allows to view the history of a file */ -public class ViewHistoryAction extends ScmWebEditorMainAction { +public class ViewDiffsAction extends ScmWebEditorMainAction { - private static final Log log = LogFactory.getLog(ViewHistoryAction.class); + private static final Log log = LogFactory.getLog(ViewDiffsAction.class); /** the content of the file */ protected String fileContent; - /** the revision to use to get the file content */ - protected String revision; + /** one of the revisions to use to get the differences */ + protected String revision1; + + /** the other revision to use to get the differences */ + protected String revision2; /** the error name or null if no error occurred */ protected String error; @@ -59,9 +62,13 @@ public class ViewHistoryAction extends ScmWebEditorMainAction { public void setFileContent(String fileContent) { this.fileContent = fileContent; } - public String getRevision() { return revision; } + public String getRevision1() { return revision1; } + + public void setRevision1(String revision1) { this.revision1 = revision1; } + + public String getRevision2() { return revision2; } - public void setRevision(String revision) { this.revision = revision; } + public void setRevision2(String revision2) { this.revision2 = revision2; } public String getError() { return error; } @@ -164,11 +171,11 @@ public class ViewHistoryAction extends ScmWebEditorMainAction { /* - * Getting the file's revision + * Getting the differences */ try { - File tempFile = scmConn.getFileContentAtRevision(address, name, password, revision); + File tempFile = scmConn.getDiffs(address, name, password, revision1, revision2); if (tempFile != null) { fileContent = FileUtils.readFileToString(tempFile); @@ -200,7 +207,7 @@ public class ViewHistoryAction extends ScmWebEditorMainAction { return LOGIN; } catch (IOException e) { if (log.isErrorEnabled()) { - log.error("Can not read temp file for " + address + " at revision " + revision, e); + log.error("Can not read temp file for " + address, e); } error = ERROR; return ERROR; diff --git a/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/ViewHistoryAction.java b/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/ViewRevisionAction.java similarity index 86% rename from swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/ViewHistoryAction.java rename to swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/ViewRevisionAction.java index 9fdb086..2edeabe 100644 --- a/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/ViewHistoryAction.java +++ b/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/ViewRevisionAction.java @@ -39,29 +39,43 @@ import java.io.UnsupportedEncodingException; import java.text.Normalizer; /** - * Allows to view the history of a file + * Allows to view a file at the given revision */ -public class ViewHistoryAction extends ScmWebEditorMainAction { +public class ViewRevisionAction extends ScmWebEditorMainAction { - private static final Log log = LogFactory.getLog(ViewHistoryAction.class); + private static final Log log = LogFactory.getLog(ViewRevisionAction.class); /** the content of the file */ protected String fileContent; - /** the revision to use to get the file content */ - protected String revision; + /** one of the revisions to use to get the differences */ + protected String revision1; + + /** the other revision to use to get the differences */ + protected String revision2; /** the error name or null if no error occurred */ protected String error; + /** equals 1 to view the revision1 and equals 2 to view the revision2 */ + protected int rev; + public String getFileContent() { return fileContent; } public void setFileContent(String fileContent) { this.fileContent = fileContent; } - public String getRevision() { return revision; } + public String getRevision1() { return revision1; } + + public void setRevision1(String revision1) { this.revision1 = revision1; } + + public String getRevision2() { return revision2; } + + public void setRevision2(String revision2) { this.revision2 = revision2; } - public void setRevision(String revision) { this.revision = revision; } + public int getRev() { return rev; } + + public void setRev(int rev) { this.rev = rev; } public String getError() { return error; } @@ -168,6 +182,12 @@ public class ViewHistoryAction extends ScmWebEditorMainAction { */ try { + String revision = revision1; + + if (rev == 2) { + revision = revision2; + } + File tempFile = scmConn.getFileContentAtRevision(address, name, password, revision); if (tempFile != null) { @@ -200,7 +220,7 @@ public class ViewHistoryAction extends ScmWebEditorMainAction { return LOGIN; } catch (IOException e) { if (log.isErrorEnabled()) { - log.error("Can not read temp file for " + address + " at revision " + revision, e); + log.error("Can not read temp file for " + address, e); } error = ERROR; return ERROR; diff --git a/swe-ui-web/src/main/resources/i18n/scmwebeditor-ui-web_en_GB.properties b/swe-ui-web/src/main/resources/i18n/scmwebeditor-ui-web_en_GB.properties index f7cc41f..7e6aad9 100644 --- a/swe-ui-web/src/main/resources/i18n/scmwebeditor-ui-web_en_GB.properties +++ b/swe-ui-web/src/main/resources/i18n/scmwebeditor-ui-web_en_GB.properties @@ -15,6 +15,7 @@ scm.close=Close scm.commitMessage=Message describing the changes\: scm.commitMessageTitle=Let a message to describe the changes scm.commitWithoutMessage=It is recommended to associate the changes to a message describing them. You have not given a message, are you sure that you want to save? +scm.compareRevisions=Compare revisions scm.connection=Connection scm.createBranch=Create a new branch scm.createBranch.branchName=Name of the new branch\: @@ -34,7 +35,8 @@ scm.exitTitle=Exit ScmWebEditor without saving. scm.file=The file scm.fileModify=File modify while editing. scm.fileNotEditable=File not editable -scm.fileRevision=File revision\: +scm.fileRevisionA=File revision (A)\: +scm.fileRevisionB=File revision (B)\: scm.fileToMove=File to move\: scm.files=Files scm.find=Find @@ -141,5 +143,6 @@ scm.uselessSave=It's useless to save the file, file is not modify. scm.username=Username scm.usernameTitle=Repository username scm.viewHistory=View file history +scm.viewRevision=View this revision scm.welcome=Welcome on SCMWebEditor scm.yes=Yes diff --git a/swe-ui-web/src/main/resources/i18n/scmwebeditor-ui-web_fr_FR.properties b/swe-ui-web/src/main/resources/i18n/scmwebeditor-ui-web_fr_FR.properties index 093757e..e7837ef 100644 --- a/swe-ui-web/src/main/resources/i18n/scmwebeditor-ui-web_fr_FR.properties +++ b/swe-ui-web/src/main/resources/i18n/scmwebeditor-ui-web_fr_FR.properties @@ -15,6 +15,7 @@ scm.close=Fermer scm.commitMessage=Message associé aux modifications \: scm.commitMessageTitle=Laisser un message pour décrire les modifications scm.commitWithoutMessage=Il est recommandé d\\'associer les modifications à un message les décrivant. Vous n\\'avez pas renseigné de message, êtes-vous sûr de vouloir enregistrer ? +scm.compareRevisions=Comparer les révisions scm.connection=Connexion scm.createBranch=Créer une nouvelle branche scm.createBranch.branchName=Nom de la nouvelle branche \: @@ -34,7 +35,8 @@ scm.exitTitle=Quitter ScmWebEditor sans sauvegarder. scm.file=Le fichier scm.fileModify=Fichier modifié pendant l'édition. scm.fileNotEditable=Fichier non éditable -scm.fileRevision=Révision du fichier \: +scm.fileRevisionA=Révision du fichier (A) \: +scm.fileRevisionB=Révision du fichier (B) \: scm.fileToMove=Fichier à déplacer \: scm.files=Fichiers scm.find=Chercher @@ -141,5 +143,6 @@ scm.uselessSave=Inutile de sauvegarder le fichier, aucune modification n'a été scm.username=Identifiant scm.usernameTitle=Identifiant du dépôt scm.viewHistory=Voir l'historique du fichier +scm.viewRevision=Voir cette révision scm.welcome=Bienvenue sur SCMWebEditor scm.yes=Oui diff --git a/swe-ui-web/src/main/resources/struts.xml b/swe-ui-web/src/main/resources/struts.xml index d038ef3..ee545f8 100644 --- a/swe-ui-web/src/main/resources/struts.xml +++ b/swe-ui-web/src/main/resources/struts.xml @@ -157,7 +157,11 @@ <result name="error">/WEB-INF/content/popups/createBranchForm.jsp</result> </action> - <action name="viewHistory" class="org.nuiton.scmwebeditor.uiweb.actions.ViewHistoryAction"> + <action name="viewRevision" class="org.nuiton.scmwebeditor.uiweb.actions.ViewRevisionAction"> + <result name="*">/WEB-INF/content/viewHistory.jsp</result> + </action> + + <action name="viewDiffs" class="org.nuiton.scmwebeditor.uiweb.actions.ViewDiffsAction"> <result name="*">/WEB-INF/content/viewHistory.jsp</result> </action> diff --git a/swe-ui-web/src/main/webapp/WEB-INF/content/loginBrowse.jsp b/swe-ui-web/src/main/webapp/WEB-INF/content/loginBrowse.jsp index c621ed7..dd3e14b 100644 --- a/swe-ui-web/src/main/webapp/WEB-INF/content/loginBrowse.jsp +++ b/swe-ui-web/src/main/webapp/WEB-INF/content/loginBrowse.jsp @@ -46,13 +46,14 @@ formIds="configForm" targets="htmlcontentSearch" href="%{ajaxSearchLogin}" - indicator="indicator" button="true" buttonIcon="ui-icon-refresh" value="%{scm.loginButton}" > </sj:submit> - - <img src="struts/js/jstree/themes/classic/throbber.gif" alt="loading" id="indicator"/> </p> </div> + +<script type="text/javascript"> + document.getElementById("loadingIndicator").style.display = "none"; +</script> diff --git a/swe-ui-web/src/main/webapp/WEB-INF/content/modificationViewer.jsp b/swe-ui-web/src/main/webapp/WEB-INF/content/modificationViewer.jsp index 19062e9..441d622 100644 --- a/swe-ui-web/src/main/webapp/WEB-INF/content/modificationViewer.jsp +++ b/swe-ui-web/src/main/webapp/WEB-INF/content/modificationViewer.jsp @@ -831,28 +831,59 @@ <h1><s:text name="scm.viewHistory"/></h1> - <s:url id="ajaxViewHistory" value="viewHistory.action"/> + <s:url id="ajaxViewRevision1" value="viewRevision.action?rev=1"/> + <s:url id="ajaxViewRevision2" value="viewRevision.action?rev=2"/> + <s:url id="ajaxViewDiffs" value="viewDiffs.action"/> + + <s:set id="scm.viewRevision"> + <s:text name="scm.viewRevision"/> + </s:set> + + <s:set id="scm.compareRevisions"> + <s:text name="scm.compareRevisions"/> + </s:set> <form id="viewHistoryForm"> - <label for="revisionsList"><s:text name="scm.fileRevision"/></label><br/> - <s:select id="revisionsList" name="revision" list="revisions"/><br/> + <label for="revisionsList"><s:text name="scm.fileRevisionA"/></label><br/> + <s:select id="revisionsList" name="revision1" list="revisions"/> + <sj:a + id="ajaxRev1Button" + formIds="editForm,viewHistoryForm" + targets="htmlContentHistory" + href="%{ajaxViewRevision1}" + > + <s:submit id="viewRev1" value="%{scm.viewRevision}" + onclick="document.getElementById('historyIndicator').style.display = 'inline'; return false;"/> + </sj:a><br/><br/> + + <label for="revisionsList2"><s:text name="scm.fileRevisionB"/></label><br/> + <s:select id="revisionsList2" name="revision2" list="revisions"/> + <sj:a + id="ajaxRev2Button" + formIds="editForm,viewHistoryForm" + targets="htmlContentHistory" + href="%{ajaxViewRevision2}" + > + <s:submit id="viewRev2" value="%{scm.viewRevision}" + onclick="document.getElementById('historyIndicator').style.display = 'inline'; return false;"/> + </sj:a><br/><br/> <sj:a id="ajaxHistoryButton" formIds="editForm,viewHistoryForm" targets="htmlContentHistory" - href="%{ajaxViewHistory}" + href="%{ajaxViewDiffs}" title="%{scm.viewHistory}" > - <s:submit id="viewHistoryButton" value="%{scm.submit}" + <s:submit id="viewHistoryButton" value="%{scm.compareRevisions}" onclick="document.getElementById('historyIndicator').style.display = 'inline'; return false;"/> - <img src="struts/js/jstree/themes/classic/throbber.gif" alt="loading" class="indicator" id="historyIndicator"/> - </sj:a> + <img src="struts/js/jstree/themes/classic/throbber.gif" alt="loading" class="indicator" id="historyIndicator"/> + </form> <div id="htmlContentHistory"></div> diff --git a/swe-ui-web/src/main/webapp/css/main.css b/swe-ui-web/src/main/webapp/css/main.css index b829e4d..3e29267 100644 --- a/swe-ui-web/src/main/webapp/css/main.css +++ b/swe-ui-web/src/main/webapp/css/main.css @@ -162,6 +162,10 @@ ul.flags li { right: 50px; } +#wwctrl_viewRev1, #wwctrl_viewRev2 { + float: right; +} + #repositoryButtonsBrowse { display: table; border-spacing: 10px; @@ -470,10 +474,6 @@ ul.buttonsGroup li { margin-top: 10px; } -#revisionsList { - width: 100%; -} - #lastAutoSave { display: none; } -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.