From d3283bd74b311b25fc393839890ac3e86fe2de0e Mon Sep 17 00:00:00 2001 From: jbrinkman_cp Date: Thu, 17 Feb 2011 07:28:56 -0800 Subject: [PATCH] Resolved issue with new JS/CSS file include enhancement --- Blog/Components/BlogModuleBase.vb | 156 +++++----- Blog/ModuleOptions.ascx.vb | 500 +++++++++++++++--------------- 2 files changed, 328 insertions(+), 328 deletions(-) diff --git a/Blog/Components/BlogModuleBase.vb b/Blog/Components/BlogModuleBase.vb index 1592ead2..eabd1695 100644 --- a/Blog/Components/BlogModuleBase.vb +++ b/Blog/Components/BlogModuleBase.vb @@ -25,109 +25,109 @@ Imports DotNetNuke.Entities.Modules Imports DotNetNuke Public Class BlogModuleBase - Inherits PortalModuleBase + Inherits PortalModuleBase #Region " Public Constants " - Public Const RSS_RECENT_ENTRIES As Integer = 0 - Public Const RSS_BLOG_ENTRIES As Integer = 1 - Public Const RSS_SINGLE_ENTRY As Integer = 2 - Public Const RSS_ARCHIV_VIEW As Integer = 3 - Public Const CONTROL_VIEW_VIEWBLOG As String = "ViewBlog.ascx" - Public Const CONTROL_VIEW_VIEWENTRY As String = "ViewEntry.ascx" - Public Const CONTROL_VIEW_BLOGFEED As String = "BlogFeed.ascx" - Public Const ONLINE_HELP_URL As String = "" - Public Const BLOG_TEMPLATES_RESOURCE As String = "/DesktopModules/Blog/App_LocalResources/BlogTemplates.ascx.resx" + Public Const RSS_RECENT_ENTRIES As Integer = 0 + Public Const RSS_BLOG_ENTRIES As Integer = 1 + Public Const RSS_SINGLE_ENTRY As Integer = 2 + Public Const RSS_ARCHIV_VIEW As Integer = 3 + Public Const CONTROL_VIEW_VIEWBLOG As String = "ViewBlog.ascx" + Public Const CONTROL_VIEW_VIEWENTRY As String = "ViewEntry.ascx" + Public Const CONTROL_VIEW_BLOGFEED As String = "BlogFeed.ascx" + Public Const ONLINE_HELP_URL As String = "" + Public Const BLOG_TEMPLATES_RESOURCE As String = "/DesktopModules/Blog/App_LocalResources/BlogTemplates.ascx.resx" #End Region #Region " Public Enums " #End Region #Region " Public Members " - Public MyActions As New Entities.Modules.Actions.ModuleActionCollection - Public Shared RssView As RssViews + Public MyActions As New Entities.Modules.Actions.ModuleActionCollection + Public Shared RssView As RssViews #End Region #Region " Public Methods " - Public Sub SetModuleConfiguration(ByVal config As Entities.Modules.ModuleInfo) - ModuleConfiguration = config - End Sub + Public Sub SetModuleConfiguration(ByVal config As Entities.Modules.ModuleInfo) + ModuleConfiguration = config + End Sub - Public Sub AddJQuery() - Dim alreadyRequested As Boolean = False - If HttpContext.Current.Items("jQueryRequested") IsNot Nothing Then - alreadyRequested = Convert.ToBoolean(HttpContext.Current.Items("jQueryRequested")) - End If - If alreadyRequested Then Exit Sub ' let DNN 5 handle it - Page.ClientScript.RegisterClientScriptInclude("jQuery", DotNetNuke.Common.ApplicationPath & "/DesktopModules/Blog/js/jquery.min.js") - HttpContext.Current.Items("jquery_registered") = True ' let DNN 5 know we've added it - End Sub + Public Sub AddJQuery() + Dim alreadyRequested As Boolean = False + If HttpContext.Current.Items("jQueryRequested") IsNot Nothing Then + alreadyRequested = Convert.ToBoolean(HttpContext.Current.Items("jQueryRequested")) + End If + If alreadyRequested Then Exit Sub ' let DNN 5 handle it + Page.ClientScript.RegisterClientScriptInclude("jQuery", DotNetNuke.Common.ApplicationPath & "/DesktopModules/Blog/js/jquery.min.js") + HttpContext.Current.Items("jquery_registered") = True ' let DNN 5 know we've added it + End Sub #End Region #Region " Public Properties " - Public ReadOnly Property BasePage() As DotNetNuke.Framework.CDefault - Get - Try - Return CType(Me.Page, DotNetNuke.Framework.CDefault) - Catch - Return Nothing - End Try - End Get - End Property + Public ReadOnly Property BasePage() As DotNetNuke.Framework.CDefault + Get + Try + Return CType(Me.Page, DotNetNuke.Framework.CDefault) + Catch + Return Nothing + End Try + End Get + End Property - Public Property BlogSettings() As Settings.BlogSettings - Get - If _blogSettings Is Nothing Then - _blogSettings = DotNetNuke.Modules.Blog.Settings.BlogSettings.GetBlogSettings(PortalId, TabId) - End If - Return _blogSettings - End Get - Set(ByVal value As Settings.BlogSettings) - _blogSettings = value - End Set - End Property + Public Property BlogSettings() As Settings.BlogSettings + Get + If _blogSettings Is Nothing Then + _blogSettings = DotNetNuke.Modules.Blog.Settings.BlogSettings.GetBlogSettings(PortalId, TabId) + End If + Return _blogSettings + End Get + Set(ByVal value As Settings.BlogSettings) + _blogSettings = value + End Set + End Property - Public Property OutputAdditionalFiles() As Boolean - Get - Return _outputAdditionalFiles - End Get - Set(ByVal value As Boolean) - _outputAdditionalFiles = value - End Set - End Property + Public Property OutputAdditionalFiles() As Boolean + Get + Return _outputAdditionalFiles + End Get + Set(ByVal value As Boolean) + _outputAdditionalFiles = value + End Set + End Property #End Region #Region " Private Members " - Private _blogSettings As Settings.BlogSettings - Private _outputAdditionalFiles As Boolean = False + Private _blogSettings As Settings.BlogSettings + Private _outputAdditionalFiles As Boolean = False #End Region #Region " Event Handlers " - Private Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init - Dim script As New StringBuilder - script.AppendLine("") - UI.Utilities.ClientAPI.RegisterClientScriptBlock(Page, "blogAppPath", script.ToString) - End Sub + Private Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init + Dim script As New StringBuilder + script.AppendLine("") + UI.Utilities.ClientAPI.RegisterClientScriptBlock(Page, "blogAppPath", script.ToString) + End Sub - Private Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender - If OutputAdditionalFiles Then - If BlogSettings.AddJQuery Then - AddJQuery() - End If - For Each f As String In BlogSettings.IncludeFiles.Split(";"c) - If Not String.IsNullOrEmpty(f) Then - If f.ToLower.EndsWith(".js") Then - Page.ClientScript.RegisterClientScriptInclude(f.Replace("[", "").Replace("]", "_").Replace("/", "_"), f.Replace("[P]", PortalSettings.HomeDirectory & "/Blog/Include").Replace("[H]", DotNetNuke.Common.ApplicationPath & "/DesktopModules/Blog/include/")) - ElseIf f.ToLower.EndsWith(".css") Then - CType(Me.Page, DotNetNuke.Framework.CDefault).AddStyleSheet(f.Replace("[", "").Replace("]", "_").Replace("/", "_"), f.Replace("[P]", PortalSettings.HomeDirectory & "/Blog/Include").Replace("[H]", DotNetNuke.Common.ApplicationPath & "/DesktopModules/Blog/include/")) - End If + Private Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender + If OutputAdditionalFiles Then + If BlogSettings.AddJQuery Then + AddJQuery() + End If + For Each f As String In BlogSettings.IncludeFiles.Split(";"c) + If Not String.IsNullOrEmpty(f) Then + If f.ToLower.EndsWith(".js") Then + Page.ClientScript.RegisterClientScriptInclude(f.Replace("[", "").Replace("]", "_").Replace("/", "_"), f.Replace("[P]", PortalSettings.HomeDirectory & "Blog/Include/").Replace("[H]", DotNetNuke.Common.ApplicationPath & "/DesktopModules/Blog/include/")) + ElseIf f.ToLower.EndsWith(".css") Then + CType(Me.Page, DotNetNuke.Framework.CDefault).AddStyleSheet(f.Replace("[", "").Replace("]", "_").Replace("/", "_"), f.Replace("[P]", PortalSettings.HomeDirectory & "Blog/Include/").Replace("[H]", DotNetNuke.Common.ApplicationPath & "/DesktopModules/Blog/include/")) + End If + End If + Next End If - Next - End If - End Sub + End Sub #End Region End Class diff --git a/Blog/ModuleOptions.ascx.vb b/Blog/ModuleOptions.ascx.vb index e5d397da..6a27265a 100644 --- a/Blog/ModuleOptions.ascx.vb +++ b/Blog/ModuleOptions.ascx.vb @@ -25,274 +25,274 @@ Imports DotNetNuke.Services.Exceptions.Exceptions Imports DotNetNuke.Services.Localization.Localization Partial Class ModuleOptions - Inherits BlogModuleBase + Inherits BlogModuleBase #Region " Controls " - Protected WithEvents tblSummaryOptions As System.Web.UI.HtmlControls.HtmlTable - Protected WithEvents tblEntryOptions As System.Web.UI.HtmlControls.HtmlTable - Protected WithEvents pnlSummaryOptions As System.Web.UI.WebControls.Panel - Protected WithEvents DropDownList1 As System.Web.UI.WebControls.DropDownList + Protected WithEvents tblSummaryOptions As System.Web.UI.HtmlControls.HtmlTable + Protected WithEvents tblEntryOptions As System.Web.UI.HtmlControls.HtmlTable + Protected WithEvents pnlSummaryOptions As System.Web.UI.WebControls.Panel + Protected WithEvents DropDownList1 As System.Web.UI.WebControls.DropDownList #End Region #Region " Event Handlers " - Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load - - Try - If Not Page.IsPostBack Then - - ' Load settings - chkForceDescription.Checked = BlogSettings.EntryDescriptionRequired - txtSummaryLimit.Text = BlogSettings.SummaryMaxLength.ToString - txtSearchLimit.Text = BlogSettings.SearchSummaryMaxLength.ToString - txtMaxImageWidth.Text = BlogSettings.MaxImageWidth.ToString - chkShowGravatars.Checked = BlogSettings.ShowGravatars - chkShowWebsite.Checked = BlogSettings.ShowWebsite - txtGravatarImageWidth.Text = BlogSettings.GravatarImageWidth.ToString - - 'DW - 06/06/2008 - ' Set the visibility of the Gravatar rows based on the ShowGravatars setting + Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + + Try + If Not Page.IsPostBack Then + + ' Load settings + chkForceDescription.Checked = BlogSettings.EntryDescriptionRequired + txtSummaryLimit.Text = BlogSettings.SummaryMaxLength.ToString + txtSearchLimit.Text = BlogSettings.SearchSummaryMaxLength.ToString + txtMaxImageWidth.Text = BlogSettings.MaxImageWidth.ToString + chkShowGravatars.Checked = BlogSettings.ShowGravatars + chkShowWebsite.Checked = BlogSettings.ShowWebsite + txtGravatarImageWidth.Text = BlogSettings.GravatarImageWidth.ToString + + 'DW - 06/06/2008 + ' Set the visibility of the Gravatar rows based on the ShowGravatars setting + trGravatarImageWidth.Visible = chkShowGravatars.Checked + trGravatarRating.Visible = chkShowGravatars.Checked + trGravatarDefaultImageUrl.Visible = chkShowGravatars.Checked + trGravatarDefaultImageCustomURL.Visible = chkShowGravatars.Checked + + Dim ratingValue As String = BlogSettings.GravatarRating + Dim defaultURL As String = BlogSettings.GravatarDefaultImageUrl + rblGravatarRating.SelectedIndex = rblGravatarRating.Items.IndexOf(rblGravatarRating.Items.FindByValue(ratingValue)) + rblDefaultImage.SelectedIndex = rblDefaultImage.Items.IndexOf(rblDefaultImage.Items.FindByValue(defaultURL)) + txtGravatarDefaultImageCustomURL.Text = BlogSettings.GravatarCustomUrl + + txtRecentEntriesMax.Text = BlogSettings.RecentEntriesMax.ToString + txtRecentRssEntriesMax.Text = BlogSettings.RecentRssEntriesMax.ToString + trSummary.Visible = Not chkForceDescription.Checked + trSearchSummary.Visible = Not chkForceDescription.Checked + chkUploadOption.Checked = BlogSettings.EnableUploadOption + chkShowSummary.Checked = BlogSettings.ShowSummary + chkShowCommentTitle.Checked = BlogSettings.ShowCommentTitle + chkShowUniqueTitle.Checked = BlogSettings.ShowUniqueTitle + chkShowSeoFriendlyUrl.Checked = BlogSettings.ShowSeoFriendlyUrl + chkEnableBookmarks.Checked = BlogSettings.ShowSocialBookmarks + chkEnforceSummaryTruncation.Checked = BlogSettings.EnforceSummaryTruncation + chkAllowCommentAnchors.Checked = BlogSettings.AllowCommentAnchors + chkAllowCommentImages.Checked = BlogSettings.AllowCommentImages + chkAllowCommentFormatting.Checked = BlogSettings.AllowCommentFormatting + chkAllowSummaryHtml.Checked = BlogSettings.AllowSummaryHtml + chkAllowWLW.Checked = BlogSettings.AllowWLW + + chkIncludeBody.Checked = BlogSettings.IncludeBody + chkIncludeCategoriesInDescription.Checked = BlogSettings.IncludeCategoriesInDescription + chkIncludeTagsInDescription.Checked = BlogSettings.IncludeTagsInDescription + + txtFeedCacheTime.Text = BlogSettings.FeedCacheTime.ToString + chkAllowChildBlogs.Checked = BlogSettings.AllowChildBlogs + chkEnableArchiveDropDown.Checked = BlogSettings.EnableArchiveDropDown + chkAllowMultipleCategories.Checked = BlogSettings.AllowMultipleCategories + chkUseWLWExcerpt.Checked = BlogSettings.UseWLWExcerpt + + ' Additional files to load + Dim fileList As String = ";" & BlogSettings.IncludeFiles + AddFolderToList(cblHostFiles, Server.MapPath("~/DesktopModules/Blog/include"), "") + AddFolderToList(cblPortalFiles, PortalSettings.HomeDirectoryMapPath & "Blog\include\", "") + For Each itm As ListItem In cblHostFiles.Items + If fileList.IndexOf(";[H]" & itm.Value & ";") > -1 Then + itm.Selected = True + End If + Next + For Each itm As ListItem In cblPortalFiles.Items + If fileList.IndexOf(";[P]" & itm.Value & ";") > -1 Then + itm.Selected = True + End If + Next + chkAddJQuery.Checked = BlogSettings.AddJQuery + + ' 6/14/2008 + ' Add icons to radiobutton + ' + ' have to do localization manually, otherwise, built-in localizer will overwrite the changes made here + + Dim li As ListItem + For Each li In rblDefaultImage.Items + If li.Value = "" Then li.Text = " " & GetString("liGrayMan.Text", LocalResourceFile) + If li.Value = "identicon" Then li.Text = " " & GetString("liIdenticon.Text", LocalResourceFile) + If li.Value = "wavatar" Then li.Text = " " & GetString("liWavatar.Text", LocalResourceFile) + If li.Value = "monsterid" Then li.Text = " " & GetString("liMonsterID.Text", LocalResourceFile) + If li.Value = "custom" Then li.Text = " " & GetString("liCustom.Text", LocalResourceFile) + Next + + Dim objBlog As New BlogController + cmbPageBlogs.DataSource = objBlog.ListBlogs(PortalId, -1, False) + cmbPageBlogs.DataBind() + cmbPageBlogs.Items.Insert(0, New ListItem("<" & GetString("Not_Specified", SharedResourceFile) & ">", "-1")) + Try + cmbPageBlogs.Items.FindByValue(CStr(BlogSettings.PageBlogs)).Selected = True + Catch + End Try + chkEnableDNNSearch.Checked = BlogSettings.EnableDNNSearch + If cmbPageBlogs.Items.Count > 2 Then + chkEnableDNNSearch.Enabled = (cmbPageBlogs.SelectedIndex = 0) + End If + + ' calculate child blogs + Dim totalBlogs As Integer = objBlog.ListBlogsByPortal(PortalId, True).Count + Dim parentBlogs As Integer = objBlog.ListBlogsRootByPortal(PortalId).Count + lblChildBlogsStatus.Text = String.Format(GetString("lblChildBlogsStatus", LocalResourceFile), CInt(totalBlogs - parentBlogs)) + DotNetNuke.UI.Utilities.ClientAPI.AddButtonConfirm(cmdMigrateChildblogs, GetString("MigrateConfirm", LocalResourceFile)) + 'cmdMigrateChildblogs + + 'Load Bookmarks Settings + 'Dim oBookmarks As New DataSet + 'oBookmarks.ReadXml(MapPath(ModulePath & "js/bookmarks.xml")) + 'dlBookmarks.DataSource = oBookmarks + 'dlBookmarks.DataBind() + + ForumBlog.Utils.isForumBlogInstalled(PortalId, TabId, True) + End If + + Catch exc As Exception + ProcessModuleLoadException(Me, exc) + End Try + End Sub + + Private Sub cmbPageBlogs_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbPageBlogs.SelectedIndexChanged + If cmbPageBlogs.Items.Count > 2 Then + If cmbPageBlogs.SelectedIndex = 0 Then + chkEnableDNNSearch.Enabled = True + Else + chkEnableDNNSearch.Enabled = False + chkEnableDNNSearch.Checked = False + End If + Else + chkEnableDNNSearch.Enabled = True + End If + + End Sub + + Private Sub chkShowGravatars_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkShowGravatars.CheckedChanged trGravatarImageWidth.Visible = chkShowGravatars.Checked trGravatarRating.Visible = chkShowGravatars.Checked trGravatarDefaultImageUrl.Visible = chkShowGravatars.Checked trGravatarDefaultImageCustomURL.Visible = chkShowGravatars.Checked + End Sub - Dim ratingValue As String = BlogSettings.GravatarRating - Dim defaultURL As String = BlogSettings.GravatarDefaultImageUrl - rblGravatarRating.SelectedIndex = rblGravatarRating.Items.IndexOf(rblGravatarRating.Items.FindByValue(ratingValue)) - rblDefaultImage.SelectedIndex = rblDefaultImage.Items.IndexOf(rblDefaultImage.Items.FindByValue(defaultURL)) - txtGravatarDefaultImageCustomURL.Text = BlogSettings.GravatarCustomUrl - - txtRecentEntriesMax.Text = BlogSettings.RecentEntriesMax.ToString - txtRecentRssEntriesMax.Text = BlogSettings.RecentRssEntriesMax.ToString - trSummary.Visible = Not chkForceDescription.Checked - trSearchSummary.Visible = Not chkForceDescription.Checked - chkUploadOption.Checked = BlogSettings.EnableUploadOption - chkShowSummary.Checked = BlogSettings.ShowSummary - chkShowCommentTitle.Checked = BlogSettings.ShowCommentTitle - chkShowUniqueTitle.Checked = BlogSettings.ShowUniqueTitle - chkShowSeoFriendlyUrl.Checked = BlogSettings.ShowSeoFriendlyUrl - chkEnableBookmarks.Checked = BlogSettings.ShowSocialBookmarks - chkEnforceSummaryTruncation.Checked = BlogSettings.EnforceSummaryTruncation - chkAllowCommentAnchors.Checked = BlogSettings.AllowCommentAnchors - chkAllowCommentImages.Checked = BlogSettings.AllowCommentImages - chkAllowCommentFormatting.Checked = BlogSettings.AllowCommentFormatting - chkAllowSummaryHtml.Checked = BlogSettings.AllowSummaryHtml - chkAllowWLW.Checked = BlogSettings.AllowWLW - - chkIncludeBody.Checked = BlogSettings.IncludeBody - chkIncludeCategoriesInDescription.Checked = BlogSettings.IncludeCategoriesInDescription - chkIncludeTagsInDescription.Checked = BlogSettings.IncludeTagsInDescription - - txtFeedCacheTime.Text = BlogSettings.FeedCacheTime.ToString - chkAllowChildBlogs.Checked = BlogSettings.AllowChildBlogs - chkEnableArchiveDropDown.Checked = BlogSettings.EnableArchiveDropDown - chkAllowMultipleCategories.Checked = BlogSettings.AllowMultipleCategories - chkUseWLWExcerpt.Checked = BlogSettings.UseWLWExcerpt - - ' Additional files to load - Dim fileList As String = ";" & BlogSettings.IncludeFiles - AddFolderToList(cblHostFiles, Server.MapPath("~/DesktopModules/Blog/include"), "") - AddFolderToList(cblPortalFiles, PortalSettings.HomeDirectoryMapPath & "\Blog\include", "") - For Each itm As ListItem In cblHostFiles.Items - If fileList.IndexOf(";[H]" & itm.Value & ";") > -1 Then - itm.Selected = True - End If - Next - For Each itm As ListItem In cblPortalFiles.Items - If fileList.IndexOf(";[P]" & itm.Value & ";") > -1 Then - itm.Selected = True - End If - Next - chkAddJQuery.Checked = BlogSettings.AddJQuery - - ' 6/14/2008 - ' Add icons to radiobutton - ' - ' have to do localization manually, otherwise, built-in localizer will overwrite the changes made here - - Dim li As ListItem - For Each li In rblDefaultImage.Items - If li.Value = "" Then li.Text = " " & GetString("liGrayMan.Text", LocalResourceFile) - If li.Value = "identicon" Then li.Text = " " & GetString("liIdenticon.Text", LocalResourceFile) - If li.Value = "wavatar" Then li.Text = " " & GetString("liWavatar.Text", LocalResourceFile) - If li.Value = "monsterid" Then li.Text = " " & GetString("liMonsterID.Text", LocalResourceFile) - If li.Value = "custom" Then li.Text = " " & GetString("liCustom.Text", LocalResourceFile) - Next + Private Sub cmdUpdateOptions_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdUpdateOptions.Click + Try + ' Update Settings + With BlogSettings + .EntryDescriptionRequired = chkForceDescription.Checked + .SummaryMaxLength = CInt(txtSummaryLimit.Text) + .SearchSummaryMaxLength = CInt(txtSearchLimit.Text) + .MaxImageWidth = CInt(txtMaxImageWidth.Text) + .RecentEntriesMax = CInt(txtRecentEntriesMax.Text) + .RecentRssEntriesMax = CInt(txtRecentRssEntriesMax.Text) + .EnableUploadOption = chkUploadOption.Checked + .ShowSummary = chkShowSummary.Checked + .ShowCommentTitle = chkShowCommentTitle.Checked + .AllowCommentAnchors = chkAllowCommentAnchors.Checked + .AllowCommentImages = chkAllowCommentImages.Checked + .AllowCommentFormatting = chkAllowCommentFormatting.Checked + .ShowUniqueTitle = chkShowUniqueTitle.Checked + .ShowSeoFriendlyUrl = chkShowSeoFriendlyUrl.Checked + .PageBlogs = CInt(cmbPageBlogs.SelectedItem.Value) + .EnableDNNSearch = chkEnableDNNSearch.Checked + .ShowGravatars = chkShowGravatars.Checked + .GravatarImageWidth = CInt(txtGravatarImageWidth.Text) + .GravatarRating = rblGravatarRating.SelectedValue + .GravatarDefaultImageUrl = rblDefaultImage.SelectedValue + .GravatarCustomUrl = txtGravatarDefaultImageCustomURL.Text + .ShowWebsite = chkShowWebsite.Checked() + .ShowSocialBookmarks = chkEnableBookmarks.Checked + .EnforceSummaryTruncation = chkEnforceSummaryTruncation.Checked + .IncludeBody = chkIncludeBody.Checked + .IncludeCategoriesInDescription = chkIncludeCategoriesInDescription.Checked + .IncludeTagsInDescription = chkIncludeTagsInDescription.Checked + .AllowSummaryHtml = chkAllowSummaryHtml.Checked + .FeedCacheTime = CInt(txtFeedCacheTime.Text.Trim) + .AllowChildBlogs = chkAllowChildBlogs.Checked + .EnableArchiveDropDown = chkEnableArchiveDropDown.Checked + .AllowWLW = chkAllowWLW.Checked + .AllowMultipleCategories = chkAllowMultipleCategories.Checked + .UseWLWExcerpt = chkUseWLWExcerpt.Checked + + ' additional files + Dim fileList As String = "" + For Each itm As ListItem In cblHostFiles.Items + If itm.Selected Then + fileList &= "[H]" & itm.Value & ";" + End If + Next + For Each itm As ListItem In cblPortalFiles.Items + If itm.Selected Then + fileList &= "[P]" & itm.Value & ";" + End If + Next + .IncludeFiles = fileList + .AddJQuery = chkAddJQuery.Checked + + .UpdateSettings() + End With + + Response.Redirect(NavigateURL(), True) + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) + End Try + End Sub - Dim objBlog As New BlogController - cmbPageBlogs.DataSource = objBlog.ListBlogs(PortalId, -1, False) - cmbPageBlogs.DataBind() - cmbPageBlogs.Items.Insert(0, New ListItem("<" & GetString("Not_Specified", SharedResourceFile) & ">", "-1")) + Private Sub cmdCancelOptions_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdCancelOptions.Click Try - cmbPageBlogs.Items.FindByValue(CStr(BlogSettings.PageBlogs)).Selected = True - Catch + Response.Redirect(NavigateURL(), True) + Catch exc As Exception 'Module failed to load + ProcessModuleLoadException(Me, exc) End Try - chkEnableDNNSearch.Checked = BlogSettings.EnableDNNSearch - If cmbPageBlogs.Items.Count > 2 Then - chkEnableDNNSearch.Enabled = (cmbPageBlogs.SelectedIndex = 0) - End If + End Sub + + Private Sub chkForceDescription_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkForceDescription.CheckedChanged + Me.trSummary.Visible = Not chkForceDescription.Checked + Me.trSearchSummary.Visible = Not chkForceDescription.Checked + End Sub + + Private Sub cmdGenerateLinks_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdGenerateLinks.Click + Utility.CreateAllEntryLinks(PortalId, , TabId) + End Sub + + Private Sub cmdMigrateChildblogs_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdMigrateChildblogs.Click + + ' get sql + Dim assembly As Reflection.Assembly = Reflection.Assembly.GetExecutingAssembly() + Dim sql As String = "" + Using stream As IO.Stream = assembly.GetManifestResourceStream("DotNetNuke.Modules.Blog.ChildblogsToCategories.sql") + Using rdr As New IO.StreamReader(stream) + sql = rdr.ReadToEnd + End Using + End Using + sql = sql.Replace("@portalid", PortalId.ToString) + + ' run the script + Dim res As String = DotNetNuke.Data.DataProvider.Instance().ExecuteScript(sql, False) + + ' run through all categories to make sure the slug is correctly set + For Each c As CategoryInfo In CategoryController.ListCategories(PortalId).Values + CategoryController.UpdateCategory(c.CatId, c.Category, c.ParentId) + Next - ' calculate child blogs - Dim totalBlogs As Integer = objBlog.ListBlogsByPortal(PortalId, True).Count - Dim parentBlogs As Integer = objBlog.ListBlogsRootByPortal(PortalId).Count + ' recalculate child blogs + Dim totalBlogs As Integer = (New BlogController).ListBlogsByPortal(PortalId, True).Count + Dim parentBlogs As Integer = (New BlogController).ListBlogsRootByPortal(PortalId).Count lblChildBlogsStatus.Text = String.Format(GetString("lblChildBlogsStatus", LocalResourceFile), CInt(totalBlogs - parentBlogs)) - DotNetNuke.UI.Utilities.ClientAPI.AddButtonConfirm(cmdMigrateChildblogs, GetString("MigrateConfirm", LocalResourceFile)) - 'cmdMigrateChildblogs - - 'Load Bookmarks Settings - 'Dim oBookmarks As New DataSet - 'oBookmarks.ReadXml(MapPath(ModulePath & "js/bookmarks.xml")) - 'dlBookmarks.DataSource = oBookmarks - 'dlBookmarks.DataBind() - - ForumBlog.Utils.isForumBlogInstalled(PortalId, TabId, True) - End If - - Catch exc As Exception - ProcessModuleLoadException(Me, exc) - End Try - End Sub - - Private Sub cmbPageBlogs_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbPageBlogs.SelectedIndexChanged - If cmbPageBlogs.Items.Count > 2 Then - If cmbPageBlogs.SelectedIndex = 0 Then - chkEnableDNNSearch.Enabled = True - Else - chkEnableDNNSearch.Enabled = False - chkEnableDNNSearch.Checked = False - End If - Else - chkEnableDNNSearch.Enabled = True - End If - - End Sub - - Private Sub chkShowGravatars_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkShowGravatars.CheckedChanged - trGravatarImageWidth.Visible = chkShowGravatars.Checked - trGravatarRating.Visible = chkShowGravatars.Checked - trGravatarDefaultImageUrl.Visible = chkShowGravatars.Checked - trGravatarDefaultImageCustomURL.Visible = chkShowGravatars.Checked - End Sub - - Private Sub cmdUpdateOptions_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdUpdateOptions.Click - Try - ' Update Settings - With BlogSettings - .EntryDescriptionRequired = chkForceDescription.Checked - .SummaryMaxLength = CInt(txtSummaryLimit.Text) - .SearchSummaryMaxLength = CInt(txtSearchLimit.Text) - .MaxImageWidth = CInt(txtMaxImageWidth.Text) - .RecentEntriesMax = CInt(txtRecentEntriesMax.Text) - .RecentRssEntriesMax = CInt(txtRecentRssEntriesMax.Text) - .EnableUploadOption = chkUploadOption.Checked - .ShowSummary = chkShowSummary.Checked - .ShowCommentTitle = chkShowCommentTitle.Checked - .AllowCommentAnchors = chkAllowCommentAnchors.Checked - .AllowCommentImages = chkAllowCommentImages.Checked - .AllowCommentFormatting = chkAllowCommentFormatting.Checked - .ShowUniqueTitle = chkShowUniqueTitle.Checked - .ShowSeoFriendlyUrl = chkShowSeoFriendlyUrl.Checked - .PageBlogs = CInt(cmbPageBlogs.SelectedItem.Value) - .EnableDNNSearch = chkEnableDNNSearch.Checked - .ShowGravatars = chkShowGravatars.Checked - .GravatarImageWidth = CInt(txtGravatarImageWidth.Text) - .GravatarRating = rblGravatarRating.SelectedValue - .GravatarDefaultImageUrl = rblDefaultImage.SelectedValue - .GravatarCustomUrl = txtGravatarDefaultImageCustomURL.Text - .ShowWebsite = chkShowWebsite.Checked() - .ShowSocialBookmarks = chkEnableBookmarks.Checked - .EnforceSummaryTruncation = chkEnforceSummaryTruncation.Checked - .IncludeBody = chkIncludeBody.Checked - .IncludeCategoriesInDescription = chkIncludeCategoriesInDescription.Checked - .IncludeTagsInDescription = chkIncludeTagsInDescription.Checked - .AllowSummaryHtml = chkAllowSummaryHtml.Checked - .FeedCacheTime = CInt(txtFeedCacheTime.Text.Trim) - .AllowChildBlogs = chkAllowChildBlogs.Checked - .EnableArchiveDropDown = chkEnableArchiveDropDown.Checked - .AllowWLW = chkAllowWLW.Checked - .AllowMultipleCategories = chkAllowMultipleCategories.Checked - .UseWLWExcerpt = chkUseWLWExcerpt.Checked - - ' additional files - Dim fileList As String = "" - For Each itm As ListItem In cblHostFiles.Items - If itm.Selected Then - fileList &= "[H]" & itm.Value & ";" - End If - Next - For Each itm As ListItem In cblPortalFiles.Items - If itm.Selected Then - fileList &= "[P]" & itm.Value & ";" - End If - Next - .IncludeFiles = fileList - .AddJQuery = chkAddJQuery.Checked - - .UpdateSettings() - End With - - Response.Redirect(NavigateURL(), True) - Catch exc As Exception 'Module failed to load - ProcessModuleLoadException(Me, exc) - End Try - End Sub - - Private Sub cmdCancelOptions_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdCancelOptions.Click - Try - Response.Redirect(NavigateURL(), True) - Catch exc As Exception 'Module failed to load - ProcessModuleLoadException(Me, exc) - End Try - End Sub - - Private Sub chkForceDescription_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkForceDescription.CheckedChanged - Me.trSummary.Visible = Not chkForceDescription.Checked - Me.trSearchSummary.Visible = Not chkForceDescription.Checked - End Sub - - Private Sub cmdGenerateLinks_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdGenerateLinks.Click - Utility.CreateAllEntryLinks(PortalId, , TabId) - End Sub - - Private Sub cmdMigrateChildblogs_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdMigrateChildblogs.Click - - ' get sql - Dim assembly As Reflection.Assembly = Reflection.Assembly.GetExecutingAssembly() - Dim sql As String = "" - Using stream As IO.Stream = assembly.GetManifestResourceStream("DotNetNuke.Modules.Blog.ChildblogsToCategories.sql") - Using rdr As New IO.StreamReader(stream) - sql = rdr.ReadToEnd - End Using - End Using - sql = sql.Replace("@portalid", PortalId.ToString) - - ' run the script - Dim res As String = DotNetNuke.Data.DataProvider.Instance().ExecuteScript(sql, False) - - ' run through all categories to make sure the slug is correctly set - For Each c As CategoryInfo In CategoryController.ListCategories(PortalId).Values - CategoryController.UpdateCategory(c.CatId, c.Category, c.ParentId) - Next - - ' recalculate child blogs - Dim totalBlogs As Integer = (New BlogController).ListBlogsByPortal(PortalId, True).Count - Dim parentBlogs As Integer = (New BlogController).ListBlogsRootByPortal(PortalId).Count - lblChildBlogsStatus.Text = String.Format(GetString("lblChildBlogsStatus", LocalResourceFile), CInt(totalBlogs - parentBlogs)) - - End Sub + + End Sub #End Region #Region " Private Methods " - Private Sub AddFolderToList(ByRef cbList As CheckBoxList, ByVal fullPath As String, ByVal relativePath As String) - If Not IO.Directory.Exists(fullPath) Then Exit Sub - Dim baseDir As New IO.DirectoryInfo(fullPath) - For Each d As IO.DirectoryInfo In baseDir.GetDirectories() - AddFolderToList(cbList, d.FullName, relativePath & d.Name & "/") - Next - For Each f As IO.FileInfo In baseDir.GetFiles() - cbList.Items.Add(New ListItem(relativePath & f.Name, relativePath & f.Name)) - Next - End Sub + Private Sub AddFolderToList(ByRef cbList As CheckBoxList, ByVal fullPath As String, ByVal relativePath As String) + If Not IO.Directory.Exists(fullPath) Then Exit Sub + Dim baseDir As New IO.DirectoryInfo(fullPath) + For Each d As IO.DirectoryInfo In baseDir.GetDirectories() + AddFolderToList(cbList, d.FullName, relativePath & d.Name & "/") + Next + For Each f As IO.FileInfo In baseDir.GetFiles() + cbList.Items.Add(New ListItem(relativePath & f.Name, relativePath & f.Name)) + Next + End Sub #End Region End Class