mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-08-20 20:40:44 +02:00
Thinkmapping Menu
This commit is contained in:
parent
a300899673
commit
5ffce2bbc3
@ -53,7 +53,7 @@ mindplot.widget.ThinkmappingMenu = new Class({
|
||||
this._toolbarElems.push(new mindplot.widget.SharePanel('shareButton', dummyModel, baseUrl));
|
||||
this._toolbarElems.push(new mindplot.widget.UserPanel('userButton', dummyModel, baseUrl));
|
||||
|
||||
this.addButton('newButton', false, false, function() {
|
||||
this._addButton('newButton', function() {
|
||||
var reqDialog = new MooDialog.Request('newMapDialog.htm', null,
|
||||
{'class': 'newModalDialog',
|
||||
closeButton:true,
|
||||
@ -68,7 +68,7 @@ mindplot.widget.ThinkmappingMenu = new Class({
|
||||
MooDialog.Request.active = reqDialog;
|
||||
});
|
||||
|
||||
this.addButton('importButton', false, false, function() {
|
||||
this._addButton('importButton', function() {
|
||||
var reqDialog = new MooDialog.Request('importMap.htm', null,
|
||||
{'class': 'importModalDialog',
|
||||
closeButton:true,
|
||||
@ -82,7 +82,7 @@ mindplot.widget.ThinkmappingMenu = new Class({
|
||||
});
|
||||
MooDialog.Request.active = reqDialog;
|
||||
});
|
||||
this.addButton('headerMapTitle', false, false, function() {
|
||||
this._addButton('headerMapTitle', function() {
|
||||
var reqDialog = new MooDialog.Request('renameMap.htm?mapId='+mapId, null,
|
||||
{'class': 'renameModalDialog',
|
||||
closeButton:true,
|
||||
@ -96,7 +96,7 @@ mindplot.widget.ThinkmappingMenu = new Class({
|
||||
});
|
||||
MooDialog.Request.active = reqDialog;
|
||||
});
|
||||
this.addButton('communicateButton', false, false, function() {
|
||||
this._addButton('communicateButton', function() {
|
||||
var reqDialog = new MooDialog.Request('sharing.htm?mapId='+mapId, null,
|
||||
{'class': 'communicateModalDialog',
|
||||
closeButton:true,
|
||||
@ -110,62 +110,16 @@ mindplot.widget.ThinkmappingMenu = new Class({
|
||||
});
|
||||
MooDialog.Request.active = reqDialog;
|
||||
});
|
||||
this._addButton('save', false, false, function() {
|
||||
this._save(saveElem, designer, true);
|
||||
}.bind(this));
|
||||
|
||||
this._registerEvents(designer);
|
||||
},
|
||||
|
||||
_registerEvents : function(designer) {
|
||||
|
||||
// Register on close events ...
|
||||
this._toolbarElems.forEach(function(elem) {
|
||||
elem.addEvent('show', function() {
|
||||
this.clear()
|
||||
}.bind(this));
|
||||
}.bind(this));
|
||||
|
||||
designer.addEvent('onblur', function() {
|
||||
var topics = designer.getModel().filterSelectedTopics();
|
||||
var rels = designer.getModel().filterSelectedRelations();
|
||||
|
||||
this._toolbarElems.forEach(function(button) {
|
||||
var disable = false;
|
||||
if (button.isTopicAction() && button.isRelAction()) {
|
||||
disable = rels.length == 0 && topics.length == 0;
|
||||
|
||||
} else if (!button.isTopicAction() && !button.isRelAction()) {
|
||||
disable = false;
|
||||
}
|
||||
else if (button.isTopicAction() && topics.length == 0) {
|
||||
disable = true;
|
||||
} else if (button.isRelAction() && rels.length == 0) {
|
||||
disable = true;
|
||||
}
|
||||
|
||||
if (disable) {
|
||||
button.disable();
|
||||
} else {
|
||||
button.enable();
|
||||
}
|
||||
|
||||
})
|
||||
}.bind(this));
|
||||
|
||||
designer.addEvent('onfocus', function() {
|
||||
var topics = designer.getModel().filterSelectedTopics();
|
||||
var rels = designer.getModel().filterSelectedRelations();
|
||||
|
||||
this._toolbarElems.forEach(function(button) {
|
||||
if (button.isTopicAction() && topics.length > 0) {
|
||||
button.enable();
|
||||
}
|
||||
|
||||
if (button.isRelAction() && rels.length > 0) {
|
||||
button.enable();
|
||||
}
|
||||
})
|
||||
}.bind(this));
|
||||
_addButton:function (buttonId, fn) {
|
||||
// Register Events ...
|
||||
var button = new mindplot.widget.ToolbarItem(buttonId, function(event) {
|
||||
fn(event);
|
||||
this.clear();
|
||||
}.bind(this), {topicAction:true, relAction:true});
|
||||
this._toolbarElems.push(button);
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user