Commit 17999458 authored by Marc Duez's avatar Marc Duez
parents c040074d 6214a551
......@@ -60,14 +60,15 @@ def add_form():
def edit():
if not auth.has_permission('admin', 'patient', request.vars['id'], auth.user_id):
res = {"success" : "false", "message" : "you need admin permission to edit files"}
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
if auth.has_permission('admin', 'patient', request.vars['patient_id']):
return dict(message=T('edit file'))
#elif not auth.has_permission('upload', 'sequence_file', request.vars['id'], auth.user_id):
# res = {"success" : "false", "message" : "you don't have right to upload files"}
# return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else:
return dict(message=T('edit file'))
res = {"success" : "false", "message" : "you need admin permission to edit files"}
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
#TODO check data
......@@ -126,21 +127,30 @@ def upload():
def confirm():
return dict(message=T('confirm sequence file deletion'))
if auth.has_permission('admin', 'patient', request.vars['patient_id']):
return dict(message=T('confirm sequence file deletion'))
else:
res = {"success" : "false", "message" : "you need admin permission to delete this file"}
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
def delete():
import shutil, os.path
patient_id = db.sequence_file[request.vars["id"]].patient_id
db(db.sequence_file.id == request.vars["id"]).delete()
db(db.data_file.sequence_file_id == request.vars["id"]).delete()
if auth.has_permission('admin', 'patient', patient_id):
db(db.sequence_file.id == request.vars["id"]).delete()
db(db.data_file.sequence_file_id == request.vars["id"]).delete()
res = {"redirect": "patient/info",
"args" : { "id" : patient_id},
"message": "sequence file deleted"}
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else:
res = {"success" : "false", "message" : "you need admin permission to delete this file"}
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
res = {"redirect": "patient/info",
"args" : { "id" : patient_id},
"message": "sequence file deleted"}
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
def sequencer_list():
sequencer_list = []
......
......@@ -136,19 +136,8 @@ def edit_form():
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
## return
## need ["first_name", "last_name", "birth_date", "info"]
## redirect to patient list if success
## return a flash error message if fail
@cache.action()
def download():
if (auth.has_permission('read', 'patient', request.vars["id"]) ) or (auth.has_permission('admin', 'patient', request.vars["id"]) ):
return response.download(request, db)
else :
res = {"message": "acces denied"}
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
#
......
......@@ -104,7 +104,7 @@ db.define_table('sequence_file',
Field('sequencer','text'),
Field('producer','text'),
Field('size_file','integer'),
Field('data_file', 'upload', length=1000000000000))
Field('data_file', 'upload', length=1000000000000, autodelete=True))
......@@ -128,21 +128,21 @@ db.define_table('data_file',
Field('config_id', 'reference config'),
Field('run_date','date'),
Field('scheduler_task_id', 'integer'),
Field('data_file', 'upload', length=1000000000000))
Field('data_file', 'upload', length=1000000000000, autodelete=True))
db.define_table('fused_file',
Field('patient_id', 'reference patient'),
Field('config_id', 'reference config'),
Field('fuse_date','date'),
Field('status', 'string'),
Field('fused_file', 'upload', length=1000000000000))
Field('fused_file', 'upload', length=1000000000000, autodelete=True))
db.define_table('analysis_file',
Field('patient_id', 'reference patient'),
Field('config_id', 'reference config'),
Field('analyze_date','date'),
Field('status', 'string'),
Field('analysis_file', 'upload', length=1000000000000))
Field('analysis_file', 'upload', length=1000000000000, autodelete=True))
if db(db.auth_user.id > 0).count() == 0:
......
{{('message' in globals())}}
{{extend 'layout.html'}}
<html>
<header>
<title>Hi!</title>
<script>
function init() {
var browser_url = document.URL.replace("/vidjil/default/index#", "/browser")
.replace("/vidjil", "/browser")
.replace("https", "http")
var database_url = document.URL.replace("/default/index#", "/")
.replace("/vidjil", "/vidjil/")
document.getElementById("browser").href = browser_url
document.getElementById("db").innerHTML = database_url
}
</script>
</header>
<body onload="init()">
<h4>Hi!</h4>
It seems you've found me ... nice to meet you.
</br></br>
I'm a vidjil database, you can try to connect to me with a vidjil browser just copy this address "<span id="db" ></span>" in your browser js/config.js file as DB_ADDRESS.
</br></br>
If your vidjil browser redirected you here to validate a certificat, it's ok now you can close this page.
</br></br>
Here you can found the online browser <a id="browser" href="#">Clik!</a>
</br></br>
Bye
</body>
{{if 'message' in globals():}}
<h3>{{=message}}</h3>
<h4>{{=T('Hi')}}</h4>
Vidjil !!
{{elif 'content' in globals():}}
{{=content}}
{{else:}}
{{=BEAUTIFY(response._vars)}}
{{pass}}
</html>
......@@ -24,7 +24,7 @@
<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)</span></td>
<span>* (format: yyyy-mm-dd)</span></td>
<td></td>
</tr>
<tr>
......@@ -55,3 +55,7 @@
</tbody>
</table>
</form>
<div>
(* required fields)
</div>
......@@ -24,7 +24,7 @@ info = db.sequence_file[request.vars["id"]]
<tbody>
<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="{{=info.sampling_date}}"> <span>(format: yyyy-mm-dd) /!\ pas encore de check </span> </td>
<td> <input class="date" id="sampling_date" name="sampling_date" type="text" value="{{=info.sampling_date}}"> <span>* (format: yyyy-mm-dd)</span> </td>
<td> </td>
</tr>
<tr>
......
......@@ -8,7 +8,7 @@
<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="">
<input class="string" id="patient_first_name" name="first_name" type="text" value=""><span>*</span>
</td>
<td >
</td>
......@@ -18,7 +18,7 @@
<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="">
<input class="string" id="patient_last_name" name="last_name" type="text" value=""><span>*</span>
</td>
<td>
</td>
......@@ -28,7 +28,7 @@
<label for="patient_birth" id="patient_birth__label">Birth: </label>
</td>
<td>
<input class="date" id="patient_birth" name="birth" type="text" value=""><span>(format: yyyy-mm-dd)</span>
<input class="date" id="patient_birth" name="birth" type="text" value=""><span>* (format: yyyy-mm-dd)</span>
</td>
<td>
</td>
......@@ -55,3 +55,7 @@
</tbody>
</table>
</form>
<div>
(* required fields)
</div>
......@@ -10,17 +10,17 @@ info = db.patient[request.vars["id"]]
<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="{{=info.first_name}}"> </td>
<td > <input class="string" id="patient_first_name" name="first_name" type="text" value="{{=info.first_name}}"><span>*</span></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="{{=info.last_name}}"> </td>
<td> <input class="string" id="patient_last_name" name="last_name" type="text" value="{{=info.last_name}}"><span>*</span></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="{{=info.birth}}"> </td>
<td> <label for="patient_birth" id="patient_birth__label">Birth: </label></td>
<td> <input class="date" id="patient_birth" name="birth" type="text" value="{{=info.birth}}"><span>* (format: yyyy-mm-dd)</span></td>
<td> </td>
</tr>
<tr>
......@@ -35,4 +35,9 @@ info = db.patient[request.vars["id"]]
</tr>
</tbody>
</table>
</form>
<div>
(* required fields)
</div>
......@@ -22,21 +22,29 @@ query = db(
<div id="db_table_container">
<table class="db_table" id="table">
<thead>
<tr><td class="column1"> name </td>
<td class="column2"> birth </td>
<td> info </td>
<td class="column2"> files </td>
<td class="column1"> configs used</td>
<td class="column4"> files </td>
<td class="column5"> </td>
<td class="column5"> </td>
<td class="column5"> </td>
</tr>
</thead>
{{for row in query :}}
<tr onclick="db.call('patient/info', {'id' :'{{=row.patient.id}}'} )" >
<td> {{=row.patient.last_name + " " + row.patient.first_name }} </td>
<td> {{=row.patient.birth }} </td>
<td> {{=row.patient.info }} </td>
<td> {{for row2 in db( db.fused_file.patient_id == row.patient.id ).select(db.fused_file.config_id, distinct=True) :}}
{{=db.config[row2.config_id].name}} ,
{{pass}}</td>
<td> {{=row[count]}}</td>
{{if auth.has_membership("admin"):}}
<td onclick="db.call('patient/permission', {'id' :'{{=row.patient.id}}'} )" > p </td> {{else:}} <td></td> {{pass}}
......@@ -46,6 +54,9 @@ query = db(
{{else:}} <td></td><td></td>{{pass}}
</tr>
{{pass}}
</table>
<table class="db_table" id="db_fixed_header"></table>
</div>
......
......@@ -110,7 +110,8 @@ query = db(
<tr>
<td id="sequence_file_{{=row.sequence_file.id}}"> {{=filename}}</td>
<td> {{if filename != '':}}<a href="{{=URL('patient','download', scheme='https', args=row.sequence_file.data_file)}}" >dl</a>{{pass}}</td>
<td> {{if filename == 'plop':}}<a href="{{=URL('patient','download', scheme='https', args=row.sequence_file.data_file)}}" >dl</a>{{pass}}</td>
<td> {{=row.sequence_file.sampling_date}} </td>
<td> {{=row.sequence_file.info}} </td>
{{if (auth.has_permission('admin', 'patient', request.vars["id"]) ):}}
......
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