コード例 #1
0
 public ContentPropertyMapDefinition(
     ICultureDictionary cultureDictionary,
     IDataTypeService dataTypeService,
     IEntityService entityService,
     ILocalizedTextService textService,
     ILoggerFactory loggerFactory,
     PropertyEditorCollection propertyEditors)
 {
     _contentPropertyBasicConverter = new ContentPropertyBasicMapper <ContentPropertyBasic>(
         dataTypeService,
         entityService,
         loggerFactory.CreateLogger <ContentPropertyBasicMapper <ContentPropertyBasic> >(),
         propertyEditors);
     _contentPropertyDtoConverter = new ContentPropertyDtoMapper(
         dataTypeService,
         entityService,
         loggerFactory.CreateLogger <ContentPropertyDtoMapper>(),
         propertyEditors);
     _contentPropertyDisplayMapper = new ContentPropertyDisplayMapper(
         cultureDictionary,
         dataTypeService,
         entityService,
         textService,
         loggerFactory.CreateLogger <ContentPropertyDisplayMapper>(),
         propertyEditors);
 }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MemberController"/> class.
 /// </summary>
 /// <param name="cultureDictionary">The culture dictionary</param>
 /// <param name="loggerFactory">The logger factory</param>
 /// <param name="shortStringHelper">The string helper</param>
 /// <param name="eventMessages">The event messages factory</param>
 /// <param name="localizedTextService">The entry point for localizing key services</param>
 /// <param name="propertyEditors">The property editors</param>
 /// <param name="umbracoMapper">The mapper</param>
 /// <param name="memberService">The member service</param>
 /// <param name="memberTypeService">The member type service</param>
 /// <param name="memberManager">The member manager</param>
 /// <param name="dataTypeService">The data-type service</param>
 /// <param name="backOfficeSecurityAccessor">The back office security accessor</param>
 /// <param name="jsonSerializer">The JSON serializer</param>
 /// <param name="passwordChanger">The password changer</param>
 public MemberController(
     ICultureDictionary cultureDictionary,
     ILoggerFactory loggerFactory,
     IShortStringHelper shortStringHelper,
     IEventMessagesFactory eventMessages,
     ILocalizedTextService localizedTextService,
     PropertyEditorCollection propertyEditors,
     IUmbracoMapper umbracoMapper,
     IMemberService memberService,
     IMemberTypeService memberTypeService,
     IMemberManager memberManager,
     IDataTypeService dataTypeService,
     IBackOfficeSecurityAccessor backOfficeSecurityAccessor,
     IJsonSerializer jsonSerializer,
     IPasswordChanger <MemberIdentityUser> passwordChanger,
     ICoreScopeProvider scopeProvider)
     : base(cultureDictionary, loggerFactory, shortStringHelper, eventMessages, localizedTextService, jsonSerializer)
 {
     _propertyEditors            = propertyEditors;
     _umbracoMapper              = umbracoMapper;
     _memberService              = memberService;
     _memberTypeService          = memberTypeService;
     _memberManager              = memberManager;
     _dataTypeService            = dataTypeService;
     _localizedTextService       = localizedTextService;
     _backOfficeSecurityAccessor = backOfficeSecurityAccessor;
     _jsonSerializer             = jsonSerializer;
     _shortStringHelper          = shortStringHelper;
     _passwordChanger            = passwordChanger;
     _scopeProvider              = scopeProvider;
 }
コード例 #3
0
 public MemberTypeController(
     ICultureDictionary cultureDictionary,
     EditorValidatorCollection editorValidatorCollection,
     IContentTypeService contentTypeService,
     IMediaTypeService mediaTypeService,
     IMemberTypeService memberTypeService,
     IUmbracoMapper umbracoMapper,
     ILocalizedTextService localizedTextService,
     IBackOfficeSecurityAccessor backofficeSecurityAccessor,
     IShortStringHelper shortStringHelper)
     : base(cultureDictionary,
            editorValidatorCollection,
            contentTypeService,
            mediaTypeService,
            memberTypeService,
            umbracoMapper,
            localizedTextService)
 {
     _memberTypeService          = memberTypeService ?? throw new ArgumentNullException(nameof(memberTypeService));
     _backofficeSecurityAccessor = backofficeSecurityAccessor ?? throw new ArgumentNullException(nameof(backofficeSecurityAccessor));
     _shortStringHelper          = shortStringHelper ?? throw new ArgumentNullException(nameof(shortStringHelper));
     _umbracoMapper        = umbracoMapper ?? throw new ArgumentNullException(nameof(umbracoMapper));
     _localizedTextService =
         localizedTextService ?? throw new ArgumentNullException(nameof(localizedTextService));
 }
