Skip to content
Snippets Groups Projects
Commit 3a26d4b2 authored by Marco De Donno's avatar Marco De Donno
Browse files

Add the 'download full resolution' button for admin in the mark display page

parent 6804f9a0
No related branches found
No related tags found
No related merge requests found
......@@ -74,6 +74,27 @@ def image_file_serve( file_id = None ):
current_app.logger.error( "Error while creating the thumbnail. Serving a 'no preview' image" )
return send_file( no_preview_image(), mimetype = "image/png" )
@image_view.route( "/image/file/<file_id>/full_resolution" )
@utils.decorator.admin_required
def admin_download_file_full_resolution( file_id ):
try:
if file_id == None:
raise Exception( "No file id" )
submission_id = get_submission_uuid_for_file( file_id )
current_app.logger.debug( "submission id: '{}'".format( submission_id ) )
img, _ = image_serve( "files", file_id, submission_id )
if img == None:
return abort( 404 )
buff = utils.images.pil2buffer( img, "TIFF" )
return send_file( buff, mimetype = "image/tiff" )
except:
return abort( 403 )
@image_view.route( "/image/segment/<tenprint_id>/<pc>" )
@utils.decorator.login_required
def image_segment_serve( tenprint_id, pc ):
......
......@@ -128,6 +128,13 @@
} );
}
{% if admin %}
var download_image = function()
{
window.open( "{{ url_for( 'image.admin_download_file_full_resolution', file_id = file[ 'uuid' ] ) }}", "_blank" );
}
{% endif %}
var next_information = function()
{
{% if admin %}
......@@ -290,6 +297,13 @@
</div>
<div>
<div class="icnml_button">
{% if admin %}
<div id="download_full_res_button_div">
<a class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" id="download_button">
<span class="ui-button-text" id="next_button_span_text">Download image</span>
</a>
</div>
{% endif %}
<div id="next_button_div">
<a class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" id="next_button">
<span class="ui-button-text" id="next_button_span_text">Next</span>
......@@ -320,6 +334,9 @@
$( "#file_{{ file[ 'uuid' ] }}_uploadtime" )
.text( moment.utc( "{{ file[ 'creation_time' ] }}" ).local().format( "MMMM Do YYYY, HH:mm:ss" ) );
{% if admin %}
$( "#download_button" ).on( "click", download_image );
{% endif %}
$( "#next_button" ).on( "click", next_information );
$( "#delete_button" ).on( "click", delete_mark );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment