Exemplo n.º 1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            this.infobar.SetInfobarClass("infobarEdit");
            this.infobar.SetShouldHonorHideByDefault(true);
            this.calendarItemBase = base.Initialize <CalendarItemBase>(false, new PropertyDefinition[]
            {
                CalendarItemBaseSchema.CalendarItemType,
                StoreObjectSchema.EffectiveRights
            });
            if (this.calendarItemBase != null)
            {
                if (string.Equals(base.OwaContext.FormsRegistryContext.Action, "Open", StringComparison.OrdinalIgnoreCase))
                {
                    this.newItemType = NewItemType.ExplicitDraft;
                }
                else
                {
                    this.newItemType         = NewItemType.ImplicitDraft;
                    base.DeleteExistingDraft = true;
                }
            }
            else
            {
                this.calendarItemBase = Utilities.CreateDraftMeetingRequestFromQueryString(base.UserContext, base.Request, new PropertyDefinition[]
                {
                    StoreObjectSchema.EffectiveRights
                });
                if (this.calendarItemBase != null)
                {
                    this.newItemType         = NewItemType.ImplicitDraft;
                    base.DeleteExistingDraft = true;
                    base.Item = this.calendarItemBase;
                }
            }
            if (this.calendarItemBase != null)
            {
                this.isMeeting = this.calendarItemBase.IsMeeting;
                this.startTime = this.calendarItemBase.StartTime;
                this.endTime   = this.calendarItemBase.EndTime;
                if (this.calendarItemBase.IsAllDayEvent && !this.IsRecurringMaster)
                {
                    this.endTime = this.endTime.IncrementDays(-1);
                }
                this.recipientWell       = new CalendarItemRecipientWell(this.calendarItemBase);
                this.bodyMarkup          = BodyConversionUtilities.GetBodyFormatOfEditItem(this.calendarItemBase, this.newItemType, base.UserContext.UserOptions);
                this.toolbar             = new EditCalendarItemToolbar(this.calendarItemBase, this.isMeeting, this.bodyMarkup, this.IsPublicItem);
                this.toolbar.ToolbarType = (base.IsPreviewForm ? ToolbarType.Preview : ToolbarType.Form);
                this.isBeingCanceled     = (Utilities.GetQueryStringParameter(base.Request, "c", false) != null);
                string queryStringParameter = Utilities.GetQueryStringParameter(base.Request, "er", false);
                if (queryStringParameter != null)
                {
                    if (this.calendarItemBase.CalendarItemType != CalendarItemType.RecurringMaster || !(this.calendarItemBase is CalendarItem))
                    {
                        throw new OwaInvalidRequestException("Invalid calendar item type.  Only recurring masters support specifying an end range");
                    }
                    this.endRange = ExDateTime.MinValue;
                    try
                    {
                        this.endRange = DateTimeUtilities.ParseIsoDate(queryStringParameter, base.UserContext.TimeZone);
                    }
                    catch (OwaParsingErrorException)
                    {
                        ExTraceGlobals.CalendarDataTracer.TraceDebug <string>((long)this.GetHashCode(), "Invalid end range provided on URL '{0}'", queryStringParameter);
                        throw new OwaInvalidRequestException(string.Format("Invalid end range provided on URL '{0}'", queryStringParameter));
                    }
                    if (this.endRange != ExDateTime.MinValue)
                    {
                        CalendarItem calendarItem = (CalendarItem)this.calendarItemBase;
                        this.occurrenceCount = MeetingUtilities.CancelRecurrence(calendarItem, this.endRange);
                        if (this.occurrenceCount == 0)
                        {
                            this.isBeingCanceled = true;
                        }
                    }
                }
                string queryStringParameter2 = Utilities.GetQueryStringParameter(base.Request, "od", false);
                if (queryStringParameter2 != null)
                {
                    try
                    {
                        this.occurrenceDate = DateTimeUtilities.ParseIsoDate(queryStringParameter2, base.UserContext.TimeZone).Date;
                        goto IL_303;
                    }
                    catch (OwaParsingErrorException)
                    {
                        ExTraceGlobals.CalendarDataTracer.TraceDebug <string>((long)this.GetHashCode(), "Invalid occurrence date specified on URL '{0}'", queryStringParameter2);
                        throw new OwaInvalidRequestException(string.Format("Invalid occurrence date provided on URL '{0}'", queryStringParameter2));
                    }
                }
                this.occurrenceDate = DateTimeUtilities.GetLocalTime().Date;
IL_303:
                CalendarUtilities.AddCalendarInfobarMessages(this.infobar, this.calendarItemBase, null, base.UserContext);
                if (this.isBeingCanceled)
                {
                    this.infobar.AddMessage(SanitizedHtmlString.FromStringId(1328030972), InfobarMessageType.Informational);
                }
                this.disableOccurrenceReminderUI = MeetingUtilities.CheckShouldDisableOccurrenceReminderUI(this.calendarItemBase);
                if (this.disableOccurrenceReminderUI && !this.IsPublicItem)
                {
                    this.infobar.AddMessage(SanitizedHtmlString.FromStringId(-891369593), InfobarMessageType.Informational);
                }
                if (!(this.calendarItemBase is CalendarItem))
                {
                    this.recurrenceUtilities = new RecurrenceUtilities(null, base.SanitizingResponse);
                    return;
                }
                if (0 < this.occurrenceCount)
                {
                    EndDateRecurrenceRange range = new EndDateRecurrenceRange(((CalendarItem)this.calendarItemBase).Recurrence.Range.StartDate, this.endRange.IncrementDays(-1));
                    this.recurrenceUtilities = new RecurrenceUtilities(new Recurrence(((CalendarItem)this.calendarItemBase).Recurrence.Pattern, range), base.SanitizingResponse);
                    return;
                }
                this.recurrenceUtilities = new RecurrenceUtilities(((CalendarItem)this.calendarItemBase).Recurrence, base.SanitizingResponse);
                return;
            }
            else
            {
                this.isMeeting = (Utilities.GetQueryStringParameter(base.Request, "mr", false) != null);
                if (this.isMeeting && this.IsPublicItem)
                {
                    throw new OwaInvalidRequestException("Can't create meeting in Owa Public Folders");
                }
                this.isAllDayEvent = (Utilities.GetQueryStringParameter(base.Request, "evt", false) != null);
                bool   flag = Utilities.GetQueryStringParameter(base.Request, "tm", false) != null || this.isAllDayEvent;
                string queryStringParameter3 = Utilities.GetQueryStringParameter(base.Request, "st", false);
                if (queryStringParameter3 != null)
                {
                    try
                    {
                        this.startTime = DateTimeUtilities.ParseIsoDate(queryStringParameter3, base.UserContext.TimeZone);
                    }
                    catch (OwaParsingErrorException)
                    {
                        ExTraceGlobals.CalendarDataTracer.TraceDebug <string>((long)this.GetHashCode(), "Invalid start date provided on URL '{0}'", queryStringParameter3);
                        throw new OwaInvalidRequestException(string.Format("Invalid start date provided on URL '{0}'", queryStringParameter3));
                    }
                }
                if (flag || this.startTime == ExDateTime.MinValue)
                {
                    ExDateTime localTime = DateTimeUtilities.GetLocalTime();
                    if (this.startTime == ExDateTime.MinValue)
                    {
                        this.startTime = new ExDateTime(base.UserContext.TimeZone, localTime.Year, localTime.Month, localTime.Day, localTime.Hour, localTime.Minute, 0);
                    }
                    else
                    {
                        this.startTime = new ExDateTime(base.UserContext.TimeZone, this.startTime.Year, this.startTime.Month, this.startTime.Day, localTime.Hour, localTime.Minute, 0);
                    }
                    if (this.isAllDayEvent && this.startTime.Hour == 23)
                    {
                        if (this.startTime.Minute >= 30)
                        {
                            this.startTime = this.startTime.Date;
                        }
                        else
                        {
                            this.startTime = new ExDateTime(base.UserContext.TimeZone, this.startTime.Year, this.startTime.Month, this.startTime.Day, 23, 0, 0);
                            this.endTime   = new ExDateTime(base.UserContext.TimeZone, this.startTime.Year, this.startTime.Month, this.startTime.Day, 23, 30, 0);
                        }
                    }
                    else if (this.startTime.Minute != 0 && this.startTime.Minute != 30)
                    {
                        this.startTime = this.startTime.AddMinutes((double)(30 - this.startTime.Minute % 30));
                    }
                }
                if (this.endTime == ExDateTime.MinValue)
                {
                    this.endTime = this.startTime.AddMinutes(60.0);
                }
                this.recipientWell       = new CalendarItemRecipientWell();
                this.bodyMarkup          = base.UserContext.UserOptions.ComposeMarkup;
                this.toolbar             = new EditCalendarItemToolbar(null, this.isMeeting, this.bodyMarkup, this.IsPublicItem);
                this.toolbar.ToolbarType = (base.IsPreviewForm ? ToolbarType.Preview : ToolbarType.Form);
                this.recurrenceUtilities = new RecurrenceUtilities(null, base.SanitizingResponse);
                return;
            }
        }
