// Token: 0x06002740 RID: 10048 RVA: 0x000DFB70 File Offset: 0x000DDD70
        protected override void OnLoad(EventArgs e)
        {
            ExTraceGlobals.CalendarCallTracer.TraceDebug(0L, "CalendarView.OnLoad");
            this.Infobar = new Infobar();
            this.readingPaneMarkupBegin = SanitizedHtmlString.Format("{0}{1}{2}", new object[]
            {
                "<iframe allowtransparency id=\"ifCalRP\" frameborder=\"0\" src=\"",
                base.UserContext.GetBlankPage(),
                "\""
            });
            string           queryStringParameter = Utilities.GetQueryStringParameter(base.Request, "id", false);
            OwaStoreObjectId owaStoreObjectId;

            if (queryStringParameter != null)
            {
                owaStoreObjectId = OwaStoreObjectId.CreateFromString(queryStringParameter);
            }
            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");
            }
            string queryStringParameter2 = Utilities.GetQueryStringParameter(base.Request, "d", false);

            ExDateTime[] days = null;
            if (queryStringParameter2 != null)
            {
                try
                {
                    days = new ExDateTime[]
                    {
                        DateTimeUtilities.ParseIsoDate(queryStringParameter2, base.UserContext.TimeZone).Date
                    };
                }
                catch (OwaParsingErrorException)
                {
                    ExTraceGlobals.CalendarTracer.TraceDebug <string>(0L, "Invalid date provided on URL '{0}'", queryStringParameter2);
                    throw new OwaInvalidRequestException("Invalid date on URL");
                }
            }
            if (base.UserContext.IsWebPartRequest)
            {
                string text = Utilities.GetQueryStringParameter(base.Request, "view", false);
                if (string.IsNullOrEmpty(text))
                {
                    text = WebPartUtilities.GetDefaultView("IPF.Appointment");
                }
                if (string.Equals(text, "daily", StringComparison.OrdinalIgnoreCase))
                {
                    this.viewType = CalendarViewType.Min;
                }
                else if (string.CompareOrdinal(text, "monthly") == 0)
                {
                    this.viewType = CalendarViewType.Monthly;
                }
                else
                {
                    this.viewType = CalendarViewType.Weekly;
                }
            }
            this.calendarAdapter = new CalendarAdapter(base.UserContext, owaStoreObjectId);
            this.calendarAdapter.LoadData(CalendarUtilities.QueryProperties, days, true, ref this.viewType, out this.viewWidth, out this.readingPanePosition);
            if (!this.calendarAdapter.UserCanReadItem)
            {
                return;
            }
            owaStoreObjectId = this.calendarAdapter.FolderId;
            using (CalendarAdapter calendarAdapter = new CalendarAdapter(base.UserContext, owaStoreObjectId))
            {
                if (this.viewType == CalendarViewType.Monthly)
                {
                    this.contentView = new CalendarView.ContentView(new DailyView(base.UserContext, calendarAdapter), new MonthlyView(base.UserContext, this.calendarAdapter), false);
                }
                else
                {
                    this.contentView = new CalendarView.ContentView(new DailyView(base.UserContext, this.calendarAdapter), new MonthlyView(base.UserContext, calendarAdapter), true);
                }
            }
            if (this.viewType != CalendarViewType.Monthly)
            {
                string queryStringParameter3 = Utilities.GetQueryStringParameter(base.Request, "srp", false);
                int    num;
                if (!string.IsNullOrEmpty(queryStringParameter3) && int.TryParse(queryStringParameter3, out num))
                {
                    this.readingPanePosition        = ((num != 0) ? ReadingPanePosition.Right : ReadingPanePosition.Off);
                    this.requestReadingPanePosition = this.readingPanePosition;
                }
            }
            else
            {
                this.readingPanePosition = ReadingPanePosition.Off;
            }
            string queryStringParameter4 = Utilities.GetQueryStringParameter(base.Request, "sid", false);

            if (queryStringParameter4 != null)
            {
                OwaStoreObjectId selectedItemId = OwaStoreObjectId.CreateFromString(queryStringParameter4);
                this.contentView.MainView.SelectedItemId = selectedItemId;
            }
            OwaSingleCounters.CalendarViewsLoaded.Increment();
            base.OnLoad(e);
        }
        // Token: 0x060021E8 RID: 8680 RVA: 0x000C18B0 File Offset: 0x000BFAB0
        protected override void LoadViewState()
        {
            OwaStoreObjectId owaStoreObjectId = null;

            if (base.SerializedContainerId != null)
            {
                if (OwaStoreObjectId.IsDummyArchiveFolder(base.SerializedContainerId))
                {
                    owaStoreObjectId         = base.UserContext.GetArchiveRootFolderId();
                    this.archiveRootFolderId = owaStoreObjectId.ToString();
                }
                else
                {
                    owaStoreObjectId = OwaStoreObjectId.CreateFromString(base.SerializedContainerId);
                }
            }
            if (owaStoreObjectId == null)
            {
                base.AlgorithmTracer.TraceDebug((long)this.GetHashCode(), "folder Id is null, using default folder");
                owaStoreObjectId = OwaStoreObjectId.CreateFromMailboxFolderId(this.DefaultFolderId);
            }
            PropertyDefinition[] array = new PropertyDefinition[]
            {
                FolderSchema.DisplayName,
                FolderSchema.ItemCount,
                FolderSchema.UnreadCount,
                ViewStateProperties.ReadingPanePosition,
                ViewStateProperties.ViewWidth,
                ViewStateProperties.ViewHeight,
                ViewStateProperties.MultiLine,
                ViewStateProperties.SortColumn,
                ViewStateProperties.SortOrder,
                ViewStateProperties.ViewFilter,
                ViewStateProperties.FilteredViewLabel,
                FolderSchema.SearchFolderAllowAgeout,
                FolderSchema.IsOutlookSearchFolder,
                FolderSchema.AdminFolderFlags,
                FolderSchema.FolderQuota,
                FolderSchema.FolderSize,
                FolderSchema.ELCFolderComment,
                FolderSchema.ELCPolicyIds,
                FolderSchema.ExtendedFolderFlags,
                StoreObjectSchema.EffectiveRights,
                FolderSchema.OutlookSearchFolderClsId
            };
            this.folder = Utilities.GetFolderForContent <Folder>(base.UserContext, owaStoreObjectId, array);
            this.favoritesFilterParameter = Utilities.GetFavoritesFilterViewParameter(base.UserContext, this.Folder);
            if (this.folder is SearchFolder && this.favoritesFilterParameter != null && !this.favoritesFilterParameter.IsCurrentVersion)
            {
                this.favoritesFilterParameter.UpgradeFilter(this.folder as SearchFolder, array);
            }
            this.sortOrder           = this.DefaultSortOrder;
            this.sortedColumn        = this.DefaultSortedColumn;
            this.isMultiLine         = this.DefaultMultiLineSetting;
            this.readingPanePosition = this.DefaultReadingPanePosition;
            FolderViewStates folderViewStates = base.UserContext.GetFolderViewStates(this.folder);

            if (base.UserContext.IsWebPartRequest)
            {
                string          queryStringParameter = Utilities.GetQueryStringParameter(base.Request, "view", false);
                WebPartListView webPartListView      = WebPartUtilities.LookUpWebPartView(this.folder.Id.ObjectId.ObjectType, this.folder.ClassName, queryStringParameter);
                if (webPartListView != null)
                {
                    if (webPartListView.ColumnId != null)
                    {
                        this.sortedColumn = (ColumnId)webPartListView.ColumnId.Value;
                    }
                    if (webPartListView.SortOrder != null)
                    {
                        this.sortOrder = (SortOrder)webPartListView.SortOrder.Value;
                    }
                    if (webPartListView.IsMultiLine != null)
                    {
                        this.isMultiLine = webPartListView.IsMultiLine.Value;
                    }
                }
            }
            else
            {
                this.viewWidth   = folderViewStates.ViewWidth;
                this.viewHeight  = folderViewStates.ViewHeight;
                this.sortOrder   = folderViewStates.GetSortOrder(this.DefaultSortOrder);
                this.isMultiLine = folderViewStates.GetMultiLine(this.DefaultMultiLineSetting);
                string sortColumn = folderViewStates.GetSortColumn(null);
                if (sortColumn != null)
                {
                    ColumnId columnId = ColumnIdParser.Parse(sortColumn);
                    if (columnId < ColumnId.Count && (!this.isMultiLine || ListViewColumns.GetColumn(columnId).SortBoundaries != null))
                    {
                        this.sortedColumn = columnId;
                    }
                }
            }
            if (ConversationUtilities.IsConversationSortColumn(this.sortedColumn) && !ConversationUtilities.ShouldAllowConversationView(base.UserContext, this.Folder))
            {
                this.sortedColumn = ColumnId.DeliveryTime;
            }
            this.readingPanePosition = folderViewStates.GetReadingPanePosition(this.DefaultReadingPanePosition);
            this.LoadELCData();
        }
