Commit a6d6b9d0 authored by delanoe's avatar delanoe

[STABLE] Merging testing.

parents de4cbd4c 56bdb3a5
## Version 3.0.6.2
* Guided Tour
## Version 3.0.6.1
* Sources form highlighting crawlers
* Link to Licence
## Version 3.0.6
* New Menu
* Links to Documentation
* Contextual Help English or French (French by default)
* User parameters stored in Node.hyperdata with typename 'USER'
Each user has only one node with typename 'USER'
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -214,7 +214,7 @@
var newNgramText = annotation.trim()
// new ngram (first call creates then like previous case for list)
$scope.menuItems.push({
'comment' : "Create and add to STOPLIST",
'comment' : "Create and add to stop list",
'tgtListName': "STOPLIST",
'crudCalls':[
{'service': MainApiAddNgramHttpService, 'action': 'put',
......@@ -225,7 +225,7 @@
]
}) ;
$scope.menuItems.push({
'comment' : "Create and add to MAINLIST",
'comment' : "Create and add to candidate list",
'tgtListName': "MAINLIST",
'crudCalls':[
{'service': MainApiAddNgramHttpService, 'action': 'put',
......@@ -236,7 +236,7 @@
]
}) ;
$scope.menuItems.push({
'comment' : "Create and add to MAPLIST",
'comment' : "Create and add to map list",
'tgtListName': "MAPLIST",
'crudCalls':[
{'service': MainApiAddNgramHttpService, 'action': 'put',
......
......@@ -151,6 +151,9 @@ INDEXED_HYPERDATA = {
# },
}
# user parameters----------------------------------------
USER_LANG = ["fr", "en"]
# resources ---------------------------------------------
def get_resource(sourcetype):
......@@ -395,7 +398,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' : 100
,'corpusMin' : 40
graph_constraints = {'corpusMax' : 0
,'corpusMin' : 0
,'mapList' : 50
}
......@@ -61,7 +61,9 @@ class User(Base):
"""check if a given node is owned by the user"""
return (node.user_id == self.id) or \
node.id in (contact.id for contact in self.contacts())
def get_params(self, username=None):
print(self.__dict__.items())
return self.hyperdata
class Contact(Base):
__tablename__ = 'contacts'
......
This diff is collapsed.
......@@ -7,13 +7,14 @@ API views for advanced operations on ngrams and ngramlists
- modify NodeNgramNgram groups (PUT/DEL a list of groupings like {"767[]":[209,640],"779[]":[436,265,385]}")
"""
from gargantext.util.http import APIView, get_parameters, JsonHttpResponse,\
ValidationException, Http404, HttpResponse
from gargantext.util.db import session, aliased, bulk_insert
from gargantext.util.db_cache import cache
from sqlalchemy import tuple_
from gargantext.models import Ngram, NodeNgram, NodeNodeNgram, NodeNgramNgram, Node
from gargantext.util.lists import UnweightedList, Translations
from gargantext.util.http import APIView, get_parameters, JsonHttpResponse,\
ValidationException, Http404, HttpResponse
from gargantext.util.db import session, aliased, bulk_insert
from gargantext.util.db_cache import cache
from sqlalchemy import tuple_
from gargantext.models import Ngram, NodeNgram, NodeNodeNgram, NodeNgramNgram, Node
from gargantext.util.lists import UnweightedList, Translations
from gargantext.util.scheduling import scheduled
# useful subroutines
from gargantext.util.ngramlists_tools import query_list, export_ngramlists, \
......@@ -21,7 +22,6 @@ from gargantext.util.ngramlists_tools import query_list, export_ngramlists, \
import_and_merge_ngramlists
from gargantext.util.group_tools import query_grouped_ngrams
class List(APIView):
"""
see already available API query api/nodes/<list_id>?fields[]=ngrams
......@@ -89,7 +89,8 @@ class CSVLists(APIView):
# import the csv
# try:
log_msg = import_and_merge_ngramlists(csv_contents,
log_msg = "Async generation"
scheduled(import_and_merge_ngramlists)(csv_contents,
onto_corpus_id = corpus_node.id)
return JsonHttpResponse({
'log': log_msg,
......
......@@ -286,12 +286,13 @@ class NodeListResource(APIView):
node_ids = [int(n) for n in parameters['ids'].split(',')]
except :
raise ValidationException('"ids" needs integers separated by comma.')
result = session.execute(
delete(Node).where(Node.id.in_(node_ids))
)
session.commit()
try:
result = session.execute(
delete(Node).where(Node.id.in_(node_ids))
)
session.commit()
finally:
session.close()
return JsonHttpResponse({'deleted': result.rowcount})
class NodeListHaving(APIView):
......@@ -399,10 +400,13 @@ class NodeResource(APIView):
parameters, query, count = _query_nodes(request, node_id)
if not len(query):
raise Http404()
result = session.execute(
delete(Node).where(Node.id == node_id)
)
session.commit()
try:
result = session.execute(
delete(Node).where(Node.id == node_id)
)
session.commit()
finally:
session.close()
return JsonHttpResponse({'deleted': result.rowcount})
def post(self, request, node_id):
......@@ -567,16 +571,17 @@ class CorpusFavorites(APIView):
{'docs': list, 'default': ""}
)
nodeids_to_delete = [int(did) for did in req_params['docs'].split(',')]
# it deletes from favourites but not from DB
result = session.execute(
delete(NodeNode)
.where(NodeNode.node1_id == fav_node.id)
.where(NodeNode.node2_id.in_(nodeids_to_delete))
)
session.commit()
response = {'count_removed': result.rowcount}
try:
# it deletes from favourites but not from DB
result = session.execute(
delete(NodeNode)
.where(NodeNode.node1_id == fav_node.id)
.where(NodeNode.node2_id.in_(nodeids_to_delete))
)
session.commit()
response = {'count_removed': result.rowcount}
finally:
session.close()
return JsonHttpResponse(response)
def put(self, request, corpus_id, check_each_doc=True):
......
......@@ -3,6 +3,7 @@ from django.conf.urls import url
from . import nodes
from . import projects
from . import corpora
from . import users
from . import ngrams
from . import metrics
from . import ngramlists
......@@ -90,6 +91,6 @@ urlpatterns = [ url(r'^nodes$' , nodes.NodeListResource.as_view()
, url(r'^ngramlists/maplist$' , ngramlists.MapListGlance.as_view() )
# fast access to maplist, similarly formatted for termtable
, url(r'^user/parameters/$', users.UserParameters.as_view())
]
from .api import * #notamment APIView, check_rights, format_response
from gargantext.util.http import *
from django.core.exceptions import *
from collections import defaultdict
from gargantext.util.toolchain import *
import copy
from gargantext.util.db import session
class UserParameters(APIView):
'''API endpoint that represent the parameters of the user'''
def get(self, request):
node_user = session.query(Node).filter(Node.user_id == request.user.id, Node.typename== "USER").first()
if node_user is None:
return Response({"detail":"Not Found"}, status=HTTP_404)
else:
#context = format_response(node_user, )
return Response(node_user.hyperdata)
def put(self, request):
if request.user.id is None:
raise TypeError("This API request must come from an authenticated user.")
else:
# we query among the nodes that belong to this user
user = cache.User[request.user.id]
node_user = session.query(Node).filter(Node.user_id == user.id, Node.typename== "USER").first()
if node_user is None:
return Response({"detail":"Not Allowed"}, status=HTTP_401_UNAUTHORIZED)
for k, v in request.data.items():
node_user.hyperdata[k] = v
# setattr(node_user.hyperdata, k, v)
# print(node_user.hyperdata)
node_user.save_hyperdata()
session.add(node_user)
session.commit()
node_user = session.query(Node).filter(Node.user_id == user.id, Node.typename== "USER").first()
print(node_user.hyperdata)
return Response({"detail":"Updated user parameters", "hyperdata": node_user.hyperdata}, status=HTTP_202_ACCEPTED)
......@@ -2,8 +2,10 @@ from django.contrib.auth import authenticate, login, logout
from django.core.urlresolvers import reverse_lazy
from django.views.generic import FormView
from django.shortcuts import redirect
from gargantext.util.db import session
from gargantext.models.users import User
from django import forms
from gargantext.models import Node, User
from gargantext.views.pages.projects import overview
......@@ -21,6 +23,23 @@ class LoginView(FormView):
if user is not None and user.is_active:
login(self.request, user)
node_user = session.query(Node).filter(Node.user_id == user.id, Node.typename== "USER").first()
#user hasn't been found inside Node table
#create it from auth table => node table
if node_user is None:
node_user = Node(
typename = 'USER',
#in node = > name
#in user = > username
name = user.username,
user_id = user.id,
)
node_user.hyperdata = {"language":"fr"}
session.add(node_user)
session.commit()
return super(LoginView, self).form_valid(form)
else:
return self.form_invalid(form)
......
from gargantext.util.http import *
from gargantext.util.db import *
from gargantext.util.db_cache import cache
from gargantext.models import *
from gargantext.constants import *
from gargantext.settings import *
from datetime import datetime
from gargantext.util.http import *
from gargantext.util.db import *
from gargantext.util.db_cache import cache
from gargantext.models import *
from gargantext.constants import *
from gargantext.settings import *
from datetime import datetime
from .main import get_user_params
from gargantext.constants import USER_LANG
def _get_user_project_corpus(request, project_id, corpus_id):
"""Helper method to get a corpus, knowing the project's and corpus' ID.
......@@ -28,7 +28,6 @@ def docs_by_titles(request, project_id, corpus_id):
authorized, user, project, corpus = _get_user_project_corpus(request, project_id, corpus_id)
if not authorized:
return HttpResponseForbidden()
source_type = corpus.resources()[0]['type']
# response!
return render(
......@@ -41,7 +40,9 @@ def docs_by_titles(request, project_id, corpus_id):
'corpus': corpus,
'resourcename' : get_resource(source_type)['name'],
'view': 'titles',
'user': request.user
'user': request.user,
'user_parameters': get_user_params(user),
'languages': USER_LANG
},
)
......@@ -57,10 +58,10 @@ def docs_by_sources(request, project_id, corpus_id):
# and the project just for project.id in corpusBannerTop
project = cache.Node[project_id]
user = cache.User[request.user.id]
source_type = corpus.resources()[0]['type']
# rendered page : sources.html
return render(
template_name = 'pages/corpora/sources.html',
request = request,
......@@ -70,7 +71,10 @@ def docs_by_sources(request, project_id, corpus_id):
'project': project,
'corpus' : corpus,
'resourcename' : get_resource(source_type)['name'],
'view': 'sources'
'user': request.user,
'user_parameters': get_user_params(user),
'view': 'sources',
'languages': USER_LANG
},
)
......@@ -86,10 +90,10 @@ def docs_by_authors(request, project_id, corpus_id):
# and the project just for project.id in corpusBannerTop
project = cache.Node[project_id]
user = cache.User[request.user.id]
source_type = corpus.resources()[0]['type']
# rendered page : sources.html
node_user = get_node_user(user)
return render(
template_name = 'pages/corpora/authors.html',
request = request,
......@@ -99,7 +103,10 @@ def docs_by_authors(request, project_id, corpus_id):
'project': project,
'corpus' : corpus,
'resourcename' : get_resource(source_type)['name'],
'view': 'authors'
'view': 'authors',
'user': request.user,
'user_parameters': node_user.hyperdata,
'languages': USER_LANG
},
)
......@@ -111,7 +118,6 @@ def analytics(request, project_id, corpus_id):
return HttpResponseForbidden()
source_type = corpus.resources()[0]['type']
# response!
return render(
template_name = 'pages/analytics/histories.html',
......@@ -123,6 +129,8 @@ def analytics(request, project_id, corpus_id):
'corpus': corpus,
'resourcename' : get_resource(source_type)['name'],
'view': 'analytics',
'user': request.user
'user': request.user,
'user_parameters': get_user_params(user),
'languages': USER_LANG
},
)
......@@ -81,4 +81,3 @@ class AuthenticationForm(forms.Form):
def get_user(self):
return self.user_cache
from gargantext.util.http import *
from gargantext.util.http import *
from gargantext.util.db import session
from gargantext.models import Node, User
import datetime
from gargantext.util.generators import paragraphs, credits
from gargantext.constants import USER_LANG
def get_user_node(user):
if user is not None:
node_user = session.query(Node).filter(Node.user_id == user.id, Node.typename== "USER").first()
return node_user
else:
return None
def get_user_params(user):
node_user = get_user_node(user)
if node_user is not None:
return node_user.hyperdata
return {}
def home(request):
'''Home describes the platform.
......@@ -19,12 +32,15 @@ def home(request):
'paragraph_gargantua': paragraphs.gargantua(),
'paragraph_lorem' : paragraphs.lorem(),
'paragraph_tutoreil': paragraphs.tutoreil(),
'languages': USER_LANG,
'user_parameters': get_user_params(request.user)
},
)
def about(request):
'''About Gargantext, its team and sponsors
'''
return render(
template_name = 'pages/main/about.html',
request = request,
......@@ -35,6 +51,8 @@ def about(request):
'institutions': credits.institutions(),
'labos': credits.labs(),
'grants': credits.grants(),
'user_parameters': get_user_params(request.user),
'languages': USER_LANG,
},
)
......@@ -50,11 +68,13 @@ def robots(request):
def maintenance(request):
'''Gargantext out of service
'''
user_node = get_user_node(request.user)
return render(
template_name = 'pages/main/maintenance.html',
request = request,
context = {
'user': request.user,
'date': datetime.datetime.now(),
'user_parameters': get_user_params(request.user)
},
)
......@@ -4,7 +4,7 @@ from gargantext.util.db_cache import cache
from gargantext.util.files import upload
from gargantext.models import *
from gargantext.constants import *
from .main import get_user_params
from gargantext.util.scheduling import scheduled
from gargantext.util.toolchain import parse_extract_indexhyperdata
......@@ -13,6 +13,19 @@ from collections import defaultdict
from django.utils.translation import ugettext_lazy
import re
def get_node_user(user):
node_user = session.query(Node).filter(Node.user_id == user.id, Node.typename == "USER").first()
if node_user is None:
node_user = Node(user_id = user.id,
typename = 'USER',
name = user.name,
)
#default language for now is 'fr'
node_user.hyperdata["language"] = "fr"
session.add(node_user)
session.commit()
print(node_user.hyperdata)
return node_user
@requires_auth
def overview(request):
......@@ -22,7 +35,8 @@ def overview(request):
'''
user = cache.User[request.user.id]
print(user)
node_user = get_node_user(user)
# If POST method, creates a new project...
if request.method == 'POST':
name = str(request.POST['name'])
......@@ -31,6 +45,8 @@ def overview(request):
user_id = user.id,
typename = 'PROJECT',
name = name,
parent_id = node_user.id,
)
session.add(new_project)
session.commit()
......@@ -51,6 +67,8 @@ def overview(request):
# projects owned by the user
'number': user_projects.count(),
'projects': user_projects,
'user_parameters': get_user_params(request.user),
'languages': USER_LANG,
# projects owned by the user's contacts
'common_users': (contact for contact, projects in contacts_projects),
'common_projects': sum((projects for contact, projects in contacts_projects), []),
......@@ -90,7 +108,8 @@ def project(request, project_id):
# security check
project = session.query(Node).filter(Node.id == project_id).first()
user = cache.User[request.user.id]
node_user = get_node_user(user)
if project is None:
raise Http404()
if not user.owns(project):
......@@ -168,8 +187,11 @@ def project(request, project_id):
template_name = 'pages/projects/wait.html',
request = request,
context = {
'form': NewCorpusForm,
'user': request.user,
'user_parameters': get_user_params(request.user),
'languages': USER_LANG,
'date': datetime.now(),
'project': project,
'donut': donut,
......@@ -189,6 +211,8 @@ def project(request, project_id):
template_name = 'pages/projects/project.html',
request = request,
context = {
'user_parameters': get_user_params(request.user),
"languages": USER_LANG,
'form': NewCorpusForm,
'user': request.user,
'date': datetime.now(),
......
......@@ -3,8 +3,11 @@ from gargantext.util.db import session
from gargantext.util.db_cache import cache
from gargantext.models import Node
from gargantext.constants import get_resource
from gargantext.constants import USER_LANG
from .main import get_user_params
from datetime import datetime
@requires_auth
def ngramtable(request, project_id, corpus_id):
'''
......@@ -32,7 +35,6 @@ def ngramtable(request, project_id, corpus_id):
corpora_infos = corpora_infos_q.all()
source_type = corpus.resources()[0]['type']
# rendered page : terms.html
return render(
template_name = 'pages/corpora/terms.html',
......@@ -48,6 +50,9 @@ def ngramtable(request, project_id, corpus_id):
# for the CSV import modal
'importroute': "/api/ngramlists/import?onto_corpus=%i"% corpus.id,
'corporainfos' : corpora_infos
'corporainfos' : corpora_infos,
#user params
'user_parameters': get_user_params(request.user),
'languages': USER_LANG
},
)
......@@ -4,8 +4,9 @@ from gargantext.util.db_cache import cache
from gargantext.models import *
from gargantext.constants import *
from gargantext.settings import *
from gargantext.constants import USER_LANG
from datetime import datetime
from gargantext.views.pages.main import get_user_params
@requires_auth
def explorer(request, project_id, corpus_id):
......@@ -19,9 +20,10 @@ def explorer(request, project_id, corpus_id):
# we pass our corpus
corpus = cache.Node[corpus_id]
# security check
user = cache.User[request.user.id]
if corpus is None:
raise Http404()
if not user.owns(corpus):
......@@ -46,6 +48,8 @@ def explorer(request, project_id, corpus_id):
'corpus' : corpus ,
'maplist_id': maplist_id ,
'view' : 'graph' ,
'user_parameters': get_user_params(request.user),
'languages': USER_LANG
},
)
......@@ -61,6 +65,7 @@ def myGraphs(request, project_id, corpus_id):
'''
user = cache.User[request.user.id]
# we pass our corpus
corpus = cache.Node[corpus_id]
......@@ -99,6 +104,8 @@ def myGraphs(request, project_id, corpus_id):
'corpus' : corpus,
'view' : 'myGraph',
'coocs' : coocs,
'coocs_count' : coocs_count
'coocs_count' : coocs_count,
'user_parameters': get_user_params(request.user),
'languages': USER_LANG,
},
)
......@@ -580,6 +580,9 @@ function Main_test(Data) {
$(".dynatable-record-count").insertAfter(".imadiv")
$(".dynatable-pagination-links").insertAfter(".imadiv")
$('<div class="imadiv"></div>').insertAfter("#my-ajax-table")
$(".dynatable-record-count").insertAfter(".imadiv")
$(".dynatable-pagination-links").insertAfter(".imadiv")
// binds a custom filter to our 'doubleSearch' via dynatable.queries.functions
MyTable.data('dynatable').queries
.functions['doubleSearch'] = function(record,searchString) {
......
......@@ -2016,7 +2016,7 @@ function MainTableAndCharts( ngdata , initial , filtersParams, callerLabel) {
+ ' title="Selected terms will be removed from all lists."'
+ ' style="width:3em;"'
+ '>'
+ 'Del'
+ 'Stop'
+ '<p class="note">'
+ '<input type="checkbox" id="delAll"'
+ ' onclick="SelectPage(\'delete\',this)" title="Check to select all currently visible terms"></input>'
......@@ -2025,7 +2025,7 @@ function MainTableAndCharts( ngdata , initial , filtersParams, callerLabel) {
+ '</th>'+"\n" ;
// main name and score columns
div_table += "\t"+"\t"+'<th data-dynatable-column="name">Terms</th>'+"\n";
div_table += "\t"+"\t"+'<th id="score_column_id" data-dynatable-sorts="score" data-dynatable-column="score">Score</th>'+"\n";
div_table += "\t"+"\t"+'<th id="score_column_id" data-dynatable-sorts="score" data-dynatable-column="score">Occurences (nb)</th>'+"\n";
div_table += "\t"+"\t"+'</th>'+"\n";
div_table += "\t"+'</tr>'+"\n";
div_table += "\t"+'</thead>'+"\n";
......@@ -2376,6 +2376,10 @@ function MainTableAndCharts( ngdata , initial , filtersParams, callerLabel) {
$(".dynatable-record-count").insertAfter(".imadiv")
$(".dynatable-pagination-links").insertAfter(".imadiv")
$('<div class="imadiv"></div>').insertAfter("#my-ajax-table")
$(".dynatable-record-count").insertAfter(".imadiv")
$(".dynatable-pagination-links").insertAfter(".imadiv")
// restore chart filters
if (typeof(filtersParams.from) != 'undefined'
&& typeof(filtersParams.to) != 'undefined'
......
......@@ -482,6 +482,9 @@ function Main_test( data , initial) {
$(".dynatable-record-count").insertAfter(".imadiv")
$(".dynatable-pagination-links").insertAfter(".imadiv")
$('<div class="imadiv"></div>').insertAfter("#my-ajax-table")
$(".dynatable-record-count").insertAfter(".imadiv")
$(".dynatable-pagination-links").insertAfter(".imadiv")
console.log("After table 3")
return "OK"
......
This diff is collapsed.
......@@ -169,8 +169,16 @@ $(document).on('keyup keydown', function(e){
var att_c = AttsDict_sorted[i].value;
var the_method = "clustersBy"
if(att_s.indexOf("clust")>-1) the_method = "colorsBy"
div_info += '<li><a href="#" onclick=\''+the_method+'("'+att_s+'" , "color")\'>By '+att_s+'('+att_c+')'+'</a></li>'
pr('<li><a href="#" onclick=\''+the_method+'("'+att_s+'" , "color")\'>By '+att_s+'('+att_c+')'+'</a></li>')
var method_label = att_s
if (att_s == "clust_default"){
method_label = "default";
}
else if (att_s == "clust_louvain"){
method_label = "community (louvain)"
}
div_info += '<li><a href="#" onclick=\''+the_method+'("'+att_s+'" , "color")\'>By '+method_label+'</a></li>'
// pr('<li><a href="#" onclick=\''+the_method+'("'+att_s+'" , "color")\'>By '+att_s+'('+att_c+')'+'</a></li>')
}
div_info += ' </ul>'
div_info += ' </li>'
......@@ -217,11 +225,12 @@ $(document).on('keyup keydown', function(e){
var att_c = AttsDict_sorted[i].value;
var the_method = "clustersBy"
if(att_s.indexOf("clust")>-1) the_method = "colorsBy"
div_info += '<li><a href="#" onclick=\''+the_method+'("'+att_s+'" , "size")\'>By '+att_s+'('+att_c+')'+'</a></li>'
pr('<li><a href="#" onclick=\''+the_method+'("'+att_s+'" , "size")\'>By '+att_s+'('+att_c+')'+'</a></li>')
console.log(att_s)
div_info += '<li><a href="#" onclick=\''+the_method+'("'+att_s+'" , "size")\'>By '+att_s+'</a></li>'
// pr('<li><a href="#" onclick=\''+the_method+'("'+att_s+'" , "size")\'>By '+att_s+'</a></li>')
}
div_info += '<li><a href="#" onclick=\''+"clustersBy"+'("default" , "size")\'>By '+"default"+'('+AttsDict_sorted[0].value+')'+'</a></li>'
console.log('<li><a href="#" onclick=\''+"clustersBy"+'("default" , "size")\'>By '+"default"+'('+AttsDict_sorted[0].value+')'+'</a></li>' )
div_info += '<li><a href="#" onclick=\''+"clustersBy"+'("default" , "size")\'>By '+"default"+'</a></li>'
//console.log('<li><a href="#" onclick=\''+"clustersBy"+'("default" , "size")\'>By '+"default"+'('+AttsDict_sorted[0].value+')'+'</a></li>' )
div_info += ' </ul>'
div_info += ' </li>'
......@@ -988,34 +997,72 @@ function camaraButton(){
*/
});
}
function updateLang(old_lang, new_lang){
console.log("Old", old_lang)
console.log("Updating to", new_lang)
//update lang in db
$.ajax({
url: '/api/user/parameters/',
type: 'PUT',
data: {"language":new_lang},
beforeSend: function(xhr) {
xhr.setRequestHeader("X-CSRFToken", getCookie("csrftoken"));
},
success: function(response, data) {
console.log(data)
var old_lang = $("a#lang").data("lang")
//var new_lang = data["language"]
//change active langue
$("a#lang").attr("data-lang", new_lang);
$("a#lang > img").attr({"value":new_lang, "src":"/static/img/"+new_lang+".png"})
$("a#lang > span").text(new_lang)
//switch lang to option
$("a.new_lang").attr("data-lang", old_lang);
$("a.new_lang > img").attr({"value":old_lang, "src":"/static/img/"+lang+".png"})
$("a.new_lang > span").text(old_lang)
console.log(response, data)
},
error: function(xhr) {
console.log("EDIT FAIL!")
},
});
console.log("defaut lang is now", $("a#lang").data("lang"))
};
function getTips(){
// console.log('FUN extras_explorerjs:getTips')
$("a.new_lang").on("click", function(){
//close all popover while changing lang
$("#tab-container").hide();
$("#tab-container-top").hide();
old_lang = $("a#lang").data("lang")
new_lang = $(this).data("lang")
updateLang(lang, new_lang);
});
active_lang = $("a#lang").data("lang")
param='';
text =
"<br>"+
"Basic Interactions:"+
"<ul>"+
"<li>Click on a node to select/unselect and get its information. In case of multiple selection, the button unselect clears all selections.</li>"+
"<li>The switch button switch allows to change the view type.</li>"+
"</ul>"+
"<br>"+
"Graph manipulation:"+
"<ul>"+
"<li>Link and node sizes indicate their strength.</li>"+
"<li>To fold/unfold the graph (keep only strong links or weak links), use the 'edges filter' sliders.</li>"+
"<li>To select a more of less specific area of the graph, use the 'nodes filter' slider.</li>"+
"</ul>"+
"<br>"+
"Micro/Macro view:"+
"<ul>"+
"<li>To explore the neighborhood of a selection, either double click on the selected nodes, either click on the macro/meso level button. Zoom out in meso view return to macro view.</li>"+
"<li>Click on the 'all nodes' tab below to view the full clickable list of nodes.</li>"+
"</ul>";
$("#tab-container").hide();
$("#tab-container-top").hide();
return text;
console.log("loading getTips in", active_lang)
$("a.new_lang").on("click", function(){
//close all popover while changing lang
$("#tab-container").hide();
$("#tab-container-top").hide();
old_lang = $("a#lang").data("lang")
new_lang = $(this).data("lang")
updateLang(lang, new_lang);
location.reload();
});
active_lang = $("a#lang").data("lang")
help = {"en":"<h4>Graph basic manipulation</h4><p>Whenever you click on a node inside the graph. This window will show the label of the node and the common expressions associated with the term.It will also display the list of associated documents. You can remove this node for candidate list by clicking on the button delete. You can edit the terms of this map by managing terms list<p> <a href='https://iscpif.fr/gargantext/improve-your-map/' target='_blank'>Discover how to improve your map</a>", "fr":"<h4>Manipuler les noeuds du graph</h4>"}
$("#tab-container").hide();
$("#tab-container-top").hide();
return help[active_lang];
}
......@@ -53,6 +53,7 @@
<!-- this is a vertical spacer used to start everything below dafixedtop -->
<div id="topspace">
</div>
<!-- this is the tweakbar -->
......@@ -61,6 +62,8 @@
<div id="left" class="col-sm-8 col-md-8 col-lg-7">
<ul class="nav navbar-nav">
<li class="basicitem"><a class="help" style="display:inline-block;padding:15px;" id="edition">
</a></li>
<!--
<li>
<a>
......@@ -83,11 +86,12 @@
<li class='basicitem'><a>
<!-- Create a subgraph -->
<ul id="category0" class="nav">
<li><small>Nodes</small> <div id="slidercat0nodesweight" class="settingslider"></div></li>
<li><small>Edges</small> <div id="slidercat0edgesweight" class="settingslider"></div></li>
<li><small class="help" id="nodeweight">Nodes</small> <div id="slidercat0nodesweight" class="settingslider"></div></li>
<li><small class="help" id="edgeweight">Edges</small> <div id="slidercat0edgesweight" class="settingslider"></div></li>
</ul>
</a></li>
<!-- <li class='basicitem'><a>
Compare<br>
<img width="30" title="Compare with other corpus!" onclick="GetUserPortfolio(); $('#corpuses').modal('show');" src="{% static "img/INTER.png" %}"></img>
......@@ -95,22 +99,22 @@
<li class='basicitem'><a>
<!-- TODO fix: category0 -> category1 switching -->
Label size<br>
<small class="help" id="labelsize">Label size<br></small>
<div id="slidercat0nodessize" class="settingslider"></div>
</a></li>
<li class='basicitem'><a>
Colors<br>
<li class='basicitem'><a >
<small class='help' id="colorgraph">Colors<br></small>
<div class="colorgraph_div"></div>
</a></li>
<li class='basicitem'><a>
Sizes<br>
<small class='help' id="sizegraph">Sizes<br></small>
<div class="sizegraph_div"></div>
</a></li>
<li class='basicitem'><a>
Selector size<br>
<small class='help' id="selectorsize">Selector size<br></small>
<div id="unranged-value" class="settingslider"></div>
</a></li>
<!--
......@@ -132,7 +136,7 @@
title="Add next search results to current selection"
class="btn btn-info"
type="checkbox"></input>
Add
<small class='help' id="addgraph">Add</small>
</div>
<!-- the smaller the viewport, the larger the relative search box size -->
......@@ -155,6 +159,8 @@
class="form-control"
placeholder="Search" />
<!-- #################################### -->
<span id="search" class="input-group-btn help">
</span>
</div>
<!-- messages below the search bar -->
<div id="unused_msg"></div>
......@@ -202,6 +208,9 @@
<ul id="ctlzoom">
<li >
<a style="display:inline-block;padding:5px;" id="exploration" class="help"></a>
</li>
<!-- <div class="content-header">
<button id="menu-toggle">X</button>
</div> -->
......@@ -246,18 +255,22 @@
</a>
</li>
</ul>
</div>
<!-- Sidebar -->
<div id="sidecolumn">
<div id="unfold">
<div id="unfold" class="help">
<!-- button to be replaced by handle when sidecolumn is hidden -->
<a href="#" id="aUnfold" class="rightarrow"></a>
</div>
<div id="tips"></div>
<div id="names"></div>
<div id="ngrams_actions"></div>
<div id="ngrams_actions" class="help"></div>
<br>
......@@ -478,6 +491,7 @@
<script src="{% static "lib/graphExplorer/tinawebJS/Tinaweb.js" %}" type="text/javascript" language="javascript"></script>
<script src="{% static "lib/graphExplorer/tinawebJS/main.js" %}" type="text/javascript" language="javascript"></script>
<script type="text/javascript">
// set exact height of topspace
var dafixedtopHeight = $('#dafixedtop').height() ;
......
......@@ -6,7 +6,7 @@
{% load staticfiles %}
<div class="container">
<h3>
<h3 class="help" id="filter_analytics">
<span class="glyphicon glyphicon-hand-right" aria-hidden="true"></span>
Filter your documents with terms and watch histories (you can compare all your corpora).
</h3>
......@@ -96,7 +96,7 @@
<auto-complete source="getNgrams($query)"></auto-complete>
</tags-input ng-model="tags">
</li>
<!-- filter hyperdata
<!-- filter hyperdata
<li>
<ul>
<li ng-repeat="hyperdata in hyperdataList">
......
{% extends "pages/menu.html" %}
{% extends "pages/menu.html"}
{% block css %}
{% load staticfiles %}
......@@ -87,5 +87,5 @@
<!-- custom-lib for dynatable.js and dc.js -->
<script type="text/javascript" src="{% static "lib/gargantext/Authors_dyna_chart_and_table.js" %}"></script>
<script type="text/javascript" src="{% static "lib/gargantext/help.js" %}"></script>
{% endblock %}
{% extends "pages/menu.html" %}
{% extends "pages/menu.html"%}
{% load staticfiles %}
{% block css %}
{% load staticfiles %}
<link rel="stylesheet" href="{% static "lib/bootstrap/3.0.2/bootstrap.css" %}">
<script type="text/javascript" src="{% static "lib/jquery/1.11.1/jquery.min.js" %}"></script>
<script type="text/javascript" src="{% static "lib/gargantext/garganrest.js" %}"></script>
......@@ -193,7 +193,7 @@
<script type="text/javascript" src="{% static "lib/gargantext/help.js" %}"></script>
<script type="text/javascript">
// initial vars
......
{% extends "pages/menu.html" %}
{% block css %}
{% extends "pages/menu.html"%}
{% load staticfiles %}
<link rel="stylesheet" type="text/css" href="{% static "lib/bootstrap/3.0.2/bootstrap.css" %}">
{% block 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"%}"/>
......@@ -21,33 +20,35 @@
<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 source
<b>y</b>: number of sources 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>
<div class="bs-callout">
<div class="row">
<div id="monthly-volume-chart"></div>
</div>
<div id="content_loader">
<br>
<div class="row">
<div id="monthly-move-chart">
<center>
<!-- <img width="10%" src="{% static "img/ajax-loader.gif"%}"></img> -->
<p class="help" id="sources_time">Select a time range in the chart with blue bars to zoom in </p>
<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>
<div class="clearfix"></div>
</center>
<br>
</div>
</div>
</div>
<div id="content_loader">
<br>
<center>
<img width="10%" src="{% static "img/ajax-loader.gif"%}"></img>
</center>
<br>
</div>
</div>
</div>
</div>
......@@ -87,5 +88,5 @@
<!-- custom-lib for dynatable.js and dc.js -->
<script type="text/javascript" src="{% static "lib/gargantext/Sources_dyna_chart_and_table.js" %}"></script>
<!-- <script type="text/javascript" src="{% static "lib/gargantext/help.js" %}"></script> -->
{% endblock %}
......@@ -78,15 +78,7 @@ em {
<div class="container">
<div class="col-md-3 col-md-offset-2">
<div id="monthly-move-chart">
<center>
Select a score/frequency range 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>
<div class="clearfix"></div>
</center>
</div>
<div class="bs-callout">
<div class="row">
......@@ -101,9 +93,21 @@ em {
<br>
</div>
</div>
</div>
</div>
<div id="monthly-move-chart" class="bs-callout">
<center>
<p id="terms_time" class="help">Select a score/frequency range in the chart with blue bars to zoom in <p>
<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>
<div class="clearfix"></div>
</center>
</div>
</div>
</div>
</div>
<div class="container">
<!-- (values set by js) caching our DB ids (handy for list update commands) -->
<input type="hidden" id="mainlist_id" value=""></input>
......@@ -136,12 +140,13 @@ em {
</button>
</div>
<!-- see in javascript function queries.functions['my_state_filter'] -->
<div class="pull-right" style="margin-top:2.1em;padding-left:1em;">
<div id="filter_terms" class="pull-right help" style="margin-top:2.1em;padding-left:1em;">
<select id="picklistmenu" name="my_state_filter">
<option value='reset'>All lists</option>
<option value='0'>Candidates terms</option>
<option value='reset'>All terms</option>
<!-- <option value='1' selected="selected">Map terms only</option> -->
<option value='1'>Map terms</option>
<option value='0'>Other terms</option>
<option value='2'>Stop terms</option>
</select>
<select id="picktermtype" name="my_termtype_filter" style="margin-left:1em;">
......@@ -457,7 +462,7 @@ function listmergeCsvPost(theFile){
}
};
</script>
<!-- <script type="text/javascript" src="{% static "lib/gargantext/help.js" %}"></script> -->
{% endblock %}
{% extends "pages/menu.html" %}
{% extends "pages/menu.html"%}
{% load staticfiles %}
{% block css %}
......@@ -19,30 +19,38 @@
<div class="container">
<div class="col-md-3 col-md-offset-2">
<div id="monthly-move-chart">
<center>
Select a time range 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>
<div class="clearfix"></div>
</center>
</div>
<div class="bs-callout">
<div class="row">
<div id="monthly-volume-chart"></div>
</div>
</div>
<div class="bs-callout">
<div class="row">
<div id="monthly-volume-chart"></div>
<div class="row">
<div id="monthly-move-chart">
<center>
<p class="help" id="titles_time">Select a time range in the chart with blue bars to zoom in </p>
<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>
<div class="clearfix"></div>
</center>
</div>
</div>
<div id="content_loader">
<br>
<center>
<img width="10%" src="{% static "img/ajax-loader.gif"%}"></img>
</center>
<br>
</div>
</div>
<div id="content_loader">
<br>
<center>
<img width="10%" src="{% static "img/ajax-loader.gif"%}"></img>
</center>
<br>
</div>
</div>
</div>
</div>
......@@ -77,7 +85,7 @@
</input>
</span>
<span class="glyphicon glyphicon-filter" aria-hidden="true"></span>
<select id="docFilter" name="docFilter">
<select id="docFilter" name="docFilter" class="help">
<option value="filter_all">All</option>
<option value="filter_favs">Favorite documents</option>
<option value="filter_dupl_all">Duplicates (title, date &amp; src)</option>
......@@ -102,5 +110,5 @@
<!-- custom-lib for dynatable.js and dc.js -->
<script type="text/javascript" src="{% static "lib/gargantext/Docs_dyna_chart_and_table.js" %}"></script>
<!-- <script type="text/javascript" src="{% static "lib/gargantext/help.js" %}"></script> -->
{% endblock %}
......@@ -17,6 +17,7 @@
<div class="col-md-4 content">
<h1>Gargantext</h1>
<p>A web platform to explore text-mining</p>
<a class="btn btn-primary btn-lg" href="/projects" title="Click and test by yourself">
<span class="glyphicon glyphicon-hand-right" aria-hidden="true"></span>
Enter in
......@@ -90,3 +91,4 @@
{% endblock %}
<script type="text/javascript" src="{% static "lib/gargantext/help.js" %}"></script>
......@@ -5,7 +5,7 @@
<script type="text/javascript" src="{% static "lib/jquery/1.11.1/jquery.min.js" %}"></script>
<link rel="stylesheet" type="text/css" href="{% static "lib/bootstrap/3.0.2/bootstrap.css" %}">
<link rel="stylesheet" type="text/css" href="{% static "lib/gargantext/menu.css"%}"/>
<!-- <script type="text/javascript" src="{% static "lib/gargantext/help.js" %}"></script> -->
{% block css %}
{% endblock %}
......@@ -21,11 +21,40 @@
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="/about/" title="More informations about the project, its sponsors and its authors.">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
About
</a>
</li>
<ul class="nav navbar-nav pull-left">
<li class="dropdown">
<a href="#" role="button" class="dropdown-toggle navbar-text" data-toggle="dropdown" title="Informations about Gargantext">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
Info
<i class="caret"></i>
</a>
<ul class="dropdown-menu">
<li>
<a
tabindex="-1" target="blank" title="Documentation and tutorials"
href='https://iscpif.fr/gargantext/your-first-map/' >
Documentation
</a>
</li>
<li class="divider"></li>
<li>
<a
tabindex="-1" target="blank" title="About"
href="/about/" title="More informations about the project, its sponsors and its authors">
About
</a>
</li>
</ul>
</li>
</ul>
{% if user.is_authenticated %}
<li><a href="/projects/" title="All your projects are here.">
<span class="glyphicon glyphicon-home" aria-hidden="true"></span>
......@@ -68,6 +97,8 @@
{% endif %}
</ul>
<ul class="nav navbar-nav pull-right">
<li class="dropdown">
<a href="#" role="button" class="dropdown-toggle navbar-text" data-toggle="dropdown" title="That is your username">
......@@ -102,7 +133,30 @@
{% endif %}
</ul>
</li>
{% if user.is_authenticated %}
<li class="nav-item dropdown lang">
<a class="nav-link dropdown-toggle" id="lang" data-lang="{{user_parameters.language}}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<img value="{{user_parameters.language}}" src="/static/img/{{user_parameters.language}}.png" width="25%"/>
<span class="label">{{user_parameters.language}}</span>
<i class="caret"></i>
</a>
<ul class="dropdown-menu" aria-labelledby="lang">
{% for lang in languages %}
{% if lang != user_parameters.language %}
<li class="dropdown-item new_lang">
<a class="new_lang" data-lang="{{lang}}"><img value="{{user_parameters.language}}" src="/static/img/{{lang}}.png" width="25%"/> <span>{{lang}}</span> </a></li>
{% endif %}
{% endfor %}
</ul>
</li>
{% endif %}
</ul>
</div>
</div>
{% if corpus %}
......@@ -209,6 +263,7 @@
{% if view != "graph" %}
<div class="container theme-showcase">
<div class="jumbotron" style="margin-bottom:0">
<br>
<br>
<br>
<div class="row">
......@@ -222,7 +277,10 @@
</div>
<!-- export button -->
<div class="col-md-6">
{% if view == 'terms' %}
<a id="export_terms" class="help btn pull-right">
</a>
<a class="btn btn-primary exportbtn pull-right" role="button"
href="/api/ngramlists/export?corpus={{corpus.id}}"
title="Export terms table in CSV">
......@@ -230,14 +288,11 @@
</a>
{% elif view == 'titles' %}
{% elif view == 'titles' %}
<a href="http://gitlab.iscpif.fr/humanities/gargantext/wikis/faq/exportImport" class="pull-right btn btn-lg">
<span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span>
<a id="export_corpus" class="help btn pull-right">
</a>
<a class="btn btn-primary exportbtn pull-right" role="button"
href="/api/nodes?parent_id={{corpus.id}}&types[]=DOCUMENT&pagination_limit=100000&formated=csv"
title="Export full corpus in CSV">
......@@ -252,6 +307,18 @@
{% else %}
<!-- TODO export source table -->
<!-- <a id="export_sources" class="help">
</a> -->
<!-- <a id="export_sources" class="help btn btn-primary exportbtn pull-right" role="button"
href="/api/nodes?parent_id={{corpus.id}}&types[]=DOCUMENT&pagination_limit=100000&formated=csv"
title="Export full corpus in CSV">
Export sources &nbsp;
<span class="glyphicon glyphicon-download" aria-hidden="true"></span>
</a><span class="help" id="export_sources"> -->
{% endif %}
</div>
</div>
......@@ -300,14 +367,14 @@
<p>
Gargantext
<span class="glyphicon glyphicon-registration-mark" aria-hidden="true"></span>
, version 3.0.5.7,
, version 3.0.6,
<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>
CNRS {{ date.year }}
</a>
<a href="http://www.gnu.org/licenses/agpl-3.0.html" target="blank" title="Legal instructions of the project.">
, Licence aGPLV3
<a href="http://gitlab.iscpif.fr/humanities/gargantext/blob/stable/LICENSE" target="blank" title="Legal instructions of the project.">
, Licences aGPLV3 and CECILL variant Affero compliant
</a>
.
</p>
......@@ -387,8 +454,9 @@
<script type="text/javascript" src="{% static "lib/gargantext/garganrest.js" %}"></script>
<!-- Graph renaming (load after garganrest)-->
<script type="text/javascript" src="{% static "lib/gargantext/graph_renamer.js" %}"></script>
<!-- <script type="text/javascript" src="{% static "lib/gargantext/help.js" %}"></script> -->
{% endif %}
<script type="text/javascript" src="{% static "lib/gargantext/help.js" %}"></script>
{% if debug == False %}
<!-- Piwik -->
......
{% if list_corpora %}
{% for key, corpora in list_corpora.items %}
<h2>
<div class="row">
<div class="col-md-1 content"></div>
<span class="glyphicon glyphicon-cd" aria-hidden="true"></span>
{{ key }}
</h2>
{% for corpus in corpora %}
<div id="corpus_{{corpus.id}}">
<div class="row">
<h4>
<div class="col-md-1 content"></div>
<div class="col-md-5 content">
<a href="/projects/{{project.id}}/corpora/{{corpus.id}}">
<span class="glyphicon glyphicon-file" aria-hidden="true"></span>
{{corpus.name}}, {{ corpus.count }} documents {{ corpus.status_message }}
</a>
</div>
<div class="col-md-3 content">
<!-- -->
{% for state in corpus.hyperdata.statuses %}
{% ifequal state.action "Workflow" %}
{% if state.complete %}
<a href="/projects/{{project.id}}/corpora/{{corpus.id}}" title="View the corpus">
<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 yopla" data-container="body" data-toggle="popover" data-placement="bottom" data-trigger="focus"
data-content="
<ul>
<li
onclick=&quot;
garganrest.metrics.update({{corpus.id}}, function(){alert('The corpus ({{corpus.name|escapejs}}) was updated')});
&quot;>
<a href='#'>Recalculate ngram metrics</a> <br/> (can take a little while)
</li>
</ul>
">
<span class="glyphicon glyphicon-repeat" aria-hidden="true"
title='Recalculate ngram scores and similarities'></span>
</button>
{% endif %}
<!-- TODO: delete non seulement si state.complete mais aussi si state.error -->
<button type="button" class="btn btn-default" data-container="body" data-toggle="popover" data-placement="bottom"
data-content="
<ul>
<li
onclick=&quot;
garganrest.nodes.delete({{corpus.id}}, function(){$('#corpus_'+{{corpus.id}}).remove()});
$(this).parent().parent().remove();
&quot;>
<a href='#'>Delete this</a>
</li>
</ul>
">
<span class="glyphicon glyphicon-trash" aria-hidden="true"
title='Delete this corpus'></span>
</button>
{% endifequal %}
{% endfor %}
</div>
<div class="col-md-3 content">
{% for state in corpus.hyperdata.statuses %}
{% ifequal state.action "Workflow" %}
{% if state.complete %}
<span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
{% else %}
{% if state.error %}
<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
{{ state.error }}
{% else %}
<div class="progress">
<div class=" progress-bar progress-bar-striped
progress-bar-success
"
role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: 20%">
<span>
Upload
</span>
</div>
{% for state in corpus.hyperdata.statuses %}
<div class=" progress-bar progress-bar-striped
{% if state.complete %}
progress-bar-success
{% else %}
active
{% endif %}
"
role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: 20%">
<span>
{{ state.action }}
{% if not state.complete %}
Processing
{% endif %}
</span>
</div>
{% endfor %}
</div>
{% endif %}
{% endif %}
{% endifequal %}
{% endfor %}
</div>
<div class="col-md-1 content"></div>
</h4>
</div>
</div>
{% endfor %}
{% endfor %}
{% endif %}
<div class="modal fade" id="stack1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3>Query to PubMed</h3>
</div>
<div class="modal-body">
<p>One fine body…</p>
<input id="daquery" type="text" class="input-lg" data-tabindex="2">
<a onclick="getGlobalResults();" class="btn">Scan</a>
<div id="results"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button onclick="doTheQuery();" disabled id="id_thebutton" type="button" class="btn btn-primary">Explore a sample!</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Modal -->
<div class="modal fade" id="addcorpus" tabindex="-1" role="dialog" aria-labelledby="myModalLabel2" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3>Add a Corpus <a href="https://gogs.iscpif.fr/humanities/faq_gargantext/wiki/FAQ#import--export-a-dataset">
<span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span>
</a>
</h3>
</div>
<div class="modal-body">
<!-- FAQ -->
<form id="id_form" enctype="multipart/form-data" action="/projects/{{project.id}}/" method="post">
{% csrf_token %}
<table cellpadding="5">
{% for field in form %}
<tr>
<th>{{field.label_tag}}</th>
<td>
{{ field.errors }}
{{ field }}
{% if field.name == 'name' %}
<span onclick="getGlobalResults(this);" id="scanpubmed"></span>
<div id="theresults"></div>
{% endif %}
</td>
</tr>
{% endfor %}
<tr>
<th></th>
<td>
<div id="pubmedcrawl" style="visibility: hidden;">
Do you have a file already? &nbsp;
<input type="radio" id="file_yes" name="file1" onclick="FileOrNotFile(this.value);" class="file1" value="true" checked> Yes </input>
<input type="radio" id="file_no" name="file1" onclick="FileOrNotFile(this.value);" class="file1" value="false"> No </input>
</div>
</td>
</tr>
</table>
</form>
<div class="modal-footer">
<!-- <div id="pubmedcrawl" align="right" style="visibility: hidden;"><a data-toggle="modal" href="#stack1">&#10142; Query directly in PubMed</a></div> -->
<button type="button" class="btn btn-default" data-dismiss="modal">
<span class="glyphicon glyphicon-remove" aria-hidden="true" ></span>
Close
</button>
<button onclick='bringDaNoise();' id="submit_thing" disabled class="btn btn-primary" >
<span class="glyphicon glyphicon-ok" aria-hidden="true" ></span>
Process this!
</button><span id="simpleloader"></span>
</div>
</div>
</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">
<h5>
Your file has been uploaded !
Gargantext need some time to eat it.
Duration depends on the size of the dish.
</h5>
</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 -->
This diff is collapsed.
This diff is collapsed.
......@@ -49,11 +49,12 @@
</div>
<div class="col-md-3"></div>
<div class="col-md-5">
<p>
<p id="project" class="help">
<br>
<button id="add" type="button" class="btn btn-primary btn-lg" data-container="body" data-toggle="popover" data-placement="bottom">
<button id="add" type="button" class="btn btn-primary btn-lg help" data-container="body" data-toggle="popover" data-placement="bottom">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
Add a new project
</button>
<div id="popover-content" class="hide">
<div id="createForm" class="form-group">
......@@ -72,7 +73,7 @@
</div>
</div>
</div>
</p>
</p>
</div>
</div>
</div>
......@@ -86,11 +87,11 @@
</div>
<!-- CHECKBOX EDITION -->
<!--
<div class="row collapse" id="editor">
<button title="delete selected project" type="button" class="btn btn-danger" id="delete">
<span class="glyphicon glyphicon-trash " aria-hidden="true" ></span>
</button>
<!--
<button title="edit selected project" type="button" class="btn btn-warning" id="edit">
<span class="glyphicon glyphicon-pencil " aria-hidden="true" onclick="editProjects()"></span>
</button> -->
......@@ -117,7 +118,9 @@
<div id="{url}" class="item row">
<h3>
<div class="col-md-6 content">
<!--
<input type="checkbox" value="{url}" data-id="{id}">
-->
<a href="{url}">
<span class="glyphicon glyphicon-book" aria-hidden="true"></span>
<span class="item_name">{name}</span>
......@@ -182,7 +185,9 @@
</style>
<script type="text/javascript" src="{% static "lib/gargantext/garganrest_projects.js" %}"></script>
<!-- <script type="text/javascript" src="{% static "lib/gargantext/help.js" %}"></script> -->
<script type="text/javascript">
getProjects();
// $(document).on("input#inoutName").bind('keypress', function(e) {
// if(e.keyCode==13){
......
......@@ -11,6 +11,7 @@
<link rel="stylesheet" href="{% static "lib/morris/morris.css" %}">
<script src="{% static "lib/raphael/raphael-min.js"%}"></script>
<style type="text/css">
.ui-autocomplete {
z-index: 5000;
......@@ -53,9 +54,11 @@
{% if donut %}
<div id="hero-donut" style="height: 200px;"></div>
{% endif %}
<center>
<a data-toggle="modal" href="#addcorpus">
<center id="corpus" class="help">
<a data-toggle="modal" href="#addcorpus" >
<button
type="button"
class="btn btn-primary btn-lg"
......@@ -66,8 +69,13 @@
<span class="glyphicon glyphicon-plus" aria-hidden="true" ></span>
Add a corpus
</button>
</a>
</center>
</p>
</div>
</div>
......@@ -256,8 +264,7 @@
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3>Add a Corpus <a href="http://gitlab.iscpif.fr/humanities/gargantext/wikis/faq/exportImport">
<span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span>
<h3 id="corpus" class="help">Add a Corpus
</a>
</h3>
</div>
......@@ -331,6 +338,7 @@
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script type="text/javascript" src="{% static "lib/jquery/1.11.2/jquery-ui.js" %}"></script>
<!-- <script type="text/javascript" src="{% static "lib/gargantext/help.js" %}"></script> -->
<script type="text/javascript">
var corporaDivs = document.getElementsByClassName('corpusElt')
......
{% for state in corpus.hyperdata.statuses %}
{% ifequal state.action "Workflow" %}
{% if state.complete %}
<span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
{% else %}
{% if state.error %}
<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
{{ state.error }}
{% else %}
<div class="progress">
{% for state in corpus.hyperdata.statuses %}
{% if state.action != "Workflow" %}
<div class=" progress-bar progress-bar-striped
{% if state.complete %}
progress-bar-success
{% else %}
active
{% endif %}
"
role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: 25%">
<span>
{{ state.action }}
{% if state.complete %}
Ok
{% else %}
Processing
{% endif %}
</span>
</div>
{% endif %}
{% endfor %}
</div>
{% endif %}
{% endif %}
{% endifequal %}
{% endfor %}
function manageStatus(statuses){
status_bar = ""
status_bar += '<div class="progress">'
statuses.forEach(function (status){
if (status["action"] == "Workflow"){
if (status["complete"]){
status_bar += '<span class="glyphicon glyphicon-ok pull-right" aria-hidden="true"></span></div>'
return status_bar;
};
else if (status["error"]) {
status_bar += '<span class="glyphicon glyphicon-exclamation-sign pull-right" aria-hidden="true"></span></div>'
return status_bar;
};
else{
};
};
else{
status_bar +='<div class=" progress-bar progress-bar-striped'
if (status["complete"]){
status_bar +='progress-bar-sucess'
};
else{
status_bar +='active'
};
status_bar+= '" role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: 25%"> <span>'
if (status["action"]){
if (status["complete"]){
status_bar+= " OK </span></div>"
};
else{
status_bar+= " Processing </span>"
};
}
});
}
}
})
status_bar+="</div>"
return status_bar
};
console.log(errors)
errors.forEach(function(err) {
div = err[0].split(" ")
logs = []
logs.push(div[0])
if (err[1] == false)
{
alert(div[0])
//$(div[0]).parent().addClass("alert danger error");
$(div[0]).next(div[1]).collapse("show");
//$(div[0]).find(div[1]).collapse("show")
}
else
{
$("<span class='glyphicon glyphicon-ok' aria-hidden='true'>").appendTo(div[0])
}
});
return errors
};
function checkInput(source){
if (source.val().length > 0){
return true
}
else {
return false
}
}
function checkSourceFormat(){
source = $("select#source").find(':selected')
if (source.val() != '') {
console.log(source)
source_data = source.data("format")
alert(source_data)
formats = source_data.split(',');
alert(formats);
extension = $("#file").val().substr( (filename.lastIndexOf('.') +1) );
if ($.inArray(extension, formats) == -1){
//$("span.format").collapse("show");
return false;
}
else{
//$("span.format").collapse("hide");
return true;
}
}
return true
}
function checkFileSize(filesize, max_size){
if (filesize > max_size){
return true
}
else{
return false
}
};
//ADD CORPUS FORM
// //source
// $('#source').change(function() {
// $("#source").next("span.required").collapse("hide");
// source_type = $('#source').find(":selected");
// var formats = source_type.data("format").split(',');
// if (formats.length == 0){
// $("#source").next("span.required").collapse("show");
//
// }
// else{
// $("#source").next("span.required").collapse("hide");
// }
// });
// //file
// var max_size = parseInt($('#file').data("max-size"));
// $('#file').change(function() {
// var filesize = parseInt(this.files[0].size);
// if( filesize > max_size){
// alert("Upload file can't exceed 1 Mo because Gargantext would have an indigestion. Consult the special diet of Gargantext in our FAQ")
// $("#file").empty();
// };
// });
//
//
// });
$("#create").bind("click",function(){
var method = $('#radioBtn').find('a.active').data("title");
errors = checkForm()
if (has_error == "true"){
alert("Invalid Form");
}
else{
alert("OK")
//if (checkFileExtension() == true){
//preparePost(method, form)
//}
}
});
/////////////////FORM VALIDATION
function checkFilename(filename){
if (filename == ""){
$("#filename").next("span.required").collapse("show");
return false;
}
else{
$("#file").next("span.required").collapse("hide");
return true;
}
};
function checkFileSize(filesize, max_size){
if (filesize > max_size){
$("span.size").collapse("show");
}
else{
$("span.size").collapse("hide");
}
};
function checkFileExtension(){
filename = $('#file').val()
source_type = $('#source').find(":selected");
if (filename != "" && source_type.val() !== "0"){
fextension = filename.substr( (filename.lastIndexOf('.') +1) );
var formats = source_type.data("format").split(',');
if ($.inArray(extension, formats) == -1){
$("span.format").collapse("show");
return false;
}
else{
$("span.format").collapse("hide");
return true;
}
}
};
//name
$("span.error").collapse("hide");
$('#name').on('input', function() {
var input=$(this);
var is_name=input.val();
if ( is_name.length < 0){
$("#name").next("span.required").collapse("show");
$("form-group#name").addClass("error");
}
else {
$("#name").next("span").collapse("hide");
}
});
//source
$('#source').change(function() {
$("#source").next("span.required").collapse("hide");
source_type = $('#source').find(":selected");
var formats = source_type.data("format").split(',');
if (formats.length == 0){
$("#source").next("span.required").collapse("show");
}
else{
$("#source").next("span.required").collapse("hide");
}
});
//file
var max_size = parseInt($('#file').data("max-size"));
$('#file').change(function() {
$('#name span').collapse("hide");
var input=$(this);
var filename= input.val()
var filesize = parseInt(this.files[0].size);
checkFileSize(filesize, max_size);
});
//console.log("ERRORS?,)
$("#create").bind("click",function(){
var method = $('#radioBtn').find('a.active').data("title");
has_error = $("span.error").hasClass("collapse in");
if (has_error == "true"){
alert("Invalid Form");
}
else{
if (checkFileExtension() == true){
//preparePost(method, form)
}
}
});
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