Merge branch 'MDL-30899_23' of git://github.com/dmonllao/moodle into MOODLE_23_STABLE
authorDan Poltawski <dan@moodle.com>
Tue, 18 Dec 2012 01:11:31 +0000 (09:11 +0800)
committerDan Poltawski <dan@moodle.com>
Tue, 18 Dec 2012 01:11:31 +0000 (09:11 +0800)
13 files changed:
backup/util/ui/base_moodleform.class.php
blocks/community/communitycourse.php
blocks/community/styles.css
blocks/community/yui/comments/comments.js
blocks/community/yui/imagegallery/imagegallery.js
course/lib.php
enrol/cohort/yui/quickenrolment/quickenrolment.js
enrol/manual/yui/quickenrolment/quickenrolment.js
enrol/yui/notification/assets/skins/sam/notification.css
enrol/yui/notification/notification.js
filter/glossary/yui/autolinker/autolinker.js
lib/yui/chooserdialogue/chooserdialogue.js
theme/base/style/core.css

index ce95e7a..fb0e975 100644 (file)
@@ -322,6 +322,7 @@ abstract class base_moodleform extends moodleform {
         $config->question = get_string('confirmcancelquestion', 'backup');
         $config->yesLabel = get_string('confirmcancelyes', 'backup');
         $config->noLabel = get_string('confirmcancelno', 'backup');
+        $config->closeButtonTitle = get_string('close', 'editor');
         $PAGE->requires->yui_module('moodle-backup-confirmcancel', 'M.core_backup.watch_cancel_buttons', array($config));
 
         $PAGE->requires->yui_module('moodle-backup-backupselectall', 'M.core_backup.select_all_init',
index dbd9e07..5cef966 100644 (file)
@@ -228,10 +228,10 @@ if (!empty($courses)) {
     }
 }
 $PAGE->requires->yui_module('moodle-block_community-comments', 'M.blocks_community.init_comments',
-        array(array('commentids' => $commentedcourseids)));
+        array(array('commentids' => $commentedcourseids, 'closeButtonTitle' => get_string('close', 'editor'))));
 $PAGE->requires->yui_module('moodle-block_community-imagegallery', 'M.blocks_community.init_imagegallery',
         array(array('imageids' => $courseids, 'imagenumbers' => $courseimagenumbers,
-                'huburl' => $huburl)));
+                'huburl' => $huburl, 'closeButtonTitle' => get_string('close', 'editor'))));
 
 echo highlight($search, $renderer->course_list($courses, $huburl, $courseid));
 
index 97e6e1d..28d6162 100644 (file)
     background-color:#F6F6F6;
     border:1px solid #CCCCCC;
     overflow: auto;
+    padding: 7px 6px;
 }
 
 #page-blocks-community-communitycourse .moodle-dialogue-base .moodle-dialogue-bd {
 
 #page-blocks-community-communitycourse .moodle-dialogue-base .closebutton {
     margin-top:4px;
