branch feature/GIT updated (5e5c2c8 -> bf83c20)
This is an automated email from the git hooks/post-receive script. New change to branch feature/GIT in repository scmwebeditor. See http://git.nuiton.org/scmwebeditor.git from 5e5c2c8 Now using an interface instead of the abstract class for the SCMs (ScmConnection) and the local Git repositories are stored in a folder which the name is a hash of their URL new bf83c20 The user can now choose which SCM to use. An automatic detection based on the repository's address helps the user to make the choice. The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit bf83c20f2d1ec5edf6b6c0724114d8d5649926e3 Author: Hugo PIGEON <hpigeon@codelutin.com> Date: Fri Apr 24 14:52:09 2015 +0200 The user can now choose which SCM to use. An automatic detection based on the repository's address helps the user to make the choice. Summary of changes: .../nuiton/scmwebeditor/ScmConnectionFactory.java | 39 +++++++++++------- .../nuiton/scmwebeditor/ScmNotFoundException.java | 11 ++++++ .../scmwebeditor/ScmWebEditorBaseAction.java | 6 +++ .../nuiton/scmwebeditor/actions/LogoutAction.java | 15 ++++--- .../nuiton/scmwebeditor/actions/ResetAction.java | 16 +++++--- .../actions/ScmWebEditorCommitAction.java | 10 ++++- .../actions/ScmWebEditorMainAction.java | 10 ++++- .../nuiton/scmwebeditor/actions/SearchAction.java | 46 ++++++++++++++++------ .../nuiton/scmwebeditor/actions/UploadAction.java | 15 ++++--- .../resources/i18n/scmwebeditor_en_GB.properties | 1 + .../resources/i18n/scmwebeditor_fr_FR.properties | 1 + src/main/webapp/WEB-INF/content/logout.jsp | 6 +-- .../webapp/WEB-INF/content/modificationViewer.jsp | 7 ++-- src/main/webapp/WEB-INF/content/outConnection.jsp | 11 ++++++ .../webapp/WEB-INF/content/privateSvnRedirect.jsp | 2 + src/main/webapp/WEB-INF/content/search.jsp | 7 ++-- src/main/webapp/js/branches.js | 8 ++-- src/main/webapp/js/scmDetector.js | 9 +++++ 18 files changed, 161 insertions(+), 59 deletions(-) create mode 100644 src/main/java/org/nuiton/scmwebeditor/ScmNotFoundException.java create mode 100644 src/main/webapp/js/scmDetector.js -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/GIT in repository scmwebeditor. See http://git.nuiton.org/scmwebeditor.git commit bf83c20f2d1ec5edf6b6c0724114d8d5649926e3 Author: Hugo PIGEON <hpigeon@codelutin.com> Date: Fri Apr 24 14:52:09 2015 +0200 The user can now choose which SCM to use. An automatic detection based on the repository's address helps the user to make the choice. --- .../nuiton/scmwebeditor/ScmConnectionFactory.java | 39 +++++++++++------- .../nuiton/scmwebeditor/ScmNotFoundException.java | 11 ++++++ .../scmwebeditor/ScmWebEditorBaseAction.java | 6 +++ .../nuiton/scmwebeditor/actions/LogoutAction.java | 15 ++++--- .../nuiton/scmwebeditor/actions/ResetAction.java | 16 +++++--- .../actions/ScmWebEditorCommitAction.java | 10 ++++- .../actions/ScmWebEditorMainAction.java | 10 ++++- .../nuiton/scmwebeditor/actions/SearchAction.java | 46 ++++++++++++++++------ .../nuiton/scmwebeditor/actions/UploadAction.java | 15 ++++--- .../resources/i18n/scmwebeditor_en_GB.properties | 1 + .../resources/i18n/scmwebeditor_fr_FR.properties | 1 + src/main/webapp/WEB-INF/content/logout.jsp | 6 +-- .../webapp/WEB-INF/content/modificationViewer.jsp | 7 ++-- src/main/webapp/WEB-INF/content/outConnection.jsp | 11 ++++++ .../webapp/WEB-INF/content/privateSvnRedirect.jsp | 2 + src/main/webapp/WEB-INF/content/search.jsp | 7 ++-- src/main/webapp/js/branches.js | 8 ++-- src/main/webapp/js/scmDetector.js | 9 +++++ 18 files changed, 161 insertions(+), 59 deletions(-) diff --git a/src/main/java/org/nuiton/scmwebeditor/ScmConnectionFactory.java b/src/main/java/org/nuiton/scmwebeditor/ScmConnectionFactory.java index ab370cb..b9f5544 100644 --- a/src/main/java/org/nuiton/scmwebeditor/ScmConnectionFactory.java +++ b/src/main/java/org/nuiton/scmwebeditor/ScmConnectionFactory.java @@ -16,31 +16,40 @@ public class ScmConnectionFactory { /** * Creates a new ScmConnection, the type of SCM is deduced with the repository's address * @param address the SCM's address + * @param type the name of the SCM tu use * @param sessionId the user's session ID * @return a ScmConnection of the correct type to use the repository at the given address */ - public static ScmConnection createScmConnection(String address, String sessionId) { + public static ScmConnection createScmConnection(String address, String type, + String sessionId) throws ScmNotFoundException { ScmConnection scmConn = null; - if(address.contains(".git")) { + if (type != null) { - try { - scmConn = new GitConnection(address, sessionId); - } catch (IOException e) { - if (log.isErrorEnabled()) { - log.error("Can not reach the repository", e); - } - } - } else { + if (type.equals("Git")) { - try { - scmConn = new SvnConnection(address); - } catch(StringIndexOutOfBoundsException e) { - if (log.isDebugEnabled()) { - log.debug("Parameter is not valid ", e); + try { + scmConn = new GitConnection(address, sessionId); + } catch (IOException e) { + if (log.isErrorEnabled()) { + log.error("Can not reach the repository", e); + } } + } else if (type.equals("SVN")) { + + try { + scmConn = new SvnConnection(address); + } catch (StringIndexOutOfBoundsException e) { + if (log.isDebugEnabled()) { + log.debug("Parameter is not valid ", e); + } + } + } else { + throw new ScmNotFoundException("The given SCM type was not recognized"); } + } else { + throw new ScmNotFoundException("The given SCM type is null"); } return scmConn; diff --git a/src/main/java/org/nuiton/scmwebeditor/ScmNotFoundException.java b/src/main/java/org/nuiton/scmwebeditor/ScmNotFoundException.java new file mode 100644 index 0000000..241e3b8 --- /dev/null +++ b/src/main/java/org/nuiton/scmwebeditor/ScmNotFoundException.java @@ -0,0 +1,11 @@ +package org.nuiton.scmwebeditor; + +/** + * An exception called when the requested SCM doesn't exist + */ +public class ScmNotFoundException extends Exception { + + public ScmNotFoundException(String message) { + super(message); + } +} diff --git a/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorBaseAction.java b/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorBaseAction.java index ebd0359..c9d9708 100644 --- a/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorBaseAction.java +++ b/src/main/java/org/nuiton/scmwebeditor/ScmWebEditorBaseAction.java @@ -66,6 +66,8 @@ public class ScmWebEditorBaseAction extends BaseAction implements ServletRequest protected transient HttpServletRequest request; + protected String scmType; + private static final long serialVersionUID = 1L; final static protected String CONTEXT_ACTION_KEY = "action"; @@ -134,6 +136,10 @@ public class ScmWebEditorBaseAction extends BaseAction implements ServletRequest protected static final String EDITABLESFILES = "editableFiles"; + public String getScmType() { return scmType; } + + public void setScmType(String scmType) { this.scmType = scmType; } + protected static CodepageDetectorProxy detector; diff --git a/src/main/java/org/nuiton/scmwebeditor/actions/LogoutAction.java b/src/main/java/org/nuiton/scmwebeditor/actions/LogoutAction.java index 112ed7d..d1dc836 100644 --- a/src/main/java/org/nuiton/scmwebeditor/actions/LogoutAction.java +++ b/src/main/java/org/nuiton/scmwebeditor/actions/LogoutAction.java @@ -25,10 +25,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.struts2.interceptor.ServletRequestAware; import org.apache.struts2.interceptor.ServletResponseAware; -import org.nuiton.scmwebeditor.ScmConnection; -import org.nuiton.scmwebeditor.ScmConnectionFactory; -import org.nuiton.scmwebeditor.ScmWebEditorBaseAction; -import org.nuiton.scmwebeditor.SvnConnection; +import org.nuiton.scmwebeditor.*; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; @@ -68,7 +65,15 @@ public class LogoutAction extends ScmWebEditorBaseAction implements ServletReque public String execute() { String sessionId = request.getSession().getId(); - ScmConnection scmConn = ScmConnectionFactory.createScmConnection(address, sessionId); + + ScmConnection scmConn = null; + try { + scmConn = ScmConnectionFactory.createScmConnection(address, scmType, sessionId); + } catch (ScmNotFoundException e) { + if (log.isErrorEnabled()) { + log.error("Can not create a connection to the SCM", e); + } + } // getting the repository unique identifier if it is possible String repositoryId = scmConn.getRepositoryId(); diff --git a/src/main/java/org/nuiton/scmwebeditor/actions/ResetAction.java b/src/main/java/org/nuiton/scmwebeditor/actions/ResetAction.java index 6becee3..9b0eb9a 100644 --- a/src/main/java/org/nuiton/scmwebeditor/actions/ResetAction.java +++ b/src/main/java/org/nuiton/scmwebeditor/actions/ResetAction.java @@ -23,10 +23,7 @@ package org.nuiton.scmwebeditor.actions; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.nuiton.scmwebeditor.ScmConnection; -import org.nuiton.scmwebeditor.ScmConnectionFactory; -import org.nuiton.scmwebeditor.ScmWebEditorBaseAction; -import org.nuiton.scmwebeditor.SvnConnection; +import org.nuiton.scmwebeditor.*; import org.tmatesoft.svn.core.SVNAuthenticationException; import org.tmatesoft.svn.core.SVNException; @@ -79,7 +76,16 @@ public class ResetAction extends ScmWebEditorBaseAction { public String execute() { String sessionId = request.getSession().getId(); - ScmConnection scmConn = ScmConnectionFactory.createScmConnection(address, sessionId); + + ScmConnection scmConn = null; + try { + scmConn = ScmConnectionFactory.createScmConnection(address, scmType, sessionId); + } catch (ScmNotFoundException e) { + error = e.getMessage(); + if (log.isErrorEnabled()) { + log.error("Can not create a connection to the SCM", e); + } + } // getting the repository unique identifier if it is possible String repositoryId = scmConn.getRepositoryId(); diff --git a/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java b/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java index f0d87be..09051ae 100644 --- a/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java +++ b/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorCommitAction.java @@ -238,7 +238,15 @@ public class ScmWebEditorCommitAction extends ScmWebEditorBaseAction implements // connection to the repository HttpSession session = request.getSession(); String sessionId = session.getId(); - ScmConnection scmConn = ScmConnectionFactory.createScmConnection(address, sessionId); + + ScmConnection scmConn = null; + try { + scmConn = ScmConnectionFactory.createScmConnection(address, scmType, sessionId); + } catch (ScmNotFoundException e) { + if (log.isErrorEnabled()) { + log.error("Can not create a connection to the SCM", e); + } + } String login = getUsername(); diff --git a/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java b/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java index 5b4369f..896fdd9 100644 --- a/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java +++ b/src/main/java/org/nuiton/scmwebeditor/actions/ScmWebEditorMainAction.java @@ -240,7 +240,15 @@ public class ScmWebEditorMainAction extends ScmWebEditorBaseAction implements Se HttpSession session = request.getSession(); String sessionId = session.getId(); - ScmConnection scmConn = ScmConnectionFactory.createScmConnection(address, sessionId); + + ScmConnection scmConn = null; + try { + scmConn = ScmConnectionFactory.createScmConnection(address, scmType, sessionId); + } catch (ScmNotFoundException e) { + if (log.isErrorEnabled()) { + log.error("Can not create a connection to the SCM", e); + } + } format = scmConn.getFileName().substring(scmConn.getFileName().lastIndexOf(".") + 1); diff --git a/src/main/java/org/nuiton/scmwebeditor/actions/SearchAction.java b/src/main/java/org/nuiton/scmwebeditor/actions/SearchAction.java index 7c05340..e63a660 100644 --- a/src/main/java/org/nuiton/scmwebeditor/actions/SearchAction.java +++ b/src/main/java/org/nuiton/scmwebeditor/actions/SearchAction.java @@ -24,10 +24,7 @@ package org.nuiton.scmwebeditor.actions; import com.jgeppert.struts2.jquery.tree.result.TreeNode; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.nuiton.scmwebeditor.GitConnection; -import org.nuiton.scmwebeditor.ScmConnection; -import org.nuiton.scmwebeditor.ScmConnectionFactory; -import org.nuiton.scmwebeditor.ScmWebEditorBaseAction; +import org.nuiton.scmwebeditor.*; import org.tmatesoft.svn.core.SVNDirEntry; import org.tmatesoft.svn.core.SVNException; import org.tmatesoft.svn.core.SVNNodeKind; @@ -130,16 +127,41 @@ public class SearchAction extends ScmWebEditorBaseAction { address = address.substring(0, address.length() - 1); } - // connection to the repository - HttpSession session = request.getSession(); - String sessionId = session.getId(); - ScmConnection scmConn = ScmConnectionFactory.createScmConnection(address, sessionId); + if (!address.equals("")) { - // getting the files and directories - String returnCode = scmConn.search(this); + // connection to the repository + HttpSession session = request.getSession(); + String sessionId = session.getId(); - if (returnCode != SUCCESS) { - return returnCode; + ScmConnection scmConn = null; + try { + scmConn = ScmConnectionFactory.createScmConnection(address, scmType, sessionId); + } catch (ScmNotFoundException e) { + error = e.getMessage(); + if (log.isErrorEnabled()) { + log.error("Can not create a connection to the SCM", e); + } + } + + String returnCode = null; + + // getting the files and directories + try { + returnCode = scmConn.search(this); + } catch (NullPointerException e) { + error = "Can't access to the repository"; + if (log.isErrorEnabled()) { + log.error("Can't access to the repository", e); + } + return SUCCESS; + } + + if (returnCode != SUCCESS) { + return returnCode; + } + } else { + error = "No address given"; + return SUCCESS; } // building the tree diff --git a/src/main/java/org/nuiton/scmwebeditor/actions/UploadAction.java b/src/main/java/org/nuiton/scmwebeditor/actions/UploadAction.java index 1659b83..da72158 100644 --- a/src/main/java/org/nuiton/scmwebeditor/actions/UploadAction.java +++ b/src/main/java/org/nuiton/scmwebeditor/actions/UploadAction.java @@ -25,10 +25,7 @@ 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.scmwebeditor.ScmConnection; -import org.nuiton.scmwebeditor.ScmConnectionFactory; -import org.nuiton.scmwebeditor.ScmWebEditorBaseAction; -import org.nuiton.scmwebeditor.SvnConnection; +import org.nuiton.scmwebeditor.*; import org.tmatesoft.svn.core.SVNAuthenticationException; import org.tmatesoft.svn.core.SVNDepth; import org.tmatesoft.svn.core.SVNException; @@ -158,7 +155,15 @@ public class UploadAction extends ScmWebEditorBaseAction implements ServletReque public String execute() { String sessionId = request.getSession().getId(); - ScmConnection scmConn = ScmConnectionFactory.createScmConnection(address, sessionId); + + ScmConnection scmConn = null; + try { + scmConn = ScmConnectionFactory.createScmConnection(address, scmType, sessionId); + } catch (ScmNotFoundException e) { + if (log.isErrorEnabled()) { + log.error("Can not create a connection to the SCM", e); + } + } String returnCode = scmConn.uploadFile(this); diff --git a/src/main/resources/i18n/scmwebeditor_en_GB.properties b/src/main/resources/i18n/scmwebeditor_en_GB.properties index e9bae11..a4798dc 100644 --- a/src/main/resources/i18n/scmwebeditor_en_GB.properties +++ b/src/main/resources/i18n/scmwebeditor_en_GB.properties @@ -32,6 +32,7 @@ scm.outConnection.enterRepo=Please enter your repository address. scm.outConnection.headBranch=Current branch\: scm.outConnection.noJavascript=Javascript is not activated. Please activate it for a fully use of ScmWebEditor. scm.outConnection.scmPath=SCM path \: +scm.outConnection.scmType=Use the SCM\: scm.outConnection.search=Search scm.outConnection.selectBranch=Select a branch\: scm.password=Password diff --git a/src/main/resources/i18n/scmwebeditor_fr_FR.properties b/src/main/resources/i18n/scmwebeditor_fr_FR.properties index f7430b4..8c6d8c6 100644 --- a/src/main/resources/i18n/scmwebeditor_fr_FR.properties +++ b/src/main/resources/i18n/scmwebeditor_fr_FR.properties @@ -32,6 +32,7 @@ scm.outConnection.enterRepo=Entrez l'adresse de votre dépôt. scm.outConnection.headBranch=Branche courante \: scm.outConnection.noJavascript=Javascript n'est pas activé. Certaines fonctions ne seront pas accessibles. scm.outConnection.scmPath=Répertoire SCM \: +scm.outConnection.scmType=Utiliser le SCM \: scm.outConnection.search=Chercher scm.outConnection.selectBranch=Sélectionner une branche \: scm.password=Mot de passe diff --git a/src/main/webapp/WEB-INF/content/logout.jsp b/src/main/webapp/WEB-INF/content/logout.jsp index 1b22e84..9035585 100644 --- a/src/main/webapp/WEB-INF/content/logout.jsp +++ b/src/main/webapp/WEB-INF/content/logout.jsp @@ -34,10 +34,10 @@ <% if (request.getAttribute("projectUrl") != null) { %> <meta http-equiv="Refresh" - content="0;URL=checkout.action?address=<%=request.getAttribute("address")%>&projectUrl=<%=request.getAttribute("projectUrl")%>"> + content="0;URL=checkout.action?address=<%=request.getAttribute("address")%>&projectUrl=<%=request.getAttribute("projectUrl")%>&scmType=<%=request.getAttribute("scmType")%>"> <% } else { %> <meta http-equiv="Refresh" - content="0;URL=checkout.action?address=<%=request.getAttribute("address")%>"> + content="0;URL=checkout.action?address=<%=request.getAttribute("address")%>&scmType=<%=request.getAttribute("scmType")%>"> <% } %> @@ -48,7 +48,7 @@ <p><s:text name="scm.logoutWait"/><a - href="checkout.action?address=<%=request.getAttribute("address")%>"> <s:text + href="checkout.action?address=<%=request.getAttribute("address")%>&scmType=<%=request.getAttribute("scmType")%>"> <s:text name="scm.clickHere"/> </a>.</p> <p>©2004-2014 CodeLutin</p> diff --git a/src/main/webapp/WEB-INF/content/modificationViewer.jsp b/src/main/webapp/WEB-INF/content/modificationViewer.jsp index 6ae8903..d40b227 100644 --- a/src/main/webapp/WEB-INF/content/modificationViewer.jsp +++ b/src/main/webapp/WEB-INF/content/modificationViewer.jsp @@ -63,6 +63,8 @@ <form method="POST" action="commit.action" id="editForm"> +<s:hidden name="scmType" id="scmType" value="%{scmType}"/> + <div id="head"> @@ -143,7 +145,7 @@ </s:set> <s:a id="logout" - href="logout.action?address=%{addressDeco}&projectUrl=%{projectUrlDeco}" + href="logout.action?address=%{addressDeco}&projectUrl=%{projectUrlDeco}&scmType=%{scmType}" title="Logout" > <div id="logoutButton"></div> @@ -324,9 +326,6 @@ <script type="text/javascript"> var textarea = document.getElementById('newTextId'); - var uiOptions = { imagePath : 'codemirror-ui/images/silk', path : 'codemirror-ui/js/', searchMode : 'inline', - buttons : ['undo', 'redo', 'jump', 'reindentSelection', 'reindent'] } - var codeMirrorOptions = { mode: "null", lineNumbers: true } var editor = CodeMirror.fromTextArea(textarea, { lineNumbers: true }); diff --git a/src/main/webapp/WEB-INF/content/outConnection.jsp b/src/main/webapp/WEB-INF/content/outConnection.jsp index 6ef5d0e..c7c99a2 100644 --- a/src/main/webapp/WEB-INF/content/outConnection.jsp +++ b/src/main/webapp/WEB-INF/content/outConnection.jsp @@ -37,6 +37,8 @@ <title>SCM Web Editor</title> <script type="text/javascript" src="js/branches.js"></script> + <script type="text/javascript" src="js/scmDetector.js"></script> + </head> <body> <!-- <a target="_blank" href="http://maven-site.nuiton.org/scmwebeditor/"><img src="img/accueil/machine-a-ecrire.png" alt="$alt" /></a> --> @@ -118,8 +120,17 @@ <input type="submit"/> </p> + </center> + <p> + <s:text name="scm.outConnection.scmType"/> + <select id="scmType" name="scmType"> + <option>SVN</option> + <option>Git</option> + </select> + </p> + <div id="branches"> <s:text name="scm.outConnection.selectBranch"/> <select id="branchesList"> diff --git a/src/main/webapp/WEB-INF/content/privateSvnRedirect.jsp b/src/main/webapp/WEB-INF/content/privateSvnRedirect.jsp index 6ff776d..bc9dd0c 100644 --- a/src/main/webapp/WEB-INF/content/privateSvnRedirect.jsp +++ b/src/main/webapp/WEB-INF/content/privateSvnRedirect.jsp @@ -62,6 +62,8 @@ Author : glorieux --%> </p> + <s:hidden name="scmType" value="%{scmType}" id="scmType"/> + <input type="submit" name="Save"/> diff --git a/src/main/webapp/WEB-INF/content/search.jsp b/src/main/webapp/WEB-INF/content/search.jsp index 3686bc1..c9224a5 100644 --- a/src/main/webapp/WEB-INF/content/search.jsp +++ b/src/main/webapp/WEB-INF/content/search.jsp @@ -33,14 +33,15 @@ var item = event.originalEvent.data.rslt.obj; if (item.text().indexOf("/") == -1) { - document.location.href = ("checkout.action?address=" + item.attr("id")); + var scmType = $("#scmType").val(); + document.location.href = ("checkout.action?address=" + item.attr("id") + "&scmType=" + scmType); } }); </script> -<s:if test="address.endsWith('.git')"> +<s:if test="scmType.equals('Git')"> <s:text name="scm.outConnection.headBranch"/> <s:if test="selectedBranch != null"> <s:if test="selectedBranch != ''"> @@ -68,7 +69,7 @@ <s:url id="searchTreeUrl" - action="search?address=%{address}&username=%{username}&pw=%{pw}&selectedBranch=%{selectedBranch}"/> + action="search?address=%{address}&username=%{username}&pw=%{pw}&selectedBranch=%{selectedBranch}&scmType=%{scmType}"/> <sjt:tree id="scmTree" htmlTitles="true" jstreetheme="classic" diff --git a/src/main/webapp/js/branches.js b/src/main/webapp/js/branches.js index 34f9c4e..689311d 100644 --- a/src/main/webapp/js/branches.js +++ b/src/main/webapp/js/branches.js @@ -1,18 +1,16 @@ -var search1; -var search2; - $(document).ready(function() { $("#ajaxSearchButton").on("click", function() { var listDiv = $("#branches"); var listSelect = $("#branchesList"); var address = $("#addressInput").val(); + var scmType = $("#scmType").val(); - if (address.endsWith(".git")) { + if (scmType == "Git") { listSelect.find("option:gt(0)").remove(); - $.getJSON("getBranches.action?address=" + address, function(result) { + $.getJSON("getBranches.action?address=" + address + "&scmType=" + scmType, function(result) { $.each(result.branches, function(i, field) { listSelect.append("<option>" + field + "</option>"); }); diff --git a/src/main/webapp/js/scmDetector.js b/src/main/webapp/js/scmDetector.js new file mode 100644 index 0000000..a76d1f0 --- /dev/null +++ b/src/main/webapp/js/scmDetector.js @@ -0,0 +1,9 @@ +$(document).ready(function() { + + $("#addressInput").on("input", function() { + var address = $("#addressInput").val(); + if (address.contains(".git")) { + $("#scmType").val("Git"); + } + }); +}); \ No newline at end of file -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
participants (1)
-
nuiton.org scm