Exemplo n.º 1
0
 public DateValueEditor(
     ILocalizedTextService localizedTextService,
     IShortStringHelper shortStringHelper,
     IJsonSerializer jsonSerializer,
     IIOHelper ioHelper,
     DataEditorAttribute attribute)
     : base(localizedTextService, shortStringHelper, jsonSerializer, ioHelper, attribute) =>
Exemplo n.º 2
0
        private static PropertyValidationService GetPropertyValidationService()
        {
            IIOHelper                  ioHelper                  = Mock.Of <IIOHelper>();
            IDataTypeService           dataTypeService           = Mock.Of <IDataTypeService>();
            ILocalizedTextService      localizedTextService      = Mock.Of <ILocalizedTextService>();
            IEditorConfigurationParser editorConfigurationParser = Mock.Of <IEditorConfigurationParser>();

            var attribute = new DataEditorAttribute("a", "a", "a");
            IDataValueEditorFactory dataValueEditorFactory = Mock.Of <IDataValueEditorFactory>(x
                                                                                               => x.Create <TextOnlyValueEditor>(It.IsAny <DataEditorAttribute>()) == new TextOnlyValueEditor(attribute, localizedTextService, Mock.Of <IShortStringHelper>(), new JsonNetSerializer(), Mock.Of <IIOHelper>()));


            var textBoxEditor = new TextboxPropertyEditor(
                dataValueEditorFactory,
                ioHelper,
                editorConfigurationParser);

            var serializer = new ConfigurationEditorJsonSerializer();

            var mockDataTypeService = new Mock <IDataTypeService>();

            Mock.Get(dataTypeService).Setup(x => x.GetDataType(It.Is <int>(y => y == Constants.DataTypes.Textbox)))
            .Returns(new DataType(textBoxEditor, serializer));

            var propertyEditorCollection = new PropertyEditorCollection(new DataEditorCollection(() => new[] { textBoxEditor }));

            return(new PropertyValidationService(
                       propertyEditorCollection,
                       dataTypeService,
                       localizedTextService,
                       new ValueEditorCache()));
        }
Exemplo n.º 3
0
    /// <summary>
    ///     Initializes a new instance of the <see cref="DataValueEditor" /> class.
    /// </summary>
    public DataValueEditor(
        ILocalizedTextService localizedTextService,
        IShortStringHelper shortStringHelper,
        IJsonSerializer jsonSerializer,
        IIOHelper ioHelper,
        DataEditorAttribute attribute)
    {
        if (attribute == null)
        {
            throw new ArgumentNullException(nameof(attribute));
        }

        _localizedTextService = localizedTextService;
        _shortStringHelper    = shortStringHelper;
        _jsonSerializer       = jsonSerializer;

        var view = attribute.View;

        if (string.IsNullOrWhiteSpace(view))
        {
            throw new ArgumentException("The attribute does not specify a view.", nameof(attribute));
        }

        if (view.StartsWith("~/"))
        {
            view = ioHelper.ResolveRelativeOrVirtualUrl(view);
        }

        View      = view;
        ValueType = attribute.ValueType;
        HideLabel = attribute.HideLabel;
    }