Exemplo n.º 2
0
 // Token: 0x06002917 RID: 10519 RVA: 0x000E8944 File Offset: 0x000E6B44
 protected virtual void MeetingPageWriterFactory(string itemType, EventArgs e)
 {
     if (ObjectClass.IsMeetingRequest(itemType))
     {
         this.meetingPageWriter = new MeetingInviteWriter(base.Item = base.Initialize <MeetingRequest>(MeetingPageWriter.MeetingMessagePrefetchProperties), base.UserContext, null, base.IsPreviewForm, base.IsInDeleteItems, base.IsEmbeddedItem, this.isInJunkEmailFolder, this.isSuspectedPhishingItem, this.itemLinkEnabled);
         if (!this.IsDraft)
         {
             this.shouldRenderToolbar = true;
             if (!base.IsEmbeddedItem && this.IsOwnerMailboxSession && (this.IsItemFromOtherMailbox || this.IsDelegated || Utilities.IsItemInExternalSharedInFolder(base.UserContext, base.Item)))
             {
                 this.GetPrincipalCalendarFolderId();
             }
         }
     }
     else if (ObjectClass.IsMeetingCancellation(itemType))
     {
         this.meetingPageWriter = new MeetingCancelWriter(base.Item = base.Initialize <MeetingCancellation>(MeetingPageWriter.MeetingMessagePrefetchProperties), base.UserContext, null, base.IsPreviewForm, base.IsInDeleteItems, base.IsEmbeddedItem, this.isInJunkEmailFolder, this.isSuspectedPhishingItem, this.itemLinkEnabled);
         if (!this.IsDraft)
         {
             this.shouldRenderToolbar = true;
             if (!base.IsEmbeddedItem && this.IsOwnerMailboxSession && (this.IsItemFromOtherMailbox || this.IsDelegated || Utilities.IsItemInExternalSharedInFolder(base.UserContext, base.Item)))
             {
                 this.GetPrincipalCalendarFolderId();
             }
         }
     }
     else if (ObjectClass.IsCalendarItemCalendarItemOccurrenceOrRecurrenceException(itemType))
     {
         CalendarItemBase calendarItemBase = base.Item = base.Initialize <CalendarItemBase>(MeetingPageWriter.CalendarPrefetchProperties);
         this.isCalendarItem      = true;
         this.isMeeting           = calendarItemBase.IsMeeting;
         this.meetingPageWriter   = new CalendarItemWriter(calendarItemBase, base.UserContext, base.IsPreviewForm, base.IsInDeleteItems, base.IsEmbeddedItem, this.isInJunkEmailFolder, this.isSuspectedPhishingItem, this.itemLinkEnabled);
         this.shouldRenderToolbar = true;
         if (!base.IsEmbeddedItem && this.IsOwnerMailboxSession && (this.IsItemFromOtherMailbox || Utilities.IsItemInExternalSharedInFolder(base.UserContext, base.Item)))
         {
             this.GetPrincipalCalendarFolderId();
         }
     }
     else
     {
         if (!ObjectClass.IsMeetingResponse(itemType))
         {
             ExTraceGlobals.CalendarDataTracer.TraceDebug <string>((long)this.GetHashCode(), "Unsupported item type '{0}' for meeting page", itemType);
             throw new OwaInvalidRequestException(string.Format("Unsupported item type '{0}' for edit meeting page", itemType));
         }
         MeetingResponse meetingResponse = base.Item = base.Initialize <MeetingResponse>(MeetingPageWriter.MeetingMessagePrefetchProperties);
         this.meetingPageWriter = new MeetingResponseWriter(meetingResponse, base.UserContext, base.IsPreviewForm, base.IsInDeleteItems, base.IsEmbeddedItem, this.isInJunkEmailFolder, this.isSuspectedPhishingItem, this.itemLinkEnabled);
         if (meetingResponse.From != null && this.IsDraft)
         {
             this.shouldRenderSendOnBehalf = (string.CompareOrdinal(base.UserContext.ExchangePrincipal.LegacyDn, meetingResponse.From.EmailAddress) != 0);
         }
         this.shouldRenderToolbar = true;
     }
     if (this.MeetingPageWriter.ShouldRenderReminder && this.MeetingPageWriter.CalendarItemBase != null)
     {
         this.disableOccurrenceReminderUI = MeetingUtilities.CheckShouldDisableOccurrenceReminderUI(this.MeetingPageWriter.CalendarItemBase);
         if (this.disableOccurrenceReminderUI && !this.IsPublicItem)
         {
             this.MeetingPageWriter.FormInfobar.AddMessage(SanitizedHtmlString.FromStringId(-891369593), InfobarMessageType.Informational);
         }
     }
 }