Skip to content
segment.html 5.78 KiB
Newer Older
Marco De Donno's avatar
Marco De Donno committed
<!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', path = 'functions.js' ) }}"></script>
        <link type="text/css" rel="stylesheet" href="{{ url_for( 'send_app_files', path = 'app.css' ) }}">
        
        <script type="text/javascript">
            baseurl = "{{ baseurl }}";
            
            var password_local = decrypt( sessionStorage.getItem( "session_key" ), "{{ session_security_key }}" );
            var nickname = decrypt( "{{ nickname }}", password_local );
            var tp_filename = decrypt( "{{ tp_filename }}", password_local );
            
            var update_general_pattern_db = function( gp )
            {
            	$.ajax( {
    	            url: "{{ url_for( 'submission_segment_set_gp', id = submission_id, tid = tid, pc = pc ) }}",
    	            dataType: 'json',
    	            method: 'POST',
    	            data: {
    	            	gp: gp
    	            },
    	            success: function( data )
    	            {
    	            	console.log( data );
    	            }
    	        } );
            }
        </script>
        
        <style type="text/css">
            img {
                max-height: 500px;
                max-width: 500px;
                height: auto;
                width: auto;
            }
            #general_pattern {
                margin-top: 5px;
                display: grid;
                grid-template-columns: repeat( 4, 1fr );
                grid-gap: 10px;
            }
            #general_pattern > div > span {
                margin-top: 35px;
                margin-bottom: 35px;
            }
            .icnml_box_fields {
                margin-bottom: 20px;
            }
        </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">Segment '{{ pc_name }}'</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_segment_serve', tid = tid, pc = pc ) }}">
                            </div>
                            <div>
                                <div class="icnml_box_fields">
                                    <div>Position code</div>
                                    <div>{{ pc_name }}</div>
                                </div>
                                
                                <div>General pattern</div>
                                <div id="general_pattern">
                                    <div class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" id="general_pattern_loop">
                                        <span class="ui-button-text">Loop</span>
                                    </div>
                                    <div class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" id="general_pattern_whorl">
                                        <span class="ui-button-text">Whorl</span>
                                    </div>
                                    <div class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" id="general_pattern_arch">
                                        <span class="ui-button-text">Arch</span>
                                    </div>
                                    <div class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" id="general_pattern_unknown">
                                        <span class="ui-button-text">Unknown</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </body>
    <script type="text/javascript">
    	/*
    	 *	General pattern buttons
    	 */
    	
    	$( '#general_pattern_loop' ).on( 'click', function()
		{
    		update_general_pattern_db( 'loop' );
		} );
    	$( '#general_pattern_whorl' ).on( 'click', function()
		{
    		update_general_pattern_db( 'whorl' );
		} );
    	$( '#general_pattern_arch' ).on( 'click', function()
		{
    		update_general_pattern_db( 'arch' );
		} );
    	$( '#general_pattern_unknown' ).on( 'click', function()
		{
    		update_general_pattern_db( 'unknown' );
		} );
    	
    	/*
    	 *	Navigation UI update
    	 */
    	
    	$( '#icnml_navigation_updatedonor' )
			.addClass( 'activated' );
        
    	$( '#navloc' ).append(
    		$( '<a />' )
    			.attr( 'href', "{{ url_for( 'submission_list' ) }}" )
    			.text( "Submissions" )
		)
		.append(
    		$( '<span />' ).text( ">" )
		)
		.append(
			$( '<a />' )
				.attr( 'href', "{{ url_for( 'submission_update', id = submission_id ) }}" )
				.text( nickname )
		)
		.append(
    		$( '<span />' ).text( ">" )
		)
		.append(
    		$( '<a />' )
    			.attr( 'href', "{{ url_for( 'submission_tenprint_list', id = submission_id ) }}" )
    			.text( "Tenprints" )
		)
		.append(
    		$( '<span />' ).text( ">" )
		)
		.append(
			$( '<a />' )
    			.attr( 'href', "{{ url_for( 'submission_tenprint', id = submission_id, tid = tid ) }}" )
    			.text( tp_filename )
		);
    </script>
</html>