public override object ConvertDbToEditor(Property property, PropertyType propertyType, IDataTypeService dataTypeService) { if(property.Value == null || property.Value.ToString() == "") return string.Empty; var archetype = ArchetypeHelper.Instance.DeserializeJsonToArchetype(property.Value.ToString(), propertyType.DataTypeDefinitionId); foreach (var fieldset in archetype.Fieldsets) { foreach (var propDef in fieldset.Properties.Where(p => p.DataTypeGuid != null)) { try { var dtd = ArchetypeHelper.Instance.GetDataTypeByGuid(Guid.Parse(propDef.DataTypeGuid)); var propType = new PropertyType(dtd) {Alias = propDef.Alias}; var prop = new Property(propType, propDef.Value); var propEditor = PropertyEditorResolver.Current.GetByAlias(dtd.PropertyEditorAlias); propDef.Value = propEditor.ValueEditor.ConvertDbToEditor(prop, propType, dataTypeService); } catch (Exception ex) { LogHelper.Error<ArchetypePropertyValueEditor>(ex.Message, ex); } } } return archetype; }
public ContentDocument(IDataTypeService service, IContent content) : this() { Id = content.Id; ContentTypeId = content.ContentTypeId; ContentType = content.ContentType.Name; Name = content.Name; ParentId = content.ParentId; Level = content.Level; Path = content.Path; foreach (var propInfo in content.PropertyTypes.OrderBy(n => n.SortOrder)) { var p = new Property { Name = propInfo.Name, Alias = propInfo.Alias, Description = propInfo.Description, Required = propInfo.Mandatory, Validation = propInfo.ValidationRegExp, DataType = service.GetDataTypeDefinitionById(propInfo.DataTypeDefinitionId).Name, Value = (content.Properties.SingleOrDefault(n => n.Alias == propInfo.Alias).Value ?? string.Empty).ToString() }; Properties.Add(p); } }
/// <summary> /// public ctor - will generally just be used for unit testing /// </summary> /// <param name="contentService"></param> /// <param name="mediaService"></param> /// <param name="contentTypeService"></param> /// <param name="dataTypeService"></param> /// <param name="fileService"></param> /// <param name="localizationService"></param> /// <param name="packagingService"></param> /// <param name="entityService"></param> /// <param name="relationService"></param> /// <param name="sectionService"></param> /// <param name="treeService"></param> /// <param name="tagService"></param> public ServiceContext( IContentService contentService, IMediaService mediaService, IContentTypeService contentTypeService, IDataTypeService dataTypeService, IFileService fileService, ILocalizationService localizationService, PackagingService packagingService, IEntityService entityService, IRelationService relationService, ISectionService sectionService, IApplicationTreeService treeService, ITagService tagService) { _tagService = new Lazy<ITagService>(() => tagService); _contentService = new Lazy<IContentService>(() => contentService); _mediaService = new Lazy<IMediaService>(() => mediaService); _contentTypeService = new Lazy<IContentTypeService>(() => contentTypeService); _dataTypeService = new Lazy<IDataTypeService>(() => dataTypeService); _fileService = new Lazy<IFileService>(() => fileService); _localizationService = new Lazy<ILocalizationService>(() => localizationService); _packagingService = new Lazy<PackagingService>(() => packagingService); _entityService = new Lazy<IEntityService>(() => entityService); _relationService = new Lazy<IRelationService>(() => relationService); _sectionService = new Lazy<ISectionService>(() => sectionService); _treeService = new Lazy<IApplicationTreeService>(() => treeService); }
internal static XElement ToXml(this Property property, IDataTypeService dataTypeService) { var nodeName = UmbracoSettings.UseLegacyXmlSchema ? "data" : property.Alias.ToSafeAlias(); var xd = new XmlDocument(); var xmlNode = xd.CreateNode(XmlNodeType.Element, nodeName, ""); //Add the property alias to the legacy schema if (UmbracoSettings.UseLegacyXmlSchema) { var alias = xd.CreateAttribute("alias"); alias.Value = property.Alias.ToSafeAlias(); xmlNode.Attributes.Append(alias); } //This seems to fail during testing //SD: With the new null checks below, this shouldn't fail anymore. var dt = property.PropertyType.DataType(property.Id, dataTypeService); if (dt != null && dt.Data != null) { //We've already got the value for the property so we're going to give it to the // data type's data property so it doesn't go re-look up the value from the db again. var defaultData = dt.Data as IDataValueSetter; if (defaultData != null) { defaultData.SetValue(property.Value, property.PropertyType.DataTypeDatabaseType.ToString()); } xmlNode.AppendChild(dt.Data.ToXMl(xd)); } var element = xmlNode.GetXElement(); return element; }
private void ExpireCache(IDataTypeService sender, global::Umbraco.Core.Events.SaveEventArgs<global::Umbraco.Core.Models.IDataTypeDefinition> e) { foreach (var dataType in e.SavedEntities) { ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheItem( string.Concat("Our.Umbraco.DocTypeGridEditor.Web.Extensions.ContentTypeServiceExtensions.GetAliasById_", dataType.Key)); } }
/// <summary> /// Format the data for the editor /// </summary> /// <param name="property"></param> /// <param name="propertyType"></param> /// <param name="dataTypeService"></param> /// <returns></returns> public override object ConvertDbToEditor(Property property, PropertyType propertyType, IDataTypeService dataTypeService) { if (property.Value == null) return null; var parsed = MacroTagParser.FormatRichTextPersistedDataForEditor(property.Value.ToString(), new Dictionary<string, string>()); return parsed; }
void ExpirePreValueCache(IDataTypeService sender, global::Umbraco.Core.Events.SaveEventArgs<IDataTypeDefinition> e) { foreach (var dataType in e.SavedEntities) { ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheItem(Constants.CacheKey_PreValueFromDataTypeId + dataType.Id); ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheItem(Constants.CacheKey_DataTypeByGuid + dataType.Key); } }
private void ExpireVortoCache(IDataTypeService sender, global::Umbraco.Core.Events.SaveEventArgs<global::Umbraco.Core.Models.IDataTypeDefinition> e) { foreach (var dataType in e.SavedEntities) { ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheItem( Constants.CacheKey_GetTargetDataTypeDefinition + dataType.Id); } }
public MemberService() { _memberService = AppHelpers.UmbServices().MemberService; _memberGroupService = AppHelpers.UmbServices().MemberGroupService; _membershipHelper = AppHelpers.UmbMemberHelper(); _memberTypeService = AppHelpers.UmbServices().MemberTypeService; _dataTypeService = AppHelpers.UmbServices().DataTypeService; }
public CustomProperties(ILogger logger, IDataTypeService dataTypeService, IFileService fileService, IContent content, XElement xml) { _logger = logger; _dataTypeService = dataTypeService; _fileService = fileService; _content = content; _propertyElements = xml.Elements().ToList(); }
private void ExpireCache(IDataTypeService sender, SaveEventArgs<IDataTypeDefinition> e) { foreach (var dataType in e.SavedEntities) { ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheItem( string.Concat("Our.Umbraco.NestedContent.GetPreValuesCollectionByDataTypeId_", dataType.Id)); } }
/// <summary> /// TODO /// </summary> /// <param name="content">IContent/page to update</param> /// <param name="xml">XML</param> public XmlEdit(ILogger logger, IDataTypeService dataTypeService, IFileService fileService, IContent content, string xml) { _logger = logger; _dataTypeService = dataTypeService; _fileService = fileService; _content = content; TryParse(xml); }
public override object ConvertDbToEditor(Property property, PropertyType propertyType, IDataTypeService dataTypeService) { if (property.Value == null || string.IsNullOrEmpty(property.Value.ToString())) { return ""; } return SecurityHelper.Decrypt(property.Value.ToString(), SecurityHelper.GetKey()); }
public override string ConvertDbToString(Property property, PropertyType propertyType, IDataTypeService dataTypeService) { if (property.Value == null || string.IsNullOrEmpty(property.Value.ToString())) { return ""; } return property.Value.ToString(); }
public override object ConvertDbToEditor(Property property, PropertyType propertyType, IDataTypeService dataTypeService) { var date = property.Value.TryConvertTo<DateTime?>(); if (date.Success == false || date.Result == null) { return string.Empty; } //Dates will be formatted as yyyy-MM-dd return date.Result.Value.ToString("yyyy-MM-dd"); }
public ConnectToDatabase(IDbConnectService dbConnectService, IConnectionStringService connectionStringService, IDataTypeService dataTypeService) { InitializeComponent(); _dbConnectService = dbConnectService; _connectionStringService = connectionStringService; _dataTypeService = dataTypeService; LoadAuthenticationTypes(); }
public TypeMapper(IDataTypeService dataTypeService) { InitializeComponent(); _dataTypeService = dataTypeService; CreateColumns(); BindGrid(); }
private void ExpireMortarCache(IDataTypeService sender, SaveEventArgs<IDataTypeDefinition> e) { foreach (var dataType in e.SavedEntities) { ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheItem( string.Concat("Our.Umbraco.Mortar.Web.Extensions.ContentTypeServiceExtensions.GetAliasById_", dataType.Key)); ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheItem( string.Concat("Our.Umbraco.Mortar.Helpers.MortarHelper.GetRowOptionsDocType_GetPreValuesCollectionByDataTypeId_", dataType.Id)); } }
/// <summary> /// This method is called when the Content Type declared in the attribute hasn't been found in Umbraco /// </summary> /// <param name="contentTypeService"></param> /// <param name="fileService"></param> /// <param name="attribute"></param> /// <param name="type"></param> /// <param name="dataTypeService"></param> private static void CreateContentType(IContentTypeService contentTypeService, IFileService fileService, UmbracoContentTypeAttribute attribute, Type type, IDataTypeService dataTypeService) { IContentType newContentType; Type parentType = type.BaseType; if (parentType != null && parentType != typeof(UmbracoGeneratedBase) && parentType.GetBaseTypes(false).Any(x => x == typeof(UmbracoGeneratedBase))) { UmbracoContentTypeAttribute parentAttribute = parentType.GetCustomAttribute<UmbracoContentTypeAttribute>(); if (parentAttribute != null) { string parentAlias = parentAttribute.ContentTypeAlias; IContentType parentContentType = contentTypeService.GetContentType(parentAlias); newContentType = new ContentType(parentContentType); } else { throw new Exception("The given base class has no UmbracoContentTypeAttribute"); } } else { newContentType = new ContentType(-1); } newContentType.Name = attribute.ContentTypeName; newContentType.Alias = attribute.ContentTypeAlias; newContentType.Icon = attribute.Icon; newContentType.Description = attribute.Description; if (attribute.CreateMatchingView) { SetDefaultTemplateAndCreateIfNotExists(fileService, attribute.MasterTemplate, attribute.TemplateLocation, type, newContentType); } CreateAdditionalTemplates(newContentType, type, fileService, attribute.MasterTemplate, attribute.TemplateLocation); newContentType.AllowedAsRoot = attribute.AllowedAtRoot; newContentType.IsContainer = attribute.EnableListView; newContentType.AllowedContentTypes = FetchAllowedContentTypes(attribute.AllowedChildren, contentTypeService); //create tabs CreateTabs(newContentType, type, dataTypeService); //create properties on the generic tab var propertiesOfRoot = type.GetProperties().Where(x => x.GetCustomAttribute<UmbracoPropertyAttribute>() != null); foreach (var item in propertiesOfRoot) { CreateProperty(newContentType, null, dataTypeService, true, item); } //Save and persist the content Type contentTypeService.Save(newContentType, 0); }
public PackagingService(IContentService contentService, IContentTypeService contentTypeService, IMediaService mediaService, IDataTypeService dataTypeService, IFileService fileService, RepositoryFactory repositoryFactory, IDatabaseUnitOfWorkProvider uowProvider) { _contentService = contentService; _contentTypeService = contentTypeService; _mediaService = mediaService; _dataTypeService = dataTypeService; _fileService = fileService; _repositoryFactory = repositoryFactory; _uowProvider = uowProvider; _importedContentTypes = new Dictionary<string, IContentType>(); }
/// <summary> /// public ctor - will generally just be used for unit testing /// </summary> /// <param name="contentService"></param> /// <param name="mediaService"></param> /// <param name="contentTypeService"></param> /// <param name="dataTypeService"></param> /// <param name="fileService"></param> /// <param name="localizationService"></param> /// <param name="packagingService"></param> /// <param name="entityService"></param> /// <param name="relationService"></param> public ServiceContext(IContentService contentService, IMediaService mediaService, IContentTypeService contentTypeService, IDataTypeService dataTypeService, IFileService fileService, ILocalizationService localizationService, PackagingService packagingService, IEntityService entityService, RelationService relationService) { _contentService = new Lazy<IContentService>(() => contentService); _mediaService = new Lazy<IMediaService>(() => mediaService); _contentTypeService = new Lazy<IContentTypeService>(() => contentTypeService); _dataTypeService = new Lazy<IDataTypeService>(() => dataTypeService); _fileService = new Lazy<IFileService>(() => fileService); _localizationService = new Lazy<ILocalizationService>(() => localizationService); _packagingService = new Lazy<PackagingService>(() => packagingService); _entityService = new Lazy<IEntityService>(() => entityService); _relationService = new Lazy<RelationService>(() => relationService); }
/// <summary> /// Resolves the IDataType for a PropertyType. /// </summary> /// <param name="propertyType">PropertyType that references a DataType</param> /// <param name="propertyId">Id of the Property which references this DataType through its PropertyType</param> /// <param name="dataTypeService"></param> /// <returns><see cref="IDataType"/></returns> /// <remarks> /// This extension method is left internal because we don't want to take /// a hard dependency on the IDataType, as it will eventually go away and /// be replaced by PropertyEditors. It is however needed to generate xml /// for a property/propertytype when publishing. /// </remarks> internal static IDataType DataType(this PropertyType propertyType, int propertyId, IDataTypeService dataTypeService) { Mandate.ParameterNotNull(propertyType, "propertyType"); var dataType = dataTypeService.GetDataTypeById(propertyType.DataTypeId); if (dataType == null) { return null; } dataType.DataTypeDefinitionId = propertyType.DataTypeDefinitionId; dataType.Data.PropertyId = propertyId; return dataType; }
/// <summary> /// when saving to the xml cache, if the value can be converted to xml then ensure it's not wrapped in CData /// </summary> /// <param name="property"></param> /// <param name="propertyType"></param> /// <param name="dataTypeService"></param> /// <returns></returns> public override XNode ConvertDbToXml(Property property, PropertyType propertyType, IDataTypeService dataTypeService) { string value = this.ConvertDbToString(property, propertyType, dataTypeService); try { return XElement.Parse(value); } catch { return new XCData(value); } }
/// <summary> /// Initializes a new instance of the <see cref="DetachedValuesConverter"/> class. /// </summary> /// <param name="applicationContext"> /// The <see cref="ApplicationContext"/>. /// </param> /// <param name="values"> /// The resolved DefaultValueCorrection types. /// </param> internal DetachedValuesConverter(ApplicationContext applicationContext, IEnumerable<Type> values) { if (applicationContext != null) { _contentTypeService = applicationContext.Services.ContentTypeService; _dataTypeService = applicationContext.Services.DataTypeService; _ready = true; } else { _ready = false; } // Instantiate the corrector _corrector = new DetachedValueCorrector(values); }
/// <summary> /// Need to lookup the pre-values and put the string version in cache, not the ID (which is what is stored in the db) /// </summary> /// <param name="property"></param> /// <param name="propertyType"></param> /// <param name="dataTypeService"></param> /// <returns></returns> public override string ConvertDbToString(Property property, PropertyType propertyType, IDataTypeService dataTypeService) { var idAttempt = property.Value.TryConvertTo<int>(); if (idAttempt.Success) { var preValId = idAttempt.Result; var preVals = GetPreValues(property); if (preVals != null) { if (preVals.Any(x => x.Value.Id == preValId)) { return preVals.Single(x => x.Value.Id == preValId).Value.Value; } LogHelper.Warn<PublishValueValueEditor>("Could not find a pre value with ID " + preValId + " for property alias " + property.Alias); } } return base.ConvertDbToString(property, propertyType, dataTypeService); }
protected AbstractConnectionDependencies( ITableQueryWriter tableQueryWriter, IConnectionChecker connectionChecker, IEntityRecordsExist entityRecordsExist, IEntityDropper entityDropper, IEntityCreator entityCreator, List<IViewWriter> viewWriters, ITflWriter tflWriter, IScriptRunner scriptRunner, IDataTypeService dataTypeService, ILogger logger ) { TableQueryWriter = tableQueryWriter; ConnectionChecker = connectionChecker; EntityRecordsExist = entityRecordsExist; EntityDropper = entityDropper; EntityCreator = entityCreator; ViewWriters = viewWriters; TflWriter = tflWriter; ScriptRunner = scriptRunner; DataTypeService = dataTypeService; Logger = logger; }
/// <summary> /// If publishing ids, we don't need to do anything, otherwise we need to look up the pre-values and get the string values /// </summary> /// <param name="property"></param> /// <param name="propertyType"></param> /// <param name="dataTypeService"></param> /// <returns></returns> public override string ConvertDbToString(Property property, PropertyType propertyType, IDataTypeService dataTypeService) { if (_publishIds) { return base.ConvertDbToString(property, propertyType, dataTypeService); } var selectedIds = property.Value.ToString().Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries); if (selectedIds.Any() == false) { return base.ConvertDbToString(property, propertyType, dataTypeService); } var preValues = GetPreValues(property); if (preValues != null) { //get all pre-values matching our Ids return string.Join(",", preValues.Where(x => selectedIds.Contains(x.Value.Id.ToInvariantString())).Select(x => x.Value.Value)); } return base.ConvertDbToString(property, propertyType, dataTypeService); }
/// <summary> /// Creates the xml representation for the <see cref="Property"/> object /// </summary> /// <param name="property"><see cref="Property"/> to generate xml for</param> /// <param name="propertyType"></param> /// <param name="dataTypeService"></param> /// <returns>Xml of the property and its value</returns> internal static XElement ToXml(this Property property, PropertyType propertyType, IDataTypeService dataTypeService) { var nodeName = UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema ? "data" : property.Alias.ToSafeAlias(); var xElement = new XElement(nodeName); //Add the property alias to the legacy schema if (UmbracoConfig.For.UmbracoSettings().Content.UseLegacyXmlSchema) { var a = new XAttribute("alias", property.Alias.ToSafeAlias()); xElement.Add(a); } //Get the property editor for thsi property and let it convert it to the xml structure var propertyEditor = PropertyEditorResolver.Current.GetByAlias(property.PropertyType.PropertyEditorAlias); if (propertyEditor != null) { var xmlValue = propertyEditor.ValueEditor.ConvertDbToXml(property, propertyType, dataTypeService); xElement.Add(xmlValue); } return xElement; }
public _30_ExternalUrlsToMenus(IContentTypeService contentTypeService, IDataTypeService dataTypeService, ILogger logger) { this.dataTypeService = dataTypeService; this.contentTypeService = contentTypeService; this.logger = logger; }
/// <summary> /// Initializes a new instance of the <see cref="DefaultDataTypeDefinitionMapping" /> class. /// </summary> /// <param name="enablePropertyValueConverters">The value of EnablePropertyValueConverters in umbracoSettings.config</param> /// <param name="dataTypeService">The data type service.</param> public DefaultDataTypeDefinitionMapping(bool enablePropertyValueConverters, IDataTypeService dataTypeService) : this(dataTypeService, GetSupportedHints(enablePropertyValueConverters)) { }
public DataTypeSerializer(string type) : base(type) { _dataTypeService = ApplicationContext.Current.Services.DataTypeService; }
public async Task PostSaveMember_SaveExistingMember_WithNoRoles_Add1Role_ExpectSuccessResponse( [Frozen] IMemberManager umbracoMembersUserManager, IMemberService memberService, IMemberTypeService memberTypeService, IMemberGroupService memberGroupService, IDataTypeService dataTypeService, IBackOfficeSecurityAccessor backOfficeSecurityAccessor, IBackOfficeSecurity backOfficeSecurity, IPasswordChanger <MemberIdentityUser> passwordChanger, IOptions <GlobalSettings> globalSettings, IUser user) { // arrange var roleName = "anyrole"; IMember member = SetupMemberTestData(out MemberSave fakeMemberData, out MemberDisplay memberDisplay, ContentSaveAction.Save); fakeMemberData.Groups = new List <string>() { roleName }; var membersIdentityUser = new MemberIdentityUser(123); Mock.Get(umbracoMembersUserManager) .Setup(x => x.FindByIdAsync(It.IsAny <string>())) .ReturnsAsync(() => membersIdentityUser); Mock.Get(umbracoMembersUserManager) .Setup(x => x.ValidatePasswordAsync(It.IsAny <string>())) .ReturnsAsync(() => IdentityResult.Success); Mock.Get(umbracoMembersUserManager) .Setup(x => x.UpdateAsync(It.IsAny <MemberIdentityUser>())) .ReturnsAsync(() => IdentityResult.Success); Mock.Get(umbracoMembersUserManager) .Setup(x => x.AddToRolesAsync(It.IsAny <MemberIdentityUser>(), It.IsAny <IEnumerable <string> >())) .ReturnsAsync(() => IdentityResult.Success); Mock.Get(umbracoMembersUserManager) .Setup(x => x.GetRolesAsync(It.IsAny <MemberIdentityUser>())) .ReturnsAsync(() => Array.Empty <string>()); Mock.Get(memberTypeService).Setup(x => x.GetDefault()).Returns("fakeAlias"); Mock.Get(backOfficeSecurityAccessor).Setup(x => x.BackOfficeSecurity).Returns(backOfficeSecurity); Mock.Get(memberService).Setup(x => x.GetByUsername(It.IsAny <string>())).Returns(() => member); Mock.Get(memberService).Setup(x => x.GetById(It.IsAny <int>())).Returns(() => member); SetupUserAccess(backOfficeSecurityAccessor, backOfficeSecurity, user); SetupPasswordSuccess(umbracoMembersUserManager, passwordChanger); Mock.Get(memberService).SetupSequence( x => x.GetByEmail(It.IsAny <string>())) .Returns(() => null) .Returns(() => member); MemberController sut = CreateSut(memberService, memberTypeService, memberGroupService, umbracoMembersUserManager, dataTypeService, backOfficeSecurityAccessor, passwordChanger, globalSettings, user); // act ActionResult <MemberDisplay> result = await sut.PostSave(fakeMemberData); // assert Assert.IsNull(result.Result); Assert.IsNotNull(result.Value); Mock.Get(umbracoMembersUserManager) .Verify(u => u.GetRolesAsync(membersIdentityUser)); Mock.Get(umbracoMembersUserManager) .Verify(u => u.AddToRolesAsync(membersIdentityUser, new[] { roleName })); Mock.Get(umbracoMembersUserManager) .Verify(x => x.GetRolesAsync(It.IsAny <MemberIdentityUser>())); Mock.Get(memberService) .Verify(m => m.Save(It.IsAny <Member>())); AssertMemberDisplayPropertiesAreEqual(memberDisplay, result.Value); }
public PackagingService(IContentService contentService, IContentTypeService contentTypeService, IMediaService mediaService, IDataTypeService dataTypeService, IFileService fileService, RepositoryFactory repositoryFactory, IDatabaseUnitOfWorkProvider uowProvider) { _contentService = contentService; _contentTypeService = contentTypeService; _mediaService = mediaService; _dataTypeService = dataTypeService; _fileService = fileService; _repositoryFactory = repositoryFactory; _uowProvider = uowProvider; _importedContentTypes = new Dictionary <string, IContentType>(); }
public FlexibleDropdownPropertyValueConverter(IDataTypeService dataTypeService) { Mandate.ParameterNotNull(dataTypeService, "dataTypeService"); _dataTypeService = dataTypeService; }
/// <summary> /// public ctor - will generally just be used for unit testing all items are optional and if not specified, the defaults will be used /// </summary> public ServiceContext( IContentService contentService = null, IMediaService mediaService = null, IContentTypeService contentTypeService = null, IDataTypeService dataTypeService = null, IFileService fileService = null, ILocalizationService localizationService = null, IPackagingService packagingService = null, IEntityService entityService = null, IRelationService relationService = null, IMemberGroupService memberGroupService = null, IMemberTypeService memberTypeService = null, IMemberService memberService = null, IUserService userService = null, ISectionService sectionService = null, IApplicationTreeService treeService = null, ITagService tagService = null, INotificationService notificationService = null, ILocalizedTextService localizedTextService = null, IAuditService auditService = null, IDomainService domainService = null, ITaskService taskService = null, IMacroService macroService = null, IPublicAccessService publicAccessService = null, IExternalLoginService externalLoginService = null, IMigrationEntryService migrationEntryService = null, IRedirectUrlService redirectUrlService = null, IConsentService consentService = null) { if (migrationEntryService != null) { _migrationEntryService = new Lazy <IMigrationEntryService>(() => migrationEntryService); } if (externalLoginService != null) { _externalLoginService = new Lazy <IExternalLoginService>(() => externalLoginService); } if (auditService != null) { _auditService = new Lazy <IAuditService>(() => auditService); } if (localizedTextService != null) { _localizedTextService = new Lazy <ILocalizedTextService>(() => localizedTextService); } if (tagService != null) { _tagService = new Lazy <ITagService>(() => tagService); } if (contentService != null) { _contentService = new Lazy <IContentService>(() => contentService); } if (mediaService != null) { _mediaService = new Lazy <IMediaService>(() => mediaService); } if (contentTypeService != null) { _contentTypeService = new Lazy <IContentTypeService>(() => contentTypeService); } if (dataTypeService != null) { _dataTypeService = new Lazy <IDataTypeService>(() => dataTypeService); } if (fileService != null) { _fileService = new Lazy <IFileService>(() => fileService); } if (localizationService != null) { _localizationService = new Lazy <ILocalizationService>(() => localizationService); } if (packagingService != null) { _packagingService = new Lazy <IPackagingService>(() => packagingService); } if (entityService != null) { _entityService = new Lazy <IEntityService>(() => entityService); } if (relationService != null) { _relationService = new Lazy <IRelationService>(() => relationService); } if (sectionService != null) { _sectionService = new Lazy <ISectionService>(() => sectionService); } if (memberGroupService != null) { _memberGroupService = new Lazy <IMemberGroupService>(() => memberGroupService); } if (memberTypeService != null) { _memberTypeService = new Lazy <IMemberTypeService>(() => memberTypeService); } if (treeService != null) { _treeService = new Lazy <IApplicationTreeService>(() => treeService); } if (memberService != null) { _memberService = new Lazy <IMemberService>(() => memberService); } if (userService != null) { _userService = new Lazy <IUserService>(() => userService); } if (notificationService != null) { _notificationService = new Lazy <INotificationService>(() => notificationService); } if (domainService != null) { _domainService = new Lazy <IDomainService>(() => domainService); } if (taskService != null) { _taskService = new Lazy <ITaskService>(() => taskService); } if (macroService != null) { _macroService = new Lazy <IMacroService>(() => macroService); } if (publicAccessService != null) { _publicAccessService = new Lazy <IPublicAccessService>(() => publicAccessService); } if (redirectUrlService != null) { _redirectUrlService = new Lazy <IRedirectUrlService>(() => redirectUrlService); } if (consentService != null) { _consentService = new Lazy <IConsentService>(() => consentService); } }
public ProductTypesController(IProductTypeService productTypeService, IDataTypeService dataTypeService, ICategoryService categoryService) { _productTypeService = productTypeService; _dataTypeService = dataTypeService; _categoryService = categoryService; }
/// <summary> /// A method used to format the database value to a value that can be used by the editor /// </summary> /// <param name="property"></param> /// <param name="propertyType"></param> /// <param name="dataTypeService"></param> /// <returns></returns> /// <remarks> /// The object returned will always be a string and if the database type is not a valid string type an exception is thrown /// </remarks> public override object ConvertDbToEditor(Property property, PropertyType propertyType, IDataTypeService dataTypeService) { if (property.Value == null) { return(string.Empty); } switch (GetDatabaseType()) { case DataTypeDatabaseType.Ntext: case DataTypeDatabaseType.Nvarchar: return(property.Value.ToString()); case DataTypeDatabaseType.Integer: case DataTypeDatabaseType.Decimal: case DataTypeDatabaseType.Date: default: throw new InvalidOperationException("The " + typeof(TextOnlyValueEditor) + " can only be used with string based property editors"); } }
public override object ConvertDbToEditor(Property property, PropertyType propertyType, IDataTypeService dataTypeService) { if (property.Value == null || property.Value.ToString() == "") { return(string.Empty); } //LogHelper.Info<ArchetypeHelper>(property.Value.ToString()); var archetype = ArchetypeHelper.Instance.DeserializeJsonToArchetype(property.Value.ToString(), propertyType.DataTypeDefinitionId); foreach (var fieldset in archetype.Fieldsets) { foreach (var propDef in fieldset.Properties) { try { var dtd = ArchetypeHelper.Instance.GetDataTypeByGuid(Guid.Parse(propDef.DataTypeGuid)); var propType = new PropertyType(dtd) { Alias = propDef.Alias }; var prop = new Property(propType, propDef.Value); var propEditor = PropertyEditorResolver.Current.GetByAlias(dtd.PropertyEditorAlias); propDef.Value = propEditor.ValueEditor.ConvertDbToEditor(prop, propType, dataTypeService); } catch (Exception ex) { LogHelper.Error <ArchetypePropertyValueEditor>(ex.Message, ex); } } } return(archetype); }
public BentoItemMapper(IEntityService entityService, IContentTypeService contentTypeService, IDataTypeService dataTypeService) : base(entityService, contentTypeService, dataTypeService) { }
static void DataTypeServiceSaved(IDataTypeService sender, Core.Events.SaveEventArgs<IDataTypeDefinition> e) { e.SavedEntities.ForEach(x => DistributedCache.Instance.RefreshDataTypeCache(x)); }
public static ContentApp CreateContentApp(IDataTypeService dataTypeService, PropertyEditorCollection propertyEditors, string entityType, string contentTypeAlias, int defaultListViewDataType) { if (dataTypeService == null) { throw new ArgumentNullException(nameof(dataTypeService)); } if (propertyEditors == null) { throw new ArgumentNullException(nameof(propertyEditors)); } if (string.IsNullOrWhiteSpace(entityType)) { throw new ArgumentException("message", nameof(entityType)); } if (string.IsNullOrWhiteSpace(contentTypeAlias)) { throw new ArgumentException("message", nameof(contentTypeAlias)); } if (defaultListViewDataType == default) { throw new ArgumentException("defaultListViewDataType", nameof(defaultListViewDataType)); } var contentApp = new ContentApp { Alias = "umbListView", Name = "Child items", Icon = "icon-list", View = "views/content/apps/listview/listview.html", Weight = Weight }; var customDtdName = Core.Constants.Conventions.DataTypes.ListViewPrefix + contentTypeAlias; //first try to get the custom one if there is one var dt = dataTypeService.GetDataType(customDtdName) ?? dataTypeService.GetDataType(defaultListViewDataType); if (dt == null) { throw new InvalidOperationException("No list view data type was found for this document type, ensure that the default list view data types exists and/or that your custom list view data type exists"); } var editor = propertyEditors[dt.EditorAlias]; if (editor == null) { throw new NullReferenceException("The property editor with alias " + dt.EditorAlias + " does not exist"); } var listViewConfig = editor.GetConfigurationEditor().ToConfigurationEditor(dt.Configuration); //add the entity type to the config listViewConfig["entityType"] = entityType; //Override Tab Label if tabName is provided if (listViewConfig.ContainsKey("tabName")) { var configTabName = listViewConfig["tabName"]; if (configTabName != null && String.IsNullOrWhiteSpace(configTabName.ToString()) == false) { contentApp.Name = configTabName.ToString(); } } //Override Icon if icon is provided if (listViewConfig.ContainsKey("icon")) { var configIcon = listViewConfig["icon"]; if (configIcon != null && String.IsNullOrWhiteSpace(configIcon.ToString()) == false) { contentApp.Icon = configIcon.ToString(); } } // if the list view is configured to show umbContent first, update the list view content app weight accordingly if (listViewConfig.ContainsKey("showContentFirst") && listViewConfig["showContentFirst"]?.ToString().TryConvertTo <bool>().Result == true) { contentApp.Weight = ContentEditorContentAppFactory.Weight + 1; } //This is the view model used for the list view app contentApp.ViewModel = new List <ContentPropertyDisplay> { new ContentPropertyDisplay { Alias = $"{Core.Constants.PropertyEditors.InternalGenericPropertiesPrefix}containerView", Label = "", Value = null, View = editor.GetValueEditor().View, HideLabel = true, Config = listViewConfig } }; return(contentApp); }
/// <summary> /// Maps the generic tab with custom properties for content /// </summary> /// <param name="content"></param> /// <param name="display"></param> /// <param name="dataTypeService"></param> /// <param name="localizedText"></param> /// <param name="contentTypeService"></param> private static void AfterMap(IContent content, ContentItemDisplay display, IDataTypeService dataTypeService, ILocalizedTextService localizedText, IContentTypeService contentTypeService) { // map the IsChildOfListView (this is actually if it is a descendant of a list view!) var parent = content.Parent(); display.IsChildOfListView = parent != null && (parent.ContentType.IsContainer || contentTypeService.HasContainerInPath(parent.Path)); //map the tree node url if (HttpContext.Current != null) { var urlHelper = new UrlHelper(HttpContext.Current.Request.RequestContext); var url = urlHelper.GetUmbracoApiService <ContentTreeController>(controller => controller.GetTreeNode(display.Id.ToString(), null)); display.TreeNodeUrl = url; } //fill in the template config to be passed to the template drop down. var templateItemConfig = new Dictionary <string, string> { { "", localizedText.Localize("general/choose") } }; foreach (var t in content.ContentType.AllowedTemplates .Where(t => t.Alias.IsNullOrWhiteSpace() == false && t.Name.IsNullOrWhiteSpace() == false)) { templateItemConfig.Add(t.Alias, t.Name); } if (content.ContentType.IsContainer) { TabsAndPropertiesResolver.AddListView(display, "content", dataTypeService, localizedText); } var properties = new List <ContentPropertyDisplay> { new ContentPropertyDisplay { Alias = string.Format("{0}doctype", Constants.PropertyEditors.InternalGenericPropertiesPrefix), Label = localizedText.Localize("content/documentType"), Value = localizedText.UmbracoDictionaryTranslate(display.ContentTypeName), View = PropertyEditorResolver.Current.GetByAlias(Constants.PropertyEditors.NoEditAlias).ValueEditor.View }, new ContentPropertyDisplay { Alias = string.Format("{0}releasedate", Constants.PropertyEditors.InternalGenericPropertiesPrefix), Label = localizedText.Localize("content/releaseDate"), Value = display.ReleaseDate.HasValue ? display.ReleaseDate.Value.ToIsoString() : null, //Not editible for people without publish permission (U4-287) View = display.AllowedActions.Contains(ActionPublish.Instance.Letter) ? "datepicker" : PropertyEditorResolver.Current.GetByAlias(Constants.PropertyEditors.NoEditAlias).ValueEditor.View, Config = new Dictionary <string, object> { { "offsetTime", "1" } } //TODO: Fix up hard coded datepicker }, new ContentPropertyDisplay { Alias = string.Format("{0}expiredate", Constants.PropertyEditors.InternalGenericPropertiesPrefix), Label = localizedText.Localize("content/unpublishDate"), Value = display.ExpireDate.HasValue ? display.ExpireDate.Value.ToIsoString() : null, //Not editible for people without publish permission (U4-287) View = display.AllowedActions.Contains(ActionPublish.Instance.Letter) ? "datepicker" : PropertyEditorResolver.Current.GetByAlias(Constants.PropertyEditors.NoEditAlias).ValueEditor.View, Config = new Dictionary <string, object> { { "offsetTime", "1" } } //TODO: Fix up hard coded datepicker }, new ContentPropertyDisplay { Alias = string.Format("{0}template", Constants.PropertyEditors.InternalGenericPropertiesPrefix), Label = localizedText.Localize("template/template"), Value = display.TemplateAlias, View = "dropdown", //TODO: Hard coding until we make a real dropdown property editor to lookup Config = new Dictionary <string, object> { { "items", templateItemConfig } } } }; TabsAndPropertiesResolver.MapGenericProperties(content, display, localizedText, properties.ToArray(), genericProperties => { //TODO: This would be much nicer with the IUmbracoContextAccessor so we don't use singletons //If this is a web request and there's a user signed in and the // user has access to the settings section, we will if (HttpContext.Current != null && UmbracoContext.Current != null && UmbracoContext.Current.Security.CurrentUser != null && UmbracoContext.Current.Security.CurrentUser.AllowedSections.Any(x => x.Equals(Constants.Applications.Settings))) { var currentDocumentType = contentTypeService.GetContentType(display.ContentTypeAlias); var currentDocumentTypeName = currentDocumentType == null ? string.Empty : localizedText.UmbracoDictionaryTranslate(currentDocumentType.Name); var currentDocumentTypeId = currentDocumentType == null ? string.Empty : currentDocumentType.Id.ToString(CultureInfo.InvariantCulture); //TODO: Hard coding this is not good var docTypeLink = string.Format("#/settings/documenttypes/edit/{0}", currentDocumentTypeId); //Replace the doc type property var docTypeProperty = genericProperties.First(x => x.Alias == string.Format("{0}doctype", Constants.PropertyEditors.InternalGenericPropertiesPrefix)); docTypeProperty.Value = new List <object> { new { linkText = currentDocumentTypeName, url = docTypeLink, target = "_self", icon = "icon-item-arrangement" } }; //TODO: Hard coding this because the templatepicker doesn't necessarily need to be a resolvable (real) property editor docTypeProperty.View = "urllist"; } // inject 'Link to document' as the first generic property genericProperties.Insert(0, new ContentPropertyDisplay { Alias = string.Format("{0}urls", Constants.PropertyEditors.InternalGenericPropertiesPrefix), Label = localizedText.Localize("content/urls"), Value = string.Join(",", display.Urls), View = "urllist" //TODO: Hard coding this because the templatepicker doesn't necessarily need to be a resolvable (real) property editor }); }); }
public ListViewContentAppFactory(IDataTypeService dataTypeService, PropertyEditorCollection propertyEditors) { _dataTypeService = dataTypeService; _propertyEditors = propertyEditors; }
public TagsValueConverter(IDataTypeService dataTypeService) { _dataTypeService = dataTypeService ?? throw new ArgumentNullException(nameof(dataTypeService)); }
/// <summary> /// Create member controller to test /// </summary> /// <param name="memberService">Member service</param> /// <param name="memberTypeService">Member type service</param> /// <param name="memberGroupService">Member group service</param> /// <param name="membersUserManager">Members user manager</param> /// <param name="dataTypeService">Data type service</param> /// <param name="backOfficeSecurityAccessor">Back office security accessor</param> /// <param name="mockPasswordChanger">Password changer class</param> /// <returns>A member controller for the tests</returns> private MemberController CreateSut( IMemberService memberService, IMemberTypeService memberTypeService, IMemberGroupService memberGroupService, IUmbracoUserManager <MemberIdentityUser> membersUserManager, IDataTypeService dataTypeService, IBackOfficeSecurityAccessor backOfficeSecurityAccessor, IPasswordChanger <MemberIdentityUser> passwordChanger, IOptions <GlobalSettings> globalSettings, IUser user) { var httpContextAccessor = new HttpContextAccessor(); var mockShortStringHelper = new MockShortStringHelper(); var textService = new Mock <ILocalizedTextService>(); var contentTypeBaseServiceProvider = new Mock <IContentTypeBaseServiceProvider>(); contentTypeBaseServiceProvider.Setup(x => x.GetContentTypeOf(It.IsAny <IContentBase>())).Returns(new ContentType(mockShortStringHelper, 123)); var contentAppFactories = new Mock <List <IContentAppFactory> >(); var mockContentAppFactoryCollection = new Mock <ILogger <ContentAppFactoryCollection> >(); var hybridBackOfficeSecurityAccessor = new BackOfficeSecurityAccessor(httpContextAccessor); var contentAppFactoryCollection = new ContentAppFactoryCollection( () => contentAppFactories.Object, mockContentAppFactoryCollection.Object, hybridBackOfficeSecurityAccessor); var mockUserService = new Mock <IUserService>(); var commonMapper = new CommonMapper( mockUserService.Object, contentTypeBaseServiceProvider.Object, contentAppFactoryCollection, textService.Object); var mockCultureDictionary = new Mock <ICultureDictionary>(); var mockPasswordConfig = new Mock <IOptions <MemberPasswordConfigurationSettings> >(); mockPasswordConfig.Setup(x => x.Value).Returns(() => new MemberPasswordConfigurationSettings()); IDataEditor dataEditor = Mock.Of <IDataEditor>( x => x.Type == EditorType.PropertyValue && x.Alias == Constants.PropertyEditors.Aliases.Label); Mock.Get(dataEditor).Setup(x => x.GetValueEditor()).Returns(new TextOnlyValueEditor(new DataEditorAttribute(Constants.PropertyEditors.Aliases.TextBox, "Test Textbox", "textbox"), textService.Object, Mock.Of <IShortStringHelper>(), Mock.Of <IJsonSerializer>(), Mock.Of <IIOHelper>())); var propertyEditorCollection = new PropertyEditorCollection(new DataEditorCollection(() => new[] { dataEditor })); IMapDefinition memberMapDefinition = new MemberMapDefinition( commonMapper, new CommonTreeNodeMapper(Mock.Of <LinkGenerator>()), new MemberTabsAndPropertiesMapper( mockCultureDictionary.Object, backOfficeSecurityAccessor, textService.Object, memberTypeService, memberService, memberGroupService, mockPasswordConfig.Object, contentTypeBaseServiceProvider.Object, propertyEditorCollection)); var map = new MapDefinitionCollection(() => new List <IMapDefinition>() { new global::Umbraco.Cms.Core.Models.Mapping.MemberMapDefinition(), memberMapDefinition, new ContentTypeMapDefinition( commonMapper, propertyEditorCollection, dataTypeService, new Mock <IFileService>().Object, new Mock <IContentTypeService>().Object, new Mock <IMediaTypeService>().Object, memberTypeService, new Mock <ILoggerFactory>().Object, mockShortStringHelper, globalSettings, new Mock <IHostingEnvironment>().Object, new Mock <IOptionsMonitor <ContentSettings> >().Object) }); var scopeProvider = Mock.Of <ICoreScopeProvider>(x => x.CreateCoreScope( It.IsAny <IsolationLevel>(), It.IsAny <RepositoryCacheMode>(), It.IsAny <IEventDispatcher>(), It.IsAny <IScopedNotificationPublisher>(), It.IsAny <bool?>(), It.IsAny <bool>(), It.IsAny <bool>()) == Mock.Of <ICoreScope>()); _mapper = new UmbracoMapper(map, scopeProvider); return(new MemberController( new DefaultCultureDictionary( new Mock <ILocalizationService>().Object, NoAppCache.Instance), new LoggerFactory(), mockShortStringHelper, new DefaultEventMessagesFactory( new Mock <IEventMessagesAccessor>().Object), textService.Object, propertyEditorCollection, _mapper, memberService, memberTypeService, (IMemberManager)membersUserManager, dataTypeService, backOfficeSecurityAccessor, new ConfigurationEditorJsonSerializer(), passwordChanger, scopeProvider )); }
public ImageCropperManager(IDataTypeService dataTypeService, IImageCropperCacheManager cacheManager) { this.dataTypeService = dataTypeService; this.cacheManager = cacheManager; }
public PublishedContentTypeFactory(IPublishedModelFactory publishedModelFactory, PropertyValueConverterCollection propertyValueConverters, IDataTypeService dataTypeService) { _publishedModelFactory = publishedModelFactory; _propertyValueConverters = propertyValueConverters; _dataTypeService = dataTypeService; }
public PreValueDisplayResolver(IDataTypeService dataTypeService) { _dataTypeService = dataTypeService; }
/// <summary> /// Adds the container (listview) tab to the document /// </summary> /// <typeparam name="TPersisted"></typeparam> /// <param name="display"></param> /// <param name="entityType">This must be either 'content' or 'media'</param> /// <param name="dataTypeService"></param> /// <param name="localizedTextService"></param> internal static void AddListView <TPersisted>(TabbedContentItem <ContentPropertyDisplay, TPersisted> display, string entityType, IDataTypeService dataTypeService, ILocalizedTextService localizedTextService) where TPersisted : IContentBase { int dtdId; var customDtdName = Constants.Conventions.DataTypes.ListViewPrefix + display.ContentTypeAlias; switch (entityType) { case "content": dtdId = Constants.System.DefaultContentListViewDataTypeId; break; case "media": dtdId = Constants.System.DefaultMediaListViewDataTypeId; break; case "member": dtdId = Constants.System.DefaultMembersListViewDataTypeId; break; default: throw new ArgumentOutOfRangeException("entityType does not match a required value"); } //first try to get the custom one if there is one var dt = dataTypeService.GetDataTypeDefinitionByName(customDtdName) ?? dataTypeService.GetDataTypeDefinitionById(dtdId); if (dt == null) { throw new InvalidOperationException("No list view data type was found for this document type, ensure that the default list view data types exists and/or that your custom list view data type exists"); } var preVals = dataTypeService.GetPreValuesCollectionByDataTypeId(dt.Id); var editor = PropertyEditorResolver.Current.GetByAlias(dt.PropertyEditorAlias); if (editor == null) { throw new NullReferenceException("The property editor with alias " + dt.PropertyEditorAlias + " does not exist"); } var listViewTab = new Tab <ContentPropertyDisplay>(); listViewTab.Alias = Constants.Conventions.PropertyGroups.ListViewGroupName; listViewTab.Label = localizedTextService.Localize("content/childItems"); listViewTab.Id = display.Tabs.Count() + 1; listViewTab.IsActive = true; var listViewConfig = editor.PreValueEditor.ConvertDbToEditor(editor.DefaultPreValues, preVals); //add the entity type to the config listViewConfig["entityType"] = entityType; //Override Tab Label if tabName is provided if (listViewConfig.ContainsKey("tabName")) { var configTabName = listViewConfig["tabName"]; if (configTabName != null && string.IsNullOrWhiteSpace(configTabName.ToString()) == false) { listViewTab.Label = configTabName.ToString(); } } var listViewProperties = new List <ContentPropertyDisplay>(); listViewProperties.Add(new ContentPropertyDisplay { Alias = string.Format("{0}containerView", Constants.PropertyEditors.InternalGenericPropertiesPrefix), Label = "", Value = null, View = editor.ValueEditor.View, HideLabel = true, Config = listViewConfig }); listViewTab.Properties = listViewProperties; SetChildItemsTabPosition(display, listViewConfig, listViewTab); }
public override object ConvertDbToEditor(Property property, PropertyType propertyType, IDataTypeService dataTypeService) { if (property.Value == null || string.IsNullOrWhiteSpace(property.Value.ToString())) { return(string.Empty); } var value = JsonConvert.DeserializeObject <List <object> >(property.Value.ToString()); if (value == null) { return(string.Empty); } // Process value PreValueCollection preValues = null; for (var i = 0; i < value.Count; i++) { var o = value[i]; var propValues = ((JObject)o); // convert from old style (v0.1.1) data format if necessary NestedContentHelper.ConvertItemValueFromV011(propValues, propertyType.DataTypeDefinitionId, ref preValues); var contentType = NestedContentHelper.GetContentTypeFromItem(propValues); if (contentType == null) { continue; } var propValueKeys = propValues.Properties().Select(x => x.Name).ToArray(); foreach (var propKey in propValueKeys) { var propType = contentType.PropertyTypes.FirstOrDefault(x => x.Alias == propKey); if (propType == null) { if (IsSystemPropertyKey(propKey) == false) { // Property missing so just delete the value propValues[propKey] = null; } } else { // Create a fake property using the property abd stored value var prop = new Property(propType, propValues[propKey] == null ? null : propValues[propKey].ToString()); // Lookup the property editor var propEditor = PropertyEditorResolver.Current.GetByAlias(propType.PropertyEditorAlias); // Get the editor to do it's conversion var newValue = propEditor.ValueEditor.ConvertDbToEditor(prop, propType, ApplicationContext.Current.Services.DataTypeService); // Store the value back propValues[propKey] = (newValue == null) ? null : JToken.FromObject(newValue); } } } // Update the value on the property property.Value = JsonConvert.SerializeObject(value); // Pass the call down return(base.ConvertDbToEditor(property, propertyType, dataTypeService)); }
public PropertyValidationService(PropertyEditorCollection propertyEditors, IDataTypeService dataTypeService) { _propertyEditors = propertyEditors; _dataTypeService = dataTypeService; }
/// <summary> /// For use in unit tests. Not possible to use as attribute ctor. /// </summary> /// <param name="dataTypeService"></param> /// <param name="propertyEditors"></param> public DataTypeValidateAttribute(IDataTypeService dataTypeService, PropertyEditorCollection propertyEditors) { DataTypeService = dataTypeService; PropertyEditors = propertyEditors; }
public BlogMlExporter(IUmbracoContextAccessor umbracoContextAccessor, ArticulateTempFileSystem fileSystem, IContentService contentService, IContentTypeService contentTypeService, IDataTypeService dataTypeService, ITagService tagService, ILogger logger) { _umbracoContextAccessor = umbracoContextAccessor; _fileSystem = fileSystem; _contentService = contentService; _contentTypeService = contentTypeService; _dataTypeService = dataTypeService; _tagService = tagService; _logger = logger; }
public ContentPropertyDtoMapper(IDataTypeService dataTypeService, IEntityService entityService, ILogger <ContentPropertyDtoMapper> logger, PropertyEditorCollection propertyEditors) : base(dataTypeService, entityService, logger, propertyEditors) { }
public override string ConvertDbToString(PropertyType propertyType, object value, IDataTypeService dataTypeService) { if (value == null || string.IsNullOrEmpty(value.ToString())) { return(null); } // if we dont have a json structure, we will get it from the property type var val = value.ToString(); if (val.DetectIsJson()) { return(val); } // more magic here ;-( var configuration = dataTypeService.GetDataType(propertyType.DataTypeId).ConfigurationAs <ImageCropperConfiguration>(); var crops = configuration?.Crops ?? Array.Empty <ImageCropperConfiguration.Crop>(); return("{src: '" + val + "', crops: " + crops + "}"); }
internal ContentTypeMigration(IContentTypeService contentTypeService, IDataTypeService dataTypeService) { _contentTypeService = contentTypeService; _dataTypeService = dataTypeService; }
/// <summary> /// Initializes a new instance of the <see cref="MultiNodeTreePicker2MediaParser"/> class. /// </summary> public MultiNodeTreePicker2MediaParser() { this.dataTypeService = ApplicationContext.Current.Services.DataTypeService; this.mediaService = ApplicationContext.Current.Services.MediaService; this.cache = ApplicationContext.Current.ApplicationCache.StaticCache; }
public MetaWeblogHandler(IUmbracoContextAccessor umbracoContextAccessor, IContentService contentService, ITagService tagService, IUserService userService, IMediaFileSystem mediaFileSystem, ILocalizationService localizationService, IContentTypeService contentTypeService, IDataTypeService dataTypeService) { _umbracoContextAccessor = umbracoContextAccessor; _contentService = contentService; _tagService = tagService; _userService = userService; _mediaFileSystem = mediaFileSystem; _localizationService = localizationService; _contentTypeService = contentTypeService; _dataTypeService = dataTypeService; }
static void DataTypeServiceDeleted(IDataTypeService sender, Core.Events.DeleteEventArgs<IDataTypeDefinition> e) { e.DeletedEntities.ForEach(x => DistributedCache.Instance.RemoveDataTypeCache(x)); }
/// <summary> /// Initializes a new instance of the <see cref="MultiNodeTreePicker2MediaParser"/> class. /// </summary> /// <param name="dataTypeService"> /// The data type service. /// </param> public MultiNodeTreePicker2MediaParser(IDataTypeService dataTypeService) { this.dataTypeService = dataTypeService; }