Commit fb45368c authored by Romain Loth's avatar Romain Loth

finished support for multiple query via 'refine' buttons (except for...

finished support for multiple query via 'refine' buttons (except for corresponding changes in tinawebJS bridge that are not included in this commit)
parent 55750288
This diff is collapsed.
......@@ -28,14 +28,17 @@ def main():
# db=SQLite('../community.db')
db=MySQL(MY_SQL_HOST)
if 'query' in request.args:
# TODO fix ('refine' button)
# query is a json {cat:filtervalue} , not an executable SQL query !!
filteredquery = request.args['query']
scholars = db.getScholarsList("filter",filteredquery)
if 'qtype' in request.args:
if request.args['qtype'] == "filters":
# all the other args are a series of constraints for filtering
# ex: qtype=filters&keywords[]=complex%20networks&keywords[]=complexity%20theory&countries[]=France&countries[]=USA
scholars = db.getScholarsList("filter",request.query_string.decode())
else:
unique_id = request.args['unique_id']
scholars = db.getScholarsList("unique_id",unique_id)
else:
unique_id = request.args['unique_id']
scholars = db.getScholarsList("unique_id",unique_id)
raise TypeError("API query is missing qtype (should be 'filters' or 'uid')")
if scholars and len(scholars):
db.extract(scholars)
# < / Data Extraction > #
......
......@@ -245,6 +245,8 @@ $(document).ready(function() {
log(query);
query = encodeURIComponent(JSON.stringify(query));
console.log("calling callback with encoded query:", query)
return cb(query);
};
$("#generate").click(function() {
......@@ -252,7 +254,7 @@ $(document).ready(function() {
return $("#welcome").fadeOut("slow", function() {
show("#loading", "fast");
return collectFilters(function(query) {
return window.location.href='explorerjs.html?type="filter"&nodeidparam="' + query +'"';
return window.location.href='explorerjs.html?type="filter"&nodeidparam="' + escape(query) +'"';
//return loadGraph("getgraph.php?query=" + query);
});
});
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment