|
From: <tob...@us...> - 2014-05-30 21:13:12
|
Revision: 8427
http://sourceforge.net/p/bigdata/code/8427
Author: tobycraig
Date: 2014-05-30 21:13:07 +0000 (Fri, 30 May 2014)
Log Message:
-----------
Added download namespace properties functionality
Modified Paths:
--------------
branches/NEW_WORKBENCH_1_3_2_BRANCH/bigdata-war/src/html/js/workbench.js
Modified: branches/NEW_WORKBENCH_1_3_2_BRANCH/bigdata-war/src/html/js/workbench.js
===================================================================
--- branches/NEW_WORKBENCH_1_3_2_BRANCH/bigdata-war/src/html/js/workbench.js 2014-05-30 21:01:10 UTC (rev 8426)
+++ branches/NEW_WORKBENCH_1_3_2_BRANCH/bigdata-war/src/html/js/workbench.js 2014-05-30 21:13:07 UTC (rev 8427)
@@ -107,7 +107,7 @@
} else {
use = '<a href="#" class="use-namespace">Use</a>';
}
- $('#namespaces-list').append('<li data-name="' + title + '" data-url="' + url + '">' + titleText + ' - ' + use + ' - <a href="#" class="delete-namespace">Delete</a> - <a href="#" class="namespace-properties">Properties</a> - <a href="/bigdata/namespace/' + title + '/sparql" class="namespace-service-description">Service Description</a></li>');
+ $('#namespaces-list').append('<li data-name="' + title + '" data-url="' + url + '">' + titleText + ' - ' + use + ' - <a href="#" class="delete-namespace">Delete</a> - <a href="#" class="namespace-properties">Properties</a> (Download <a href="/bigdata/namespace/' + title + '/properties" download="' + title + '.xml">XML</a>/<a href="#" class="namespace-properties-java">Java</a>) - <a href="#" class="clone-namespace">Clone</a> - <a href="/bigdata/namespace/' + title + '/sparql" class="namespace-service-description">Service Description</a></li>');
}
$('.use-namespace').click(function(e) {
e.preventDefault();
@@ -121,6 +121,14 @@
e.preventDefault();
getNamespaceProperties($(this).parent().data('name'));
});
+ $('.namespace-properties-java').click(function(e) {
+ e.preventDefault();
+ getNamespaceProperties($(this).parent().data('name'), 'java');
+ });
+ $('.clone-namespace').click(function(e) {
+ e.preventDefault();
+ cloneNamespace($(this).parent().data('name'));
+ });
$('.namespace-service-description').click(function(e) {
return confirm('This can be an expensive operation. Proceed anyway?');
});
@@ -165,15 +173,25 @@
}
}
-function getNamespaceProperties(namespace) {
- $('#namespace-properties h1').html(namespace);
- $('#namespace-properties table').empty();
- $('#namespace-properties').show();
+function getNamespaceProperties(namespace, download) {
var url = '/bigdata/namespace/' + namespace + '/properties';
+ if(!download) {
+ $('#namespace-properties h1').html(namespace);
+ $('#namespace-properties table').empty();
+ $('#namespace-properties').show();
+ }
$.get(url, function(data) {
+ var java = '';
$.each(data.getElementsByTagName('entry'), function(i, entry) {
- $('#namespace-properties table').append('<tr><td>' + entry.getAttribute('key') + '</td><td>' + entry.textContent + '</td></tr>');
+ if(download) {
+ java += entry.getAttribute('key') + '=' + entry.textContent + '\n';
+ } else {
+ $('#namespace-properties table').append('<tr><td>' + entry.getAttribute('key') + '</td><td>' + entry.textContent + '</td></tr>');
+ }
});
+ if(download) {
+ downloadFile(java, 'text/x-java-properties', this.url.split('/')[3] + '.properties');
+ }
});
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|