Skip to content
GitLab
Explore
Sign in
Commits on Source (4)
Rename the variable upload_uuid to submission_uuid
· bed092be
Marco De Donno
authored
Sep 03, 2019
bed092be
Add the tenprint quality field on the tenprint page
· 6b62ebfe
Marco De Donno
authored
Sep 03, 2019
6b62ebfe
Style update
· a38b0451
Marco De Donno
authored
Sep 03, 2019
a38b0451
Add the sql files to install the tenprint file quality field
· 41e1b3c6
Marco De Donno
authored
Sep 03, 2019
41e1b3c6
Show whitespace changes
Inline
Side-by-side
module.py
View file @
41e1b3c6
...
...
@@ -1408,9 +1408,9 @@ def upload_file():
else
:
try
:
upload
_uuid
=
request
.
form
.
get
(
"
submission_id
"
)
submission
_uuid
=
request
.
form
.
get
(
"
submission_id
"
)
sql
=
"
SELECT id FROM submissions WHERE uuid = %s
"
r
=
config
.
db
.
query
(
sql
,
(
upload
_uuid
,
)
)
r
=
config
.
db
.
query
(
sql
,
(
submission
_uuid
,
)
)
submission_id
=
r
.
fetchone
()[
"
id
"
]
except
:
...
...
@@ -1433,7 +1433,7 @@ def upload_file():
if
file_extension
in
config
.
NIST_file_extensions
:
file_data
=
fp
.
getvalue
()
file_data
=
base64
.
b64encode
(
file_data
)
file_data
=
do_encrypt_dek
(
file_data
,
upload
_uuid
)
file_data
=
do_encrypt_dek
(
file_data
,
submission
_uuid
)
try
:
n
=
NISTf_auto
(
fp
)
...
...
@@ -1462,7 +1462,7 @@ def upload_file():
buff
.
seek
(
0
)
img_data
=
buff
.
getvalue
()
img_data
=
base64
.
b64encode
(
img_data
)
img_data
=
do_encrypt_dek
(
img_data
,
upload
_uuid
)
img_data
=
do_encrypt_dek
(
img_data
,
submission
_uuid
)
sql
=
sql_insert_generate
(
"
files_segments
"
,
[
"
tenprint
"
,
"
uuid
"
,
"
pc
"
,
"
data
"
]
)
data
=
(
file_uuid
,
str
(
uuid4
()
),
fpc
,
img_data
,
)
...
...
@@ -1505,7 +1505,7 @@ def upload_file():
file_data
=
buff
.
getvalue
()
if
upload_type
in
[
"
tenprint_card_front
"
,
"
tenprint_card_back
"
]:
create_thumbnail
(
file_uuid
,
img
,
upload
_uuid
)
create_thumbnail
(
file_uuid
,
img
,
submission
_uuid
)
else
:
file_data
=
fp
.
getvalue
()
...
...
@@ -1520,7 +1520,7 @@ def upload_file():
if
upload_type
==
"
consent_form
"
:
sql
=
"
SELECT email_aes FROM submissions WHERE uuid = %s
"
email
=
config
.
db
.
query_fetchone
(
sql
,
(
upload
_uuid
,
)
)[
"
email_aes
"
]
email
=
config
.
db
.
query_fetchone
(
sql
,
(
submission
_uuid
,
)
)[
"
email_aes
"
]
email
=
do_decrypt_user_session
(
email
)
sql
=
"
SELECT username, email FROM users WHERE type = 2 ORDER BY id DESC
"
...
...
@@ -1578,12 +1578,12 @@ def upload_file():
config
.
db
.
query
(
sql
,
data
)
sql
=
"
UPDATE submissions SET consent_form = true WHERE uuid = %s
"
config
.
db
.
query
(
sql
,
(
upload
_uuid
,
)
)
config
.
db
.
query
(
sql
,
(
submission
_uuid
,
)
)
config
.
db
.
commit
()
else
:
file_data
=
do_encrypt_dek
(
file_data
,
upload
_uuid
)
file_data
=
do_encrypt_dek
(
file_data
,
submission
_uuid
)
sql
=
sql_insert_generate
(
"
files
"
,
[
"
folder
"
,
"
creator
"
,
...
...
@@ -2339,7 +2339,7 @@ def submission_tenprint( submission_id, tenprint_id ):
files.uuid, files.filename, files.note,
files.format, files.resolution, files.width, files.height, files.size,
files.creation_time, files.type,
file_template.template
file_template.template
, files.quality
FROM files
LEFT JOIN file_template ON files.uuid = file_template.file
WHERE
...
...
@@ -2391,6 +2391,11 @@ def submission_tenprint( submission_id, tenprint_id ):
############################################################################
sql
=
"
SELECT id, name FROM quality_type
"
quality_type
=
config
.
db
.
query_fetchall
(
sql
)
############################################################################
zones
=
get_tenprint_template_zones
(
tenprint_file
[
"
template
"
],
t
)
datacolumns
=
[
"
tl_x
"
,
"
tl_y
"
,
"
br_x
"
,
"
br_y
"
,
"
angle
"
]
...
...
@@ -2414,7 +2419,8 @@ def submission_tenprint( submission_id, tenprint_id ):
svg_hw_factor
=
svg_hw_factor
,
zones
=
zones
,
datacolumns
=
datacolumns
,
tenprint_templates
=
tenprint_templates
tenprint_templates
=
tenprint_templates
,
quality_type
=
quality_type
)
@app.route
(
baseurl
+
"
/submission/<submission_id>/tenprint/<tenprint_id>/delete
"
)
...
...
@@ -2486,6 +2492,22 @@ def submission_file_set_note( submission_id, file_type, tenprint_id ):
"
error
"
:
False
}
)
@app.route
(
baseurl
+
"
/submission/<submission_id>/tenprint/<tenprint_id>/set/quality
"
,
methods
=
[
"
POST
"
]
)
@submitter_required
def
submission_tenprint_set_quality
(
submission_id
,
tenprint_id
):
"""
Store the user encrypted notes for a tenprint image.
"""
quality
=
request
.
form
.
get
(
"
quality
"
)
sql
=
"
UPDATE files SET quality = %s WHERE uuid = %s RETURNING id
"
config
.
db
.
query
(
sql
,
(
quality
,
tenprint_id
,
)
)
config
.
db
.
commit
()
return
jsonify
(
{
"
error
"
:
False
}
)
################################################################################
# Tenprint segments
...
...
sql/install/10-files.sql
View file @
41e1b3c6
...
...
@@ -35,7 +35,8 @@ CREATE TABLE public.files (
height
integer
,
format
character
varying
,
resolution
integer
,
note
character
varying
note
character
varying
,
quality
integer
);
...
...
sql/install/11-files_v.sql
View file @
41e1b3c6
...
...
@@ -30,7 +30,8 @@ CREATE VIEW public.files_v AS
files
.
height
,
files
.
uuid
,
files
.
format
,
files
.
note
files
.
note
,
files
.
quality
FROM
public
.
files
;
...
...
sql/install/15-quality_type.sql
0 → 100644
View file @
41e1b3c6
--
-- PostgreSQL database dump
--
SET
statement_timeout
=
0
;
SET
lock_timeout
=
0
;
SET
idle_in_transaction_session_timeout
=
0
;
SET
client_encoding
=
'UTF8'
;
SET
standard_conforming_strings
=
on
;
SELECT
pg_catalog
.
set_config
(
'search_path'
,
''
,
false
);
SET
check_function_bodies
=
false
;
SET
xmloption
=
content
;
SET
client_min_messages
=
warning
;
SET
row_security
=
off
;
SET
default_tablespace
=
''
;
SET
default_with_oids
=
false
;
--
-- Name: quality_type; Type: TABLE; Schema: public; Owner: icnml
--
CREATE
TABLE
public
.
quality_type
(
id
integer
NOT
NULL
,
name
character
varying
NOT
NULL
);
ALTER
TABLE
public
.
quality_type
OWNER
TO
icnml
;
--
-- Name: newtable_id_seq; Type: SEQUENCE; Schema: public; Owner: icnml
--
CREATE
SEQUENCE
public
.
newtable_id_seq
AS
integer
START
WITH
1
INCREMENT
BY
1
NO
MINVALUE
NO
MAXVALUE
CACHE
1
;
ALTER
TABLE
public
.
newtable_id_seq
OWNER
TO
icnml
;
--
-- Name: newtable_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: icnml
--
ALTER
SEQUENCE
public
.
newtable_id_seq
OWNED
BY
public
.
quality_type
.
id
;
--
-- Name: quality_type id; Type: DEFAULT; Schema: public; Owner: icnml
--
ALTER
TABLE
ONLY
public
.
quality_type
ALTER
COLUMN
id
SET
DEFAULT
nextval
(
'public.newtable_id_seq'
::
regclass
);
--
-- Data for Name: quality_type; Type: TABLE DATA; Schema: public; Owner: icnml
--
INSERT
INTO
public
.
quality_type
VALUES
(
1
,
'Prestine'
);
INSERT
INTO
public
.
quality_type
VALUES
(
2
,
'Medium'
);
INSERT
INTO
public
.
quality_type
VALUES
(
3
,
'Bad'
);
--
-- Name: newtable_id_seq; Type: SEQUENCE SET; Schema: public; Owner: icnml
--
SELECT
pg_catalog
.
setval
(
'public.newtable_id_seq'
,
3
,
true
);
--
-- PostgreSQL database dump complete
--
sql/install/1
5
-tenprint_cards.sql
→
sql/install/1
6
-tenprint_cards.sql
View file @
41e1b3c6
File moved
sql/install/1
6
-tenprint_zones_location.sql
→
sql/install/1
7
-tenprint_zones_location.sql
View file @
41e1b3c6
File moved
sql/install/1
7
-tenprint_zones.sql
→
sql/install/1
8
-tenprint_zones.sql
View file @
41e1b3c6
File moved
sql/install/1
8
-latent_info.sql
→
sql/install/1
9
-latent_info.sql
View file @
41e1b3c6
File moved
sql/install/
19
-gp.sql
→
sql/install/
20
-gp.sql
View file @
41e1b3c6
File moved
sql/install/2
0
-donor_fingers_gp.sql
→
sql/install/2
1
-donor_fingers_gp.sql
View file @
41e1b3c6
File moved
sql/install/2
1
-pc.sql
→
sql/install/2
2
-pc.sql
View file @
41e1b3c6
File moved
sql/install/2
2
-sequences.sql
→
sql/install/2
3
-sequences.sql
View file @
41e1b3c6
File moved
templates/submission/tenprint.html
View file @
41e1b3c6
...
...
@@ -70,6 +70,29 @@
}
);
}
var
update_quality_db
=
function
()
{
var
quality
=
$
(
"
#file_{{ file[ 'uuid' ] }}_quality > select > option:checked
"
).
val
();
$
.
ajax
(
{
url
:
"
{{ url_for( 'submission_tenprint_set_quality', submission_id = submission_id, tenprint_id = file[ 'uuid' ] ) }}
"
,
dataType
:
"
json
"
,
method
:
"
POST
"
,
data
:
{
quality
:
quality
},
success
:
function
(
data
)
{
if
(
data
.
error
)
toastr
.
error
(
"
Error while saving the quality value
"
);
},
error
:
function
(
data
)
{
toastr
.
error
(
"
Network error
"
);
}
}
);
}
var
update_note_db
=
function
()
{
var
note
=
$
(
"
#file_note
"
).
val
()
||
null
;
...
...
@@ -321,6 +344,18 @@
</select>
</div>
<div>
Quality
</div>
<div
id=
"file_{{ file[ 'uuid' ] }}_quality"
>
<select
name=
"tenprint_quality_select"
>
<option
value=
"0"
id=
"tenprint_quality_none_option"
selected
>
None
</option>
{% for quality_type in quality_type %}
<option
value=
"{{ quality_type[ 'id' ] }}"
id=
"tenprint_quality_{{ quality_type[ 'id' ] }}_option"
>
{{ quality_type[ 'name' ] }}
</option>
{% endfor %}
</select>
</div>
<div>
Notes
</div>
<div><textarea
rows=
"6"
id=
"file_note"
></textarea></div>
</div>
...
...
@@ -372,8 +407,11 @@
$
(
"
#delete_button
"
).
on
(
"
click
"
,
delete_tenprint
);
$
(
"
#file_{{ file[ 'uuid' ] }}_template > select
"
).
on
(
"
change
"
,
update_template_db
);
$
(
"
#file_{{ file[ 'uuid' ] }}_quality > select
"
).
on
(
"
change
"
,
update_quality_db
);
$
(
"
#{{ file[ 'template' ] }}_option
"
).
prop
(
"
selected
"
,
true
);
$
(
"
#tenprint_quality_{{ file[ 'quality' ] }}_option
"
).
prop
(
"
selected
"
,
true
);
{
%
if
file
[
"
template
"
]
==
None
or
file
[
"
template
"
]
==
0
%
}
$
(
"
#segmentation_button
"
)
.
removeClass
(
"
ui-state-default
"
)
...
...