コード例 #1
0
 public MultipleContentTypeParameterEditor(ILogger logger)
     : base(logger)
 {
     // configure
     DefaultConfiguration.Add("multiple", true);
     DefaultConfiguration.Add("entityType", "DocumentType");
 }
コード例 #2
0
        public NumberInputConfigurationEditor()
            : base()
        {
            DefaultConfiguration.Add("size", "s");

            Fields.Add(
                "size",
                "Numeric size",
                "How big will the number get?",
                IOHelper.ResolveUrl(RadioButtonListDataListEditor.DataEditorViewPath),
                new Dictionary <string, object>
            {
                { Constants.Conventions.ConfigurationFieldAliases.Items, new[]
                  {
                      new DataListItem {
                          Name = "Small", Value = "s", Description = "Ideal for numbers under 100, comfortably fits 3 digits."
                      },
                      new DataListItem {
                          Name = "Medium", Value = "m", Description = "Better when dealing with hundreds and thousands, comfortably fits 6 digits."
                      },
                      new DataListItem {
                          Name = "Large", Value = "l", Description = "Did you know a 18 digit number is called a quintillion!"
                      },
                      new DataListItem {
                          Name = "Extra Large", Value = "xl", Description = "Useful when aligning with full width text inputs. Fits 88 digits <em>- that's over an octovigintillion!</em>"
                      },
                  } },
                { ShowDescriptionsConfigurationField.ShowDescriptions, Constants.Values.True },
                { Constants.Conventions.ConfigurationFieldAliases.DefaultValue, "s" },
            });

            // TODO: [LK:2020-12-11] Commented out the value-type feature for the time being. Adds additional complexity that I don't currently need.
            //// NOTE: When using the key "umbracoDataValueType", Umbraco will auto-set the database type.
            //// https://github.com/umbraco/Umbraco-CMS/blob/release-8.6.1/src/Umbraco.Core/Models/DataType.cs#L122-L126
            //Fields.Add(
            //    UmbConstants.PropertyEditors.ConfigurationKeys.DataValueType,
            //    "Value type",
            //    "Select the value type of this number input.",
            //    IOHelper.ResolveUrl(RadioButtonListDataListEditor.DataEditorViewPath),
            //    new Dictionary<string, object>()
            //    {
            //        { Constants.Conventions.ConfigurationFieldAliases.Items, new[]
            //            {
            //                new DataListItem { Name = nameof(ValueTypes.Decimal), Value = ValueTypes.Decimal, Description = "Accepts any number with decimal places." },
            //                new DataListItem { Name = nameof(ValueTypes.Integer), Value = ValueTypes.Integer, Description = "Accepts positive and negative whole numbers." },
            //            }
            //        },
            //        { ShowDescriptionsConfigurationField.ShowDescriptions, Constants.Values.True },
            //        { Constants.Conventions.ConfigurationFieldAliases.DefaultValue, ValueTypes.Integer },
            //    });

            // TODO: [LK:2020-12-11] Add "min/max" and "step" fields.

            Fields.Add(
                "placeholderText",
                "Placeholder text",
                "Add placeholder text for the number input.<br>This is to be used as instructional information, not as a default value.",
                "textstring"
                );
        }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MultipleContentPickerParameterEditor"/> class.
 /// </summary>
 public MultipleContentPickerParameterEditor(ILogger logger)
     : base(logger)
 {
     // configure
     DefaultConfiguration.Add("multiPicker", "1");
     DefaultConfiguration.Add("minNumber", 0);
     DefaultConfiguration.Add("maxNumber", 0);
 }
コード例 #4
0
 public MultipleContentTypeParameterEditor(
     IDataValueEditorFactory dataValueEditorFactory)
     : base(dataValueEditorFactory)
 {
     // configure
     DefaultConfiguration.Add("multiple", true);
     DefaultConfiguration.Add("entityType", "DocumentType");
 }
コード例 #5
0
 public MultiplePropertyTypeParameterEditor(ILogger logger)
     : base(logger)
 {
     // configure
     DefaultConfiguration.Add("multiple", "1");
     DefaultConfiguration.Add("entityType", "PropertyType");
     //don't publish the id for a property type, publish its alias
     DefaultConfiguration.Add("publishBy", "alias");
 }
