public void Describe(DescribeContext context)
        {
            context.For("Content", T("Content Items"), T("Content Items"))
                .Token("Id", T("Content Id"), T("Numeric primary key value of content."))
                .Token("Author", T("Content Author"), T("Person in charge of the content."), "User")
                .Token("Date", T("Content Date"), T("Date the content was created."), "DateTime")
                .Token("Identity", T("Identity"), T("Identity of the content."))
                .Token("ContentType", T("Content Type"), T("The name of the item Content Type."), "TypeDefinition")
                .Token("DisplayText", T("Display Text"), T("Title of the content."),"Text")
                .Token("DisplayUrl", T("Display Url"), T("Url to display the content."), "Url")
                .Token("EditUrl", T("Edit Url"), T("Url to edit the content."), "Url")
                .Token("Container", T("Container"), T("The container Content Item."), "Content")
                ;

            context.For("TextField", T("Text Field"), T("Tokens for Text Fields"))
                .Token("Length", T("Length"), T("The length of the field."));

            context.For("Url", T("Url"), T("Tokens for Urls"))
                .Token("Absolute", T("Absolute"), T("Absolute url."));

            context.For("TypeDefinition", T("Type Definition"), T("Tokens for Content Types"))
                .Token("Name", T("Name"), T("Name of the content type."))
                .Token("DisplayName", T("Display Name"), T("Display name of the content type."), "Text")
                .Token("Parts", T("Parts"), T("List of the attached part names."))
                .Token("Fields", T("Fields"), T("Fields for each of the attached parts. For example, Fields.Page.Approved."));
        }
Example #2
0
        public override void Describe(DescribeContext <OpenIdScope> context)
        {
            context.For <OpenIdScopeIndex>()
            .Map(scope => new OpenIdScopeIndex
            {
                Name    = scope.Name,
                ScopeId = scope.ScopeId
            });

            context.For <OpenIdScopeByResourceIndex, string>()
            .Map(scope => scope.Resources.Select(resource => new OpenIdScopeByResourceIndex
            {
                Resource = resource,
                Count    = 1
            }))
            .Group(index => index.Resource)
            .Reduce(group => new OpenIdScopeByResourceIndex
            {
                Resource = group.Key,
                Count    = group.Sum(x => x.Count)
            })
            .Delete((index, map) =>
            {
                index.Count -= map.Sum(x => x.Count);
                return(index.Count > 0 ? index : null);
            });
        }
Example #3
0
        public override void Describe(DescribeContext <BlogPost> context)
        {
            context.For <BlogPostByAuthor>().Map(blogPost => new BlogPostByAuthor {
                Author = blogPost.Author,
                Title  = blogPost.Title
            });

            context.For <BlogPostByTag>().Map(blogPost => blogPost.Tags.Select(t => new BlogPostByTag {
                Tag = t
            }));

            context.For <BlogPostByMonth>().Map(blogPost => new BlogPostByMonth
            {
                PublishedMonth = blogPost.Published.ToString("yyyyMM"),
                Count          = 1
            })
            .Group(map => map.PublishedMonth)
            .Reduce(group => new BlogPostByMonth {
                PublishedMonth = group.Key, Count = group.Sum(m => m.Count)
            })
            .Delete((index, map) =>
            {
                index.Count -= map.Sum(x => x.Count);
                return(index.Count > 0 ? index : null);
            });
        }
Example #4
0
 public void Describe(DescribeContext context)
 {
     context.For("Content", T("Content Items"), T("Content Items"))
     .Token("TemplatedItem", T("TemplatedItem"), T("The templated item for this content item."));
     context.For("TemplatedItem", T("Templated Item"), T("Dynamically templated item"))
     .Token("MainPicture", T("Main Picture"), T("The main picture for this templated item."));
 }
Example #5
0
        public override void Describe(DescribeContext <BlogPost> context)
        {
            // for each BlogPost, create a BlogPostByAuthor index
            context.For <BlogPostByAuthor>()
            .Map(blogPost =>
                 new BlogPostByAuthor {
                Author = blogPost.Author
            }
                 );

            // for each BlogPost, aggregate in an exiting BlogPostByDay
            context.For <BlogPostByDay, string>()
            .Map(blogPost =>
                 new BlogPostByDay
            {
                Day   = blogPost.PublishedUtc.ToString("yyyyMMdd"),
                Count = 1
            })
            .Group(blogPost => blogPost.Day)
            .Reduce(group =>
                    new BlogPostByDay
            {
                Day   = group.Key,
                Count = group.Sum(p => p.Count)
            })
            .Delete((index, map) =>
            {
                index.Count -= map.Sum(x => x.Count);

                // if Count == 0 then delete the index
                return(index.Count > 0 ? index : null);
            }
                    );
        }
        public override void Describe(DescribeContext <WorkflowDefinitionVersionDocument> context)
        {
            context.For <WorkflowDefinitionIndex>()
            .Map(
                document => new WorkflowDefinitionIndex
            {
                WorkflowDefinitionId = document.WorkflowDefinitionId,
                Version     = document.Version,
                IsPublished = document.IsPublished,
                IsLatest    = document.IsLatest,
                IsDisabled  = document.IsDisabled
            }
                );

            context.For <WorkflowDefinitionStartActivitiesIndex>()
            .Map(
                document => GetStartActivities(document)
                .Select(
                    activity => new WorkflowDefinitionStartActivitiesIndex
            {
                StartActivityId   = activity.Id,
                StartActivityType = activity.Type,
                IsDisabled        = document.IsDisabled
            }
                    )
                );
        }
Example #7
0
        public override void Describe(DescribeContext <Workflow> context)
        {
            context.For <WorkflowIndex>()
            .Map(workflow =>
                 new WorkflowIndex
            {
                WorkflowTypeId = workflow.WorkflowTypeId,
                WorkflowId     = workflow.WorkflowId,
                CreatedUtc     = workflow.CreatedUtc
            }
                 );

            context.For <WorkflowBlockingActivitiesIndex>()
            .Map(workflow =>
                 workflow.BlockingActivities.Select(x =>
                                                    new WorkflowBlockingActivitiesIndex
            {
                ActivityId            = x.ActivityId,
                ActivityName          = x.Name,
                ActivityIsStart       = x.IsStart,
                WorkflowTypeId        = workflow.WorkflowTypeId,
                WorkflowId            = workflow.WorkflowId,
                WorkflowCorrelationId = workflow.CorrelationId ?? ""
            })
                 );
        }
Example #8
0
        public override void Describe(DescribeContext <WorkflowType> context)
        {
            context.For <WorkflowTypeIndex>()
            .Map(workflowType =>
                 new WorkflowTypeIndex
            {
                WorkflowTypeId = workflowType.WorkflowTypeId,
                Name           = workflowType.Name,
                IsEnabled      = workflowType.IsEnabled,
                HasStart       = workflowType.Activities.Any(x => x.IsStart)
            }
                 );

            context.For <WorkflowTypeStartActivitiesIndex>()
            .Map(workflowType =>
                 workflowType.Activities.Where(x => x.IsStart).Select(x =>
                                                                      new WorkflowTypeStartActivitiesIndex
            {
                WorkflowTypeId    = workflowType.WorkflowTypeId,
                Name              = workflowType.Name,
                IsEnabled         = workflowType.IsEnabled,
                StartActivityId   = x.ActivityId,
                StartActivityName = x.Name
            })
                 );
        }
Example #9
0
        public override void Describe(DescribeContext <WorkflowInstance> context)
        {
            context.For <WorkflowInstanceIndex>()
            .Map(
                workflowInstance => new WorkflowInstanceIndex
            {
                WorkflowDefinitionId = workflowInstance.Id,
                WorkflowStatus       = workflowInstance.Status,
                CorrelationId        = workflowInstance.CorrelationId,
                CreatedAt            = workflowInstance.CreatedAt.ToDateTimeUtc()
            });

            context.For <WorkflowInstanceBlockingActivitiesIndex>()
            .Map(
                workflowInstance => workflowInstance.BlockingActivities
                .Select(
                    activity => new WorkflowInstanceBlockingActivitiesIndex
            {
                ActivityId     = activity.ActivityId,
                ActivityType   = activity.ActivityType,
                CorrelationId  = workflowInstance.CorrelationId,
                WorkflowStatus = workflowInstance.Status,
                CreatedAt      = workflowInstance.CreatedAt.ToDateTimeUtc()
            }));
        }
Example #10
0
        public void Describe(DescribeContext context)
        {
            context.For("Cart", T("Shopping Cart"), T("Shopping Cart"))
            .Token("Items", T("Items"), T("The items in the shopping cart."), "CartItems")
            .Token("Country", T("Country"), T("The country where the cart will get shipped."))
            .Token("ZipCode", T("Zip Code"), T("The zip code where the cart will get shipped."))
            .Token("Shipping", T("Shipping Option"), T("The shipping option chosen by the user."), "ShippingOption")
            .Token("Subtotal", T("Subtotal"), T("The total price of all products in the cart, without the tax and shipping costs."))
            .Token("Taxes", T("Taxes"), T("The taxes to be paid on this cart."), "TaxAmount")
            .Token("Total", T("Total"), T("The total price of all products in the cart, with the tax and shipping costs included."))
            .Token("Count", T("Item count"), T("The total number of products in the cart."));

            context.For("CartItems", T("Cart Items"), T("The list of product quantities and prices in the cart."))
            .Token("Format:*", T("Format:<separator>:<cart format>"), T("Formats the contents of the cart using a format string that uses $quantity for the quantity, $product for the product name (with attributes), and $price for the price. For example {Cart.Items.Format:, :$quantity x $product}"), "Text");

            context.For("ShippingOption", T("Shipping Option"), T("Shipping Option"))
            .Token("Price", T("Price"), T("Price of the shipping option"))
            .Token("Description", T("Description"), T("Description of the shipping option"), "Text")
            .Token("Company", T("Company"), T("The shipping company"), "Text");

            context.For("TaxAmount", T("Tax Amount"), T("Tax Amount"))
            .Token("Name", T("Name"), T("Name of the tax"), "Text")
            .Token("Amount", T("Amount"), T("Amount taxed"));

            context.For("Item", T("Item for update"), T("Item for update"))
            .Token("Format:*", T("Format:<item format>"), T("Formats the contents of the item using a format string that uses $quantity for the quantity, $product for the product name (with attributes), and $price for the price. For example {Item.Format:$quantity x (&sku) $product}"), "Text");
        }
        public void Describe(DescribeContext context)
        {
            context.For(ProjectTokenProvider.AttachToProjectKey, T("AttachToProject"), T("AttachToProject"))
            .Token("ProjectId", T("ProjectId"), T("ProjectId"));

            context.For(ProjectTokenProvider.ProjectKey, T("Project"), T("Project"))
            .Token("ProjectId", T("ProjectId"), T("ProjectId"));
        }
Example #12
0
        public void Describe(DescribeContext context)
        {
            context.For("Content")
            .Token("CultureInfo", T("Culture"), T("Item's culture."));

            context.For("CultureInfo", T("Culture Information"), T("Tokens for Culture Informations"))
            .Token("CultureName", T("Culture name"), T("languagecode2-country/regioncode2."))
            .Token("ThreeLetterName", T("Three-letter name"), T("ISO 639-2 code for the language."))
            .Token("TwoLetterName", T("Two-letter name"), T("ISO 639-1 code for the language."));
        }
Example #13
0
        public void Describe(DescribeContext context)
        {
            context.For("Content", T("Content Items"), T("Content Items"))
            .Token("Culture", T("Culture"), T("The culture of the content item"), "Culture")
            ;


            context.For("Culture", T("Culture"), T("Tokens for culture"))
            .Token("Name", T("Name"), T("Gets the culture name in the format languagecode2-country/regioncode2."), "Text")
            .Token("TwoLetterISOLanguageName", T("Two Letter ISO Language Name"), T("Gets the ISO 639-1 two-letter code for the language of the current CultureInfo."), "Text");
        }
Example #14
0
        public override void Describe(DescribeContext <User> context)
        {
            context.For <UserByUsername>()
            .Map(user => new UserByUsername {
                Username = user.Username
            });

            context.For <UserById>()
            .Map(user => new UserById {
                EntityId = user.EntityId
            });
        }
Example #15
0
        public override void Describe(DescribeContext <Game> context)
        {
            context.For <GameById>()
            .Map(game => new GameById {
                EntityId = game.EntityId
            });

            context.For <GameByUserId>()
            .Map(game => new GameByUserId {
                UserId = game.UserId
            });
        }
Example #16
0
        public void Describe(DescribeContext context)
        {
            context.For("Content", T("Order"), T("Tokens for order"))
            .Token("Customer", T("Customer"), T("Order's customer"), "Content")
            ;

            context.For("Customer", T("Customer"), T("Tokens for customer"))
            .Token("FirstName", T("First name"), T("Customer's first name"))
            .Token("LastName", T("Last name"), T("Customer's last name"))
            .Token("Email", T("Email"), T("Customer's e-mail"))
            ;
        }
        public void Describe(DescribeContext context)
        {
            context.For("WContentItem", T("Main ContentItem"), T("Main ContentItem to use in widgets"))
            .Token("Id", T("Id"), T("ContentItem Id"));

            context.For("Team", T("Team"), T("The current Team"))
            .Token("Id", T("Id"), T("The Team Id"));

            context.For("Ticket", T("Ticket"), T("The current Ticket"))
            .Token("Id", T("Id"), T("The Ticket Id"));

            context.For("BusinessUnit", T("BusinessUnit"), T("The current BusinessUnit"))
            .Token("Id", T("Id"), T("The BusinessUnit Id"));
        }
Example #18
0
        public void Describe(DescribeContext context) {
            context.For("Site")
                .Token("Global1", T("Global1"), T("description of token1"))
                .Token("Global2", T("Global2"), T("description of token2"))
                .Token("Global3", T("Global3"), T("description of token3"))
                .Token("CurrentUser", T("Current User"), T("The current user"), "User");

            context.For("User")
                .Token("Name", T("Name"), T("Their user name"))
                .Token("Birthdate", T("Birthdate"), T("Date of birth"), "DateTime");

            context.For("Date")
                .Token("Now", T("Now"), T("Current system date in short date format. You can chain a .NET DateTime format string to customize."));
        }
        public void Describe(DescribeContext context)
        {
            context.For("Content", T("Content Items"), T("Content Items"))
            .Token("Id", T("Content Id"), T("Numeric primary key value of content."))
            .Token("Author", T("Content Author"), T("Person in charge of the content."), "User")
            .Token("Date", T("Content Date"), T("Date the content was created."), "DateTime")
            .Token("Identity", T("Identity"), T("Identity of the content."))
            .Token("ContentType", T("Content Type"), T("The name of the item Content Type."), "TypeDefinition")
            .Token("DisplayText", T("Display Text"), T("Title of the content."), "Text")
            .Token("DisplayUrl", T("Display Url"), T("Url to display the content."), "Url")
            .Token("EditUrl", T("Edit Url"), T("Url to edit the content."), "Url")
            .Token("Container", T("Container"), T("The container Content Item."), "Content")
            .Token("Body", T("Body"), T("The body text of the content item."), "Text")
            ;

            // Token descriptors for fields
            foreach (var typeDefinition in _contentManager.GetContentTypeDefinitions())
            {
                foreach (var typePart in typeDefinition.Parts)
                {
                    if (!typePart.PartDefinition.Fields.Any())
                    {
                        continue;
                    }

                    var partContext = context.For("Content");
                    foreach (var partField in typePart.PartDefinition.Fields)
                    {
                        var field     = partField;
                        var tokenName = "Fields." + typePart.PartDefinition.Name + "." + field.Name;

                        // the token is chained with the technical name
                        partContext.Token(tokenName, T("{0} {1}", typePart.PartDefinition.Name, field.Name), T("The content of the {0} field.", partField.DisplayName), field.Name);
                    }
                }
            }

            context.For("TextField", T("Text Field"), T("Tokens for Text Fields"))
            .Token("Length", T("Length"), T("The length of the field."));

            context.For("Url", T("Url"), T("Tokens for Urls"))
            .Token("Absolute", T("Absolute"), T("Absolute url."), "Text");

            context.For("TypeDefinition", T("Type Definition"), T("Tokens for Content Types"))
            .Token("Name", T("Name"), T("Name of the content type."))
            .Token("DisplayName", T("Display Name"), T("Display name of the content type."), "Text")
            .Token("Parts", T("Parts"), T("List of the attached part names."))
            .Token("Fields", T("Fields"), T("Fields for each of the attached parts. For example, Fields.Page.Approved."));
        }
Example #20
0
        public void Describe(DescribeContext context)
        {
            context.For("Site")
            .Token("Global1", T("Global1"), T("description of token1"))
            .Token("Global2", T("Global2"), T("description of token2"))
            .Token("Global3", T("Global3"), T("description of token3"))
            .Token("CurrentUser", T("Current User"), T("The current user"), "User");

            context.For("User")
            .Token("Name", T("Name"), T("Their user name"))
            .Token("Birthdate", T("Birthdate"), T("Date of birth"), "DateTime");

            context.For("Date")
            .Token("Now", T("Now"), T("Current system date in short date format. You can chain a .NET DateTime format string to customize."));
        }
