Skip to content
segment.html 9.54 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( 'files.send_app_files', subpath = 'functions.js' ) }}"></script>
        <link type="text/css" rel="stylesheet" href="{{ url_for( 'files.send_app_files', subpath = 'app.css' ) }}">
        
        <script type="text/javascript">
            baseurl = "{{ baseurl }}";
            
            {% if admin %}
                var update_users_in_db = function()
                {
                    update_users_in_db_sub( "mark" );
                    update_users_in_db_sub( "reference" );
                }
                
                var update_users_in_db_sub = function( type )
                {
                    var users = [];
                    
                    $.each( $( "#users_" + type + " > select > option:checked" ), function() {
                        users.push( parseInt( $( this ).val() ) );
                    } );
                    
                    $.ajax( {
                        url: "{{ url_for( 'afis.admin_update_users_in_afis_folder', target_uuid = target_uuid ) }}",
                        dataType: "json",
                        method: "POST",
                        data: {
                            users: JSON.stringify( users ),
                            type: type
                        },
                        success: function( data )
                        {
                            if( data.error )
                                toastr.error( "Server side error" );
                        },
                        error: function( data )
                        {
                            toastr.error( "Network error" );
                        }
                    } );
                }
            {% endif %}
        </script>
        
        <style type="text/css">
            :root {
                --imgsize: 200px;
            }
            .icnml_list_of_boxes {
                grid-template-columns: repeat( auto-fill, calc( var( --imgsize ) + 2 * var( --imgmargin ) ) );
            }
            .icnml_list_of_boxes_outer {
                border: 1px solid #ccc;
                border-radius: 10px;
                padding: 10px;
                margin-top: 10px;
                margin-bottom: 20px;
            }
            .icnml_list_of_boxes_desc {
                position: relative;
                top: -19px;
                padding-left: 10px;
                padding-right: 20px;
                width: fit-content;
                width: -moz-fit-content;
                background-color: rgb( 238, 238, 238 );
            }
            .list_of_assignee {
                display: grid;
                grid-template-columns: auto 1fr;
                grid-gap: 3px 20px;
                margin-bottom: 30px;
            }
    </head>
    <body class="icnml_main_layout">
        {% include "header.html" %}
        {% include navigation %}
        
        <div class="icnml_content">
                <div class="list_of_assignee">
                    <div>Marks</div>
                        <select multiple id="users_select_marks" data-placeholder="Add a user to this folder..." class="chosen-select">
                            {% for user in all_afis_users %}
                                <option id="user_{{ user[ 'id' ] }}_mark_chosen" value="{{ user[ 'id' ] }}">{{ user[ 'username' ] }}</option>
                            {% endfor %}
                        </select>
                    </div>
                    <div>References</div>
                        <select multiple id="users_select_refs" data-placeholder="Add a user to this folder..." class="chosen-select">
                            {% for user in all_afis_users %}
                                <option id="user_{{ user[ 'id' ] }}_ref_chosen" value="{{ user[ 'id' ] }}">{{ user[ 'username' ] }}</option>
                            {% endfor %}
                        </select>
                    </div>
            {% if annotation_list != None %}
                <div class="icnml_list_of_boxes_outer">
                    <div class="icnml_list_of_boxes_desc">Target annotations ({{ annotation_list|length }})</div>
                    <div class="icnml_list_of_boxes">
                        {% for s in annotation_list %}
                            <div id="segment_{{ s[ 'uuid' ] }}_outer">
                                <div class="ui-widget-header ui-corner-top icnml_box_top" id="segment_{{ s[ 'uuid' ] }}_filename">{{ s[ 'uuid' ][ 0:18 ] }}</div>
                                <div class="ui-widget-content ui-corner-bottom icnml_box_content">
                                    <div
                                        id="segment_{{ s[ 'uuid' ] }}"
                                        class="icnml_pointer"
                                        style="background-image: url( {{ url_for( 'image.image_annotation_serve', uuid = s[ 'uuid' ] ) }} )">
                                    </div>
                                </div>
                            </div>
                        {% endfor %}
                    </div>
                </div>
            {% else %}
                <div>No annotations for this finger at the moment</div>
            {% endif %}
            
            {% if segments_list != None %}
                <div class="icnml_list_of_boxes_outer">
                    <div class="icnml_list_of_boxes_desc">Non annotated images ({{ segments_list|length }})</div>
                    <div class="icnml_list_of_boxes">
                        {% for s in segments_list %}
                            <div id="segment_{{ s[ 'folder_uuid' ] }}_outer">
                                <div class="ui-widget-header ui-corner-top icnml_box_top" id="segment_{{ s[ 'uuid' ] }}_filename">{{ s[ 'uuid' ][ 0:18 ] }}</div>
                                <div class="ui-widget-content ui-corner-bottom icnml_box_content">
                                    <div
                                        id="segment_{{ s[ 'uuid' ] }}"
                                        class="icnml_pointer"
                                        style="background-image: url( {{ url_for( 'image.image_segment_serve', tenprint_id = s[ 'tenprint' ], pc = s[ 'pc' ] ) }} )">
                            </div>
                        {% endfor %}
            {% else %}
                <div>No segment/mark images in this folder at the moment</div>
            {% endif %}
            <div id="zoom_slider"></div>
        </div>
        <script type="text/javascript">
            $( "#icnml_navigation_afis" )
                .addClass( "activated" );
            
            var users_assigned_refs = [];
            {% for user in users_assigned_refs %}
                users_assigned_refs.push( "{{ user[ 'id' ] }}" );
            $( "#users_select_refs" )
                .val( users_assigned_refs ).trigger( "chosen:updated" );
            
            var users_assigned_marks = [];
            {% for user in users_assigned_marks %}
                users_assigned_marks.push( "{{ user[ 'id' ] }}" );
            $( "#users_select_marks" )
                .val( users_assigned_marks ).trigger( "chosen:updated" );
            {% if admin %}
                $( "#users_select_marks" ).on( "change", update_users_in_db )
                $( "#users_select_refs" ).on( "change", update_users_in_db )
            {% endif %}
            
            $( "#users_select_marks" )
                .chosen( {
                    search_contains: true,
                    width: "50%"
                } );
            $( "#users_select_refs" )
                .chosen( {
                    search_contains: true,
                    width: "50%"
                } );
            
            $( "#navloc" ).append(
                $( "<a />" )
                    .attr( "href", "{{ url_for( 'afis.list_folders' ) }}" )
                    .text( "Submissions" )
            )
            .append(
                $( "<span />" ).text( ">" )
            )
                        
            {% if admin %}
                .append(
                    $( "<a />" )
                        .attr( "href", "{{ url_for( 'submission.admin_submission_home', submission_id = submission_id ) }}" )
                        .text( "{{ username }}" )
                )
                .append(
                    $( "<span />" ).text( ">" )
                )
                .append(
                    $( "<a />" )
                        .attr( "href", "{{ url_for( 'afis.admin_show_target_list', uuid = submission_id ) }}" )
                        .text( "Targets" )
                )
                .append(
                    $( "<span />" ).text( ">" )
                )
                .append(
                    $( "<span />" ).text( "{{ finger_name }}" )
                )
            {% else %}
                .append(
                    $( "<span />" ).text( "{{ target_uuid[ 0:18 ] }}" )
                )
        </script>
    </body>
</html>