Esempio n. 1
0
        //+
        //- #OnPreRender -//
        protected override void OnPreRender(EventArgs e)
        {
            String link = Themelia.Web.HttpData.GetScopedItem <String>(Info.Scope, Info.CustomLink);

            //+
            if (!String.IsNullOrEmpty(link))
            {
                Minima.Service.BlogEntry blogEntry = BlogAgent.GetSingleBlogEntryByLink(this.BlogGuid, 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
                    });
                }
            }
            //+
            base.OnPreRender(e);
        }
Esempio n. 2
0
 //- $MasterPage_Load -//
 private void Page_Load(Object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         String       blogGuid     = Themelia.Web.HttpData.GetScopedItem <String>(Info.Scope, Info.BlogGuid);
         BlogMetaData blogMetaData = BlogAgent.GetBlogMetaData(blogGuid);
         //+
         rsd.Attributes.Add("href", WebConfiguration.Domain + "rsd.xml");
         wlwmanifest.Attributes.Add("href", WebConfiguration.Domain + "wlwmanifest.xml");
         //+
         hlBlogUrl.NavigateUrl = blogMetaData.Uri.AbsoluteUri;
         hlBlogUrl.Text        = blogMetaData.Title;
         //+
         image.Attributes.Add("onclick", "window.location='" + WebConfiguration.Domain + "'");
         //+
         rssLink.Attributes.Add("title", blogMetaData.FeedTitle);
         rssLink.Attributes.Add("href", blogMetaData.FeedUri.AbsoluteUri);
         rssLink.Attributes.Remove("id");
         //+
         hlFeedUrl.NavigateUrl = blogMetaData.FeedUri.AbsoluteUri;
         hlFeedUrl.Attributes.Add("title", "Subscribe to my feed");
         hlFeedUrl.Attributes.Add("rel", "alternate");
         hlFeedUrl.Attributes.Add("type", "application/rss+xml");
         //+
         litBlogDescription.Text = blogMetaData.Description;
         //+
     }
 }
Esempio n. 3
0
        //+
        //- $GetDataSource -//
        private List <BlogEntry> GetDataSource()
        {
            String blogGuid = Themelia.Web.HttpData.GetScopedItem <String>(Info.Scope, Info.BlogGuid);

            if (String.IsNullOrEmpty(blogGuid))
            {
                throw new ArgumentNullException("BlogGuid is required.");
            }
            //+
            List <BlogEntry> blogEntryList = new List <BlogEntry>();

            if (this.AccessType != AccessType.Index)
            {
                blogEntryList = BlogAgent.GetNetBlogEntryList(blogGuid, this.Label, this.Archive, this.Link, BlogSection.GetConfigSection().EntriesToShow, false);
                //+
                if (this.AccessType == AccessType.Link)
                {
                    if (blogEntryList != null)
                    {
                        HttpData.SetScopedItem <String>(Info.Scope, "BlogEntryTitle", blogEntryList[0].Title);
                        //+
                        this.BlogEntryGuid = blogEntryList[0].Guid;
                    }
                }
            }
            //+
            return(blogEntryList);
        }
Esempio n. 4
0
        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
            });
        }
Esempio n. 5
0
        public FullPost[] GetRecentPosts(String blogid, String emailAddress, String password, Int32 maxEntryCount)
        {
            String blogGuid = blogid;

            //+
            if (this.Reporter.Initialized)
            {
                this.Reporter.SendSingle(new Object[] { blogGuid, emailAddress, password, maxEntryCount }, "XmlRpcApi::GetRecentPosts", false);
            }
            //+
            List <BlogEntry> blogEntryList = BlogAgent.GetBlogEntryList(blogGuid, maxEntryCount, false, BlogEntryRetreivalType.Full, emailAddress, password);

            //+
            return(blogEntryList.Select(p => new FullPost
            {
                dateCreated = p.PostDateTime,
                description = p.Content,
                title = p.Title,
                link = Themelia.Web.Http.Root + "/" + Themelia.Web.UrlCleaner.FixWebPathHead(p.MappingNameList.First()),
                permalink = Themelia.Web.Http.Root + "/" + Themelia.Web.UrlCleaner.FixWebPathHead(p.MappingNameList.First()),
                postid = p.Guid,
                mt_allow_comments = "1",
                mt_convert_breaks = "0",
                mt_text_mode = "",
                mt_excerpt = "0",
                mt_tb_ping_urls = new String[0],
                categories = p.LabelList != null ? p.LabelList.Select(q => q.Title).ToArray() : null
            }).ToArray());
        }
