Skip to content
segment.html 8.95 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 )
            {
            	$( ".gp_checked" ).css( "visibility", "hidden" )
            	$( "#gp_" + gp + "_checked" ).css( "visibility", "visible" );
            	
Marco De Donno's avatar
Marco De Donno committed
            	$.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 );
    	            	$( "#gp_" + gp + "_checked" ).css( "visibility", "hidden" );
    	            	toastr.error( "Error while saving the general pattern" );
Marco De Donno's avatar
Marco De Donno committed
    	            }
    	        } );
            }
        </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;
            }
Marco De Donno's avatar
Marco De Donno committed
            #general_pattern > div {
                padding-top: 40px;
                padding-bottom: 40px;
            }
Marco De Donno's avatar
Marco De Donno committed
            #general_pattern > div > span {
                margin-top: 35px;
                margin-bottom: 35px;
            }
            .icnml_box_fields {
                margin-bottom: 20px;
            }
            .gp_checked {
                visibility: hidden;
                position: absolute;
                margin-top: 0px;
                margin-bottom: 0px;
                right: -8px;
                top: -8px;
            }
            
            #next_div {
                margin-top: 30px;
                width: 100%;
            }
            #next_div > a {
Marco De Donno's avatar
Marco De Donno committed
                padding: 10px;
                width: calc( 100% - 23px );
Marco De Donno's avatar
Marco De Donno committed
        </style>
    </head>
    <body class="icnml_main_layout">
        {% include "header.html" %}
        {% include "navigations/submitter.html" %}
        
        <div class="icnml_content">
            <div class="icnml_lp_oneperpage">
Marco De Donno's avatar
Marco De Donno committed
                    <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>
                                
                                {% if tp_type == 1 %}
                                    <div>General pattern</div>
                                    <div id="general_pattern">
                                        {% macro gp_div( gp_id, gp_name ) %}
                                            <div class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" id="general_pattern_{{ gp_id }}">
                                                <span class="ui-button-text">{{ gp_name|title }}</span>
                                                <div class="gp_checked" id="gp_{{ gp_id }}_checked">
                                                    <svg width="20px" height="20px" viewBox="0 0 54 54" version="1.1">
                                                        <g id="" fill-rule="evenodd">
                                                            <path
                                                                d="M23.5,31.8431458 L17.5852419,25.9283877 C16.0248253,24.3679711 13.4910294,24.366835 11.9289322,25.9289322 C10.3700136,27.4878508 10.3665912,30.0234455 11.9283877,31.5852419 L20.4147581,40.0716123 C20.5133999,40.1702541 20.6159315,40.2626649 20.7218615,40.3488435 C22.2835669,41.8725651 24.794234,41.8626202 26.3461564,40.3106978 L43.3106978,23.3461564 C44.8771021,21.7797521 44.8758057,19.2483887 43.3137085,17.6862915 C41.7547899,16.1273729 39.2176035,16.1255422 37.6538436,17.6893022 L23.5,31.8431458 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z"
                                                                stroke="#747474" stroke-opacity="0.198794158"
                                                                fill="#109618" fill-opacity="0.816519475"
                                                            ></path>
                                                        </g>
                                                    </svg>
                                                </div>
                                        {{ gp_div( 'loop', 'loop' ) }}
                                        {{ gp_div( 'whorl', 'whorl' ) }}
                                        {{ gp_div( 'arch', 'arch' ) }}
                                        {{ gp_div( 'unknown', 'unknown' ) }}
Marco De Donno's avatar
Marco De Donno committed
                                    </div>
                                
                                {% if next_pc %}
                                    <div id="next_div">
                                        <a class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" id="next_segment" href="{{ url_for( 'submission_segment', id = submission_id, tid = tid, pc = next_pc ) }}">
                                            <span class="ui-button-text" id="segmentation_button_span_text">Next segment</span>
                                        </a>
                                    </div>
                                {% endif %}
Marco De Donno's avatar
Marco De Donno committed
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </body>
    <script type="text/javascript">
    	/*
    	 *	General pattern buttons
    	 */
    	{% macro gp_action( id ) %}
        	$( '#general_pattern_{{ id }}' ).on( 'click', function()
    		{
        		update_general_pattern_db( '{{ id }}' );
    		} );
    	{% endmacro %}
    	{{ gp_action( 'loop' ) }}
        {{ gp_action( 'whorl' ) }}
        {{ gp_action( 'arch' ) }}
        {{ gp_action( 'unknown' ) }}
        
        //
        	
    	$( "#gp_{{ current_gp }}_checked" ).css( "visibility", "visible" );
    	
Marco De Donno's avatar
Marco De Donno committed
    	/*
    	 *	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 )
		)
		.append(
    		$( '<span />' ).text( ">" )
		)
		.append(
			$( '<a />' )
    			.attr( 'href', "{{ url_for( 'submission_tenprint_segments_list', id = submission_id, tid = tid ) }}" )
    			.text( "Segments" )
		)
		.append(
    		$( '<span />' ).text( ">" )
		)
		.append(
    		$( '<span />' ).text( "{{ pc_name }}" )
Marco De Donno's avatar
Marco De Donno committed
		);
    </script>
</html>