Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
humanities
gargantext
Commits
329a9f82
Commit
329a9f82
authored
Jan 28, 2016
by
PkSM3
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[BUGFIX] explorer sharing
parent
47f6061a
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
262 additions
and
98 deletions
+262
-98
corpus_views.py
gargantext_web/corpus_views.py
+3
-3
views.py
gargantext_web/views.py
+30
-9
views_optimized.py
gargantext_web/views_optimized.py
+1
-1
ngrams.py
rest_v1_0/ngrams.py
+14
-6
views.py
scrappers/scrap_pubmed/views.py
+2
-2
NGrams_dyna_chart_and_table.js
static/js/NGrams_dyna_chart_and_table.js
+207
-72
authentication.html
templates/authentication.html
+3
-3
views.py
tests/ngramstable/views.py
+2
-2
No files found.
gargantext_web/corpus_views.py
View file @
329a9f82
...
...
@@ -58,7 +58,7 @@ from ngram.lists import listIds, listNgramIds, ngramList , doList
def
test_page
(
request
,
project_id
,
corpus_id
):
if
not
request
.
user
.
is_authenticated
():
return
redirect
(
'/
login
/?next=
%
s'
%
request
.
path
)
return
redirect
(
'/
auth
/?next=
%
s'
%
request
.
path
)
try
:
offset
=
int
(
project_id
)
...
...
@@ -96,7 +96,7 @@ def test_page(request , project_id , corpus_id):
def
get_ngrams
(
request
,
project_id
,
corpus_id
):
if
not
request
.
user
.
is_authenticated
():
return
redirect
(
'/
login
/?next=
%
s'
%
request
.
path
)
return
redirect
(
'/
auth
/?next=
%
s'
%
request
.
path
)
try
:
offset
=
int
(
project_id
)
...
...
@@ -170,7 +170,7 @@ def test_test(request , corpus_id , doc_id):
def
get_journals
(
request
,
project_id
,
corpus_id
):
if
not
request
.
user
.
is_authenticated
():
return
redirect
(
'/
login
/?next=
%
s'
%
request
.
path
)
return
redirect
(
'/
auth
/?next=
%
s'
%
request
.
path
)
try
:
offset
=
int
(
project_id
)
...
...
gargantext_web/views.py
View file @
329a9f82
...
...
@@ -51,9 +51,25 @@ from gargantext_web.db import session, cache, NodeNgram, NodeNgramNgram
def
login_user
(
request
):
logout
(
request
)
username
=
password
=
''
print
(
request
)
if
request
.
POST
:
next_page
=
""
if
request
.
method
==
"GET"
:
additional_context
=
{}
# if for exemple: auth/?next=/project/5/corpus/554/document/556/
# => we'll forward ?next="..." into template with form
if
(
'next'
in
request
.
GET
):
additional_context
=
{
'next_page'
:
request
.
GET
[
'next'
]}
return
render_to_response
(
'authentication.html'
,
additional_context
,
context_instance
=
RequestContext
(
request
)
)
elif
request
.
method
==
"POST"
:
username
=
request
.
POST
[
'username'
]
# /!\ pass is sent clear in POST data
password
=
request
.
POST
[
'password'
]
user
=
authenticate
(
username
=
username
,
password
=
password
)
...
...
@@ -61,8 +77,13 @@ def login_user(request):
if
user
.
is_active
:
login
(
request
,
user
)
return
HttpResponseRedirect
(
'/projects/'
)
return
render_to_response
(
'authentication.html'
,
context_instance
=
RequestContext
(
request
))
# if "next" forwarded from the GET via the template form
if
(
'the_next_page'
in
request
.
POST
):
return
HttpResponseRedirect
(
request
.
POST
[
'the_next_page'
])
else
:
return
HttpResponseRedirect
(
'/projects/'
)
def
logout_user
(
request
):
logout
(
request
)
...
...
@@ -297,7 +318,7 @@ def update_nodes(request, project_id, corpus_id, view=None):
'''
if
not
request
.
user
.
is_authenticated
():
return
redirect
(
'/
login
/?next=
%
s'
%
request
.
path
)
return
redirect
(
'/
auth
/?next=
%
s'
%
request
.
path
)
try
:
offset
=
int
(
project_id
)
...
...
@@ -360,7 +381,7 @@ def update_nodes(request, project_id, corpus_id, view=None):
def
corpus
(
request
,
project_id
,
corpus_id
):
if
not
request
.
user
.
is_authenticated
():
return
redirect
(
'/
login
/?next=
%
s'
%
request
.
path
)
return
redirect
(
'/
auth
/?next=
%
s'
%
request
.
path
)
try
:
offset
=
int
(
project_id
)
...
...
@@ -488,7 +509,7 @@ def move_to_trash_multiple(request):
user
=
request
.
user
if
not
user
.
is_authenticated
():
return
redirect
(
'/
login
/?next=
%
s'
%
request
.
path
)
return
redirect
(
'/
auth
/?next=
%
s'
%
request
.
path
)
results
=
[
"operation"
,
"failed"
]
...
...
@@ -516,7 +537,7 @@ def delete_node(request, node_id):
node
=
session
.
query
(
Node
)
.
filter
(
Node
.
id
==
node_id
)
.
first
()
if
not
user
.
is_authenticated
():
return
redirect
(
'/
login
/?next=
%
s'
%
request
.
path
)
return
redirect
(
'/
auth
/?next=
%
s'
%
request
.
path
)
if
node
.
user_id
!=
user
.
id
:
return
HttpResponseForbidden
()
...
...
@@ -618,7 +639,7 @@ def graph(request, project_id, corpus_id, generic=100, specific=100):
corpus_type_id
=
cache
.
NodeType
[
'Corpus'
]
.
id
miamlist_type_id
=
cache
.
NodeType
[
'MiamList'
]
.
id
miamlist
=
session
.
query
(
Node
)
.
filter
(
Node
.
user_id
==
request
.
user
.
id
,
Node
.
parent_id
==
corpus_id
,
Node
.
type_id
==
cache
.
NodeType
[
'MiamList'
]
.
id
)
.
first
()
miamlist
=
session
.
query
(
Node
)
.
filter
(
Node
.
parent_id
==
corpus_id
,
Node
.
type_id
==
cache
.
NodeType
[
'MiamList'
]
.
id
)
.
first
()
graphurl
=
"corpus/"
+
str
(
corpus_id
)
+
"/node_link.json"
...
...
gargantext_web/views_optimized.py
View file @
329a9f82
...
...
@@ -52,7 +52,7 @@ def project(request, project_id):
# do we have a valid user?
user
=
request
.
user
if
not
user
.
is_authenticated
():
return
redirect
(
'/
login
/?next=
%
s'
%
request
.
path
)
return
redirect
(
'/
auth
/?next=
%
s'
%
request
.
path
)
if
project
.
user_id
!=
user
.
id
:
in_group
=
""" SELECT user_parent FROM node_user_user WHERE user_id=
%
d"""
%
(
int
(
user
.
id
)
)
cursor
=
connection
.
cursor
()
...
...
rest_v1_0/ngrams.py
View file @
329a9f82
...
...
@@ -399,12 +399,20 @@ class Group(APIView):
max_deg
=
-
1
mainNode
=
-
1
mainNode_sinonims
=
[]
for
node
in
clique
:
groups
[
"nodes"
][
node
]
=
False
node_outdeg
=
DG
.
out_degree
(
node
)
if
node_outdeg
>
max_deg
:
max_deg
=
node_outdeg
mainNode
=
node
if
len
(
clique
)
>
1
:
for
node
in
clique
:
# just a lookup hash with *both*
# the mainNode and the subnodes
groups
[
"nodes"
][
node
]
=
False
# choosing mainNode
node_outdeg
=
DG
.
out_degree
(
node
)
if
node_outdeg
>
max_deg
:
max_deg
=
node_outdeg
mainNode
=
node
# the links themselves main => [subs]
for
node
in
clique
:
if
mainNode
!=
node
:
mainNode_sinonims
.
append
(
node
)
...
...
scrappers/scrap_pubmed/views.py
View file @
329a9f82
...
...
@@ -104,7 +104,7 @@ def doTheQuery(request , project_id):
# do we have a valid user?
user
=
request
.
user
if
not
user
.
is_authenticated
():
return
redirect
(
'/
login
/?next=
%
s'
%
request
.
path
)
return
redirect
(
'/
auth
/?next=
%
s'
%
request
.
path
)
if
project
.
user_id
!=
user
.
id
:
return
HttpResponseForbidden
()
...
...
@@ -208,7 +208,7 @@ def testISTEX(request , project_id):
# do we have a valid user?
user
=
request
.
user
if
not
user
.
is_authenticated
():
return
redirect
(
'/
login
/?next=
%
s'
%
request
.
path
)
return
redirect
(
'/
auth
/?next=
%
s'
%
request
.
path
)
if
project
.
user_id
!=
user
.
id
:
return
HttpResponseForbidden
()
...
...
static/js/NGrams_dyna_chart_and_table.js
View file @
329a9f82
This diff is collapsed.
Click to expand it.
templates/authentication.html
View file @
329a9f82
...
...
@@ -62,8 +62,8 @@
<div
id=
"login"
>
<form
class=
"form-horizontal"
name=
"LoginForm"
action=
"/auth/"
method=
"post"
>
{% csrf_token %}
{% if next %}
<input
type=
"hidden"
name=
"
next"
value=
"{{ next
}}"
/>
{% if next
_page
%}
<input
type=
"hidden"
name=
"
the_next_page"
value=
"{{ next_page
}}"
/>
{% endif %}
<div
class=
"grp-row"
>
<label
class=
"control-label"
for=
"username"
>
Username
</label>
...
...
@@ -102,4 +102,4 @@
})(
grp
.
jQuery
);
</script>
</body>
</html>
\ No newline at end of file
</html>
tests/ngramstable/views.py
View file @
329a9f82
...
...
@@ -50,7 +50,7 @@ from rest_v1_0.api import JsonHttpResponse
def
get_ngrams
(
request
,
project_id
,
corpus_id
):
if
not
request
.
user
.
is_authenticated
():
return
redirect
(
'/
login
/?next=
%
s'
%
request
.
path
)
return
redirect
(
'/
auth
/?next=
%
s'
%
request
.
path
)
try
:
offset
=
int
(
project_id
)
...
...
@@ -108,7 +108,7 @@ def get_ngrams(request , project_id , corpus_id ):
def
get_journals
(
request
,
project_id
,
corpus_id
):
if
not
request
.
user
.
is_authenticated
():
return
redirect
(
'/
login
/?next=
%
s'
%
request
.
path
)
return
redirect
(
'/
auth
/?next=
%
s'
%
request
.
path
)
try
:
offset
=
int
(
project_id
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment