/// <summary>
 /// Initializes a new instance of the <see cref="ListViewPropertyEditor"/> class.
 /// </summary>
 public ListViewPropertyEditor(
     IDataValueEditorFactory dataValueEditorFactory,
     IIOHelper iioHelper)
     : base(dataValueEditorFactory)
 {
     _iioHelper = iioHelper;
 }
 public EyeDropperColorPickerPropertyEditor(
     IDataValueEditorFactory dataValueEditorFactory,
     IIOHelper ioHelper,
     EditorType type = EditorType.PropertyValue)
     : this(dataValueEditorFactory, ioHelper, StaticServiceProvider.Instance.GetRequiredService <IEditorConfigurationParser>(), type)
 {
 }
 /// <summary>
 /// The constructor will setup the property editor based on the attribute if one is found
 /// </summary>
 public EmailAddressPropertyEditor(
     IDataValueEditorFactory dataValueEditorFactory,
     IIOHelper ioHelper)
     : base(dataValueEditorFactory)
 {
     _ioHelper = ioHelper;
 }
Exemple #4
0
    /// <summary>
    ///     Initializes a new instance of the <see cref="ManifestParser" /> class.
    /// </summary>
    public ManifestParser(
        AppCaches appCaches,
        ManifestValueValidatorCollection validators,
        ManifestFilterCollection filters,
        ILogger <ManifestParser> logger,
        IIOHelper ioHelper,
        IHostingEnvironment hostingEnvironment,
        IJsonSerializer jsonSerializer,
        ILocalizedTextService localizedTextService,
        IShortStringHelper shortStringHelper,
        IDataValueEditorFactory dataValueEditorFactory)
    {
        if (appCaches == null)
        {
            throw new ArgumentNullException(nameof(appCaches));
        }

        _cache                  = appCaches.RuntimeCache;
        _validators             = validators ?? throw new ArgumentNullException(nameof(validators));
        _filters                = filters ?? throw new ArgumentNullException(nameof(filters));
        _logger                 = logger ?? throw new ArgumentNullException(nameof(logger));
        _ioHelper               = ioHelper;
        _hostingEnvironment     = hostingEnvironment;
        AppPluginsPath          = "~/App_Plugins";
        _jsonSerializer         = jsonSerializer;
        _localizedTextService   = localizedTextService;
        _shortStringHelper      = shortStringHelper;
        _dataValueEditorFactory = dataValueEditorFactory;
    }
Exemple #5
0
 public NestedContentPropertyEditor(
     IDataValueEditorFactory dataValueEditorFactory,
     IIOHelper ioHelper)
     : base(dataValueEditorFactory)
 {
     _ioHelper = ioHelper;
 }
Exemple #6
0
 public RenderNoContentController(
     IUmbracoContextAccessor umbracoContextAccessor,
     IIOHelper ioHelper,
     IOptionsSnapshot <GlobalSettings> globalSettings)
     : this(umbracoContextAccessor, globalSettings, StaticServiceProvider.Instance.GetRequiredService <IHostingEnvironment>())
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MultipleTextStringPropertyEditor"/> class.
 /// </summary>
 public MultipleTextStringPropertyEditor(
     IIOHelper ioHelper,
     IDataValueEditorFactory dataValueEditorFactory)
     : base(dataValueEditorFactory)
 {
     _ioHelper = ioHelper;
 }
Exemple #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MarkdownPropertyEditor"/> class.
 /// </summary>
 public MarkdownPropertyEditor(
     IDataValueEditorFactory dataValueEditorFactory,
     IIOHelper ioHelper)
     : base(dataValueEditorFactory)
 {
     _ioHelper = ioHelper;
 }
 public MergeDateAndDateTimePropertyEditor(IMigrationContext context, IIOHelper ioHelper, IConfigurationEditorJsonSerializer configurationEditorJsonSerializer, IEditorConfigurationParser editorConfigurationParser)
     : base(context)
 {
     _ioHelper = ioHelper;
     _configurationEditorJsonSerializer = configurationEditorJsonSerializer;
     _editorConfigurationParser         = editorConfigurationParser;
 }
Exemple #10
0
 private void ClearFiles(IIOHelper ioHelper)
 {
     TestHelper.DeleteDirectory(ioHelper.MapPath("media"));
     TestHelper.DeleteDirectory(ioHelper.MapPath("FileSysTests"));
     TestHelper.DeleteDirectory(ioHelper.MapPath(Constants.SystemDirectories.TempData.EnsureEndsWith('/') +
                                                 "ShadowFs"));
 }
Exemple #11
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;
        }
