Table of Contents

Class AddInParameterEditorAttribute

Namespace
Dynamicweb.Extensibility.AddIns
Assembly
Dynamicweb.Extensibility.dll
Defines the parameter editor attribute
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
public sealed class AddInParameterEditorAttribute : Attribute
Inheritance
AddInParameterEditorAttribute
Inherited Members

Examples

using System;
using System.Collections;
using Dynamicweb.Extensibility.AddIns;
using Dynamicweb.Extensibility.Editors;

namespace Dynamicweb.Examples.Extensibility
{
    /// <summary>
    /// The example of an abstract addin with attrbutes and parameter editors
    /// </summary>
    [
        AddInActive(true), 
        AddInName("Abstract add-in"),
        AddInLabel("Abstract add-in"),
        AddInDescription("Just an example of using attributes and parameter editors."),
        AddInImage("image.png"),
        AddInIcon(Core.UI.Icons.KnownIcon.ObjectGroup),
        AddInDeprecated(false),
        AddInAuthor("James Bond"),
        AddInGroup("Examples"),
        AddInTarget("Examples"),
        AddInOrder(0),
        AddInUseParameterOrdering(true), 
        AddInUseParameterGrouping(true),
        AddInUseParameters(false)
    ]
    public class AddInWithEditors : ConfigurableAddIn, IDropDownOptions
    {
        [AddInLabel("Color"), AddInParameter("ColorParameterEditor"), AddInParameterEditor(typeof(ColorParameterEditor), "")]
        public string ColorEditor { get; set; }

        [AddInLabel("Date"), AddInParameter("DateEditor"), AddInParameterEditor(typeof(DateTimeParameterEditor), "hideName=true;AllowNeverExpire=true;AllowEmpty=true;show=date"), AddInParameterGroup("Source")]
        public DateTime DateEditor { get; set; }

        [AddInLabel("Decimal"), AddInParameter("DecimalEditor"), AddInParameterEditor(typeof(FloatingPointNumberParameterEditor), "minValue=0;maxValue=10;allowNegativeValues=false;localizeValues=true;inputClass=std;disabled=false")]
        public decimal DecimalEditor { get; set; }

        [AddInParameter("FileEditor"), AddInParameterEditor(typeof(FileManagerEditor), "usefilesfolder=true;allowBrowse=true;extensions=js;file=System/config/clean.js;showfullpath=true;Icon=fa fa-exclamation-triangle;Tooltip=Select a js file;")]
        public string FileEditor { get; set; }

        [AddInParameter("FolderCustom"), AddInParameterEditor(typeof(FolderSelectEditor), "htmlClass=NewUIinput;")]
        public string FolderCustomEditor { get; set; } = "/MyCustomFolder";

        [AddInParameter("FolderImages"), AddInParameterEditor(typeof(FolderSelectEditor), "htmlClass=NewUIinput;useimagesfolder=true")]
        public string FolderImagesEditor { get; set; }

        [AddInParameter("FolderFiles"), AddInParameterEditor(typeof(FolderSelectEditor), "htmlClass=NewUIinput;usefilesfolder=true")]
        public string FolderFilesEditor { get; set; }

        [AddInParameter("Default font"), AddInParameterEditor(typeof(GoogleFontParameterEditor), "")]
        public Dynamicweb.Content.Items.Editors.GoogleFont FontEditor { get; set; }

        [AddInParameter("DefaultFontName"), AddInParameterEditor(typeof(HiddenParameterEditor), "")]
        public string DefaultFontName
        {
            get { return FontEditor.Family; }
            set { FontEditor.Family = value; }
        }

        [AddInParameter("DefaultFontWeight"), AddInParameterEditor(typeof(HiddenParameterEditor), "")]
        public string DefaultFontWeight
        {
            get { return FontEditor.SelectedVariant; }
            set { FontEditor.SelectedVariant = value; }
        }

        [AddInParameter("IntegerEditor"), AddInParameterEditor(typeof(IntegerNumberParameterEditor), "inputClass=std editor-parameter;allowNegativeValues=false")]
        public int IntegerEditor { get; set; }

        [AddInParameter("NumberEditorInteger"), AddInParameterEditor(typeof(NumberParameterEditor), "inputClass=std editor-parameter;allowNegativeValues=false")]
        public int NumberEditorInteger { get; set; }

        [AddInParameter("NumberEditorDecimal"), AddInParameterEditor(typeof(NumberParameterEditor), "inputClass=std editor-parameter;allowNegativeValues=false;numberType=Decimal")]
        public int NumberEditorDecimal { get; set; }

        [AddInParameter("NumberEditorCurrency"), AddInParameterEditor(typeof(NumberParameterEditor), "inputClass=std editor-parameter;allowNegativeValues=false;numberType=Currency")]
        public int NumberEditorCurrency { get; set; }