コード例 #6
0
 public PropertyGroupParameterEditor(ILogger logger)
     : base(logger)
 {
     // configure
     DefaultConfiguration.Add("multiple", "0");
     DefaultConfiguration.Add("entityType", "PropertyGroup");
     //don't publish the id for a property group, publish it's alias (which is actually just it's lower cased name)
     DefaultConfiguration.Add("publishBy", "alias");
 }
コード例 #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MultipleContentPickerParameterEditor"/> class.
 /// </summary>
 public MultipleContentPickerParameterEditor(
     IDataValueEditorFactory dataValueEditorFactory)
     : base(dataValueEditorFactory)
 {
     // configure
     DefaultConfiguration.Add("multiPicker", "1");
     DefaultConfiguration.Add("minNumber", 0);
     DefaultConfiguration.Add("maxNumber", 0);
 }
コード例 #8
0
 public MultiplePropertyGroupParameterEditor(
     IDataValueEditorFactory dataValueEditorFactory)
     : base(dataValueEditorFactory)
 {
     // configure
     DefaultConfiguration.Add("multiple", true);
     DefaultConfiguration.Add("entityType", "PropertyGroup");
     //don't publish the id for a property group, publish its alias, which is actually just its lower cased name
     DefaultConfiguration.Add("publishBy", "alias");
 }
コード例 #9
0
 public MultiplePropertyTypeParameterEditor(
     IDataValueEditorFactory dataValueEditorFactory)
     : base(dataValueEditorFactory)
 {
     // configure
     DefaultConfiguration.Add("multiple", "1");
     DefaultConfiguration.Add("entityType", "PropertyType");
     //don't publish the id for a property type, publish its alias
     DefaultConfiguration.Add("publishBy", "alias");
 }
        public ContentBlocksConfigurationEditor(
            IContentService contentService,
            IContentTypeService contentTypeService,
            ConfigurationEditorUtility utility)
            : base()
        {
            _utility = utility;

            // NOTE: Gets all the elementTypes and blueprints upfront, rather than several hits inside the loop.
            _elementTypes      = contentTypeService.GetAllElementTypes().ToDictionary(x => x.Key);
            _elementBlueprints = new Lazy <ILookup <int, IContent> >(() => contentService.GetBlueprintsForContentTypes(_elementTypes.Values.Select(x => x.Id).ToArray()).ToLookup(x => x.ContentTypeId));

            var displayModes = utility.GetConfigurationEditorModels <IContentBlocksDisplayMode>();

            // NOTE: Sets the default display mode to be the Blocks.
            var defaultDisplayMode = displayModes.FirstOrDefault(x => x.Key.InvariantEquals(typeof(BlocksDisplayMode).GetFullNameWithAssembly()));

            if (defaultDisplayMode != null)
            {
                DefaultConfiguration.Add(DisplayMode, new[] { new { key = defaultDisplayMode.Key, value = defaultDisplayMode.DefaultValues } });
            }

            Fields.Add(new ConfigurationField
            {
                Key         = DisplayMode,
                Name        = "Display mode",
                Description = "Select and configure how to display the blocks in the editor.",
                View        = IOHelper.ResolveUrl(ConfigurationEditorDataEditor.DataEditorViewPath),
                Config      = new Dictionary <string, object>()
                {
                    { Constants.Conventions.ConfigurationFieldAliases.AddButtonLabelKey, "contentment_configureDisplayMode" },
                    { Constants.Conventions.ConfigurationFieldAliases.Items, displayModes },
                    { MaxItemsConfigurationField.MaxItems, 1 },
                    { DisableSortingConfigurationField.DisableSorting, Constants.Values.True },
                    { Constants.Conventions.ConfigurationFieldAliases.OverlayView, IOHelper.ResolveUrl(ConfigurationEditorDataEditor.DataEditorOverlayViewPath) },
                    { EnableDevModeConfigurationField.EnableDevMode, Constants.Values.True },
                }
            });

            Fields.Add(new ContentBlocksTypesConfigurationField(_elementTypes.Values));
            Fields.Add(new EnableFilterConfigurationField());
            Fields.Add(new MaxItemsConfigurationField());
            Fields.Add(new DisableSortingConfigurationField());
            Fields.Add(new EnableDevModeConfigurationField());
        }
