- Finish exclusive locking support.
This commit is contained in:
committed by
Paulo Gustavo Veiga
parent
e5e2e86fce
commit
a179875fee
@@ -40,7 +40,7 @@ mindplot.widget.IMenu = new Class({
|
||||
});
|
||||
},
|
||||
|
||||
discardChanges:function () {
|
||||
discardChanges:function (designer) {
|
||||
// Avoid autosave before leaving the page ....
|
||||
this.setRequireChange(false);
|
||||
|
||||
@@ -49,12 +49,21 @@ mindplot.widget.IMenu = new Class({
|
||||
var mindmap = designer.getMindmap();
|
||||
persistenceManager.discardChanges(mindmap.getId());
|
||||
|
||||
// Unlock map ...
|
||||
this.unlockMap(designer);
|
||||
|
||||
// Reload the page ...
|
||||
window.location.reload();
|
||||
|
||||
},
|
||||
|
||||
save:function (saveElem, designer, saveHistory) {
|
||||
unlockMap:function (designer) {
|
||||
var mindmap = designer.getMindmap();
|
||||
var persistenceManager = mindplot.PersistenceManager.getInstance();
|
||||
persistenceManager.unlockMap(mindmap);
|
||||
},
|
||||
|
||||
save:function (saveElem, designer, saveHistory, sync) {
|
||||
// Load map content ...
|
||||
var mindmap = designer.getMindmap();
|
||||
var mindmapProp = designer.getMindmapProperties();
|
||||
@@ -88,7 +97,8 @@ mindplot.widget.IMenu = new Class({
|
||||
$notify(msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}, sync);
|
||||
|
||||
},
|
||||
|
||||
isSaveRequired:function () {
|
||||
|
@@ -325,10 +325,12 @@ mindplot.widget.Menu = new Class({
|
||||
|
||||
if (!readOnly) {
|
||||
// To prevent the user from leaving the page with changes ...
|
||||
$(window).addEvent('beforeunload', function () {
|
||||
Element.NativeEvents.unload = 2;
|
||||
$(window).addEvent('unload', function () {
|
||||
if (this.isSaveRequired()) {
|
||||
this.save(saveElem, designer, false);
|
||||
this.save(saveElem, designer, false, true);
|
||||
}
|
||||
this.unlockMap(designer);
|
||||
}.bind(this));
|
||||
|
||||
// Autosave on a fixed period of time ...
|
||||
@@ -343,29 +345,11 @@ mindplot.widget.Menu = new Class({
|
||||
var discardElem = $('discard');
|
||||
if (discardElem) {
|
||||
this._addButton('discard', false, false, function () {
|
||||
this.discardChanges();
|
||||
this.discardChanges(designer);
|
||||
}.bind(this));
|
||||
this._registerTooltip('discard', $msg('DISCARD_CHANGES'));
|
||||
}
|
||||
|
||||
var tagElem = $('tagIt');
|
||||
if (tagElem) {
|
||||
this._addButton('tagIt', false, false, function () {
|
||||
var reqDialog = new MooDialog.Request('c/tags?mapId=' + mapId, null,
|
||||
{'class':'modalDialog tagItModalDialog',
|
||||
closeButton:true,
|
||||
destroyOnClose:true,
|
||||
title:'Tags'
|
||||
});
|
||||
reqDialog.setRequestOptions({
|
||||
onRequest:function () {
|
||||
reqDialog.setContent($msg('LOADING'));
|
||||
}
|
||||
});
|
||||
});
|
||||
this._registerTooltip('tagIt', "Tag");
|
||||
}
|
||||
|
||||
var shareElem = $('shareIt');
|
||||
if (shareElem) {
|
||||
this._addButton('shareIt', false, false, function () {
|
||||
|
Reference in New Issue
Block a user