return cfg;
},
- getChildContainer : function() {
+ initEvents :function ()
+ {
+ //Roo.log(this.el.select('.navbar-toggle',true));
+ this.el.select('.navbar-toggle',true).on('click', function() {
+ // Roo.log('click');
+ this.el.select('.navbar-collapse',true).toggleClass('in');
+ }, this);
+ },
+
+
+ getChildContainer : function()
+ {
if (this.bar === true) {
return this.el.select('.collapse',true).first();
}
- /*
- * - LGPL
- *
- * row
- *
- */
-/**
- * @class Roo.bootstrap.Navbar.Button
- * @extends Roo.bootstrap.Component
- * Bootstrap Navbar.Button class
- * @cfg {String} href link to
- * @cfg {String} html content of button
-
- * @constructor
- * Create a new Navbar Button
- * @param {Object} config The config object
- */
-
-
-Roo.bootstrap.Navbar.Button = function(config){
- Roo.bootstrap.Navbar.Button.superclass.constructor.call(this, config);
-};
-
-Roo.extend(Roo.bootstrap.Navbar.Button, Roo.bootstrap.Component, {
-
- href : false,
- html : false,
-
- autoCreate : {
- cls: 'btn',
- tag : 'button',
- html: 'hello'
- },
-
- getAutoCreate : function(){
-
- var cfg = {
- cls: 'btn',
- tag : 'button',
- html: 'hello',
- cn : []
-
- } ;
- cfg.cn.push({
- html : this.html || ''
- //href : this.
- // )
- });
- cfg.cn.push({
- tag: 'span',
- cls : 'carat'
- });
-
- return cfg;
- }
-
-});
-
-
-
/*
* - LGPL
*
}
};
var cal_rows = function() {
+
var ret = []
for (var r = 0; r < 6; r++) {
var row= {
}
ret[0].cls += ' fc-first';
-
+ ret[4].cls += ' fc-prev-last';
ret[5].cls += ' fc-last';
return ret;
};
+
var cal_table = {
tag: 'table',
cls: 'fc-border-separate',
initEvents : function()
{
+ if(!this.store){
+ throw "can not find store for combo";
+ }
+
+ this.store = Roo.factory(this.store, Roo.data);
+ this.store.on('load', this.onLoad, this);
+
this.resize();
this.cells = this.el.select('.fc-day',true);
this.textNodes = this.el.query('.fc-day-number');
- this.update(new Date().clearTime());
+ this.cells.addClassOnOver('fc-state-hover');
+
this.el.select('.fc-button-prev',true).on('click', this.showPrevMonth, this);
this.el.select('.fc-button-next',true).on('click', this.showNextMonth, this);
this.el.select('.fc-button-today',true).on('click', this.showToday, this);
this.el.select('.fc-button',true).addClassOnOver('fc-state-hover');
- this.cells.addClassOnOver('fc-state-hover');
+ this.on('monthchange', this.onMonthChange, this);
- // move to ...
- this.calevents = [];
-
- this.addItem({
- start: new Date(),
- end : new Date().add(Date.DAY, 2),
- title : 'test'
- });
- this.addItem({
- start: new Date().add(Date.DAY, -5),
- end : new Date().add(Date.DAY, 2),
- title : 'test'
- });
- this.addItem({
- start: new Date(),
- end : new Date().add(Date.HOUR, 2),
- title : 'test'
- });
- this.addItem({
- start: new Date(),
- end : new Date().add(Date.HOUR, 2),
- title : 'test'
- });
- this.renderEvents();
+ this.update(new Date().clearTime());
},
+
resize : function() {
var sz = this.el.getSize();
// private
update : function(date)
{
-
var vd = this.activeDate;
this.activeDate = date;
if(vd && this.el){
}
var days = date.getDaysInMonth();
+
var firstOfMonth = date.getFirstDateOfMonth();
var startingPos = firstOfMonth.getDay()-this.startDay;
- if(startingPos <= this.startDay){
+ if(startingPos < this.startDay){
startingPos += 7;
}
var setCellClass = function(cal, cell){
cell.title = "";
var t = d.getTime();
+
cell.dateValue = t;
if(t == today){
cell.className += " fc-today";
setCellClass(this, cells[i]);
}
var extraDays = 0;
+
for(; i < 42; i++) {
textEls[i].innerHTML = (++extraDays);
d.setDate(d.getDate()+1);
cells[i].className = "fc-future fc-other-month";
setCellClass(this, cells[i]);
}
-
+
this.el.select('.fc-header-title h2',true).update(Date.monthNames[date.getMonth()] + " " + date.getFullYear());
+
+ var totalRows = Math.ceil((date.getDaysInMonth() + date.getFirstDateOfMonth().getDay()) / 7);
+
+ this.el.select('tr.fc-week.fc-prev-last',true).removeClass('fc-last');
+ this.el.select('tr.fc-week.fc-next-last',true).addClass('fc-last').show();
+
+ if(totalRows != 6){
+ this.el.select('tr.fc-week.fc-last',true).removeClass('fc-last').addClass('fc-next-last').hide();
+ this.el.select('tr.fc-week.fc-prev-last',true).addClass('fc-last');
+ }
+
this.fireEvent('monthchange', this, date);
}
return true;
});
- Roo.log(ret);
+
return ret;
},
}
ret.push(c);
});
- //Roo.log(ret);
+
return ret;
},
findBestRow: function(cells)
{
var ret = 0;
+
for (var i =0 ; i < cells.length;i++) {
ret = Math.max(cells[i].rows || 0,ret);
}
return ret;
- //d.setDate(d.ev()+1);
},
addItem : function(ev)
{
-
// look for vertical location slot in
var cells = this.findCells(ev);
+
ev.row = this.findBestRow(cells);
// work out the location.
};
}
+
rows.push(crow);
ev.els = [];
ev.rows = rows;
},
clearEvents: function() {
+
+ if(!this.calevents){
+ return;
+ }
+
+ Roo.each(this.cells.elements, function(c){
+ c.rows = 0;
+ });
+
Roo.each(this.calevents, function(e) {
Roo.each(e.els, function(el) {
el.un('mouseenter' ,this.onEventEnter, this);
},
renderEvents: function()
- {
- this.clearEvents();
+ {
// first make sure there is enough space..
+
this.cells.each(function(c) {
- Roo.log(c.select('.fc-day-content div',true).first(), Math.max(34, c.rows * 20));
+// Roo.log(c.select('.fc-day-content div',true).first(), Math.max(34, c.rows * 20));
c.select('.fc-day-content div',true).first().setHeight(Math.max(34, c.rows * 20));
});
{
tag:'span',
cls: 'fc-event-time',
- html : cells.length > 1 ? '' : '7pm'
+ html : cells.length > 1 ? '' : ev.time
},
{
tag:'span',
var ctr = this.el.select('.fc-event-container',true).first();
var cg = ctr.createChild(cfg);
-
cg.on('mouseenter' ,this.onEventEnter, this);
cg.on('mouseleave' ,this.onEventLeave, this);
ev.els.push(cg);
+
var sbox = rows[i].start.select('.fc-day-content',true).first().getBox();
var ebox = rows[i].end.select('.fc-day-content',true).first().getBox();
//Roo.log(cg);
cg.setWidth(ebox.right - sbox.x -2);
}
+
}
},
onEventEnter: function (e, el,c,d) {
- Roo.log(e,el,c,d)
this.fireEvent('evententer', this, el);
- //code
},
+
onEventLeave: function (e, el,c,d) {
- Roo.log(e,el,c,d)
this.fireEvent('eventleave', this, el);
- //code
- }
+ },
+
+ onMonthChange: function () {
+ this.store.load();
+ },
+
+ onLoad: function () {
+
+ this.clearEvents();
+
+ this.calevents = [];
+ var cal = this;
+ if(this.store.getCount() > 0){
+ this.store.data.each(function(d){
+ cal.addItem({
+ start: new Date(d.data.start_dt),
+ end : new Date(d.data.end_dt),
+ time : d.data.start_time,
+ title : d.data.title
+ });
+ });
+ }
+
+ this.renderEvents();
+ }
});