Exemplo n.º 4
0
 public GridPropertyValueEditor(
     IDataValueEditorFactory dataValueEditorFactory,
     DataEditorAttribute attribute,
     IBackOfficeSecurityAccessor backOfficeSecurityAccessor,
     ILocalizedTextService localizedTextService,
     HtmlImageSourceParser imageSourceParser,
     RichTextEditorPastedImages pastedImages,
     IShortStringHelper shortStringHelper,
     IImageUrlGenerator imageUrlGenerator,
     IJsonSerializer jsonSerializer,
     IIOHelper ioHelper)
     : this(
         dataValueEditorFactory,
         attribute,
         backOfficeSecurityAccessor,
         localizedTextService,
         imageSourceParser,
         pastedImages,
         shortStringHelper,
         imageUrlGenerator,
         jsonSerializer,
         ioHelper,
         StaticServiceProvider.Instance.GetRequiredService <IHtmlMacroParameterParser>())
 {
 }
 public CustomTextOnlyValueEditor(
     DataEditorAttribute attribute,
     ILocalizedTextService textService,
     IShortStringHelper shortStringHelper,
     IJsonSerializer jsonSerializer,
     IIOHelper ioHelper)
     : base(attribute, textService, shortStringHelper, jsonSerializer, ioHelper) => _textService = textService;
 public MultiplePickerParamateterValueEditorBase(
     ILocalizedTextService localizedTextService,
     IShortStringHelper shortStringHelper,
     IJsonSerializer jsonSerializer,
     IIOHelper ioHelper,
     DataEditorAttribute attribute,
     IEntityService entityService)
     : base(localizedTextService, shortStringHelper, jsonSerializer, ioHelper, attribute) =>
 public NestedContentPropertyValueEditor(DataEditorAttribute attribute, PropertyEditorCollection propertyEditors, IDataTypeService dataTypeService, IContentTypeService contentTypeService)
     : base(attribute)
 {
     _propertyEditors     = propertyEditors;
     _dataTypeService     = dataTypeService;
     _nestedContentValues = new NestedContentValues(contentTypeService);
     Validators.Add(new NestedContentValidator(propertyEditors, dataTypeService, _nestedContentValues));
 }
Exemplo n.º 8
0
 public GridPropertyValueEditor(DataEditorAttribute attribute,
                                IUmbracoContextAccessor umbracoContextAccessor,
                                HtmlImageSourceParser imageSourceParser,
                                RichTextEditorPastedImages pastedImages,
                                HtmlLocalLinkParser localLinkParser)
     : this(attribute, umbracoContextAccessor, imageSourceParser, pastedImages, localLinkParser, Current.ImageUrlGenerator)
 {
 }
Exemplo n.º 9
0
 public RichTextPropertyValueEditor(DataEditorAttribute attribute, IMediaService mediaService, IContentTypeBaseServiceProvider contentTypeBaseServiceProvider, IUmbracoContextAccessor umbracoContextAccessor, ILogger logger)
     : base(attribute)
 {
     _mediaService = mediaService;
     _contentTypeBaseServiceProvider = contentTypeBaseServiceProvider;
     _umbracoContextAccessor         = umbracoContextAccessor;
     _logger = logger;
 }
Exemplo n.º 10
0
 public ContentPickerPropertyValueEditor(
     ILocalizedTextService localizedTextService,
     IShortStringHelper shortStringHelper,
     IJsonSerializer jsonSerializer,
     IIOHelper ioHelper,
     DataEditorAttribute attribute)
     : base(localizedTextService, shortStringHelper, jsonSerializer, ioHelper, attribute)
 {
 }
 public NestedContentPropertyValueEditor(DataEditorAttribute attribute, PropertyEditorCollection propertyEditors, IDataTypeService dataTypeService, IContentTypeService contentTypeService, ILocalizedTextService textService, ILogger logger)
     : base(attribute)
 {
     _propertyEditors     = propertyEditors;
     _dataTypeService     = dataTypeService;
     _logger              = logger;
     _nestedContentValues = new NestedContentValues(contentTypeService);
     Validators.Add(new NestedContentValidator(_nestedContentValues, propertyEditors, dataTypeService, textService));
 }
Exemplo n.º 12
0
 public RichTextPropertyValueEditor(DataEditorAttribute attribute, IUmbracoContextAccessor umbracoContextAccessor, HtmlImageSourceParser imageSourceParser, HtmlLocalLinkParser localLinkParser, RichTextEditorPastedImages pastedImages, IImageUrlGenerator imageUrlGenerator)
     : base(attribute)
 {
     _umbracoContextAccessor = umbracoContextAccessor;
     _imageSourceParser      = imageSourceParser;
     _localLinkParser        = localLinkParser;
     _pastedImages           = pastedImages;
     _imageUrlGenerator      = imageUrlGenerator;
 }
Exemplo n.º 13
0
 public TextOnlyValueEditor(
     DataEditorAttribute attribute,
     ILocalizedTextService localizedTextService,
     IShortStringHelper shortStringHelper,
     IJsonSerializer jsonSerializer,
     IIOHelper ioHelper)
     : base(localizedTextService, shortStringHelper, jsonSerializer, ioHelper, attribute)
 {
 }
Exemplo n.º 14
0
 public MultipleTextStringPropertyValueEditor(
     ILocalizedTextService localizedTextService,
     IShortStringHelper shortStringHelper,
     IJsonSerializer jsonSerializer,
     IIOHelper ioHelper,
     DataEditorAttribute attribute)
     : base(localizedTextService, shortStringHelper, jsonSerializer, ioHelper, attribute)
 {
     _localizedTextService = localizedTextService;
 }
Exemplo n.º 15
0
 public TestValueEditor(
     ILocalizedTextService localizedTextService,
     IShortStringHelper shortStringHelper,
     IJsonSerializer jsonSerializer,
     IIOHelper ioHelper,
     DataEditorAttribute attribute)
     : base(localizedTextService, shortStringHelper, jsonSerializer, ioHelper, attribute)
 {
     Validators.Add(new NeverValidateValidator());
 }
Exemplo n.º 16
0
 public MultipleMediaPickerPropertyValueEditor(
     ILocalizedTextService localizedTextService,
     IShortStringHelper shortStringHelper,
     IJsonSerializer jsonSerializer,
     IIOHelper ioHelper,
     DataEditorAttribute attribute,
     IEntityService entityService)
     : base(localizedTextService, shortStringHelper, jsonSerializer, ioHelper, attribute, entityService)
 {
 }
 public BlockEditorPropertyValueEditor(DataEditorAttribute attribute, PropertyEditorCollection propertyEditors, IDataTypeService dataTypeService, IContentTypeService contentTypeService, ILocalizedTextService textService, ILogger logger)
     : base(attribute)
 {
     _propertyEditors   = propertyEditors;
     _dataTypeService   = dataTypeService;
     _logger            = logger;
     _blockEditorValues = new BlockEditorValues(new BlockListEditorDataConverter(), contentTypeService, _logger);
     Validators.Add(new BlockEditorValidator(_blockEditorValues, propertyEditors, dataTypeService, textService, contentTypeService));
     Validators.Add(new MinMaxValidator(_blockEditorValues, textService));
 }
Exemplo n.º 18
0
 public ContentBlocksDataValueEditor(
     DataEditorAttribute attribute,
     IContentTypeService contentTypeService,
     IDataTypeService dataTypeService,
     PropertyEditorCollection propertyEditors)
     : base(attribute)
 {
     _dataTypeService = dataTypeService;
     _elementTypes    = new Lazy <Dictionary <Guid, IContentType> >(() => contentTypeService.GetAllElementTypes().ToDictionary(x => x.Key));
     _propertyEditors = propertyEditors;
 }
 public MediaPicker3PropertyValueEditor(
     ILocalizedTextService localizedTextService,
     IShortStringHelper shortStringHelper,
     IJsonSerializer jsonSerializer,
     IIOHelper ioHelper,
     DataEditorAttribute attribute,
     IDataTypeService dataTypeService)
     : base(localizedTextService, shortStringHelper, jsonSerializer, ioHelper, attribute)
 {
     _jsonSerializer  = jsonSerializer;
     _dataTypeService = dataTypeService;
 }
Exemplo n.º 20
0
 public FileUploadPropertyValueEditor(
     DataEditorAttribute attribute,
     MediaFileManager mediaFileManager,
     ILocalizedTextService localizedTextService,
     IShortStringHelper shortStringHelper,
     IOptionsMonitor <ContentSettings> contentSettings,
     IJsonSerializer jsonSerializer,
     IIOHelper ioHelper)
     : base(localizedTextService, shortStringHelper, jsonSerializer, ioHelper, attribute)
 {
     _mediaFileManager = mediaFileManager ?? throw new ArgumentNullException(nameof(mediaFileManager));
     _contentSettings  = contentSettings.CurrentValue ?? throw new ArgumentNullException(nameof(contentSettings));
     contentSettings.OnChange(x => _contentSettings = x);
 }
