Commit a9183bfe authored by delanoe's avatar delanoe

Merge branch 'testing' into stable

parents 9137a6c0 e94f5c2f
......@@ -360,7 +360,7 @@ DEFAULT_N_DOCS_HAVING_NGRAM = 5
# Graph constraints to compute the graph:
# Modes: live graph generation, graph asynchronously computed or errors detected
# here are the maximum size of corpus and maplist required to compute the graph
graph_constraints = {'corpusMax' : 1001
graph_constraints = {'corpusMax' : 599
,'corpusMin' : 40
,'mapList' : 50
}
......@@ -438,7 +438,8 @@ class CorpusFacet(APIView):
# check that the hyperfield parameter makes sense
_facet_available_subfields = [
'journal', 'publication_year', 'rubrique',
'language_iso2', 'language_iso3', 'language_name'
'language_iso2', 'language_iso3', 'language_name',
'authors'
]
parameters = get_parameters(request)
......
......@@ -70,6 +70,34 @@ def docs_by_journals(request, project_id, corpus_id):
},
)
@requires_auth
def docs_by_authors(request, project_id, corpus_id):
'''
Browse authors for a given corpus
NB: javascript in page will GET counts from our api: facets?subfield=author
# TODO refactor Author && Journals_dyna_charts_and_table.js
'''
# we pass our corpus to mark it's a corpora page
corpus = cache.Node[corpus_id]
# and the project just for project.id in corpusBannerTop
project = cache.Node[project_id]
# rendered page : journals.html
return render(
template_name = 'pages/corpora/authors.html',
request = request,
context = {
'debug': settings.DEBUG,
'date': datetime.now(),
'project': project,
'corpus' : corpus,
'resourcename' : get_resource_by_name(corpus.resources()[0]),
'view': 'authors'
},
)
@requires_auth
def analytics(request, project_id, corpus_id):
authorized, user, project, corpus = _get_user_project_corpus(request, project_id, corpus_id)
......
......@@ -22,7 +22,6 @@ def home(request):
},
)
def about(request):
'''About Gargantext, its team and sponsors
'''
......@@ -39,6 +38,14 @@ def about(request):
},
)
def robots(request):
'''Robots rules
'''
return render(
template_name = 'pages/main/robots.txt',
request = request,
content_type='text/plain',
)
def maintenance(request):
'''Gargantext out of service
......
......@@ -104,16 +104,9 @@ def project(request, project_id):
# parse_extract: fileparsing -> ngram extraction -> lists
scheduled(parse_extract_indexhyperdata)(corpus.id)
return render(
template_name = 'pages/projects/wait.html',
request = request,
context = {
'user' : request.user,
'project': project,
},
)
wait = True
else:
wait = False
# corpora within this project
corpora = project.children('CORPUS', order=True).all()
......@@ -161,6 +154,25 @@ def project(request, project_id):
}
for sourcename, count in sourcename2documentscount.items()
]
if wait:
return render(
template_name = 'pages/projects/wait.html',
request = request,
context = {
'form': NewCorpusForm,
'user': request.user,
'date': datetime.now(),
'project': project,
'donut': donut,
'list_corpora': dict(sourcename2corpora),
'whitelists': [],
'blacklists': [],
'cooclists': [],
'number': len(corpora),
'query_size': QUERY_SIZE_N_DEFAULT,
},
)
# response!
return render(
template_name = 'pages/projects/project.html',
......
......@@ -10,6 +10,7 @@ urlpatterns = [
# presentation pages
url(r'^$', main.home),
url(r'^about/?$', main.about),
url(r'^robots.txt$', main.robots),
# maintenance mode
url(r'^maintenance/?$', main.maintenance),
# authentication
......@@ -25,6 +26,9 @@ urlpatterns = [
# corpus by journals
url(r'^projects/(\d+)/corpora/(\d+)/journals/?$', corpora.docs_by_journals),
# corpus by journals
url(r'^projects/(\d+)/corpora/(\d+)/authors/?$', corpora.docs_by_authors),
# terms table for the corpus
url(r'^projects/(\d+)/corpora/(\d+)/terms/?$', terms.ngramtable),
......
......@@ -151,7 +151,7 @@ def get_graph( request=None , corpus=None
, start=start , end =end
, mapList_id=mapList_id , groupList_id=groupList_id
, isMonopartite=True , threshold = threshold
, save_on_db = False
, save_on_db = True
#, limit=size
)
else:
......
This diff is collapsed.
......@@ -320,7 +320,7 @@ function Main_test( data , initial) {
// url_title = i.replace(" ","+")
var node_info = {
"id" : ID,
"name" : '<a target=_blank href="http://google.com/search?q='+url_title+'">'+i+'</a>',
"name" : '<a target=_blank href="http://search.iscpif.fr/?categories=general&q='+url_title+'">'+i+'</a>',
"score": data[i],
}
AjaxRecords.push(node_info)
......
......@@ -174,6 +174,98 @@ var tableSpan ;
var corpusesList = {}
// =============================================================================
// CACHE MANAGEMENT
// =============================================================================
/**
* a local cache to remember active filters and page after reload
* cf. saveParamsToCache()
* restoreSettingsFromCache()
*
* TODO localStorage.clear() after expiry date
*/
window.onbeforeunload = saveParamsToCache;
// always called at page close/quit
// £TODO use url instead of corpusId+'/terms' as prefix
function saveParamsToCache() {
var corpusId = getIDFromURL("corpora")
var search_filter_status = MyTable.data('dynatable').settings.dataset.queries['search']
var state_filter_status = MyTable.data('dynatable').settings.dataset.queries['my_state_filter']
var type_filter_status = MyTable.data('dynatable').settings.dataset.queries['my_termtype_filter']
// var page_status = document.getElementsByClassName("dynatable-page-link dynatable-active-page")[0].getAttribute("data-dynatable-page")
var per_page_status = MyTable.data('dynatable').settings.dataset.perPage
// keys and values are str only so we use path-like keys
if (search_filter_status) {
localStorage[corpusId+'/terms/search'] = search_filter_status
}
else {
localStorage.removeItem(corpusId+'/terms/search')
}
if (state_filter_status) {
localStorage[corpusId+'/terms/state'] = state_filter_status
}
else {
localStorage.removeItem(corpusId+'/terms/state')
}
if (type_filter_status) {
localStorage[corpusId+'/terms/type'] = type_filter_status
}
else {
localStorage.removeItem(corpusId+'/terms/type')
}
// if (page_status) {
// localStorage[corpusId+'/terms/page'] = page_status
// }
// else {
// localStorage.removeItem(corpusId+'/terms/page')
// }
if (per_page_status) {
localStorage[corpusId+'/terms/perPage'] = per_page_status
}
else {
localStorage.removeItem(corpusId+'/terms/perPage')
}
return null;
}
// always called after MyTable init
function restoreSettingsFromCache() {
var corpusId = getIDFromURL("corpora")
// var had_page = localStorage[corpusId+'/terms/page']
var had_type = localStorage[corpusId+'/terms/type']
var had_state = localStorage[corpusId+'/terms/state']
var had_search = localStorage[corpusId+'/terms/search']
var had_perPage = localStorage[corpusId+'/terms/perPage']
// if (had_page) {
// MyTable.data('dynatable').paginationPage.set(had_page);
// }
if (had_type) {
MyTable.data('dynatable').settings.dataset.queries['my_termtype_filter'] = had_type
}
if (had_state) {
MyTable.data('dynatable').settings.dataset.queries['my_state_filter'] = had_state
}
if (had_search) {
MyTable.data('dynatable').settings.dataset.queries['search'] = had_search
}
if (had_perPage) {
MyTable.data('dynatable').paginationPerPage.set(had_perPage)
}
// re-process to makes the changes visible
MyTable.data('dynatable').process()
return null;
}
// =============================================================================
// ELEMENT CONTROLLERS AND ROW PROCESSORS
// =============================================================================
......@@ -1816,6 +1908,10 @@ function GROUPCRUDS( groupnode_id , send_data, http_method , callback) {
* @param ngdata: OriginalNG['records']
* @param initial: initial score type "occs" or "tfidf"
* @param search_filter: value among {0,1,2,'reset'} (see #picklistmenu options)
*
* TODO replace by new @param filters (multiple) for all cached values
* (would allow us to use them directly in settings instead of a posteriori
* with restoreSettingsFromCache)
*/
function MainTableAndCharts( ngdata , initial , search_filter) {
......@@ -2130,8 +2226,7 @@ function MainTableAndCharts( ngdata , initial , search_filter) {
// _cellWriter: customCellWriter
},
inputs: {
queries: $('select#testquery'),
queries: $('select#picklistmenu'),
queries: $('select#picklistmenu, select#picktermtype'),
}
})
......@@ -2186,23 +2281,43 @@ function MainTableAndCharts( ngdata , initial , search_filter) {
// bind a filter named 'my_state_filter' to dynatable.queries.functions
MyTable.data('dynatable').queries
// selects on current state <=> shows only elements of specific list
// nb: possible value are in {0,1,2} (see terms.html > #picklistmenu)
// (see terms.html > #picklistmenu)
.functions['my_state_filter'] = function(record,selectedValue) {
if (selectedValue == 'reset') {
// return (AjaxRecords[record.id].state >= 0)
return true
}
// for states, possible value are in {0,1,2}
else {
// return true or false
return (AjaxRecords[record.id].state == selectedValue)
// return true or false
return (AjaxRecords[record.id].state == selectedValue)
}
}
// second filter named 'my_termtype_filter'
MyTable.data('dynatable').queries
.functions['my_termtype_filter'] = function(record,selectedValue) {
if (selectedValue == 'reset') {
return true
}
else if (selectedValue == 'mono') {
// one-word terms aka monograms aka monolexical terms
return (AjaxRecords[record.id]['name'].indexOf(" ") == -1)
}
else if (selectedValue == 'multi') {
// MWE aka multigrams aka polylexical terms
return (AjaxRecords[record.id]['name'].indexOf(" ") != -1)
}
}
// and set this filter's initial status to 'maplist' (aka state == 1)
// MyTable.data('dynatable').settings.dataset.queries['my_state_filter'] = 1 ;
// and set these filters' initial status
MyTable.data('dynatable').settings.dataset.queries['my_state_filter'] = search_filter ;
MyTable.data('dynatable').settings.dataset.queries['my_termtype_filter'] = 'reset' ;
MyTable.data('dynatable').process();
// £todo factorize with previous with a param search_filters
restoreSettingsFromCache(localStorage)
// moves pagination over table
if ( $(".imadiv").length>0 ) return 1;
$('<br><br><div class="imadiv"></div>').insertAfter(".dynatable-per-page")
......
......@@ -145,7 +145,7 @@
<!-- <script type="text/javascript" src="{% static "lib/d3/d3/d3.v2.min.js" %}"></script> -->
<script type="text/javascript" src="{% static "lib/d3/n3.line-chart.min.js" %}"></script>
<script type="text/javascript" src="{% static "lib/ng-tags//ng-tags-input.min.js" %}"></script>
<script type="text/javascript" src="{% static "lib/ng-tags/ng-tags-input.min.js" %}"></script>
<link rel="stylesheet" href="{% static "lib/ng-tags/ng-tags-input.min.css" %}">
<script type="text/javascript" src="{% static "lib/gargantext/gargantext.angular.js" %}"></script>
......
{% extends "pages/menu.html" %}
{% block css %}
{% load staticfiles %}
<link rel="stylesheet" type="text/css" href="{% static "lib/bootstrap/3.0.2/bootstrap.css" %}">
<link rel="stylesheet" type="text/css" href="{% static "lib/d3/dc.css"%}"/>
<link rel="stylesheet" type="text/css" href="{% static "lib/jquery/dynatable/jquery.dynatable.css"%}"/>
<link rel="stylesheet" type="text/css" href="{% static "lib/gargantext/tables.css"%}"/>
<link rel="stylesheet" type="text/css" href="{% static "lib/gargantext/charts.css"%}"/>
<script type="text/javascript" src="{% static "lib/d3/d3.js"%}"></script>
<script type="text/javascript" src="{% static "lib/d3/crossfilter.js"%}"></script>
<script type="text/javascript" src="{% static "lib/d3/dc.js"%}"></script>
{% endblock %}
{% block content %}
<div class="container">
<div class="col-md-3 col-md-offset-2">
<div id="monthly-move-chart">
<center>
Select a frequency group in the chart with blue bars to zoom in
<p align="center">
<!--<a class="btn btn-xs btn-default" role="button" href="/chart/corpus/{{ corpus.id }}/data.csv">Save</a>-->
<a class="btn btn-xs btn-default" href="javascript:volumeChart.filterAll();dc.redrawAll();">Reset</a></p>
<!-- <p style="font-size:70%">
<b>x</b>: amount of documents for the author
<b>y</b>: number of authors with that amount
</p> -->
<div class="clearfix"></div>
</center>
</div>
<div class="bs-callout">
<div class="row">
<div id="monthly-volume-chart"></div>
</div>
<div id="content_loader">
<br>
<center>
<!-- <img width="10%" src="{% static "img/ajax-loader.gif"%}"></img> -->
</center>
<br>
</div>
</div>
</div>
</div>
<div class="container">
<div class="jumbotron">
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="panel-title">
<center>
<span class="glyphicon glyphicon-hand-down" aria-hidden="true"></span>
Publications by source
</center>
</h2>
</div>
<div class="panel-body">
<div id="div-table">
<!-- (table id="my-ajax-table") dynamically set by Authors_dyna_chart_and_table -->
</div>
</div>
</div> <!-- /div panel -->
</div> <!-- /jumbotron -->
<!--</div> This div is closed in the menu !-->
<script type="text/javascript" src="{% static "lib/jquery/dynatable/jquery.dynatable.js" %}"></script>
<!-- custom-lib for dynatable.js and dc.js -->
<script type="text/javascript" src="{% static "lib/gargantext/Authors_dyna_chart_and_table.js" %}"></script>
{% endblock %}
......@@ -26,29 +26,39 @@
<div class="col-md-5 content">
<li>
Graph created at {{cooc.date}}
{{cooc.date}}
{% for key, value in coocs_count.items %}
{% if key == cooc.id %}
{% if value > 0 %}
with {{ value }} nodes :
<ul>
<!-- <li>{{cooc.id}}</li> --!>
<li>Start period: {% if not cooc.hyperdata.start %} begin of corpus {% else %} {{cooc.hyperdata.start}} {% endif %} </li>
<li>End period: {% if not cooc.hyperdata.end %} end of corpus {% else %} {{cooc.hyperdata.end}} {% endif %} </li>
<li>Distances:
<li>From: {% if not cooc.hyperdata.start %} begin of corpus {% else %} {{cooc.hyperdata.start}} {% endif %}
, To: {% if not cooc.hyperdata.end %} end of corpus {% else %} {{cooc.hyperdata.end}} {% endif %}
</li>
<li> {{ value }} nodes with distances:
<ul>
<li> <span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span>
Conditional with bridgeness
<a href="/projects/{{project.id}}/corpora/{{corpus.id}}/explorer?cooc_id={{cooc.id}}&distance=conditional&bridgeness=5">5</a>
or <a href="/projects/{{project.id}}/corpora/{{corpus.id}}/explorer?cooc_id={{cooc.id}}&distance=conditional&bridgeness=10">10</a>
<li>
<a href="/projects/{{project.id}}/corpora/{{corpus.id}}/explorer?cooc_id={{cooc.id}}&distance=distributional&bridgeness=5">
<span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span>
Conditional
</a>
(with bridgeness
<a href="/projects/{{project.id}}/corpora/{{corpus.id}}/explorer?cooc_id={{cooc.id}}&distance=conditional&bridgeness=10">10</a>
or <a href="/projects/{{project.id}}/corpora/{{corpus.id}}/explorer?cooc_id={{cooc.id}}&distance=conditional&bridgeness=20">20</a>
<li> <span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span>
Distributional with bridgeness
<a href="/projects/{{project.id}}/corpora/{{corpus.id}}/explorer?cooc_id={{cooc.id}}&distance=distributional&bridgeness=5">5</a>
or <a href="/projects/{{project.id}}/corpora/{{corpus.id}}/explorer?cooc_id={{cooc.id}}&distance=distributional&bridgeness=10">10</a>
or <a href="/projects/{{project.id}}/corpora/{{corpus.id}}/explorer?cooc_id={{cooc.id}}&distance=conditional&bridgeness=30">30</a>
)
</li>
<li>
<a href="/projects/{{project.id}}/corpora/{{corpus.id}}/explorer?cooc_id={{cooc.id}}&distance=distributional&bridgeness=5">
<span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span>
Distributional
</a>
(with bridgeness
<a href="/projects/{{project.id}}/corpora/{{corpus.id}}/explorer?cooc_id={{cooc.id}}&distance=distributional&bridgeness=10">10</a>
or <a href="/projects/{{project.id}}/corpora/{{corpus.id}}/explorer?cooc_id={{cooc.id}}&distance=distributional&bridgeness=20">20</a>
or <a href="/projects/{{project.id}}/corpora/{{corpus.id}}/explorer?cooc_id={{cooc.id}}&distance=distributional&bridgeness=30">30</a>
)
</li>
</ul>
</ul>
......
......@@ -137,14 +137,18 @@ em {
</div>
<!-- see in javascript function queries.functions['my_state_filter'] -->
<div class="pull-right" style="margin-top:2.1em;padding-left:1em;">
Filter:
<select id="picklistmenu" name="my_state_filter">
<option value='reset'>All terms</option>
<option value='reset'>All lists</option>
<option value='0'>Candidates only</option>
<!-- <option value='1' selected="selected">Map terms only</option> -->
<option value='1'>Map terms only</option>
<option value='2'>Stopwords only</option>
</select>
<select id="picktermtype" name="my_termtype_filter" style="margin-left:1em;">
<option value='reset'>All types</option>
<option value='mono'>One word terms only</option>
<option value='multi'>Multiword terms only</option>
</select>
</div>
</h4>
</div>
......
User-agent: *
Disallow : /auth/
Disallow : /projects/
......@@ -81,17 +81,30 @@
<li>
<a type="button" class="btn btn-default {% if view == 'titles' %} active {% endif %}"
onclick="javascript:location.href='/projects/{{project.id}}/corpora/{{ corpus.id }}/'"
data-target='#' href='#'>Documents
data-target='#' href='#'>
<span class="glyphicon glyphicon-folder-open" aria-hidden="true"></span>
&nbsp;Documents
</a>
</li>
<li>
<a type="button" class="btn btn-default {% if view == 'journals' %} active {% endif %}"
onclick="javascript:location.href='/projects/{{project.id}}/corpora/{{ corpus.id }}/journals'"
data-target='#' href='#'>Journals
data-target='#' href='#'>
<span class="glyphicon glyphicon-globe" aria-hidden="true"></span>
Journals
</a>
</li>
<!--
<li>
<a type="button" class="btn btn-default {% if view == 'authors' %} active {% endif %}"
onclick="javascript:location.href='/projects/{{project.id}}/corpora/{{ corpus.id }}/authors'"
data-target='#' href='#'>Authors
<span class="glyphicon glyphicon-user" aria-hidden="true"></span>
</a>
</li>
--!>
{% for state in corpus.hyperdata.statuses %}
{% if state.action == "Workflow" %}
......@@ -100,13 +113,16 @@
<li>
<a type="button" class="btn btn-default {% if view == 'terms' %} active {% endif %}"
onclick="javascript:location.href='/projects/{{project.id}}/corpora/{{ corpus.id }}/terms'"
data-target='#' href='#'>Terms
data-target='#' href='#'>
<span class="glyphicon glyphicon-text-width" aria-hidden="true"></span>
Terms
</a>
</li>
<li class="dropdown">
<a href="#graph" role="button" type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" title="That is your username">
<span class="glyphicon glyphicon-map-marker" aria-hidden="true"></span>
Graphs
</a>
<i class="caret"></i>
......@@ -134,7 +150,10 @@
<li>
<a type="button" class="btn btn-default {% if view == 'analytics' %} active {% endif %}"
onclick="javascript:location.href='/projects/{{project.id}}/corpora/{{ corpus.id }}/analytics'"
data-target='#' href='#'>Analytics
data-target='#' href='#'>
<span class="glyphicon glyphicon-signal" aria-hidden="true"></span>
Analytics
</a>
</li>
......@@ -246,7 +265,7 @@
<p>
Gargantext
<span class="glyphicon glyphicon-registration-mark" aria-hidden="true"></span>
, version 3.0.5,
, version 3.0.5.1,
<a href="http://www.cnrs.fr" target="blank" title="Institution that enables this project.">
Copyrights
<span class="glyphicon glyphicon-copyright-mark" aria-hidden="true"></span>
......
......@@ -61,23 +61,7 @@
</p>
</div>
</div>
<!-- Modal -->
<div id="wait" class="modal" style="top:8%;">
<div class="jumbotron">
<div class="container theme-showcase jumbotron" role="main">
<div>
<div class="col-md-3"></div>
<div class="col-md-6">
<h2>Your file has been uploaded ! </h2>
<h2>Gargantext need some time to eat it.</h2>
<h2>Duration depends on the size of the dish.</h2>
<a class="btn btn-primary btn-lg" href="/projects/{{ project.id }}" title="Click and test by yourself">Continue on Gargantext</a>
</div>
<div class="col-md-3"></div>
</div>
</div>
</div>
</div>
</div>
......@@ -295,6 +279,29 @@
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Modal -->
<div id="wait" class="modal fade">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h2 class="modal-title"><h2><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> Uploading corpus...</h2>
</div>
<div class="modal-body">
<p>
Your file has been uploaded !
Gargantext need some time to eat it.
Duration depends on the size of the dish.
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Continue on Gargantext</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script type="text/javascript" src="{% static "lib/jquery/1.11.2/jquery-ui.js" %}"></script>
<script type="text/javascript">
function getCookie(name) {
......@@ -312,7 +319,7 @@
}
return cookieValue;
}
var thequeries = [] ;
// load the template's value for N scan size
......@@ -657,9 +664,14 @@
alert("OK")
setTimeout(
function() {
alert("TimeOut!")
$('#addcorpus').modal('hide')
$("#wait").modal("show")
$("#wait").modal("show");
// setTimeout(
// function(){
// location.reload();
//
// }, 600);
// )
//setTimeout(, 300)
//location.reload();
}, 600);
......@@ -730,6 +742,10 @@
formatter: function (y) { return y + "%" }
});
{% endif %}
$('#wait').on('hidden.bs.modal', function (e) {
// reload page when dismiss the info box
window.location.reload()
})
</script>
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment