Commit 3382b3aa authored by Marc Duez's avatar Marc Duez
Browse files

model.js : move model init from main.js to model.js

parent c5bf388e
......@@ -40,6 +40,10 @@ function Model() {
this.reset();
this.checkBrowser();
this.germlineList = new GermlineList()
window.onresize = function () { m.resize(); };
this.start()
}
......@@ -114,6 +118,66 @@ Model.prototype = {
];
},
start: function() {
var self = this;
var dataURL = ""
var analysisURL = ""
var patient = -1
var dbconfig = -1
var custom_list = []
// Process arguments in conf.js
if (typeof config != 'undefined' && typeof config.autoload != 'undefined')
dataURL = config.autoload
if (typeof config != 'undefined' && typeof config.autoload_analysis != 'undefined')
analysisURL = config.autoload_analysis
// Process arguments given on the URL (overrides conf.js)
if (location.search != '') {
var tmp = location.search.substring(1).split('&')
for (var i=0; i<tmp.length; i++){
var tmp2 = tmp[i].split('=')
if (tmp2[0] == 'data') dataURL = tmp2[1]
if (tmp2[0] == 'analysis') analysisURL = tmp2[1]
if (tmp2[0] == 'patient') patient = tmp2[1]
if (tmp2[0] == 'config') dbconfig = tmp2[1]
if (tmp2[0] == 'custom') custom_list.push(tmp2[1])
}
}
//onStart
if (dataURL != "") {
if (analysisURL != ""){
var callback = function() {self.loadAnalysisUrl(analysisURL)}
this.loadDataUrl(dataURL, callback)
}else{
this.loadDataUrl(dataURL)
}
}
else if (patient != "-1" && dbconfig != "-1"){
//wait 1sec to check ssl
setTimeout(function () { db.load_data( {"patient" : patient , "config" : dbconfig } , "") }, 1000);
}
else if (custom_list.length>0){
//wait 1sec to check ssl
setTimeout(function () { db.load_custom_data( {"custom" : custom_list }) }, 1000);
}
else if (typeof config != 'undefined' && config.use_database){
//wait 1sec to check ssl
setTimeout(function () { db.call("patient/index.html")}, 1000);
}else{
myConsole.popupMsg(myConsole.msg.welcome)
}
},
/* load the selected vidjil/analysis file from an html input file
* @id : id of the form (html element) linking to the vidjil file
......
Supports Markdown
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