Skip to content
Snippets Groups Projects
Commit 74aca334 authored by Marco De Donno's avatar Marco De Donno
Browse files

Add the list of segments to search in the user view

parent e94d9607
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/python
# -*- coding: UTF-8 -*-
from flask import Blueprint
from flask import Blueprint, session
import config
from utils.decorator import login_required
from utils.template import my_render_template
afis_view = Blueprint( "afis", __name__, template_folder = "templates" )
......@@ -9,3 +13,32 @@ afis_view = Blueprint( "afis", __name__, template_folder = "templates" )
def admin_list_folders():
return "ok"
@afis_view.route( "/afis/list" )
@login_required
def list_folders():
user_id = session.get( "user_id", None )
sql = """
SELECT
cnm_assignment.folder_uuid,
tmp.*
FROM cnm_assignment
LEFT JOIN cnm_folder ON cnm_assignment.folder_uuid = cnm_folder.folder_uuid
LEFT JOIN (
SELECT DISTINCT ON ( donor_id, pc ) *
FROM donor_segments_v
) AS tmp ON cnm_folder.donor_id = tmp.donor_id AND cnm_folder.pc = tmp.pc
WHERE cnm_assignment.user_id = %s
ORDER BY
tmp.donor_id ASC,
tmp.pc ASC
"""
folder_list = config.db.query_fetchall( sql, ( user_id, ) )
return my_render_template(
"afis/folder_list.html",
folder_list = folder_list
)
<!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 }}";
</script>
<style type="text/css">
.icnml_list_of_boxes {
grid-template-columns: repeat( auto-fill, calc( var( --imgsize ) + 2 * var( --imgmargin ) ) );
}
.icnml_search_bar {
margin-left: 10px;
margin-bottom: 20px;
width: 500px;
}
</style>
</head>
<body class="icnml_main_layout">
{% include "header.html" %}
{% include navigation %}
<div class="icnml_content">
<div class="icnml_search_bar">
<input id="search_bar" placeholder="Search for a file..."/>
</div>
<div class="icnml_list_of_boxes">
{% for f in folder_list %}
<div id="segment_{{ f[ 'folder_uuid' ] }}_outer">
<div class="ui-widget-header ui-corner-top icnml_box_top" id="segment_{{ f[ 'uuid' ] }}_filename">{{ f[ 'folder_uuid' ][ 0:18 ] }}</div>
<div class="ui-widget-content ui-corner-bottom icnml_box_content">
<div
id="segment_{{ f[ 'folder_uuid' ] }}"
class="icnml_pointer"
style="background-image: url( {{ url_for( 'image.image_segment_serve', tenprint_id = f[ 'tenprint' ], pc = f[ 'pc' ] ) }} )">
</div>
</div>
</div>
{% endfor %}
</div>
<div id="zoom_slider"></div>
</div>
<script type="text/javascript">
$( "#icnml_navigation_afis" )
.addClass( "activated" );
$( "#navloc" ).append(
$( "<a />" )
.attr( "href", "{{ url_for( 'afis.list_folders' ) }}" )
.text( "AFIS folders" )
)
.append(
$( "<span />" ).text( ">" )
)
.append(
$( "<span />" ).text( "All" )
)
$( "#search_bar" ).focus();
</script>
</body>
</html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment