From 2f8cd121e3177703715852daf37f5abc3ba6f012 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Mon, 5 Nov 2012 21:55:19 -0300 Subject: [PATCH] add $notifyModal function. --- .../main/javascript/LocalStorageManager.js | 1 - .../javascript/widget/ModalDialogNotifier.js | 5 +- wise-editor/src/main/webapp/js/editor.js | 81 +------------------ 3 files changed, 4 insertions(+), 83 deletions(-) diff --git a/mindplot/src/main/javascript/LocalStorageManager.js b/mindplot/src/main/javascript/LocalStorageManager.js index 1df06dfb..c436dc0c 100644 --- a/mindplot/src/main/javascript/LocalStorageManager.js +++ b/mindplot/src/main/javascript/LocalStorageManager.js @@ -24,7 +24,6 @@ mindplot.LocalStorageManager = new Class({ saveMapXml:function (mapId, mapXml, pref, saveHistory, events) { localStorage.setItem(mapId + "-xml", mapXml); - events.onError({message:"It's not possible to save your changes because your mindmap has been modified by '%s'. Refresh the page and try again.", severity:"FATAL"}); }, discardChanges:function (mapId) { diff --git a/mindplot/src/main/javascript/widget/ModalDialogNotifier.js b/mindplot/src/main/javascript/widget/ModalDialogNotifier.js index b6fa4d23..db151762 100644 --- a/mindplot/src/main/javascript/widget/ModalDialogNotifier.js +++ b/mindplot/src/main/javascript/widget/ModalDialogNotifier.js @@ -21,9 +21,10 @@ mindplot.widget.ModalDialogNotifier = new Class({ initialize:function () { this.parent({ closeButton:false, - destroyOnClose:true, + destroyOnClose:false, autoOpen:true, useEscKey:false, + closeOnOverlayClick:false, title:"", onInitialize:function (wrapper) { wrapper.setStyle('opacity', 0); @@ -71,7 +72,7 @@ mindplot.widget.ModalDialogNotifier = new Class({ show:function (message, title) { $assert(message, "message can not be null"); this._messsage = message; - this.options.title.setText($defined(title) ? title : "Outch!!. An unexpected error has occurred"); + this.options.title = $defined(title) ? title : "Outch!!. An unexpected error has occurred"; this.open(); }, diff --git a/wise-editor/src/main/webapp/js/editor.js b/wise-editor/src/main/webapp/js/editor.js index 6a7b2456..2f44c1e6 100644 --- a/wise-editor/src/main/webapp/js/editor.js +++ b/wise-editor/src/main/webapp/js/editor.js @@ -72,7 +72,7 @@ function buildDesigner(options) { // Open error dialog only in case of mindmap loading errors. The rest of the error are reported but not display the dialog. // Remove this in the near future. if (!window.mindmapLoadReady) { - errorDialog.show(); + $notifyModal($msg('UNEXPECTED_ERROR_LOADING')); } }; @@ -210,88 +210,9 @@ editor.WaitDialog = new Class({ }); - -editor.FatalErrorDialog = new Class({ - Extends:MooDialog, - initialize:function () { - this.parent({ - closeButton:false, - destroyOnClose:true, - autoOpen:true, - useEscKey:false, - title:'Outch!!. An unexpected error has occurred', - onInitialize:function (wrapper) { - wrapper.setStyle('opacity', 0); - this.wrapper.setStyle('display', 'none'); - this.fx = new Fx.Morph(wrapper, { - duration:100, - transition:Fx.Transitions.Bounce.easeOut - }); - }, - - onBeforeOpen:function () { - var panel = this._buildPanel(); - this.setContent(panel); - - this.overlay = new Overlay(this.options.inject, { - duration:this.options.duration - }); - if (this.options.closeOnOverlayClick) - this.overlay.addEvent('click', this.close.bind(this)); - this.overlay.open(); - this.fx.start({ - 'margin-top':[-200, -100], - opacity:[0, 1] - }).chain(function () { - this.fireEvent('show'); - this.wrapper.setStyle('display', 'block'); - }.bind(this)); - }, - - onBeforeClose:function () { - this.fx.start({ - 'margin-top':[-100, 0], - opacity:0, - duration:200 - }).chain(function () { - this.wrapper.setStyle('display', 'none'); - this.fireEvent('hide'); - - }.bind(this)); - }} - ); - }, - - destroy:function () { - this.parent(); - this.overlay.destroy(); - }, - - _buildPanel:function () { - var result = new Element('div'); - result.setStyles({ - 'text-align':'center', - width:'400px' - }); - var p = new Element('p', {'text':$msg('UNEXPECTED_ERROR_LOADING')}); - p.inject(result); - - var img = new Element('img', {'src':'images/alert-sign.png'}); - img.inject(result); - - return result; - }, - - show:function () { - this.open(); - } - -}); - // Show loading dialog ... waitDialog = new editor.WaitDialog(); waitDialog.show(); -errorDialog = new editor.FatalErrorDialog(); // Loading libraries ... Asset.javascript("js/mindplot-min.js");