コード例 #4
0
ファイル: UmbracoHelper.cs プロジェクト: jraghu24/Rraghu
 /// <summary>
 /// Returns the dictionary value for the key specified
 /// </summary>
 /// <param name="key"></param>
 /// <returns></returns>
 public string GetDictionaryValue(string key)
 {
     if (_cultureDictionary == null)
     {
         var factory = CultureDictionaryFactoryResolver.Current.Factory;
         _cultureDictionary = factory.CreateDictionary();
     }
     return(_cultureDictionary[key]);
 }
コード例 #5
0
        public MediaMapDefinition(ICultureDictionary cultureDictionary, CommonMapper commonMapper, CommonTreeNodeMapper commonTreeNodeMapper, IMediaService mediaService, IMediaTypeService mediaTypeService,
                                  ILocalizedTextService localizedTextService, MediaUrlGeneratorCollection mediaUrlGenerators, IOptions <ContentSettings> contentSettings, IContentTypeBaseServiceProvider contentTypeBaseServiceProvider)
        {
            _commonMapper         = commonMapper;
            _commonTreeNodeMapper = commonTreeNodeMapper;
            _mediaService         = mediaService;
            _mediaTypeService     = mediaTypeService;
            _mediaUrlGenerators   = mediaUrlGenerators;
            _contentSettings      = contentSettings.Value ?? throw new ArgumentNullException(nameof(contentSettings));

            _tabsAndPropertiesMapper = new TabsAndPropertiesMapper <IMedia>(cultureDictionary, localizedTextService, contentTypeBaseServiceProvider);
        }
コード例 #6
0
 public ContentPropertyDisplayMapper(
     ICultureDictionary cultureDictionary,
     IDataTypeService dataTypeService,
     IEntityService entityService,
     ILocalizedTextService textService,
     ILogger <ContentPropertyDisplayMapper> logger,
     PropertyEditorCollection propertyEditors)
     : base(dataTypeService, entityService, logger, propertyEditors)
 {
     _cultureDictionary = cultureDictionary;
     _textService       = textService;
 }
コード例 #7
0
 //TODO: add mockings as params
 public UmbracoHelper GetMockedUmbracoHelper(ICultureDictionary dictionary)
 {
     return(new UmbracoHelper(
                UmbracoContextMock,
                Mock.Of <IPublishedContent>(),
                Mock.Of <ITypedPublishedContentQuery>(query => query.TypedContent(It.IsAny <int>()) == Mock.Of <IPublishedContent>(content => content.Id == 7)),
                Mock.Of <IDynamicPublishedContentQuery>(),
                Mock.Of <ITagQuery>(),
                Mock.Of <IDataTypeService>(),
                new UrlProvider(UmbracoContextMock, Enumerable.Empty <IUrlProvider>()),
                dictionary,
                Mock.Of <IUmbracoComponentRenderer>(),
                new MembershipHelper(UmbracoContextMock, Mock.Of <MembershipProvider>(), Mock.Of <RoleProvider>())));
 }
コード例 #8
0
ファイル: BaseContext.cs プロジェクト: KerwinMa/Umbraco
 public virtual void SetMembers(MacroModel macro, INode node)
 {
     if (macro == null)
     {
         throw new ArgumentNullException("macro");
     }
     if (node == null)
     {
         throw new ArgumentNullException("node");
     }
     _macro = macro;
     ParameterDictionary = new UmbracoParameterDictionary(macro.Properties);
     CultureDictionary   = new UmbracoCultureDictionary();
     _node = node;
 }
