diff --git a/mindplot/src/main/javascript/Designer.js b/mindplot/src/main/javascript/Designer.js index fb22e23b..11431b8e 100644 --- a/mindplot/src/main/javascript/Designer.js +++ b/mindplot/src/main/javascript/Designer.js @@ -527,13 +527,6 @@ mindplot.Designer = new Class({ this._relPivot.start(nodes[0], pos); }, - - needsSave:function () { - //@Todo: Review all this ... - return this._actionDispatcher._actionRunner.hasBeenChanged(); - }, - - getMindmapProperties:function () { return {zoom:this.getModel().getZoom()}; }, diff --git a/mindplot/src/main/javascript/DesignerActionRunner.js b/mindplot/src/main/javascript/DesignerActionRunner.js index bcb91383..5e96e9b1 100644 --- a/mindplot/src/main/javascript/DesignerActionRunner.js +++ b/mindplot/src/main/javascript/DesignerActionRunner.js @@ -17,7 +17,7 @@ */ mindplot.DesignerActionRunner = new Class({ - initialize: function(commandContext, notifier) { + initialize:function (commandContext, notifier) { $assert(commandContext, "commandContext can not be null"); this._undoManager = new mindplot.DesignerUndoManager(); @@ -25,7 +25,7 @@ mindplot.DesignerActionRunner = new Class({ this._notifier = notifier; }, - execute:function(command) { + execute:function (command) { $assert(command, "command can not be null"); command.execute(this._context); this._undoManager.enqueue(command); @@ -34,29 +34,21 @@ mindplot.DesignerActionRunner = new Class({ }, - undo: function() { + undo:function () { this._undoManager.execUndo(this._context); this.fireChangeEvent(); mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.DoLayout); }, - redo: function() { + redo:function () { this._undoManager.execRedo(this._context); this.fireChangeEvent(); mindplot.EventBus.instance.fireEvent(mindplot.EventBus.events.DoLayout); }, - fireChangeEvent : function () { + fireChangeEvent:function () { var event = this._undoManager.buildEvent(); this._notifier.fireEvent("modelUpdate", event); - }, - - markAsChangeBase: function() { - return this._undoManager.markAsChangeBase(); - }, - - hasBeenChanged: function() { - return this._undoManager.hasBeenChanged(); } }); diff --git a/mindplot/src/main/javascript/DesignerUndoManager.js b/mindplot/src/main/javascript/DesignerUndoManager.js index d78d6a00..30d4f10e 100644 --- a/mindplot/src/main/javascript/DesignerUndoManager.js +++ b/mindplot/src/main/javascript/DesignerUndoManager.js @@ -21,8 +21,6 @@ mindplot.DesignerUndoManager = new Class({ this._undoQueue = []; this._redoQueue = []; this._baseId = 0; - this._fireChange = fireChange; - }, enqueue:function(command) { @@ -62,9 +60,9 @@ mindplot.DesignerUndoManager = new Class({ }, markAsChangeBase: function() { - var undoLenght = this._undoQueue.length; - if (undoLenght > 0) { - var command = this._undoQueue[undoLenght - 1]; + var undoLength = this._undoQueue.length; + if (undoLength > 0) { + var command = this._undoQueue[undoLength - 1]; this._baseId = command.getId(); } else { this._baseId = 0; @@ -73,11 +71,11 @@ mindplot.DesignerUndoManager = new Class({ hasBeenChanged: function() { var result = true; - var undoLenght = this._undoQueue.length; - if (undoLenght == 0 && this._baseId == 0) { + var undoLength= this._undoQueue.length; + if (undoLength == 0 && this._baseId == 0) { result = false; - } else if (undoLenght > 0) { - var command = this._undoQueue[undoLenght - 1]; + } else if (undoLength > 0) { + var command = this._undoQueue[undoLength - 1]; result = (this._baseId != command.getId()); } return result; diff --git a/mindplot/src/main/javascript/StandaloneActionDispatcher.js b/mindplot/src/main/javascript/StandaloneActionDispatcher.js index 9776aa5d..b28dcea8 100644 --- a/mindplot/src/main/javascript/StandaloneActionDispatcher.js +++ b/mindplot/src/main/javascript/StandaloneActionDispatcher.js @@ -23,12 +23,6 @@ mindplot.StandaloneActionDispatcher = new Class({ this._actionRunner = new mindplot.DesignerActionRunner(commandContext, this); }, - hasBeenChanged:function () { - // @todo: This don't seems to belong here. - this._actionRunner.hasBeenChanged(); - }, - - addTopics:function (models, parentTopicsId) { var command = new mindplot.commands.AddTopicCommand(models, parentTopicsId); this.execute(command); diff --git a/mindplot/src/main/javascript/widget/IMenu.js b/mindplot/src/main/javascript/widget/IMenu.js index 18ad4b93..0938b876 100644 --- a/mindplot/src/main/javascript/widget/IMenu.js +++ b/mindplot/src/main/javascript/widget/IMenu.js @@ -26,6 +26,12 @@ mindplot.widget.IMenu = new Class({ this._toolbarElems = []; this._containerId = containerId; this._mapId = mapId; + this._mindmapUpdated = false; + + // Register update events ... + this._designer.addEvent('modelUpdate', function () { + this.setRequireChange(true); + }.bind(this)); }, clear:function () { @@ -35,9 +41,17 @@ mindplot.widget.IMenu = new Class({ }, discardChanges:function () { + // Avoid autosave before leaving the page .... + this.setRequireChange(false); + + // Finally call discard function ... var persistenceManager = mindplot.PersistenceManager.getInstance(); var mindmap = designer.getMindmap(); persistenceManager.discardChanges(mindmap.getId()); + + // Reload the page ... + window.location.reload(); + }, save:function (saveElem, designer, saveHistory) { @@ -54,6 +68,7 @@ mindplot.widget.IMenu = new Class({ } // Call persistence manager for saving ... + var menu = this; var persistenceManager = mindplot.PersistenceManager.getInstance(); persistenceManager.save(mindmap, mindmapProp, saveHistory, { onSuccess:function () { @@ -61,6 +76,7 @@ mindplot.widget.IMenu = new Class({ saveElem.setStyle('cursor', 'pointer'); $notify($msg('SAVE_COMPLETE')); } + menu.setRequireChange(false); }, onError:function () { if (saveHistory) { @@ -69,5 +85,13 @@ mindplot.widget.IMenu = new Class({ } } }); + }, + + isSaveRequired:function () { + return this._mindmapUpdated; + }, + + setRequireChange:function (value) { + this._mindmapUpdated = value; } }); \ No newline at end of file diff --git a/mindplot/src/main/javascript/widget/Menu.js b/mindplot/src/main/javascript/widget/Menu.js index 92ffed62..f5b6349e 100644 --- a/mindplot/src/main/javascript/widget/Menu.js +++ b/mindplot/src/main/javascript/widget/Menu.js @@ -304,14 +304,14 @@ mindplot.widget.Menu = new Class({ if (!readOnly) { // To prevent the user from leaving the page with changes ... $(window).addEvent('beforeunload', function () { - if (designer.needsSave()) { + if (this.isSaveRequired()) { this.save(saveElem, designer, false); } }.bind(this)); // Autosave on a fixed period of time ... (function () { - if (designer.needsSave()) { + if (this.isSaveRequired()) { this.save(saveElem, designer, false); } }.bind(this)).periodical(30000); @@ -321,14 +321,7 @@ mindplot.widget.Menu = new Class({ var discardElem = $('discard'); if (discardElem) { this._addButton('discard', false, false, function () { - // Avoid autosave before leaving the page .... - $(window).removeEvents(['beforeunload']); - - // Discard changes ... this.discardChanges(); - - // Reload the page ... - window.location.reload(); }.bind(this)); this._registerTooltip('discard', $msg('DISCARD_CHANGES')); } diff --git a/wise-editor/src/main/webapp/icons/gener_female.png b/wise-editor/src/main/webapp/icons/gener_female.png new file mode 100755 index 00000000..f92958e6 Binary files /dev/null and b/wise-editor/src/main/webapp/icons/gener_female.png differ diff --git a/wise-editor/src/main/webapp/icons/gener_male.png b/wise-editor/src/main/webapp/icons/gener_male.png new file mode 100755 index 00000000..25d6ea91 Binary files /dev/null and b/wise-editor/src/main/webapp/icons/gener_male.png differ diff --git a/wise-webapp/src/main/webapp/WEB-INF/app.properties b/wise-webapp/src/main/webapp/WEB-INF/app.properties index ebb670c8..6f23fc28 100755 --- a/wise-webapp/src/main/webapp/WEB-INF/app.properties +++ b/wise-webapp/src/main/webapp/WEB-INF/app.properties @@ -24,7 +24,7 @@ database.password= #------------------------ # Plain SMTP Server Configuration #------------------------ -mail.smtp.port=465 +mail.smtp.port=25 mail.smtp.host=localhost mail.username=root mail.password=