Commit a0399da7 authored by Marc Duez's avatar Marc Duez
Browse files

browser : warning message if analysis file need to be saved

-only if you try to close the browser
-TODO : warning message if we try to load another file
parent 08f14fcb
......@@ -333,6 +333,7 @@ Builder.prototype = {
tagName[tagID] = newTagName
self.build_tagSelector()
self.build_displaySelector()
self.m.analysisHasChanged = true
}
divParent.appendChild(a);
$('#new_tag_name')
......@@ -371,6 +372,7 @@ Builder.prototype = {
self.m.samples[data][self.m.t] = document.getElementById("edit_value").value
self.build_info_container()
self.m.update()
self.m.analysisHasChanged = true
}
divParent.appendChild(a);
$('#edit_value')
......
......@@ -95,6 +95,7 @@ Clone.prototype = {
myConsole.log("changeName() (clone " + this.hash + " <<" + newName + ")");
this.c_name = newName;
this.m.updateElem([this.hash]);
this.m.analysisHasChanged = true
}, //fin changeName,
......
......@@ -4,15 +4,6 @@ function Database(id, db_address) {
this.id = id;
this.upload = {};
this.url = []
window.onbeforeunload = function(e){
if ( self.is_uploading() ){
e = e || event;
if(e.preventDefault){e.preventDefault();}
e.returnValue = false;
return 'some uploads are incomplete, do you really want to leave';
}
}
}
......@@ -480,6 +471,7 @@ Database.prototype = {
try {
var res = jQuery.parseJSON(result);
if (res.message) myConsole.flash("database : " + res.message , 1)
self.m.analysisHasChanged = false
}
catch(err){}
},
......
......@@ -112,4 +112,19 @@ if (location.search != ''){
myConsole.popupMsg(myConsole.msg.welcome)
}
window.onbeforeunload = function(e){
if ( db.is_uploading() ){
e = e || event;
if(e.preventDefault){e.preventDefault();}
e.returnValue = false;
return 'some uploads are incomplete';
}
if ( m.analysisHasChanged ){
e = e || event;
if(e.preventDefault){e.preventDefault();}
e.returnValue = false;
return 'Some changes have not been saved';
}
}
initTag();//TODO a enlever
......@@ -588,6 +588,7 @@ Model.prototype = {
var filename = this.getPrintableAnalysisName().replace(/[ \/\\:]/,'_')
saveAs(textFileAsBlob, filename + ".analysis");
self.m.analysisHasChanged = false
}, //end saveAnalysis
/* create a string with analysis
......@@ -1155,7 +1156,8 @@ Model.prototype = {
this.unselectAll()
this.updateElem(list)
this.select(leader)
this.analysisHasChanged = true
},
......
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