From 9c7f855b4909bfd22c2beb68c1d49ebb2ea83c6d Mon Sep 17 00:00:00 2001 From: Ankit Agarwal Date: Mon, 14 Oct 2013 15:13:20 +0800 Subject: [PATCH] MDL-42239 calendar: Fix missing ids issue with mouseover panels --- calendar/lib.php | 4 ++-- .../moodle-calendar-eventmanager-debug.js | 1 + .../moodle-calendar-eventmanager-min.js | 2 +- .../moodle-calendar-eventmanager.js | 1 + calendar/yui/src/eventmanager/js/eventmanager.js | 1 + 5 files changed, 6 insertions(+), 3 deletions(-) diff --git a/calendar/lib.php b/calendar/lib.php index 6c7bf6e59c7..c11141e092e 100644 --- a/calendar/lib.php +++ b/calendar/lib.php @@ -398,7 +398,7 @@ function calendar_get_mini($courses, $groups, $users, $calmonth = false, $calyea } else if(isset($typesbyday[$day]['startuser'])) { $class .= ' calendar_event_user'; } - $cell = html_writer::link($dayhref, $day, array('aria-controls' => $popupid.'_panel', 'id' => $popupid)); + $cell = html_writer::link($dayhref, $day, array('id' => $popupid)); } else { $cell = $day; } @@ -441,7 +441,7 @@ function calendar_get_mini($courses, $groups, $users, $calmonth = false, $calyea if(! isset($eventsbyday[$day])) { $class .= ' eventnone'; $popupid = calendar_get_popup(true, false); - $cell = html_writer::link('#', $day, array('aria-controls' => $popupid.'_panel', 'id' => $popupid)); + $cell = html_writer::link('#', $day, array('id' => $popupid)); } $cell = get_accesshide($today.' ').$cell; } diff --git a/calendar/yui/build/moodle-calendar-eventmanager/moodle-calendar-eventmanager-debug.js b/calendar/yui/build/moodle-calendar-eventmanager/moodle-calendar-eventmanager-debug.js index 8a06c3d4fd5..d9c932a1434 100644 --- a/calendar/yui/build/moodle-calendar-eventmanager/moodle-calendar-eventmanager-debug.js +++ b/calendar/yui/build/moodle-calendar-eventmanager/moodle-calendar-eventmanager-debug.js @@ -52,6 +52,7 @@ Y.extend(EVENT, Y.Base, { width : Math.floor(constraint.get('offsetWidth')*0.9)+"px" }); panel.render(td); + node.setAttribute('aria-controls', panel.get('id')); panel.get('boundingBox').addClass('calendar-event-panel'); panel.get('boundingBox').setAttribute('aria-live', 'off'); this.on('showevent', panel.show, panel); diff --git a/calendar/yui/build/moodle-calendar-eventmanager/moodle-calendar-eventmanager-min.js b/calendar/yui/build/moodle-calendar-eventmanager/moodle-calendar-eventmanager-min.js index 332dafbe765..37223512a6f 100644 --- a/calendar/yui/build/moodle-calendar-eventmanager/moodle-calendar-eventmanager-min.js +++ b/calendar/yui/build/moodle-calendar-eventmanager/moodle-calendar-eventmanager-min.js @@ -1 +1 @@ -YUI.add("moodle-calendar-eventmanager",function(e,t){var n="Calendar event",r="eventId",i="node",s="title",o="content",u="delay",a="showTimeout",f="hideTimeout",l=function(){l.superclass.constructor.apply(this,arguments)},c;e.extend(l,e.Base,{initpanelcalled:!1,initializer:function(){this.get(r);var e=this.get(i),t;return e?(t=e.ancestor("td"),this.publish("showevent"),this.publish("hideevent"),t.on("mouseenter",this.startShow,this),t.on("mouseleave",this.startHide,this),t.on("focus",this.startShow,this),t.on("blur",this.startHide,this),!0):!1},initPanel:function(){if(!this.initpanelcalled){this.initpanelcalled=!0;var t=this.get(i),n=t.ancestor("td"),u=n.ancestor("div"),a;a=new e.Overlay({constrain:u,align:{node:n,points:[e.WidgetPositionAlign.TL,e.WidgetPositionAlign.BC]},headerContent:e.Node.create('

'+this.get(s)+"

"),bodyContent:e.Node.create('
'+this.get(o)+"
"),visible:!1,id:this.get(r)+"_panel",width:Math.floor(u.get("offsetWidth")*.9)+"px"}),a.render(n),a.get("boundingBox").addClass("calendar-event-panel"),a.get("boundingBox").setAttribute("aria-live","off"),this.on("showevent",a.show,a),this.on("showevent",this.setAriashow,a),this.on("hideevent",this.setAriahide,a),this.on("hideevent",a.hide,a)}},startShow:function(){this.get(a)!==null&&this.cancelShow();var e=this;this.set(a,setTimeout(function(){e.show()},this.get(u)))},cancelShow:function(){clearTimeout(this.get(a))},setAriashow:function(){this.get("boundingBox").setAttribute("aria-live","assertive")},setAriahide:function(){this.get("boundingBox").setAttribute("aria-live","off")},show:function(){this.initPanel(),this.fire("showevent")},startHide:function(){this.get(f)!==null&&this.cancelHide();var e=this;this.set(f,setTimeout(function(){e.hide()},this.get(u)))},hide:function(){this.fire("hideevent")},cancelHide:function(){clearTimeout(this.get(f))}},{NAME:n,ATTRS:{eventId:{setter:function(t){return this.set(i,e.one("#"+t)),t},validator:e.Lang.isString},node:{setter:function(t){return typeof t=="string"&&(t=e.one("#"+t)),t}},title:{validator:e.Lang.isString},content:{validator:e.Lang.isString},delay:{value:300,validator:e.Lang.isNumber},showTimeout:{value:null},hideTimeout:{value:null}}}),e.augment(l,e.EventTarget),c={add_event:function(e){new l(e)}},M.core_calendar=M.core_calendar||{},e.mix(M.core_calendar,c)},"@VERSION@",{requires:["base","node","event-mouseenter","overlay","moodle-calendar-eventmanager-skin"]}); +YUI.add("moodle-calendar-eventmanager",function(e,t){var n="Calendar event",r="eventId",i="node",s="title",o="content",u="delay",a="showTimeout",f="hideTimeout",l=function(){l.superclass.constructor.apply(this,arguments)},c;e.extend(l,e.Base,{initpanelcalled:!1,initializer:function(){this.get(r);var e=this.get(i),t;return e?(t=e.ancestor("td"),this.publish("showevent"),this.publish("hideevent"),t.on("mouseenter",this.startShow,this),t.on("mouseleave",this.startHide,this),t.on("focus",this.startShow,this),t.on("blur",this.startHide,this),!0):!1},initPanel:function(){if(!this.initpanelcalled){this.initpanelcalled=!0;var t=this.get(i),n=t.ancestor("td"),u=n.ancestor("div"),a;a=new e.Overlay({constrain:u,align:{node:n,points:[e.WidgetPositionAlign.TL,e.WidgetPositionAlign.BC]},headerContent:e.Node.create('

'+this.get(s)+"

"),bodyContent:e.Node.create('
'+this.get(o)+"
"),visible:!1,id:this.get(r)+"_panel",width:Math.floor(u.get("offsetWidth")*.9)+"px"}),a.render(n),t.setAttribute("aria-controls",a.get("id")),a.get("boundingBox").addClass("calendar-event-panel"),a.get("boundingBox").setAttribute("aria-live","off"),this.on("showevent",a.show,a),this.on("showevent",this.setAriashow,a),this.on("hideevent",this.setAriahide,a),this.on("hideevent",a.hide,a)}},startShow:function(){this.get(a)!==null&&this.cancelShow();var e=this;this.set(a,setTimeout(function(){e.show()},this.get(u)))},cancelShow:function(){clearTimeout(this.get(a))},setAriashow:function(){this.get("boundingBox").setAttribute("aria-live","assertive")},setAriahide:function(){this.get("boundingBox").setAttribute("aria-live","off")},show:function(){this.initPanel(),this.fire("showevent")},startHide:function(){this.get(f)!==null&&this.cancelHide();var e=this;this.set(f,setTimeout(function(){e.hide()},this.get(u)))},hide:function(){this.fire("hideevent")},cancelHide:function(){clearTimeout(this.get(f))}},{NAME:n,ATTRS:{eventId:{setter:function(t){return this.set(i,e.one("#"+t)),t},validator:e.Lang.isString},node:{setter:function(t){return typeof t=="string"&&(t=e.one("#"+t)),t}},title:{validator:e.Lang.isString},content:{validator:e.Lang.isString},delay:{value:300,validator:e.Lang.isNumber},showTimeout:{value:null},hideTimeout:{value:null}}}),e.augment(l,e.EventTarget),c={add_event:function(e){new l(e)}},M.core_calendar=M.core_calendar||{},e.mix(M.core_calendar,c)},"@VERSION@",{requires:["base","node","event-mouseenter","overlay","moodle-calendar-eventmanager-skin"]}); diff --git a/calendar/yui/build/moodle-calendar-eventmanager/moodle-calendar-eventmanager.js b/calendar/yui/build/moodle-calendar-eventmanager/moodle-calendar-eventmanager.js index 8a06c3d4fd5..d9c932a1434 100644 --- a/calendar/yui/build/moodle-calendar-eventmanager/moodle-calendar-eventmanager.js +++ b/calendar/yui/build/moodle-calendar-eventmanager/moodle-calendar-eventmanager.js @@ -52,6 +52,7 @@ Y.extend(EVENT, Y.Base, { width : Math.floor(constraint.get('offsetWidth')*0.9)+"px" }); panel.render(td); + node.setAttribute('aria-controls', panel.get('id')); panel.get('boundingBox').addClass('calendar-event-panel'); panel.get('boundingBox').setAttribute('aria-live', 'off'); this.on('showevent', panel.show, panel); diff --git a/calendar/yui/src/eventmanager/js/eventmanager.js b/calendar/yui/src/eventmanager/js/eventmanager.js index 6e883a6f321..42c3ca2005d 100644 --- a/calendar/yui/src/eventmanager/js/eventmanager.js +++ b/calendar/yui/src/eventmanager/js/eventmanager.js @@ -50,6 +50,7 @@ Y.extend(EVENT, Y.Base, { width : Math.floor(constraint.get('offsetWidth')*0.9)+"px" }); panel.render(td); + node.setAttribute('aria-controls', panel.get('id')); panel.get('boundingBox').addClass('calendar-event-panel'); panel.get('boundingBox').setAttribute('aria-live', 'off'); this.on('showevent', panel.show, panel);