Commit 3ce5f459 authored by delanoe's avatar delanoe

Merge branch 'romain-reintegration-graphExplorer' into anoe-graph

parents abf2b592 d053c10f
...@@ -29,7 +29,11 @@ ...@@ -29,7 +29,11 @@
$rootScope.projectId = path[1]; $rootScope.projectId = path[1];
$rootScope.corpusId = path[2]; $rootScope.corpusId = path[2];
$rootScope.docId = path[3]; $rootScope.docId = path[3];
$rootScope.focusNgram = path[4];
// ex: ["483", "3561", "9754", "35183"]
// (passed from graphExplorer selections)
$rootScope.focusNgrams = path[4].split(",");
// debug // debug
// console.log("==> $rootScope <==") // console.log("==> $rootScope <==")
......
...@@ -434,10 +434,10 @@ ...@@ -434,10 +434,10 @@
* @param $rootScope (global) to check activeLists and list names * @param $rootScope (global) to check activeLists and list names
* *
* add-on mechanism: * add-on mechanism:
* @param focusNgram: an ngram_id to higlight more * @param focusNgrams: some ngram_ids to higlight more
* (it is assumed to be already in one of the active lists) * (it is assumed to be already in one of the active lists)
*/ */
function compileNgramsHtml(annotations, textMapping, $rootScope, focusNgram) { function compileNgramsHtml(annotations, textMapping, $rootScope, focusNgrams) {
if (typeof $rootScope.activeLists == "undefined") return; if (typeof $rootScope.activeLists == "undefined") return;
if (_.keys($rootScope.activeLists).length === 0) return; if (_.keys($rootScope.activeLists).length === 0) return;
var templateBegin = "<span ng-controller='TextSelectionController' ng-click='onClick($event)' class='keyword-inline'>"; var templateBegin = "<span ng-controller='TextSelectionController' ng-click='onClick($event)' class='keyword-inline'>";
...@@ -540,8 +540,15 @@ ...@@ -540,8 +540,15 @@
// 2nd pass for result html // 2nd pass for result html
// ========================= // =========================
// first pass for anchors // a small lookup for possible focus items (they'll get different css)
// ====================== var checkFocusOn = {}
if (focusNgrams) {
for (var i in focusNgrams) {
var focusNgramId = focusNgrams[i]
checkFocusOn[focusNgramId] = true
}
}
angular.forEach(sortedSizeAnnotations, function (annotation) { angular.forEach(sortedSizeAnnotations, function (annotation) {
// again exclude ngrams that are into inactive lists // again exclude ngrams that are into inactive lists
if ($rootScope.activeLists[annotation.list_id] === undefined) return; if ($rootScope.activeLists[annotation.list_id] === undefined) return;
...@@ -549,8 +556,9 @@ ...@@ -549,8 +556,9 @@
// listName now used to setup css class // listName now used to setup css class
var cssClass = $rootScope.lists[annotation.list_id]; var cssClass = $rootScope.lists[annotation.list_id];
// except if FOCUS // except if uuid or group mainform is in FOCUS items
if (focusNgram && (annotation.uuid == focusNgram || annotation.group == focusNgram)) { if (focusNgrams &&
(checkFocusOn[annotation.uuid] || checkFocusOn[annotation.group])) {
cssClass = "FOCUS" cssClass = "FOCUS"
} }
...@@ -642,7 +650,7 @@ ...@@ -642,7 +650,7 @@
'#title': angular.copy($rootScope.title) '#title': angular.copy($rootScope.title)
}, },
$rootScope, $rootScope,
$rootScope.focusNgram // new: optional focus ngram $rootScope.focusNgrams // optional focus ngrams
); );
// inject highlighted HTML // inject highlighted HTML
angular.forEach(result, function(html, eltId) { angular.forEach(result, function(html, eltId) {
......
...@@ -612,9 +612,8 @@ function getTopPapers(type){ ...@@ -612,9 +612,8 @@ function getTopPapers(type){
} }
// ex url_mainIDs = {projects: 1, corpora: 2690} // ex url_mainIDs = {projects: 1, corpora: 2690}
// link to matching document // link to matching document (with focus=selections_ids param)
var getpubAPI = window.location.origin+'/projects/'+url_mainIDs["projects"]+'/corpora/'+ url_mainIDs["corpora"] + '/documents/'+pub["id"] var getpubAPI = window.location.origin+'/projects/'+url_mainIDs["projects"]+'/corpora/'+ url_mainIDs["corpora"] + '/documents/'+pub["id"]+'/focus='+theids.join(",")
var ifjournal="",ifauthors="",ifkeywords="",ifdate="",iftitle=""; var ifjournal="",ifauthors="",ifkeywords="",ifdate="",iftitle="";
...@@ -635,7 +634,7 @@ function getTopPapers(type){ ...@@ -635,7 +634,7 @@ function getTopPapers(type){
jsstuff += "wnws_buffer = window.open('"+getpubAPI+"', 'popUpWindow' , '"+jsparams+"')"; jsstuff += "wnws_buffer = window.open('"+getpubAPI+"', 'popUpWindow' , '"+jsparams+"')";
output += "<li><a onclick=\""+jsstuff+"\" target=_blank>"+pub["title"]+"</a>. "+ifauthors+". "+ifjournal+". "+ifkeywords+". "+ifdate+"\n"; output += "<li><a onclick=\""+jsstuff+"\" target=_blank>"+pub["title"]+"</a>. "+ifauthors+". "+ifjournal+". "+ifkeywords+". "+ifdate+"\n";
output += '<a href="'+gquery+'" target=_blank><img title="Query to Google" src="'+window.location.origin+'/static/img/google.png"></img></a>' output += '<a href="'+gquery+'" target=_blank><img title="Query the web" src="'+window.location.origin+'/static/img/searx.png"></img></a>'
output +="</li>\n"; output +="</li>\n";
// for(var j in pub) { // for(var j in pub) {
// if(j!="abstract") // if(j!="abstract")
......
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