Skip to content
GitLab
Explore
Sign in
Commits on Source (1)
Add the mark list for admin (one shared html file between submitter and admin)
· 37c908d9
Marco De Donno
authored
Feb 05, 2020
37c908d9
Hide whitespace changes
Inline
Side-by-side
views/submission/__init__.py
View file @
37c908d9
...
...
@@ -739,7 +739,7 @@ def submission_mark_list( submission_id, mark_type = "all" ):
nickname
=
do_decrypt_user_session
(
nickname
)
sql
=
"""
SELECT files.uuid, files.filename, files.size, files.creation_time
SELECT
files.id,
files.uuid, files.filename, files.size, files.creation_time
FROM files
LEFT JOIN files_type ON files.type = files_type.id
WHERE folder = %s AND
...
...
@@ -761,11 +761,12 @@ def submission_mark_list( submission_id, mark_type = "all" ):
current_app
.
logger
.
debug
(
"
{} marks for
'
{}
'"
.
format
(
len
(
files
),
submission_id
)
)
return
my_render_template
(
"
s
ubmission
/mark_list.html
"
,
"
s
hared
/mark_list.html
"
,
submission_id
=
submission_id
,
mark_type
=
mark_type
,
files
=
files
,
nickname
=
nickname
nickname
=
nickname
,
admin
=
False
)
else
:
...
...
@@ -1853,3 +1854,46 @@ def admin_submission_gp( submission_id ):
"
message
"
:
"
Case not found
"
}
)
@submission_view.route
(
"
/admin/submission/<submission_id>/mark/list
"
)
@submission_view.route
(
"
/admin/submission/<submission_id>/mark/list/<mark_type>
"
)
@submission_has_access
def
admin_submission_mark_list
(
submission_id
,
mark_type
=
"
all
"
):
current_app
.
logger
.
info
(
"
Get the list of mark for the submission
'
{}
'"
.
format
(
submission_id
)
)
current_app
.
logger
.
debug
(
"
mark_type: {}
"
.
format
(
mark_type
)
)
if
mark_type
in
[
"
target
"
,
"
incidental
"
,
"
all
"
]:
sql
=
"
SELECT id FROM submissions WHERE uuid = %s
"
case_id
,
=
config
.
db
.
query_fetchone
(
sql
,
(
submission_id
,
)
)
sql
=
"""
SELECT files.id, files.uuid, files.filename, files.size, files.creation_time
FROM files
LEFT JOIN files_type ON files.type = files_type.id
WHERE folder = %s AND
"""
if
mark_type
==
"
target
"
:
sql
+=
"
files_type.name =
'
mark_target
'"
elif
mark_type
==
"
incidental
"
:
sql
+=
"
files_type.name =
'
mark_incidental
'"
elif
mark_type
==
"
all
"
:
sql
+=
"
( files_type.name =
'
mark_target
'
OR files_type.name =
'
mark_incidental
'
)
"
sql
+=
"
ORDER BY files.id DESC
"
files
=
config
.
db
.
query_fetchall
(
sql
,
(
case_id
,
)
)
for
_
,
v
in
enumerate
(
files
):
v
[
"
filename
"
]
=
do_decrypt_user_session
(
v
[
"
filename
"
]
)
v
[
"
size
"
]
=
round
(
(
float
(
v
[
"
size
"
]
)
/
(
1024
*
1024
)
)
*
100
)
/
100
current_app
.
logger
.
debug
(
"
{} marks for
'
{}
'"
.
format
(
len
(
files
),
submission_id
)
)
return
my_render_template
(
"
shared/mark_list.html
"
,
submission_id
=
submission_id
,
mark_type
=
mark_type
,
files
=
files
,
admin
=
True
)
else
:
return
abort
(
403
)
views/submission/templates/admin/submission_home.html
View file @
37c908d9
...
...
@@ -83,6 +83,11 @@
window
.
location
=
"
{{ url_for( 'submission.admin_tenprint_list', submission_id = donor[ 'uuid' ] ) }}
"
;
}
);
$
(
"
#lt_button
"
).
on
(
"
click
"
,
function
()
{
window
.
location
=
"
{{ url_for( 'submission.admin_submission_mark_list', submission_id = donor[ 'uuid' ] ) }}
"
;
}
);
$
(
"
#icnml_navigation_updatedonor
"
)
.
addClass
(
"
activated
"
);
...
...
views/submission/templates/s
ubmission
/mark_list.html
→
views/submission/templates/s
hared
/mark_list.html
View file @
37c908d9
...
...
@@ -13,8 +13,11 @@
<script
type=
"text/javascript"
>
baseurl
=
"
{{ baseurl }}
"
;
var
password_local
=
decrypt
(
sessionStorage
.
getItem
(
"
session_key
"
),
"
{{ session_security_key }}
"
);
var
nickname
=
decrypt
(
"
{{ nickname }}
"
,
password_local
);
{
%
if
not
admin
%
}
var
password_local
=
decrypt
(
sessionStorage
.
getItem
(
"
session_key
"
),
"
{{ session_security_key }}
"
);
var
nickname
=
decrypt
(
"
{{ nickname }}
"
,
password_local
);
{
%
endif
%
}
var
marks_list
=
new
Array
();
{
%
for
file
in
files
%
}
...
...
@@ -33,9 +36,9 @@
if
(
filename
.
indexOf
(
searched
)
>=
0
)
{
$
(
"
#mark_
"
+
uuid
).
show
();
}
else
{
$
(
"
#mark_
"
+
uuid
).
hide
();
}
}
else
{
$
(
"
#mark_
"
+
uuid
).
hide
();
}
}
}
</script>
...
...
@@ -104,38 +107,47 @@
$
(
"
#icnml_navigation_updatedonor
"
)
.
addClass
(
"
activated
"
);
{
%
for
file
in
files
%
}
$
(
"
#mark_{{ file[ 'uuid' ] }}_filename
"
)
.
text
(
decrypt
(
"
{{ file[ 'filename' ] }}
"
,
password_local
)
);
{
%
endfor
%
}
{
%
if
not
admin
%
}
{
%
for
file
in
files
%
}
$
(
"
#mark_{{ file[ 'uuid' ] }}_filename
"
)
.
text
(
decrypt
(
"
{{ file[ 'filename' ] }}
"
,
password_local
)
);
{
%
endfor
%
}
{
%
else
%
}
{
%
for
file
in
files
%
}
$
(
"
#mark_{{ file[ 'uuid' ] }}_filename
"
)
.
text
(
"
Mark {{ file[ 'id' ] }}
"
);
{
%
endfor
%
}
{
%
endif
%
}
$
(
"
#navloc
"
).
append
(
$
(
"
<a />
"
)
.
attr
(
"
href
"
,
"
{{ url_for( 'submission.submission_list' ) }}
"
)
.
text
(
"
Submissions
"
)
)
.
append
(
$
(
"
<span />
"
).
text
(
"
>
"
)
)
.
append
(
$
(
"
<a />
"
)
.
attr
(
"
href
"
,
"
{{ url_for( 'submission.submission_upload_tplp', submission_id = submission_id ) }}
"
)
.
text
(
nickname
)
)
.
append
(
$
(
"
<span />
"
).
text
(
"
>
"
)
)
.
append
(
$
(
"
<a />
"
)
.
attr
(
"
href
"
,
"
{{ url_for( 'submission.submission_mark_list', submission_id = submission_id, mark_type = 'all' ) }}
"
)
.
text
(
"
Marks
"
)
)
.
append
(
$
(
"
<span />
"
).
text
(
"
>
"
)
)
.
append
(
$
(
"
<span />
"
).
text
(
"
{{ mark_type }}
"
)
);
{
%
if
not
admin
%
}
$
(
"
#navloc
"
).
append
(
$
(
"
<a />
"
)
.
attr
(
"
href
"
,
"
{{ url_for( 'submission.submission_list' ) }}
"
)
.
text
(
"
Submissions
"
)
)
.
append
(
$
(
"
<span />
"
).
text
(
"
>
"
)
)
.
append
(
$
(
"
<a />
"
)
.
attr
(
"
href
"
,
"
{{ url_for( 'submission.submission_upload_tplp', submission_id = submission_id ) }}
"
)
.
text
(
nickname
)
)
.
append
(
$
(
"
<span />
"
).
text
(
"
>
"
)
)
.
append
(
$
(
"
<a />
"
)
.
attr
(
"
href
"
,
"
{{ url_for( 'submission.submission_mark_list', submission_id = submission_id, mark_type = 'all' ) }}
"
)
.
text
(
"
Marks
"
)
)
.
append
(
$
(
"
<span />
"
).
text
(
"
>
"
)
)
.
append
(
$
(
"
<span />
"
).
text
(
"
{{ mark_type }}
"
)
);
{
%
endif
%
}
</script>
</body>
</html>
...
...