delay timeout error to avoid it on page unload

This commit is contained in:
j 2012-01-21 01:06:11 +05:30
parent 89296dd356
commit 07d99ee056

View file

@ -48,41 +48,44 @@ pandora.ui.errorDialog = function(data) {
// on window unload, pending request will time out, so // on window unload, pending request will time out, so
// in order to keep the dialog from appearing, delay it // in order to keep the dialog from appearing, delay it
setTimeout(function() {
that = Ox.Dialog({ if ($('.OxErrorDialog').length ==0 && !pandora.isUnloading) {
buttons: [ that = Ox.Dialog({
Ox.Button({ buttons: [
id: 'close', Ox.Button({
title: 'Close' id: 'close',
}) title: 'Close'
.bindEvent({ })
click: function() { .bindEvent({
that.close(); click: function() {
} that.close();
}) }
], })
content: Ox.Element() ],
.append( content: Ox.Element()
$('<img>') .append(
.attr({src: Ox.UI.PATH + 'png/icon128.png'}) $('<img>')
.css({position: 'absolute', left: '16px', top: '16px', width: '64px', height: '64px'}) .attr({src: Ox.UI.PATH + 'png/icon128.png'})
) .css({position: 'absolute', left: '16px', top: '16px', width: '64px', height: '64px'})
.append(
Ox.Element()
.css({position: 'absolute', left: '96px', top: '16px', width: '256px'})
.html(
'Sorry, a server ' + error
+ ' occured while handling your request. To help us find out what went wrong, you may want to report this error to an administrator. Otherwise, please try again later.'
) )
), .append(
fixedSize: true, Ox.Element()
height: 192, .css({position: 'absolute', left: '96px', top: '16px', width: '256px'})
keys: {enter: 'close', escape: 'close'}, .html(
removeOnClose: true, 'Sorry, a server ' + error
title: 'Server ' + Ox.toTitleCase(error), + ' occured while handling your request. To help us find out what went wrong, you may want to report this error to an administrator. Otherwise, please try again later.'
width: 368 )
}) ),
.open(); fixedSize: true,
height: 192,
keys: {enter: 'close', escape: 'close'},
removeOnClose: true,
title: 'Server ' + Ox.toTitleCase(error),
width: 368
})
.open();
}
}, 250);
} }
that.addClass('OxErrorDialog'); that.addClass('OxErrorDialog');
}; };