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 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("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")
     ;
 }
Example #4
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")
         ;
 }
Example #5
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 #6
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 #7
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 #8
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 #9
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 #10
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."));
        }
        public void Describe(DescribeContext context)
        {
            Func <IShapeFactory, object> form =
                shape => {
                var f = Shape.Form(
                    Id: "DateTimeFilter",
                    _Operator: Shape.SelectList(
                        Id: "operator", Name: "Operator",
                        Title: T("Operator"),
                        Size: 1,
                        Multiple: false
                        ),
                    _FieldSetOption: Shape.FieldSet(
                        _ValueTypeDate: Shape.Radio(
                            Id: "value-type-date", Name: "ValueType",
                            Title: T("A date"), Value: "0", Checked: true,
                            Description: T("Please use this format: YYYY-MM-DD hh:mm:ss. e.g., 2010-04-12 would filter on the whole day. You can also use the Date token like this: {Date.Format:yyyy-MM-dd}")
                            ),
                        _ValueTypeSpan: Shape.Radio(
                            Id: "value-type-timespan", Name: "ValueType",
                            Title: T("An offset from the current time"), Value: "1",
                            Description: T("You can provide time in the past by using negative values. e.g., -1 day")
                            )
                        ),
                    _FieldSetSingle: Shape.FieldSet(
                        Id: "fieldset-single",
                        _Value: Shape.TextBox(
                            Id: "value", Name: "Value",
                            Title: T("Value"),
                            Classes: new [] { "tokenized" }
                            ),
                        _ValueUnit: Shape.SelectList(
                            Id: "value-unit", Name: "ValueUnit",
                            Title: T("Unit"),
                            Size: 1,
                            Multiple: false
                            )
                        ),
                    _FieldSetMin: Shape.FieldSet(
                        Id: "fieldset-min",
                        _Min: Shape.TextBox(
                            Id: "min", Name: "Min",
                            Title: T("Min"),
                            Classes: new[] { "tokenized" }
                            ),
                        _MinUnit: Shape.SelectList(
                            Id: "min-unit", Name: "MinUnit",
                            Title: T("Unit"),
                            Size: 1,
                            Multiple: false
                            )
                        ),
                    _FieldSetMax: Shape.FieldSet(
                        Id: "fieldset-max",
                        _Max: Shape.TextBox(
                            Id: "max", Name: "Max",
                            Title: T("Max"),
                            Classes: new[] { "tokenized" }
                            ),
                        _MaxUnit: Shape.SelectList(
                            Id: "max-unit", Name: "MaxUnit",
                            Title: T("Unit"),
                            Size: 1,
                            Multiple: false
                            )
                        )
                    );

                _resourceManager.Value.Require("script", "jQuery");
                _resourceManager.Value.Include("script", "~/Modules/Orchard.Projections/Scripts/datetime-editor-filter.js", "~/Modules/Orchard.Projections/Scripts/datetime-editor-filter.js");
                _resourceManager.Value.Include("stylesheet", "~/Modules/Orchard.Projections/Styles/datetime-editor-filter.css", "~/Modules/Orchard.Projections/Styles/datetime-editor-filter.css");

                f._Operator.Add(new SelectListItem {
                    Value = Convert.ToString(DateTimeOperator.LessThan), Text = T("Is less than").Text
                });
                f._Operator.Add(new SelectListItem {
                    Value = Convert.ToString(DateTimeOperator.LessThanEquals), Text = T("Is less than or equal to").Text
                });
                f._Operator.Add(new SelectListItem {
                    Value = Convert.ToString(DateTimeOperator.Equals), Text = T("Is equal to").Text
                });
                f._Operator.Add(new SelectListItem {
                    Value = Convert.ToString(DateTimeOperator.NotEquals), Text = T("Is not equal to").Text
                });
                f._Operator.Add(new SelectListItem {
                    Value = Convert.ToString(DateTimeOperator.GreaterThanEquals), Text = T("Is greater than or equal to").Text
                });
                f._Operator.Add(new SelectListItem {
                    Value = Convert.ToString(DateTimeOperator.GreaterThan), Text = T("Is greater than").Text
                });
                f._Operator.Add(new SelectListItem {
                    Value = Convert.ToString(DateTimeOperator.Between), Text = T("Is between").Text
                });
                f._Operator.Add(new SelectListItem {
                    Value = Convert.ToString(DateTimeOperator.NotBetween), Text = T("Is not between").Text
                });

                foreach (var unit in new[] { f._FieldSetSingle._ValueUnit, f._FieldSetMin._MinUnit, f._FieldSetMax._MaxUnit })
                {
                    unit.Add(new SelectListItem {
                        Value = Convert.ToString(DateTimeSpan.Year), Text = T("Year").Text
                    });
                    unit.Add(new SelectListItem {
                        Value = Convert.ToString(DateTimeSpan.Month), Text = T("Month").Text
                    });
                    unit.Add(new SelectListItem {
                        Value = Convert.ToString(DateTimeSpan.Day), Text = T("Day").Text
                    });
                    unit.Add(new SelectListItem {
                        Value = Convert.ToString(DateTimeSpan.Hour), Text = T("Hour").Text
                    });
                    unit.Add(new SelectListItem {
                        Value = Convert.ToString(DateTimeSpan.Minute), Text = T("Minute").Text
                    });
                    unit.Add(new SelectListItem {
                        Value = Convert.ToString(DateTimeSpan.Second), Text = T("Second").Text
                    });
                }

                return(f);
            };

            context.Form(FormName, form);
        }
Example #13
0
 protected virtual void DescribeForm(DescribeContext context)
 {
 }
Example #14
0
 public void Describe(DescribeContext context)
 {
     context.For("Element", T("Element"), T("Element tokens."))
     .Token("Display:*", T("Display:<element type>"), T("Displays the specified element type."))
     ;
 }
Example #15
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."))
     ;
 }
Example #16
0
 public void Describe(DescribeContext context)
 {
     DescribeForm(context);
 }
 public void Describe(DescribeContext context)
 {
     Describe(context, string.Empty);
 }
        public void Describe(DescribeContext context)
        {
            Func <IShapeFactory, dynamic> formFactory =
                shape => {
                var jobsQueueEnabled = _featureManager.GetEnabledFeatures().Any(x => x.Id == "Orchard.JobsQueue");

                var form = New.Form(
                    Id: "EmailActivity",
                    _Type: New.FieldSet(
                        Title: T("Send to"),
                        _Recipients: New.Textbox(
                            Id: "recipients",
                            Name: "Recipients",
                            Title: T("Email Addresses"),
                            Description: T("Specify a comma-separated list of recipient email addresses. To include a display name, use the following format: John Doe &lt;[email protected]&gt;"),
                            Classes: new[] { "large", "text", "tokenized" }),
                        _Bcc: New.TextBox(
                            Id: "bcc",
                            Name: "Bcc",
                            Title: T("Bcc"),
                            Description: T("Specify a comma-separated list of email addresses for a blind carbon copy"),
                            Classes: new[] { "large", "text", "tokenized" }),
                        _CC: New.TextBox(
                            Id: "cc",
                            Name: "CC",
                            Title: T("CC"),
                            Description: T("Specify a comma-separated list of email addresses for a carbon copy"),
                            Classes: new[] { "large", "text", "tokenized" }),
                        _ReplyTo: New.Textbox(
                            Id: "reply-to",
                            Name: "ReplyTo",
                            Title: T("Reply To Address"),
                            Description: T("If necessary, specify an email address for replies."),
                            Classes: new [] { "large", "text", "tokenized" }),
                        _Subject: New.Textbox(
                            Id: "Subject", Name: "Subject",
                            Title: T("Subject"),
                            Description: T("The subject of the email message."),
                            Classes: new[] { "large", "text", "tokenized" }),
                        _Message: New.Textarea(
                            Id: "Body", Name: "Body",
                            Title: T("Body"),
                            Description: T("The body of the email message."),
                            Classes: new[] { "tokenized" }),
                        _NotifyReadEmail: New.Checkbox(
                            Id: "NotifyReadEmail", Name: "NotifyReadEmail",
                            Title: T("Notify email read"),
                            Checked: false, Value: "true",
                            Description: T("Notify when email sent gets read by the recipient."))
                        ));

                if (jobsQueueEnabled)
                {
                    form._Type._Queued(New.Checkbox(
                                           Id: "Queued", Name: "Queued",
                                           Title: T("Queued"),
                                           Checked: false, Value: "true",
                                           Description: T("Check send it as a queued job.")));

                    form._Type._Priority(New.SelectList(
                                             Id: "priority",
                                             Name: "Priority",
                                             Title: T("Priority"),
                                             Description: ("The priority of this message.")
                                             ));

                    form._Type._Priority.Add(new SelectListItem {
                        Value = "-50", Text = T("Low").Text
                    });
                    form._Type._Priority.Add(new SelectListItem {
                        Value = "0", Text = T("Normal").Text
                    });
                    form._Type._Priority.Add(new SelectListItem {
                        Value = "50", Text = T("High").Text
                    });
                }

                return(form);
            };

            context.Form("EmailActivity", formFactory);
        }
Example #19
0
        public void Describe(DescribeContext context)
        {
            Func <IShapeFactory, object> form =
                shape => {
                var f = Shape.Form(
                    Id: "GridLayout",
                    _Options: Shape.Fieldset(
                        Title: T("Alignment"),
                        _ValueTrue: Shape.Radio(
                            Id: "horizontal", Name: "Alignment",
                            Title: T("Horizontal"), Value: "horizontal",
                            Checked: true,
                            Description: T("Horizontal alignment will place items starting in the upper left and moving right.")
                            ),
                        _ValueFalse: Shape.Radio(
                            Id: "vertical", Name: "Alignment",
                            Title: T("Vertical"), Value: "vertical",
                            Description: T("Vertical alignment will place items starting in the upper left and moving down.")
                            ),
                        _Colums: Shape.TextBox(
                            Id: "columns", Name: "Columns",
                            Title: T("Number of columns/lines "),
                            Value: 3,
                            Description: T("How many columns (in Horizontal mode) or lines (in Vertical mode) to display in the grid."),
                            Classes: new[] { "small-text", "tokenized" }
                            )
                        ),
                    _HtmlProperties: Shape.Fieldset(
                        Title: T("Html properties"),
                        _GridTag: Shape.TextBox(
                            Id: "grid-tag", Name: "GridTag",
                            Title: T("Grid tag"),
                            Description: T("The tag of the grid. Leave empty for no tag. (e.g., table)"),
                            Classes: new[] { "text medium", "tokenized" }
                            ),
                        _GridId: Shape.TextBox(
                            Id: "grid-id", Name: "GridId",
                            Title: T("Grid id"),
                            Description: T("The id to provide on the grid element."),
                            Classes: new[] { "text medium", "tokenized" }
                            ),
                        _GridClass: Shape.TextBox(
                            Id: "grid-class", Name: "GridClass",
                            Title: T("Grid class"),
                            Description: T("The class to provide on the grid element."),
                            Classes: new[] { "text medium", "tokenized" }
                            ),
                        _RowTag: Shape.TextBox(
                            Id: "row-tag", Name: "RowTag",
                            Title: T("Row tag"),
                            Description: T("The tag of a row. Leave empty for no tag. (e.g., tr)"),
                            Classes: new[] { "text medium", "tokenized" }
                            ),
                        _RowClass: Shape.TextBox(
                            Id: "row-class", Name: "RowClass",
                            Title: T("Row class"),
                            Description: T("The class to provide on each row."),
                            Classes: new[] { "text medium", "tokenized" }
                            ),
                        _CellTag: Shape.TextBox(
                            Id: "cell-tag", Name: "CellTag",
                            Title: T("Cell tag"),
                            Description: T("The tag of a cell. Leave empty for no tag. (e.g., td)"),
                            Classes: new[] { "text medium", "tokenized" }
                            ),
                        _CellClass: Shape.TextBox(
                            Id: "cell-class", Name: "CellClass",
                            Title: T("Cell class"),
                            Description: T("The class to provide on each cell."),
                            Classes: new[] { "text medium", "tokenized" }
                            ),
                        _EmptyCell: Shape.TextBox(
                            Id: "empty-cell", Name: "EmptyCell",
                            Title: T("Empty Cell"),
                            Description: T("The HTML to render as empty cells to fill a row. (e.g., <td>&nbsp;</td>"),
                            Classes: new[] { "text medium", "tokenized" }
                            )
                        )
                    );

                return(f);
            };

            context.Form("GridLayout", form);
        }
        public override void Describe(DescribeContext <ContentItem> context)
        {
            context.For <DateFieldIndex>()
            .Map(contentItem =>
            {
                // Remove index records of soft deleted items.
                if (!contentItem.Published && !contentItem.Latest)
                {
                    return(null);
                }

                // Can we safely ignore this content item?
                if (_ignoredTypes.Contains(contentItem.ContentType))
                {
                    return(null);
                }

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

                // Search for DateField
                var contentTypeDefinition = _contentDefinitionManager.GetTypeDefinition(contentItem.ContentType);

                // This can occur when content items become orphaned, particularly layer widgets when a layer is removed, before its widgets have been unpublished.
                if (contentTypeDefinition == null)
                {
                    _ignoredTypes.Add(contentItem.ContentType);
                    return(null);
                }

                var fieldDefinitions = contentTypeDefinition
                                       .Parts.SelectMany(x => x.PartDefinition.Fields.Where(f => f.FieldDefinition.Name == nameof(DateField)))
                                       .ToArray();

                // This type doesn't have any DateField, ignore it
                if (fieldDefinitions.Length == 0)
                {
                    _ignoredTypes.Add(contentItem.ContentType);
                    return(null);
                }

                var results = new List <DateFieldIndex>();

                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 <DateField>();

                    results.Add(new DateFieldIndex
                    {
                        Latest               = contentItem.Latest,
                        Published            = contentItem.Published,
                        ContentItemId        = contentItem.ContentItemId,
                        ContentItemVersionId = contentItem.ContentItemVersionId,
                        ContentType          = contentItem.ContentType,
                        ContentPart          = fieldDefinition.PartDefinition.Name,
                        ContentField         = fieldDefinition.Name,
                        Date = field.Value
                    });
                }

                return(results);
            });
        }
