Commit 96c369b8 authored by delanoe's avatar delanoe

[MERGE] fix conflicts.

parents b9f01e80 6b2c5413
......@@ -102,7 +102,7 @@ INDEXED_HYPERDATA = {
}
from gargantext.util.taggers import EnglishMeltTagger, FrenchMeltTagger, TurboTagger
from gargantext.util.taggers import FrenchMeltTagger, TurboTagger
LANGUAGES = {
'en': {
......
......@@ -101,13 +101,16 @@ class Node(Base):
# session.add(self)
# 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.
Allows filtering by typename (see `constants.py`)
"""
query = session.query(Node).filter(Node.parent_id == self.id)
if typename is not None:
query = query.filter(Node.typename == typename)
if order is not None:
query = query.order_by(Node.name)
return query
def add_child(self, **kwargs):
......
......@@ -32,7 +32,7 @@ class User(Base):
)
return query.all()
def nodes(self, typename=None):
def nodes(self, typename=None, order=None):
"""get all nodes belonging to the user"""
from .nodes import Node
query = (session
......@@ -41,6 +41,10 @@ class User(Base):
)
if typename is not None:
query = query.filter(Node.typename == typename)
if order is not None:
query = query.order_by(Node.name)
return query
def contacts_nodes(self, typename=None):
......
......@@ -33,13 +33,13 @@ _members = [
{ 'first_name' : 'Maziyar', 'last_name' : 'Panahi',
'mail' : '',
'website' : '',
'website' : 'http://iscpif.fr',
'picture' : 'maziyar.jpg',
'role' : 'developer'},
{ 'first_name' : 'Romain', 'last_name' : 'Loth',
'mail' : '',
'website' : '',
'website' : 'http://iscpif.fr',
'picture' : 'romain.jpg',
'role' : 'developer'},
......@@ -47,7 +47,7 @@ _members = [
'mail' : 'alexandre+gargantextATdelanoe.org',
'website' : 'http://alexandre.delanoe.org',
'picture' : 'alexandre.jpg',
'role' : 'principal investigator, developer'},
'role' : 'project manager'},
#{ 'first_name' : '', 'name' : '', 'mail' : '', 'website' : '', 'picture' : ''},
# copy-paste the line above and write your informations please
......
......@@ -36,7 +36,7 @@ def overview(request):
session.commit()
# 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
contacts_projects = list(user.contacts_nodes(typename='PROJECT'))
......@@ -110,7 +110,7 @@ def project(request, project_id):
# corpora within this project
corpora = project.children('CORPUS').all()
corpora = project.children('CORPUS', order=True).all()
sourcename2corpora = defaultdict(list)
for corpus in corpora:
# we only consider the first resource of the corpus to determine its type
......
......@@ -5,7 +5,7 @@ import threading
from traceback import print_tb
#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 gargantext.constants import RESOURCETYPES, QUERY_SIZE_N_MAX
......@@ -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()
for i in range(8):
......@@ -137,13 +133,15 @@ def save(request , project_id):
if filename!=False:
# add the uploaded resource to the corpus
corpus.add_resource(
type = 8 # cf. constants.RESOURCETYPES
type = int(8) # cf. constants.RESOURCETYPES
, path = filename
)
dwnldsOK+=1
session.add(corpus)
session.commit()
corpus_id = corpus.id
if dwnldsOK == 0 :
return JsonHttpResponse(["fail"])
###########################
......@@ -161,8 +159,15 @@ def save(request , project_id):
# sanitize session after interrupted transact
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]
......
......@@ -111,9 +111,6 @@ def save( request , project_id ) :
, typename = "CORPUS"
)
session.add(corpus)
session.commit()
corpus_id = corpus.id
# """
# urlreqs: List of urls to query.
# - Then, to each url in urlreqs you do:
......@@ -137,16 +134,21 @@ def save( request , project_id ) :
print(filename)
if filename != False:
# add the uploaded resource to the corpus
corpus.add_resource(
type = 3
corpus.add_resource( type = int(3)
, path = filename
, url = None
)
print("Adding the resource")
dwnldsOK+=1
#session.commit()
session.add(corpus)
session.commit()
corpus_id = corpus.id
if dwnldsOK == 0 :
return JsonHttpResponse(["fail"])
try:
scheduled(parse_extract_indexhyperdata(corpus_id))
scheduled(parse_extract_indexhyperdata)(corpus_id)
except Exception as error:
print('WORKFLOW ERROR')
print(error)
......
......@@ -278,9 +278,13 @@ function Main_test(Data) {
var div_table = '<p align="right">'+"\n"
div_table += '<table id="my-ajax-table" class="table table-bordered">'+"\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 data-dynatable-column="name">Title</th>'+"\n"
div_table += "\t"+"\t"+'<th data-dynatable-column="del" data-dynatable-no-sort="true">Trash</th>'+"\n"
div_table += "\t"+"\t"+'<th width="100px;" data-dynatable-column="date">'+"\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="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"+'</thead>'+"\n"
div_table += "\t"+'<tbody>'+"\n"
......
This diff is collapsed.
This diff is collapsed.
......@@ -64,13 +64,17 @@
<!-- search box with custom function in Docs_dyna_chart_and_tables.js -->
<div class="pull-left" style="margin-top:1.85em; font-size: 16px;">
<span class="glyphicon glyphicon-search" aria-hidden="true"></span>
Search:
<input type="search" id="doubleSearch"/>
<span style="font-size:70%;">
<span class="glyphicon glyphicon-filter" aria-hidden="true"></span>
<!-- Used by the #doubleSearch associated function -->
<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
</span>&nbsp;&nbsp;
<span class="glyphicon glyphicon-filter" aria-hidden="true"></span>
<select id="dupFilter" name="dupFilter">
<option value="filter_all">All</option>
<option value="filter_dupl">Duplicates by Title</option>
......@@ -83,7 +87,10 @@
<div class="panel-body">
<div id="div-table"></div>
<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>
</div>
</div>
......
......@@ -153,7 +153,7 @@
<div class="row">
<div class="thumbnails">
{% for member in team %}
<div class="col-md-3 ">
<div class="col-md-5 ">
<div class="thumbnail">
{% if member.picture %}
<img src="{% static "img/credits/"%}{{ member.picture }}" style="100px; height:150px">
......@@ -161,6 +161,7 @@
<img src="{% static "img/logo.png" %}" style="100px; height:150px">
{% endif %}
<div class="caption">
<center>
<h3>{{ member.first_name }} {{member.last_name }}</h3>
{% if member.role %}
<p class="description">{{ member.role }}</p>
......@@ -171,6 +172,7 @@
{% if member.website %}
<a href="{{ member.website }}" class="btn btn-primary btn-xs">Website</a>
{% endif %}
</center>
</div>
</div>
</div>
......
......@@ -31,14 +31,14 @@
{% if project %}
<li><a href="/projects/{{project.id}}">
<span class="glyphicon glyphicon-book" aria-hidden="true"></span>
{{project.name}}
{{project.name | truncatechars:15}}
</a>
</li>
{% endif %}
{% if corpus %}
<li><a href="/projects/{{project.id}}/corpora/{{corpus.id}}">
<span class="glyphicon glyphicon-file" aria-hidden="true"></span>
{{corpus.name}}
{{corpus.name | truncatechars:15}}
</a>
</li>
{% endif %}
......@@ -48,8 +48,8 @@
<li class="dropdown">
<a href="#" role="button" class="dropdown-toggle" data-toggle="dropdown" title="That is your username">
<i class="icon-user"></i>
<span class="glyphicon glyphicon-user" aria-hidden="true"></span>
{{ user.username }}
<span class="glyphicon glyphicon-user" aria-hidden="true" style="color:white"></span>
{{ user.username | truncatechars:15}}
<i class="caret"></i>
</a>
<ul class="dropdown-menu">
......
......@@ -6,7 +6,7 @@
<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/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>
......@@ -69,71 +69,77 @@
<div class="container">
<div class="row">
<div class="container">
<div class="container">
<div class="container">
{% if projects %}
{% for project in projects %}
<!--<div class="col-md-offset-7 col-md-4 content" style="background-color:grey">!-->
<div id="project_{{project.id}}" class="row">
<h3>
<a
href="/projects/{{ project.id }}">
<span class="glyphicon glyphicon-book" aria-hidden="true"></span>
{{ project.name }}
</a>
<a href="/projects/{{project.id}}" >
<button type="button" class="btn btn-default" aria-label="Left Align">
<span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span>
</button>
</a>
<button type="button" class="btn btn-default" data-container="body" data-toggle="popover" data-placement="bottom"
data-content=" <ul>
<!--
<li>Rename</li>
--!>
<li onclick=&quot;
garganrest.nodes.delete({{project.id}}, function(){$('#project_'+{{project.id}}).remove()});
$(this).parent().parent().remove();
&quot;><a href=&quot;#&quot;>Delete</a></li>
</ul>
">
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
</button>
</li>
{% if common_users %}
<!-- <a style="cursor:pointer;"><img class="share_button" data-id="{{ project.id }}" title="Share it!" width="20px" src="{% static "img/share.png" %}"></img></a> --!>
{% endif %}
</h3>
<h4>{{ project.subtitle }}<h4>
</div>
{% endfor %}
{% endif %}
{% if common_projects %}
<br><br><br><br><br><br>
<h3><i> - - Shared projects - -</i></h3>
{% for project in common_projects %}
<!--<div class="col-md-offset-7 col-md-4 content" style="background-color:grey">!-->
<div class="col-md-3 content">
<h3><a href="/projects/{{ project.id }}">{{ project.name }}</a>
<button type="button" class="btn btn-xs btn-default" data-container="body" data-toggle="popover" data-placement="bottom"
data-content='
<ul>
<li> Rename </li>
<li><a href="/projects/{{ project.id }}">Add new corpus</a></li>
<li><a href="/delete/{{ project.id }}">Delete</a></li>
</ul>
'>Manage</button>
</h3>
<h4>{{ project.subtitle }}<h4>
</div>
{% endfor %}
{% endif %}
{% if projects %}
{% for project in projects %}
<!--<div class="col-md-offset-7 col-md-4 content" style="background-color:grey">!-->
<div id="project_{{project.id}}" class="col-md-3 content">
<h3>
<a
href="/projects/{{ project.id }}">
<span class="glyphicon glyphicon-book" aria-hidden="true"></span>
{{ project.name }}
</a>
<a href="/projects/{{project.id}}" >
<button type="button" class="btn btn-default" aria-label="Left Align">
<span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span>
</button>
</a>
<button type="button" class="btn btn-default" data-container="body" data-toggle="popover" data-placement="bottom"
data-content=" <ul>
<!--
<li>Rename</li>
--!>
<li onclick=&quot;
garganrest.nodes.delete({{project.id}}, function(){$('#project_'+{{project.id}}).remove()});
$(this).parent().parent().remove();
&quot;><a href=&quot;#&quot;>Delete</a></li>
</ul>
">
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
</button>
</li>
{% if common_users %}
<!-- <a style="cursor:pointer;"><img class="share_button" data-id="{{ project.id }}" title="Share it!" width="20px" src="{% static "img/share.png" %}"></img></a> --!>
{% endif %}
</h3>
<h4>{{ project.subtitle }}<h4>
</div>
{% endfor %}
{% endif %}
{% if common_projects %}
<br><br><br><br><br><br>
<h3><i> - - Shared projects - -</i></h3>
{% for project in common_projects %}
<!--<div class="col-md-offset-7 col-md-4 content" style="background-color:grey">!-->
<div class="col-md-3 content">
<h3><a href="/projects/{{ project.id }}">{{ project.name }}</a>
<button type="button" class="btn btn-xs btn-default" data-container="body" data-toggle="popover" data-placement="bottom"
data-content='
<ul>
<li> Rename </li>
<li><a href="/projects/{{ project.id }}">Add new corpus</a></li>
<li><a href="/delete/{{ project.id }}">Delete</a></li>
</ul>
'>Manage</button>
</h3>
<h4>{{ project.subtitle }}<h4>
</div>
</div>
</div>
{% endfor %}
{% endif %}
</div>
......
......@@ -5,7 +5,7 @@
<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/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>
......@@ -71,16 +71,13 @@
<div class="container">
{% if list_corpora %}
<ul>
{% for key, corpora in list_corpora.items %}
<li>
<h2>
<span class="glyphicon glyphicon-cd" aria-hidden="true"></span>
{{ key }}
</h2>
<ul>
{% for corpus in corpora %}
<li id="corpus_{{corpus.id}}">
<div id="corpus_{{corpus.id}}">
{% ifequal corpus.processing 1 %}
{{corpus.name}}:
<img width="20px" src="{% static "js/libs/img2/loading-bar.gif" %}">
......@@ -165,16 +162,10 @@
{% endfor %}
</div>
</p>
</li>
</div>
{% endfor %}
</ul>
</li>
{% endfor %}
</ul>
{% endif %}
{% if list_corporax %}
......@@ -296,7 +287,7 @@
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</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">
function getCookie(name) {
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