archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1376569 - in /archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva: main.js search.js
Date Thu, 23 Aug 2012 16:11:43 GMT
Author: olamy
Date: Thu Aug 23 16:11:42 2012
New Revision: 1376569

URL: http://svn.apache.org/viewvc?rev=1376569&view=rev
Log:
make advanced search navigable

Modified:
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js?rev=1376569&r1=1376568&r2=1376569&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js
Thu Aug 23 16:11:42 2012
@@ -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);
         });
 

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js?rev=1376569&r1=1376568&r2=1376569&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js
Thu Aug 23 16:11:42 2012
@@ -1567,14 +1567,11 @@ define("archiva.search",["jquery","i18n"
         });
       }
       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"
       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);



Mime
View raw message