Skip to content
latent.html 8.16 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()
            {
            	var note = $( '#file_note' ).val() || null;
            	note = encrypt( note, password_local );
            	
            	$.ajax( {
    	            url: "{{ url_for( 'submission_file_set_note', id = submission_id, file = file[ 'uuid' ], t = 'latent' ) }}",
    	            dataType: 'json',
    	            method: 'POST',
    	            data: {
    	            	note: note
    	            }
    	        } );
            }
            var next_information = function()
            {
            	window.location = "{{ url_for( 'submission_latent_pfsp', id = submission_id, lid = file[ 'uuid' ] ) }}";
            }
            
            var delete_latent = function()
            {
            	$( '<div />' )
            		.attr( 'id', 'delete_confirmation' )
            		.text( 'Do you really want to delete this latent?' )
        			.dialog( {
                        title: "Confirm latent deletion",
                        modal: true,
                        buttons: {
                            'OK': function()
                            {
                            	$.ajax( {
                    	            url: "{{ url_for( 'submission_latent_delete', id = submission_id, lid = file[ 'uuid' ] ) }}",
                    	            dataType: 'json',
                    	            success: function( data )
                    	            {
                    	            	$( '#delete_confirmation' ).remove();
                    	            	window.location = "{{ url_for( 'submission_latent_list', id = submission_id, ltype = file[ 'file_type' ] ) }}";
                    	            },
                    	            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', 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 );
    	$( '#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' )
        
        $( '#navloc' ).append(
    		$( '<a />' )
    			.attr( 'href', "{{ url_for( 'submission_list' ) }}" )
    			.text( "Submissions" )
		)
		.append(
    		$( '<span />' ).text( ">" )
		)
		.append(
			$( '<a />' )
				.attr( 'href', "{{ url_for( 'submission_upload_tplp', id = submission_id ) }}" )
		)
		.append(
    		$( '<span />' ).text( ">" )
		)
		.append(
    		$( '<a />' )
    			.attr( 'href', "{{ url_for( 'submission_latent_list', id = submission_id ) }}" )
    			.text( "Latents" )
		)
		.append(
    		$( '<span />' ).text( ">" )
		)
		.append(
    		$( '<span />' ).text( filename )