Esempio n. 1
0
        private void ImportBlog()
        {
            LogMessage("Reading import file");
            string        fileLocation       = string.Format("{0}\\{1}", ApplicationContext.PackagePath, WordpressXmlFile.Value);
            List <WpPost> listWordpressPosts = WpImportManager.Import(fileLocation, ImportComments.Checked, ImportCategories.Checked, ImportTags.Checked);

            LogMessage("Creating blog");
            Item root = db.GetItem(litSummaryPath.Text);

            BranchItem   newBlog  = db.Branches.GetMaster(Settings.BlogBranchID);
            BlogHomeItem blogItem = root.Add(ItemUtil.ProposeValidItemName(litSettingsName.Value), newBlog);

            blogItem.BeginEdit();
            blogItem.Email.Field.Value = litSettingsEmail.Value;
            blogItem.EndEdit();

            LogMessage("Importing posts");
            LogTotal(listWordpressPosts.Count);

            WpImportManager.ImportPosts(blogItem, listWordpressPosts, db, (itemName, count) =>
            {
                LogMessage("Importing entry " + itemName);
                LogProgress(count);
            });
        }
Esempio n. 2
0
        public BlogHomeItem CreateBlogRoot(Item root, string name, string email, ID blogRootTemplate)
        {
            BlogHomeItem blogItem = root.Add(ItemUtil.ProposeValidItemName(name), new TemplateID(blogRootTemplate));

            blogItem.BeginEdit();
            blogItem.Email.Field.Value = email;
            blogItem.EndEdit();

            return(blogItem);
        }