Commit e7acb8d0 authored by Mathieu Giraud's avatar Mathieu Giraud

db: some end-user messages and notifications

parent 207c5cdd
......@@ -243,7 +243,7 @@ def save_analysis():
patient_name = db.patient[request.vars['patient_id']].first_name + " " + db.patient[request.vars['patient_id']].last_name
res = {"success" : "true",
"message" : "default/save_analysis : analysis saved ("+patient_name+")"}
"message" : patient_name+": analysis saved"}
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else :
res = {"success" : "false",
......
......@@ -37,7 +37,7 @@ def add_form():
else:
(filename, str) = db.sequence_file.data_file.retrieve(row.data_file)
if filename == request.vars['filename'] :
res = {"message": "this sequence file already exist for this patient"}
res = {"message": "this sequence file already exists for this patient"}
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
id = db.sequence_file.insert(sampling_date=request.vars['sampling_date'],
......@@ -48,7 +48,7 @@ def add_form():
patient_id=request.vars['patient_id'])
res = {"file_id" : id,
"message": "info file added",
"message": request.vars['filename'] + ": upload started",
"redirect": "patient/info",
"args" : {"id" : request.vars['patient_id']}
}
......@@ -89,7 +89,7 @@ def edit_form():
else:
(filename, str) = db.sequence_file.data_file.retrieve(row.data_file)
if filename == request.vars['filename'] :
res = {"message": "this sequence file already exist for this patient"}
res = {"message": "this sequence file already exists for this patient"}
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
mes = "file " + request.vars['id'] + " : "
......@@ -120,7 +120,7 @@ def upload():
if request.vars.file != None :
f = request.vars.file
db.sequence_file[request.vars["id"]] = dict(data_file = db.sequence_file.data_file.store(f.file, f.filename))
mes += "file saved, "
mes = f.filename + ": upload finished"
res = {"message": mes}
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
......
......@@ -73,9 +73,11 @@ def add_form():
auth.add_permission(g, 'read', db.patient, id)
patient_name = request.vars["first_name"] + ' ' + request.vars["last_name"]
res = {"redirect": "patient/info",
"args" : { "id" : id },
"message": "new patient added"}
"message": patient_name + ": patient added"}
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else :
......
......@@ -7,7 +7,8 @@
<h3>{{=message}}</h3>
Are you sure you want to delete this sequence file?</br>
All data using this sequence file will also be deleted ({{=db(db.data_file.sequence_file_id==request.vars["id"]).count()}} data file(s) will be deleted).</br>
This will also delete {{=db(db.data_file.sequence_file_id==request.vars["id"]).count()}} related result files.</br>
This action cannot be undone.
<div class="center">
<button onclick="db.call('file/delete', {'id' :'{{=request.vars["id"]}}'} )">delete</button>
......
......@@ -12,9 +12,9 @@ for row in query :}}
<div>
<h3>{{=message}}</h3>
Are you sure you want to delete this patient</br>
All sequence file of this patient will also be deleted ({{=db(db.sequence_file.patient_id==request.vars["id"]).count()}} sequence file(s) will be deleted).</br>
All data file of this patient will also be deleted ({{=data_count}} data file(s) will be deleted).</br>
Are you sure you want to delete this patient ?</br>
This will delete {{=db(db.sequence_file.patient_id==request.vars["id"]).count()}} sequence file(s) and {{=data_count}} result files.</br>
This action cannot be undone.
<div class="center">
<button onclick="db.call('patient/delete', {'id' :'{{=request.vars["id"]}}'} )">delete</button>
......
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