Ejemplo n.º 1
0
        public IEnumerable<TypeDescriptor<FilterDescriptor>> DescribeFilters() {
            var context = new DescribeFilterContext();

            foreach (var provider in _filterProviders) {
                provider.Describe(context);
            }
            return context.Describe();
        }
Ejemplo n.º 2
0
        public void Describe(DescribeFilterContext describe) {
            describe.For("Content", T("Content"),T("Content"))
                .Element("ContentTypes", T("Content Types"), T("Specific content types"),
                    ApplyFilter,
                    DisplayFilter,
                    "ContentTypesFilter"
                );

        }
 public void Describe(DescribeFilterContext describe)
 {
     describe.For("Associativy", T("Associativy"), T("Associativy filters"))
         .Element("AssociativyNeighboursFilter", T("Neighbours filter"), T("Filters for items connected to an item."),
             ApplyFilter,
             DisplayFilter,
             "AssociativyNeighboursFilter"
         );
 }
Ejemplo n.º 4
0
        public void Describe(DescribeFilterContext describe) {
            describe.For("Content", T("Content"),T("Content"))
                .Element("EagerFetch", T("Eager fetch"), T("Eager fetch content part records"),
                    ApplyFilter,
                    DisplayFilter,
                    "ContentPartRecordsForm"
                );

        }
Ejemplo n.º 5
0
 public void Describe(DescribeFilterContext describe)
 {
     describe.For("Content", T("Content"), T("Content"))
         .Element("IdsInFilter", T("Ids In filter"), T("Filters for items having the specified ids."),
             ApplyFilter,
             DisplayFilter,
             "IdsInFilter"
         );
 }
Ejemplo n.º 6
0
 public void Describe(DescribeFilterContext describe)
 {
     describe.For("Associativy", T("Associativy"), T("Associativy filters"))
         .Element("AssociativySearchFilter", T("Search filter"), T("Filters for items matched by a search query."),
             ApplyFilter,
             DisplayFilter,
             "AssociativySearchFilter"
         );
 }
Ejemplo n.º 7
0
 public void Describe(DescribeFilterContext describe)
 {
     describe.For("Content", T("Content"), T("Content"))
         .Element("ContainedByFilter", T("Contained by filter"), T("Filters for items contained by a container."),
             ApplyFilter,
             DisplayFilter,
             "ContainedByFilter"
         );
 }
        private void Describe(DescribeFilterContext describe)
        {
            describe.For(
                "CommonPartRecord",
                T("Common Part Record"),
                T("Common Part Record"))

                    .Element(
                        "NotEqualId",
                        T("Not equal Id"),
                        T("Where the content item's id is unequal to the current one"),
                        ApplyFilter,
                        DisplayFilter
                );
        }
        public void Describe(DescribeFilterContext describe)
        {
            describe.For(
               "Content",          // The category of this filter
               T("Content"),       // The name of the filter (not used in 1.4)
               T("Content"))       // The description of the filter (not used in 1.4)

               // Defines the actual filter (we could define multiple filters using the fluent syntax)
               .Element(
                   "ProductParts",     // Type of the element
                   T("Product Parts"), // Name of the element
                   T("Product parts"), // Description of the element
                   ApplyFilter,        // Delegate to a method that performs the actual filtering for this element
                   DisplayFilter       // Delegate to a method that returns a descriptive string for this element
               );
        }
Ejemplo n.º 10
0
        public void Describe(DescribeFilterContext describe) {
            var builder = new BindingBuilder();

            foreach(var bindingProvider in _bindingProviders) {
                bindingProvider.GetMemberBindings(builder);
            }

            var groupedMembers = builder.Build().GroupBy(b => b.Property.DeclaringType).ToDictionary(b => b.Key, b => b);

            foreach (var typeMembers in groupedMembers.Keys) {
                var descriptor = describe.For(typeMembers.Name, new LocalizedString(typeMembers.Name.CamelFriendly()), T("Members for {0}", typeMembers.Name));
                foreach(var member in groupedMembers[typeMembers]) {
                    var closureMember = member;
                    string formName = _filterCoordinator.GetForm(closureMember.Property.PropertyType);
                    descriptor.Element(member.Property.Name, member.DisplayName, member.Description,
                        context => ApplyFilter(context, closureMember.Property),
                        context => _filterCoordinator.Display(closureMember.Property.PropertyType, closureMember.DisplayName.Text, context.State),
                        formName    
                    );
                }
            }
        }