Exemple #12
0
 public HtmlUrlParser(IOptions <ContentSettings> contentSettings, ILogger <HtmlUrlParser> logger, IProfilingLogger profilingLogger, IIOHelper ioHelper)
 {
     _contentSettings = contentSettings.Value;
     _logger          = logger;
     _ioHelper        = ioHelper;
     _profilingLogger = profilingLogger;
 }
 public DateValueEditor(
     ILocalizedTextService localizedTextService,
     IShortStringHelper shortStringHelper,
     IJsonSerializer jsonSerializer,
     IIOHelper ioHelper,
     DataEditorAttribute attribute)
     : base(localizedTextService, shortStringHelper, jsonSerializer, ioHelper, attribute) =>
 public CheckBoxListPropertyEditor(
     IDataValueEditorFactory dataValueEditorFactory,
     ILocalizedTextService textService,
     IIOHelper ioHelper)
     : this(dataValueEditorFactory, textService, ioHelper, StaticServiceProvider.Instance.GetRequiredService <IEditorConfigurationParser>())
 {
 }
 public MultiNodeTreePickerPropertyEditor(
     IDataValueEditorFactory dataValueEditorFactory,
     IIOHelper ioHelper)
     : base(dataValueEditorFactory)
 {
     _ioHelper = ioHelper;
 }
Exemple #16
0
 public BlockListPropertyEditor(
     IDataValueEditorFactory dataValueEditorFactory,
     PropertyEditorCollection propertyEditors,
     IIOHelper ioHelper)
     : this(dataValueEditorFactory, propertyEditors, ioHelper, StaticServiceProvider.Instance.GetRequiredService <IEditorConfigurationParser>())
 {
 }
 public CustomTextOnlyValueEditor(
     DataEditorAttribute attribute,
     ILocalizedTextService textService,
     IShortStringHelper shortStringHelper,
     IJsonSerializer jsonSerializer,
     IIOHelper ioHelper)
     : base(attribute, textService, shortStringHelper, jsonSerializer, ioHelper) => _textService = textService;
Exemple #18
0
 public ComplexTestEditor(
     IDataValueEditorFactory dataValueEditorFactory,
     IIOHelper ioHelper,
     IEditorConfigurationParser editorConfigurationParser)
     : base(dataValueEditorFactory, ioHelper, editorConfigurationParser)
 {
 }
        public void Setup()
        {
            var testRoot = TestContext.CurrentContext.TestDirectory.Split("bin")[0];

            // Create an example JSON log file to check results
            // As a one time setup for all tets in this class/fixture
            IIOHelper           ioHelper   = TestHelper.IOHelper;
            IHostingEnvironment hostingEnv = TestHelper.GetHostingEnvironment();

            ILoggingConfiguration loggingConfiguration = TestHelper.GetLoggingConfiguration(hostingEnv);

            var exampleLogfilePath = Path.Combine(testRoot, "TestHelpers", "Assets", LogfileName);

            _newLogfileDirPath = loggingConfiguration.LogDirectory;
            _newLogfilePath    = Path.Combine(_newLogfileDirPath, LogfileName);

            // Create/ensure Directory exists
            ioHelper.EnsurePathExists(_newLogfileDirPath);

            // Copy the sample files
            File.Copy(exampleLogfilePath, _newLogfilePath, true);

            ILogger <SerilogJsonLogViewer> logger = Mock.Of <ILogger <SerilogJsonLogViewer> >();
            var logViewerConfig = new LogViewerConfig(LogViewerQueryRepository, Mock.Of <IScopeProvider>());
            var logLevelLoader  = Mock.Of <ILogLevelLoader>();

            _logViewer = new SerilogJsonLogViewer(logger, logViewerConfig, loggingConfiguration, logLevelLoader, Log.Logger);
        }
 public RichTextPropertyEditor(
     IDataValueEditorFactory dataValueEditorFactory,
     IBackOfficeSecurityAccessor backOfficeSecurityAccessor,
     HtmlImageSourceParser imageSourceParser,
     HtmlLocalLinkParser localLinkParser,
     RichTextEditorPastedImages pastedImages,
     IIOHelper ioHelper,
     IImageUrlGenerator imageUrlGenerator,
     IHtmlMacroParameterParser macroParameterParser)
     : this(
         dataValueEditorFactory,
         backOfficeSecurityAccessor,
         imageSourceParser,
         localLinkParser,
         pastedImages,
         ioHelper,
         imageUrlGenerator,
         macroParameterParser,
         StaticServiceProvider.Instance.GetRequiredService <IEditorConfigurationParser>())
 {
     _backOfficeSecurityAccessor = backOfficeSecurityAccessor;
     _imageSourceParser          = imageSourceParser;
     _localLinkParser            = localLinkParser;
     _pastedImages         = pastedImages;
     _ioHelper             = ioHelper;
     _imageUrlGenerator    = imageUrlGenerator;
     _macroParameterParser = macroParameterParser;
 }
