]> source.dussan.org Git - archiva.git/commitdiff
make advanced search navigable
authorOlivier Lamy <olamy@apache.org>
Thu, 23 Aug 2012 16:11:42 +0000 (16:11 +0000)
committerOlivier Lamy <olamy@apache.org>
Thu, 23 Aug 2012 16:11:42 +0000 (16:11 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1376569 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js

index 51a3bdc2a6d775c62a0df9acc64f5c12555bfef2..3baa67acf0f19e6beccf9736eaa8e88be4284493 100644 (file)
@@ -178,7 +178,7 @@ function($,sammy,tmpl,ui) {
       this.activeMenuId = ko.observable();
           
       window.sammyArchivaApplication = Sammy(function () {
-        var self = this;
+
         this.get('#quicksearch~:artifactId',function(){
           $("#main-content" ).html(mediumSpinnerImg());
           var artifactId= this.params.artifactId;
@@ -267,20 +267,20 @@ function($,sammy,tmpl,ui) {
           searchRequest.classifier(classifier);
           searchRequest.packaging(packaging);
           searchRequest.className(className);
-
-          searchRequest.selectedRepoIds=repositoryIds;
+          //searchRequest.repositories=repos;
+          //searchRequest.selectedRepoIds=repos;
           searchViewModel.searchRequest(searchRequest);
           displaySearch(function(){
 
-            searchViewModel.search("restServices/archivaServices/searchService/searchArtifacts",repositoryIds);
+            searchViewModel.search("restServices/archivaServices/searchService/searchArtifacts",repos);//,repositoryIds);
           },searchViewModel);
         }
 
-        self.get("#advancedsearch/:queryterms",function(){
+        this.get("#advancedsearch/:queryterms",function(){
           advancedSearchRoute(this.params);
         });
 
-        self.get("#advancedsearch~:repositoryIds/:queryterms",function(){
+        this.get("#advancedsearch~:repositoryIds/:queryterms",function(){
           advancedSearchRoute(this.params);
         });
 
index 1061b19295934f4697787c55e2d62fdaaf6c0233..ec69ac2a4c906cf40870fdedb4bdb1b9abf53957 100644 (file)
@@ -1567,14 +1567,11 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
         });
       }
       location+="/"+queryTerm;
-      $.log("basicsearch location:"+location);
       window.sammyArchivaApplication.setLocation(location);
-      //self.search("restServices/archivaServices/searchService/quickSearchWithRepositories");
     }
 
     this.externalBasicSearch=function(){
       var queryTerm=this.searchRequest().queryTerms();
-      $.log("externalBasicSearch#queryTerm:"+queryTerm);
       self.search("restServices/archivaServices/searchService/quickSearchWithRepositories",this.searchRequest().repositories);
     }
 
@@ -1585,7 +1582,55 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
       this.search("restServices/archivaServices/searchService/searchArtifacts");
     }
     advancedSearch=function(){
-      self.search("restServices/archivaServices/searchService/searchArtifacts");
+      var location="#advancedsearch";
+
+      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+="/";
+      if(self.searchRequest().groupId()){
+        location+=self.searchRequest().groupId();
+      }/*else{
+        location+='~';
+      }*/
+      if(self.searchRequest().artifactId()){
+        location+='~'+self.searchRequest().artifactId();
+      }else{
+        location+='~';
+      }
+      if(self.searchRequest().version()){
+        location+='~'+self.searchRequest().version();
+      }else{
+        location+='~';
+      }
+      if(self.searchRequest().classifier()){
+        location+='~'+self.searchRequest().classifier();
+      }else{
+        location+='~';
+      }
+      if(self.searchRequest().packaging()){
+        location+='~'+self.searchRequest().packaging();
+      }else{
+        location+='~';
+      }
+      if(self.searchRequest().className()){
+        location+='~'+self.searchRequest().className();
+      }else{
+        location+='~';
+      }
+
+      $.log("location:"+location);
+      window.sammyArchivaApplication.setLocation(location);
     }
     removeFilter=function(){
       $.log("removeFilter:"+self.resultViewModel.originalArtifacts.length);