aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-web
diff options
context:
space:
mode:
Diffstat (limited to 'archiva-modules/archiva-web')
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js26
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js76
-rw-r--r--archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html36
3 files changed, 88 insertions, 50 deletions
diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js
index 1f18d8398..70caaee49 100644
--- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js
+++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js
@@ -465,32 +465,6 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa
checkArtifactDetailContent(groupId,artifactId,version,repositoryId,"artifact-details-dependencies-content-a");
});
- this.get('#artifact-details-files-content/:groupId/:artifactId/:version',function(context){
-
- var groupId= this.params.groupId;
- var artifactId= this.params.artifactId;
- var version= this.params.version;
-
- checkArtifactDetailContent(groupId,artifactId,version,null,"artifact-details-files-content-a","artifact-details-files-content",
- function(groupId,artifactId,version,artifactVersionDetailViewModel){
- displayArtifactFilesContent(artifactVersionDetailViewModel);
- });
-
- });
-
- this.get('#artifact-details-files-content~:repositoryId/:groupId/:artifactId/:version',function(context){
-
- var repositoryId = this.params.repositoryId;
- var groupId= this.params.groupId;
- var artifactId= this.params.artifactId;
- var version= this.params.version;
- checkArtifactDetailContent(groupId,artifactId,version,repositoryId,"artifact-details-files-content-a","artifact-details-files-content",
- function(groupId,artifactId,version,artifactVersionDetailViewModel){
- displayArtifactFilesContent(artifactVersionDetailViewModel);
- });
- });
-
-
this.get('#artifact-details-download-content/:groupId/:artifactId/:version',function(context){
var repositoryId = this.params.repositoryId;
diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js
index 1ae512a97..d65d152b6 100644
--- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js
+++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js
@@ -720,6 +720,80 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
var artifactDetailsDownloadViewModel = new ArtifactDetailsDownloadViewModel(mapArtifacts(data),artifactVersionDetailViewModel);
mainContent.find("#artifact-details-download-content" ).attr("data-bind",'template:{name:"artifact-details-download-content_tmpl"}');
ko.applyBindings(artifactDetailsDownloadViewModel,mainContent.find("#artifact-details-download-content" ).get(0));
+
+
+ mainContent.find("#artifact-download-list-files li img" ).on("click",function(){
+ mainContent.find("#artifact_content_tree").empty();
+ var contentText = mainContent.find("#artifact-content-text" );
+ contentText.empty();
+ var idValue = $(this ).attr("id");
+ var splitted = idValue.split(":");
+
+ var classifier=splitted[0];
+ var version=splitted[1];
+ var type = splitted[2];
+
+ $.log("click:" + idValue + " -> " + classifier + ":" + type + ":" + version);
+ if (type=="pom"){
+ $.log("show pom");
+ var pomContentUrl = "restServices/archivaServices/browseService/artifactContentText/"+encodeURIComponent(artifactVersionDetailViewModel.groupId);
+ pomContentUrl+="/"+encodeURIComponent(artifactVersionDetailViewModel.artifactId)+"/"+encodeURIComponent(version);
+ pomContentUrl+="?repositoryId="+encodeURIComponent(getSelectedBrowsingRepository());
+ pomContentUrl+="&t=pom";
+ contentText.html(mediumSpinnerImg());
+ $.ajax({
+ url: pomContentUrl,
+ success: function(data) {
+ var text = data.content.replace(/</g,'&lt;');
+ text=text.replace(/>/g,"&gt;");
+ contentText.html(text);
+ prettyPrint();
+ // olamy do not move to anchor to not loose nav history
+ //goToAnchor("artifact-content-text-header");
+ //window.location.href=window.location+"#artifact-content-text-header";
+ }
+ });
+ return;
+ }
+ var entriesUrl = "restServices/archivaServices/browseService/artifactContentEntries/"+encodeURIComponent(artifactVersionDetailViewModel.groupId);
+ entriesUrl+="/"+encodeURIComponent(artifactVersionDetailViewModel.artifactId)+"/"+encodeURIComponent(version);
+ entriesUrl+="?repositoryId="+encodeURIComponent(getSelectedBrowsingRepository());
+ if(classifier){
+ entriesUrl+="&c="+encodeURIComponent(classifier);
+ }
+ $("#main-content").find("#artifact_content_tree").fileTree({
+ script: entriesUrl,
+ root: ""
+ },function(file) {
+ $.log("file:"+file.substringBeforeLast("/")+',classifier:'+classifier);
+ var fileContentUrl = "restServices/archivaServices/browseService/artifactContentText/"+encodeURIComponent(artifactVersionDetailViewModel.groupId);
+ fileContentUrl+="/"+encodeURIComponent(artifactVersionDetailViewModel.artifactId)+"/"+encodeURIComponent(version);
+ fileContentUrl+="?repositoryId="+encodeURIComponent(getSelectedBrowsingRepository());
+ if(type){
+ fileContentUrl+="&t="+encodeURIComponent(type);
+ }
+ if(classifier){
+ fileContentUrl+="&c="+encodeURIComponent(classifier);
+ }
+ fileContentUrl+="&p="+encodeURIComponent(file.substringBeforeLast("/"));
+ $.ajax({
+ url: fileContentUrl,
+ success: function(data) {
+ var text = data.content.replace(/</g,'&lt;');
+ text=text.replace(/>/g,"&gt;");
+ mainContent.find("#artifact-content-text" ).html(smallSpinnerImg());
+ mainContent.find("#artifact-content-text" ).html(text);
+ prettyPrint();
+ // olamy do not move to anchor to not loose nav history
+ //goToAnchor("artifact-content-text-header");
+ //window.location.href=window.location+"#artifact-content-text-header";
+ }
+ });
+ }
+ );
+ });
+
+
});
return;
}
@@ -740,7 +814,7 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
var idValue = $(this ).attr("id");
var splitted = idValue.split(":");
- var classifier=splitted[0];//idValue.substringBeforeLast(":");
+ var classifier=splitted[0];
var version=splitted[1];
var type = splitted[2];
diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html
index c2a0ca1b0..648a8a6a5 100644
--- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html
+++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html
@@ -515,10 +515,6 @@
data-target="#artifact-details-dependency-tree-content" href="#artifact-details-dependency-tree-content">${$.i18n.prop('artifact.detail.tab.header.dependency.tree')}</a>
</li>
<li>
- <a data-toggle="tab" id="artifact-details-files-content-a" data-target="#artifact-details-files-content"
- href="#artifact-details-files-content">${$.i18n.prop('artifact.detail.tab.header.file.content')}</a>
- </li>
- <li>
<a data-toggle="tab" id="artifact-details-download-content-a" data-target="#artifact-details-download-content"
href="#artifact-details-download-content">${$.i18n.prop('artifact.detail.tab.header.file.download')}</a>
</li>
@@ -927,13 +923,20 @@
</ul>
</script>
-<script id="artifact-details-files-content_tmpl" type="text/html">
+<script id="artifact-details-download-content_tmpl" type="text/html">
+
<div class="row-fluid">
<div class="span5">
- <ul id="artifact-content-list-files" class="package-list">
- {{each artifactDownloadInfos}}
- <li id="${$value.classifier}:${$value.version}:${$value.packaging}">
- <a class="cursor-hand">${$value.packaging}:${$value.version}&nbsp;-&nbsp;${$value.size}</a>
+ <ul id="artifact-download-list-files" class="package-list">
+ {{each(i, row) artifacts()}}
+ <li>
+ <img src="images/system-search-16-16.png" class="cursor-hand" id="${row.classifier}:${row.version}:${row.packaging}"/>
+ {{if deleteKarma}}
+ <a href="#" data-bind="click: function(){deleteArtifact(row)}"><img src="images/trash.png"/></a>&nbsp;<a
+ href="${row.url}">${row.packaging}:${row.version}&nbsp;-&nbsp;${row.size}</a>
+ {{else}}
+ <a href="${row.url}">${row.packaging}:${row.version}&nbsp;-&nbsp;${row.size}</a>
+ {{/if}}
</li>
{{/each}}
</ul>
@@ -943,24 +946,11 @@
</div>
</div>
</div>
+
<h4 id="artifact-content-text-header">${$.i18n.prop('browse.artifact.content.header')}</h4>
<div class="source">
<pre class="prettyprint linenums" id="artifact-content-text"></pre>
</div>
-</script>
-<script id="artifact-details-download-content_tmpl" type="text/html">
- <ul id="artifact-download-list-files" class="package-list">
- {{each(i, row) artifacts()}}
- <li>
- {{if deleteKarma}}
- <a href="#" data-bind="click: function(){deleteArtifact(row)}"><img src="images/trash.png"/></a>&nbsp;<a
- href="${row.url}">${row.packaging}:${row.version}&nbsp;-&nbsp;${row.size}</a>
- {{else}}
- <a href="${row.url}">${row.packaging}:${row.version}&nbsp;-&nbsp;${row.size}</a>
- {{/if}}
- </li>
- {{/each}}
- </ul>
</script> \ No newline at end of file