Commit 96c369b8 authored by delanoe's avatar delanoe

[MERGE] fix conflicts.

parents b9f01e80 6b2c5413
...@@ -102,7 +102,7 @@ INDEXED_HYPERDATA = { ...@@ -102,7 +102,7 @@ INDEXED_HYPERDATA = {
} }
from gargantext.util.taggers import EnglishMeltTagger, FrenchMeltTagger, TurboTagger from gargantext.util.taggers import FrenchMeltTagger, TurboTagger
LANGUAGES = { LANGUAGES = {
'en': { 'en': {
......
...@@ -101,13 +101,16 @@ class Node(Base): ...@@ -101,13 +101,16 @@ class Node(Base):
# session.add(self) # session.add(self)
# session.commit() # session.commit()
def children(self, typename=None): def children(self, typename=None, order=None):
"""Return a query to all the direct children of the current node. """Return a query to all the direct children of the current node.
Allows filtering by typename (see `constants.py`) Allows filtering by typename (see `constants.py`)
""" """
query = session.query(Node).filter(Node.parent_id == self.id) query = session.query(Node).filter(Node.parent_id == self.id)
if typename is not None: if typename is not None:
query = query.filter(Node.typename == typename) query = query.filter(Node.typename == typename)
if order is not None:
query = query.order_by(Node.name)
return query return query
def add_child(self, **kwargs): def add_child(self, **kwargs):
......
...@@ -32,7 +32,7 @@ class User(Base): ...@@ -32,7 +32,7 @@ class User(Base):
) )
return query.all() return query.all()
def nodes(self, typename=None): def nodes(self, typename=None, order=None):
"""get all nodes belonging to the user""" """get all nodes belonging to the user"""
from .nodes import Node from .nodes import Node
query = (session query = (session
...@@ -41,6 +41,10 @@ class User(Base): ...@@ -41,6 +41,10 @@ class User(Base):
) )
if typename is not None: if typename is not None:
query = query.filter(Node.typename == typename) query = query.filter(Node.typename == typename)
if order is not None:
query = query.order_by(Node.name)
return query return query
def contacts_nodes(self, typename=None): def contacts_nodes(self, typename=None):
......
...@@ -33,13 +33,13 @@ _members = [ ...@@ -33,13 +33,13 @@ _members = [
{ 'first_name' : 'Maziyar', 'last_name' : 'Panahi', { 'first_name' : 'Maziyar', 'last_name' : 'Panahi',
'mail' : '', 'mail' : '',
'website' : '', 'website' : 'http://iscpif.fr',
'picture' : 'maziyar.jpg', 'picture' : 'maziyar.jpg',
'role' : 'developer'}, 'role' : 'developer'},
{ 'first_name' : 'Romain', 'last_name' : 'Loth', { 'first_name' : 'Romain', 'last_name' : 'Loth',
'mail' : '', 'mail' : '',
'website' : '', 'website' : 'http://iscpif.fr',
'picture' : 'romain.jpg', 'picture' : 'romain.jpg',
'role' : 'developer'}, 'role' : 'developer'},
...@@ -47,7 +47,7 @@ _members = [ ...@@ -47,7 +47,7 @@ _members = [
'mail' : 'alexandre+gargantextATdelanoe.org', 'mail' : 'alexandre+gargantextATdelanoe.org',
'website' : 'http://alexandre.delanoe.org', 'website' : 'http://alexandre.delanoe.org',
'picture' : 'alexandre.jpg', 'picture' : 'alexandre.jpg',
'role' : 'principal investigator, developer'}, 'role' : 'project manager'},
#{ 'first_name' : '', 'name' : '', 'mail' : '', 'website' : '', 'picture' : ''}, #{ 'first_name' : '', 'name' : '', 'mail' : '', 'website' : '', 'picture' : ''},
# copy-paste the line above and write your informations please # copy-paste the line above and write your informations please
......
...@@ -36,7 +36,7 @@ def overview(request): ...@@ -36,7 +36,7 @@ def overview(request):
session.commit() session.commit()
# list of projects created by the logged user # list of projects created by the logged user
user_projects = user.nodes(typename='PROJECT') user_projects = user.nodes(typename='PROJECT', order=True)
# list of contacts of the logged user # list of contacts of the logged user
contacts_projects = list(user.contacts_nodes(typename='PROJECT')) contacts_projects = list(user.contacts_nodes(typename='PROJECT'))
...@@ -110,7 +110,7 @@ def project(request, project_id): ...@@ -110,7 +110,7 @@ def project(request, project_id):
# corpora within this project # corpora within this project
corpora = project.children('CORPUS').all() corpora = project.children('CORPUS', order=True).all()
sourcename2corpora = defaultdict(list) sourcename2corpora = defaultdict(list)
for corpus in corpora: for corpus in corpora:
# we only consider the first resource of the corpus to determine its type # we only consider the first resource of the corpus to determine its type
......
...@@ -5,7 +5,7 @@ import threading ...@@ -5,7 +5,7 @@ import threading
from traceback import print_tb from traceback import print_tb
#from gargantext.settings import MEDIA_ROOT, BASE_DIR #from gargantext.settings import MEDIA_ROOT, BASE_DIR
from django.shortcuts import redirect from django.shortcuts import redirect, render
from django.http import Http404, HttpResponseRedirect, HttpResponseForbidden from django.http import Http404, HttpResponseRedirect, HttpResponseForbidden
from gargantext.constants import RESOURCETYPES, QUERY_SIZE_N_MAX from gargantext.constants import RESOURCETYPES, QUERY_SIZE_N_MAX
...@@ -117,11 +117,7 @@ def save(request , project_id): ...@@ -117,11 +117,7 @@ def save(request , project_id):
) )
session.add(corpus)
session.commit()
corpus_id = corpus.id
print("NEW CORPUS", corpus_id)
tasks = Scraper() tasks = Scraper()
for i in range(8): for i in range(8):
...@@ -137,12 +133,14 @@ def save(request , project_id): ...@@ -137,12 +133,14 @@ def save(request , project_id):
if filename!=False: if filename!=False:
# add the uploaded resource to the corpus # add the uploaded resource to the corpus
corpus.add_resource( corpus.add_resource(
type = 8 # cf. constants.RESOURCETYPES type = int(8) # cf. constants.RESOURCETYPES
, path = filename , path = filename
) )
dwnldsOK+=1 dwnldsOK+=1
session.add(corpus)
session.commit() session.commit()
corpus_id = corpus.id
if dwnldsOK == 0 : if dwnldsOK == 0 :
return JsonHttpResponse(["fail"]) return JsonHttpResponse(["fail"])
...@@ -161,8 +159,15 @@ def save(request , project_id): ...@@ -161,8 +159,15 @@ def save(request , project_id):
# sanitize session after interrupted transact # sanitize session after interrupted transact
session.rollback() session.rollback()
# -------------------------------------------- # --------------------------------------------
sleep(1)
return HttpResponseRedirect('/projects/' + str(project_id)) return render(
template_name = 'pages/projects/wait.html',
request = request,
context = {
'user' : request.user,
'project': project,
},
)
data = [query_string,query,N] data = [query_string,query,N]
......
...@@ -111,9 +111,6 @@ def save( request , project_id ) : ...@@ -111,9 +111,6 @@ def save( request , project_id ) :
, typename = "CORPUS" , typename = "CORPUS"
) )
session.add(corpus)
session.commit()
corpus_id = corpus.id
# """ # """
# urlreqs: List of urls to query. # urlreqs: List of urls to query.
# - Then, to each url in urlreqs you do: # - Then, to each url in urlreqs you do:
...@@ -137,16 +134,21 @@ def save( request , project_id ) : ...@@ -137,16 +134,21 @@ def save( request , project_id ) :
print(filename) print(filename)
if filename != False: if filename != False:
# add the uploaded resource to the corpus # add the uploaded resource to the corpus
corpus.add_resource( corpus.add_resource( type = int(3)
type = 3
, path = filename , path = filename
, url = None
) )
print("Adding the resource")
dwnldsOK+=1 dwnldsOK+=1
#session.commit()
session.add(corpus)
session.commit()
corpus_id = corpus.id
if dwnldsOK == 0 : if dwnldsOK == 0 :
return JsonHttpResponse(["fail"]) return JsonHttpResponse(["fail"])
try: try:
scheduled(parse_extract_indexhyperdata(corpus_id)) scheduled(parse_extract_indexhyperdata)(corpus_id)
except Exception as error: except Exception as error:
print('WORKFLOW ERROR') print('WORKFLOW ERROR')
print(error) print(error)
......
...@@ -278,9 +278,13 @@ function Main_test(Data) { ...@@ -278,9 +278,13 @@ function Main_test(Data) {
var div_table = '<p align="right">'+"\n" var div_table = '<p align="right">'+"\n"
div_table += '<table id="my-ajax-table" class="table table-bordered">'+"\n" div_table += '<table id="my-ajax-table" class="table table-bordered">'+"\n"
div_table += "\t"+'<thead>'+"\n" div_table += "\t"+'<thead>'+"\n"
div_table += "\t"+"\t"+'<th width="100px;" data-dynatable-column="date">Date</th>'+"\n" div_table += "\t"+"\t"+'<th width="100px;" data-dynatable-column="date">'+"\n"
div_table += "\t"+"\t"+'<th data-dynatable-column="name">Title</th>'+"\n" div_table += "\t"+"\t"+'<span class="glyphicon glyphicon-calendar" aria-hidden="true"></span> Date</th>'+"\n"
div_table += "\t"+"\t"+'<th data-dynatable-column="del" data-dynatable-no-sort="true">Trash</th>'+"\n" div_table += "\t"+"\t"+'<th data-dynatable-column="name">'+"\n"
div_table += "\t"+"\t"+'<span class="glyphicon glyphicon-text-size" aria-hidden="true"></span> Title</th>'+"\n"
div_table += "\t"+"\t"+'<th data-dynatable-column="del" data-dynatable-no-sort="true">'+"\n"
div_table += "\t"+"\t"+'<span class="glyphicon glyphicon-trash" aria-hidden="true"></span>'+"\n"
div_table += "\t"+"\t"+'</th>'+"\n"
div_table += "\t"+"\t"+'</th>'+"\n" div_table += "\t"+"\t"+'</th>'+"\n"
div_table += "\t"+'</thead>'+"\n" div_table += "\t"+'</thead>'+"\n"
div_table += "\t"+'<tbody>'+"\n" div_table += "\t"+'<tbody>'+"\n"
......
This diff is collapsed.
This diff is collapsed.
...@@ -64,13 +64,17 @@ ...@@ -64,13 +64,17 @@
<!-- search box with custom function in Docs_dyna_chart_and_tables.js --> <!-- search box with custom function in Docs_dyna_chart_and_tables.js -->
<div class="pull-left" style="margin-top:1.85em; font-size: 16px;"> <div class="pull-left" style="margin-top:1.85em; font-size: 16px;">
<span class="glyphicon glyphicon-search" aria-hidden="true"></span>
Search: Search:
<input type="search" id="doubleSearch"/> <input type="search" id="doubleSearch"/>
<span style="font-size:70%;"> <span style="font-size:70%;">
<span class="glyphicon glyphicon-filter" aria-hidden="true"></span>
<!-- Used by the #doubleSearch associated function --> <!-- Used by the #doubleSearch associated function -->
<input title="Search in Titles" id="searchTI" name="searchTI" type="checkbox" checked onclick="return false">TI&nbsp; <input title="Search in Titles" id="searchTI" name="searchTI" type="checkbox" checked onclick="return false">TI&nbsp;
<span class="glyphicon glyphicon-filter" aria-hidden="true"></span>
<input title="Search in Abstracts" id="searchAB" name="searchAB" type="checkbox">AB <input title="Search in Abstracts" id="searchAB" name="searchAB" type="checkbox">AB
</span>&nbsp;&nbsp; </span>&nbsp;&nbsp;
<span class="glyphicon glyphicon-filter" aria-hidden="true"></span>
<select id="dupFilter" name="dupFilter"> <select id="dupFilter" name="dupFilter">
<option value="filter_all">All</option> <option value="filter_all">All</option>
<option value="filter_dupl">Duplicates by Title</option> <option value="filter_dupl">Duplicates by Title</option>
...@@ -83,7 +87,10 @@ ...@@ -83,7 +87,10 @@
<div class="panel-body"> <div class="panel-body">
<div id="div-table"></div> <div id="div-table"></div>
<p align="right"> <p align="right">
<button id="move2trash" class="btn btn-primary btn-lg" >Trash It!</button> <button id="move2trash" class="btn btn-primary btn-lg" >
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
Trash It!
</button>
</p> </p>
</div> </div>
</div> </div>
......
...@@ -153,7 +153,7 @@ ...@@ -153,7 +153,7 @@
<div class="row"> <div class="row">
<div class="thumbnails"> <div class="thumbnails">
{% for member in team %} {% for member in team %}
<div class="col-md-3 "> <div class="col-md-5 ">
<div class="thumbnail"> <div class="thumbnail">
{% if member.picture %} {% if member.picture %}
<img src="{% static "img/credits/"%}{{ member.picture }}" style="100px; height:150px"> <img src="{% static "img/credits/"%}{{ member.picture }}" style="100px; height:150px">
...@@ -161,6 +161,7 @@ ...@@ -161,6 +161,7 @@
<img src="{% static "img/logo.png" %}" style="100px; height:150px"> <img src="{% static "img/logo.png" %}" style="100px; height:150px">
{% endif %} {% endif %}
<div class="caption"> <div class="caption">
<center>
<h3>{{ member.first_name }} {{member.last_name }}</h3> <h3>{{ member.first_name }} {{member.last_name }}</h3>
{% if member.role %} {% if member.role %}
<p class="description">{{ member.role }}</p> <p class="description">{{ member.role }}</p>
...@@ -171,6 +172,7 @@ ...@@ -171,6 +172,7 @@
{% if member.website %} {% if member.website %}
<a href="{{ member.website }}" class="btn btn-primary btn-xs">Website</a> <a href="{{ member.website }}" class="btn btn-primary btn-xs">Website</a>
{% endif %} {% endif %}
</center>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -31,14 +31,14 @@ ...@@ -31,14 +31,14 @@
{% if project %} {% if project %}
<li><a href="/projects/{{project.id}}"> <li><a href="/projects/{{project.id}}">
<span class="glyphicon glyphicon-book" aria-hidden="true"></span> <span class="glyphicon glyphicon-book" aria-hidden="true"></span>
{{project.name}} {{project.name | truncatechars:15}}
</a> </a>
</li> </li>
{% endif %} {% endif %}
{% if corpus %} {% if corpus %}
<li><a href="/projects/{{project.id}}/corpora/{{corpus.id}}"> <li><a href="/projects/{{project.id}}/corpora/{{corpus.id}}">
<span class="glyphicon glyphicon-file" aria-hidden="true"></span> <span class="glyphicon glyphicon-file" aria-hidden="true"></span>
{{corpus.name}} {{corpus.name | truncatechars:15}}
</a> </a>
</li> </li>
{% endif %} {% endif %}
...@@ -48,8 +48,8 @@ ...@@ -48,8 +48,8 @@
<li class="dropdown"> <li class="dropdown">
<a href="#" role="button" class="dropdown-toggle" data-toggle="dropdown" title="That is your username"> <a href="#" role="button" class="dropdown-toggle" data-toggle="dropdown" title="That is your username">
<i class="icon-user"></i> <i class="icon-user"></i>
<span class="glyphicon glyphicon-user" aria-hidden="true"></span> <span class="glyphicon glyphicon-user" aria-hidden="true" style="color:white"></span>
{{ user.username }} {{ user.username | truncatechars:15}}
<i class="caret"></i> <i class="caret"></i>
</a> </a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<link rel="stylesheet" href="{% static "css/bootstrap.css" %}"> <link rel="stylesheet" href="{% static "css/bootstrap.css" %}">
<script type="text/javascript" src="{% static "js/jquery/jquery.min.js" %}"></script> <script type="text/javascript" src="{% static "js/jquery/jquery.min.js" %}"></script>
<script type="text/javascript" src="{% static "js/gargantext/garganrest.js" %}"></script> <script type="text/javascript" src="{% static "js/gargantext/garganrest.js" %}"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css"> <link rel="stylesheet" href="{% static "js/jquery/1.11.2/jquery-ui.css" %}">
<script type="text/javascript" src="{% static "js/morris.min.js" %}"></script> <script type="text/javascript" src="{% static "js/morris.min.js" %}"></script>
<script type="text/javascript" src="{% static "js/morris.min.js" %}"></script> <script type="text/javascript" src="{% static "js/morris.min.js" %}"></script>
...@@ -69,11 +69,14 @@ ...@@ -69,11 +69,14 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="container">
<div class="container">
<div class="container">
{% if projects %} {% if projects %}
{% for project in projects %} {% for project in projects %}
<!--<div class="col-md-offset-7 col-md-4 content" style="background-color:grey">!--> <!--<div class="col-md-offset-7 col-md-4 content" style="background-color:grey">!-->
<div id="project_{{project.id}}" class="col-md-3 content"> <div id="project_{{project.id}}" class="row">
<h3> <h3>
<a <a
...@@ -135,6 +138,9 @@ ...@@ -135,6 +138,9 @@
{% endif %} {% endif %}
</div> </div>
</div>
</div>
</div>
<div id="sharemodal" class="modal fade"> <div id="sharemodal" class="modal fade">
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<link rel="stylesheet" href="{% static "css/bootstrap.css" %}"> <link rel="stylesheet" href="{% static "css/bootstrap.css" %}">
<script type="text/javascript" src="{% static "js/jquery/jquery.min.js" %}"></script> <script type="text/javascript" src="{% static "js/jquery/jquery.min.js" %}"></script>
<script type="text/javascript" src="{% static "js/gargantext/garganrest.js" %}"></script> <script type="text/javascript" src="{% static "js/gargantext/garganrest.js" %}"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css"> <link rel="stylesheet" href="{% static "js/jquery/1.11.2/jquery-ui.css" %}">
<script type="text/javascript" src="{% static "js/morris.min.js" %}"></script> <script type="text/javascript" src="{% static "js/morris.min.js" %}"></script>
<script type="text/javascript" src="{% static "js/morris.min.js" %}"></script> <script type="text/javascript" src="{% static "js/morris.min.js" %}"></script>
...@@ -71,16 +71,13 @@ ...@@ -71,16 +71,13 @@
<div class="container"> <div class="container">
{% if list_corpora %} {% if list_corpora %}
<ul>
{% for key, corpora in list_corpora.items %} {% for key, corpora in list_corpora.items %}
<li>
<h2> <h2>
<span class="glyphicon glyphicon-cd" aria-hidden="true"></span> <span class="glyphicon glyphicon-cd" aria-hidden="true"></span>
{{ key }} {{ key }}
</h2> </h2>
<ul>
{% for corpus in corpora %} {% for corpus in corpora %}
<li id="corpus_{{corpus.id}}"> <div id="corpus_{{corpus.id}}">
{% ifequal corpus.processing 1 %} {% ifequal corpus.processing 1 %}
{{corpus.name}}: {{corpus.name}}:
<img width="20px" src="{% static "js/libs/img2/loading-bar.gif" %}"> <img width="20px" src="{% static "js/libs/img2/loading-bar.gif" %}">
...@@ -165,16 +162,10 @@ ...@@ -165,16 +162,10 @@
{% endfor %} {% endfor %}
</div> </div>
</p> </p>
</div>
</li>
{% endfor %} {% endfor %}
</ul>
</li>
{% endfor %} {% endfor %}
</ul>
{% endif %} {% endif %}
{% if list_corporax %} {% if list_corporax %}
...@@ -296,7 +287,7 @@ ...@@ -296,7 +287,7 @@
</div><!-- /.modal-content --> </div><!-- /.modal-content -->
</div><!-- /.modal-dialog --> </div><!-- /.modal-dialog -->
</div><!-- /.modal --> </div><!-- /.modal -->
<script type="text/javascript" src="http://code.jquery.com/ui/1.11.2/jquery-ui.js"></script> <script type="text/javascript" src="{% static "js/jquery/1.11.2/jquery-ui.js" %}"></script>
<script type="text/javascript"> <script type="text/javascript">
function getCookie(name) { function getCookie(name) {
var cookieValue = null; var cookieValue = null;
......
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