Exemplo n.º 21
0
 public GridPropertyValueEditor(DataEditorAttribute attribute,
                                IUmbracoContextAccessor umbracoContextAccessor,
                                HtmlImageSourceParser imageSourceParser,
                                RichTextEditorPastedImages pastedImages,
                                HtmlLocalLinkParser localLinkParser,
                                IImageUrlGenerator imageUrlGenerator)
     : base(attribute)
 {
     _umbracoContextAccessor         = umbracoContextAccessor;
     _imageSourceParser              = imageSourceParser;
     _pastedImages                   = pastedImages;
     _richTextPropertyValueEditor    = new RichTextPropertyEditor.RichTextPropertyValueEditor(attribute, umbracoContextAccessor, imageSourceParser, localLinkParser, pastedImages, _imageUrlGenerator);
     _mediaPickerPropertyValueEditor = new MediaPickerPropertyEditor.MediaPickerPropertyValueEditor(attribute);
     _imageUrlGenerator              = imageUrlGenerator;
 }
 public MultiUrlPickerValueEditor(
     IEntityService entityService,
     IPublishedSnapshotAccessor publishedSnapshotAccessor,
     ILogger <MultiUrlPickerValueEditor> logger,
     ILocalizedTextService localizedTextService,
     IShortStringHelper shortStringHelper,
     DataEditorAttribute attribute,
     IPublishedUrlProvider publishedUrlProvider,
     IJsonSerializer jsonSerializer,
     IIOHelper ioHelper)
     : base(localizedTextService, shortStringHelper, jsonSerializer, ioHelper, attribute)
 {
     _entityService             = entityService ?? throw new ArgumentNullException(nameof(entityService));
     _publishedSnapshotAccessor = publishedSnapshotAccessor ??
                                  throw new ArgumentNullException(nameof(publishedSnapshotAccessor));
     _logger = logger ?? throw new ArgumentNullException(nameof(logger));
     _publishedUrlProvider = publishedUrlProvider;
 }
Exemplo n.º 23
0
 public ImageCropperPropertyValueEditor(
     DataEditorAttribute attribute,
     ILogger <ImageCropperPropertyValueEditor> logger,
     MediaFileManager mediaFileSystem,
     ILocalizedTextService localizedTextService,
     IShortStringHelper shortStringHelper,
     IOptionsMonitor <ContentSettings> contentSettings,
     IJsonSerializer jsonSerializer,
     IIOHelper ioHelper,
     IDataTypeService dataTypeService)
     : base(localizedTextService, shortStringHelper, jsonSerializer, ioHelper, attribute)
 {
     _logger           = logger ?? throw new ArgumentNullException(nameof(logger));
     _mediaFileManager = mediaFileSystem ?? throw new ArgumentNullException(nameof(mediaFileSystem));
     _contentSettings  = contentSettings.CurrentValue;
     _dataTypeService  = dataTypeService;
     contentSettings.OnChange(x => _contentSettings = x);
 }
 public NestedContentPropertyValueEditor(
     IDataTypeService dataTypeService,
     ILocalizedTextService localizedTextService,
     IContentTypeService contentTypeService,
     IShortStringHelper shortStringHelper,
     DataEditorAttribute attribute,
     PropertyEditorCollection propertyEditors,
     ILogger <NestedContentPropertyEditor> logger,
     IJsonSerializer jsonSerializer,
     IIOHelper ioHelper,
     IPropertyValidationService propertyValidationService)
     : base(localizedTextService, shortStringHelper, jsonSerializer, ioHelper, attribute)
 {
     _propertyEditors     = propertyEditors;
     _dataTypeService     = dataTypeService;
     _logger              = logger;
     _nestedContentValues = new NestedContentValues(contentTypeService);
     Validators.Add(new NestedContentValidator(propertyValidationService, _nestedContentValues, contentTypeService));
 }
            public BlockEditorPropertyValueEditor(
                DataEditorAttribute attribute,
                PropertyEditorCollection propertyEditors,
                IDataTypeService dataTypeService,
                IContentTypeService contentTypeService,
                ILocalizedTextService textService,
                ILogger <BlockEditorPropertyValueEditor> logger,
                IShortStringHelper shortStringHelper,
                IJsonSerializer jsonSerializer,
                IIOHelper ioHelper,
                IPropertyValidationService propertyValidationService)
                : base(textService, shortStringHelper, jsonSerializer, ioHelper, attribute)
            {
                _propertyEditors = propertyEditors;
                _dataTypeService = dataTypeService;
                _logger          = logger;

                _blockEditorValues = new BlockEditorValues(new BlockListEditorDataConverter(), contentTypeService, _logger);
                Validators.Add(new BlockEditorValidator(propertyValidationService, _blockEditorValues, contentTypeService));
                Validators.Add(new MinMaxValidator(_blockEditorValues, textService));
            }
