calendar MDL-23443 Attemped fix of calendar rendering problems

This commit is contained in:
Sam Hemelryk 2010-07-29 06:14:12 +00:00
parent 002f53ab32
commit 0c42353743

View File

@ -13,34 +13,44 @@ YUI.add('moodle-calendar-eventmanager', function(Y) {
EVENT.superclass.constructor.apply(this, arguments);
}
Y.extend(EVENT, Y.Base, {
initpanelcalled : false,
initializer : function(config){
var id = this.get(EVENTID), node = this.get(EVENTNODE);
if (!node) {
return false;
}
var td = node.ancestor('td'), constraint = td.ancestor('div'), panel;
var td = node.ancestor('td');
this.publish('showevent');
this.publish('hideevent');
panel = new Y.Overlay({
constrain : constraint,
align : {
node : td,
points:[Y.WidgetPositionAlign.TL, Y.WidgetPositionAlign.BC]
},
headerContent : Y.Node.create('<h2 class="eventtitle">'+this.get(EVENTTITLE)+'</h2>'),
bodyContent : Y.Node.create('<div class="eventcontent">'+this.get(EVENTCONTENT)+'</div>'),
visible : false,
id : this.get(EVENTID)+'_panel',
width : Math.floor(constraint.get('offsetWidth')*0.9)+"px"
});
panel.get('boundingBox').addClass('calendar-event-panel')
panel.render(td);
this.on('showevent', panel.show, panel);
this.on('hideevent', panel.hide, panel);
td.on('mouseenter', this.startShow, this);
td.on('mouseleave', this.startHide, this);
return true;
},
initPanel : function() {
if (!this.initpanelcalled) {
this.initpanelcalled = true;
var node = this.get(EVENTNODE),
td = node.ancestor('td'),
constraint = td.ancestor('div'),
panel;
panel = new Y.Overlay({
constrain : constraint,
align : {
node : td,
points:[Y.WidgetPositionAlign.TL, Y.WidgetPositionAlign.BC]
},
headerContent : Y.Node.create('<h2 class="eventtitle">'+this.get(EVENTTITLE)+'</h2>'),
bodyContent : Y.Node.create('<div class="eventcontent">'+this.get(EVENTCONTENT)+'</div>'),
visible : false,
id : this.get(EVENTID)+'_panel',
width : Math.floor(constraint.get('offsetWidth')*0.9)+"px"
});
panel.render(td);
panel.get('boundingBox').addClass('calendar-event-panel');
this.on('showevent', panel.show, panel);
this.on('hideevent', panel.hide, panel);
}
},
startShow : function() {
if (this.get(SHOWTIMEOUT) !== null) {
this.cancelShow();
@ -52,6 +62,7 @@ YUI.add('moodle-calendar-eventmanager', function(Y) {
clearTimeout(this.get(SHOWTIMEOUT));
},
show : function() {
this.initPanel();
this.fire('showevent');
},
startHide : function() {