From 291455cecdbd64fada004a45031880593f7b1abb Mon Sep 17 00:00:00 2001 From: David Monllao Date: Mon, 10 Sep 2012 13:27:23 +0800 Subject: [PATCH] MDL-30899 modchooser Changing from overlay to panel references --- lib/yui/chooserdialogue/chooserdialogue.js | 34 ++++++++++++---------- theme/base/style/core.css | 4 +-- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/lib/yui/chooserdialogue/chooserdialogue.js b/lib/yui/chooserdialogue/chooserdialogue.js index 496084707c926..7d819827fc187 100644 --- a/lib/yui/chooserdialogue/chooserdialogue.js +++ b/lib/yui/chooserdialogue/chooserdialogue.js @@ -5,8 +5,8 @@ YUI.add('moodle-core-chooserdialogue', function(Y) { } Y.extend(CHOOSERDIALOGUE, Y.Base, { - // The overlay widget - overlay: null, + // The panel widget + panel: null, // The submit button - we disable this until an element is set submitbutton : null, @@ -51,23 +51,23 @@ YUI.add('moodle-core-chooserdialogue', function(Y) { params[paramkey] = this.instanceconfig[paramkey]; } - // Create the overlay - this.overlay = new M.core.dialogue(params); + // Create the panel + this.panel = new M.core.dialogue(params); // Remove the template for the chooser this.bodycontent.remove(); this.headercontent.remove(); - // Hide and then render the overlay - this.overlay.hide(); - this.overlay.render(); + // Hide and then render the panel + this.panel.hide(); + this.panel.render(); // Set useful links - this.container = this.overlay.get('boundingBox').one('.choosercontainer'); + this.container = this.panel.get('boundingBox').one('.choosercontainer'); this.options = this.container.all('.option input[type=radio]'); // Add the chooserdialogue class to the container for styling - this.overlay.get('boundingBox').addClass('chooserdialogue'); + this.panel.get('boundingBox').addClass('chooserdialogue'); }, /** @@ -82,7 +82,7 @@ YUI.add('moodle-core-chooserdialogue', function(Y) { // Stop the default event actions before we proceed e.preventDefault(); - var bb = this.overlay.get('boundingBox'); + var bb = this.panel.get('boundingBox'); var dialogue = this.container.one('.alloptions'); // Get the overflow setting when the chooser was opened - we @@ -136,7 +136,9 @@ YUI.add('moodle-core-chooserdialogue', function(Y) { // Hook onto the cancel button to hide the form thisevent = this.container.one('.addcancel').on('click', this.cancel_popup, this); this.listenevents.push(thisevent); - thisevent = bb.one('div.closebutton').on('click', this.cancel_popup, this); + + // Hide will be managed by cancel_popup after restoring the body overflow + thisevent = bb.one('button.closebutton').on('click', this.cancel_popup, this); this.listenevents.push(thisevent); // Grab global keyup events and handle them @@ -153,8 +155,8 @@ YUI.add('moodle-core-chooserdialogue', function(Y) { // Ensure that the options are shown this.options.removeAttribute('disabled'); - // Display the overlay - this.overlay.show(); + // Display the panel + this.panel.show(); // Re-centre the dialogue after we've shown it. this.center_dialogue(dialogue); @@ -192,7 +194,7 @@ YUI.add('moodle-core-chooserdialogue', function(Y) { * @return void */ center_dialogue : function(dialogue) { - var bb = this.overlay.get('boundingBox'); + var bb = this.panel.get('boundingBox'); var winheight = bb.get('winHeight'); var winwidth = bb.get('winWidth'); @@ -276,7 +278,7 @@ YUI.add('moodle-core-chooserdialogue', function(Y) { } this.container.detachAll(); - this.overlay.hide(); + this.panel.hide(); }, check_options : function(e) { @@ -319,6 +321,6 @@ YUI.add('moodle-core-chooserdialogue', function(Y) { M.core.chooserdialogue = CHOOSERDIALOGUE; }, '@VERSION@', { - requires:['base', 'overlay', 'moodle-core-notification'] + requires:['base', 'panel', 'moodle-core-notification'] } ); diff --git a/theme/base/style/core.css b/theme/base/style/core.css index 5774931824092..c345d44ef4a04 100644 --- a/theme/base/style/core.css +++ b/theme/base/style/core.css @@ -892,7 +892,7 @@ sup {vertical-align: super;} -moz-box-shadow: 5px 5px 20px 0px #666666; } -.chooserdialogue .moodle-dialogue-hd { +.chooserdialogue .moodle-dialogue-wrap .moodle-dialogue-hd { font-size:12px!important; font-weight: normal!important; letter-spacing: 1px; @@ -913,7 +913,7 @@ sup {vertical-align: super;} /* Question Bank - Question Chooser "Close" button */ #page-question-edit.dir-rtl a.container-close {right:auto;left:6px;} -.chooserdialogue .moodle-dialogue-bd { +.chooserdialogue .moodle-dialogue-wrap .moodle-dialogue-bd { font-size: 12px; color: #555555; overflow: auto;