var repositoryIds = this.params.repositoryIds;
var repos = repositoryIds.split("~");
$.log("queryterms:"+queryterms+',repositoryIds:'+repositoryIds+",repos:"+repos.length);
+ var searchViewModel = new SearchViewModel();
+ var searchRequest = new SearchRequest();
+ searchRequest.queryTerms(queryterms);
+ searchRequest.repositories=repos;
+ searchViewModel.searchRequest(searchRequest);
+ displaySearch(function(){
+ searchViewModel.externalBasicSearch();
+ },searchViewModel);
+ });
+
+ this.get('#searchresult~:repositoryIds/:queryterms',function(){
var queryterms= this.params.queryterms;
- $.log("queryterms:"+queryterms);
+ var repositoryIds = this.params.repositoryIds;
+ var repos = repositoryIds.split("~");
+ $.log("queryterms:"+queryterms+',repositoryIds:'+repositoryIds+",repos:"+repos.length);
var searchViewModel = new SearchViewModel();
var searchRequest = new SearchRequest();
searchRequest.queryTerms(queryterms);
},searchViewModel);
});
+ this.get('#searchresult/:queryterms',function(){
+ var queryterms= this.params.queryterms;
+ $.log("queryterms:"+queryterms);
+ var searchViewModel = new SearchViewModel();
+ var searchRequest = new SearchRequest();
+ searchRequest.queryTerms(queryterms);
+ searchViewModel.searchRequest(searchRequest);
+ displaySearch(function(){
+ searchViewModel.externalBasicSearch();
+ },searchViewModel);
+ });
+
this.get('#open-admin-create-box',function(){
$.log("#open-admin-create-box");
adminCreateBox();
*/
SearchViewModel=function(){
var self=this;
+ var mainContent=$("#main-content");
this.searchRequest=ko.observable(new SearchRequest());
this.observableRepoIds=ko.observableArray([]);
this.selectedRepoIds=[];
// cleanup previours error message
customShowError("#main-content #search-basic-form", null, null, []);
}
- self.search("restServices/archivaServices/searchService/quickSearchWithRepositories");
+ var location="#searchresult";
+
+ self.selectedRepoIds=[];
+ mainContent.find("#search-basic-repositories" )
+ .find(".chzn-choices li span").each(function(i,span){
+ self.selectedRepoIds.push($(span).html());
+ }
+ );
+
+ if (self.selectedRepoIds.length>0){
+ $.log("selectedRepoIds:"+self.selectedRepoIds.length);
+ $(self.selectedRepoIds).each(function(index, Element){
+ location+="~"+self.selectedRepoIds[index];
+ });
+ }
+ location+="/"+queryTerm;
+ $.log("basicsearch location:"+location);
+ window.sammyArchivaApplication.setLocation(location);
+ //self.search("restServices/archivaServices/searchService/quickSearchWithRepositories");
}
this.externalBasicSearch=function(){
}
this.search=function(url,repositoriesIds){
- var mainContent=$("#main-content");
-
var searchResultsGrid=mainContent.find("#search-results #search-results-grid" );
mainContent.find("#btn-basic-search" ).button("loading");
mainContent.find("#btn-advanced-search" ).button("loading");
$.log("repos:"+repos);
searchViewModel.observableRepoIds(repos);
ko.applyBindings(searchViewModel,mainContent.find("#search-artifacts-div").get(0));
- mainContent.find("#search-basic-repostories-select" ).chosen();
+ mainContent.find("#search-basic-repositories-select" ).chosen();
if (successCallbackFn && $.isFunction(successCallbackFn)) successCallbackFn();
}
});
<fieldset>
<div class="control-group" id="search-basic-repositories">
<select data-placeholder="${$.i18n.prop('search.artifact.search.form.query.repositories')}"
- id="search-basic-repostories-select" class="chzn-select defaults"
+ id="search-basic-repositories-select" class="chzn-select defaults"
multiple style="width:350px;" tabindex="4">
<option value="all">${$.i18n.prop('search.artifact.search.form.repositories.all')}</option>
{{each(i,repoId) observableRepoIds}}