Esempio n. 1
0
        public void GetEventListForPublishedCalendar()
        {
            ExDateTime[]     days     = (ExDateTime[])base.GetParameter("days");
            CalendarViewType viewType = (CalendarViewType)base.GetParameter("vt");
            int startHour             = (int)base.GetParameter("SH");
            int endHour = (int)base.GetParameter("EH");
            AnonymousSessionContext anonymousSessionContext = base.SessionContext as AnonymousSessionContext;

            if (anonymousSessionContext == null)
            {
                throw new OwaInvalidRequestException("This request can only be sent to Calendar VDir");
            }
            using (PublishedCalendarAdapter publishedCalendarAdapter = new PublishedCalendarAdapter(anonymousSessionContext))
            {
                publishedCalendarAdapter.LoadData(CalendarUtilities.QueryProperties, days, startHour, endHour, viewType);
                if (!publishedCalendarAdapter.UserCanReadItem)
                {
                    throw new OwaInvalidRequestException("no read access to the calendar");
                }
                PrintEventList printEventList = new PrintEventList(base.SessionContext, publishedCalendarAdapter, viewType, false);
                printEventList.RenderView(this.SanitizingWriter);
            }
        }
Esempio n. 2
0
        public void GetPublishedViewPayload()
        {
            ExTraceGlobals.CalendarCallTracer.TraceDebug((long)this.GetHashCode(), "CalendarViewEventHandler.GetPublishedViewPayload");
            AnonymousSessionContext anonymousSessionContext = base.SessionContext as AnonymousSessionContext;

            if (anonymousSessionContext == null)
            {
                throw new OwaInvalidRequestException("This request can only be sent to Calendar VDir");
            }
            CalendarViewType calendarViewType = (CalendarViewType)base.GetParameter("vt");

            ExDateTime[] array = (ExDateTime[])base.GetParameter("days");
            if (array == null)
            {
                array = new ExDateTime[]
                {
                    DateTimeUtilities.GetLocalTime().Date
                };
            }
            int num = 0;

            if (base.IsParameterSet("dir"))
            {
                num = (int)base.GetParameter("dir");
            }
            if (num != 0)
            {
                CalendarViewEventHandler.MoveDates(array, calendarViewType, num);
            }
            this.ValidateDays(array, calendarViewType, num);
            ExTimeZone exTimeZone = null;

            if (base.IsParameterSet("tz"))
            {
                string text = (string)base.GetParameter("tz");
                if (ExTimeZoneEnumerator.Instance.TryGetTimeZoneByName(text, out exTimeZone))
                {
                    anonymousSessionContext.TimeZone = exTimeZone;
                    this.HttpContext.Response.Cookies["timezone"].Value   = text;
                    this.HttpContext.Response.Cookies["timezone"].Expires = (DateTime)ExDateTime.Now.AddYears(1);
                }
            }
            using (PublishedCalendarAdapter publishedCalendarAdapter = new PublishedCalendarAdapter(anonymousSessionContext))
            {
                publishedCalendarAdapter.LoadData(CalendarUtilities.QueryProperties, array, calendarViewType, exTimeZone);
                CalendarViewPayloadWriter calendarViewPayloadWriter;
                if (calendarViewType == CalendarViewType.Monthly)
                {
                    calendarViewPayloadWriter = new MonthlyViewPayloadWriter(base.SessionContext, this.Writer, array, new CalendarAdapterBase[]
                    {
                        publishedCalendarAdapter
                    });
                }
                else
                {
                    calendarViewPayloadWriter = new DailyViewPayloadWriter(base.SessionContext, this.Writer, array, new CalendarAdapterBase[]
                    {
                        publishedCalendarAdapter
                    });
                }
                base.ResponseContentType = OwaEventContentType.Javascript;
                calendarViewPayloadWriter.Render(0, calendarViewType, Microsoft.Exchange.Clients.Owa.Core.ReadingPanePosition.Off, Microsoft.Exchange.Clients.Owa.Core.ReadingPanePosition.Off);
            }
            if (Globals.ArePerfCountersEnabled)
            {
                OwaSingleCounters.CalendarViewsRefreshed.Increment();
            }
        }
