Commit 3dfb1615 authored by PkSM3's avatar PkSM3

network selector and php ok

parent 6b85aa82
...@@ -10,6 +10,7 @@ $gexf_db["data/ClimateChange/Maps_S_800.gexf"] = "data/ClimateChange/wos_climate ...@@ -10,6 +10,7 @@ $gexf_db["data/ClimateChange/Maps_S_800.gexf"] = "data/ClimateChange/wos_climate
$gexf_db["data/AXA/EditedJan20151980 nodes V2 PageRank.gexf"] = "data/AXA/data.db"; $gexf_db["data/AXA/EditedJan20151980 nodes V2 PageRank.gexf"] = "data/AXA/data.db";
$gexf_db["data/AXA/RiskV2PageRank.gexf"] = "data/AXA/data.db"; $gexf_db["data/AXA/RiskV2PageRank.gexf"] = "data/AXA/data.db";
$gexf_db["data/AXA/RiskV2PageRank5000.gexf"] = "data/AXA/data.db";
$gexf= str_replace('"','',$_GET["gexf"]); $gexf= str_replace('"','',$_GET["gexf"]);
......
...@@ -4,16 +4,26 @@ ...@@ -4,16 +4,26 @@
"title":"ISITITLE", "title":"ISITITLE",
"date":"ISIpubdate", "date":"ISIpubdate",
"abstract":"ISIABSTRACT", "abstract":"ISIABSTRACT",
"first" : "RiskV2PageRank.gexf",
"gexfs": { "gexfs": {
"RiskV2PageRank5000.gexf": {
"social": { "table":"ISIAUTHOR" , "textCol":"data","forkeyCol":"id"},
"semantic": { "table":"ISItermsAxa_2015" , "textCol":"data","forkeyCol":"id"}
},
"RiskV2PageRank.gexf": { "RiskV2PageRank.gexf": {
"social": { "table":"ISIAUTHOR" , "textCol":"data","forkeyCol":"id"}, "social": { "table":"ISIAUTHOR" , "textCol":"data","forkeyCol":"id"},
"semantic": { "table":"ISItermsAxa_2015" , "textCol":"data","forkeyCol":"id"} "semantic": { "table":"ISItermsAxa_2015" , "textCol":"data","forkeyCol":"id"}
}, },
"RiskV2PageRank5000.gexf": {
"social": { "table":"ISIAUTHOR" , "textCol":"data","forkeyCol":"id"},
"semantic": { "table":"ISItermsAxa_2015" , "textCol":"data","forkeyCol":"id"}
},
"asbestos.gexf": { "asbestos.gexf": {
"social": { "table":"ISIAUTHOR" , "textCol":"data","forkeyCol":"id"}, "social": { "table":"ISIAUTHOR" , "textCol":"data","forkeyCol":"id"},
"semantic": { "table":"ISItermsAsbestos" , "textCol":"data","forkeyCol":"id"} "semantic": { "table":"ISItermsAsbestos" , "textCol":"data","forkeyCol":"id"}
} }
} }
}, },
"data/ClimateChange": { "data/ClimateChange": {
"dbname":"wos_climate-change_title_2014-2015.db", "dbname":"wos_climate-change_title_2014-2015.db",
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<head> <head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> <meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>TinawebJS</title> <title>Mapping risk research</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8"> <meta charset="utf-8">
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<div class="container"> <div class="container">
<div class="navbar-header"> <div class="navbar-header">
<a href="index.html" class="navbar-brand"> <img width="20px" src="libs/img2/home.png"></img> TinawebJS</a> <a href="../index.html" class="navbar-brand"> <img width="20px" src="libs/img2/home.png"></img>Mapping Risk Research</a>
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#navbar-main"> <button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#navbar-main">
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
......
...@@ -5,11 +5,11 @@ var TW = {} ...@@ -5,11 +5,11 @@ var TW = {}
TW.twittertimeline = false; TW.twittertimeline = false;
TW.minimap=false; TW.minimap=false;
TW.getAdditionalInfo=false;// True: Activate TopPapers feature. TW.getAdditionalInfo=false;// True: Activate TopPapers feature.
TW.mainfile = ["db.json"]; //TW.mainfile = ["db.json"];
// // TW.mainfile = "api.json"; // // TW.mainfile = "api.json";
// TW.mainfile = [ TW.mainfile = [
// "data/2-Terms-Authors-300nodes.gexf", // "data/2-Terms-Authors-300nodes.gexf",
// "data/0-terms-terms-MainNodes.gexf", "data/0-terms-terms-MainNodes.gexf",
// "data/maziyar2.json", // "data/maziyar2.json",
// "data/3-Terms-Countries-300nodes.gexf", // "data/3-Terms-Countries-300nodes.gexf",
// // "data/noclimatechange_mnodes.gexf", // // "data/noclimatechange_mnodes.gexf",
...@@ -19,7 +19,7 @@ var TW = {} ...@@ -19,7 +19,7 @@ var TW = {}
// // "data/20141128_GPs_03_bi.gexf", // // "data/20141128_GPs_03_bi.gexf",
// // "data/example.json", // // "data/example.json",
// // "data/Elisa__Omodei.gexf", // // "data/Elisa__Omodei.gexf",
// ]; ];
TW.APINAME = "LOCALDB/"; TW.APINAME = "LOCALDB/";
TW.tagcloud_limit = 6; TW.tagcloud_limit = 6;
TW.bridge={}; TW.bridge={};
......
...@@ -51,35 +51,27 @@ function getGexfPath(v){ ...@@ -51,35 +51,27 @@ function getGexfPath(v){
return gexfpath; return gexfpath;
} }
function jsActionOnGexfSelector(gexfLegend){ function jsActionOnGexfSelector(gexfLegend , db_json){
db_json = (db_json)?"&mode=db.json":""
if(getGexfPath[gexfLegend]) if(getGexfPath[gexfLegend])
window.location=window.location.origin+window.location.pathname+"?file="+encodeURIComponent(getGexfPath(gexfLegend)); window.location=window.location.origin+window.location.pathname+"?file="+encodeURIComponent(getGexfPath(gexfLegend))+db_json;
else else
window.location=window.location.origin+window.location.pathname+"?file="+encodeURIComponent( gexfLegend ); window.location=window.location.origin+window.location.pathname+"?file="+encodeURIComponent( gexfLegend )+db_json;
} }
var files_selector = ""
if( !isUndef(getUrlParam.file) )
TW.mainfile.unshift( getUrlParam.file );
var unique_mainfile = TW.mainfile.filter(function(item, pos) { var file =""
return TW.mainfile.indexOf(item) == pos; if(!isUndef(getUrlParam.mode)) { // if {db|api}.json
}); file = getUrlParam.mode
TW.mainfile = unique_mainfile; } else {
if( !isUndef(getUrlParam.file) )
TW.mainfile.unshift( getUrlParam.file );
console.log("THE URL.FILE PARAM:") var unique_mainfile = TW.mainfile.filter(function(item, pos) {
console.log(TW.mainfile) return TW.mainfile.indexOf(item) == pos;
});
files_selector += '<select onchange="jsActionOnGexfSelector(this.value);">' file = (Array.isArray(TW.mainfile))?TW.mainfile[0]:TW.mainfile;
for(var i in TW.mainfile) {
var gotoURL = window.location.origin+window.location.pathname+"?file="+TW.mainfile[i];
files_selector += '<option>'+TW.mainfile[i]+'</option>'
} }
files_selector += "</select>"
$("#network").html(files_selector)
var file = (Array.isArray(TW.mainfile))?TW.mainfile[0]:TW.mainfile;
var RES = AjaxSync({ URL: file }); var RES = AjaxSync({ URL: file });
if(RES["OK"]) { if(RES["OK"]) {
...@@ -87,11 +79,28 @@ if(RES["OK"]) { ...@@ -87,11 +79,28 @@ if(RES["OK"]) {
var fileparam;// = { db|api.json , somefile.json|gexf } var fileparam;// = { db|api.json , somefile.json|gexf }
var the_data = RES["data"]; var the_data = RES["data"];
if(file=="db.json") {
var the_file = "";
if ( !isUndef(getUrlParam.mode) && getUrlParam.mode=="db.json") {
var first_file = "" , first_path = ""
for( var path in the_data ) {
first_file = the_data[path]["first"]
first_path = path
break;
}
if( isUndef(getUrlParam.file) ) {
the_file = first_path+"/"+first_file
} else {
the_file = first_path+"/"+getUrlParam.file
}
TW.getAdditionalInfo = true; TW.getAdditionalInfo = true;
fileparam = file; fileparam = the_file;
var files_selector = '<select onchange="jsActionOnGexfSelector(this.value , true);">'
for( var path in the_data ) { for( var path in the_data ) {
pr("\t"+path+" has:") pr("\t"+path+" has:")
...@@ -99,26 +108,36 @@ if(RES["OK"]) { ...@@ -99,26 +108,36 @@ if(RES["OK"]) {
var the_gexfs = the_data[path]["gexfs"] var the_gexfs = the_data[path]["gexfs"]
pr("\t\tThese are the available Gexfs:") pr("\t\tThese are the available Gexfs:")
for(var gexf in the_gexfs) { for(var gexf in the_gexfs) {
pr("\t\t\t"+gexf) pr("\t\t\t"+gexf+ " -> table:" +the_gexfs[gexf]["semantic"]["table"] )
pr("\t\t\t\t"+ the_gexfs[gexf]["semantic"]["table"] )
TW.field[path+"/"+gexf] = the_gexfs[gexf]["semantic"]["table"] TW.field[path+"/"+gexf] = the_gexfs[gexf]["semantic"]["table"]
TW.gexfDict[path+"/"+gexf] = "A "+gexf TW.gexfDict[path+"/"+gexf] = "A "+gexf
getUrlParam.file = path+"/"+gexf
break var selected = (the_file==(path+"/"+gexf))?"selected":""
files_selector += '<option '+selected+'>'+gexf+'</option>'
} }
console.log( files_selector )
break; break;
} }
files_selector += "</select>"
$("#network").html(files_selector)
pr("\n============================\n") pr("\n============================\n")
pr(TW.field) pr(TW.field)
pr(TW.gexfDict) pr(TW.gexfDict)
var sub_RES = AjaxSync({ URL: getUrlParam.file }); var sub_RES = AjaxSync({ URL: fileparam });
the_data = sub_RES["data"] the_data = sub_RES["data"]
fileparam = sub_RES["format"] fileparam = sub_RES["format"]
pr(the_data.length) pr(the_data.length)
pr(fileparam) pr(fileparam)
pr("\n============================\n") pr("\n============================\n")
}
}
if (file=="api.json") { if (file=="api.json") {
fileparam = file; fileparam = file;
......
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