Example #1
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);
        }
Example #2
0
        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);
        }
Example #3
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
                        )
                    );
                // We don't add an "Any" option
                //f._Parts.Add(new SelectListItem { Value = "", Text = T("Any").Text });

                foreach (var contentType in _contentDefinitionManager
                         .ListTypeDefinitions()
                         // Type has ProductPart
                         .Where(ctd => ctd.Parts.Any(ctpd => ctpd
                                                     .PartDefinition.Name
                                                     .Equals(ProductPart.PartName, StringComparison.InvariantCultureIgnoreCase)))
                         .OrderBy(x => x.DisplayName))
                {
                    f._Parts.Add(new SelectListItem {
                        Value = contentType.Name,
                        Text  = contentType.DisplayName
                    });
                }

                return(f);
            };

            context.Form(FormName, form);
        }
Example #4
0
        /// <summary>
        /// This method creates a form to select the operator to apply.
        /// </summary>
        /// <param name="context"></param>
        public void Describe(DescribeContext context)
        {
            Func <IShapeFactory, object> form =
                shape => {
                var f = _shapeFactory.Form(
                    Id: "HiddenStringFieldFilter",
                    _Operator: _shapeFactory.SelectList(
                        Id: "operator", Name: "Operator",
                        Title: T("Operator"),
                        Size: 1,
                        Multiple: false
                        ),
                    _Value: _shapeFactory.TextBox(
                        Id: "value", Name: "Value",
                        Title: T("Value"),
                        Classes: new[] { "text medium", "tokenized" },
                        Description: T("Enter the value the string should be.")
                        )
                    );

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

                return(f);
            };

            context.Form(FormName, form);
        }
        public void Describe(DescribeContext context)
        {
            // recupera il valore salvato per il content picker field
            char[]             separator   = { ',' };
            List <ContentItem> contentItem = new List <ContentItem>();
            var httpContext = HttpContext.Current;

            if (httpContext != null)
            {
                var filterId = httpContext.Request["filterId"];
                if (string.IsNullOrEmpty(filterId) == false)
                {
                    var filter = _repositoryFilters.Get(Convert.ToInt32(filterId));
                    if (filter != null)
                    {
                        XmlDocument doc = new XmlDocument();
                        doc.LoadXml(filter.State);
                        var node = doc.SelectSingleNode("Form/ContentId");
                        if (node != null)
                        {
                            var arrIds = node.InnerText.Split(separator, StringSplitOptions.RemoveEmptyEntries);
                            if (arrIds.Length > 0)
                            {
                                contentItem.Add(_orchardServices.ContentManager.Get(Convert.ToInt32(arrIds[0])));
                            }
                        }
                    }
                }
            }
            // compone il form
            context.Form("ReactionClickedFilterForm", shape => {
                var f = _shapeFactory.Form(
                    Id: "ReactionClickedFilterForm",

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

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

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

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

                    _FieldSetSingle: _shapeFactory.FieldSet(
                        Id: "fieldset-content-item",
                        _Value: _shapeFactory.ContentPicker_Edit(
                            Required: false,
                            Multiple: false,
                            DisplayName: "Content",
                            IdsFieldId: "contentId",
                            SelectedItemsFieldName: "ContentId",
                            ContentItems: contentItem,
                            Hint: "Select a content or populate the following field.",
                            PartName: "",
                            FieldName: ""
                            ),
                        _ValueTokenized: _shapeFactory.TextBox(
                            Id: "contentIdTokenized", Name: "ContentIdTokenized",
                            Title: T("Tokenized Content ID"),
                            Classes: new[] { "tokenized" }
                            )
                        )
                    );

                _resourceManager.Value.Require("script", "ContentPicker");
                _resourceManager.Value.Require("script", "jQueryUI");
                _resourceManager.Value.Require("style", "content-picker-admin.css");

                var reactionTypes = _reactionsService.GetTypesTableFiltered();
                foreach (var item in reactionTypes)
                {
                    f._ReactionsList.Add(item.TypeName);
                }
                return(f);
            });
        }
        public void Describe(DescribeContext context)
        {
            Func <IShapeFactory, dynamic> form =
                shape => {
                var f = Shape.Form(
                    Id: _formName,
                    _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" }
                            )
                        ),
                    _FieldSetShowNotReviewed: Shape.FieldSet(
                        Id: "fieldset-not-reviewed",
                        _ShowNotReviewed: Shape.Checkbox(
                            Id: "notReviewed",
                            Name: "NotReviewed",
                            Title: T("Show not reviewed"),
                            Value: "true"
                            )
                        )
                    );
                _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");

                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);
        }
        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.")),
                    _CreateContent: shape.Checkbox(
                        Id: "CreateContent",
                        Name: "CreateContent",
                        Title: "Create Content",
                        Value: "true",
                        Description: T("Check this 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);
            });
        }
        public void Describe(DescribeContext context)
        {
            Func <IShapeFactory, object> filterForm = shape =>
            {
                var taxonomies = _taxonomyService.GetTaxonomies().OrderBy(taxonomy => taxonomy.Name).ToList();

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

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

                return(form);
            };

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

                return(f);
            };

            context.Form("GridLayout", form);
        }
Example #10
0
        public void Describe(DescribeContext context)
        {
            Func <IShapeFactory, object> form = shape => {
                var f = Shape.Form(
                    Id: "SelectTermsFormForLines",
                    _TermIds: Shape.SelectList(
                        Id: "termids", Name: "TermIds",
                        Title: T("Terms"),
                        Description: T("Select some terms. If term identifiers have been added below, the selected terms will be added without being duplicated."),
                        Size: 10,
                        Multiple: true
                        ),
                    _Terms: Shape.TextBox(
                        Id: "terms",
                        Name: "Terms",
                        Title: T("Term identifiers"),
                        Classes: new[] { "text medium tokenized" },
                        Description: T("Enter token or id of term. If no valid term is provided, all content items will be included in the results. If some terms above have been selected, the term identifiers will be added without being duplicated.")),
                    _Exclusion: Shape.FieldSet(
                        _OperatorOneOf: Shape.Radio(
                            Id: "operator-is-one-of", Name: "Operator",
                            Title: T("Is associated to one of the specified terms"), Value: "0", Checked: true
                            ),
                        _OperatorIsAllOf: Shape.Radio(
                            Id: "operator-is-all-of", Name: "Operator",
                            Title: T("Is associated to all the specified terms"), Value: "1"
                            )
                        ),
                    _IncludeChildren: Shape.Checkbox(
                        Id: "IncludeChildren", Name: "IncludeChildren",
                        Title: T("Automatically include children terms in filtering"),
                        Value: "true"
                        ));

                foreach (var taxonomy in _taxonomyService.GetTaxonomies())
                {
                    var optionGroup = new SelectListGroup()
                    {
                        Name = taxonomy.Name
                    };
                    f._TermIds.Add(optionGroup);
                    f._TermIds.Add(new SelectListItem {
                        Value = taxonomy.Id.ToString(), Text = T("(All terms of {0})", taxonomy.Name).Text, Group = optionGroup
                    });
                    foreach (var term in _taxonomyService.GetTerms(taxonomy.Id))
                    {
                        var gap = new string('-', term.GetLevels());

                        if (gap.Length > 0)
                        {
                            gap += " ";
                        }

                        f._TermIds.Add(new SelectListItem {
                            Value = term.Id.ToString(), Text = gap + term.Name, Group = optionGroup
                        });
                    }
                }

                return(f);
            };

            context.Form(FormName, form);
        }
        public void Describe(DescribeContext context)
        {
            Func <IShapeFactory, dynamic> form =
                shape => {
                var f = _shapeFactory.Form(
                    Id: "TheFormTaxonomySetValues",
                    _Type: _shapeFactory.FieldSet(
                        Title: T("Select Terms of ContentItem"),

                        _ddlTerms: _shapeFactory.SelectList(
                            Id: "allterms",
                            Name: "allterms",
                            title: T("all Termss"),
                            Description: T("select a Term"),
                            Size: 10,
                            Multiple: true
                            )
                        //),
                        //  _filter: _shapeFactory.Check(
                        // Title: T("Set Owner of content picker element"),

                        //  Id: "operator-is-one-of", Name: "Operator",
                        //   Value: "0", Checked: true
                        )

                    );

                IEnumerable <TaxonomyPart> listtaxonomies = _taxonomyService.GetTaxonomies();
                //foreach (TaxonomyPart tp in listtaxonomies) {
                //    f._Type._ddlTaxonomies.Add(new SelectListItem { Value = tp.Id.ToString(), Text = tp.Name.ToString() });

                //}


                foreach (TaxonomyPart tp in listtaxonomies)
                {
                    f._Type._ddlTerms.Add(new SelectListItem {
                        Value = tp.Id.ToString(), Text = tp.Name.ToString()
                    });
                    IEnumerable <TermPart> listterms = _taxonomyService.GetTerms(tp.Id);
                    foreach (TermPart termp in listterms)
                    {
                        f._Type._ddlTerms.Add(new SelectListItem {
                            Value = termp.Id.ToString(), Text = " - " + termp.Name.ToString()
                        });
                    }
                }
                // f._Type._ddlOwner.Add(new SelectListItem { Value = "", Text = T("Any").Text });
                //  var userProfiles = _contentManager.Query<UserPart, UserPartRecord>().List().Select(user => ((dynamic)user).ProfilePart).Select(user => new { user.FirstName, user.LastName });
                //IEnumerable<UserPart> users = _contentManager
                // .Query<UserPart, UserPartRecord>()
                //    .Where(x => x.UserName != null)
                //    .List();

                //foreach (UserPart up in users) {
                //    f._Type._ddlOwner.Add(new SelectListItem { Value = up.Id.ToString(), Text = up.UserName.ToString() });
                //    //            f._ddlOwner.Add(new SelectListItem { Value = userProfiles[i].FirstName, Text = userProfiles[i].LastName });
                //}
                //var singleuser in userProfiles.Count) {
                //    f._ddlOwner.Add(new SelectListItem { Value = singleuser.FirstName, Text = singleuser.LastName });

                //var submittedByField = ((dynamic)q.ContentItem).Question.SubmittedBy;
                //sbmittedByField.Ids = new[] { submittedById };

                return(f);
            };

            context.Form("TheFormTaxonomySetValues", form);
        }
        public void Describe(DescribeContext context)
        {
            Func <IShapeFactory, dynamic> form =
                shape => {
                var f = Shape.Form(
                    Id: "ActionPush",
                    _Type: Shape.FieldSet(
                        Title: T("Send Push"),
                        _ddlDevice: Shape.SelectList(
                            Id: "allDevice",
                            Name: "allDevice",
                            Title: T("Device"),
                            Size: 10,
                            Multiple: false
                            ),
                        _UsersList: Shape.Textbox(
                            Id: "userId",
                            Name: "userId",
                            Title: T("Users list (ID / e-mail / username)"),
                            Description: T("Comma separated list of User IDs or e-mails or usernames (eg. 12,45,239). Tokenized."),
                            Classes: new[] { "large", "text", "tokenized" }
                            ),
                        _ddlLanguage: Shape.SelectList(
                            Id: "allLanguage",
                            Name: "allLanguage",
                            Title: T("Language"),
                            Size: 4,
                            Multiple: false
                            ),
                        _RecipientProd: Shape.Radio(
                            Id: "Produzione",
                            Name: "Produzione",
                            Value: "Produzione",
                            Title: T("Produzione")
                            ),
                        _RecipientProd2: Shape.Radio(
                            Id: "Produzione",
                            Name: "Produzione",
                            Value: "Sviluppo",
                            Title: T("Sviluppo")
                            ),
                        _Recipientidrelated: Shape.TextBox(
                            Id: "idRelated",
                            Name: "idRelated",
                            Value: "",
                            Title: T("Link the content as Related Content"),
                            Description: T("Content ID. Tokenized. Example: the current content item is {Content.Id}."),
                            Classes: new[] { "large", "text", "tokenized" }
                            ),
                        _Recipient5: Shape.Textbox(
                            Id: "PushMessage",
                            Name: "PushMessage",
                            Title: T("Push Message"),
                            Description: T("Push Message Tokenized."),
                            Classes: new[] { "large", "text", "tokenized" }
                            )
                        )
                    );
                f._Type._ddlDevice.Add(new SelectListItem {
                    Value = "All", Text = "All Devices"
                });
                f._Type._ddlDevice.Add(new SelectListItem {
                    Value = "Apple", Text = "All Apple's device"
                });
                f._Type._ddlDevice.Add(new SelectListItem {
                    Value = "Android", Text = "All Android's device"
                });
                f._Type._ddlDevice.Add(new SelectListItem {
                    Value = "WindowsMobile", Text = "All WindowsMobile's device"
                });
                f._Type._ddlDevice.Add(new SelectListItem {
                    Value = "ContentOwner", Text = "Content's Owner"
                });
                f._Type._ddlDevice.Add(new SelectListItem {
                    Value = "ContentCreator", Text = "Content's Creator"
                });
                f._Type._ddlDevice.Add(new SelectListItem {
                    Value = "ContentLastModifier", Text = "Content's LastModifier"
                });
                f._Type._ddlDevice.Add(new SelectListItem {
                    Value = "UserId", Text = "User specified by ID"
                });
                f._Type._ddlDevice.Add(new SelectListItem {
                    Value = "UserEmail", Text = "User specified by e-mail"
                });
                f._Type._ddlDevice.Add(new SelectListItem {
                    Value = "UserName", Text = "User specified by username"
                });
                f._Type._ddlLanguage.Add(new SelectListItem {
                    Value = "All", Text = "All Languages"
                });
                foreach (string up in _cultureManager.ListCultures())
                {
                    f._Type._ddlLanguage.Add(new SelectListItem {
                        Value = up.ToString(), Text = up.ToString()
                    });
                }
                return(f);
            };

            context.Form("ActivityMobileForm", form);
        }
        public void Describe(DescribeContext context)
        {
            Func <IShapeFactory, object> form =
                shape => {
                var f = Shape.Form(
                    Id: "ImageFormatAndResizeFilter",
                    _Width: Shape.Textbox(
                        Id: "width", Name: "Width",
                        Title: T("Width"),
                        Value: 0,
                        Description: T("The width in pixels."),
                        Classes: new[] { "text-small" }),
                    _Height: Shape.Textbox(
                        Id: "height", Name: "Height",
                        Title: T("Height"),
                        Value: 0,
                        Description: T("The height in pixels."),
                        Classes: new[] { "text-small" }),
                    _Mode: Shape.SelectList(
                        Id: "mode", Name: "Mode",
                        Title: T("Mode"),
                        Description: T("How the image should be resized.<br/>Max: adjusts to the max given width or left, keeping image ratio.<br/>Pad: adds a padding so that the target image is exactly of width and height.<br/>Crop: removes part of the image to fit with given height and width.<br/>Stretch: stretches the image to fit within height and width."),
                        Size: 1,
                        Multiple: false),
                    _Alignment: Shape.SelectList(
                        Id: "alignment", Name: "Alignment",
                        Title: T("Alignment"),
                        Description: T("Select the alignment for Crop and Pad modes."),
                        Size: 1,
                        Multiple: false),
                    _PadColor: Shape.Textbox(
                        Id: "padcolor", Name: "PadColor",
                        Title: T("Pad Color"),
                        Value: "#ffffff",
                        Description: T("The background color to use to pad the image. Named color or hex value."),
                        Classes: new[] { "text-small" }),
                    _Format: Shape.SelectList(
                        Id: "format", Name: "Format",
                        Title: T("Format"),
                        Description: T("The format of the displayed image (usually JPG).<br/>Selecting (any) will keep the existing format, except for TIF files which are always changed to JPG."),
                        Size: 1,
                        Multiple: false),
                    _Quality: Shape.Textbox(
                        Id: "quality", Name: "Quality",
                        Title: T("Quality"),
                        Value: 90,
                        Description: T("JPEG image quality (0-100). The higher the quality the larger the image file.")),
                    Classes: new[] { "text-small" }
                    );

                f._Format.Add(new SelectListItem {
                    Value = "jpg", Text = T("JPG").Text
                });
                f._Format.Add(new SelectListItem {
                    Value = "png", Text = T("PNG").Text
                });
                f._Format.Add(new SelectListItem {
                    Value = "gif", Text = T("GIF").Text
                });
                f._Format.Add(new SelectListItem {
                    Value = "(any)", Text = T("(any)").Text
                });

                f._Mode.Add(new SelectListItem {
                    Value = "max", Text = T("Max").Text
                });
                f._Mode.Add(new SelectListItem {
                    Value = "pad", Text = T("Pad").Text
                });
                f._Mode.Add(new SelectListItem {
                    Value = "crop", Text = T("Crop").Text
                });
                f._Mode.Add(new SelectListItem {
                    Value = "stretch", Text = T("Stretch").Text
                });

                f._Alignment.Add(new SelectListItem {
                    Value = "topleft", Text = T("Top Left").Text
                });
                f._Alignment.Add(new SelectListItem {
                    Value = "topcenter", Text = T("Top Center").Text
                });
                f._Alignment.Add(new SelectListItem {
                    Value = "topright", Text = T("Top Right").Text
                });
                f._Alignment.Add(new SelectListItem {
                    Value = "middleleft", Text = T("Middle Left").Text
                });
                f._Alignment.Add(new SelectListItem {
                    Value = "middlecenter", Text = T("Middle Center").Text
                });
                f._Alignment.Add(new SelectListItem {
                    Value = "middleright", Text = T("Middle Right").Text
                });
                f._Alignment.Add(new SelectListItem {
                    Value = "bottomleft", Text = T("Bottom Left").Text
                });
                f._Alignment.Add(new SelectListItem {
                    Value = "bottomcenter", Text = T("Bottom Center").Text
                });
                f._Alignment.Add(new SelectListItem {
                    Value = "bottomright", Text = T("Bottom Right").Text
                });

                return(f);
            };

            context.Form("FormatAndResizeFilter", form);
        }