Esempio n. 6
0
        //+
        //- @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);
        }
Esempio n. 7
0
 //- $MasterPage_Load -//
 private void Page_Load(Object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         BlogMetaData blogMetaData = BlogAgent.GetBlogMetaData(Minima.Web.Controls.MinimaBlog.BlogGuid);
         //+
         hlBlogUrl.NavigateUrl = blogMetaData.Uri.AbsoluteUri;
         hlBlogUrl.Text        = blogMetaData.Title;
         this.Page.Title       = blogMetaData.Title;
         //+
         litBlogDescription.Text = blogMetaData.Description;
     }
 }
Esempio n. 8
0
        //+
        //- #GetDataSource -//
        protected override Object GetDataSource()
        {
            List <ArchiveCount> archiveList = BlogAgent.GetArchivedEntryList(this.BlogGuid);

            //+
            return(archiveList.Select(p => new
            {
                Url = String.Format("/{0}/{1}", p.ArchiveDate.Year, p.ArchiveDate.ToString("MM")),
                MonthText = p.ArchiveDate.ToString("MMMM"),
                Year = p.ArchiveDate.Year,
                Count = p.Count
            }));
        }
Esempio n. 9
0
        public Boolean DeletePost(String appKey, String postid, String emailAddress, String password, Boolean publish)
        {
            String blogEntryGuid = postid;

            //+
            if (this.Reporter.Initialized)
            {
                this.Reporter.SendSingle(new Object[] { appKey, blogEntryGuid, emailAddress, password, publish }, "XmlRpcApi::DeletePost", false);
            }
            //+
            BlogAgent.DisableBlogEntry(postid, emailAddress, password);
            //+
            return(false);
        }
Esempio n. 10
0
        //+
        //- #GetDataSource -//
        protected override Object GetDataSource()
        {
            Int32 maxEntryCount = BlogSection.GetConfigSection().EntriesToShow;

            if (this.MaxEntryCount > 0)
            {
                maxEntryCount = this.MaxEntryCount;
            }
            List <BlogEntry> blogEntryList = BlogAgent.GetBlogEntryList(this.BlogGuid, maxEntryCount, false, BlogEntryRetreivalType.Full);

            //+
            return(blogEntryList.Select(p => new
            {
                Url = "/" + Themelia.Web.UrlCleaner.FixWebPathHead(p.MappingNameList.First()),
                Title = p.Title
            }));
        }
