예제 #1
0
 protected override ActivityFeedOptions GetActivityFeedOptions(Guid activityId)
 {
     return(new ActivityFeedOptions()
     {
         Links = _feedLinkService.GetLinks(activityId)
     });
 }
예제 #2
0
 protected override ActivityFeedOptions GetActivityFeedOptions(Guid id)
 {
     return(new ActivityFeedOptions
     {
         Links = _feedLinkService.GetLinks(id),
         IsReadOnly = !IsCurrentMemberInGroup
     });
 }
        public override ConverterResponseModel MapViewModel(UintraNewsEditPageModel node, UintraNewsEditPageViewModel viewModel)
        {
            var id = _context.ParseQueryString("id").TryParseGuid();

            if (!id.HasValue)
            {
                return(NotFoundResult());
            }

            var news = _newsService.Get(id.Value);

            if (news == null || news.IsHidden)
            {
                return(NotFoundResult());
            }

            if (news.GroupId.HasValue)
            {
                var group = _groupService.Get(news.GroupId.Value);
                if (group != null && group.IsHidden)
                {
                    return(NotFoundResult());
                }
            }

            if (!_newsService.CanEdit(id.Value))
            {
                return(ForbiddenResult());
            }

            viewModel.Details                = GetDetails(news);
            viewModel.Links                  = _feedLinkService.GetLinks(news.Id);
            viewModel.CanEditOwner           = _permissionsService.Check(PermissionResourceTypeEnum.News, PermissionActionEnum.EditOwner);
            viewModel.AllowedMediaExtensions = _newsService.GetMediaSettings().AllowedMediaExtensions;
            viewModel.PinAllowed             = _permissionsService.Check(PermissionResourceTypeEnum.News, PermissionActionEnum.CanPin);

            if (viewModel.CanEditOwner)
            {
                viewModel.Members = GetUsersWithAccess(new PermissionSettingIdentity(PermissionActionEnum.Create, PermissionResourceTypeEnum.News));
            }

            var requestGroupId = HttpContext.Current.Request["groupId"];

            if (Guid.TryParse(requestGroupId, out var groupId) && news.GroupId == groupId)
            {
                viewModel.GroupHeader = _groupHelper.GetHeader(groupId);
            }

            return(OkResult());
        }
예제 #4
0
        private NewsViewModel GetDetails(Entities.News news)
        {
            var details = news.Map <NewsViewModel>();

            details.Media = MediaHelper.GetMediaUrls(news.MediaIds);

            details.LightboxPreviewModel = _lightBoxHelper.GetGalleryPreviewModel(news.MediaIds, PresetStrategies.ForActivityDetails);
            details.CanEdit          = _newsService.CanEdit(news);
            details.Links            = _feedLinkService.GetLinks(news.Id);
            details.IsReadOnly       = false;
            details.HeaderInfo       = news.Map <IntranetActivityDetailsHeaderViewModel>();
            details.HeaderInfo.Dates = news.PublishDate.ToDateTimeFormat().ToEnumerable();
            details.HeaderInfo.Owner = _memberService.Get(news).ToViewModel();
            details.HeaderInfo.Links = _feedLinkService.GetLinks(news.Id);


            return(details);
        }
        protected SocialExtendedViewModel GetViewModel(Entities.Social social)
        {
            var viewModel = social.Map <SocialViewModel>();

            viewModel.Media = MediaHelper.GetMediaUrls(social.MediaIds);

            viewModel.LightboxPreviewModel = _lightboxHelper.GetGalleryPreviewModel(social.MediaIds, PresetStrategies.ForActivityDetails);
            viewModel.CanEdit          = _socialService.CanEdit(social);
            viewModel.Links            = _feedLinkService.GetLinks(social.Id);
            viewModel.IsReadOnly       = false;
            viewModel.HeaderInfo       = social.Map <IntranetActivityDetailsHeaderViewModel>();
            viewModel.HeaderInfo.Dates = social.PublishDate.ToDateTimeFormat().ToEnumerable();
            viewModel.HeaderInfo.Owner = _memberService.Get(social).ToViewModel();
            viewModel.HeaderInfo.Links = _feedLinkService.GetLinks(social.Id);

            var extendedModel = viewModel.Map <SocialExtendedViewModel>();

            return(extendedModel);
        }
예제 #6
0
        public override ConverterResponseModel MapViewModel(SocialEditPageModel node, SocialEditPageViewModel viewModel)
        {
            var id = _context.ParseQueryString("id").TryParseGuid();

            if (!id.HasValue)
            {
                return(NotFoundResult());
            }

            var social = _socialService.Get(id.Value);

            if (social == null)
            {
                return(NotFoundResult());
            }

            if (social.GroupId.HasValue)
            {
                var group = _groupService.Get(social.GroupId.Value);
                if (group != null && group.IsHidden)
                {
                    return(NotFoundResult());
                }
            }

            if (!_socialService.CanEdit(id.Value))
            {
                return(ForbiddenResult());
            }

            viewModel.CanDelete            = _socialService.CanDelete(id.Value);
            viewModel.OwnerId              = social.OwnerId;
            viewModel.Id                   = social.Id;
            viewModel.Description          = social.Description;
            viewModel.Name                 = _localizationModelService["Social.Edit"];
            viewModel.Tags                 = _userTagService.Get(id.Value);
            viewModel.LightboxPreviewModel = _lightboxHelper.GetGalleryPreviewModel(social.MediaIds, PresetStrategies.ForActivityDetails);
            viewModel.AvailableTags        = _userTagProvider.GetAll();
            viewModel.Links                = _feedLinkService.GetLinks(social.Id);

            var mediaSettings = _socialService.GetMediaSettings();

            viewModel.AllowedMediaExtensions = mediaSettings.AllowedMediaExtensions;

            var groupId = HttpContext.Current.Request["groupId"].TryParseGuid();

            if (groupId.HasValue && social.GroupId == groupId.Value)
            {
                viewModel.GroupHeader = _groupHelper.GetHeader(groupId.Value);
            }

            return(OkResult());
        }
        private EventViewModel GetDetails(Event @event)
        {
            var details = @event.Map <EventViewModel>();

            details.Media = MediaHelper.GetMediaUrls(@event.MediaIds);

            details.LightboxPreviewModel =
                _lightBoxHelper.GetGalleryPreviewModel(@event.MediaIds, PresetStrategies.ForActivityDetails);
            details.CanEdit          = _eventsService.CanEdit(@event);
            details.Links            = _feedLinkService.GetLinks(@event.Id);
            details.IsReadOnly       = false;
            details.HeaderInfo       = @event.Map <IntranetActivityDetailsHeaderViewModel>();
            details.HeaderInfo.Dates = @event.PublishDate.ToDateTimeFormat().ToEnumerable();
            details.HeaderInfo.Owner = _memberService.Get(@event).ToViewModel();
            details.HeaderInfo.Links = _feedLinkService.GetLinks(@event.Id);
            details.CanSubscribe     = _eventsService.CanSubscribe(@event.Id);

            var subscribe = @event.Subscribers.FirstOrDefault(x => x.UserId == _memberService.GetCurrentMemberId());

            details.IsSubscribed            = subscribe != null;
            details.IsNotificationsDisabled = subscribe?.IsNotificationDisabled ?? true;

            return(details);
        }