Example #14
0
        public void Describe(DescribeContext context)
        {
            context.Form("ActivityWeiXinEventKey", shape => Shape.Form(
                             Id: "ActivityWeiXinEventKey",
                             _Type: Shape.SelectList(
                                 Id: "EventType", Name: "EventType",
                                 Title: T("用户消息的事件类型"),
                                 Description: T("请选择一个消息事件类型."))
                             .Add(new SelectListItem {
                Value = "VIEW", Text = T("菜单跳转").Text
            })
                             .Add(new SelectListItem {
                Value = "CLICK", Text = T("菜单点击").Text
            })
                             .Add(new SelectListItem {
                Value = "SCAN", Text = T("扫描二维码[用户已经关注]").Text
            })
                             .Add(new SelectListItem {
                Value = "subscribe", Text = T("扫描二维码[用户首次关注]").Text
            })
                             .Add(new SelectListItem {
                Value = "unsubscribe", Text = T("用户取消关注").Text
            }),

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

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

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

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

            context.Form("ActivityWeiXinText", shape => Shape.Form(
                             Id: "ActivityWeiXinText",
                             _Operator: Shape.SelectList(
                                 Id: "operator", Name: "operator",
                                 Title: T("运算符"),
                                 Description: T("请选择一个运算符测试用户发送的文本消息."))
                             .Add(new SelectListItem {
                Value = "Equals", Text = T("等于").ToString()
            })
                             .Add(new SelectListItem {
                Value = "NotEquals", Text = T("不等于").ToString()
            })
                             .Add(new SelectListItem {
                Value = "Contains", Text = T("包含").ToString()
            })
                             .Add(new SelectListItem {
                Value = "NotContains", Text = T("不包含").ToString()
            })
                             .Add(new SelectListItem {
                Value = "Starts", Text = T("开始于").ToString()
            })
                             .Add(new SelectListItem {
                Value = "NotStarts", Text = T("不开始于").ToString()
            })
                             .Add(new SelectListItem {
                Value = "Ends", Text = T("结束于").ToString()
            })
                             .Add(new SelectListItem {
                Value = "NotEnds", Text = T("不结束于").ToString()
            }),
                             _Text: Shape.TextArea(
                                 Id: "textValue", Name: "textValue",
                                 Title: T("值"),
                                 Description: T("用来测试的字符串值."),
                                 Classes: new[] { "large", "text", "tokenized" }
                                 )));
        }
Example #15
0
        public void Describe(DescribeContext context)
        {
            Func <IShapeFactory, object> form =
                shape => {
                var f = Shape.Form(
                    Id: "ImageResizeFilter",
                    _Width: Shape.Textbox(
                        Id: "width", Name: "Width",
                        Title: T("Width"),
                        Value: 0,
                        Description: T("The width in pixels."),
                        Classes: new[] { "text small" }),
                    _Height: Shape.Textbox(
                        Id: "height", Name: "Height",
                        Title: T("Height"),
                        Value: 0,
                        Description: T("The height in pixels."),
                        Classes: new[] { "text small" }),
                    _Mode: Shape.SelectList(
                        Id: "mode", Name: "Mode",
                        Title: T("Mode"),
                        Description: T("How the image should be resized.<br />Max: adjusts to the max given width or height, keeping image ratio.<br />Pad: adds a padding so that the target image is exactly of width and height.<br />Crop: removes part of the image to fit with given height and width.<br />Stretch: stretches the image to fit within height and width."),
                        Size: 1,
                        Multiple: false),
                    _Alignment: Shape.SelectList(
                        Id: "alignment", Name: "Alignment",
                        Title: T("Alignment"),
                        Description: T("Select the alignment for Crop and Pad modes."),
                        Size: 1,
                        Multiple: false),
                    _PadColor: Shape.Textbox(
                        Id: "padcolor", Name: "PadColor",
                        Title: T("Pad Color"),
                        Value: "#ffffff",
                        Description: T("The background color to use to pad the image. Named color or hex value."),
                        Classes: new[] { "text small" })
                    );

                f._Mode.Add(new SelectListItem {
                    Value = "max", Text = T("Max").Text
                });
                f._Mode.Add(new SelectListItem {
                    Value = "pad", Text = T("Pad").Text
                });
                f._Mode.Add(new SelectListItem {
                    Value = "crop", Text = T("Crop").Text
                });
                f._Mode.Add(new SelectListItem {
                    Value = "stretch", Text = T("Stretch").Text
                });

                f._Alignment.Add(new SelectListItem {
                    Value = "topleft", Text = T("Top Left").Text
                });
                f._Alignment.Add(new SelectListItem {
                    Value = "topcenter", Text = T("Top Center").Text
                });
                f._Alignment.Add(new SelectListItem {
                    Value = "topright", Text = T("Top Right").Text
                });
                f._Alignment.Add(new SelectListItem {
                    Value = "middleleft", Text = T("Middle Left").Text
                });
                f._Alignment.Add(new SelectListItem {
                    Value = "middlecenter", Text = T("Middle Center").Text
                });
                f._Alignment.Add(new SelectListItem {
                    Value = "middleright", Text = T("Middle Right").Text
                });
                f._Alignment.Add(new SelectListItem {
                    Value = "bottomleft", Text = T("Bottom Left").Text
                });
                f._Alignment.Add(new SelectListItem {
                    Value = "bottomcenter", Text = T("Bottom Center").Text
                });
                f._Alignment.Add(new SelectListItem {
                    Value = "bottomright", Text = T("Bottom Right").Text
                });

                return(f);
            };

            context.Form("ResizeFilter", form);
        }
Example #16
0
        public void Describe(DescribeContext context)
        {
            Func <IShapeFactory, object> form =
                shape => {
                var f = Shape.Form(
                    Id: "RawLayout",
                    _HtmlProperties: Shape.Fieldset(
                        Title: T("Html properties"),
                        _ContainerTag: Shape.TextBox(
                            Id: "container-tag", Name: "ContainerTag",
                            Title: T("Container tag"),
                            Description: T("The tag of the container. Leave empty for no container."),
                            Classes: new[] { "text medium", "tokenized" }
                            ),
                        _ContainerId: Shape.TextBox(
                            Id: "container-id", Name: "ContainerId",
                            Title: T("Container id"),
                            Description: T("The id to provide on the container element."),
                            Classes: new[] { "text medium", "tokenized" }
                            ),
                        _ContainerClass: Shape.TextBox(
                            Id: "container-class", Name: "ContainerClass",
                            Title: T("Container class"),
                            Description: T("The class to provide on the container element."),
                            Classes: new[] { "text medium", "tokenized" }
                            ),
                        _ItemTag: Shape.TextBox(
                            Id: "item-tag", Name: "ItemTag",
                            Title: T("Item tag"),
                            Description: T("The tag of each item. Leave empty for no tag."),
                            Classes: new[] { "text medium", "tokenized" }
                            ),
                        _ItemClass: Shape.TextBox(
                            Id: "item-class", Name: "ItemClass",
                            Title: T("Item class"),
                            Description: T("The class to provide on each item."),
                            Classes: new[] { "text medium", "tokenized" }
                            ),
                        _Prepend: Shape.TextBox(
                            Id: "prepend", Name: "Prepend",
                            Title: T("Prepend"),
                            Description: T("Some HTML to insert before the first element."),
                            Classes: new[] { "text medium", "tokenized" }
                            ),
                        _Separator: Shape.TextBox(
                            Id: "separator", Name: "Separator",
                            Title: T("Separator"),
                            Description: T("Some HTML to insert between two items."),
                            Classes: new[] { "text medium", "tokenized" }
                            ),
                        _Append: Shape.TextBox(
                            Id: "append", Name: "Append",
                            Title: T("Append"),
                            Description: T("Some HTML to insert after the last element."),
                            Classes: new[] { "text medium", "tokenized" }
                            )
                        )
                    );

                return(f);
            };

            context.Form("RawLayout", form);
        }
        public void Describe(DescribeContext context)
        {
            Func <IShapeFactory, object> form =
                shape => {
                var f = Shape.Form(
                    _Format: Shape.SelectList(
                        Id: "format", Name: "Format",
                        Title: T("Date format"),
                        Size: 1,
                        Multiple: false
                        )
                    );

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

                return(f);
            };

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

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

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

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

                return(f);
            };

            context.Form(FormName, form);
        }
        public void Describe(DescribeContext context)
        {
            Func <IShapeFactory, dynamic> form =
                shape => {
                var jobsQueueEnabled = _featureManager.GetEnabledFeatures().Any(x => x.Id == "Orchard.JobsQueue");
                var f = 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" }
                            ),
                        _CCEmails: Shape.Textbox(
                            Id: "recipient-cc-email",
                            Name: "RecipientCC",
                            Title: T("CC"),
                            Description: T("Specify a comma-separated list of e-mail CC recipients."),
                            Classes: new[] { "large", "text", "tokenized" }
                            ),
                        _BCCEmails: Shape.Textbox(
                            Id: "recipient-bcc-email",
                            Name: "RecipientBCC",
                            Title: T("BCC"),
                            Description: T("Specify a comma-separated list of e-mail BCC recipients."),
                            Classes: new[] { "large", "text", "tokenized" }
                            ),
                        _FromEmails: Shape.Textbox(
                            Id: "from-email",
                            Name: "FromEmail",
                            Title: T("From"),
                            Description: T("Specify email sender."),
                            Classes: new[] { "large", "text", "tokenized" }
                            ),
                        _ReplyTo: Shape.Textbox(
                            Id: "reply-to",
                            Name: "ReplyTo",
                            Title: T("ReplyTo"),
                            Description: T("Specify reply to."),
                            Classes: new[] { "large", "text", "tokenized" }
                            ),
                        _NotifyReadEmail: Shape.Checkbox(
                            Id: "NotifyReadEmail",
                            Name: "NotifyReadEmail",
                            Title: T("Notify at Read Email"),
                            Description: T("Notify Read Email."),
                            Value: "NotifyReadEmail"
                            )
                        ),
                    _Parts: Shape.SelectList(
                        Id: "email-template", Name: "EmailTemplate",
                        Title: T("Default template"),
                        Description: T("A default template to format your email message."),
                        Size: 1,
                        Multiple: false
                        ),
                    _Template: Shape.Textbox(
                        Id: "custom-template-id",
                        Name: "CustomTemplateId",
                        Title: T("Custom template ID"),
                        Description: T("Specify a template ID to format your email message. Leave blank to use the default template."),
                        Classes: new[] { "large", "text", "tokenized" }
                        ),
                    _Attachments: Shape.Textbox(
                        Id: "attachment-list",
                        Name: "AttachmentList",
                        Title: T("Attachment Path List"),
                        Description: T("Specify a comma separated list of file phisical path (e.g. c:\\Temp\\dummy_file.txt)."),
                        Classes: new[] { "large", "text", "tokenized" }
                        )
                    );
                if (jobsQueueEnabled)
                {
                    f._Type._Queued(Shape.Checkbox(
                                        Id: "Queued", Name: "Queued",
                                        Title: T("Queued"),
                                        Checked: false, Value: "true",
                                        Description: T("Check send it as a queued job.")));

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

                    f._Type._Priority.Add(new SelectListItem {
                        Value = "-50", Text = T("Low").Text
                    });
                    f._Type._Priority.Add(new SelectListItem {
                        Value = "0", Text = T("Normal").Text
                    });
                    f._Type._Priority.Add(new SelectListItem {
                        Value = "50", Text = T("High").Text
                    });
                }
                var allTemplates = _templateServices.GetTemplates().Where(w => !w.IsLayout);

                foreach (var template in allTemplates)
                {
                    f._Parts.Add(new SelectListItem {
                        Value = _contentManager.GetItemMetadata(template).Identity.ToString(), Text = template.Title
                    });
                }
                return(f);
            };


            context.Form("ActivityActionTemplatedEmail", form);
        }
