X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=docs%2Fsrc%2FRoo_grid_Calendar.js.html;fp=docs%2Fsymbols%2Fsrc%2FRoo_grid_Calendar.js.html;h=091e79e0806549c2dbc0ed95569f052be82d05f7;hb=c1c0168c0e693c4262f3f744a82419f9d9b1807f;hp=7ddb2c1b62bf62aac1d2c6a8eeb4bf5da4a19ba5;hpb=b282409b66344f6d0ff1999b55639cfd80097128;p=roojs1 diff --git a/docs/symbols/src/Roo_grid_Calendar.js.html b/docs/src/Roo_grid_Calendar.js.html similarity index 98% rename from docs/symbols/src/Roo_grid_Calendar.js.html rename to docs/src/Roo_grid_Calendar.js.html index 7ddb2c1b62..091e79e080 100644 --- a/docs/symbols/src/Roo_grid_Calendar.js.html +++ b/docs/src/Roo_grid_Calendar.js.html @@ -1,9 +1,9 @@ -
/*
+/home/alan/gitlive/roojs1/Roo/grid/Calendar.js /*
* Licence LGPL
*/
-
+
/**
* @class Roo.grid.Calendar
* @extends Roo.util.Grid
@@ -38,11 +38,11 @@
Roo.apply(this, config);
// check and correct shorthanded configs
-
+
var rows = [];
var d =1;
for (var r = 0;r < 6;r++) {
-
+
rows[r]=[];
for (var c =0;c < 7;c++) {
rows[r][c]= '';
@@ -52,9 +52,9 @@
this.eventStore= Roo.factory(this.eventStore, Roo.data);
this.eventStore.on('load',this.onLoad, this);
this.eventStore.on('beforeload',this.clearEvents, this);
-
+
}
-
+
this.dataSource = new Roo.data.Store({
proxy: new Roo.data.MemoryProxy(rows),
reader: new Roo.data.ArrayReader({}, [
@@ -64,21 +64,21 @@
this.dataSource.load();
this.ds = this.dataSource;
this.ds.xmodule = this.xmodule || false;
-
-
+
+
var cellRender = function(v,x,r)
{
return String.format(
'<div class="fc-day fc-widget-content"><div>' +
'<div class="fc-event-container"></div>' +
'<div class="fc-day-number">{0}</div>'+
-
+
'<div class="fc-day-content"><div style="position:relative"></div></div>' +
'</div></div>', v);
-
+
}
-
-
+
+
this.colModel = new Roo.grid.ColumnModel( [
{
xtype: 'ColumnModel',
@@ -132,14 +132,14 @@
]);
this.cm = this.colModel;
this.cm.xmodule = this.xmodule || false;
-
-
-
+
+
+
//this.selModel = new Roo.grid.CellSelectionModel();
//this.sm = this.selModel;
//this.selModel.init(this);
-
-
+
+
if(this.width){
this.container.setWidth(this.width);
}
@@ -411,21 +411,21 @@
* @param {data} data to be modified
*/
'eventrender': true
-
+
});
Roo.grid.Grid.superclass.constructor.call(this);
this.on('render', function() {
- this.view.el.addClass('x-grid-cal');
-
+ this.view.el.addClass('x-grid-cal');
+
(function() { this.setDate(new Date()); }).defer(100,this); //default today..
},this);
-
+
if (!Roo.grid.Calendar.style) {
Roo.grid.Calendar.style = Roo.util.CSS.createStyleSheet({
-
-
+
+
'.x-grid-cal .x-grid-col' : {
height: 'auto !important',
'vertical-align': 'top'
@@ -433,13 +433,13 @@
'.x-grid-cal .fc-event-hori' : {
height: '14px'
}
-
-
+
+
}, Roo.id());
}
-
-
+
+
};
Roo.extend(Roo.grid.Calendar, Roo.grid.Grid, {
/**
@@ -447,13 +447,13 @@
*/
eventStore : 25,
-
+
activeDate : false,
startDay : 0,
autoWidth : true,
monitorWindowResize : false,
-
+
resizeColumns : function() {
var col = (this.view.el.getWidth() / 7) - 3;
// loop through cols, and setWidth
@@ -462,9 +462,9 @@
}
},
setDate :function(date) {
-
+
Roo.log('setDate?');
-
+
this.resizeColumns();
var vd = this.activeDate;
this.activeDate = date;
@@ -489,33 +489,33 @@
// return;
// }
// }
-
+
var days = date.getDaysInMonth();
-
+
var firstOfMonth = date.getFirstDateOfMonth();
var startingPos = firstOfMonth.getDay()-this.startDay;
-
+
if(startingPos < this.startDay){
startingPos += 7;
}
-
+
var pm = date.add(Date.MONTH, -1);
var prevStart = pm.getDaysInMonth()-startingPos;
//
-
-
+
+
this.cells = this.view.el.select('.x-grid-row .x-grid-col',true);
-
+
this.textNodes = this.view.el.query('.x-grid-row .x-grid-col .x-grid-cell-text');
//this.cells.addClassOnOver('fc-state-hover');
-
+
var cells = this.cells.elements;
var textEls = this.textNodes;
-
+
//Roo.each(cells, function(cell){
// cell.removeClass([ 'fc-past', 'fc-other-month', 'fc-future', 'fc-state-highlight', 'fc-state-disabled']);
//});
-
+
days += startingPos;
// convert everything to numbers so it's fast
@@ -524,7 +524,7 @@
//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;
@@ -534,16 +534,16 @@
var ddays = this.disabledDays ? this.disabledDays.join("") : false;
var ddaysText = this.disabledDaysText;
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";
@@ -553,7 +553,7 @@
if(t == sel){
// disable highlight in other month..
cell.className += " fc-state-highlight";
-
+
}
// disabling
if(t < min) {
@@ -579,83 +579,83 @@
cell.className = " fc-state-disabled";
}
}
-
+
if (!cell.initialClassName) {
cell.initialClassName = cell.dom.className;
}
-
+
cell.dom.className = cell.initialClassName + ' ' + cell.className;
};
var i = 0;
-
+
for(; i < startingPos; i++) {
cells[i].dayName = (++prevStart);
Roo.log(textEls[i]);
d.setDate(d.getDate()+1);
-
+
//cells[i].className = "fc-past fc-other-month";
setCellClass(this, cells[i]);
}
-
+
var intDay = 0;
-
+
for(; i < days; i++){
intDay = i - startingPos + 1;
cells[i].dayName = (intDay);
d.setDate(d.getDate()+1);
-
+
cells[i].className = ''; // "x-date-active";
setCellClass(this, cells[i]);
}
var extraDays = 0;
-
+
for(; i < 42; i++) {
//textEls[i].innerHTML = (++extraDays);
-
+
d.setDate(d.getDate()+1);
cells[i].dayName = (++extraDays);
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 will cause all the cells to mis
var rows= [];
var i =0;
for (var r = 0;r < 6;r++) {
for (var c =0;c < 7;c++) {
this.ds.getAt(r).set('weekday' + c ,cells[i++].dayName );
- }
+ }
}
-
+
this.cells = this.view.el.select('.x-grid-row .x-grid-col',true);
for(i=0;i<cells.length;i++) {
-
+
this.cells.elements[i].dayName = cells[i].dayName ;
this.cells.elements[i].className = cells[i].className;
this.cells.elements[i].initialClassName = cells[i].initialClassName ;
this.cells.elements[i].title = cells[i].title ;
this.cells.elements[i].dateValue = cells[i].dateValue ;
}
-
-
-
-
+
+
+
+
//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);
-
-
+
+
},
/**
* Returns the grid's SelectionModel.
@@ -670,11 +670,11 @@
load: function() {
this.eventStore.load()
-
-
-
+
+
+
},
-
+
findCell : function(dt) {
dt = dt.clearTime().getTime();
var ret = false;
@@ -686,10 +686,10 @@
}
return true;
});
-
+
return ret;
},
-
+
findCells : function(rec) {
var s = rec.data.start_dt.clone().clearTime().getTime();
// Roo.log(s);
@@ -698,7 +698,7 @@
var ret = [];
this.cells.each(function(c){
////Roo.log("check " +c.dateValue + '<' + e + ' > ' + s);
-
+
if(c.dateValue > e){
return ;
}
@@ -707,31 +707,31 @@
}
ret.push(c);
});
-
- return 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;
-
+
},
-
-
+
+
addItem : function(rec)
{
// look for vertical location slot in
var cells = this.findCells(rec);
-
+
rec.row = this.findBestRow(cells);
-
+
// work out the location.
-
+
var crow = false;
var rows = [];
for(var i =0; i < cells.length; i++) {
@@ -753,23 +753,23 @@
start: cells[i],
end : cells[i]
};
-
+
}
-
+
rows.push(crow);
rec.els = [];
rec.rows = rows;
rec.cells = cells;
for (var i = 0; i < cells.length;i++) {
cells[i].rows = Math.max(cells[i].rows || 0 , rec.row + 1 );
-
+
}
-
-
+
+
},
-
+
clearEvents: function() {
-
+
if (!this.eventStore.getCount()) {
return;
}
@@ -777,13 +777,13 @@
Roo.each(this.cells.elements, function(c){
c.rows = 0;
});
-
+
this.eventStore.each(function(e) {
this.clearEvent(e);
},this);
-
+
},
-
+
clearEvent : function(ev)
{
if (ev.els) {
@@ -795,26 +795,26 @@
ev.els = [];
}
},
-
-
+
+
renderEvent : function(ev,ctr) {
if (!ctr) {
ctr = this.view.el.select('.fc-event-container',true).first();
}
-
-
+
+
this.clearEvent(ev);
//code
-
-
-
+
+
+
ev.els = [];
var cells = ev.cells;
var rows = ev.rows;
this.fireEvent('eventrender', this, ev);
-
+
for(var i =0; i < rows.length; i++) {
-
+
cls = '';
if (i == 0) {
cls += ' fc-event-start';
@@ -822,34 +822,34 @@
if ((i+1) == rows.length) {
cls += ' fc-event-end';
}
-
+
//Roo.log(ev.data);
// how many rows should it span..
var cg = this.eventTmpl.append(ctr,Roo.apply({
fccls : cls
-
+
}, ev.data) , true);
-
-
+
+
cg.on('mouseenter' ,this.onEventEnter, this, ev);
cg.on('mouseleave' ,this.onEventLeave, this, ev);
cg.on('click', this.onEventClick, this, ev);
-
+
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.setXY([sbox.x +2, sbox.y +(ev.row * 20)]);
+
+ cg.setXY([sbox.x +2, sbox.y +(ev.row * 20)]);
cg.setWidth(ebox.right - sbox.x -2);
}
},
-
+
renderEvents: function()
- {
+ {
// first make sure there is enough space..
-
+
if (!this.eventTmpl) {
this.eventTmpl = new Roo.Template(
'<div class="roo-dynamic fc-event fc-event-hori fc-event-draggable ui-draggable {fccls} {cls}" style="position: absolute" unselectable="on">' +
@@ -860,56 +860,56 @@
'<div class="ui-resizable-heandle ui-resizable-e"> </div>' +
'</div>'
);
-
+
}
-
-
-
+
+
+
this.cells.each(function(c) {
//Roo.log(c.select('.fc-day-content div',true).first());
c.select('.fc-day-content div',true).first().setHeight(Math.max(34, (c.rows || 1) * 20));
});
-
+
var ctr = this.view.el.select('.fc-event-container',true).first();
-
+
var cls;
this.eventStore.each(function(ev){
-
+
this.renderEvent(ev);
-
-
+
+
}, this);
this.view.layout();
-
+
},
-
+
onEventEnter: function (e, el,event,d) {
this.fireEvent('evententer', this, el, event);
},
-
+
onEventLeave: function (e, el,event,d) {
this.fireEvent('eventleave', this, el, event);
},
-
+
onEventClick: function (e, el,event,d) {
this.fireEvent('eventclick', this, el, event);
},
-
+
onMonthChange: function () {
this.store.load();
},
-
+
onLoad: function () {
-
+
//Roo.log('calendar onload');
//
if(this.eventStore.getCount() > 0){
-
-
-
+
+
+
this.eventStore.each(function(d){
-
-
+
+
// FIXME..
var add = d.data;
if (typeof(add.end_dt) == 'undefined') {
@@ -926,16 +926,16 @@
add.end_dt = typeof(add.end_dt) == 'string' ? Date.parseDate(add.end_dt,'Y-m-d H:i:s') : add.end_dt,
add.id = add.id || d.id;
add.title = add.title || '??';
-
+
this.addItem(d);
-
-
+
+
},this);
}
-
+
this.renderEvents();
}
-
+
});
/*