Remove moodialog

Re-implementing message dialog.
Fix several imports.
This commit is contained in:
Paulo Gustavo Veiga 2014-02-19 03:34:12 -03:00
parent 4efd64fac1
commit 0e0e3ec29e
20 changed files with 13 additions and 731 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,45 +0,0 @@
/*
---
name: MooDialog.Alert
description: Creates an Alert dialog
authors: Arian Stolwijk
license: MIT-style license
requires: MooDialog
provides: MooDialog.Alert
...
*/
MooDialog.Alert = new Class({
Extends: MooDialog,
options: {
okText: 'Ok',
focus: true,
textPClass: 'MooDialogAlert'
},
initialize: function(msg, options){
this.parent(options);
var okButton = new Element('input[type=button]', {
events: {
click: this.close.bind(this)
},
value: this.options.okText
});
this.setContent(
new Element('p.' + this.options.textPClass, {text: msg}),
new Element('div.buttons').adopt(okButton)
);
if (this.options.autoOpen) this.open();
if (this.options.focus) this.addEvent('show', function(){
okButton.focus()
});
}
});

View File

@ -1,80 +0,0 @@
/*
---
name: MooDialog.Confirm
description: Creates an Confirm Dialog
authors: Arian Stolwijk
license: MIT-style license
requires: MooDialog
provides: [MooDialog.Confirm, Element.confirmLinkClick, Element.confirmFormSubmit]
...
*/
MooDialog.Confirm = new Class({
Extends: MooDialog,
options: {
okText: 'Ok',
cancelText: 'Cancel',
focus: true,
textPClass: 'MooDialogConfirm'
},
initialize: function(msg, fn, fn1, options){
this.parent(options);
var emptyFn = function(){},
self = this;
var buttons = [
{fn: fn || emptyFn, txt: this.options.okText},
{fn: fn1 || emptyFn, txt: this.options.cancelText}
].map(function(button){
return new Element('input[type=button]', {
events: {
click: function(){
button.fn();
self.close();
}
},
value: button.txt
});
});
this.setContent(
new Element('p.' + this.options.textPClass, {text: msg}),
new Element('div.buttons').adopt(buttons)
);
if (this.options.autoOpen) this.open();
if(this.options.focus) this.addEvent('show', function(){
buttons[1].focus();
});
}
});
Element.implement({
confirmLinkClick: function(msg, options){
this.addEvent('click', function(e){
e.stop();
new MooDialog.Confirm(msg, function(){
location.href = this.get('href');
}.bind(this), null, options)
});
return this;
},
confirmFormSubmit: function(msg, options){
this.addEvent('submit', function(e){
e.stop();
new MooDialog.Confirm(msg, function(){
this.submit();
}.bind(this), null, options)
}.bind(this));
return this;
}
});

View File

@ -1,21 +0,0 @@
/*
---
name: MooDialog.Error
description: Creates an Error dialog
authors: Arian Stolwijk
license: MIT-style license
requires: MooDialog
provides: MooDialog.Error
...
*/
MooDialog.Error = new Class({
Extends: MooDialog.Alert,
options: {
textPClass: 'MooDialogError'
}
});

View File

@ -1,44 +0,0 @@
/*
---
name: MooDialog.Fx
description: Overwrite the default events so the Dialogs are using Fx on open and close
authors: Arian Stolwijk
license: MIT-style license
requires: [Cores/Fx.Tween, Overlay]
provides: MooDialog.Fx
...
*/
MooDialog.implement('options', {
duration: 400,
closeOnOverlayClick: true,
onInitialize: function(wrapper){
this.fx = new Fx.Tween(wrapper, {
property: 'opacity',
duration: this.options.duration
}).set(0);
},
onBeforeOpen: function(wrapper){
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(1).chain(function(){
this.fireEvent('show');
}.bind(this));
},
onBeforeClose: function(wrapper){
this.overlay.destroy();
this.fx.start(0).chain(function(){
this.fireEvent('hide');
}.bind(this));
}
});

