private EventCreateDataViewModel GetData(Guid?groupId) { var model = new EventCreateDataViewModel { GroupId = groupId }; var currentMember = _memberService.GetCurrentMember(); model.CanEditOwner = _permissionsService.Check(PermissionType, PermissionActionEnum.EditOwner); model.PinAllowed = _permissionsService.Check(PermissionType, PermissionActionEnum.CanPin); if (model.CanEditOwner) { model.Members = GetUsersWithAccess(new PermissionSettingIdentity(PermissionActionEnum.Create, PermissionType)); } model.Links = model.GroupId.HasValue ? _feedLinkService.GetCreateLinks(ActivityType, model.GroupId.Value) : _feedLinkService.GetCreateLinks(ActivityType); var mediaSettings = _eventsService.GetMediaSettings(); model.AllowedMediaExtensions = mediaSettings.AllowedMediaExtensions; model.Tags = _tagProvider.GetAll(); model.Creator = currentMember.ToViewModel(); var now = DateTime.UtcNow; model.PublishDate = now; model.StartDate = now; model.EndDate = now.AddHours(8); return(model); }
public IEnumerable <ActivityFeedTabModel> GetTabs(IPublishedContent currentPage) { yield return(GetMainFeedTab(currentPage)); var allActivityTypes = _activityTypeProvider.All; foreach (var content in _contentProvider.GetRelatedPages()) { var tabType = GetFeedTabType(content); var activityType = allActivityTypes.SingleOrDefault(a => a.ToInt() == tabType.ToInt()); if (activityType == null) { continue; } var settings = _centralFeedService.GetSettings(tabType); yield return(new ActivityFeedTabModel { Content = content, Type = tabType, HasSubscribersFilter = settings.HasSubscribersFilter, HasPinnedFilter = settings.HasPinnedFilter, IsActive = content.IsAncestorOrSelf(currentPage), Links = _feedLinkService.GetCreateLinks(tabType) }); } }
public override ConverterResponseModel MapViewModel(UintraGroupsRoomPageModel node, UintraGroupsRoomPageViewModel viewModel) { var groupId = _context.ParseQueryString("groupId").TryParseGuid(); if (!groupId.HasValue) { return(NotFoundResult()); } var group = _groupService.Get(groupId.Value); if (group == null || group.IsHidden) { return(NotFoundResult()); } viewModel.GroupId = groupId.Value; viewModel.GroupInfo = _groupHelper.GetGroupViewModel(groupId.Value); viewModel.GroupHeader = _groupHelper.GetHeader(groupId.Value); viewModel.CreateEventsLink = _permissionsService.Check(PermissionResourceTypeEnum.Events, PermissionActionEnum.Create) ? _feedLinkService.GetCreateLinks(IntranetActivityTypeEnum.Events).Create?.AddGroupId(groupId.Value) : null; viewModel.CreateNewsLink = _permissionsService.Check(PermissionResourceTypeEnum.News, PermissionActionEnum.Create) ? _feedLinkService.GetCreateLinks(IntranetActivityTypeEnum.News).Create.AddGroupId(groupId.Value) : null; var socialCreateModel = _nodeModelService.AsEnumerable().OfType <SocialCreatePageModel>().First(); viewModel.SocialCreateModel = _nodeModelService.GetViewModel <SocialCreatePageViewModel>(socialCreateModel); return(OkResult()); }
public void Map(HomePageModel node, HomePageViewModel viewModel) { var groupId = _context.ParseQueryString("groupId").TryParseGuid(); viewModel.CreateEventsLink = _permissionsService.Check(PermissionResourceTypeEnum.Events, PermissionActionEnum.Create) ? _feedLinkService.GetCreateLinks(IntranetActivityTypeEnum.Events).Create : null; viewModel.CreateNewsLink = _permissionsService.Check(PermissionResourceTypeEnum.News, PermissionActionEnum.Create) ? _feedLinkService.GetCreateLinks(IntranetActivityTypeEnum.News).Create : null; if (node.UserListPage.Value.HasValue) { var userListPage = _nodeModelService.Get(node.UserListPage.Value.Value); viewModel.UserListPage = userListPage.Url.ToLinkModel(); } if (groupId.HasValue) { viewModel.CreateNewsLink = viewModel.CreateNewsLink?.AddGroupId(groupId.Value); viewModel.CreateEventsLink = viewModel.CreateEventsLink?.AddGroupId(groupId.Value); } var socialCreateModel = _nodeModelService.AsEnumerable().OfType <SocialCreatePageModel>().First(); viewModel.SocialCreateModel = _nodeModelService.GetViewModel <SocialCreatePageViewModel>(socialCreateModel); }
private ActivityFeedTabModel GetMainFeedTab(IPublishedContent currentPage) { var overviewPage = _contentProvider.GetOverviewPage(); var type = GetFeedTabType(overviewPage); return(new ActivityFeedTabModel { Content = overviewPage, Type = type, IsActive = overviewPage.Id == currentPage.Id, Links = _feedLinkService.GetCreateLinks(type) }); }
public ActivityFeedTabModel GetMainFeedTab(IPublishedContent currentPage, Guid groupId) { var groupRoom = _contentProvider.GetGroupRoomPage(); var type = GetFeedTabType(groupRoom); var result = new ActivityFeedTabModel { Content = groupRoom, Type = type, IsActive = groupRoom.Id == currentPage.Id, Links = _feedLinkService.GetCreateLinks(type, groupId) }; return(result); }
protected virtual CreateViewModel GetCreateViewModel(Enum activityType) { var links = _feedLinkService.GetCreateLinks(activityType); var settings = _centralFeedService.GetSettings(activityType); return(new CreateViewModel() { Links = links, Settings = settings }); }
protected virtual CreateViewModel GetCreateViewModel(Enum activityType, Guid groupId) { var links = _feedLinkService.GetCreateLinks(activityType, groupId); var settings = _groupFeedService.GetSettings(activityType); return(new CreateViewModel { Links = links, Settings = settings }); }
private SocialCreateDataViewModel GetData(Guid?groupId) { var model = new SocialCreateDataViewModel(); var currentMember = _memberService.GetCurrentMember(); model.Links = model.GroupId.HasValue ? _feedLinkService.GetCreateLinks(ActivityType, model.GroupId.Value) : _feedLinkService.GetCreateLinks(ActivityType); var mediaSettings = _socialService.GetMediaSettings(); model.AllowedMediaExtensions = mediaSettings.AllowedMediaExtensions; model.Tags = _tagProvider.GetAll(); model.Creator = currentMember.ToViewModel(); model.GroupId = groupId; model.Date = DateTime.UtcNow.ToDateFormat(); return(model); }