Example #21
0
 public void Describe(DescribeContext context)
 {
     context.For(UserTokenProvider.LoginedUser, T("EUser"), T("User"))
     .Token("Id", T("Id"), T("Id"))
     .Token("Email", T("Email"), T("Email"))
     .Token("Username", T("Username"), T("Username"));
 }
Example #22
0
 public void Describe(DescribeContext context) {
     context.For("User", T("User"), T("User tokens"))
         .Token("Name", T("Name"), T("Username"))
         .Token("Email", T("Email"), T("Email Address"))
         .Token("Id", T("Id"), T("User Id"))
         .Token("Content", T("Content"), T("The user's content item"));
 }
 public void Describe(DescribeContext context)
 {
     context.For("Content")
     .Token("SeoDescription",
            T("SEOPart.Description"),
            T("The description for the content that was input in its SEO Part."));
 }
Example #24
0
 public override void Describe(DescribeContext <User> context)
 {
     context.For <UserByName>()
     .Map(user => new UserByName {
         Name = user.Name, Adult = user.Adult, Age = user.Age
     });
 }
Example #25
0
        public void Describe(DescribeContext <ContentItem> context)
        {
            context.For <LocalizedContentItemIndex>()
            .Map(contentItem =>
            {
                var part = contentItem.As <LocalizationPart>();

                if (part == null)
                {
                    return(null);
                }

                // If the related content item was removed, a record is still added.
                if (!contentItem.Published && !contentItem.Latest && !_removed.Contains(contentItem))
                {
                    return(null);
                }

                if (String.IsNullOrEmpty(part.LocalizationSet) || part.Culture == null)
                {
                    return(null);
                }

                return(new LocalizedContentItemIndex
                {
                    Culture = part.Culture.ToLowerInvariant(),
                    LocalizationSet = part.LocalizationSet,
                    ContentItemId = contentItem.ContentItemId,
                    Published = contentItem.Published,
                    Latest = contentItem.Latest
                });
            });
        }
Example #26
0
        public override void Describe(DescribeContext <ContentItem> context)
        {
            context.For <LocalizedContentItemIndex>()
            .Map(contentItem =>
            {
                if (!contentItem.Latest)
                {
                    return(null);
                }

                var localizationPart = contentItem.As <LocalizationPart>();

                if (string.IsNullOrEmpty(localizationPart?.LocalizationSet) || localizationPart?.Culture == null)
                {
                    return(null);
                }

                return(new LocalizedContentItemIndex
                {
                    Culture = localizationPart.Culture.ToLowerInvariant(),
                    LocalizationSet = localizationPart.LocalizationSet,
                    ContentItemId = contentItem.ContentItemId,
                    Published = contentItem.Published
                });
            });
        }
Example #27
0
        public override void Describe(DescribeContext <ContentItem> context)
        {
            context.For <ContentPickerFieldIndex>()
            .Map(contentItem =>
            {
                // Can we safely ignore this content item?
                if (_ignoredTypes.Contains(contentItem.ContentType))
                {
                    return(null);
                }

                // Lazy initialization because of ISession cyclic dependency
                _contentDefinitionManager = _contentDefinitionManager ?? _serviceProvider.GetRequiredService <IContentDefinitionManager>();

                // Search for Text fields
                var fieldDefinitions = _contentDefinitionManager
                                       .GetTypeDefinition(contentItem.ContentType)
                                       .Parts.SelectMany(x => x.PartDefinition.Fields.Where(f => f.FieldDefinition.Name == nameof(ContentPickerField)))
                                       .ToArray();

                var results = new List <ContentPickerFieldIndex>();

                // Get all field values
                foreach (var fieldDefinition in fieldDefinitions)
                {
                    var jPart = (JObject)contentItem.Content[fieldDefinition.PartDefinition.Name];

                    if (jPart == null)
                    {
                        continue;
                    }

                    var jField = (JObject)jPart[fieldDefinition.Name];

                    if (jField == null)
                    {
                        continue;
                    }

                    var field = jField.ToObject <ContentPickerField>();

                    foreach (var contentItemId in field.ContentItemIds)
                    {
                        results.Add(new ContentPickerFieldIndex
                        {
                            Latest                = contentItem.Latest,
                            Published             = contentItem.Published,
                            ContentItemId         = contentItem.ContentItemId,
                            ContentItemVersionId  = contentItem.ContentItemVersionId,
                            ContentType           = contentItem.ContentType,
                            ContentPart           = fieldDefinition.PartDefinition.Name,
                            ContentField          = fieldDefinition.Name,
                            SelectedContentItemId = contentItemId
                        });
                    }
                }

                return(results);
            });
        }
 public override void Describe(DescribeContext <ApiLeaderModel> context)
 {
     context.For <ApiLeaderIndex>().Map(leader => new ApiLeaderIndex
     {
         FullName = leader.FullName,
     });
 }
