2009-06-07 18:59:43 +00:00
|
|
|
/*
|
2011-01-23 20:34:05 -03:00
|
|
|
* Copyright [2011] [wisemapping]
|
|
|
|
*
|
2011-01-23 21:03:12 -03:00
|
|
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
|
|
|
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
2011-01-23 20:34:05 -03:00
|
|
|
* "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.
|
2009-06-11 17:43:45 +00:00
|
|
|
*/
|
2009-06-07 18:59:43 +00:00
|
|
|
|
|
|
|
/*
|
2009-06-11 17:43:45 +00:00
|
|
|
Created By: Chris Campbell
|
|
|
|
Website: http://particletree.com
|
|
|
|
Date: 2/1/2006
|
2009-06-07 18:59:43 +00:00
|
|
|
|
2009-06-11 17:43:45 +00:00
|
|
|
Inspired by the lightbox implementation found at http://www.huddletogether.com/projects/lightbox/
|
|
|
|
/*-----------------------------------------------------------------------------------------------*/
|
2009-06-07 18:59:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
core.WaitDialog = new Class({
|
|
|
|
|
|
|
|
|
|
|
|
yPos : 0,
|
|
|
|
xPos : 0,
|
|
|
|
|
2009-06-11 17:43:45 +00:00
|
|
|
initialize: function() {
|
|
|
|
},
|
|
|
|
// Turn everything on - mainly the IE fixes
|
|
|
|
activate: function(changeCursor, dialogContent)
|
2009-06-07 18:59:43 +00:00
|
|
|
{
|
2009-06-11 17:43:45 +00:00
|
|
|
|
|
|
|
this.content = dialogContent;
|
|
|
|
|
|
|
|
this._initLightboxMarkup();
|
|
|
|
|
2009-06-07 18:59:43 +00:00
|
|
|
this.displayLightbox("block");
|
|
|
|
|
|
|
|
// Change to loading cursor.
|
|
|
|
if (changeCursor)
|
|
|
|
{
|
|
|
|
window.document.body.style.cursor = "wait";
|
|
|
|
}
|
|
|
|
},
|
2009-06-11 17:43:45 +00:00
|
|
|
changeContent: function(dialogContent, changeCursor)
|
|
|
|
{
|
|
|
|
this.content = dialogContent;
|
|
|
|
if (!$('lbContent'))
|
|
|
|
{
|
|
|
|
// Dialog is not activated. Nothing to do ...
|
|
|
|
window.document.body.style.cursor = "pointer";
|
|
|
|
return;
|
2009-06-07 18:59:43 +00:00
|
|
|
}
|
|
|
|
|
2009-06-11 17:43:45 +00:00
|
|
|
this.processInfo();
|
2009-06-07 18:59:43 +00:00
|
|
|
|
2009-06-11 17:43:45 +00:00
|
|
|
// Change to loading cursor.
|
|
|
|
if (changeCursor)
|
|
|
|
{
|
|
|
|
window.document.body.style.cursor = "wait";
|
|
|
|
}else
|
|
|
|
{
|
|
|
|
window.document.body.style.cursor = "auto";
|
|
|
|
}
|
2009-06-07 18:59:43 +00:00
|
|
|
},
|
|
|
|
displayLightbox: function(display) {
|
|
|
|
if (display != 'none')
|
|
|
|
this.processInfo();
|
2011-08-25 22:08:39 -03:00
|
|
|
$('overlay-lightbox').style.display = display;
|
2009-07-10 00:01:09 +00:00
|
|
|
$('lightbox').style.display = display;
|
|
|
|
|
2009-06-07 18:59:43 +00:00
|
|
|
},
|
|
|
|
|
2009-06-11 17:43:45 +00:00
|
|
|
// Display dialog content ...
|
2009-06-07 18:59:43 +00:00
|
|
|
processInfo: function() {
|
2009-06-11 17:43:45 +00:00
|
|
|
if ($('lbContent'))
|
2011-07-26 15:07:53 -03:00
|
|
|
$('lbContent').dispose();
|
2009-06-11 17:43:45 +00:00
|
|
|
|
|
|
|
var lbContentElement = new Element('div').setProperty('id', 'lbContent');
|
2011-07-26 15:07:53 -03:00
|
|
|
lbContentElement.innerHTML = this.content.innerHTML;
|
2009-06-11 17:43:45 +00:00
|
|
|
|
2011-07-26 15:07:53 -03:00
|
|
|
lbContentElement.inject($('lbLoadMessage'),'before');
|
2009-06-07 18:59:43 +00:00
|
|
|
$('lightbox').className = "done";
|
|
|
|
},
|
|
|
|
|
2009-06-11 17:43:45 +00:00
|
|
|
// Search through new links within the lightbox, and attach click event
|
2009-06-07 18:59:43 +00:00
|
|
|
actions: function() {
|
|
|
|
lbActions = document.getElementsByClassName('lbAction');
|
|
|
|
|
|
|
|
for (i = 0; i < lbActions.length; i++) {
|
|
|
|
$(lbActions[i]).addEvent('click', function() {
|
|
|
|
this[lbActions[i].rel].pass(this)
|
|
|
|
}.bind(this));
|
|
|
|
lbActions[i].onclick = function() {
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
2009-06-11 17:43:45 +00:00
|
|
|
// Example of creating your own functionality once lightbox is initiated
|
2009-06-07 18:59:43 +00:00
|
|
|
deactivate: function(time) {
|
|
|
|
|
|
|
|
if ($('lbContent'))
|
2011-07-26 15:07:53 -03:00
|
|
|
$('lbContent').dispose();
|
2009-06-11 17:43:45 +00:00
|
|
|
|
2009-06-07 18:59:43 +00:00
|
|
|
this.displayLightbox("none");
|
|
|
|
|
|
|
|
window.document.body.style.cursor = "default";
|
|
|
|
}
|
2009-06-11 17:43:45 +00:00
|
|
|
, _initLightboxMarkup:function()
|
|
|
|
{
|
|
|
|
// Add overlay element inside body ...
|
|
|
|
var bodyElem = document.getElementsByTagName('body')[0];
|
2011-08-25 22:08:39 -03:00
|
|
|
var overlayElem = new Element('div').setProperty('id', 'overlay-lightbox');
|
2011-07-26 15:07:53 -03:00
|
|
|
overlayElem.inject(bodyElem);
|
2009-06-11 17:43:45 +00:00
|
|
|
|
|
|
|
// Add lightbox element inside body ...
|
|
|
|
var lightboxElem = new Element('div').setProperty('id', 'lightbox');
|
|
|
|
lightboxElem.addClass('loading');
|
|
|
|
|
|
|
|
var lbLoadMessageElem = new Element('div').setProperty('id', 'lbLoadMessage');
|
2011-07-26 15:07:53 -03:00
|
|
|
lbLoadMessageElem.inject(lightboxElem);
|
2009-06-11 17:43:45 +00:00
|
|
|
|
2011-07-26 15:07:53 -03:00
|
|
|
lightboxElem.inject(bodyElem);
|
2009-06-11 17:43:45 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
});
|