Files
wisemapping-open-source/mindplot/src/main/javascript/widget/ModalDialogNotifier.js

106 lines
3.7 KiB
JavaScript
Raw Normal View History

/*
2012-10-04 20:48:01 -03:00
* Copyright [2012] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
2012-10-05 20:05:33 -03:00
mindplot.widget.ModalDialogNotifier = new Class({
2014-03-04 22:48:31 -03:00
// Extends:MooDialog,
initialize: function () {
console.error("Re-impl required ....");
// this.parent(
// {
// closeButton:false,
// destroyOnClose:false,
// autoOpen:true,
// useEscKey:false,
// closeOnOverlayClick:false,
// title:"",
// 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));
// }}
// );
// this.message = null;
},
2014-03-04 22:48:31 -03:00
show: function (message, title) {
2012-10-05 20:05:33 -03:00
$assert(message, "message can not be null");
this._messsage = message;
2012-11-05 21:55:19 -03:00
this.options.title = $defined(title) ? title : "Outch!!. An unexpected error has occurred";
2012-10-05 20:05:33 -03:00
this.open();
},
2014-03-04 22:48:31 -03:00
destroy: function () {
2012-10-05 20:05:33 -03:00
this.parent();
this.overlay.destroy();
},
2014-03-04 22:48:31 -03:00
_buildPanel: function () {
2012-10-05 20:05:33 -03:00
var result = new Element('div');
result.setStyles({
2014-03-04 22:48:31 -03:00
'text-align': 'center',
width: '400px'
2012-10-05 20:05:33 -03:00
});
2014-03-04 22:48:31 -03:00
var p = new Element('p', {'text': this._messsage});
2012-10-05 20:05:33 -03:00
p.inject(result);
2014-03-04 22:48:31 -03:00
var img = new Element('img', {'src': 'images/alert-sign.png'});
2012-10-05 20:05:33 -03:00
img.inject(result);
2012-10-05 20:05:33 -03:00
return result;
}
});
2012-10-05 20:05:33 -03:00
var dialogNotifier = new mindplot.widget.ModalDialogNotifier();
$notifyModal = dialogNotifier.show.bind(dialogNotifier);