UNPKG

calenstyle

Version:

CalenStyle is a Responsive Drag-and-Drop Event Calendar for Web, iOS, Android & Windows. CalenStyle is customizable plugin having multiple, clean-designed event calendar templates specially designed for web & mobile applications.

1,267 lines (1,057 loc) 120 kB
/* ----------------------------------------------------------------------------- CalenStyle - Responsive Event Calendar Version 2.0.8 Copyright (c)2017 Lajpat Shah Contributors : https://github.com/nehakadam/CalenStyle/contributors Repository : https://github.com/nehakadam/CalenStyle Homepage : https://nehakadam.github.io/CalenStyle ----------------------------------------------------------------------------- */ /*! ------------------------------------ CalenStyle Month View Start ----------------------------------- */ //"use strict"; CalenStyle.prototype = $.extend(CalenStyle.prototype, { _arrayContains: function(iArrTemp, iValue) { var to = this; for(var iTempIndex = 0; iTempIndex < iArrTemp.length; iTempIndex++) { if(iArrTemp[iTempIndex] === iValue) return 1; } return 0; }, _setNextPreviousMonthDates: function() { var to = this; var dPMDt = new Date(to.tv.dCMDt.getTime() - (30 * $.CalenStyle.extra.iMS.d)); dPMDt.setDate(15); to.tv.dPMDt = new Date(dPMDt); var dNMDt = new Date(to.tv.dCMDt.getTime() + (30 * $.CalenStyle.extra.iMS.d)); dNMDt.setDate(15); to.tv.dNMDt = new Date(dNMDt); }, _updateMonthTable: function() { var to = this; to.__getCurrentViewDates(); var sTemplate = ""; sTemplate += "<thead>"; sTemplate += "<tr class='cmvMonthTableRowDayHeader'>"; if(to.setting.displayWeekNumInMonthView) sTemplate += "<td class='cmvDayHeader cmvWeekNumber cmvThinBorderRight cmvFirstColumn'></td>"; var iCountDays = to.setting.weekStartDay, iNumWeekDays = (to.setting.excludeNonBusinessHours) ? to.tv.iBsDays : 7, iWeekDayIndex; for(iWeekDayIndex = 0; iWeekDayIndex < 7; iWeekDayIndex++) { var sClass = ""; if(!to.setting.displayWeekNumInMonthView && iWeekDayIndex === 0) sClass = "cmvFirstColumn"; if((to.setting.excludeNonBusinessHours && to.tv.bABsDays[iCountDays]) || !to.setting.excludeNonBusinessHours) sTemplate += "<td id='" + "cmvDayName"+(iCountDays + 1) + "' class='cmvDayHeader cmvTableColumns "+sClass+"'>" + to.getDateInFormat({"iDate": {D: iCountDays}}, "DDD", false, true) + "</td>"; iCountDays++; if(iCountDays > 6) iCountDays = 0; } sTemplate += "</tr>"; sTemplate += "</thead>"; to.tv.dCMDt = new Date(to.setting.selectedDate); to.tv.dCMDt.setDate(15); to._setNextPreviousMonthDates(); var iTodayDateNum = $.CalenStyle.extra.dToday.getDate(), iTodayMonthNum = $.CalenStyle.extra.dToday.getMonth(), iTodayYearNum = $.CalenStyle.extra.dToday.getFullYear(); sTemplate += "<tbody>"; var iDateIndex = 0; for(var iMonthWeeks = 1; iMonthWeeks <= to.tv.iWkInMonth; iMonthWeeks++) { sTemplate += "<tr id='"+ ("cmvMonthTableRow"+iMonthWeeks) +"' class='cmvMonthTableRows'>"; var bCurrentWeek = false; if(to.setting.displayWeekNumInMonthView) { var dWkSDate = to.tv.dAVDt[iDateIndex], dWkEDate = to.setDateInFormat({"date": to.tv.dAVDt[(iDateIndex + 6)]}, "END"), sWkNumber = to.__getWeekNumber(dWkSDate, dWkEDate); var sCellClass = "cmvDay cmvWeekNumber cmvThinBorderRight cmvWeekNumberBorderLeft"; if(iMonthWeeks === 1) sCellClass += " cmvWeekNumberBorderBottom"; else if(iMonthWeeks === to.tv.iWkInMonth) sCellClass += " cmvWeekNumberBorderTop"; else sCellClass += " cmvWeekNumberBorderBottom cmvWeekNumberBorderTop"; var dArrTempDates = to._getWeekForDate($.CalenStyle.extra.dToday, false), dWkSDateToday = dArrTempDates[0], dWkEDateToday = dArrTempDates[1]; if(to.compareDates(dWkSDateToday, dWkSDate) === 0 && to.compareDates(dWkEDateToday, dWkEDate) === 0) { sCellClass += " cTodayHighlightTextColor"; bCurrentWeek = true; } sTemplate += "<td id='"+ dWkSDate.getTime() +"' class='"+ sCellClass +"'><span>" + sWkNumber + "</span></td>"; } for(iWeekDayIndex = 0; iWeekDayIndex < iNumWeekDays; iWeekDayIndex++) { var dCurrentDate = to.tv.dAVDt[iDateIndex], iCurrentDateNum = dCurrentDate.getDate(), iCurrentMonthNum = dCurrentDate.getMonth(), iCurrentYearNum = dCurrentDate.getFullYear(), iSourceCount = to.__getSourceCountForDate(dCurrentDate), sDayNumberClass = ($.cf.compareStrings(to.setting.eventIndicatorInDatePicker, "DayNumberBold") && ($.cf.compareStrings(to.setting.visibleView, "DatePicker") || to.setting.parentObject !== null) && (iSourceCount > 0)) ? " cBold" : "", dArrTempResSec = [], sStyle = "", iTempIndex, sTempId, sCellClassTemp = "cmvDay" + " " + "cmvTableColumns" + " " + "cmvTableColumn" + iWeekDayIndex; if(to.tv.dCMDt.getMonth() !== iCurrentMonthNum) sCellClassTemp += " " + "cmvOtherMonthDay"; else sCellClassTemp += " " + "cmvCurrentMonthDay"; if(!to.setting.displayWeekNumInMonthView && iWeekDayIndex === 0) sCellClassTemp += (" " + "cmvFirstColumn"); sTempId = "cmvDay" + "-" + iCurrentDateNum + "-" + iCurrentMonthNum + "-" + iCurrentYearNum; var iSelectedDateNum = to.setting.selectedDate.getDate(), iSelectedMonthNum = to.setting.selectedDate.getMonth(), iSelectedYearNum = to.setting.selectedDate.getFullYear(); if(iCurrentDateNum === iTodayDateNum && iCurrentMonthNum === iTodayMonthNum && iCurrentYearNum === iTodayYearNum) sCellClassTemp += " " + "cTodayHighlightTextColor"; else if(iCurrentDateNum === iSelectedDateNum && iCurrentMonthNum === iSelectedMonthNum && iCurrentYearNum === iSelectedYearNum) sCellClassTemp += " " + "cCurrentDateHighlightColor"; if(($.cf.compareStrings(to.setting.visibleView, "MonthView") && !$.cf.compareStrings(to.setting.actionOnDayClickInMonthView, "DisplayEventListDialog")) || $.cf.compareStrings(to.setting.visibleView, "DatePicker")) sCellClassTemp += " clickableLink"; // Set Style For Non Busienss Hours if(!to.tv.bABsDays[dCurrentDate.getDay()]) sCellClassTemp += " cNonBusinessHoursBg"; // Set Style For All-Day Restricted Section dArrTempResSec = to._getRestrictedSectionForCurrentView(dCurrentDate); for(iTempIndex = 0; iTempIndex < dArrTempResSec.length; iTempIndex++) { var dArrResSec = dArrTempResSec[iTempIndex], dTempResSecStart = new Date(dArrResSec.start), bCompStart = (to.compareDates(dCurrentDate, dTempResSecStart) === 0), dTempResSecEnd = new Date(dArrResSec.end), bCompEnd = (to.compareDates(dCurrentDate, dTempResSecEnd) === 0), iNumOfHours; if(!bCompStart) dTempResSecStart = to._normalizeDateTime(dCurrentDate, "START", "T"); if(!bCompEnd) dTempResSecEnd = to._normalizeDateTime(dCurrentDate, "END", "T"); iNumOfHours = Math.round((dTempResSecEnd.getTime() - dTempResSecStart.getTime()) / $.CalenStyle.extra.iMS.h); if(iNumOfHours > 23 || dArrResSec.isAllDay) { if($.cf.isValid(dArrResSec.backgroundColor)) sStyle = "style='background: " + $.cf.addHashToHexcode(dArrResSec.backgroundColor) + ";'"; if($.cf.isValid(dArrResSec.class)) sCellClassTemp += " " + dArrResSec.class; } } sTemplate += "<td id='"+ sTempId +"' class='" + sCellClassTemp + "' " + sStyle + ">"; sTemplate += "<span class='cmvDayNumber" + sDayNumberClass + "'>" + to.getNumberStringInFormat(iCurrentDateNum, 0, true) + "</span>"; if($.cf.compareStrings(to.setting.visibleView, "MonthView")) { if($.cf.compareStrings(to.setting.actionOnDayClickInMonthView, "DisplayEventListDialog")) sTemplate += "<span class='cmvDisplayAllEvents'>..</span>"; if($.cf.compareStrings(to.setting.eventIndicatorInMonthView, "DayHighlight")) sTemplate += "<div class='cmvMonthTableRowIndicator' ><span>&nbsp;</span></div>"; else if($.cf.compareStrings(to.setting.eventIndicatorInMonthView, "Custom")) sTemplate += "<div class='cmvMonthTableRowCustom' >&nbsp;</div>"; } else if($.cf.compareStrings(to.setting.visibleView, "DatePicker")) { sTemplate += "<div class='cElemDatePickerCustom'>"; if($.cf.compareStrings(to.setting.eventIndicatorInDatePicker, "Dot") && iSourceCount > 0) { sTemplate += "<span class='cElemDatePickerDot'></span>"; } sTemplate += "</div>"; } sTemplate += "</td>"; iDateIndex++; } sTemplate += "</tr>"; } sTemplate += "</tbody>"; $(to.elem).find(".cmvMonthTableMain").html(sTemplate); $(to.elem).find(".cTodayHighlightTextColor").find(".cmvDayNumber").addClass("cTodayHighlightCircle"); if($.cf.compareStrings(to.setting.visibleView, "MonthView") && $.cf.compareStrings(to.setting.actionOnDayClickInMonthView, "ModifyEventList")) $(to.elem).find(".cCurrentDateHighlightColor").find(".cmvDayNumber").addClass("cCurrentHighlightCircle"); to.adjustMonthTable(); if(!to.setting.addEventsInMonthView) to.adjustMonthTable(); to._setMonthStrings(); if(!$.CalenStyle.extra.bTouchDevice) to._addHoverClassesInMonthView(); }, _updateMonthTableContents: function(bLoadAllData) { var to = this; if(to.setting.addEventsInMonthView && !$.cf.compareStrings(to.setting.visibleView, "DatePicker")) { if($.cf.compareStrings(to.setting.eventIndicatorInMonthView, "DayHighlight")) to._updateDayHighlightViewInMonthView(bLoadAllData); else if($.cf.compareStrings(to.setting.eventIndicatorInMonthView, "Events")) to._addEventContInMonthView(bLoadAllData); else if($.cf.compareStrings(to.setting.eventIndicatorInMonthView, "Custom")) { to.__parseData(bLoadAllData, function() { if(to.setting.modifyCustomView) to.setting.modifyCustomView.call(to, to.tv.dAVDt); if(!$.cf.compareStrings(to.setting.actionOnDayClickInMonthView, "ChangeDate")) to._displayEventOnDayClickInMonthView(); to.adjustMonthTable(); to.__modifyFilterBarCallback(); }); } } else if($.cf.compareStrings(to.setting.visibleView, "DatePicker")) to._updateDayHighlightInDatePickerView(bLoadAllData); if(!$.cf.compareStrings(to.setting.actionOnDayClickInMonthView, "DisplayEventListDialog")) to._makeDayClickableInMonthView(); }, _updateDayHighlightInDatePickerView: function(bLoadAllData) { var to = this; to.__parseData(bLoadAllData, function() { for(var iTempIndex = 0; iTempIndex < to.tv.dAVDt.length; iTempIndex++) { var dTempViewDate = to.tv.dAVDt[iTempIndex], sDayId = "#cmvDay-"+dTempViewDate.getDate()+"-"+dTempViewDate.getMonth()+"-"+dTempViewDate.getFullYear(), $oDay = $(to.elem).find(sDayId), iSourceCount = to.__getSourceCountForDate(dTempViewDate), sDayNumberClass = (($.cf.compareStrings(to.setting.visibleView, "DatePicker") || to.setting.parentObject !== null) && (iSourceCount > 0)) ? " cBold" : ""; if($.cf.compareStrings(to.setting.eventIndicatorInDatePicker, "DayNumberBold")) { if(sDayNumberClass !== "") $oDay.find(".cmvDayNumber").addClass(sDayNumberClass); } else if($.cf.compareStrings(to.setting.eventIndicatorInDatePicker, "Dot")) { if($oDay.find(".cElemDatePickerCustom").length === 0) { var sTemplate = "<div class='cElemDatePickerCustom'>"; sTemplate += "<span class='cElemDatePickerDot'></span>"; sTemplate += "</div>"; $oDay.append(sTemplate); } } } }); }, _updateDayHighlightViewInMonthView: function(bLoadAllData) { var to = this; to.__parseData(bLoadAllData, function() { for(var iTempIndex = 0; iTempIndex < to.tv.dAVDt.length; iTempIndex++) { var dTempViewDate = to.tv.dAVDt[iTempIndex], sDayId = "#cmvDay-"+dTempViewDate.getDate()+"-"+dTempViewDate.getMonth()+"-"+dTempViewDate.getFullYear(); var dTempViewStartDate = to.setDateInFormat({"date": dTempViewDate}, "START"), dTempViewEndDate = to.setDateInFormat({"date": dTempViewDate}, "END"), oArrDayDetails = to.getEventCountAndIsMarkedDay(dTempViewStartDate, dTempViewEndDate), iArrTempLength = oArrDayDetails[0], bIsMarked = oArrDayDetails[1], sMarkedColor = oArrDayDetails[2], $oMonthInd = $(to.elem).find(sDayId+" .cmvMonthTableRowIndicator"); if(iArrTempLength !== 0) { if(iArrTempLength < to.setting.averageEventsPerDayForDayHighlightView) iArrTempLength = iArrTempLength * (100 / to.setting.averageEventsPerDayForDayHighlightView); else iArrTempLength = 100; if(iArrTempLength > 100) iArrTempLength = 100; } if(bIsMarked) { $oMonthInd.addClass("cMarkedDayLineIndicator"); if($.cf.isValid(sMarkedColor)) $oMonthInd.find("span").css({"background": sMarkedColor}); } $oMonthInd.find("span").css({"width": iArrTempLength + "%"}); if($.cf.compareStrings(to.setting.visibleView, "MonthView") && $.cf.compareStrings(to.setting.actionOnDayClickInMonthView, "DisplayEventListDialog")) { if($(to.elem).find(".cmvMonthTableMain " +sDayId).has(".cmvDisplayAllEvents").length === 0) $(to.elem).find(".cmvMonthTableMain " +sDayId).prepend("<span class='cmvDisplayAllEvents'>...</span>"); } } if(!$.cf.compareStrings(to.setting.actionOnDayClickInMonthView, "ChangeDate")) to._displayEventOnDayClickInMonthView(); to.adjustMonthTable(); to.addRemoveViewLoader(false, "cEventLoaderBg"); to.addRemoveLoaderIndicators(false, "cEventLoaderIndicator"); to.__modifyFilterBarCallback(); }); }, // Public Method updateMonthTableAndContents: function(bLoadAllData) { var to = this; $(to.elem).find(".cmvDisplayAllEvents").remove(); $(to.elem).find(".cmvEvent").remove(); $(to.elem).find(".cdmvEvent").remove(); $(to.elem).find(".cHiddenEventsIndicator").remove(); $(to.elem).find(".cHiddenEventsCont").remove(); $(to.elem).find(".cmvDialog").remove(); to._updateMonthTable(); to._updateMonthTableContents(bLoadAllData); }, _addHoverClassesInMonthView: function() { var to = this; if($(to.elem).find(".cContHeaderLabelMonth" + ", " + ".cContHeaderLabelYear").hasClass("sClickableClass")) { $(to.elem).find(".cContHeaderLabelMonth" + ", " + ".cContHeaderLabelYear").hover( function(e) { $(this).addClass("cContHeaderLabelHover"); }, function(e) { $(this).removeClass("cContHeaderLabelHover"); } ); } $(to.elem).find(".cmvDay").hover( function(e) { $(this).addClass("cContHeaderButtonsHover"); }, function(e) { $(this).removeClass("cContHeaderButtonsHover"); } ); }, _addEventContInMonthView: function(bLoadAllData) { var to = this; var sTempInner = "", iElemIndex, $oElemDragged, sDroppableId, sEventId, sId, oDraggedEvent, sEventClass, sElemId, dStartDateTime = null, dEndDateTime = null, bIsAllDay = 0, iArrNumOfDays, iNumOfDays, iNumOfHours, sDayId, sArrDayId, dThisDate, dNextDate, bNextDate, dStartDateAfterDrop, dEndDateAfterDrop, bEventEntered = false; if($.cf.compareStrings(to.setting.visibleView, "MonthView") && to.setting.displayEventsInMonthView) { sTempInner += "<div class='cmvEventCont'><div class='cmvEventContSmall'></div><div class='cmvEventContAllDay'></div></div>"; $(to.elem).find(".cmvMonthTableMain .cmvDay").not(".cmvWeekNumber").append(sTempInner); } $(to.elem).find(".cmvDay").droppable( { scope: "Events", over: function(event, ui) { $oElemDragged = $(ui.draggable); sEventId = $oElemDragged.attr("id"); sId = $oElemDragged.attr("data-id"); oDraggedEvent = to.getEventWithId(sId); sEventClass = "." + "Event-" + sId; dStartDateTime = null; dEndDateTime = null; bIsAllDay = 0; $(to.elem).find(sEventClass).addClass("cEditingEventClone"); if(oDraggedEvent.start !== null) dStartDateTime = oDraggedEvent.start; if(oDraggedEvent.end !== null) dEndDateTime = oDraggedEvent.end; if(oDraggedEvent.isAllDay !== null) bIsAllDay = oDraggedEvent.isAllDay; iArrNumOfDays = to.getNumberOfDaysOfEvent(bIsAllDay, dStartDateTime, dEndDateTime, true, false, true); iNumOfDays = iArrNumOfDays[0]; iNumOfHours = iArrNumOfDays[1]; sDayId = $(this).attr("id"); sArrDayId = sDayId.split("-"); dThisDate = new Date(sArrDayId[3], sArrDayId[2], sArrDayId[1], 0, 0, 0, 0); dNextDate = new Date(dThisDate); bNextDate = false; dStartDateAfterDrop = to.setDateInFormat({"iDate": {d: parseInt(sArrDayId[1]), M: parseInt(sArrDayId[2]), y: parseInt(sArrDayId[3]), H: dStartDateTime.getHours(), m: dStartDateTime.getMinutes(), s: dStartDateTime.getSeconds()}}, ""); dEndDateAfterDrop = new Date(dStartDateAfterDrop.getTime() + (dEndDateTime.getTime() - dStartDateTime.getTime())); if(to.tv.bChkDroppable) { $oElemDragged = $(to.elem).find("#" + sEventId + ".ui-draggable-dragging"); sDroppableId = $oElemDragged.attr("data-droppableid"); bEventEntered = to._findWhetherEventEnteredNonDroppableZone(dStartDateAfterDrop, dEndDateAfterDrop, bIsAllDay, iNumOfDays, sDroppableId); if(bEventEntered) { $oElemDragged.addClass("cCursorNotAllowed"); $oElemDragged.find(".cEventLink").addClass("cCursorNotAllowed"); } else { $oElemDragged.removeClass("cCursorNotAllowed"); $oElemDragged.find(".cEventLink").removeClass("cCursorNotAllowed"); } } $(to.elem).find(".cmvDay").removeClass("cActivatedCell"); for(iElemIndex = 0; iElemIndex < iNumOfDays; iElemIndex++) { if(iElemIndex > 0) { dNextDate = new Date(dNextDate.getTime() + $.CalenStyle.extra.iMS.d); bNextDate = to.compareDates(dNextDate, to.tv.dVEDt); } if((iElemIndex === 0 || bNextDate <= 0) && to.__findWhetherDateIsVisibleInCurrentView(dNextDate, (bIsAllDay || iNumOfHours > 23), dStartDateTime, dEndDateTime)) { sElemId = "#cmvDay" + "-" + dNextDate.getDate() + "-" + dNextDate.getMonth() + "-" + dNextDate.getFullYear(); $(to.elem).find(sElemId).addClass("cActivatedCell"); } } }, drop: function(event, ui) { $oElemDragged = $(ui.draggable); sEventId = $oElemDragged.attr("id"); sId = $oElemDragged.attr("data-id"); oDraggedEvent = to.getEventWithId(sId); sEventClass = "." + "Event-" + sId; dStartDateTime = null; dEndDateTime = null; bIsAllDay = 0; if(oDraggedEvent.start !== null) dStartDateTime = oDraggedEvent.start; if(oDraggedEvent.end !== null) dEndDateTime = oDraggedEvent.end; if(oDraggedEvent.isAllDay !== null) bIsAllDay = oDraggedEvent.isAllDay; iArrNumOfDays = to.getNumberOfDaysOfEvent(bIsAllDay, dStartDateTime, dEndDateTime, true, false, true); iNumOfDays = iArrNumOfDays[0]; iNumOfHours = iArrNumOfDays[1]; sDayId = $(this).attr("id"); sArrDayId = sDayId.split("-"); dStartDateAfterDrop = to.setDateInFormat({"iDate": {d: parseInt(sArrDayId[1]), M: parseInt(sArrDayId[2]), y: parseInt(sArrDayId[3]), H: dStartDateTime.getHours(), m: dStartDateTime.getMinutes(), s: dStartDateTime.getSeconds()}}, ""); dEndDateAfterDrop = new Date(dStartDateAfterDrop.getTime() + (dEndDateTime.getTime() - dStartDateTime.getTime())); if(to.tv.bChkDroppable) { $oElemDragged = $(to.elem).find("#" + sEventId + ".ui-draggable-dragging"); sDroppableId = $oElemDragged.attr("data-droppableid"); bEventEntered = to._findWhetherEventEnteredNonDroppableZone(dStartDateAfterDrop, dEndDateAfterDrop, bIsAllDay, iNumOfDays, sDroppableId); $oElemDragged.removeClass("cCursorNotAllowed"); $oElemDragged.find(".cEventLink").removeClass("cCursorNotAllowed"); } var iComp = to.compareDates(dEndDateTime, $.CalenStyle.extra.dToday); if(iComp >= 0) $(to.elem).find(sEventClass).removeClass("cEditingEventClone"); else if(iComp < 0) $(to.elem).find(sEventClass).removeClass("cEditingEventClone").addClass("cBlurredEvent"); if(to.tv.draggableParent === $(this).attr("id") || bEventEntered) { to.tv.iTSEndEditing = $.cf.getTimestamp(); to.tv.bDroppedInDifferent = false; setTimeout(function() { var $oEventClone = $("#"+sEventId+".cEventClone"); $("#"+sEventId).attr("style", $oEventClone.attr("style")); $(sEventClass).removeClass("cEditingEvent cEditingEventUI cEventBeingDragged"); $oEventClone.remove(); }, 300); return true; } to.tv.bDroppedInDifferent = true; var sEventContClass = ""; if($.cf.compareStrings(to.setting.visibleView, "MonthView")) { if(bIsAllDay === true || iNumOfHours> 23) sEventContClass += ".cmvEventContAllDay"; else sEventContClass += ".cmvEventContSmall"; } if(to.__updateEventWithId(sId, dStartDateAfterDrop, dEndDateAfterDrop)) { $(to.elem).find(".cmvDisplayAllEvents").remove(); $(to.elem).find(".cmvEvent").remove(); $(to.elem).find(".cdmvEvent").remove(); $(to.elem).find(".cHiddenEventsIndicator").remove(); $(to.elem).find(".cHiddenEventsCont").remove(); $(to.elem).find(".cmvDialog").remove(); to._addEventsInMonthView(null); if($.cf.compareStrings(to.setting.visibleView, "DetailedMonthView")) to._adjustEventsInMonthView(); } $(to.elem).find(".cmvDay").removeClass("cActivatedCell"); if(to.setting.saveChangesOnEventDrop) to.setting.saveChangesOnEventDrop.call(to, oDraggedEvent, dStartDateTime, dEndDateTime, dStartDateAfterDrop, dEndDateAfterDrop); to.tv.iTSEndEditing = $.cf.getTimestamp(); } }); if($.cf.compareStrings(to.setting.visibleView, "MonthView")) to.adjustMonthTable(); to.__parseData(bLoadAllData, function() { to._addEventsInMonthView(null); to.adjustMonthTable(); to.__modifyFilterBarCallback(); }); }, _addEventsInMonthView: function(oHiddenEventsDialog) { var to = this; var bEventsInDialog, oArrTempEvents, dDialogDayStart, dDialogDayEnd, dMonthStartDate = new Date($.CalenStyle.extra.dToday); dMonthStartDate.setDate(1); var bHideEventIcon = $.cf.isValid(to.setting.hideEventIcon[to.setting.visibleView]) ? to.setting.hideEventIcon[to.setting.visibleView] : $.cf.isValid(to.setting.hideEventIcon.Default) ? to.setting.hideEventIcon.Default : false, bHideEventTime = $.cf.isValid(to.setting.hideEventTime[to.setting.visibleView]) ? to.setting.hideEventTime[to.setting.visibleView] : $.cf.isValid(to.setting.hideEventTime.Default) ? to.setting.hideEventTime.Default : false, sEventTimeFormat = to.setting.is24Hour ? "HH:mm" : "h[:m]sm", iNoBsDays = to.setting.excludeNonBusinessHours ? to.tv.iBsDays : 7; if($.cf.isValid(oHiddenEventsDialog) && oHiddenEventsDialog.oArrEvents.length > 0) { bEventsInDialog = true; oArrTempEvents = oHiddenEventsDialog.oArrEvents; dDialogDayStart = oHiddenEventsDialog.dDayStart; dDialogDayEnd = oHiddenEventsDialog.dDayEnd; } else { if($.cf.compareStrings(to.setting.visibleView, "DetailedMonthView")) $(to.elem).find(".cdmvEventContMain").html(""); oArrTempEvents = to.getArrayOfEventsForView(to.tv.dVSDt, to.tv.dVEDt); to.tv.bAWkRw = []; for(var iTempIndex = 0; iTempIndex < 6; iTempIndex++) { var oArrTempRow = []; for(var iRowIndex = 0; iRowIndex < (to.tv.iMxEvRw - 1); iRowIndex++) { oArrTempRow.push(new Array(0, 0, 0, 0, 0, 0, 0)); } to.tv.bAWkRw.push(oArrTempRow); } } if(oArrTempEvents.length > 0) { // DetailedMonthView var iEventHeightForAllEvents = $.CalenStyle.extra.iEventHeights[to.setting.visibleView], sTooltipEventClass = "", // MonthView iDayWidth = $(to.elem).find(".cmvTableColumn0").width(), iHeightOfAllDayEvents = to._getHeightForAllDayEventInMonthView(), iHeightOfSmallEvents = to._getHeightForSmallEventInMonthView(), iMarginForSmallEvent = to._getMarginValueForSmallEventInMonthView(), sMarginForSmallEvent = iMarginForSmallEvent + "px" + " " + iMarginForSmallEvent+ "px"; for(var iEventIndex = 0; iEventIndex < oArrTempEvents.length; iEventIndex++) { var oEvent = oArrTempEvents[iEventIndex], dStartDateTime = null, dEndDateTime = null, bIsAllDay = 0, sTitle = "", sDesc = "", sType = "", sURL = "", bIsMarked = false, bDragNDrop = false, sDroppableId = "", sId = "Event-" + oEvent.calEventId; if(oEvent.start !== null) dStartDateTime = oEvent.start; if(oEvent.end !== null) dEndDateTime = oEvent.end; if(oEvent.isAllDay !== null) bIsAllDay = oEvent.isAllDay; if(oEvent.title !== null) sTitle = oEvent.title; if(oEvent.desc !== null) sDesc = oEvent.desc; if(oEvent.type !== null) sType = oEvent.type; if(oEvent.url !== null) sURL = oEvent.url; if(oEvent.droppableId !== null) sDroppableId = oEvent.droppableId; if(oEvent.isDragNDropInMonthView !== null) bDragNDrop = oEvent.isDragNDropInMonthView; if(oEvent.isMarked !== null) bIsMarked = oEvent.isMarked; if(bIsMarked) bIsAllDay = true; var iArrTempNum = to.getNumberOfDaysOfEvent(bIsAllDay, dStartDateTime, dEndDateTime, true, true, true), iNumOfEventElements = iArrTempNum[0], iNumberOfHours = iArrTempNum[1]; if(iNumOfEventElements > 0) { var sDayId = "", $oDay, iNumOfSegs = iNumOfEventElements, iNumOfDays, sPartialEvent = "", iNumberOfHrs = 0, dTempStartDateTime = new Date(dStartDateTime), dTempEndDateTime = new Date(dEndDateTime), dTempSDT, dTemp, iDateIndex, sArrDateTime, sEventColor, sEventBorderColor, sEventTextColor, sNonAllDayEventTextColor, sColorStyle = "", sEventIconStyle = "", sEventIconDotStyle = "", sLinkStyle = "", sStyle = "", sPartialEventStyle = "", sIcon, sEventClass, oEventTooltip, sDateTime, sTemplate, sIdElem, $oSeg, $oSegContent, sEventTitle, sEventContent, iArrNumOfDays, bActualStartDate, sDataDroppableId, bLeftPartial = false, bRightPartial = false, bAddedHidden = false, bAddedLessElems = false, iAddedElemsLength = 0; if($.cf.compareStrings(to.setting.visibleView, "DetailedMonthView")) { sTooltipEventClass = ".cdmvEvent"; if(bEventsInDialog) { if(to.compareDates(dStartDateTime, dDialogDayStart) < 0 && Math.abs(to.__getDifference("m", dDialogDayStart, dStartDateTime)) > 1) { bLeftPartial = true; sPartialEvent = "Left"; dTempStartDateTime = new Date(dDialogDayStart); } if(to.compareDates(dDialogDayEnd, dEndDateTime) < 0 && Math.abs(to.__getDifference("m", dDialogDayEnd, dEndDateTime)) > 1) { bRightPartial = true; sPartialEvent = "Right"; dTempEndDateTime = new Date(dDialogDayEnd); } sDayId = "#cmvDay" + "-" + dDialogDayStart.getDate() + "-" + dDialogDayStart.getMonth() + "-" + dDialogDayStart.getFullYear(); } else { if(to.compareDates(dStartDateTime, to.tv.dVSDt) < 0 && Math.abs(to.__getDifference("m", to.tv.dVSDt, dStartDateTime)) > 1) { sPartialEvent = "Left"; dTempStartDateTime = new Date(to.tv.dVSDt); } if(to.compareDates(to.tv.dVEDt, dEndDateTime) < 0 && Math.abs(to.__getDifference("m", to.tv.dVEDt, dEndDateTime)) > 1) { sPartialEvent = "Right"; dTempEndDateTime = new Date(to.tv.dVEDt); } dTempSDT = new Date(dTempStartDateTime); bActualStartDate = true; while(!to.__findWhetherDateIsVisibleInCurrentView(dTempSDT, (bIsAllDay || iNumberOfHours > 23), dTempStartDateTime, dTempEndDateTime)) { dTempSDT.setDate(dTempSDT.getDate() + 1); bActualStartDate = false; if(to.compareDates(dTempSDT, dTempEndDateTime) > 0) break; } dTempStartDateTime = new Date(dTempSDT); sDayId = "#cmvDay" + "-" + dTempStartDateTime.getDate() + "-" + dTempStartDateTime.getMonth() + "-" + dTempStartDateTime.getFullYear(); } iArrNumOfDays = to.getNumberOfDaysOfEvent(bIsAllDay, dTempStartDateTime, dTempEndDateTime, true, true, bActualStartDate); iNumOfDays = iArrNumOfDays[0]; iNumOfSegs = iArrNumOfDays[0]; iNumberOfHrs = iArrNumOfDays[1]; if(iNumberOfHrs > 0) { sEventClass = "cdmvEvent "; sEventColor = oEvent.backgroundColor; sEventColor = (!$.cf.isValid(sEventColor) || $.cf.compareStrings(sEventColor, "transparent")) ? "transparent" : sEventColor; sEventBorderColor = oEvent.borderColor || $.cf.addHashToHexcode(to.setting.borderColor); sEventBorderColor = (!$.cf.isValid(sEventBorderColor) || $.cf.compareStrings(sEventBorderColor, "transparent")) ? "transparent" : sEventBorderColor; sEventTextColor = oEvent.textColor || $.cf.addHashToHexcode(to.setting.textColor); sEventTextColor = (!$.cf.isValid(sEventTextColor) || $.cf.compareStrings(sEventTextColor, "transparent")) ? $.cf.addHashToHexcode(to.setting.textColor) : sEventTextColor; sNonAllDayEventTextColor = $.cf.isValid(oEvent.nonAllDayEventsTextColor) ? oEvent.nonAllDayEventsTextColor : oEvent.backgroundColor; sNonAllDayEventTextColor = (!$.cf.isValid(sNonAllDayEventTextColor) || $.cf.compareStrings(sNonAllDayEventTextColor, "transparent")) ? oEvent.backgroundColor : sNonAllDayEventTextColor; if(bIsAllDay === true || iNumberOfHours > 23) { if(bIsMarked) { if(oEvent.fromSingleColor) { sColorStyle += "background: " + sEventColor + "; "; sColorStyle += "border-color: " + sEventBorderColor + "; "; sColorStyle += "color: " + sEventTextColor + "; "; sLinkStyle += "color: " + sEventTextColor + "; "; sEventIconStyle = "background: " + sEventTextColor + "; color: #FFFFFF"; sEventIconDotStyle = "background: " + sEventTextColor + "; "; } else { sEventBorderColor = sEventColor; sColorStyle += "background: " + $.cf.getRGBAString(sEventColor, 0.1) + "; "; sColorStyle += "border-color: " + sEventBorderColor + "; "; sColorStyle += "color: " + sEventColor + "; "; sLinkStyle += "color: " + sEventColor + "; "; sEventIconStyle = "background: " + sEventColor + "; color: " + sEventTextColor; sEventIconDotStyle = "background: " + sEventColor + "; "; } } else { sColorStyle += "background: " + sEventColor + "; "; sColorStyle += "border-color: " + sEventBorderColor + "; "; sColorStyle += "color: " + sEventTextColor + "; "; sLinkStyle += "color: " + sEventTextColor + "; "; sEventIconStyle = "color: " + sEventTextColor + "; "; sEventIconDotStyle = "background: " + sEventTextColor + "; "; } } else { if(to.setting.onlyTextForNonAllDayEvents) { sEventClass += "cEventOnlyText "; sColorStyle += "color: " + sNonAllDayEventTextColor + "; "; sColorStyle += "border-color: transparent; "; iNumOfSegs = 1; sPartialEvent = ""; sLinkStyle += "color: " + sNonAllDayEventTextColor + "; "; sEventIconStyle = "color: " + sNonAllDayEventTextColor + "; "; sEventIconDotStyle = "background: " + sNonAllDayEventTextColor + "; "; } else { sColorStyle += "background: " + sEventColor + "; "; sColorStyle += "border-color: " + sEventBorderColor + "; "; sColorStyle += "color: " + sEventTextColor + "; "; sLinkStyle += "color: " + sEventTextColor + "; "; sEventIconStyle = "color: " + sEventTextColor + "; "; sEventIconDotStyle = "background: " + sEventTextColor + "; "; } } sPartialEventStyle = "border-color: " + (oEvent.fromSingleColor ? sEventTextColor : "#000000"); if(bIsMarked) sIcon = ($.cf.isValid(oEvent.icon) && oEvent.icon !== "Dot") ? oEvent.icon : "cs-icon-Mark"; else sIcon = $.cf.isValid(oEvent.icon) ? oEvent.icon : to.setting.eventIcon; if(to.compareDates(dEndDateTime, dMonthStartDate) < 0) sEventClass += "cBlurredEvent "; if(bDragNDrop) sEventClass += "EventDraggable cDragNDrop "; if(to.setting.isTooltipInMonthView) sEventClass += "cEventTooltip "; sEventClass += sId; if(bIsMarked) sEventClass += " cMarkedDayEvent"; sEventTitle = sTitle; sEventContent = sDesc; var $oRow = $(to.elem).find(sDayId).parent(), sRow = $oRow.attr("id"), iRow = parseInt(sRow.replace("cmvMonthTableRow", "")) - 1, iColumn = $(to.elem).find(sDayId).index(), sHeight, sPartialClass; if(to.setting.displayWeekNumInMonthView) iColumn--; if(bEventsInDialog) { iTableRowIndex = 0; iEventRow = iEventIndex; iEventColumn = 0; iEventLengthInRow = 1; sEventSegId = sId + "-Hidden"; sName = iTableRowIndex + "|" + (iEventRow + 1) + "|" + iEventColumn + "|" + iEventLengthInRow; sHeight = iEventHeightForAllEvents + "px"; sStyle = sColorStyle; sStyle += "height: " + sHeight + "; "; if(sEventBorderColor === "transparent") sStyle += "border-width: 0px; "; sEventClass += " cHiddenEvent"; sDataDroppableId = $.cf.isValid(sDroppableId) ? "data-droppableid='" + sDroppableId + "'" : ""; sTemplate = "<div id='" + sEventSegId + "' class='" + sEventClass + "' style='" + sStyle + "' data-pos='" + sName + "' " + sDataDroppableId + " title='' data-id='" + oEvent.calEventId + "'>"; sTemplate += "<a class='cEventLink' style='" + sLinkStyle + "'>"; sPartialClass = ""; if(bRightPartial && bLeftPartial) { sPartialClass = "cPartialEvent"; sTemplate += "<span class='" + sPartialClass + " cPartialEventLeft' style='" + sPartialEventStyle + "'></span>"; sTemplate += "<span class='" + sPartialClass + " cPartialEventRight' style='" + sPartialEventStyle + "'></span>"; } else if(bRightPartial || bLeftPartial) { sPartialClass = "cPartialEvent"; if(bLeftPartial) sPartialClass += " cPartialEventLeft"; if(bRightPartial) sPartialClass += " cPartialEventRight"; sTemplate += "<span class='" + sPartialClass + "' style='" + sPartialEventStyle + "'></span>"; } if(bIsMarked) { sTemplate += "<span class='cdmvEventTitle'>" + sTitle + "</span>"; //if(!bHideEventIcon && !$.cf.compareStrings(sIcon, "Dot")) sTemplate += "<span class='cdmvEventIcon "+sIcon+"' style='" + sEventIconStyle + "'></span>"; } else { if(!bHideEventTime && bIsAllDay === false && (iNumOfEventElements === 1 || (iNumOfEventElements > 1 && !bLeftPartial && bRightPartial))) sTemplate += "<span class='cdmvEventTime'>" + to.getDateInFormat({"date": dStartDateTime}, sEventTimeFormat, to.setting.is24Hour, true) + "</span>"; if(!bHideEventTime && bIsAllDay === false && (iNumOfEventElements === 1 || (iNumOfEventElements > 1 && bLeftPartial && !bRightPartial))) sTemplate += "<span class='cdmvEventTimeRight'>" + to.getDateInFormat({"date": dEndDateTime}, sEventTimeFormat, to.setting.is24Hour, true) + "</span>"; if(!bHideEventIcon && !$.cf.compareStrings(sIcon, "Dot")) sTemplate += "<span class='cdmvEventIcon "+sIcon+"' style='" + sEventIconStyle + "'></span>"; sTemplate += "<span class='cdmvEventTitle'>" + sTitle + "</span>"; } sTemplate += "</a>"; sTemplate += "</div>"; $(to.elem).find(".cHiddenEventsCont").append(sTemplate); sIdElem = "#"+sEventSegId; $oSeg = $(to.elem).find(sIdElem); $oSegContent = $oSeg.find(".cEventLink"); oEventTooltip = {}; sDateTime = to.getEventDateTimeString(dStartDateTime, dEndDateTime, bIsAllDay, "&&"); sArrDateTime = sDateTime.split("&&"); oEventTooltip.title = sTitle; oEventTooltip.startDateTime = sArrDateTime[0]; oEventTooltip.endDateTime = sArrDateTime[1]; $oSeg.data("tooltipcontent", oEventTooltip); if(to.setting.eventRendered) to.setting.eventRendered.call(to, oEvent, $oSeg, $oSegContent, to.setting.visibleView, true); if($.cf.isValid(sURL) || to.setting.eventClicked) { $oSegContent.on($.CalenStyle.extra.sClickHandler, {"url": sURL, "eventId": oEvent.calEventId, "eventElemSelector": sIdElem, "view": "MonthView", "pluginId": to.tv.pluginId}, to.__bindClick); } } else { var iAddedDays = 0, iEventSegIndex = 0, sName; for(var iTableRowIndex = iRow; iTableRowIndex < to.tv.bAWkRw.length; iTableRowIndex++) { sId = "Event-" + oEvent.calEventId; var bArrCurrentRow = to.tv.bAWkRw[iTableRowIndex], iEventRow = -1; bLeftPartial = false; bRightPartial = false; if($.cf.compareStrings(sPartialEvent, "Left")) bLeftPartial = (iAddedDays > 0) ? false : true; if($.cf.compareStrings(sPartialEvent, "Right")) bRightPartial = true; if(iAddedDays < iNumOfSegs) { var iEventColumn = (iAddedDays > 0 && !bAddedHidden && !bAddedLessElems) ? 0 : iColumn, iEventLengthInRow = (iNumOfSegs - iAddedDays), iEventLengthInWeek = ((to.setting.excludeNonBusinessHours) ? to.tv.iBsDays : 7) - iEventColumn; bAddedHidden = false; bAddedLessElems = false; iAddedElemsLength = 0; if(iEventLengthInRow > iEventLengthInWeek) { iEventLengthInRow = iEventLengthInWeek; bRightPartial = true; } if(iAddedDays > 0) bLeftPartial = true; var iMaxColumn = iEventColumn + iEventLengthInRow; var bInnerRow, iTempIndex2, iTempIndex3, iTempEventLengthInRow; for(iTempIndex2 = 0; iTempIndex2 < bArrCurrentRow.length; iTempIndex2++) { bInnerRow = bArrCurrentRow[iTempIndex2]; if(iEventRow !== -1) break; iTempEventLengthInRow = 0; for(iTempIndex3 = iEventColumn; iTempIndex3 < iMaxColumn; iTempIndex3++) { if(bInnerRow[iTempIndex3] === 0 && iTempEventLengthInRow < iEventLengthInRow) { if(to.setting.hideExtraEvents) { if(iTempIndex3 === iEventColumn) iTempEventLengthInRow++; else if(iTempEventLengthInRow > 0) iTempEventLengthInRow++; } else iTempEventLengthInRow++; if(iTempEventLengthInRow === iEventLengthInRow) { iEventRow = iTempIndex2; break; } } else { if(to.setting.hideExtraEvents) break; } } if(to.setting.hideExtraEvents && (iTempEventLengthInRow > 0) && (iTempEventLengthInRow < iEventLengthInRow)) { iEventRow = iTempIndex2; bRightPartial = true; bAddedLessElems = true; iAddedElemsLength = iTempEventLengthInRow; } } iEventColumn = (iEventColumn > (iNoBsDays - 1)) ? (iNoBsDays - 1) : iEventColumn; if((to.setting.hideExtraEvents && iEventRow !== -1) || !to.setting.hideExtraEvents) { if(iEventRow === -1) { bArrCurrentRow.push([0, 0, 0, 0, 0, 0, 0]); iEventRow = bArrCurrentRow.length - 1; } bInnerRow = bArrCurrentRow[iEventRow]; var sEventSegId = sId + "-" + (++iEventSegIndex); //--------------------------- Add Event Start ----------------------------- sName = iTableRowIndex + "|" + (iEventRow + 1) + "|" + iEventColumn + "|" + (bAddedLessElems ? iAddedElemsLength : iEventLengthInRow); sHeight = iEventHeightForAllEvents + "px"; sStyle = sColorStyle; sStyle += "height: " + sHeight + "; "; if(sEventBorderColor === "transparent") sStyle += "border-width: 0px; "; sDataDroppableId = $.cf.isValid(sDroppableId) ? "data-droppableid='" + sDroppableId + "'" : ""; sTemplate = "<div id='" + sEventSegId + "' class='" + sEventClass + "' style='" + sStyle + "' data-pos='" + sName + "' " + sDataDroppableId + " title='' data-id='" + oEvent.calEventId + "'>"; sTemplate += "<a class='cEventLink' style='" + sLinkStyle + "'>"; sPartialClass = ""; if(bRightPartial && bLeftPartial) { sPartialClass = "cPartialEvent"; sTemplate += "<span class='" + sPartialClass + " cPartialEventLeft' style='" + sPartialEventStyle + "'></span>"; sTemplate += "<span class='" + sPartialClass + " cPartialEventRight' style='" + sPartialEventStyle + "'></span>"; } else if(bRightPartial || bLeftPartial) { sPartialClass = "cPartialEvent"; if(bLeftPartial) sPartialClass += " cPartialEventLeft"; if(bRightPartial) sPartialClass += " cPartialEventRight"; sTemplate += "<span class='" + sPartialClass + "' style='" + sPartialEventStyle + "'></span>"; } if(bIsMarked) { sTemplate += "<span class='cdmvEventTitle'>" + sTitle + "</span>"; //if(!bHideEventIcon && !$.cf.compareStrings(sIcon, "Dot")) sTemplate += "<span class='cdmvEventIcon "+sIcon+"' style='" + sEventIconStyle + "'></span>"; } else { if(!bHideEventTime && bIsAllDay === false && ((iEventSegIndex === 1 && !bLeftPartial && iNumOfEventElements > 1) || iNumOfEventElements === 1)) sTemplate += "<span class='cdmvEventTime'>" + to.getDateInFormat({"date": dStartDateTime}, sEventTimeFormat, to.setting.is24Hour, true) + "</span>"; if(!bHideEventTime && bIsAllDay === false && (iNumOfSegs > 1 || (bAddedLessElems ? iAddedElemsLength : iEventLengthInRow) > 1 || iNumberOfHours > 23) && !bRightPartial) sTemplate += "<span class='cdmvEventTimeRight'>" + to.getDateInFormat({"date": dEndDateTime}, sEventTimeFormat, to.setting.is24Hour, true) + "</span>"; if(!bHideEventIcon && !$.cf.compareStrings(sIcon, "Dot")) sTemplate += "<span class='cdmvEventIcon "+sIcon+"' style='" + sEventIconStyle + "'></span>"; sTemplate += "<span class='cdmvEventTitle'>" + sTitle + "</span>"; } sTemplate += "</a>"; sTemplate += "</div>"; $(to.elem).find(".cdmvEventContMain").append(sTemplate); sIdElem = "#"+sEventSegId; $oSeg = $(to.elem).find(sIdElem); $oSegContent = $oSeg.find(".cEventLink"); oEventTooltip = {}; sDateTime = to.getEventDateTimeString(dStartDateTime, dEndDateTime, bIsAllDay, "&&"); sArrDateTime = sDateTime.split("&&"); oEventTooltip.title = sTitle; oEventTooltip.startDateTime = sArrDateTime[0]; oEventTooltip.endDateTime = sArrDateTime[1]; $oSeg.data("tooltipcontent", oEventTooltip); if(to.setting.eventRendered) to.setting.eventRendered.call(to, oEvent, $oSeg, $oSegContent, to.setting.visibleView, false); if($.cf.isValid(sURL) || to.setting.eventClicked) $oSegContent.on($.CalenStyle.extra.sClickHandler, {"url": sURL, "eventId": oEvent.calEventId, "eventElemSelector": sIdElem, "view": "MonthView", "pluginId": to.tv.pluginId}, to.__bindClick); if(bIsMarked) { $oDay = $(to.elem).find(sDayId); dTemp = new Date(dTempStartDateTime); for(iDateIndex = 0; iDateIndex < iNumOfDays; iDateIndex++) { if(iDateIndex > 0) { dTemp.setDate(dTemp.getDate() + 1); sDayId = "#cmvDay" + "-" + dTemp.getDate() + "-" + dTemp.getMonth() + "-" + dTemp.getFullYear(); $oDay = $(to.elem).find(sDayId); } if($oDay.find(".cMarkedDayIndicator").length === 0) $oDay.append("<span class='cMarkedDayIndicator cs-icon-Mark'></span>"); if($.cf.isValid(sEventColor)) { if(oEvent.fromSingleColor) $oDay.css({"background": sEventColor}); else $oDay.css({"background": $.cf.getRGBAString(sEventColor, 0.1)}); } } } //--------------------------- Add Event End ----------------------------- if(to.setting.hideExtraEvents) { var iMaxElemIndex = iEventColumn + (bAddedLessElems ? iAddedElemsLength : iEventLengthInRow); for(iTempIndex3 = iEventColumn; iTempIndex3 < iMaxElemIndex; iTempIndex3++) { bInnerRow[iTempIndex3] = 1; iAddedDays++; } if(bAddedLessElems) iTableRowIndex--; dTempStartDateTime = new Date(dTempStartDateTime.getTime() + ((iMaxElemIndex - iEventColumn) * $.CalenStyle.extra.iMS.d)); sDayId = "#cmvDay" + "-" + dTempStartDateTime.getDate() + "-" + dTempStartDateTime.getMonth() + "-" + dTempStartDateTime.getFullYear(); iColumn = $(to.elem).find(sDayId).index(); } else { for(iTempIndex3 = iEventColumn; iTempIndex3 < iMaxColumn; iTempIndex3++) { bInnerRow[iTempIndex3] = 1; iAddedDays++; } } } else { var $oCDMVEvContM = $(to.elem).find(".cdmvEventContMain"), dDayStart = to.setDateInFormat({"date": dTempStartDateTime}, "START"), dDayEnd = to.setDateInFormat({"date": dTempStartDateTime}, "END"), iEventLength = to.getEventCountAndIsMarkedDay(dDayStart, dDayEnd)[0], sDateId = dDayStart.getDate() + "-" + dDayStart.getMonth() + "-" + dDayStart.getFullYear(); sId = "HiddenEvents-" + sDateId; var iExtraEventCount = iEventLength - bArrCurrentRow.length, sExtraEventCount = to.getNumberStringInFormat(iExtraEventCount, 0, true), $oDateDay = $(to.elem).find("#cmvDay-" + sDateId), sDateRow = $oDateDay.closest('.cmvMonthTableRows').index(), sDateColumn = $oDateDay.index(); sDateColumn = to.setting.displayWeekNumInMonthView ? (sDateColumn - 1) : sDateColumn; sName = sDateRow + "|" + (bArrCurrentRow.length + 1) + "|" + sDateColumn + "|" + 1; if($oCDMVEvContM.find("#"+sId).length === 0 && iExtraEventCount > 0) { var sEventOverflow = "<span class='cHiddenEventsIndicator clickableLink' id='" + sId + "' data-pos='" + sName + "'>"; sEventOverflow += to.setting.hiddenEventsIndicatorLabel.replace("(count)", sExtraEventCount); sEventOverflow += "</span>"; $oCDMVEvContM.append(sEventOverflow); } else $oCDMVEvContM.find("#"+sId).html(to.setting.hiddenEventsIndicatorLabel.replace("(count)", sExtraEventCount)); iAddedDays++; if(iEventColumn !== (iNoBsDays - 1)) { bAddedHidden = true; iTableRowIndex--; } dTempStartDateTime = new Date(dTempStartDateTime.getTime() + $.CalenStyle.extra.iMS.d); sDayId = "#cmvDay" + "-" + dTempStartDateTime.getDate() + "-" + dTempStartDateTime.getMonth() + "-" + dTempStartDateTime.getFullYear(); iColumn = $(to.elem).find(sDayId).index(); } } else break; } } } } else if($.cf.compareStrings(to.setting.visibleView, "MonthView")) { sTooltipEventClass = ".cmvEvent"; var iEventElemTopPosition = 0, bShowDetails = 0; if(to.compareDates(dStartDateTime, to.tv.dVSDt) < 0) { sPartialEvent = "Left"; dTempStartDateTime = new Date(to.tv.dVSDt); } if(to.compareDates(to.tv.dVEDt, dEndDateTime) < 0) { sPartialEvent = "Right"; dTempEndDateTime = new Date(to.tv.dVEDt); } dTempSDT = new Date(dTempStartDateTime); bActualStartDate = true; while(!to.__findWhetherDateIsVisibleInCurrentView(dTempSDT, (bIsAllDay || iNumberOfHours > 23), dTempStartDateTime, dTempEndDateTime)) { dTempSDT.setDate(dTempSDT.getDate() + 1); bActualStartDate = false; if(to.compareDates(dTempSDT, dTempEndDateTime) > 0) break; } dTempStartDateTime = new Date(dTempSDT); iArrNumOfDays = to.getNumberOfDaysOfEvent(bIsAllDay, dTempStartDateTime, dTempEndDateTime, true, false, bActualStartDate); iNumOfSegs = iArrNumOfDays[0]; iNumberOfHrs = iArrNumOfDays[1]; sEventColor = oEvent.fromSingleColor ? oEvent.textColor : oEvent.backgroundColor; sEventColor = ($.cf.compareStrings(sEventColor, "") || $.cf.compareStrings(sEventColor, "transparent")) ? "transparent" : sEventColor; if(bIsMarked) { dTemp = new Date(dTempStartDateTime); for(iDateIndex = 0; iDateIndex < iNumOfSegs; iDateIndex++) { if(iDateIndex > 0) dTemp.setDate(dTemp.getDate() + 1); sDayId = "#cmvDay" + "-" + dTemp.getDate() + "-" + dTemp.getMonth() + "-" + dTemp.getFullYear(); $oDay = $(to.elem).find(sDayId); if($.cf.isValid(sEventColor)) $oDay.css({"background": $.cf.getRGBAString(sEventColor, 0.1)}); } } else { if(!(bIsAllDay === true || iNumberOfHrs > 23)) { sPartialEvent = ""; iNumOfSegs = 1; } var dThisDate = new Date(dTempStartDateTime), iThisDate = dThisDate.getTime(); for(var iEventElem = 1; iEventElem <= iNumOfSegs; iEventElem++) { if(to.__find