Merge branch 'MDL-33649-master-2' of git://git.luns.net.uk/moodle

This commit is contained in:
Aparup Banerjee
2012-06-20 15:19:18 +08:00
+31
View File
@@ -17,6 +17,9 @@ YUI.add('moodle-core-chooserdialogue', function(Y) {
// Any event listeners we may need to cancel later
listenevents : [],
// The initial overflow setting
initialoverflow : '',
setup_chooser_dialogue : function(bodycontent, headercontent, config) {
// Set Default options
var params = {
@@ -66,6 +69,14 @@ YUI.add('moodle-core-chooserdialogue', function(Y) {
var bb = this.overlay.get('boundingBox');
var dialogue = this.container.one('.alloptions');
// Get the overflow setting when the chooser was opened - we
// may need this later
if (Y.UA.ie > 0) {
this.initialoverflow = Y.one('html').getStyle('overflow');
} else {
this.initialoverflow = Y.one('body').getStyle('overflow');
}
var thisevent;
// This will detect a change in orientation and retrigger centering
@@ -186,9 +197,21 @@ YUI.add('moodle-core-chooserdialogue', function(Y) {
// Set a fixed position if the window is large enough
if (newheight > this.get('minheight')) {
bb.setStyle('position', 'fixed');
// Disable the page scrollbars
if (Y.UA.ie > 0) {
Y.one('html').setStyle('overflow', 'hidden');
} else {
Y.one('body').setStyle('overflow', 'hidden');
}
} else {
bb.setStyle('position', 'absolute');
offsettop = Y.one('window').get('scrollTop');
// Ensure that the page scrollbars are enabled
if (Y.UA.ie > 0) {
Y.one('html').setStyle('overflow', this.initialoverflow);
} else {
Y.one('body').setStyle('overflow', this.initialoverflow);
}
}
// Take off 15px top and bottom for borders, plus 40px each for the title and button area before setting the
@@ -228,6 +251,14 @@ YUI.add('moodle-core-chooserdialogue', function(Y) {
hide : function() {
// Detach the global keypress handler before hiding
Y.one('document').detach('keyup', this.handle_key_press, this);
// Re-enable the page scrollbars
if (Y.UA.ie > 0) {
Y.one('html').setStyle('overflow', this.initialoverflow);
} else {
Y.one('body').setStyle('overflow', this.initialoverflow);
}
this.container.detachAll();
this.overlay.hide();
},