        [AddInParameter("Item type"), AddInParameterEditor(typeof(ItemListParameterEditor), "inputClass=std; StructureType=All; AllowEditParameterOptions=False")]
        public string ItemType { get; set; }

        [AddInParameter("Example of static link"), AddInParameterEditor(typeof(LabelParameterEditor), "")]
        public string LabelEditor { get; set; } = @"<a href=""http://doc.dynamicweb.com/forum"" target=""_blank"">Developer forum</a>";

        [AddInParameter("MoreLessEditor"), AddInParameterEditor(typeof(MoreLessParameterEditor), "")]
        public string MoreLessEditor { get; set; }

        [AddInParameter("MultipleValuesEditor"), AddInParameterEditor(typeof(MultipleValuesEditor), "")]
        public string MultipleValuesEditor { get; set; }

        [AddInParameter("URL to page"), AddInParameterEditor(typeof(PageSelectEditor), "")]
        public string UrlToPage{ get; set; }

        [AddInParameter("Show on paragraph"), AddInParameterEditor(typeof(ParagraphSelectEditor), "htmlClass=std")]
        public string ParagraphId { get; set; }

        [AddInParameter("Period editor"), AddInParameterEditor(typeof(PeriodParameterEditor), "")]
        public string PeriodEditor { get; set; }

        [AddInParameter("Template"), AddInParameterEditor(typeof(TemplateParameterEditor), "folder=templates/MyModule/Email/;FullPath=true;NewGUI=true")]
        public string Template { get; set; }

        [AddInLabel("Text"), AddInParameter("Text"), AddInParameterOrder(0), AddInParameterEditor(typeof(TextParameterEditor), ""), AddInIsEditable(true)]
        public string Text { get; set; }

        [AddInParameter("User group"), AddInParameterEditor(typeof(UserGroupParameterEditor), "multiple=false;")]
        public string UserGroup { get; set; }

        [AddInParameter("User"), AddInParameterEditor(typeof(UserParameterEditor), "")]
        public string UserEditor { get; set; }

        [AddInLabel("YesNo"), AddInParameter("YesNo"), AddInParameterEditor(typeof(YesNoParameterEditor), "")]
        public bool YesNoEditor { get; set; } = false;

        [AddInParameter("CheckList"), AddInParameterGroup("Parameters with options"), AddInParameterEditor(typeof(CheckListParameterEditor), "infoText=A little description for parameter")]
        public string CheckListEditor { get; set; }

        [AddInParameter("DropDownEditor"), AddInParameterGroup("Parameters with options"), AddInParameterEditor(typeof(DropDownParameterEditor), "none=false;SortBy=Value;")]
        public string DropDownEditor { get; set; }

        [AddInParameter("GroupedDropDown"), AddInParameterGroup("Parameters with options"), AddInParameterEditor(typeof(GroupedDropDownParameterEditor), "SortBy=Group,Key;none=false;")]
        public string GroupedDropDownEditor { get; set; }

        [AddInParameter("RadioButtons"), AddInParameterGroup("Parameters with options"), AddInParameterEditor(typeof(RadioParameterEditor), "")]
        public string RadioEditor { get; set; }

        /// <summary>
        /// Implementation of IDropDownOptions interface
        /// </summary>
        public Hashtable GetOptions(string dropdownName)
        {
            switch (dropdownName)
            {
                case "CheckList":
                case "DropDownEditor":
                case "RadioButtons":
                    return new Hashtable
                    {
                        {"value1", "label 1"},
                        {"value2", "label 2"},
                        {"value3", "label 3"},
                        {"value4", "label 4"}
                    };
                case "GroupedDropDown":
                    var list = new Hashtable();
                    list.Add("Group1_Item1", new GroupedDropDownParameterEditor.DropDownItem("Item 1", "Group 1", "Group1_Item1"));
                    list.Add("Group1_Item2", new GroupedDropDownParameterEditor.DropDownItem("Item 2", "Group 1", "Group1_Item2"));
                    list.Add("Group2_Item1", new GroupedDropDownParameterEditor.DropDownItem("Item 1", "Group 2", "Group2_Item1"));
                    return list;
                default:
                    throw new ArgumentException($"Unknown dropdown name: '{dropdownName}'");
            }
        }
    }
}

Constructors

AddInParameterEditorAttribute(string, string)

Initializes a new instance of the AddInParameterEditorAttribute class.
public AddInParameterEditorAttribute(string editorType, string options)

Parameters

editorType string
Type of the editor.
options string
The options.

AddInParameterEditorAttribute(Type, string)

Initializes a new instance of the AddInParameterEditorAttribute class.
public AddInParameterEditorAttribute(Type editor, string options)

Parameters

editor Type
Type of the editor.
options string
The options.

Properties

EditorType

Gets or sets the type of the editor.
public Type EditorType { get; set; }

Property Value

Type
The type of the editor.

Options

Gets or sets the options.
public string Options { get; set; }

Property Value

string
The options.
To top