View File

@ -1,33 +0,0 @@
/*
---
name: MooDialog.IFrame
description: Opens an IFrame in a MooDialog
authors: Arian Stolwijk
license: MIT-style license
requires: MooDialog
provides: MooDialog.IFrame
...
*/
MooDialog.Iframe = new Class({
Extends: MooDialog,
options: {
useScrollBar: true
},
initialize: function(url, options){
this.parent(options);
this.setContent(
new Element('iframe', {
src: url,
frameborder: 0,
scrolling: this.options.useScrollBar ? 'auto' : 'no'
})
);
if (this.options.autoOpen) this.open();
}
});

View File

@ -1,47 +0,0 @@
/*
---
name: MooDialog.Prompt
description: Creates a Prompt dialog
authors: Arian Stolwijk
license: MIT-style license
requires: MooDialog
provides: MooDialog.Prompt
...
*/
MooDialog.Prompt = new Class({
Extends: MooDialog,
options: {
okText: 'Ok',
focus: true,
textPClass: 'MooDialogPrompt'
},
initialize: function(msg, fn, options){
this.parent(options);
if (!fn) fn = function(){};
var textInput = new Element('input.textInput', {type: 'text'}),
submitButton = new Element('input[type=submit]', {value: this.options.okText}),
formEvents = {
submit: function(e){
e.stop();
fn(textInput.get('value'));
this.close();
}.bind(this)
};
this.setContent(
new Element('p.' + this.options.textPClass, {text: msg}),
new Element('form.buttons', {events: formEvents}).adopt(textInput, submitButton)
);
if (this.options.autoOpen) this.open();
if (this.options.focus) this.addEvent('show', function(){
textInput.focus();
});
}
});

View File

@ -1,66 +0,0 @@
/*
---
name: MooDialog.Request
description: Loads Data into a Dialog with Request
authors: Arian Stolwijk
license: MIT-style license
requires: [MooDialog, Core/Request.HTML]
provides: MooDialog.Request
...
*/
MooDialog.Request = new Class({
Extends: MooDialog,
initialize: function(url, requestOptions, options) {
this.parent(options);
this.requestOptions = requestOptions || {};
this.requestOptions.update = this.content;
this.requestOptions.evalScripts = true;
this.requestOptions.noCache = true;
this.requestOptions.onFailure = function(xhr) {
// Intercept form requests ...
console.log("Failure:");
console.log(xhr);
}.bind(this);
this.requestOptions.onSuccess = function() {
// Intercept form requests ...
var forms = this.content.getElements('form');
forms.forEach(function(form) {
form.addEvent('submit', function(event) {
// Intercept form ...
this.requestOptions.url = form.action;
this.requestOptions.method = form.method ? form.method : 'post';
var request = new Request.HTML(this.requestOptions);
request.post(form);
event.stopPropagation();
return false;
}.bind(this))
}.bind(this));
}.bind(this);
this.addEvent('open', function() {
this.requestOptions.url = url;
this.requestOptions.method = 'get';
var request = new Request.HTML(this.requestOptions);
request.send();
MooDialog.Request.active = this;
}.bind(this));
this.addEvent('close', function() {
MooDialog.Request.active = null;
}.bind(this));
if (this.options.autoOpen) this.open();
},
setRequestOptions: function(options) {
this.requestOptions = Object.merge(this.requestOptions, options);
return this;
}
});

View File

