public ContentListViewModel PostPodcastList() { ContentListViewModel result = new ContentListViewModel(); try { string token = GetRequestHeader(); User user = UnitOfWork.UserRepository.GetByToken(token); if (user != null) { result.Result = GetVideoList(_podcastContentTypeId, user.Id); result.Status = status.ReturnStatus(0, Resources.Messages.SuccessPost, true); } else { result.Result = null; result.Status = status.ReturnStatus(100, Resources.Messages.InvalidUser, false); } } catch (Exception) { result.Result = null; result.Status = status.ReturnStatus(100, Resources.Messages.CatchError, false); } return(result); }
public ActionResult VirtualIndex(string tabId, int parentId) { var result = ContentService.InitList(parentId, true); var model = ContentListViewModel.Create(result, tabId, parentId); return(JsonHtml("Index", model)); }
public async Task <ActionResult> Index(string tabId, int parentId) { var result = ContentService.InitList(parentId); var model = ContentListViewModel.Create(result, tabId, parentId); return(await JsonHtml("Index", model)); }
public async Task <IActionResult> Edit(int id, string type) { var contentList = await _contentListService.FindByIdAsync(id).ConfigureAwait(false); var m = new ContentListViewModel { Title = contentList.Title, Id = contentList.Id, Pic = contentList.Pic, Thumbnail = contentList.Thumbnail, Description = contentList.Description, IsPublish = contentList.IsPublish, RegisterDate = contentList.PublishDateTime.ToShortPersianDateString(), RegisterTime = contentList.PublishDateTime != null?contentList.PublishDateTime.Value.ToString("h:mm:tt") : "", Content = contentList.Content != null ? contentList.Content.Replace("../../content/files/editor/", "/content/files/editor/") .Replace("../content/files/editor/", "/content/files/editor/") .Replace("..//content/files/editor/", "/content/files/editor/") : "", Type = contentList.Type, Tags = contentList.ContentListTags != null?string.Join(",", contentList.ContentListTags?.Where(d => d.Type == "cat").Select(d => d.TagId)) : null, Styles = contentList.ContentListTags != null?string.Join(",", contentList.ContentListTags?.Where(d => d.Type == "style").Select(d => d.TagId)) : null, Artists = contentList.ContentListTags != null?string.Join(",", contentList.ContentListTags?.Where(d => d.Type == "artist").Select(d => d.TagId)) : null, Musics = contentList.ContentListTags != null?string.Join(",", contentList.ContentListTags?.Where(d => d.Type == "music").Select(d => d.TagId)) : null, ContentListTags = contentList.ContentListTags }; return(View(viewName: nameof(Edit), model: m)); }
// GET: /SiteContent/ public ActionResult Index() { var model = new ContentListViewModel(); model = model.Populate(db); return(View(model)); }
/// <summary> /// Gets the last post dates for each blog in the model that has blog posts. /// </summary> /// <param name="model">The blog model.</param> /// <returns>Prefetched dictionary containing last post date for each blog in the model that has blog posts.</returns> public static IDictionary <Guid, DateTime> GetLastPostDates(this ContentListViewModel model) { const int BatchSize = 200; var ids = model.Items.Select(vm => vm.DataItem.Id).ToArray(); var blogPosts = BlogsManager.GetManager(model.ProviderName).GetBlogPosts().Where(i => i.Status == ContentLifecycleStatus.Master); IEnumerable <KeyValuePair <Guid, DateTime> > blogsWithChildPosts; if (ids.Length <= BatchSize) { blogsWithChildPosts = BlogPostHelper.PartialBlogsLastPostDates(ids, blogPosts); } else { var tempResult = new List <KeyValuePair <Guid, DateTime> >(ids.Length); // Integer division, rounded up var pagesCount = (ids.Length + BatchSize - 1) / BatchSize; for (var p = 0; p < pagesCount; p++) { var batch = ids.Skip(p * BatchSize).Take(BatchSize).ToArray(); tempResult.AddRange(BlogPostHelper.PartialBlogsLastPostDates(batch, blogPosts)); } blogsWithChildPosts = tempResult; } var result = blogsWithChildPosts.ToDictionary(k => k.Key, k => k.Value); return(result); }
public ContentListView(Space space, ConfluenceToolWindowNavigatorViewModel parent) { InitializeComponent(); this._viewModel = new ContentListViewModel(space, parent); this.DataContext = this._viewModel; }
public ActionResult Archived() { var model = new ContentListViewModel(); model = model.PopulateArchived(db); //if (!model.Items.Any()) return HttpNotFound(); return(View(model)); }
/// <summary> /// Gets a collection of <see cref="CacheDependencyNotifiedObject"/>. /// The <see cref="CacheDependencyNotifiedObject"/> represents a key for which cached items could be subscribed for /// notification. /// When notified, all cached objects with dependency on the provided keys will expire. /// </summary> /// <param name="viewModel">View model that will be used for displaying the data.</param> /// <returns> /// The <see cref="IList"/>. /// </returns> public override IList <CacheDependencyKey> GetKeysOfDependentObjects(ContentListViewModel viewModel) { var result = new List <CacheDependencyKey>(); viewModel.Items.ForEach(p => result.AddRange(OutputCacheDependencyHelper.GetPublishedContentCacheDependencyKeys(this.ContentType, p.DataItem.Id))); return(result); }
public static ContentListViewModel GetMediaListView() { if (mediaListView == null) { mediaListView = new ContentListViewModel(); } return(mediaListView); }
public MainPage() { this.InitializeComponent(); this.NavigationCacheMode = NavigationCacheMode.Required; listViewModel = App.GetMediaListView(); videoList.DataContext = listViewModel; searchVideos.KeyDown += SearchVideos_KeyDown; }
public ActionResult History(string id = null) { var model = new ContentListViewModel(); model = model.Populate(db, id); if (!model.Items.Any()) { return(HttpNotFound()); } return(View(model)); }
/// <summary> /// Index Page /// </summary> /// <returns></returns> public ActionResult Index() { var model = new ContentListViewModel { Contents = _entities.Contents .Include("Author") .OrderByDescending(c => c.Created) .ToPagedList(1, ContentListViewModel.PageSize), Page = 1 }; return View("~/Areas/mitarbeit/Views/Content/Index.cshtml", model); }
/// <summary> /// Gets a collection of <see cref="CacheDependencyNotifiedObject"/>. /// The <see cref="CacheDependencyNotifiedObject"/> represents a key for which cached items could be subscribed for /// notification. /// When notified, all cached objects with dependency on the provided keys will expire. /// </summary> /// <param name="viewModel">View model that will be used for displaying the data.</param> /// <returns> /// The <see cref="IList"/>. /// </returns> public override IList <CacheDependencyKey> GetKeysOfDependentObjects(ContentListViewModel viewModel) { var result = base.GetKeysOfDependentObjects(viewModel); var manager = this.GetManager(); string applicationName = manager != null && manager.Provider != null ? manager.Provider.ApplicationName : string.Empty; result.Add(new CacheDependencyKey { Key = string.Concat(ContentLifecycleStatus.Live.ToString(), applicationName), Type = typeof(ListItem) }); return(result); }
public ActionResult Details(ForumThread item) { this.ViewBag.ThreadTitle = item.Title; this.InitializeMetadataDetailsViewBag(item); // Sitefinity SEO optimizations var posts = this.GetPosts(item).Select(x => new ItemViewModel(x)); var viewModel = new ContentListViewModel() { Items = posts.ToList() }; return(this.View("Detail.ForumThreadDetails", viewModel)); }
/// <summary> /// Gets a collection of <see cref="CacheDependencyNotifiedObject"/>. /// The <see cref="CacheDependencyNotifiedObject"/> represents a key for which cached items could be subscribed for /// notification. /// When notified, all cached objects with dependency on the provided keys will expire. /// </summary> /// <param name="viewModel">View model that will be used for displaying the data.</param> /// <returns> /// The <see cref="IList"/>. /// </returns> public override IList <CacheDependencyKey> GetKeysOfDependentObjects(ContentListViewModel viewModel) { var result = base.GetKeysOfDependentObjects(viewModel); var manager = this.GetManager(); string applicationName = manager != null && manager.Provider != null ? manager.Provider.ApplicationName : string.Empty; foreach (var key in OutputCacheDependencyHelper.GetPublishedContentCacheDependencyKeys(typeof(ListItem), applicationName)) { result.Add(key); } return(result); }
public ActionResult Index(int?page) { var pageNumber = this.ExtractValidPage(page); var items = this.GetThreads().Skip((pageNumber - 1) * 50).Select(x => new ItemViewModel(x)); var viewModel = new ContentListViewModel() { Items = items.ToList() }; // TODO: Cache dependencies? return(this.View("List.ForumThreadsList", viewModel)); }
/// <inheritdoc /> public override IList <CacheDependencyKey> GetKeysOfDependentObjects(ContentListViewModel viewModel) { if (this.ContentType != null) { var result = new List <CacheDependencyKey>(1); result.Add(new CacheDependencyKey { Key = this.ContentType.FullName, Type = typeof(Telerik.Sitefinity.DynamicModules.Model.DynamicContent) }); return(result); } else { return(new List <CacheDependencyKey>(0)); } }
public async Task <IActionResult> List(string searchstring, int category, int pageindex = 1, int status = -1, int type = 0) { var VM = new ContentListViewModel(); VM.searchstring = searchstring; VM.category = category; VM.pageindex = pageindex; VM.status = status; if (type == 0) { //文章类型才获取分类 VM.metas = await mms.GetMetasAsync(0); } VM.type = type; VM.contents = await cms.GetContentsAsync(status, searchstring, category, pageindex, 10, type); return(View(VM)); }
/// <summary> /// Renders the topic title as link. /// </summary> /// <param name="helper">The HTML helper.</param> /// <param name="model">The model.</param> /// <returns> /// Topic title link /// </returns> public static IHtmlString RenderTopicLink(this HtmlHelper helper, ContentListViewModel model) { var viewItem = model.Items.FirstOrDefault(); if (viewItem == null) { return(null); } var taxon = viewItem.GetFlatTaxon("Tags"); if (taxon == null) { return(null); } return(new HtmlString(string.Format("<a href=\"../{0}\">{1}</a>", taxon.Name, taxon.Title))); }
public IActionResult List(Guid repositoryid, Guid definitionid) { IRepository repository = CmsManager.Load().GetRepositoryById(repositoryid); if (repository == null) { return(Redirect("/fcmsmanager/repository")); } IContentStore contentStore = CmsManager.Load().GetContentStore(repositoryid); ContentListViewModel model = new ContentListViewModel(); model.RepositoryId = repositoryid; model.RepositoryName = repository.Name; model.DefinitionId = definitionid; model.ContentDefinition = repository.ContentDefinitions.Where(m => m.DefinitionId == definitionid).FirstOrDefault(); model.Items = contentStore.Items.Where(m => m.DefinitionId == definitionid).ToList(); return(View("List", model)); }
/// <inheritdoc /> public override IList <CacheDependencyKey> GetKeysOfDependentObjects(ContentListViewModel viewModel) { if (this.ContentType != null) { var result = new List <CacheDependencyKey>(2); var manager = this.GetManager(); string applicationName = manager != null && manager.Provider != null ? manager.Provider.ApplicationName : string.Empty; result.Add(new CacheDependencyKey { Key = string.Concat(Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live.ToString(), applicationName, this.ContentType.FullName), Type = typeof(Telerik.Sitefinity.DynamicModules.Model.DynamicContent) }); result.Add(new CacheDependencyKey() { Key = this.ContentType.FullName, Type = typeof(DynamicModule) }); return(result); } else { return(new List <CacheDependencyKey>(0)); } }
/// <inheritdoc /> public override IList <CacheDependencyKey> GetKeysOfDependentObjects(ContentListViewModel viewModel) { if (this.ContentType != null) { var result = new List <CacheDependencyKey>(2); var manager = this.GetManager(); string applicationName = manager != null && manager.Provider != null ? manager.Provider.ApplicationName : string.Empty; result.AddRange(OutputCacheDependencyHelper.GetPublishedContentCacheDependencyKeys(this.ContentType, applicationName)); result.Add(new CacheDependencyKey() { Key = this.ContentType.FullName, Type = typeof(DynamicModule) }); this.AddCommonDependencies(result, this.ContentType); return(result); } else { return(new List <CacheDependencyKey>(0)); } }
public async Task <IActionResult> Edit(ContentListViewModel model, int id) { try { if (!ModelState.IsValid) { return(View(model)); } var content = await _contentListService.FindByIdAsync(id).ConfigureAwait(false); content.Title = model.Title.Trim(); content.Description = model.Description.Trim(); content.IsPublish = model.IsPublish; content.Thumbnail = model.Thumbnail; content.Pic = model.Pic; content.Content = model.Content != null?model.Content .Replace("../../content/files/editor/", "/content/files/editor/") .Replace("../content/files/editor/", "/content/files/editor/") .Replace("..//content/files/editor/", "/content/files/editor/") : ""; var c = new List <ContentListTag>(); if (model.Tags != null) { var tags = model.Tags.Split(",").Where(s => !string.IsNullOrWhiteSpace(s)); foreach (var t in tags) { c.Add(new ContentListTag { TagId = Convert.ToInt32(t), Type = "cat" }); } } if (model.Artists != null) { var tags = model.Artists.Split(",").Where(s => !string.IsNullOrWhiteSpace(s)); foreach (var t in tags) { c.Add(new ContentListTag { TagId = Convert.ToInt32(t), Type = "artist" }); } } if (model.Styles != null) { var tags = model.Styles.Split(",").Where(s => !string.IsNullOrWhiteSpace(s)); foreach (var t in tags) { c.Add(new ContentListTag { TagId = Convert.ToInt32(t), Type = "style" }); } } if (model.Musics != null) { var tags = model.Musics.Split(",").Where(s => !string.IsNullOrWhiteSpace(s)); foreach (var t in tags) { c.Add(new ContentListTag { TagId = Convert.ToInt32(t), Type = "music" }); } } content.ContentListTags.Clear(); content.ContentListTags = c; _contentListService.UpdateContentList(content, model.Photo); if (model.SendNotification) { SendNotification( "/topics/all", "لیست پخش " + content.Title + " منتشر شد", "لیست پخش " + content.Title + " منتشر شد" , content.Id.ToString()); } return(RedirectToAction(nameof(Index), new { type = content.Type })); } catch (Exception e) { return(View()); } }
/// <inheritdoc /> protected override void PopulateListViewModel(int page, IQueryable <IDataItem> query, ContentListViewModel viewModel) { int?totalPages = null; if (this.ParentFilterMode == Models.ParentFilterMode.Selected && this.selectedParentsIds.Count() == 0) { viewModel.Items = Enumerable.Empty <ItemViewModel>(); } else { viewModel.Items = this.ApplyListSettings(page, query, out totalPages); } this.SetViewModelProperties(viewModel, page, totalPages); }
/// <summary> /// Populates the list ViewModel. /// </summary> /// <param name="page">The current page.</param> /// <param name="query">The query.</param> /// <param name="viewModel">The view model.</param> protected override void PopulateListViewModel(int page, IQueryable <IDataItem> query, ContentListViewModel viewModel) { if (viewModel == null) { throw new ArgumentNullException("Paremter viewModel cannot be null."); } int?totalPages = null; if (string.IsNullOrEmpty(this.GetSelectedItemsFilterExpression())) { viewModel.Items = Enumerable.Empty <ItemViewModel>(); } else { viewModel.Items = this.ApplyListSettings(page, query, out totalPages); } this.SetViewModelProperties(viewModel, page, totalPages); }
/// <inheritdoc /> protected override void PopulateListViewModel(int page, IQueryable <IDataItem> query, ContentListViewModel viewModel) { base.PopulateListViewModel(page, query, viewModel); foreach (ThumbnailViewModel item in viewModel.Items) { var sfImage = (SfImage)item.DataItem; if (sfImage.IsVectorGraphics()) { this.ApplyThumbnailProfileToViewModel(item, this.ThumbnailSizeModel); this.ApplyImageSizesToViewModel(item, this.ImageSizeModel); } item.ThumbnailUrl = this.GetSelectedSizeUrl(sfImage, this.ThumbnailSizeModel); item.MediaUrl = this.GetSelectedSizeUrl(sfImage, this.ImageSizeModel); } }
/// <inheritdoc /> protected override void PopulateListViewModel(int page, IQueryable <IDataItem> query, ContentListViewModel viewModel) { base.PopulateListViewModel(page, query, viewModel); foreach (var item in viewModel.Items) { ((VideoThumbnailViewModel)item).ThumbnailUrl = this.GetSelectedSizeUrl((SfVideo)item.DataItem, this.ThumbnailSizeModel); } }
protected override void PopulateListViewModel(int page, IQueryable <IDataItem> query, ContentListViewModel viewModel) { base.PopulateListViewModel(page, query, viewModel); }
/// <summary> /// Determines whether the controller should return the details view. /// </summary> /// <param name="controller">The controller.</param> /// <param name="contentViewDisplayMode">Display mode of the view.</param> /// <param name="viewModel">A view model containing list of selected items.</param> /// <returns>A value indicating whether the controller should return the details view.</returns> public static bool ShouldReturnDetails(this Controller controller, ContentViewDisplayMode contentViewDisplayMode, ContentListViewModel viewModel) { if (controller == null) { throw new ArgumentNullException("controller"); } if (contentViewDisplayMode == ContentViewDisplayMode.Detail && viewModel != null && viewModel.Items.Count() == 1) { return(true); } return(false); }