Example #21
0
 public void Describe(DescribeContext context)
 {
     context.For("Content", T("Owner email"), T("Owner email of content item "))
     .Token("OwnerEmail", T("OwnerEmail"), T("The email of user creator."))
     ;
 }
        public void Describe(DescribeContext context)
        {
            Func <IShapeFactory, object> form =
                shape => {
                var f = Shape.Form(
                    _Format: Shape.SelectList(
                        Id: "format", Name: "Format",
                        Title: T("Date format"),
                        Size: 1,
                        Multiple: false
                        )
                    );

                f._Format.Add(new SelectListItem {
                    Value = "d", Text = T("Short date pattern: 6/15/2009").Text
                });
                f._Format.Add(new SelectListItem {
                    Value = "D", Text = T("Long date pattern: Monday, June 15, 2009").Text
                });
                f._Format.Add(new SelectListItem {
                    Value = "f", Text = T("Full date/time pattern (short time): Monday, June 15, 2009 1:45 PM").Text
                });
                f._Format.Add(new SelectListItem {
                    Value = "F", Text = T("Full date/time pattern (long time): Monday, June 15, 2009 1:45:30 PM").Text
                });
                f._Format.Add(new SelectListItem {
                    Value = "g", Text = T("General date/time pattern (short time): 6/15/2009 1:45 PM").Text
                });
                f._Format.Add(new SelectListItem {
                    Value = "G", Text = T("General date/time pattern (long time): 6/15/2009 1:45:30 PM").Text
                });
                f._Format.Add(new SelectListItem {
                    Value = "M", Text = T("Month/day pattern: June 15").Text
                });
                f._Format.Add(new SelectListItem {
                    Value = "O", Text = T("Round-trip date/time pattern: 2009-06-15T13:45:30.0900000").Text
                });
                f._Format.Add(new SelectListItem {
                    Value = "R", Text = T("RFC1123 pattern: Mon, 15 Jun 2009 20:45:30 GMT").Text
                });
                f._Format.Add(new SelectListItem {
                    Value = "s", Text = T("Sortable date/time pattern: 2009-06-15T13:45:30").Text
                });
                f._Format.Add(new SelectListItem {
                    Value = "t", Text = T("Long time pattern: 1:45 PM").Text
                });
                f._Format.Add(new SelectListItem {
                    Value = "T", Text = T("Long time pattern: 1:45:30 PM").Text
                });
                f._Format.Add(new SelectListItem {
                    Value = "u", Text = T("Universal sortable date/time pattern: 2009-06-15 20:45:30Z").Text
                });
                f._Format.Add(new SelectListItem {
                    Value = "U", Text = T("Universal full date/time pattern:  Monday, June 15, 2009 8:45:30 PM").Text
                });
                f._Format.Add(new SelectListItem {
                    Value = "Y", Text = T("Year month pattern: June, 2009").Text
                });
                f._Format.Add(new SelectListItem {
                    Value = "day", Text = T("Day: 15").Text
                });
                f._Format.Add(new SelectListItem {
                    Value = "month", Text = T("Month: 6").Text
                });
                f._Format.Add(new SelectListItem {
                    Value = "year", Text = T("Year: 2009").Text
                });
                f._Format.Add(new SelectListItem {
                    Value = "dayOfYear", Text = T("Day of year: 166").Text
                });
                f._Format.Add(new SelectListItem {
                    Value = "ago", Text = T("Time ago").Text
                });

                return(f);
            };

            context.Form(FormName, form);
        }
