public void Describe(DescribeContext context)
        {
            Func<IShapeFactory, object> form = shapeFactory =>
            {
                var shape = (dynamic)shapeFactory;
                var formShape = shape.Form
                (
                    Id: "Terms",
                    _Terms: shape.TextBox
                    (
                        Id: "termids", Name: "TermIds",
                        Title: T("Terms"),
                        Description: T("Enter one or more term IDs, seperated by a comma. Tip: you can use tokens such as #{Request.CurrentContent.Fields.MyTaxonomyField.Terms:0} to get the terms for the currently routed content item."),
                        Classes: "text large tokenized"
                    ),
                    _Exclusion: shape.FieldSet
                    (
                        _OperatorOneOf: shape.Radio
                        (
                            Id: "operator-is-one-of", Name: "Operator",
                            Title: T("Is one of"), Value: "0", Checked: true
                        ),
                        _OperatorIsAllOf: shape.Radio
                        (
                            Id: "operator-is-all-of", Name: "Operator",
                            Title: T("Is all of"), Value: "1"
                        )
                    )
                );

                return formShape;
            };

            context.Form("EnterTerms", form);
        }
示例#2
0
        void IFormProvider.Describe(DescribeContext context) {
            context.Form("SignInUser", factory => {
                var shape = (dynamic) factory;
                var form = shape.Form(
                    Id: "signInUser",
                    _UserName: shape.Textbox(
                        Id: "userNameOrEmail",
                        Name: "UserNameOrEmail",
                        Title: T("User Name or Email"),
                        Description: T("The user name or email of the user to sign in."),
                        Classes: new[]{"text", "large", "tokenized"}),
                    _Password: shape.Textbox(
                        Id: "password",
                        Name: "Password",
                        Title: T("Password"),
                        Description: T("The password of the user to sign in."),
                        Classes: new[] { "text", "large", "tokenized" }),
                    _CreatePersistentCookie: shape.Textbox(
                        Id: "createPersistentCookie",
                        Name: "CreatePersistentCookie",
                        Title: T("Create Persistent Cookie"),
                        Description: T("A value evaluating to 'true' to create a persistent cookie."),
                        Classes: new[]{"text", "large", "tokenized"}));

                return form;
            });
        }
示例#3
0
        public void Describe(DescribeContext context) {
            Func<IShapeFactory, object> form =
                shape => {
                    var operators = new List<SelectListItem> {
                        new SelectListItem {Value = Convert.ToString(StringOperator.Equals), Text = T("Is equal to").Text},
                        new SelectListItem {Value = Convert.ToString(StringOperator.NotEquals), Text = T("Is not equal to").Text},
                        new SelectListItem {Value = Convert.ToString(StringOperator.Contains), Text = T("Contains").Text},
                        new SelectListItem {Value = Convert.ToString(StringOperator.ContainsAny), Text = T("Contains any word").Text},
                        new SelectListItem {Value = Convert.ToString(StringOperator.ContainsAll), Text = T("Contains all words").Text},
                        new SelectListItem {Value = Convert.ToString(StringOperator.Starts), Text = T("Starts with").Text},
                        new SelectListItem {Value = Convert.ToString(StringOperator.NotStarts), Text = T("Does not start with").Text},
                        new SelectListItem {Value = Convert.ToString(StringOperator.Ends), Text = T("Ends with").Text},
                        new SelectListItem {Value = Convert.ToString(StringOperator.NotEnds), Text = T("Does not end with").Text},
                        new SelectListItem {Value = Convert.ToString(StringOperator.NotContains), Text = T("Does not contain").Text}
                    };

                    var f = Shape.FilterEditors_StringFilter(
                        Id: FormName,
                        Operators: operators
                        );

                    return f;
                };

            context.Form(FormName, form);
        }
示例#4
0
        public void Describe(DescribeContext context)
        {
            Func<IShapeFactory, dynamic> form =
                shape => {

                    var f = Shape.Form(
                        Id: "AnyOfRoles",
                        _Parts: Shape.SelectList(
                            Id: "role", Name: "Roles",
                            Title: T("Roles"),
                            Description: T("Select some roles."),
                            Size: 10,
                            Multiple: true
                            )
                        );

                    f._Parts.Add(new SelectListItem { Value = "", Text = T("Any").Text });

                    foreach (var role in _roleService.GetRoles().OrderBy(x => x.Name)) {
                        f._Parts.Add(new SelectListItem { Value = role.Name, Text = role.Name });
                    }

                    return f;
                };

            context.Form("SelectRoles", form);
        }
示例#5
0
        void IFormProvider.Describe(DescribeContext context) {
            context.Form("CreateUser", factory => {
                var shape = (dynamic) factory;
                var form = shape.Form(
                    Id: "createUser",
                    _UserName: shape.Textbox(
                        Id: "userName",
                        Name: "UserName",
                        Title: T("User Name"),
                        Description: T("The user name of the user to be created."),
                        Classes: new[]{"text", "large", "tokenized"}),
                    _Email: shape.Textbox(
                        Id: "email",
                        Name: "Email",
                        Title: T("Email"),
                        Description: T("The email address of the user to be created."),
                        Classes: new[] { "text", "large", "tokenized" }),
                    _Password: shape.Textbox(
                        Id: "password",
                        Name: "Password",
                        Title: T("Password"),
                        Description: T("The password of the user to be created."),
                        Classes: new[] { "text", "large", "tokenized" }),
                    _Approved: shape.Checkbox(
                        Id: "approved",
                        Name: "Approved",
                        Title: T("Approved"),
                        Description: T("Check to approve the created user."),
                        Value: true));

                return form;
            });
        }
示例#6
0
        public void Describe(DescribeContext context) {
            Func<IShapeFactory, object> form =
                shape => {
                    var f = Shape.Form(
                        Id: "FormatFilter",
                        _Format: Shape.SelectList(
                            Id: "format", Name: "Format",
                            Title: T("Format"),
                            Description: T("The target format of the image."),
                            Size: 1,
                            Multiple: false),
                        _Quality: Shape.Textbox(
                            Id: "quality", Name: "Quality",
                            Title: T("Quality"),
                            Value: 90,
                            Description: T("JPeg compression quality, from 0 to 100."),
                            Classes: new[] { "text small" })
                        );

                    f._Format.Add(new SelectListItem { Value = "jpg", Text = T("Jpeg").Text });
                    f._Format.Add(new SelectListItem { Value = "gif", Text = T("Gif").Text });
                    f._Format.Add(new SelectListItem { Value = "png", Text = T("Png").Text });

                    return f;
                };

            context.Form("FormatFilter", form);
        }
        public void Describe(DescribeContext context) {
            Func<IShapeFactory, object> form =
                shape => {

                    var f = Shape.Form(
                        Id: "AnyOfContentPartRecords",
                        _Parts: Shape.SelectList(
                            Id: "contentpartrecordss", Name: "ContentPartRecords",
                            Title: T("Content part records"),
                            Description: T("Select some content part records."),
                            Size: 10,
                            Multiple: true
                            )
                        );

                    foreach (var recordBluePrint in _shellBlueprint.Records.OrderBy(x => x.Type.Name)) {
                        if (typeof(ContentPartRecord).IsAssignableFrom(recordBluePrint.Type) || typeof(ContentPartVersionRecord).IsAssignableFrom(recordBluePrint.Type)) {
                            f._Parts.Add(new SelectListItem { Value = recordBluePrint.Type.Name, Text = recordBluePrint.Type.Name });
                        }
                    }

                    return f;
                };

            context.Form("ContentPartRecordsForm", form);

        }
示例#8
0
        public void Describe(DescribeContext context) {
            Func<IShapeFactory, object> form =
                shape => {

                    var f = Shape.Form(
                        Id: "AnyOfContentTypes",
                        _Parts: Shape.SelectList(
                            Id: "contenttypes", Name: "ContentTypes",
                            Title: T("Content types"),
                            Description: T("Select some content types."),
                            Size: 10,
                            Multiple: true
                            )
                        );

                    f._Parts.Add(new SelectListItem { Value = "", Text = T("Any").Text });

                    foreach (var contentType in _contentDefinitionManager.ListTypeDefinitions().OrderBy(x => x.DisplayName)) {
                        f._Parts.Add(new SelectListItem { Value = contentType.Name, Text = contentType.DisplayName });
                    }

                    return f;
                };

            context.Form("ContentTypesFilter", form);

        }
