trigger download remote index call in async mode

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1176386 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2011-09-27 13:56:10 +00:00
parent 3283a043d1
commit 9b1ab5d366
1 changed files with 24 additions and 18 deletions

View File

@ -19,12 +19,14 @@
<%@ page contentType="text/html; charset=UTF-8" %> <%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %> <%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="redback" uri="http://plexus.codehaus.org/redback/taglib-1.0" %> <%@ taglib prefix="redback" uri="http://plexus.codehaus.org/redback/taglib-1.0" %>
<html> <html>
<head> <head>
<title>Admin: Edit Remote Repository</title> <title>Admin: Edit Remote Repository</title>
<s:head/> <s:head/>
<script type="text/javascript" src="<c:url value='/js/jquery-1.6.1.min.js'/>"></script>
</head> </head>
<body> <body>
@ -42,28 +44,32 @@
<s:submit value="Update Repository"/> <s:submit value="Update Repository"/>
</s:form> </s:form>
<redback:ifAuthorized permission="archiva-run-indexer"> <redback:ifAuthorized permission="archiva-run-indexer">
<s:form method="post" action="editRemoteRepository!downloadRemoteIndex" namespace="/admin" validate="false" <form id="downloadRemoteForm" name="downloadRemoteForm">
onsubmit="javascript:downloadRemote();"> <input type="hidden" value="${repoid}" id="repoid"/>
<s:hidden name="repoid"/> Now: <input type="checkbox" name="now"/><br/>
<s:checkbox name="now" label="Now" /> Full download: <input type="checkbox" name="fullDownload" /><br/>
<s:checkbox name="fullDownload" label="Full download"/> <input type="button" onclick="downloadRemote();" value="Download Remote Index" />
<s:submit value="download Remote Index" onclick="javascript:downloadRemote();"/>
</s:form> </form>
</redback:ifAuthorized> </redback:ifAuthorized>
<script type="text/javascript">
document.getElementById("editRemoteRepository_repository_name").focus();
function downloadRemote() {
$.ajax({
url: "test.html",
success: function(){
alert("ok");
}
});
}
</script>
</div> </div>
<script type="text/javascript">
function downloadRemote() {
$.ajax({
url: "${pageContext.request.contextPath}/restServices/archivaServices/repositoriesService/scheduleDownloadRemoteIndex",
data: "repositoryId="+document.getElementById("downloadRemoteForm").repoid.value+"&now="+document.getElementById("downloadRemoteForm").now.value+"&fullDownload="+document.getElementById("downloadRemoteForm").fullDownload.value ,
error: function(){
alert('error');
}
});
return false;
}
document.getElementById("editRemoteRepository_repository_name").focus();
</script>
</body> </body>
</html> </html>