[FIX] web_calendar: ensure dhtmlx minical does not set offsetHeight < 0px, IE<9 raise 'Invalid argument.' breaking the view

bzr revid: fme@openerp.com-20120329113234-aj5bpj5ea0h0d2b8
This commit is contained in:
Fabien Meghazi 2012-03-29 13:32:34 +02:00
commit 5da87c6a32
3 changed files with 3 additions and 3 deletions

View File

@ -9,7 +9,7 @@
"depends": ['web'],
"js": [
'static/lib/dhtmlxScheduler/codebase/dhtmlxscheduler_debug.js',
'static/lib/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_minical.js',
'static/lib/dhtmlxScheduler/sources/ext/ext_minical.js',
'static/src/js/calendar.js'
],
"css": [

View File

@ -13,7 +13,7 @@ scheduler._render_calendar=function(b,c,a,d){var e=scheduler.templates,f=this._c
g.innerHTML="<div class='dhx_year_month'></div><div class='dhx_year_week'>"+l.innerHTML+"</div><div class='dhx_year_body'></div>";g.childNodes[0].innerHTML=this.templates.calendar_month(c);if(a.navigation){var h=document.createElement("DIV");h.className="dhx_cal_prev_button";h.style.cssText="left:1px;top:2px;position:absolute;";h.innerHTML=this._mini_cal_arrows[0];g.firstChild.appendChild(h);h.onclick=function(){scheduler.updateCalendar(g,scheduler.date.add(g._date,-1,"month"));scheduler._date.getMonth()==
g._date.getMonth()&&scheduler._date.getFullYear()==g._date.getFullYear()&&scheduler._markCalendarCurrentDate(g)};h=document.createElement("DIV");h.className="dhx_cal_next_button";h.style.cssText="left:auto; right:1px;top:2px;position:absolute;";h.innerHTML=this._mini_cal_arrows[1];g.firstChild.appendChild(h);h.onclick=function(){scheduler.updateCalendar(g,scheduler.date.add(g._date,1,"month"));scheduler._date.getMonth()==g._date.getMonth()&&scheduler._date.getFullYear()==g._date.getFullYear()&&scheduler._markCalendarCurrentDate(g)}}g._date=
new Date(c);g.week_start=(c.getDay()-(this.config.start_on_monday?1:0)+7)%7;var u=this.date.week_start(c);this._reset_month_scale(g.childNodes[2],c,u);for(var j=g.childNodes[2].firstChild.rows,q=j.length;q<6;q++){var t=j[j.length-1];j[0].parentNode.appendChild(t.cloneNode(!0));for(var r=parseInt(t.childNodes[t.childNodes.length-1].childNodes[0].innerHTML),r=r<10?r:0,s=0;s<j[q].childNodes.length;s++)j[q].childNodes[s].className="dhx_after",j[q].childNodes[s].childNodes[0].innerHTML=scheduler.date.to_fixed(++r)}d||
b.appendChild(g);g.childNodes[1].style.height=g.childNodes[1].childNodes[0].offsetHeight-1+"px";this._cols=f;this._mode=n;this._colsS=m;this._min_date=k;this._max_date=p;scheduler._date=i;e.month_day=o;return g};
b.appendChild(g);g.childNodes[1].style.height=g.childNodes[1].childNodes[0].offsetHeight<=0?"0px":g.childNodes[1].childNodes[0].offsetHeight-1+"px";this._cols=f;this._mode=n;this._colsS=m;this._min_date=k;this._max_date=p;scheduler._date=i;e.month_day=o;return g};
scheduler.destroyCalendar=function(b,c){if(!b&&this._def_count&&this._def_count.firstChild&&(c||(new Date).valueOf()-this._def_count._created.valueOf()>500))b=this._def_count.firstChild;if(b&&(b.onclick=null,b.innerHTML="",b.parentNode&&b.parentNode.removeChild(b),this._def_count))this._def_count.style.top="-1000px"};scheduler.isCalendarVisible=function(){return this._def_count&&parseInt(this._def_count.style.top,10)>0?this._def_count:!1};
scheduler.attachEvent("onTemplatesReady",function(){dhtmlxEvent(document.body,"click",function(){scheduler.destroyCalendar()})});scheduler.templates.calendar_time=scheduler.date.date_to_str("%d-%m-%Y");
scheduler.form_blocks.calendar_time={render:function(){var b="<input class='dhx_readonly' type='text' readonly='true'>",c=scheduler.config,a=this.date.date_part(new Date);c.first_hour&&a.setHours(c.first_hour);b+=" <select>";for(var d=60*c.first_hour;d<60*c.last_hour;d+=this.config.time_step*1){var e=this.templates.time_picker(a);b+="<option value='"+d+"'>"+e+"</option>";a=this.date.add(a,this.config.time_step,"minute")}b+="</select>";var f=scheduler.config.full_day;return"<div style='height:30px;padding-top:0; font-size:inherit;' class='dhx_section_time'>"+

View File

@ -207,7 +207,7 @@ scheduler._render_calendar=function(obj,sd,conf, previous){
if (!previous)
obj.appendChild(d);
d.childNodes[1].style.height = (d.childNodes[1].childNodes[0].offsetHeight-1)+"px"; // dhx_year_week should have height property so that day dates would get correct position. dhx_year_week height = height of it's child (with the day name)
d.childNodes[1].style.height = d.childNodes[1].childNodes[0].offsetHeight <= 0 ? "0px" : (d.childNodes[1].childNodes[0].offsetHeight-1)+"px"; // dhx_year_week should have height property so that day dates would get correct position. dhx_year_week height = height of it's child (with the day name)
/*restore*/ this._cols=temp; this._mode = temp2; this._colsS = temp3; this._min_date=temp4; this._max_date=temp5; scheduler._date = temp6; ts.month_day=temp7;
return d;