Example #29
0
        public override void Describe(DescribeContext <ContentItem> context)
        {
            context.For <AnimalTraitsIndex>()
            .Map(contentItem =>
            {
                var animal = contentItem.As <Animal>();

                if (animal != null)
                {
                    return(new AnimalTraitsIndex
                    {
                        IsHappy = contentItem.As <Animal>().IsHappy,
                        IsScary = contentItem.As <Animal>().IsScary
                    });
                }

                var animalPartSuffix = contentItem.As <AnimalPart>();

                return(new AnimalTraitsIndex
                {
                    IsHappy = animalPartSuffix.IsHappy,
                    IsScary = animalPartSuffix.IsScary
                });
            });
        }
Example #30
0
        public override void Describe(DescribeContext <Article> context)
        {
            var tokenizer = new WhiteSpaceTokenizer();
            var filter    = new StopWordFilter();

            context.For <ArticleByWord, string>()
            .Map(article => filter
                 .Filter(tokenizer.Tokenize(article.Content))
                 .Select(x => new ArticleByWord {
                Word = x, Count = 1
            })
                 )
            .Group(article => article.Word)
            .Reduce(group => new ArticleByWord
            {
                Word  = group.Key,
                Count = group.Sum(y => y.Count)
            })
            .Delete((index, map) =>
            {
                index.Count -= map.Sum(x => x.Count);

                // if Count == 0 then delete the index
                return(index.Count > 0 ? index : null);
            });
        }
 // First tokens need to be "described". This is the definition phase, the texts here will be shown to the user
 // from the token helper.
 public void Describe(DescribeContext context) =>
 // Adding a token for the "UtcNow" target. I.e. every token will be in the {UtcNow.Something} format.
 context.For("UtcNow", T("Current UTC Date/Time"), T("Current UTC Date/time tokens"))
 // Adding a token called "Default", i.e. it will be usable as {UtcNow.Default}. The last parameter
 // allows the output of the token to be processed by tokens defined for the "Text" target, i.e. by tokens
 // in the {Text.Something} format (like {UtcNow.Default.Limit:5}, see TextTokens in Orchard.Tokens).
 .Token("Default", T("Default"), T("The current date/time in UTC, with the default formatting."), "Text");
Example #32
0
        public void Describe(DescribeContext <ContentItem> context)
        {
            context.For <AliasPartIndex>()
            .When(contentItem => contentItem.Has <AliasPart>() || _partRemoved.Contains(contentItem.ContentItemId))
            .Map(contentItem =>
            {
                // Remove index records of soft deleted items.
                if (!contentItem.Published && !contentItem.Latest)
                {
                    return(null);
                }

                var part = contentItem.As <AliasPart>();
                if (part == null || String.IsNullOrEmpty(part.Alias))
                {
                    return(null);
                }

                return(new AliasPartIndex
                {
                    Alias = part.Alias.ToLowerInvariant(),
                    ContentItemId = contentItem.ContentItemId,
                    Latest = contentItem.Latest,
                    Published = contentItem.Published
                });
            });
        }
Example #33
0
        public void Describe(DescribeContext context)
        {
            var describe = context.For("Endpoints", T("Endpoints"), T("Tokens for Endpoints"));

            DescribeCurrentTokens(describe);
            DescribeAutoTokens(describe);
        }
