public override void RenderInEditMode(HtmlTextWriter writer, CmsPage page, int identifier, CmsLanguage langToRenderFor, string[] paramList)
        {
            string          ControlId = "Calender_" + page.ID.ToString() + "_" + identifier.ToString() + "_" + langToRenderFor.shortCode.ToLower();
            EventCalendarDb db        = new EventCalendarDb();

            EventCalendarDb.EventCalendarAggregatorData entity = db.fetchAggregatorData(page, identifier, langToRenderFor, true);

            string action = PageUtils.getFromForm(ControlId + "_action", "");

            if (String.Compare(action, "saveNewValues", true) == 0)
            {
                entity.ViewMode = (CalendarViewMode)PageUtils.getFromForm(ControlId + "_viewMode", typeof(CalendarViewMode), entity.ViewMode);
                db.updateAggregatorData(page, identifier, langToRenderFor, entity);
            }

            StringBuilder html = new StringBuilder();

            html.Append("<p>Calendar Display Configuration:</p>");

            html.Append("<table>");
            html.Append("<tr>");
            html.Append("<td>Initial view mode: </td>");
            html.Append("<td>");
            html.Append(PageUtils.getDropDownHtml(ControlId + "_viewMode", ControlId + "_viewMode", Enum.GetNames(typeof(CalendarViewMode)), Enum.GetName(typeof(CalendarViewMode), entity.ViewMode)));
            html.Append("</td>");
            html.Append("</tr>");
            html.Append("</table>");

            html.Append(PageUtils.getHiddenInputHtml(ControlId + "_action", "saveNewValues"));

            writer.Write(html.ToString());
        }
        public override Rss.RssItem[] GetRssFeedItems(CmsPage page, CmsPlaceholderDefinition placeholderDefinition, CmsLanguage langToRenderFor)
        {
            EventCalendarDb db = new EventCalendarDb();

            EventCalendarDb.EventCalendarAggregatorData entity = db.fetchAggregatorData(page, placeholderDefinition.Identifier, langToRenderFor, true);

            DateTime start = DateTime.MinValue;
            DateTime end   = DateTime.MinValue;

            switch (entity.ViewMode)
            {
            case CalendarViewMode.Agenda_Day:
                start = DateTime.Now.Date;
                end   = DateTime.Now.AddDays(1);
                break;

            case CalendarViewMode.Agenda_Week:
                DayOfWeek firstDay = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek;
                start = DateTime.Now.Date;
                while (start.DayOfWeek != firstDay)
                {
                    start = start.AddDays(-1);
                }

                end = DateTime.Now.AddDays(7);
                break;

            case CalendarViewMode.Month:
                start = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
                end   = start.AddMonths(1);
                break;

            default:
                throw new ArgumentException("Error: invalid CalendarView mode");
                break;
            }

            List <Rss.RssItem> ret = new List <Rss.RssItem>();
            List <EventCalendarDb.EventCalendarDetailsData> list = new EventCalendarDb().fetchDetailsDataByRange(start, end, langToRenderFor);

            foreach (EventCalendarDb.EventCalendarDetailsData e in list)
            {
                CmsPage     detailPage = CmsContext.getPageById(e.PageId);
                Rss.RssItem rssItem    = CreateAndInitRssItem(detailPage, langToRenderFor);
                rssItem.PubDate_GMT = e.StartDateTime;
                rssItem.Author      = e.CreatedBy;
                rssItem.Description = detailPage.renderPlaceholdersToString("EventCalendarDetails", langToRenderFor, CmsPage.RenderPlaceholderFilterAction.RunAllPageAndPlaceholderFilters);
                ret.Add(rssItem);
            }
            return(ret.ToArray());
        }
        public override void RenderInViewMode(HtmlTextWriter writer, CmsPage page, int identifier, CmsLanguage langToRenderFor, string[] paramList)
        {
            AddEventCommandToEditMenu(page, page);
            EventCalendarDb db = new EventCalendarDb();

            EventCalendarDb.EventCalendarAggregatorData entity = db.fetchAggregatorData(page, identifier, langToRenderFor, true);
            string calViewMode = entity.getViewModeForJQuery();

            addCssAndScriptForCalendarPlugin(page);
            addCssForEventCategory(page, langToRenderFor);

            string calDomId = getCalendarHtmlDomId(page, identifier);

            addScriptForCalendarRender(page, langToRenderFor, calDomId, calViewMode);

            StringBuilder html = new StringBuilder();

            html.Append("<div id=\"" + calDomId + "\" style=\"margin-right: 10px;\"></div>");

            writer.Write(html.ToString());
        }