Skip to content
latent.html 8.55 KiB
Newer Older
<!DOCTYPE html>
<html>
    <head>
        {% for src in js %}
            <script type="text/javascript" src="{{ src }}"></script>
        {% endfor %}
        {% for src in css %}
            <link type="text/css" rel="stylesheet" href="{{ src }}">
        {% endfor %}
        
        <script type="text/javascript" src="{{ url_for( 'send_app_files', subpath = 'functions.js' ) }}"></script>
        <link type="text/css" rel="stylesheet" href="{{ url_for( 'send_app_files', subpath = 'app.css' ) }}">
        <style type="text/css">
            .icnml_button {
                margin-top: 50px;
            }
            .icnml_button > div > a {
                width: 60%;
                margin-bottom: 10px;
            }
        </style>
        
        <script type="text/javascript">
            baseurl = "{{ baseurl }}";
            
            var password_local = decrypt( sessionStorage.getItem( "session_key" ), "{{ session_security_key }}" );
            var nickname = decrypt( "{{ nickname }}", password_local );
            var filename = decrypt( "{{ file[ 'filename' ] }}", password_local );
            var note     = decrypt( "{{ file[ 'note' ] }}", password_local );
            
            var update_note_db = function()
            {
Marco De Donno's avatar
Marco De Donno committed
                var note = $( "#file_note" ).val() || null;
                note = encrypt( note, password_local );
                
                $.ajax( {
                    url: "{{ url_for( 'submission_file_set_note', upload_id = submission_id, tenprint_id = file[ 'uuid' ], t = 'latent' ) }}",
Marco De Donno's avatar
Marco De Donno committed
                    dataType: "json",
                    method: "POST",
                    data: {
                        note: note
                    }
                } );
            var next_information = function()
            {
                window.location = "{{ url_for( 'submission_latent_pfsp', upload_id = submission_id, lid = file[ 'uuid' ] ) }}";
            var delete_latent = function()
            {
Marco De Donno's avatar
Marco De Donno committed
                $( "<div />" )
                    .attr( "id", "delete_confirmation" )
                    .text( "Do you really want to delete this latent?" )
                    .dialog( {
                        title: "Confirm latent deletion",
                        modal: true,
                        buttons: {
                            "OK": function()
Marco De Donno's avatar
Marco De Donno committed
                                $.ajax( {
                                    url: "{{ url_for( 'submission_latent_delete', upload_id = submission_id, lid = file[ 'uuid' ] ) }}",
Marco De Donno's avatar
Marco De Donno committed
                                    dataType: "json",
                                    success: function( data )
                                    {
                                        $( "#delete_confirmation" ).remove();
                                        window.location = "{{ url_for( 'submission_latent_list', upload_id = submission_id, ltype = file[ 'file_type' ] ) }}";
Marco De Donno's avatar
Marco De Donno committed
                                    },
                                    error: function( data )
                                    {
                                        $( "#delete_confirmation" ).remove();
                                    }
                                } );
                            "Cancel": function()
                                $( this ).dialog( "close" );
                            },
                        },
                        close: function()
                        {
                            $( this ).remove();
                        }
                    } );
            }
            img {
                max-height:500px;
                max-width:500px;
                height:auto;
                width:auto;
            }
        </style>
    </head>
    <body class="icnml_main_layout">
        {% include "header.html" %}
        {% include "navigations/submitter.html" %}
        
        <div class="icnml_content">
            <div class="icnml_lp_oneperpage">
                <form id="icnml_file_update_{{ file[ 'uuid' ] }}">
                    <div class="ui-widget-header ui-corner-top icnml_box_top">File '<span id="header_filename">-</span>'</div>
                    <div class="ui-widget-content ui-corner-bottom icnml_box_content">
                        <div class="icnml_lp_cardbox">
                            <div id="img_preview" class="icnml_img">
                                <img src="{{ url_for( 'image_file_serve', file_id = file[ 'uuid' ] ) }}">
                            </div>
                            <div>
                                <div class="icnml_box_fields">
                                    <div>Name</div>
                                    <div id="box_filename"></div>
                                    
                                    <div>Resolution</div>
                                    
                                    <div>Upload time</div>
                                    <div id="file_{{ file[ 'uuid' ] }}_uploadtime">-</div>
                                    <div><textarea rows="6" id="file_note"></textarea></div>
                                    <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>
                                        </a>
                                    </div>
                                    <div id="delete_button_div">
                                        <a class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" id="delete_button">
                                            <span class="ui-button-text" id="delete_button_span_text">Delete latent</span>
        </div>
    </body>
    <script type="text/javascript">
        $( "#header_filename" ).text( filename );
Marco De Donno's avatar
Marco De Donno committed
        $( "#box_filename" ).text( filename );
        $( "#file_note" ).text( note );
        $( "#file_note" ).on( "change", update_note_db );
        
        $( "#file_{{ file[ 'uuid' ] }}_uploadtime" )
            .text( moment.utc( "{{ file[ 'creation_time' ] }}" ).local().format( "MMMM Do YYYY, HH:mm:ss" ) );
        
        $( "#next_button" ).on( "click", next_information );
        $( "#delete_button" ).on( "click", delete_latent );
        
        $( "#icnml_navigation_updatedonor" )
            .addClass( "activated" );
        $( "#navloc" ).append(
Marco De Donno's avatar
Marco De Donno committed
            $( "<a />" )
                .attr( "href", "{{ url_for( 'submission_list' ) }}" )
                .text( "Submissions" )
        )
        .append(
            $( "<span />" ).text( ">" )
        )
        .append(
            $( "<a />" )
                .attr( "href", "{{ url_for( 'submission_upload_tplp', upload_id = submission_id ) }}" )
Marco De Donno's avatar
Marco De Donno committed
                .text( nickname )
        )
        .append(
            $( "<span />" ).text( ">" )
        )
        .append(
            $( "<a />" )
                .attr( "href", "{{ url_for( 'submission_latent_list', upload_id = submission_id ) }}" )
Marco De Donno's avatar
Marco De Donno committed
                .text( "Latents" )
        )
        .append(
            $( "<span />" ).text( ">" )
        )
        .append(
            $( "<span />" ).text( filename )
        );