Commit 6d6ac234 authored by Romain Loth's avatar Romain Loth

fix "delete node" in graphexplorer view

parent dea4d0e0
...@@ -19,12 +19,15 @@ def explorer(request, project_id, corpus_id): ...@@ -19,12 +19,15 @@ def explorer(request, project_id, corpus_id):
# we pass our corpus # we pass our corpus
corpus = cache.Node[corpus_id] corpus = cache.Node[corpus_id]
# get the maplist_id for modifications
maplist_id = corpus.children(typename="MAPLIST").first().id
# and the project just for project.id in corpusBannerTop # and the project just for project.id in corpusBannerTop
project = cache.Node[project_id] project = cache.Node[project_id]
graphurl = "projects/" + str(project_id) + "/corpora/" + str(corpus_id) + "/node_link.json" graphurl = "projects/" + str(project_id) + "/corpora/" + str(corpus_id) + "/node_link.json"
# rendered page : journals.html # rendered page : explorer.html
return render( return render(
template_name = 'graphExplorer/explorer.html', template_name = 'graphExplorer/explorer.html',
request = request, request = request,
...@@ -35,9 +38,8 @@ def explorer(request, project_id, corpus_id): ...@@ -35,9 +38,8 @@ def explorer(request, project_id, corpus_id):
'date' : datetime.now(), 'date' : datetime.now(),
'project' : project, 'project' : project,
'corpus' : corpus, 'corpus' : corpus,
#'list_id' : maplist.id,\ 'maplist_id': maplist_id,
'graphfile' : graphurl,\ 'graphfile' : graphurl,
'view' : 'graph' 'view' : 'graph'
}, },
) )
...@@ -15,7 +15,7 @@ function getIDFromURL( item ) { ...@@ -15,7 +15,7 @@ function getIDFromURL( item ) {
cid=parseInt(i); cid=parseInt(i);
break; break;
} }
} }
return pageurl[cid+1]; return pageurl[cid+1];
} }
...@@ -23,25 +23,20 @@ function modify_ngrams( classname ) { ...@@ -23,25 +23,20 @@ function modify_ngrams( classname ) {
console.clear() console.clear()
var corpus_id = getIDFromURL( "corpora" ) // not used var corpus_id = getIDFromURL( "corpora" ) // not used
var list_id = $("#list_id").val() var list_id = $("#maplist_id").val()
var selected_ngrams = $.extend({}, selections) var selected_ngrams = $.extend({}, selections)
console.log( selected_ngrams )
if(classname=="delete") { if(classname=="delete") {
CRUD( corpus_id , "/keep" , [] , selected_ngrams , "DELETE" , function(result) { CRUD(list_id, Object.keys(selected_ngrams), "DELETE", function(success) {
console.log(" Delete from Map-list: "+result) cancelSelection(false)
CRUD( list_id , "" , Object.keys(selected_ngrams).map(Number) , [] , "DELETE", function(result) { for(var i in selected_ngrams) {
console.log(" Add to Stop-list "+result) partialGraph.dropNode( i )
cancelSelection(false) delete Nodes[i]
for(var i in selected_ngrams) { delete partialGraph._core.graph.nodesIndex[i]
partialGraph.dropNode( i ) }
delete Nodes[i] partialGraph.refresh()
delete partialGraph._core.graph.nodesIndex[i] $("#lensButton").click()
} }) ;
partialGraph.refresh()
$("#lensButton").click()
});
});
} }
// if(classname=="group") { // if(classname=="group") {
...@@ -53,34 +48,44 @@ function modify_ngrams( classname ) { ...@@ -53,34 +48,44 @@ function modify_ngrams( classname ) {
// } // }
} }
function CRUD( parent_id , action , nodes , args , http_method , callback) { function CRUD( list_id , ngram_ids , http_method , callback) {
var the_url = window.location.origin+"/api/node/"+parent_id+"/ngrams"+action+"/"+nodes.join("+"); // ngramlists/change?node_id=42&ngram_ids=1,2
the_url = the_url.replace(/\/$/, ""); //remove trailing slash var the_url = window.location.origin+"/api/ngramlists/change?list="+list_id+"&ngrams="+ngram_ids.join(",");
console.log( the_url )
console.log( args ) // debug
if(nodes.length>0 || Object.keys(args).length>0) { // console.log("starting CRUD AJAX => URL: " + the_url + " (" + http_method + ")")
if(ngram_ids.length>0) {
$.ajax({ $.ajax({
method: http_method, method: http_method,
url: the_url, url: the_url,
data: args, // data: args, // currently all data explicitly in the url (like a GET)
beforeSend: function(xhr) { beforeSend: function(xhr) {
xhr.setRequestHeader("X-CSRFToken", getCookie("csrftoken")); xhr.setRequestHeader("X-CSRFToken", getCookie("csrftoken"));
}, },
success: function(data){ success: function(data){
console.log("-- CRUD ----------")
console.log(http_method + " ok!!") console.log(http_method + " ok!!")
console.log(nodes) console.log(JSON.stringify(data))
console.log(data) console.log("------------------")
callback("Success"); callback(true);
}, },
error: function(result) { error: function(result) {
console.log("-- CRUD ----------")
console.log("Data not found in #Save_All");
console.log(result) console.log(result)
callback("Fail"); console.log("------------------")
callback(false);
} }
}); });
} else callback(false); } else callback(false);
} }
// = = = = = = = = = = = [ Clusters Plugin ] = = = = = = = = = = = //
// = = = = = = = = = = = [ Clusters Plugin ] = = = = = = = = = = = //
// Execution: ChangeGraphAppearanceByAtt( true ) // Execution: ChangeGraphAppearanceByAtt( true )
// It scans the existing node-attributes and t keeps only those which are Numeric. // It scans the existing node-attributes and t keeps only those which are Numeric.
...@@ -92,7 +97,7 @@ function CRUD( parent_id , action , nodes , args , http_method , callback) { ...@@ -92,7 +97,7 @@ function CRUD( parent_id , action , nodes , args , http_method , callback) {
if(!colorByAtt) return; if(!colorByAtt) return;
// Seeing all the possible attributes! // Seeing all the possible attributes!
var AttsDict = {} var AttsDict = {}
var Atts_2_Exclude = {} var Atts_2_Exclude = {}
var v_nodes = getVisibleNodes(); var v_nodes = getVisibleNodes();
for (var i in v_nodes) { for (var i in v_nodes) {
...@@ -107,11 +112,11 @@ function CRUD( parent_id , action , nodes , args , http_method , callback) { ...@@ -107,11 +112,11 @@ function CRUD( parent_id , action , nodes , args , http_method , callback) {
if ( ( typeof(someatt)=="string" && isNaN(Number(someatt)) ) || typeof(someatt)=="object" ) { if ( ( typeof(someatt)=="string" && isNaN(Number(someatt)) ) || typeof(someatt)=="object" ) {
if (!Atts_2_Exclude[a]) Atts_2_Exclude[a]=0; if (!Atts_2_Exclude[a]) Atts_2_Exclude[a]=0;
Atts_2_Exclude[a]++; Atts_2_Exclude[a]++;
} }
} }
var possible_atts = []; var possible_atts = [];
if (!isUndef(Nodes[id].attributes)) if (!isUndef(Nodes[id].attributes))
possible_atts = Object.keys(Nodes[id].attributes) possible_atts = Object.keys(Nodes[id].attributes)
if(!isUndef(v_nodes[i].degree)) if(!isUndef(v_nodes[i].degree))
...@@ -119,15 +124,15 @@ function CRUD( parent_id , action , nodes , args , http_method , callback) { ...@@ -119,15 +124,15 @@ function CRUD( parent_id , action , nodes , args , http_method , callback) {
possible_atts.push("clust_louvain") possible_atts.push("clust_louvain")
for(var a in possible_atts){ for(var a in possible_atts){
if ( !AttsDict[ possible_atts[a] ] ) if ( !AttsDict[ possible_atts[a] ] )
AttsDict[ possible_atts[a] ] = 0 AttsDict[ possible_atts[a] ] = 0
AttsDict[ possible_atts[a] ] ++; AttsDict[ possible_atts[a] ] ++;
} }
} }
} }
for(var i in Atts_2_Exclude) for(var i in Atts_2_Exclude)
delete AttsDict[i]; delete AttsDict[i];
var AttsDict_sorted = ArraySortByValue(AttsDict, function(a,b){ var AttsDict_sorted = ArraySortByValue(AttsDict, function(a,b){
...@@ -137,9 +142,9 @@ function CRUD( parent_id , action , nodes , args , http_method , callback) { ...@@ -137,9 +142,9 @@ function CRUD( parent_id , action , nodes , args , http_method , callback) {
console.log( AttsDict_sorted ) console.log( AttsDict_sorted )
var div_info = ""; var div_info = "";
if( $( ".colorgraph_div" ).length>0 ) if( $( ".colorgraph_div" ).length>0 )
div_info += '<ul id="colorGraph" class="nav navbar-nav navbar-right">' div_info += '<ul id="colorGraph" class="nav navbar-nav navbar-right">'
div_info += ' <li class="dropdown">' div_info += ' <li class="dropdown">'
...@@ -174,9 +179,9 @@ function CRUD( parent_id , action , nodes , args , http_method , callback) { ...@@ -174,9 +179,9 @@ function CRUD( parent_id , action , nodes , args , http_method , callback) {
div_info = ""; div_info = "";
if( $( ".sizegraph_div" ).length>0 ) if( $( ".sizegraph_div" ).length>0 )
div_info += '<ul id="sizeGraph" class="nav navbar-nav navbar-right">' div_info += '<ul id="sizeGraph" class="nav navbar-nav navbar-right">'
div_info += ' <li class="dropdown">' div_info += ' <li class="dropdown">'
...@@ -210,7 +215,7 @@ function CRUD( parent_id , action , nodes , args , http_method , callback) { ...@@ -210,7 +215,7 @@ function CRUD( parent_id , action , nodes , args , http_method , callback) {
console.log('$( ".sizegraph_div" ).length') console.log('$( ".sizegraph_div" ).length')
console.log($( ".sizegraph_div" ).length) console.log($( ".sizegraph_div" ).length)
if( $( ".sizegraph_div" ).length>0 ) { if( $( ".sizegraph_div" ).length>0 ) {
div_info += '</ul>' div_info += '</ul>'
...@@ -242,7 +247,7 @@ function CRUD( parent_id , action , nodes , args , http_method , callback) { ...@@ -242,7 +247,7 @@ function CRUD( parent_id , action , nodes , args , http_method , callback) {
} }
edge_realdata.push(info) edge_realdata.push(info)
} }
var community = jLouvain().nodes(node_realdata).edges(edge_realdata); var community = jLouvain().nodes(node_realdata).edges(edge_realdata);
var results = community(); var results = community();
for(var i in results) for(var i in results)
Nodes[i].attributes["clust_louvain"]=results[i] Nodes[i].attributes["clust_louvain"]=results[i]
...@@ -257,7 +262,7 @@ function CRUD( parent_id , action , nodes , args , http_method , callback) { ...@@ -257,7 +262,7 @@ function CRUD( parent_id , action , nodes , args , http_method , callback) {
var Type=raw[0], Cluster=raw[1], clstID=Number(raw[2]); var Type=raw[0], Cluster=raw[1], clstID=Number(raw[2]);
var present = partialGraph.states.slice(-1)[0]; // Last var present = partialGraph.states.slice(-1)[0]; // Last
var type_t0 = present.type; var type_t0 = present.type;
var str_type_t0 = type_t0.map(Number).join("|") var str_type_t0 = type_t0.map(Number).join("|")
console.log( "\t"+str_type_t0) console.log( "\t"+str_type_t0)
...@@ -322,7 +327,7 @@ function CRUD( parent_id , action , nodes , args , http_method , callback) { ...@@ -322,7 +327,7 @@ function CRUD( parent_id , action , nodes , args , http_method , callback) {
}); });
for(var n in nodes_2_label) { for(var n in nodes_2_label) {
if(n==4) if(n==4)
break break
var ID = nodes_2_label[n].key var ID = nodes_2_label[n].key
partialGraph._core.graph.nodesIndex[ID].forceLabel = true; partialGraph._core.graph.nodesIndex[ID].forceLabel = true;
...@@ -388,13 +393,13 @@ function CRUD( parent_id , action , nodes , args , http_method , callback) { ...@@ -388,13 +393,13 @@ function CRUD( parent_id , action , nodes , args , http_method , callback) {
} }
LegendDiv += ' </ul>' LegendDiv += ' </ul>'
LegendDiv += ' </div>' LegendDiv += ' </div>'
$("#legend_for_clusters").addClass( "my-legend" ); $("#legend_for_clusters").addClass( "my-legend" );
$("#legend_for_clusters").html( LegendDiv ) $("#legend_for_clusters").html( LegendDiv )
} }
// = = = = = = = = = = = [ / Clusters Plugin ] = = = = = = = = = = = // // = = = = = = = = = = = [ / Clusters Plugin ] = = = = = = = = = = = //
// PHP-mode when you've a cortext db. // PHP-mode when you've a cortext db.
...@@ -417,11 +422,11 @@ function getTopPapers_OriginalVersion(type){ ...@@ -417,11 +422,11 @@ function getTopPapers_OriginalVersion(type){
data: "type="+type+"&bi="+bi+"&query="+jsonparams+"&gexf="+thisgexf+"&index="+field[getUrlParam.file], data: "type="+type+"&bi="+bi+"&query="+jsonparams+"&gexf="+thisgexf+"&index="+field[getUrlParam.file],
//contentType: "application/json", //contentType: "application/json",
//dataType: 'json', //dataType: 'json',
success : function(data){ success : function(data){
pr(APINAME+'info_div.php?'+"type="+type+"&bi="+bi+"&query="+jsonparams+"&gexf="+thisgexf+"&index="+field[getUrlParam.file]); pr(APINAME+'info_div.php?'+"type="+type+"&bi="+bi+"&query="+jsonparams+"&gexf="+thisgexf+"&index="+field[getUrlParam.file]);
$("#topPapers").html(data); $("#topPapers").html(data);
}, },
error: function(){ error: function(){
pr('Page Not found: getTopPapers'); pr('Page Not found: getTopPapers');
} }
}); });
...@@ -472,11 +477,11 @@ function getTopProposals(type , jsonparams , thisgexf) { ...@@ -472,11 +477,11 @@ function getTopProposals(type , jsonparams , thisgexf) {
data: "type="+"semantic"+"&query="+jsonparams+"&gexf="+thisgexf, data: "type="+"semantic"+"&query="+jsonparams+"&gexf="+thisgexf,
//contentType: "application/json", //contentType: "application/json",
//dataType: 'json', //dataType: 'json',
success : function(data){ success : function(data){
pr("API_pasteur/"+'info_div2.php?'+"type="+"semantic"+"&query="+jsonparams+"&gexf="+thisgexf); pr("API_pasteur/"+'info_div2.php?'+"type="+"semantic"+"&query="+jsonparams+"&gexf="+thisgexf);
$("#topProposals").html(data); $("#topProposals").html(data);
}, },
error: function(){ error: function(){
pr('Page Not found: getTopProposals'); pr('Page Not found: getTopProposals');
} }
}); });
...@@ -493,7 +498,7 @@ function genericGetTopPapers(theids , corpus_id , thediv) { ...@@ -493,7 +498,7 @@ function genericGetTopPapers(theids , corpus_id , thediv) {
url: window.location.origin+'/api/nodes/'+corpus_id+'/having?score=tfidf&ngram_ids='+theids.join(","), url: window.location.origin+'/api/nodes/'+corpus_id+'/having?score=tfidf&ngram_ids='+theids.join(","),
//contentType: "application/json", //contentType: "application/json",
//dataType: 'json', //dataType: 'json',
success : function(data){ success : function(data){
pr(window.location.origin+'/api/nodes/'+corpus_id+'/having?score=tfidf&ngram_ids='+theids.join(",") ) pr(window.location.origin+'/api/nodes/'+corpus_id+'/having?score=tfidf&ngram_ids='+theids.join(",") )
var arraydata = $.parseJSON(data) var arraydata = $.parseJSON(data)
var output = "<ul style='padding: 0px; margin: 13px;'>" var output = "<ul style='padding: 0px; margin: 13px;'>"
...@@ -515,7 +520,7 @@ function genericGetTopPapers(theids , corpus_id , thediv) { ...@@ -515,7 +520,7 @@ function genericGetTopPapers(theids , corpus_id , thediv) {
} }
if(pub["fields"]) ifkeywords = "<br>Fields: "+pub["fields"]; if(pub["fields"]) ifkeywords = "<br>Fields: "+pub["fields"];
if(pub["publication_date"]) ifdate = "<br>In "+pub["publication_date"].split(" ")[0]; if(pub["publication_date"]) ifdate = "<br>In "+pub["publication_date"].split(" ")[0];
var jsstuff = "if(wnws_buffer!=null) {wnws_buffer.close();} " var jsstuff = "if(wnws_buffer!=null) {wnws_buffer.close();} "
var jsparams = 'height=700,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,status=no' var jsparams = 'height=700,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,status=no'
jsstuff += "wnws_buffer = window.open('"+getpubAPI+"', 'popUpWindow' , '"+jsparams+"')"; jsstuff += "wnws_buffer = window.open('"+getpubAPI+"', 'popUpWindow' , '"+jsparams+"')";
...@@ -535,9 +540,9 @@ function genericGetTopPapers(theids , corpus_id , thediv) { ...@@ -535,9 +540,9 @@ function genericGetTopPapers(theids , corpus_id , thediv) {
// $('#tab-container-top').easytabs({updateHash:false}); // $('#tab-container-top').easytabs({updateHash:false});
}, },
error: function(){ error: function(){
pr('Page Not found: getTopPapers()'); pr('Page Not found: getTopPapers()');
} }
}); });
...@@ -558,7 +563,7 @@ function getTopPapers(type){ ...@@ -558,7 +563,7 @@ function getTopPapers(type){
cid=parseInt(i); cid=parseInt(i);
break; break;
} }
} }
var corpus_id = pageurl[cid+1]; var corpus_id = pageurl[cid+1];
pr("corpus_id: "+ corpus_id); pr("corpus_id: "+ corpus_id);
...@@ -569,7 +574,7 @@ function getTopPapers(type){ ...@@ -569,7 +574,7 @@ function getTopPapers(type){
theids.push(parseInt(Nodes[i].id)) theids.push(parseInt(Nodes[i].id))
} }
} }
pr("the IDs of the selectioons") pr("the IDs of the selectioons")
pr(theids) pr(theids)
$.ajax({ $.ajax({
...@@ -577,7 +582,7 @@ function getTopPapers(type){ ...@@ -577,7 +582,7 @@ function getTopPapers(type){
url: window.location.origin+'/api/nodes/'+corpus_id+'/having?score=tfidf&ngram_ids='+theids.join(","), url: window.location.origin+'/api/nodes/'+corpus_id+'/having?score=tfidf&ngram_ids='+theids.join(","),
//contentType: "application/json", //contentType: "application/json",
//dataType: 'json', //dataType: 'json',
success : function(data){ success : function(data){
// pr(window.location.origin+'/api/tfidf/'+corpus_id+'/'+theids.join("a") ) // pr(window.location.origin+'/api/tfidf/'+corpus_id+'/'+theids.join("a") )
// var arraydata = $.parseJSON(data) // var arraydata = $.parseJSON(data)
var output = "<ul style='padding: 0px; margin: 13px;'>" var output = "<ul style='padding: 0px; margin: 13px;'>"
...@@ -594,7 +599,7 @@ function getTopPapers(type){ ...@@ -594,7 +599,7 @@ function getTopPapers(type){
} }
} }
var getpubAPI = window.location.origin+'/project/'+url_mainIDs["project"]+'/corpus/'+ url_mainIDs["corpus"] + '/document/'+pub["id"] var getpubAPI = window.location.origin+'/project/'+url_mainIDs["project"]+'/corpus/'+ url_mainIDs["corpus"] + '/document/'+pub["id"]
var ifjournal="",ifauthors="",ifkeywords="",ifdate="",iftitle=""; var ifjournal="",ifauthors="",ifkeywords="",ifdate="",iftitle="";
...@@ -609,7 +614,7 @@ function getTopPapers(type){ ...@@ -609,7 +614,7 @@ function getTopPapers(type){
} }
if(pub["fields"]) ifkeywords = "<br>Fields: "+pub["fields"]; if(pub["fields"]) ifkeywords = "<br>Fields: "+pub["fields"];
if(pub["publication_date"]) ifdate = "<br>In "+pub["publication_date"].split(" ")[0]; if(pub["publication_date"]) ifdate = "<br>In "+pub["publication_date"].split(" ")[0];
var jsstuff = "if(wnws_buffer!=null) {wnws_buffer.close();} " var jsstuff = "if(wnws_buffer!=null) {wnws_buffer.close();} "
var jsparams = 'height=700,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,status=no' var jsparams = 'height=700,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,status=no'
jsstuff += "wnws_buffer = window.open('"+getpubAPI+"', 'popUpWindow' , '"+jsparams+"')"; jsstuff += "wnws_buffer = window.open('"+getpubAPI+"', 'popUpWindow' , '"+jsparams+"')";
...@@ -629,7 +634,7 @@ function getTopPapers(type){ ...@@ -629,7 +634,7 @@ function getTopPapers(type){
// $('#tab-container-top').easytabs({updateHash:false}); // $('#tab-container-top').easytabs({updateHash:false});
$("#topPapers").html(output); $("#topPapers").html(output);
}, },
error: function(){ error: function(){
pr('Page Not found: getTopPapers()'); pr('Page Not found: getTopPapers()');
} }
}); });
...@@ -667,7 +672,7 @@ function printCorpuses() { ...@@ -667,7 +672,7 @@ function printCorpuses() {
var selected = $('input[name=optradio]:checked')[0].id.split("_") var selected = $('input[name=optradio]:checked')[0].id.split("_")
var sel_p = selected[0], sel_c=selected[1] var sel_p = selected[0], sel_c=selected[1]
var pageurl = window.location.href.split("/") var pageurl = window.location.href.split("/")
var cid; var cid;
for(var i in pageurl) { for(var i in pageurl) {
...@@ -675,7 +680,7 @@ function printCorpuses() { ...@@ -675,7 +680,7 @@ function printCorpuses() {
cid=parseInt(i); cid=parseInt(i);
break; break;
} }
} }
var current_corpus = pageurl[cid+1]; var current_corpus = pageurl[cid+1];
pr("corpus id, selected: "+corpusesList[sel_p]["corpuses"][sel_c]["id"]) pr("corpus id, selected: "+corpusesList[sel_p]["corpuses"][sel_c]["id"])
...@@ -701,7 +706,7 @@ function printCorpuses() { ...@@ -701,7 +706,7 @@ function printCorpuses() {
}, },
success : function(data){ success : function(data){
console.log( "!!!!!!!! in printCorpuses() AJAX!!!!!!!! " ) console.log( "!!!!!!!! in printCorpuses() AJAX!!!!!!!! " )
for(var i in Nodes) { for(var i in Nodes) {
if(data[i]) if(data[i])
Nodes[i].attributes["inter"] = data[i] Nodes[i].attributes["inter"] = data[i]
...@@ -715,7 +720,7 @@ function printCorpuses() { ...@@ -715,7 +720,7 @@ function printCorpuses() {
clustersBy("inter" , "color") clustersBy("inter" , "color")
clustersBy("inter" , "size") clustersBy("inter" , "size")
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")"); var err = eval("(" + xhr.responseText + ")");
...@@ -732,7 +737,7 @@ function printCorpuses() { ...@@ -732,7 +737,7 @@ function printCorpuses() {
// var c = corpusesList[i]["id"] // var c = corpusesList[i]["id"]
// string += "\t"+"<li id='tab_"+text+"' class='tab'><a href='#tabs"+c+"'>"+text+" Pubs</a></li>"+"\n"; // string += "\t"+"<li id='tab_"+text+"' class='tab'><a href='#tabs"+c+"'>"+text+" Pubs</a></li>"+"\n";
// } // }
// string += "</ul>"+"\n"; // string += "</ul>"+"\n";
// string += "<div class='panel-container'>"+"\n"; // string += "<div class='panel-container'>"+"\n";
// string += "\t"+'<div id="tabs3">'+"\n"; // string += "\t"+'<div id="tabs3">'+"\n";
...@@ -763,7 +768,7 @@ function printCorpuses() { ...@@ -763,7 +768,7 @@ function printCorpuses() {
// cid=parseInt(i); // cid=parseInt(i);
// break; // break;
// } // }
// } // }
// var corpus_id = pageurl[cid+1]; // var corpus_id = pageurl[cid+1];
// theids.push( corpus_id ) // theids.push( corpus_id )
...@@ -790,7 +795,7 @@ function GetUserPortfolio() { ...@@ -790,7 +795,7 @@ function GetUserPortfolio() {
pid=parseInt(i); pid=parseInt(i);
break; break;
} }
} }
var project_id = pageurl[pid+1]; var project_id = pageurl[pid+1];
var cid; var cid;
...@@ -799,7 +804,7 @@ function GetUserPortfolio() { ...@@ -799,7 +804,7 @@ function GetUserPortfolio() {
cid=parseInt(i); cid=parseInt(i);
break; break;
} }
} }
var corpus_id = pageurl[cid+1]; var corpus_id = pageurl[cid+1];
if( Object.keys( corpusesList ).length > 0 ) if( Object.keys( corpusesList ).length > 0 )
...@@ -810,7 +815,7 @@ function GetUserPortfolio() { ...@@ -810,7 +815,7 @@ function GetUserPortfolio() {
type: 'GET', type: 'GET',
url: query_url, url: query_url,
success : function(data) { success : function(data) {
var html_ = "" var html_ = ""
html_ += '<div class="panel-group" id="accordion">'+"\n" html_ += '<div class="panel-group" id="accordion">'+"\n"
html_ += ' <form id="corpuses_form" role="form">'+"\n" html_ += ' <form id="corpuses_form" role="form">'+"\n"
...@@ -858,7 +863,7 @@ function GetUserPortfolio() { ...@@ -858,7 +863,7 @@ function GetUserPortfolio() {
}, },
error: function(){ error: function(){
pr('Page Not found: TestFunction()'); pr('Page Not found: TestFunction()');
} }
}); });
...@@ -866,60 +871,60 @@ function GetUserPortfolio() { ...@@ -866,60 +871,60 @@ function GetUserPortfolio() {
function camaraButton(){ function camaraButton(){
$("#PhotoGraph").click(function (){ $("#PhotoGraph").click(function (){
//canvas=partialGraph._core.domElements.nodes; //canvas=partialGraph._core.domElements.nodes;
var nodesCtx = partialGraph._core.domElements.nodes; var nodesCtx = partialGraph._core.domElements.nodes;
/* /*
var edgesCtx = document.getElementById("sigma_edges_1").getContext('2d'); var edgesCtx = document.getElementById("sigma_edges_1").getContext('2d');
var edgesImg = edgesCtx.getImageData(0, 0, document.getElementById("sigma_edges_1").width, document.getElementById("sigma_edges_1").height) var edgesImg = edgesCtx.getImageData(0, 0, document.getElementById("sigma_edges_1").width, document.getElementById("sigma_edges_1").height)
nodesCtx.putImageData(edgesImg,0,0); nodesCtx.putImageData(edgesImg,0,0);
//ctx.drawImage(partialGraph._core.domElements.edges,0,0) //ctx.drawImage(partialGraph._core.domElements.edges,0,0)
//var oCanvas = ctx; //var oCanvas = ctx;
*/ */
//div = document.getElementById("sigma_nodes_1").getContext('2d'); //div = document.getElementById("sigma_nodes_1").getContext('2d');
//ctx = div.getContext("2d"); //ctx = div.getContext("2d");
//oCanvas.drawImage(partialGraph._core.domElements.edges,0,0); //oCanvas.drawImage(partialGraph._core.domElements.edges,0,0);
Canvas2Image.saveAsPNG(nodesCtx); Canvas2Image.saveAsPNG(nodesCtx);
/* /*
Canvas2Image.saveAsJPEG(oCanvas); // will prompt the user to save the image as JPEG. Canvas2Image.saveAsJPEG(oCanvas); // will prompt the user to save the image as JPEG.
// Only supported by Firefox. // Only supported by Firefox.
Canvas2Image.saveAsBMP(oCanvas); // will prompt the user to save the image as BMP. Canvas2Image.saveAsBMP(oCanvas); // will prompt the user to save the image as BMP.
// returns an <img> element containing the converted PNG image // returns an <img> element containing the converted PNG image
var oImgPNG = Canvas2Image.saveAsPNG(oCanvas, true); var oImgPNG = Canvas2Image.saveAsPNG(oCanvas, true);
// returns an <img> element containing the converted JPEG image (Only supported by Firefox) // returns an <img> element containing the converted JPEG image (Only supported by Firefox)
var oImgJPEG = Canvas2Image.saveAsJPEG(oCanvas, true); var oImgJPEG = Canvas2Image.saveAsJPEG(oCanvas, true);
// returns an <img> element containing the converted BMP image // returns an <img> element containing the converted BMP image
var oImgBMP = Canvas2Image.saveAsBMP(oCanvas, true); var oImgBMP = Canvas2Image.saveAsBMP(oCanvas, true);
// all the functions also takes width and height arguments. // all the functions also takes width and height arguments.
// These can be used to scale the resulting image: // These can be used to scale the resulting image:
// saves a PNG image scaled to 100x100 // saves a PNG image scaled to 100x100
Canvas2Image.saveAsPNG(oCanvas, false, 100, 100); Canvas2Image.saveAsPNG(oCanvas, false, 100, 100);
*/ */
}); });
} }
function getTips(){ function getTips(){
param=''; param='';
text = text =
"<br>"+ "<br>"+
"Basic Interactions:"+ "Basic Interactions:"+
"<ul>"+ "<ul>"+
...@@ -939,7 +944,7 @@ function getTips(){ ...@@ -939,7 +944,7 @@ function getTips(){
"<li>To explore the neighborhood of a selection, either double click on the selected nodes, either click on the macro/meso level button. Zoom out in meso view return to macro view.</li>"+ "<li>To explore the neighborhood of a selection, either double click on the selected nodes, either click on the macro/meso level button. Zoom out in meso view return to macro view.</li>"+
"<li>Click on the 'all nodes' tab below to view the full clickable list of nodes.</li>"+ "<li>Click on the 'all nodes' tab below to view the full clickable list of nodes.</li>"+
"</ul>"; "</ul>";
$("#tab-container").hide(); $("#tab-container").hide();
$("#tab-container-top").hide(); $("#tab-container-top").hide();
return text; return text;
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
} }
#ctlzoom { #ctlzoom {
width:7%; width:7%;
} }
#topPapers{ #topPapers{
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#category0 ul li { margin: 0 12px 12px 0; } #category0 ul li { margin: 0 12px 12px 0; }
#category1 ul li { margin: 0 12px 12px 0; } #category1 ul li { margin: 0 12px 12px 0; }
</style> </style>
<!-- <!--
<link rel="stylesheet" href="{% static "js/libs/bootswatch/css/bootswatch.css" %}"> <link rel="stylesheet" href="{% static "js/libs/bootswatch/css/bootswatch.css" %}">
<link rel="stylesheet" href="{% static "js/libs/css2/font.css" %}" type="text/css"> <link rel="stylesheet" href="{% static "js/libs/css2/font.css" %}" type="text/css">
--> -->
...@@ -101,10 +101,10 @@ ...@@ -101,10 +101,10 @@
<div class="navbar-collapse collapse navbar-responsive-collapse"> <div class="navbar-collapse collapse navbar-responsive-collapse">
<div id="left" style="margin:0em 2em;"> <div id="left" style="margin:0em 2em;">
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<!-- <!--
<li> <li>
<a> <a>
<select id="aselector" onchange="console.log('salut monde')" class="selectpicker" data-style="btn btn-success btn-sm" data-width="auto"> <select id="aselector" onchange="console.log('salut monde')" class="selectpicker" data-style="btn btn-success btn-sm" data-width="auto">
<option value="Document" selected>Scholars</option> <option value="Document" selected>Scholars</option>
<option value="NGram">Keywords</option> <option value="NGram">Keywords</option>
...@@ -136,7 +136,7 @@ ...@@ -136,7 +136,7 @@
<li> <li>
<a> <a>
<div id="graphid" style="visibility: hidden;">{{graphfile}}</div> <div id="graphid" style="visibility: hidden;">{{graphfile}}</div>
<input type="hidden" id="list_id" value="{{ list_id }}"></input> <input type="hidden" id="maplist_id" value="{{ maplist_id }}"></input>
<div id="jquerytemplatenb" style="visibility: hidden;">{{user.id}}</div> <div id="jquerytemplatenb" style="visibility: hidden;">{{user.id}}</div>
</a> </a>
</li> </li>
...@@ -148,10 +148,10 @@ ...@@ -148,10 +148,10 @@
</a> </a>
</li> </li>
--> -->
</ul> </ul>
<ul id="category0" class="nav navbar-nav navbar-right"> <ul id="category0" class="nav navbar-nav navbar-right">
<li> <li>
...@@ -192,7 +192,7 @@ ...@@ -192,7 +192,7 @@
<input id="searchinput" autocomplete="off" class="form-control input-sm col-lg-8" placeholder="Search" type="text"> <input id="searchinput" autocomplete="off" class="form-control input-sm col-lg-8" placeholder="Search" type="text">
</a></li> </a></li>
</ul> </ul>
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<li> <li>
<a> <a>
...@@ -226,7 +226,7 @@ ...@@ -226,7 +226,7 @@
</li> </li>
</ul> </ul>
--> -->
</div><!-- /.nav-collapse --> </div><!-- /.nav-collapse -->
</div><!-- /.navbar --> </div><!-- /.navbar -->
...@@ -235,7 +235,7 @@ ...@@ -235,7 +235,7 @@
<div id="zonecentre"> <div id="zonecentre">
<!-- Page content --> <!-- Page content -->
<div id="sigma-example"></div> <div id="sigma-example"></div>
...@@ -255,7 +255,7 @@ ...@@ -255,7 +255,7 @@
<img title="World Map Distribution" width="34px" src="{% static "js/libs/img2/world.png" %}" ></img> <img title="World Map Distribution" width="34px" src="{% static "js/libs/img2/world.png" %}" ></img>
</a> </a>
</li> </li>
--> -->
<li> <li>
...@@ -263,13 +263,13 @@ ...@@ -263,13 +263,13 @@
<img title="Take a photo!" width="34px" src="{% static "js/libs/img2/camera.png" %}" ></img> <img title="Take a photo!" width="34px" src="{% static "js/libs/img2/camera.png" %}" ></img>
</a> </a>
</li> </li>
<li> <li>
<a href="#" id="saveAs"> <a href="#" id="saveAs">
<img width="30px" title="Save As..." src="{% static "js/libs/img2/save.png" %}" ></img> <img width="30px" title="Save As..." src="{% static "js/libs/img2/save.png" %}" ></img>
</a> </a>
</li> </li>
<li> <li>
<a href="#" id="zoomPlusButton" title="S'approcher"> </a> <a href="#" id="zoomPlusButton" title="S'approcher"> </a>
</li> </li>
...@@ -294,12 +294,12 @@ ...@@ -294,12 +294,12 @@
</div> </div>
<!-- Sidebar --> <!-- Sidebar -->
<div id="leftcolumn"> <div id="leftcolumn">
<div id="tips"></div> <div id="tips"></div>
<div id="names"></div> <div id="names"></div>
<div id="ngrams_actions"></div> <div id="ngrams_actions"></div>
<br> <br>
<div id="tab-container" class='tab-container' style="display: none;"> <div id="tab-container" class='tab-container' style="display: none;">
...@@ -320,7 +320,7 @@ ...@@ -320,7 +320,7 @@
</div> </div>
<!-- <div id="topPapers"></div> --> <!-- <div id="topPapers"></div> -->
<div id="tab-container-top" class='tab-container' style="display: none;"> <div id="tab-container-top" class='tab-container' style="display: none;">
<ul class='etabs'> <ul class='etabs'>
...@@ -337,7 +337,7 @@ ...@@ -337,7 +337,7 @@
</div> </div>
</div> </div>
</div> </div>
...@@ -407,7 +407,7 @@ ...@@ -407,7 +407,7 @@
</div> </div>
</div> </div>
</div> </div>
...@@ -440,7 +440,7 @@ ...@@ -440,7 +440,7 @@
</div> </div>
</div> </div>
</div> </div>
<div id="modalloader" class="modal fade"> <div id="modalloader" class="modal fade">
...@@ -457,15 +457,15 @@ ...@@ -457,15 +457,15 @@
<script src="{% static "js/libs/jquery/jquery.ba-dotimeout.min.js" %}" type="text/javascript"></script> <script src="{% static "js/libs/jquery/jquery.ba-dotimeout.min.js" %}" type="text/javascript"></script>
<script src="{% static "js/libs/jquery/jquery.mousewheel.min.js" %}" type="text/javascript"></script> <script src="{% static "js/libs/jquery/jquery.mousewheel.min.js" %}" type="text/javascript"></script>
<script type="text/javascript" src="{% static "js/libs/freshslider.1.0.js" %}"></script> <script type="text/javascript" src="{% static "js/libs/freshslider.1.0.js" %}"></script>
<script type="text/javascript" src="{% static "js/libs/readmore.js" %}"></script> <script type="text/javascript" src="{% static "js/libs/readmore.js" %}"></script>
<script type="text/javascript" src="{% static "js/libs/jquery/jquery.easytabs.min.js" %}"></script> <script type="text/javascript" src="{% static "js/libs/jquery/jquery.easytabs.min.js" %}"></script>
<script src="{% static "js/libs/bootstrap/js/bootstrap.min.js" %}"></script> <script src="{% static "js/libs/bootstrap/js/bootstrap.min.js" %}"></script>
<script src="{% static "js/libs/bootstrap/js/bootstrap-modal.js" %}" type="text/javascript"></script> <script src="{% static "js/libs/bootstrap/js/bootstrap-modal.js" %}" type="text/javascript"></script>
<script src="{% static "js/libs/bootstrap/js/bootstrap-hover-dropdown.min.js" %}" type="text/javascript"></script> <script src="{% static "js/libs/bootstrap/js/bootstrap-hover-dropdown.min.js" %}" type="text/javascript"></script>
<script src="{% static "js/tinawebJS/globalUtils.js" %}" type="text/javascript"></script> <script src="{% static "js/tinawebJS/globalUtils.js" %}" type="text/javascript"></script>
<script src="{% static "js/tinawebJS/plugins/jLouvain.js" %}" type="text/javascript"></script> <script src="{% static "js/tinawebJS/plugins/jLouvain.js" %}" type="text/javascript"></script>
......
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