aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorzsloan2016-10-21 19:53:36 +0000
committerzsloan2016-10-21 19:53:36 +0000
commit4feab4e85475834fafa930291934b441d1611e44 (patch)
tree8955c96527bccd4f017e8c33ed05c2dc4a9f006e /wqflask
parent921726b7bf2ced0cbb348f366d8a2955400567c3 (diff)
downloadgenenetwork2-4feab4e85475834fafa930291934b441d1611e44.tar.gz
Added metadata to "Download Table"
Only checked traits are now downloaded and all traits are downloaded if nothing is checked
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/export_traits.py14
-rw-r--r--wqflask/wqflask/static/new/javascript/search_results.js25
-rw-r--r--wqflask/wqflask/templates/search_result_page.html1
3 files changed, 33 insertions, 7 deletions
diff --git a/wqflask/wqflask/export_traits.py b/wqflask/wqflask/export_traits.py
index 280566d7..eeed72f1 100644
--- a/wqflask/wqflask/export_traits.py
+++ b/wqflask/wqflask/export_traits.py
@@ -4,6 +4,7 @@ import operator
import csv
import xlsxwriter
import StringIO
+import datetime
import simplejson as json
@@ -18,10 +19,21 @@ def export_search_results_csv(targs):
buff = StringIO.StringIO()
writer = csv.writer(buff)
+ metadata = []
+
+ metadata.append(["Citations: Please see www.genenetwork.org/reference.html"])
+ metadata.append(["Database: " + targs['database_name']])
+ metadata.append(["Date: " + datetime.datetime.now().strftime("%B %d, %Y")])
+ metadata.append(["Time: " + datetime.datetime.now().strftime("%H:%M GMT")])
+ metadata.append(["Status of data ownership: Possibly unpublished data; please see www.genenetwork.org/statusandContact.html for details on sources, ownership, and usage of these data."])
+
+ for metadata_row in metadata:
+ writer.writerow(metadata_row)
+
writer.writerow(table_headers)
for trait_info in table_rows:
writer.writerow(trait_info)
-
+
csv_data = buff.getvalue()
buff.close()
diff --git a/wqflask/wqflask/static/new/javascript/search_results.js b/wqflask/wqflask/static/new/javascript/search_results.js
index 54a61a45..5250523f 100644
--- a/wqflask/wqflask/static/new/javascript/search_results.js
+++ b/wqflask/wqflask/static/new/javascript/search_results.js
@@ -174,13 +174,26 @@ $(function() {
rows = [];
trait_table.find('tbody tr').each(function (i, tr) {
- this_row = [];
- $(tr).find('td').each(function(j, td){
- if ($(td).data('export')){
- this_row.push($(td).data('export'));
+ if (trait_table.find('input[name="searchResult"]:checked').length > 0) {
+ if ($(this).find('input[name="searchResult"]').is(':checked')){
+ this_row = [];
+ $(tr).find('td').each(function(j, td){
+ if ($(td).data('export')){
+ this_row.push($(td).data('export'));
+ }
+ });
+ rows.push(this_row);
}
- });
- rows.push(this_row);
+ }
+ else {
+ this_row = [];
+ $(tr).find('td').each(function(j, td){
+ if ($(td).data('export')){
+ this_row.push($(td).data('export'));
+ }
+ });
+ rows.push(this_row);
+ }
});
table_dict['rows'] = rows;
console.log("TABLEDICT:", table_dict);
diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html
index 13993e83..f44714f3 100644
--- a/wqflask/wqflask/templates/search_result_page.html
+++ b/wqflask/wqflask/templates/search_result_page.html
@@ -59,6 +59,7 @@
<br />
<br />
<form id="export_form" method="POST" action="/export_traits_csv">
+ <input type="hidden" name="database_name" id="database_name" value="{{ dataset.fullname }}">
<input type="hidden" name="export_data" id="export_data" value="">
<button class="btn btn-default" id="export_traits">Download CSV</button>
</form>