protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); Title = (!String.IsNullOrEmpty(Title) ? Title : Resources.Resource.RecentActivity); var activityBox = (RecentActivityBox)TemplateControl.LoadControl(RecentActivityBox.Location); activityBox.userActivityList = UserActivityManager.GetUserActivities( TenantId, UserId, ProductId, new[] { ModuleId }, UserActivityConstants.AllActionType, null, 0, MaxItems); activityBox.MaxLengthTitle = 20; activityBox.ItemCSSClass = ItemCSSClass; Controls.Add(activityBox); Controls.Add(new LiteralControl { Text = string.Format("<div style='margin:10px 20px 0 20px;'><a href='{0}'>{1}</a></div>", WhatsNew.GetUrlForModule(ProductId, ModuleId), Resources.Resource.ToWhatsNewPage) }); }
protected void Page_Load(object sender, EventArgs e) { ((CommunityMasterPage)this.Master).DisabledSidePanel = true; this.Title = Resources.CommunityResource.MainPageTitle; if (ShowEmptyScreen()) { var dashboardEmptyScreen = (DashboardEmptyScreen)Page.LoadControl(DashboardEmptyScreen.Location); AddContent.Controls.Add(dashboardEmptyScreen); return; } _widgetTabControl = new WidgetTab(new Guid("{57DAD9FA-BBB8-4a3a-B208-D3CD58691D35}"), ColumnSchemaType.Schema_25_50_25, "communityDashboard" ); var modules = new List <ASC.Web.Core.ModuleManagement.Module>(); foreach (var item in WebItemManager.Instance.GetSubItems(CommunityProduct.ID)) { if ((item is ASC.Web.Core.ModuleManagement.Module) == false) { continue; } var module = item as ASC.Web.Core.ModuleManagement.Module; modules.Add(module); foreach (var widget in module.Widgets) { try { _widgetTabControl.WidgetCollection.Add(GetWidgetControl(module, widget)); } catch (Exception ex) { //TODO: draw error control or something _widgetTabControl.WidgetCollection.Add(GetBrokenWidgetControl(ex)); } } } _widgetTabControl.WidgetCollection.Add(new Widget(BirthdayReminderWidget.WidgetID, new BirthdayReminderWidget() { ProductID = CommunityProduct.ID }, Resources.CommunityResource.BirthdayReminderWidgetName, Resources.CommunityResource.BirthdayReminderWidgetDescription) { ImageURL = WebImageSupplier.GetAbsoluteWebPath("birthday_widget.png"), SettingsProviderType = typeof(StudioWidgetSettingsProvider), UsePositionAttribute = true }); _widgetTabControl.WidgetCollection.Add(new Widget(NewEmployeeWidget.WidgetID, new NewEmployeeWidget() { ProductID = CommunityProduct.ID }, CustomNamingPeople.Substitute <Resources.CommunityResource>("NewEmployeeWidgetName"), Resources.CommunityResource.NewEmployeeWidgetDescription) { ImageURL = WebImageSupplier.GetAbsoluteWebPath("newemp_widget.png"), SettingsProviderType = typeof(StudioWidgetSettingsProvider), UsePositionAttribute = true }); var widgetSettings = SettingsManager.Instance.LoadSettingsFor <ProductActivityWidgetSettings>(SecurityContext.CurrentAccount.ID); ProductActivity productActivityControl = (ProductActivity)LoadControl(ProductActivity.Location); productActivityControl.ProductId = CommunityProduct.ID; productActivityControl.Activities = UserActivityManager.GetUserActivities( TenantProvider.CurrentTenantID, null, CommunityProduct.ID, null, UserActivityConstants.ContentActionType, null, 0, widgetSettings.CountActivities) .ConvertAll(a => new UserContentActivity(a)); _widgetTabControl.WidgetCollection.Add(new Widget(ProductActivity.WidgetID, productActivityControl, Resources.CommunityResource.CommunityActivityWidgetName, Resources.CommunityResource.CommunityActivityWidgetDescription) { ImageURL = WebImageSupplier.GetAbsoluteWebPath("lastadded_widget.png"), SettingsProviderType = typeof(StudioWidgetSettingsProvider), Position = new Point(0, 2), WidgetURL = WhatsNew.GetUrlForModule(Product.CommunityProduct.ID, null) }); WidgetsContent.Controls.Add(_widgetTabControl); NavigationPanel NavigationPanel = (NavigationPanel)this.LoadControl(NavigationPanel.Location); NavigationPanelContent.Controls.Add(NavigationPanel); if (SecurityContext.CurrentAccount.IsAuthenticated) { NavigationPanel.addButton(Resources.CommunityResource.BtnCustomizeWidgets, WebImageSupplier.GetAbsoluteWebPath("btn_managewidgets.png"), "javascript:communityDashboard.ShowSettings()", 3); if (modules.Count > 0) { NavigationPanel.addButton(Resources.CommunityResource.BtnAddContent, WebImageSupplier.GetAbsoluteWebPath("btn_addcontent.png"), "javascript:StudioManager.ShowAddContentDialog()", 2); AddContentControl AddCntnt = (AddContentControl)this.LoadControl(AddContentControl.Location); foreach (var module in modules) { try { AddCntnt.Types.Add(new AddContentControl.ContentTypes { Link = module.Context.GetCreateContentPageAbsoluteUrl(), Icon = (module as IWebItem).GetIconAbsoluteURL(), Label = module.Name }); } catch (Exception) { AddCntnt.Types.Add(new AddContentControl.ContentTypes { Link = "#", Icon = string.Empty, Label = "Error loading " + module.Name }); } } AddContent.Controls.Add(AddCntnt); } } }