Commit b983583e authored by Romain Loth's avatar Romain Loth

Merge commit '908dd1' (new db.json spec + templates + updated settings) into with_tina_1.2

parents abe38cc1 db2024fb
Résumé de la structure globale
----------------------------------
Après commits de la semaine 26-30 juin 2017, une structure plus facile pour les déploiements
- les settings sont le seul élément à part
- les sous-dossiers respectent la "separation of concerns"
- une valeur dans les settings et un script bash à lancer 1 fois (adapt_html_paths.sh) suffisent à reconfigurer toute l'appli pour des routes de déploiement spécifiques (par exemple ajouter un prefixe comme 'static/tinawebJS' à tous les liens internes)
- un nouveau dossier twpresets contient des configurations toutes faites pour les cas de déploiement les plus fréquents
- les librairies tierces-parties ont été groupées permettant de les substituer avec plus de facilité lors de factorisation avec les mêmes libs déjà déployées autrement, ou lors de màj de ces librairies
```
├── 00.DOCUMENTATION
│   └── (fusionné avec ./doc)
├── data
│   └── (graphes par sous-projets)
├── db.json
├── explorerjs.html <= point d'entrée lancement
├── settings_explorerjs.js <= point d'entrée config
├── favicon.ico
├── LICENSE
├── README.md
├── twbackends <= APIS externes
│   ├── phpAPI <= api CSV et CortextDB
│   └── twitterAPI2
├── twlibs <= librairies développées chez nous
│   ├── css
│   ├── fonts
│   ├── img
│   └── README.md
├── twlibs3 <= librairies tierces-parties
│   ├── bootstrap-3
│   ├── bootstrap-native
│   ├── freshslider
│   ├── jquery-3
│   ├── readmore.js
│   ├── sigma_v1.2
│   ├── sigma_v1.5
│   └── tweets
|
├── twmain <= ancien dossier tinawebJS
│   ├── main.js
│   ├── extras_explorerjs.js <= ajouté à l'intérieur
│   ├── (etc)
│   └── Tinaweb.js
|
├── twmodules <= modules internes
│   ├── crowdsourcingModule
│   └── histogramModule
├── twpresets <= variantes de settings
│   ├── README.md
│   └── settings_explorerjs.comex.js
└── twtools
|
└── adapt_html_paths.sh <= "compile" un nouvel explorerjs.prod.html
avec les routes utilisées au déploiement
```
## Servermenu Configuration
The servermenu file associates some metadata to each graph file.
It is used if `sourcemode="servermenu"` is found in the url params or the settings file.
By default, the file is called `./db.json` (this can be modified in settings under `TW.conf.paths.sourceMenu`)
The `db.json` file of this distribution contains many examples.
------------------------------------------------------
#### Minimal Config
One minimal servermenu entry contains:
- a data dir path (**the project**)
- for each project: a list of graph files subpaths (**the graph source**)
- for each graph file: a list of expected node types starting by 'node0' (**the nodetypes**)
```json
"$$data/yourprojectdir": {
"graphs": {
"$$graph_source.gexf":{
"node0": {"name": "$$a_typename_of_nodes"}
},
"$$another_graph_source.json":{
"node0": {"name": "$$a_typename_of_nodes"}
}
}
}
```
The value **typename_of_nodes** should match the `type` or `category` attribute value of your nodes in the source gexf or json. It acts as a filter specifying the nodes that will be displayed in the ProjectExplorer GUI.
##### For a bipartite graph
If the source file has 2 types of nodes, the config should look like this:
```json
"$$data/yourprojectdir": {
"graphs": {
"$$source_file.ext":{
"node0": {"name": "$$typename_of_term_nodes"},
"node1": {"name": "$$typename_of_context_nodes"}
}
}
}
```
NB: giving an empty string value to `node1.name` property will group all other found types in an "other" category.
Having a node0.name entry and optionally a node1.name is enough to display the graph.
###### Real life example
```json
"data/comexjsons": {
"graphs": {
"graph_example.json": {
"node0": { "name": "NGram" },
"node1": { "name": "Document" }
}
}
}
```
------------------------------------------------------
#### Activating relatedDocs LocalDB queries
The servermenu file also allows configuration of associated queries for selected node(s): **relatedDocs**
To enable it, you need to add to your node entry the `reldbfile` key:
```json
"node0": {
"name": "$$blabla",
"reldbfile": "$$relpath/to/csv/or/sqlite"
}
```
The presence of this property `reldbfile` makes the API usable in db.json.
##### More relatedDocs settings
In addition, for full configuration, the following entries can be set under node0 or node1.
###### => for a CSV doc-by-doc table
Expected type is `"csv"` and you should fill the columns to search in.
```json
"reldbtype": "csv",
"reldbqcols": ["list", "of", "columns", "to", "search", "in", "for", "node0"]
```
###### Real life example
```json
"data/gargistex": {
"first": "shale_and_ice.gexf",
"graphs": {
"shale_and_ice.gexf": {
"node0": {
"name": "terms",
"reldbtype": "csv",
"reldbfile": "shale_and_ice.csv",
"reldbqcols": ["title", "abstract"]
}
},
"model_calibration.gexf": {
"node0": {
"name": "terms",
"reldbtype": "csv",
"reldbfile": "model_calibration.csv",
"reldbqcols": ["title", "abstract"]
}
}
}
}
```
###### => for CortextDB SQL tables
Expected type is `"CortextDB"` and you should fill the table to search in.
```json
"reldbtype": "CortextDB",
"reldbqtable": []
```
"title" "pubdate" "author" "journal" "keywords" "text"
"python is nice" "2001" "Asher,Lutz" "areview" "python, forest" "hic in Palatio prima urbi fundamenta ieci. arcem iam scelere emptam Sabini habent"
"python is cool" "2003" "-cc-" "areview" "python, ocean" "hic in Palatio prima urbi fundamenta ieci. arcem iam scelere emptam Sabini habent"
"scala is great" "2003" "Odersky" "areviewB" "scala, crop" "hic in Palatio prima urbi fundamenta ieci. arcem iam scelere emptam Sabini habent"
"php is expressive" "2005" "Nixon" "areview" "php, mysql" "hic in Palatio prima urbi fundamenta ieci. arcem iam scelere emptam Sabini habent"
"php is expressive2" "2010" "-bb-" "areviewB" "php, web" "hic in Palatio prima urbi fundamenta ieci. arcem iam scelere emptam Sabini habent"
"javascript rules the web" "2005" "someguy,anotherguy" "areviewC" "javascript, web" "hic in Palatio prima urbi fundamenta ieci. arcem iam scelere emptam Sabini habent"
"a cool article" "2008" "-dd-" "areview" "coolness, ecosystem" "hic in Palatio prima urbi fundamenta ieci. arcem iam scelere emptam Sabini habent"
"another cool article" "2001" "-aa-" "areview" "coastal, coolness" "hic in Palatio prima urbi fundamenta ieci. arcem iam scelere emptam Sabini habent"
"a js primer" "2004" "mandelbrot" "areviewC" "coolness, ecosystem, grain yield" "hic in Palatio prima urbi fundamenta ieci. arcem iam scelere emptam Sabini habent"
"a scala js primer" "2004" "somebody" "areviewC" "keyword, ecosystem, growth response" "hic in Palatio prima urbi fundamenta ieci. arcem iam scelere emptam Sabini habent"
{ {
"data/comexjsons": {
"first" : "graph_example.json",
"graphs": {
"graph_example.json": {
"node0": { "name": "NGram" },
"node1": { "name": "Document" }
}
}
},
"data/gargistex": { "data/gargistex": {
"first" : "shale_and_ice.gexf", "first" : "shale_and_ice.gexf",
"graphs":{ "graphs":{
...@@ -17,7 +8,7 @@ ...@@ -17,7 +8,7 @@
"reldbtype": "csv", "reldbtype": "csv",
"reldbfile": "shale_and_ice.csv", "reldbfile": "shale_and_ice.csv",
"reldbqcols": ["title"], "reldbqcols": ["title"],
"reltemplate": "_todo" "reltemplate": "bib_details"
} }
}, },
"model_calibration.gexf": { "model_calibration.gexf": {
...@@ -26,11 +17,20 @@ ...@@ -26,11 +17,20 @@
"reldbtype": "csv", "reldbtype": "csv",
"reldbfile": "model_calibration.csv", "reldbfile": "model_calibration.csv",
"reldbqcols": ["title"], "reldbqcols": ["title"],
"reltemplate": "_todo" "reltemplate": "bib_details"
} }
} }
} }
}, },
"data/comexjsons": {
"first" : "graph_example.json",
"graphs": {
"graph_example.json": {
"node0": { "name": "NGram" },
"node1": { "name": "Document" }
}
}
},
"data/test": { "data/test": {
"first" : "mini_for_csv.gexf", "first" : "mini_for_csv.gexf",
"graphs": { "graphs": {
...@@ -40,24 +40,22 @@ ...@@ -40,24 +40,22 @@
"reldbtype": "csv", "reldbtype": "csv",
"reldbfile": "mini_for_csv.csv", "reldbfile": "mini_for_csv.csv",
"reldbqcols": ["title","keywords","text"], "reldbqcols": ["title","keywords","text"],
"reltemplate": "_todo" "reltemplate": "bib_details"
}, },
"node1": { "node1": {
"name": "person", "name": "person",
"reldbtype": "csv", "reldbtype": "csv",
"reldbfile": "mini_for_csv.csv", "reldbfile": "mini_for_csv.csv",
"reldbqcols": ["author"], "reldbqcols": ["author"],
"reltemplate": "_todo" "reltemplate": "bib_details"
} }
}, },
"test_with_various_atts.gexf": {} "test_with_various_atts.gexf": {}
} }
}, },
"data/politoscope": { "data/politoscope": {
"dbname":null,
"title":"Politoscope", "title":"Politoscope",
"date":"2017", "date":"2017",
"abstract":"",
"first" : "ProgrammeDesCandidats.enrichi.gexf", "first" : "ProgrammeDesCandidats.enrichi.gexf",
"graphs": { "graphs": {
"ProgrammeDesCandidats.enrichi.gexf": { "ProgrammeDesCandidats.enrichi.gexf": {
...@@ -69,14 +67,14 @@ ...@@ -69,14 +67,14 @@
} }
}, },
"data/ClimateChange": { "data/ClimateChange": {
"abstract":"ISIABSTRACT",
"graphs": { "graphs": {
"Maps_S_800.gexf": { "Maps_S_800.gexf": {
"node0": { "node0": {
"name": "ISItermsWhitelistV2Oct_5 &amp; ISItermsWhitelistV2Oct_5", "name": "ISItermsWhitelistV2Oct_5 &amp; ISItermsWhitelistV2Oct_5",
"reldbtable": "ISItermsWhitelistV2Oct_5", "reldbqtable": "ISItermsWhitelistV2Oct_5",
"reldbname" : "wos_climate-change_title_2014-2015.db", "reldbfile" : "wos_climate-change_title_2014-2015.db",
"reldbtype": "CortextDB" "reldbtype": "CortextDB",
"reltemplate": "cortext_with_link"
} }
} }
} }
......
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
<!-- NB bootstrap 3 not used for main grid (graph + bars) but inside the bars --> <!-- NB bootstrap 3 not used for main grid (graph + bars) but inside the bars -->
<link rel="stylesheet" href="twlibs3/bootstrap-3/css/bootstrap.min.css" media="screen"> <link rel="stylesheet" href="twlibs3/bootstrap-3/css/bootstrap.min.css" media="screen">
<link rel="stylesheet" href="twlibs3/freshslider/freshslider.css" media="screen"> <link rel="stylesheet" href="twlibs3/freshslider/freshslider.css" media="screen">
<link rel="stylesheet" href="twlibs3/tweets/tweet.light.ltr.css" /> <link rel="stylesheet" href="twlibs3/tweets/tweet.light.excerpt.css" />
<link rel="stylesheet" href="twlibs3/tweets/custom.css"/> <link rel="stylesheet" href="twlibs3/tweets/custom.css"/>
<link rel="stylesheet" href="twlibs/css/twjs.css"> <link rel="stylesheet" href="twlibs/css/twjs.css">
...@@ -73,7 +73,14 @@ ...@@ -73,7 +73,14 @@
<body> <body>
<a id='mainlogo' href="https://github.com/moma/ProjectExplorer"
class="navbar-higher"
title="Project Explorer">
<img src="twlibs/img/logo.png"
style="width:50px; position:absolute; top:-8px; left:-4px; z-index:5; overflow:visible;">
</a>
<div id="topbar" class="navbar navbar-default"> <div id="topbar" class="navbar navbar-default">
<div class="container"> <div class="container">
<div class="navbar-collapse collapse" id="navbar-main"> <div class="navbar-collapse collapse" id="navbar-main">
...@@ -82,6 +89,7 @@ ...@@ -82,6 +89,7 @@
<!-- name will be replaced by TW.conf.branding, link by TW.conf.brandingLink --> <!-- name will be replaced by TW.conf.branding, link by TW.conf.brandingLink -->
<a href="#" class="navbar-middle navbar-brand twbrand-link"> <a href="#" class="navbar-middle navbar-brand twbrand-link">
<span id="twbrand">TinaWebJS</span> <span id="twbrand">TinaWebJS</span>
</a> </a>
</li> </li>
...@@ -130,7 +138,7 @@ ...@@ -130,7 +138,7 @@
<!-- ex-defaultop --> <!-- ex-defaultop -->
<div id="toolbar" class="navbar navbar-default"> <div id="toolbar" class="navbar navbar-default">
<div id="defaultop" class="container"> <div id="defaultop" class="container-fluid">
<div class="navbar-header"> <div class="navbar-header">
<button id="toolbar-open" type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#left" aria-expanded="false" aria-controls="navbar"> <button id="toolbar-open" type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#left" aria-expanded="false" aria-controls="navbar">
...@@ -143,7 +151,7 @@ ...@@ -143,7 +151,7 @@
<div id="left" class="navbar-collapse collapse"> <div id="left" class="navbar-collapse collapse">
<ul class="nav navbar-nav"> <ul class="nav navbar-nav navbar">
<!-- <!--
<li> <li>
...@@ -156,13 +164,6 @@ ...@@ -156,13 +164,6 @@
</li> </li>
--> -->
<li><a href="https://communityexplorer.org"
class="navbar-higher"
title="Community Explorer">
<img src="twlibs/img/logo.png"
style="width:60px; position:absolute; top:-60px; left:-75px; z-index:5; overflow:visible;">
</a></li>
<li> <li>
<a> <a>
<button type="button" id="changetype" class="btn btn-success btn-sm">Change<br>Type</button> <button type="button" id="changetype" class="btn btn-success btn-sm">Change<br>Type</button>
...@@ -256,9 +257,7 @@ ...@@ -256,9 +257,7 @@
</ul> </ul>
<ul id="searchnav" class='nav navbar-nav navbar-left'>
<ul id="searchnav" class='nav navbar-nav'>
<li class="navbar-lower"> <li class="navbar-lower">
<div id="search_input_group" class="input-group input-group-sm my-nav-input-group"> <div id="search_input_group" class="input-group input-group-sm my-nav-input-group">
<span class="input-group-btn crowdsourcingModule"> <span class="input-group-btn crowdsourcingModule">
...@@ -441,7 +440,10 @@ ...@@ -441,7 +440,10 @@
</div> </div>
</div> </div>
<div id="sidebar"> <div id="sidebar">
<div id="tab-container" class='tab-container'> <!-- manual file chooser if run locally -->
<div id="localInput"></div>
<div id="selection-tabs-contnr" class='selection-tabs-contnr'>
<ul class='etabs'> <ul class='etabs'>
<!-- for related elements from the combined graph (eg soc => sem) --> <!-- for related elements from the combined graph (eg soc => sem) -->
...@@ -460,21 +462,25 @@ ...@@ -460,21 +462,25 @@
</div> </div>
</div> </div>
<div class="question reldocs"> <!-- topPapers tabs -->
<div class="input-group"> <div id="reldocs-tabs-wrapper" class="reldocs">
<label for="reldocs-type" class="smlabel input-group-addon">Related documents type</label>
<select id="reldocs-type" name="reldocs-type" <!-- NB: data-reldocstype should match TW.conf.relatedDocsType
class="custom-select form-control" and will be filled from TW.conf.relatedDocsAPIS keys
onchange="TW.conf.relatedDocsType=this.value; getTopPapers()"> -->
<option value="twitter">Twitter API</option> <ul id="reldocs-tabs" class="nav nav-tabs" role="tablist">
<option value="LocalDB">Local DB query</option>
</select> </ul>
<!-- One tab pane
(only one with topPapers, we change content ourselves)
-->
<div class="tab-content">
<div id="topPapers" role="tabpanel" class="tab-pane active">
</div>
</div> </div>
</div>
<div id="topPapers">
</div>
<div id="localInput"></div> </div>
<div id="information"></div> <div id="information"></div>
...@@ -483,13 +489,14 @@ ...@@ -483,13 +489,14 @@
open/close panel from: jsfiddle.net/KyleMit/kcpma open/close panel from: jsfiddle.net/KyleMit/kcpma
--> -->
<div class="panel-group" id="accordion"> <div class="panel-group" id="varinfos-accordion">
<div class="panel panel-default" id="video_explanation"> <div class="panel panel-default" id="video_explanation">
<div class="panel-heading"> <div class="panel-heading">
<h4 class="panel-title"> <h4 class="panel-title">
<a data-toggle="collapse" data-target="#le_tutorial" href="#le_tutorial"> <a data-toggle="collapse" data-target="#le_tutorial" href="#le_tutorial"
data-parent="#varinfos-accordion">
<span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span> <span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span>
&nbsp;Tutorial video &nbsp;Tutorial video
</a> </a>
...@@ -497,29 +504,35 @@ ...@@ -497,29 +504,35 @@
</div> </div>
<!-- TODO: outcloud the video for better stream+player --> <!-- TODO: outcloud the video for better stream+player -->
<!-- <div class="panel-collapse collapse" id="le_tutorial"> <div class="panel-collapse collapse" id="le_tutorial">
<p>here video</p>
<video width="100%" <video width="100%"
src="video/AXA2015.mp4" controls="" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></video> src="" controls="" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></video>
</div> --> </div>
</div> </div>
<div class="panel panel-default" id="tips_panel"> <div class="panel panel-default" id="tips_panel">
<div class="panel-heading"> <div class="panel-heading">
<h4 class="panel-title"> <h4 class="panel-title">
<a data-toggle="collapse" data-target="#tips" href="#tips"> <a data-toggle="collapse" data-target="#tips" href="#tips"
data-parent="#varinfos-accordion">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
&nbsp;Tips &nbsp;Tips
</a> </a>
</h4> </h4>
</div> </div>
<div class="panel-collapse collapse in" id="tips"></div> <div class="panel-collapse collapse in" id="tips">
<p>here tips inserted by twmain/Tinaweb.js</p>
</div>
</div> </div>
<div class="panel panel-default" id="credits_panel">
<div class="panel panel-default" id="video_explanationw">
<div class="panel-heading"> <div class="panel-heading">
<h4 class="panel-title"> <h4 class="panel-title">
<a data-toggle="collapse" data-target="#credits" href="#credits"> <a data-toggle="collapse" data-target="#credits" href="#credits"
data-parent="#varinfos-accordion">
<span class="glyphicon glyphicon-flag" aria-hidden="true"></span> <span class="glyphicon glyphicon-flag" aria-hidden="true"></span>
&nbsp;Credits &nbsp;Credits
</a> </a>
...@@ -527,19 +540,21 @@ ...@@ -527,19 +540,21 @@
</div> </div>
<div class="panel-collapse collapse" id="credits"> <div class="panel-collapse collapse" id="credits">
<a href="https://bigdata.iscpif.fr/" target="_blank"> <p>
<img src="https://bigdata.iscpif.fr/images/logos/BIGDATA-Logo-PoweredBy-light.jpg" <a href="https://bigdata.iscpif.fr/" target="_blank">
alt="Powered by Big Data at ISCPIF" <img src="https://bigdata.iscpif.fr/images/logos/BIGDATA-Logo-PoweredBy-light.jpg"
style="width:85%; "> alt="Powered by Big Data at ISCPIF"
</a> style="width:85%; ">
<a href="https://github.com/moma" target="_blank"> </a>
<img src="twlibs/img/moma.png" <a href="https://github.com/moma" target="_blank">
alt="Sciencemapping" <img src="twlibs/img/moma.png"
style="width:85%; "> alt="Sciencemapping"
</a> style="width:85%; ">
</a>
</p>
</div> </div>
</div> </div>
</div> </div>
<br><br> <br><br>
...@@ -610,12 +625,12 @@ ...@@ -610,12 +625,12 @@
</div> </div>
<div id="modalloader" class="modal fade"> <!-- <div id="modalloader" class="modal fade">
<div id="loader" class="loader"> <div id="loader" class="loader">
<img src="twlibs/img/loader.gif"></img> <img src="twlibs/img/loader.gif"></img>
</div> </div>
<div id="closeloader" data-dismiss="modal"></div> <div id="closeloader" data-dismiss="modal"></div>
</div> </div> -->
<div id="facet-options" class="modal fade"> <div id="facet-options" class="modal fade">
...@@ -725,10 +740,9 @@ ...@@ -725,10 +740,9 @@
</div> </div>
</div> </div>
<!--
<div id="geomapmodal" class="modal fade"> <div id="geomapmodal" class="modal fade">
<!-- <div class="modal-content"> -->
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Geomap</h4> <h4 class="modal-title">Geomap</h4>
...@@ -736,12 +750,10 @@ ...@@ -736,12 +750,10 @@
<div class="modal-body"> <div class="modal-body">
<div class="geomapCont"></div> <div class="geomapCont"></div>
</div> </div>
<!-- </div> -->
<!-- <div class="geomapCont"></div> -->
<div id="closegeomap" data-dismiss="modal"></div> <div id="closegeomap" data-dismiss="modal"></div>
</div> </div> -->
<div id="heatgraph"></div> <!-- <div id="heatgraph"></div> -->
</div> </div>
......
...@@ -6,8 +6,8 @@ TW.conf = (function(TW){ ...@@ -6,8 +6,8 @@ TW.conf = (function(TW){
let TWConf = {} let TWConf = {}
TWConf.branding = 'Community Explorer 2' // <--- name displayed in upper left TWConf.branding = 'ProjectExplorer' // <--- name displayed in upper left
TWConf.brandingLink = 'https://communityexplorer.org' // <--- link to "home" TWConf.brandingLink = 'https://github.com/moma/ProjectExplorer' // <--- link to "home"
// ========================== // ==========================
...@@ -17,13 +17,7 @@ TW.conf = (function(TW){ ...@@ -17,13 +17,7 @@ TW.conf = (function(TW){
// Graph data source // Graph data source
// ----------------- // -----------------
// the graph input depends on TWConf.sourcemode (or manual url arg 'sourcemode') // the graph input depends on TWConf.sourcemode (or manual url arg 'sourcemode')
TWConf.sourcemode = "api" // accepted: "api" | "serverfile" | "servermenu" | "localfile" TWConf.sourcemode = "servermenu" // accepted: "api" | "serverfile" | "servermenu" | "localfile"
// server-side .gexf|.json default source
TWConf.sourceFile = ""
// ...or server-side gexf default source list
TWConf.sourceMenu = "db.json"
// ...or remote bridge to default source api ajax queries // ...or remote bridge to default source api ajax queries
TWConf.sourceAPI={}; TWConf.sourceAPI={};
...@@ -34,9 +28,8 @@ TW.conf = (function(TW){ ...@@ -34,9 +28,8 @@ TW.conf = (function(TW){
// Related documents (topPapers) data source // Related documents (topPapers) data source
// ----------------------------------------- // -----------------------------------------
TWConf.getRelatedDocs = false TWConf.getRelatedDocs = true
TWConf.relatedDocsMax = 10 TWConf.relatedDocsMax = 10
TWConf.relatedDocsAPI = "http://127.0.0.1:5000/twitter_search"
TWConf.relatedDocsType = "twitter" // accepted: "twitter" | "LocalDB" TWConf.relatedDocsType = "twitter" // accepted: "twitter" | "LocalDB"
// POSSible: "elastic" // POSSible: "elastic"
...@@ -115,7 +108,7 @@ TW.conf = (function(TW){ ...@@ -115,7 +108,7 @@ TW.conf = (function(TW){
'weight' : {'col': "heatmap" , 'n': 5, 'binmode': 'samerange' }, 'weight' : {'col': "heatmap" , 'n': 5, 'binmode': 'samerange' },
'Weighted Degree' : {'col': "heatmap", 'n': 8, 'binmode': 'samerange' }, 'Weighted Degree' : {'col': "heatmap", 'n': 8, 'binmode': 'samerange' },
'out-degree' : {'col': "heatmap" , 'n': 3, 'binmode': 'samepop' }, 'out-degree' : {'col': "heatmap" , 'n': 3, 'binmode': 'samepop' },
'CC' : {'col': "cluster" , 'binmode': 'off'}, 'country' : {'col': "cluster" , 'binmode': 'off'},
'ACR' : {'col': "cluster" , 'binmode': 'off'}, 'ACR' : {'col': "cluster" , 'binmode': 'off'},
'cluster_universal_index': {'col': "cluster" , 'binmode': 'off' }, 'cluster_universal_index': {'col': "cluster" , 'binmode': 'off' },
'community_orphan' : {'col': "cluster" , 'binmode': 'off' } 'community_orphan' : {'col': "cluster" , 'binmode': 'off' }
...@@ -165,8 +158,12 @@ TW.conf = (function(TW){ ...@@ -165,8 +158,12 @@ TW.conf = (function(TW){
// Modules path // Modules path
// ------------ // ------------
TWConf.paths = { TWConf.paths = {
'ourlibs': 'static/tinawebJS/twlibs', 'ourlibs': 'twlibs',
'modules': 'twmodules' 'templates': "twlibs/hit_templates",
'modules': 'twmodules',
'sourceFile': "", // server-side .gexf|.json default source
'sourceMenu': "db.json" // ...or server-side gexf default source list
} }
Object.freeze(TWConf.paths) // /!\ to prevent path modification before load Object.freeze(TWConf.paths) // /!\ to prevent path modification before load
...@@ -216,7 +213,7 @@ TW.conf = (function(TW){ ...@@ -216,7 +213,7 @@ TW.conf = (function(TW){
// if fa2Available, the auto-run config: // if fa2Available, the auto-run config:
TWConf.fa2Enabled= true; // fa2 auto-run at start and after graph modified ? TWConf.fa2Enabled= true; // fa2 auto-run at start and after graph modified ?
TWConf.fa2Milliseconds=10000; // duration of auto-run TWConf.fa2Milliseconds=2000; // duration of auto-run
TWConf.minNodesForAutoFA2 = 5 // graph size threshold to auto-run TWConf.minNodesForAutoFA2 = 5 // graph size threshold to auto-run
......
<?php
header('Content-Type: application/json');
include("DirectoryScanner.php");
$projectFolderPat = dirname(dirname(getcwd())) . "/";
$instance = new scanTree($projectFolderPat);
$instance->getDirectoryTree("data");
//pr(var_dump($instance->folders));
$output = array();
$output["folders"] = $instance->folders;
$output["gexf_idfolder"] = $instance->gexf_folder;
echo json_encode($output);
// ** Debug Functions: **
function br() {
echo "----------<br>";
}
function pr($msg) {
echo $msg . "<br>";
}
?>
...@@ -58,18 +58,47 @@ TWConf.relatedDocsType = "LocalDB" (CSV or CortextDB) ...@@ -58,18 +58,47 @@ TWConf.relatedDocsType = "LocalDB" (CSV or CortextDB)
Finally, to match the correct DB with the correct graph file: Finally, to match the correct DB with the correct graph file:
- both should reside in `data/yoursubdir` - both should reside in `data/yoursubdir`
- the appropriate source database information needs to appear in `db.json` in order to associate the graph source file (eg gexf) with this related docs API: - the appropriate source database information needs to appear in `db.json` in order to associate the graph source file (eg gexf) with this related docs API:
```json ```json
"data/yoursubdir": { "data/yoursubdir": {
"dbname":"your.sqlite.db",
"title":"yourDocumentTitlesTable",
"date":"yourDocumentPubDatesTable",
"abstract":"yourDocumentContentsTable",
"graphs": { "graphs": {
"your.graph.gexf": { "your.graph.gexf": {
"semantic": { "table":"yourTableWithTerms"}, "node0": {
"social": { "table":"yourTableWithSocialNodes"} "name": "terms",
"reldbtype": "CortextDB",
"reldbfile": "yourDB.db",
"reldbqtable": "yourTableWithTerms"
},
"node1": {
"name": "people",
"reldbtype": "CortextDB",
"reldbfile": "yourDB.db",
"reldbqtable": "yourTableWithSocialNodes"
},
}
}
},
"data/anothersubdir": {
"graphs": {
"another.graph.gexf": {
"node0": {
"name": "terms",
"reldbtype": "csv",
"reldbfile": "aCsvByDocs.csv",
"reldbqcols": ["title", "text", "keywords"]
},
"node1": {
"name": "people",
"reldbtype": "csv",
"reldbfile": "aCsvByDocs.csv",
"reldbqcols": ["authors", "editors"]
},
} }
} }
} }
``` ```
£TODO update after new specifications implemented
See more exemples and explanations in [servermenu_config.md](https://github.com/moma/ProjectExplorer/blob/master/00.DOCUMENTATION/A-Introduction/servermenu_config.md).
<?php
echo 'toto';
?>
\ No newline at end of file
...@@ -7,47 +7,50 @@ error_reporting(-1); ...@@ -7,47 +7,50 @@ error_reporting(-1);
// DISPLAY THE RESULTS // DISPLAY THE RESULTS
function displayDoc($docId, $score, $base) { function displayDoc($docId, $score, $base, $outmode) {
$output = "";
// POSS score should have a data-score attribute // POSS score should have a data-score attribute
$output = "<li class='searchhit' title='".$score."'>";
// shortcut to doc // shortcut to doc
$doc = $base[$docId]; $doc = $base[$docId];
// £TODO new concept: use searchhit-templates // fallback "universal" values
$has_template = False ; $title = try_attrs_until_you_find($doc, ['title', 'tit', 't']);
if ($has_template) { $source = try_attrs_until_you_find($doc, ['source', 'journal', 'j']);
$keywords = try_attrs_until_you_find($doc, ['keywords', 'keyword', 'kw']);
$author = try_attrs_until_you_find($doc, ['authors', 'author', 'auth', 'au']);
$doccontent = try_attrs_until_you_find($doc, ['text', 'txt', 'abstract', 'content']);
} $date = try_attrs_until_you_find($doc, ['pubdate', 'publication_year', 'date']);
else {
// fallback "universal" values // detailed dates, gargantext-compatible
$title = try_attrs_until_you_find($doc, ['title', 'tit', 't']); $month = try_attrs_until_you_find($doc, ['publication_month']);
$source = try_attrs_until_you_find($doc, ['source', 'journal', 'j']); $day = try_attrs_until_you_find($doc, ['publication_day']);
$keywords = try_attrs_until_you_find($doc, ['keywords', 'keyword', 'kw']); if ($month) { $date .= "/".$month;
$author = try_attrs_until_you_find($doc, ['authors', 'author', 'auth', 'au']); if ($day) { $date .= "/".$day; } }
$doccontent = try_attrs_until_you_find($doc, ['text', 'txt', 'abstract', 'content']);
// "universal" template
$date = try_attrs_until_you_find($doc, ['pubdate', 'publication_year', 'date']); if ($outmode == 'html') {
$output = "<li class='searchhit' title='".$score."'>";
// detailed dates, gargantext-compatible
$month = try_attrs_until_you_find($doc, ['publication_month']);
$day = try_attrs_until_you_find($doc, ['publication_day']);
if ($month) { $date .= "/".$month;
if ($day) { $date .= "/".$day; } }
// "universal" template
$output.="<p><b>$title</b> by <span class='author'>$author</span>, <i>$source</i> [$date]</p>"; $output.="<p><b>$title</b> by <span class='author'>$author</span>, <i>$source</i> [$date]</p>";
if (strlen($keywords)) { if (strlen($keywords)) {
$output.="<p><b>keywords:</b> $keywords</p>"; $output.="<p><b>keywords:</b> $keywords</p>";
} }
$output.="<p><span class='hit-text'>$doccontent</span></p>"; $output.="<p><span class='hit-text'>$doccontent</span></p>";
$output.="</li>";
}
// json mode
else {
$output = array(
"tit" => $title,
"au" => $author,
"src" => $source,
"kws" => $keywords,
"txt" => $doccontent,
"date" => $date,
"score" => $score
);
} }
$output.="</li>";
return $output; return $output;
} }
...@@ -67,6 +70,7 @@ function try_attrs_until_you_find($doc_obj, $attr_names_array) { ...@@ -67,6 +70,7 @@ function try_attrs_until_you_find($doc_obj, $attr_names_array) {
$htmlout = "<ul class=infoitems>\n"; $htmlout = "<ul class=infoitems>\n";
$jsonout = array();
$nb_displayed = 0; $nb_displayed = 0;
foreach ($sims as $doc => $freq) { foreach ($sims as $doc => $freq) {
// doc limit // doc limit
...@@ -75,16 +79,30 @@ foreach ($sims as $doc => $freq) { ...@@ -75,16 +79,30 @@ foreach ($sims as $doc => $freq) {
} }
$rowid = ltrim($doc, 'd'); $rowid = ltrim($doc, 'd');
$thisdoc = displayDoc($rowid, $freq, $base); $thisdoc = displayDoc($rowid, $freq, $base, $output_mode);
// echodump("doc", $thisdoc); // echodump("doc", $thisdoc);
$htmlout .= $thisdoc."\n";
if ($output_mode == "html") {
$htmlout .= $thisdoc."\n";
}
else {
array_push($jsonout, $thisdoc);
}
// doc limit // doc limit
$nb_displayed++; $nb_displayed++;
} }
$htmlout .= "</ul>\n"; $htmlout .= "</ul>\n";
echo '<br/><h4><font color="#0000FF"> Full text of top '.$max_item_displayed."/".count($sims).' related publications:</font></h4>'.$htmlout; if ($output_mode == "html") {
echo '<br/><h4><font color="#0000FF"> Full text of top '.$nb_displayed."/".count($sims).' related publications:</font></h4>';
echo $htmlout;
}
else {
echo json_encode(array(
'hits' => $jsonout,
'nhits' => $nb_displayed
));
}
// to see the entire results array: // to see the entire results array:
// -------------------------------- // --------------------------------
......
...@@ -55,14 +55,14 @@ function parse_and_index_csv($filename, $typed_cols_to_index, $separator, $quote ...@@ -55,14 +55,14 @@ function parse_and_index_csv($filename, $typed_cols_to_index, $separator, $quote
$base[$rowid][$colname] = $line_fields[$c]; $base[$rowid][$colname] = $line_fields[$c];
// fill our search index if the type+col was asked in postings // fill our search index if the type+col was asked in postings
foreach (['semantic', 'social'] as $swtype){ for ($ndtypeid = 0 ; $ndtypeid < $GLOBALS["ntypes"] ; $ndtypeid++) {
if (array_key_exists($swtype, $postings)) { if (array_key_exists($ndtypeid, $postings)) {
if (array_key_exists($colname, $postings[$swtype])) { if (array_key_exists($colname, $postings[$ndtypeid])) {
// basic tokenisation (TODO specify tokenisation delimiters etc.) // basic tokenisation (TODO specify tokenisation delimiters etc.)
$tokens = preg_split("/\W/", $line_fields[$c]); $tokens = preg_split("/\W/", $line_fields[$c]);
// for debug // for debug
// echo("indexing column:".$colname." under type:".$swtype.'<br>'); // echo("indexing column:".$colname." under type:".$ndtypeid.'<br>');
// var_dump($tokens); // var_dump($tokens);
foreach($tokens as $tok) { foreach($tokens as $tok) {
...@@ -70,16 +70,16 @@ function parse_and_index_csv($filename, $typed_cols_to_index, $separator, $quote ...@@ -70,16 +70,16 @@ function parse_and_index_csv($filename, $typed_cols_to_index, $separator, $quote
if (strlen($tok)) { if (strlen($tok)) {
// POSS : stopwords could be used here // POSS : stopwords could be used here
if (! array_key_exists($tok, $postings[$swtype][$colname])) { if (! array_key_exists($tok, $postings[$ndtypeid][$colname])) {
$postings[$swtype][$colname][$tok] = array(); $postings[$ndtypeid][$colname][$tok] = array();
} }
// in a csv, rowid is a pointer to the document // in a csv, rowid is a pointer to the document
if (array_key_exists($docid, $postings[$swtype][$colname][$tok])) { if (array_key_exists($docid, $postings[$ndtypeid][$colname][$tok])) {
// we keep the frequencies // we keep the frequencies
$postings[$swtype][$colname][$tok][$docid]++ ; $postings[$ndtypeid][$colname][$tok][$docid]++ ;
} }
else { else {
$postings[$swtype][$colname][$tok][$docid] = 1; $postings[$ndtypeid][$colname][$tok][$docid] = 1;
} }
} }
} }
......
This diff is collapsed.
<?php <?php
include('tools.php');
include('parameters_details.php'); include('parameters_details.php');
$db = $gexf_db[$gexf];
$base = new PDO("sqlite:../" .$db); $base = new PDO("sqlite:" .$mainpath.$graphdb);
$query = str_replace( '__and__', '&', $_GET["query"] ); $query = str_replace( '__and__', '&', $_GET["query"] );
$terms_of_query = json_decode($query); $terms_of_query = json_decode($query);
// echo "mainpath: ".$mainpath."<br>"; // echo "mainpath: ".$mainpath."<br>";
// echo "thedb: ".$db."<br>"; // echo "thedb: ".$mainpath.$graphdb."<br>";
// echo "thequery: ".var_dump($terms_of_query); // echo "thequery: ".var_dump($terms_of_query);
echo ' echo '
...@@ -18,7 +18,7 @@ echo ' ...@@ -18,7 +18,7 @@ echo '
<link rel="stylesheet" href="js/jquery-ui.css" /> <link rel="stylesheet" href="js/jquery-ui.css" />
<script src="js/jquery-1.9.1.js"></script> <script src="js/jquery-1.9.1.js"></script>
<script src="js/jquery-ui.js"></script> <script src="js/jquery-ui.js"></script>
<script> <script>
$(function() { $(function() {
$( "#tabs" ).tabs({ $( "#tabs" ).tabs({
...@@ -27,12 +27,12 @@ echo ' ...@@ -27,12 +27,12 @@ echo '
}); });
</script> </script>
</head> </head>
<body> <body>
<div id="tabs"> <div id="tabs">
<ul> <ul>
<li><a href="#tabs-1">Selected Document</a></li> <li><a href="#tabs-1">Selected Document</a></li>
<li><a href="full_doc_list.php?'.'gexf='.urlencode($gexf).'&query='.urlencode($_GET["query"]).'&index='.$_GET["index"].'&type='.urlencode($_GET["type"]).'">Full list</a></li>'; <li><a href="full_doc_list.php?'.'gexf='.urlencode($gexf).'&query='.urlencode($_GET["query"]).'&index='.$_GET["index"].'&type='.urlencode($_GET["type"]).'">Full list</a></li>';
echo '</ul>'; echo '</ul>';
echo '<div id="tabs-1">'; echo '<div id="tabs-1">';
...@@ -43,14 +43,14 @@ $id=$_GET["id"]; ...@@ -43,14 +43,14 @@ $id=$_GET["id"];
// //$elems = json_decode($query); // //$elems = json_decode($query);
// $sql = 'SELECT data FROM ISIkeyword WHERE id='.$id; // $sql = 'SELECT data FROM ISIkeyword WHERE id='.$id;
// foreach ($base->query($sql) as $row) { // foreach ($base->query($sql) as $row) {
// $country=$CC[strtoupper($row['data'])]; // $country=$CC[strtoupper($row['data'])];
// } // }
$sql = 'SELECT data FROM ISITITLE WHERE id='.$id.' group by data'; $sql = 'SELECT data FROM ISITITLE WHERE id='.$id.' group by data';
foreach ($base->query($sql) as $row) { foreach ($base->query($sql) as $row) {
$output.='<h2>'.$row['data'].'</h2>'; $output.='<h2>'.$row['data'].'</h2>';
$find.="<br/><a href=http://google.com/webhp?q=".urlencode('"'.$row['data'].'"')." target='blank'>[ Search on the web ] </a>"; $find.="<br/><a href=http://google.com/webhp?q=".urlencode('"'.$row['data'].'"')." target='blank'>[ Search on the web ] </a>";
} }
...@@ -76,7 +76,7 @@ $id=$_GET["id"]; ...@@ -76,7 +76,7 @@ $id=$_GET["id"];
// $sql = 'SELECT data FROM ISIkeyword WHERE id='.$id; // $sql = 'SELECT data FROM ISIkeyword WHERE id='.$id;
// foreach ($base->query($sql) as $row) { // foreach ($base->query($sql) as $row) {
// $country=$CC[strtoupper($row['data'])]; // $country=$CC[strtoupper($row['data'])];
// $output.=strtoupper($country).'<br/> '; // $output.=strtoupper($country).'<br/> ';
// } // }
...@@ -118,7 +118,7 @@ $id=$_GET["id"]; ...@@ -118,7 +118,7 @@ $id=$_GET["id"];
$abs.=". ".$row['data']; $abs.=". ".$row['data'];
} }
$abs=str_replace('ISSUES:' ,'<br/><br/><b>Issues:</b>',$abs); $abs=str_replace('ISSUES:' ,'<br/><br/><b>Issues:</b>',$abs);
$abs=str_replace('INTENDED IMPACT:' ,'<br/><br/><b>Intended impact:</b>',$abs); $abs=str_replace('INTENDED IMPACT:' ,'<br/><br/><b>Intended impact:</b>',$abs);
$abs=str_replace('IMPACT:' ,'<br/><br/><b>Impact:</b>',$abs); $abs=str_replace('IMPACT:' ,'<br/><br/><b>Impact:</b>',$abs);
$abs=str_replace('NOVELTY:' ,'<br/><br/><b>Novelty:</b>',$abs); $abs=str_replace('NOVELTY:' ,'<br/><br/><b>Novelty:</b>',$abs);
$abs=str_replace('BOLD INNOVATION:' ,'<br/><br/><b>Bold innovation:</b>',$abs); $abs=str_replace('BOLD INNOVATION:' ,'<br/><br/><b>Bold innovation:</b>',$abs);
...@@ -131,7 +131,7 @@ $id=$_GET["id"]; ...@@ -131,7 +131,7 @@ $id=$_GET["id"];
$abs=str_replace('_x000D_', ' ', $abs); $abs=str_replace('_x000D_', ' ', $abs);
$abs=str_replace('•', ' ', $abs); $abs=str_replace('•', ' ', $abs);
$abs=str_replace('’', '\'', $abs); $abs=str_replace('’', '\'', $abs);
foreach ($terms_of_query as $key => $value) { foreach ($terms_of_query as $key => $value) {
$abs=str_ireplace($value,'<font color="green"><b> '.$value.'</b></font>',$abs); $abs=str_ireplace($value,'<font color="green"><b> '.$value.'</b></font>',$abs);
} }
...@@ -140,7 +140,7 @@ $id=$_GET["id"]; ...@@ -140,7 +140,7 @@ $id=$_GET["id"];
} }
$output.='<br/><p align="justify"><b>Abstract : </b><i>'.$abs.' </i></p>'; $output.='<br/><p align="justify"><b>Abstract : </b><i>'.$abs.' </i></p>';
$output.="<br>"; $output.="<br>";
......
<?php <?php
include('tools.php');
include('parameters_details.php'); include('parameters_details.php');
$db = $gexf_db[$gexf];
$base = new PDO("sqlite:../" .$db); $base = new PDO("sqlite:" .$mainpath.$graphdb);
$output = "<ul>"; // string sent to the javascript for display $output = "<ul>"; // string sent to the javascript for display
#http://localhost/branch_ademe/php/test.php?type=social&query=[%22marwah,%20m%22]
$type = $_GET["type"]; $type = $_GET["type"];
...@@ -14,7 +13,7 @@ $query = str_replace( '__and__', '&', $_GET["query"] ); ...@@ -14,7 +13,7 @@ $query = str_replace( '__and__', '&', $_GET["query"] );
$terms_of_query=json_decode($_GET["query"]); $terms_of_query=json_decode($_GET["query"]);
$elems = json_decode($query); $elems = json_decode($query);
// nombre d'item dans les tables // nombre d'item dans les tables
$sql='SELECT COUNT(*) FROM ISIABSTRACT'; $sql='SELECT COUNT(*) FROM ISIABSTRACT';
foreach ($base->query($sql) as $row) { foreach ($base->query($sql) as $row) {
$table_size=$row['COUNT(*)']; $table_size=$row['COUNT(*)'];
...@@ -23,7 +22,6 @@ foreach ($base->query($sql) as $row) { ...@@ -23,7 +22,6 @@ foreach ($base->query($sql) as $row) {
$table = ""; $table = "";
$column = ""; $column = "";
$id=""; $id="";
$twjs=end( explode("/",getcwd()) )."/"; // LOCALDB folder.
if($type=="social"){ if($type=="social"){
$table = "ISIAUTHOR"; $table = "ISIAUTHOR";
...@@ -63,9 +61,9 @@ $sum=0; ...@@ -63,9 +61,9 @@ $sum=0;
//The final query! //The final query!
// array of all relevant documents with score // array of all relevant documents with score
foreach ($base->query($sql) as $row) { foreach ($base->query($sql) as $row) {
// on pondère le score par le nombre de termes mentionnés par l'article // on pondère le score par le nombre de termes mentionnés par l'article
//$num_rows = $result->numRows(); //$num_rows = $result->numRows();
$wos_ids[$row[$id]] = $row["count(*)"]; $wos_ids[$row[$id]] = $row["count(*)"];
$sum = $row["count(*)"] +$sum; $sum = $row["count(*)"] +$sum;
...@@ -76,8 +74,8 @@ foreach ($base->query($sql) as $row) { ...@@ -76,8 +74,8 @@ foreach ($base->query($sql) as $row) {
$number_doc=ceil(count($wos_ids)/3); $number_doc=ceil(count($wos_ids)/3);
$count=0; $count=0;
foreach ($wos_ids as $id => $score) { foreach ($wos_ids as $id => $score) {
if ($count<1000){ if ($count<200){
// retrieve publication year // retrieve publication year
$sql = 'SELECT data FROM ISIpubdate WHERE id='.$id; $sql = 'SELECT data FROM ISIpubdate WHERE id='.$id;
foreach ($base->query($sql) as $row) { foreach ($base->query($sql) as $row) {
...@@ -85,23 +83,16 @@ foreach ($wos_ids as $id => $score) { ...@@ -85,23 +83,16 @@ foreach ($wos_ids as $id => $score) {
} }
// to filter under some conditions // to filter under some conditions
$to_display=true; $to_display=true;
if ($to_display){ if ($to_display){
$count+=1; $count+=1;
$output.="<li title='".$score."'>"; $output.="<li title='".$score."'>";
$output.=imagestar($score,$factor,$twjs).' '; $output.=imagestar($score,$factor,'./').' ';
$sql = 'SELECT data FROM ISITITLE WHERE id='.$id." group by data"; $sql = 'SELECT data FROM ISITITLE WHERE id='.$id." group by data";
foreach ($base->query($sql) as $row) { foreach ($base->query($sql) as $row) {
$output.='<a href="default_doc_details.php?gexf='.urlencode($gexf).'&type='.urlencode($_GET["type"]).'&query='.urlencode($query).'&id='.$id.'">'.$row['data']." </a> "; $output.='<a href="default_doc_details.php?gexf='.urlencode($gexf).'&type='.urlencode($_GET["type"]).'&query='.urlencode($query).'&id='.$id.'">'.$row['data']." </a> ";
$external_link="<a href=http://scholar.google.com/scholar?q=".urlencode('"'.$row['data'].'"')." target=blank>".' <img width=20px src="img/gs.png"></a>';
//this should be the command:
//$output.='<a href="JavaScript:newPopup(\''.$twjs.'php/default_doc_details.php?db='.urlencode($datadb).'&id='.$id.' \')">'.$row['data']." </a> ";
//the old one:
//$output.='<a href="JavaScript:newPopup(\''.$twjs.'php/default_doc_details.php?id='.$id.' \')">'.$row['data']." </a> ";
$external_link="<a href=http://scholar.google.com/scholar?q=".urlencode('"'.$row['data'].'"')." target=blank>".' <img width=20px src="twlibs/img/gs.png"></a>';
//$output.='<a href="JavaScript:newPopup(''php/doc_details.php?id='.$id.''')"> Link</a>';
} }
// get the authors // get the authors
...@@ -110,9 +101,7 @@ foreach ($wos_ids as $id => $score) { ...@@ -110,9 +101,7 @@ foreach ($wos_ids as $id => $score) {
$output.=strtoupper($row['data']).', '; $output.=strtoupper($row['data']).', ';
} }
//<a href="JavaScript:newPopup('http://www.quackit.com/html/html_help.cfm');">Open a popup window</a>' $output.=$external_link."</li><br>";
$output.=$external_link."</li><br>";
} }
}else{ }else{
...@@ -126,21 +115,4 @@ $output= '<h3>'.$count.' items related to: '.implode(' OR ', $elems).'</h3>'.$ou ...@@ -126,21 +115,4 @@ $output= '<h3>'.$count.' items related to: '.implode(' OR ', $elems).'</h3>'.$ou
echo $output; echo $output;
function imagestar($score,$factor,$twjs) {
// produit le html des images de score
$star_image = '';
if ($score > .5) {
$star_image = '';
for ($s = 0; $s < min(5,$score/$factor); $s++) {
$star_image.='<img src="twlibs/img/star.gif" border="0" >';
}
} else {
$star_image.='<img src="twlibs/img/stargrey.gif" border="0">';
}
return $star_image;
}
?> ?>
...@@ -7,24 +7,54 @@ ini_set('display_startup_errors',1); ...@@ -7,24 +7,54 @@ ini_set('display_startup_errors',1);
// exemple call: // exemple call:
// http://blabla/LOCALDB/info_div.php?type=semantic&bi=0&query=[%22Monte%20Carlo%22]&gexf=%22line/AXA/RiskV2PageRank1000.gexf%22&index=ISItermsAxa_2015 // http://blabla/LOCALDB/info_div.php?type=semantic&bi=0&query=[%22Monte%20Carlo%22]&gexf=%22line/AXA/RiskV2PageRank1000.gexf%22&index=ISItermsAxa_2015
include('tools.php');
include('parameters_details.php'); include('parameters_details.php');
if ($_GET['dbtype'] == "CortextDB") { if ($output_mode == "json") {
$base = new PDO("sqlite:".$mainpath.$graphdb); header('Content-Type: application/json');
include('default_div.php');
} }
$dbtype = null;
if (array_key_exists('reldbtype', $my_conf[$ntid])) {
$dbtype = $my_conf[$ntid]['reldbtype'];
}
else { else {
// to index: the "searchable columns" $guess_src = '';
if (! array_key_exists('toindex', $_GET)) { if (array_key_exists('dbtype', $_GET)) {
echo('<br> info_div.php (csv mode): please provide columns to index <br>'); $dbtype = $_GET['dbtype'];
$guess_src = "via url parameters";
} }
else { else {
$idxcolsbytype = json_decode($_GET['toindex']); $dbtype = 'csv'; // new default
$guess_src = "by default";
// echodump("columns to index",$idxcolsbytype); }
errmsg("not filled", "$gexf -> node$ntid -> 'reldbtype'", "...Assuming dbtype is $dbtype ($guess_src).");
}
if ($dbtype == "CortextDB") {
$base = new PDO("sqlite:".$mainpath.$graphdb);
include('default_div.php');
}
else {
// to index: the union of "searchable columns" qcols for all nodetypes
$idxcolsbytype = [];
for ($i = 0; $i < $ntypes ; $i++) {
if ($my_conf[$i]['active']) {
$idxcolsbytype[$i] = [];
$idxcolsbytype[$i] = $my_conf[$i]['reldbqcols'];
}
// else {
// echo("no nodetype ".$i."<br>");
// }
}
if (! $idxcolsbytype) {
echo('<br> info_div.php (csv mode): please provide reldbqcols param in db.json <br>');
}
else {
// DO THE INDEXATION (or RETRIEVE CACHED ONE) // DO THE INDEXATION (or RETRIEVE CACHED ONE)
// we use cache if memcached is present (and if we indexed the csv already) // we use cache if memcached is present (and if we indexed the csv already)
include('csv_indexation.php'); include('csv_indexation.php');
...@@ -68,7 +98,7 @@ else { ...@@ -68,7 +98,7 @@ else {
// DO THE SEARCH // DO THE SEARCH
// ------------- // -------------
$searchcols = json_decode($_GET['searchin']); $searchcols = $my_conf[$ntid]['reldbqcols'];
// a - split the query // a - split the query
$qtokens = preg_split('/\W/', $_GET["query"]); $qtokens = preg_split('/\W/', $_GET["query"]);
...@@ -93,7 +123,7 @@ else { ...@@ -93,7 +123,7 @@ else {
for ($l=0 ; $l < count($searchcols) ; $l++) { for ($l=0 ; $l < count($searchcols) ; $l++) {
// set of values we could find a match in // set of values we could find a match in
$searchable = $postings[$_GET['type']][$searchcols[$l]]; $searchable = $postings[$ntid][$searchcols[$l]];
if (array_key_exists($tok, $searchable)) { if (array_key_exists($tok, $searchable)) {
......
<?php <?php
# loading an associated db for a given gexf as relatedDocs php API // GLOBAL PARAMS
$gexf_db = array(); // -------------
// 0 - output mode: 'json' or 'html'
// > json is for new use cases where styling is applied via template import in the js
// > html is the classical use where data is styled in this php scripts
$output_mode = "json";
# £££TODO read the db.json // 1 - relative urls
$gexf_db["data/ClimateChange/Maps_S_800.gexf"] = "data/ClimateChange/wos_climate-change_title_2014-2015.db"; $our_php_root="twbackends/phpAPI"; // our php scripts relative URL
$gexf_db["data/AXA/RiskV2PageRank1000.gexf"] = "data/AXA/data.db"; $our_libs_root="twbackends/phpAPI"; // for our few icons and jquery-ui
$gexf_db["data/AXA/RiskV2PageRank2500.gexf"] = "data/AXA/data.db"; // POSS could be merged with our_php_root
$gexf_db["data/AXA/RiskV2PageRank5000.gexf"] = "data/AXA/data.db";
$gexf_db["data/test/mini_for_csv.gexf"] = "data/test/mini_for_csv.csv";
$gexf_db["data/gargistex/shale_and_ice.gexf"] = "data/gargistex/shale_and_ice.csv";
$gexf_db["data/gargistex/model_calibration.gexf"] = "data/gargistex/model_calibration.csv";
// $gexf_db["data/ProgrammeDesCandidats.gexf"] = "foobar";
$gexf= str_replace('"','',$_GET["gexf"]); // 2 - paths
$mainpath=dirname(dirname(getcwd()))."/"; // default fs path to ProjectExplorer root
// (where data dir and db.json file reside)
// default path to ProjectExplorer root $project_menu_path = "db.json";
// (where data directory and db.json file reside)
$mainpath=dirname(getcwd())."/../";
$graphdb = $gexf_db[$gexf]; // 3 - others
$ntypes = 2; // max node types
// number of docs to display setting
$max_item_displayed = 7;
// for csv parsing // for csv parsing
$csvsep = "\t"; $csvsep = "\t";
...@@ -32,15 +34,36 @@ $csvquote = '"'; ...@@ -32,15 +34,36 @@ $csvquote = '"';
$memserver = 'localhost'; $memserver = 'localhost';
$memport = 11211; $memport = 11211;
// number of docs to display setting
$max_item_displayed = 7;
// echodump("graphdb", $graphdb); // CONFIGURATION PARAMS
// --------------------
// parse db.json project menu and create a conf by file
$conf = read_conf($mainpath.$project_menu_path, $ntypes);
// =======================================
// echodump("== READ CONF ==<br>", $conf);
// =======================================
function echodump($title, $anyObj) { $gexf= str_replace('"','',$_GET["gexf"]);
echo "<br>".$title.": "; $ndtype = $_GET["type"];
echo (json_encode($anyObj, JSON_PRETTY_PRINT)); $ntid = null;
echo "<br>"; $my_conf = null;
// legacy types => generic types with 0 as default
if ($ndtype == 'social') { $ntid = 1; }
else { $ntid = 0; }
// echodump("params: node type id", $ntid);
if (! $conf[$gexf][$ntid]['active']) {
errmsg("not active", "your graph ($gexf)");
exit(1);
}
else {
$my_conf = $conf[$gexf];
$graphdb = $my_conf[$ntid]['dir'].'/'.$my_conf[$ntid]['reldbfile'];
} }
// echodump("params: reldb", $graphdb);
?> ?>
<?php
function echodump($title, $anyObj) {
echo "<br>".$title.": ";
echo (preg_replace_callback("/\n(\s*)/", function($capt){
return('<br>'.str_repeat('&nbsp;', strlen($capt[0])));
}, json_encode($anyObj, JSON_PRETTY_PRINT)));
echo "<br>";
}
function errmsg($message, $context, $more = "") {
echo "<p class='micromessage'>The relatedDocs DB conf for $context is $message
(please read A-Introduction/servermenu_config.md).<br>$more</p>";
}
// reading db.json associations
// source graph file <=> (db, dbtype, cols) as relatedDocs php API
function read_conf($filepath, $ntypes) {
$project_menu_fh = fopen($filepath, "r");
$json_st = '';
while (!feof($project_menu_fh)) {
$json_st .= fgets($project_menu_fh);
}
fclose($project_menu_fh);
$project_menu = json_decode($json_st);
// echodump("== db.json menu ==", $project_menu);
$conf = array();
foreach ($project_menu as $project_dir => $dir_items){
// NB access by obj property (and not array key)
if (! property_exists($dir_items, 'graphs')) {
error_log("tw/phpAPI skip error: conf file ($project_menu_path)
has no 'graphs' entry for project '$project_dir' !");
continue;
}
foreach ($dir_items->graphs as $graph_file => $graph_conf){
// echodump("== $graph_file ==", $graph_conf);
$gpath = $project_dir.'/'.$graph_file;
// NB a graph conf can now have different settings for each nodetype
// node0 <=> classic type 'semantic'
// node1 <=> classic type 'social'
$conf[$gpath] = array($ntypes);
for ($i = 0 ; $i < $ntypes ; $i++) {
// check node0, node1, etc to see if they at least have a reldbfile
if (! property_exists($graph_conf, 'node'.$i)
|| ! property_exists($graph_conf->{'node'.$i}, 'reldbfile') ) {
$conf[$gpath][$i] = array('active' => false);
continue;
}
else {
// we have a file for this type: copy entire conf
$conf[$gpath][$i] = (array)$graph_conf->{'node'.$i};
$conf[$gpath][$i]['active'] = true;
$conf[$gpath][$i]['dir'] = $project_dir;
}
// POSS here info on higher level may be propagated for lower ones
// (ex: if dbtype is on the project level, its value should count
// for each source file in the project unless overridden)
}
}
}
return $conf;
}
function imagestar($score,$factor,$static_libs) {
// produit le html des images de score
$star_image = '';
if ($score > 1) {
$star_image = '';
$yellow_star = '<img src="'.$static_libs.'/img/star.gif" border="0" >';
$grey_star = '<img src="'.$static_libs.'/img/stargrey.gif" border="0">';
$max = 5 * $score / $factor;
for ($s = 0; $s < 5 ; $s++) {
if ($s < $max) {
$star_image.=$yellow_star;
}
else {
$star_image.= $grey_star;
}
}
}
return $star_image;
}
?>
#### Unused functionalities
- `tfidf.php`: compute a tfidf value per term (as pointwise metric for ranking, not similarities) table in Cortext-like databases
- `listFiles.php` + `DirectoryScanner.php`: alternative strategy to navigate between source files (old tina before db.json)
- `favorites.php` : query a favorites table in Cortext-like databases
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
$db= $_GET["db"];//I receive the specific database as string! $db= $_GET["db"];//I receive the specific database as string!
$terms_of_query=json_decode($_GET["query"]); $terms_of_query=json_decode($_GET["query"]);
include('parameters_details.php'); include('parameters_details.php');
include('tools.php');
$base = new PDO("sqlite:" .$mainpath.$db); $base = new PDO("sqlite:" .$mainpath.$db);
$query=$_GET["query"]; $query=$_GET["query"];
$gexf=$_GET["gexf"]; $gexf=$_GET["gexf"];
...@@ -20,7 +21,7 @@ foreach ($base->query($sql) as $row){ ...@@ -20,7 +21,7 @@ foreach ($base->query($sql) as $row){
$favorite_keywords=array(); $favorite_keywords=array();
foreach ($wos_ids as $id => $score) { foreach ($wos_ids as $id => $score) {
if ($count<1000){ if ($count<1000){
// retrieve publication year // retrieve publication year
$sql = 'SELECT data FROM ISIpubdate WHERE id='.$id; $sql = 'SELECT data FROM ISIpubdate WHERE id='.$id;
...@@ -38,8 +39,8 @@ foreach ($wos_ids as $id => $score) { ...@@ -38,8 +39,8 @@ foreach ($wos_ids as $id => $score) {
}else{ }else{
$favorite_keywords[$row['data']]=1; $favorite_keywords[$row['data']]=1;
} }
} }
$sql = 'SELECT data FROM ISITITLE WHERE id='.$id; $sql = 'SELECT data FROM ISITITLE WHERE id='.$id;
...@@ -47,12 +48,12 @@ foreach ($wos_ids as $id => $score) { ...@@ -47,12 +48,12 @@ foreach ($wos_ids as $id => $score) {
$output.='<a href="default_doc_details.php?db='.urlencode($db).'&type='.urlencode($_GET["type"]).'&query='.urlencode($query).'&id='.$id.'">'.$row['data']." </a> "; $output.='<a href="default_doc_details.php?db='.urlencode($db).'&type='.urlencode($_GET["type"]).'&query='.urlencode($query).'&id='.$id.'">'.$row['data']." </a> ";
//this should be the command: //this should be the command:
//$output.='<a href="JavaScript:newPopup(\''.$twjs.'php/default_doc_details.php?db='.urlencode($datadb).'&id='.$id.' \')">'.$row['data']." </a> "; //$output.='<a href="JavaScript:newPopup(\''.$our_php_root.'/default_doc_details.php?db='.urlencode($datadb).'&id='.$id.' \')">'.$row['data']." </a> ";
//the old one: //the old one:
//$output.='<a href="JavaScript:newPopup(\''.$twjs.'php/default_doc_details.php?id='.$id.' \')">'.$row['data']." </a> "; //$output.='<a href="JavaScript:newPopup(\''.$our_php_root.'/default_doc_details.php?id='.$id.' \')">'.$row['data']." </a> ";
$external_link="<a href=http://scholar.google.com/scholar?q=".urlencode('"'.$row['data'].'"')." target=blank>".' <img width=20px src="img/gs.png"></a>'; $external_link="<a href=http://scholar.google.com/scholar?q=".urlencode('"'.$row['data'].'"')." target=blank>".' <img width=20px src="img/gs.png"></a>';
//$output.='<a href="JavaScript:newPopup(''php/doc_details.php?id='.$id.''')"> Link</a>'; //$output.='<a href="JavaScript:newPopup(''php/doc_details.php?id='.$id.''')"> Link</a>';
} }
// get the authors // get the authors
...@@ -62,7 +63,7 @@ foreach ($wos_ids as $id => $score) { ...@@ -62,7 +63,7 @@ foreach ($wos_ids as $id => $score) {
} }
if($project_folder!='nci'){ if($project_folder!='nci'){
$output.='('.$pubdate.') '; $output.='('.$pubdate.') ';
}else { }else {
...@@ -73,15 +74,15 @@ foreach ($wos_ids as $id => $score) { ...@@ -73,15 +74,15 @@ foreach ($wos_ids as $id => $score) {
$sql = 'SELECT data FROM ISIkeyword WHERE id='.$id; $sql = 'SELECT data FROM ISIkeyword WHERE id='.$id;
foreach ($base->query($sql) as $row) { foreach ($base->query($sql) as $row) {
$country=$CC[strtoupper($row['data'])]; $country=$CC[strtoupper($row['data'])];
$output.=strtoupper($country).' '; $output.=strtoupper($country).' ';
} }
//<a href="JavaScript:newPopup('http://www.quackit.com/html/html_help.cfm');">Open a popup window</a>' //<a href="JavaScript:newPopup('http://www.quackit.com/html/html_help.cfm');">Open a popup window</a>'
$output.=$external_link."</li><br>"; $output.=$external_link."</li><br>";
}else{ }else{
continue; continue;
...@@ -106,22 +107,6 @@ foreach ($favorite_keywords as $key => $value) { ...@@ -106,22 +107,6 @@ foreach ($favorite_keywords as $key => $value) {
$output= '<h3>'.$num_favorite.' favorite items </h3>'.$tag_could.'<br/>'.$output; $output= '<h3>'.$num_favorite.' favorite items </h3>'.$tag_could.'<br/>'.$output;
echo $output; echo $output;
function imagestar($score,$factor,$twjs) {
// produit le html des images de score
$star_image = '';
if ($score > .5) {
$star_image = '';
for ($s = 0; $s < min(5,$score/$factor); $s++) {
$star_image.='<img src="twlibs/img/star.gif" border="0" >';
}
} else {
$star_image.='<img src="twlibs/img/stargrey.gif" border="0">';
}
return $star_image;
}
?> ?>
### phpAPI old use-case specific variants
They are quasi-identical to info_div.php and full_doc_list.php, kept for future decision to remove or add as conditional behavior.
Apparent use-cases:
- `info_div2.php`: tweetoscope
- `full_doc_list2.php`: pasteur
- `default_doc_details2.php`: pasteur
- `full_doc_list_tidf.php`: ???
<?php <?php
include('tools.php');
include('parameters_details.php'); include('parameters_details.php');
$db = $gexf_db[$gexf]; $db = $gexf_db[$gexf];
...@@ -18,7 +19,7 @@ echo ' ...@@ -18,7 +19,7 @@ echo '
<link rel="stylesheet" href="js/jquery-ui.css" /> <link rel="stylesheet" href="js/jquery-ui.css" />
<script src="js/jquery-1.9.1.js"></script> <script src="js/jquery-1.9.1.js"></script>
<script src="js/jquery-ui.js"></script> <script src="js/jquery-ui.js"></script>
<script> <script>
$(function() { $(function() {
$( "#tabs" ).tabs({ $( "#tabs" ).tabs({
...@@ -27,12 +28,12 @@ echo ' ...@@ -27,12 +28,12 @@ echo '
}); });
</script> </script>
</head> </head>
<body> <body>
<div id="tabs"> <div id="tabs">
<ul> <ul>
<li><a href="#tabs-1">Selected Document</a></li> <li><a href="#tabs-1">Selected Document</a></li>
<li><a href="full_doc_list2.php?'.'gexf='.urlencode($gexf).'&query='.urlencode($_GET["query"]).'&type='.urlencode($_GET["type"]).'">Full list</a></li>'; <li><a href="full_doc_list2.php?'.'gexf='.urlencode($gexf).'&query='.urlencode($_GET["query"]).'&type='.urlencode($_GET["type"]).'">Full list</a></li>';
echo '</ul>'; echo '</ul>';
echo '<div id="tabs-1">'; echo '<div id="tabs-1">';
...@@ -43,7 +44,7 @@ $id=$_GET["id"]; ...@@ -43,7 +44,7 @@ $id=$_GET["id"];
// //$elems = json_decode($query); // //$elems = json_decode($query);
// $sql = 'SELECT data FROM ISIkeyword WHERE id='.$id; // $sql = 'SELECT data FROM ISIkeyword WHERE id='.$id;
// foreach ($base->query($sql) as $row) { // foreach ($base->query($sql) as $row) {
// $country=$CC[strtoupper($row['data'])]; // $country=$CC[strtoupper($row['data'])];
// } // }
...@@ -59,7 +60,7 @@ $id=$_GET["id"]; ...@@ -59,7 +60,7 @@ $id=$_GET["id"];
foreach ($base->query($sql) as $row) { foreach ($base->query($sql) as $row) {
$output.='<h2>'.$row['data'].'</h2>'; $output.='<h2>'.$row['data'].'</h2>';
$find.="<br/><a href=http://google.com/webhp?q=".urlencode('"'.$row['data'].'"')." target='blank'>[ Search on the web ] </a>"; $find.="<br/><a href=http://google.com/webhp?q=".urlencode('"'.$row['data'].'"')." target='blank'>[ Search on the web ] </a>";
} }
...@@ -77,13 +78,13 @@ $id=$_GET["id"]; ...@@ -77,13 +78,13 @@ $id=$_GET["id"];
$output.=' (2014) '; $output.=' (2014) ';
// // get the country // // get the country
// $sql = 'SELECT data FROM ISIkeyword WHERE id='.$id; // $sql = 'SELECT data FROM ISIkeyword WHERE id='.$id;
// foreach ($base->query($sql) as $row) { // foreach ($base->query($sql) as $row) {
// $country=$CC[strtoupper($row['data'])]; // $country=$CC[strtoupper($row['data'])];
// $output.=strtoupper($country).'<br/> '; // $output.=strtoupper($country).'<br/> ';
// } // }
...@@ -125,7 +126,7 @@ $id=$_GET["id"]; ...@@ -125,7 +126,7 @@ $id=$_GET["id"];
$abs.=". ".$row['data']; $abs.=". ".$row['data'];
} }
$abs=str_replace('ISSUES:' ,'<br/><br/><b>Issues:</b>',$abs); $abs=str_replace('ISSUES:' ,'<br/><br/><b>Issues:</b>',$abs);
$abs=str_replace('INTENDED IMPACT:' ,'<br/><br/><b>Intended impact:</b>',$abs); $abs=str_replace('INTENDED IMPACT:' ,'<br/><br/><b>Intended impact:</b>',$abs);
$abs=str_replace('IMPACT:' ,'<br/><br/><b>Impact:</b>',$abs); $abs=str_replace('IMPACT:' ,'<br/><br/><b>Impact:</b>',$abs);
$abs=str_replace('NOVELTY:' ,'<br/><br/><b>Novelty:</b>',$abs); $abs=str_replace('NOVELTY:' ,'<br/><br/><b>Novelty:</b>',$abs);
$abs=str_replace('BOLD INNOVATION:' ,'<br/><br/><b>Bold innovation:</b>',$abs); $abs=str_replace('BOLD INNOVATION:' ,'<br/><br/><b>Bold innovation:</b>',$abs);
...@@ -138,7 +139,7 @@ $id=$_GET["id"]; ...@@ -138,7 +139,7 @@ $id=$_GET["id"];
$abs=str_replace('_x000D_', ' ', $abs); $abs=str_replace('_x000D_', ' ', $abs);
$abs=str_replace('•', ' ', $abs); $abs=str_replace('•', ' ', $abs);
$abs=str_replace('’', '\'', $abs); $abs=str_replace('’', '\'', $abs);
foreach ($terms_of_query as $key => $value) { foreach ($terms_of_query as $key => $value) {
$abs=str_ireplace($value,'<font color="green"><b> '.$value.'</b></font>',$abs); $abs=str_ireplace($value,'<font color="green"><b> '.$value.'</b></font>',$abs);
} }
...@@ -147,7 +148,7 @@ $id=$_GET["id"]; ...@@ -147,7 +148,7 @@ $id=$_GET["id"];
} }
$output.='<br/><p align="justify"><b>Abstract : </b><i>'.$abs.' </i></p>'; $output.='<br/><p align="justify"><b>Abstract : </b><i>'.$abs.' </i></p>';
$output.="<br>"; $output.="<br>";
......
<?php <?php
include('tools.php');
include('parameters_details.php'); include('parameters_details.php');
$db = $gexf_db[$gexf]; $db = $gexf_db[$gexf];
...@@ -14,7 +15,7 @@ $query = str_replace( '__and__', '&', $_GET["query"] ); ...@@ -14,7 +15,7 @@ $query = str_replace( '__and__', '&', $_GET["query"] );
$terms_of_query=json_decode($_GET["query"]); $terms_of_query=json_decode($_GET["query"]);
$elems = json_decode($query); $elems = json_decode($query);
// nombre d'item dans les tables // nombre d'item dans les tables
$sql='SELECT COUNT(*) FROM ISIABSTRACT'; $sql='SELECT COUNT(*) FROM ISIABSTRACT';
foreach ($base->query($sql) as $row) { foreach ($base->query($sql) as $row) {
$table_size=$row['COUNT(*)']; $table_size=$row['COUNT(*)'];
...@@ -23,7 +24,6 @@ foreach ($base->query($sql) as $row) { ...@@ -23,7 +24,6 @@ foreach ($base->query($sql) as $row) {
$table = ""; $table = "";
$column = ""; $column = "";
$id=""; $id="";
$twjs="pasteurapi/"; // submod path of TinaWebJS
if($type=="social"){ if($type=="social"){
$table = "ISIAUTHOR"; $table = "ISIAUTHOR";
...@@ -64,9 +64,9 @@ $sum=0; ...@@ -64,9 +64,9 @@ $sum=0;
//The final query! //The final query!
// array of all relevant documents with score // array of all relevant documents with score
foreach ($base->query($sql) as $row) { foreach ($base->query($sql) as $row) {
// on pondère le score par le nombre de termes mentionnés par l'article // on pondère le score par le nombre de termes mentionnés par l'article
//$num_rows = $result->numRows(); //$num_rows = $result->numRows();
$wos_ids[$row[$id]] = $row["count(*)"]; $wos_ids[$row[$id]] = $row["count(*)"];
$sum = $row["count(*)"] +$sum; $sum = $row["count(*)"] +$sum;
...@@ -77,7 +77,7 @@ foreach ($base->query($sql) as $row) { ...@@ -77,7 +77,7 @@ foreach ($base->query($sql) as $row) {
$number_doc=ceil(count($wos_ids)/3); $number_doc=ceil(count($wos_ids)/3);
$count=0; $count=0;
foreach ($wos_ids as $id => $score) { foreach ($wos_ids as $id => $score) {
if ($count<1000){ if ($count<1000){
// retrieve publication year // retrieve publication year
$sql = 'SELECT data FROM ISIpubdate WHERE id='.$id; $sql = 'SELECT data FROM ISIpubdate WHERE id='.$id;
...@@ -86,23 +86,22 @@ foreach ($wos_ids as $id => $score) { ...@@ -86,23 +86,22 @@ foreach ($wos_ids as $id => $score) {
} }
// to filter under some conditions // to filter under some conditions
$to_display=true; $to_display=true;
if ($to_display){ if ($to_display){
$count+=1; $count+=1;
$output.="<li title='".$score."'>"; $output.="<li title='".$score."'>";
$output.=imagestar($score,$factor,$twjs).' '; $output.=imagestar($score,$factor,$our_libs_root).' ';
$sql = 'SELECT data FROM ISITITLE WHERE id='.$id." group by data"; $sql = 'SELECT data FROM ISITITLE WHERE id='.$id." group by data";
foreach ($base->query($sql) as $row) { foreach ($base->query($sql) as $row) {
$output.='<a href="default_doc_details2.php?gexf='.urlencode($gexf).'&type='.urlencode($_GET["type"]).'&query='.urlencode($query).'&id='.$id.'">'.$row['data']." </a> "; $output.='<a href="'.$our_php_root.'/default_doc_details2.php?gexf='.urlencode($gexf).'&type='.urlencode($_GET["type"]).'&query='.urlencode($query).'&id='.$id.'">'.$row['data']." </a> ";
//this should be the command: //this should be the command:
//$output.='<a href="JavaScript:newPopup(\''.$twjs.'php/default_doc_details.php?db='.urlencode($datadb).'&id='.$id.' \')">'.$row['data']." </a> "; //$output.='<a href="JavaScript:newPopup(\''.$our_php_root.'/default_doc_details.php?db='.urlencode($datadb).'&id='.$id.' \')">'.$row['data']." </a> ";
//the old one: //the old one:
//$output.='<a href="JavaScript:newPopup(\''.$twjs.'php/default_doc_details.php?id='.$id.' \')">'.$row['data']." </a> "; //$output.='<a href="JavaScript:newPopup(\''.$our_php_root.'/default_doc_details.php?id='.$id.' \')">'.$row['data']." </a> ";
$external_link="<a href=http://scholar.google.com/scholar?q=".urlencode('"'.$row['data'].'"')." target=blank>".' <img width=20px src="twlibs/img/gs.png"></a>'; $external_link="<a href=http://scholar.google.com/scholar?q=".urlencode('"'.$row['data'].'"')." target=blank>".' <img width=20px src="'.$our_libs_root.'/img/gs.png"></a>';
//$output.='<a href="JavaScript:newPopup(''php/doc_details.php?id='.$id.''')"> Link</a>';
} }
// get the authors // get the authors
...@@ -113,7 +112,7 @@ foreach ($wos_ids as $id => $score) { ...@@ -113,7 +112,7 @@ foreach ($wos_ids as $id => $score) {
//<a href="JavaScript:newPopup('http://www.quackit.com/html/html_help.cfm');">Open a popup window</a>' //<a href="JavaScript:newPopup('http://www.quackit.com/html/html_help.cfm');">Open a popup window</a>'
$output.=$external_link."</li><br>"; $output.=$external_link."</li><br>";
} }
}else{ }else{
...@@ -127,21 +126,4 @@ $output= '<h3>'.$count.' items related to: '.implode(' OR ', $elems).'</h3>'.$ou ...@@ -127,21 +126,4 @@ $output= '<h3>'.$count.' items related to: '.implode(' OR ', $elems).'</h3>'.$ou
echo $output; echo $output;
function imagestar($score,$factor,$twjs) {
// produit le html des images de score
$star_image = '';
if ($score > .5) {
$star_image = '';
for ($s = 0; $s < min(5,$score/$factor); $s++) {
$star_image.='<img src="twlibs/img/star.gif" border="0" >';
}
} else {
$star_image.='<img src="twlibs/img/stargrey.gif" border="0">';
}
return $star_image;
}
?> ?>
<?php <?php
include('tools.php');
include('parameters_details.php'); include('parameters_details.php');
$db= $_GET["db"];//I receive the specific database as string! $db= $_GET["db"];//I receive the specific database as string!
$query=$_GET["query"]; $query=$_GET["query"];
$gexf=$_GET["gexf"]; $gexf=$_GET["gexf"];
...@@ -21,7 +22,7 @@ $output = "<ul>"; // string sent to the javascript for display ...@@ -21,7 +22,7 @@ $output = "<ul>"; // string sent to the javascript for display
$type = $_GET["type"]; $type = $_GET["type"];
$query = str_replace( '__and__', '&', $_GET["query"] ); $query = str_replace( '__and__', '&', $_GET["query"] );
$elems = json_decode($query); $elems = json_decode($query);
// nombre d'item dans les tables // nombre d'item dans les tables
$sql='SELECT COUNT(*) FROM ISIABSTRACT'; $sql='SELECT COUNT(*) FROM ISIABSTRACT';
foreach ($base->query($sql) as $row) { foreach ($base->query($sql) as $row) {
$table_size=$row['COUNT(*)']; $table_size=$row['COUNT(*)'];
...@@ -31,7 +32,7 @@ foreach ($base->query($sql) as $row) { ...@@ -31,7 +32,7 @@ foreach ($base->query($sql) as $row) {
// Other restrictions // Other restrictions
// extracting the project folder and the year // extracting the project folder and the year
if (strpos($gexf,'2013')>0){ if (strpos($gexf,'2013')>0){
$year='2013'; $year='2013';
$year_filter=true; $year_filter=true;
}elseif (strpos($gexf,'2012')>0){ }elseif (strpos($gexf,'2012')>0){
$year='2012'; $year='2012';
...@@ -42,14 +43,13 @@ if (strpos($gexf,'2013')>0){ ...@@ -42,14 +43,13 @@ if (strpos($gexf,'2013')>0){
// identification d'une année pour echoing // identification d'une année pour echoing
if($project_folder=='nci'){ if($project_folder=='nci'){
$year_filter=true; $year_filter=true;
} }
$table = ""; $table = "";
$column = ""; $column = "";
$id=""; $id="";
$twjs="tinawebJS/"; // submod path of TinaWebJS
if($type=="social"){ if($type=="social"){
$table = "ISIAUTHOR"; $table = "ISIAUTHOR";
...@@ -95,7 +95,7 @@ $sum=0; ...@@ -95,7 +95,7 @@ $sum=0;
//echo $sql;//The final query! //echo $sql;//The final query!
// array of all relevant documents with score // array of all relevant documents with score
$count=0; $count=0;
foreach ($corporadb ->query($sql) as $row) { foreach ($corporadb ->query($sql) as $row) {
//if ($count<4*$max_item_displayed){ //if ($count<4*$max_item_displayed){
$wos_ids[$row[$id]] = $row['sum(tfidf)'];//$row["count(*)"]; $wos_ids[$row[$id]] = $row['sum(tfidf)'];//$row["count(*)"];
$sum = $row["count(*)"] +$sum; $sum = $row["count(*)"] +$sum;
...@@ -109,7 +109,7 @@ foreach ($corporadb ->query($sql) as $row) { ...@@ -109,7 +109,7 @@ foreach ($corporadb ->query($sql) as $row) {
$number_doc=ceil(count($wos_ids)/3); $number_doc=ceil(count($wos_ids)/3);
$count=0; $count=0;
foreach ($wos_ids as $id => $score) { foreach ($wos_ids as $id => $score) {
if ($count<1000){ if ($count<1000){
// retrieve publication year // retrieve publication year
$sql = 'SELECT data FROM ISIpubdate WHERE id='.$id; $sql = 'SELECT data FROM ISIpubdate WHERE id='.$id;
...@@ -118,37 +118,37 @@ foreach ($wos_ids as $id => $score) { ...@@ -118,37 +118,37 @@ foreach ($wos_ids as $id => $score) {
} }
// to filter under some conditions // to filter under some conditions
$to_display=true; $to_display=true;
if ($project_folder=='echoing'){ if ($project_folder=='echoing'){
if ($year_filter){ if ($year_filter){
if ($pubdate!=$year){ if ($pubdate!=$year){
$to_display=false; $to_display=false;
} }
} }
}elseif($project_folder=='nci'){ }elseif($project_folder=='nci'){
if ($year_filter){ if ($year_filter){
if ($pubdate!='2013'){ if ($pubdate!='2013'){
$to_display=false; $to_display=false;
} }
} }
} }
if ($to_display){ if ($to_display){
$count+=1; $count+=1;
$output.="<li title='".$score."'>"; $output.="<li title='".$score."'>";
$output.=imagestar($score,$factor,$twjs).' '; $output.=imagestar($score,$factor,$our_libs_root).' ';
$sql = 'SELECT data FROM ISITITLE WHERE id='.$id; $sql = 'SELECT data FROM ISITITLE WHERE id='.$id;
foreach ($base->query($sql) as $row) { foreach ($base->query($sql) as $row) {
$output.='<a href="default_doc_details.php?db='.urlencode($db).'&type='.urlencode($_GET["type"]).'&query='.urlencode($query).'&id='.$id.'">'.$row['data']." </a> "; $output.='<a href="'.$our_php_root.'/default_doc_details.php?db='.urlencode($db).'&type='.urlencode($_GET["type"]).'&query='.urlencode($query).'&id='.$id.'">'.$row['data']." </a> ";
//this should be the command: //this should be the command:
//$output.='<a href="JavaScript:newPopup(\''.$twjs.'php/default_doc_details.php?db='.urlencode($datadb).'&id='.$id.' \')">'.$row['data']." </a> "; //$output.='<a href="JavaScript:newPopup(\''.$our_php_root.'/default_doc_details.php?db='.urlencode($datadb).'&id='.$id.' \')">'.$row['data']." </a> ";
//the old one: //the old one:
//$output.='<a href="JavaScript:newPopup(\''.$twjs.'php/default_doc_details.php?id='.$id.' \')">'.$row['data']." </a> "; //$output.='<a href="JavaScript:newPopup(\''.$our_php_root.'/default_doc_details.php?id='.$id.' \')">'.$row['data']." </a> ";
$external_link="<a href=http://scholar.google.com/scholar?q=".urlencode('"'.$row['data'].'"')." target=blank>".' <img width=20px src="twlibs/img/gs.png"></a>'; $external_link="<a href=http://scholar.google.com/scholar?q=".urlencode('"'.$row['data'].'"')." target=blank>".' <img width=20px src="'.$our_libs_root.'/img/gs.png"></a>';
//$output.='<a href="JavaScript:newPopup(''php/doc_details.php?id='.$id.''')"> Link</a>'; //$output.='<a href="JavaScript:newPopup(''php/doc_details.php?id='.$id.''')"> Link</a>';
} }
// get the authors // get the authors
...@@ -158,7 +158,7 @@ foreach ($wos_ids as $id => $score) { ...@@ -158,7 +158,7 @@ foreach ($wos_ids as $id => $score) {
} }
if($project_folder!='nci'){ if($project_folder!='nci'){
$output.='('.$pubdate.') '; $output.='('.$pubdate.') ';
}else { }else {
...@@ -169,7 +169,7 @@ foreach ($wos_ids as $id => $score) { ...@@ -169,7 +169,7 @@ foreach ($wos_ids as $id => $score) {
//<a href="JavaScript:newPopup('http://www.quackit.com/html/html_help.cfm');">Open a popup window</a>' //<a href="JavaScript:newPopup('http://www.quackit.com/html/html_help.cfm');">Open a popup window</a>'
$output.=$external_link."</li><br>"; $output.=$external_link."</li><br>";
} }
}else{ }else{
...@@ -183,21 +183,4 @@ $output= '<h3>'.$count.' items related to: '.implode(' OR ', $elems).'</h3>'.$ou ...@@ -183,21 +183,4 @@ $output= '<h3>'.$count.' items related to: '.implode(' OR ', $elems).'</h3>'.$ou
echo $output; echo $output;
function imagestar($score,$factor,$twjs) {
// produit le html des images de score
$star_image = '';
if ($score > .5) {
$star_image = '';
for ($s = 0; $s < min(5,$score/$factor); $s++) {
$star_image.='<img src="twlibs/img/star.gif" border="0" >';
}
} else {
$star_image.='<img src="twlibs/img/stargrey.gif" border="0">';
}
return $star_image;
}
?> ?>
...@@ -13,7 +13,6 @@ $elems = json_decode($query); ...@@ -13,7 +13,6 @@ $elems = json_decode($query);
$table = ""; $table = "";
$column = ""; $column = "";
$id=""; $id="";
$twjs="API_CNRS/"; // submod path of TinaWebJS
if($type=="semantic"){ if($type=="semantic"){
...@@ -65,9 +64,9 @@ $sum=0; ...@@ -65,9 +64,9 @@ $sum=0;
//The final query! //The final query!
// array of all relevant documents with score // array of all relevant documents with score
foreach ($base->query($sql) as $row) { foreach ($base->query($sql) as $row) {
// on pondère le score par le nombre de termes mentionnés par l'article // on pondère le score par le nombre de termes mentionnés par l'article
//$num_rows = $result->numRows(); //$num_rows = $result->numRows();
$wos_ids[$row[$id]] = $row["count(*)"]; $wos_ids[$row[$id]] = $row["count(*)"];
$sum = $row["count(*)"] +$sum; $sum = $row["count(*)"] +$sum;
...@@ -76,21 +75,21 @@ foreach ($base->query($sql) as $row) { ...@@ -76,21 +75,21 @@ foreach ($base->query($sql) as $row) {
// /// nombre de document associés $related // /// nombre de document associés $related
$total_count=0; $total_count=0;
$count_max=500; $count_max=500;
$number_doc=count($wos_ids); $number_doc=count($wos_ids);
$count=0; $count=0;
$all_terms_from_selected_projects=array();// list of terms for the top 6 project selected $all_terms_from_selected_projects=array();// list of terms for the top 6 project selected
// to filter under some conditions // to filter under some conditions
$to_display=true; $to_display=true;
$count=0; $count=0;
foreach ($wos_ids as $id => $score) { foreach ($wos_ids as $id => $score) {
if ($total_count<$count_max) { if ($total_count<$count_max) {
// retrieve publication year // retrieve publication year
if ($to_display){ if ($to_display){
$total_count+=1; $total_count+=1;
...@@ -99,27 +98,27 @@ foreach ($wos_ids as $id => $score) { ...@@ -99,27 +98,27 @@ foreach ($wos_ids as $id => $score) {
$sql = 'SELECT data FROM ISITITLE WHERE id='.$id.' group by data'; $sql = 'SELECT data FROM ISITITLE WHERE id='.$id.' group by data';
foreach ($base->query($sql) as $row) { foreach ($base->query($sql) as $row) {
$external_link="<a href=http://google.com/webhp?#q=".urlencode('"'.utf8_decode($row['data']).'"')." target=blank>".' <img width=15px src="twlibs/img/google.png"></a>'; $external_link="<a href=http://google.com/webhp?#q=".urlencode('"'.utf8_decode($row['data']).'"')." target=blank>".' <img width=15px src="'.$our_libs_root.'/img/google.png"></a>';
$output.="<li title='".$score."'>"; $output.="<li title='".$score."'>";
$output.=$external_link.imagestar($score,$factor,$twjs).' '; $output.=$external_link.imagestar($score,$factor,$our_libs_root).' ';
$output.='<a href="JavaScript:newPopup(\''.$twjs.'default_doc_details2.php?gexf='.urlencode($gexf).'&query='.urlencode($query).'&type='.urlencode($_GET["type"]).'&id='.$id.' \')">'.htmlentities($row['data'], ENT_QUOTES, "UTF-8")." </a> "; $output.='<a href="JavaScript:newPopup(\''.$our_php_root.'default_doc_details2.php?gexf='.urlencode($gexf).'&query='.urlencode($query).'&type='.urlencode($_GET["type"]).'&id='.$id.' \')">'.htmlentities($row['data'], ENT_QUOTES, "UTF-8")." </a> ";
// $output.='<a>'.htmlentities($row['data'], ENT_QUOTES, "UTF-8")." </a> "; // $output.='<a>'.htmlentities($row['data'], ENT_QUOTES, "UTF-8")." </a> ";
} }
$sql = 'SELECT data FROM ISIDOI WHERE id='.$id.' group by data'; $sql = 'SELECT data FROM ISIDOI WHERE id='.$id.' group by data';
foreach ($base->query($sql) as $row) { foreach ($base->query($sql) as $row) {
$output.=$external_link.imagestar($score,$factor,$twjs).' '; $output.=$external_link.imagestar($score,$factor,$our_libs_root).' ';
$output.='<a href="JavaScript:newPopup(\''.$twjs.'default_doc_details2.php?gexf='.urlencode($gexf).'&query='.urlencode($query).'&type='.urlencode($_GET["type"]).'&id='.$id.' \')">'.htmlentities($row['data'], ENT_QUOTES, "UTF-8")." </a> "; $output.='<a href="JavaScript:newPopup(\''.$our_php_root.'default_doc_details2.php?gexf='.urlencode($gexf).'&query='.urlencode($query).'&type='.urlencode($_GET["type"]).'&id='.$id.' \')">'.htmlentities($row['data'], ENT_QUOTES, "UTF-8")." </a> ";
} // get the authors } // get the authors
$sql2 = 'SELECT data FROM ISIAUTHOR WHERE id='.$id. ' group by data'; $sql2 = 'SELECT data FROM ISIAUTHOR WHERE id='.$id. ' group by data';
foreach ($base->query($sql2) as $row2) { foreach ($base->query($sql2) as $row2) {
$output.=(str_replace("\r", "", $row2['data'])).', '; $output.=(str_replace("\r", "", $row2['data'])).', ';
} }
$output = rtrim($output, ", "); $output = rtrim($output, ", ");
$output.="</li><br>"; $output.="</li><br>";
} }
} }
...@@ -154,10 +153,10 @@ function getDB ($directory) { ...@@ -154,10 +153,10 @@ function getDB ($directory) {
$result = ""; $result = "";
$handler = opendir($directory); $handler = opendir($directory);
while ($file = readdir($handler)) { while ($file = readdir($handler)) {
if ($file != "." && $file != ".." if ($file != "." && $file != ".."
&& &&
((strpos($file,'.db~'))==false && (strpos($file,'.db'))==true ) ((strpos($file,'.db~'))==false && (strpos($file,'.db'))==true )
|| ||
((strpos($file,'.sqlite~'))==false && (strpos($file,'.sqlite'))==true) ((strpos($file,'.sqlite~'))==false && (strpos($file,'.sqlite'))==true)
) { ) {
//$results[] = $file; //$results[] = $file;
...@@ -170,19 +169,4 @@ function getDB ($directory) { ...@@ -170,19 +169,4 @@ function getDB ($directory) {
return $result; return $result;
} }
function imagestar($score,$factor,$twjs) {
// produit le html des images de score
$star_image = '';
if ($score > .5) {
$star_image = '';
for ($s = 0; $s < min(5,$score/$factor); $s++) {
$star_image.='<img src="twlibs/img/star.gif" border="0" >';
}
} else {
$star_image.='<img src="twlibs/img/stargrey.gif" border="0">';
}
return $star_image;
}
?> ?>
...@@ -117,11 +117,16 @@ ...@@ -117,11 +117,16 @@
.zoombarbuttons { .zoombarbuttons {
position:relative; /* b/c they can contain absolute wait icon */ position:relative; /* b/c they can contain absolute wait icon */
width:100%;
height:100%;
} }
.zoombarbuttons:hover { .zoombarbuttons:hover {
opacity: .7; opacity: .7;
} }
/*.zoombarbuttons:hover > img {
box-shadow: 0px 0px 1px 3px #033;
}*/
#zoomMinusButton, #zoomPlusButton { #zoomMinusButton, #zoomPlusButton {
display: block; display: block;
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
bottom: 0; bottom: 0;
height: 25%; height: 25%;
width: 100%; width: 100%;
background-color: #CCC; background-color: #BBB;
} }
#topPapers { #topPapers {
......
...@@ -94,7 +94,7 @@ html.waiting { ...@@ -94,7 +94,7 @@ html.waiting {
} }
#defaultop #searchnav { #defaultop #searchnav {
padding-left: 40px; padding-left: 30px;
} }
#defaultop .my-nav-input-group { #defaultop .my-nav-input-group {
width: 2vw !important; width: 2vw !important;
...@@ -118,6 +118,8 @@ html.waiting { ...@@ -118,6 +118,8 @@ html.waiting {
#defaultop .slider-legend { #defaultop .slider-legend {
margin: 10px 0 0 0 ; margin: 10px 0 0 0 ;
} }
#defaultop .settingslider { #defaultop .settingslider {
max-width: 90px !important; max-width: 90px !important;
display: inline-block ; display: inline-block ;
...@@ -135,6 +137,10 @@ html.waiting { ...@@ -135,6 +137,10 @@ html.waiting {
line-height: 12px; line-height: 12px;
} }
#left {
max-width:
}
/* override navbar toggle on right side when collapsed */ /* override navbar toggle on right side when collapsed */
#toolbar-open { #toolbar-open {
float:left !important; float:left !important;
...@@ -143,8 +149,8 @@ html.waiting { ...@@ -143,8 +149,8 @@ html.waiting {
/* right info panel */ /* right info panel */
#accordion { #varinfos-accordion {
display:none display:block;
} }
/* VARIAE */ /* VARIAE */
...@@ -178,7 +184,9 @@ html.waiting { ...@@ -178,7 +184,9 @@ html.waiting {
.searchhit { .searchhit {
font-family: "Roboto", "Droid Sans", sans-serif; font-family: "Roboto", "Droid Sans", sans-serif;
border: 1px solid #222; border: 1px solid #888;
border-radius: 7px;
background-color: #FFF;
padding: 7px 0 7px 12px; padding: 7px 0 7px 12px;
margin: 10px 10px 0 0; margin: 10px 10px 0 0;
} }
...@@ -188,22 +196,11 @@ html.waiting { ...@@ -188,22 +196,11 @@ html.waiting {
font-family: "Crete Round", "garamond", serif ; font-family: "Crete Round", "garamond", serif ;
padding: 5px; padding: 5px;
} }
.hit-keywords {
#tab-container { color: #000;
margin: 7px; font-style: italic;
} font-family: "Crete Round", "garamond", serif ;
padding: 5px;
#topPapers{
display: none;
margin: 7px;
padding: 10px 0px 10px 10px;
border-style:solid;
background-color:white;
color:black;
border: 1px solid #666;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
-border-radius: 3px;
} }
/* small messages */ /* small messages */
...@@ -216,21 +213,10 @@ p.micromessage{ ...@@ -216,21 +213,10 @@ p.micromessage{
font-weight: bold; font-weight: bold;
} }
/* Example Styles for Demo */
.etabs { margin: 0; padding: 0; line-height: 15px;}
.tab { display: inline-block; zoom:1; *display:inline; background: #eee; border: solid 1px #999; border-bottom: none; -moz-border-radius: 4px 4px 0 0; -webkit-border-radius: 4px 4px 0 0; }
.tab a { font-size: 12px; line-height: 15px; display: block; padding: 0 5px 2px 5px; outline: none; }
.tab a:hover { text-decoration: underline; }
.tab.active { background: #fff; padding-top: 6px; position: relative; top: 1px; border-color: #666; }
.tab a.active { font-weight: bold; }
.tab-container .panel-container { background: #fff; border: solid #666 1px; padding: 10px; -moz-border-radius: 0 4px 4px 4px; -webkit-border-radius: 0 4px 4px 4px; }
.panel-container { margin-bottom: 10px; }
/* SIDEBAR CONTENT */ /* SIDEBAR CONTENT */
#sidebar { #sidebar {
padding: 5px 0 0 5px; padding: 5px 0 0 5px;
} }
...@@ -253,7 +239,7 @@ p.micromessage{ ...@@ -253,7 +239,7 @@ p.micromessage{
#localInput { #localInput {
font-size: 80%; font-size: 80%;
padding: 10px; height: 0; /* before activation if explorerjs.html run locally */
} }
#localgraphfile { #localgraphfile {
...@@ -288,8 +274,71 @@ p.micromessage{ ...@@ -288,8 +274,71 @@ p.micromessage{
ul.infoitems { ul.infoitems {
list-style: none; list-style: none;
padding: 0 !important;
} }
/* etabs => easytabs (for selection)
* nav-tabs => bootstrap[-native] tabs (for reldocs)
*/
#selection-tabs-contnr, #reldocs-tabs-wrapper {
margin: 7px;
display: none; /* shown when selection */
}
.etabs{ margin: 0; padding: 0; line-height: 15px;}
.tab {
display: inline-block; zoom:1; *display:inline; background: #eee; border: solid 1px #999; border-bottom: none; -moz-border-radius: 4px 4px 0 0; -webkit-border-radius: 4px 4px 0 0; }
.tab a { font-size: 12px; line-height: 15px; display: block; padding: 0 5px 2px 5px; outline: none; }
.tab a:hover { text-decoration: underline; }
.tab.active { background: #fff; padding-top: 6px; position: relative; top: 1px; border-color: #666; }
.tab a.active { font-weight: bold; }
.selection-tabs-contnr .panel-container { background: #fff; border: solid #666 1px; padding: 10px; -moz-border-radius: 0 4px 4px 4px; -webkit-border-radius: 0 4px 4px 4px; }
.panel-container { margin-bottom: 10px; }
.tab-content {
padding: 10px;
border: 1px solid #555;
border-radius: 0 4px 4px 4px;
background-color: #BBB;
display: block;
}
.nav-tabs > li > a,
.nav-tabs > li:hover > a {
margin-bottom: -1px;
padding: 4px 7px;
border-top: 1px solid rgb(204, 204, 204);
border-left: 1px solid rgb(204, 204, 204);
border-right: 1px solid rgb(204, 204, 204);
}
.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus {
color: white !important;
background-color: #3E6280;
border-top: 1px solid #222;
border-left: 1px solid #222;
border-right: 1px solid #222;
}
#topPapers{
display: none;
color:black;
}
/* switch css -- generic (src: proto.io/freebies/onoff/)*/ /* switch css -- generic (src: proto.io/freebies/onoff/)*/
.onoffswitch { .onoffswitch {
position: relative; width: 38px; position: relative; width: 38px;
......
<li class="searchhit" title='$${score}'>
<a href="$${link}">$${tit}</a> <span class="author">$${au}</span>
</li>
<li class="searchhit" title="$${score}">
<p>
<a href="$${link}"><b>$${tit}</b></a>
by
<span class="author">$${au}</span>
,
<i>$${src}</i>
[$${date}]
</p>
<p>
<span class="hit-keywords">
$${kws}
</span>
<span class="hit-text">
$${txt}
</span>
</p>
</li>
blockquote.Tweet { blockquote.Tweet {
display: inline-block !important; display: inline-block !important;
background-color: #FFF;
font-family: Roboto, "Helvetica Neue", "Segoe UI", Calibri, sans-serif !important; font-family: Roboto, "Helvetica Neue", "Segoe UI", Calibri, sans-serif !important;
font-size: 12px !important; font-size: 12px !important;
font-weight: bold !important; font-weight: bold !important;
line-height: 16px !important; line-height: 14px !important;
border-color: #eee #ddd #bbb !important; border-color: #eee #ddd #bbb !important;
border-radius: 5px !important; border-radius: 5px !important;
border-style: solid !important; border-style: solid !important;
border-width: 1px !important; border-width: 1px !important;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) !important; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) !important;
margin: 10px 5px !important; margin: 10px 5px !important;
padding: 0 16px 16px 16px !important; padding: 8px 16px !important;
min-width: 330px !important; min-width: 330px !important;
width: 330px !important; width: 330px !important;
max-width: 330px !important; max-width: 330px !important;
} }
p.Tweet-text { p.Tweet-text {
font-size: 16px !important; padding: .4em 0 0 0 !important;
margin-bottom: -1em !important;
font-size: 12px !important;
font-weight: normal !important; font-weight: normal !important;
line-height: 20px !important; line-height: 16px !important;
min-height: 90px !important; min-height: 70px !important;
} }
blockquote.Tweet a { blockquote.Tweet a {
...@@ -32,7 +35,8 @@ blockquote.Tweet a { ...@@ -32,7 +35,8 @@ blockquote.Tweet a {
blockquote.Tweet a:hover, blockquote.Tweet a:hover,
blockquote.Tweet a:focus { blockquote.Tweet a:focus {
text-decoration: underline !important; /*text-decoration: underline !important;*/
text-decoration: none !important;
} }
.Tweet-metadata { .Tweet-metadata {
...@@ -41,3 +45,7 @@ blockquote.Tweet a:focus { ...@@ -41,3 +45,7 @@ blockquote.Tweet a:focus {
.Tweet-authorScreenName { .Tweet-authorScreenName {
font-size: .9em; font-size: .9em;
} }
.Tweet-actions {
padding-left: .5em;
}
This diff is collapsed.
This diff is collapsed.
...@@ -381,11 +381,59 @@ var TinaWebJS = function ( sigmacanvas ) { ...@@ -381,11 +381,59 @@ var TinaWebJS = function ( sigmacanvas ) {
} }
} }
$('#tab-container').easytabs({ // initialize selection tabs (POSS: swap from easytabs lib to bs-native)
$('#selection-tabs-contnr').easytabs({
updateHash:false, updateHash:false,
defaultTab: 'li#tabneigh' defaultTab: 'li#tabneigh'
}); });
// initialize reldocs tabs
if (TW.conf.getRelatedDocs) {
// POSSible: create them on a settings list (currently in the HTML)
let ul = document.getElementById('reldocs-tabs')
let tabEls = []
for (var possibleAPI in TW.conf.relatedDocsAPIS) {
// create valid tabs
let newLi = document.createElement('li')
newLi.setAttribute("role", "presentation")
let newRDTab = document.createElement('a')
newRDTab.text = possibleAPI
newRDTab.href = '#topPapers'
newRDTab.setAttribute("role", "tab")
newRDTab.dataset.toggle = 'tab'
newRDTab.dataset.reldocstype = possibleAPI
if (possibleAPI == TW.conf.relatedDocsType) {
newLi.setAttribute("class", "active")
}
// add to DOM
ul.append(newLi)
newLi.append(newRDTab)
// keep access
TW.gui.reldocTabs[possibleAPI] = newRDTab
}
// afterwards to get all types and the active type
for (let rdtype in TW.gui.reldocTabs) {
let tab = TW.gui.reldocTabs[rdtype]
// init toggle mecanisms (bootstrap.native/#componentTab)
// (just used for the tabs active/inactive handling,
// content is *always* topPapers and we modify it ourselves)
new Tab(tab);
// add handler to switch relatedDocsType
tab.addEventListener('click', function(){
TW.conf.relatedDocsType = this.dataset.reldocstype
getTopPapers()
})
}
}
// show any already existing panel // show any already existing panel
document.getElementById("graph-panels").style.display = "block" document.getElementById("graph-panels").style.display = "block"
...@@ -715,17 +763,15 @@ var TinaWebJS = function ( sigmacanvas ) { ...@@ -715,17 +763,15 @@ var TinaWebJS = function ( sigmacanvas ) {
} }
}) })
if (TW.conf.getRelatedDocs && document.getElementById('reldocs-type')) { // select currently preferred reldoc tab
document.getElementById('reldocs-type').value = TW.conf.relatedDocsType if (TW.conf.getRelatedDocs && document.getElementById('reldocs-tabs')) {
TW.gui.reldocTabs[TW.conf.relatedDocsType].Tab.show()
} }
$("#tips").html(getTips()); $("#tips").html(getTips());
// a bit costly, TODO make conditional or deprecated // we start with no selection
// showMeSomeLabels(6); $("#selection-tabs-contnr").hide();
// updateDownNodeEvent(false);
// #saveAs => toggle #savemodal initialized in html + bootstrap-native // #saveAs => toggle #savemodal initialized in html + bootstrap-native
...@@ -1072,15 +1118,6 @@ var TinaWebJS = function ( sigmacanvas ) { ...@@ -1072,15 +1118,6 @@ var TinaWebJS = function ( sigmacanvas ) {
} }
}); });
if (TW.conf.getRelatedDocs) {
let reldocsEls = document.querySelectorAll('.reldocs')
for (var k in reldocsEls) {
if (reldocsEls[k].style) {
reldocsEls[k].style.display = 'block'
}
}
}
if (TW.conf.filterSliders) { if (TW.conf.filterSliders) {
// the indice of the first cat to be active (ex: '1') // the indice of the first cat to be active (ex: '1')
......
...@@ -24,6 +24,7 @@ TW.gui.foldedSide=false; ...@@ -24,6 +24,7 @@ TW.gui.foldedSide=false;
TW.gui.manuallyChecked = false; TW.gui.manuallyChecked = false;
TW.gui.handpickedcolor = false; // <= changes edge rendering strategy TW.gui.handpickedcolor = false; // <= changes edge rendering strategy
TW.gui.lastFilters = {} TW.gui.lastFilters = {}
TW.gui.reldocTabs = []
TW.gui.sizeRatios = [1,1] // sizeRatios per nodetype TW.gui.sizeRatios = [1,1] // sizeRatios per nodetype
......
...@@ -373,12 +373,12 @@ function getTopPapers(){ ...@@ -373,12 +373,12 @@ function getTopPapers(){
topPapersFetcher( topPapersFetcher(
swNodetypes[0], swNodetypes[0],
qWordsbySwType[swNodetypes[0]], qWordsbySwType[swNodetypes[0]],
`<h2>${swNodetypes[0]}</h2>`, [[],[]],
function(enrichedHtml) { function(priorJsonHits) {
topPapersFetcher( topPapersFetcher(
swNodetypes[1], swNodetypes[1],
qWordsbySwType[swNodetypes[1]], qWordsbySwType[swNodetypes[1]],
enrichedHtml+`<p class=centered>---</p><h2>${swNodetypes[1]}</h2>`, priorJsonHits,
displayTopPapers displayTopPapers
) )
} }
...@@ -396,31 +396,30 @@ function getTopPapers(){ ...@@ -396,31 +396,30 @@ function getTopPapers(){
// - cbNext is a partial function to handle the follow-up // - cbNext is a partial function to handle the follow-up
// (just pass it resHTML, to continue enriching or display) // (just pass it resHTML, to continue enriching or display)
// //
function topPapersFetcher(swType, qWords, priorHtml, cbNext){ function topPapersFetcher(swType, qWords, accumulHits, cbNext){
if (isUndef(priorHtml)) priorHtml = '' // list of json object with hit metadata (title, author, etc.) by nodetype
if (isUndef(cbNext)) cbNext = displayTopPapers if (isUndef(accumulHits)) accumulHits = [[],[]]
// callback to continue accumulating json hits or display to html
if (isUndef(cbNext)) cbNext = displayTopPapers
// introducing the modern node type thanks to updated db.json specs // introducing the modern node type thanks to updated db.json specs
let nodetype = (swType == 'semantic') ? 0 : 1 let nodetype = (swType == 'semantic') ? 0 : 1
let stockErrMsg = `<p class="micromessage">
Your settings for relatedDocsType are set on ${TW.conf.relatedDocsType}
API but it couldn't be connected to.</p>`
if (TW.conf.relatedDocsType == "api") {
stockErrMsg += `<p class="micromessage">Check if it is running and
accessible:<br><span class=code>${TW.conf.relatedDocsAPI}</span></p>`
}
let resHTML = ''
let apiurl = TW.conf.relatedDocsAPIS[TW.conf.relatedDocsType] let apiurl = TW.conf.relatedDocsAPIS[TW.conf.relatedDocsType]
if (! apiurl) { if (! apiurl) {
apiurl = TW.conf.relatedDocsAPI apiurl = TW.conf.relatedDocsAPI
} }
let stockErrMsg = `
<p class="micromessage">The API ${TW.conf.relatedDocsType} couldn't be connected to.</p>
<p class="micromessage">The queried route found in TW.conf was: <span class=code>${apiurl}</span>
<br>Check if it is running and accessible.</p>`
let resHTML = ''
if (TW.conf.relatedDocsType == "twitter") { if (TW.conf.relatedDocsType == "twitter") {
let joinedQ = qWords.map(function(w){return'('+w+')'}).join(' AND ') let joinedQ = qWords.map(function(w){return'('+w+')'}).join(' AND ')
$.ajax({ $.ajax({
...@@ -430,34 +429,37 @@ function topPapersFetcher(swType, qWords, priorHtml, cbNext){ ...@@ -430,34 +429,37 @@ function topPapersFetcher(swType, qWords, priorHtml, cbNext){
contentType: "application/json", contentType: "application/json",
success : function(data){ success : function(data){
if (data.length) { if (data.length) {
for (var k in data) { accumulHits[nodetype] = accumulHits[nodetype].concat(data)
let tweetJson = data[k]
resHTML += renderTweet(tweetJson)
}
} }
else { else {
resHTML += `<p class="micromessage centered">The query accumulHits[nodetype].push({
<span class=code>${joinedQ}</span> delivers "error": `<p class="micromessage centered">The query
no results on Twitter.</p>` <span class=code>${joinedQ}</span> delivers
no results on Twitter.</p>`
})
} }
cbNext(priorHtml + resHTML) cbNext(accumulHits)
}, },
error: function(){ error: function(){
console.log(`Not found: relatedDocs for ${apiurl}`) console.log(`Not found: relatedDocs for ${apiurl}`)
cbNext(priorHtml + stockErrMsg) accumulHits[nodetype].push({
"error": stockErrMsg
})
cbNext(accumulHits)
} }
}); });
} }
else if (TW.conf.relatedDocsType == "LocalDB") { else if (TW.conf.relatedDocsType == "LocalDB") {
let thisRelDocsConf = TW.gmenuInfos[TW.File][nodetype] let thisRelDocsConf = TW.gmenuInfos[TW.File][nodetype]
if (!thisRelDocsConf) { if (!thisRelDocsConf) {
resHTML = accumulHits[nodetype].push({
`<p>Your settings for relatedDocsType are set on a local database, "error": `<p>Your settings for relatedDocsType are set on a local database,
but your servermenu file does not provide any information about but your servermenu file does not provide any information about
the CSV or DB table to query for related documents the CSV or DB table to query for related documents
(on nodetype ${nodetype}: ${swType})</p>` (on nodetype ${nodetype}: ${swType})</p>`
cbNext(priorHtml + resHTML) })
return cbNext(accumulHits)
return
} }
else { else {
// /!\ documentation and specification needed for the php use cases /!\ // /!\ documentation and specification needed for the php use cases /!\
...@@ -468,53 +470,101 @@ function topPapersFetcher(swType, qWords, priorHtml, cbNext){ ...@@ -468,53 +470,101 @@ function topPapersFetcher(swType, qWords, priorHtml, cbNext){
// or 'csv' (like gargantext exports) // or 'csv' (like gargantext exports)
// POSS object + join.map(join) // POSS object + join.map(join)
let urlParams = "type="+swType+"&query="+joinedQ+"&gexf="+TW.File+"&n="+TW.conf.relatedDocsMax+"&dbtype="+thisRelDocsConf.reldbtype let urlParams = "type="+swType+"&query="+joinedQ+"&gexf="+TW.File+"&n="+TW.conf.relatedDocsMax ;
if (thisRelDocsConf.reldbtype == "CortextDB") {
var qIndex = thisRelDocsConf.reldbtable // a table
urlParams += `&index=${qIndex}`
}
else {
// a list of csv columns to search in
// ex: for semantic nodes matching we look in 'title', 'keywords' cols
// for social nodes matching we look in 'authors' col... etc.
let joinedSearchCols = JSON.stringify(thisRelDocsConf.reldbqcols)
urlParams += `&searchin=${joinedSearchCols}`
// HIGHER LEVEL SCOPE (whole indexation directive) WILL BE MOVED TO PHP
let allCols = {}
if (TW.gmenuInfos[TW.File][0])
allCols.semantic = TW.gmenuInfos[TW.File][0].reldbqcols
if (TW.gmenuInfos[TW.File][1])
allCols.social = TW.gmenuInfos[TW.File][1].reldbqcols
let joinedAllCols = JSON.stringify(allCols)
urlParams += `&toindex=${joinedAllCols}`
// POSS use a direct access from php to db.json to avoid toindex
}
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
url: apiurl + '/info_div.php', url: apiurl + '/info_div.php',
data: urlParams, data: urlParams,
contentType: "application/json",
success : function(data){ success : function(data){
console.log(`relatedDocs: ${apiurl}/info_div.php?${urlParams}`); if (data.hits) {
resHTML = data accumulHits[nodetype] = accumulHits[nodetype].concat(data.hits)
cbNext(priorHtml + resHTML) }
cbNext(accumulHits)
}, },
error: function(){ error: function(){
console.log(`Not found: relatedDocs for ${apiurl}`) console.log(`Not found: relatedDocs for ${apiurl}`)
cbNext(priorHtml + stockErrMsg) accumulHits[nodetype].push({
"error": stockErrMsg
})
cbNext(accumulHits)
} }
}); });
} }
} }
} }
function displayTopPapers(enrichedHtml) { function makeRendererFromTemplate(tmplName) {
$("#topPapers").html(enrichedHtml); let tmplURL = TW.conf.paths.templates + '/' + tmplName + '.html'
let gotTemplate = AjaxSync({ url: tmplURL });
var tmplStr = ''
if (gotTemplate['OK']) {
tmplStr = gotTemplate.data
}
// we return a customized renderJsonToHtml function
return function(jsonHit) {
let htmlOut = tmplStr
for (key in jsonHit) {
// our tags look like this in the template ====> by $${author}, [$${date}]
let reKey = new RegExp('\\$\\$\\{'+key+'\\}', 'g')
// we replace them by value
htmlOut = htmlOut.replace(reKey, jsonHit[key])
}
// we also replace any not found keys by 'N/A'
let reKeyAll = new RegExp('\\$\\$\\{[^\\}]+\\}', 'g')
htmlOut = htmlOut.replace(reKeyAll, "N/A")
return htmlOut
}
}
function displayTopPapers(jsonHits) {
// console.log('jsonHits', jsonHits)
let resHTML = '<ul class="infoitems">'
let toHtmlFun = function(){}
for (var ndtypeId in TW.categories) {
if (TW.conf.relatedDocsType == 'twitter') {
toHtmlFun = renderTweet
}
else {
let thisRelDocsConf = TW.gmenuInfos[TW.File][ndtypeId]
if (thisRelDocsConf && thisRelDocsConf.reltemplate) {
// console.log("my rendering hits template", thisRelDocsConf.reltemplate)
toHtmlFun = makeRendererFromTemplate(thisRelDocsConf.reltemplate)
}
else {
console.warn(`no rendering template found in ${TW.conf.paths.sourceMenu} for this source ${TW.File}...`)
// try the universal template
toHtmlFun = makeRendererFromTemplate("universal")
}
}
// console.log("my rendering fun", toHtmlFun)
for (var k in jsonHits[ndtypeId]) {
let hitJson = jsonHits[ndtypeId][k]
if (hitJson.error) {
resHTML += hitJson.error
}
else {
resHTML += toHtmlFun(hitJson)
}
}
}
resHTML += '</ul>'
// effect the changes in topPapers
$("#topPapers").html(resHTML);
} }
function newPopup(url) { function newPopup(url) {
...@@ -687,8 +737,6 @@ function renderTweet( tweet) { ...@@ -687,8 +737,6 @@ function renderTweet( tweet) {
} }
function getTips(){ function getTips(){
param='';
text = text =
"<br>"+ "<br>"+
"Basic Interactions:"+ "Basic Interactions:"+
...@@ -710,9 +758,6 @@ function getTips(){ ...@@ -710,9 +758,6 @@ function getTips(){
"<li>The 'change level' button allows to change between global view and node centered view,</li>"+ "<li>The 'change level' button allows to change between global view and node centered view,</li>"+
"<li>To explore the neighborhood of a selection click on the 'change level' button.</li>"+ "<li>To explore the neighborhood of a selection click on the 'change level' button.</li>"+
"</ul>"; "</ul>";
$("#tab-container").hide();
$("#tab-container-top").hide();
return text; return text;
} }
......
...@@ -79,6 +79,8 @@ if (window.location.protocol == 'file:' || sourcemode == 'localfile') { ...@@ -79,6 +79,8 @@ if (window.location.protocol == 'file:' || sourcemode == 'localfile') {
remark.classList.add('comment') remark.classList.add('comment')
remark.classList.add('centered') remark.classList.add('centered')
inputDiv.appendChild(remark) inputDiv.appendChild(remark)
inputDiv.style.height = "auto";
inputDiv.style.padding = "10px";
} }
// user can open a gexf or json from his fs // user can open a gexf or json from his fs
...@@ -215,7 +217,7 @@ function syncRemoteGraphData () { ...@@ -215,7 +217,7 @@ function syncRemoteGraphData () {
// cases (2) and (3) : we'll read a file from server // cases (2) and (3) : we'll read a file from server
// sourcemode == "serverfile" or "servermenu" (several files with <select>) // sourcemode == "serverfile" or "servermenu" (several files with <select>)
else { else {
console.log("input case: server-side file, using TW.conf.sourceMenu or getUrlParam.file or TW.conf.sourceFile") console.log("input case: server-side file, using TW.conf.paths.sourceMenu or getUrlParam.file or TW.conf.paths.sourceFile")
// -> @mode is servermenu, files are listed in db.json file (preRes ajax) // -> @mode is servermenu, files are listed in db.json file (preRes ajax)
// --> if @file also in url, choose the db.json one matching // --> if @file also in url, choose the db.json one matching
...@@ -223,13 +225,13 @@ function syncRemoteGraphData () { ...@@ -223,13 +225,13 @@ function syncRemoteGraphData () {
// -> @mode is serverfile // -> @mode is serverfile
// -> gexf file path is in the urlparam @file // -> gexf file path is in the urlparam @file
// -> gexf file path is already specified in TW.conf.sourceFile // -> gexf file path is already specified in TW.conf.paths.sourceFile
// menufile case : a list of source files in ./db.json // menufile case : a list of source files in ./db.json
if (sourcemode == 'servermenu') { if (sourcemode == 'servermenu') {
console.log("reading from FILEMENU TW.conf.sourceMenu") console.log("reading from FILEMENU TW.conf.paths.sourceMenu")
// we'll first retrieve the menu of available files in db.json, then get the real data in a second ajax // we'll first retrieve the menu of available files in db.json, then get the real data in a second ajax
var infofile = TW.conf.sourceMenu var infofile = TW.conf.paths.sourceMenu
if (TW.conf.debug.logFetchers) console.info(`attempting to load filemenu ${infofile}`) if (TW.conf.debug.logFetchers) console.info(`attempting to load filemenu ${infofile}`)
var preRES = AjaxSync({ url: infofile, datatype:"json" }); var preRES = AjaxSync({ url: infofile, datatype:"json" });
...@@ -307,12 +309,12 @@ function syncRemoteGraphData () { ...@@ -307,12 +309,12 @@ function syncRemoteGraphData () {
TW.File = getUrlParam.file TW.File = getUrlParam.file
} }
// direct file fallback case: specified file in settings_explorer // direct file fallback case: specified file in settings_explorer
else if (TW.conf.sourceFile && linkCheck(TW.conf.sourceFile)) { else if (TW.conf.paths.sourceFile && linkCheck(TW.conf.paths.sourceFile)) {
console.log("no @file arg: trying TW.conf.sourceFile from settings") console.log("no @file arg: trying TW.conf.sourceFile from settings")
TW.File = TW.conf.sourceFile; TW.File = TW.conf.paths.sourceFile;
} }
else { else {
console.error(`No specified input and neither db.json nor TW.conf.sourceFile ${TW.conf.sourceFile} are present`) console.error(`No specified input and neither db.json nor TW.conf.paths.sourceFile ${TW.conf.paths.sourceFile} are present`)
} }
var finalRes = AjaxSync({ url: TW.File }); var finalRes = AjaxSync({ url: TW.File });
......
...@@ -122,14 +122,17 @@ function cancelSelection (fromTagCloud, settings) { ...@@ -122,14 +122,17 @@ function cancelSelection (fromTagCloud, settings) {
// hide all selection panels // hide all selection panels
if(fromTagCloud==false){ if(fromTagCloud==false){
// £TODO give them all a common class
$("#names").html(""); $("#names").html("");
$("#topPapers").html(""); $("#topPapers").hide(); $("#topPapers").html("");
$("#opossiteNodes").html(""); $("#tab-container").hide(); $("#topPapers").hide();
$("#oppositeNodes").html("");
$("#selection-tabs-contnr").hide();
$("#reldocs-tabs-wrapper").hide();
$("#information").html(""); $("#information").html("");
$("#searchinput").val(""); $("#searchinput").val("");
$("#unselectbutton").hide(); $("#unselectbutton").hide();
$("#lefttopbox").hide(); $("#lefttopbox").hide();
$("#tips").html(getTips());
} }
// send "eraseNodeSet" event // send "eraseNodeSet" event
...@@ -430,21 +433,22 @@ function updateRelatedNodesPanel( sels , same, oppos ) { ...@@ -430,21 +433,22 @@ function updateRelatedNodesPanel( sels , same, oppos ) {
//using the readmore.js (NB readmore and easytabs are not easy to harmonize) //using the readmore.js (NB readmore and easytabs are not easy to harmonize)
$("#lefttopbox").show(); $("#lefttopbox").show();
$("#tab-container").show(); $("#selection-tabs-contnr").show();
$("#names").html(namesDIV).readmore({maxHeight:100}); $("#names").html(namesDIV).readmore({maxHeight:100});
if(oppos.length>0) { if(oppos.length>0) {
$("#oppositeNodes").html(alterNodesDIV).readmore({maxHeight:200}); $("#oppositeNodes").html(alterNodesDIV).readmore({maxHeight:200});
} }
$("#sameNodes").html(sameNodesDIV).readmore({maxHeight:200}); $("#sameNodes").html(sameNodesDIV).readmore({maxHeight:200});
$("#information").html(informationDIV); $("#information").html(informationDIV);
$("#tips").html("");
if (TW.conf.getRelatedDocs) { if (TW.conf.getRelatedDocs) {
$("#reldocs-tabs-wrapper").show();
$("#topPapers").show(); $("#topPapers").show();
getTopPapers() getTopPapers()
} }
else { else {
$("#topPapers").hide() $("#topPapers").hide()
$("#reldocs-tabs-wrapper").hide();
} }
} }
......
...@@ -565,12 +565,7 @@ var SigmaUtils = function () { ...@@ -565,12 +565,7 @@ var SigmaUtils = function () {
else { else {
if ((TW.conf.fa2Enabled || args.manual) if ((TW.conf.fa2Enabled || args.manual)
&& TW.partialGraph.graph.nNodes() >= TW.conf.minNodesForAutoFA2) { && TW.partialGraph.graph.nNodes() >= TW.conf.minNodesForAutoFA2) {
setTimeout(function(){ setTimeout(function(){sigma_utils.ourStopFA2()},args.duration)
// NB in here scope: 'this' is the window
if (TW.partialGraph.isForceAtlas2Running())
sigma_utils.ourStopFA2()
},
args.duration)
// hide edges during work for smaller cpu load // hide edges during work for smaller cpu load
if (TW.partialGraph.settings('drawEdges')) { if (TW.partialGraph.settings('drawEdges')) {
......
...@@ -19,12 +19,6 @@ TW.conf = (function(TW){ ...@@ -19,12 +19,6 @@ TW.conf = (function(TW){
// the graph input depends on TWConf.sourcemode (or manual url arg 'sourcemode') // the graph input depends on TWConf.sourcemode (or manual url arg 'sourcemode')
TWConf.sourcemode = "api" // accepted: "api" | "serverfile" | "servermenu" | "localfile" TWConf.sourcemode = "api" // accepted: "api" | "serverfile" | "servermenu" | "localfile"
// server-side .gexf|.json default source
TWConf.sourceFile = ""
// ...or server-side gexf default source list
TWConf.sourceMenu = "db.json"
// ...or remote bridge to default source api ajax queries // ...or remote bridge to default source api ajax queries
TWConf.sourceAPI={}; TWConf.sourceAPI={};
TWConf.sourceAPI["forNormalQuery"] = "services/api/graph"; TWConf.sourceAPI["forNormalQuery"] = "services/api/graph";
...@@ -47,7 +41,7 @@ TW.conf = (function(TW){ ...@@ -47,7 +41,7 @@ TW.conf = (function(TW){
} }
// fallback topPapers API if none found by type // fallback topPapers API if none found by type
TWConf.relatedDocsAPI = "twbackends/phpAPI" TWConf.relatedDocsAPI = "http://127.0.0.1:5000/twitter_search"
// ======================= // =======================
// DATA FACETS AND LEGENDS // DATA FACETS AND LEGENDS
...@@ -114,7 +108,7 @@ TW.conf = (function(TW){ ...@@ -114,7 +108,7 @@ TW.conf = (function(TW){
'weight' : {'col': "heatmap" , 'n': 5, 'binmode': 'samerange' }, 'weight' : {'col': "heatmap" , 'n': 5, 'binmode': 'samerange' },
'Weighted Degree' : {'col': "heatmap", 'n': 8, 'binmode': 'samerange' }, 'Weighted Degree' : {'col': "heatmap", 'n': 8, 'binmode': 'samerange' },
'out-degree' : {'col': "heatmap" , 'n': 3, 'binmode': 'samepop' }, 'out-degree' : {'col': "heatmap" , 'n': 3, 'binmode': 'samepop' },
'CC' : {'col': "cluster" , 'binmode': 'off'}, 'country' : {'col': "cluster" , 'binmode': 'off'},
'ACR' : {'col': "cluster" , 'binmode': 'off'}, 'ACR' : {'col': "cluster" , 'binmode': 'off'},
'cluster_universal_index': {'col': "cluster" , 'binmode': 'off' }, 'cluster_universal_index': {'col': "cluster" , 'binmode': 'off' },
'community_orphan' : {'col': "cluster" , 'binmode': 'off' } 'community_orphan' : {'col': "cluster" , 'binmode': 'off' }
...@@ -145,9 +139,9 @@ TW.conf = (function(TW){ ...@@ -145,9 +139,9 @@ TW.conf = (function(TW){
TWConf.maxDiscreteValues = 15 TWConf.maxDiscreteValues = 15
TWConf.legendsBins = 7 TWConf.legendsBins = 7
// to normalize node sizes: (NB not very useful because tina normalizes them at display) // to normalize node sizes (larger range does increase visual size difference)
TWConf.desirableNodeSizeMin=1; TWConf.desirableNodeSizeMin=1;
TWConf.desirableNodeSizeMax=2; TWConf.desirableNodeSizeMax=10;
// ============= // =============
...@@ -164,8 +158,12 @@ TW.conf = (function(TW){ ...@@ -164,8 +158,12 @@ TW.conf = (function(TW){
// Modules path // Modules path
// ------------ // ------------
TWConf.paths = { TWConf.paths = {
'ourlibs': 'static/tinawebJS/twlibs', 'ourlibs': 'twlibs',
'modules': 'twmodules' 'templates': "twlibs/hit_templates",
'modules': 'twmodules',
'sourceFile': "", // server-side .gexf|.json default source
'sourceMenu': "db.json" // ...or server-side gexf default source list
} }
Object.freeze(TWConf.paths) // /!\ to prevent path modification before load Object.freeze(TWConf.paths) // /!\ to prevent path modification before load
...@@ -256,8 +254,8 @@ TW.conf = (function(TW){ ...@@ -256,8 +254,8 @@ TW.conf = (function(TW){
font: "Droid Sans", // font params font: "Droid Sans", // font params
fontStyle: "bold", fontStyle: "bold",
defaultLabelColor: '#000', // labels text color defaultLabelColor: '#000', // labels text color
labelSizeRatio: 1, // initial label size (on the slider) labelSizeRatio: 1, // label size in ratio of node size
labelThreshold: 5, // min node cam size to start showing label labelThreshold: 4, // min node cam size to start showing label
// (old tina: showLabelsIfZoom) // (old tina: showLabelsIfZoom)
// hovered nodes // hovered nodes
...@@ -272,10 +270,10 @@ TW.conf = (function(TW){ ...@@ -272,10 +270,10 @@ TW.conf = (function(TW){
twSelectedColor: "default", // "node" for a label bg like the node color, twSelectedColor: "default", // "node" for a label bg like the node color,
// "default" for note-like yellow // "default" for note-like yellow
// not selected <=> grey // not selected <=> (1-greyness)
twNodesGreyOpacity: .35, // smaller value: more grey twNodesGreyOpacity: .5, // smaller value: more grey
twBorderGreyColor: "rgba(100, 100, 100, 0.5)", twBorderGreyColor: "rgba(100, 100, 100, 0.5)",
twEdgeGreyColor: "rgba(100, 100, 100, 0.2)", twEdgeGreyColor: "rgba(100, 100, 100, 0.3)",
}; };
// NB: sigmaJsDrawingProperties are available as 'settings' in all renderers // NB: sigmaJsDrawingProperties are available as 'settings' in all renderers
// cf. https://github.com/jacomyal/sigma.js/wiki/Settings#renderers-settings // cf. https://github.com/jacomyal/sigma.js/wiki/Settings#renderers-settings
...@@ -285,7 +283,7 @@ TW.conf = (function(TW){ ...@@ -285,7 +283,7 @@ TW.conf = (function(TW){
// ----------------------------------- // -----------------------------------
// mouse captor zoom limits // mouse captor zoom limits
TWConf.zoomMin = .015625 // for zoom IN (ex: 1/64 to allow zoom x64) TWConf.zoomMin = .015625 // for zoom IN (ex: 1/64 to allow zoom x64)
TWConf.zoomMax = 2 // for zoom OUT TWConf.zoomMax = 8 // for zoom OUT
// circle selection cursor // circle selection cursor
TWConf.circleSizeMin = 0; TWConf.circleSizeMin = 0;
...@@ -302,7 +300,7 @@ TW.conf = (function(TW){ ...@@ -302,7 +300,7 @@ TW.conf = (function(TW){
// relative sizes (iff ChangeType == both nodetypes) // relative sizes (iff ChangeType == both nodetypes)
TWConf.sizeMult = []; TWConf.sizeMult = [];
TWConf.sizeMult[0] = 1.0; // ie for node type 0 (<=> sem) TWConf.sizeMult[0] = 1.0; // ie for node type 0 (<=> sem)
TWConf.sizeMult[1] = 5.0; // ie for node type 1 (<=> soc) TWConf.sizeMult[1] = 10.0; // ie for node type 1 (<=> soc)
// =========== // ===========
......
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