コード例 #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UmbracoHelper"/> class.
 /// </summary>
 /// <remarks>For tests.</remarks>
 internal UmbracoHelper(UmbracoContext umbracoContext, IPublishedContent content,
                        ITagQuery tagQuery,
                        ICultureDictionary cultureDictionary,
                        IUmbracoComponentRenderer componentRenderer,
                        MembershipHelper membershipHelper,
                        ServiceContext services)
 {
     _umbracoContext    = umbracoContext ?? throw new ArgumentNullException(nameof(umbracoContext));
     _tag               = tagQuery ?? throw new ArgumentNullException(nameof(tagQuery));
     _cultureDictionary = cultureDictionary ?? throw new ArgumentNullException(nameof(cultureDictionary));
     _componentRenderer = componentRenderer ?? throw new ArgumentNullException(nameof(componentRenderer));
     _membershipHelper  = membershipHelper ?? throw new ArgumentNullException(nameof(membershipHelper));
     _currentPage       = content ?? throw new ArgumentNullException(nameof(content));
     _services          = services ?? throw new ArgumentNullException(nameof(services));
 }
コード例 #10
0
 public EmbeddedContentPropertyEditor(
     IContentTypeService contentTypeService,
     IDataTypeService dataTypeService,
     ICultureDictionary cultureDictionary,
     ProfilingLogger profilingLogger,
     PropertyEditorResolver propertyEditorResolver,
     Func <WebSecurity> securityFactory)
 {
     _contentTypeService     = contentTypeService;
     _dataTypeService        = dataTypeService;
     _cultureDictionary      = cultureDictionary;
     _profilingLogger        = profilingLogger;
     _propertyEditorResolver = propertyEditorResolver;
     _securityFactory        = securityFactory;
 }
コード例 #11
0
        private static string UmbracoDictionaryTranslate(string text, ICultureDictionary cultureDictionary)
        {
            if (text == null)
            {
                return(null);
            }

            if (text.StartsWith("#") == false)
            {
                return(text);
            }

            text = text.Substring(1);
            return(cultureDictionary[text].IfNullOrWhiteSpace(text));
        }
コード例 #12
0
 public static UmbracoHelper GetUmbracoHelper(UmbracoContext context, ICultureDictionary cultureDictionary = null, MembershipHelper membershipHelper = null, UrlProvider urlProvider = null,
                                              IPublishedContent content = null, ITypedPublishedContentQuery typedQuery = null, IDynamicPublishedContentQuery dynamicQuery            = null, ITagQuery tagQuery = null, IDataTypeService typeService = null,
                                              IUmbracoComponentRenderer componentRenderer = null)
 {
     return(new UmbracoHelper(context,
                              content ?? Mock.Of <IPublishedContent>(),
                              typedQuery ?? Mock.Of <ITypedPublishedContentQuery>(),
                              dynamicQuery ?? Mock.Of <IDynamicPublishedContentQuery>(),
                              tagQuery ?? Mock.Of <ITagQuery>(),
                              typeService ?? Mock.Of <IDataTypeService>(),
                              urlProvider ?? GetUmbracoUrlProvider(context),
                              cultureDictionary ?? Mock.Of <ICultureDictionary>(),
                              componentRenderer ?? Mock.Of <IUmbracoComponentRenderer>(),
                              membershipHelper ?? GetUmbracoMembershipHelper(context)));
 }
コード例 #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ContentControllerBase"/> class.
 /// </summary>
 protected ContentControllerBase(
     ICultureDictionary cultureDictionary,
     ILoggerFactory loggerFactory,
     IShortStringHelper shortStringHelper,
     IEventMessagesFactory eventMessages,
     ILocalizedTextService localizedTextService,
     IJsonSerializer serializer)
 {
     CultureDictionary    = cultureDictionary;
     LoggerFactory        = loggerFactory;
     _logger              = loggerFactory.CreateLogger <ContentControllerBase>();
     ShortStringHelper    = shortStringHelper;
     EventMessages        = eventMessages;
     LocalizedTextService = localizedTextService;
     _serializer          = serializer;
 }
