/// <inheritdoc />
        public override IEnumerable <ContentLocations.IContentLocationInfo> GetLocations()
        {
            var location = new ContentLocationInfo();

            location.ContentType  = typeof(ListItem);
            location.ProviderName = this.ProviderName;
            if (string.IsNullOrEmpty(location.ProviderName))
            {
                location.ProviderName = this.GetManager().Provider.Name;
            }

            string listsFilterExpression;

            switch (this.ContentViewDisplayMode)
            {
            case Telerik.Sitefinity.Web.UI.ContentUI.Enums.ContentViewDisplayMode.Detail:
                location.Filters.Add(this.CompileSingleItemFilterExpression(location.ContentType));

                return(new[] { location });

            case Telerik.Sitefinity.Web.UI.ContentUI.Enums.ContentViewDisplayMode.Automatic:
                listsFilterExpression = this.CompileFilterExpression(ListItemFilterExpression);
                break;

            default:
                return(null);
            }

            if (!string.IsNullOrEmpty(listsFilterExpression))
            {
                location.Filters.Add(new BasicContentLocationFilter(listsFilterExpression));
            }

            var listItemModel = new ListItemModel()
            {
                FilterExpression            = this.FilterExpression,
                SerializedAdditionalFilters = this.SerializedAdditionalFilters,

                // We need only filter list items.
                SelectionMode = SelectionMode.FilteredItems
            };

            var listItemsFilterExpression = listItemModel.GetFilterExpression();

            if (!string.IsNullOrEmpty(listItemsFilterExpression))
            {
                location.Filters.Add(new BasicContentLocationFilter(listItemsFilterExpression));
            }

            return(new[] { location });
        }
Beispiel #2
0
        /// <inheritdoc />
        public override ContentListViewModel CreateListViewModel(ITaxon taxonFilter, int page)
        {
            if (page < 1)
            {
                throw new ArgumentException("'page' argument has to be at least 1.", "page");
            }

            var query = this.GetItemsQuery();

            if (query == null)
            {
                return(this.CreateListViewModelInstance());
            }

            var viewModel = this.CreateListViewModelInstance();

            viewModel.UrlKeyPrefix = this.UrlKeyPrefix;
            this.PopulateListViewModel(page, query, viewModel);

            foreach (var listModel in viewModel.Items.Cast <ListViewModel>())
            {
                var listItemModel = new ListItemModel(listModel)
                {
                    SortExpression              = this.SortExpression,
                    FilterExpression            = this.FilterExpression,
                    SerializedAdditionalFilters = this.SerializedAdditionalFilters,

                    // We need only filter list items.
                    SelectionMode = SelectionMode.FilteredItems,
                    SelectionGroupLogicalOperator = this.SelectionGroupLogicalOperator,
                    ProviderName = this.ProviderName,
                    ItemsPerPage = null,

                    UrlKeyPrefix = this.UrlKeyPrefix
                };

                listModel.ListItemViewModel = listItemModel.CreateListViewModel(taxonFilter, page);
            }

            return(viewModel);
        }
Beispiel #3
0
        /// <inheritdoc />
        public override IEnumerable <ContentLocations.IContentLocationInfo> GetLocations()
        {
            var location = new ContentLocationInfo();

            location.ContentType  = typeof(ListItem);
            location.ProviderName = this.ProviderName;
            if (string.IsNullOrEmpty(location.ProviderName))
            {
                location.ProviderName = this.GetManager().Provider.Name;
            }

            var listsFilterExpression = this.CompileFilterExpression(ListItemFilterExpression);

            if (!string.IsNullOrEmpty(listsFilterExpression))
            {
                location.Filters.Add(new BasicContentLocationFilter(listsFilterExpression));
            }

            var listItemModel = new ListItemModel()
            {
                FilterExpression            = this.FilterExpression,
                SerializedAdditionalFilters = this.SerializedAdditionalFilters,

                // We need only filter list items.
                SelectionMode = SelectionMode.FilteredItems
            };

            var listItemsFilterExpression = listItemModel.GetFilterExpression();

            if (!string.IsNullOrEmpty(listItemsFilterExpression))
            {
                location.Filters.Add(new BasicContentLocationFilter(listItemsFilterExpression));
            }

            return(new[] { location });
        }