示例#9
0
        public void Describe(DescribeContext context) {
            Func<IShapeFactory, dynamic> form =
                shape => {

                    var f = Shape.Form(
                        Id: "AnyOfRoles",
                        _Parts: Shape.SelectList(
                            Id: "role", Name: "Roles",
                            Title: T("Roles"),
                            Description: T("Select some roles."),
                            Size: 10,
                            Multiple: true
                            ),
                        _Message: Shape.Textbox(
                            Id: "actions", Name: "Actions",
                            Title: T("Available actions."),
                            Description: T("A comma separated list of actions."),
                            Classes: new[] { "text medium" })
                        );

                    f._Parts.Add(new SelectListItem { Value = "", Text = T("Any").Text });

                    foreach (var role in _roleService.GetRoles().OrderBy(x => x.Name)) {
                        f._Parts.Add(new SelectListItem { Value = role.Name, Text = role.Name });
                    }

                    return f;
                };

            context.Form("ActivityUserTask", form);

        }
示例#10
0
        public void Describe(DescribeContext context) {
            context.Form("ActivityTimer",
                shape => {
                    var form = Shape.Form(
                        Id: "ActionDelay",
                        _Amount: Shape.Textbox(
                            Id: "Amount", Name: "Amount",
                            Title: T("Amount"),
                            Description: T("Amount of time units to add."),
                            Classes: new[] { "text small tokenized" }),
                        _Type: Shape.SelectList(
                            Id: "Unity", Name: "Unity",
                            Title: T("Amount type"))
                            .Add(new SelectListItem { Value = "Minute", Text = T("Minutes").Text, Selected = true })
                            .Add(new SelectListItem { Value = "Hour", Text = T("Hours").Text })
                            .Add(new SelectListItem { Value = "Day", Text = T("Days").Text })
                            .Add(new SelectListItem { Value = "Week", Text = T("Weeks").Text })
                            .Add(new SelectListItem { Value = "Month", Text = T("Months").Text }),
                        _Date: Shape.Textbox(
                            Id: "Date", Name: "Date",
                            Title: T("Date"),
                            Description: T("Optional. Starting date/time to calculate difference from. Leave blank to use current date/time."),
                            Classes: new[] {"text medium tokenized"}));

                    return form;
                }
            );
        }
示例#11
0
        public void Describe(DescribeContext context) {
            Func<IShapeFactory, object> form =
                shape => {
                    var f = Shape.Form(
                        Id: "BooleanFilter",
                        _Options: Shape.Fieldset(
                            _ValueUndefined: Shape.Radio(
                                Id: "value-undefined", Name: "Value",
                                Title: T("Undefined"), Value: "undefined"
                                ),
                            _LabelTrue: Shape.InputLabel(
                                Title: T("Yes"),
                                For: "value-true"
                                ),
                            _ValueTrue: Shape.Radio(
                                Id: "value-true", Name: "Value",
                                Title: T("Yes"), Value: "true", Checked: true
                                ),
                            _ValueFalse: Shape.Radio(
                                Id: "value-false", Name: "Value",
                                Title: T("No"), Value: "false"
                                ),
                            Description: T("Enter the value the string should be.")
                            ));

                    return f;
                };

            context.Form(FormName, form);
        }
示例#12
0
        public void Describe(DescribeContext context) {
            Func<IShapeFactory, object> form =
                shape => {
                    var f = Shape.Form(
                        Id: "StringFilter",
                        _Operator: Shape.SelectList(
                            Id: "operator", Name: "Operator",
                            Size: 1,
                            //Classes: new[] { "show-tick" },
                            Multiple: false
                        ),
                        _Value: Shape.TextBox(
                            Id: "value", Name: "Value",
                            Classes: new[] { "filterInput" }
                            )
                        );

                    f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.Equals), Text = T("Is equal to").Text });
                    f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.NotEquals), Text = T("Is not equal to").Text });
                    f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.Contains), Text = T("Contains").Text });
                    f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.ContainsAny), Text = T("Contains any word").Text });
                    f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.ContainsAll), Text = T("Contains all words").Text });
                    f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.Starts), Text = T("Starts with").Text });
                    f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.NotStarts), Text = T("Does not start with").Text });
                    f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.Ends), Text = T("Ends with").Text });
                    f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.NotEnds), Text = T("Does not end with").Text });
                    f._Operator.Add(new SelectListItem { Value = Convert.ToString(StringOperator.NotContains), Text = T("Does not contain").Text });

                    return f;
                };

            context.Form(FormName, form);
        }
示例#13
0
        public void Describe(DescribeContext context) {
            Func<IShapeFactory, dynamic> form =
                shape => {

                    var f = Shape.Form(
                        Id: "AnyOfCustomForms",
                        _Parts: Shape.SelectList(
                            Id: "customforms", Name: "CustomForms",
                            Title: T("Custom Forms"),
                            Description: T("Select some custom forms."),
                            Size: 10,
                            Multiple: true
                            )
                        );

                    f._Parts.Add(new SelectListItem { Value = "", Text = T("Any").Text });

                    var query = _contentManager.Query().ForType("CustomForm", "CustomFormWidget");
                    var customForms = query.List().Select(x => new { ContentItem = x, Metadata = _contentManager.GetItemMetadata(x)});

                    foreach (var customForm in customForms.OrderBy(x => x.Metadata.DisplayText)) {
                        
                        f._Parts.Add(new SelectListItem { Value = customForm.Metadata.Identity.ToString(), Text = customForm.Metadata.DisplayText });
                    }

                    return f;
                };

            context.Form("SelectCustomForms", form);

        }
        protected override void DescribeForm(DescribeContext context)
        {
            context.Form("Enumeration", factory => {
                var shape = (dynamic)factory;
                var form  = shape.Fieldset(
                    Id: "Enumeration",
                    _Options: shape.Textarea(
                        Id: "Options",
                        Name: "Options",
                        Title: "Options",
                        Classes: new[] { "text", "large", "tokenized" },
                        Description: T("Enter one option per line. To differentiate between an option's text and value, separate the two by a colon. For example: &quot;Option 1:1&quot;")),
                    _InputType: shape.SelectList(
                        Id: "InputType",
                        Name: "InputType",
                        Title: "Input Type",
                        Description: T("The control to render when presenting the list of options.")));

                form._InputType.Items.Add(new SelectListItem {
                    Text = T("Select List").Text, Value = "SelectList"
                });
                form._InputType.Items.Add(new SelectListItem {
                    Text = T("Multi Select List").Text, Value = "MultiSelectList"
                });
                form._InputType.Items.Add(new SelectListItem {
                    Text = T("Radio List").Text, Value = "RadioList"
                });
                form._InputType.Items.Add(new SelectListItem {
                    Text = T("Check List").Text, Value = "CheckList"
                });

                return(form);
            });

            context.Form("EnumerationValidation", factory => {
                var shape = (dynamic)factory;
                var form  = shape.Fieldset(
                    Id: "EnumerationValidation",
                    _IsRequired: shape.Checkbox(
                        Id: "Required",
                        Name: "Required",
                        Title: "Required",
                        Value: "true",
                        Description: T("Tick this checkbox to make at least one option required.")),
                    _CustomValidationMessage: shape.Textbox(
                        Id: "CustomValidationMessage",
                        Name: "CustomValidationMessage",
                        Title: "Custom Validation Message",
                        Classes: new[] { "text", "large", "tokenized" },
                        Description: T("Optionally provide a custom validation message.")),
                    _ShowValidationMessage: shape.Checkbox(
                        Id: "ShowValidationMessage",
                        Name: "ShowValidationMessage",
                        Title: "Show Validation Message",
                        Value: "true",
                        Description: T("Autogenerate a validation message when a validation error occurs for the current field. Alternatively, to control the placement of the validation message you can use the ValidationMessage element instead.")));

                return(form);
            });
        }
        public void Describe(DescribeContext context) {
            Func<IShapeFactory, dynamic> form =
                shape => Shape.Form(
                Id: "ActionTemplatedMessage",
                _Recipient: Shape.TextBox(
                    Id: "Recipient", Name: "Recipient",
                    Title: T("Recipient"),
                    Description: "The recipient's address"),
                    Classes: new[] { "textMedium", "tokenized" },
                _TemplateId: Shape.SelectList(
                    Id: "TemplateId", Name: "TemplateId",
                    Title: T("Template"),
                    Description: T("The template of the e-mail."),
                    Items: _messageTemplateService.GetTemplates().Select(x => new SelectListItem { Text = x.Title, Value = x.Id.ToString()})
                    ),
                _Channel: Shape.SelectList(
                    Id: "Channel", Name: "Channel",
                    Title: T("Channel"),
                    Description: T("The channel through which to send the message."),
                    Items: _messageManager.GetAvailableChannelServices().Select(x => new SelectListItem { Text = x, Value = x })
                    ),
                _DataTokens: Shape.TextArea(
                    Id: "DataTokens", Name: "DataTokens",
                    Title: T("Data Tokens"),
                    Description: T("Enter a key:value pair per line. Each key will become available as a property on the ViewBag of the Razor template. E.g. \"Order:{Order.OrderNumber}\" will create a \"Order\" property on the ViewBag"),
                    Classes: new[] { "textMedium" }
                    )
                );

            context.Form("ActionTemplatedMessage", form);
        }
示例#16
0
        public void Describe(DescribeContext context)
        {
            Func<IShapeFactory, object> form =
                shape =>
                {
                    var f = _shapeFactory.Form(
                        Id: "FromShoutboxWidget",
                        _Parts: _shapeFactory.SelectList(
                            Id: "shoutbox-widget", Name: "ShoutboxWidget",
                            Title: T("Shoutbox Widget"),
                            Description: T("Select a Shoutbox widget."),
                            Size: 10,
                            Multiple: false
                            )
                        );

                    foreach (var widget in _contentManager.Query<WidgetPart, WidgetPartRecord>("ShoutboxWidget").List())
                    {
                        f._Parts.Add(new SelectListItem { Value = widget.Id.ToString(), Text = widget.Title });
                    }

                    return f;
                };

            context.Form("ShoutboxMessagesFilter", form);
        }
示例#17
0
        public void Describe(DescribeContext context)
        {
            //todo: add options:
            //1. Include Query definition in json
            //2. Require Authorization
            //3. Permission stereotype

            Func<IShapeFactory, object> form =
                shape => {

                    var f =
                        Shape.Form(
                            Id: "JsonLayout",
                            _Options: Shape.Fieldset(
                                Title: T("Fields"),
                                _ValueTrue:
                                    Shape.Checkbox(
                                        Id: "IncludeQueryDefinition",
                                        Title: T("Include Query Definition"),
                                        Checked: true,
                                        Description: T("Include the title of the query in the json results")
                                    ),
                                _ValueFalse:
                                    Shape.Checkbox(
                                        Id: "RequireAuthorization",
                                        Title: T("Require Authorization"),
                                        Checked: false,
                                        Description: T("Require user to be authorized")
                                    )
                            )
                            //_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 dowmn.")
                            //    ),
                            //_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" }
                            //    )
                            //),

                        );

                    return f;
                };

            context.Form("JsonLayout", form);
        }
示例#18
0
        public void Describe(DescribeContext context)
        {
            Func<IShapeFactory, dynamic> form =
                shape => Shape.Form(
                Id: "ActionEmail",
                _Type: Shape.FieldSet(
                    Title: T("Send to"),
                    _RecipientOwner: Shape.Radio(
                        Id: "recipient-owner",
                        Name: "Recipient",
                        Value: "owner",
                        Title: T("Owner"),
                        Description: T("The owner of the content item in context, such as a blog post's author.")
                    ),
                    _RecipientAuthor: Shape.Radio(
                        Id: "recipient-author",
                        Name: "Recipient",
                        Value: "author",
                        Title: T("Author"),
                        Description: T("The current user when this action executes.")
                    ),
                    _RecipientAdmin: Shape.Radio(
                        Id: "recipient-admin",
                        Name: "Recipient",
                        Value: "admin",
                        Title: T("Site Admin"),
                        Description: T("The site administrator.")
                    ),
                    _RecipientOther: Shape.Radio(
                        Id: "recipient-other",
                        Name: "Recipient",
                        Value: "other",
                        Title: T("Other:")
                    ),
                    _OtherEmails: Shape.Textbox(
                        Id: "recipient-other-email",
                        Name: "RecipientOther",
                        Title: T("E-mail"),
                        Description: T("Specify a comma-separated list of e-mail recipients."),
                        Classes: new[] { "large", "text", "tokenized" }
                    )
                ),
                _Subject: Shape.Textbox(
                    Id: "Subject", Name: "Subject",
                    Title: T("Subject"),
                    Description: T("The subject of the e-mail."),
                    Classes: new[] { "large", "text", "tokenized" }),
                _Message: Shape.Textarea(
                    Id: "Body", Name: "Body",
                    Title: T("Body"),
                    Description: T("The body of the e-mail."),
                    Classes: new[] { "tokenized" }
                    )
                );

            context.Form("ActivityActionEmail", form);
        }
示例#19
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/Orchard.Projections/Scripts/numeric-editor-filter.js", "~/Modules/Orchard.Projections/Scripts/numeric-editor-filter.js");
                    _resourceManager.Value.Include("stylesheet", "~/Modules/Orchard.Projections/Styles/numeric-editor-filter.css", "~/Modules/Orchard.Projections/Styles/numeric-editor-filter.css");

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

        }
示例#20
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 dowmn.")
                                ),
                            _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"), 
                            _ListId: Shape.TextBox(
                                Id: "grid-id", Name: "GridId",
                                Title: T("Grid id"),
                                Description: T("The id to provide on the table element."),
                                Classes: new[] { "textMedium", "tokenized" }
                                ),
                            _ListClass: Shape.TextBox(
                                Id: "grid-class", Name: "GridClass",
                                Title: T("Grid class"),
                                Description: T("The class to provide on the table element."),
                                Classes: new[] { "textMedium", "tokenized" }
                                ),
                            _ItemClass: Shape.TextBox(
                                Id: "row-class", Name: "RowClass",
                                Title: T("Row class"),
                                Description: T("The class to provide on each row."),
                                Classes: new[] { "textMedium", "tokenized" }
                                )
                            )
                        );

                    return f;
                };

            context.Form("GridLayout", form);

        }
示例#21
0
        protected override void DescribeForm(DescribeContext context)
        {
            context.Form("EmailField", factory => {
                var shape = (dynamic)factory;
                var form  = shape.Fieldset(
                    Id: "EmailField",
                    _Value: shape.Textbox(
                        Id: "Value",
                        Name: "Value",
                        Title: "Value",
                        Classes: new[] { "text", "medium", "tokenized" },
                        Description: T("The value of this email field.")));

                return(form);
            });

            context.Form("EmailFieldValidation", factory => {
                var shape = (dynamic)factory;
                var form  = shape.Fieldset(
                    Id: "EmailFieldValidation",
                    _IsRequired: shape.Checkbox(
                        Id: "IsRequired",
                        Name: "IsRequired",
                        Title: "Required",
                        Value: "true",
                        Description: T("Tick this checkbox to make this email field a required field.")),
                    _MaximumLength: shape.Textbox(
                        Id: "MaximumLength",
                        Name: "MaximumLength",
                        Title: "Maximum Length",
                        Classes: new[] { "text", "medium", "tokenized" },
                        Description: T("The maximum length allowed.")),
                    _CompareWith: shape.Textbox(
                        Id: "CompareWith",
                        Name: "CompareWith",
                        Title: "Compare With",
                        Classes: new[] { "text", "medium", "tokenized" },
                        Description: T("The name of another field whose value must match with this email field.")),
                    _CustomValidationMessage: shape.Textbox(
                        Id: "CustomValidationMessage",
                        Name: "CustomValidationMessage",
                        Title: "Custom Validation Message",
                        Classes: new[] { "text", "large", "tokenized" },
                        Description: T("Optionally provide a custom validation message.")),
                    _ShowValidationMessage: shape.Checkbox(
                        Id: "ShowValidationMessage",
                        Name: "ShowValidationMessage",
                        Title: "Show Validation Message",
                        Value: "true",
                        Description: T("Autogenerate a validation message when a validation error occurs for the current field. Alternatively, to control the placement of the validation message you can use the ValidationMessage element instead.")));

                return(form);
            });
        }
