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" }), _DefaultValue: shape.Textbox( Id: "DefaultValue", Name: "DefaultValue", Title: "Default Value", Classes: new[] { "text", "large", "tokenized" }, Description: T("The default value of this query field.")), _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); }); }
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", 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); }); }
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: "Option 1:1"")), _InputType: shape.SelectList( Id: "InputType", Name: "InputType", Title: "Input Type", Description: T("The control to render when presenting the list of options.")), _DefaultValue: shape.Textbox( Id: "DefaultValue", Name: "DefaultValue", Title: "Default Value", Classes: new[] { "text", "large", "tokenized" }, Description: T("The default value of this enumeration field."))); 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); }); }
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); }); }
protected override void DescribeForm(DescribeContext context) { context.Form("QueryForm", factory => { var shape = (dynamic)factory; var form = shape.Fieldset( Id: "QueryForm", _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."), Classes: new[] { "text", "large", "tokenized" }), _Query: shape.SelectList( Id: "QueryId", Name: "QueryId", Title: "Query", Description: T("Select the query to use as a source for the list.")), _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."))); // Query var queries = _contentManager.Query <QueryPart, QueryPartRecord>().Join <TitlePartRecord>().OrderBy(x => x.Title).List().ToArray(); foreach (var query in queries) { form._Query.Items.Add(new SelectListItem { Text = query.Name, Value = query.Id.ToString(CultureInfo.InvariantCulture) }); } // 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("QueryValidation", factory => { var shape = (dynamic)factory; var form = shape.Fieldset( Id: "QueryValidation", _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); }); }