public BlogImportRepository(ISubtextContext context, ICommentService commentService, IEntryPublisher entryPublisher, IBlogMLImportMapper mapper) { SubtextContext = context; CommentService = commentService; EntryPublisher = entryPublisher; Mapper = mapper; }
public void CreateWelcomeContent(ISubtextContext context, IEntryPublisher entryPublisher, Blog blog) { var repository = context.Repository; CreateWelcomeCategories(repository, blog); var adminUrlHelper = new AdminUrlHelper(context.UrlHelper); Entry article = CreateWelcomeArticle(blog, entryPublisher, adminUrlHelper); Entry entry = CreateWelcomeBlogPost(context, blog, entryPublisher, adminUrlHelper, article); CreateWelcomeComment(repository, adminUrlHelper, entry); }
private static Entry CreateWelcomeArticle(Blog blog, IEntryPublisher entryPublisher, AdminUrlHelper adminUrlHelper) { string body = ScriptHelper.UnpackEmbeddedScriptAsString("WelcomeArticle.htm"); body = String.Format(body, adminUrlHelper.ArticlesList()); var article = new Entry(PostType.Story) { EntryName = "welcome-to-subtext-article", Title = "Welcome to Subtext!", BlogId = blog.Id, Author = blog.Author, Body = body, DateCreated = DateTime.Now, DateModified = DateTime.Now, IsActive = true, }; entryPublisher.Publish(article); return(article); }
public static int Create(Entry entry) { var requestContext = new RequestContext(new HttpContextWrapper(HttpContext.Current), new RouteData()); var serviceLocator = new Mock <IDependencyResolver>().Object; var searchEngineService = new Mock <IIndexingService>().Object; DependencyResolver.SetResolver(serviceLocator); var routes = new RouteCollection(); var subtextRoutes = new SubtextRouteMapper(routes, serviceLocator); Routes.RegisterRoutes(subtextRoutes); var urlHelper = new BlogUrlHelper(requestContext, routes); var subtextContext = new SubtextContext(Config.CurrentBlog, requestContext, urlHelper, new DatabaseObjectProvider(), requestContext.HttpContext.User, new SubtextCache(requestContext.HttpContext.Cache), serviceLocator); IEntryPublisher entryPublisher = CreateEntryPublisher(subtextContext, searchEngineService); int id = entryPublisher.Publish(entry); entry.Id = id; return(id); }
public MetaWeblog(ISubtextContext context, IEntryPublisher entryPublisher) : base(context) { EntryPublisher = entryPublisher; }
private static Entry CreateWelcomeBlogPost(ISubtextContext context, Blog blog, IEntryPublisher entryPublisher, AdminUrlHelper adminUrlHelper, IEntryIdentity article) { string body = ScriptHelper.UnpackEmbeddedScriptAsString("WelcomePost.htm"); string articleUrl = context.UrlHelper.EntryUrl(article); body = String.Format(body, articleUrl, adminUrlHelper.Home(), context.UrlHelper.HostAdminUrl("default.aspx")); var entry = new Entry(PostType.BlogPost) { Title = "Welcome to Subtext!", EntryName = "welcome-to-subtext", BlogId = blog.Id, Author = blog.Author, Body = body, DateCreated = DateTime.Now, DateModified = DateTime.Now, DateSyndicated = DateTime.Now, IsActive = true, IncludeInMainSyndication = true, DisplayOnHomePage = true, AllowComments = true }; entryPublisher.Publish(entry); return entry; }
private static Entry CreateWelcomeArticle(Blog blog, IEntryPublisher entryPublisher, AdminUrlHelper adminUrlHelper) { string body = ScriptHelper.UnpackEmbeddedScriptAsString("WelcomeArticle.htm"); body = String.Format(body, adminUrlHelper.ArticlesList()); var article = new Entry(PostType.Story) { EntryName = "welcome-to-subtext-article", Title = "Welcome to Subtext!", BlogId = blog.Id, Author = blog.Author, Body = body, DateCreated = DateTime.Now, DateModified = DateTime.Now, IsActive = true, }; entryPublisher.Publish(article); return article; }
private static Entry CreateWelcomeBlogPost(ISubtextContext context, Blog blog, IEntryPublisher entryPublisher, AdminUrlHelper adminUrlHelper, IEntryIdentity article) { string body = ScriptHelper.UnpackEmbeddedScriptAsString("WelcomePost.htm"); string articleUrl = context.UrlHelper.EntryUrl(article); body = String.Format(body, articleUrl, adminUrlHelper.Home(), context.UrlHelper.HostAdminUrl("default.aspx")); var entry = new Entry(PostType.BlogPost) { Title = "Welcome to Subtext!", EntryName = "welcome-to-subtext", BlogId = blog.Id, Author = blog.Author, Body = body, DateCreated = DateTime.Now, DateModified = DateTime.Now, DateSyndicated = DateTime.Now, IsActive = true, IncludeInMainSyndication = true, DisplayOnHomePage = true, AllowComments = true }; entryPublisher.Publish(entry); return(entry); }