-    width:30px;
-}
\ No newline at end of file
+    margin-right: 4px;
+}
index 7355b80..300fcdf 100644 (file)
@@ -9,8 +9,8 @@ YUI.add('moodle-block_community-comments', function(Y) {
     Y.extend(COMMENTS, Y.Base, {
 
         event:null,
-        overlayevent:null,
-        overlays: [], //all the comment boxes
+        panelevent: null,
+        panels: [], //all the comment boxes
 
         initializer : function(params) {
 
@@ -18,17 +18,19 @@ YUI.add('moodle-block_community-comments', function(Y) {
             for (var i=0;i<this.get('commentids').length;i++)
             {
                 var commentid = this.get('commentids')[i];
-                this.overlays[commentid] = new M.core.dialogue({
-                    headerContent:Y.one('#commentoverlay-'+commentid+' .commenttitle').get('innerHTML'),
+                this.panels[commentid] = new M.core.dialogue({
+                    headerContent:Y.Node.create('<h1>')
+                        .append(Y.one('#commentoverlay-'+commentid+' .commenttitle').get('innerHTML')),
                     bodyContent:Y.one('#commentoverlay-'+commentid).get('innerHTML'),
                     visible: false, //by default it is not displayed
                     lightbox : false,
-                    zIndex:100
+                    zIndex:100,
+                    closeButtonTitle: this.get('closeButtonTitle')
                 });
 
-                this.overlays[commentid].get('contentBox').one('.commenttitle').remove();
-                this.overlays[commentid].render();
-                this.overlays[commentid].hide();
+                this.panels[commentid].get('contentBox').one('.commenttitle').remove();
+                this.panels[commentid].render();
+                this.panels[commentid].hide();
 
                 Y.one('#comments-'+commentid).on('click', this.show, this, commentid);
             }
@@ -37,34 +39,37 @@ YUI.add('moodle-block_community-comments', function(Y) {
 
         show : function (e, commentid) {
 
-            //hide all overlays
+            // Hide all panels.
             for (var i=0;i<this.get('commentids').length;i++)
             {
                 this.hide(e, this.get('commentids')[i]);
             }
 
-            this.overlays[commentid].show(); //show the overlay
+            this.panels[commentid].show(); //show the panel
 
-            e.halt(); // we are going to attach a new 'hide overlay' event to the body,
+            e.halt(); // we are going to attach a new 'hide panel' event to the body,
             // because javascript always propagate event to parent tag,
             // we need to tell Yahoo to stop to call the event on parent tag
             // otherwise the hide event will be call right away.
 
-            //we add a new event on the body in order to hide the overlay for the next click
+            // We add a new event on the body in order to hide the panel for the next click.
             this.event = Y.one(document.body).on('click', this.hide, this, commentid);
-            //we add a new event on the overlay in order to hide the overlay for the next click (touch device)
-            this.overlayevent = Y.one("#commentoverlay-"+commentid).on('click', this.hide, this, commentid);
+            // We add a new event on the panel in order to hide the panel for the next click (touch device).
+            this.panelevent = Y.one("#commentoverlay-"+commentid).on('click', this.hide, this, commentid);
+
+            // Focus on the close button
+            this.panels[commentid].get('buttons').header[0].focus();
         },
 
         hide : function (e, commentid) {
-            this.overlays[commentid].hide(); //hide the overlay
+            this.panels[commentid].hide(); //hide the panel
             if (this.event != null) {
                 this.event.detach(); //we need to detach the body hide event
             //Note: it would work without but create js warning everytime
             //we click on the body
             }
-            if (this.overlayevent != null) {
-                this.overlayevent.detach(); //we need to detach the overlay hide event
+            if (this.panelevent != null) {
+                this.panelevent.detach(); //we need to detach the panel hide event
             //Note: it would work without but create js warning everytime
             //we click on the body
             }
@@ -74,7 +79,11 @@ YUI.add('moodle-block_community-comments', function(Y) {
     }, {
         NAME : COMMENTSNAME,
         ATTRS : {
-            commentids: {}
+            commentids: {},
+            closeButtonTitle : {
+                validator : Y.Lang.isString,
+                value : 'Close'
+            }
         }
     });
 
@@ -84,5 +93,5 @@ YUI.add('moodle-block_community-comments', function(Y) {
     }
 
 }, '@VERSION@', {
-    requires:['base','overlay', 'moodle-enrol-notification']
+    requires:['base', 'moodle-enrol-notification']
 });
index f91abb0..5407234 100644 (file)
@@ -11,8 +11,8 @@ YUI.add('moodle-block_community-imagegallery', function(Y) {
         event:null,
         previousevent:null,
         nextevent:null,
-        overlayevent:null,
-        overlay:null, //all the comment boxes
+        panelevent: null,
+        panel: null, //all the images boxes
         imageidnumbers: [],
         imageloadingevent: null,
         loadingimage: null,
@@ -26,15 +26,15 @@ YUI.add('moodle-block_community-imagegallery', function(Y) {
                 +'</div>');
             objBody.append(this.loadingimage);
 
-            /// create the div for overlay
+            // Create the div for panel.
             var objBody = Y.one(document.body);
-            var overlaytitle = Y.Node.create('<div id="imagetitleoverlay" class="hiddenoverlay"></div>');
-            objBody.append(overlaytitle);
-            var overlay = Y.Node.create('<div id="imageoverlay" class="hiddenoverlay"></div>');
-            objBody.append(overlay);
+            var paneltitle = Y.Node.create('<div id="imagetitleoverlay" class="hiddenoverlay"></div>');
+            objBody.append(paneltitle);
+            var panel = Y.Node.create('<div id="imageoverlay" class="hiddenoverlay"></div>');
+            objBody.append(panel);
 
-            /// create the overlay
-            this.overlay = new M.core.dialogue({
+            /// Create the panel.
+            this.panel = new M.core.dialogue({
                 headerContent:Y.one('#imagetitleoverlay').get('innerHTML'),
                 bodyContent:Y.one('#imageoverlay').get('innerHTML'),
                 visible: false, //by default it is not displayed
@@ -42,8 +42,8 @@ YUI.add('moodle-block_community-imagegallery', function(Y) {
                 zIndex:100
             });
 
-            this.overlay.render();
-            this.overlay.hide();
+            this.panel.render();
+            this.panel.hide();
 
             //attach a show event on the image divs (<tag id='image-X'>)
             for (var i=0;i<this.get('imageids').length;i++)
@@ -85,31 +85,31 @@ YUI.add('moodle-block_community-imagegallery', function(Y) {
             var maxheight = windowheight - 150;
 
             //load the title + link to next image
-            var overlaytitle = Y.one('#imagetitleoverlay');
+            var paneltitle = Y.one('#imagetitleoverlay');
             var previousimagelink = "<div id=\"previousarrow\" class=\"imagearrow\">←</div>";
             var nextimagelink = "<div id=\"nextarrow\" class=\"imagearrow\">→</div>";
 
-            /// need to load the images in the overlay
-            var overlay = Y.one('#imageoverlay');
-            overlay.setContent('');
+            // Need to load the images in the panel.
+            var panel = Y.one('#imageoverlay');
+            panel.setContent('');
 
-
-            overlay.append(Y.Node.create('<div style="text-align:center"><img id=\"imagetodisplay\" src="' + url
+            panel.append(Y.Node.create('<div style="text-align:center"><img id=\"imagetodisplay\" src="' + url
                 + '" style="max-height:' + maxheight + 'px;"></div>'));
-            this.overlay.destroy();
-            this.overlay = new M.core.dialogue({
-                headerContent:previousimagelink + '<div id=\"imagenumber\" class=\"imagetitle\"> Image '
-                + screennumber + ' / ' + this.imageidnumbers[imageid] + ' </div>' + nextimagelink,
+            this.panel.destroy();
+            this.panel = new M.core.dialogue({
+                headerContent:previousimagelink + '<div id=\"imagenumber\" class=\"imagetitle\"><h1> Image '
+                + screennumber + ' / ' + this.imageidnumbers[imageid] + ' </h1></div>' + nextimagelink,
                 bodyContent:Y.one('#imageoverlay').get('innerHTML'),
                 visible: false, //by default it is not displayed
                 lightbox : false,
-                zIndex:100
+                zIndex:100,
+                closeButtonTitle: this.get('closeButtonTitle')
             });
-            this.overlay.render();
-            this.overlay.hide(); //show the overlay
-            this.overlay.set("centered", true);
+            this.panel.render();
+            this.panel.hide(); //show the panel
+            this.panel.set("centered", true);
 
-            e.halt(); // we are going to attach a new 'hide overlay' event to the body,
+            e.halt(); // we are going to attach a new 'hide panel' event to the body,
             // because javascript always propagate event to parent tag,
             // we need to tell Yahoo to stop to call the event on parent tag
             // otherwise the hide event will be call right away.
@@ -123,14 +123,17 @@ YUI.add('moodle-block_community-imagegallery', function(Y) {
                 var screenshot = new Image();
                 screenshot.src = url;
 
-                var overlaywidth = windowwidth - 100;
-                if(overlaywidth > screenshot.width) {
-                    overlaywidth = screenshot.width;
+                var panelwidth = windowwidth - 100;
+                if(panelwidth > screenshot.width) {
+                    panelwidth = screenshot.width;
                 }
 
-                this.overlay.set('width', overlaywidth);
-                this.overlay.set("centered", true);
-                this.overlay.show();
+                this.panel.set('width', panelwidth);
+                this.panel.set("centered", true);
+                this.panel.show();
+
+                // Focus on the close button
+                this.panel.get('buttons').header[0].focus();
 
             }, this, url);
 
@@ -147,12 +150,12 @@ YUI.add('moodle-block_community-imagegallery', function(Y) {
             Y.one('#nextarrow').on('click', this.show, this, imageid, nextnumber);
             Y.one('#imagenumber').on('click', this.show, this, imageid, nextnumber);
 
-            //we add a new event on the body in order to hide the overlay for the next click
+            //we add a new event on the body in order to hide the panel for the next click
             this.event = Y.one(document.body).on('click', this.hide, this);
-            //we add a new event on the overlay in order to hide the overlay for the next click (touch device)
-            this.overlayevent = Y.one("#imageoverlay").on('click', this.hide, this);
+            //we add a new event on the panel in order to hide the panel for the next click (touch device)
+            this.panelevent = Y.one("#imageoverlay").on('click', this.hide, this);
 
-            this.overlay.on('visibleChange',function(e){
+            this.panel.on('visibleChange',function(e){
                 if(e.newVal == 0){
                     this.get('maskNode').remove()
                 }
@@ -167,14 +170,14 @@ YUI.add('moodle-block_community-imagegallery', function(Y) {
             //hide the loading image
             Y.one('#hubloadingimage').setStyle('display', 'none');
 
-            this.overlay.hide(); //hide the overlay
+            this.panel.hide(); //hide the panel
             if (this.event != null) {
                 this.event.detach(); //we need to detach the body hide event
             //Note: it would work without but create js warning everytime
             //we click on the body
             }
-            if (this.overlayevent != null) {
-                this.overlayevent.detach(); //we need to detach the overlay hide event
+            if (this.panelevent != null) {
+                this.panelevent.detach(); //we need to detach the panel hide event
             //Note: it would work without but create js warning everytime
             //we click on the body
             }
@@ -185,7 +188,11 @@ YUI.add('moodle-block_community-imagegallery', function(Y) {
         ATTRS : {
             imageids: {},
             imagenumbers: {},
-            huburl: {}
+            huburl: {},
+            closeButtonTitle : {
+                validator : Y.Lang.isString,
+                value : 'Close'
+            }
         }
     });
 
@@ -195,5 +202,5 @@ YUI.add('moodle-block_community-imagegallery', function(Y) {
     }
 
 }, '@VERSION@', {
-    requires:['base','node','overlay', 'moodle-enrol-notification']
+    requires:['base','node', 'moodle-enrol-notification']
 });
index 5ce677f..54dfc74 100644 (file)
@@ -4599,7 +4599,7 @@ function include_course_ajax($course, $usedmodules = array(), $enabledmodules =
     // Add the module chooser
     $PAGE->requires->yui_module('moodle-course-modchooser',
         'M.course.init_chooser',
-        array(array('courseid' => $course->id))
+        array(array('courseid' => $course->id, 'closeButtonTitle' => get_string('close', 'editor')))
     );
     $PAGE->requires->strings_for_js(array(
             'addresourceoractivity',
index 7f5437e..341a439 100644 (file)
@@ -20,6 +20,7 @@ YUI.add('moodle-enrol_cohort-quickenrolment', function(Y) {
         AJAXURL = 'ajaxurl',
         MANUALENROLMENT = 'manualEnrolment',
         CSS = {
+            CLOSEBTN : 'close-button',
             COHORT : 'qce-cohort',
             COHORTS : 'qce-cohorts',
             COHORTBUTTON : 'qce-cohort-button',
@@ -52,13 +53,16 @@ YUI.add('moodle-enrol_cohort-quickenrolment', function(Y) {
             this.publish('cohortsloaded');
             this.publish('defaultcohortroleloaded', {fireOnce:true});
 
+            var finishbutton = Y.Node.create('<div class="'+CSS.CLOSEBTN+'"></div>')
+                                   .append(Y.Node.create('<input type="button" value="'+M.str.enrol.finishenrollingusers+'" />'));
             var base = Y.Node.create('<div class="'+CSS.PANELCONTENT+'"></div>')
                 .append(Y.Node.create('<div class="'+CSS.PANELROLES+'"></div>'))
                 .append(Y.Node.create('<div class="'+CSS.PANELCOHORTS+'"></div>'))
                 .append(Y.Node.create('<div class="'+CSS.FOOTER+'"></div>')
-                    .append(Y.Node.create('<div class="'+CSS.SEARCH+'"><label>'+M.str.enrol_cohort.cohortsearch+':</label></div>')
+                    .append(Y.Node.create('<div class="'+CSS.SEARCH+'"><label for="enrolcohortsearch">'+M.str.enrol_cohort.cohortsearch+':</label></div>')
                         .append(Y.Node.create('<input type="text" id="enrolcohortsearch" value="" />'))
                     )
+                    .append(finishbutton)
                 )
                 .append(Y.Node.create('<div class="'+CSS.LIGHTBOX+' '+CSS.HIDDEN+'"></div>')
                     .append(Y.Node.create('<img alt="loading" class="'+CSS.LOADINGICON+'" />')
@@ -99,6 +103,7 @@ YUI.add('moodle-enrol_cohort-quickenrolment', function(Y) {
             this.on('defaultcohortroleloaded', this.updateContent, this, panel);
             Y.on('key', this.hide, document.body, 'down:27', this);
             close.on('click', this.hide, this);
+            finishbutton.on('click', this.hide, this);
 
             Y.all('.enrol_cohort_plugin input').each(function(node){
                 if (node.getAttribute('type', 'submit')) {
@@ -117,6 +122,11 @@ YUI.add('moodle-enrol_cohort-quickenrolment', function(Y) {
             this.getCohorts(e, false);
             this.getAssignableRoles();
             this.fire('show');
+
+            var rolesselect = Y.one('#id_enrol_cohort_assignable_roles');
+            if (rolesselect) {
+                rolesselect.focus();
+            }
         },
         updateContent : function(e, panel) {
             var content, i, roles, cohorts, count=0, supportmanual = this.get(MANUALENROLMENT), defaultrole;
@@ -154,13 +164,14 @@ YUI.add('moodle-enrol_cohort-quickenrolment', function(Y) {
                     break;
                 case 'assignablerolesloaded':
                     roles = this.get(ASSIGNABLEROLES);
-                    content = Y.Node.create('<select></select>');
+                    content = Y.Node.create('<select id="id_enrol_cohort_assignable_roles"></select>');
                     for (i in roles) {
                         content.append(Y.Node.create('<option value="'+i+'">'+roles[i]+'</option>'));
                     }
-                    panel.get('contentBox').one('.'+CSS.PANELROLES).setContent(Y.Node.create('<div><label>'+M.str.role.assignroles+':</label></div>').append(content));
+                    panel.get('contentBox').one('.'+CSS.PANELROLES).setContent(Y.Node.create('<div><label for="id_enrol_cohort_assignable_roles">'+M.str.role.assignroles+':</label></div>').append(content));
 
                     this.getDefaultCohortRole();
+                    Y.one('#id_enrol_cohort_assignable_roles').focus();
                     break;
                 case 'defaultcohortroleloaded':
                     defaultrole = this.get(DEFAULTCOHORTROLE);
@@ -280,7 +291,8 @@ YUI.add('moodle-enrol_cohort-quickenrolment', function(Y) {
                                 new M.core.ajaxException(result);
                             } else {
                                 if (result.response && result.response.message) {
-                                    new M.core.alert(result.response);
+                                    var alertpanel = new M.core.alert(result.response);
+                                    Y.Node.one('#id_yuialertconfirm-' + alertpanel.COUNT).focus();
                                 }
                                 var enrolled = Y.Node.create('<div class="'+CSS.COHORTBUTTON+' alreadyenrolled">'+M.str.enrol.synced+'</div>');
                                 node.one('.'+CSS.COHORT+' #cohortid_'+cohort.get(COHORTID)).replace(enrolled);
index b4c7692..3236a75 100644 (file)
@@ -89,8 +89,8 @@ YUI.add('moodle-enrol_manual-quickenrolment', function(Y) {
                         .append(create('<h2>'+M.str.enrol.enrolusers+'</h2>')))
                     .append(create('<div class="'+CSS.CONTENT+'"></div>')
                         .append(create('<div class="'+CSS.SEARCHCONTROLS+'"></div>')
-                            .append(create('<div class="'+CSS.ENROLMENTOPTION+' '+CSS.ROLE+'">'+M.str.role.assignroles+'</div>')
-                                    .append(create('<select><option value="">'+M.str.enrol.none+'</option></select>'))
+                            .append(create('<div class="'+CSS.ENROLMENTOPTION+' '+CSS.ROLE+'"><label for="id_enrol_manual_assignable_roles">'+M.str.role.assignroles+'</label></div>')
+                                    .append(create('<select id="id_enrol_manual_assignable_roles"><option value="">'+M.str.enrol.none+'</option></select>'))
                             )
                             .append(create('<div class="'+CSS.SEARCHOPTIONS+'"></div>')
                                 .append(create('<div class="'+CSS.COLLAPSIBLEHEADING+'"><img alt="" />'+M.str.enrol.enrolmentoptions+'</div>'))
@@ -180,6 +180,7 @@ YUI.add('moodle-enrol_manual-quickenrolment', function(Y) {
                     s.append(option);
                 }
                 s.set('selectedIndex', index);
+                Y.one('#id_enrol_manual_assignable_roles').focus();
             }, this);
             this.getAssignableRoles();
         },
@@ -271,6 +272,10 @@ YUI.add('moodle-enrol_manual-quickenrolment', function(Y) {
             }
 
             this._escCloseEvent = Y.on('key', this.hide, document.body, 'down:27', this);
+            var rolesselect = Y.one('#id_enrol_manual_assignable_roles');
+            if (rolesselect) {
+                rolesselect.focus();
+            }
         },
         hide : function(e) {
             if (this._escCloseEvent) {
index 66cddda..91fd8d2 100644 (file)
@@ -1,12 +1,15 @@
 .moodle-dialogue-base .hidden,
 .moodle-dialogue-base .moodle-dialogue-hidden {display:none;}
-.moodle-dialogue-base .moodle-dialogue-lightbox {background-color:#AAA;position:absolute;top:0;left:0;width:100%;height:100%;}
+.moodle-dialogue-base .moodle-dialogue-lightbox {background-color:#AAA;}
 .moodle-dialogue-base .moodle-dialogue {background-color:#666;border:0 solid #666;border-right-width:3px;border-bottom-width:3px;}
 .moodle-dialogue-base .moodle-dialogue-wrap {background-color:#FFF;margin-top:-3px;margin-left:-3px;border:1px solid #555;height:auto;}
-.moodle-dialogue-base .moodle-dialogue-hd {font-size:110%;color:inherit;font-weight:bold;text-align:left;padding:5px 6px;margin:0;border-bottom:1px solid #ccc;background-color:#f6f6f6;}
-.moodle-dialogue-base .closebutton {background-image:url(sprite.png);width:25px;height:15px;background-repeat:no-repeat;float:right;vertical-align:middle;display:inline-block;cursor:pointer;}
+.moodle-dialogue-base .moodle-dialogue-wrap .moodle-dialogue-hd {font-size:110%;color:inherit;font-weight:bold;text-align:left;padding:5px 6px;margin:0;border-bottom:1px solid #ccc;background:#f6f6f6;}
+.moodle-dialogue-base .moodle-dialogue-wrap .moodle-dialogue-hd h1{font-size:100%;font-weight:bold;margin:0;padding:0;display:inline;}
+.moodle-dialogue-base .moodle-dialogue-wrap .moodle-dialogue-hd .yui3-widget-buttons {padding: 5px;}
+.moodle-dialogue-base .closebutton {background-image:url(sprite.png);width:25px;height:15px;background-repeat:no-repeat;float:right;vertical-align:middle;display:inline-block;cursor:pointer;padding:0px;border-style:none;}
 .moodle-dialogue-base .moodle-dialogue-bd {padding:5px; overflow: auto;}
-.moodle-dialogue-base .moodle-dialogue-ft {}
+.moodle-dialogue-base .moodle-dialogue-wrap .moodle-dialogue-content {background:#FFF;padding:0px;}
+.moodle-dialogue-base .moodle-dialogue .moodle-dialogue-content .moodle-dialogue-ft {padding:0px;}
 
 .moodle-dialogue-confirm .confirmation-dialogue {text-align:center;}
 .moodle-dialogue-confirm .confirmation-message {margin:0.5em 1em;}
index 2ed9af0..b2b4d45 100644 (file)
@@ -8,8 +8,6 @@ var DIALOGUE_NAME = 'Moodle dialogue',
     ALERT_NAME = 'Moodle alert',
     C = Y.Node.create,
     BASE = 'notificationBase',
-    LIGHTBOX = 'lightbox',
-    NODELIGHTBOX = 'nodeLightbox',
     COUNT = 0,
     CONFIRMYES = 'yesLabel',
     CONFIRMNO = 'noLabel',
@@ -31,7 +29,6 @@ var DIALOGUE = function(config) {
     var id = 'moodle-dialogue-'+COUNT;
     config.notificationBase =
         C('<div class="'+CSS.BASE+'">')
-            .append(C('<div class="'+CSS.LIGHTBOX+' '+CSS.HIDDEN+'"></div>'))
             .append(C('<div id="'+id+'" class="'+CSS.WRAP+'"></div>')
                 .append(C('<div class="'+CSS.HEADER+' yui3-widget-hd"></div>'))
                 .append(C('<div class="'+CSS.BODY+' yui3-widget-bd"></div>'))
@@ -42,41 +39,50 @@ var DIALOGUE = function(config) {
     config.visible =    config.visible || false;
     config.center =     config.centered || true;
     config.centered =   false;
+
+    // lightbox param to keep the stable versions API.
+    if (config.lightbox !== false) {
+        config.modal = true;
+    }
+    delete config.lightbox;
+
+    // closeButton param to keep the stable versions API.
+    if (config.closeButton === false) {
+        config.buttons = null;
+    } else {
+        config.buttons = [
+            {
+                section: Y.WidgetStdMod.HEADER,
+                classNames: 'closebutton',
+                action: function (e) {
+                    this.hide();
+                }
+            }
+        ];
+    }
     DIALOGUE.superclass.constructor.apply(this, [config]);
+
+    if (config.closeButton !== false) {
+        // The buttons constructor does not allow custom attributes
+        this.get('buttons').header[0].setAttribute('title', this.get('closeButtonTitle'));
+    }
 };
-Y.extend(DIALOGUE, Y.Overlay, {
+Y.extend(DIALOGUE, Y.Panel, {
     initializer : function(config) {
-        this.set(NODELIGHTBOX, this.get(BASE).one('.'+CSS.LIGHTBOX).setStyle('opacity', 0.5));
         this.after('visibleChange', this.visibilityChanged, this);
-        this.after('headerContentChange', function(e){
-            var h = (this.get('closeButton'))?this.get(BASE).one('.'+CSS.HEADER):false;
-            if (h && !h.one('.closebutton')) {
-                var c = C('<div class="closebutton"></div>');
-                c.on('click', this.hide, this);
-                h.append(c);
-            }
-        }, this);
         this.render();
         this.show();
     },
     visibilityChanged : function(e) {
         switch (e.attrName) {
             case 'visible':
-                if (this.get(LIGHTBOX)) {
-                    var l = this.get(NODELIGHTBOX);
-                    if (!e.prevVal && e.newVal) {
-                        l.setStyle('height',l.get('docHeight')+'px').removeClass(CSS.HIDDEN);
-                    } else if (e.prevVal && !e.newVal) {
-                        l.addClass(CSS.HIDDEN);
-                    }
-                }
+                this.get('maskNode').addClass(CSS.LIGHTBOX);
                 if (this.get('center') && !e.prevVal && e.newVal) {
                     this.centerDialogue();
                 }
                 if (this.get('draggable')) {
                     var titlebar = '#' + this.get('id') + ' .' + CSS.HEADER;
                     this.plug(Y.Plugin.Drag, {handles : [titlebar]});
-                    this.dd.addInvalid('div.closebutton');
                     Y.one(titlebar).setStyle('cursor', 'move');
                 }
                 break;
@@ -101,9 +107,6 @@ Y.extend(DIALOGUE, Y.Overlay, {
     ATTRS : {
         notificationBase : {
 
-        },
-        nodeLightbox : {
-            value : null
         },
         lightbox : {
             validator : Y.Lang.isBoolean,
@@ -113,6 +116,10 @@ Y.extend(DIALOGUE, Y.Overlay, {
             validator : Y.Lang.isBoolean,
             value : true
         },
+        closeButtonTitle : {
+            validator : Y.Lang.isString,
+            value : 'Close'
+        },
         center : {
             validator : Y.Lang.isBoolean,
             value : true
@@ -132,14 +139,14 @@ Y.extend(ALERT, DIALOGUE, {
     _enterKeypress : null,
     initializer : function(config) {
         this.publish('complete');
-        var yes = C('<input type="button" value="'+this.get(CONFIRMYES)+'" />'),
+        var yes = C('<input type="button" id="id_yuialertconfirm-' + this.COUNT + '" value="'+this.get(CONFIRMYES)+'" />'),
             content = C('<div class="confirmation-dialogue"></div>')
                     .append(C('<div class="confirmation-message">'+this.get('message')+'</div>'))
                     .append(C('<div class="confirmation-buttons"></div>')
                             .append(yes));
         this.get(BASE).addClass('moodle-dialogue-confirm');
         this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
-        this.setStdModContent(Y.WidgetStdMod.HEADER, this.get(TITLE), Y.WidgetStdMod.REPLACE);
+        this.setStdModContent(Y.WidgetStdMod.HEADER, '<h1>' + this.get(TITLE) + '</h1>', Y.WidgetStdMod.REPLACE);
         this.after('destroyedChange', function(){this.get(BASE).remove();}, this);
         this._enterKeypress = Y.on('key', this.submit, window, 'down:13', this);
         yes.on('click', this.submit, this);
@@ -185,8 +192,8 @@ Y.extend(CONFIRM, DIALOGUE, {
         this.publish('complete');
         this.publish('complete-yes');
         this.publish('complete-no');
-        var yes = C('<input type="button" value="'+this.get(CONFIRMYES)+'" />'),
-            no = C('<input type="button" value="'+this.get(CONFIRMNO)+'" />'),
+        var yes = C('<input type="button" id="id_yuiconfirmyes-' + this.COUNT + '" value="'+this.get(CONFIRMYES)+'" />'),
+            no = C('<input type="button" id="id_yuiconfirmno-' + this.COUNT + '" value="'+this.get(CONFIRMNO)+'" />'),
             content = C('<div class="confirmation-dialogue"></div>')
                         .append(C('<div class="confirmation-message">'+this.get(QUESTION)+'</div>'))
                         .append(C('<div class="confirmation-buttons"></div>')
@@ -194,7 +201,7 @@ Y.extend(CONFIRM, DIALOGUE, {
                             .append(no));
         this.get(BASE).addClass('moodle-dialogue-confirm');
         this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
-        this.setStdModContent(Y.WidgetStdMod.HEADER, this.get(TITLE), Y.WidgetStdMod.REPLACE);
+        this.setStdModContent(Y.WidgetStdMod.HEADER, '<h1>' + this.get(TITLE) + '</h1>', Y.WidgetStdMod.REPLACE);
         this.after('destroyedChange', function(){this.get(BASE).remove();}, this);
         this._enterKeypress = Y.on('key', this.submit, window, 'down:13', this, true);
         this._escKeypress = Y.on('key', this.submit, window, 'down:27', this, false);
@@ -247,7 +254,7 @@ Y.extend(EXCEPTION, DIALOGUE, {
     _keypress : null,
     initializer : function(config) {
         this.get(BASE).addClass('moodle-dialogue-exception');
-        this.setStdModContent(Y.WidgetStdMod.HEADER, config.name, Y.WidgetStdMod.REPLACE);
+        this.setStdModContent(Y.WidgetStdMod.HEADER, '<h1>' + config.name + '</h1>', Y.WidgetStdMod.REPLACE);
         var content = C('<div class="moodle-exception"></div>')
                     .append(C('<div class="moodle-exception-message">'+this.get('message')+'</div>'))
                     .append(C('<div class="moodle-exception-param hidden param-filename"><label>File:</label> '+this.get('fileName')+'</div>'))
@@ -318,7 +325,7 @@ Y.extend(AJAXEXCEPTION, DIALOGUE, {
     _keypress : null,
     initializer : function(config) {
         this.get(BASE).addClass('moodle-dialogue-exception');
-        this.setStdModContent(Y.WidgetStdMod.HEADER, config.name, Y.WidgetStdMod.REPLACE);
+        this.setStdModContent(Y.WidgetStdMod.HEADER, '<h1>' + config.name + '</h1>', Y.WidgetStdMod.REPLACE);
         var content = C('<div class="moodle-ajaxexception"></div>')
                     .append(C('<div class="moodle-exception-message">'+this.get('error')+'</div>'))
                     .append(C('<div class="moodle-exception-param hidden param-debuginfo"><label>URL:</label> '+this.get('reproductionlink')+'</div>'))
@@ -382,4 +389,4 @@ M.core.confirm = CONFIRM;
 M.core.exception = EXCEPTION;
 M.core.ajaxException = AJAXEXCEPTION;
 
-}, '@VERSION@', {requires:['base','node','overlay','event-key', 'moodle-enrol-notification-skin', 'dd-plugin']});
+}, '@VERSION@', {requires:['base','node','panel','event-key', 'moodle-enrol-notification-skin', 'dd-plugin']});
index 484c42e..743159a 100644 (file)
@@ -70,7 +70,8 @@ YUI.add('moodle-filter_glossary-autolinker', function(Y) {
 
                     for (key in data.entries) {
                         definition = data.entries[key].definition + data.entries[key].attachments
-                        new M.core.alert({title:data.entries[key].concept, message:definition, lightbox:false});
+                        var alertpanel = new M.core.alert({title:data.entries[key].concept, message:definition, lightbox:false});
+                        Y.Node.one('#id_yuialertconfirm-' + alertpanel.COUNT).focus();
                     }
 
                     return true;
index 95701d9..c8bd732 100644 (file)
@@ -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,
@@ -40,9 +40,11 @@ YUI.add('moodle-core-chooserdialogue', function(Y) {
                 bodyContent : this.bodycontent.get('innerHTML'),
                 headerContent : this.headercontent.get('innerHTML'),
                 draggable : true,
-                visible : false, // Hide by default.
-                zindex : 100, // Display in front of other items.
-                lightbox : true // This dialogue should be modal.
+                visible : false, // Hide by default
+                zindex : 100, // Display in front of other items
+                lightbox : true, // This dialogue should be modal
+                shim : true,
+                closeButtonTitle : this.get('closeButtonTitle')
             }
 
             // Override with additional options
@@ -50,23 +52,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');
         },
 
         /**
@@ -81,7 +83,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
@@ -135,7 +137,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
@@ -152,8 +156,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);
@@ -191,7 +195,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');
@@ -275,7 +279,7 @@ YUI.add('moodle-core-chooserdialogue', function(Y) {
             }
 
             this.container.detachAll();
-            this.overlay.hide();
+            this.panel.hide();
         },
 
         check_options : function(e) {
@@ -311,6 +315,10 @@ YUI.add('moodle-core-chooserdialogue', function(Y) {
             },
             maxheight : {
                 value : 660
+            },
+            closeButtonTitle : {
+                validator : Y.Lang.isString,
+                value : 'Close'
             }
         }
     });
@@ -318,6 +326,6 @@ YUI.add('moodle-core-chooserdialogue', function(Y) {
     M.core.chooserdialogue = CHOOSERDIALOGUE;
 },
 '@VERSION@', {
-    requires:['base', 'overlay', 'moodle-enrol-notification']
+    requires:['base', 'panel', 'moodle-enrol-notification']
 }
 );
index c19030e..5508530 100644 (file)
@@ -849,7 +849,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;
@@ -870,7 +870,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;