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) }); }
/// <summary> /// Send message /// </summary> private void CreateMessage(object sender, RoutedEventArgs e) { // Create message string text = MessageBox1.Text; App.CreateMessage(ChannelId, text); // Clear draft MessageBox1.Text = ""; MessageBox1.FocusTextBox(); //Add a user activity for this channel: Task.Run(async() => { if (CurrentGuildIsDM) { await UserActivityManager.GenerateActivityAsync(LocalState.CurrentDMChannel.Id, LocalState.CurrentDMChannel.Name, Common.GetChannelIconUriString(LocalState.CurrentDMChannel.Id, LocalState.CurrentDMChannel.Icon)); } else { await UserActivityManager.GenerateActivityAsync(LocalState.CurrentGuild.Raw.Id, LocalState.CurrentGuild.Raw.Name, Common.GetGuildIconUriString(LocalState.CurrentGuild.Raw.Id, LocalState.CurrentGuild.Raw.Icon), LocalState.CurrentGuildChannel.raw.Id, "#" + LocalState.CurrentGuildChannel.raw.Name); } }); }
public override void Init(ProductContext productContext) { productContext.ThemesFolderVirtualPath = String.Concat(PathProvider.BaseVirtualPath, "App_Themes"); productContext.ImageFolder = "images"; productContext.MasterPageFile = String.Concat(PathProvider.BaseVirtualPath, "Masters/BasicTemplate.Master").ToLower(); productContext.DisabledIconFileName = "product_disabled_logo.png"; productContext.IconFileName = "product_logo.png"; productContext.LargeIconFileName = "product_logolarge.png"; productContext.DefaultSortOrder = 30; productContext.UserActivityControlLoader = new UserActivityControlLoader(); productContext.UserActivityPublishers = new List <IUserActivityPublisher> { new FilesActivityPublisher() }; UserActivityManager.AddFilter(new FilesActivityPublisher()); productContext.SubscriptionManager = new SubscriptionManager(); productContext.SpaceUsageStatManager = new FilesSpaceUsageStatManager(); productContext.AdminOpportunities = GetAdminOpportunities; productContext.UserOpportunities = GetUserOpportunities; productContext.CanNotBeDisabled = true; _moduleContext = new ModuleContext { SearchHandler = new SearchHandler(), StatisticProvider = new StatisticProvider() }; _productContext = productContext; }
private static void DoUserActivityHandler(object sender, UserActivityEventArgs e) { if (e.UserActivity != null) { if (e.UserActivity.TenantID == 0) { e.UserActivity.TenantID = CoreContext.TenantManager.GetCurrentTenant().TenantId; } //Fix url if (Uri.IsWellFormedUriString(e.UserActivity.URL, UriKind.Relative)) { //It's relative remove and make it look like ~/ if (HttpContext.Current != null) { //Get rel app app path var appPath = VirtualPathUtility.ToAbsolute("~/"); if (e.UserActivity.URL.StartsWith(appPath, StringComparison.OrdinalIgnoreCase)) { //Replace it with ~/ e.UserActivity.URL = "~/" + e.UserActivity.URL.Remove(0, appPath.Length).TrimStart('/'); } } } UserActivityManager.SaveUserActivity(e.UserActivity); } }
private bool ShowEmptyScreen() { return(!UserActivityManager.HaveUserActivity( TenantProvider.CurrentTenantID, CommunityProduct.ID, UserActivityConstants.AllActionType )); }
public static List <DocServiceParams.RecentDocument> GetRecentEditedDocument(bool forEdit, int count, string crumbsSeporator, IFileDao fileDao) { var recent = new List <DocServiceParams.RecentDocument>(); var activity = UserActivityManager.GetUserActivities(TenantProvider.CurrentTenantID, SecurityContext.CurrentAccount.ID, ProductEntryPoint.ID, null, UserActivityConstants.AllActionType, new[] { "OpenEditorFile" }, 0, 100); foreach (var entryId in activity.Select(userActivity => userActivity.ContentID.Substring("file_".Length))) { if (recent.Exists(r => r.ID.Equals(entryId))) { continue; } var fileAct = fileDao.GetFile(entryId); if (fileAct.RootFolderType == FolderType.TRASH) { continue; } if (!FileUtility.UsingHtml5(fileAct.Title)) { continue; } if (!Global.GetFilesSecurity().CanRead(fileAct)) { continue; } string uri; if (forEdit && Global.GetFilesSecurity().CanEdit(fileAct)) { uri = CommonLinkUtility.GetFileWebEditorUrl(fileAct.ID); } else { uri = CommonLinkUtility.GetFileWebViewerUrl(fileAct.ID); } var fileBreadCrumbs = Global.GetBreadCrumbs(fileAct.FolderID); recent.Add(new DocServiceParams.RecentDocument { ID = entryId, Title = fileAct.Title, Uri = CommonLinkUtility.GetFullAbsolutePath(uri), FolderPath = string.Join(crumbsSeporator, fileBreadCrumbs.Select(folder => folder.Title).ToArray()) }); if (recent.Count == count) { break; } } return(recent); }
private static IList <object[]> BuildUserActivityReport(ReportFilter filter) { var result = new List <object[]>(); var users = new List <UserInfo>(); if (filter.UserId != Guid.Empty) { users.Add(CoreContext.UserManager.GetUsers(filter.UserId)); } else if (filter.DepartmentId != Guid.Empty) { users.AddRange(CoreContext.UserManager.GetUsersByGroup(filter.DepartmentId)); } else { users.AddRange(CoreContext.UserManager.GetUsers()); } foreach (var u in users.OrderBy(u => u, UserInfoComparer.Default)) { var tasks = 0; var milestones = 0; var discussions = 0; var files = 0; var pid = ProductEntryPoint.ID; var fromDate = filter.GetFromDate(true); var toDate = filter.GetToDate(true); UserActivityManager.GetUserActivities( TenantProvider.CurrentTenantID, u.ID, pid, new[] { pid }, UserActivityConstants.AllActionType, null, fromDate, toDate) .ForEach(a => { var data = a.AdditionalData.Split(new[] { '|' })[0]; if (a.ActionType == UserActivityConstants.ContentActionType && data == EntityType.Task.ToString()) { tasks++; } if (a.ActionType == UserActivityConstants.ContentActionType && data == EntityType.Milestone.ToString()) { milestones++; } if (a.ActionType == UserActivityConstants.ContentActionType && data == EntityType.Message.ToString()) { discussions++; } if (a.ActionType == UserActivityConstants.ActivityActionType && data == EntityType.File.ToString()) { files++; } }); result.Add(new object[] { u.ID, tasks, milestones, discussions, files, tasks + milestones + discussions + files }); } return(result); }
public List <UserActivity> GetByFilter(ProjectActivityFilter filter) { var listProjects = new List <UserActivity>(); while (true) { var projects = UserActivityManager.GetProjectsActivities( TenantProvider.CurrentTenantID, EngineFactory.ProductId, filter.UserId, filter.ProjectId, filter.Type, filter.SearchText, filter.From, filter.To, filter.Offset, filter.Max, filter.LastId, filter.SortBy, filter.SortOrder); if (filter.LastId != 0) { var lastProjectIndex = projects.FindIndex(r => r.ID == filter.LastId); if (lastProjectIndex >= 0) { projects = projects.SkipWhile((r, index) => index <= lastProjectIndex).ToList(); } } listProjects.AddRange(projects); if (filter.Max <= 0 || filter.Max > 150000) { break; } listProjects = listProjects.Take((int)filter.Max).ToList(); if (listProjects.Count == filter.Max || projects.Count == 0) { break; } if (listProjects.Count != 0) { filter.LastId = (int)listProjects.Last().ID; } filter.Offset += filter.Max; } return(listProjects); }
/// <summary> /// Gets specified user activities for the Community product. /// </summary> /// <param name="userID">UserID. If the UserID is null returns activities for all of the users.</param> /// <param name="startDate"></param> /// <param name="endDate"></param> /// <returns></returns> public IList <WhatsNewUserActivity> GetUserActivities(Guid?userID, DateTime startDate, DateTime endDate) { var activities = UserActivityManager.GetUserActivities(TenantProvider.CurrentTenantID, null, CommunityProduct.ID, null, UserActivityConstants.ContentActionType, null, startDate, endDate); var userContentActivities = activities.ConvertAll(a => new UserContentActivity(a)); userContentActivities = (from u in userContentActivities orderby u.ModuleName ascending, u.Date descending select u).ToList <UserContentActivity>(); var whatsNewUserActivities = Convert(userContentActivities); return(whatsNewUserActivities); }
public IList <WhatsNewUserActivity> GetUserActivities(Guid?userID, DateTime startDate, DateTime endDate) { var result = new List <WhatsNewUserActivity>(); var activities = UserActivityManager.GetUserActivities(TenantProvider.CurrentTenantID, null, ProductEntryPoint.ID, new[] { ProductEntryPoint.ID }, UserActivityConstants.ContentActionType, null, startDate, endDate).ToList(); if (userID.HasValue) { var ids = Global.EngineFactory.GetProjectEngine() .GetByParticipant(userID.Value) .Select(p => p.ID) .Union(Global.EngineFactory.GetParticipantEngine().GetFollowingProjects(userID.Value)); activities = activities.FindAll(a => ids.Contains(Convert.ToInt32(a.ContainerID))); } if (activities.Count != 0) { activities.Sort((x, y) => { var proj1 = int.Parse(x.ContainerID); var proj2 = int.Parse(y.ContainerID); var compare = proj1.CompareTo(proj2); return(compare != 0 ? compare : DateTime.Compare(x.Date, y.Date)); }); activities.ForEach(a => { var parts = a.AdditionalData.Split(new[] { '|' }); if (3 <= parts.Length) { var projectTitle = parts[2]; var timeLineType = (EntityType)Enum.Parse(typeof(EntityType), parts[0]); result.Add(new WhatsNewUserActivity { Title = a.Title, Date = a.Date, URL = CommonLinkUtility.GetFullAbsolutePath(a.URL), UserAbsoluteURL = CommonLinkUtility.GetFullAbsolutePath(CommonLinkUtility.GetUserProfile(a.UserID, CommonLinkUtility.GetProductID())), UserName = DisplayUserSettings.GetFullUserName(a.UserID), BreadCrumbs = new List <String> { string.Format("[{0}]", projectTitle), ResourceEnumConverter.ConvertToString(timeLineType) } }); } }); } return(result); }
public override void Init(ProductContext productContext) { if (!DbRegistry.IsDatabaseRegistered(Global.DB_ID)) { DbRegistry.RegisterDatabase(Global.DB_ID, WebConfigurationManager.ConnectionStrings[Global.DB_ID]); } new SearchHandler(); ConfigurationManager.Configure(ID, PathProvider.BaseVirtualPath, String.Empty, Global.FileStorageModule); productContext.ThemesFolderVirtualPath = String.Concat(PathProvider.BaseVirtualPath, "App_Themes"); productContext.ImageFolder = "images"; productContext.MasterPageFile = String.Concat(PathProvider.BaseVirtualPath, "Masters/BasicTemplate.Master"); productContext.DisabledIconFileName = "product_disabled_logo.png"; productContext.IconFileName = "product_logo.png"; productContext.LargeIconFileName = "product_logolarge.png"; productContext.SubscriptionManager = new ProductSubscriptionManager(); productContext.UserActivityControlLoader = new ProjectActivity(); productContext.WhatsNewHandler = new WhatsNewHandler(); productContext.UserActivityPublishers = new List <IUserActivityPublisher>() { new TimeLinePublisher() }; productContext.DefaultSortOrder = 10; productContext.SpaceUsageStatManager = new ProjectsSpaceUsageStatManager(); productContext.AdminOpportunities = GetAdminOpportunities; productContext.UserOpportunities = GetUserOpportunities; productContext.HasComplexHierarchyOfAccessRights = true; context = productContext; NotifyClient.Instance.Client.RegisterSendMethod(SendMsgMilestoneDeadline, TimeSpan.FromDays(1), DateTime.UtcNow.Date.AddHours(7)); NotifyClient.Instance.Client.RegisterSendMethod(ReportHelper.SendAutoReports, TimeSpan.FromHours(1), DateTime.UtcNow.Date.AddHours(DateTime.UtcNow.Hour)); NotifyClient.Instance.Client.RegisterSendMethod(TaskHelper.SendAutoReminderAboutTask, TimeSpan.FromHours(1), DateTime.UtcNow.Date.AddHours(DateTime.UtcNow.Hour)); NotifyClient.Instance.Client.AddInterceptor(InterceptorSecurity); UserActivityManager.AddFilter(new WhatsNewHandler()); FilesIntegration.RegisterFileSecurityProvider("projects", "project", new SecurityAdapterProvider()); SearchHandlerManager.Registry(new SearchHandler()); }
protected void Page_Load(object sender, EventArgs e) { if (UserID == Guid.Empty) { UserID = SecurityContext.CurrentAccount.ID; } var filter = new TaskFilter { ParticipantId = UserID, MyProjects = true }; var tasks = Global.EngineFactory.GetTaskEngine().GetByFilter(filter); var projects = Global.EngineFactory.GetProjectEngine().GetByParticipant(UserID).Select(prj => new ProjectVm(prj)).OrderBy(r => r.ProjectTitle).ToList(); foreach (var project in projects) { project.OpenedTasksCount = tasks.Count(t => t.Project.ID == project.ProjectId && t.Status == TaskStatus.Open); project.ClosedTasksCount = tasks.Count(t => t.Project.ID == project.ProjectId && t.Status == TaskStatus.Closed); } ProjectsRepeater.DataSource = projects; ProjectsRepeater.DataBind(); //load user activity // var activities = UserActivityManager.GetUserActivities( TenantProvider.CurrentTenantID, UserID, ProductEntryPoint.ID, new[] { ProductEntryPoint.ID }, UserActivityConstants.AllActionType, null, 0, 10); LastActivityRepeater.DataSource = activities.ConvertAll(a => new ActivityVm(a)); LastActivityRepeater.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { ltRecentActivity.Text = Resources.Resource.RecentActivity; uaRecentActivity.Activities = UserActivityManager.GetUserActivities(TenantProvider.CurrentTenantID, UserID, ProductID, null, UserActivityConstants.AllActionType, null, 0, 10) .ConvertAll <UserContentActivity>(a => new UserContentActivity(a)); }
private void SendMsgWhatsNew(DateTime scheduleDate) { var log = LogManager.GetLogger("ASC.Notify.WhatsNew"); log.Info("Start send whats new."); SecurityContext.AuthenticateMe(ASC.Core.Configuration.Constants.CoreSystem); var products = new List <IProduct>(ProductManager.Instance.Products); if (products.Count == 0) { return; } products.Sort((p1, p2) => string.Compare(p1.Name, p2.Name)); var tenants = UserActivityManager.GetChangedTenants(scheduleDate.AddDays(-1), scheduleDate); foreach (var tenantid in tenants) { try { var tenant = CoreContext.TenantManager.GetTenant(tenantid); if (tenant == null || tenant.Status != TenantStatus.Active) { continue; } if (!TimeToSendWhatsNew(TenantUtil.DateTimeFromUtc(tenant, scheduleDate))) { continue; } CoreContext.TenantManager.SetCurrentTenant(tenant); log.InfoFormat("Start send whats new in {0} ({1}).", tenant.MappedDomain, tenantid); foreach (var user in CoreContext.UserManager.GetUsers()) { var recipient = user; if (!IsSubscribeToWhatsNew(recipient)) { continue; } var activities = new Dictionary <string, IList <WhatsNewUserActivity> >(); foreach (var product in products) { if (product.Context.WhatsNewHandler == null || string.IsNullOrEmpty(product.Name) || !WebItemSecurity.IsAvailableForUser(product.ID.ToString(), user.ID)) { continue; } if (!activities.ContainsKey(product.Name)) { var whatsNewActivities = product.Context.WhatsNewHandler.GetUserActivities(user.ID, scheduleDate.AddDays(-1), scheduleDate); if (whatsNewActivities != null && whatsNewActivities.Count != 0) { activities.Add(product.Name, whatsNewActivities); } } } if (0 < activities.Count) { log.InfoFormat("Send whats new to {0} <{1}>.", recipient.DisplayUserName(), recipient.Email); client.SendNoticeAsync( Constants.ActionSendWhatsNew, null, recipient, null, new TagValue(Constants.TagActivities, activities), new TagValue(Constants.TagDate, scheduleDate.AddDays(-1).ToString("M")) ); } } } catch (Exception error) { log.Error(error); } } }
public Dictionary <int, DateTime> GetLastActivity(IEnumerable <string> projectIds) { return(UserActivityManager.GetProjectsActivities(TenantProvider.CurrentTenantID, EngineFactory.ProductId, projectIds)); }
public AjaxResponse ShowRecentActivity(Guid productId, List <Guid> moduleIds, string strFromDate, string strToDate, int type, int currentPage, Guid userOrDeptID) { if (!SecurityContext.AuthenticateMe(CookiesManager.GetCookies(CookiesType.AuthKey))) { throw new UnauthorizedAccessException("Unauthorized"); } var resp = new AjaxResponse(); var fromDate = Convert.ToDateTime(strFromDate); var toDate = Convert.ToDateTime(strToDate); var actionType = UserActivityConstants.ActivityActionType; if (type == 0) { actionType = UserActivityConstants.AllActionType; } if (type == 1) { actionType = UserActivityConstants.ContentActionType; } var userActivity = UserActivityManager.GetUserActivities( TenantProvider.CurrentTenantID, userOrDeptID, productId, moduleIds, actionType, null, fromDate, toDate.AddDays(1)); var activityContainer = userActivity.ConvertAll(rec => new ActivityContainer { UserProfileLink = ASC.Core.Users.StudioUserInfoExtension.RenderProfileLink(ASC.Core.CoreContext.UserManager.GetUsers(rec.UserID), rec.ProductID), ActionText = rec.ActionText.ToLower(), URL = CommonLinkUtility.GetFullAbsolutePath(rec.URL), Title = rec.Title.HtmlEncode(), ModuleName = GetModuleName(rec), ModuleIconUrl = GetModuleIconUrl(rec), Date = rec.Date.ToString(DateTimeExtension.DateFormatPattern), AgoSentence = GetAgoSentence(rec.Date) }); var CountShowOnPage = 15; var countTotal = activityContainer.Count; var amountPage = Convert.ToInt32(Math.Ceiling(countTotal / (CountShowOnPage * 1.0))); currentPage = currentPage > 0 ? currentPage : 1; if (amountPage != 0) { currentPage = currentPage <= amountPage ? currentPage : amountPage; } resp.rs10 = "5"; //CountVisiblePage resp.rs11 = amountPage.ToString(); resp.rs12 = currentPage.ToString(); resp.rs13 = Resource.BackButton; resp.rs14 = Resource.NextButton; var result = new List <ActivityContainer>(); for (var i = (currentPage - 1) * CountShowOnPage; i < currentPage * CountShowOnPage && i < activityContainer.Count; i++) { result.Add(activityContainer[i]); } resp.rs1 = JavaScriptSerializer.Serialize(result); return(resp); }
public void ProcessRequest(HttpContext context) { //Process authorization if (!ProcessAuthorization(context)) { AccessDenied(context); return; } var productId = Helpers.ParseGuid(context.Request[ProductParam]); var moduleIds = Helpers.ParseGuids(context.Request[ModuleParam]); var actionType = Helpers.ParseInt(context.Request[ActionTypeParam]); var containerIds = Helpers.Tokenize(context.Request[ContainerParam]); var title = context.Request[TitleParam]; if (string.IsNullOrEmpty(title)) { title = Resources.Resource.RecentActivity; } var userIds = Helpers.ParseGuid(context.Request[UserParam]); if (userIds.HasValue) { throw new NotImplementedException(); } var userActivity = UserActivityManager.GetUserActivities( TenantProvider.CurrentTenantID, null, productId.GetValueOrDefault(), moduleIds, actionType.GetValueOrDefault(), containerIds, 0, 100); var feedItems = userActivity.Select(x => { var user = CoreContext.UserManager.GetUsers(x.UserID); var veloContext = Formatter.PrepareContext(x, user); var item = new SyndicationItem( HttpUtility.HtmlDecode(Formatter.Format(context, "title.txt", veloContext)), SyndicationContent.CreateHtmlContent(Formatter.Format(context, "pattern.html", veloContext)), new Uri(CommonLinkUtility.GetFullAbsolutePath(x.URL)), x.ID.ToString(), new DateTimeOffset(TenantUtil.DateTimeToUtc(x.Date))) { PublishDate = x.Date, Summary = SyndicationContent.CreatePlaintextContent(Formatter.Format(context, "pattern.txt", veloContext)) }; var person = new SyndicationPerson(user.Email) { Name = user.UserName }; if (productId.HasValue) { person.Uri = CommonLinkUtility.GetUserProfile(user.ID, productId.Value); } item.Authors.Add(person); return(item); }); var lastUpdate = new DateTimeOffset(DateTime.UtcNow); if (userActivity.Count > 0) { lastUpdate = new DateTimeOffset(userActivity.Max(x => x.Date)); } var feed = new SyndicationFeed( title, Resources.Resource.RecentActivity, new Uri(context.Request.GetUrlRewriter(), VirtualPathUtility.ToAbsolute(Studio.WhatsNew.PageUrl)), TenantProvider.CurrentTenantID.ToString(), lastUpdate, feedItems); var rssFormatter = new Atom10FeedFormatter(feed); //Set writer settings var settings = new XmlWriterSettings(); settings.CheckCharacters = false; settings.ConformanceLevel = ConformanceLevel.Document; settings.Encoding = Encoding.UTF8; settings.Indent = true; using (var writer = XmlWriter.Create(context.Response.Output, settings)) { rssFormatter.WriteTo(writer); } context.Response.Charset = Encoding.UTF8.WebName; context.Response.ContentType = "application/atom+xml"; }
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); } } }