Commit 51821c19 authored by Marc Duez's avatar Marc Duez

server : reorganize folder

- multiple controller ( one by kind of file)
- all views related to a same controller are grouped in a sub-folder
parent 61c910e4
......@@ -169,9 +169,9 @@
<div class="menu" id="database_menu" onmouseover="showSelector('dbSelector');" style="display:none"> database
<div id="dbSelector" class="selector">
<a class="buttonSelector" onclick="db.call('patient_list');">patient list</a>
<a class="buttonSelector" onclick="db.call('standard_list');">standard list</a>
<a class="buttonSelector" onclick="db.call('config_list');">config list</a>
<a class="buttonSelector" onclick="db.call('patient/index');">patient list</a>
<a class="buttonSelector" onclick="db.call('standard/index');">standard list</a>
<a class="buttonSelector" onclick="db.call('config/index');">config list</a>
<div id="upload_list"></div>
</div>
......
......@@ -8,7 +8,7 @@ var config = {
/*database */
"use_database" : true,
"db_address" : "http://134.206.11.64:8000/Vidjil/default/",
"db_address" : "http://134.206.11.64:8000/Vidjil/",
"login" : "", // un jour peut-etre ...
"password" : "",
......
......@@ -75,7 +75,7 @@ Database.prototype = {
success: function (result) {
var res = jQuery.parseJSON(result);
if (res.success == "true") {
self.call("patient_list")
self.call("patient/index")
} else {
popupMsg(res.error);
}
......@@ -103,7 +103,7 @@ Database.prototype = {
url : $(this).attr('action'),
data : $(this).serialize(),
beforeSubmit: function() {
self.call("patient_list")
self.call("patient/index")
//crée un div qui contiendra la progression de l'upload du fichier
self.upload++;
var div = document.createElement('div');
......@@ -267,7 +267,7 @@ Database.prototype = {
type: "POST",
timeout: 5000,
crossDomain: true,
url: self.db_adress + "result" + arg,
url: self.db_adress + "default/result" + arg,
success: function (result) {
json = jQuery.parseJSON(result)
m.reset();
......
var DB_ADDRESS = "http://134.206.11.64:8000/Vidjil/default/";
var DB_ADDRESS = "http://134.206.11.64:8000/Vidjil/";
var CGI_ADDRESS = "http://127.0.1.1/cgi-bin/";
/* Model
......
# coding: utf8
def index():
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
return dict(message=T('config_list'))
def add():
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
return dict(message=T('add config'))
#TODO check data
def add_form():
import gluon.contrib.simplejson, shutil, os.path
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
db.config.insert(name=request.vars['config_name'],
info=request.vars['config_info'],
standard_id=request.vars['config_standard'],
command=request.vars['config_command'],
)
res = {"success": "true" }
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
......@@ -21,182 +21,6 @@ def index():
response.flash = T("Welcome to Vidjil!")
return dict(message=T('hello world'))
def patient():
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
response.title = ""
return dict(message=T('patient'))
def patient_list():
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
return dict(message=T('patient list'))
def add_patient():
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
return dict(message=T('add patient'))
def add_patient_form():
import gluon.contrib.simplejson
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
error = ""
if request.vars["first_name"] == "" :
error += "first name needed, "
if request.vars["last_name"] == "" :
error += "last name needed, "
if request.vars["birth"] == "" :
error += "birth date needed, "
'''if request.vars["birth"] == "" :
error += "birth date incorrect format, " '''
if error=="" :
id = db.patient.insert(first_name=request.vars["first_name"],
last_name=request.vars["last_name"],
birth=request.vars["birth"],
info=request.vars["info"]
)
'''TODO
db.auth_permission.insert(group_id=auth.user_group(auth.user_id),
name="read",
table_name="patient",
record_id=id)
'''
res = {"success": "true" }
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else :
res = {"success" : "false", "error" : error}
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
res2 = {"success" : "false", "error" : "connect error"}
return gluon.contrib.simplejson.dumps(res2, separators=(',',':'))
def add_file():
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
return dict(message=T('add file'))
#TODO check data
def add_file_form():
import gluon.contrib.simplejson, shutil, os.path
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
id = db.sequence_file.insert(data_file = request.vars.file )
query = db( ( db.sequence_file.id==id)).select()
for row in query :
name = db.sequence_file.data_file.retrieve(row.data_file)[0]
db.sequence_file[id] = dict(sampling_date=request.vars['sampling_date'],
info=request.vars['file_info'],
patient_id=request.vars['patient_id'],
filename=name)
res = {"success": "true" }
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
def standard_list():
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
return dict(message=T('standard_list'))
def add_standard():
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
return dict(message=T('add standard file'))
#TODO check data
def add_standard_form():
import gluon.contrib.simplejson, shutil, os.path
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
id = db.standard_file.insert(data_file = request.vars.file )
db.standard_file[id] = dict(name=request.vars['standard_name'],
info=request.vars['standard_info'])
res = {"success": "true" }
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
def config_list():
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
return dict(message=T('config_list'))
def add_config():
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
return dict(message=T('add config'))
#TODO check data
def add_config_form():
import gluon.contrib.simplejson, shutil, os.path
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
db.config.insert(name=request.vars['config_name'],
info=request.vars['config_info'],
standard_id=request.vars['config_standard'],
command=request.vars['config_command'],
)
res = {"success": "true" }
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
def run_request():
import gluon.contrib.simplejson
......
# coding: utf8
def add():
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
return dict(message=T('add file'))
#TODO check data
def add_form():
import gluon.contrib.simplejson, shutil, os.path
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
id = db.sequence_file.insert(data_file = request.vars.file )
name = ""
query = db( ( db.sequence_file.id==id)).select()
for row in query :
name = db.sequence_file.data_file.retrieve(row.data_file)[0]
db.sequence_file[id] = dict(sampling_date=request.vars['sampling_date'],
info=request.vars['file_info'],
patient_id=request.vars['patient_id'],
filename=name)
res = {"success": "true" }
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
# coding: utf8
def info():
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
response.title = ""
return dict(message=T('patient'))
def index():
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
return dict(message=T('patient list'))
def add():
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
return dict(message=T('add patient'))
def add_form():
import gluon.contrib.simplejson
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
error = ""
if request.vars["first_name"] == "" :
error += "first name needed, "
if request.vars["last_name"] == "" :
error += "last name needed, "
if request.vars["birth"] == "" :
error += "birth date needed, "
'''if request.vars["birth"] == "" :
error += "birth date incorrect format, " '''
if error=="" :
id = db.patient.insert(first_name=request.vars["first_name"],
last_name=request.vars["last_name"],
birth=request.vars["birth"],
info=request.vars["info"]
)
'''TODO
db.auth_permission.insert(group_id=auth.user_group(auth.user_id),
name="read",
table_name="patient",
record_id=id)
'''
res = {"success": "true" }
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
else :
res = {"success" : "false", "error" : error}
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
res2 = {"success" : "false", "error" : "connect error"}
return gluon.contrib.simplejson.dumps(res2, separators=(',',':'))
# coding: utf8
def index():
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
return dict(message=T('standard_list'))
def add():
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
return dict(message=T('add standard file'))
#TODO check data
def add_form():
import gluon.contrib.simplejson, shutil, os.path
if request.env.http_origin:
response.headers['Access-Control-Allow-Origin'] = request.env.http_origin
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Max-Age'] = 86400
id = db.standard_file.insert(data_file = request.vars.file )
db.standard_file[id] = dict(name=request.vars['standard_name'],
info=request.vars['standard_info'])
res = {"success": "true" }
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
<form id="data_form" action="DB_ADRESS/add_config_form" enctype="multipart/form-data" method="post">
<form id="data_form" action="DB_ADRESS/config/add_form" enctype="multipart/form-data" method="post">
<table>
<tbody>
<tr>
......@@ -52,7 +52,7 @@
<td>
</td>
<td >
<span class="button" onclick="db.call('config_list')"> back to list </span>
<span class="button" onclick="db.call('config/index')"> back to list </span>
<input type="submit" value="Soumettre" class="btn">
</td>
<td>
......
......@@ -23,7 +23,7 @@
</tr>
{{pass}}
</table>
<span class="button" onclick="db.call('add_config')"> new config </span>
<span class="button" onclick="db.call('config/add')"> new config </span>
</div>
{{elif 'content' in globals():}}
......
<form id="upload_form" action="DB_ADRESS/add_file_form" enctype="multipart/form-data" method="post">
<form id="upload_form" action="DB_ADRESS/file/add_form" enctype="multipart/form-data" method="post">
<input type="hidden" name="patient_id" value="{{=request.vars["id"]}}" >
<table>
......@@ -39,7 +39,7 @@
<td>
</td>
<td >
<span class="button" onclick="db.call('patient', { id : '{{=request.vars['id']}}' } )"> back to list </span>
<span class="button" onclick="db.call('patient/info', { id : '{{=request.vars['id']}}' } )"> back to list </span>
<input type="submit" value="Soumettre" class="btn">
</td>
<td>
......
<form id="data_form" action="DB_ADRESS/add_patient_form" enctype="multipart/form-data" method="post">
<form id="data_form" action="DB_ADRESS/patient/add_form" enctype="multipart/form-data" method="post">
<table>
<tbody>
<tr>
......@@ -47,7 +47,7 @@
<td>
</td>
<td >
<span class="button" onclick="db.call('patient_list')"> back to list </span>
<span class="button" onclick="db.call('patient/index')"> back to list </span>
<input type="submit" value="Soumettre" class="btn">
</td>
<td>
......
......@@ -14,14 +14,14 @@
c_id = ""
query = db(db.patient).select()
for row in query :}}
<tr onclick="db.call('patient', {'id' :'{{=row.id}}'} )" >
<tr onclick="db.call('patient/info', {'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>
<span class="button" onclick="db.call('patient/add')"> add patient </span>
</div>
{{elif 'content' in globals():}}
......
......@@ -14,7 +14,7 @@
<div>
choose config
<span>
<select id="choose_config" name="config" onchange="db.call('patient', {'id' :'{{=request.vars['id']}}', 'config_id' : this.value})">
<select id="choose_config" name="config" onchange="db.call('patient/info', {'id' :'{{=request.vars['id']}}', 'config_id' : this.value})">
{{
query = db(db.config).select()
......@@ -65,9 +65,9 @@
</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' : {{=config_id}} } )" > see result </span>
<span class="button" onclick="db.call('patient/index')"> back to list </span>
<span class="button" onclick="db.call('file/add', { 'id' : '{{=request.vars["id"]}}' } )"> add file </span>
<span class="button" onclick="db.load( { 'patient_id' : '{{=request.vars["id"]}}' , 'config_id' : {{=config_id}} } )" > see result </span>
</div>
{{elif 'content' in globals():}}
......
<form id="upload_form" action="DB_ADRESS/add_standard_form" enctype="multipart/form-data" method="post">
<form id="upload_form" action="DB_ADRESS/standard/add_form" enctype="multipart/form-data" method="post">
<table>
<tbody>
<tr>
......@@ -36,7 +36,7 @@
<td>
</td>
<td >
<span class="button" onclick="db.call('standard_list')"> back to list </span>
<span class="button" onclick="db.call('standard/index')"> back to list </span>
<input type="submit" value="Soumettre" class="btn">
</td>
<td>
......
......@@ -21,7 +21,7 @@
</tr>
{{pass}}
</table>
<span class="button" onclick="db.call('add_standard')"> add standard_file </span>
<span class="button" onclick="db.call('standard/add')"> add standard_file </span>
</div>
{{elif 'content' in globals():}}
......
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