Exemplo n.º 26
0
 public RichTextPropertyValueEditor(
     DataEditorAttribute attribute,
     IBackOfficeSecurityAccessor backOfficeSecurityAccessor,
     ILocalizedTextService localizedTextService,
     IShortStringHelper shortStringHelper,
     HtmlImageSourceParser imageSourceParser,
     HtmlLocalLinkParser localLinkParser,
     RichTextEditorPastedImages pastedImages,
     IImageUrlGenerator imageUrlGenerator,
     IJsonSerializer jsonSerializer,
     IIOHelper ioHelper,
     IHtmlSanitizer htmlSanitizer,
     IHtmlMacroParameterParser macroParameterParser)
     : base(localizedTextService, shortStringHelper, jsonSerializer, ioHelper, attribute)
 {
     _backOfficeSecurityAccessor = backOfficeSecurityAccessor;
     _imageSourceParser          = imageSourceParser;
     _localLinkParser            = localLinkParser;
     _pastedImages         = pastedImages;
     _imageUrlGenerator    = imageUrlGenerator;
     _htmlSanitizer        = htmlSanitizer;
     _macroParameterParser = macroParameterParser;
 }
Exemplo n.º 27
0
 public GridPropertyValueEditor(
     IDataValueEditorFactory dataValueEditorFactory,
     DataEditorAttribute attribute,
     IBackOfficeSecurityAccessor backOfficeSecurityAccessor,
     ILocalizedTextService localizedTextService,
     HtmlImageSourceParser imageSourceParser,
     RichTextEditorPastedImages pastedImages,
     IShortStringHelper shortStringHelper,
     IImageUrlGenerator imageUrlGenerator,
     IJsonSerializer jsonSerializer,
     IIOHelper ioHelper,
     IHtmlMacroParameterParser macroParameterParser)
     : base(localizedTextService, shortStringHelper, jsonSerializer, ioHelper, attribute)
 {
     _backOfficeSecurityAccessor = backOfficeSecurityAccessor;
     _imageSourceParser          = imageSourceParser;
     _pastedImages = pastedImages;
     _richTextPropertyValueEditor =
         dataValueEditorFactory.Create <RichTextPropertyEditor.RichTextPropertyValueEditor>(attribute);
     _mediaPickerPropertyValueEditor =
         dataValueEditorFactory.Create <MediaPickerPropertyEditor.MediaPickerPropertyValueEditor>(attribute);
     _imageUrlGenerator    = imageUrlGenerator;
     _macroParameterParser = macroParameterParser;
 }
 public TagPropertyValueEditor(DataEditorAttribute attribute)
     : base(attribute)
 {
 }
Exemplo n.º 29
0
 public NestedContentPropertyValueEditor(DataEditorAttribute attribute, PropertyEditorCollection propertyEditors)
     : base(attribute)
 {
     _propertyEditors = propertyEditors;
     Validators.Add(new NestedContentValidator(propertyEditors));
 }
Exemplo n.º 30
0
 public HideLabelDataValueEditor(DataEditorAttribute attribute)
     : base(attribute)
 {
 }