]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1620] add a tab to browse artifact content in artifact detail view
authorOlivier Lamy <olamy@apache.org>
Mon, 21 May 2012 17:08:31 +0000 (17:08 +0000)
committerOlivier Lamy <olamy@apache.org>
Mon, 21 May 2012 17:08:31 +0000 (17:08 +0000)
artifact content.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1341112 13f79535-47bb-0310-9956-ffa450edef68

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

index e587ad56486ee9c085f9317c4f34fbd6f20b262f..b927169d400c00ec05c3bcea74b00ccb90dbcca4 100644 (file)
@@ -280,6 +280,7 @@ define("search",["jquery","i18n","jquery.tmpl","choosen","order!knockout","knock
                   $.get(artifactDownloadInfosUrl,function(data){
                     $("#artifact-details-files-content" ).html($("#artifact-details-files-content_tmpl").tmpl({artifactDownloadInfos:data}));
                     mainContent.find("#artifact-content-list-files li" ).on("click",function(){
+                      $("#main-content #artifact_content_tree").html("");
                       var idValue = $(this ).attr("id");
                       var classifier=idValue.substringBeforeLast(":");
                       var type = idValue.substringAfterLast(":");
@@ -314,6 +315,27 @@ define("search",["jquery","i18n","jquery.tmpl","choosen","order!knockout","knock
                         root: ""
                                  },function(file) {
                           $.log("file:"+file.substringBeforeLast("/")+',classifier:'+classifier);
+                          var fileContentUrl = "restServices/archivaServices/browseService/artifactContentText/"+encodeURIComponent(self.groupId);
+                          fileContentUrl+="/"+encodeURIComponent(self.artifactId)+"/"+encodeURIComponent(self.version);
+                          fileContentUrl+="?repositoryId="+encodeURIComponent(getSelectedBrowsingRepository());
+                          if(type){
+                            fileContentUrl+="&t="+type;
+                          }
+                          if(classifier){
+                            fileContentUrl+="&c="+classifier;
+                          }
+                          fileContentUrl+="&p="+file.substringBeforeLast("/");
+                          $.ajax({
+                           url: fileContentUrl,
+                           dataType: "text",
+                           success: function(data) {
+                             $.log("foo");
+                             $.log("data:"+data);
+                             var text = data.replace(/</g,'&lt;');
+                             text=text.replace(/>/g,"&gt;");
+                             mainContent.find("#artifact-content-text" ).html(text);
+                           }
+                          });
                                  }
                       );
                     });