コード例 #14
0
 public MediaController(
     ICultureDictionary cultureDictionary,
     ILoggerFactory loggerFactory,
     IShortStringHelper shortStringHelper,
     IEventMessagesFactory eventMessages,
     ILocalizedTextService localizedTextService,
     IOptions <ContentSettings> contentSettings,
     IMediaTypeService mediaTypeService,
     IMediaService mediaService,
     IEntityService entityService,
     IBackOfficeSecurityAccessor backofficeSecurityAccessor,
     IUmbracoMapper umbracoMapper,
     IDataTypeService dataTypeService,
     ISqlContext sqlContext,
     IContentTypeBaseServiceProvider contentTypeBaseServiceProvider,
     IRelationService relationService,
     PropertyEditorCollection propertyEditors,
     MediaFileManager mediaFileManager,
     MediaUrlGeneratorCollection mediaUrlGenerators,
     IHostingEnvironment hostingEnvironment,
     IImageUrlGenerator imageUrlGenerator,
     IJsonSerializer serializer,
     IAuthorizationService authorizationService,
     AppCaches appCaches)
     : base(cultureDictionary, loggerFactory, shortStringHelper, eventMessages, localizedTextService, serializer)
 {
     _shortStringHelper          = shortStringHelper;
     _contentSettings            = contentSettings.Value;
     _mediaTypeService           = mediaTypeService;
     _mediaService               = mediaService;
     _entityService              = entityService;
     _backofficeSecurityAccessor = backofficeSecurityAccessor;
     _umbracoMapper              = umbracoMapper;
     _dataTypeService            = dataTypeService;
     _localizedTextService       = localizedTextService;
     _sqlContext = sqlContext;
     _contentTypeBaseServiceProvider = contentTypeBaseServiceProvider;
     _relationService      = relationService;
     _propertyEditors      = propertyEditors;
     _mediaFileManager     = mediaFileManager;
     _mediaUrlGenerators   = mediaUrlGenerators;
     _hostingEnvironment   = hostingEnvironment;
     _logger               = loggerFactory.CreateLogger <MediaController>();
     _imageUrlGenerator    = imageUrlGenerator;
     _authorizationService = authorizationService;
     _appCaches            = appCaches;
 }
コード例 #15
0
 protected ContentTypeControllerBase(
     ICultureDictionary cultureDictionary,
     EditorValidatorCollection editorValidatorCollection,
     IContentTypeService contentTypeService,
     IMediaTypeService mediaTypeService,
     IMemberTypeService memberTypeService,
     IUmbracoMapper umbracoMapper,
     ILocalizedTextService localizedTextService)
 {
     _editorValidatorCollection = editorValidatorCollection ?? throw new ArgumentNullException(nameof(editorValidatorCollection));
     CultureDictionary          = cultureDictionary ?? throw new ArgumentNullException(nameof(cultureDictionary));
     ContentTypeService         = contentTypeService ?? throw new ArgumentNullException(nameof(contentTypeService));
     MediaTypeService           = mediaTypeService ?? throw new ArgumentNullException(nameof(mediaTypeService));
     MemberTypeService          = memberTypeService ?? throw new ArgumentNullException(nameof(memberTypeService));
     UmbracoMapper        = umbracoMapper ?? throw new ArgumentNullException(nameof(umbracoMapper));
     LocalizedTextService = localizedTextService ?? throw new ArgumentNullException(nameof(localizedTextService));
 }
コード例 #16
0
        public ContentMapDefinition(
            CommonMapper commonMapper,
            CommonTreeNodeMapper commonTreeNodeMapper,
            ICultureDictionary cultureDictionary,
            ILocalizedTextService localizedTextService,
            IContentService contentService,
            IContentTypeService contentTypeService,
            IFileService fileService,
            IUmbracoContextAccessor umbracoContextAccessor,
            IPublishedRouter publishedRouter,
            ILocalizationService localizationService,
            ILoggerFactory loggerFactory,
            IUserService userService,
            IVariationContextAccessor variationContextAccessor,
            IContentTypeBaseServiceProvider contentTypeBaseServiceProvider,
            UriUtility uriUtility,
            IPublishedUrlProvider publishedUrlProvider,
            IEntityService entityService,
            IBackOfficeSecurityAccessor backOfficeSecurityAccessor,
            AppCaches appCaches)
        {
            _commonMapper               = commonMapper;
            _commonTreeNodeMapper       = commonTreeNodeMapper;
            _cultureDictionary          = cultureDictionary;
            _localizedTextService       = localizedTextService;
            _contentService             = contentService;
            _contentTypeService         = contentTypeService;
            _fileService                = fileService;
            _umbracoContextAccessor     = umbracoContextAccessor;
            _publishedRouter            = publishedRouter;
            _localizationService        = localizationService;
            _loggerFactory              = loggerFactory;
            _userService                = userService;
            _entityService              = entityService;
            _backOfficeSecurityAccessor = backOfficeSecurityAccessor;
            _variationContextAccessor   = variationContextAccessor;
            _uriUtility           = uriUtility;
            _publishedUrlProvider = publishedUrlProvider;
            _appCaches            = appCaches;

            _tabsAndPropertiesMapper = new TabsAndPropertiesMapper <IContent>(cultureDictionary, localizedTextService, contentTypeBaseServiceProvider);
            _stateMapper             = new ContentSavedStateMapper <ContentPropertyDisplay>();
            _basicStateMapper        = new ContentBasicSavedStateMapper <ContentPropertyBasic>();
            _contentVariantMapper    = new ContentVariantMapper(_localizationService, localizedTextService);
        }