Esempio n. 11
0
        public BlogInfo[] GetUsersBlogs(String key, String emailAddress, String password)
        {
            if (this.Reporter.Initialized)
            {
                this.Reporter.SendSingle(new Object[] { key, emailAddress, password }, "XmlRpcApi::GetUsersBlogs", false);
            }
            //+
            List <BlogMetaData> blogList = BlogAgent.GetBlogListForAssociatedAuthor(emailAddress, password);

            //+
            Themelia.Map webDomainPathMap = new Themelia.Map();
            foreach (WebDomainData webDomainData in WebDomainDataList.AllWebDomainData)
            {
                ComponentData data = webDomainData.ComponentDataList[Info.MinimaKey];
                if (data != null)
                {
                    ParameterData parameterData = data.ParameterDataList[Info.BlogGuid];
                    if (parameterData != null)
                    {
                        String blogGuid = parameterData.Value;
                        if (!webDomainPathMap.ContainsKey(blogGuid))
                        {
                            webDomainPathMap.Add(blogGuid, webDomainData.Path);
                        }
                        else
                        {
                            throw new InvalidOperationException("Only one MinimaComponent may use a particular blog guid on a web site.  Minima web controls in other web domains may reference the web domain for a particular blog guid in order to access that blog.  Also, make sure that only the MinimaComponent component is using the \"Minima\" Key.");
                        }
                    }
                }
            }
            List <String> registeredBlogGuidList = webDomainPathMap.GetKeyList();

            //+
            BlogInfo[] netBlogList = (from b in blogList
                                      where registeredBlogGuidList.Contains(b.Guid)
                                      select new BlogInfo
            {
                blogid = b.Guid,
                blogName = b.Title,
                url = Themelia.Web.WebDomain.GetUrl(webDomainPathMap[b.Guid])
            }).ToArray();
            //+
            return(netBlogList);
        }
Esempio n. 12
0
        public String MetaWeblogNewPost(String blogid, String emailAddress, String password, Post post, Boolean publish)
        {
            String blogGuid = blogid;

            //+
            if (this.Reporter.Initialized)
            {
                this.Reporter.SendSingle(new Object[] { blogGuid, emailAddress, password, post.description, post.title, publish }, "XmlRpcApi::MetaWeblogNewPost", false);
            }
            //+
            return(BlogAgent.PostBlogEntry(blogGuid, new List <Author>(
                                               new Author[] {
                new Author {
                    Email = emailAddress
                }
            }
                                               ), post.title, post.description, DateTime.Now, null, null, publish, emailAddress, password));
        }
Esempio n. 13
0
        public Boolean EditPost(String postid, String emailAddress, String password, Post post, Boolean publish)
        {
            String blogEntryGuid = postid;

            //+
            if (this.Reporter.Initialized)
            {
                this.Reporter.SendSingle(new Object[] { blogEntryGuid, emailAddress, password, post.description, post.title, publish }, "XmlRpcApi::EditPost", false);
            }
            //+
            List <Label> labelList = new List <Label>();

            foreach (String title in post.categories)
            {
                labelList.Add(LabelAgent.GetLabelByTitle(title));
            }
            BlogAgent.UpdateBlogEntry(blogEntryGuid, post.title, post.description, null, labelList, new DateTime(0x79d, 1, 1), publish, emailAddress, password);
            //+
            return(true);
        }
Esempio n. 14
0
        //- @ProcessRequest -//
        public override void Process()
        {
            String blogGuid = Themelia.Web.HttpData.GetScopedItem <String>(Info.Scope, Info.BlogGuid);
            String key      = "SiteMap_" + blogGuid;

            if (String.IsNullOrEmpty(Themelia.Web.Http.Cache[key] as String))
            {
                List <BlogEntry> blogEntryList = BlogAgent.GetBlogEntryList(blogGuid, 0, false, BlogEntryRetreivalType.Full);
                StringBuilder    xml           = new StringBuilder();
                XmlWriter        xmlWriter     = XmlWriter.Create(xml);
                xmlWriter.WriteProcessingInstruction("xml", @"version=""1.0"" encoding=""UTF-8""");
                xmlWriter.WriteStartElement("urlset", "http://www.sitemaps.org/schemas/sitemap/0.9");
                foreach (BlogEntry blogEntry in blogEntryList)
                {
                    xmlWriter.WriteStartElement("url");
                    //+
                    xmlWriter.WriteStartElement("loc");
                    //xmlWriter.WriteValue(blogEntry.BlogEntryUri.AbsoluteUri);
                    xmlWriter.WriteEndElement();
                    xmlWriter.WriteStartElement("lastmod");
                    xmlWriter.WriteValue(blogEntry.PostDateTime.ToString("yyyy-MM-dd"));
                    xmlWriter.WriteEndElement();
                    xmlWriter.WriteStartElement("changefreq");
                    xmlWriter.WriteValue("never");
                    xmlWriter.WriteEndElement();
                    //+
                    xmlWriter.WriteEndElement();
                }
                xmlWriter.WriteEndElement();
                xmlWriter.Close();
                //+
                Themelia.Web.Http.Cache.Insert(key, xml.ToString());
            }
            ContentType = "text/xml";
            Output.Append(Themelia.Web.Http.Cache[key] as String);
        }
