Commit f86c46a3 authored by Romain Loth's avatar Romain Loth

add comex support + related fixes

parent ed677841
......@@ -76,12 +76,9 @@
<div class="navbar-collapse collapse" id="navbar-main">
<ul class="nav navbar-nav navbar-left">
<li class="navbar-middle">
<img style="width:20px" src="libs/img2/home.png">
</li>
<li style="margin-left:10px;">
<a href="#" class="navbar-middle navbar-brand">
<!-- will be replaced by TW.conf.branding -->
<!-- name will be replaced by TW.conf.branding, link by TW.conf.brandingLink -->
<a href="#" class="navbar-middle navbar-brand twbrand-link">
<span id="twbrand">TinaWebJS</span>
</a>
</li>
......@@ -157,10 +154,10 @@
</li>
-->
<li><a href="http://www.politoscope.org"
<li><a href="https://communityexplorer.org"
class="navbar-higher"
title="Politoscope">
<img src="libs/img2/logo.png"
title="Community Explorer">
<img src="static/explorerlibs/img2/logo.png"
style="width:60px; position:absolute; top:-60px; left:-75px; z-index:5; overflow:visible;">
</a></li>
......@@ -356,28 +353,30 @@
<li>
<a href="#" id="lensButton" class="zoombarbuttons"
title="Center View">
<img src="libs/img2/target.png" style="width:32px">
<img src="libs/img2/target.png">
</a>
</li>
<li>
<a href="#" id="layoutButton" class="zoombarbuttons"
title="Force Atlas Layout">
<img src="libs/img2/edges.png" style="width:32px">
<img src="libs/img2/edges.png">
</a>
</li>
<li>
<a href="#" id="noverlapButton" class="zoombarbuttons"
title="Disperse Overlapping Nodes">
<img src="libs/img2/disperse.png" style="width:32px">
<img src="libs/img2/disperse.png">
</a>
</li>
<li>
<a href="#facet-options" id="facets" class="zoombarbuttons" data-toggle="modal" data-target="#facet-options">
<img style="width:32px" title="Facets coloring options" src="libs/img2/facet_options.png"></img>
<a href="#facet-options" id="facets" class="zoombarbuttons"
title="Facets coloring options"
data-toggle="modal" data-target="#facet-options">
<img src="libs/img2/facet_options.png"></img>
</a>
</li>
......@@ -755,13 +754,6 @@
<script src="tinawebJS/sigma_v1.2/plugins/sigma.renderers.snapshot/sigma.renderers.snapshot.js"></script>
<script src="tinawebJS/sigma_v1.2/plugins/sigma.plugins.dragNodes/sigma.plugins.dragNodes.js"></script>
<!-- Tested as replacement for parseCustom -->
<!-- <script src="tinawebJS/sigma_v1.2/plugins/sigma.parsers.gexf/gexf-parser.js"></script> -->
<!-- <script src="tinawebJS/sigma_v1.2/plugins/sigma.parsers.gexf/sigma.parsers.gexf.js"></script> -->
<!-- testing sigma 1.5 imports from linkurious src -->
<!-- <script src="tinawebJS/sigma_v1.5/sigma.js" type="text/javascript" language="javascript"></script>
<script src="tinawebJS/sigma_v1.5/plugins.js" type="text/javascript" language="javascript"></script> -->
<!-- new sigma (1.0c => 1.2) compatibility imports -->
<script src="tinawebJS/sigma_tools.js"></script>
......
......@@ -220,6 +220,7 @@ function graphResetLabelsAndSizes(){
n.size = TW.Nodes[n.id].size
}
}
set_ClustersLegend()
}
// @daclass: the name of a numeric/categorical attribute from node.attributes
......@@ -279,7 +280,7 @@ function set_ClustersLegend ( daclass, groupedByTicks ) {
}
// we add a title to cluster classes by ranking their nodes and taking k best labels
if (TW.conf.facetOptions[daclass] && TW.conf.facetOptions[daclass].col == 'cluster') {
if (TW.conf.facetOptions[daclass] && TW.conf.facetOptions[daclass].col == 'cluster' && getActivetypesKey() != "0|1" ) {
// let t0 = performance.now()
......
......@@ -7,6 +7,7 @@ TW.conf = (function(TW){
let TWConf = {}
TWConf.branding = 'ProjectExplorer' // <--- the name displayed in upper left
TWConf.brandingLink = 'https://github.com/moma/ProjectExplorer' // <--- link to "home"
// ==========================
......@@ -164,7 +165,7 @@ TW.conf = (function(TW){
// flag name is div class to be removed if false
// *and* subdirectory of modules path to import if true
// see also activateModules()
TWConf.ModulesFlags["histogramModule"] = true ;
TWConf.ModulesFlags["histogramModule"] = false ;
TWConf.ModulesFlags["histogramDailyVariantModule"] = false ;
// TODO more generic module integrating the variants cf. experiments/histogramModule_STUB_GENERIQUE
TWConf.ModulesFlags["crowdsourcingModule"] = true ;
......
......@@ -179,9 +179,15 @@ function SelectionEngine() {
// Dictionaries of: selection+neighbors for the new state and updateRelatedNodesPanel
let selections = {}
// detailed relations sorted by types and srcid (for state cache, deselects etc)
let activeRelations = {}
activeRelations[activetypesKey] = {}
// cumulated neighbor weights no matter what srcid (for tagCloud etc)
let sameSideNeighbors = {}
let oppoSideNeighbors = {}
// targeted arg 'nodes' can be nid array or single nid
var ndsids=[]
if(args.nodes) {
......@@ -194,12 +200,8 @@ function SelectionEngine() {
if(TW.Relations[activetypesKey] && TW.Relations[activetypesKey][srcnid] ) {
var neighs = TW.Relations[activetypesKey][srcnid]
// for state cache
activeRelations[activetypesKey][srcnid] = {}
// shortcut
let sameSideNeighbors = activeRelations[activetypesKey][srcnid]
if(neighs) {
for(var j in neighs) {
var tgtnid = neighs[j]
......@@ -224,14 +226,21 @@ function SelectionEngine() {
sameSideNeighbors[tgtnid]=0
}
// and the detailed info
if (typeof activeRelations[activetypesKey][srcnid][tgtnid] == 'undefined') {
activeRelations[activetypesKey][srcnid][tgtnid]=0
}
// **make the edge active**
if (e1 && !e1.hidden) {
e1.customAttrs.activeEdge = 1;
sameSideNeighbors[tgtnid] += e1.weight || 1
activeRelations[activetypesKey][srcnid][tgtnid] += e1.weight || 1
}
if (e2 && !e2.hidden) {
e2.customAttrs.activeEdge = 1;
sameSideNeighbors[tgtnid] += e2.weight || 1
activeRelations[activetypesKey][srcnid][tgtnid] += e2.weight || 1
}
// we add as neighbor to color it (except if already in targeted)
......@@ -265,15 +274,20 @@ function SelectionEngine() {
var bipaNeighs = TW.Relations["1|1"][srcnid];
activeRelations["1|1"][srcnid] = {}
// shortcut
let oppositeSideNeighbors = activeRelations["1|1"][srcnid]
for(var k in bipaNeighs) {
if (typeof oppositeSideNeighbors[bipaNeighs[k]] == "undefined")
oppositeSideNeighbors[bipaNeighs[k]] = 0;
if (typeof activeRelations["1|1"][srcnid][bipaNeighs[k]] == "undefined") {
activeRelations["1|1"][srcnid][bipaNeighs[k]] = 0;
}
if (typeof oppoSideNeighbors[bipaNeighs[k]] == "undefined") {
oppoSideNeighbors[bipaNeighs[k]] = 0 ;
}
// £TODO weighted increment
oppositeSideNeighbors[bipaNeighs[k]]++;
// cumulated for all srcnids
oppoSideNeighbors[bipaNeighs[k]]++
// and the details
activeRelations["1|1"][srcnid][bipaNeighs[k]]++;
}
}
}
......@@ -284,12 +298,12 @@ function SelectionEngine() {
let same = []
if (activeRelations["1|1"]) {
oppos = ArraySortByValue(activeRelations["1|1"][srcnid], function(a,b){
oppos = ArraySortByValue(oppoSideNeighbors, function(a,b){
return b-a
});
}
same = ArraySortByValue(activeRelations[activetypesKey][srcnid], function(a,b){
same = ArraySortByValue(sameSideNeighbors, function(a,b){
return b-a
});
......@@ -316,6 +330,7 @@ function SelectionEngine() {
TW.partialGraph.render();
updateRelatedNodesPanel( theSelection , same, oppos )
if (TW.conf.debug.logSelections) {
......@@ -661,7 +676,7 @@ var TinaWebJS = function ( sigmacanvas ) {
}
});
if (TW.conf.getRelatedDocs) {
if (TW.conf.getRelatedDocs && document.getElementById('reldocs-type')) {
document.getElementById('reldocs-type').value = TW.conf.relatedDocsType
}
......
......@@ -380,6 +380,8 @@ function changeType() {
let newselsArr = Object.keys(newsels)
TW.gui.handpickedcolor = false
TW.pushState({
activetypes: t1Activetypes,
sels: newselsArr,
......@@ -425,6 +427,8 @@ function changeLevel() {
var sels = present.selectionNids ;//[144, 384, 543]//TW.states[last].selectionNids;
deselectNodes()
let selsChecker = {}
for (let i in sels) {
selsChecker[sels[i]] = true
......@@ -443,35 +447,38 @@ function changeLevel() {
var voisinage = {}
// Dictionaries of: selection+neighbors
var nodes_2_colour = {}
var edges_2_colour = {}
var nodesToAdd = {}
var edgesToAdd = {}
// £TODO: factorize with same strategy in MultipleSelection2 beginning
for(var i in sels) {
s = sels[i];
neigh = TW.Relations[activetypesKey][s]
if(neigh) {
for(var j in neigh) {
t = neigh[j]
nodes_2_colour[t]=false;
edges_2_colour[s+";"+t]=true;
edges_2_colour[t+";"+s]=true;
if( !selsChecker[t] )
voisinage[ t ] = true;
}
nodesToAdd[s]=true;
if (TW.Relations[activetypesKey]) {
neigh = TW.Relations[activetypesKey][s]
if(neigh) {
for(var j in neigh) {
t = neigh[j]
nodesToAdd[t]=true;
edgesToAdd[s+";"+t]=true;
edgesToAdd[t+";"+s]=true;
if( !selsChecker[t] )
voisinage[ t ] = true;
}
}
}
else {
// case where no edges at all (ex: scholars have no common keywords)
console.log("no edges between these nodes")
}
}
for(var i in sels)
nodes_2_colour[sels[i]]=true;
var futurelevel = null
if(present.level) { // [Change to Local] when level=Global(1)
for(var nid in nodes_2_colour)
add1Elem(nid)
for(var eid in edges_2_colour)
add1Elem(eid)
for(var nid in nodesToAdd)
add1Elem(nid)
for(var eid in edgesToAdd)
add1Elem(eid)
// Adding intra-neighbors edges O(voisinage²)
voisinage = Object.keys(voisinage)
......@@ -481,7 +488,6 @@ function changeLevel() {
// console.log( "\t" + voisinage[i] + " vs " + voisinage[j] )
add1Elem( voisinage[i]+";"+voisinage[j] )
}
}
}
......@@ -509,11 +515,7 @@ function changeLevel() {
// Nodes Selection now:
if(sels.length>0) {
TW.instance.selNgn.MultipleSelection2({
nodes:sels,
// nodesDict:nodes_2_colour,
// edgesDict:edges_2_colour
});
TW.instance.selNgn.MultipleSelection2({nodes:sels});
TW.gui.selectionActive=true;
}
}
......@@ -954,7 +956,7 @@ function updateSearchLabels(id,name,type){
function createWaitIcon(idname, width) {
let icon = document.createElement('img')
icon.src = TW.conf.libspath + '/img2/loader.gif'
icon.src = 'libs/img2/loader.gif'
icon.style.position = 'absolute'
icon.style.left = '0'
......
......@@ -329,10 +329,10 @@ function htmlfied_nodesatts(elems){
information += '<li><b>' + node.label + '</b></li>';
if(node.htmlCont==""){
if (!isUndef(node.level)) {
information += '<li>' + node.level + '</li>';
information += '<li class="infosoc">' + node.level + '</li>';
}
} else {
information += '<li>' + $("<div/>").html(node.htmlCont).text() + '</li>';
information += '<li class="infosoc">' + $("<div/>").html(node.htmlCont).text() + '</li>';
}
socnodes.push(information)
}
......@@ -431,7 +431,7 @@ function updateRelatedNodesPanel( sels , same, oppos ) {
sameNodesDIV+= '</div>';
}
informationDIV += '<br><h4>Information:</h4><ul>';
informationDIV += '<br><h4>Information:</h4><ul class="infoitems">';
informationDIV += htmlfied_nodesatts( sels ).join("<br>\n")
informationDIV += '</ul><br>';
......
......@@ -1014,6 +1014,7 @@ function dictfyJSON( data , categories ) {
for(var nid in data.nodes) {
let n = data.nodes[nid];
let node = {}
node.id = (n.id) ? n.id : nid ; // use the key if no id
......@@ -1028,6 +1029,13 @@ function dictfyJSON( data , categories ) {
else node.attributes = {}
node.type = (n.type)? n.type : categories[0] ;
// any content to display on side panel (eg: comex v-card)
node.htmlCont = n.content || '';
// 2x use-case-specific attributes (comex)
node.CC = n.CC || '';
node.ACR = n.ACR || '';
// £TODO REFA new sigma.js: shape is not attr but custom type linked to a renderer's name
// node.shape = "square";
......
## Presets by use case for faster deployment
This directory stores **settings variants** for various ProjectExplorer use cases.
These files are just commodity exemples for the deployer or developer:
- just use the desired settings file to overwrite the default `settings_explorerjs.js` file.
### Provided files
#### Community Explorer (`settings_explorerjs.comex.js`)
- uses communityexplorer.org branding settings
- `sourcemode` configuration for the comex service api
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