示例#22
0
        public void Describe(DescribeContext context) {
            Func<IShapeFactory, object> form =
                shape => {
                    var operators = new List<SelectListItem> {
                        new SelectListItem {Value = Convert.ToString(ReferenceOperator.MatchesAny), Text = T("Maches any").Text},
                        new SelectListItem {Value = Convert.ToString(ReferenceOperator.NotMatchesAny), Text = T("Not mathes any").Text}
                    };
                    return Shape.FilterEditors_ReferenceFilter(Id: FormName, Operators: operators);
                };

            context.Form(FormName, form);
        }
        public void Describe(DescribeContext context) {
            Func<IShapeFactory, object> form =
                shape => {

                    var f = Shape.Form(
                        Id: "CarouselLayout",                        
                        _HtmlProperties: Shape.Fieldset(
                            Title: T("Html properties"), 
                            _ListId: Shape.TextBox(
                                Id: "outer-div-id", Name: "OuterDivId",
                                Title: T("Outer div id"),
                                Description: T("The id to provide on the div element."),
                                Classes: new[] { "textMedium", "tokenized" }
                                ),
                            _ListClass: Shape.TextBox(
                                Id: "outer-div-class", Name: "OuterDivClass",
                                Title: T("Outer div class"),
                                Description: T("The class to provide on the div element."),
                                Classes: new[] { "textMedium", "tokenized" }
                                ),
                            _InnerClass: Shape.TextBox(
                                Id: "inner-div-class", Name: "InnerDivClass",
                                Title: T("Inner div class"),
                                Description: T("The class to provide on the inner div element."),
                                Classes: new[] { "textMedium", "tokenized" }
                                ),
                             _FirstItemClass: Shape.TextBox(
                                Id: "first-item-class", Name: "FirstItemClass",
                                Title: T("First item class"),
                                Description: T("The class to provide on the first item element."),
                                Classes: new[] { "textMedium", "tokenized" }
                                ),
                            _ItemClass: Shape.TextBox(
                                Id: "item-class", Name: "ItemClass",
                                Title: T("Item class"),
                                Description: T("The class to provide on the item element."),
                                Classes: new[] { "textMedium", "tokenized" }
                                ),
							_Interval: Shape.TextBox(
								Id: "interval", Name: "Interval",
								Title: T("Interval"),
								Description: T("The amount of time to delay between automatically cycling an item. If false, carousel will not automatically cycle."),
								Classes: new[] { "textMedium", "tokenized" }
								)
                            )
                        );

                    return f;
                };

            context.Form("CarouselLayout", form);

        }
示例#24
0
 public void Describe(DescribeContext context) {
     context.Form("ActionRedirect",
         shape => New.Form(
         Id: "ActionRedirect",
         _Url: New.Textbox(
             Id: "Url", Name: "Url",
             Title: T("Url"),
             Description: T("The url to redirect to."),
             Classes: new[] { "text large", "tokenized" })
         )
     );
 }
        public void Describe(DescribeContext context) {
            var form = _shape.Form(
                Id: "PushoverMessageSettings",
                _UserSelect: _shape.SelectList(
                    Id: "UserSelect", Name: "UserSelect",
                    Title: T("Select a User...")
                ),
                _User: _shape.TextBox(
                    Id: "PushoverUser", Name: "PushoverUser",
                    Size: 255, Rows: 1,
                    Title: T("... or enter a Pushover user key"),
                    Classes: new[] {"tokenized"}),
                _Title: _shape.TextBox(
                    Id: "MessageTitle", Name: "MessageTitle",
                    Title: T("Message Title"),
                    Classes: new[] {"tokenized"}),
                _Message: _shape.TextArea(
                    Id: "MessageBody", Name: "MessageBody",
                    Title: T("Message Body"),
                    Classes: new[] {"tokenized"}
                    ),
                _Url: _shape.TextBox(
                    Id: "MessageUrl", Name: "MessageUrl",
                    Title: T("Message URL"),
                    Classes: new[] {"tokenized"}
                    ),
                _UrlTitle: _shape.TextBox(
                    Id: "MessageUrlTitle", Name: "MessageUrlTitle",
                    Title: T("Message URL Title"),
                    Classes: new[] {"tokenized"}
                    ),
                _Priority: _shape.SelectList(
                    Id: "Priority", Name: "Priority",
                    Title: T("Message Priority")
                    ),
                    _Timestamp: _shape.TextBox(
                    Id: "Timestamp", Name: "Timestamp",
                    Title: T("Timestamp"),
                    Description: T("Leave blank for the current date and time"),
                    Classes: new[] {"tokenized"})
                );

            form._Priority.Add(new SelectListItem {Value = MessagePriority.Normal.ToString(), Text = T("Normal").Text});
            form._Priority.Add(new SelectListItem {Value = MessagePriority.High.ToString(), Text = T("High").Text});

            form._UserSelect.Add(new SelectListItem {Value = "", Text = T("None").Text});
            foreach (var user in _pushover.GetPushoverUsers())
                form._UserSelect.Add(new SelectListItem {Value = user.UserKey, Text = user.DisplayText});

            context.Form("PushoverMessageSettings",
                         shape => form);
        }
示例#26
0
        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"}),
                            _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"})
                            ));

                    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);
        }
        public void Describe(DescribeContext context) {
            context.Form("DynamicFormValidatingScript", shapeFactory => {
                var shape = (dynamic) shapeFactory;
                var form = shape.Form(
                    Id: "DynamicFormValidatingScript",
                    _Script: shape.TextArea(
                        Id: "Script",
                        Name: "Script",
                        Title: T("Script"),
                        Description: T("The script to validate the submitted form. You can use ContentItem, Services, WorkContext, Workflow and T(). Call AddModelError(string key, LocalizedString errorMessage) to add modelstate errors."),
                        Classes: new[] {"tokenized"}));

                return form;
            });
        }
 public void Describe(DescribeContext context)
 {
     context.Form("SchedulerEventsForm",
         shape =>
         {                    
             return _shapeFactory.Form(
                 Id: "Schedule",
                 _Schedules: _shapeFactory.SelectTable(
                     Id: "Name", 
                     Name: "Name", 
                     Title: T("Schedules"),
                     Description: T("The Schedule that you would like to trigger the event"))
                     .AddRange(_namedEventProvider.GetNamedEvents().Select(x => new SelectListItem { Text = x, Value = x })));
         });
 }
示例#29
0
        public void Describe(DescribeContext context) {
            Func<IShapeFactory, object> form =
                shape => {

                    var f = Shape.Form(
                        Id: "ListLayout",
                        _Options: Shape.Fieldset(
                            Title: T("Order"),
                            _ValueTrue: Shape.Radio(
                                Id: "unordered", Name: "Order",
                                Checked: true,
                                Title: T("Unordered list"), Value: "unordered"
                                ),
                            _ValueFalse: Shape.Radio(
                                Id: "ordered", Name: "Order",
                                Title: T("Ordered list"), Value: "ordered"
                                )
                            ),
                        _HtmlProperties: Shape.Fieldset(
                            Classes: new []{"expando"},
                            Title: T("Html properties"), 
                            _ListId: Shape.TextBox(
                                Id: "list-id", Name: "ListId",
                                Title: T("List id"),
                                Description: T("The id to provide on the list element."),
                                Classes: new[] { "textMedium", "tokenized" }
                                ),
                            _ListClass: Shape.TextBox(
                                Id: "list-class", Name: "ListClass",
                                Title: T("List class"),
                                Description: T("The class to provide on the list element."),
                                Classes: new[] { "textMedium", "tokenized" }
                                ),
                            _ItemClass: Shape.TextBox(
                                Id: "item-class", Name: "ItemClass",
                                Title: T("Item class"),
                                Description: T("The class to provide on each list item."),
                                Classes: new[] { "textMedium", "tokenized" }
                                )
                            )
                        );

                    return f;
                };

            context.Form("ListLayout", form);

        }
        protected override void DescribeForm(DescribeContext context)
        {
            context.Form("CustomTextAreaValidation", factory => {
                var shape = (dynamic)factory;
                var form  = shape.Fieldset(
                    Id: "CustomTextAreaValidation",
                    _IfEmptyRequire: shape.Textbox(
                        Id: "IfEmptyRequire",
                        Name: "IfEmptyRequire",
                        Title: "If Empty, Require",
                        Classes: new[] { "text", "medium", "tokenized" },
                        Description: T("The name of the field that is required if this field is empty.")));

                return(form);
            });
        }
示例#31
0
        public void Describe(DescribeContext context)
        {
            context.Form("Placeholder", factory => {
                var shape = (dynamic)factory;
                var form  = shape.Fieldset(
                    Id: "Placeholder",
                    _Placeholder: shape.Textbox(
                        Id: "Placeholder",
                        Name: "Placeholder",
                        Title: "Placeholder",
                        Classes: new[] { "text", "large", "tokenized" },
                        Description: T("The text to render as placeholder.")));

                return(form);
            });
        }
        protected override void DescribeForm(DescribeContext context)
        {
            context.Form("HiddenField", factory => {
                var shape = (dynamic)factory;
                var form  = shape.Fieldset(
                    Id: "HiddenField",
                    _Span: shape.Textbox(
                        Id: "Value",
                        Name: "Value",
                        Title: "Value",
                        Classes: new[] { "text", "medium", "tokenized" },
                        Description: T("The value of this hidden field.")));

                return(form);
            });
        }
示例#33
0
        protected override void DescribeForm(DescribeContext context)
        {
            context.Form("ValidationMessage", factory => {
                var shape = (dynamic)factory;
                var form  = shape.Fieldset(
                    Id: "ValidationMessage",
                    _ValidationMessageFor: shape.Textbox(
                        Id: "For",
                        Name: "For",
                        Title: "For",
                        Classes: new[] { "text", "large", "tokenized" },
                        Description: T("The name of the field this validation message is for.")));

                return(form);
            });
        }
        public void Describe(DescribeContext context)
        {
            Func<IShapeFactory, object> form =
                shape => {

                    var f = Shape.Form(
                        Id: "CarouselLayout",
                        _HtmlProperties: Shape.Fieldset(
                            Title: T("Html properties"),
                            _ListId: Shape.TextBox(
                                Id: "outer-grid-id", Name: "OuterDivId",
                                Title: T("Outer div id"),
                                Description: T("The id to provide on the div element."),
                                Classes: new[] { "textMedium", "tokenized" }
                                ),
                            _ListClass: Shape.TextBox(
                                Id: "outer-div-class", Name: "OuterDivClass",
                                Title: T("Outer div class"),
                                Description: T("The class to provide on the div element."),
                                Classes: new[] { "textMedium", "tokenized" }
                                ),
                            _InnerClass: Shape.TextBox(
                                Id: "inner-div-class", Name: "InnerDivClass",
                                Title: T("Inner div class"),
                                Description: T("The class to provide on the inner div element."),
                                Classes: new[] { "textMedium", "tokenized" }
                                ),
                             _FirstItemClass: Shape.TextBox(
                                Id: "first-item-class", Name: "FirstItemClass",
                                Title: T("First item class"),
                                Description: T("The class to provide on the first item element."),
                                Classes: new[] { "textMedium", "tokenized" }
                                ),
                            _ItemClass: Shape.TextBox(
                                Id: "item-class", Name: "ItemClass",
                                Title: T("Item class"),
                                Description: T("The class to provide on the item element."),
                                Classes: new[] { "textMedium", "tokenized" }
                                )
                            )
                        );

                    return f;
                };

            context.Form("CarouselLayout", form);
        }
示例#35
0
        public string Import(string formName, string state, ImportContentContext importContext) {
            var describeContext = new DescribeContext();
            foreach (var provider in _formProviders) {
                provider.Describe(describeContext);
            }

            var descriptor = describeContext.Describe().FirstOrDefault(x => x.Name == formName);

            if (descriptor == null || descriptor.Import == null) {
                return state;
            }

            var dynamicState = FormParametersHelper.ToDynamic(state);
            descriptor.Import(dynamicState, importContext);

            return FormParametersHelper.ToString(dynamicState);
        }
示例#36
0
        protected override void DescribeForm(DescribeContext context)
        {
            context.Form("Button", factory => {
                var shape = (dynamic)factory;
                var form  = shape.Fieldset(
                    Id: "Form",
                    _ButtonText: shape.Textbox(
                        Id: "Text",
                        Name: "Text",
                        Title: "Text",
                        Value: "Submit",
                        Classes: new[] { "text", "medium", "tokenized" },
                        Description: T("The button text.")));

                return(form);
            });
        }
        public void Describe(DescribeContext context) {
            context.Form("SelectDynamicForms", factory => {
                var shape = (dynamic)factory;
                 var form = shape.Form(
                    Id: "AnyOfDynamicForms",
                    _Parts: Shape.Textbox(
                        Id: "dynamicforms",
                        Name: "DynamicForms",
                        Title: T("Dynamic Forms"),
                        Description: T("Enter a comma separated list of dynamic form names. Leave empty to handle all forms."),
                        Classes: new[] { "text", "large" })
                    );

                return form;
            });

        }
示例#38
0
        protected override void DescribeForm(DescribeContext context)
        {
            context.Form("RadioButton", factory => {
                var shape = (dynamic)factory;
                var form  = shape.Fieldset(
                    Id: "RadioButton",
                    Description: T("The label for this radio button."),
                    _Value: shape.Textbox(
                        Id: "Value",
                        Name: "Value",
                        Title: "Value",
                        Classes: new[] { "text", "medium", "tokenized" },
                        Description: T("The value of this radio button.")));

                return(form);
            });
        }
        protected override void DescribeForm(DescribeContext context)
        {
            context.Form("CheckBox", factory => {
                var shape = (dynamic)factory;
                var form  = shape.Fieldset(
                    Id: "CheckBox",
                    _Value: shape.Textbox(
                        Id: "Value",
                        Name: "Value",
                        Title: "Value",
                        Classes: new[] { "text", "large", "tokenized" },
                        Description: T("The value of this checkbox.")));

                return(form);
            });

            context.Form("CheckBoxValidation", factory => {
                var shape = (dynamic)factory;
                var form  = shape.Fieldset(
                    Id: "CheckBoxValidation",
                    _IsRequired: shape.Checkbox(
                        Id: "IsMandatory",
                        Name: "IsMandatory",
                        Title: "Mandatory",
                        Value: "true",
                        Description: T("Tick this checkbox to make this check box element mandatory.")),
                    _CustomValidationMessage: shape.Textbox(
                        Id: "CustomValidationMessage",
                        Name: "CustomValidationMessage",
                        Title: "Custom Validation Message",
                        Classes: new[] { "text", "large", "tokenized" },
                        Description: T("Optionally provide a custom validation message.")),
                    _ShowValidationMessage: shape.Checkbox(
                        Id: "ShowValidationMessage",
                        Name: "ShowValidationMessage",
                        Title: "Show Validation Message",
                        Value: "true",
                        Description: T("Autogenerate a validation message when a validation error occurs for the current field. Alternatively, to control the placement of the validation message you can use the ValidationMessage element instead.")));

                return(form);
            });
        }
示例#40
0
        public void Describe(Orchard.Forms.Services.DescribeContext context)
        {
            Func <IShapeFactory, object> form =
                shape =>
            {
                var f = _shapeFactory.Form(
                    Id: "ContainedByFilterForm",
                    _Parts: _shapeFactory.Textbox(
                        Id: "ContainerId", Name: "ContainerId",
                        Title: T("Container Id"),
                        Description: T("The numerical id of the content item containing the items to fetch."),
                        Classes: new[] { "tokenized" })
                    );


                return(f);
            };

            context.Form("ContainedByFilter", form);
        }
示例#41
0
        public void Describe(Orchard.Forms.Services.DescribeContext context)
        {
            Func <IShapeFactory, object> form =
                shape =>
            {
                var f = _shapeFactory.Form(
                    Id: "IdsInFilterForm",
                    _Parts: _shapeFactory.Textbox(
                        Id: "ContentIds", Name: "ContentIds",
                        Title: T("Contents Ids"),
                        Description: T("A comma-separated list of the ids of contents to match. Items should have CommonPart attached."),
                        Classes: new[] { "tokenized" })
                    );


                return(f);
            };

            context.Form("IdsInFilter", form);
        }
        protected override void DescribeForm(DescribeContext context)
        {
            context.Form("Label", factory => {
                var shape = (dynamic)factory;
                var form  = shape.Fieldset(
                    Id: "Label",
                    _LabelText: shape.Textbox(
                        Id: "LabelText",
                        Name: "LabelText",
                        Title: "Text",
                        Classes: new[] { "text", "large", "tokenized" },
                        Description: T("The label text.")),
                    _LabelFor: shape.Textbox(
                        Id: "LabelFor",
                        Name: "LabelFor",
                        Title: "For",
                        Classes: new[] { "text", "large", "tokenized" },
                        Description: T("The name of the field this label is for.")));

                return(form);
            });
        }
        protected override void DescribeForm(DescribeContext context)
        {
            context.Form("ReCaptchaValidation", factory => {
                var shape = (dynamic)factory;
                var form  = shape.Fieldset(
                    Id: "ReCaptchaValidation",
                    _CustomValidationMessage: shape.Textbox(
                        Id: "CustomValidationMessage",
                        Name: "CustomValidationMessage",
                        Title: "Custom Validation Message",
                        Classes: new[] { "text", "large", "tokenized" },
                        Description: T("Optionally provide a custom validation message.")),
                    _ShowValidationMessage: shape.Checkbox(
                        Id: "ShowValidationMessage",
                        Name: "ShowValidationMessage",
                        Title: "Show Validation Message",
                        Value: "true",
                        Description: T("Autogenerate a validation message when a validation error occurs for the current anti-spam filter. Alternatively, to control the placement of the validation message you can use the ValidationMessage element instead.")));

                return(form);
            });
        }
        public void Describe(DescribeContext context)
        {
            context.Form("AutoLabel", factory => {
                var shape = (dynamic)factory;
                var form  = shape.Fieldset(
                    Id: "AutoLabel",
                    _ShowLabel: shape.Checkbox(
                        Id: "ShowLabel",
                        Name: "ShowLabel",
                        Title: "Show Label",
                        Value: "true",
                        Description: T("Check this to show a label for this text field.")),
                    _Label: shape.Textbox(
                        Id: "Label",
                        Name: "Label",
                        Title: "Label",
                        Classes: new[] { "text", "large", "tokenized" },
                        Description: T("The label text to render."),
                        EnabledBy: "ShowLabel"));

                return(form);
            });
        }
示例#45
0
        public void Describe(Orchard.Forms.Services.DescribeContext context)
        {
            Func <IShapeFactory, object> form =
                shape =>
            {
                var f = _shapeFactory.Form(
                    Id: "SearchFilterForm",
                    _Index: _shapeFactory.SelectList(
                        Id: "Index", Name: "Index",
                        Title: T("Index"),
                        Description: T("The selected index will be queried."),
                        Size: 5,
                        Multiple: false),
                    _SearchQuery: _shapeFactory.Textbox(
                        Id: "SearchQuery", Name: "SearchQuery",
                        Title: T("Search query"),
                        Description: T("The search query to match against."),
                        Classes: new[] { "tokenized" }),
                    _HitCountLimit: _shapeFactory.Textbox(
                        Id: "HitCountLimit", Name: "HitCountLimit",
                        Title: T("Hit count limit"),
                        Description: T("For performance reasons you can limit the maximal number of search hits used in the query. Having thousands of search hits will result in poor performance and increased load on the database server."))
                    );

                foreach (var index in _indexProvider.List())
                {
                    f._Index.Add(new SelectListItem {
                        Value = index, Text = index
                    });
                }


                return(f);
            };

            context.Form("SearchFilter", form);
        }
示例#46
0
        public void Describe(DescribeContext context)
        {
            Func <IShapeFactory, dynamic> form =
                shape => {
                var f = _shapeFactory.Form(
                    Id: "SyncContentForm",
                    _Type: _shapeFactory.Textbox(
                        Name: "TargetType",
                        Title: T("Target Type")
                        ),
                    _Versioning: _shapeFactory.Checkbox(
                        Name: "Versioning",
                        Value: "True",
                        Title: "Ensure new version"
                        ),
                    _Publishing: _shapeFactory.Checkbox(
                        Name: "Publishing",
                        Value: "True",
                        Title: "Ensure publish"
                        ),
                    _Creating: _shapeFactory.Checkbox(
                        Name: "Creating",
                        Value: "True",
                        Title: "Ensure creation"
                        ),
                    _ForceOwnerUpdate: _shapeFactory.CheckBox(
                        Name: "ForceOwnerUpdate",
                        Value: "True",
                        Title: "Force owner update"
                        )
                    );
                return(f);
            };

            context.Form("SyncContentForm", form);
        }
示例#47
0
        protected override void DescribeForm(DescribeContext context)
        {
            context.Form("TextArea", factory => {
                var shape = (dynamic)factory;
                var form  = shape.Fieldset(
                    Id: "TextArea",
                    _Value: shape.Textarea(
                        Id: "Value",
                        Name: "Value",
                        Title: "Value",
                        Classes: new[] { "text", "large", "tokenized" },
                        Description: T("The value of this text area.")),
                    _Rows: shape.Textbox(
                        Id: "Rows",
                        Name: "Rows",
                        Title: "Rows",
                        Classes: new[] { "text", "small" },
                        Description: T("The number of rows for this text area.")),
                    _Columns: shape.Textbox(
                        Id: "Columns",
                        Name: "Columns",
                        Title: "Columns",
                        Classes: new[] { "text", "small" },
                        Description: T("The number of columns for this text area.")));

                return(form);
            });

            context.Form("TextAreaValidation", factory => {
                var shape = (dynamic)factory;
                var form  = shape.Fieldset(
                    Id: "TextAreaValidation",
                    _IsRequired: shape.Checkbox(
                        Id: "IsRequired",
                        Name: "IsRequired",
                        Title: "Required",
                        Value: "true",
                        Description: T("Check to make this text area a required field.")),
                    _MinimumLength: shape.Textbox(
                        Id: "MinimumLength",
                        Name: "MinimumLength",
                        Title: "Minimum Length",
                        Classes: new[] { "text", "medium", "tokenized" },
                        Description: T("The minimum length required.")),
                    _MaximumLength: shape.Textbox(
                        Id: "MaximumLength",
                        Name: "MaximumLength",
                        Title: "Maximum Length",
                        Classes: new[] { "text", "medium", "tokenized" },
                        Description: T("The maximum length allowed.")),
                    _CustomValidationMessage: shape.Textbox(
                        Id: "CustomValidationMessage",
                        Name: "CustomValidationMessage",
                        Title: "Custom Validation Message",
                        Classes: new[] { "text", "large", "tokenized" },
                        Description: T("Optionally provide a custom validation message.")),
                    _ShowValidationMessage: shape.Checkbox(
                        Id: "ShowValidationMessage",
                        Name: "ShowValidationMessage",
                        Title: "Show Validation Message",
                        Value: "true",
                        Description: T("Autogenerate a validation message when a validation error occurs for the current field. Alternatively, to control the placement of the validation message you can use the ValidationMessage element instead.")));

                return(form);
            });
        }
示例#48
0
        public void Describe(OrchardForms.DescribeContext context)
        {
            Func <IShapeFactory, dynamic> form =
                shape => {
                var f = Shape.Form(
                    Id: "DateTimeFilterForm",
                    _Op: Shape.FieldSet(
                        Id: "fieldset-operator",
                        Title: "Operator",
                        _Operator: Shape.SelectList(
                            Id: "operator",
                            Name: "Operator",
                            Title: T("Operator"),
                            Size: 1,
                            Multiple: false,
                            EnableWrapper: false,
                            Description: _operatorHint
                            )
                        ),
                    // Property names must start with "_" to be added to the Items collection of the Shape.
                    _From: Shape.DateTimeEditorForm(
                        Id: "div-from",
                        Title: "From",
                        Hint: _dateFromHint,
                        _Date: Shape.TextBox(
                            Id: "datefrom",
                            Name: "DateFrom",
                            EnableWrapper: false
                            ),
                        _Time: Shape.TextBox(
                            Id: "timefrom",
                            Name: "TimeFrom",
                            EnableWrapper: false
                            ),
                        // I need to declare culture inside the DateTimeEditorForm to properly manage it in the razor.
                        _Culture: Shape.Hidden(
                            Id: "culturefrom",
                            Name: "CultureFrom",
                            EnableWrapper: false,
                            Value: _currentCulture
                            )
                        ),
                    _To: Shape.DateTimeEditorForm(
                        Id: "div-to",
                        Title: "To",
                        Hint: _dateToHint,
                        _Date: Shape.TextBox(
                            Id: "dateto",
                            Name: "DateTo",
                            EnableWrapper: false
                            ),
                        _Time: Shape.TextBox(
                            Id: "timeto",
                            Name: "TimeTo",
                            EnableWrapper: false
                            ),
                        // I need to declare culture inside the DateTimeEditorForm to properly manage it in the razor.
                        _Culture: Shape.Hidden(
                            Id: "cultureto",
                            Name: "CultureTo",
                            EnableWrapper: false,
                            Value: _currentCulture
                            )
                        )
                    );

                f._Op._Operator.Add(new SelectListItem {
                    Value = Convert.ToString(DateTimeOperator.LessThan), Text = T("Is less than").Text
                });
                f._Op._Operator.Add(new SelectListItem {
                    Value = Convert.ToString(DateTimeOperator.Between), Text = T("Is between").Text
                });
                f._Op._Operator.Add(new SelectListItem {
                    Value = Convert.ToString(DateTimeOperator.GreaterThan), Text = T("Is greater than").Text
                });

                return(f);
            };

            context.Form(FormName, form);
        }
示例#49
0
        protected override void DescribeForm(DescribeContext context)
        {
            context.Form("TaxonomyForm", factory => {
                var shape = (dynamic)factory;
                var form  = shape.Fieldset(
                    Id: "TaxonomyForm",
                    _OptionLabel: shape.Textbox(
                        Id: "OptionLabel",
                        Name: "OptionLabel",
                        Title: "Option Label",
                        Description: T("Optionally specify a label for the first option. If no label is specified, no empty option will be rendered.")),
                    _Taxonomy: shape.SelectList(
                        Id: "TaxonomyId",
                        Name: "TaxonomyId",
                        Title: "Taxonomy",
                        Description: T("Select the taxonomy to use as a source for the list.")),
                    _SortOrder: shape.SelectList(
                        Id: "SortOrder",
                        Name: "SortOrder",
                        Title: "Sort Order",
                        Description: T("The sort order to use when presenting the term values.")),
                    _TextExpression: shape.Textbox(
                        Id: "TextExpression",
                        Name: "TextExpression",
                        Title: "Text Expression",
                        Value: "{Content.DisplayText}",
                        Description: T("Specify the expression to get the display text of each option."),
                        Classes: new[] { "text", "large", "tokenized" }),
                    _ValueExpression: shape.Textbox(
                        Id: "ValueExpression",
                        Name: "ValueExpression",
                        Title: "Value Expression",
                        Value: "{Content.Id}",
                        Description: T("Specify the expression to get the value of each option."),
                        Classes: new[] { "text", "large", "tokenized" }),
                    _InputType: shape.SelectList(
                        Id: "InputType",
                        Name: "InputType",
                        Title: "Input Type",
                        Description: T("The control to render when presenting the list of options.")));

                // Taxonomy
                var taxonomies = _taxonomyService.GetTaxonomies();
                foreach (var taxonomy in taxonomies)
                {
                    form._Taxonomy.Items.Add(new SelectListItem {
                        Text = taxonomy.Name, Value = taxonomy.Id.ToString(CultureInfo.InvariantCulture)
                    });
                }

                // Sort Order
                form._SortOrder.Items.Add(new SelectListItem {
                    Text = T("None").Text, Value = ""
                });
                form._SortOrder.Items.Add(new SelectListItem {
                    Text = T("Ascending").Text, Value = "Asc"
                });
                form._SortOrder.Items.Add(new SelectListItem {
                    Text = T("Descending").Text, Value = "Desc"
                });

                // Input Type
                form._InputType.Items.Add(new SelectListItem {
                    Text = T("Select List").Text, Value = "SelectList"
                });
                form._InputType.Items.Add(new SelectListItem {
                    Text = T("Multi Select List").Text, Value = "MultiSelectList"
                });
                form._InputType.Items.Add(new SelectListItem {
                    Text = T("Radio List").Text, Value = "RadioList"
                });
                form._InputType.Items.Add(new SelectListItem {
                    Text = T("Check List").Text, Value = "CheckList"
                });

                return(form);
            });

            context.Form("TaxonomyValidation", factory => {
                var shape = (dynamic)factory;
                var form  = shape.Fieldset(
                    Id: "TaxonomyValidation",
                    _IsRequired: shape.Checkbox(
                        Id: "Required",
                        Name: "Required",
                        Title: "Required",
                        Value: "true",
                        Description: T("Tick this checkbox to make at least one option required.")),
                    _CustomValidationMessage: shape.Textbox(
                        Id: "CustomValidationMessage",
                        Name: "CustomValidationMessage",
                        Title: "Custom Validation Message",
                        Classes: new[] { "text", "large", "tokenized" },
                        Description: T("Optionally provide a custom validation message.")),
                    _ShowValidationMessage: shape.Checkbox(
                        Id: "ShowValidationMessage",
                        Name: "ShowValidationMessage",
                        Title: "Show Validation Message",
                        Value: "true",
                        Description: T("Autogenerate a validation message when a validation error occurs for the current field. Alternatively, to control the placement of the validation message you can use the ValidationMessage element instead.")));

                return(form);
            });
        }
示例#50
0
        protected override void DescribeForm(DescribeContext context)
        {
            context.Form("Form", factory => {
                var shape = (dynamic)factory;
                var form  = shape.Fieldset(
                    Id: "Form",
                    _FormName: shape.Textbox(
                        Id: "FormName",
                        Name: "FormName",
                        Title: "Name",
                        Value: "Untitled",
                        Classes: new[] { "text", "medium" },
                        Description: T("The name of the form.")),
                    _FormAction: shape.Textbox(
                        Id: "FormAction",
                        Name: "FormAction",
                        Title: "Custom Target URL",
                        Classes: new[] { "text", "large", "tokenized" },
                        Description: T("The action of the form. Leave blank to have the form submitted to the default form controller.")),
                    _FormMethod: shape.SelectList(
                        Id: "FormMethod",
                        Name: "FormMethod",
                        Title: "Method",
                        Description: T("The method of the form.")),
                    _EnableClientValidation: shape.Checkbox(
                        Id: "EnableClientValidation",
                        Name: "EnableClientValidation",
                        Title: "Enable Client Validation",
                        Value: "true",
                        Description: T("Enables client validation.")),
                    _StoreSubmission: shape.Checkbox(
                        Id: "StoreSubmission",
                        Name: "StoreSubmission",
                        Title: "Store Submission",
                        Value: "true",
                        Description: T("Stores the submitted form into the database.")),
                    _HtmlEncode: shape.Checkbox(
                        Id: "HtmlEncode",
                        Name: "HtmlEncode",
                        Title: "Html Encode",
                        Value: "true",
                        Checked: true,
                        Description: T("Check this option to automatically HTML encode submitted values to prevent code injection.")),
                    _CreateContent: shape.Checkbox(
                        Id: "CreateContent",
                        Name: "CreateContent",
                        Title: "Create Content",
                        Value: "true",
                        Description: T("Check this option to create a content item based using the submitted values. You will have to select a Content Type here and bind the form fields to the various parts and fields of the selected Content Type.")),
                    _ContentType: shape.SelectList(
                        Id: "FormBindingContentType",
                        Name: "FormBindingContentType",
                        Title: "Content Type",
                        Description: T("The Content Type to use when storing the submitted form values as a content item. Note that if you change the content type, you will have to update the form field bindings."),
                        EnabledBy: "CreateContent"),
                    _PublicationDraft: shape.Radio(
                        Id: "Publication-Draft",
                        Name: "Publication",
                        Title: "Save As Draft",
                        Value: "Draft",
                        Checked: true,
                        Description: T("Save the created content item as a draft."),
                        EnabledBy: "CreateContent"),
                    _PublicationPublish: shape.Radio(
                        Id: "Publication-Publish",
                        Name: "Publication",
                        Title: "Publish",
                        Value: "Publish",
                        Description: T("Publish the created content item."),
                        EnabledBy: "CreateContent"),
                    _Notification: shape.Textbox(
                        Id: "Notification",
                        Name: "Notification",
                        Title: "Show Notification",
                        Classes: new[] { "text", "large", "tokenized" },
                        Description: T("The message to show after the form has been submitted. Leave blank if you don't want to show a message.")),
                    _RedirectUrl: shape.Textbox(
                        Id: "RedirectUrl",
                        Name: "RedirectUrl",
                        Title: "Redirect URL",
                        Classes: new[] { "text", "large", "tokenized" },
                        Description: T("The URL to redirect to after the form has been submitted. Leave blank to stay on the same page. tip: you can use a Workflow to control what happens when this form is submitted.")));

                // FormMethod
                form._FormMethod.Items.Add(new SelectListItem {
                    Text = "POST", Value = "POST"
                });
                form._FormMethod.Items.Add(new SelectListItem {
                    Text = "GET", Value = "GET"
                });

                // ContentType
                var contentTypes = _contentDefinitionManager.ListTypeDefinitions().Where(IsFormBindingContentType).ToArray();
                foreach (var contentType in contentTypes.OrderBy(x => x.DisplayName))
                {
                    form._ContentType.Items.Add(new SelectListItem {
                        Text = contentType.DisplayName, Value = contentType.Name
                    });
                }

                return(form);
            });
        }
示例#51
0
        protected override void DescribeForm(DescribeContext context)
        {
            context.Form("ProjectionForm", factory => {
                var shape = (dynamic)factory;
                var form  = shape.Fieldset(
                    Id: "ProjectionForm",
                    _QueryLayoutId: shape.SelectList(
                        Id: "QueryLayoutId",
                        Name: "QueryLayoutId",
                        Title: T("For Query"),
                        Description: T("The query to display.")),
                    _ItemsToDisplay: shape.Textbox(
                        Id: "ItemsToDisplay",
                        Name: "ItemsToDisplay",
                        Title: T("Items to display"),
                        Value: "0",
                        Description: T("The number of items to display. Enter 0 for no limit. When using pagination, this is the number of items per page."),
                        Classes: new[] { "text", "medium" }),
                    _Skip: shape.Textbox(
                        Id: "Skip",
                        Name: "Skip",
                        Title: T("Offset"),
                        Value: "0",
                        Description: T("The number of items to skip (e.g., if 2 is entered, the first 2 items won't be diplayed)."),
                        Classes: new[] { "text", "medium" }),
                    _MaxItems: shape.Textbox(
                        Id: "MaxItems",
                        Name: "MaxItems",
                        Title: T("MaxItems items"),
                        Value: "20",
                        Description: T("Maximum number of items which can be queried at once. Use 0 for unlimited. This is only used as a failsafe when the number of items comes from a user-provided source such as the query string."),
                        Classes: new[] { "text", "medium" }),
                    _PagerSuffix: shape.Textbox(
                        Id: "PagerSuffix",
                        Name: "PagerSuffix",
                        Title: T("Suffix"),
                        Description: T("Optional. Provide a suffix to use when multiple pagers are displayed on the same page, e.g., when using multiple Projection Widgets, or to define alternates."),
                        Classes: new[] { "text", "medium" }),
                    _DisplayPager: shape.Checkbox(
                        Id: "DisplayPager",
                        Name: "DisplayPager",
                        Title: T("Show Pager"),
                        Value: "true",
                        Description: T("Check to add a pager to the list.")));

                // Populate the list of queries and layouts.
                var layouts = _projectionManager.DescribeLayouts().SelectMany(x => x.Descriptors).ToList();
                var queries = _contentManager.Query <QueryPart, QueryPartRecord>().Join <TitlePartRecord>().OrderBy(x => x.Title).List()
                              .Select(x => new QueryRecordEntry {
                    Id   = x.Id,
                    Name = x.Name,
                    LayoutRecordEntries = x.Layouts.Select(l => new LayoutRecordEntry {
                        Id          = l.Id,
                        Description = GetLayoutDescription(layouts, l)
                    })
                }).ToArray();

                foreach (var queryRecord in queries.OrderBy(x => x.Name))
                {
                    form._QueryLayoutId.Add(new SelectListGroup {
                        Name = queryRecord.Name
                    });
                    form._QueryLayoutId.Add(new SelectListItem {
                        Text = queryRecord.Name + " " + T("(Default Layout)").Text, Value = queryRecord.Id + ";-1"
                    });

                    foreach (var layoutRecord in queryRecord.LayoutRecordEntries.OrderBy(x => x.Description))
                    {
                        form._QueryLayoutId.Add(new SelectListItem {
                            Text = queryRecord.Name + " " + T("({0})", layoutRecord.Description).Text, Value = queryRecord.Id + ";" + layoutRecord.Id
                        });
                    }
                }

                return(form);
            });
        }
示例#52
0
        protected override void DescribeForm(DescribeContext context)
        {
            context.Form("FileField", factory => {
                var shape = (dynamic)factory;
                var form  = shape.Fieldset(
                    Id: "FileField",
                    _GenerateUnique: shape.Checkbox(
                        Id: "GenerateUnique",
                        Name: "GenerateUnique",
                        Title: "Unique Filename",
                        Value: "true",
                        Description: T("Check to generate unique filename on upload")),
                    _FilePath: shape.Textbox(
                        Id: "FilePath",
                        Name: "FilePath",
                        Title: "FilePath",
                        Classes: new[] { "text", "medium", "tokenized" },
                        Description: T("The path for the uploaded file inside Media/Default  (e.g. uploads/files). note: uploads/test should be created and existes")));
                return(form);
            });

            context.Form("FileFieldValidation", factory => {
                var shape = (dynamic)factory;
                var form  = shape.Fieldset(
                    Id: "FileFieldValidation",
                    _IsRequired: shape.Checkbox(
                        Id: "IsRequired",
                        Name: "IsRequired",
                        Title: "Required",
                        Value: "true",
                        Description: T("Check to make the file field a required field.")),
                    _MaximumSize: shape.Textbox(
                        Id: "MaximumSize",
                        Name: "MaximumSize",
                        Title: "Maximum Size",
                        Classes: new[] { "text", "medium" },
                        Description: T("The maximum file size (MB) allowed.")),
                    _FileTypes: shape.Textbox(
                        Id: "FileTypes",
                        Name: "FileTypes",
                        Title: "File Types",
                        Classes: new[] { "text", "large" },
                        Description: T("Comma separated list of allowed file extensions")),
                    _AllowOverwrite: shape.Checkbox(
                        Id: "AllowOverwrite",
                        Name: "AllowOverwrite",
                        Title: "Overwrite Allowed",
                        Value: "true",
                        Description: T("Check to allow the file field to overwrite existing files.")),
                    _CustomValidationMessage: shape.Textbox(
                        Id: "CustomValidationMessage",
                        Name: "CustomValidationMessage",
                        Title: "Custom Validation Message",
                        Classes: new[] { "text", "large", "tokenized" },
                        Description: T("Optionally provide a custom validation message.")),
                    _ShowValidationMessage: shape.Checkbox(
                        Id: "ShowValidationMessage",
                        Name: "ShowValidationMessage",
                        Title: "Show Validation Message",
                        Value: "true",
                        Description: T("Autogenerate a validation message when a validation error occurs for the current field. Alternatively, to control the placement of the validation message you can use the ValidationMessage element instead.")));

                return(form);
            });
        }