Esempio n. 15
0
        //+
        //- #OnInit -//
        protected override void OnInit(EventArgs e)
        {
            Func <BlogEntry, IndexEntry> indexTransformation = p => new IndexEntry
            {
                Url             = Themelia.Web.WebDomain.GetUrl() + Themelia.Web.UrlCleaner.FixWebPathHead(p.MappingNameList.FirstOrDefault()),
                Title           = p.Title,
                TypeGuid        = p.BlogEntryTypeGuid,
                PostDateTime    = p.PostDateTime,
                LabelList       = p.LabelList,
                DateTimeString  = String.Format("{0}, {1} {2}, {3}", p.PostDateTime.DayOfWeek, p.PostDateTime.ToString("MMMM"), p.PostDateTime.Day, p.PostDateTime.Year),
                DateTimeDisplay = String.Format("{0}/{1}/{2} {3}", p.PostDateTime.Month, p.PostDateTime.Day, p.PostDateTime.Year, p.PostDateTime.ToShortTimeString())
            };
            List <IndexEntry> indexDataSource;

            //+ index
            if (this.Index > 0)
            {
                String   blogGuid      = Themelia.Web.HttpData.GetScopedItem <String>(Info.Scope, Info.BlogGuid);
                DateTime startDateTime = new DateTime(this.Index, 1, 1, 0, 0, 0);
                DateTime endDateTime   = new DateTime(this.Index, 12, 31, 23, 59, 59);
                //+
                indexDataSource = BlogAgent.GetBlogEntryListByDateRange(blogGuid, startDateTime, endDateTime, false, true).Select(indexTransformation).ToList();
                List <Int32> yearDataSource = BlogAgent.GetBlogEntryList(blogGuid, 0, false, BlogEntryRetreivalType.VeryBasic)
                                              .Where(p => p.PostDateTime.Year != this.Index)
                                              .Select(p => p.PostDateTime.Year)
                                              .Distinct()
                                              .OrderByDescending(p => p)
                                              .ToList();
                indexListSeries = new IndexListSeries()
                {
                    HeadingSuffix       = BlogSection.GetConfigSection().Suffix.Index,
                    BlogEntryDataSource = indexDataSource,
                    YearDataSource      = yearDataSource,
                    Year = this.Index
                };
                indexListSeries.ID = "indexListSeries";
                this.Controls.Add(indexListSeries);
            }
            //+ blog
            else
            {
                if (this.AccessType == AccessType.Archive || this.AccessType == AccessType.Label)
                {
                    if (this.DataSource != null && this.DataSource.Count > 0)
                    {
                        indexDataSource   = this.DataSource.Select(indexTransformation).ToList();
                        indexEntryList    = new IndexEntryList(this.AccessType, indexDataSource);
                        indexEntryList.ID = "indexEntryList";
                        this.Controls.Add(indexEntryList);
                    }
                }
                //+
                phNoEntries    = __BuildNoEntryPlaceHolderControl();
                phNoEntries.ID = "phNoEntries";
                this.Controls.Add(phNoEntries);
                //+
                rptPosts    = this.__BuildPostRepeaterControl();
                rptPosts.ID = "rptPosts";
                this.Controls.Add(rptPosts);
                //+
                if (this.SupportCommenting)
                {
                    mvCommentContent = this.__BuildCommentMultiViewControl();
                    this.Controls.Add(mvCommentContent);
                }
            }
            //+
            base.OnInit(e);
        }