public DefaultPlatformHelper(IPlatformDataSource source) { this._source = source; if (_serviceProviderActions == null) { _serviceProviderActions = new Dictionary <string, IList <string> >(); _serviceProviderActions.Add("Access", new List <string> { EntityServiceActions.AllowAnonymousAccess }); _serviceProviderActions.Add("Names", new List <string> { EntityServiceActions.AllowNonUniqueNames }); //// _serviceProviderActions.Add("Auto Path", new List<string> { EntityServiceActions.UpdatePaths }); _serviceProviderActions.Add("Comments", new List <string> { EntityServiceActions.AllowComments, EntityServiceActions.AllowNestedComments /*, EntityServiceActions.ModerateComments*/ }); _serviceProviderActions.Add("Rich Text Editor", new List <string> { EntityServiceActions.RteAdvanced, EntityServiceActions.RteFileUpload, EntityServiceActions.HtmlEditor }); _serviceProviderActions.Add("Taxonomy", new List <string> { EntityServiceActions.AllowFixedTagging /*, EntityServiceActions.AllowFreeTagging*/ }); _serviceProviderActions.Add("Translations", new List <string> { EntityServiceActions.Translations }); //// _serviceProviderActions.Add("Trash bin", new List<string> { EntityServiceActions.Trashbin }); _serviceProviderActions.Add("Versioning", new List <string> { EntityServiceActions.AutomaticVersions /*, EntityServiceActions.Drafts*/ }); } }
public void InitMails(IPlatformDataSource source) { if (source == null) { throw new ArgumentNullException("source"); } if (this._membershipService != null) { string from = this.GetFromAddress(); // Add the default entity types. var mailTemplateType = new EntityType { Id = Guid.NewGuid(), Name = typeof(MailContentTemplate).FullName }; var mailType = new EntityType { Id = Guid.NewGuid(), Name = typeof(MailContent).FullName }; source.Save(mailTemplateType); source.Save(mailType); var adminId = this._membershipService.AdminId; var mainGroupId = StrixPlatform.MainGroupId; var date = DateTime.Now; var templateDir = ModuleManager.AppSettings["Membership"]["mailTemplateFolder"]; var directory = StrixPlatform.Environment.MapPath(templateDir); var supportedCultures = StrixPlatform.Configuration.Cultures.ToLower().Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Trim().ToArray(); var templateContent = this.AddMailTemplate(source, adminId, mainGroupId, directory, mailTemplateType, date, supportedCultures); this.AddMails(source, adminId, mainGroupId, directory, templateContent, mailType, from, date, supportedCultures); source.SaveChanges(); } }
private void AddMails(IPlatformDataSource source, Guid adminId, Guid mainGroupId, string directory, List<MailContentTemplate> templateContent, EntityType mailType, string from, DateTime date, string[] supportedCultures) { var allFiles = Directory.GetFiles(directory).Where(f => !f.ToLower().Split('\\').Last().StartsWith("mailtemplate") && f.EndsWith(".html")); List<string> mailFiles = new List<string>(); foreach (var file in allFiles) { var normalisedName = file.Contains("_") ? file.Split('_').First() + "." + file.Split('.').Last() : file; if (!mailFiles.Contains(normalisedName)) { mailFiles.Add(normalisedName); } } foreach (var mailFile in mailFiles) { var mailData = this._fileSystemWrapper.GetHtmlTemplate(directory, mailFile.Split('\\').Last().Split('.').First(), null); var entity = new PlatformEntity { Id = Guid.NewGuid(), GroupId = mainGroupId, Url = mailFile.Split('\\').Last().Split('.').First().ToLower(), EntityType = mailType, OwnerUserId = adminId }; source.Save(entity); foreach (var data in mailData.Where(t => supportedCultures.Contains(t.Culture.ToLower()))) { var template = templateContent.First(t => t.Culture == data.Culture); var content = new MailContent { Id = Guid.NewGuid(), EntityId = entity.Id, Entity = entity, Template = template, TemplateId = template.Id, Culture = data.Culture, VersionNumber = 1, Name = mailFile.Split('\\').Last().Split('.').First(), CreatedByUserId = adminId, CreatedOn = date, UpdatedByUserId = adminId, UpdatedOn = date, IsCurrentVersion = true, PublishedByUserId = adminId, PublishedOn = date, From = from, Subject = data.Subject, Body = data.Body }; source.Save(content); } } }
private void AddMails(IPlatformDataSource source, Guid adminId, Guid mainGroupId, string directory, List <MailContentTemplate> templateContent, EntityType mailType, string from, DateTime date, string[] supportedCultures) { var allFiles = Directory.GetFiles(directory).Where(f => !f.ToLower().Split('\\').Last().StartsWith("mailtemplate") && f.EndsWith(".html")); List <string> mailFiles = new List <string>(); foreach (var file in allFiles) { var normalisedName = file.Contains("_") ? file.Split('_').First() + "." + file.Split('.').Last() : file; if (!mailFiles.Contains(normalisedName)) { mailFiles.Add(normalisedName); } } foreach (var mailFile in mailFiles) { var mailData = this._fileSystemWrapper.GetHtmlTemplate(directory, mailFile.Split('\\').Last().Split('.').First(), null); var entity = new PlatformEntity { Id = Guid.NewGuid(), GroupId = mainGroupId, Url = mailFile.Split('\\').Last().Split('.').First().ToLower(), EntityType = mailType, OwnerUserId = adminId }; source.Save(entity); foreach (var data in mailData.Where(t => supportedCultures.Contains(t.Culture.ToLower()))) { var template = templateContent.First(t => t.Culture == data.Culture); var content = new MailContent { Id = Guid.NewGuid(), EntityId = entity.Id, Entity = entity, Template = template, TemplateId = template.Id, Culture = data.Culture, VersionNumber = 1, Name = mailFile.Split('\\').Last().Split('.').First(), CreatedByUserId = adminId, CreatedOn = date, UpdatedByUserId = adminId, UpdatedOn = date, IsCurrentVersion = true, PublishedByUserId = adminId, PublishedOn = date, From = from, Subject = data.Subject, Body = data.Body }; source.Save(content); } } }
public DefaultPlatformHelper(IPlatformDataSource source) { this._source = source; if (_serviceProviderActions == null) { _serviceProviderActions = new Dictionary<string, IList<string>>(); _serviceProviderActions.Add("Access", new List<string> { EntityServiceActions.AllowAnonymousAccess }); _serviceProviderActions.Add("Names", new List<string> { EntityServiceActions.AllowNonUniqueNames }); //// _serviceProviderActions.Add("Auto Path", new List<string> { EntityServiceActions.UpdatePaths }); _serviceProviderActions.Add("Comments", new List<string> { EntityServiceActions.AllowComments, EntityServiceActions.AllowNestedComments/*, EntityServiceActions.ModerateComments*/ }); _serviceProviderActions.Add("Rich Text Editor", new List<string> { EntityServiceActions.RteAdvanced, EntityServiceActions.RteFileUpload, EntityServiceActions.HtmlEditor }); _serviceProviderActions.Add("Taxonomy", new List<string> { EntityServiceActions.AllowFixedTagging/*, EntityServiceActions.AllowFreeTagging*/ }); _serviceProviderActions.Add("Translations", new List<string> { EntityServiceActions.Translations }); //// _serviceProviderActions.Add("Trash bin", new List<string> { EntityServiceActions.Trashbin }); _serviceProviderActions.Add("Versioning", new List<string> { EntityServiceActions.AutomaticVersions/*, EntityServiceActions.Drafts*/ }); } }
private List <MailContentTemplate> AddMailTemplate(IPlatformDataSource source, Guid adminId, Guid mainGroupId, string directory, EntityType mailTemplateType, DateTime date, string[] supportedCultures) { // Add the mail template var templateName = "Default"; var templateData = this._fileSystemWrapper.GetHtmlTemplate(directory, "MailTemplate", null); List <MailContentTemplate> templateContent = new List <MailContentTemplate>(); var templateEntity = new PlatformEntity { Id = Guid.NewGuid(), GroupId = mainGroupId, Url = templateName.ToLower(), EntityType = mailTemplateType, OwnerUserId = adminId }; source.Save(templateEntity); foreach (var data in templateData.Where(t => supportedCultures.Contains(t.Culture.ToLower()))) { var template = new MailContentTemplate { Id = Guid.NewGuid(), EntityId = templateEntity.Id, Entity = templateEntity, Culture = data.Culture, VersionNumber = 1, Name = "Default", CreatedByUserId = adminId, CreatedOn = date, UpdatedByUserId = adminId, UpdatedOn = date, IsCurrentVersion = true, PublishedByUserId = adminId, PublishedOn = date, Body = data.Body }; templateContent.Add(template); source.Save(template); } return(templateContent); }
public ObjectService(IPlatformDataSource dataSource, IObjectManager objectManager) { this._dataSource = dataSource; this._objectManager = objectManager; }
public FileService(IPlatformDataSource dataSource, IFileManager fileManager, IImageConverter imageConverter) { this._dataSource = dataSource; this._fileManager = fileManager; this._imageConverter = imageConverter; }
public EntityServiceManager(IPlatformDataSource dataSource) { this._dataSource = dataSource; }
public EntityManager(IPlatformDataSource dataSource, ICacheService cache) : base(dataSource) { this._cache = cache; }
private List<MailContentTemplate> AddMailTemplate(IPlatformDataSource source, Guid adminId, Guid mainGroupId, string directory, EntityType mailTemplateType, DateTime date, string[] supportedCultures) { // Add the mail template var templateName = "Default"; var templateData = this._fileSystemWrapper.GetHtmlTemplate(directory, "MailTemplate", null); List<MailContentTemplate> templateContent = new List<MailContentTemplate>(); var templateEntity = new PlatformEntity { Id = Guid.NewGuid(), GroupId = mainGroupId, Url = templateName.ToLower(), EntityType = mailTemplateType, OwnerUserId = adminId }; source.Save(templateEntity); foreach (var data in templateData.Where(t => supportedCultures.Contains(t.Culture.ToLower()))) { var template = new MailContentTemplate { Id = Guid.NewGuid(), EntityId = templateEntity.Id, Entity = templateEntity, Culture = data.Culture, VersionNumber = 1, Name = "Default", CreatedByUserId = adminId, CreatedOn = date, UpdatedByUserId = adminId, UpdatedOn = date, IsCurrentVersion = true, PublishedByUserId = adminId, PublishedOn = date, Body = data.Body }; templateContent.Add(template); source.Save(template); } return templateContent; }
public FileManager(IPlatformDataSource dataSource, IImageConverter imageConverter) { this._dataSource = dataSource; this._imageConverter = imageConverter; }
public ServiceManagerService(IPlatformDataSource dataSource, IEntityServiceManager manager) { this._dataSource = dataSource; this._manager = manager; }
public TaxonomyManager(IPlatformDataSource dataSource) { this._dataSource = dataSource; }
public CommentManager(IPlatformDataSource dataSource) { this._dataSource = dataSource; }
public ObjectManager(IPlatformDataSource dataSource) { this._dataSource = dataSource; }
public CommentService(IPlatformDataSource dataSource, ICommentManager commentManager) { this._dataSource = dataSource; this._commentManager = commentManager; }
public DocumentService(IPlatformDataSource dataSource, IEntityManager entityManager, ITaxonomyManager taxonomyManager, IFileManager fileManager, ICacheService cache) : base(dataSource, entityManager, taxonomyManager, cache) { this._fileManager = fileManager; }
public MailTemplateService(IPlatformDataSource dataSource, IEntityManager entityManager, ITaxonomyManager taxonomyManager, ICacheService cache) : base(dataSource, entityManager, taxonomyManager, cache) { }
public TaxonomyService(IPlatformDataSource dataSource, ITaxonomyManager manager) { this._source = dataSource; this._manager = manager; }
public SearchService(IPlatformDataSource source) { this._source = source; }
public EntityService(IPlatformDataSource dataSource, IEntityManager entityManager, ITaxonomyManager taxonomyManager, ICacheService cache) : base(dataSource, entityManager) { this._taxonomyManager = taxonomyManager; this._cache = cache; }