コード例 #17
0
            public EmbeddedContentValueEditor(
                PropertyValueEditor wrapped,
                IContentTypeService contentTypeService,
                IDataTypeService dataTypeService,
                ICultureDictionary cultureDictionary,
                ProfilingLogger profilingLogger,
                PropertyEditorResolver propertyEditorResolver,
                WebSecurity security) : base(wrapped)
            {
                _contentTypeService     = contentTypeService;
                _dataTypeService        = dataTypeService;
                _cultureDictionary      = cultureDictionary;
                _profilingLogger        = profilingLogger;
                _propertyEditorResolver = propertyEditorResolver;
                _security = security;

                Validators.Add(new EmbeddedContentValidator(contentTypeService, dataTypeService));
            }
コード例 #18
0
 public MemberTabsAndPropertiesMapper(ICultureDictionary cultureDictionary,
                                      IBackOfficeSecurityAccessor backofficeSecurityAccessor,
                                      ILocalizedTextService localizedTextService,
                                      IMemberTypeService memberTypeService,
                                      IMemberService memberService,
                                      IMemberGroupService memberGroupService,
                                      IOptions <MemberPasswordConfigurationSettings> memberPasswordConfiguration,
                                      IContentTypeBaseServiceProvider contentTypeBaseServiceProvider,
                                      PropertyEditorCollection propertyEditorCollection)
     : base(cultureDictionary, localizedTextService, contentTypeBaseServiceProvider)
 {
     _backofficeSecurityAccessor = backofficeSecurityAccessor ?? throw new ArgumentNullException(nameof(backofficeSecurityAccessor));
     _localizedTextService       = localizedTextService ?? throw new ArgumentNullException(nameof(localizedTextService));
     _memberTypeService          = memberTypeService ?? throw new ArgumentNullException(nameof(memberTypeService));
     _memberService               = memberService ?? throw new ArgumentNullException(nameof(memberService));
     _memberGroupService          = memberGroupService ?? throw new ArgumentNullException(nameof(memberGroupService));
     _memberPasswordConfiguration = memberPasswordConfiguration.Value;
     _propertyEditorCollection    = propertyEditorCollection;
 }
コード例 #19
0
 public ContentTypeController(
     ICultureDictionary cultureDictionary,
     IContentTypeService contentTypeService,
     IMediaTypeService mediaTypeService,
     IMemberTypeService memberTypeService,
     IUmbracoMapper umbracoMapper,
     ILocalizedTextService localizedTextService,
     IEntityXmlSerializer serializer,
     PropertyEditorCollection propertyEditors,
     IBackOfficeSecurityAccessor backofficeSecurityAccessor,
     IDataTypeService dataTypeService,
     IShortStringHelper shortStringHelper,
     IFileService fileService,
     ILogger <ContentTypeController> logger,
     IContentService contentService,
     IContentTypeBaseServiceProvider contentTypeBaseServiceProvider,
     IHostingEnvironment hostingEnvironment,
     EditorValidatorCollection editorValidatorCollection,
     PackageDataInstallation packageDataInstallation)
     : base(
         cultureDictionary,
         editorValidatorCollection,
         contentTypeService,
         mediaTypeService,
         memberTypeService,
         umbracoMapper,
         localizedTextService)
 {
     _serializer                 = serializer;
     _propertyEditors            = propertyEditors;
     _contentTypeService         = contentTypeService;
     _umbracoMapper              = umbracoMapper;
     _backofficeSecurityAccessor = backofficeSecurityAccessor;
     _dataTypeService            = dataTypeService;
     _shortStringHelper          = shortStringHelper;
     _localizedTextService       = localizedTextService;
     _fileService                = fileService;
     _logger         = logger;
     _contentService = contentService;
     _contentTypeBaseServiceProvider = contentTypeBaseServiceProvider;
     _hostingEnvironment             = hostingEnvironment;
     _packageDataInstallation        = packageDataInstallation;
 }
