X-Git-Url: http://git.roojs.org/?p=roojs1;a=blobdiff_plain;f=roojs-calendar-debug.js;h=82e30ea6f961333a166988288545a71c45fbd9f1;hp=651f250b47945643d9bad9ed1473175d2d35386b;hb=refs%2Fheads%2Fwip_alan_T6011_fixing_surrogate_characters;hpb=de1ce34b7bef96ff8347b45598e4daceb4a3ede0 diff --git a/roojs-calendar-debug.js b/roojs-calendar-debug.js index 651f250b47..82e30ea6f9 100644 --- a/roojs-calendar-debug.js +++ b/roojs-calendar-debug.js @@ -347,7 +347,7 @@ Roo.extend(Roo.bootstrap.Calendar, Roo.bootstrap.Component, { getAutoCreate : function(){ - fc_button = function(name, corner, style, content ) { + var fc_button = function(name, corner, style, content ) { return Roo.apply({},{ tag : 'span', cls : 'fc-button fc-button-'+name+' fc-state-default ' + @@ -554,8 +554,9 @@ Roo.extend(Roo.bootstrap.Calendar, Roo.bootstrap.Component, { this.store.on('load', this.onLoad, this); this.resize(); - this.cells = this.el.select('.fc-day',true); + this.cells = this.el.select('.fc-day',true); + //Roo.log(this.cells); this.textNodes = this.el.query('.fc-day-number'); this.cells.addClassOnOver('fc-state-hover'); @@ -636,7 +637,7 @@ Roo.extend(Roo.bootstrap.Calendar, Roo.bootstrap.Component, { startingPos += 7; } - var pm = date.add("mo", -1); + var pm = date.add(Date.MONTH, -1); var prevStart = pm.getDaysInMonth()-startingPos; // this.cells = this.el.select('.fc-day',true); @@ -655,6 +656,10 @@ Roo.extend(Roo.bootstrap.Calendar, Roo.bootstrap.Component, { // convert everything to numbers so it's fast var day = 86400000; var d = (new Date(pm.getFullYear(), pm.getMonth(), prevStart)).clearTime(); + //Roo.log(d); + //Roo.log(pm); + //Roo.log(prevStart); + var today = new Date().clearTime().getTime(); var sel = date.clearTime().getTime(); var min = this.minDate ? this.minDate.clearTime() : Number.NEGATIVE_INFINITY; @@ -666,9 +671,13 @@ Roo.extend(Roo.bootstrap.Calendar, Roo.bootstrap.Component, { var format = this.format; var setCellClass = function(cal, cell){ + + //Roo.log('set Cell Class'); cell.title = ""; var t = d.getTime(); + //Roo.log(d); + cell.dateValue = t; if(t == today){ cell.className += " fc-today"; @@ -794,10 +803,12 @@ Roo.extend(Roo.bootstrap.Calendar, Roo.bootstrap.Component, { findCells : function(ev) { var s = ev.start.clone().clearTime().getTime(); + // Roo.log(s); var e= ev.end.clone().clearTime().getTime(); + // Roo.log(e); var ret = []; this.cells.each(function(c){ - //Roo.log("check " +c.dateValue + '<' + e + ' > ' + s); + ////Roo.log("check " +c.dateValue + '<' + e + ' > ' + s); if(c.dateValue > e){ return ; @@ -984,7 +995,7 @@ Roo.extend(Roo.bootstrap.Calendar, Roo.bootstrap.Component, { onLoad: function () { this.clearEvents(); - Roo.log('calendar onload'); + //Roo.log('calendar onload'); // this.calevents = []; var cal = this; @@ -1049,7 +1060,13 @@ Roo.CalendarPanel = function(config){ //this.footer = Roo.factory(this.footer, Roo); } + this.view = new Roo.calendar.View(Roo.apply({ + skipNavHeader : true, + skipMonthHeader : false + + },config)); + this.on('activate', function() { Roo.log('activate'); @@ -1093,45 +1110,30 @@ Roo.CalendarPanel = function(config){ * @param {Calendar} this * @param {event} */ - 'eventclick': true + 'eventclick': true, + /** + * @event rendered + * Fires when the grid is rendered + * @param {Calendar} this + + */ + 'rendered': true + }); - + this.relayEvents(this.view, ["select","monthchange","evententer","eventleave","rendered"]); + //this.grid = grid; //this.grid.getGridEl().replaceClass("x-layout-inactive-content", "x-layout-component-panel"); }; Roo.extend(Roo.CalendarPanel, Roo.ContentPanel, { - getId : function(){ - return this.id; - }, - /* - setSize : function(width, height){ - if(!this.ignoreResize(width, height)){ - var grid = this.grid; - var size = this.adjustForComponents(width, height); - grid.getGridEl().setSize(size.width, size.height); - grid.autoSize(); - } - }, - - beforeSlide : function(){ - this.grid.getView().scroller.clip(); - }, - afterSlide : function(){ - this.grid.getView().scroller.unclip(); - }, - */ - destroy : function(){ - // this.grid.destroy(); - // delete this.grid; - Roo.GridPanel.superclass.destroy.call(this); - - }, + render : function() { + var ct = this.el.appendChild(document.createElement("div")); this.onRender(this.el, false) }, @@ -1144,10 +1146,11 @@ Roo.extend(Roo.CalendarPanel, Roo.ContentPanel, { Roo.log("render calendar"); + //Roo.bootstrap.Component.superclass.onRender.call(this, ct, position); - var cfg = Roo.apply({}, this.getAutoCreate()); + var cfg = Roo.apply({}, this.view.getAutoCreate()); cfg.id = Roo.id(); // fill in the extra attributes @@ -1173,49 +1176,20 @@ Roo.extend(Roo.CalendarPanel, Roo.ContentPanel, { cfg.name = this.name; } - this.el = ct.createChild(cfg, position); + this.view.el = ct.createChild(cfg, position); - if(this.tabIndex !== undefined){ - this.el.dom.setAttribute('tabIndex', this.tabIndex); - } - this.initEvents(); - }, - + //if(this.tabIndex !== undefined){ + // this.el.dom.setAttribute('tabIndex', this.tabIndex); + //} + + + this.view.initEvents(); + this.fireEvent('rendered'); + } - getAutoCreate : Roo.bootstrap.Calendar.prototype.getAutoCreate, - initEvents : Roo.bootstrap.Calendar.prototype.initEvents }); - - -Roo.each([ - 'getAutoCreate', - 'initEvents', - 'resize', - 'showPrevMonth', - 'showToday', - 'showNextMonth', - 'showPrevYear', - 'showNextYear', - 'update', - 'findCell', - 'findCells', - 'findBestRow', - 'addItem', - 'clearEvents', - 'renderEvents', - 'onEventEnter', - 'onEventLeave', - 'onEventClick', - 'onMonthChange', - 'onLoad' - - -], function(p) { - Roo.log('add' + p); - Roo.CalendarPanel.prototype[p] = Roo.bootstrap.Calendar.prototype[p]; -});