Exemplo n.º 1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            this.post = base.Initialize <PostItem>(false, new PropertyDefinition[0]);
            Importance importance;

            if (this.post != null)
            {
                base.DeleteExistingDraft = true;
                this.newItemType         = NewItemType.PostReply;
                importance = this.post.Importance;
            }
            else
            {
                base.DeleteExistingDraft = false;
                this.newItemType         = NewItemType.New;
                importance = Importance.Normal;
            }
            this.bodyMarkup         = BodyConversionUtilities.GetBodyFormatOfEditItem(base.Item, this.newItemType, base.UserContext.UserOptions);
            this.addSignatureToBody = base.ShouldAddSignatureToBody(this.bodyMarkup, this.newItemType);
            this.toolbar            = new EditPostToolbar(importance, this.bodyMarkup);
        }
Exemplo n.º 2
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;
            }
        }
        // Token: 0x06002819 RID: 10265 RVA: 0x000E2E20 File Offset: 0x000E1020
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            this.infobar.SetInfobarClass("infobarEdit");
            this.infobar.SetShouldHonorHideByDefault(true);
            string queryStringParameter = Utilities.GetQueryStringParameter(base.Request, "a", false);
            string type = base.OwaContext.FormsRegistryContext.Type;

            if (ObjectClass.IsMeetingResponse(type))
            {
                this.isNew = string.Equals(queryStringParameter, "New", StringComparison.OrdinalIgnoreCase);
                if (this.isNew)
                {
                    this.newItemType = NewItemType.New;
                }
                base.Item = base.Initialize <MeetingResponse>(EditMeetingResponse.prefetchProperties);
                MeetingMessage meetingMessage = (MeetingMessage)base.Item;
                if (meetingMessage.From != null)
                {
                    this.isSendOnBehalfOf = (string.CompareOrdinal(base.UserContext.ExchangePrincipal.LegacyDn, meetingMessage.From.EmailAddress) != 0);
                }
                this.InitializeMeetingResponse();
            }
            else if (ObjectClass.IsMeetingRequest(type))
            {
                this.itemType = StoreObjectType.MeetingRequest;
                this.isNew    = string.Equals(queryStringParameter, "Forward", StringComparison.OrdinalIgnoreCase);
                if (this.isNew)
                {
                    this.newItemType = NewItemType.Forward;
                }
                base.Item = base.Initialize <MeetingRequest>(EditMeetingResponse.prefetchProperties);
            }
            else
            {
                if (!ObjectClass.IsMeetingCancellation(type))
                {
                    ExTraceGlobals.CalendarDataTracer.TraceDebug <string>((long)this.GetHashCode(), "Unsupported item type '{0}' for edit meeting page", type);
                    throw new OwaInvalidRequestException(string.Format("Unsupported item type '{0}' for edit meeting page", type));
                }
                this.itemType = StoreObjectType.MeetingCancellation;
                this.isNew    = string.Equals(queryStringParameter, "Forward", StringComparison.OrdinalIgnoreCase);
                if (this.isNew)
                {
                    this.newItemType = NewItemType.Forward;
                }
                this.infobar.AddMessage(SanitizedHtmlString.FromStringId(-161808760), InfobarMessageType.Informational);
                base.Item = base.Initialize <MeetingCancellation>(EditMeetingResponse.prefetchProperties);
            }
            base.DeleteExistingDraft = this.isNew;
            if (!this.isNew && base.Item is MessageItem)
            {
                MessageItem messageItem = (MessageItem)base.Item;
                if (messageItem.GetValueOrDefault <bool>(MessageItemSchema.HasBeenSubmitted))
                {
                    messageItem.AbortSubmit();
                }
            }
            this.bodyMarkup          = BodyConversionUtilities.GetBodyFormatOfEditItem(base.Item, this.newItemType, base.UserContext.UserOptions);
            this.toolbar             = new EditMessageToolbar(((MeetingMessage)base.Item).Importance, this.bodyMarkup);
            this.toolbar.ToolbarType = (base.IsPreviewForm ? ToolbarType.Preview : ToolbarType.Form);
            this.toolbar.IsComplianceButtonAllowedInForm = false;
            this.messageRecipientWell = new MessageRecipientWell((MeetingMessage)base.Item);
            this.showBcc = this.messageRecipientWell.HasRecipients(RecipientWellType.Bcc);
        }