Example #23
0
        public void Describe(DescribeContext context)
        {
            context.Form("ReactionsFilterForm", shape => {
                var f = _shapeFactory.Form(
                    Id: "ReactionsFilterForm",

                    _Reaction: _shapeFactory.FieldSet(
                        Id: "reaction",
                        _Reaction: _shapeFactory.TextBox(
                            Name: "Reaction",
                            Title: T("Reactions types"),
                            Classes: new[] { "tokenized" }
                            )
                        ),

                    _ReactionTitle: _shapeFactory.Markup(
                        Value: "<fieldset><legend>" + T("List of available reactions") + ":</legend>"
                        ),

                    _ReactionsList: _shapeFactory.List(
                        Id: "reactionslist"
                        ),

                    _ReactionPanel: _shapeFactory.Markup(
                        Value: " </fieldset>"
                        ),

                    _Operator: _shapeFactory.SelectList(
                        Id: "operator", Name: "Operator",
                        Title: T("Operator"),
                        Size: 1,
                        Multiple: false
                        ),

                    _FieldSetSingle: _shapeFactory.FieldSet(
                        Id: "fieldset-single",
                        _Value: _shapeFactory.TextBox(
                            Id: "value", Name: "Value",
                            Title: T("Value"),
                            Classes: new[] { "tokenized" }
                            )
                        ),

                    _FieldSetMin: _shapeFactory.FieldSet(
                        Id: "fieldset-min",
                        _Min: _shapeFactory.TextBox(
                            Id: "min", Name: "Min",
                            Title: T("Min"),
                            Classes: new[] { "tokenized" }
                            )
                        ),

                    _FieldSetMax: _shapeFactory.FieldSet(
                        Id: "fieldset-max",
                        _Max: _shapeFactory.TextBox(
                            Id: "max", Name: "Max",
                            Title: T("Max"),
                            Classes: new[] { "tokenized" }
                            )
                        )
                    );

                var reactionTypes = _reactionsService.GetTypesTableFiltered();
                foreach (var item in reactionTypes)
                {
                    f._ReactionsList.Add(item.TypeName);
                }

                _resourceManager.Value.Include("script", "~/Modules/Orchard.Projections/Scripts/numeric-editor-filter.js", "~/Modules/Orchard.Projections/Scripts/numeric-editor-filter.js");

                f._Operator.Add(new SelectListItem {
                    Value = Convert.ToString(UserReactionsFieldOperator.Equals), Text = T("Is equal to").Text
                });
                f._Operator.Add(new SelectListItem {
                    Value = Convert.ToString(UserReactionsFieldOperator.NotEquals), Text = T("Is not equal to").Text
                });
                f._Operator.Add(new SelectListItem {
                    Value = Convert.ToString(UserReactionsFieldOperator.Between), Text = T("Is between to").Text
                });
                f._Operator.Add(new SelectListItem {
                    Value = Convert.ToString(UserReactionsFieldOperator.GreaterThan), Text = T("Is greater than").Text
                });
                f._Operator.Add(new SelectListItem {
                    Value = Convert.ToString(UserReactionsFieldOperator.GreaterThanEquals), Text = T("Is greater than or equal").Text
                });
                f._Operator.Add(new SelectListItem {
                    Value = Convert.ToString(UserReactionsFieldOperator.LessThan), Text = T("Is less than").Text
                });
                f._Operator.Add(new SelectListItem {
                    Value = Convert.ToString(UserReactionsFieldOperator.LessThanEquals), Text = T("Is less than or equal").Text
                });
                f._Operator.Add(new SelectListItem {
                    Value = Convert.ToString(UserReactionsFieldOperator.NotBetween), Text = T("Not between").Text
                });
                return(f);
            });
        }
