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); }
public ActionResult Index() { var adminUrlHelper = new AdminUrlHelper(UrlHelper); var adminUrl = adminUrlHelper.Home().ToFullyQualifiedUrl(Blog); var postEditingUrl = adminUrlHelper.PostsEdit().ToFullyQualifiedUrl(Blog); string manifestXml = string.Format(ManifestXml, Blog.TrackbacksEnabled.ToYesNo(), adminUrl, postEditingUrl); return Content(manifestXml, "text/xml"); }
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 void CreateWelcomeComment(ObjectProvider repository, AdminUrlHelper adminUrlHelper, Entry entry) { string commentBody = ScriptHelper.UnpackEmbeddedScriptAsString("WelcomeComment.htm"); string feedbackUrl = adminUrlHelper.FeedbackList(); commentBody = string.Format(commentBody, feedbackUrl); var comment = new FeedbackItem(FeedbackType.Comment) { Title = "re: Welcome to Subtext!", Entry = entry, Author = "Subtext", DateCreated = DateTime.Now, DateModified = DateTime.Now, Approved = true, Body = commentBody }; repository.Create(comment); }
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; }