Ejemplo n.º 1
0
        /// <summary>
        /// Renders appropriate list view depending on the <see cref="ListTemplateName" />
        /// </summary>
        /// <param name="page">The page.</param>
        /// <returns>
        /// The <see cref="ActionResult" />.
        /// </returns>
        public ActionResult Index(int?page)
        {
            var fullTemplateName = this.listTemplateNamePrefix + this.ListTemplateName;

            this.ViewBag.CurrentPageUrl          = this.GetPageUrl();
            this.ViewBag.RedirectPageUrlTemplate = this.ViewBag.CurrentPageUrl + UrlHelpers.GetRedirectPagingUrl();

            if (!this.IsEmpty)
            {
                ITaxon taxonFilter = TaxonUrlEvaluator.GetTaxonFromQuery(this.HttpContext, this.Model.UrlKeyPrefix);

                var viewModel = this.Model.CreateListViewModel(taxonFilter: taxonFilter, page: page ?? 1);
                if (SystemManager.CurrentHttpContext != null)
                {
                    this.AddCacheDependencies(this.Model.GetKeysOfDependentObjects(viewModel));
                    if (viewModel.ContentType != null)
                    {
                        this.AddCacheVariations(viewModel.ContentType, viewModel.ProviderName);
                    }
                }

                return(this.View(fullTemplateName, viewModel));
            }

            return(new EmptyResult());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Renders appropriate list view depending on the <see cref="ListTemplateName" />
        /// </summary>
        /// <param name="page">The page.</param>
        /// <returns>
        /// The <see cref="ActionResult" />.
        /// </returns>
        public ActionResult Index(int?page)
        {
            ITaxon taxonFilter      = TaxonUrlEvaluator.GetTaxonFromQuery(this.HttpContext, this.Model.UrlKeyPrefix);
            var    fullTemplateName = this.listTemplateNamePrefix + this.ListTemplateName;
            var    currentPageUrl   = this.GetCurrentPageUrl();

            this.ViewBag.CurrentPageUrl          = currentPageUrl;
            this.ViewBag.RedirectPageUrlTemplate = this.GeneratePagingTemplate(currentPageUrl, this.Model.UrlKeyPrefix);
            this.ViewBag.DetailsPageId           = this.DetailsPageId;
            this.ViewBag.OpenInSamePage          = this.OpenInSamePage;

            this.SetRedirectUrlQueryString(taxonFilter);

            this.UpdatePageFromQuery(ref page, this.Model.UrlKeyPrefix);
            var viewModel = this.Model.CreateListViewModel(taxonFilter, this.ExtractValidPage(page));

            if (this.ShouldReturnDetails(this.Model.ContentViewDisplayMode, viewModel))
            {
                return(this.Details((NewsItem)viewModel.Items.First().DataItem));
            }

            this.AddCacheDependencies(this.Model.GetKeysOfDependentObjects(viewModel));
            if (viewModel.ContentType != null)
            {
                this.AddCacheVariations(viewModel.ContentType, viewModel.ProviderName);
            }

            return(this.View(fullTemplateName, viewModel));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Renders appropriate list view depending on the <see cref="ListTemplateName" />
        /// </summary>
        /// <param name="page">The page.</param>
        /// <returns>
        /// The <see cref="ActionResult" />.
        /// </returns>
        public ActionResult Index(int?page)
        {
            if (this.Model.ParentFilterMode != ParentFilterMode.CurrentlyOpen)
            {
                ITaxon taxonFilter = TaxonUrlEvaluator.GetTaxonFromQuery(this.HttpContext, this.Model.UrlKeyPrefix);

                this.InitializeListViewBag();
                this.SetRedirectUrlQueryString(taxonFilter);

                this.UpdatePageFromQuery(ref page, this.Model.UrlKeyPrefix);
                var viewModel = this.Model.CreateListViewModel(taxonFilter, this.ExtractValidPage(page));

                var fullTemplateName = this.listTemplateNamePrefix + this.ListTemplateName;

                if (this.ShouldReturnDetails(this.Model.ContentViewDisplayMode, viewModel))
                {
                    return(this.Details((BlogPost)viewModel.Items.First().DataItem));
                }

                this.AddCacheDependencies(this.Model.GetKeysOfDependentObjects(viewModel));
                if (viewModel.ContentType != null)
                {
                    this.AddCacheVariations(viewModel.ContentType, viewModel.ProviderName);
                }

                return(this.View(fullTemplateName, viewModel));
            }

            return(this.Content(string.Empty));
        }
        /// <summary>
        /// Renders appropriate list view depending on the <see cref="ListTemplateName" />
        /// </summary>
        /// <param name="page">The page.</param>
        /// <returns>
        /// The <see cref="ActionResult" />.
        /// </returns>
        public virtual ActionResult Index(int?page)
        {
            if (this.Request != null && this.Model.HideListView(this.Request.RequestContext))
            {
                return(this.Content(string.Empty));
            }

            if (this.Model.ParentFilterMode != ParentFilterMode.CurrentlyOpen || this.Model.ShowListViewOnEmpyParentFilter)
            {
                ITaxon taxonFilter = TaxonUrlEvaluator.GetTaxonFromQuery(this.HttpContext, this.Model.UrlKeyPrefix);

                this.InitializeListViewBag();
                this.SetRedirectUrlQueryString(taxonFilter);

                this.UpdatePageFromQuery(ref page, this.Model.UrlKeyPrefix);
                var viewModel = this.Model.CreateListViewModel(taxonFilter, this.ExtractValidPage(page));

                var fullTemplateName = this.listTemplateNamePrefix + this.ListTemplateName;

                if (this.ShouldReturnDetails(this.Model.ContentViewDisplayMode, viewModel))
                {
                    return(this.Details((Telerik.Sitefinity.DynamicModules.Model.DynamicContent)viewModel.Items.First().DataItem));
                }

                this.AddCacheDependencies(this.Model.GetKeysOfDependentObjects(viewModel));
                if (viewModel.ContentType != null)
                {
                    this.AddCacheVariations(viewModel.ContentType, viewModel.ProviderName);
                }

                return(this.View(fullTemplateName, viewModel));
            }
            else
            {
                if (this.Model.CurrentlyOpenParentType != null && SitefinityContext.IsBackend)
                {
                    var dynamicType = ModuleBuilderManager.GetActiveTypes().FirstOrDefault(t => t.FullTypeName == this.Model.ContentType.FullName);
                    if (dynamicType != null)
                    {
                        if (this.Model.CurrentlyOpenParentType != DynamicContentController.AnyParentValue)
                        {
                            var parentType = ModuleBuilderManager.GetActiveTypes().FirstOrDefault(t => t.FullTypeName == this.Model.CurrentlyOpenParentType);
                            if (parentType != null)
                            {
                                return(this.Content(Res.Get <DynamicContentResources>().DisplaysFromCurrentlyOpen.Arrange(dynamicType.DisplayName, PluralsResolver.Instance.ToPlural(parentType.DisplayName))));
                            }
                        }
                        else
                        {
                            return(this.Content(Res.Get <DynamicContentResources>().DisplaysFromCurrentlyOpen.Arrange(dynamicType.DisplayName, Res.Get <DynamicContentResources>().AnyParentContentType)));
                        }
                    }
                }

                return(this.Content(string.Empty));
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Renders appropriate list view depending on the <see cref="TemplateName" />
        /// </summary>
        /// <returns>
        /// The <see cref="ActionResult" />.
        /// </returns>
        public ActionResult Index(int?page)
        {
            ITaxon taxonFilter = TaxonUrlEvaluator.GetTaxonFromQuery(this.HttpContext, this.Model.UrlKeyPrefix);

            this.InitializeListViewBag();
            this.SetRedirectUrlQueryString(taxonFilter);

            this.UpdatePageFromQuery(ref page, this.Model.UrlKeyPrefix);
            var viewModel        = this.Model.CreateListViewModel(taxonFilter, this.ExtractValidPage(page));
            var fullTemplateName = this.GetFullListTemplateName();

            return(this.View(fullTemplateName, viewModel));
        }
        /// <summary>
        /// Renders appropriate list view depending on the <see cref="TemplateName" />
        /// </summary>
        /// <returns>
        /// The <see cref="ActionResult" />.
        /// </returns>
        public ActionResult Index(int?page)
        {
            ITaxon taxonFilter = TaxonUrlEvaluator.GetTaxonFromQuery(this.HttpContext, this.Model.UrlKeyPrefix);

            this.InitializeListViewBag("/{0}");
            this.SetRedirectUrlQueryString(taxonFilter);

            var viewModel = this.Model.CreateListViewModel(taxonFilter: taxonFilter, page: page ?? 1);

            var fullTemplateName = this.GetFullListTemplateName();

            return(View(fullTemplateName, viewModel));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Renders appropriate list view depending on the <see cref="ListTemplateName" />
        /// </summary>
        /// <param name="page">The page.</param>
        /// <returns>
        /// The <see cref="ActionResult" />.
        /// </returns>
        public ActionResult Index(int?page)
        {
            ITaxon taxonFilter = TaxonUrlEvaluator.GetTaxonFromQuery(this.HttpContext, this.Model.UrlKeyPrefix);

            this.InitializeListViewBag("/{0}");
            this.SetRedirectUrlQueryString(taxonFilter);

            var viewModel = this.Model.CreateListViewModel(taxonFilter: taxonFilter, page: page ?? 1);

            if (SystemManager.CurrentHttpContext != null)
            {
                this.AddCacheDependencies(this.Model.GetKeysOfDependentObjects(viewModel));
            }

            var fullTemplateName = this.listTemplateNamePrefix + this.ListTemplateName;

            return(this.View(fullTemplateName, viewModel));
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Renders appropriate list view depending on the <see cref="ListTemplateName" />
        /// </summary>
        /// <param name="page">The page.</param>
        /// <returns>
        /// The <see cref="ActionResult" />.
        /// </returns>
        public ActionResult Index(int?page)
        {
            if (this.Model.ParentFilterMode != ParentFilterMode.CurrentlyOpen || this.Model.ShowListViewOnEmpyParentFilter)
            {
                ITaxon taxonFilter = TaxonUrlEvaluator.GetTaxonFromQuery(this.HttpContext, this.Model.UrlKeyPrefix);

                this.InitializeListViewBag("/{0}");
                this.SetRedirectUrlQueryString(taxonFilter);

                var viewModel = this.Model.CreateListViewModel(taxonFilter: taxonFilter, page: page ?? 1);
                if (SystemManager.CurrentHttpContext != null)
                {
                    this.AddCacheDependencies(this.Model.GetKeysOfDependentObjects(viewModel));
                }

                var fullTemplateName = this.listTemplateNamePrefix + this.ListTemplateName;
                return(this.View(fullTemplateName, viewModel));
            }
            else
            {
                if (this.Model.CurrentlyOpenParentType != null && SitefinityContext.IsBackend)
                {
                    var manager     = ModuleBuilderManager.GetManager().Provider;
                    var dynamicType = manager.GetDynamicModuleTypes().FirstOrDefault(t => t.TypeName == this.Model.ContentType.Name && t.TypeNamespace == this.Model.ContentType.Namespace);
                    if (dynamicType != null)
                    {
                        if (this.Model.CurrentlyOpenParentType != DynamicContentController.AnyParentValue)
                        {
                            var parentType = manager.GetDynamicModuleTypes().FirstOrDefault(t => t.TypeNamespace + "." + t.TypeName == this.Model.CurrentlyOpenParentType);
                            if (parentType != null)
                            {
                                return(this.Content(Res.Get <DynamicContentResources>().DisplaysFromCurrentlyOpen.Arrange(dynamicType.DisplayName, PluralsResolver.Instance.ToPlural(parentType.DisplayName))));
                            }
                        }
                        else
                        {
                            return(this.Content(Res.Get <DynamicContentResources>().DisplaysFromCurrentlyOpen.Arrange(dynamicType.DisplayName, Res.Get <DynamicContentResources>().AnyParentContentType)));
                        }
                    }
                }

                return(this.Content(string.Empty));
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Renders appropriate list view depending on the <see cref="ListTemplateName" />
        /// </summary>
        /// <param name="page">The page.</param>
        /// <returns>
        /// The <see cref="ActionResult" />.
        /// </returns>
        public ActionResult Index(int?page)
        {
            ITaxon taxonFilter = TaxonUrlEvaluator.GetTaxonFromQuery(this.HttpContext, this.Model.UrlKeyPrefix);

            this.InitializeListViewBag();
            this.SetRedirectUrlQueryString(taxonFilter);

            this.UpdatePageFromQuery(ref page, this.Model.UrlKeyPrefix);
            var viewModel = this.Model.CreateListViewModel(taxonFilter, this.ExtractValidPage(page));

            this.AddCacheDependencies(this.Model.GetKeysOfDependentObjects(viewModel));
            if (viewModel.ContentType != null)
            {
                this.AddCacheVariations(viewModel.ContentType, viewModel.ProviderName);
            }

            var fullTemplateName = this.FullListTemplateName();

            return(this.View(fullTemplateName, viewModel));
        }