@ -1,133 +0,0 @@
/*
---
name: MooDialog
description: The base class of MooDialog
authors: Arian Stolwijk
license: MIT-style license
requires: [Core/Class, Core/Element, Core/Element.Styles, Core/Element.Event]
provides: [MooDialog, Element.MooDialog]
...
*/
var MooDialog = new Class({
Implements: [Options, Events],
options: {
'class': 'MooDialog',
title: null,
scroll: true, // IE
forceScroll: false,
useEscKey: true,
destroyOnHide: true,
autoOpen: true,
closeButton: true,
onInitialize: function(){
this.wrapper.setStyle('display', 'none');
},
onBeforeOpen: function(){
this.wrapper.setStyle('display', 'block');
this.fireEvent('show');
},
onBeforeClose: function(){
this.wrapper.setStyle('display', 'none');
this.fireEvent('hide');
}
},
initialize: function(options){
this.setOptions(options);
this.options.inject = this.options.inject || document.body;
options = this.options;
var wrapper = this.wrapper = new Element('div.' + options['class'].replace(' ', '.')).inject(options.inject);
if (options.title){
this.title = new Element('div.title').set('text', options.title).inject(wrapper);
// this.title.addClass('MooDialogTitle');
}
if (options.closeButton){
this.closeButton = new Element('a.close', {
events: {click: this.close.bind(this)}
}).inject(wrapper);
}
this.content = new Element('div.content').inject(wrapper);
/*<ie6>*/// IE 6 scroll
if ((options.scroll && Browser.ie6) || options.forceScroll){
wrapper.setStyle('position', 'absolute');
var position = wrapper.getPosition(options.inject);
window.addEvent('scroll', function(){
var scroll = document.getScroll();
wrapper.setPosition({
x: position.x + scroll.x,
y: position.y + scroll.y
});
});
}
/*</ie6>*/
if (options.useEscKey){
// Add event for the esc key
document.addEvent('keydown', function(e){
if (e.key == 'esc') this.close();
}.bind(this));
}
this.addEvent('hide', function(){
if (options.destroyOnHide)
this.destroy();
}.bind(this));
this.fireEvent('initialize', wrapper);
},
setContent: function(){
var content = Array.from(arguments);
if (content.length == 1) content = content[0];
this.content.empty();
var type = typeOf(content);
if (['string', 'number'].contains(type)) this.content.set('text', content);
else this.content.adopt(content);
return this;
},
open: function(){
this.fireEvent('beforeOpen', this.wrapper).fireEvent('open');
this.opened = true;
return this;
},
close: function(){
this.fireEvent('beforeClose', this.wrapper).fireEvent('close');
this.opened = false;
return this;
},
destroy: function(){
this.wrapper.destroy();
},
toElement: function(){
return this.wrapper;
}
});
Element.implement({
MooDialog: function(options){
this.store('MooDialog',
new MooDialog(options).setContent(this).open()
);
return this;
}
});

View File