Example #34
0
 public void Describe(DescribeContext context) {
     context.For("Text", T("Text"), T("Tokens for text strings"))
         .Token("Limit:*", T("Limit:<text length>[,<ellipsis>]"), T("Limit text to specified length and append an optional ellipsis text."))
         .Token("Format:*", T("Format:<text format>"), T("Optional format specifier (e.g. foo{0}bar). See format strings at <a target=\"_blank\" href=\"http://msdn.microsoft.com/en-us/library/az4se3k1.aspx\">Standard Formats</a> and <a target=\"_blank\" href=\"http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx\">Custom Formats</a>"), "DateTime")
         .Token("UrlEncode", T("Url Encode"), T("Encodes a URL string."), "Text")
         .Token("HtmlEncode", T("Html Encode"), T("Encodes an HTML string."), "Text")
         ;
 }
 public void Describe(DescribeContext context) {
     context.For("Request", T("Http Request"), T("Current Http Request tokens."))
         .Token("QueryString:*", T("QueryString:<element>"), T("The Query String value for the specified element."))
         .Token("Form:*", T("Form:<element>"), T("The Form value for the specified element."))
         .Token("Route:*", T("Route:<key>"), T("The Route value for the specified key."))
         .Token("Content", T("Content"), T("The request routed Content Item."), "Content")
     ;
 }
        public void Describe(DescribeContext context) {
            context.For("Content", T("Content Items"), T("Content Items"))
                .Token("Id", T("Content Id"), T("Numeric primary key value of content."))
                .Token("Author", T("Content Author"), T("Person in charge of the content."), "User")
                .Token("Date", T("Content Date"), T("Date the content was created."), "DateTime")
                .Token("Identity", T("Identity"), T("Identity of the content."))
                .Token("ContentType", T("Content Type"), T("The name of the item Content Type."), "TypeDefinition")
                .Token("DisplayText", T("Display Text"), T("Title of the content."), "Text")
                .Token("DisplayUrl", T("Display Url"), T("Url to display the content."), "Url")
                .Token("EditUrl", T("Edit Url"), T("Url to edit the content."), "Url")
                .Token("Container", T("Container"), T("The container Content Item."), "Content")
                .Token("Body", T("Body"), T("The body text of the content item."), "Text")
                ;

            // Token descriptors for fields
            foreach (var typeDefinition in _contentManager.GetContentTypeDefinitions()) {
                foreach (var typePart in typeDefinition.Parts) {

                    if (!typePart.PartDefinition.Fields.Any()) {
                        continue;
                    }

                    var partContext = context.For("Content");
                    foreach (var partField in typePart.PartDefinition.Fields) {
                        var field = partField;
                        var tokenName = "Fields." + typePart.PartDefinition.Name + "." + field.Name;

                        // the token is chained with the technical name
                        partContext.Token(tokenName, T("{0} {1}", typePart.PartDefinition.Name, field.Name), T("The content of the {0} field.", partField.DisplayName), field.Name);
                    }
                }
            }

            context.For("TextField", T("Text Field"), T("Tokens for Text Fields"))
                .Token("Length", T("Length"), T("The length of the field."));

            context.For("Url", T("Url"), T("Tokens for Urls"))
                .Token("Absolute", T("Absolute"), T("Absolute url."), "Text");

            context.For("TypeDefinition", T("Type Definition"), T("Tokens for Content Types"))
                .Token("Name", T("Name"), T("Name of the content type."))
                .Token("DisplayName", T("Display Name"), T("Display name of the content type."), "Text")
                .Token("Parts", T("Parts"), T("List of the attached part names."))
                .Token("Fields", T("Fields"), T("Fields for each of the attached parts. For example, Fields.Page.Approved."));
        }
Example #37
0
 public void Describe(DescribeContext context) {
     context.For("Date", T("Date/time"), T("Current date/time tokens"))
         .Token("Since", T("Since"), T("Relative to the current date/time."), "Date")
         .Token("Local", T("Local"), T("Based on the configured time zone."), "Date")
         .Token("ShortDate", T("Short Date"), T("Short date format."))
         .Token("ShortTime", T("Short Time"), T("Short time format."))
         .Token("Long", T("Long Date and Time"), T("Long date and time format."))
         .Token("Format:*", T("Format:<date format>"), T("Optional format specifier (e.g. yyyy/MM/dd). See format strings at <a target=\"_blank\" href=\"http://msdn.microsoft.com/en-us/library/az4se3k1.aspx\">Standard Formats</a> and <a target=\"_blank\" href=\"http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx\">Custom Formats</a>"), "DateTime");
 }
