public void Init(BlogSettings settings)
 {
     _initing = true;
     _settings = settings;
     HtmlEditorSettingsControl.LoadSettings(settings);
     _initing = false;
 }
        public void EditWeblogItem(ListViewItem item, BlogSettings settings)
        {
            // Set tag (back-reference to profile)
            item.Tag = settings;

            // set text
            item.Text = String.Format(CultureInfo.CurrentCulture, " {0}", settings.BlogName);
        }
        public void Save(BlogSettings settings)
        {
            settings.HostBlogId = this.HostBlogId;
            settings.IsSpacesBlog = this.IsSpacesBlog;
            settings.IsSharePointBlog = this.IsSharePointBlog;
            settings.IsGoogleBloggerBlog = this.IsGoogleBloggerBlog;
            settings.BlogName = this.BlogName;
            settings.HomepageUrl = this.HomepageUrl;
            settings.ForceManualConfig = this.ForceManualConfig;
            settings.ManifestDownloadInfo = this.ManifestDownloadInfo;
            settings.SetProvider(this.ProviderId, this.ServiceName);
            settings.ClientType = this.ClientType;
            settings.PostApiUrl = this.PostApiUrl;
            if (IsSpacesBlog || !(SavePassword ?? false)) // clear out password so we don't save it
                Credentials.Password = "";

            settings.Credentials = this.Credentials;

            if (Categories != null)
                settings.Categories = this.Categories;

            if (Keywords != null)
                settings.Keywords = this.Keywords;

            settings.Authors = this.Authors;
            settings.Pages = this.Pages;

            settings.FavIcon = this.FavIcon;
            settings.Image = this.Image;
            settings.WatermarkImage = this.WatermarkImage;

            if (OptionOverrides != null)
                settings.OptionOverrides = this.OptionOverrides;

            if (UserOptionOverrides != null)
                settings.UserOptionOverrides = this.UserOptionOverrides;

            if (HomePageOverrides != null)
                settings.HomePageOverrides = this.HomePageOverrides;

            settings.ButtonDescriptions = this.ButtonDescriptions;

            // file upload support
            settings.FileUploadSupport = this.FileUploadSupport;

            // save ftp settings if necessary
            if (FileUploadSupport == FileUploadSupport.FTP)
            {
                FtpUploaderSettings.Copy(FileUploadSettings, settings.FileUploadSettings);
            }

            PublishingPluginSettings.CopyTo(settings.PublishingPluginSettings);

            using (PostHtmlEditingSettings editSettings = new PostHtmlEditingSettings(settings.Id))
            {
                editSettings.EditorTemplateHtmlFiles = TemplateFiles;
            }
        }
 public virtual void Dispose()
 {
     if(_htmlEditorSettingsControl != null)
     {
         _htmlEditorSettingsControl.SettingsChanged -= new EventHandler(_htmlEditorSettingsControl_SettingsChanged);
         _htmlEditorSettingsControl.Dispose();
         _htmlEditorSettingsControl = null;
     }
     _settings = null;
 }
        public ListViewItem AddWeblogItem(BlogSettings settings)
        {
            // create a new list view item
            ListViewItem listViewItem = new ListViewItem();

            // populate it from the published folder
            EditWeblogItem(listViewItem, settings);

            // add the item to the list and return it
            Items.Add(listViewItem);
            return listViewItem;
        }
Exemplo n.º 6
0
        public void ApplyUpdates(IBlogSettingsDetectionContext settingsContext)
        {
            using (MetaLock(APPLY_UPDATES_LOCK))
            {
                if (BlogSettings.BlogIdIsValid(_id))
                {
                    if (settingsContext.ManifestDownloadInfo != null)
                    {
                        ManifestDownloadInfo = settingsContext.ManifestDownloadInfo;
                    }

                    if (settingsContext.ClientType != null)
                    {
                        ClientType = settingsContext.ClientType;
                    }

                    if (settingsContext.FavIcon != null)
                    {
                        FavIcon = settingsContext.FavIcon;
                    }

                    if (settingsContext.Image != null)
                    {
                        Image = settingsContext.Image;
                    }

                    if (settingsContext.WatermarkImage != null)
                    {
                        WatermarkImage = settingsContext.WatermarkImage;
                    }

                    if (settingsContext.Categories != null)
                    {
                        Categories = settingsContext.Categories;
                    }

                    if (settingsContext.Keywords != null)
                    {
                        Keywords = settingsContext.Keywords;
                    }

                    if (settingsContext.ButtonDescriptions != null)
                    {
                        ButtonDescriptions = settingsContext.ButtonDescriptions;
                    }

                    if (settingsContext.OptionOverrides != null)
                    {
                        OptionOverrides = settingsContext.OptionOverrides;
                    }

                    if (settingsContext.HomePageOverrides != null)
                    {
                        HomePageOverrides = settingsContext.HomePageOverrides;
                    }
                }
                else
                {
                    throw new InvalidOperationException("Attempted to apply updates to invalid blog-id");
                }
            }
        }
 private string GetBlogSettingsContents(BlogSettings blogSettings)
 {
     // return normalized string of settings contents
     StringBuilder settingsContents = new StringBuilder();
     AppendClientType(blogSettings.ClientType, settingsContents);
     AppendImages(blogSettings.Image, blogSettings.WatermarkImage, settingsContents);
     AppendCategories(blogSettings.Categories, settingsContents);
     AppendButtons(blogSettings.ButtonDescriptions, settingsContents);
     AppendOptionOverrides(blogSettings.OptionOverrides, settingsContents);
     AppendOptionOverrides(blogSettings.HomePageOverrides, settingsContents);
     return settingsContents.ToString();
 }
 public void ApplySettings(BlogSettings settings)
 {
     //blog template
     using(PostHtmlEditingSettings editingSettings = new PostHtmlEditingSettings(settings.Id))
     {
         editingSettings.EditorTemplateHtmlFile = _templateFile;
         editingSettings.EditorTemplateHtml = textBoxTemplate.Text;
     }
 }
 internal void LoadSettings(BlogSettings settings)
 {
     //blog template
     _id = settings.Id;
     using(PostHtmlEditingSettings blogTemplate = new PostHtmlEditingSettings(settings.Id))
     {
         _templateFile = blogTemplate.EditorTemplateHtmlFile;
         textBoxTemplate.Text = blogTemplate.EditorTemplateHtml;
     }
 }
Exemplo n.º 10
0
 public Blog(string blogId)
 {
     _settings = BlogSettings.ForBlogId(blogId);
 }
        private static IEnumerable<ContentSourceInfo> GetActivePlugins(IWin32Window owner, IEnumerable<ContentSourceInfo> plugins, BlogSettings blogSettings, bool defaultEnabled)
        {
            BlogPublishingPluginSettings settings = blogSettings.PublishingPluginSettings;
            List<ContentSourceInfo> pluginList = new List<ContentSourceInfo>(plugins);

            // Sort the plugins according to their determined order, and for those
            // without an order, sort by last use
            pluginList.Sort(CreateComparison(settings));

            // Filter out plugins that aren't enabled for this blog.
            // Do this after sorting, so that if we need to prompt, we
            // will persist the correct order
            pluginList = pluginList.FindAll(delegate (ContentSourceInfo csi) { return PluginIsEnabled(owner, settings, csi, defaultEnabled); });

            return pluginList;
        }