@ -1,143 +0,0 @@
/*
---
name: Overlay
authors:
- David Walsh (http://davidwalsh.name)
license:
- MIT-style license
requires: [Core/Class, Core/Element.Style, Core/Element.Event, Core/Element.Dimensions, Core/Fx.Tween]
provides:
- Overlay
...
*/
var Overlay = new Class({
Implements: [Options, Events],
options: {
id: 'overlay',
color: '#000000',
duration: 500,
opacity: 0.8,
zIndex: 5000/*,
onClick: $empty,
onClose: $empty,
onHide: $empty,
onOpen: $empty,
onShow: $empty
*/
},
initialize: function(container, options) {
this.setOptions(options);
this.container = document.id(container);
this.bound = {
'window': {
resize: this.resize.bind(this),
scroll: this.scroll.bind(this)
},
overlayClick: this.overlayClick.bind(this),
tweenStart: this.tweenStart.bind(this),
tweenComplete: this.tweenComplete.bind(this)
};
this.build().attach();
},
build: function() {
this.overlay = new Element('div', {
id: this.options.id,
opacity: 0,
styles: {
position: (Browser.ie6) ? 'absolute' : 'fixed',
background: this.options.color,
left: 0,
top: 0,
'z-index': this.options.zIndex
}
}).inject(this.container);
this.tween = new Fx.Tween(this.overlay, {
duration: this.options.duration,
link: 'cancel',
property: 'opacity'
});
return this;
}.protect(),
attach: function() {
window.addEvents(this.bound.window);
this.overlay.addEvent('click', this.bound.overlayClick);
this.tween.addEvents({
onStart: this.bound.tweenStart,
onComplete: this.bound.tweenComplete
});
return this;
},
detach: function() {
var args = Array.prototype.slice.call(arguments);
args.each(function(item) {
if (item == 'window') window.removeEvents(this.bound.window);
if (item == 'overlay') this.overlay.removeEvent('click', this.bound.overlayClick);
}, this);
return this;
},
overlayClick: function() {
this.fireEvent('click');
return this;
},
tweenStart: function() {
this.overlay.setStyles({
width: '100%',
height: this.container.getScrollSize().y
});
return this;
},
tweenComplete: function() {
this.fireEvent(this.overlay.get('opacity') == this.options.opacity ? 'show' : 'hide');
return this;
},
open: function() {
this.fireEvent('open');
this.overlay.setStyle('display', 'block');
this.tween.start(this.options.opacity);
return this;
},
close: function() {
this.fireEvent('close');
this.overlay.setStyle('display', 'none');
this.tween.start(0);
return this;
},
destroy: function(){
this.close();
this.overlay.dispose();
},
resize: function() {
this.fireEvent('resize');
this.overlay.setStyle('height', this.container.getScrollSize().y);
return this;
},
scroll: function() {
this.fireEvent('scroll');
if (Browser.ie6) this.overlay.setStyle('left', window.getScroll().x);
return this;
}
});

View File