Ejemplo n.º 11
0
        public void Describe(DescribeFilterContext describe) {
            foreach(var part in _contentDefinitionManager.ListPartDefinitions()) {
                if(!part.Fields.Any()) {
                    continue;
                }

                var descriptor = describe.For(part.Name + "ContentFields", T("{0} Content Fields", part.Name.CamelFriendly()), T("Content Fields for {0}", part.Name.CamelFriendly()));

                foreach(var field in part.Fields) {
                    var localField = field;
                    var localPart = part;
                    var drivers = _contentFieldDrivers.Where(x => x.GetFieldInfo().Any(fi => fi.FieldTypeName == localField.FieldDefinition.Name)).ToList();

                    var membersContext = new DescribeMembersContext(
                        (storageName, storageType, displayName, description) => {
                            // look for a compatible field type editor
                            IFieldTypeEditor fieldTypeEditor = _fieldTypeEditors.FirstOrDefault(x => x.CanHandle(storageType));

                            if(fieldTypeEditor == null) {
                                return;
                            }

                            descriptor.Element(
                                type: localPart.Name + "." + localField.Name + "." + storageName,
                                name: new LocalizedString(localField.DisplayName + (displayName != null ? ":" + displayName.Text : "")),
                                description: description ?? T("{0} property for {1}", storageName, localField.DisplayName),
                                filter: context => ApplyFilter(context, fieldTypeEditor, storageName, storageType, localPart, localField),
                                display: context => fieldTypeEditor.DisplayFilter(localPart.Name.CamelFriendly() + "." + localField.DisplayName, storageName, context.State),
                                form: fieldTypeEditor.FormName);
                        });
                    
                    foreach(var driver in drivers) {
                        driver.Describe(membersContext);
                    }
                }
            }
        }
 public void Describe(DescribeFilterContext describe)
 {
     describe
         .For("Taxonomy", T("Taxonomy"), T("Taxonomy"))
         .Element("RelatedContent", T("Related Content"), T("Related content based on the specified taxonomy field of the current content item"), ApplyFilter, DisplayFilter, "RelatedContent");
 }
Ejemplo n.º 13
0
 public void Describe(DescribeFilterContext describe)
 {
     describe.For("Content", T("Shoutbox"), T("Shoutbox"))
         .Element("ShoutboxMessages", T("Shoutbox Messages"), T("Messages from a Shoutbox widget"),
             ApplyFilter,
             DisplayFilter,
             "ShoutboxMessagesFilter"
         );
 }
Ejemplo n.º 14
0
 public void Describe(DescribeFilterContext describe)
 {
     describe
         .For("Taxonomy", T("Taxonomy"), T("Taxonomy"))
         .Element("HasTermIds", T("Has Term IDs"), T("Categorized content items containing a list of specified term IDs"), ApplyFilter, DisplayFilter, "EnterTerms");
 }
Ejemplo n.º 15
0
 public void Describe(DescribeFilterContext describe)
 {
     describe.For("Search", T("Search"), T("Search"))
         .Element("SearchFilter", T("Search filter"), T("Filters for items matching a search query in the site search index."),
             ApplyFilter,
             DisplayFilter,
             "SearchFilter"
         );
 }
Ejemplo n.º 16
0
 public void Describe(DescribeFilterContext describe)
 {
     describe.For("Taxonomy", T("Taxonomy"), T("Taxonomy"))
         .Element("HasSameTerms", T("Has same Terms as content"), T("Categorized content items"),
             ApplyFilter,
             DisplayFilter,
             "SelectSameTermsMethod"
         );
 }
 public void Describe(DescribeFilterContext describe)
 {
     describe
         .For("Content", T("Content"), T("Content"))
         .Element("Exclude", T("Exclude"), T("Exclude specific content items"), ApplyFilter, DisplayFilter, "ExcludeContentItems");
 }