コード例 #20
0
 public ExtendedMemberController(
     ICultureDictionary cultureDictionary,
     ILoggerFactory loggerFactory,
     IShortStringHelper shortStringHelper,
     IEventMessagesFactory eventMessages,
     ILocalizedTextService localizedTextService,
     PropertyEditorCollection propertyEditors,
     IUmbracoMapper umbracoMapper,
     IMemberService memberService,
     IMemberTypeService memberTypeService,
     IMemberManager memberManager,
     IDataTypeService dataTypeService,
     IBackOfficeSecurityAccessor backOfficeSecurityAccessor,
     IJsonSerializer jsonSerializer,
     IPasswordChanger <MemberIdentityUser> passwordChanger,
     IScopeProvider scopeProvider,
     IMemberExtendedService memberExtendedService,
     IMemberGroupService memberGroupService,
     IConfiguration configuration) :
     base(cultureDictionary, loggerFactory, shortStringHelper, eventMessages, localizedTextService,
          propertyEditors, umbracoMapper, memberService, memberTypeService,
          memberManager, dataTypeService, backOfficeSecurityAccessor, jsonSerializer, passwordChanger, scopeProvider)
コード例 #21
0
    public static string?UmbracoDictionaryTranslate(
        this ILocalizedTextService manager,
        ICultureDictionary cultureDictionary,
        string?text)
    {
        if (text == null)
        {
            return(null);
        }

        if (text.StartsWith("#") == false)
        {
            return(text);
        }

        text = text.Substring(1);
        var value = cultureDictionary[text];

        if (value.IsNullOrWhiteSpace() == false)
        {
            return(value);
        }

        if (text.IndexOf('_') == -1)
        {
            return(text);
        }

        var areaAndKey = text.Split('_');

        if (areaAndKey.Length < 2)
        {
            return(text);
        }

        value = manager.Localize(areaAndKey[0], areaAndKey[1]);
        return(value.StartsWith("[") ? text : value);
    }
コード例 #22
0
 public EmbeddedContentPreValueEditor(IContentTypeService contentTypeService,
                                      ICultureDictionary cultureDictionary)
 {
     _contentTypeService = contentTypeService ?? throw new ArgumentNullException(nameof(contentTypeService));
     _cultureDictionary  = cultureDictionary ?? throw new ArgumentNullException(nameof(cultureDictionary));
 }
コード例 #23
0
        private static string UmbracoDictionaryTranslate(this ILocalizedTextService manager, string text, ICultureDictionary cultureDictionary)
        {
            if (text == null)
            {
                return(null);
            }

            if (text.StartsWith("#") == false)
            {
                return(text);
            }

            text = text.Substring(1);
            var value = cultureDictionary[text];

            if (value.IsNullOrWhiteSpace() == false)
            {
                return(value);
            }

            value = manager.Localize(text.Replace('_', '/'));
            return(value.StartsWith("[") ? text : value);
        }
コード例 #24
0
 protected TabsAndPropertiesMapper(ICultureDictionary cultureDictionary, ILocalizedTextService localizedTextService, IEnumerable <string> ignoreProperties)
 {
     CultureDictionary    = cultureDictionary ?? throw new ArgumentNullException(nameof(cultureDictionary));
     LocalizedTextService = localizedTextService ?? throw new ArgumentNullException(nameof(localizedTextService));
     IgnoreProperties     = ignoreProperties ?? throw new ArgumentNullException(nameof(ignoreProperties));
 }
コード例 #25
0
 protected TabsAndPropertiesMapper(ICultureDictionary cultureDictionary, ILocalizedTextService localizedTextService)
     : this(cultureDictionary, localizedTextService, new List <string>())
 {
 }