@ -1,95 +0,0 @@
/* Created by Arian Stolwijk <http://www.aryweb.nl> */
.MooDialog {
position: fixed;
top: 50%;
left: 50%;
z-index: 11000;
width: 400px;
margin: -250px 0 0 -250px;
background-color: #ffffff;
border: 1px solid #999;
border: 1px solid rgba(0, 0, 0, 0.3);
*border: 1px solid #999;
/* IE6-7 */
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
-webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
-moz-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
-webkit-background-clip: padding-box;
-moz-background-clip: padding-box;
background-clip: padding-box;
padding: 30px;
}
.MooDialogTitle {
padding-top: 50px;
}
.MooDialog .content {
height: 100px;
}
.MooDialog .title {
position: absolute;
top: 0;
left: 0;
right: 0;
border-bottom: 1px solid #a1aec5;
font-weight: bold;
text-shadow: 1px 1px 0 #fff;
/*color: black;*/
border-bottom: 1px solid #eee;
padding: 5px 30px;
font-size: 18px
}
.MooDialog .close {
background: url(dialog-close.png) no-repeat;
width: 16px;
height: 16px;
display: block;
cursor: pointer;
top: 8px;
left: 420px;
position: absolute;
}
.MooDialog .buttons {
text-align: right;
margin: 0;
padding: 0;
border: 0;
background: none;
}
.MooDialog .iframe {
width: 100%;
height: 100%;
}
.MooDialog .textInput {
width: 200px;
float: left;
}
.MooDialog .MooDialogAlert,
.MooDialog .MooDialogConfirm,
.MooDialog .MooDialogPrompt,
.MooDialog .MooDialogError {
background: url(dialog-warning.png) no-repeat;
padding-left: 40px;
min-height: 40px;
}
.MooDialog .MooDialogConfirm,
.MooDialog .MooDialogPromt {
background: url(dialog-question.png) no-repeat;
}
.MooDialog .MooDialogError {
background: url(dialog-error.png) no-repeat;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 689 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -19,18 +19,6 @@
mindplot.widget.ToolbarNotifier = new Class({ mindplot.widget.ToolbarNotifier = new Class({
initialize:function () { initialize:function () {
var container = document.id('headerNotifier');
// In case of print,embedded no message is displayed ....
if (container) {
this._effect = new Fx.Elements(container, {
onComplete:function () {
container.setStyle('display', 'none');
}.bind(this),
link:'cancel',
duration:8000,
transition:Fx.Transitions.Expo.easeInOut
});
}
}, },
logError:function (userMsg) { logError:function (userMsg) {
@ -44,7 +32,7 @@ mindplot.widget.ToolbarNotifier = new Class({
logMessage:function (msg, fade) { logMessage:function (msg, fade) {
$assert(msg, 'msg can not be null'); $assert(msg, 'msg can not be null');
var container = document.id('headerNotifier'); var container = $('#headerNotifier');
// In case of print,embedded no message is displayed .... // In case of print,embedded no message is displayed ....
if (container) { if (container) {
@ -57,15 +45,9 @@ mindplot.widget.ToolbarNotifier = new Class({
}); });
if (!$defined(fade) || fade) { if (!$defined(fade) || fade) {
this._effect.start({ this._effect = container.fadeIn('slow');
0:{
opacity:[1, 0]
}
});
} else { } else {
container.setStyle('opacity', '1'); this._effect = container.fadeIn(0);
this._effect.pause();
} }
} }
} }

View File

@ -11,6 +11,7 @@
<![endif]--> <![endif]-->
<link rel="stylesheet/less" type="text/css" href="css/editor.less"/> <link rel="stylesheet/less" type="text/css" href="css/editor.less"/>
<script type='text/javascript' src='js/jquery.js'></script>
<script type='text/javascript' src='js/mootools-core.js'></script> <script type='text/javascript' src='js/mootools-core.js'></script>
<script type='text/javascript' src='js/core.js'></script> <script type='text/javascript' src='js/core.js'></script>
<script type='text/javascript' src='js/less.js'></script> <script type='text/javascript' src='js/less.js'></script>
@ -20,7 +21,7 @@
<script type="text/javascript"> <script type="text/javascript">
var mapId = 'welcome'; var mapId = 'welcome';
$(document).addEvent('loadcomplete', function(resource) { document.id(document).addEvent('loadcomplete', function(resource) {
var options = loadDesignerOptions(); var options = loadDesignerOptions();
var designer = buildDesigner(options); var designer = buildDesigner(options);

View File

@ -10,6 +10,7 @@
<![endif]--> <![endif]-->
<link rel="stylesheet/less" type="text/css" href="css/embedded.less"/> <link rel="stylesheet/less" type="text/css" href="css/embedded.less"/>
<script type='text/javascript' src='js/jquery.js'></script>
<script type='text/javascript' src='js/mootools-core.js'></script> <script type='text/javascript' src='js/mootools-core.js'></script>
<script type='text/javascript' src='js/core.js'></script> <script type='text/javascript' src='js/core.js'></script>
<script type='text/javascript' src='js/less.js'></script> <script type='text/javascript' src='js/less.js'></script>

View File

@ -20,7 +20,7 @@ var designer = null;
function buildDesigner(options) { function buildDesigner(options) {
var container = $(options.container); var container = document.id(options.container);
$assert(container, 'container could not be null'); $assert(container, 'container could not be null');
// Register load events ... // Register load events ...
@ -92,7 +92,7 @@ function buildDesigner(options) {
mindplot.PersistenceManager.init(persistence); mindplot.PersistenceManager.init(persistence);
// Register toolbar event ... // Register toolbar event ...
if ($('toolbar')) { if ($('#toolbar')) {
var menu = new mindplot.widget.Menu(designer, 'toolbar', options.mapId, ""); var menu = new mindplot.widget.Menu(designer, 'toolbar', options.mapId, "");
// If a node has focus, focus can be move to another node using the keys. // If a node has focus, focus can be move to another node using the keys.

1
wise-editor/src/main/webapp/js/jquery.js vendored Symbolic link
View File

@ -0,0 +1 @@
../../../../../mindplot/src/main/javascript/libraries/jquery/jquery-2.1.0.min.js