Esempio n. 3
0
        // Token: 0x060029FE RID: 10750 RVA: 0x000EB600 File Offset: 0x000E9800
        protected override void OnLoad(EventArgs e)
        {
            string queryStringParameter = Utilities.GetQueryStringParameter(base.Request, "vt", false);
            int    num = 1;

            if (!string.IsNullOrEmpty(queryStringParameter) && (!int.TryParse(queryStringParameter, out num) || num < 1 || num >= 7))
            {
                throw new OwaInvalidRequestException("View type error");
            }
            this.viewType = (CalendarViewType)num;
            string queryStringParameter2 = Utilities.GetQueryStringParameter(base.Request, "wo", false);

            if (queryStringParameter2 == "1" || this.viewType == CalendarViewType.WorkWeek)
            {
                this.workingDayOnly = true;
            }
            this.days = Utilities.GetQueryStringParameterDateTimeArray(base.Request, "d", base.SessionContext.TimeZone, false, 7);
            if (this.days == null || this.days.Length == 0)
            {
                this.days = new ExDateTime[]
                {
                    ExDateTime.Now.Date
                };
            }
            string queryStringParameter3 = Utilities.GetQueryStringParameter(base.Request, "st", false);
            string queryStringParameter4 = Utilities.GetQueryStringParameter(base.Request, "et", false);

            if (!string.IsNullOrEmpty(queryStringParameter3))
            {
                int.TryParse(queryStringParameter3, out this.startTime);
            }
            if (!string.IsNullOrEmpty(queryStringParameter4))
            {
                int.TryParse(queryStringParameter4, out this.endTime);
            }
            if (this.startTime >= this.endTime || this.startTime < 0 || this.endTime > 24)
            {
                throw new OwaInvalidRequestException("start time and end time must be in range and start time must early than end time");
            }
            if (this.workingDayOnly)
            {
                if (this.viewType == CalendarViewType.Weekly)
                {
                    this.viewType = CalendarViewType.WorkWeek;
                }
                else if (this.viewType == CalendarViewType.WeeklyAgenda)
                {
                    this.viewType = CalendarViewType.WorkWeeklyAgenda;
                }
            }
            if (this.viewType == CalendarViewType.Min)
            {
                string queryStringParameter5 = Utilities.GetQueryStringParameter(base.Request, "rn", false);
                if (queryStringParameter5 == "1")
                {
                    this.renderNotes = true;
                }
            }
            string queryStringParameter6 = Utilities.GetQueryStringParameter(base.Request, "el", false);

            if (!string.IsNullOrEmpty(queryStringParameter6) && queryStringParameter6 == "1")
            {
                this.printEventList = true;
            }
            string queryStringParameter7 = Utilities.GetQueryStringParameter(base.Request, "id", false);

            if (base.SessionContext is AnonymousSessionContext)
            {
                PublishedCalendarAdapter publishedCalendarAdapter = new PublishedCalendarAdapter((AnonymousSessionContext)base.SessionContext);
                publishedCalendarAdapter.LoadData(CalendarUtilities.QueryProperties, this.days, this.startTime, this.endTime, this.viewType);
                this.calendarAdapter = publishedCalendarAdapter;
            }
            else
            {
                OwaStoreObjectId owaStoreObjectId;
                if (queryStringParameter7 != null)
                {
                    owaStoreObjectId = OwaStoreObjectId.CreateFromString(queryStringParameter7);
                }
                else
                {
                    ExTraceGlobals.CalendarTracer.TraceDebug(0L, "folder Id is null, using default folder");
                    owaStoreObjectId = base.UserContext.CalendarFolderOwaId;
                }
                if (owaStoreObjectId == null)
                {
                    throw new OwaInvalidRequestException("Invalid folder id");
                }
                CalendarAdapter calendarAdapter = new CalendarAdapter(base.UserContext, owaStoreObjectId);
                calendarAdapter.LoadData(this.printEventList ? CalendarUtilities.PrintQueryProperties : CalendarUtilities.QueryProperties, this.days, false, this.startTime, this.endTime, ref this.viewType, out this.viewWidth, out this.readingPanePosition);
                this.calendarAdapter = calendarAdapter;
            }
            if (!this.calendarAdapter.UserCanReadItem)
            {
                return;
            }
            base.OnLoad(e);
        }