Example #38
0
 public void Describe(DescribeContext context) {
     context.For("Text", T("Text"), T("Tokens for text strings"))
         .Token("Limit:*", T("Limit:<text length>[,<ellipsis>]"), T("Limit text to specified length and append an optional ellipsis text."))
         .Token("Format:*", T("Format:<text format>"), T("Optional format specifier (e.g. foo{0}bar). See format strings at <a target=\"_blank\" href=\"http://msdn.microsoft.com/en-us/library/az4se3k1.aspx\">Standard Formats</a> and <a target=\"_blank\" href=\"http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx\">Custom Formats</a>"), "DateTime")
         .Token("TrimEnd:*", T("TrimEnd:<chars|number>"), T("Trims the specified characters or number of them from the end of the string."), "Text")
         .Token("UrlEncode", T("Url Encode"), T("Encodes a URL string."), "Text")
         .Token("HtmlEncode", T("Html Encode"), T("Encodes an HTML string."), "Text")
         .Token("LineEncode", T("Line Encode"), T("Replaces new lines with <br /> tags."))
         ;
 }
Example #39
0
 public void Describe(DescribeContext context) {
     context.For("Text", T("Text"), T("Tokens for text strings"))
         .Token("Limit:*", T("Limit:<text length>[,<ellipsis>]"), T("Limit text to specified length and append an optional ellipsis text."))
         .Token("Format:*", T("Format:<text format>"), T("Optional format specifier (e.g. foo{0}bar)."))
         .Token("TrimEnd:*", T("TrimEnd:<chars|number>"), T("Trims the specified characters or number of them from the end of the string."))
         .Token("UrlEncode", T("Url Encode"), T("Encodes a URL string."), "Text")
         .Token("HtmlEncode", T("Html Encode"), T("Encodes an HTML string."), "Text")
         .Token("JavaScriptEncode", T("JavaScript Encode"), T("Encodes a JavaScript string."), "Text")
         .Token("LineEncode", T("Line Encode"), T("Replaces new lines with <br /> tags."), "Text")
         ;
 }
Example #40
0
 public void Describe(DescribeContext context)
 {
     context.For("List", T("Lists"), T("Handles lists of Content Items"))
         .Token("Join:*", T("Join:<Tokenized text>[,<separator>]"), T("Join each element in the list by applying the tokenized text and concatenating the output with the optional separator."))
         .Token("Sum:*", T("Sum:<Tokenized text>"), T("Sum each element in the list by applying the tokenized text."))
         .Token("First:*", T("First:<Tokenized text>"), T("Apply the tokenized text to the first element."))
         .Token("Last:*", T("Last:<Tokenized text>"), T("Apply the tokenized text to the last element."))
         .Token("Count", T("Count"), T("Get the list count."))
         .Token("ElementAt:*", T("ElementAt:<index>,<Tokenized text>"), T("Apply the tokenized text to the element at its index."))
         ;
 }
Example #41
0
 public void Describe(DescribeContext context) {
     context.For("Date", T("Date/Time"), T("Current date/time tokens"))
         .Token("Since", T("Since"), T("Relative to the current date/time."), "Date")
         .Token("Local", T("Local"), T("Based on the configured time zone and calendar."), "Date")
         .Token("Short", T("Short Date and Time"), T("Short date and time format."))
         .Token("ShortDate", T("Short Date"), T("Short date format."))
         .Token("ShortTime", T("Short Time"), T("Short time format."))
         .Token("Long", T("Long Date and Time"), T("Long date and time format."))
         .Token("LongDate", T("Long Date"), T("Long date format."))
         .Token("LongTime", T("Long Time"), T("Long time format."))
         .Token("Format:*", T("Format:<formatString>"), T("Optional custom date/time format string (e.g. yyyy/MM/dd). For reference see <a target=\"_blank\" href=\"http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx\">Custom Date and Time Format Strings</a>"), "DateTime");
 }
Example #42
0
 public void Describe(DescribeContext context)
 {
     context.For("Url", T("UrlHelper actions"), T("UrlHelper actions."))
         .Token("Action:*", T("Action:<actionname,controllername[,area=MyModuleName][,customValue=42]>"), T("The route values to evaluate."));
 }
Example #43
0
 public void Describe(DescribeContext context) {
     context.For("Request", T("Http Request"), T("Current Http Request tokens."))
         .Token("QueryString:*", T("QueryString:<element>"), T("The Query String value for the specified element."))
         .Token("Form:*", T("Form:<element>"), T("The Form value for the specified element."))
     ;
 }
 public void Describe(DescribeContext context) {
     context.For("Shape", T("Shape"), T("Shape tokens."))
         .Token("Execute:*", T("Execute:<shape name>"), T("Executes the specified shape."));
 }