Example #24
0
        public void Describe(DescribeContext context)
        {
            Func <IShapeFactory, object> form =
                shape => {
                var f = Shape.Form(
                    Id: "NumericFilter",
                    _Operator: Shape.SelectList(
                        Id: "operator", Name: "Operator",
                        Title: T("Operator"),
                        Size: 1,
                        Multiple: false
                        ),
                    _FieldSetSingle: Shape.FieldSet(
                        Id: "fieldset-single",
                        _Value: Shape.TextBox(
                            Id: "value", Name: "Value",
                            Title: T("Value"),
                            Classes: new[] { "tokenized" }
                            )
                        ),
                    _FieldSetMin: Shape.FieldSet(
                        Id: "fieldset-min",
                        _Min: Shape.TextBox(
                            Id: "min", Name: "Min",
                            Title: T("Min"),
                            Classes: new[] { "tokenized" }
                            )
                        ),
                    _FieldSetMax: Shape.FieldSet(
                        Id: "fieldset-max",
                        _Max: Shape.TextBox(
                            Id: "max", Name: "Max",
                            Title: T("Max"),
                            Classes: new[] { "tokenized" }
                            )
                        )
                    );

                _resourceManager.Value.Require("script", "jQuery");
                _resourceManager.Value.Include("script", "~/Modules/Tomelt.Projections/Scripts/numeric-editor-filter.js", "~/Modules/Tomelt.Projections/Scripts/numeric-editor-filter.js");

                f._Operator.Add(new SelectListItem {
                    Value = Convert.ToString(NumericOperator.LessThan), Text = T("Is less than").Text
                });
                f._Operator.Add(new SelectListItem {
                    Value = Convert.ToString(NumericOperator.LessThanEquals), Text = T("Is less than or equal to").Text
                });
                f._Operator.Add(new SelectListItem {
                    Value = Convert.ToString(NumericOperator.Equals), Text = T("Is equal to").Text
                });
                f._Operator.Add(new SelectListItem {
                    Value = Convert.ToString(NumericOperator.NotEquals), Text = T("Is not equal to").Text
                });
                f._Operator.Add(new SelectListItem {
                    Value = Convert.ToString(NumericOperator.GreaterThanEquals), Text = T("Is greater than or equal to").Text
                });
                f._Operator.Add(new SelectListItem {
                    Value = Convert.ToString(NumericOperator.GreaterThan), Text = T("Is greater than").Text
                });
                f._Operator.Add(new SelectListItem {
                    Value = Convert.ToString(NumericOperator.Between), Text = T("Is between").Text
                });
                f._Operator.Add(new SelectListItem {
                    Value = Convert.ToString(NumericOperator.NotBetween), Text = T("Is not between").Text
                });

                return(f);
            };

            context.Form(FormName, form);
        }
Example #25
0
        public override void Describe(DescribeContext <ContentItem> context)
        {
            context.For <TimeFieldIndex>()
            .Map(contentItem =>
            {
                // Can we safely ignore this content item?
                if (_ignoredTypes.Contains(contentItem.ContentType))
                {
                    return(null);
                }

                if (!contentItem.Latest && !contentItem.Published)
                {
                    return(null);
                }

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

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

                var results = new List <TimeFieldIndex>();

                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 <TimeField>();

                    results.Add(new TimeFieldIndex
                    {
                        Latest               = contentItem.Latest,
                        Published            = contentItem.Published,
                        ContentItemId        = contentItem.ContentItemId,
                        ContentItemVersionId = contentItem.ContentItemVersionId,
                        ContentType          = contentItem.ContentType,
                        ContentPart          = fieldDefinition.PartDefinition.Name,
                        ContentField         = fieldDefinition.Name,
                        Time = field.Value
                    });
                }

                return(results);
            });
        }
 public void Describe(DescribeContext context) {
     context.For("Shape", T("Shape"), T("Shape tokens."))
         .Token("Execute:*", T("Execute:<shape name>"), T("Executes the specified shape."));
 }
