showMonth: function () {
// Set the date to the first day of the month
var firstDate = new Date();
firstDate.setTime(this.date.valueOf());
firstDate.setDate(1);
firstDate = this._getFirstDayInMonthCalendar(firstDate);
var trs = this.el.getElements('.monthView tr');
var c = 0; // counter
for (var i = 1; i < trs.length; i++) {
var tds = trs[i].getElements('td');
var colcounter = 0;
tds.each(function (td) {
td.setProperties({'class': ''});
td.addClass(firstDate.getTime());
// No need to unset as this is done in setProperties above
if (firstDate.getMonth() !== this.date.getMonth()) {
td.addClass('otherMonth');
}
if (this.selectedDate.isSameDay(firstDate)) {
td.addClass('selectedDay');
}
td.empty();
// Barbara : added greyscaled week-ends color option
td.adopt(
new Element('div', {'class': 'date', 'styles': {'background-color': this._getColor('#E8EEF7', firstDate)}}).appendText(firstDate.getDate())
);
var gridSize = 0;
this.entries.each(function (entry) {
// Between (end date present) or same (no end date)
var startdate = new Date(entry.startdate_locale);
var enddate = new Date(entry.enddate_locale);
if ((enddate !== '' && firstDate.isDateBetween(startdate, enddate)) || (enddate === '' && startdate.isSameDay(firstDate))) {
gridSize ++;
}
}.bind(this));
var j = 0;
this.entries.each(function (entry) {
// Between (end date present) or same (no end date)
var startdate = new Date(entry.startdate_locale);
var enddate = new Date(entry.enddate_locale);
if ((entry.enddate !== '' && firstDate.isDateBetween(startdate, enddate)) || (enddate === '' && startdate.isSameDay(firstDate))) {
var existingEvents = td.getElements('.fabrikEvent').length;
var height = 20;
var dayHeadingSize = td.getElement('.date').getSize().y;
height = Math.floor((td.getSize().y - gridSize - dayHeadingSize) / (gridSize));
var top = (td.getSize().y * (i - 1)) + this.el.getElement('.monthView .dayHeading').getSize().y + dayHeadingSize;
this.colwidth['.monthView'] = this.colwidth['.monthView'] ? this.colwidth['.monthView'] : td.getSize().x;
var width = td.getSize().x;
width = this.colwidth['.monthView'];
top = top + (existingEvents * height);
var left = width * colcounter;
// var opts = {'width': width, 'height': height, 'view': 'monthView'};
var opts = {'view': 'monthView', 'max-width': width};
opts.top = top;
if (window.ie) {
opts.left = left;
}
opts.startHour = startdate.getHours();
opts.endHour = enddate.getHours();
opts.startMin = startdate.getMinutes();
opts.endMin = enddate.getMinutes();
opts['margin-left'] = 0;
td.adopt(this._makeEventRelDiv(entry, opts, firstDate, td));
}
j ++;
}.bind(this));
firstDate.setTime(firstDate.getTime() + this.DAY);
colcounter ++;
}.bind(this));
}