コード例 #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MultipleMediaPickerParameterEditor"/> class.
 /// </summary>
 public MultipleMediaPickerParameterEditor(ILogger logger)
     : base(logger)
 {
     DefaultConfiguration.Add("multiPicker", "1");
 }
コード例 #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MultipleMediaPickerParameterEditor"/> class.
 /// </summary>
 public MultipleMediaPickerParameterEditor(
     IDataValueEditorFactory dataValueEditorFactory)
     : base(dataValueEditorFactory)
 {
     DefaultConfiguration.Add("multiPicker", "1");
 }
        public CodeEditorConfigurationEditor()
            : base()
        {
            var targetPath    = "~/umbraco/lib/ace-builds/src-min-noconflict/";
            var aceEditorPath = IOHelper.MapPath(targetPath);

            if (Directory.Exists(aceEditorPath) == true)
            {
                var aceEditorFiles = Directory.GetFiles(aceEditorPath, "*.js");
                if (aceEditorFiles != null && aceEditorFiles.Length > 0)
                {
                    var modes  = new List <DataListItem>();
                    var themes = new List <DataListItem>();

                    foreach (var file in aceEditorFiles)
                    {
                        var filename = Path.GetFileNameWithoutExtension(file);
                        if (filename.StartsWith("mode-") == true)
                        {
                            var mode = filename.Replace("mode-", string.Empty).ToLower();
                            modes.Add(new DataListItem {
                                Name = mode.ToFirstUpperInvariant(), Value = mode
                            });
                        }

                        if (filename.StartsWith("theme-") == true)
                        {
                            var theme = filename.Replace("theme-", string.Empty).ToLower();
                            themes.Add(new DataListItem {
                                Name = theme.ToFirstUpperInvariant(), Value = theme
                            });
                        }
                    }

                    if (modes.Count > 0)
                    {
                        DefaultConfiguration.Add(Mode, "razor");
                        Fields.Add(new ConfigurationField
                        {
                            Key         = Mode,
                            Name        = "Language mode",
                            Description = "Select the programming language mode. The default mode is 'Razor'.",
                            View        = IOHelper.ResolveUrl(DropdownListDataListEditor.DataEditorViewPath),
                            Config      = new Dictionary <string, object>
                            {
                                { DropdownListDataListEditor.AllowEmpty, Constants.Values.False },
                                { Constants.Conventions.ConfigurationFieldAliases.Items, modes },
                            }
                        });
                    }

                    if (themes.Count > 0)
                    {
                        DefaultConfiguration.Add(Theme, "chrome");
                        Fields.Add(new ConfigurationField
                        {
                            Key         = Theme,
                            Name        = nameof(Theme),
                            Description = "Set the theme for the code editor. The default theme is 'Chrome'.",
                            View        = IOHelper.ResolveUrl(DropdownListDataListEditor.DataEditorViewPath),
                            Config      = new Dictionary <string, object>
                            {
                                { DropdownListDataListEditor.AllowEmpty, Constants.Values.False },
                                { Constants.Conventions.ConfigurationFieldAliases.Items, themes },
                            }
                        });
                    }

                    if (modes.Count > 0 || themes.Count > 0)
                    {
                        Fields.Add(new NotesConfigurationField($@"<details class=""well well-small"">
<summary>Would you like to add more <strong>language modes</strong> and <strong>themes</strong>?</summary>
<p>This property editor makes use of <a href=""https://ace.c9.io/"" target=""_blank""><strong>AWS Cloud 9's Ace editor</strong></a> library that is distributed with Umbraco. By default, Umbraco ships a streamlined set of programming language modes and themes.</p>
<p>If you would like to add more modes and themes, you can do this by <a href=""https://github.com/ajaxorg/ace-builds/releases"" target=""_blank""><strong>downloading the latest pre-packaged version of the Ace editor</strong></a> and copy any of the <code>mode-*</code> or <code>theme-*</code> files from the <code>src-min-noconflict</code> folder over to the <code>{targetPath}</code> folder in this Umbraco installation.</p>
<p>When you reload this screen, the new programming language modes and themes will appear in the dropdown options above.</p>
</details>", true));
                    }
                }
            }

            DefaultConfiguration.Add(FontSize, "small");
            Fields.Add(new ConfigurationField
            {
                Key         = FontSize,
                Name        = "Font size",
                Description = @"Set the font size. The value must be a valid CSS <a href=""https://developer.mozilla.org/en-US/docs/Web/CSS/font-size"" target=""_blank""  rel=""noopener""><strong>font-size</strong></a> value. The default size is 'small'.",
                View        = IOHelper.ResolveUrl(TextInputDataEditor.DataEditorViewPath),
                Config      = new Dictionary <string, object>
                {
                    { Constants.Conventions.ConfigurationFieldAliases.Items, new[] {
                          new DataListItem {
                              Name = "Extra extra small", Value = "xx-small"
                          },
                          new DataListItem {
                              Name = "Extra small", Value = "x-small"
                          },
                          new DataListItem {
                              Name = "Small", Value = "small"
                          },
                          new DataListItem {
                              Name = "Medium", Value = "medium"
                          },
                          new DataListItem {
                              Name = "Large", Value = "large"
                          },
                          new DataListItem {
                              Name = "Extra large", Value = "x-large"
                          },
                          new DataListItem {
                              Name = "Extra extra large", Value = "xx-large"
                          },
                          new DataListItem {
                              Name = "Extra extra extra large", Value = "xxx-large"
                          },
                          new DataListItem {
                              Name = "Use pixels?", Value = "14px"
                          },
                          new DataListItem {
                              Name = "Use percentage?", Value = "80%"
                          },
                          new DataListItem {
                              Name = "Use ems?", Value = "0.8em"
                          },
                          new DataListItem {
                              Name = "Use rems?", Value = "1.2rem"
                          },
                      } },
                }
            });

            Fields.Add(new ConfigurationField
            {
                Key         = UseWrapMode,
                Name        = "Word wrapping",
                Description = "Select to enable word wrapping.",
                View        = "boolean"
            });

            // NOTE: [LK:2019-06-07] Hidden the advanced options (for now), need to review.
            //Fields.Add("showGutter", "Show gutter?", "Select to show the left-hand side gutter in the code editor.", "boolean");
            //Fields.Add("firstLineNumber", "First Line Number", "[A friendly description]", "number");
            //Fields.Add("showInvisibles", "showInvisibles", "[A friendly description]", "boolean");// showInvisibles: 0,
            //Fields.Add("showIndentGuides", "showIndentGuides", "[A friendly description]", "boolean");// showIndentGuides: 0,
            //Fields.Add("useSoftTabs", "useSoftTabs", "[A friendly description]", "boolean");// useSoftTabs: 1,
            //Fields.Add("showPrintMargin", "showPrintMargin", "[A friendly description]", "boolean");// showPrintMargin: 0,
            //Fields.Add("disableSearch", "disableSearch", "[A friendly description]", "boolean");// disableSearch: 0,
            //Fields.Add("enableSnippets", "enableSnippets", "[A friendly description]", "boolean");// enableSnippets: 0,
            //Fields.Add("enableBasicAutocompletion", "enableBasicAutocompletion", "[A friendly description]", "boolean");// enableBasicAutocompletion: 0,
            //Fields.Add("enableLiveAutocompletion", "enableLiveAutocompletion", "[A friendly description]", "boolean");// enableLiveAutocompletion: 0,
            //Fields.Add("readonly", "readonly", "[A friendly description]", "boolean");// readonly: 0,

            DefaultConfiguration.Add(MinLines, 12);
            Fields.Add(new ConfigurationField
            {
                Key         = MinLines,
                Name        = "Minimum lines",
                Description = "Set the minimum number of lines that the editor will be. The default is 12 lines.",
                View        = IOHelper.ResolveUrl(NumberInputDataEditor.DataEditorViewPath)
            });

            DefaultConfiguration.Add(MaxLines, 30);
            Fields.Add(new ConfigurationField
            {
                Key         = MaxLines,
                Name        = "Maximum lines",
                Description = "Set the maximum number of lines that the editor can be. If left empty, the editor will not auto-scale.",
                View        = IOHelper.ResolveUrl(NumberInputDataEditor.DataEditorViewPath)
            });
        }