Commit bf7a5a7c authored by Marc Duez's avatar Marc Duez

web2py : views file for vidjil pages

parent c723e3b5
<form id="data_form" action="DB_ADRESS/add_config_form" enctype="multipart/form-data" method="post">
<table>
<tbody>
<tr>
<td >
<label for="config_name" id="config_name__label"> Name: </label>
</td>
<td >
<input class="string" id="config_name" name="config_name" type="text" value="">
</td>
<td >
</td>
</tr>
<tr>
<td>
<label for="config_standard" id="config_standard__label"> standard: </label>
</td>
<td>
<select id="config_standard" name="config_standard">
{{
query = db(db.standard_file).select()
for row in query :}}
<option value="{{=row.id }}">{{=row.name }} </option>
{{pass}}
</select>
</td>
<td>
</td>
</tr>
<tr>
<td>
<label for="config_command" id="config_command__label">Command: </label>
</td>
<td>
<input class="string" id="config_command" name="config_command" type="text" value="">
</td>
<td>
</td>
</tr>
<tr>
<td>
<label for="config_info" id="config_info__label">Info: </label>
</td>
<td>
<textarea class="text" cols="40" id="config_info" name="config_info" rows="10">
</textarea>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td >
<span class="button" onclick="db.call('config_list')"> back to list </span>
<input type="submit" value="Soumettre" class="btn">
</td>
<td>
</td>
</tr>
</tbody>
</table>
</form>
<form id="upload_form" action="DB_ADRESS/add_file_form" enctype="multipart/form-data" method="post">
<input type="hidden" name="patient_id" value="{{=request.vars["id"]}}" >
<table>
<tbody>
<tr>
<td >
<label for="file" id="file__label"> file </label>
</td>
<td >
<input id="upload_file" type="file" name="file" >
</td>
<td >
</td>
</tr>
<tr>
<td>
<label for="sampling_date" id="sampling_date__label">sampling date: </label>
</td>
<td>
<input class="date" id="sampling_date" name="sampling_date" type="text" value="">
<span>(format: yyyy-mm-dd) /!\ pas encore de check </span>
</td>
<td>
</td>
</tr>
<tr>
<td>
<label for="file_info" id="file_info__label">Info: </label>
</td>
<td>
<textarea class="text" cols="40" id="file_info" name="file_info" rows="10">
</textarea>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td >
<span class="button" onclick="db.call('patient',{{=request.vars["id"]}})"> back to list </span>
<input type="submit" value="Soumettre" class="btn">
</td>
<td>
</td>
</tr>
</tbody>
</table>
</form>
<form id="data_form" action="DB_ADRESS/add_patient_form" enctype="multipart/form-data" method="post">
<table>
<tbody>
<tr>
<td >
<label for="patient_first_name" id="patient_first_name__label"> First Name: </label>
</td>
<td >
<input class="string" id="patient_first_name" name="first_name" type="text" value="">
</td>
<td >
</td>
</tr>
<tr>
<td>
<label for="patient_last_name" id="patient_last_name__label">Last Name: </label>
</td>
<td>
<input class="string" id="patient_last_name" name="last_name" type="text" value="">
</td>
<td>
</td>
</tr>
<tr>
<td>
<label for="patient_birth" id="patient_birth__label">Birth: </label>
<span>(format: yyyy-mm-dd) /!\ pas encore de check </span>
</td>
<td>
<input class="date" id="patient_birth" name="birth" type="text" value="">
</td>
<td>
</td>
</tr>
<tr>
<td>
<label for="patient_info" id="patient_info__label">Info: </label>
</td>
<td>
<textarea class="text" cols="40" id="patient_info" name="info" rows="10">
</textarea>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td >
<span class="button" onclick="db.call('patient_list')"> back to list </span>
<input type="submit" value="Soumettre" class="btn">
</td>
<td>
</td>
</tr>
</tbody>
</table>
</form>
<form id="upload_form" action="DB_ADRESS/add_standard_form" enctype="multipart/form-data" method="post">
<table>
<tbody>
<tr>
<td >
<label for="file" id="file__label"> File :</label>
</td>
<td >
<input id="upload_file" type="file" name="file" >
</td>
<td >
</td>
</tr>
<tr>
<td>
<label for="standard_name" id="standard_name__label">Name: </label>
</td>
<td>
<input class="string" id="standard_name" name="standard_name" rows="10">
</td>
<td>
</td>
</tr>
<tr>
<td>
<label for="standard_info" id="standard_info__label">Info: </label>
</td>
<td>
<textarea class="text" cols="40" id="standard_info" name="standard_info" rows="10">
</textarea>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td >
<span class="button" onclick="db.call('standard_list')"> back to list </span>
<input type="submit" value="Soumettre" class="btn">
</td>
<td>
</td>
</tr>
</tbody>
</table>
</form>
{{('message' in globals())}}
{{if 'message' in globals():}}
<div>
<h3>{{=message}}</h3>
<table >
<tr><td> name </td>
<td> standard </td>
<td> info </td>
<td> command </td>
</tr>
{{
query = None
c_id = ""
query = db(db.config.standard_id==db.standard_file.id).select()
for row in query :}}
<tr>
<td> {{=row.config.name }} </td>
<td> {{=row.standard_file.name}} </td>
<td> {{=row.config.info }} </td>
<td> {{=row.config.command }} </td>
</tr>
{{pass}}
</table>
<span class="button" onclick="db.call('add_config')"> new config </span>
</div>
{{elif 'content' in globals():}}
{{=content}}
{{else:}}
{{=BEAUTIFY(response._vars)}}
{{pass}}
{{('message' in globals())}}
{{extend 'layout.html'}}
{{if 'message' in globals():}}
<h3>{{=message}}</h3>
<h4>{{=T('Hi')}}</h4>
Vidjil !!
premiere ebauche de l'interface de gestion
<h4>TODO</h4>
<ol>
<li>nettoyer le layout</li>
<li>ajouter les bdd manquantes</li>
<li>changer le css(un peu)</li>
<li>toussa toussa</li>
</ol>
{{=A("patient list",_href=URL('patient_list'), _class='btn',
) }}
{{=A("user list",_href=URL('user_list'), _class='btn',
) }}
{{elif 'content' in globals():}}
{{=content}}
{{else:}}
{{=BEAUTIFY(response._vars)}}
{{pass}}
{{('message' in globals())}}
{{if 'message' in globals():}}
<div>
<h3>{{=message}} {{=request.vars["id"]}}</h3>
<div>
choose config ( TODO : fixé sur TRG pour le moment ) <span>
<select id="choose_config" name="config">
{{
query = db(db.config).select()
for row in query :}}
<option value="{{=row.id }}">{{=row.name }} </option>
{{pass}}
</select>
</span>
</div>
</div></br>
<table>
<thead>
<tr><td> file_name </td>
<td> sampling date </td>
<td> info </td>
<td> status </td>
</tr>
</thead>
<tbody>
{{
query = db(
( db.sequence_file.patient_id==db.patient.id )
& ( db.patient.id==request.vars["id"] )
).select( left=db.data_file.on(db.data_file.sequence_file_id==db.sequence_file.id) )
for row in query :}}
<tr>
<td> {{ filename = row.sequence_file.data_file
}}
{{=filename}}</td>
<td> {{=row.sequence_file.sampling_date}} </td>
<td> {{=row.sequence_file.info}} </td>
<td> {{if row.data_file.id == None :}}
<span class="button" onclick="db.request('run_request', { 'sequence_file_id' : '{{=row.sequence_file.id}}' , 'config_id' : '1' } )"> run >> </span>
{{else:}}
ready
{{pass}}
</td>
</tr>
{{pass}}
</tbody>
</table>
</br>
<span class="button" onclick="db.call('patient_list')"> back to list </span>
<span class="button" onclick="db.call('add_file', { 'id' : '{{=request.vars["id"]}}' } )"> add file </span>
<span class="button" onclick="db.load( { 'patient_id' : '{{=request.vars["id"]}}' , 'config_id' : '1' } )" > see result </span>
</div>
{{elif 'content' in globals():}}
{{=content}}
{{else:}}
{{=BEAUTIFY(response._vars)}}
{{pass}}
{{('message' in globals())}}
{{if 'message' in globals():}}
<div>
<h3>{{=message}}</h3>
<table >
<tr><td> name </td>
<td> birth </td>
<td> info </td>
</tr>
{{
query = None
c_id = ""
query = db(db.patient).select()
for row in query :}}
<tr onclick="db.call('patient', {'id' :'{{=row.id}}'} )" >
<td> {{=row.last_name + " " + row.first_name }} </td>
<td> {{=row.birth }} </td>
<td> {{=row.info }} </td>
</tr>
{{pass}}
</table>
<span class="button" onclick="db.call('add_patient')"> add patient </span>
</div>
{{elif 'content' in globals():}}
{{=content}}
{{else:}}
{{=BEAUTIFY(response._vars)}}
{{pass}}
{{('message' in globals())}}
{{extend 'layout_fluid.html'}}
{{if 'message' in globals():}}
<div class="span7">
<h3>{{=message}}</h3>
<table class="table">
<thead>
<tr><td> name </td>
<td> gender </td>
<td> birth </td>
<td> </td>
</tr>
</thead>
<tbody>
{{ query = None
c_id = ""}}
{{if "admin" in auth.user_groups.values():}}
{{query = db( db.patient.id==db.auth_permission.record_id ).select( orderby = db.patient.id) }}
{{else:}}
{{query = db(
( db.auth_permission.record_id==db.patient.id )
& ( db.auth_permission.table_name=="patient" )
& ( db.auth_permission.name=="read" )
& ( db.auth_permission.group_id.belongs(auth.user_groups) )
).select( orderby = db.patient.id)
}}
{{pass}}
{{for row in query :}}
{{if (c_id != row.patient.id) :
c_id = row.patient.id}}
<tr class="tabrow" onclick="window.location = '{{=URL(f='patient', args=[row.patient.id])}}' ">
<td> {{=row.patient.last_name + " " + row.patient.first_name }} </td>
<td> {{=row.patient.sex }} </td>
<td> {{=row.patient.birth }} </td>
<td> {{=row.patient.info }} </td>
</tr>
{{pass}}
plop
{{pass}}
</tbody>
</table>
{{=A(str(T('back')),_href=URL('index'),_class="btn")}}
{{=A(str(T('add patient')),_href=URL('add_patient_form'),_class="btn")}}
</div>
<div class="span5">
<div class="well well-small">
<h3>
info
</h3>
fenetre ajax / affichage info_patient ...
<br>TODO
<br>.
<br>.
<br>.
<br>.
</div>
{{=A(str(T('edit info (TODO)')),_href=URL('index'),_class="btn")}}
</div>
{{elif 'content' in globals():}}
{{=content}}
{{else:}}
{{=BEAUTIFY(response._vars)}}
{{pass}}
{{('message' in globals())}}
{{if 'message' in globals():}}
<div class="span7">
<h3>{{=message}} {{=request.args[0]}}</h3>
<table class="table">
<thead>
<tr><td> file_name </td>
<td> sampling date </td>
<td> info </td>
<td></td>
</tr>
</thead>
<tbody>
{{
query = db(
( db.auth_permission.record_id==db.patient.id )
& ( db.auth_permission.table_name=="patient" )
& ( db.auth_permission.name=="read" )
& ( db.auth_permission.group_id.belongs(auth.user_groups) )
& ( db.sequence_file.patient_id==db.patient.id )
& ( db.patient.id==request.args[0] )
).select()
}}
{{
query_perm = db(
( db.auth_permission.record_id==db.patient.id )
& ( db.auth_permission.table_name=="patient" )
& ( db.auth_permission.name=="read" )
& ( db.auth_permission.group_id== db.auth_group.id)
).select(db.auth_group.role, distinct=True)
}}
authorized group :
{{for row in query_perm :}}
{{=row.role}},
{{pass}}
admin
{{for row in query :}}
<tr class="tabrow" onclick="window.location = 'patient.html?id_patient={{=row.patient.id}}' ">
<td> {{="plop"}} </td>
<td> {{=row.sequence_file.sampling_date}} </td>
<td> {{=row.sequence_file.info}} </td>
<td> <a class="btn" data-w2p_disable_with="default" href={{=URL(f='delete_file', args=[row.sequence_file.id])}}>delete</a> </td>
</tr>
{{pass}}
</tbody>
</table>
<a class="btn" data-w2p_disable_with="default" href={{=URL(f='patient_list')}}>back</a>
<a class="btn" data-w2p_disable_with="default" href={{=URL(f='test_upload', args=[request.args[0]])}}>add file</a>
</div>
<div class="span5">
<div class="well well-small">
<h3>
info
</h3>
fenetre ajax / affichage info fichier ...
<br>.
<br>.
<br>.
<br>.
<br>.
</div>
</div>
{{elif 'content' in globals():}}
{{=content}}
{{else:}}
{{=BEAUTIFY(response._vars)}}
{{pass}}
{{('message' in globals())}}
{{if 'message' in globals():}}
<div>
<h3>{{=message}}</h3>
<table >
<tr><td> name </td>
<td> info </td>
<td> </td>
</tr>
{{
query = None
c_id = ""
query = db(db.standard_file).select()
for row in query :}}
<tr>
<td> {{=row.name }} </td>
<td> {{=row.info}} </td>
<td> TODO </td>
</tr>
{{pass}}
</table>
<span class="button" onclick="db.call('add_standard')"> add standard_file </span>
</div>
{{elif 'content' in globals():}}
{{=content}}
{{else:}}
{{=BEAUTIFY(response._vars)}}
{{pass}}
{{('message' in globals())}}
{{extend 'layout.html'}}
{{if 'message' in globals():}}
<!--
/*
* jQuery File Upload Plugin Demo 9.0.0
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2010, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
*/
-->
<link rel="stylesheet" href="http://blueimp.github.io/Gallery/css/blueimp-gallery.min.css">
<link rel="stylesheet" href="{{=URL('static','jQuery-File-Upload/css/jquery.fileupload.css')}}">
<link rel="stylesheet" href="{{=URL('static','jQuery-File-Upload/css/jquery.fileupload-ui.css')}}">
{{
response.files.insert(0,URL('static','css/web2py.css'))
response.files.insert(1,URL('static','css/bootstrap.min.css'))
response.files.insert(2,URL('static','css/bootstrap-responsive.min.css'))
response.files.insert(3,URL('static','css/web2py_bootstrap.css'))
response.files.insert(4,URL('static','css/style.css'))
}}
<div class="container">
<br>
<h3>{{row = db(db.patient.id==request.args[0]).select()}}
add file for {{=row[0].first_name + " " + row[0].last_name }}
</h3>
<!-- The file upload form used as target for the file upload widget -->
<form id="fileupload" action="//jquery-file-upload.appspot.com/" method="POST" enctype="multipart/form-data">
<!-- Redirect browsers with JavaScript disabled to the origin page -->
<noscript><input type="hidden" name="redirect" value="http://blueimp.github.io/jQuery-File-Upload/"></noscript>
<!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
<div class="row fileupload-buttonbar">
<div class="col-lg-7">
<!-- The fileinput-button span is used to style the file input field as button -->
<span class="btn btn-success fileinput-button">
<i class="glyphicon glyphicon-plus"></i>
<span>Add files...</span>
<input type="file" name="files[]" multiple>
</span>
<button type="submit" class="btn btn-primary start">
<i class="glyphicon glyphicon-upload"></i>
<span>Start upload</span>
</button>
<button type="reset" class="btn btn-warning cancel">
<i class="glyphicon glyphicon-ban-circle"></i>
<span>Cancel upload</span>
</button>
<button type="button" class="btn btn-danger delete">