Exemple #21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TrueFalsePropertyEditor"/> class.
 /// </summary>
 public TrueFalsePropertyEditor(
     IDataValueEditorFactory dataValueEditorFactory,
     IIOHelper ioHelper)
     : base(dataValueEditorFactory)
 {
     _ioHelper = ioHelper;
 }
        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()));
        }
        public GridConfigurationEditor(IIOHelper ioHelper, IEditorConfigurationParser editorConfigurationParser)
            : base(ioHelper, editorConfigurationParser)
        {
            var items = Fields.First(x => x.Key == "items");

            items.Validators.Add(new GridValidator());
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="TextAreaPropertyEditor"/> class.
 /// </summary>
 public TextAreaPropertyEditor(
     IDataValueEditorFactory dataValueEditorFactory,
     IIOHelper ioHelper)
     : base(dataValueEditorFactory)
 {
     _ioHelper = ioHelper;
 }
 public ColorPickerPropertyEditor(
     IDataValueEditorFactory dataValueEditorFactory,
     IIOHelper ioHelper,
     IJsonSerializer jsonSerializer)
     : this(dataValueEditorFactory, ioHelper, jsonSerializer, StaticServiceProvider.Instance.GetRequiredService <IEditorConfigurationParser>())
 {
 }
Exemple #26
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SliderPropertyEditor"/> class.
 /// </summary>
 public SliderPropertyEditor(
     IDataValueEditorFactory dataValueEditorFactory,
     IIOHelper ioHelper)
     : base(dataValueEditorFactory)
 {
     _ioHelper = ioHelper;
 }
 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>())
 {
 }
Exemple #28
0
 public MntpConfigurationEditor(IIOHelper iOHelper) : base(iOHelper)
 {
     Field(nameof(MultiNodePickerConfiguration.TreeSource))
     .Config = new Dictionary <string, object> {
         { "idType", "udi" }
     };
 }
    /*
     * HOW TO REPLACE THE MEDIA UNDERLYING FILESYSTEM
     * ----------------------------------------------
     *
     * Create an implementation of IFileSystem and register it as the underlying filesystem for
     * MediaFileSystem with the following extension on composition.
     *
     * builder.SetMediaFileSystem(factory => FactoryMethodToReturnYourImplementation())
     *
     * WHAT IS SHADOWING
     * -----------------
     *
     * Shadowing is the technology used for Deploy to implement some sort of
     * transaction-management on top of filesystems. The plumbing explained above,
     * compared to creating your own physical filesystem, ensures that your filesystem
     * would participate into such transactions.
     *
     */

    internal static IUmbracoBuilder AddFileSystems(this IUmbracoBuilder builder)
    {
        // register FileSystems, which manages all filesystems
        builder.Services.AddSingleton <FileSystems>();

        // register the scheme for media paths
        builder.Services.AddUnique <IMediaPathScheme, UniqueMediaPathScheme>();

        builder.Services.AddUnique <IViewHelper, ViewHelper>();
        builder.Services.AddUnique <IDefaultViewContentProvider, DefaultViewContentProvider>();

        builder.SetMediaFileSystem(factory =>
        {
            IIOHelper ioHelper = factory.GetRequiredService <IIOHelper>();
            IHostingEnvironment hostingEnvironment = factory.GetRequiredService <IHostingEnvironment>();
            ILogger <PhysicalFileSystem> logger    = factory.GetRequiredService <ILogger <PhysicalFileSystem> >();
            GlobalSettings globalSettings          = factory.GetRequiredService <IOptions <GlobalSettings> >().Value;

            var rootPath = Path.IsPathRooted(globalSettings.UmbracoMediaPhysicalRootPath)
                ? globalSettings.UmbracoMediaPhysicalRootPath
                : hostingEnvironment.MapPathWebRoot(globalSettings.UmbracoMediaPhysicalRootPath);
            var rootUrl = hostingEnvironment.ToAbsolute(globalSettings.UmbracoMediaPath);
            return(new PhysicalFileSystem(ioHelper, hostingEnvironment, logger, rootPath, rootUrl));
        });

        return(builder);
    }
Exemple #30
0
 public MultiUrlPickerPropertyEditor(
     IIOHelper ioHelper,
     IDataValueEditorFactory dataValueEditorFactory)
     : base(dataValueEditorFactory, EditorType.PropertyValue)
 {
     _ioHelper = ioHelper;
 }