public FullPost GetPost(String postid, String emailAddress, String password) { String blogEntryGuid = postid; //+ if (this.Reporter.Initialized) { this.Reporter.SendSingle(new Object[] { blogEntryGuid, emailAddress, password }, "XmlRpcApi::GetPost", false); } //+ BlogEntry blogEntry = BlogAgent.GetSingleBlogEntry(blogEntryGuid, false, emailAddress, password); //+ return(new FullPost { dateCreated = blogEntry.PostDateTime, description = blogEntry.Content, title = blogEntry.Title, categories = blogEntry.LabelList.Select(p => p.Title).ToArray(), link = Themelia.Web.UrlCleaner.FixWebPathHead(blogEntry.MappingNameList.First()), permalink = Themelia.Web.UrlCleaner.FixWebPathHead(blogEntry.MappingNameList.First()), postid = blogEntry.Guid, mt_allow_comments = blogEntry.AllowCommentStatus == AllowCommentStatus.Enabled ? "1" : "0", mt_convert_breaks = String.Empty, mt_allow_pings = 0, mt_excerpt = String.Empty, mt_tb_ping_urls = new String[] { }, mt_text_mode = String.Empty }); }
//+ //- @Parse -// public override String ParseCode(String code) { Template linkTemplate = new Template(@"<a href=""{Link}"">{Text}</a>"); Map map = new Map(); if (!String.IsNullOrEmpty(code)) { String[] partArray = code.Split('|'); BlogEntry blogEntry = BlogAgent.GetSingleBlogEntry(partArray[0], false); if (blogEntry != null && blogEntry.MappingNameList != null) { map.Add("Link", "/" + Themelia.Web.UrlCleaner.FixWebPathHead(blogEntry.MappingNameList.First())); } if (partArray.Length > 1) { String[] partArray2 = partArray[1].Split(';'); map.Add("Text", partArray2[0]); } else { map.Add("Text", blogEntry.Title); } return(linkTemplate.Interpolate(map)); } //+ return(null); }
//+ //- #OnPreRender -// protected override void OnPreRender(EventArgs e) { Minima.Service.BlogEntry blogEntry = null; if (!String.IsNullOrEmpty(this.BlogEntryGuid)) { blogEntry = BlogAgent.GetSingleBlogEntry(this.BlogEntryGuid, this.IgnoreBlogEntryFooter); } else { String blogGuid = this.BlogGuid; if (String.IsNullOrEmpty(blogGuid)) { blogGuid = Themelia.Web.HttpData.GetScopedItem <String>(Info.Scope, Info.BlogGuid); } //+ if (!String.IsNullOrEmpty(this.Link)) { blogEntry = BlogAgent.GetSingleBlogEntryByLink(blogGuid, this.Link, this.IgnoreBlogEntryFooter); } } if (blogEntry != null) { String labelSeries = SeriesHelper.GetBlogEntryLabelSeries(blogEntry); Template template = DataTemplateTemplateFactory.CreatePostTemplate(false, this.HidePostDateTime, this.ShowAuthorSeries, this.ShowLabelSeries, labelSeries, true, false, Minima.Service.AllowCommentStatus.Disabled, false, String.Empty); String output = template.Interpolate(new Map( new MapEntry("$Title$", blogEntry.Title), new MapEntry("$DateTimeString$", String.Format("{0}, {1} {2}, {3}", blogEntry.PostDateTime.DayOfWeek, blogEntry.PostDateTime.ToString("MMMM"), blogEntry.PostDateTime.Day, blogEntry.PostDateTime.Year)), new MapEntry("$Content$", blogEntry.Content), new MapEntry("$AuthorSeries$", SeriesHelper.GetBlogEntryAuthorSeries(blogEntry)), new MapEntry("$DateTimeDisplay$", String.Format("{0}/{1}/{2} {3}", blogEntry.PostDateTime.Month, blogEntry.PostDateTime.Day, blogEntry.PostDateTime.Year, blogEntry.PostDateTime.ToShortTimeString())), new MapEntry("$LabelSeries$", labelSeries) ) ); output = this.CodeParserSeries.ParseCode(output); //+ this.Controls.Add(new System.Web.UI.WebControls.Literal { Text = output }); //+ HttpData.SetScopedItem("MinimaBlogEntry", "Title", blogEntry.Title); } //+ base.OnPreRender(e); }