Example #27
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 #28
0
        public void Describe(DescribeContext context)
        {
            context.Form("ActivityWeiXinEventKey", shape => Shape.Form(
                             Id: "ActivityWeiXinEventKey",
                             _Type: Shape.SelectList(
                                 Id: "EventType", Name: "EventType",
                                 Title: T("用户消息的事件类型"),
                                 Description: T("请选择一个消息事件类型."))
                             .Add(new SelectListItem {
                Value = "VIEW", Text = T("菜单跳转").Text
            })
                             .Add(new SelectListItem {
                Value = "CLICK", Text = T("菜单点击").Text
            })
                             .Add(new SelectListItem {
                Value = "SCAN", Text = T("扫描二维码[用户已经关注]").Text
            })
                             .Add(new SelectListItem {
                Value = "subscribe", Text = T("扫描二维码[用户首次关注]").Text
            })
                             .Add(new SelectListItem {
                Value = "unsubscribe", Text = T("用户取消关注").Text
            }),

                             _EventKey: Shape.Textbox(
                                 Id: "eventKey", Name: "EventKey",
                                 Title: T("EventKey"),
                                 Description: T(@"菜单跳转:跳转的Url<br/>
菜单点击:自定义的EventKey<br/>
首次关注:qrscene_二维码参数值<br/>
已关注:二维码scene_id<br/>
取消关注:忽略此值.<br/>
如果不填,则不对此类消息进行过滤!"),
                                 Classes: new[] { "medium" })
                             ));

            context.Form("ActivityWeiXinLocation", shape => Shape.Form(
                             Id: "ActivityWeiXinLocation",
                             _lat1: Shape.Textbox(
                                 Id: "lat1", Name: "lat1",
                                 Title: T("参照点位置的纬度"),
                                 Description: T("参照点位置的纬度,可以用<a href='http://api.map.baidu.com/lbsapi/getpoint/index.html' target='_blank'>百度地图工具</a>拾取经纬度."),
                                 Classes: new[] { "medium" }),

                             _lng1: Shape.Textbox(
                                 Id: "lng1", Name: "lng1",
                                 Title: T("参照点位置的经度"),
                                 Description: T("参照点位置的经度"),
                                 Classes: new[] { "medium" }),

                             _Distance: Shape.Textbox(
                                 Id: "distance", Name: "distance",
                                 Title: T("用户距离参照点的距离"),
                                 Description: T("用户距离参照点的距离,单位公里"),
                                 Classes: new[] { "medium" })
                             ));

            context.Form("ActivityWeiXinText", shape => Shape.Form(
                             Id: "ActivityWeiXinText",
                             _Operator: Shape.SelectList(
                                 Id: "operator", Name: "operator",
                                 Title: T("运算符"),
                                 Description: T("请选择一个运算符测试用户发送的文本消息."))
                             .Add(new SelectListItem {
                Value = "Equals", Text = T("等于").ToString()
            })
                             .Add(new SelectListItem {
                Value = "NotEquals", Text = T("不等于").ToString()
            })
                             .Add(new SelectListItem {
                Value = "Contains", Text = T("包含").ToString()
            })
                             .Add(new SelectListItem {
                Value = "NotContains", Text = T("不包含").ToString()
            })
                             .Add(new SelectListItem {
                Value = "Starts", Text = T("开始于").ToString()
            })
                             .Add(new SelectListItem {
                Value = "NotStarts", Text = T("不开始于").ToString()
            })
                             .Add(new SelectListItem {
                Value = "Ends", Text = T("结束于").ToString()
            })
                             .Add(new SelectListItem {
                Value = "NotEnds", Text = T("不结束于").ToString()
            }),
                             _Text: Shape.TextArea(
                                 Id: "textValue", Name: "textValue",
                                 Title: T("值"),
                                 Description: T("用来测试的字符串值."),
                                 Classes: new[] { "large", "text", "tokenized" }
                                 )));
        }
        public void Describe(DescribeContext context)
        {
            Func <IShapeFactory, object> filterForm = shape =>
            {
                var taxonomies = _taxonomyService.GetTaxonomies().OrderBy(taxonomy => taxonomy.Name).ToList();

                var form = _shapeFactory.Form(
                    Id: FormName,
                    _ContainsOrNot: _shapeFactory.FieldSet(
                        _Contains: _shapeFactory.Radio(
                            Id: "contains", Name: nameof(TokenizedTaxonomyTermsFilterFormElements.Contains),
                            Title: T("Content that has"), Value: "true", Checked: true
                            ),
                        _NotContains: _shapeFactory.Radio(
                            Id: "notContains", Name: nameof(TokenizedTaxonomyTermsFilterFormElements.Contains),
                            Title: T("Content that doesn't have"), Value: "false"
                            )
                        ),
                    _Operator: _shapeFactory.FieldSet(
                        _AnyTerm: _shapeFactory.Radio(
                            Id: "operatorAnyTerm", Name: nameof(TokenizedTaxonomyTermsFilterFormElements.Operator),
                            Title: T("Any Term"), Value: "0", Checked: true
                            ),
                        _AllTerms: _shapeFactory.Radio(
                            Id: "operatorAllTerms", Name: nameof(TokenizedTaxonomyTermsFilterFormElements.Operator),
                            Title: T("All Terms"), Value: "1"
                            )
                        ),
                    _Property: _shapeFactory.FieldSet(
                        _PropertyId: _shapeFactory.Radio(
                            Id: "termPropertyId", Name: nameof(TokenizedTaxonomyTermsFilterFormElements.TermProperty),
                            Title: T("Defined by the Id"), Value: nameof(TermPart.Id), Checked: true
                            ),
                        _PropertyName: _shapeFactory.Radio(
                            Id: "termPropertyName", Name: nameof(TokenizedTaxonomyTermsFilterFormElements.TermProperty),
                            Title: T("Defined by the Name"), Value: nameof(TermPart.Name)
                            )
                        ),
                    _Terms: _shapeFactory.Textbox(
                        Id: "terms", Name: nameof(TokenizedTaxonomyTermsFilterFormElements.Terms),
                        Classes: new[] { "text", "medium", "tokenized" },
                        Title: T("Terms"),
                        Description: T("The comma-separated list of Taxonomy Terms (based on their property selected above) to filter content items with.")),
                    _Taxonomies: _shapeFactory.SelectList(
                        Id: "taxonomyId", Name: nameof(TokenizedTaxonomyTermsFilterFormElements.TaxonomyAliases),
                        Title: T("That belong to the Taxonomy"),
                        Description: T("Select the Taxonomy that the Terms to filter on belong to. When filtering Terms based on their Id, selecting Taxonomies does not have an effect, but filtering on their Names may yield unexpected results when a Taxonomy is not defined and the same Term name occurs across multiple Taxonomies on the given content."),
                        Size: Math.Min(taxonomies.Count() + 1, 11),
                        Multiple: true)
                    );

                form._Taxonomies.Add(new SelectListItem {
                    Value = "", Text = T("<None>").Text
                });
                foreach (var taxonomy in taxonomies)
                {
                    form._Taxonomies.Add(new SelectListItem
                    {
                        Value = taxonomy.ContentItem?.As <IAliasAspect>().Path ?? taxonomy.Id.ToString(),
                        Text  = taxonomy.Name
                    });
                }

                return(form);
            };

            context.Form(FormName, filterForm);
        }
Example #30
0
 public void Describe(DescribeContext context)
 {
     context.For("Workflow", T("Workflow"), T("Workflow tokens."))
     .Token("State:*", T("State:<workflowcontext path>"), T("The workflow context state to access. Workflow.State:MyData.MyProperty.SubProperty"))
     ;
 }
Example #31
0
        public override void Describe(DescribeContext <ContentItem> context)
        {
            context.For <TaxonomyIndex>()
            .Map(contentItem =>
            {
                if (!contentItem.IsPublished())
                {
                    return(null);
                }

                // 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 Taxonomy fields
                var fieldDefinitions = _contentDefinitionManager
                                       .GetTypeDefinition(contentItem.ContentType)
                                       .Parts.SelectMany(x => x.PartDefinition.Fields.Where(f => f.FieldDefinition.Name == nameof(TaxonomyField)))
                                       .ToArray();

                // This type doesn't have any TaxonomyField, ignore it
                if (fieldDefinitions.Length == 0)
                {
                    _ignoredTypes.Add(contentItem.ContentType);
                    return(null);
                }

                var results = new List <TaxonomyIndex>();

                // 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 <TaxonomyField>();

                    foreach (var termContentItemId in field.TermContentItemIds)
                    {
                        results.Add(new TaxonomyIndex
                        {
                            TaxonomyContentItemId = field.TaxonomyContentItemId,
                            ContentItemId         = contentItem.ContentItemId,
                            ContentType           = contentItem.ContentType,
                            ContentPart           = fieldDefinition.PartDefinition.Name,
                            ContentField          = fieldDefinition.Name,
                            TermContentItemId     = termContentItemId,
                        });
                    }
                }

                return(results);
            });
        }