Commit 1d8594f0 authored by Marc Duez's avatar Marc Duez

model.js / com.js : move communication function from model.js to com.js

parent 0a642323
......@@ -252,7 +252,7 @@
</div></div>
</div>
<div id="logo" style="float: right;" onclick="popupMsg(msg.welcome)">Vidjil <span class='logo'>(beta)</span></div>
<div id="logo" style="float: right;" onclick="com.popupMsg(msg.welcome)">Vidjil <span class='logo'>(beta)</span></div>
<div class="menu" style="float: right"> <a href="help" target="_blank">help</a></div>
......@@ -310,12 +310,12 @@
<div id="frame-container"></div>
<div id="popup-container">
<span class="closeButton" onclick="closePopupMsg()">X</span>
<span class="closeButton" onclick="com.closePopupMsg()">X</span>
<div id="popup-msg"></div>
</div>
<div id="data-container">
<span class="closeButton" onclick="closeDataBox()">X</span>
<span class="closeButton" onclick="com.closeDataBox()">X</span>
<div id="data-msg"></div>
</div>
......
......@@ -210,7 +210,7 @@ Builder.prototype = {
.hide('fast')
self.build_settings()
}else{
popupMsg("expected input between 0.0001 and 1")
myConsole.popupMsg("expected input between 0.0001 and 1")
}
}
......@@ -576,7 +576,7 @@ Builder.prototype = {
infoTime.appendChild(document.createTextNode("Info"));
infoTime.className = "button_right"
infoTime.onclick = function () {
dataBox(self.m.getPointHtmlInfo(self.m.t));
myConsole.dataBox(self.m.getPointHtmlInfo(self.m.t));
}
div_point.appendChild(infoTime)
......
......@@ -21,9 +21,12 @@
/* Com object display/store system message
*
* */
function Com(id, id2) {
this.flash_id = id;
this.log_id = id2;
function Com(flash_id, log_id, popup_id, data_id) {
this.flash_id = flash_id;
this.log_id = log_id;
this.popup_id = popup_id
this.data_id = data_id;
this.min_priority = 1; // minimum required to display message
this.log_container = document.getElementById(this.log_id);
}
......@@ -90,6 +93,33 @@ Com.prototype = {
closeLog: function () {
$("#"+this.log_id).fadeToggle(200)
},
popupMsg: function (msg) {
document.getElementById(this.popup_id)
.style.display = "block";
document.getElementById(this.popup_id)
.innerHTML = msg;
},
closePopupMsg: function () {
document.getElementById(this.popup_id)
.style.display = "none";
document.getElementById(this.popup_id)
.innerHTML = "";
},
dataBox: function(msg) {
document.getElementById(this.data_id)
.style.display = "block";
document.getElementById(this.data_id)
.innerHTML = msg;
},
closeDataBox: function() {
document.getElementById(this.data_id)
.style.display = "none";
document.getElementById(this.data_id).lastElementChild
.innerHTML = "";
},
}
\ No newline at end of file
......@@ -73,7 +73,7 @@ Database.prototype = {
+ "Your browser currently does not recognize our SSL certificate. </br>"
+ "To use the sample database, you need to accept this certificate and/or tag this website as a trusted one. </br>"
+ "<a href='"+DB_ADDRESS+"'>Follow this link<a/>"
popupMsg(msg)
myConsole.popupMsg(msg)
}
},
......@@ -150,7 +150,7 @@ Database.prototype = {
if (status === "timeout") {
myConsole.flash("database : Timeout",2)
} else {
popupMsg(request.responseText);
myConsole.popupMsg(request.responseText);
}
}
});
......@@ -224,7 +224,7 @@ Database.prototype = {
if(status==="timeout") {
myConsole.flash("database : Timeout",2)
} else {
popupMsg(request + " " + status + " " + error);
myConsole.popupMsg(request + " " + status + " " + error);
}
}
});
......@@ -370,7 +370,7 @@ Database.prototype = {
if (status === "timeout") {
myConsole.flash("database : Timeout", 2)
} else {
popupMsg(request.responseText);
myConsole.popupMsg(request.responseText);
}
}
});
......@@ -398,7 +398,7 @@ Database.prototype = {
if (status === "timeout") {
myConsole.flash("database : Timeout", 2)
} else {
popupMsg(request.responseText);
myConsole.popupMsg(request.responseText);
}
}
});
......
......@@ -225,7 +225,7 @@ List.prototype = {
var span_info = document.createElement('span')
span_info.className = "infoBox";
span_info.onclick = function () {
dataBox(self.m.clone(cloneID).getHtmlInfo());
myConsole.dataBox(self.m.clone(cloneID).getHtmlInfo());
}
span_info.appendChild(document.createTextNode("I"));
......@@ -317,7 +317,7 @@ List.prototype = {
var span_info = document.createElement('span')
span_info.className = "infoBox";
span_info.onclick = function () {
dataBox(self.m.clone(this.parentNode.id2).getHtmlInfo());
myConsole.dataBox(self.m.clone(this.parentNode.id2).getHtmlInfo());
}
span_info.appendChild(document.createTextNode("I"));
......
......@@ -116,7 +116,7 @@ if (location.search != ''){
//wait 1sec to check ssl
setTimeout(function () { db.call("patient/index.html")}, 1000);
}else{
popupMsg(msg.welcome)
myConsole.popupMsg(msg.welcome)
}
/*Statements and functions which allows to active the ALT key, and the movement of the SVG frame*/
......
......@@ -1468,7 +1468,6 @@ Model.prototype = {
*
* */
updateElem: function (list) {
if ( list.indexOf(this.normalization.id) != -1 ){
this.update_normalization()
this.update_precision()
......@@ -1834,23 +1833,7 @@ Model.prototype = {
this.update()
},
flash: function (str){
var div = jQuery('<div/>', {
text: str,
style: 'display : none',
class: 'flash'
}).appendTo('#flash_mes')
.slideDown(200);
setTimeout(function(){
div.fadeOut('slow', function() { div.remove();});
}, 5000);
},
clone: function(hash) {
return this.windows[hash]
},
......@@ -1948,35 +1931,6 @@ function showDisplayMenu() {
}
function popupMsg(msg) {
document.getElementById("popup-msg")
.innerHTML = "";
document.getElementById("popup-container")
.style.display = "block";
document.getElementById("popup-msg")
.innerHTML += msg;
}
function closePopupMsg() {
document.getElementById("popup-container")
.style.display = "none";
document.getElementById("popup-msg")
.innerHTML = "";
}
function dataBox(msg) {
document.getElementById("data-container")
.style.display = "block";
document.getElementById("data-msg")
.innerHTML = msg;
}
function closeDataBox() {
document.getElementById("data-container")
.style.display = "none";
document.getElementById("data-msg")
.innerHTML = "";
}
function return_URL_CGI() {
if (typeof config != "undefined") return config.cgi_address;
......
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