Example #20
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" }),
                        _Bcc: New.TextBox(
                            Id: "bcc",
                            Name: "Bcc",
                            Title: T("Bcc"),
                            Description: T("Specify a comma-separated list of email addresses for a blind carbon copy"),
                            Classes: new[] { "large", "text", "tokenized" }),
                        _CC: New.TextBox(
                            Id: "cc",
                            Name: "CC",
                            Title: T("CC"),
                            Description: T("Specify a comma-separated list of email addresses for a carbon copy"),
                            Classes: new[] { "large", "text", "tokenized" }),
                        _ReplyTo: New.Textbox(
                            Id: "reply-to",
                            Name: "ReplyTo",
                            Title: T("Reply To Address"),
                            Description: T("If necessary, specify an email address for replies."),
                            Classes: new [] { "large", "text", "tokenized" }),
                        _Subject: New.Textbox(
                            Id: "Subject", Name: "Subject",
                            Title: T("Subject"),
                            Description: T("The subject of the email message."),
                            Classes: new[] { "large", "text", "tokenized" }),
                        _Message: New.Textarea(
                            Id: "Body", Name: "Body",
                            Title: T("Body"),
                            Description: T("The body of the email message."),
                            Classes: new[] { "tokenized" })
                        ));

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

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

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

                return(form);
            };

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

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

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

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

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

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

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

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

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

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

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

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