Exemplo n.º 4
0
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
     if (this.IsPageCacheable)
     {
         Utilities.MakePageCacheable(base.Response);
     }
     else
     {
         Utilities.MakePageNoCacheNoStore(base.Response);
     }
     this.InitializeMessage();
     if (this.PageSupportSmime && this.message != null && Utilities.IsSMime(this.message))
     {
         if (!Utilities.IsSMimeFeatureUsable(base.OwaContext))
         {
             throw new OwaNeedsSMimeControlToEditDraftException(LocalizedStrings.GetNonEncoded(-1507367759));
         }
         if (Utilities.IsFlagSet((int)base.ClientSMimeControlStatus, 1))
         {
             throw new OwaNeedsSMimeControlToEditDraftException(LocalizedStrings.GetNonEncoded(-872682934));
         }
         if (Utilities.IsFlagSet((int)base.ClientSMimeControlStatus, 2))
         {
             throw new OwaNeedsSMimeControlToEditDraftException(LocalizedStrings.GetNonEncoded(-1103993212));
         }
         if (!Utilities.CheckSMimeEditFormBasicRequirement(base.ClientSMimeControlStatus, base.OwaContext))
         {
             throw new OwaNeedsSMimeControlToEditDraftException(LocalizedStrings.GetNonEncoded(-1507367759));
         }
     }
     if (!base.UserContext.IsIrmEnabled && this.message != null && Utilities.IsIrmRestricted(this.message))
     {
         SanitizedHtmlString sanitizedHtmlString = SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(1049269714), new object[]
         {
             Utilities.GetOfficeDownloadAnchor(Microsoft.Exchange.Data.Storage.BodyFormat.TextPlain, base.UserContext.UserCulture)
         });
         throw new OwaCannotEditIrmDraftException(sanitizedHtmlString.ToString());
     }
     if (this.message != null)
     {
         string action = base.OwaContext.FormsRegistryContext.Action;
         string state  = base.OwaContext.FormsRegistryContext.State;
         if (string.CompareOrdinal(action, "Reply") == 0 || string.CompareOrdinal(action, "ReplyAll") == 0)
         {
             this.newItemType = NewItemType.Reply;
         }
         else if (string.CompareOrdinal(action, "Forward") == 0)
         {
             this.newItemType = NewItemType.Forward;
         }
         else if (string.Equals(action, "Open", StringComparison.OrdinalIgnoreCase) && string.Equals(state, "Draft", StringComparison.OrdinalIgnoreCase))
         {
             this.newItemType = NewItemType.ExplicitDraft;
             if (this.message.GetValueOrDefault <bool>(MessageItemSchema.HasBeenSubmitted))
             {
                 this.message.AbortSubmit();
             }
         }
         else
         {
             this.newItemType         = NewItemType.ImplicitDraft;
             base.DeleteExistingDraft = true;
         }
     }
     else
     {
         this.CreateDraftMessage();
     }
     if (this.message != null && Utilities.IsPublic(this.message))
     {
         throw new OwaInvalidRequestException("No way to open a public message in edit form");
     }
     if (this.IsSMimeControlNeeded && this.PageSupportSmime)
     {
         this.bodyMarkup = Markup.Html;
     }
     else
     {
         this.bodyMarkup = BodyConversionUtilities.GetBodyFormatOfEditItem(base.Item, this.newItemType, base.UserContext.UserOptions);
     }
     this.SetIsOtherFolder();
     this.infobar.SetInfobarClass("infobarEdit");
     this.infobar.SetShouldHonorHideByDefault(true);
     if (this.newItemType != NewItemType.New)
     {
         if (this.newItemType == NewItemType.ExplicitDraft)
         {
             this.infobar.AddMessage(SanitizedHtmlString.FromStringId(-1981719796), InfobarMessageType.Informational);
         }
         InfobarMessageBuilder.AddSensitivity(this.infobar, this.message);
         if (this.newItemType != NewItemType.ImplicitDraft)
         {
             InfobarMessageBuilder.AddCompliance(base.UserContext, this.infobar, this.message, true);
         }
         if (base.UserContext.IsIrmEnabled && this.message != null)
         {
             InfobarMessageBuilder.AddIrmInformation(this.infobar, this.message, false, true, false, this.IsIrmAsAttachment);
         }
         this.recipientWell       = new MessageRecipientWell(this.message);
         this.showBcc             = (this.recipientWell.HasRecipients(RecipientWellType.Bcc) || base.UserContext.UserOptions.AlwaysShowBcc);
         this.showFrom            = (this.recipientWell.HasRecipients(RecipientWellType.From) || base.UserContext.UserOptions.AlwaysShowFrom || this.isOtherFolder);
         this.toolbar             = this.BuildToolbar();
         this.toolbar.ToolbarType = (base.IsPreviewForm ? ToolbarType.Preview : ToolbarType.Form);
         this.addSignatureToBody  = base.ShouldAddSignatureToBody(this.bodyMarkup, this.newItemType);
     }
     else
     {
         this.recipientWell       = new MessageRecipientWell();
         this.showBcc             = base.UserContext.UserOptions.AlwaysShowBcc;
         this.showFrom            = (base.UserContext.UserOptions.AlwaysShowFrom || this.isOtherFolder);
         this.toolbar             = new EditMessageToolbar(Importance.Normal, this.bodyMarkup, this.IsSMimeControlMustUpdate, this.IsSMimeControlNeeded, false, false);
         this.toolbar.ToolbarType = (base.IsPreviewForm ? ToolbarType.Preview : ToolbarType.Form);
     }
     if (base.OwaContext.UserContext.IsFeatureEnabled(Feature.SMime) && this.PageSupportSmime)
     {
         if (this.IsSMimeControlNeeded && Utilities.IsFlagSet((int)base.ClientSMimeControlStatus, 4))
         {
             this.infobar.AddMessage(SanitizedHtmlString.FromStringId(330022834), InfobarMessageType.Informational);
         }
         else if (this.IsSMimeControlMustUpdate)
         {
             this.infobar.AddMessage(SanitizedHtmlString.FromStringId(1697878138), InfobarMessageType.Informational);
         }
         if (Utilities.IsSMimeControlNeededForEditForm(base.ClientSMimeControlStatus, base.OwaContext) && this.ShowFrom)
         {
             this.infobar.AddMessage(SanitizedHtmlString.FromStringId(-1863471683), InfobarMessageType.Informational);
         }
         if (!Utilities.IsFlagSet((int)base.ClientSMimeControlStatus, 1) && !Utilities.IsFlagSet((int)base.ClientSMimeControlStatus, 16) && !base.OwaContext.UserContext.IsExplicitLogonOthersMailbox)
         {
             this.infobar.AddMessage(SanitizedHtmlString.FromStringId(-1908761042), InfobarMessageType.Warning);
         }
     }
     if (this.Message != null && this.IsRemoveRestricted)
     {
         this.toolbar.IsComplianceButtonEnabledInForm = false;
     }
     if (this.ShowFrom && this.IsFromWellRestricted)
     {
         this.infobar.AddMessage(SanitizedHtmlString.FromStringId(885106754), InfobarMessageType.Informational);
     }
     if (this.message != null && this.newItemType == NewItemType.ExplicitDraft && Utilities.IsInArchiveMailbox(base.Item))
     {
         this.toolbar.IsSendButtonEnabledInForm = false;
     }
 }