text: YUI.add("aui-scheduler-view-table",function(e,t){var n=e.Lang,r=n.isFunction,i=n.isString,s=e.DataType.DateMath,o=e.WidgetStdMod,u=s.WEEK_LENGTH,a="-",f=".",l="",c=" ",h="scheduler-view",p="scheduler-view-table",d=function(e,t){return function(n){var r=n.all(e);return r.size()>=t?r:null}},v="body",m="boundingBox",g="close",y="col",b="colHeaderDaysNode",w="colgrid",E="colspan",S="columnDayHeader",x="columnTableGrid",T="container",N="content",C="data",k="day",L="displayDaysInterval",A="displayRows",O="div",M="down",_="endDate",D="event",P="events",H="eventsOverlay",B="filterFn",j="first",F="firstDayOfWeek",I="grid",q="header",R="headerDateFormatter",U="headerTableNode",z="icon",W="left",X="locale",V="more",$="next",J="node",K="overlay",Q="right",G="row",Y="rowsContainerNode",Z="scheduler",et="scheduler-event",tt="show",V="more",nt="startDate",rt="strings",it="table",st="tableGridNode",ot="tableRowContainer",ut="tableRows",at="tbody",ft="title",lt="tl",ct="today",ht="todayDate",pt="tr",dt="viewDate",vt="visible",mt=e.getClassName,gt=mt(z),yt=mt(z,"arrowstop-1-l"),bt=mt(z,"arrowstop-1-r"),wt=mt(h,it,w),Et=mt(h,it,w,j),St=mt(h,it,w,ct),xt=mt(h,it,T),Tt=mt(h,it,P,K,J),Nt=mt(h,it,P,K,J,v),Ct=mt(h,it,P,K,J,g),kt=mt(h,it,q,y),Lt=mt(h,it,q,k),At=mt(h,it,q,it),Ot=mt(h,it,V),Mt=mt(h,it,G),_t=mt(h,it,G,T),Dt=mt(h,it,C),Pt=mt(h,it,C,y),Ht=mt(h,it,C,y,ft),Bt=mt(h,it,C,y,ft,M),jt=mt(h,it,C,y,ft,j),Ft=mt(h,it,C,y,ft,$),It=mt(h,it,C,y,ft,ct),qt=mt(h,it,C,D),Rt=mt(h,it,C,D,W),Ut=mt(h,it,C,D,Q),zt=mt(h,it,C,j),Wt=mt(h,it,I),Xt=mt(h,it,I,T),Vt=mt(h,it,I,j),$t='<div class="'+xt+'">'+'<div class="'+_t+'"></div>'+"</div>",Jt='<div class="'+Tt+'">'+'<div class="'+Nt+'"></div>'+'<a href="javascript:;" class="'+Ct+'">{label}</a>'+"</div>",Kt='<td class="'+wt+'">&nbsp;</td>',Qt='<th class="'+Lt+'"><div>&nbsp;</div></th>',Gt='<table cellspacing="0" cellpadding="0" class="'+At+'">'+"<tbody>"+'<tr class="'+kt+'"></tr>'+"</tbody>"+"</table>",Yt='<a href="javascript:;" class="'+Ot+'">{labelPrefix} {count} {labelSuffix}</a>',Zt='<div class="'+Mt+'"></div>',en='<table cellspacing="0" cellpadding="0" class="'+Dt+'">'+"<tbody></tbody>"+"</table>",tn='<div class="'+Xt+'">'+'<table cellspacing="0" cellpadding="0" class="'+Wt+'">'+"<tbody>"+"<tr></tr>"+"</tbody>"+"</table></div>",nn='<span class="'+[gt,yt].join(c)+'"></span>',rn='<span class="'+[gt,bt].join(c)+'"></span>',sn='<td class="'+Pt+'"><div></div></td>',on="<tr></tr>",un=e.Component.create({NAME:p,ATTRS:{bodyContent:{value:l},displayDaysInterval:{value:42},displayRows:{value:3},eventsOverlayConstrain:{value:!0,writeOnce:!0},fixedHeight:{value:!0},name:{value:it},headerDateFormatter:{value:function(t){var n=this,r=n.get(Z);return e.DataType.Date.format(t,{format:"%a",locale:r.get(X)})},validator:i},navigationDateFormatter:{value:function(t){var n=this,r=n.get(Z);return e.DataType.Date.format(t,{format:"%b %Y",locale:r.get(X)})},validator:r},scrollable:{value:!1},strings:{value:{close:"Close",show:"Show",more:"more"}},headerTableNode:{valueFn:function(){return e.Node.create(Gt)}},colHeaderDaysNode:{valueFn:"_valueColHeaderDaysNode"},rowsContainerNode:{valueFn:function(){return e.Node.create($t)}},tableGridNode:{valueFn:"_valueTableGridNode"}},HTML_PARSER:{colHeaderDaysNode:d(f+Lt,7),headerTableNode:f+At,rowsContainerNode:f+xt,tableGridNode:d(f+Wt,7)},EXTENDS:e.SchedulerView,prototype:{evtDateStack:null,evtRenderedStack:null,rowDataTableStack:null,initializer:function(){var t=this;t.evtDateStack={},t.evtRenderedStack={},t.rowDataTableStack={},t[b]=t.get(b),t[U]=t.get(U),t[Y]=t.get(Y),t[st]=t.get(st),t[S]=t.headerTableNode.one(f+kt),t[x]=e.NodeList.create(),t[ot]=t[Y].one(f+_t),t[ut]=e.NodeList.create()},bindUI:function(){var t=this;t[Y].delegate("click",e.bind(t._onClickMore,t),f+Ot)},renderUI:function(){var e=this,t=e._getDisplayRowsCount(),n;for(n=0;n<t;n++)e[ut].push(e.buildGridRowNode(n));e._renderEventsOverlay(),e[b].appendTo(e[S]),e[ut].appendTo(e[ot])},buildEventsRow:function(t,r,i){var s=this,o=s.get(A),u=0,a=e.Node.create(on),f=!1;return s.loopDates(t,r,function(l,c){var h=String(l.getTime()),p=s.evtRenderedStack[h];p||(s.evtRenderedStack[h]=[],p=s.evtRenderedStack[h]);if(u>c){p.push(null);return}var d=s.evtDateStack[h];d||(d=[]),d=d.filter(function(e){return e.get("visible")});var v=s._getRenderableEvent(d,t,r,l),m=e.Node.create(sn),g=m.one(O);if(p.length<d.length&&o&&i===o-1){var y=s.get(rt),b=e.Node.create(n.sub(Yt,{count:d.length-p.length,labelPrefix:y[tt],labelSuffix:y[V]}));b.setData(P,d),g.append(b),f=!0}else if(v){var w=s._getEvtSplitInfo(v,l,t,r);m.attr(E,w.colspan),u+=w.colspan-1,s._syncEventNodeContainerUI(v,g,w),s._syncEventNodeUI(v,g,l),p.push(v),f=!0}u++,a.append(m)}),f?a:null},buildEventsTable:function(t,n){var r=this,i=r.get(A),o=!1,u=s.clearTime(r._findCurrentIntervalStart()),a=String(u.getTime()).concat(t.getTime()).concat(n.getTime()),f=r.rowDataTableStack[a],l=0;if(!f){f=e.Node.create(en);var c=f.one(at),h=r.buildEventsTitleRow(f,t,n);c.append(h);while(!o){var p=r.buildEventsRow(t,n,l);p?(c.append(p),l++,i&&l>=i&&(o=!0)):o=!0}r.rowDataTableStack[a]=f}return f},buildEventsTitleRow:function(t,n,r){var i=this,o=i.get(Z).get(ht),u=e.Node.create(on);return i.loopDates(n,r,function(t,n){var r=e.Node.create(sn);r.addClass(Ht).toggleClass(jt,n===0).toggleClass(It,!s.isDayOverlap(t,o)).toggleClass(Ft,!s.isDayOverlap(s.subtract(t,s.DAY,1),o)).toggleClass(Bt,!s.isDayOverlap(s.subtract(t,s.WEEK,1),o)),u.append(r.setContent(t.getDate()))}),u},buildGridRowNode:function(t){var n=this,r=n._getTableGridNode(t),i=e.Node.create(Zt);return i.append(r.toggleClass(Vt,t===0)),i},flushViewCache:function(){var e=this;e.evtDateStack={},e.evtRenderedStack={},e.rowDataTableStack={}},getDateInterval:function(){var e=this.getWeekDaysCount()*this._getDisplayRowsCount()-1,t=this._findCurrentIntervalStart();return{endDate:s.toLastHour(s.add(t,s.DAY,e)),startDate:s.toMidnight(t)}},getIntersectEvents:function(t){var n=this,r=n.get(Z),i=String(t.getTime());if(!n.evtDateStack[i])
  {var s=r.getIntersectEvents(t);n.evtDateStack[i]=e.Array.filter(s,n.get(B))}return n.evtDateStack[i]},getNextDate:function(){var e=this,t=e.get(Z),n=t.get(dt),r=e.get(L);return s.toLastHour(s.add(n,s.DAY,r))},getPrevDate:function(){var e=this,t=e.get(Z),n=t.get(dt),r=e.get(L);return s.toMidnight(s.subtract(n,s.DAY,r))},getWeekDaysCount:function(){var e=this.get("displayDaysInterval");return Math.min(e,u)},hideEventsOverlay:function(){var e=this;e[H].set(vt,!1)},loopDates:function(e,t,n,r,i){var o=this,u=s.clone(e),a=t.getTime(),f;for(f=0;u.getTime()<=a;f++)n.apply(o,[u,f]),u=s.add(u,r||s.DAY,i||1)},plotEvents:function(){var e=this,t=e._findCurrentIntervalStart(),n=s.safeClearTime(t);e.flushViewCache(),e.hideEventsOverlay(),e.bodyNode.all(f+Dt).remove();var r=this.getWeekDaysCount(),i=s.add(n,s.DAY,r*this.tableRows.size()-1);e._findIntersections(n,i),e[ut].each(function(t,i){var o=s.add(n,s.DAY,r*i),u=s.add(o,s.DAY,r-1),a=e.buildEventsTable(o,u);i===0&&a.addClass(zt),t.append(a)})},syncDaysHeaderUI:function(){var e=this,t=e.get(Z),n=t.get(dt),r=e.get(R),i=e.get(X),o=e._findFirstDayOfWeek(n);e.colHeaderDaysNode.all(O).each(function(t,n){var i=s.add(o,s.DAY,n);t.html(r.call(e,i))})},syncGridUI:function(){var e=this,t=e.get(Z),n=t.get(ht);e[x].removeClass(St);var r=e._findCurrentIntervalStart(),i=e._findCurrentIntervalEnd();if(s.between(n,r,i)){var o=t.get(F),u=e._findFirstDayOfWeek(n),a=s.getWeekNumber(n,o)-s.getWeekNumber(r,o),f=n.getDate()-u.getDate(),l=e._getCellIndex([f,a]),c=e[x].item(l);c&&c.addClass(St)}},syncStdContent:function(){var e=this;e.setStdModContent(o.BODY,e[Y].getDOM()),e.setStdModContent(o.HEADER,e[U].getDOM())},_addEventToAllDates:function(e,t,n){var r=t,i=e.getClearEndDate();s.after(n,i)&&(n=i);while(!s.after(r,n))this._addToEvtDateStack(String(r.getTime()),e),r=s.add(r,s.DAY,1)},_addToEvtDateStack:function(e,t){this.evtDateStack[e]||(this.evtDateStack[e]=[]),this.evtDateStack[e].push(t)},_findCurrentIntervalEnd:function(){var e=this,t=e.get(Z),n=t.get(dt),r=e.get(L);return s.add(n,s.DAY,r)},_findCurrentIntervalStart:function(){var e=this,t=e.get(Z);return t.get(dt)},_findFirstDayOfWeek:function(e){var t=this,n=t.get(Z),r=n.get(F);return s.getFirstDayOfWeek(e,r)},_findIntersections:function(e,t){var n=e,r,i=this.get("scheduler").getEvents(null,!0),o,u=this.get("filterFn"),a=0;i.sort(function(e,t){return e.isAfter(t)?1:-1});while(a<i.length){o=i[a].getClearStartDate(),r=i[a].getClearEndDate();if(s.after(n,r))a++;else if(s.before(n,o)){n=s.add(n,s.DAY,1);if(s.after(n,t))break}else(!u||u(i[a]))&&this._addEventToAllDates(i[a],n,t),a++}},_getCellIndex:function(e){var t=this;return e[1]*u+e[0]},_getDisplayRowsCount:function(){var e=this,t=e.get(L);return Math.ceil(t/u)},_getDisplayRowDaysCount:function(){var e=this,t=e.get(L);return Math.min(t,u)},_getEvtLabel:function(e){var t=this,n=e.get(_),r=e.get(nt);return[r.getHours(),a,n.getHours(),c,e.get(N)].join(l)},_getEvtSplitInfo:function(e,t,n,r){var i=this,o=e.getClearStartDate(),u=e.getClearEndDate(),a=s.countDays(r,t),f={colspan:Math.min(s.countDays(u,t),a)+1,left:s.before(o,n),right:s.after(u,r)};return f},_getRenderableEvent:function(t,n,r,i){var o=this,u=String(i.getTime()),a;o.evtRenderedStack[u]||(o.evtRenderedStack[u]=[]);for(a=0;a<t.length;a++){var f=t[a],l=f.get(nt),c=s.after(i,l)&&!s.isDayOverlap(i,n),h=!s.isDayOverlap(l,i),p=e.Array.indexOf(o.evtRenderedStack[u],f)>-1;if(!p&&(h||c))return f}return null},_getTableGridNode:function(t){var n=this,r=n.get(L),i=n[st].item(t),s=i.one(pt),o;for(o=0;o<Math.min(r,u);o++){var a=e.Node.create(Kt);s.append(a),o===0&&a.addClass(Et),n[x].push(a)}return i},_onClickMore:function(t){var n=this,r=t.target,i=r.getData(P),s=e.NodeList.create();e.Array.each(i,function(e){e.syncNodeTitleUI();var t=e.get(J).item(0).clone();t.setData(et,e),t.setStyles({height:"auto",left:0,position:"relative",top:0,width:"auto"}),s.push(t)}),n[H].bodyNode.one(f+Nt).setContent(s),n[H].setAttrs({visible:!0,xy:r.getXY()})},_renderEventsOverlay:function(){var t=this,r=t.get(Z),i=t.get(rt);t[H]=new e.Overlay({align:{points:[lt,lt]},bodyContent:n.sub(Jt,{label:i[g]}),constrain:t.get("eventsOverlayConstrain"),render:t.get(m),visible:!1,width:250,zIndex:450}),t[H].bodyNode.delegate("click",e.bind(t.hideEventsOverlay,t),f+Ct)},_syncEventNodeContainerUI:function(e,t,n){var r=this;t.addClass(qt),n.left&&t.addClass(Rt).prepend(nn),n.right&&t.addClass(Ut).append(rn)},_syncEventNodeUI:function(e,t,n){var r=this,i=r.get(Z),o=i.get(F),a=e.get(J),f=e.get(nt),l=s.clearTime(r._findCurrentIntervalStart()),c=s.clearTime(s.getFirstDayOfWeek(new Date(Math.max(f,l)),o)),h=Math.floor(s.countDays(n,c)/u);a.size()<=h&&e.addPaddingNode(),a.size()<=h&&(h=a.size()-1);var p=a.item(h);p.show(),p.setStyles({height:"auto",left:0,top:0,width:"auto"}),p.appendTo(t),e.syncUI()},_uiSetDate:function(e){var t=this;t.syncDaysHeaderUI(),t.syncGridUI()},_valueColHeaderDaysNode:function(){var e=this,t=e.get(L),n=Math.min(t,u);return e._valueNodeList(n,Qt)},_valueTableGridNode:function(){var e=this,t=e.get(L),n=Math.min(t,u);return e._valueNodeList(n,tn)},_valueNodeList:function(t,n){var r=this,i=[];while(t--)i.push(n);return e.NodeList.create(i.join(l))}}});e.SchedulerTableView=un},"2.0.0",{requires:["overlay","aui-scheduler-base"],skinnable:!0});
  