Commit ffb4c249 authored by marc's avatar marc Committed by Mathieu Giraud

run.py : new controller for runs

generate runs list / similar to patient controller
parent ab117bef
This diff is collapsed.
{{extend 'db_layout.html'}}
<form id="data_form" action="DB_ADDRESS/run/add_form" enctype="multipart/form-data" method="post">
<table>
<tbody>
<tr>
<td><label for="run_id_label" id="patient_id_label__label">Run ID: </label></td>
<td><input class="date" id="run_id_label" name="id_label" type="text" value=""><span></span></td>
<td></td>
</tr>
<tr>
<td ><label for="run_name" id="run_name__label">Name: </label></td>
<td ><input class="string" id="run_name" name="name" type="text" value=""><span>*</span></td>
<td ></td>
</tr>
<tr>
<td><label for="run_date" id="run_date__label">Date: </label></td>
<td><input class="date" id="run_date" name="run_date" type="text" value=""><span>(format: yyyy-mm-dd)</span></td>
<td></td>
</tr>
<tr>
<td><label for="run_info" id="run_info__label">Info: </label></td>
<td><textarea class="text" cols="40" id="run_info" name="info" rows="10"></textarea></td>
<td></td>
</tr>
<tr>
<td></td>
<td ><input type="submit" value="save" class="btn"></td>
<td></td>
</tr>
</tbody>
</table>
</form>
<div>
(* required fields)
</div>
{{extend 'db_layout.html'}}
{{import vidjil_utils}}
{{('message' in globals())}}
{{if 'message' in globals():}}
{{
data_count = 0
run_name = db.run[request.vars["id"]].name
}}
<div>
<h3>{{=message}}: {{=run_name}}
</h3>
Are you sure you want to delete the run {{=run_name}} ?</br>
This action cannot be undone.
<div class="center">
<button onclick="db.call('run/delete', {'id' :'{{=request.vars["id"]}}'} )">delete</button>
<button onclick="db.call('run/index')">cancel</button>
</div>
</div>
{{elif 'content' in globals():}}
{{=content}}
{{else:}}
{{=BEAUTIFY(response._vars)}}
{{pass}}
{{extend 'db_layout.html'}}
{{
info = db.run[request.vars["id"]]
}}
<form id="data_form" action="DB_ADDRESS/run/edit_form" enctype="multipart/form-data" method="post">
<input type="HIDDEN" id="run_id" name="id" value="{{=request.vars["id"]}}">
<table>
<tbody>
<tr>
<td><label for="run_id_label" id="run_id_label__label">Run ID:</label></td>
<td><input class="date" id="run_id_label" name="id_label" type="text" value="{{=info.id_label}}"><span></span></td>
<td></td>
</tr>
<tr>
<td > <label for="run_name" id="run_name__label">Name: </label> </td>
<td > <input class="string" id="run_name" name="name" type="text" value="{{=info.name}}"><span>*</span></td>
<td > </td>
</tr>
<tr>
<td> <label for="run_run_date" id="run_run_date__label">Date: </label></td>
<td> <input class="date" id="run_run_date" name="run_date" type="text" value="{{if info.run_date:}}{{=info.run_date}}{{pass}}"><span>(yyyy-mm-dd)</span></td>
<td> </td>
</tr>
<tr>
<td> <label for="run_info" id="run_info__label">Info: </label> </td>
<td> <textarea class="text" cols="40" id="run_info" name="info" rows="10">{{=info.info}}</textarea> </td>
<td></td>
</tr>
<tr>
<td> </td>
<td> <input type="submit" value="Soumettre" class="btn"> </td>
<td> </td>
</tr>
</tbody>
</table>
</form>
<div>
(* required fields)
</div>
{{extend 'db_layout.html'}}
{{import vidjil_utils}}
{{total_file_count = 0 ; total_size = 0}}
<h3></h3>
<div class="db_block">
<div class="db_block_left">
search
<input id="db_filter_input" type="text" value="{{=request.vars["filter"]}}" onchange="db.call('patient/index', {'filter' : this.value} )">
</div>
</div>
<div id="db_table_container">
<table class="db_table" id="table">
<thead>
<tr><td class="column_200 pointer" onclick="db.call('run/index', {'sort' :'name', 'filter' : '{{=request.vars["filter"]}}'
{{if not reverse and request.vars["sort"]=="name" :}} , 'reverse' : true {{pass}} })"> name </td>
<td class="column_100 pointer" onclick="db.call('run/index', {'sort' :'run_date', 'filter' : '{{=request.vars["filter"]}}'
{{if not reverse and request.vars["sort"]=="run_date" :}} , 'reverse' : true {{pass}} })"> date </td>
<td class="pointer" onclick="db.call('run/index', {'sort' :'info', 'filter' : '{{=request.vars["filter"]}}'
{{if not reverse and request.vars["sort"]=="info" :}} , 'reverse' : true {{pass}} })"> info </td>
<td class="pointer" class="column_100" onclick="db.call('run/index', {'sort' :'configs', 'filter' : '{{=request.vars["filter"]}}'
{{if not reverse and request.vars["sort"]=="configs" :}} , 'reverse' : true {{pass}} })"> configs </td>
{{if isAdmin:}} <td class="column_100 pointer" onclick="db.call('run/index', {'sort' :'groups', 'filter' : '{{=request.vars["filter"]}}'
{{if not reverse and request.vars["sort"]=="groups" :}} , 'reverse' : true {{pass}} })"> groups </td> {{pass}}
{{if isAdmin:}} <td class="column_100 pointer" onclick="db.call('run/index', {'sort' :'creator', 'filter' : '{{=request.vars["filter"]}}'
{{if not reverse and request.vars["sort"]=="creator" :}} , 'reverse' : true {{pass}} })"> creator </td> {{pass}}
<td class="column_100 pointer" onclick="db.call('run/index', {'sort' :'files', 'filter' : '{{=request.vars["filter"]}}'
{{if not reverse and request.vars["sort"]=="files" :}} , 'reverse' : true {{pass}} })"> files </td>
<td class="column5"> </td>
<td class="column5"> </td>
<td class="column5"> </td>
</tr>
</thead>
{{for row in query :}}
<tr class="pointer" onclick="db.call('sample_set/index', {'id' :'{{=row['sample_set_id']}}' , 'config_id' : {{=row['most_used_conf']}} } )" >
<td> {{=row['name']}} </td>
<td> {{ if row['run_date'] is not None: }} {{=row['run_date'] }} {{ pass }} </td>
<td> {{=row['info']}} </td>
<td>
{{ configs = [] }}
{{for conf in row['conf_list'] :}}
{{filename = patient_name + " (" + conf['name'] + ")"}}
{{if conf['fused_file'] is not None :}}
{{ configs.append(str(A(conf['name'], _href="index.html?patient=" + str(row['id']) + "&config=" + str(conf['id']), _type="text/html",
_onclick="event.preventDefault();event.stopPropagation();if( event.which == 2 ) { window.open(this.href); } else { db.load_data( { 'patient' : '" + str(row['id']) + "' , 'config' : " + str(conf['id']) + " }, '" + filename + "' ); }"))) }}
{{else:}}
{{ configs.append(conf['name']) }}
{{pass}}
{{pass}}
{{= XML(", ".join(configs)) }}
</td>
{{if isAdmin:}} <td> {{=row['groups']}}</td>{{pass}}
{{if isAdmin:}} <td> {{=row['creator']}}</td>{{pass}}
<td> {{=row['file_count']}} ({{=vidjil_utils.format_size(row['size'])}}) </td>
{{ total_file_count += row['file_count'] ; total_size += row['size'] }}
{{if isAdmin:}} <td onclick="db.call('run/permission', {'id' :'{{=row['id']}}'} )" > p </td> {{else:}} <td></td> {{pass}}
{{if row['has_admin_permission']:}}
<td onclick="db.call('run/edit', {'id' :'{{=row['id']}}'} )" > e </td>
<td onclick="db.call('run/confirm', {'id' :'{{=row['id']}}'} )" > X </td>
{{else:}} <td></td><td></td>{{pass}}
</tr>
{{pass}}
</table>
<table class="db_table" id="db_fixed_header"></table>
</div>
<div class="db_block">
<div class="db_block_left">
{{if auth.can_create_patient():}}
<span class="button2" onclick="db.call('run/add')"> + new run </span>
{{else:}}
<!-- <span class="button2 inactive" onclick="db.call('patient/add')" title="you don't have permission to create new patient"> add patient </span> -->
{{pass}}
</div>
<div class="db_block_right">
<br />
{{ =len(query) }} runs, {{ =total_file_count }} files ({{ =vidjil_utils.format_size(total_size) }})
</div>
</div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment