First edit node implementation...

This commit is contained in:
Paulo Veiga
2011-08-25 22:08:39 -03:00
parent 9fbe0050df
commit c4cd24744a
36 changed files with 868 additions and 4131 deletions

View File

@@ -744,6 +744,7 @@ mindplot.MindmapDesigner = new Class({
}
return result;
}.bind(this);
var dialog = mindplot.LinkIcon.buildDialog(this, okFunction, okButtonId);
dialog.adopt(msg).show();
@@ -757,51 +758,11 @@ mindplot.MindmapDesigner = new Class({
}
},
addNote2Node : function(text) {
var topicsIds = this.getModel().filterTopicsIds();
if (topicsIds.length > 0) {
this._actionDispatcher.addNoteToTopic(topicsIds[0], text);
}
},
addNote : function() {
var selectedTopics = this.getModel().filterSelectedTopics();
var topic = null;
if (selectedTopics.length > 0) {
topic = selectedTopics[0];
if (!$defined(topic._hasNote)) {
var msg = new Element('div');
var text = new Element('div').inject(msg);
var formElem = new Element('form', {'action': 'none', 'id':'noteFormId'});
var textInput = new Element('textarea').setStyles({'width':280, 'height':50});
textInput.inject(formElem);
formElem.inject(msg);
var okButtonId = "noteOkButtonId";
formElem.addEvent('submit', function(e) {
$(okButtonId).fireEvent('click', e);
e = new Event(e);
e.stop();
});
var okFunction = function() {
var text = textInput.value;
var result = false;
if ("" != text.trim()) {
this.addNote2Node(text);
result = true;
}
return result;
}.bind(this);
var dialog = mindplot.Note.buildDialog(this, okFunction, okButtonId);
dialog.adopt(msg).show();
// IE doesn't like too much this focus action...
if (!core.UserAgent.isIE()) {
textInput.focus();
}
}
var model = this.getModel();
var topic = model.selectedTopic();
if (topic!=null) {
topic.showNoteEditor();
} else {
core.Monitor.getInstance().logMessage('At least one topic must be selected to execute this operation.');
}