コード例 #1
0
ファイル: Calendar.cs プロジェクト: 0anion0/IBN
        // June 16 04: added .AddTicks(-1) method call to endDate to allow filter events that end at 0:00
        private int AddMonthItemAttributes(HtmlTextWriter writer, DateTime cycleDate, CalendarItem item)
        {
            int colSpan = 1;

            colSpan = (Helper.GetDaySpan(item.StartDate, item.AdjustedEndDate) + 1);

            // detect if events spans from previous week
            if(item.StartDate.Date<cycleDate.Date)
            {
                // Calculate span from current date
                colSpan = (Helper.GetDaySpan(cycleDate.Date, item.AdjustedEndDate) + 1);
            }

            // detect if event spans to next week
            if(colSpan>(7 - Helper.LocalizedDayOfWeek(cycleDate.DayOfWeek, this.FirstDayOfWeek)))
            {
                colSpan = (7 - Helper.LocalizedDayOfWeek(cycleDate.DayOfWeek, this.FirstDayOfWeek));
            }

            if(item.getRenderStyle() == CalendarItemRenderStyle.Box)
            {
                CalendarItemDefaultStyle.AddAttributesToRender(writer);
                RenderPaletteColor(writer, HtmlTextWriterStyle.BackgroundColor, CalendarItemDefaultStyle.BackColor, CalendarColorConstants.ItemDefaultBackColor);
                RenderPaletteColor(writer, HtmlTextWriterStyle.Color, CalendarItemDefaultStyle.ForeColor, CalendarColorConstants.ItemDefaultForeColor);
            }
            else
                AddMonthCellColorAttributes(writer, cycleDate);
            // [13/1/2005] - Begin
            if(colSpan>0) // [13/1/2005] - End
                writer.AddAttribute("colspan", colSpan.ToString());
            writer.AddAttribute(HtmlTextWriterAttribute.Height, ItemHeight.ToString());
            writer.AddAttribute(HtmlTextWriterAttribute.Valign, "top");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            return colSpan;
        }