Exemple #3
0
        /// <summary>
        /// Display all active Web Parts to the Web Part grid for the specified Web Application
        /// </summary>
        private void DisplayActiveWebParts(SPWebApplication webApp)
        {
            try
            {
                // Process search criteria
                bool   includeSubSites           = wp_type_subsites.Checked;
                bool   includeSharePointWebParts = wp_type_SharePoint2007.Checked;
                bool   includeCustomWebParts     = wp_type_custom.Checked;
                string urlFilter     = wp_url_search.Text == "<Site Collection / Site>" ? string.Empty : wp_url_search.Text.Trim();
                string keywordFilter = wp_webpart_search.Text == "<Web Part Search>" ? string.Empty : wp_webpart_search.Text.Trim().ToLower();

                try
                {
                    // Validate URL filter format
                    if (urlFilter != string.Empty)
                    {
                        new Uri(urlFilter);
                    }
                }
                catch (UriFormatException)
                {
                    MessageBox.Show("Please enter a valid URL filter", "URL Format Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                if (urlFilter == string.Empty || includeSubSites)
                {
                    DialogResult dialogResult = MessageBox.Show("Your search criteria may generate a large number of results, do you want to continue?", "Search Criteria Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                    if (dialogResult != DialogResult.Yes)
                    {
                        return;
                    }
                }

                collectionLabel.Text = "Total Web Parts: Loading...Please Wait";
                this.Invalidate();
                this.Update();

                WebPartUtilities        webpartUtilities = new WebPartUtilities();
                List <WebPartToDisplay> allWebParts      = new List <WebPartToDisplay>();
                if (urlFilter != string.Empty)
                {
                    // Apply a URL filter
                    using (SPSite site = new SPSite(urlFilter))
                    {
                        using (SPWeb web = site.OpenWeb())
                        {
                            allWebParts = webpartUtilities.GetAllWebPartsInWeb(web, includeSubSites, includeSharePointWebParts, includeCustomWebParts);
                        }
                    }
                }
                else
                {
                    // No URL filter, go through each site collection
                    foreach (SPSite site in webApp.Sites)
                    {
                        using (SPWeb web = site.RootWeb)
                        {
                            allWebParts.AddRange(webpartUtilities.GetAllWebPartsInWeb(web, includeSubSites, includeSharePointWebParts, includeCustomWebParts));
                        }
                        site.Dispose();
                    }
                }

                if (!webPartGrid.Columns.Contains("Zone"))
                {
                    webPartGrid.Columns.Add("Zone", "Zone");
                }
                if (!webPartGrid.Columns.Contains("WebPartTitle"))
                {
                    webPartGrid.Columns.Add("WebPartTitle", "Title");
                }
                if (!webPartGrid.Columns.Contains("Description"))
                {
                    webPartGrid.Columns.Add("Description", "Description");
                }

                foreach (WebPartToDisplay webpartToDisplay in allWebParts)
                {
                    if (keywordFilter != string.Empty)
                    {
                        if (!webpartToDisplay.Title.ToLower().Contains(keywordFilter) &&
                            !webpartToDisplay.Type.ToLower().Contains(keywordFilter))
                        {
                            continue;
                        }
                    }

                    int             rowIndex = webPartGrid.Rows.Add();
                    DataGridViewRow row      = webPartGrid.Rows[rowIndex];
                    row.Cells["webURL"].Value       = webpartToDisplay.PageUrl;
                    row.Cells["WebPart"].Value      = webpartToDisplay.Type;
                    row.Cells["webType"].Value      = webpartToDisplay.Category;
                    row.Cells["WebScope"].Value     = webpartToDisplay.Visible ? "Visible" : "Hidden";
                    row.Cells["Description"].Value  = webpartToDisplay.Description;
                    row.Cells["Zone"].Value         = webpartToDisplay.Zone;
                    row.Cells["WebPartTitle"].Value = webpartToDisplay.Title;
                }

                webPartGrid.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
                collectionLabel.Text = "Total Web Parts: " + (webPartGrid.Rows.Count - 1);
            }
            catch (Exception ex)
            {
                collectionLabel.Text = "Total Web Parts: 0";
                if (DEBUG_MODE.Checked)
                {
                    MessageBox.Show("Error in DisplayActiveWebParts:\n" + ex.ToString());
                }
            }
        }