+
\ No newline at end of file
diff --git a/Archives.ascx.designer.vb b/Archives.ascx.designer.vb
new file mode 100755
index 0000000..ff4a131
--- /dev/null
+++ b/Archives.ascx.designer.vb
@@ -0,0 +1,152 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+Namespace Ventrian.NewsArticles
+
+ Partial Public Class Archives
+
+ '''
+ '''Header1 control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents Header1 As Global.Ventrian.NewsArticles.ucHeader
+
+ '''
+ '''phCurrentArticles control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents phCurrentArticles As Global.System.Web.UI.WebControls.PlaceHolder
+
+ '''
+ '''lblCurrentArticles control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents lblCurrentArticles As Global.System.Web.UI.WebControls.Label
+
+ '''
+ '''phArchives control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents phArchives As Global.System.Web.UI.WebControls.PlaceHolder
+
+ '''
+ '''lblLatest control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents lblLatest As Global.System.Web.UI.WebControls.Label
+
+ '''
+ '''phCategory control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents phCategory As Global.System.Web.UI.WebControls.PlaceHolder
+
+ '''
+ '''lblByCategory control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents lblByCategory As Global.System.Web.UI.WebControls.Label
+
+ '''
+ '''rptCategories control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents rptCategories As Global.System.Web.UI.WebControls.Repeater
+
+ '''
+ '''phAuthor control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents phAuthor As Global.System.Web.UI.WebControls.PlaceHolder
+
+ '''
+ '''lblByAuthor control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents lblByAuthor As Global.System.Web.UI.WebControls.Label
+
+ '''
+ '''rptAuthors control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents rptAuthors As Global.System.Web.UI.WebControls.Repeater
+
+ '''
+ '''phMonth control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents phMonth As Global.System.Web.UI.WebControls.PlaceHolder
+
+ '''
+ '''lblByMonth control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents lblByMonth As Global.System.Web.UI.WebControls.Label
+
+ '''
+ '''rptMonth control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents rptMonth As Global.System.Web.UI.WebControls.Repeater
+
+ '''
+ '''Header2 control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents Header2 As Global.Ventrian.NewsArticles.ucHeader
+ End Class
+End Namespace
diff --git a/Archives.ascx.vb b/Archives.ascx.vb
new file mode 100755
index 0000000..5093445
--- /dev/null
+++ b/Archives.ascx.vb
@@ -0,0 +1,310 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports DotNetNuke.Common.Utilities
+Imports DotNetNuke.Services.Exceptions
+Imports DotNetNuke.Security
+
+Imports Ventrian.NewsArticles.Base
+
+Namespace Ventrian.NewsArticles
+
+ Partial Public Class Archives
+ Inherits NewsArticleModuleBase
+
+#Region " Protected Properties "
+
+ Protected ReadOnly Property AuthorID() As Integer
+ Get
+ Dim id As Integer = Null.NullInteger
+ If (ArticleSettings.AuthorUserIDFilter) Then
+ If (Request.QueryString(ArticleSettings.AuthorUserIDParam) <> "") Then
+ Try
+ id = Convert.ToInt32(Request.QueryString(ArticleSettings.AuthorUserIDParam))
+ Catch
+ End Try
+ End If
+ End If
+
+ If (ArticleSettings.AuthorUsernameFilter) Then
+ If (Request.QueryString(ArticleSettings.AuthorUsernameParam) <> "") Then
+ Try
+ Dim objUser As DotNetNuke.Entities.Users.UserInfo = DotNetNuke.Entities.Users.UserController.GetUserByName(Me.PortalId, Request.QueryString(ArticleSettings.AuthorUsernameParam))
+ If (objUser IsNot Nothing) Then
+ id = objUser.UserID
+ End If
+ Catch
+ End Try
+ End If
+ End If
+
+ If (ArticleSettings.AuthorLoggedInUserFilter) Then
+ If (Request.IsAuthenticated) Then
+ id = Me.UserId
+ Else
+ id = -100
+ End If
+ End If
+
+ If (ArticleSettings.Author <> Null.NullInteger) Then
+ id = ArticleSettings.Author
+ End If
+
+ Return id
+ End Get
+ End Property
+
+ Protected ReadOnly Property AuthorIDRSS() As String
+ Get
+ If (AuthorID <> Null.NullInteger) Then
+ Return "&AuthorID=" & AuthorID.ToString()
+ End If
+ Return ""
+ End Get
+ End Property
+
+#End Region
+
+#Region " Protected Methods "
+
+ Protected Function GetAuthorLink(ByVal authorID As Integer, ByVal username As String) As String
+
+ Return Common.GetAuthorLink(Me.TabId, Me.ModuleId, authorID, username, ArticleSettings.LaunchLinks, ArticleSettings)
+
+ End Function
+
+ Protected Function GetAuthorLinkRss(ByVal authorID As String) As String
+
+ Return Page.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/RSS.aspx?TabID=" & TabId.ToString() & "&ModuleID=" & ModuleId.ToString() & "&AuthorID=" & authorID)
+
+ End Function
+
+ Protected Function GetCategoryLink(ByVal categoryID As String, ByVal name As String) As String
+
+ Return Common.GetCategoryLink(Me.TabId, Me.ModuleId, categoryID, name, ArticleSettings.LaunchLinks, ArticleSettings)
+
+ End Function
+
+ Protected Function GetCategoryLinkRss(ByVal categoryID As String) As String
+
+ Return Page.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/RSS.aspx?TabID=" & TabId.ToString() & "&ModuleID=" & ModuleId.ToString() & "&CategoryID=" & categoryID & AuthorIDRSS)
+
+ End Function
+
+ Protected Function GetCurrentLinkRss() As String
+
+ Return Page.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/RSS.aspx?TabID=" & TabId.ToString() & "&ModuleID=" & ModuleId.ToString() & "&MaxCount=25" & AuthorIDRSS)
+
+ End Function
+
+ Protected Function GetCurrentLink() As String
+
+ Return Common.GetModuleLink(TabId, ModuleId, "", ArticleSettings)
+
+ End Function
+
+ Protected Function GetMonthLink(ByVal month As Integer, ByVal year As Integer) As String
+
+ Return Common.GetModuleLink(Me.TabId, Me.ModuleId, "ArchiveView", ArticleSettings, "month=" & month.ToString(), "year=" & year.ToString())
+
+ End Function
+
+ Protected Function GetMonthLinkRss(ByVal month As Integer, ByVal year As Integer) As String
+
+ Return Page.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/RSS.aspx?TabID=" & TabId.ToString() & "&ModuleID=" & ModuleId.ToString() & "&Month=" & month.ToString() & "&Year=" & year.ToString() & AuthorIDRSS)
+
+ End Function
+
+ Protected Function GetMonthName(ByVal month As Integer) As String
+
+ Dim dt As New DateTime(2008, month, 1)
+ Return dt.ToString("MMMM")
+
+ End Function
+
+ Protected Function GetRssPath() As String
+
+ Return Page.ResolveUrl(ArticleSettings.SyndicationImagePath)
+
+ End Function
+
+ Protected Function IsSyndicationEnabled() As Boolean
+
+ Return ArticleSettings.IsSyndicationEnabled
+
+ End Function
+
+#End Region
+
+#Region " Event Handlers "
+
+ Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
+
+ Try
+
+ Dim objCategoryController As New CategoryController
+ If (ArticleSettings.FilterSingleCategory <> Null.NullInteger) Then
+ Dim categoriesToDisplay(1) As Integer
+ categoriesToDisplay(1) = ArticleSettings.FilterSingleCategory
+
+ rptCategories.DataSource = objCategoryController.GetCategoriesAll(Me.ModuleId, Null.NullInteger, categoriesToDisplay, AuthorID, Null.NullInteger, ArticleSettings.ShowPending, ArticleSettings.CategorySortType)
+ rptCategories.DataBind()
+ Else
+ Dim objCategoriesSelected As New List(Of CategoryInfo)
+ Dim objCategoriesDisplay As List(Of CategoryInfo) = objCategoryController.GetCategoriesAll(Me.ModuleId, Null.NullInteger, ArticleSettings.FilterCategories, AuthorID, Null.NullInteger, ArticleSettings.ShowPending, ArticleSettings.CategorySortType)
+ For Each objCategory As CategoryInfo In objCategoriesDisplay
+ If (objCategory.InheritSecurity) Then
+ objCategoriesSelected.Add(objCategory)
+ Else
+ If (Request.IsAuthenticated) Then
+ If (Settings.Contains(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING)) Then
+ If (PortalSecurity.IsInRoles(Settings(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING).ToString())) Then
+ objCategoriesSelected.Add(objCategory)
+ End If
+ End If
+ End If
+ End If
+ Next
+
+ rptCategories.DataSource = objCategoriesSelected
+ rptCategories.DataBind()
+ End If
+
+ Dim objCategories As List(Of CategoryInfo) = objCategoryController.GetCategoriesAll(ModuleId, Null.NullInteger)
+
+ Dim excludeCategoriesRestrictive As New List(Of Integer)
+
+ For Each objCategory As CategoryInfo In objCategories
+ If (objCategory.InheritSecurity = False And objCategory.CategorySecurityType = CategorySecurityType.Restrict) Then
+ If (Request.IsAuthenticated) Then
+ If (Settings.Contains(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING)) Then
+ If (PortalSecurity.IsInRoles(Settings(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING).ToString()) = False) Then
+ excludeCategoriesRestrictive.Add(objCategory.CategoryID)
+ End If
+ End If
+ Else
+ excludeCategoriesRestrictive.Add(objCategory.CategoryID)
+ End If
+ End If
+ Next
+
+ Dim excludeCategories As New List(Of Integer)
+
+ For Each objCategory As CategoryInfo In objCategories
+ If (objCategory.InheritSecurity = False And objCategory.CategorySecurityType = CategorySecurityType.Loose) Then
+ If (Request.IsAuthenticated) Then
+ If (Settings.Contains(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING)) Then
+ If (PortalSecurity.IsInRoles(Settings(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING).ToString()) = False) Then
+ excludeCategories.Add(objCategory.CategoryID)
+ End If
+ End If
+ Else
+ excludeCategories.Add(objCategory.CategoryID)
+ End If
+ End If
+ Next
+
+ Dim filterCategories As Integer() = ArticleSettings.FilterCategories
+ Dim includeCategories As New List(Of Integer)
+
+ If (excludeCategories.Count > 0) Then
+
+ For Each objCategoryToInclude As CategoryInfo In objCategories
+
+ Dim includeCategory As Boolean = True
+
+ For Each exclCategory As Integer In excludeCategories
+ If (exclCategory = objCategoryToInclude.CategoryID) Then
+ includeCategory = False
+ End If
+ Next
+
+ If (ArticleSettings.FilterCategories IsNot Nothing) Then
+ If (ArticleSettings.FilterCategories.Length > 0) Then
+ Dim filter As Boolean = False
+ For Each cat As Integer In ArticleSettings.FilterCategories
+ If (cat = objCategoryToInclude.CategoryID) Then
+ filter = True
+ End If
+ Next
+ If (filter = False) Then
+ includeCategory = False
+ End If
+ End If
+ End If
+
+ If (includeCategory) Then
+ includeCategories.Add(objCategoryToInclude.CategoryID)
+ End If
+
+ Next
+
+ If (includeCategories.Count > 0) Then
+ includeCategories.Add(-1)
+ End If
+
+ filterCategories = includeCategories.ToArray()
+
+ End If
+
+
+ If (ArticleSettings.FilterSingleCategory <> Null.NullInteger) Then
+ Dim categoriesToDisplay(1) As Integer
+ categoriesToDisplay(1) = ArticleSettings.FilterSingleCategory
+
+ Dim objAuthorController As New AuthorController
+ rptAuthors.DataSource = objAuthorController.GetAuthorStatistics(Me.ModuleId, categoriesToDisplay, excludeCategoriesRestrictive.ToArray(), AuthorID, "DisplayName", ArticleSettings.ShowPending)
+ rptAuthors.DataBind()
+ Else
+ Dim objAuthorController As New AuthorController
+ rptAuthors.DataSource = objAuthorController.GetAuthorStatistics(Me.ModuleId, filterCategories, excludeCategoriesRestrictive.ToArray(), AuthorID, "DisplayName", ArticleSettings.ShowPending)
+ rptAuthors.DataBind()
+ End If
+
+ If (ArticleSettings.FilterSingleCategory <> Null.NullInteger) Then
+ Dim categoriesToDisplay(1) As Integer
+ categoriesToDisplay(1) = ArticleSettings.FilterSingleCategory
+ Dim objArticleController As New ArticleController
+ rptMonth.DataSource = objArticleController.GetNewsArchive(Me.ModuleId, categoriesToDisplay, excludeCategoriesRestrictive.ToArray(), AuthorID, GroupByType.Month, ArticleSettings.ShowPending)
+ rptMonth.DataBind()
+ Else
+ Dim objArticleController As New ArticleController
+ rptMonth.DataSource = objArticleController.GetNewsArchive(Me.ModuleId, filterCategories, excludeCategoriesRestrictive.ToArray(), AuthorID, GroupByType.Month, ArticleSettings.ShowPending)
+ rptMonth.DataBind()
+ End If
+
+ Me.BasePage.Title = "Archives | " & Me.BasePage.Title
+
+ Catch exc As Exception 'Module failed to load
+ ProcessModuleLoadException(Me, exc)
+ End Try
+
+ End Sub
+
+ Private Sub Page_PreRender(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.PreRender
+
+ Try
+
+ LoadStyleSheet()
+
+ phCurrentArticles.Visible = ArticleSettings.ArchiveCurrentArticles
+ phCategory.Visible = ArticleSettings.ArchiveCategories
+ phAuthor.Visible = ArticleSettings.ArchiveAuthor
+ phMonth.Visible = ArticleSettings.ArchiveMonth
+
+ phArchives.Visible = IsSyndicationEnabled()
+
+ Catch exc As Exception 'Module failed to load
+ ProcessModuleLoadException(Me, exc)
+ End Try
+
+ End Sub
+
+#End Region
+
+ End Class
+
+End Namespace
\ No newline at end of file
diff --git a/Base/NewsArticleControlBase.vb b/Base/NewsArticleControlBase.vb
new file mode 100755
index 0000000..dd9ba27
--- /dev/null
+++ b/Base/NewsArticleControlBase.vb
@@ -0,0 +1,34 @@
+Namespace Ventrian.NewsArticles.Base
+
+ Public Class NewsArticleControlBase
+
+ Inherits UserControl
+
+#Region " Private Members "
+
+ Private _articleID As Integer
+
+#End Region
+
+#Region " Public Properties "
+
+ Public Property ArticleID() As Integer
+ Get
+ Return _articleID
+ End Get
+ Set(ByVal value As Integer)
+ _articleID = value
+ End Set
+ End Property
+
+ Protected ReadOnly Property ArticleModuleBase() As NewsArticleModuleBase
+ Get
+ Return CType(Parent, NewsArticleModuleBase)
+ End Get
+ End Property
+
+#End Region
+
+ End Class
+
+End Namespace
diff --git a/Base/NewsArticleModuleBase.vb b/Base/NewsArticleModuleBase.vb
new file mode 100755
index 0000000..3b00ee9
--- /dev/null
+++ b/Base/NewsArticleModuleBase.vb
@@ -0,0 +1,409 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.ComponentModel
+Imports System.Text.RegularExpressions
+Imports System.Web
+Imports System.Web.UI
+Imports System.Web.UI.HtmlControls
+Imports System.Xml
+
+Imports DotNetNuke.Common
+Imports DotNetNuke.Common.Utilities
+Imports DotNetNuke.Entities.Modules
+Imports DotNetNuke.Security
+Imports DotNetNuke.Services.Localization
+
+Namespace Ventrian.NewsArticles.Base
+
+ Public Class NewsArticleModuleBase
+
+ Inherits PortalModuleBase
+
+#Region " Private Members "
+
+ Private _articleSettings As ArticleSettings
+
+#End Region
+
+#Region " Public Properties "
+
+ _
+ Public ReadOnly Property BasePage() As DotNetNuke.Framework.CDefault
+ Get
+ Return CType(Page, DotNetNuke.Framework.CDefault)
+ End Get
+ End Property
+
+ Public ReadOnly Property ArticleSettings() As ArticleSettings
+ Get
+ If (_articleSettings Is Nothing) Then
+ Try
+ _articleSettings = New ArticleSettings(Settings, PortalSettings, ModuleConfiguration)
+ Catch
+ Dim objModuleController As New ModuleController()
+
+ Dim objSettings As Hashtable = objModuleController.GetModuleSettings(ModuleId)
+ Dim objTabSettings As Hashtable = objModuleController.GetTabModuleSettings(TabModuleId)
+
+ For Each item As DictionaryEntry In objTabSettings
+ If (objSettings.ContainsKey(item.Key) = False) Then
+ objSettings.Add(item.Key, item.Value)
+ End If
+ Next
+
+ _articleSettings = New ArticleSettings(objSettings, PortalSettings, ModuleConfiguration)
+ objModuleController.UpdateModuleSetting(ModuleId, "ResetArticleSettings", "true")
+ End Try
+ End If
+ Return _articleSettings
+ End Get
+ End Property
+
+ Public ReadOnly Property ModuleKey() As String
+ Get
+ Return "NewsArticles-" & TabModuleId
+ End Get
+ End Property
+
+#End Region
+
+#Region " Protected Methods "
+
+ Protected Function EditArticleUrl(ByVal ctl As String) As String
+
+ If (ArticleSettings.AuthorUserIDFilter) Then
+ If (ArticleSettings.AuthorUserIDParam <> "") Then
+ If (HttpContext.Current.Request(ArticleSettings.AuthorUserIDParam) <> "") Then
+ Return EditUrl(ArticleSettings.AuthorUserIDParam, HttpContext.Current.Request(ArticleSettings.AuthorUserIDParam), ctl)
+ End If
+ End If
+ End If
+
+ If (ArticleSettings.AuthorUsernameFilter) Then
+ If (ArticleSettings.AuthorUsernameParam <> "") Then
+ If (HttpContext.Current.Request(ArticleSettings.AuthorUsernameParam) <> "") Then
+ Return EditUrl(ArticleSettings.AuthorUsernameParam, HttpContext.Current.Request(ArticleSettings.AuthorUsernameParam), ctl)
+ End If
+ End If
+ End If
+
+ Return EditUrl(ctl)
+
+ End Function
+
+ Protected Function EditArticleUrl(ByVal ctl As String, ByVal ParamArray params() As String) As String
+
+ Dim parameters As New List(Of String)
+
+ parameters.Add("mid=" & ModuleId.ToString())
+ parameters.AddRange(params)
+
+ If (ArticleSettings.AuthorUserIDFilter) Then
+ If (ArticleSettings.AuthorUserIDParam <> "") Then
+ If (HttpContext.Current.Request(ArticleSettings.AuthorUserIDParam) <> "") Then
+ parameters.Add(ArticleSettings.AuthorUserIDParam & "=" & HttpContext.Current.Request(ArticleSettings.AuthorUserIDParam))
+ End If
+ End If
+ End If
+
+ If (ArticleSettings.AuthorUsernameFilter) Then
+ If (ArticleSettings.AuthorUsernameParam <> "") Then
+ If (HttpContext.Current.Request(ArticleSettings.AuthorUsernameParam) <> "") Then
+ parameters.Add(ArticleSettings.AuthorUsernameParam & "=" & HttpContext.Current.Request(ArticleSettings.AuthorUsernameParam))
+ End If
+ End If
+ End If
+
+ Return NavigateURL(TabId, ctl, parameters.ToArray)
+
+ End Function
+
+ Public Sub LoadStyleSheet()
+
+
+ Dim objCSS As Control = BasePage.FindControl("CSS")
+
+ If Not (objCSS Is Nothing) Then
+ Dim objLink As New HtmlLink()
+ objLink.ID = "Template_" & ModuleId.ToString()
+ objLink.Attributes("rel") = "stylesheet"
+ objLink.Attributes("type") = "text/css"
+ objLink.Href = Page.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Templates/" & _articleSettings.Template & "/Template.css")
+
+ objCSS.Controls.AddAt(0, objLink)
+ End If
+
+ End Sub
+
+ Public Function GetSkinAttribute(ByVal xDoc As XmlDocument, ByVal tag As String, ByVal attrib As String, ByVal defaultValue As String) As String
+ Dim retValue As String = defaultValue
+ Dim xmlSkinAttributeRoot As XmlNode = xDoc.SelectSingleNode("descendant::Object[Token='[" & tag & "]']")
+ ' if the token is found
+ If Not xmlSkinAttributeRoot Is Nothing Then
+ ' process each token attribute
+ Dim xmlSkinAttribute As XmlNode
+ For Each xmlSkinAttribute In xmlSkinAttributeRoot.SelectNodes(".//Settings/Setting")
+ If xmlSkinAttribute.SelectSingleNode("Value").InnerText <> "" Then
+ ' append the formatted attribute to the inner contents of the control statement
+ If xmlSkinAttribute.SelectSingleNode("Name").InnerText = attrib Then
+ retValue = xmlSkinAttribute.SelectSingleNode("Value").InnerText
+ End If
+ End If
+ Next
+ End If
+ Return retValue
+ End Function
+
+
+ Protected Function FormatImageUrl(ByVal imageUrlResolved As String) As String
+
+ Return PortalSettings.HomeDirectory & imageUrlResolved
+
+ End Function
+
+ Protected Function IsRated(ByVal objArticle As ArticleInfo) As Boolean
+
+ If (objArticle.Rating = Null.NullDouble) Then
+ Return False
+ Else
+ Return True
+ End If
+
+ End Function
+
+ Protected Function IsRated(ByVal objDataItem As Object) As Boolean
+
+ Dim objArticle As ArticleInfo = CType(objDataItem, ArticleInfo)
+
+ Return IsRated(objArticle)
+
+ End Function
+
+ Protected Function GetRatingImage(ByVal objArticle As ArticleInfo) As String
+
+ If (objArticle.Rating = Null.NullDouble) Then
+ Return ResolveUrl("Images\Rating\stars-0-0.gif")
+ Else
+
+ Select Case RoundToUnit(objArticle.Rating, 0.5, False)
+
+ Case 1
+ Return ResolveUrl("Images\Rating\stars-1-0.gif")
+
+ Case 1.5
+ Return ResolveUrl("Images\Rating\stars-1-5.gif")
+
+ Case 2
+ Return ResolveUrl("Images\Rating\stars-2-0.gif")
+
+ Case 2.5
+ Return ResolveUrl("Images\Rating\stars-2-5.gif")
+
+ Case 3
+ Return ResolveUrl("Images\Rating\stars-3-0.gif")
+
+ Case 3.5
+ Return ResolveUrl("Images\Rating\stars-3-5.gif")
+
+ Case 4
+ Return ResolveUrl("Images\Rating\stars-4-0.gif")
+
+ Case 4.5
+ Return ResolveUrl("Images\Rating\stars-4-5.gif")
+
+ Case 5
+ Return ResolveUrl("Images\Rating\stars-5-0.gif")
+
+ End Select
+
+ Return ResolveUrl("Images\Rating\stars-0-0.gif")
+
+ End If
+
+ End Function
+ Protected Function StripHtml(ByVal html As String) As String
+
+ Const pattern As String = "<(.|\n)*?>"
+ Return Regex.Replace(html, pattern, String.Empty)
+
+ End Function
+
+
+ Private Function RoundToUnit(ByVal d As Double, ByVal unit As Double, ByVal roundDown As Boolean) As Double
+
+ If (roundDown) Then
+ Return Math.Round(Math.Round((d / unit) - 0.5, 0) * unit, 2)
+ Else
+ Return Math.Round(Math.Round((d / unit) + 0.5, 0) * unit, 2)
+ End If
+
+ End Function
+
+ Protected Function GetRatingImage(ByVal objDataItem As Object) As String
+
+ Dim objArticle As ArticleInfo = CType(objDataItem, ArticleInfo)
+
+ Return GetRatingImage(objArticle)
+
+ End Function
+
+ Protected Function GetUserName(ByVal dataItem As Object) As String
+
+ Dim objArticle As ArticleInfo = CType(dataItem, ArticleInfo)
+
+ If Not (objArticle Is Nothing) Then
+
+ Select Case ArticleSettings.DisplayMode
+
+ Case DisplayType.UserName
+ Return objArticle.AuthorUserName
+
+ Case DisplayType.FirstName
+ Return objArticle.AuthorFirstName
+
+ Case DisplayType.LastName
+ Return objArticle.AuthorLastName
+
+ Case DisplayType.FullName
+ Return objArticle.AuthorFullName
+
+ End Select
+
+ End If
+
+ Return Null.NullString
+
+ End Function
+
+ Protected Function GetUserName(ByVal dataItem As Object, ByVal type As Integer) As String
+
+ Dim objArticle As ArticleInfo = CType(dataItem, ArticleInfo)
+
+ If Not (objArticle Is Nothing) Then
+
+ Select Case type
+
+ Case 1 'Last Updated
+
+ Select Case ArticleSettings.DisplayMode
+
+ Case DisplayType.UserName
+ Return objArticle.LastUpdateUserName
+
+ Case DisplayType.FirstName
+ Return objArticle.LastUpdateFirstName
+
+ Case DisplayType.LastName
+ Return objArticle.LastUpdateLastName
+
+ Case DisplayType.FullName
+ Return objArticle.LastUpdateDisplayName
+
+ End Select
+
+ Case Else
+
+ Select Case ArticleSettings.DisplayMode
+
+ Case DisplayType.UserName
+ Return objArticle.AuthorUserName
+
+ Case DisplayType.FirstName
+ Return objArticle.AuthorFirstName
+
+ Case DisplayType.LastName
+ Return objArticle.AuthorLastName
+
+ Case DisplayType.FullName
+ Return objArticle.AuthorDisplayName
+
+ End Select
+
+ End Select
+
+ End If
+
+ Return Null.NullString
+
+ End Function
+
+ Protected Function HasEditRights(ByVal articleId As Integer, ByVal moduleID As Integer, ByVal tabID As Integer) As Boolean
+
+ ' Unauthenticated User
+ '
+ If (Request.IsAuthenticated = False) Then
+
+ Return False
+
+ End If
+
+ Dim objModuleController As ModuleController = New ModuleController
+
+ Dim objModule As ModuleInfo = objModuleController.GetModule(moduleID, tabID)
+
+ If Not (objModule Is Nothing) Then
+
+ ' Admin of Module
+ '
+ If (PortalSecurity.HasEditPermissions(objModule.ModulePermissions)) Then
+
+ Return True
+
+ End If
+
+ End If
+
+
+ ' Approver
+ '
+ If (ArticleSettings.IsApprover) Then
+ Return True
+ End If
+
+ ' Submitter of New Article
+ '
+ If (articleId = Null.NullInteger And ArticleSettings.IsSubmitter) Then
+ Return True
+ End If
+
+ ' Owner of Article
+ '
+ Dim objArticleController As ArticleController = New ArticleController
+ Dim objArticle As ArticleInfo = objArticleController.GetArticle(articleId)
+ If Not (objArticle Is Nothing) Then
+ If (objArticle.AuthorID = UserId And (objArticle.Status = StatusType.Draft Or ArticleSettings.IsAutoApprover)) Then
+ Return True
+ End If
+ End If
+
+ Return False
+
+ End Function
+
+ Public Function GetSharedResource(ByVal key As String) As String
+
+ Dim path As String = "~/DesktopModules/DnnForge - NewsArticles/" & Localization.LocalResourceDirectory & "/" & Localization.LocalSharedResourceFile
+ Return Localization.GetString(key, path)
+
+ End Function
+
+#End Region
+
+#Region " Shadowed Methods "
+
+ Public Shadows Function ResolveUrl(ByVal url As String) As String
+
+ Return MyBase.ResolveUrl(url).Replace(" ", "%20")
+
+ End Function
+
+#End Region
+
+ End Class
+
+End Namespace
diff --git a/Components/Archives/ArchiveInfo.vb b/Components/Archives/ArchiveInfo.vb
new file mode 100755
index 0000000..20fcb62
--- /dev/null
+++ b/Components/Archives/ArchiveInfo.vb
@@ -0,0 +1,63 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2005-2012
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Namespace Ventrian.NewsArticles
+
+ Public Class ArchiveInfo
+
+#Region " Private Methods "
+
+ ' local property declarations
+ Dim _day As Integer
+ Dim _month As Integer
+ Dim _year As Integer
+ Dim _count As Integer
+
+#End Region
+
+#Region " Public Properties "
+
+ Public Property Day() As Integer
+ Get
+ Return _day
+ End Get
+ Set(ByVal Value As Integer)
+ _day = Value
+ End Set
+ End Property
+
+ Public Property Month() As Integer
+ Get
+ Return _month
+ End Get
+ Set(ByVal Value As Integer)
+ _month = Value
+ End Set
+ End Property
+
+ Public Property Year() As Integer
+ Get
+ Return _year
+ End Get
+ Set(ByVal Value As Integer)
+ _year = Value
+ End Set
+ End Property
+
+ Public Property Count() As Integer
+ Get
+ Return _count
+ End Get
+ Set(ByVal Value As Integer)
+ _count = Value
+ End Set
+ End Property
+
+#End Region
+
+ End Class
+
+End Namespace
\ No newline at end of file
diff --git a/Components/Archives/ArchiveModeType.vb b/Components/Archives/ArchiveModeType.vb
new file mode 100755
index 0000000..364e2d3
--- /dev/null
+++ b/Components/Archives/ArchiveModeType.vb
@@ -0,0 +1,17 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2005-2012
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Namespace Ventrian.NewsArticles
+
+ Public Enum ArchiveModeType
+
+ [Date]
+ Category
+ Author
+
+ End Enum
+
+End Namespace
diff --git a/Components/Archives/ArchiveSettings.vb b/Components/Archives/ArchiveSettings.vb
new file mode 100755
index 0000000..d0b2a32
--- /dev/null
+++ b/Components/Archives/ArchiveSettings.vb
@@ -0,0 +1,293 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2005-2012
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Namespace Ventrian.NewsArticles
+
+ Friend Class ArchiveSettings
+
+#Region " Private Properties "
+
+ Private Property Settings As Hashtable
+
+#End Region
+
+#Region " Constructors "
+
+ Public Sub New(ByVal moduleSettings As Hashtable)
+ Settings = moduleSettings
+ End Sub
+
+#End Region
+
+#Region " Public Properties "
+
+ Public ReadOnly Property AuthorSortBy As AuthorSortByType
+ Get
+ If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_AUTHOR_SORT_BY)) Then
+ Return CType(System.Enum.Parse(GetType(AuthorSortByType), Settings(ArticleConstants.NEWS_ARCHIVES_AUTHOR_SORT_BY).ToString()), AuthorSortByType)
+ End If
+ Return ArticleConstants.NEWS_ARCHIVES_AUTHOR_SORT_BY_DEFAULT
+ End Get
+ End Property
+
+ Public ReadOnly Property CategoryHideZeroCategories As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_HIDE_ZERO_CATEGORIES)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.NEWS_ARCHIVES_HIDE_ZERO_CATEGORIES).ToString())
+ End If
+ Return ArticleConstants.NEWS_ARCHIVES_HIDE_ZERO_CATEGORIES_DEFAULT
+ End Get
+ End Property
+
+ Public ReadOnly Property CategoryMaxDepth As Integer
+ Get
+ If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_MAX_DEPTH)) Then
+ If (IsNumeric(Settings(ArticleConstants.NEWS_ARCHIVES_MAX_DEPTH).ToString())) Then
+ Return Convert.ToInt32(Settings(ArticleConstants.NEWS_ARCHIVES_MAX_DEPTH).ToString())
+ End If
+ End If
+ Return ArticleConstants.NEWS_ARCHIVES_MAX_DEPTH_DEFAULT
+ End Get
+ End Property
+
+ Public ReadOnly Property CategoryParent As Integer
+ Get
+ If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_PARENT_CATEGORY)) Then
+ If (IsNumeric(Settings(ArticleConstants.NEWS_ARCHIVES_PARENT_CATEGORY).ToString())) Then
+ Return Convert.ToInt32(Settings(ArticleConstants.NEWS_ARCHIVES_PARENT_CATEGORY).ToString())
+ End If
+ End If
+ Return ArticleConstants.NEWS_ARCHIVES_PARENT_CATEGORY_DEFAULT
+ End Get
+ End Property
+
+ Public ReadOnly Property GroupBy As GroupByType
+ Get
+ If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_GROUP_BY)) Then
+ Return CType(System.Enum.Parse(GetType(GroupByType), Settings(ArticleConstants.NEWS_ARCHIVES_GROUP_BY).ToString()), GroupByType)
+ End If
+ Return ArticleConstants.NEWS_ARCHIVES_GROUP_BY_DEFAULT
+ End Get
+ End Property
+
+ Public ReadOnly Property ItemsPerRow As Integer
+ Get
+ If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_ITEMS_PER_ROW)) Then
+ If (IsNumeric(Settings(ArticleConstants.NEWS_ARCHIVES_ITEMS_PER_ROW).ToString())) Then
+ Return Convert.ToInt32(Settings(ArticleConstants.NEWS_ARCHIVES_ITEMS_PER_ROW).ToString())
+ End If
+ End If
+ Return ArticleConstants.NEWS_ARCHIVES_ITEMS_PER_ROW_DEFAULT
+ End Get
+ End Property
+
+ Public ReadOnly Property LayoutMode As LayoutModeType
+ Get
+ If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_LAYOUT_MODE)) Then
+ Return CType(System.Enum.Parse(GetType(LayoutModeType), Settings(ArticleConstants.NEWS_ARCHIVES_LAYOUT_MODE).ToString()), LayoutModeType)
+ End If
+ Return ArticleConstants.NEWS_ARCHIVES_LAYOUT_MODE_DEFAULT
+ End Get
+ End Property
+
+ Public ReadOnly Property Mode As ArchiveModeType
+ Get
+ If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_MODE)) Then
+ Return CType(System.Enum.Parse(GetType(ArchiveModeType), Settings(ArticleConstants.NEWS_ARCHIVES_MODE).ToString()), ArchiveModeType)
+ End If
+ Return ArticleConstants.NEWS_ARCHIVES_MODE_DEFAULT
+ End Get
+ End Property
+
+ Public ReadOnly Property ModuleId As Integer
+ Get
+ If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_MODULE_ID)) Then
+ If (IsNumeric(Settings(ArticleConstants.NEWS_ARCHIVES_MODULE_ID).ToString())) Then
+ Return Convert.ToInt32(Settings(ArticleConstants.NEWS_ARCHIVES_MODULE_ID).ToString())
+ End If
+ End If
+ Return ArticleConstants.NEWS_ARCHIVES_MODULE_ID_DEFAULT
+ End Get
+ End Property
+
+ Public ReadOnly Property TabId As Integer
+ Get
+ If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_TAB_ID)) Then
+ If (IsNumeric(Settings(ArticleConstants.NEWS_ARCHIVES_TAB_ID).ToString())) Then
+ Return Convert.ToInt32(Settings(ArticleConstants.NEWS_ARCHIVES_TAB_ID).ToString())
+ End If
+ End If
+ Return ArticleConstants.NEWS_ARCHIVES_TAB_ID_DEFAULT
+ End Get
+ End Property
+
+ Public ReadOnly Property TemplateAuthorAdvancedBody
+ Get
+ If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_SETTING_AUTHOR_HTML_BODY_ADVANCED)) Then
+ Return Settings(ArticleConstants.NEWS_ARCHIVES_SETTING_AUTHOR_HTML_BODY_ADVANCED).ToString()
+ End If
+ Return ArticleConstants.NEWS_ARCHIVES_DEFAULT_AUTHOR_HTML_BODY_ADVANCED
+ End Get
+ End Property
+
+ Public ReadOnly Property TemplateAuthorAdvancedFooter
+ Get
+ If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_SETTING_AUTHOR_HTML_FOOTER_ADVANCED)) Then
+ Return Settings(ArticleConstants.NEWS_ARCHIVES_SETTING_AUTHOR_HTML_FOOTER_ADVANCED).ToString()
+ End If
+ Return ArticleConstants.NEWS_ARCHIVES_DEFAULT_AUTHOR_HTML_FOOTER_ADVANCED
+ End Get
+ End Property
+
+ Public ReadOnly Property TemplateAuthorAdvancedHeader
+ Get
+ If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_SETTING_AUTHOR_HTML_HEADER_ADVANCED)) Then
+ Return Settings(ArticleConstants.NEWS_ARCHIVES_SETTING_AUTHOR_HTML_HEADER_ADVANCED).ToString()
+ End If
+ Return ArticleConstants.NEWS_ARCHIVES_DEFAULT_AUTHOR_HTML_HEADER_ADVANCED
+ End Get
+ End Property
+
+ Public ReadOnly Property TemplateAuthorBody
+ Get
+ If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_SETTING_AUTHOR_HTML_BODY)) Then
+ Return Settings(ArticleConstants.NEWS_ARCHIVES_SETTING_AUTHOR_HTML_BODY).ToString()
+ End If
+ Return ArticleConstants.NEWS_ARCHIVES_DEFAULT_AUTHOR_HTML_BODY
+ End Get
+ End Property
+
+ Public ReadOnly Property TemplateAuthorFooter
+ Get
+ If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_SETTING_AUTHOR_HTML_FOOTER)) Then
+ Return Settings(ArticleConstants.NEWS_ARCHIVES_SETTING_AUTHOR_HTML_FOOTER).ToString()
+ End If
+ Return ArticleConstants.NEWS_ARCHIVES_DEFAULT_AUTHOR_HTML_FOOTER
+ End Get
+ End Property
+
+ Public ReadOnly Property TemplateAuthorHeader
+ Get
+ If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_SETTING_AUTHOR_HTML_HEADER)) Then
+ Return Settings(ArticleConstants.NEWS_ARCHIVES_SETTING_AUTHOR_HTML_HEADER).ToString()
+ End If
+ Return ArticleConstants.NEWS_ARCHIVES_DEFAULT_AUTHOR_HTML_HEADER
+ End Get
+ End Property
+
+ Public ReadOnly Property TemplateCategoryAdvancedBody
+ Get
+ If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_SETTING_CATEGORY_HTML_BODY_ADVANCED)) Then
+ Return Settings(ArticleConstants.NEWS_ARCHIVES_SETTING_CATEGORY_HTML_BODY_ADVANCED).ToString()
+ End If
+ Return ArticleConstants.NEWS_ARCHIVES_DEFAULT_CATEGORY_HTML_BODY_ADVANCED
+ End Get
+ End Property
+
+ Public ReadOnly Property TemplateCategoryAdvancedFooter
+ Get
+ If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_SETTING_CATEGORY_HTML_FOOTER_ADVANCED)) Then
+ Return Settings(ArticleConstants.NEWS_ARCHIVES_SETTING_CATEGORY_HTML_FOOTER_ADVANCED).ToString()
+ End If
+ Return ArticleConstants.NEWS_ARCHIVES_DEFAULT_CATEGORY_HTML_FOOTER_ADVANCED
+ End Get
+ End Property
+
+ Public ReadOnly Property TemplateCategoryAdvancedHeader
+ Get
+ If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_SETTING_CATEGORY_HTML_HEADER_ADVANCED)) Then
+ Return Settings(ArticleConstants.NEWS_ARCHIVES_SETTING_CATEGORY_HTML_HEADER_ADVANCED).ToString()
+ End If
+ Return ArticleConstants.NEWS_ARCHIVES_DEFAULT_CATEGORY_HTML_HEADER_ADVANCED
+ End Get
+ End Property
+
+ Public ReadOnly Property TemplateCategoryBody
+ Get
+ If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_SETTING_CATEGORY_HTML_BODY)) Then
+ Return Settings(ArticleConstants.NEWS_ARCHIVES_SETTING_CATEGORY_HTML_BODY).ToString()
+ End If
+ Return ArticleConstants.NEWS_ARCHIVES_DEFAULT_CATEGORY_HTML_BODY
+ End Get
+ End Property
+
+ Public ReadOnly Property TemplateCategoryFooter
+ Get
+ If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_SETTING_CATEGORY_HTML_FOOTER)) Then
+ Return Settings(ArticleConstants.NEWS_ARCHIVES_SETTING_CATEGORY_HTML_FOOTER).ToString()
+ End If
+ Return ArticleConstants.NEWS_ARCHIVES_DEFAULT_CATEGORY_HTML_FOOTER
+ End Get
+ End Property
+
+ Public ReadOnly Property TemplateCategoryHeader
+ Get
+ If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_SETTING_CATEGORY_HTML_HEADER)) Then
+ Return Settings(ArticleConstants.NEWS_ARCHIVES_SETTING_CATEGORY_HTML_HEADER).ToString()
+ End If
+ Return ArticleConstants.NEWS_ARCHIVES_DEFAULT_CATEGORY_HTML_HEADER
+ End Get
+ End Property
+
+ Public ReadOnly Property TemplateDateAdvancedBody
+ Get
+ If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_SETTING_HTML_BODY_ADVANCED)) Then
+ Return Settings(ArticleConstants.NEWS_ARCHIVES_SETTING_HTML_BODY_ADVANCED).ToString()
+ End If
+ Return ArticleConstants.NEWS_ARCHIVES_DEFAULT_HTML_BODY_ADVANCED
+ End Get
+ End Property
+
+ Public ReadOnly Property TemplateDateAdvancedFooter
+ Get
+ If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_SETTING_HTML_FOOTER_ADVANCED)) Then
+ Return Settings(ArticleConstants.NEWS_ARCHIVES_SETTING_HTML_FOOTER_ADVANCED).ToString()
+ End If
+ Return ArticleConstants.NEWS_ARCHIVES_DEFAULT_HTML_FOOTER_ADVANCED
+ End Get
+ End Property
+
+ Public ReadOnly Property TemplateDateAdvancedHeader
+ Get
+ If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_SETTING_HTML_HEADER_ADVANCED)) Then
+ Return Settings(ArticleConstants.NEWS_ARCHIVES_SETTING_HTML_HEADER_ADVANCED).ToString()
+ End If
+ Return ArticleConstants.NEWS_ARCHIVES_DEFAULT_HTML_HEADER_ADVANCED
+ End Get
+ End Property
+
+ Public ReadOnly Property TemplateDateBody
+ Get
+ If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_SETTING_HTML_BODY)) Then
+ Return Settings(ArticleConstants.NEWS_ARCHIVES_SETTING_HTML_BODY).ToString()
+ End If
+ Return ArticleConstants.NEWS_ARCHIVES_DEFAULT_HTML_BODY
+ End Get
+ End Property
+
+ Public ReadOnly Property TemplateDateFooter
+ Get
+ If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_SETTING_HTML_FOOTER)) Then
+ Return Settings(ArticleConstants.NEWS_ARCHIVES_SETTING_HTML_FOOTER).ToString()
+ End If
+ Return ArticleConstants.NEWS_ARCHIVES_DEFAULT_HTML_FOOTER
+ End Get
+ End Property
+
+ Public ReadOnly Property TemplateDateHeader
+ Get
+ If (Settings.Contains(ArticleConstants.NEWS_ARCHIVES_SETTING_HTML_HEADER)) Then
+ Return Settings(ArticleConstants.NEWS_ARCHIVES_SETTING_HTML_HEADER).ToString()
+ End If
+ Return ArticleConstants.NEWS_ARCHIVES_DEFAULT_HTML_HEADER
+ End Get
+ End Property
+
+#End Region
+
+ End Class
+
+End Namespace
diff --git a/Components/ArticleController.vb b/Components/ArticleController.vb
new file mode 100755
index 0000000..f007b05
--- /dev/null
+++ b/Components/ArticleController.vb
@@ -0,0 +1,930 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.Data
+
+Imports DotNetNuke
+Imports DotNetNuke.Common
+Imports DotNetNuke.Common.Utilities
+Imports DotNetNuke.Entities.Modules
+Imports DotNetNuke.Entities.Users
+Imports DotNetNuke.Security.Roles
+Imports DotNetNuke.Services.Search
+Imports System.Xml
+Imports System.Security.Cryptography
+Imports Ventrian.NewsArticles.Components.CustomFields
+
+Namespace Ventrian.NewsArticles
+
+ Public Class ArticleController
+ Implements ISearchable
+ Implements IPortable
+
+#Region " Private Methods "
+
+ Private Function FillArticleCollection(ByVal dr As IDataReader, ByRef totalRecords As Integer, ByVal maxCount As Integer) As List(Of ArticleInfo)
+
+ Dim objArticles As New List(Of ArticleInfo)
+ While dr.Read
+ objArticles.Add(CType(CBO.FillObject(dr, GetType(ArticleInfo), False), ArticleInfo))
+ End While
+
+ Dim nextResult As Boolean = dr.NextResult()
+ totalRecords = 0
+
+ If dr.Read Then
+ totalRecords = Convert.ToInt32(Null.SetNull(dr("TotalRecords"), totalRecords))
+ If (maxCount <> Null.NullInteger AndAlso maxCount < totalRecords) Then
+ totalRecords = maxCount
+ End If
+ End If
+
+ If Not dr Is Nothing Then
+ dr.Close()
+ End If
+
+ Return objArticles
+
+ End Function
+
+#End Region
+
+#Region " Static Methods "
+
+ Public Shared Sub ClearArchiveCache(ByVal moduleID As Integer)
+
+ Dim itemsToRemove As New List(Of String)()
+
+ If (HttpContext.Current IsNot Nothing) Then
+ Dim enumerator As IDictionaryEnumerator = HttpContext.Current.Cache.GetEnumerator()
+ While enumerator.MoveNext()
+ If enumerator.Key.ToString().ToLower().Contains("ventrian-newsarticles-archive-" & moduleID.ToString()) Then
+ itemsToRemove.Add(enumerator.Key.ToString())
+ End If
+ End While
+
+ For Each itemToRemove As String In itemsToRemove
+ DataCache.RemoveCache(itemToRemove.Replace("DNN_", ""))
+ Next
+ End If
+
+ End Sub
+
+ Public Shared Sub ClearArticleCache(ByVal articleID As Integer)
+
+ Dim cacheKey As String = "ventrian-newsarticles-article-" & articleID.ToString()
+ DataCache.RemoveCache(cacheKey)
+
+
+
+ End Sub
+
+#End Region
+
+#Region " Public Methods "
+
+ Public Function GetArticleList(ByVal moduleID As Integer) As List(Of ArticleInfo)
+
+ Return GetArticleList(moduleID, True)
+
+ End Function
+
+ Public Function GetArticleList(ByVal moduleID As Integer, ByVal isApproved As Boolean) As List(Of ArticleInfo)
+
+ Return GetArticleList(moduleID, Null.NullDate, Null.NullDate, Nothing, Null.NullBoolean, Nothing, Null.NullInteger, Null.NullInteger, Null.NullInteger, "CreatedDate", "DESC", isApproved, Null.NullBoolean, Null.NullString, Null.NullInteger, Null.NullBoolean, Null.NullBoolean, Null.NullBoolean, Null.NullBoolean, Null.NullBoolean, Null.NullBoolean, Null.NullString, Nothing, False, Null.NullString, Null.NullInteger, Null.NullString, Null.NullString, Null.NullInteger)
+
+ End Function
+
+ Public Function GetArticleList(ByVal moduleID As Integer, ByVal isApproved As Boolean, ByVal sort As String) As List(Of ArticleInfo)
+
+ Return GetArticleList(moduleID, Null.NullDate, Null.NullDate, Nothing, Null.NullBoolean, Nothing, Null.NullInteger, Null.NullInteger, Null.NullInteger, sort, "DESC", isApproved, Null.NullBoolean, Null.NullString, Null.NullInteger, Null.NullBoolean, Null.NullBoolean, Null.NullBoolean, Null.NullBoolean, Null.NullBoolean, Null.NullBoolean, Null.NullString, Nothing, False, Null.NullString, Null.NullInteger, Null.NullString, Null.NullString, Null.NullInteger)
+
+ End Function
+
+ Public Function GetArticleList(ByVal moduleID As Integer, ByVal currentDate As DateTime, ByVal agedDate As DateTime, ByVal categoryID As Integer(), ByVal matchAll As Boolean, ByVal maxCount As Integer, ByVal pageNumber As Integer, ByVal pageSize As Integer, ByVal sortBy As String, ByVal sortDirection As String, ByVal isApproved As Boolean, ByVal isDraft As Boolean, ByVal keywords As String, ByVal authorID As Integer, ByVal showPending As Boolean, ByVal showExpired As Boolean, ByVal showFeaturedOnly As Boolean, ByVal showNotFeaturedOnly As Boolean, ByVal showSecuredOnly As Boolean, ByVal showNotSecuredOnly As Boolean, ByVal articleIDs As String, ByRef totalRecords As Integer) As List(Of ArticleInfo)
+
+ Return GetArticleList(moduleID, currentDate, agedDate, categoryID, matchAll, Nothing, maxCount, pageNumber, pageSize, sortBy, sortDirection, isApproved, isDraft, keywords, authorID, showPending, showExpired, showFeaturedOnly, showNotFeaturedOnly, showSecuredOnly, showNotSecuredOnly, articleIDs, Nothing, False, Null.NullString, Null.NullInteger, Null.NullString, Null.NullString, totalRecords)
+
+ End Function
+
+ Public Function GetArticleList(ByVal moduleID As Integer, ByVal currentDate As DateTime, ByVal agedDate As DateTime, ByVal categoryID As Integer(), ByVal matchAll As Boolean, ByVal categoryIDExclude As Integer(), ByVal maxCount As Integer, ByVal pageNumber As Integer, ByVal pageSize As Integer, ByVal sortBy As String, ByVal sortDirection As String, ByVal isApproved As Boolean, ByVal isDraft As Boolean, ByVal keywords As String, ByVal authorID As Integer, ByVal showPending As Boolean, ByVal showExpired As Boolean, ByVal showFeaturedOnly As Boolean, ByVal showNotFeaturedOnly As Boolean, ByVal showSecuredOnly As Boolean, ByVal showNotSecuredOnly As Boolean, ByVal articleIDs As String, ByVal tagID As Integer(), ByVal matchAllTag As Boolean, ByVal rssGuid As String, ByVal customFieldID As Integer, ByVal customValue As String, ByVal linkFilter As String, ByRef totalRecords As Integer) As List(Of ArticleInfo)
+
+ Return FillArticleCollection(DataProvider.Instance().GetArticleListBySearchCriteria(moduleID, currentDate, agedDate, categoryID, matchAll, categoryIDExclude, maxCount, pageNumber, pageSize, sortBy, sortDirection, isApproved, isDraft, keywords, authorID, showPending, showExpired, showFeaturedOnly, showNotFeaturedOnly, showSecuredOnly, showNotSecuredOnly, articleIDs, tagID, matchAllTag, rssGuid, customFieldID, customValue, linkFilter), totalRecords, maxCount)
+
+ End Function
+
+ Public Function GetArticle(ByVal articleID As Integer) As ArticleInfo
+
+ Dim cacheKey As String = "ventrian-newsarticles-article-" & articleID.ToString()
+
+ Dim objArticle As ArticleInfo = CType(DataCache.GetCache(cacheKey), ArticleInfo)
+
+ If (objArticle Is Nothing) Then
+ objArticle = CType(CBO.FillObject(DataProvider.Instance().GetArticle(articleID), GetType(ArticleInfo)), ArticleInfo)
+ If (objArticle Is Nothing) Then
+ Return Nothing
+ End If
+ DataCache.SetCache(cacheKey, objArticle)
+ End If
+
+ Return objArticle
+
+ End Function
+
+ Public Function GetArticleCategories(ByVal articleID As Integer) As ArrayList
+
+ Dim objArticleCategories As ArrayList = CType(DataCache.GetCache(ArticleConstants.CACHE_CATEGORY_ARTICLE & articleID.ToString()), ArrayList)
+
+ If (objArticleCategories Is Nothing) Then
+ objArticleCategories = CBO.FillCollection(DataProvider.Instance().GetArticleCategories(articleID), GetType(CategoryInfo))
+ DataCache.SetCache(ArticleConstants.CACHE_CATEGORY_ARTICLE & articleID.ToString(), objArticleCategories)
+ End If
+ Return objArticleCategories
+
+ End Function
+
+ Public Function GetNewsArchive(ByVal moduleID As Integer, ByVal categoryID As Integer(), ByVal categoryIDExclude As Integer(), ByVal authorID As Integer, ByVal groupBy As GroupByType, ByVal showPending As Boolean) As List(Of ArchiveInfo)
+
+ Dim categories As String = Null.NullString
+
+ If Not (categoryID Is Nothing) Then
+ For Each category As Integer In categoryID
+ If Not (categories = Null.NullString) Then
+ categories = categories & ","
+ End If
+ categories = categories & category.ToString()
+ Next
+ End If
+
+ Dim categoriesExclude As String = Null.NullString
+
+ If Not (categoryIDExclude Is Nothing) Then
+ For Each category As Integer In categoryIDExclude
+ If Not (categoriesExclude = Null.NullString) Then
+ categoriesExclude = categoriesExclude & ","
+ End If
+ categoriesExclude = categoriesExclude & category.ToString()
+ Next
+ End If
+
+ Dim hashCategories As String = ""
+ If (categories <> "" Or categoriesExclude <> "") Then
+ Dim Ue As New UnicodeEncoding()
+ Dim ByteSourceText() As Byte = Ue.GetBytes(categories & categoriesExclude)
+ Dim Md5 As New MD5CryptoServiceProvider()
+ Dim ByteHash() As Byte = Md5.ComputeHash(ByteSourceText)
+ hashCategories = Convert.ToBase64String(ByteHash)
+ End If
+
+ Dim cacheKey As String = "ventrian-newsarticles-archive-" & moduleID.ToString() & "-" & hashCategories & "-" & authorID.ToString() & "-" & groupBy.ToString() & "-" & showPending.ToString()
+
+ Dim objArchives As List(Of ArchiveInfo) = CType(DataCache.GetCache(cacheKey), List(Of ArchiveInfo))
+
+ If (objArchives Is Nothing) Then
+ objArchives = CBO.FillCollection(Of ArchiveInfo)(DataProvider.Instance().GetNewsArchive(moduleID, categoryID, categoryIDExclude, authorID, groupBy.ToString(), showPending))
+ DataCache.SetCache(cacheKey, objArchives)
+ End If
+
+ Return objArchives
+
+ End Function
+
+ Public Sub DeleteArticle(ByVal articleID As Integer)
+
+ Dim objArticle As ArticleInfo = GetArticle(articleID)
+
+ If (objArticle IsNot Nothing) Then
+ DeleteArticle(articleID, objArticle.ModuleID)
+ End If
+
+ End Sub
+
+ Public Sub DeleteArticle(ByVal articleID As Integer, ByVal moduleID As Integer)
+
+ DataProvider.Instance().DeleteArticle(articleID)
+ CategoryController.ClearCache(moduleID)
+ AuthorController.ClearCache(moduleID)
+ ArticleController.ClearArchiveCache(moduleID)
+ ArticleController.ClearArticleCache(articleID)
+
+ End Sub
+
+ Public Sub DeleteArticleCategories(ByVal articleID As Integer)
+
+ DataProvider.Instance().DeleteArticleCategories(articleID)
+ DataCache.RemoveCache(ArticleConstants.CACHE_CATEGORY_ARTICLE & articleID.ToString())
+
+ End Sub
+
+ Public Function AddArticle(ByVal objArticle As ArticleInfo) As Integer
+
+ Dim articleID As Integer = CType(DataProvider.Instance().AddArticle(objArticle.AuthorID, objArticle.ApproverID, objArticle.CreatedDate, objArticle.LastUpdate, objArticle.Title, objArticle.Summary, objArticle.IsApproved, objArticle.NumberOfViews, objArticle.IsDraft, objArticle.StartDate, objArticle.EndDate, objArticle.ModuleID, objArticle.ImageUrl, objArticle.IsFeatured, objArticle.LastUpdateID, objArticle.Url, objArticle.IsSecure, objArticle.IsNewWindow, objArticle.MetaTitle, objArticle.MetaDescription, objArticle.MetaKeywords, objArticle.PageHeadText, objArticle.ShortUrl, objArticle.RssGuid), Integer)
+
+ CategoryController.ClearCache(objArticle.ModuleID)
+ AuthorController.ClearCache(objArticle.ModuleID)
+ ArticleController.ClearArchiveCache(objArticle.ModuleID)
+
+ Return articleID
+
+ End Function
+
+ Public Sub AddArticleCategory(ByVal articleID As Integer, ByVal categoryID As Integer)
+
+ DataProvider.Instance().AddArticleCategory(articleID, categoryID)
+ DataCache.RemoveCache(ArticleConstants.CACHE_CATEGORY_ARTICLE & articleID.ToString())
+
+ End Sub
+
+ Public Sub UpdateArticle(ByVal objArticle As ArticleInfo)
+
+ DataProvider.Instance().UpdateArticle(objArticle.ArticleID, objArticle.AuthorID, objArticle.ApproverID, objArticle.CreatedDate, objArticle.LastUpdate, objArticle.Title, objArticle.Summary, objArticle.IsApproved, objArticle.NumberOfViews, objArticle.IsDraft, objArticle.StartDate, objArticle.EndDate, objArticle.ModuleID, objArticle.ImageUrl, objArticle.IsFeatured, objArticle.LastUpdateID, objArticle.Url, objArticle.IsSecure, objArticle.IsNewWindow, objArticle.MetaTitle, objArticle.MetaDescription, objArticle.MetaKeywords, objArticle.PageHeadText, objArticle.ShortUrl, objArticle.RssGuid)
+
+ CategoryController.ClearCache(objArticle.ModuleID)
+ AuthorController.ClearCache(objArticle.ModuleID)
+ ArticleController.ClearArchiveCache(objArticle.ModuleID)
+ ArticleController.ClearArticleCache(objArticle.ArticleID)
+
+ End Sub
+
+ Public Sub UpdateArticleCount(ByVal articleID As Integer, ByVal count As Integer)
+
+ DataProvider.Instance().UpdateArticleCount(articleID, count)
+
+ End Sub
+
+ Public Function SecureCheck(ByVal portalID As Integer, ByVal articleID As Integer, ByVal userID As Integer) As Boolean
+
+ Return DataProvider.Instance().SecureCheck(portalID, articleID, userID)
+
+ End Function
+
+#End Region
+
+ Private Function GetTabModuleSettings(ByVal TabModuleId As Integer, ByVal settings As Hashtable) As Hashtable
+
+ Dim dr As IDataReader = DotNetNuke.Data.DataProvider.Instance().GetTabModuleSettings(TabModuleId)
+
+ While dr.Read()
+
+ If Not dr.IsDBNull(1) Then
+ settings(dr.GetString(0)) = dr.GetString(1)
+ Else
+ settings(dr.GetString(0)) = ""
+ End If
+
+ End While
+
+ dr.Close()
+
+ Return settings
+
+ End Function
+
+#Region " Optional Interfaces "
+
+ Public Function GetSearchItems(ByVal ModInfo As DotNetNuke.Entities.Modules.ModuleInfo) As DotNetNuke.Services.Search.SearchItemInfoCollection Implements DotNetNuke.Entities.Modules.ISearchable.GetSearchItems
+
+ Dim objModuleController As New ModuleController
+ Dim settings As Hashtable = objModuleController.GetModuleSettings(ModInfo.ModuleID)
+ settings = GetTabModuleSettings(ModInfo.TabModuleID, settings)
+
+ Dim doSearch As Boolean = False
+
+ If (settings.Contains(ArticleConstants.ENABLE_CORE_SEARCH_SETTING)) Then
+ doSearch = Convert.ToBoolean(settings(ArticleConstants.ENABLE_CORE_SEARCH_SETTING))
+ End If
+
+ Dim SearchItemCollection As New SearchItemInfoCollection
+
+ If (doSearch) Then
+
+ Dim objArticles As List(Of ArticleInfo) = GetArticleList(ModInfo.ModuleID)
+
+ For Each objArticle As ArticleInfo In objArticles
+ With CType(objArticle, ArticleInfo)
+
+ If (objArticle.IsApproved) Then
+
+ Dim objPageController As New PageController
+ Dim objPages As ArrayList = objPageController.GetPageList(objArticle.ArticleID)
+ For i As Integer = 0 To objPages.Count - 1
+ Dim SearchItem As SearchItemInfo
+ Dim objPage As PageInfo = CType(objPages(i), PageInfo)
+ Dim pageContent As String = HttpUtility.HtmlDecode(objArticle.Title) + " " + System.Web.HttpUtility.HtmlDecode(objPage.PageText)
+
+ For Each Item As DictionaryEntry In objArticle.CustomList
+ If (Item.Value.ToString() <> "") Then
+ pageContent = pageContent & vbCrLf & Item.Value.ToString()
+ End If
+ Next
+
+ Dim pageDescription As String = HtmlUtils.Shorten(HtmlUtils.Clean(System.Web.HttpUtility.HtmlDecode(objPage.PageText), False), 100, "...")
+
+ Dim title As String = objArticle.Title & " - " & objPage.Title
+ If (objArticle.Title = objPage.Title) Then
+ title = objArticle.Title
+ End If
+ If (i = 0) Then
+ SearchItem = New SearchItemInfo(title, pageDescription, objArticle.AuthorID, objArticle.LastUpdate, ModInfo.ModuleID, ModInfo.ModuleID.ToString() & "_" & .ArticleID.ToString & "_" & objPage.PageID.ToString, pageContent, "ArticleType=ArticleView&ArticleID=" & .ArticleID.ToString)
+ Else
+ SearchItem = New SearchItemInfo(title, pageDescription, objArticle.AuthorID, objArticle.LastUpdate, ModInfo.ModuleID, ModInfo.ModuleID.ToString() & "_" & .ArticleID.ToString & "_" & objPage.PageID.ToString, pageContent, "ArticleType=ArticleView&ArticleID=" & .ArticleID.ToString & "&PageID=" + objPage.PageID.ToString())
+ End If
+ SearchItemCollection.Add(SearchItem)
+ Next
+
+ End If
+
+ End With
+ Next
+
+ End If
+
+ Return SearchItemCollection
+
+ End Function
+
+ Public Function ExportModule(ByVal ModuleID As Integer) As String Implements IPortable.ExportModule
+
+ Dim strXML As String = ""
+ strXML += WriteCategories(ModuleID, Null.NullInteger)
+ strXML += WriteTags(ModuleID)
+ strXML += WriteCustomFields(ModuleID)
+ strXML += WriteArticles(ModuleID)
+ Return strXML
+
+ End Function
+
+ Public Sub ImportModule(ByVal ModuleID As Integer, ByVal Content As String, ByVal Version As String, ByVal UserId As Integer) Implements IPortable.ImportModule
+
+ Dim objXmlDocument As New XmlDocument()
+ objXmlDocument.LoadXml("" & Content & "")
+
+ For Each xmlChildNode As XmlNode In objXmlDocument.ChildNodes(0).ChildNodes
+ If (xmlChildNode.Name = "categories") Then
+ Dim sortOrder As Integer = 0
+ For Each xmlCategory As XmlNode In xmlChildNode.ChildNodes
+ ReadCategory(ModuleID, xmlCategory, Null.NullInteger, sortOrder)
+ sortOrder = sortOrder + 1
+ Next
+ End If
+
+ If (xmlChildNode.Name = "tags") Then
+ For Each xmlTag As XmlNode In xmlChildNode.ChildNodes
+ ReadTag(ModuleID, xmlTag)
+ Next
+ End If
+
+ If (xmlChildNode.Name = "customfields") Then
+ For Each xmlCustomField As XmlNode In xmlChildNode.ChildNodes
+ ReadCustomField(ModuleID, xmlCustomField)
+ Next
+ End If
+
+ If (xmlChildNode.Name = "articles") Then
+ For Each xmlArticle As XmlNode In xmlChildNode.ChildNodes
+ ReadArticle(ModuleID, xmlArticle)
+ Next
+ End If
+ Next
+
+ End Sub
+
+ Private Function WriteCategories(ByVal ModuleID As Integer, ByVal parentID As Integer) As String
+
+ Dim strXML As String = ""
+
+ Dim objCategoryController As New CategoryController
+ Dim objCategories As List(Of CategoryInfo) = objCategoryController.GetCategories(ModuleID, parentID)
+
+ If objCategories.Count <> 0 Then
+ strXML += ""
+ For Each objCategory As CategoryInfo In objCategories
+ strXML += ""
+ strXML += "" & XmlUtils.XMLEncode(objCategory.Name) & ""
+ strXML += "" & XmlUtils.XMLEncode(objCategory.Description) & ""
+ strXML += "" & XmlUtils.XMLEncode(objCategory.MetaTitle) & ""
+ strXML += "" & XmlUtils.XMLEncode(objCategory.MetaDescription) & ""
+ strXML += "" & XmlUtils.XMLEncode(objCategory.MetaKeywords) & ""
+ strXML += WriteCategories(ModuleID, objCategory.CategoryID)
+ strXML += ""
+ Next
+ strXML += ""
+ End If
+
+ Return strXML
+
+ End Function
+
+ Public Sub ReadCategory(ByVal ModuleID As Integer, ByVal xmlCategory As XmlNode, ByVal parentCategoryID As Integer, ByVal sortOrder As Integer)
+
+ Dim objCategory As New CategoryInfo
+ objCategory.ParentID = parentCategoryID
+ objCategory.ModuleID = ModuleID
+ objCategory.Name = xmlCategory.Item("name").InnerText
+ objCategory.Description = xmlCategory.Item("description").InnerText
+
+ objCategory.InheritSecurity = True
+ objCategory.CategorySecurityType = CategorySecurityType.Loose
+
+ objCategory.MetaTitle = xmlCategory.Item("metaTitle").InnerText
+ objCategory.MetaDescription = xmlCategory.Item("metaDescription").InnerText
+ objCategory.MetaKeywords = xmlCategory.Item("metaKeywords").InnerText
+
+ objCategory.Image = Null.NullString()
+ objCategory.SortOrder = sortOrder
+
+ Dim objCategoryController As New CategoryController
+ objCategory.CategoryID = objCategoryController.AddCategory(objCategory)
+
+ Dim childSortOrder As Integer = 0
+ For Each xmlChildNode As XmlNode In xmlCategory.ChildNodes
+ If (xmlChildNode.Name.ToLower() = "categories") Then
+ For Each xmlChildCategory As XmlNode In xmlChildNode.ChildNodes
+ ReadCategory(ModuleID, xmlChildCategory, objCategory.CategoryID, childSortOrder)
+ Next
+ End If
+ childSortOrder = childSortOrder + 1
+ Next
+
+ End Sub
+
+ Private Function WriteTags(ByVal ModuleID As Integer) As String
+
+ Dim strXML As String = ""
+
+ Dim objTagController As New TagController()
+ Dim objTags As ArrayList = objTagController.List(ModuleID, Null.NullInteger)
+
+ If objTags.Count <> 0 Then
+ strXML += ""
+ For Each objTag As TagInfo In objTags
+ strXML += ""
+ strXML += "" & XmlUtils.XMLEncode(objTag.Name) & ""
+ strXML += "" & XmlUtils.XMLEncode(objTag.Usages.ToString()) & ""
+ strXML += ""
+ Next
+ strXML += ""
+ End If
+
+ Return strXML
+
+ End Function
+
+ Public Sub ReadTag(ByVal ModuleID As Integer, ByVal xmlTag As XmlNode)
+
+ Dim objTag As New TagInfo
+
+ objTag.ModuleID = ModuleID
+ objTag.Name = xmlTag.Item("name").InnerText
+ objTag.NameLowered = objTag.Name.ToLower()
+ objTag.Usages = Convert.ToInt32(xmlTag.Item("usage").InnerText)
+
+ Dim objTagController As New TagController
+ objTagController.Add(objTag)
+
+ End Sub
+
+ Private Function WriteCustomFields(ByVal ModuleID As Integer) As String
+
+ Dim strXML As String = ""
+
+ Dim objCustomFieldController As New CustomFieldController()
+ Dim objCustomFields = objCustomFieldController.List(ModuleID)
+
+ If objCustomFields.Count <> 0 Then
+ strXML += ""
+ For Each objCustomField As CustomFieldInfo In objCustomFields
+ strXML += ""
+ strXML += "" & XmlUtils.XMLEncode(objCustomField.Name) & ""
+ strXML += "" & XmlUtils.XMLEncode(CType(objCustomField.FieldType, Integer)) & ""
+ strXML += "" & XmlUtils.XMLEncode(objCustomField.FieldElements) & ""
+ strXML += "" & XmlUtils.XMLEncode(objCustomField.DefaultValue) & ""
+ strXML += "
"
+ strXML += "" & XmlUtils.XMLEncode(objCustomField.CaptionHelp) & ""
+ strXML += "" & XmlUtils.XMLEncode(objCustomField.IsRequired) & ""
+ strXML += "" & XmlUtils.XMLEncode(objCustomField.IsVisible) & ""
+ strXML += "" & XmlUtils.XMLEncode(objCustomField.SortOrder) & ""
+ strXML += "" & XmlUtils.XMLEncode(CType(objCustomField.ValidationType, Integer)) & ""
+ strXML += "" & XmlUtils.XMLEncode(objCustomField.RegularExpression) & ""
+ strXML += "" & XmlUtils.XMLEncode(objCustomField.Length) & ""
+ strXML += ""
+ Next
+ strXML += ""
+ End If
+
+ Return strXML
+
+ End Function
+
+ Public Sub ReadCustomField(ByVal ModuleID As Integer, ByVal xmlCustomField As XmlNode)
+
+ Dim objCustomField As New CustomFieldInfo
+
+ objCustomField.ModuleID = ModuleID
+ objCustomField.Name = xmlCustomField.Item("name").InnerText
+ objCustomField.FieldType = [Enum].Parse(GetType(CustomFieldType), xmlCustomField.Item("fieldtype").InnerText)
+ objCustomField.FieldElements = xmlCustomField.Item("fieldelements").InnerText
+ objCustomField.DefaultValue = xmlCustomField.Item("defaultvalue").InnerText
+ objCustomField.Caption = xmlCustomField.Item("caption").InnerText
+ objCustomField.CaptionHelp = xmlCustomField.Item("captionhelp").InnerText
+ objCustomField.IsRequired = Convert.ToBoolean(xmlCustomField.Item("isrequired").InnerText)
+ objCustomField.IsVisible = Convert.ToBoolean(xmlCustomField.Item("isvisible").InnerText)
+ objCustomField.SortOrder = Convert.ToInt32(xmlCustomField.Item("sortorder").InnerText)
+ objCustomField.ValidationType = [Enum].Parse(GetType(CustomFieldValidationType), xmlCustomField.Item("validationType").InnerText)
+ objCustomField.RegularExpression = xmlCustomField.Item("regularexpression").InnerText
+ objCustomField.Length = Convert.ToInt32(xmlCustomField.Item("length").InnerText)
+
+ Dim objCustomFieldController As New CustomFieldController
+ objCustomFieldController.Add(objCustomField)
+
+ End Sub
+
+ Private Function WriteArticles(ByVal ModuleID As Integer) As String
+
+ Dim strXML As String = ""
+
+ Dim objCustomFieldController As New CustomFieldController
+ Dim objCustomFields As ArrayList = objCustomFieldController.List(ModuleID)
+
+ Dim objArticleController As New ArticleController
+ Dim objArticles As List(Of ArticleInfo) = objArticleController.GetArticleList(ModuleID, DateTime.Now, Null.NullDate, Nothing, True, 10000, 1, 10000, "CreatedDate", "DESC", True, False, Null.NullString, Null.NullInteger, True, True, False, False, False, False, Null.NullString, Nothing)
+
+ If objArticles.Count <> 0 Then
+ strXML += ""
+ For Each objArticle As ArticleInfo In objArticles
+ strXML += ""
+ strXML += "" & XmlUtils.XMLEncode(objArticle.CreatedDate.ToString("O")) & ""
+ strXML += "" & XmlUtils.XMLEncode(objArticle.LastUpdate.ToString("O")) & ""
+ strXML += "" & XmlUtils.XMLEncode(objArticle.Title) & ""
+ strXML += "" & XmlUtils.XMLEncode(objArticle.IsApproved.ToString()) & ""
+ strXML += "" & XmlUtils.XMLEncode(objArticle.NumberOfViews.ToString()) & ""
+ strXML += "" & XmlUtils.XMLEncode(objArticle.IsDraft.ToString()) & ""
+ strXML += "" & XmlUtils.XMLEncode(objArticle.StartDate.ToString("O")) & ""
+ strXML += "" & XmlUtils.XMLEncode(objArticle.EndDate.ToString("O")) & ""
+ strXML += "" & XmlUtils.XMLEncode(objArticle.ImageUrl.ToString()) & ""
+ strXML += "" & XmlUtils.XMLEncode(objArticle.IsFeatured.ToString()) & ""
+ strXML += "" & XmlUtils.XMLEncode(objArticle.Url) & ""
+ strXML += "" & XmlUtils.XMLEncode(objArticle.IsSecure.ToString()) & ""
+ strXML += "" & XmlUtils.XMLEncode(objArticle.IsNewWindow.ToString()) & ""
+ strXML += "" & XmlUtils.XMLEncode(objArticle.CommentCount.ToString()) & ""
+ strXML += "" & XmlUtils.XMLEncode(objArticle.PageCount.ToString()) & ""
+ strXML += "" & XmlUtils.XMLEncode(objArticle.FileCount.ToString()) & ""
+ strXML += "" & XmlUtils.XMLEncode(objArticle.ImageCount.ToString()) & ""
+ If (objArticle.Rating <> Null.NullDouble) Then
+ strXML += "" & XmlUtils.XMLEncode(objArticle.Rating.ToString()) & ""
+ End If
+ strXML += "" & XmlUtils.XMLEncode(objArticle.RatingCount.ToString()) & ""
+ strXML += "" & XmlUtils.XMLEncode(objArticle.Url) & ""
+ strXML += "" & XmlUtils.XMLEncode(objArticle.MetaTitle) & ""
+ strXML += "" & XmlUtils.XMLEncode(objArticle.MetaDescription) & ""
+ strXML += "" & XmlUtils.XMLEncode(objArticle.MetaKeywords) & ""
+ strXML += "" & XmlUtils.XMLEncode(objArticle.PageHeadText) & ""
+ strXML += "" & XmlUtils.XMLEncode(objArticle.ShortUrl) & ""
+
+ Dim objArticleCategories As ArrayList = objArticleController.GetArticleCategories(objArticle.ArticleID)
+ If (objArticleCategories.Count > 0) Then
+ strXML += ""
+ For Each objCategory As CategoryInfo In objArticleCategories
+ strXML += ""
+ strXML += "" & XmlUtils.XMLEncode(objCategory.Name) & ""
+ strXML += ""
+ Next
+ strXML += ""
+ End If
+
+ If (objArticle.Tags <> "") Then
+ strXML += ""
+ For Each tag As String In objArticle.Tags.Split(","c)
+ strXML += ""
+ strXML += "" & XmlUtils.XMLEncode(tag) & ""
+ strXML += ""
+ Next
+ strXML += ""
+ End If
+
+ If (objArticle.CustomList.Count > 0) Then
+ strXML += ""
+ For Each item As DictionaryEntry In objArticle.CustomList
+
+ For Each objCustomField As CustomFieldInfo In objCustomFields
+ If (objCustomField.CustomFieldID = item.Key) Then
+ strXML += ""
+ strXML += "" & XmlUtils.XMLEncode(objCustomField.Name) & ""
+ strXML += "" & XmlUtils.XMLEncode(item.Value) & ""
+ strXML += ""
+ Exit For
+ End If
+ Next
+
+ Next
+ strXML += ""
+ End If
+
+ If (objArticle.PageCount > 0) Then
+ Dim objPageController As New PageController
+ Dim objPages As ArrayList = objPageController.GetPageList(objArticle.ArticleID)
+
+ If (objPages.Count > 0) Then
+ strXML += ""
+ For Each objPage As PageInfo In objPages
+ strXML += ""
+ strXML += "" & XmlUtils.XMLEncode(objPage.Title) & ""
+ strXML += "" & XmlUtils.XMLEncode(objPage.PageText) & ""
+ strXML += ""
+ Next
+ strXML += ""
+ End If
+ End If
+
+ If (objArticle.ImageCount > 0) Then
+ Dim objImageController As New ImageController
+ Dim objImages As List(Of ImageInfo) = objImageController.GetImageList(objArticle.ArticleID, Null.NullString())
+
+ If (objImages.Count > 0) Then
+ strXML += ""
+ For Each objImage As ImageInfo In objImages
+ strXML += ""
+ strXML += "" & XmlUtils.XMLEncode(objImage.Title) & ""
+ strXML += "" & XmlUtils.XMLEncode(objImage.FileName) & ""
+ strXML += "" & XmlUtils.XMLEncode(objImage.Extension) & ""
+ strXML += "" & XmlUtils.XMLEncode(objImage.Size.ToString()) & ""
+ strXML += "" & XmlUtils.XMLEncode(objImage.Width.ToString()) & ""
+ strXML += "" & XmlUtils.XMLEncode(objImage.Height.ToString()) & ""
+ strXML += "" & XmlUtils.XMLEncode(objImage.ContentType) & ""
+ strXML += "" & XmlUtils.XMLEncode(objImage.Folder) & ""
+ strXML += ""
+ Next
+ strXML += ""
+ End If
+ End If
+
+ If (objArticle.FileCount > 0) Then
+ Dim objFileController As New FileController
+ Dim objFiles As List(Of FileInfo) = objFileController.GetFileList(objArticle.ArticleID, Null.NullString)
+
+ If (objFiles.Count > 0) Then
+ strXML += ""
+ For Each objFile As FileInfo In objFiles
+ strXML += ""
+ strXML += "" & XmlUtils.XMLEncode(objFile.Title) & ""
+ strXML += "" & XmlUtils.XMLEncode(objFile.FileName) & ""
+ strXML += "" & XmlUtils.XMLEncode(objFile.Extension) & ""
+ strXML += "" & XmlUtils.XMLEncode(objFile.Size.ToString()) & ""
+ strXML += "" & XmlUtils.XMLEncode(objFile.ContentType) & ""
+ strXML += "" & XmlUtils.XMLEncode(objFile.Folder) & ""
+ strXML += ""
+ Next
+ strXML += ""
+ End If
+ End If
+
+ If (objArticle.CommentCount > 0) Then
+ Dim objCommentController As New CommentController
+ Dim objComments As List(Of CommentInfo) = objCommentController.GetCommentList(ModuleID, objArticle.ArticleID, True)
+
+ If (objComments.Count > 0) Then
+ strXML += ""
+ For Each objComment As CommentInfo In objComments
+ strXML += ""
+ strXML += "" & XmlUtils.XMLEncode(objArticle.CreatedDate.ToString("O")) & ""
+ strXML += "" & XmlUtils.XMLEncode(objComment.Comment) & ""
+ strXML += "" & XmlUtils.XMLEncode(objComment.RemoteAddress) & ""
+ strXML += "" & XmlUtils.XMLEncode(objComment.Type.ToString()) & ""
+ strXML += "" & XmlUtils.XMLEncode(objComment.TrackbackUrl) & ""
+ strXML += "" & XmlUtils.XMLEncode(objComment.TrackbackTitle) & ""
+ strXML += "" & XmlUtils.XMLEncode(objComment.TrackbackBlogName) & ""
+ strXML += "" & XmlUtils.XMLEncode(objComment.TrackbackExcerpt) & ""
+ strXML += "" & XmlUtils.XMLEncode(objComment.AnonymousName) & ""
+ strXML += "" & XmlUtils.XMLEncode(objComment.AnonymousEmail) & ""
+ strXML += "" & XmlUtils.XMLEncode(objComment.AnonymousURL) & ""
+ strXML += "" & XmlUtils.XMLEncode(objComment.NotifyMe.ToString()) & ""
+ strXML += ""
+ Next
+ strXML += ""
+ End If
+ End If
+
+ strXML += ""
+ Next
+ strXML += ""
+ End If
+
+ Return strXML
+
+ End Function
+
+ Public Sub ReadArticle(ByVal ModuleID As Integer, ByVal xmlArticle As XmlNode)
+
+ Dim objCustomFieldController As New CustomFieldController
+ Dim objCustomFields As ArrayList = objCustomFieldController.List(ModuleID)
+
+ Dim objArticle As New ArticleInfo
+
+ objArticle.ModuleID = ModuleID
+
+ objArticle.CreatedDate = DateTime.Parse(xmlArticle.Item("createdDate").InnerText)
+ objArticle.LastUpdate = DateTime.Parse(xmlArticle.Item("lastUpdate").InnerText)
+
+ objArticle.Title = xmlArticle.Item("title").InnerText
+ objArticle.IsApproved = Convert.ToBoolean(xmlArticle.Item("isApproved").InnerText)
+ objArticle.NumberOfViews = Convert.ToInt32(xmlArticle.Item("numberOfViews").InnerText)
+ objArticle.IsDraft = Convert.ToBoolean(xmlArticle.Item("isDraft").InnerText)
+
+ objArticle.StartDate = DateTime.Parse(xmlArticle.Item("startDate").InnerText)
+ objArticle.EndDate = DateTime.Parse(xmlArticle.Item("endDate").InnerText)
+
+ objArticle.ImageUrl = xmlArticle.Item("imageUrl").InnerText
+ objArticle.IsFeatured = Convert.ToBoolean(xmlArticle.Item("isFeatured").InnerText)
+ objArticle.Url = xmlArticle.Item("url").InnerText
+ objArticle.IsSecure = Convert.ToBoolean(xmlArticle.Item("isSecure").InnerText)
+ objArticle.IsNewWindow = Convert.ToBoolean(xmlArticle.Item("isNewWindow").InnerText)
+
+ objArticle.CommentCount = Convert.ToInt32(xmlArticle.Item("commentCount").InnerText)
+ objArticle.PageCount = Convert.ToInt32(xmlArticle.Item("pageCount").InnerText)
+ objArticle.FileCount = Convert.ToInt32(xmlArticle.Item("fileCount").InnerText)
+ objArticle.ImageCount = Convert.ToInt32(xmlArticle.Item("imageCount").InnerText)
+
+ objArticle.Rating = Null.NullInteger
+ objArticle.RatingCount = 0
+ objArticle.Summary = xmlArticle.Item("summary").InnerText
+
+ objArticle.MetaTitle = xmlArticle.Item("metaTitle").InnerText
+ objArticle.MetaDescription = xmlArticle.Item("metaDescription").InnerText
+ objArticle.MetaKeywords = xmlArticle.Item("metaKeywords").InnerText
+ objArticle.PageHeadText = xmlArticle.Item("pageHeadText").InnerText
+ objArticle.ShortUrl = xmlArticle.Item("shortUrl").InnerText
+
+ Dim objArticleController As New ArticleController
+ objArticle.ArticleID = objArticleController.AddArticle(objArticle)
+
+ Dim objCategoryController As New CategoryController
+ Dim objCategories As List(Of CategoryInfo) = objCategoryController.GetCategoriesAll(ModuleID, Null.NullInteger)
+ For Each xmlChildNode As XmlNode In xmlArticle.ChildNodes
+
+ If (xmlChildNode.Name = "categories") Then
+ For Each xmlCategoryNode As XmlNode In xmlChildNode.ChildNodes
+ Dim name As String = xmlCategoryNode.Item("name").InnerText
+ For Each objCategory As CategoryInfo In objCategories
+ If (objCategory.Name.ToLower() = name.ToLower()) Then
+ objArticleController.AddArticleCategory(objArticle.ArticleID, objCategory.CategoryID)
+ Exit For
+ End If
+ Next
+ Next
+ End If
+
+ If (xmlChildNode.Name = "tags") Then
+ For Each xmlTagNode As XmlNode In xmlChildNode.ChildNodes
+ Dim name As String = xmlTagNode.Item("name").InnerText
+ Dim objTagController As New TagController()
+ Dim objTags As ArrayList = objTagController.List(ModuleID, Null.NullInteger)
+ For Each objTag As TagInfo In objTags
+ If (objTag.Name.ToLower() = name.ToLower()) Then
+ objTagController.Add(objArticle.ArticleID, objTag.TagID)
+ Exit For
+ End If
+ Next
+ Next
+ End If
+
+ If (xmlChildNode.Name = "customfields") Then
+ For Each xmlTagNode As XmlNode In xmlChildNode.ChildNodes
+
+ Dim name As String = xmlTagNode.Item("name").InnerText
+ Dim value As String = xmlTagNode.Item("value").InnerText
+
+ For Each objCustomField As CustomFieldInfo In objCustomFields
+ If (objCustomField.Name.ToLower() = name.ToLower()) Then
+ Dim objCustomValue As New CustomValueInfo
+ objCustomValue.CustomFieldID = objCustomField.CustomFieldID
+ objCustomValue.ArticleID = objArticle.ArticleID
+ objCustomValue.CustomValue = value
+
+ Dim objCustomValueController As New CustomValueController()
+ objCustomValueController.Add(objCustomValue)
+ Exit For
+ End If
+ Next
+ Next
+ End If
+
+ If (xmlChildNode.Name = "images") Then
+ Dim sortOrder As Integer = 0
+ For Each xmlImageNode As XmlNode In xmlChildNode.ChildNodes
+ Dim objImage As New ImageInfo
+
+ objImage.ArticleID = objArticle.ArticleID
+ objImage.Title = xmlImageNode.Item("title").InnerText
+ objImage.FileName = xmlImageNode.Item("filename").InnerText
+ objImage.Extension = xmlImageNode.Item("extension").InnerText
+ objImage.Size = Convert.ToInt32(xmlImageNode.Item("size").InnerText)
+ objImage.Width = Convert.ToInt32(xmlImageNode.Item("width").InnerText)
+ objImage.Height = Convert.ToInt32(xmlImageNode.Item("height").InnerText)
+ objImage.ContentType = xmlImageNode.Item("contentType").InnerText
+ objImage.Folder = xmlImageNode.Item("folder").InnerText
+ objImage.SortOrder = sortOrder
+
+ Dim objImageController As New ImageController()
+ objImageController.Add(objImage)
+
+ sortOrder = sortOrder + 1
+ Next
+ If (sortOrder > 0) Then
+ objArticle.ImageCount = sortOrder
+ objArticleController.UpdateArticle(objArticle)
+ End If
+ End If
+
+ If (xmlChildNode.Name = "files") Then
+ Dim sortOrder As Integer = 0
+ For Each xmlImageNode As XmlNode In xmlChildNode.ChildNodes
+ Dim objFile As New FileInfo
+
+ objFile.ArticleID = objArticle.ArticleID
+ objFile.Title = xmlImageNode.Item("title").InnerText
+ objFile.FileName = xmlImageNode.Item("filename").InnerText
+ objFile.Extension = xmlImageNode.Item("extension").InnerText
+ objFile.Size = Convert.ToInt32(xmlImageNode.Item("size").InnerText)
+ objFile.ContentType = xmlImageNode.Item("contentType").InnerText
+ objFile.Folder = xmlImageNode.Item("folder").InnerText
+ objFile.SortOrder = sortOrder
+
+ Dim objFileController As New FileController()
+ objFileController.Add(objFile)
+
+ sortOrder = sortOrder + 1
+ Next
+ If (sortOrder > 0) Then
+ objArticle.FileCount = sortOrder
+ objArticleController.UpdateArticle(objArticle)
+ End If
+ End If
+
+ If (xmlChildNode.Name = "pages") Then
+ Dim sortOrder As Integer = 0
+ For Each xmlImageNode As XmlNode In xmlChildNode.ChildNodes
+
+ Dim objPage As New PageInfo
+
+ objPage.ArticleID = objArticle.ArticleID
+ objPage.Title = xmlImageNode.Item("title").InnerText
+ objPage.PageText = xmlImageNode.Item("pageText").InnerText
+ objPage.SortOrder = sortOrder
+
+ Dim objPageController As New PageController()
+ objPageController.AddPage(objPage)
+
+ sortOrder = sortOrder + 1
+ Next
+ If (sortOrder > 0) Then
+ objArticle.PageCount = sortOrder
+ objArticleController.UpdateArticle(objArticle)
+ End If
+ End If
+
+ If (xmlChildNode.Name = "comments") Then
+ Dim sortOrder As Integer = 0
+ For Each xmlImageNode As XmlNode In xmlChildNode.ChildNodes
+
+ Dim objComment As New CommentInfo
+
+ objComment.UserID = Null.NullInteger
+ objComment.ArticleID = objArticle.ArticleID
+ objComment.CreatedDate = DateTime.Parse(xmlImageNode.Item("createdDate").InnerText)
+ objComment.Comment = xmlImageNode.Item("commentText").InnerText
+ objComment.RemoteAddress = xmlImageNode.Item("remoteAddress").InnerText
+ objComment.Type = Convert.ToInt32(xmlImageNode.Item("type").InnerText)
+ objComment.TrackbackUrl = xmlImageNode.Item("trackbackUrl").InnerText
+ objComment.TrackbackTitle = xmlImageNode.Item("trackbackTitle").InnerText
+ objComment.TrackbackBlogName = xmlImageNode.Item("trackbackBlogName").InnerText
+ objComment.TrackbackExcerpt = xmlImageNode.Item("trackbackExcerpt").InnerText
+ objComment.AnonymousName = xmlImageNode.Item("anonymousName").InnerText
+ objComment.AnonymousEmail = xmlImageNode.Item("anonymousEmail").InnerText
+ objComment.AnonymousURL = xmlImageNode.Item("anonymousUrl").InnerText
+ objComment.NotifyMe = Convert.ToBoolean(xmlImageNode.Item("notifyMe").InnerText)
+ objComment.IsApproved = True
+ objComment.ApprovedBy = Null.NullInteger
+
+ Dim objCommentController As New CommentController()
+ objCommentController.AddComment(objComment)
+
+ sortOrder = sortOrder + 1
+ Next
+ If (sortOrder > 0) Then
+ objArticle.CommentCount = sortOrder
+ objArticleController.UpdateArticle(objArticle)
+ End If
+ End If
+ Next
+
+ End Sub
+
+#End Region
+
+ End Class
+
+End Namespace
diff --git a/Components/ArticleInfo.vb b/Components/ArticleInfo.vb
new file mode 100755
index 0000000..1812774
--- /dev/null
+++ b/Components/ArticleInfo.vb
@@ -0,0 +1,580 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.Data
+
+Imports DotNetNuke
+Imports DotNetNuke.Common
+Imports DotNetNuke.Common.Utilities
+Imports DotNetNuke.Entities.Users
+Imports DotNetNuke.Security.Roles
+Imports Ventrian.NewsArticles.Components.CustomFields
+
+Namespace Ventrian.NewsArticles
+
+ Public Class ArticleInfo
+
+#Region " Private Members "
+
+ ' local property declarations
+ Dim _articleID As Integer
+ Dim _authorID As Integer
+ Dim _approverID As Integer
+ Dim _createdDate As DateTime
+ Dim _lastUpdate As DateTime
+ Dim _title As String
+ Dim _summary As String
+ Dim _articleText As String
+ Dim _isApproved As Boolean
+ Dim _isDraft As Boolean
+ Dim _numberOfViews As Integer
+ Dim _startDate As DateTime
+ Dim _endDate As DateTime
+ Dim _moduleID As Integer
+ Dim _isFeatured As Boolean
+ Dim _rating As Double
+ Dim _ratingCount As Integer
+ Dim _lastUpdateID As Integer
+ Dim _isSecure As Boolean
+ Dim _isNewWindow As Boolean
+
+ Dim _metaTitle As String
+ Dim _metaDescription As String
+ Dim _metaKeywords As String
+ Dim _pageHeadText As String
+ Dim _shortUrl As String
+ Dim _rssGuid As String
+
+ Dim _imageUrl As String
+ Dim _url As String
+
+ Dim _authorEmail As String
+ Dim _authorUserName As String
+ Dim _authorFirstName As String
+ Dim _authorLastName As String
+ Dim _authorDisplayName As String
+
+ Dim _lastUpdateEmail As String
+ Dim _lastUpdateUserName As String
+ Dim _lastUpdateFirstName As String
+ Dim _lastUpdateLastName As String
+ Dim _lastUpdateDisplayName As String
+
+ Dim _body As String
+ Dim _pageCount As Integer
+ Dim _commentCount As Integer
+ Dim _fileCount As Integer
+ Dim _imageCount As Integer
+ Dim _imageUrlResolved As String
+
+ Dim _customList As Hashtable
+
+ Dim _tags As String
+
+ Dim _approver As UserInfo
+
+#End Region
+
+#Region " Private Methods "
+
+ Private Sub InitializePropertyList()
+
+ ' Add Caching
+ Dim objCustomFieldController As New CustomFieldController
+ Dim objCustomFields As ArrayList = objCustomFieldController.List(Me.ModuleID)
+
+ Dim objCustomValueController As New CustomValueController
+ Dim objCustomValues As List(Of CustomValueInfo) = objCustomValueController.List(Me.ArticleID)
+
+ _customList = New Hashtable
+
+ For Each objCustomField As CustomFieldInfo In objCustomFields
+ Dim value As String = ""
+ For Each objCustomValue As CustomValueInfo In objCustomValues
+ If (objCustomValue.CustomFieldID = objCustomField.CustomFieldID) Then
+ value = objCustomValue.CustomValue
+ End If
+ Next
+ _customList.Add(objCustomField.CustomFieldID, value)
+ Next
+
+ End Sub
+
+#End Region
+
+#Region " Public Properties "
+
+ Public Property ArticleID() As Integer
+ Get
+ Return _articleID
+ End Get
+ Set(ByVal Value As Integer)
+ _articleID = Value
+ End Set
+ End Property
+
+ Public Property AuthorID() As Integer
+ Get
+ Return _authorID
+ End Get
+ Set(ByVal Value As Integer)
+ _authorID = Value
+ End Set
+ End Property
+
+ Public Property ApproverID() As Integer
+ Get
+ Return _approverID
+ End Get
+ Set(ByVal Value As Integer)
+ _approverID = Value
+ End Set
+ End Property
+
+ Public Property CreatedDate() As DateTime
+ Get
+ Return _createdDate
+ End Get
+ Set(ByVal Value As DateTime)
+ _createdDate = Value
+ End Set
+ End Property
+
+ Public Property LastUpdate() As DateTime
+ Get
+ Return _lastUpdate
+ End Get
+ Set(ByVal Value As DateTime)
+ _lastUpdate = Value
+ End Set
+ End Property
+
+ Public Property Title() As String
+ Get
+ Return _title
+ End Get
+ Set(ByVal Value As String)
+ _title = Value
+ End Set
+ End Property
+
+ Public Property Summary() As String
+ Get
+ Return _summary
+ End Get
+ Set(ByVal Value As String)
+ _summary = Value
+ End Set
+ End Property
+
+ Public Property ArticleText() As String
+ Get
+ Return _articleText
+ End Get
+ Set(ByVal Value As String)
+ _articleText = Value
+ End Set
+ End Property
+
+ Public Property IsApproved() As Boolean
+ Get
+ Return _isApproved
+ End Get
+ Set(ByVal Value As Boolean)
+ _isApproved = Value
+ End Set
+ End Property
+
+ Public Property IsDraft() As Boolean
+ Get
+ Return _isDraft
+ End Get
+ Set(ByVal Value As Boolean)
+ _isDraft = Value
+ End Set
+ End Property
+
+ Public Property NumberOfViews() As Integer
+ Get
+ Return _numberOfViews
+ End Get
+ Set(ByVal Value As Integer)
+ _numberOfViews = Value
+ End Set
+ End Property
+
+ Public Property StartDate() As DateTime
+ Get
+ Return _startDate
+ End Get
+ Set(ByVal Value As DateTime)
+ _startDate = Value
+ End Set
+ End Property
+
+ Public Property EndDate() As DateTime
+ Get
+ Return _endDate
+ End Get
+ Set(ByVal Value As DateTime)
+ _endDate = Value
+ End Set
+ End Property
+
+ Public Property ModuleID() As Integer
+ Get
+ Return _moduleID
+ End Get
+ Set(ByVal Value As Integer)
+ _moduleID = Value
+ End Set
+ End Property
+
+ Public Property ImageUrl() As String
+ Get
+ Return _imageUrl
+ End Get
+ Set(ByVal Value As String)
+ _imageUrl = Value
+ End Set
+ End Property
+
+ Public Property Url() As String
+ Get
+ Return _url
+ End Get
+ Set(ByVal Value As String)
+ _url = Value
+ End Set
+ End Property
+
+ Public Property IsFeatured() As Boolean
+ Get
+ Return _isFeatured
+ End Get
+ Set(ByVal Value As Boolean)
+ _isFeatured = Value
+ End Set
+ End Property
+
+ Public Property Rating() As Double
+ Get
+ Return _rating
+ End Get
+ Set(ByVal Value As Double)
+ _rating = Value
+ End Set
+ End Property
+
+ Public Property RatingCount() As Integer
+ Get
+ Return _ratingCount
+ End Get
+ Set(ByVal Value As Integer)
+ _ratingCount = Value
+ End Set
+ End Property
+
+ Public Property LastUpdateID() As Integer
+ Get
+ Return _lastUpdateID
+ End Get
+ Set(ByVal Value As Integer)
+ _lastUpdateID = Value
+ End Set
+ End Property
+
+ Public Property IsSecure() As Boolean
+ Get
+ Return _isSecure
+ End Get
+ Set(ByVal Value As Boolean)
+ _isSecure = Value
+ End Set
+ End Property
+
+ Public Property IsNewWindow() As Boolean
+ Get
+ Return _isNewWindow
+ End Get
+ Set(ByVal Value As Boolean)
+ _isNewWindow = Value
+ End Set
+ End Property
+
+ Public Property MetaTitle() As String
+ Get
+ Return _metaTitle
+ End Get
+ Set(ByVal Value As String)
+ _metaTitle = Value
+ End Set
+ End Property
+
+ Public Property MetaDescription() As String
+ Get
+ Return _metaDescription
+ End Get
+ Set(ByVal Value As String)
+ _metaDescription = Value
+ End Set
+ End Property
+
+ Public Property MetaKeywords() As String
+ Get
+ Return _metaKeywords
+ End Get
+ Set(ByVal Value As String)
+ _metaKeywords = Value
+ End Set
+ End Property
+
+ Public Property PageHeadText() As String
+ Get
+ Return _pageHeadText
+ End Get
+ Set(ByVal Value As String)
+ _pageHeadText = Value
+ End Set
+ End Property
+
+ Public Property ShortUrl() As String
+ Get
+ Return _shortUrl
+ End Get
+ Set(ByVal Value As String)
+ _shortUrl = Value
+ End Set
+ End Property
+
+ Public Property RssGuid() As String
+ Get
+ Return _rssGuid
+ End Get
+ Set(ByVal Value As String)
+ _rssGuid = Value
+ End Set
+ End Property
+
+ Public Property AuthorUserName() As String
+ Get
+ Return _authorUserName
+ End Get
+ Set(ByVal Value As String)
+ _authorUserName = Value
+ End Set
+ End Property
+
+ Public Property AuthorEmail() As String
+ Get
+ Return _authorEmail
+ End Get
+ Set(ByVal Value As String)
+ _authorEmail = Value
+ End Set
+ End Property
+
+ Public Property AuthorFirstName() As String
+ Get
+ Return _authorFirstName
+ End Get
+ Set(ByVal Value As String)
+ _authorFirstName = Value
+ End Set
+ End Property
+
+ Public Property AuthorLastName() As String
+ Get
+ Return _authorLastName
+ End Get
+ Set(ByVal Value As String)
+ _authorLastName = Value
+ End Set
+ End Property
+
+ Public Property AuthorDisplayName() As String
+ Get
+ Return _authorDisplayName
+ End Get
+ Set(ByVal Value As String)
+ _authorDisplayName = Value
+ End Set
+ End Property
+
+ Public Property Status() As StatusType
+ Get
+ If (IsDraft = True) Then
+ Return StatusType.Draft
+ End If
+
+ If (IsApproved = False) Then
+ Return StatusType.AwaitingApproval
+ Else
+ Return StatusType.Published
+ End If
+ End Get
+ Set(ByVal Value As StatusType)
+ Select Case Value
+ Case StatusType.Draft
+ _isDraft = True
+ _isApproved = False
+ Exit Select
+ Case StatusType.AwaitingApproval
+ _isDraft = False
+ _isApproved = False
+ Exit Select
+ Case StatusType.Published
+ _isDraft = False
+ _isApproved = True
+ Exit Select
+ Case Else
+ Exit Select
+ End Select
+ End Set
+ End Property
+
+ Public ReadOnly Property AuthorFullName() As String
+ Get
+ Return _authorFirstName & " " & _authorLastName
+ End Get
+ End Property
+
+ Public Property LastUpdateUserName() As String
+ Get
+ Return _lastUpdateUserName
+ End Get
+ Set(ByVal Value As String)
+ _lastUpdateUserName = Value
+ End Set
+ End Property
+
+ Public Property LastUpdateEmail() As String
+ Get
+ Return _lastUpdateEmail
+ End Get
+ Set(ByVal Value As String)
+ _lastUpdateEmail = Value
+ End Set
+ End Property
+
+ Public Property LastUpdateFirstName() As String
+ Get
+ Return _lastUpdateFirstName
+ End Get
+ Set(ByVal Value As String)
+ _lastUpdateFirstName = Value
+ End Set
+ End Property
+
+ Public Property LastUpdateLastName() As String
+ Get
+ Return _lastUpdateLastName
+ End Get
+ Set(ByVal Value As String)
+ _lastUpdateLastName = Value
+ End Set
+ End Property
+
+ Public Property LastUpdateDisplayName() As String
+ Get
+ Return _lastUpdateDisplayName
+ End Get
+ Set(ByVal Value As String)
+ _lastUpdateDisplayName = Value
+ End Set
+ End Property
+
+ Public ReadOnly Property LastUpdateFullName() As String
+ Get
+ Return _lastUpdateFirstName & " " & _lastUpdateLastName
+ End Get
+ End Property
+
+ Public Property Body() As String
+ Get
+ Return _body
+ End Get
+ Set(ByVal Value As String)
+ _body = Value
+ End Set
+ End Property
+
+ Public Property PageCount() As Integer
+ Get
+ Return _pageCount
+ End Get
+ Set(ByVal Value As Integer)
+ _pageCount = Value
+ End Set
+ End Property
+
+ Public Property CommentCount() As Integer
+ Get
+ Return _commentCount
+ End Get
+ Set(ByVal Value As Integer)
+ _commentCount = Value
+ End Set
+ End Property
+
+ Public Property FileCount() As Integer
+ Get
+ Return _fileCount
+ End Get
+ Set(ByVal Value As Integer)
+ _fileCount = Value
+ End Set
+ End Property
+
+ Public Property ImageCount() As Integer
+ Get
+ Return _imageCount
+ End Get
+ Set(ByVal Value As Integer)
+ _imageCount = Value
+ End Set
+ End Property
+
+ Public ReadOnly Property CustomList() As Hashtable
+ Get
+ If (_customList Is Nothing) Then
+ InitializePropertyList()
+ End If
+ Return _customList
+ End Get
+ End Property
+
+ Public Property Tags() As String
+ Get
+ Return _tags
+ End Get
+ Set(ByVal Value As String)
+ _tags = Value
+ End Set
+ End Property
+
+ Public ReadOnly Property Approver(ByVal portalID As Integer) As UserInfo
+ Get
+ If (_approver Is Nothing And ApproverID <> Null.NullInteger) Then
+ Dim objUserController As New UserController
+ _approver = objUserController.GetUser(portalID, ApproverID)
+ End If
+ Return _approver
+ End Get
+ End Property
+
+ Public ReadOnly Property TitleAlternate() As String
+ Get
+ Return "[" & StartDate.Year.ToString() & "-" & StartDate.Month.ToString() & "-" & StartDate.Day.ToString() & "] " & Title
+ End Get
+ End Property
+
+#End Region
+
+ End Class
+
+End Namespace
diff --git a/Components/ArticleSettings.vb b/Components/ArticleSettings.vb
new file mode 100755
index 0000000..adf4728
--- /dev/null
+++ b/Components/ArticleSettings.vb
@@ -0,0 +1,1607 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports DotNetNuke.Common
+Imports DotNetNuke.Common.Utilities
+Imports DotNetNuke.Entities.Modules
+Imports DotNetNuke.Entities.Portals
+Imports DotNetNuke.Entities.Users
+Imports DotNetNuke.Security
+Imports Ventrian.NewsArticles.Components.Types
+
+Namespace Ventrian.NewsArticles
+
+ Public Class ArticleSettings
+
+#Region " Private Members "
+
+ Private ReadOnly _settings As Hashtable
+ Private ReadOnly _portalSettings As PortalSettings
+ Private ReadOnly _moduleConfiguration As ModuleInfo
+
+#End Region
+
+#Region " Constructors "
+
+ Public Sub New(ByVal settings As Hashtable, ByVal portalSettings As PortalSettings, ByVal moduleConfiguration As ModuleInfo)
+ _settings = settings
+ _portalSettings = portalSettings
+ _moduleConfiguration = moduleConfiguration
+ End Sub
+
+#End Region
+
+#Region " Private Properties "
+
+ Public ReadOnly Property Settings() As Hashtable
+ Get
+ Return _settings
+ End Get
+ End Property
+
+#End Region
+
+#Region " Private Methods "
+
+ Private Function IsInRoles(ByVal roles As String) As Boolean
+
+ ' Replacement for core IsInRoles check because it doesn't auto-pass super users.
+
+ If Not roles Is Nothing Then
+ Dim context As HttpContext = HttpContext.Current
+ Dim objUserInfo As UserInfo = UserController.GetCurrentUserInfo
+ Dim role As String
+
+ For Each role In roles.Split(New Char() {";"c})
+ If (role <> "" AndAlso Not role Is Nothing AndAlso _
+ ((context.Request.IsAuthenticated = False And role = glbRoleUnauthUserName) Or _
+ role = glbRoleAllUsersName Or _
+ objUserInfo.IsInRole(role) = True _
+ )) Then
+ Return True
+ End If
+ Next role
+
+ End If
+
+ Return False
+
+ End Function
+
+#End Region
+
+#Region " Public Properties "
+
+ Public ReadOnly Property AlwaysShowPageID() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.SEO_ALWAYS_SHOW_PAGEID_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.SEO_ALWAYS_SHOW_PAGEID_SETTING).ToString())
+ Else
+ Return False
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property Author() As Integer
+ Get
+ If (Settings.Contains(ArticleConstants.AUTHOR_SETTING)) Then
+ If (IsNumeric(Settings(ArticleConstants.AUTHOR_SETTING).ToString())) Then
+ Return Convert.ToInt32(Settings(ArticleConstants.AUTHOR_SETTING).ToString())
+ Else
+ Return Null.NullInteger
+ End If
+ Else
+ Return Null.NullInteger
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property AuthorDefault() As Integer
+ Get
+ If (Settings.Contains(ArticleConstants.AUTHOR_DEFAULT_SETTING)) Then
+ If (IsNumeric(Settings(ArticleConstants.AUTHOR_DEFAULT_SETTING).ToString())) Then
+ Return Convert.ToInt32(Settings(ArticleConstants.AUTHOR_DEFAULT_SETTING).ToString())
+ Else
+ Return Null.NullInteger
+ End If
+ Else
+ Return Null.NullInteger
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property AuthorSelect() As AuthorSelectType
+ Get
+ If (Settings.Contains(ArticleConstants.AUTHOR_SELECT_TYPE)) Then
+ Return CType(System.Enum.Parse(GetType(AuthorSelectType), Settings(ArticleConstants.AUTHOR_SELECT_TYPE).ToString()), AuthorSelectType)
+ Else
+ Return AuthorSelectType.ByDropdown
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property AuthorUserIDFilter() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.AUTHOR_USERID_FILTER_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.AUTHOR_USERID_FILTER_SETTING).ToString())
+ Else
+ Return False
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property AuthorUserIDParam() As String
+ Get
+ If (Settings.Contains(ArticleConstants.AUTHOR_USERID_PARAM_SETTING)) Then
+ Return Settings(ArticleConstants.AUTHOR_USERID_PARAM_SETTING).ToString()
+ Else
+ Return "ID"
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property AuthorUsernameFilter() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.AUTHOR_USERNAME_FILTER_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.AUTHOR_USERNAME_FILTER_SETTING).ToString())
+ Else
+ Return False
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property AuthorUsernameParam() As String
+ Get
+ If (Settings.Contains(ArticleConstants.AUTHOR_USERNAME_PARAM_SETTING)) Then
+ Return Settings(ArticleConstants.AUTHOR_USERNAME_PARAM_SETTING).ToString()
+ Else
+ Return "Username"
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property AuthorLoggedInUserFilter() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.AUTHOR_LOGGED_IN_USER_FILTER_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.AUTHOR_LOGGED_IN_USER_FILTER_SETTING).ToString())
+ Else
+ Return False
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property ArchiveAuthor() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.ARCHIVE_AUTHOR_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.ARCHIVE_AUTHOR_SETTING).ToString())
+ Else
+ Return ArticleConstants.ARCHIVE_AUTHOR_SETTING_DEFAULT
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property ArchiveCategories() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.ARCHIVE_CATEGORIES_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.ARCHIVE_CATEGORIES_SETTING).ToString())
+ Else
+ Return ArticleConstants.ARCHIVE_CATEGORIES_SETTING_DEFAULT
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property ArchiveCurrentArticles() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.ARCHIVE_CURRENT_ARTICLES_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.ARCHIVE_CURRENT_ARTICLES_SETTING).ToString())
+ Else
+ Return ArticleConstants.ARCHIVE_CURRENT_ARTICLES_SETTING_DEFAULT
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property ArchiveMonth() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.ARCHIVE_MONTH_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.ARCHIVE_MONTH_SETTING).ToString())
+ Else
+ Return ArticleConstants.ARCHIVE_MONTH_SETTING_DEFAULT
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property BubbleFeatured() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.BUBBLE_FEATURED_ARTICLES)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.BUBBLE_FEATURED_ARTICLES).ToString())
+ Else
+ Return False
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property CategoryBreadcrumb() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.CATEGORY_BREADCRUMB_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.CATEGORY_BREADCRUMB_SETTING).ToString())
+ Else
+ Return ArticleConstants.CATEGORY_BREADCRUMB_SETTING_DEFAULT
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property CategoryFilterSubmit() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.CATEGORY_FILTER_SUBMIT_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.CATEGORY_FILTER_SUBMIT_SETTING).ToString())
+ Else
+ Return ArticleConstants.CATEGORY_FILTER_SUBMIT_SETTING_DEFAULT
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property IncludeInPageName() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.CATEGORY_NAME_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.CATEGORY_NAME_SETTING).ToString())
+ Else
+ Return ArticleConstants.CATEGORY_NAME_SETTING_DEFAULT
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property CategorySelectionHeight() As Integer
+ Get
+ If (Settings.Contains(ArticleConstants.CATEGORY_SELECTION_HEIGHT_SETTING)) Then
+ Return Convert.ToInt32(Settings(ArticleConstants.CATEGORY_SELECTION_HEIGHT_SETTING).ToString())
+ Else
+ Return ArticleConstants.CATEGORY_SELECTION_HEIGHT_DEFAULT
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property CategorySortType() As CategorySortType
+ Get
+ If (Settings.Contains(ArticleConstants.CATEGORY_SORT_SETTING)) Then
+ Try
+ Return CType(System.Enum.Parse(GetType(CategorySortType), Settings(ArticleConstants.CATEGORY_SORT_SETTING).ToString()), CategorySortType)
+ Catch
+ Return ArticleConstants.CATEGORY_SORT_SETTING_DEFAULT
+ End Try
+ Else
+ Return ArticleConstants.CATEGORY_SORT_SETTING_DEFAULT
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property CommentAkismetKey() As String
+ Get
+ If (Settings.Contains(ArticleConstants.COMMENT_AKISMET_SETTING)) Then
+ Return Settings(ArticleConstants.COMMENT_AKISMET_SETTING).ToString()
+ Else
+ Return ""
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property CommentModeration() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.ENABLE_COMMENT_MODERATION_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.ENABLE_COMMENT_MODERATION_SETTING).ToString())
+ Else
+ Return False
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property CommentRequireName() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.COMMENT_REQUIRE_NAME_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.COMMENT_REQUIRE_NAME_SETTING).ToString())
+ Else
+ Return True
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property CommentRequireEmail() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.COMMENT_REQUIRE_EMAIL_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.COMMENT_REQUIRE_EMAIL_SETTING).ToString())
+ Else
+ Return True
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property ContentSharingPortals() As String
+ Get
+ If (Settings.Contains(ArticleConstants.CONTENT_SHARING_SETTING)) Then
+ Return Settings(ArticleConstants.CONTENT_SHARING_SETTING).ToString()
+ Else
+ Return Null.NullString()
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property DefaultImagesFolder() As Integer
+ Get
+ If (Settings.Contains(ArticleConstants.DEFAULT_IMAGES_FOLDER_SETTING)) Then
+ If (IsNumeric(Settings(ArticleConstants.DEFAULT_IMAGES_FOLDER_SETTING).ToString())) Then
+ Return Convert.ToInt32(Settings(ArticleConstants.DEFAULT_IMAGES_FOLDER_SETTING).ToString())
+ Else
+ Return Null.NullInteger
+ End If
+ Else
+ Return Null.NullInteger
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property DefaultFilesFolder() As Integer
+ Get
+ If (Settings.Contains(ArticleConstants.DEFAULT_FILES_FOLDER_SETTING)) Then
+ If (IsNumeric(Settings(ArticleConstants.DEFAULT_FILES_FOLDER_SETTING).ToString())) Then
+ Return Convert.ToInt32(Settings(ArticleConstants.DEFAULT_FILES_FOLDER_SETTING).ToString())
+ Else
+ Return Null.NullInteger
+ End If
+ Else
+ Return Null.NullInteger
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property EnableActiveSocialFeed() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.ACTIVE_SOCIAL_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.ACTIVE_SOCIAL_SETTING).ToString())
+ Else
+ Return False
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property JournalIntegration() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.JOURNAL_INTEGRATION_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.JOURNAL_INTEGRATION_SETTING).ToString())
+ Else
+ Return True
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property JournalIntegrationGroups() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.JOURNAL_INTEGRATION_GROUPS_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.JOURNAL_INTEGRATION_GROUPS_SETTING).ToString())
+ Else
+ Return False
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property ActiveSocialSubmitKey() As String
+ Get
+ If (Settings.Contains(ArticleConstants.ACTIVE_SOCIAL_SUBMIT_SETTING)) Then
+ Return Settings(ArticleConstants.ACTIVE_SOCIAL_SUBMIT_SETTING).ToString()
+ Else
+ Return "9F02B914-F565-4E5A-9194-8423431056CD"
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property ActiveSocialCommentKey() As String
+ Get
+ If (Settings.Contains(ArticleConstants.ACTIVE_SOCIAL_COMMENT_SETTING)) Then
+ Return Settings(ArticleConstants.ACTIVE_SOCIAL_COMMENT_SETTING).ToString()
+ Else
+ Return ""
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property ActiveSocialRateKey() As String
+ Get
+ If (Settings.Contains(ArticleConstants.ACTIVE_SOCIAL_RATE_SETTING)) Then
+ Return Settings(ArticleConstants.ACTIVE_SOCIAL_RATE_SETTING).ToString()
+ Else
+ Return ""
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property EnableAutoTrackback() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.ENABLE_AUTO_TRACKBACK_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.ENABLE_AUTO_TRACKBACK_SETTING).ToString())
+ Else
+ Return True
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property EnableCoreSearch() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.ENABLE_CORE_SEARCH_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.ENABLE_CORE_SEARCH_SETTING).ToString())
+ Else
+ Return False
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property EnableExternalImages() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.ENABLE_EXTERNAL_IMAGES_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.ENABLE_EXTERNAL_IMAGES_SETTING).ToString())
+ Else
+ Return True
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property EnableNotificationPing() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.ENABLE_NOTIFICATION_PING_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.ENABLE_NOTIFICATION_PING_SETTING).ToString())
+ Else
+ Return False
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property EnableImagesUpload() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.ENABLE_UPLOAD_IMAGES_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.ENABLE_UPLOAD_IMAGES_SETTING).ToString())
+ Else
+ Return True
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property EnablePortalImages() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.ENABLE_PORTAL_IMAGES_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.ENABLE_PORTAL_IMAGES_SETTING).ToString())
+ Else
+ Return True
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property EnableRatings() As Boolean
+ Get
+ If (EnableRatingsAnonymous Or EnableRatingsAuthenticated) Then
+ Return True
+ Else
+ Return False
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property EnableRatingsAnonymous() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.ENABLE_RATINGS_ANONYMOUS_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.ENABLE_RATINGS_ANONYMOUS_SETTING).ToString())
+ Else
+ Return True
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property EnableRatingsAuthenticated() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.ENABLE_RATINGS_AUTHENTICATED_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.ENABLE_RATINGS_AUTHENTICATED_SETTING).ToString())
+ Else
+ Return True
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property EnableSmartThinkerStoryFeed() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.SMART_THINKER_STORY_FEED_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.SMART_THINKER_STORY_FEED_SETTING).ToString())
+ Else
+ Return False
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property EnableSyndication() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.ENABLE_SYNDICATION_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.ENABLE_SYNDICATION_SETTING).ToString())
+ Else
+ Return True
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property EnableSyndicationEnclosures() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.ENABLE_SYNDICATION_ENCLOSURES_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.ENABLE_SYNDICATION_ENCLOSURES_SETTING).ToString())
+ Else
+ Return True
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property EnableSyndicationHtml() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.ENABLE_SYNDICATION_HTML_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.ENABLE_SYNDICATION_HTML_SETTING).ToString())
+ Else
+ Return False
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property ExpandSummary() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.EXPAND_SUMMARY_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.EXPAND_SUMMARY_SETTING).ToString())
+ Else
+ Return False
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property FeaturedOnly() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.SHOW_FEATURED_ONLY_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.SHOW_FEATURED_ONLY_SETTING).ToString())
+ Else
+ Return False
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property FilterCategories() As Integer()
+ Get
+ If (Settings.Contains(ArticleConstants.CATEGORIES_SETTING & _moduleConfiguration.TabID.ToString())) Then
+ If Not (Settings(ArticleConstants.CATEGORIES_SETTING & _moduleConfiguration.TabID.ToString()).ToString = Null.NullString Or Settings(ArticleConstants.CATEGORIES_SETTING & _moduleConfiguration.TabID.ToString()).ToString = "-1") Then
+ Dim categories As String() = Settings(ArticleConstants.CATEGORIES_SETTING & _moduleConfiguration.TabID.ToString()).ToString().Split(","c)
+ Dim cats As New List(Of Integer)
+
+ For Each category As String In categories
+ If (IsNumeric(category)) Then
+ cats.Add(Convert.ToInt32(category))
+ End If
+ Next
+
+ Return cats.ToArray()
+ Else
+ Return Nothing
+ End If
+ Else
+ Return Nothing
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property FilterSingleCategory() As Integer
+ Get
+ If (Settings.Contains(ArticleConstants.CATEGORIES_FILTER_SINGLE_SETTING)) Then
+ If (IsNumeric(Settings(ArticleConstants.CATEGORIES_FILTER_SINGLE_SETTING))) Then
+ Return Convert.ToInt32(Settings(ArticleConstants.CATEGORIES_FILTER_SINGLE_SETTING))
+ Else
+ Return Null.NullInteger
+ End If
+ Else
+ Return Null.NullInteger
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property ImageJQueryPath() As String
+ Get
+ If (Settings.Contains(ArticleConstants.IMAGE_JQUERY_PATH)) Then
+ Return Settings(ArticleConstants.IMAGE_JQUERY_PATH).ToString()
+ Else
+ Return "includes/fancybox/jquery.fancybox.pack.js"
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property ImageThumbnailType() As ThumbnailType
+ Get
+ If (Settings.Contains(ArticleConstants.IMAGE_THUMBNAIL_SETTING)) Then
+ Return CType(System.Enum.Parse(GetType(ThumbnailType), Settings(ArticleConstants.IMAGE_THUMBNAIL_SETTING).ToString()), ThumbnailType)
+ Else
+ Return ArticleConstants.DEFAULT_IMAGE_THUMBNAIL
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property IncludeJQuery() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.INCLUDE_JQUERY_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.INCLUDE_JQUERY_SETTING).ToString())
+ Else
+ Return True
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property MatchCategories() As MatchOperatorType
+ Get
+ If (Settings.Contains(ArticleConstants.MATCH_OPERATOR_SETTING)) Then
+ Return CType(System.Enum.Parse(GetType(MatchOperatorType), Settings(ArticleConstants.MATCH_OPERATOR_SETTING).ToString()), MatchOperatorType)
+ Else
+ Return MatchOperatorType.MatchAny
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property MaxArticles() As Integer
+ Get
+ If (Settings.Contains(ArticleConstants.MAX_ARTICLES_SETTING)) Then
+ If (IsNumeric(Settings(ArticleConstants.MAX_ARTICLES_SETTING).ToString())) Then
+ Return Convert.ToInt32(Settings(ArticleConstants.MAX_ARTICLES_SETTING).ToString())
+ Else
+ Return Null.NullInteger
+ End If
+ Else
+ Return Null.NullInteger
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property MaxAge() As Integer
+ Get
+ If (Settings.Contains(ArticleConstants.MAX_AGE_SETTING)) Then
+ If (IsNumeric(Settings(ArticleConstants.MAX_AGE_SETTING).ToString())) Then
+ Return Convert.ToInt32(Settings(ArticleConstants.MAX_AGE_SETTING).ToString())
+ Else
+ Return Null.NullInteger
+ End If
+ Else
+ Return Null.NullInteger
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property MaxImageHeight() As Integer
+ Get
+ If (Settings.Contains(ArticleConstants.IMAGE_MAX_HEIGHT_SETTING)) Then
+ If (IsNumeric(Settings(ArticleConstants.IMAGE_MAX_HEIGHT_SETTING).ToString())) Then
+ Return Convert.ToInt32(Settings(ArticleConstants.IMAGE_MAX_HEIGHT_SETTING).ToString())
+ Else
+ Return ArticleConstants.DEFAULT_IMAGE_MAX_HEIGHT
+ End If
+ Else
+ Return ArticleConstants.DEFAULT_IMAGE_MAX_HEIGHT
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property MaxImageWidth() As Integer
+ Get
+ If (Settings.Contains(ArticleConstants.IMAGE_MAX_WIDTH_SETTING)) Then
+ If (IsNumeric(Settings(ArticleConstants.IMAGE_MAX_WIDTH_SETTING).ToString())) Then
+ Return Convert.ToInt32(Settings(ArticleConstants.IMAGE_MAX_WIDTH_SETTING).ToString())
+ Else
+ Return ArticleConstants.DEFAULT_IMAGE_MAX_WIDTH
+ End If
+ Else
+ Return ArticleConstants.DEFAULT_IMAGE_MAX_WIDTH
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property MenuPosition() As MenuPositionType
+ Get
+ If (Settings.Contains(ArticleConstants.MENU_POSITION_TYPE)) Then
+ Return CType(System.Enum.Parse(GetType(MenuPositionType), Settings(ArticleConstants.MENU_POSITION_TYPE).ToString()), MenuPositionType)
+ Else
+ Return MenuPositionType.Top
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property NotFeaturedOnly() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.SHOW_NOT_FEATURED_ONLY_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.SHOW_NOT_FEATURED_ONLY_SETTING).ToString())
+ Else
+ Return False
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property NotifyAuthorOnComment() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.NOTIFY_COMMENT_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.NOTIFY_COMMENT_SETTING))
+ Else
+ Return True
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property NotifyAuthorOnApproval() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.NOTIFY_APPROVAL_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.NOTIFY_APPROVAL_SETTING))
+ Else
+ Return True
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property NotifyDefault() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.NOTIFY_DEFAULT_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.NOTIFY_DEFAULT_SETTING))
+ Else
+ Return False
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property NotifyEmailOnComment() As String
+ Get
+ If (Settings.Contains(ArticleConstants.NOTIFY_COMMENT_SETTING_EMAIL)) Then
+ Return Settings(ArticleConstants.NOTIFY_COMMENT_SETTING_EMAIL).ToString()
+ Else
+ Return ""
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property NotifyApproverForCommentApproval() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.NOTIFY_COMMENT_APPROVAL_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.NOTIFY_COMMENT_APPROVAL_SETTING))
+ Else
+ Return True
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property NotifyEmailForCommentApproval() As String
+ Get
+ If (Settings.Contains(ArticleConstants.NOTIFY_COMMENT_APPROVAL_EMAIL_SETTING)) Then
+ Return Settings(ArticleConstants.NOTIFY_COMMENT_APPROVAL_EMAIL_SETTING).ToString()
+ Else
+ Return ""
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property NotSecuredOnly() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.SHOW_NOT_SECURED_ONLY_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.SHOW_NOT_SECURED_ONLY_SETTING).ToString())
+ Else
+ Return False
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property ProcessPostTokens() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.PROCESS_POST_TOKENS)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.PROCESS_POST_TOKENS).ToString())
+ Else
+ Return True
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property ResizeImages() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.IMAGE_RESIZE_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.IMAGE_RESIZE_SETTING).ToString())
+ Else
+ Return ArticleConstants.DEFAULT_IMAGE_RESIZE
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property SecuredOnly() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.SHOW_SECURED_ONLY_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.SHOW_SECURED_ONLY_SETTING).ToString())
+ Else
+ Return False
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property ShortenedID() As String
+ Get
+ If (Settings.Contains(ArticleConstants.SEO_SHORTEN_ID_SETTING)) Then
+ Return Settings(ArticleConstants.SEO_SHORTEN_ID_SETTING).ToString()
+ Else
+ Return "ID"
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property SortBy() As String
+ Get
+ If (Settings.Contains(ArticleConstants.SORT_BY)) Then
+ Return Settings(ArticleConstants.SORT_BY).ToString()
+ Else
+ Return ArticleConstants.DEFAULT_SORT_BY
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property SortDirection() As String
+ Get
+ If (Settings.Contains(ArticleConstants.SORT_DIRECTION)) Then
+ Return Settings(ArticleConstants.SORT_DIRECTION).ToString()
+ Else
+ Return ArticleConstants.DEFAULT_SORT_DIRECTION
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property SortDirectionComments() As Integer
+ Get
+ If (Settings.Contains(ArticleConstants.COMMENT_SORT_DIRECTION_SETTING)) Then
+ Return Convert.ToInt32(Settings(ArticleConstants.COMMENT_SORT_DIRECTION_SETTING).ToString())
+ Else
+ Return 0
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property SyndicationLinkType() As SyndicationLinkType
+ Get
+ If (Settings.Contains(ArticleConstants.SYNDICATION_LINK_TYPE)) Then
+ Return CType(System.Enum.Parse(GetType(SyndicationLinkType), Settings(ArticleConstants.SYNDICATION_LINK_TYPE).ToString()), SyndicationLinkType)
+ Else
+ Return SyndicationLinkType.Article
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property SyndicationEnclosureType() As SyndicationEnclosureType
+ Get
+ If (Settings.Contains(ArticleConstants.SYNDICATION_ENCLOSURE_TYPE)) Then
+ Return CType(System.Enum.Parse(GetType(SyndicationEnclosureType), Settings(ArticleConstants.SYNDICATION_ENCLOSURE_TYPE).ToString()), SyndicationEnclosureType)
+ Else
+ Return SyndicationEnclosureType.Attachment
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property SyndicationSummaryLength() As Integer
+ Get
+ If (Settings.Contains(ArticleConstants.SYNDICATION_SUMMARY_LENGTH)) Then
+ Return Convert.ToInt32(Settings(ArticleConstants.SYNDICATION_SUMMARY_LENGTH).ToString())
+ Else
+ Return Null.NullInteger
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property SyndicationMaxCount() As Integer
+ Get
+ If (Settings.Contains(ArticleConstants.SYNDICATION_MAX_COUNT)) Then
+ Return Convert.ToInt32(Settings(ArticleConstants.SYNDICATION_MAX_COUNT).ToString())
+ Else
+ Return 50
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property SyndicationImagePath() As String
+ Get
+ If (Settings.Contains(ArticleConstants.SYNDICATION_IMAGE_PATH)) Then
+ Return Settings(ArticleConstants.SYNDICATION_IMAGE_PATH).ToString()
+ Else
+ Return "~/DesktopModules/DnnForge - NewsArticles/Images/rssbutton.gif"
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property UseCanonicalLink() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.SEO_USE_CANONICAL_LINK_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.SEO_USE_CANONICAL_LINK_SETTING))
+ Else
+ Return True
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property ExpandMetaInformation() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.SEO_EXPAND_META_INFORMATION_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.SEO_EXPAND_META_INFORMATION_SETTING))
+ Else
+ Return False
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property UniquePageTitles() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.SEO_UNIQUE_PAGE_TITLES_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.SEO_UNIQUE_PAGE_TITLES_SETTING))
+ Else
+ Return True
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property UseCaptcha() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.USE_CAPTCHA_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.USE_CAPTCHA_SETTING))
+ Else
+ Return False
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property UrlModeType() As UrlModeType
+ Get
+ If (Settings.Contains(ArticleConstants.SEO_URL_MODE_SETTING)) Then
+ Try
+ Return CType(System.Enum.Parse(GetType(UrlModeType), Settings(ArticleConstants.SEO_URL_MODE_SETTING).ToString()), UrlModeType)
+ Catch
+ Return UrlModeType.Shorterned
+ End Try
+ Else
+ Return UrlModeType.Shorterned
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property WatermarkEnabled() As Boolean
+ Get
+ If (_settings.Contains(ArticleConstants.IMAGE_WATERMARK_ENABLED_SETTING)) Then
+ Return Convert.ToBoolean(_settings(ArticleConstants.IMAGE_WATERMARK_ENABLED_SETTING).ToString())
+ Else
+ Return ArticleConstants.IMAGE_WATERMARK_ENABLED_SETTING_DEFAULT
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property WatermarkText() As String
+ Get
+ If (_settings.Contains(ArticleConstants.IMAGE_WATERMARK_TEXT_SETTING)) Then
+ Return _settings(ArticleConstants.IMAGE_WATERMARK_TEXT_SETTING).ToString()
+ Else
+ Return ArticleConstants.IMAGE_WATERMARK_TEXT_SETTING_DEFAULT
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property WatermarkImage() As String
+ Get
+ If (_settings.Contains(ArticleConstants.IMAGE_WATERMARK_IMAGE_SETTING)) Then
+ Return _settings(ArticleConstants.IMAGE_WATERMARK_IMAGE_SETTING).ToString()
+ Else
+ Return ArticleConstants.IMAGE_WATERMARK_IMAGE_SETTING_DEFAULT
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property WatermarkPosition() As WatermarkPosition
+ Get
+ If (_settings.Contains(ArticleConstants.IMAGE_WATERMARK_IMAGE_POSITION_SETTING)) Then
+ Try
+ Return CType(System.Enum.Parse(GetType(WatermarkPosition), _settings(ArticleConstants.IMAGE_WATERMARK_IMAGE_POSITION_SETTING).ToString()), WatermarkPosition)
+ Catch
+ Return ArticleConstants.IMAGE_WATERMARK_IMAGE_POSITION_SETTING_DEFAULT
+ End Try
+ Else
+ Return ArticleConstants.IMAGE_WATERMARK_IMAGE_POSITION_SETTING_DEFAULT
+ End If
+ End Get
+ End Property
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Public ReadOnly Property PageSize() As Integer
+ Get
+ If (Settings.Contains("Number")) Then
+ If (Convert.ToInt32(Settings("Number").ToString()) > 0) Then
+ Return Convert.ToInt32(Settings("Number").ToString())
+ Else
+ If (Convert.ToInt32(Settings("Number").ToString()) = -1) Then
+ Return 10000
+ Else
+ Return 10
+ End If
+ End If
+ Else
+ Return 10
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property IsCommentsAnonymous() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.ENABLE_ANONYMOUS_COMMENTS_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.ENABLE_ANONYMOUS_COMMENTS_SETTING).ToString())
+ Else
+ Return True
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property IsCommentsEnabled() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.ENABLE_COMMENTS_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.ENABLE_COMMENTS_SETTING).ToString())
+ Else
+ Return True
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property IsCommentModerationEnabled() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.ENABLE_COMMENT_MODERATION_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.ENABLE_COMMENT_MODERATION_SETTING).ToString())
+ Else
+ Return False
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property IsCommentWebsiteHidden() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.COMMENT_HIDE_WEBSITE_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.COMMENT_HIDE_WEBSITE_SETTING).ToString())
+ Else
+ Return False
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property IsRateable() As Boolean
+ Get
+ If (System.Web.HttpContext.Current.Request.IsAuthenticated) Then
+ Return EnableRatingsAuthenticated
+ Else
+ Return EnableRatingsAnonymous
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property IsSyndicationEnabled() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.ENABLE_SYNDICATION_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.ENABLE_SYNDICATION_SETTING).ToString())
+ Else
+ Return True
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property IsIncomingTrackbackEnabled() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.ENABLE_INCOMING_TRACKBACK_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.ENABLE_INCOMING_TRACKBACK_SETTING).ToString())
+ Else
+ Return True
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property LaunchLinks() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.LAUNCH_LINKS)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.LAUNCH_LINKS).ToString())
+ Else
+ Return False
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property DisplayMode() As DisplayType
+ Get
+ If (Settings.Contains(ArticleConstants.DISPLAY_MODE)) Then
+ Return CType(System.Enum.Parse(GetType(DisplayType), Settings(ArticleConstants.DISPLAY_MODE).ToString()), DisplayType)
+ Else
+ Return DisplayType.FullName
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property RelatedMode() As RelatedType
+ Get
+ If (Settings.Contains(ArticleConstants.RELATED_MODE)) Then
+ Return CType(System.Enum.Parse(GetType(RelatedType), Settings(ArticleConstants.RELATED_MODE).ToString()), RelatedType)
+ Else
+ Return RelatedType.MatchCategoriesAnyTagsAny
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property Template() As String
+ Get
+ If (Settings.Contains(ArticleConstants.TEMPLATE_SETTING)) Then
+ Return Settings(ArticleConstants.TEMPLATE_SETTING).ToString()
+ Else
+ Return "Standard"
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property SEOTitleSpecified() As Boolean
+ Get
+ Return Settings.Contains(ArticleConstants.SEO_TITLE_SETTING)
+ End Get
+ End Property
+
+ Public ReadOnly Property ShowPending() As Boolean
+ Get
+ If (Settings.Contains(ArticleConstants.SHOW_PENDING_SETTING)) Then
+ Return Convert.ToBoolean(Settings(ArticleConstants.SHOW_PENDING_SETTING).ToString())
+ Else
+ Return False
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property TitleReplacement() As TitleReplacementType
+ Get
+ If (Settings.Contains(ArticleConstants.TITLE_REPLACEMENT_TYPE)) Then
+ Return CType(System.Enum.Parse(GetType(TitleReplacementType), Settings(ArticleConstants.TITLE_REPLACEMENT_TYPE).ToString()), TitleReplacementType)
+ Else
+ Return TitleReplacementType.Dash
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property TextEditorWidth() As String
+ Get
+ If (Settings.Contains(ArticleConstants.TEXT_EDITOR_WIDTH)) Then
+ Return Settings(ArticleConstants.TEXT_EDITOR_WIDTH).ToString()
+ Else
+ Return "100%"
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property TextEditorHeight() As String
+ Get
+ If (Settings.Contains(ArticleConstants.TEXT_EDITOR_HEIGHT)) Then
+ Return Settings(ArticleConstants.TEXT_EDITOR_HEIGHT).ToString()
+ Else
+ Return "400"
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property TextEditorSummaryMode() As TextEditorModeType
+ Get
+ If (Settings.Contains(ArticleConstants.TEXT_EDITOR_SUMMARY_MODE)) Then
+ Return CType(System.Enum.Parse(GetType(TextEditorModeType), Settings(ArticleConstants.TEXT_EDITOR_SUMMARY_MODE).ToString()), TextEditorModeType)
+ Else
+ Return TextEditorModeType.Rich
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property TextEditorSummaryWidth() As String
+ Get
+ If (Settings.Contains(ArticleConstants.TEXT_EDITOR_SUMMARY_WIDTH)) Then
+ Return Settings(ArticleConstants.TEXT_EDITOR_SUMMARY_WIDTH).ToString()
+ Else
+ Return "100%"
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property TextEditorSummaryHeight() As String
+ Get
+ If (Settings.Contains(ArticleConstants.TEXT_EDITOR_SUMMARY_HEIGHT)) Then
+ Return Settings(ArticleConstants.TEXT_EDITOR_SUMMARY_HEIGHT).ToString()
+ Else
+ Return "400"
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property TwitterName() As String
+ Get
+ If (Settings.Contains(ArticleConstants.TWITTER_USERNAME)) Then
+ Return Settings(ArticleConstants.TWITTER_USERNAME).ToString()
+ Else
+ Return ""
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property TwitterBitLyLogin() As String
+ Get
+ If (Settings.Contains(ArticleConstants.TWITTER_BITLY_LOGIN)) Then
+ Return Settings(ArticleConstants.TWITTER_BITLY_LOGIN).ToString()
+ Else
+ Return ""
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property TwitterBitLyAPIKey() As String
+ Get
+ If (Settings.Contains(ArticleConstants.TWITTER_BITLY_API_KEY)) Then
+ Return Settings(ArticleConstants.TWITTER_BITLY_API_KEY).ToString()
+ Else
+ Return ""
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property ServerTimeZone() As Integer
+ Get
+ If (Settings.Contains(ArticleConstants.SERVER_TIMEZONE)) Then
+ If (IsNumeric(Settings(ArticleConstants.SERVER_TIMEZONE).ToString())) Then
+ Return Convert.ToInt32(Settings(ArticleConstants.SERVER_TIMEZONE).ToString())
+ Else
+ Return _portalSettings.TimeZoneOffset
+ End If
+ Else
+ Return _portalSettings.TimeZoneOffset
+ End If
+ End Get
+ End Property
+
+
+
+
+ Public ReadOnly Property TemplatePath() As String
+ Get
+ Return _portalSettings.HomeDirectoryMapPath & "DnnForge - NewsArticles/Templates/" & Template & "/"
+ End Get
+ End Property
+
+ Public ReadOnly Property SecureUrl() As String
+ Get
+ If (Settings.Contains(ArticleConstants.PERMISSION_SECURE_URL_SETTING)) Then
+ Return Settings(ArticleConstants.PERMISSION_SECURE_URL_SETTING).ToString()
+ Else
+ Return ""
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property RoleGroupID() As Integer
+ Get
+ If (Settings.Contains(ArticleConstants.PERMISSION_ROLE_GROUP_ID)) Then
+ Return Convert.ToInt32(Settings(ArticleConstants.PERMISSION_ROLE_GROUP_ID).ToString())
+ Else
+ Return -1
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property IsApprover() As Boolean
+ Get
+ If (HttpContext.Current.Request.IsAuthenticated = False) Then
+ Return False
+ End If
+
+ If (IsAdmin) Then
+ Return True
+ End If
+
+ If (Settings.Contains(ArticleConstants.PERMISSION_APPROVAL_SETTING)) Then
+ Return PortalSecurity.IsInRoles(Settings(ArticleConstants.PERMISSION_APPROVAL_SETTING).ToString())
+ Else
+ Return False
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property IsCategoriesEnabled() As Boolean
+ Get
+ If (System.Web.HttpContext.Current.Request.IsAuthenticated = False) Then
+ Return False
+ End If
+
+ If (Settings.Contains(ArticleConstants.PERMISSION_CATEGORIES_SETTING)) Then
+ Return IsInRoles(Settings(ArticleConstants.PERMISSION_CATEGORIES_SETTING).ToString())
+ Else
+ Return True
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property IsExcerptEnabled() As Boolean
+ Get
+ If (System.Web.HttpContext.Current.Request.IsAuthenticated = False) Then
+ Return False
+ End If
+
+ If (Settings.Contains(ArticleConstants.PERMISSION_EXCERPT_SETTING)) Then
+ Return IsInRoles(Settings(ArticleConstants.PERMISSION_EXCERPT_SETTING).ToString())
+ Else
+ Return True
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property IsImagesEnabled() As Boolean
+ Get
+ If (System.Web.HttpContext.Current.Request.IsAuthenticated = False) Then
+ Return False
+ End If
+
+ If (Settings.Contains(ArticleConstants.PERMISSION_IMAGE_SETTING)) Then
+ Return IsInRoles(Settings(ArticleConstants.PERMISSION_IMAGE_SETTING).ToString())
+ Else
+ Return True
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property IsFilesEnabled() As Boolean
+ Get
+ If (System.Web.HttpContext.Current.Request.IsAuthenticated = False) Then
+ Return False
+ End If
+
+ If (Settings.Contains(ArticleConstants.PERMISSION_FILE_SETTING)) Then
+ Return IsInRoles(Settings(ArticleConstants.PERMISSION_FILE_SETTING).ToString())
+ Else
+ Return True
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property IsLinkEnabled() As Boolean
+ Get
+ If (System.Web.HttpContext.Current.Request.IsAuthenticated = False) Then
+ Return False
+ End If
+
+ If (Settings.Contains(ArticleConstants.PERMISSION_LINK_SETTING)) Then
+ Return IsInRoles(Settings(ArticleConstants.PERMISSION_LINK_SETTING).ToString())
+ Else
+ Return True
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property IsFeaturedEnabled() As Boolean
+ Get
+ If (System.Web.HttpContext.Current.Request.IsAuthenticated = False) Then
+ Return False
+ End If
+
+ If (Settings.Contains(ArticleConstants.PERMISSION_FEATURE_SETTING)) Then
+ Return PortalSecurity.IsInRoles(Settings(ArticleConstants.PERMISSION_FEATURE_SETTING).ToString())
+ Else
+ Return True
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property IsSecureEnabled() As Boolean
+ Get
+ If (System.Web.HttpContext.Current.Request.IsAuthenticated = False) Then
+ Return False
+ End If
+
+ If (Settings.Contains(ArticleConstants.PERMISSION_SECURE_SETTING)) Then
+ Return PortalSecurity.IsInRoles(Settings(ArticleConstants.PERMISSION_SECURE_SETTING).ToString())
+ Else
+ Return True
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property IsPublishEnabled() As Boolean
+ Get
+ If (System.Web.HttpContext.Current.Request.IsAuthenticated = False) Then
+ Return False
+ End If
+
+ If (Settings.Contains(ArticleConstants.PERMISSION_PUBLISH_SETTING)) Then
+ Return PortalSecurity.IsInRoles(Settings(ArticleConstants.PERMISSION_PUBLISH_SETTING).ToString())
+ Else
+ Return True
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property IsExpiryEnabled() As Boolean
+ Get
+ If (System.Web.HttpContext.Current.Request.IsAuthenticated = False) Then
+ Return False
+ End If
+
+ If (Settings.Contains(ArticleConstants.PERMISSION_EXPIRY_SETTING)) Then
+ Return PortalSecurity.IsInRoles(Settings(ArticleConstants.PERMISSION_EXPIRY_SETTING).ToString())
+ Else
+ Return True
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property IsMetaEnabled() As Boolean
+ Get
+ If (System.Web.HttpContext.Current.Request.IsAuthenticated = False) Then
+ Return False
+ End If
+
+ If (Settings.Contains(ArticleConstants.PERMISSION_META_SETTING)) Then
+ If (Settings(ArticleConstants.PERMISSION_META_SETTING).ToString() = "") Then
+ Return False
+ End If
+ Return PortalSecurity.IsInRoles(Settings(ArticleConstants.PERMISSION_META_SETTING).ToString())
+ Else
+ Return True
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property IsCustomEnabled() As Boolean
+ Get
+ If (System.Web.HttpContext.Current.Request.IsAuthenticated = False) Then
+ Return False
+ End If
+
+ If (Settings.Contains(ArticleConstants.PERMISSION_CUSTOM_SETTING)) Then
+ If (Settings(ArticleConstants.PERMISSION_CUSTOM_SETTING).ToString() = "") Then
+ Return False
+ End If
+ Return PortalSecurity.IsInRoles(Settings(ArticleConstants.PERMISSION_CUSTOM_SETTING).ToString())
+ Else
+ Return True
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property IsAutoApprover() As Boolean
+ Get
+ If (System.Web.HttpContext.Current.Request.IsAuthenticated = False) Then
+ Return False
+ End If
+
+ If (IsAdmin) Then
+ Return True
+ End If
+
+ If (Settings.Contains(ArticleConstants.PERMISSION_AUTO_APPROVAL_SETTING)) Then
+ Return PortalSecurity.IsInRoles(Settings(ArticleConstants.PERMISSION_AUTO_APPROVAL_SETTING).ToString())
+ Else
+ Return False
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property IsAutoApproverComment() As Boolean
+ Get
+ If (System.Web.HttpContext.Current.Request.IsAuthenticated = False) Then
+ Return False
+ End If
+
+ If (IsAdmin) Then
+ Return True
+ End If
+
+ If (Settings.Contains(ArticleConstants.PERMISSION_AUTO_APPROVAL_COMMENT_SETTING)) Then
+ Return PortalSecurity.IsInRoles(Settings(ArticleConstants.PERMISSION_AUTO_APPROVAL_COMMENT_SETTING).ToString())
+ Else
+ Return False
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property IsAutoFeatured() As Boolean
+ Get
+ If (System.Web.HttpContext.Current.Request.IsAuthenticated = False) Then
+ Return False
+ End If
+
+ If (Settings.Contains(ArticleConstants.PERMISSION_AUTO_FEATURE_SETTING)) Then
+
+ For Each role As String In Settings(ArticleConstants.PERMISSION_AUTO_FEATURE_SETTING).ToString().Split(New Char() {";"c})
+ If (role <> "") Then
+ If (UserController.GetCurrentUserInfo.IsInRole(role)) Then
+ Return True
+ End If
+ End If
+ Next
+ Return False
+ Else
+ Return False
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property IsAutoSecured() As Boolean
+ Get
+ If (System.Web.HttpContext.Current.Request.IsAuthenticated = False) Then
+ Return False
+ End If
+
+ If (Settings.Contains(ArticleConstants.PERMISSION_AUTO_SECURE_SETTING)) Then
+
+ For Each role As String In Settings(ArticleConstants.PERMISSION_AUTO_SECURE_SETTING).ToString().Split(New Char() {";"c})
+ If (role <> "") Then
+ If (UserController.GetCurrentUserInfo.IsInRole(role)) Then
+ Return True
+ End If
+ End If
+ Next
+ Return False
+ Else
+ Return False
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property IsSubmitter() As Boolean
+ Get
+ If (System.Web.HttpContext.Current.Request.IsAuthenticated = False) Then
+ Return False
+ End If
+
+ If (IsAdmin) Then
+ Return True
+ End If
+
+ If (Settings.Contains(ArticleConstants.PERMISSION_SUBMISSION_SETTING)) Then
+ Return PortalSecurity.IsInRoles(Settings(ArticleConstants.PERMISSION_SUBMISSION_SETTING).ToString())
+ Else
+ Return False
+ End If
+ End Get
+ End Property
+
+ Public ReadOnly Property IsAdmin() As Boolean
+ Get
+ If (System.Web.HttpContext.Current.Request.IsAuthenticated = False) Then
+ Return False
+ End If
+
+ Dim blnHasModuleEditPermissions As Boolean = PortalSecurity.IsInRoles(_moduleConfiguration.AuthorizedEditRoles)
+
+ If (blnHasModuleEditPermissions = False) Then
+ blnHasModuleEditPermissions = PortalSecurity.IsInRoles(_portalSettings.ActiveTab.AdministratorRoles)
+ End If
+
+ If (blnHasModuleEditPermissions = False) Then
+ blnHasModuleEditPermissions = PortalSecurity.IsInRoles(_portalSettings.AdministratorRoleName)
+ End If
+
+ Return blnHasModuleEditPermissions
+ End Get
+ End Property
+
+#End Region
+
+ End Class
+
+End Namespace
\ No newline at end of file
diff --git a/Components/AuthorController.vb b/Components/AuthorController.vb
new file mode 100755
index 0000000..f5aa930
--- /dev/null
+++ b/Components/AuthorController.vb
@@ -0,0 +1,102 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports DotNetNuke.Common.Utilities
+Imports System.Security.Cryptography
+
+Namespace Ventrian.NewsArticles
+
+ Public Class AuthorController
+
+ Public Shared Sub ClearCache(ByVal moduleID As Integer)
+
+ Dim itemsToRemove As New List(Of String)()
+
+ If (HttpContext.Current IsNot Nothing) Then
+ Dim enumerator As IDictionaryEnumerator = HttpContext.Current.Cache.GetEnumerator()
+ While enumerator.MoveNext()
+ If enumerator.Key.ToString().ToLower().Contains("ventrian-newsarticles-authors-" & moduleID.ToString()) Then
+ itemsToRemove.Add(enumerator.Key.ToString())
+ End If
+ End While
+
+ For Each itemToRemove As String In itemsToRemove
+ DataCache.RemoveCache(itemToRemove.Replace("DNN_", ""))
+ Next
+ End If
+
+ End Sub
+
+ Public Function GetAuthorList(ByVal moduleID As Integer) As List(Of AuthorInfo)
+
+ Dim cacheKey As String = "ventrian-newsarticles-authors-" & moduleID.ToString()
+
+ Dim objAuthors As List(Of AuthorInfo) = CType(DataCache.GetCache(cacheKey), List(Of AuthorInfo))
+
+ If (objAuthors Is Nothing) Then
+ objAuthors = CBO.FillCollection(Of AuthorInfo)(DataProvider.Instance().GetAuthorList(moduleID))
+ DataCache.SetCache(cacheKey, objAuthors)
+ End If
+
+ Return objAuthors
+
+ End Function
+
+ Public Function GetAuthorStatistics(ByVal moduleID As Integer, ByVal categoryID As Integer(), ByVal categoryIDExclude As Integer(), ByVal authorID As Integer, ByVal sortBy As String, ByVal showPending As Boolean) As List(Of AuthorInfo)
+
+ Dim categories As String = Null.NullString
+
+ If Not (categoryID Is Nothing) Then
+ For Each category As Integer In categoryID
+ If Not (categories = Null.NullString) Then
+ categories = categories & ","
+ End If
+ categories = categories & category.ToString()
+ Next
+ End If
+
+ Dim categoriesExclude As String = Null.NullString
+
+ If Not (categoryIDExclude Is Nothing) Then
+ For Each category As Integer In categoryIDExclude
+ If Not (categoriesExclude = Null.NullString) Then
+ categoriesExclude = categoriesExclude & ","
+ End If
+ categoriesExclude = categoriesExclude & category.ToString()
+ Next
+ End If
+
+ Dim hashCategories As String = ""
+ If (categories <> "" Or categoriesExclude <> "") Then
+ Dim Ue As New UnicodeEncoding()
+ Dim ByteSourceText() As Byte = Ue.GetBytes(categories & categoriesExclude)
+ Dim Md5 As New MD5CryptoServiceProvider()
+ Dim ByteHash() As Byte = Md5.ComputeHash(ByteSourceText)
+ hashCategories = Convert.ToBase64String(ByteHash)
+ End If
+
+ If (sortBy = "ArticleCount") Then
+ sortBy = "ArticleCount DESC"
+ End If
+
+ Dim cacheKey As String = "ventrian-newsarticles-authors-" & moduleID.ToString() & "-" & hashCategories & "-" & authorID.ToString() & "-" & sortBy.ToString() & "-" & showPending.ToString()
+
+ Dim objAuthorStatistics As List(Of AuthorInfo) = CType(DataCache.GetCache(cacheKey), List(Of AuthorInfo))
+
+ If (objAuthorStatistics Is Nothing) Then
+ objAuthorStatistics = CBO.FillCollection(Of AuthorInfo)(DataProvider.Instance().GetAuthorStatistics(moduleID, categoryID, categoryIDExclude, authorID, sortBy, showPending))
+ DataCache.SetCache(cacheKey, objAuthorStatistics)
+ End If
+
+ Return objAuthorStatistics
+
+ End Function
+
+
+ End Class
+
+End Namespace
diff --git a/Components/AuthorInfo.vb b/Components/AuthorInfo.vb
new file mode 100755
index 0000000..724db4b
--- /dev/null
+++ b/Components/AuthorInfo.vb
@@ -0,0 +1,98 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.Data
+
+Imports DotNetNuke
+Imports DotNetNuke.Common
+Imports DotNetNuke.Common.Utilities
+Imports DotNetNuke.Entities.Users
+Imports DotNetNuke.Security.Roles
+
+Namespace Ventrian.NewsArticles
+
+ Public Class AuthorInfo
+
+#Region " Private Members "
+
+ ' local property declarations
+ Dim _userName As String
+ Dim _userID As Integer
+ Dim _firstName As String
+ Dim _lastName As String
+ Dim _displayName As String
+ Dim _articleCount As Integer
+
+#End Region
+
+#Region " Public Properties "
+
+ Public Property UserName() As String
+ Get
+ Return _userName
+ End Get
+ Set(ByVal Value As String)
+ _userName = Value
+ End Set
+ End Property
+
+ Public Property UserID() As Integer
+ Get
+ Return _userID
+ End Get
+ Set(ByVal Value As Integer)
+ _userID = Value
+ End Set
+ End Property
+
+ Public Property FirstName() As String
+ Get
+ Return _firstName
+ End Get
+ Set(ByVal Value As String)
+ _firstName = Value
+ End Set
+ End Property
+
+ Public Property LastName() As String
+ Get
+ Return _lastName
+ End Get
+ Set(ByVal Value As String)
+ _lastName = Value
+ End Set
+ End Property
+
+ Public Property DisplayName() As String
+ Get
+ Return _displayName
+ End Get
+ Set(ByVal Value As String)
+ _displayName = Value
+ End Set
+ End Property
+
+ Public ReadOnly Property FullName() As String
+ Get
+ Return FirstName & " " & LastName
+ End Get
+ End Property
+
+ Public Property ArticleCount() As Integer
+ Get
+ Return _articleCount
+ End Get
+ Set(ByVal Value As Integer)
+ _articleCount = Value
+ End Set
+ End Property
+
+#End Region
+
+ End Class
+
+End Namespace
\ No newline at end of file
diff --git a/Components/AuthorSortByType.vb b/Components/AuthorSortByType.vb
new file mode 100755
index 0000000..5bc3b23
--- /dev/null
+++ b/Components/AuthorSortByType.vb
@@ -0,0 +1,19 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Namespace Ventrian.NewsArticles
+
+ Public Enum AuthorSortByType
+
+ ArticleCount
+ DisplayName
+ FirstName
+ LastName
+ UserName
+
+ End Enum
+
+End Namespace
diff --git a/Components/Bitly.vb b/Components/Bitly.vb
new file mode 100755
index 0000000..6365e51
--- /dev/null
+++ b/Components/Bitly.vb
@@ -0,0 +1,132 @@
+Imports System.Text
+Imports System.Xml
+Imports System.IO
+Imports System.Net
+
+Namespace Ventrian.NewsArticles
+
+ Public Class bitly
+ Private loginAccount As String
+ Private apiKeyForAccount As String
+
+ Private submitPath As String = "http://api.bit.ly/shorten?version=2.0.1&format=xml"
+ Private errorStatus As Integer = 0
+ Private errorStatusMessage As String = ""
+
+
+ ' Constructors (overloaded and chained)
+ Public Sub New()
+ Me.New("bitlyapidemo", "R_0da49e0a9118ff35f52f629d2d71bf07")
+ End Sub
+
+
+ Public Sub New(ByVal login As String, ByVal APIKey As String)
+ loginAccount = login
+ apiKeyForAccount = APIKey
+
+ submitPath &= "&login=" & loginAccount & "&apiKey=" & apiKeyForAccount
+ End Sub
+
+
+ ' Properties to retrieve error information.
+ Public ReadOnly Property ErrorCode() As Integer
+ Get
+ Return errorStatus
+ End Get
+ End Property
+
+ Public ReadOnly Property ErrorMessage() As String
+ Get
+ Return errorStatusMessage
+ End Get
+ End Property
+
+
+ ' Main shorten function which takes in the long URL and returns the bit.ly shortened URL
+ Public Function Shorten(ByVal url As String) As String
+
+ errorStatus = 0
+ errorStatusMessage = ""
+
+ Dim doc As XmlDocument
+ doc = buildDocument(url)
+
+ If Not doc.DocumentElement Is Nothing Then
+
+ Dim shortenedNode As XmlNode = doc.DocumentElement.SelectSingleNode("results/nodeKeyVal/shortUrl")
+
+ If Not shortenedNode Is Nothing Then
+
+ Return shortenedNode.InnerText
+
+ Else
+
+ getErrorCode(doc)
+
+ End If
+ Else
+
+ errorStatus = -1
+ errorStatusMessage = "Unable to connect to bit.ly for shortening of URL"
+ End If
+
+ Return ""
+
+ End Function
+
+
+ ' Sets error code and message in the situation we receive a response, but there was
+ ' something wrong with our submission.
+ Private Sub getErrorCode(ByVal doc As XmlDocument)
+
+ Dim errorNode As XmlNode = doc.DocumentElement.SelectSingleNode("errorCode")
+ Dim errorMessageNode As XmlNode = doc.DocumentElement.SelectSingleNode("errorMessage")
+
+ If Not errorNode Is Nothing Then
+
+ errorStatus = Convert.ToInt32(errorNode.InnerText)
+ errorStatusMessage = errorMessageNode.InnerText
+ End If
+ End Sub
+
+
+ ' Builds an XmlDocument using the XML returned by bit.ly in response
+ ' to our URL being submitted
+ Private Function buildDocument(ByVal url As String) As XmlDocument
+
+ Dim doc As New XmlDocument
+
+ Try
+
+ ' Load the XML response into an XML Document and return it.
+ doc.LoadXml(readSource(submitPath + "&longUrl=" + url))
+ Return doc
+
+ Catch e As Exception
+
+ Return New XmlDocument()
+ End Try
+ End Function
+
+
+ ' Fetches a result from bit.ly provided the URL submitted
+ Private Function readSource(ByVal url As String) As String
+ Dim client As New WebClient
+
+ Try
+
+ Using reader As New StreamReader(client.OpenRead(url))
+ ' Read all of the response
+ Return reader.ReadToEnd()
+ reader.Close()
+ End Using
+
+ Catch e As Exception
+ Throw e
+ End Try
+
+ End Function
+
+ End Class
+
+End Namespace
diff --git a/Components/CategoryController.vb b/Components/CategoryController.vb
new file mode 100755
index 0000000..d547203
--- /dev/null
+++ b/Components/CategoryController.vb
@@ -0,0 +1,227 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.Data
+
+Imports DotNetNuke
+Imports DotNetNuke.Common.Utilities
+
+Namespace Ventrian.NewsArticles
+
+ Public Class CategoryController
+
+#Region " Public Methods "
+
+ Public Shared Sub ClearCache(ByVal moduleID As Integer)
+
+ Dim itemsToRemove As New List(Of String)()
+
+ If (HttpContext.Current IsNot Nothing) Then
+ Dim enumerator As IDictionaryEnumerator = HttpContext.Current.Cache.GetEnumerator()
+ While enumerator.MoveNext()
+ If enumerator.Key.ToString().ToLower().Contains("ventrian-newsarticles-categories-" & moduleID.ToString()) Then
+ itemsToRemove.Add(enumerator.Key.ToString())
+ End If
+ End While
+
+ For Each itemToRemove As String In itemsToRemove
+ DataCache.RemoveCache(itemToRemove.Replace("DNN_", ""))
+ Next
+ End If
+
+ End Sub
+
+ Public Function GetCategories(ByVal moduleID As Integer, ByVal parentID As Integer) As List(Of CategoryInfo)
+
+ Return GetCategoriesAll(moduleID, parentID, Nothing, Null.NullInteger, 1, Null.NullBoolean, CategorySortType.Name)
+
+ End Function
+
+ Public Function GetCategoriesAll(ByVal moduleID As Integer) As List(Of CategoryInfo)
+
+ Return GetCategoriesAll(moduleID, Null.NullInteger, Nothing, Null.NullInteger, Null.NullInteger, Null.NullBoolean, CategorySortType.Name)
+
+ End Function
+
+ Public Function GetCategoriesAll(ByVal moduleID As Integer, ByVal parentID As Integer) As List(Of CategoryInfo)
+
+ Return GetCategoriesAll(moduleID, parentID, CategorySortType.Name)
+
+ End Function
+
+ Public Function GetCategoriesAll(ByVal moduleID As Integer, ByVal parentID As Integer, ByVal sortType As CategorySortType) As List(Of CategoryInfo)
+
+ Return GetCategoriesAll(moduleID, parentID, Nothing, Null.NullInteger, Null.NullInteger, False, sortType)
+
+ End Function
+
+ Public Function GetCategoriesAll(ByVal moduleID As Integer, ByVal parentID As Integer, ByVal categoryIDFilter As Integer(), ByVal authorID As Integer, ByVal maxDepth As Integer, ByVal showPending As Boolean, ByVal sortType As CategorySortType) As List(Of CategoryInfo)
+
+ Dim cacheKey As String = "Ventrian-NewsArticles-Categories-" & moduleID.ToString() & "-" & sortType.ToString()
+
+ If (authorID <> Null.NullInteger) Then
+ cacheKey = cacheKey & "-a-" & authorID.ToString()
+ End If
+
+ If (showPending <> Null.NullBoolean) Then
+ cacheKey = cacheKey & "-sp-" & showPending.ToString()
+ End If
+
+ Dim objCategories As List(Of CategoryInfo) = CType(DataCache.GetCache(cacheKey), List(Of CategoryInfo))
+
+ If (objCategories Is Nothing) Then
+ objCategories = CBO.FillCollection(Of CategoryInfo)(DataProvider.Instance().GetCategoryListAll(moduleID, authorID, showPending, sortType))
+ DataCache.SetCache(cacheKey, objCategories)
+ End If
+
+ If (categoryIDFilter IsNot Nothing) Then
+ Dim objNewCategories As New List(Of CategoryInfo)
+ For Each id As Integer In categoryIDFilter
+ For Each objCategory As CategoryInfo In objCategories
+ If (objCategory.CategoryID = id) Then
+ objNewCategories.Add(objCategory)
+ End If
+ Next
+ Next
+ objCategories = objNewCategories
+ End If
+
+ Dim objCategoriesCopy As New List(Of CategoryInfo)(objCategories)
+
+ If (parentID <> Null.NullInteger) Then
+ Dim level As Integer = Null.NullInteger
+ Dim objParentIDs As New List(Of Integer)
+ objParentIDs.Add(parentID)
+ Dim objNewCategories As New List(Of CategoryInfo)
+ For Each objCategory As CategoryInfo In objCategoriesCopy
+ For Each id As Integer In objParentIDs.ToArray()
+ If (objCategory.ParentID = id) Then
+ If (level = Null.NullInteger) Then
+ level = objCategory.Level
+ End If
+
+ If (maxDepth = Null.NullInteger Or objCategory.Level < (level + maxDepth)) Then
+ Dim objCategoryNew As CategoryInfo = objCategory.Clone()
+ objCategoryNew.Level = objCategory.Level - level + 1
+ objNewCategories.Add(objCategoryNew)
+ If (objParentIDs.Contains(objCategory.CategoryID) = False) Then
+ objParentIDs.Add(objCategory.CategoryID)
+ End If
+ Exit For
+ End If
+ End If
+ Next
+ Next
+ objCategoriesCopy = objNewCategories
+ Else
+ If (maxDepth <> Null.NullInteger) Then
+ Dim objNewCategories As New List(Of CategoryInfo)
+ For Each objCategory As CategoryInfo In objCategoriesCopy
+ If (objCategory.Level <= maxDepth) Then
+ objNewCategories.Add(objCategory)
+ End If
+ Next
+ objCategoriesCopy = objNewCategories
+ End If
+ End If
+
+ Return objCategoriesCopy
+
+ End Function
+
+
+
+ _
+ Public Function GetCategoryList(ByVal moduleID As Integer, ByVal parentID As Integer) As ArrayList
+
+ Dim objCategories As List(Of CategoryInfo) = GetCategories(moduleID, parentID)
+ Dim objCategoriesToReturn As New ArrayList()
+
+ For Each objCategory As CategoryInfo In objCategories
+ objCategoriesToReturn.Add(objCategory)
+ Next
+
+ Return objCategoriesToReturn
+
+ End Function
+
+ _
+ Public Function GetCategoryListAll(ByVal moduleID As Integer) As ArrayList
+
+ Return GetCategoryListAll(moduleID, Null.NullInteger, Nothing, Null.NullInteger, Null.NullInteger, Null.NullBoolean, CategorySortType.Name)
+
+ End Function
+
+ _
+ Public Function GetCategoryListAll(ByVal moduleID As Integer, ByVal parentID As Integer) As ArrayList
+
+ Return GetCategoryListAll(moduleID, parentID, CategorySortType.Name)
+
+ End Function
+
+ _
+ Public Function GetCategoryListAll(ByVal moduleID As Integer, ByVal parentID As Integer, ByVal sortType As CategorySortType) As ArrayList
+
+ Return GetCategoryListAll(moduleID, parentID, Nothing, Null.NullInteger, Null.NullInteger, False, sortType)
+
+ End Function
+
+ _
+ Public Function GetCategoryListAll(ByVal moduleID As Integer, ByVal parentID As Integer, ByVal categoryIDFilter As Integer(), ByVal authorID As Integer, ByVal maxDepth As Integer, ByVal showPending As Boolean, ByVal sortType As CategorySortType) As ArrayList
+
+ Dim objCategories As List(Of CategoryInfo) = GetCategoriesAll(moduleID, parentID, categoryIDFilter, authorID, maxDepth, showPending, sortType)
+ Dim objCategoriesToReturn As New ArrayList()
+
+ For Each objCategory As CategoryInfo In objCategories
+ objCategoriesToReturn.Add(objCategory)
+ Next
+
+ Return objCategoriesToReturn
+
+ End Function
+
+ Public Function GetCategory(ByVal categoryID As Integer, ByVal moduleID As Integer) As CategoryInfo
+
+ Dim objCategories As List(Of CategoryInfo) = GetCategoriesAll(moduleID)
+
+ For Each objCategory As CategoryInfo In objCategories
+ If (objCategory.CategoryID = categoryID) Then
+ Return objCategory
+ End If
+ Next
+
+ Return CType(CBO.FillObject(DataProvider.Instance().GetCategory(categoryID), GetType(CategoryInfo)), CategoryInfo)
+
+ End Function
+
+ Public Sub DeleteCategory(ByVal categoryID As Integer, ByVal moduleID As Integer)
+
+ DataProvider.Instance().DeleteCategory(categoryID)
+ CategoryController.ClearCache(moduleID)
+
+ End Sub
+
+ Public Function AddCategory(ByVal objCategory As CategoryInfo) As Integer
+
+ Dim categoryID As Integer = CType(DataProvider.Instance().AddCategory(objCategory.ModuleID, objCategory.ParentID, objCategory.Name, objCategory.Image, objCategory.Description, objCategory.SortOrder, objCategory.InheritSecurity, objCategory.CategorySecurityType, objCategory.MetaTitle, objCategory.MetaDescription, objCategory.MetaKeywords), Integer)
+ CategoryController.ClearCache(objCategory.ModuleID)
+ Return categoryID
+
+ End Function
+
+ Public Sub UpdateCategory(ByVal objCategory As CategoryInfo)
+
+ DataProvider.Instance().UpdateCategory(objCategory.CategoryID, objCategory.ModuleID, objCategory.ParentID, objCategory.Name, objCategory.Image, objCategory.Description, objCategory.SortOrder, objCategory.InheritSecurity, objCategory.CategorySecurityType, objCategory.MetaTitle, objCategory.MetaDescription, objCategory.MetaKeywords)
+ CategoryController.ClearCache(objCategory.ModuleID)
+
+ End Sub
+
+#End Region
+
+ End Class
+
+End Namespace
diff --git a/Components/CategoryInfo.vb b/Components/CategoryInfo.vb
new file mode 100755
index 0000000..7af073a
--- /dev/null
+++ b/Components/CategoryInfo.vb
@@ -0,0 +1,219 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.Data
+
+Imports DotNetNuke
+Imports DotNetNuke.Common.Utilities
+
+Namespace Ventrian.NewsArticles
+
+ Public Class CategoryInfo
+
+#Region " Private Methods "
+
+ ' local property declarations
+ Dim _categoryID As Integer
+ Dim _moduleID As Integer
+ Dim _parentID As Integer
+ Dim _name As String
+ Dim _nameIndented As String
+ Dim _description As String
+ Dim _image As String
+ Dim _level As Integer
+ Dim _sortOrder As Integer
+ Dim _inheritSecurity As Boolean
+ Dim _categorySecurityType As CategorySecurityType
+
+ Dim _numberOfArticles As Integer
+ Dim _numberOfViews As Integer
+
+ Dim _metaTitle As String
+ Dim _metaDescription As String
+ Dim _metaKeywords As String
+
+ Dim _levelParent As Integer = Null.NullInteger
+
+#End Region
+
+#Region " Public Properties "
+
+ Public Property CategoryID() As Integer
+ Get
+ Return _categoryID
+ End Get
+ Set(ByVal Value As Integer)
+ _categoryID = Value
+ End Set
+ End Property
+
+ Public Property ModuleID() As Integer
+ Get
+ Return _moduleID
+ End Get
+ Set(ByVal Value As Integer)
+ _moduleID = Value
+ End Set
+ End Property
+
+ Public Property ParentID() As Integer
+ Get
+ Return _parentID
+ End Get
+ Set(ByVal Value As Integer)
+ _parentID = Value
+ End Set
+ End Property
+
+ Public Property Name() As String
+ Get
+ Return _name
+ End Get
+ Set(ByVal Value As String)
+ _name = Value
+ End Set
+ End Property
+
+ Public Property Description() As String
+ Get
+ Return _description
+ End Get
+ Set(ByVal Value As String)
+ _description = Value
+ End Set
+ End Property
+
+ Public Property NameIndented() As String
+ Get
+ If (Level = 1) Then
+ Return Name
+ Else
+ If ((Level - 1) * 2 > 0) Then
+ Dim a As New String("."c, (Level - 1) * 2)
+ Return a & Name
+ Else
+ Return Name
+ End If
+ End If
+ End Get
+ Set(ByVal Value As String)
+ _nameIndented = Value
+ End Set
+ End Property
+
+ Public Property Image() As String
+ Get
+ Return _image
+ End Get
+ Set(ByVal Value As String)
+ _image = Value
+ End Set
+ End Property
+
+ Public Property Level() As Integer
+ Get
+ Return _level
+ End Get
+ Set(ByVal Value As Integer)
+ _level = Value
+ End Set
+ End Property
+
+ Public Property LevelParent() As Integer
+ Get
+ Return _levelParent
+ End Get
+ Set(ByVal Value As Integer)
+ _levelParent = Value
+ End Set
+ End Property
+
+ Public Property SortOrder() As Integer
+ Get
+ Return _sortOrder
+ End Get
+ Set(ByVal Value As Integer)
+ _sortOrder = Value
+ End Set
+ End Property
+
+ Public Property InheritSecurity() As Boolean
+ Get
+ Return _inheritSecurity
+ End Get
+ Set(ByVal Value As Boolean)
+ _inheritSecurity = Value
+ End Set
+ End Property
+
+ Public Property CategorySecurityType() As CategorySecurityType
+ Get
+ Return _categorySecurityType
+ End Get
+ Set(ByVal Value As CategorySecurityType)
+ _categorySecurityType = Value
+ End Set
+ End Property
+
+ Public Property NumberOfArticles() As Integer
+ Get
+ Return _numberOfArticles
+ End Get
+ Set(ByVal Value As Integer)
+ _numberOfArticles = Value
+ End Set
+ End Property
+
+ Public Property NumberOfViews() As Integer
+ Get
+ Return _numberOfViews
+ End Get
+ Set(ByVal Value As Integer)
+ _numberOfViews = Value
+ End Set
+ End Property
+
+ Public Property MetaTitle() As String
+ Get
+ Return _metaTitle
+ End Get
+ Set(ByVal Value As String)
+ _metaTitle = Value
+ End Set
+ End Property
+
+ Public Property MetaDescription() As String
+ Get
+ Return _metaDescription
+ End Get
+ Set(ByVal Value As String)
+ _metaDescription = Value
+ End Set
+ End Property
+
+ Public Property MetaKeywords() As String
+ Get
+ Return _metaKeywords
+ End Get
+ Set(ByVal Value As String)
+ _metaKeywords = Value
+ End Set
+ End Property
+
+#End Region
+
+#Region " Public Methods "
+
+ Public Function Clone() As CategoryInfo
+ Return DirectCast(Me.MemberwiseClone(), CategoryInfo)
+ End Function
+
+#End Region
+
+ End Class
+
+End Namespace
\ No newline at end of file
diff --git a/Components/CategorySecurityType.vb b/Components/CategorySecurityType.vb
new file mode 100755
index 0000000..cd5fb03
--- /dev/null
+++ b/Components/CategorySecurityType.vb
@@ -0,0 +1,22 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.Configuration
+Imports System.Data
+
+Imports DotNetNuke.Common.Utilities
+
+Namespace Ventrian.NewsArticles
+
+ Public Enum CategorySecurityType
+
+ Restrict = 0
+ Loose = 1
+
+ End Enum
+
+End Namespace
diff --git a/Components/CategorySortType.vb b/Components/CategorySortType.vb
new file mode 100755
index 0000000..983f0c3
--- /dev/null
+++ b/Components/CategorySortType.vb
@@ -0,0 +1,22 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.Configuration
+Imports System.Data
+
+Imports DotNetNuke.Common.Utilities
+
+Namespace Ventrian.NewsArticles
+
+ Public Enum CategorySortType
+
+ SortOrder = 0
+ Name = 1
+
+ End Enum
+
+End Namespace
diff --git a/Components/CommentController.vb b/Components/CommentController.vb
new file mode 100755
index 0000000..b355b9c
--- /dev/null
+++ b/Components/CommentController.vb
@@ -0,0 +1,96 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.Data
+
+Imports DotNetNuke
+Imports DotNetNuke.Common.Utilities
+
+Namespace Ventrian.NewsArticles
+
+ Public Class CommentController
+
+ Public Shared Sub ClearCache(ByVal articleID As Integer)
+
+ Dim itemsToRemove As New List(Of String)()
+
+ Dim enumerator As IDictionaryEnumerator = HttpContext.Current.Cache.GetEnumerator()
+ While enumerator.MoveNext()
+ If enumerator.Key.ToString().ToLower().Contains("ventrian-newsarticles-comments") Then
+ itemsToRemove.Add(enumerator.Key.ToString())
+ End If
+ End While
+
+ For Each itemToRemove As String In itemsToRemove
+ DataCache.RemoveCache(itemToRemove.Replace("DNN_", ""))
+ Next
+
+ End Sub
+
+#Region " Public Methods "
+
+ Public Function GetCommentList(ByVal moduleID As Integer, ByVal articleID As Integer, ByVal isApproved As Boolean) As List(Of CommentInfo)
+
+ Return GetCommentList(moduleID, articleID, isApproved, SortDirection.Ascending, Null.NullInteger)
+
+ End Function
+
+ Public Function GetCommentList(ByVal moduleID As Integer, ByVal articleID As Integer, ByVal isApproved As Boolean, ByVal direction As SortDirection, ByVal maxCount As Integer) As List(Of CommentInfo)
+
+ Dim cacheKey As String = "ventrian-newsarticles-comments-" & moduleID.ToString() & "-" & articleID.ToString() & "-" & isApproved.ToString() & "-" & direction.ToString() & "-" & maxCount.ToString()
+
+ Dim objComments As List(Of CommentInfo) = CType(DataCache.GetCache(cacheKey), List(Of CommentInfo))
+
+ If (objComments Is Nothing) Then
+ objComments = CBO.FillCollection(Of CommentInfo)(DataProvider.Instance().GetCommentList(moduleID, articleID, isApproved, direction, maxCount))
+ DataCache.SetCache(cacheKey, objComments)
+ End If
+
+ Return objComments
+
+ End Function
+
+ Public Function GetComment(ByVal commentID As Integer) As CommentInfo
+
+ Return CType(CBO.FillObject(DataProvider.Instance().GetComment(commentID), GetType(CommentInfo)), CommentInfo)
+
+ End Function
+
+ Public Sub DeleteComment(ByVal commentID As Integer, ByVal articleID As Integer)
+
+ DataProvider.Instance().DeleteComment(commentID)
+
+ ArticleController.ClearArticleCache(articleID)
+ CommentController.ClearCache(articleID)
+
+ End Sub
+
+ Public Function AddComment(ByVal objComment As CommentInfo) As Integer
+
+ Dim commentID As Integer = CType(DataProvider.Instance().AddComment(objComment.ArticleID, objComment.CreatedDate, objComment.UserID, objComment.Comment, objComment.RemoteAddress, objComment.Type, objComment.TrackbackUrl, objComment.TrackbackTitle, objComment.TrackbackBlogName, objComment.TrackbackExcerpt, objComment.AnonymousName, objComment.AnonymousEmail, objComment.AnonymousURL, objComment.NotifyMe, objComment.IsApproved, objComment.ApprovedBy), Integer)
+
+ ArticleController.ClearArticleCache(objComment.ArticleID)
+ CommentController.ClearCache(objComment.ArticleID)
+
+ Return commentID
+
+ End Function
+
+ Public Sub UpdateComment(ByVal objComment As CommentInfo)
+
+ DataProvider.Instance().UpdateComment(objComment.CommentID, objComment.ArticleID, objComment.UserID, objComment.Comment, objComment.RemoteAddress, objComment.Type, objComment.TrackbackUrl, objComment.TrackbackTitle, objComment.TrackbackBlogName, objComment.TrackbackExcerpt, objComment.AnonymousName, objComment.AnonymousEmail, objComment.AnonymousURL, objComment.NotifyMe, objComment.IsApproved, objComment.ApprovedBy)
+
+ ArticleController.ClearArticleCache(objComment.ArticleID)
+ CommentController.ClearCache(objComment.ArticleID)
+
+ End Sub
+
+#End Region
+
+ End Class
+
+End Namespace
\ No newline at end of file
diff --git a/Components/CommentInfo.vb b/Components/CommentInfo.vb
new file mode 100755
index 0000000..0f9c52f
--- /dev/null
+++ b/Components/CommentInfo.vb
@@ -0,0 +1,251 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.Data
+
+Imports DotNetNuke
+Imports DotNetNuke.Common.Utilities
+
+Namespace Ventrian.NewsArticles
+
+ Public Class CommentInfo
+
+#Region " Private Methods "
+
+ ' local property declarations
+ Dim _commentID As Integer
+ Dim _articleID As Integer
+ Dim _userID As Integer
+ Dim _comment As String
+ Dim _createdDate As DateTime
+ Dim _remoteAddress As String
+ Dim _type As Integer
+ Dim _trackbackUrl As String
+ Dim _trackbackTitle As String
+ Dim _trackbackBlogName As String
+ Dim _trackbackExcerpt As String
+ Dim _anonymousName As String
+ Dim _anonymousEmail As String
+ Dim _anonymousURL As String
+ Dim _notifyMe As Boolean = Null.NullBoolean
+ Dim _isApproved As Boolean = Null.NullBoolean
+ Dim _approvedBy As Integer
+
+ Dim _authorEmail As String
+ Dim _authorUserName As String
+ Dim _authorFirstName As String
+ Dim _authorLastName As String
+ Dim _authorDisplayName As String
+
+#End Region
+
+#Region " Public Properties "
+
+ Public Property CommentID() As Integer
+ Get
+ Return _commentID
+ End Get
+ Set(ByVal Value As Integer)
+ _commentID = Value
+ End Set
+ End Property
+
+ Public Property ArticleID() As Integer
+ Get
+ Return _articleID
+ End Get
+ Set(ByVal Value As Integer)
+ _articleID = Value
+ End Set
+ End Property
+
+ Public Property UserID() As Integer
+ Get
+ Return _userID
+ End Get
+ Set(ByVal Value As Integer)
+ _userID = Value
+ End Set
+ End Property
+
+
+ Public Property Comment() As String
+ Get
+ Return _comment
+ End Get
+ Set(ByVal Value As String)
+ _comment = Value
+ End Set
+ End Property
+
+ Public Property CreatedDate() As DateTime
+ Get
+ Return _createdDate
+ End Get
+ Set(ByVal Value As DateTime)
+ _createdDate = Value
+ End Set
+ End Property
+
+ Public Property RemoteAddress() As String
+ Get
+ Return _remoteAddress
+ End Get
+ Set(ByVal Value As String)
+ _remoteAddress = Value
+ End Set
+ End Property
+
+ Public Property Type() As Integer
+ Get
+ Return _type
+ End Get
+ Set(ByVal Value As Integer)
+ _type = Value
+ End Set
+ End Property
+
+ Public Property TrackbackUrl() As String
+ Get
+ Return _trackbackUrl
+ End Get
+ Set(ByVal Value As String)
+ _trackbackUrl = Value
+ End Set
+ End Property
+
+ Public Property TrackbackTitle() As String
+ Get
+ Return _trackbackTitle
+ End Get
+ Set(ByVal Value As String)
+ _trackbackTitle = Value
+ End Set
+ End Property
+
+ Public Property TrackbackBlogName() As String
+ Get
+ Return _trackbackBlogName
+ End Get
+ Set(ByVal Value As String)
+ _trackbackBlogName = Value
+ End Set
+ End Property
+
+ Public Property TrackbackExcerpt() As String
+ Get
+ Return _trackbackExcerpt
+ End Get
+ Set(ByVal Value As String)
+ _trackbackExcerpt = Value
+ End Set
+ End Property
+
+ Public Property NotifyMe() As Boolean
+ Get
+ Return _notifyMe
+ End Get
+ Set(ByVal Value As Boolean)
+ _notifyMe = Value
+ End Set
+ End Property
+
+ Public Property IsApproved() As Boolean
+ Get
+ Return _isApproved
+ End Get
+ Set(ByVal Value As Boolean)
+ _isApproved = Value
+ End Set
+ End Property
+
+ Public Property ApprovedBy() As Integer
+ Get
+ Return _approvedBy
+ End Get
+ Set(ByVal Value As Integer)
+ _approvedBy = Value
+ End Set
+ End Property
+
+ Public Property AuthorUserName() As String
+ Get
+ Return _authorUserName
+ End Get
+ Set(ByVal Value As String)
+ _authorUserName = Value
+ End Set
+ End Property
+
+ Public Property AuthorEmail() As String
+ Get
+ Return _authorEmail
+ End Get
+ Set(ByVal Value As String)
+ _authorEmail = Value
+ End Set
+ End Property
+
+ Public Property AuthorFirstName() As String
+ Get
+ Return _authorFirstName
+ End Get
+ Set(ByVal Value As String)
+ _authorFirstName = Value
+ End Set
+ End Property
+
+ Public Property AuthorLastName() As String
+ Get
+ Return _authorLastName
+ End Get
+ Set(ByVal Value As String)
+ _authorLastName = Value
+ End Set
+ End Property
+
+ Public Property AuthorDisplayName() As String
+ Get
+ Return _authorDisplayName
+ End Get
+ Set(ByVal Value As String)
+ _authorDisplayName = Value
+ End Set
+ End Property
+
+ Public Property AnonymousName() As String
+ Get
+ Return _anonymousName
+ End Get
+ Set(ByVal Value As String)
+ _anonymousName = Value
+ End Set
+ End Property
+
+ Public Property AnonymousEmail() As String
+ Get
+ Return _anonymousEmail
+ End Get
+ Set(ByVal Value As String)
+ _anonymousEmail = Value
+ End Set
+ End Property
+
+ Public Property AnonymousURL() As String
+ Get
+ Return _anonymousURL
+ End Get
+ Set(ByVal Value As String)
+ _anonymousURL = Value
+ End Set
+ End Property
+
+#End Region
+
+ End Class
+
+End Namespace
\ No newline at end of file
diff --git a/Components/Common.vb b/Components/Common.vb
new file mode 100755
index 0000000..b3b028a
--- /dev/null
+++ b/Components/Common.vb
@@ -0,0 +1,778 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System.Globalization
+Imports System.Threading
+Imports System.Web
+
+Imports DotNetNuke.Common
+Imports DotNetNuke.Common.Utilities
+Imports DotNetNuke.Entities.Modules
+Imports DotNetNuke.Entities.Portals
+Imports DotNetNuke.Entities.Tabs
+Imports DotNetNuke.Entities.Users
+Imports DotNetNuke.Services.Localization
+Imports DotNetNuke.UI.Modules
+
+Imports Ventrian.NewsArticles.Components.Utility
+Imports DotNetNuke.Entities.Controllers
+Imports DotNetNuke.Entities.Host
+Imports DotNetNuke.Security
+
+Namespace Ventrian.NewsArticles
+
+ Public Class Common
+
+#Region " Friend Shared Methods "
+
+ Friend Shared Sub BindEnum(ByVal objListControl As ListControl, ByRef enumType As Type, ByVal resourceFile As String)
+
+ For Each value As Integer In System.Enum.GetValues(enumType)
+ Dim li As New ListItem
+ li.Value = System.Enum.GetName(enumType, value)
+ li.Text = Localization.GetString(System.Enum.GetName(enumType, value), resourceFile)
+ objListControl.Items.Add(li)
+ Next
+
+ End Sub
+
+#End Region
+
+#Region " Public Shared Methods "
+
+
+ Public Shared Function FormatTitle(ByVal title As String) As String
+
+ If (title = "") Then
+ Return "Default.aspx"
+ End If
+
+ Dim returnTitle As String = OnlyAlphaNumericChars(title, TitleReplacementType.Dash)
+ If (returnTitle = "") Then
+ Return "Default.aspx"
+ End If
+
+ If (returnTitle.Replace("-", "").Replace("_", "") = "") Then
+ Return "Default.aspx"
+ End If
+
+ Return returnTitle.Replace("--", "-") & ".aspx"
+
+ End Function
+
+ Public Shared Function FormatTitle(ByVal title As String, ByVal objArticleSettings As ArticleSettings) As String
+
+ If (title = "") Then
+ Return "Default.aspx"
+ End If
+
+ Dim returnTitle As String = OnlyAlphaNumericChars(title, objArticleSettings.TitleReplacement)
+ If (returnTitle = "") Then
+ Return "Default.aspx"
+ End If
+
+ If (returnTitle.Replace("-", "").Replace("_", "") = "") Then
+ Return "Default.aspx"
+ End If
+
+ Return returnTitle.Replace("--", "-") & ".aspx"
+
+ End Function
+
+ Public Shared Function OnlyAlphaNumericChars(ByVal OrigString As String, ByVal objReplacementType As TitleReplacementType) As String
+
+ '***********************************************************
+ 'INPUT: Any String
+ 'OUTPUT: The Input String with all non-alphanumeric characters
+ ' removed
+ 'EXAMPLE Debug.Print OnlyAlphaNumericChars("Hello World!")
+ 'output = "HelloWorld")
+ 'NOTES: Not optimized for speed and will run slow on long
+ ' strings. If you plan on using long strings, consider
+ ' using alternative method of appending to output string,
+ ' such as the method at
+ ' http://www.freevbcode.com/ShowCode.Asp?ID=154
+ '***********************************************************
+ Dim lLen As Integer
+ Dim sAns As String = ""
+ Dim lCtr As Integer
+ Dim sChar As String
+
+ OrigString = RemoveDiacritics(Trim(OrigString))
+
+ lLen = Len(OrigString)
+ For lCtr = 1 To lLen
+ sChar = Mid(OrigString, lCtr, 1)
+ If IsAlphaNumeric(Mid(OrigString, lCtr, 1)) Or Mid(OrigString, lCtr, 1) = "-" Or Mid(OrigString, lCtr, 1) = "_" Then
+ sAns = sAns & sChar
+ End If
+ Next
+
+ If (objReplacementType = TitleReplacementType.Dash) Then
+ OnlyAlphaNumericChars = Replace(sAns, " ", "-")
+ Else
+ OnlyAlphaNumericChars = Replace(sAns, " ", "_")
+ End If
+
+ End Function
+
+ Public Shared Function RemoveDiacritics(ByVal s As String) As String
+ s = s.Normalize(System.Text.NormalizationForm.FormD)
+ Dim sb As System.Text.StringBuilder = New System.Text.StringBuilder()
+ Dim i As Integer
+ For i = 0 To s.Length - 1
+ If s(i) = ChrW(305) Then
+ sb.Append("i"c)
+ Else
+ If CharUnicodeInfo.GetUnicodeCategory(s(i)) <> UnicodeCategory.NonSpacingMark Then
+ sb.Append(s(i))
+ End If
+ End If
+ Next
+ Return sb.ToString()
+ End Function
+
+ Public Shared Function IsAlphaNumeric(ByVal sChr As String) As Boolean
+ IsAlphaNumeric = sChr Like "[0-9A-Za-z ]"
+ End Function
+
+ Public Shared Function GetAdjustedUserTime(ByVal dateString As String, ByVal format As String, ByVal timeZone As Integer) As String
+
+ Dim dateToFormat As DateTime = DateTime.Parse(dateString)
+
+ Return dateToFormat.ToString(format)
+
+ End Function
+
+ Public Shared Function GetAdjustedUserTime(ByVal articleSettings As ArticleSettings, ByVal dateString As String, ByVal format As String) As String
+
+ Return GetAdjustedUserTime(dateString, format, articleSettings.ServerTimeZone)
+
+ End Function
+
+ Public Shared Function GetAdjustedUserTime(ByVal articleSettings As ArticleSettings, ByVal objDateTime As DateTime) As DateTime
+
+ Return objDateTime
+
+ End Function
+
+ Public Shared Function GetAdjustedServerTime(ByVal articleSettings As ArticleSettings, ByVal objDateTime As DateTime) As DateTime
+
+ Return objDateTime
+
+ End Function
+
+ Public Shared Function GetArticleLink(ByVal objArticle As ArticleInfo, ByVal objTab As DotNetNuke.Entities.Tabs.TabInfo, ByVal articleSettings As ArticleSettings, ByVal includeCategory As Boolean) As String
+ Return GetArticleLink(objArticle, objTab, articleSettings, includeCategory, Null.NullInteger)
+ End Function
+
+ Public Shared Function GetArticleLink(ByVal objArticle As ArticleInfo, ByVal objTab As DotNetNuke.Entities.Tabs.TabInfo, ByVal articleSettings As ArticleSettings, ByVal includeCategory As Boolean, ByVal pageID As Integer) As String
+
+ If (objTab Is Nothing) Then
+ Return ""
+ End If
+
+ If Host.UseFriendlyUrls Then
+
+ Dim strURL As String = ApplicationURL(objTab.TabID)
+ Dim settings As PortalSettings = PortalController.GetCurrentPortalSettings
+
+ If (articleSettings.LaunchLinks) Then
+ strURL = strURL & "&ctl=ArticleView"
+ strURL = strURL & "&mid=" & objArticle.ModuleID.ToString
+ strURL = strURL & "&articleId=" & objArticle.ArticleID
+ Else
+ If (articleSettings.UrlModeType = Components.Types.UrlModeType.Classic) Then
+ strURL = strURL & "&articleType=ArticleView"
+ strURL = strURL & "&articleId=" & objArticle.ArticleID
+ Else
+ strURL = strURL & "&" & articleSettings.ShortenedID & "=" & objArticle.ArticleID
+ End If
+ End If
+
+ If (articleSettings.AlwaysShowPageID) Then
+ If (pageID <> Null.NullInteger) Then
+ strURL = strURL & "&PageID=" & pageID.ToString()
+ End If
+ End If
+
+ If (includeCategory) Then
+ If (HttpContext.Current.Request("CategoryID") <> "") Then
+ strURL = strURL & "&categoryId=" & HttpContext.Current.Request("CategoryID")
+ End If
+ End If
+
+ If (articleSettings.AuthorUserIDFilter) Then
+ If (articleSettings.AuthorUserIDParam <> "") Then
+ If (HttpContext.Current.Request(articleSettings.AuthorUserIDParam) <> "") Then
+ strURL = strURL & "&" & articleSettings.AuthorUserIDParam & "=" & HttpContext.Current.Request(articleSettings.AuthorUserIDParam)
+ End If
+ End If
+ End If
+
+ If (articleSettings.AuthorUsernameFilter) Then
+ If (articleSettings.AuthorUsernameParam <> "") Then
+ If (HttpContext.Current.Request(articleSettings.AuthorUsernameParam) <> "") Then
+ strURL = strURL & "&" & articleSettings.AuthorUsernameParam & "=" & HttpContext.Current.Request(articleSettings.AuthorUsernameParam)
+ End If
+ End If
+ End If
+
+ Dim title As String = FormatTitle(objArticle.Title, articleSettings)
+
+ Dim link As String = FriendlyUrl(objTab, strURL, title, settings)
+
+ If (link.ToLower().StartsWith("http://") Or link.ToLower().StartsWith("https://")) Then
+ Return link
+ Else
+ If (System.Web.HttpContext.Current.Request.Url.Port = 80) Then
+ Return AddHTTP(System.Web.HttpContext.Current.Request.Url.Host & link)
+ Else
+ Return AddHTTP(System.Web.HttpContext.Current.Request.Url.Host & ":" & System.Web.HttpContext.Current.Request.Url.Port.ToString() & link)
+ End If
+ End If
+ Else
+ If (articleSettings.LaunchLinks) Then
+ Dim parameters As New List(Of String)
+ parameters.Add("mid=" & objArticle.ModuleID.ToString)
+ parameters.Add("ctl=ArticleView")
+ parameters.Add("articleId=" & objArticle.ArticleID)
+
+ If (articleSettings.AlwaysShowPageID) Then
+ If (pageID <> Null.NullInteger) Then
+ parameters.Add("PageID=" & pageID.ToString())
+ End If
+ End If
+
+ If (articleSettings.AuthorUserIDFilter) Then
+ If (articleSettings.AuthorUserIDParam <> "") Then
+ If (HttpContext.Current.Request(articleSettings.AuthorUserIDParam) <> "") Then
+ parameters.Add(articleSettings.AuthorUserIDParam & "=" & HttpContext.Current.Request(articleSettings.AuthorUserIDParam))
+ End If
+ End If
+ End If
+
+ If (articleSettings.AuthorUsernameFilter) Then
+ If (articleSettings.AuthorUsernameParam <> "") Then
+ If (HttpContext.Current.Request(articleSettings.AuthorUsernameParam) <> "") Then
+ parameters.Add(articleSettings.AuthorUsernameParam & "=" & HttpContext.Current.Request(articleSettings.AuthorUsernameParam))
+ End If
+ End If
+ End If
+
+ If (System.Web.HttpContext.Current.Request.Url.Port = 80) Then
+ Return AddHTTP(System.Web.HttpContext.Current.Request.Url.Host & NavigateURL(objTab.TabID, Null.NullString, parameters.ToArray).Replace("&", "&"))
+ Else
+ Return AddHTTP(System.Web.HttpContext.Current.Request.Url.Host & ":" & System.Web.HttpContext.Current.Request.Url.Port.ToString() & NavigateURL(objTab.TabID, Null.NullString, parameters.ToArray).Replace("&", "&"))
+ End If
+ Else
+ Dim parameters As New List(Of String)
+
+ If (articleSettings.UrlModeType = Components.Types.UrlModeType.Classic) Then
+ parameters.Add("articleType=ArticleView")
+ parameters.Add("articleId=" & objArticle.ArticleID)
+ Else
+ parameters.Add(articleSettings.ShortenedID & "=" & objArticle.ArticleID)
+ End If
+
+ If (articleSettings.AlwaysShowPageID) Then
+ If (pageID <> Null.NullInteger) Then
+ parameters.Add("PageID=" & pageID.ToString())
+ End If
+ End If
+
+ If (articleSettings.AuthorUserIDFilter) Then
+ If (articleSettings.AuthorUserIDParam <> "") Then
+ If (HttpContext.Current.Request(articleSettings.AuthorUserIDParam) <> "") Then
+ parameters.Add(articleSettings.AuthorUserIDParam & "=" & HttpContext.Current.Request(articleSettings.AuthorUserIDParam))
+ End If
+ End If
+ End If
+
+ If (articleSettings.AuthorUsernameFilter) Then
+ If (articleSettings.AuthorUsernameParam <> "") Then
+ If (HttpContext.Current.Request(articleSettings.AuthorUsernameParam) <> "") Then
+ parameters.Add(articleSettings.AuthorUsernameParam & "=" & HttpContext.Current.Request(articleSettings.AuthorUsernameParam))
+ End If
+ End If
+ End If
+
+ If (System.Web.HttpContext.Current.Request.Url.Port = 80) Then
+ Return AddHTTP(System.Web.HttpContext.Current.Request.Url.Host & NavigateURL(objTab.TabID, Null.NullString, parameters.ToArray))
+ Else
+ Return AddHTTP(System.Web.HttpContext.Current.Request.Url.Host & ":" & System.Web.HttpContext.Current.Request.Url.Port.ToString() & NavigateURL(objTab.TabID, Null.NullString, parameters.ToArray))
+ End If
+ End If
+
+ End If
+
+ End Function
+
+ Public Shared Function GetArticleLink(ByVal objArticle As ArticleInfo, ByVal objTab As DotNetNuke.Entities.Tabs.TabInfo, ByVal articleSettings As ArticleSettings, ByVal includeCategory As Boolean, ByVal ParamArray additionalParameters As String()) As String
+ Return GetArticleLink(objArticle, objTab, articleSettings, includeCategory, Null.NullInteger, additionalParameters)
+ End Function
+
+ Public Shared Function GetArticleLink(ByVal objArticle As ArticleInfo, ByVal objTab As DotNetNuke.Entities.Tabs.TabInfo, ByVal articleSettings As ArticleSettings, ByVal includeCategory As Boolean, ByVal pageID As Integer, ByVal ParamArray additionalParameters As String()) As String
+
+ If HostController.Instance.GetString("UseFriendlyUrls") = "Y" Then
+
+ Dim strURL As String = ApplicationURL(objTab.TabID)
+ Dim settings As PortalSettings = PortalController.GetCurrentPortalSettings
+
+ If (articleSettings.LaunchLinks) Then
+ strURL = strURL & "&ctl=ArticleView"
+ strURL = strURL & "&mid=" & objArticle.ModuleID.ToString
+ strURL = strURL & "&articleId=" & objArticle.ArticleID
+
+ Else
+ If (articleSettings.UrlModeType = Components.Types.UrlModeType.Classic) Then
+ strURL = strURL & "&articleType=ArticleView"
+ strURL = strURL & "&articleId=" & objArticle.ArticleID
+ Else
+ strURL = strURL & "&" & articleSettings.ShortenedID & "=" & objArticle.ArticleID
+ End If
+ End If
+
+ If (articleSettings.AlwaysShowPageID) Then
+ If (pageID <> Null.NullInteger) Then
+
+ Dim found As Boolean = False
+ For Each param As String In additionalParameters
+ If (param.ToLower().StartsWith("pageid")) Then
+ found = True
+ End If
+ Next
+
+ If (found = False) Then
+ strURL = strURL & "&PageID=" & pageID.ToString()
+ End If
+
+ End If
+ End If
+
+ For Each param As String In additionalParameters
+ strURL = strURL & "&" & param
+ Next
+
+ If (articleSettings.AuthorUserIDFilter) Then
+ If (articleSettings.AuthorUserIDParam <> "") Then
+ If (HttpContext.Current.Request(articleSettings.AuthorUserIDParam) <> "") Then
+ strURL = strURL & "&" & articleSettings.AuthorUserIDParam & "=" & HttpContext.Current.Request(articleSettings.AuthorUserIDParam)
+ End If
+ End If
+ End If
+
+ If (articleSettings.AuthorUsernameFilter) Then
+ If (articleSettings.AuthorUsernameParam <> "") Then
+ If (HttpContext.Current.Request(articleSettings.AuthorUsernameParam) <> "") Then
+ strURL = strURL & "&" & articleSettings.AuthorUsernameParam & "=" & HttpContext.Current.Request(articleSettings.AuthorUsernameParam)
+ End If
+ End If
+ End If
+
+ Return FriendlyUrl(objTab, strURL, FormatTitle(objArticle.Title, articleSettings), settings)
+
+
+ Else
+
+ If (articleSettings.LaunchLinks) Then
+ Dim parameters As New List(Of String)
+ Dim pageFound As Boolean = False
+ For i As Integer = 0 To additionalParameters.Length - 1
+ parameters.Add(additionalParameters(i))
+ If (additionalParameters(i).ToLower().StartsWith("pageid=")) Then
+ pageFound = True
+ End If
+ Next
+ parameters.Add("mid=" & objArticle.ModuleID.ToString)
+ parameters.Add("ctl=ArticleView")
+ parameters.Add("articleId=" & objArticle.ArticleID)
+
+ If (articleSettings.AlwaysShowPageID) Then
+ If (pageID <> Null.NullInteger) Then
+ If (pageFound = False) Then
+ parameters.Add("PageID=" & pageID.ToString())
+ End If
+ End If
+ End If
+
+ If (articleSettings.AuthorUserIDFilter) Then
+ If (articleSettings.AuthorUserIDParam <> "") Then
+ If (HttpContext.Current.Request(articleSettings.AuthorUserIDParam) <> "") Then
+ parameters.Add(articleSettings.AuthorUserIDParam & "=" & HttpContext.Current.Request(articleSettings.AuthorUserIDParam))
+ End If
+ End If
+ End If
+
+ If (articleSettings.AuthorUsernameFilter) Then
+ If (articleSettings.AuthorUsernameParam <> "") Then
+ If (HttpContext.Current.Request(articleSettings.AuthorUsernameParam) <> "") Then
+ parameters.Add(articleSettings.AuthorUsernameParam & "=" & HttpContext.Current.Request(articleSettings.AuthorUsernameParam))
+ End If
+ End If
+ End If
+
+ If (System.Web.HttpContext.Current.Request.Url.Port = 80) Then
+ Return AddHTTP(System.Web.HttpContext.Current.Request.Url.Host & NavigateURL(objTab.TabID, Null.NullString, parameters.ToArray))
+ Else
+ Return AddHTTP(System.Web.HttpContext.Current.Request.Url.Host & ":" & System.Web.HttpContext.Current.Request.Url.Port.ToString() & NavigateURL(objTab.TabID, Null.NullString, parameters.ToArray))
+ End If
+ Else
+ Dim parameters As New List(Of String)
+ Dim pageFound As Boolean = False
+ For i As Integer = 0 To additionalParameters.Length - 1
+ parameters.Add(additionalParameters(i))
+ If (additionalParameters(i).ToLower().StartsWith("pageid=")) Then
+ pageFound = True
+ End If
+ Next
+
+ If (articleSettings.UrlModeType = Components.Types.UrlModeType.Classic) Then
+ parameters.Add("articleType=ArticleView")
+ parameters.Add("articleId=" & objArticle.ArticleID)
+ Else
+ parameters.Add(articleSettings.ShortenedID & "=" & objArticle.ArticleID)
+ End If
+
+ If (articleSettings.AlwaysShowPageID) Then
+ If (pageID <> Null.NullInteger) Then
+ If (pageFound = False) Then
+ parameters.Add("PageID=" & pageID.ToString())
+ End If
+ End If
+ End If
+
+ If (articleSettings.AuthorUserIDFilter) Then
+ If (articleSettings.AuthorUserIDParam <> "") Then
+ If (HttpContext.Current.Request(articleSettings.AuthorUserIDParam) <> "") Then
+ parameters.Add(articleSettings.AuthorUserIDParam & "=" & HttpContext.Current.Request(articleSettings.AuthorUserIDParam))
+ End If
+ End If
+ End If
+
+ If (articleSettings.AuthorUsernameFilter) Then
+ If (articleSettings.AuthorUsernameParam <> "") Then
+ If (HttpContext.Current.Request(articleSettings.AuthorUsernameParam) <> "") Then
+ parameters.Add(articleSettings.AuthorUsernameParam & "=" & HttpContext.Current.Request(articleSettings.AuthorUsernameParam))
+ End If
+ End If
+ End If
+
+ If (System.Web.HttpContext.Current.Request.Url.Port = 80) Then
+ Return AddHTTP(System.Web.HttpContext.Current.Request.Url.Host & NavigateURL(objTab.TabID, Null.NullString, parameters.ToArray))
+ Else
+ Return AddHTTP(System.Web.HttpContext.Current.Request.Url.Host & ":" & System.Web.HttpContext.Current.Request.Url.Port.ToString() & NavigateURL(objTab.TabID, Null.NullString, parameters.ToArray))
+ End If
+ End If
+
+ End If
+
+ End Function
+
+ Public Shared Function GetArticleModules(ByVal portalID As Integer) As List(Of ModuleInfo)
+
+ Dim objModulesFound As New List(Of ModuleInfo)
+
+ Dim objDesktopModuleController As New DesktopModuleController
+ Dim objDesktopModuleInfo As DesktopModuleInfo = objDesktopModuleController.GetDesktopModuleByModuleName("DnnForge - NewsArticles")
+
+ If Not (objDesktopModuleInfo Is Nothing) Then
+
+ Dim objTabController As New TabController()
+ Dim objTabs As ArrayList = objTabController.GetTabs(portalID)
+ For Each objTab As DotNetNuke.Entities.Tabs.TabInfo In objTabs
+ If Not (objTab Is Nothing) Then
+ If (objTab.IsDeleted = False) Then
+ Dim objModules As New ModuleController
+ For Each pair As KeyValuePair(Of Integer, ModuleInfo) In objModules.GetTabModules(objTab.TabID)
+ Dim objModule As ModuleInfo = pair.Value
+ If (objModule.IsDeleted = False) Then
+ If (objModule.DesktopModuleID = objDesktopModuleInfo.DesktopModuleID) Then
+ If objModule.IsDeleted = False Then
+ Dim strPath As String = objTab.TabName
+ Dim objTabSelected As TabInfo = objTab
+ While objTabSelected.ParentId <> Null.NullInteger
+ objTabSelected = objTabController.GetTab(objTabSelected.ParentId, objTab.PortalID, False)
+ If (objTabSelected Is Nothing) Then
+ Exit While
+ End If
+ strPath = objTabSelected.TabName & " -> " & strPath
+ End While
+
+ objModulesFound.Add(objModule)
+ End If
+ End If
+ End If
+ Next
+ End If
+ End If
+ Next
+
+ End If
+
+ Return objModulesFound
+
+ End Function
+
+ Public Shared Function GetAuthorLink(ByVal tabID As Integer, ByVal moduleID As Integer, ByVal authorID As Integer, ByVal username As String, ByVal launchLinks As Boolean, ByVal articleSettings As ArticleSettings) As String
+
+ Dim objTab As TabInfo = PortalController.GetCurrentPortalSettings.ActiveTab
+ If (tabID <> PortalController.GetCurrentPortalSettings.ActiveTab.TabID) Then
+ Dim objTabController As New TabController
+ objTab = objTabController.GetTab(tabID, PortalController.GetCurrentPortalSettings.PortalId, False)
+ End If
+ Return GetAuthorLink(tabID, moduleID, authorID, username, launchLinks, objTab, articleSettings)
+
+ End Function
+
+ Public Shared Function GetAuthorLink(ByVal tabID As Integer, ByVal moduleID As Integer, ByVal authorID As Integer, ByVal username As String, ByVal launchLinks As Boolean, ByVal targetTab As TabInfo, ByVal articleSettings As ArticleSettings) As String
+
+ If Host.UseFriendlyUrls Then
+
+ Dim strURL As String = ApplicationURL(tabID)
+
+ If (launchLinks) Then
+ strURL = strURL & "&ctl=AuthorView"
+ strURL = strURL & "&mid=" & moduleID.ToString
+ Else
+ strURL = strURL & "&articleType=AuthorView"
+ End If
+ strURL = strURL & "&authorID=" & authorID.ToString()
+
+ ' TODO: Remove at a later date when minimum version raised.
+ If Localization.GetEnabledLocales.Count > 1 AndAlso LocalizationUtil.UseLanguageInUrl Then
+ strURL += "&language=" & Thread.CurrentThread.CurrentCulture.Name
+ End If
+
+ If (articleSettings.AuthorUserIDFilter) Then
+ If (articleSettings.AuthorUserIDParam <> "") Then
+ If (HttpContext.Current.Request(articleSettings.AuthorUserIDParam) <> "") Then
+ strURL = strURL & "&" & articleSettings.AuthorUserIDParam & "=" & HttpContext.Current.Request(articleSettings.AuthorUserIDParam)
+ End If
+ End If
+ End If
+
+ If (articleSettings.AuthorUsernameFilter) Then
+ If (articleSettings.AuthorUsernameParam <> "") Then
+ If (HttpContext.Current.Request(articleSettings.AuthorUsernameParam) <> "") Then
+ strURL = strURL & "&" & articleSettings.AuthorUsernameParam & "=" & HttpContext.Current.Request(articleSettings.AuthorUsernameParam)
+ End If
+ End If
+ End If
+
+ Return FriendlyUrl(targetTab, strURL, Common.FormatTitle("", articleSettings), PortalController.GetCurrentPortalSettings)
+
+ Else
+
+ Return Common.GetModuleLink(tabID, moduleID, "AuthorView", articleSettings, "AuthorID=" & authorID.ToString())
+
+ End If
+
+ End Function
+
+ Public Shared Function GetCategoryLink(ByVal tabID As Integer, ByVal moduleID As Integer, ByVal categoryID As String, ByVal title As String, ByVal launchLinks As Boolean, ByVal articleSettings As ArticleSettings) As String
+
+ Dim objTab As TabInfo = PortalController.GetCurrentPortalSettings.ActiveTab
+ If (tabID <> PortalController.GetCurrentPortalSettings.ActiveTab.TabID) Then
+ Dim objTabController As New TabController
+ objTab = objTabController.GetTab(tabID, PortalController.GetCurrentPortalSettings.PortalId, False)
+ End If
+ Return GetCategoryLink(tabID, moduleID, categoryID, title, launchLinks, objTab, articleSettings)
+
+ End Function
+
+ Public Shared Function GetCategoryLink(ByVal tabID As Integer, ByVal moduleID As Integer, ByVal categoryID As String, ByVal title As String, ByVal launchLinks As Boolean, ByVal targetTab As TabInfo, ByVal articleSettings As ArticleSettings) As String
+
+ If DotNetNuke.Entities.Host.HostSettings.GetHostSetting("UseFriendlyUrls") = "Y" Then
+
+ Dim strURL As String = ApplicationURL(tabID)
+ Dim settings As PortalSettings = PortalController.GetCurrentPortalSettings
+
+ If (launchLinks) Then
+ strURL = strURL & "&ctl=CategoryView"
+ strURL = strURL & "&mid=" & moduleID.ToString
+ Else
+ strURL = strURL & "&articleType=CategoryView"
+ End If
+ strURL = strURL & "&categoryId=" & categoryID
+
+ ' TODO: Remove at a later date when minimum version raised.
+ If Localization.GetEnabledLocales.Count > 1 AndAlso LocalizationUtil.UseLanguageInUrl Then
+ strURL += "&language=" & Thread.CurrentThread.CurrentCulture.Name
+ End If
+
+ If (articleSettings.AuthorUserIDFilter) Then
+ If (articleSettings.AuthorUserIDParam <> "") Then
+ If (HttpContext.Current.Request(articleSettings.AuthorUserIDParam) <> "") Then
+ strURL = strURL & "&" & articleSettings.AuthorUserIDParam & "=" & HttpContext.Current.Request(articleSettings.AuthorUserIDParam)
+ End If
+ End If
+ End If
+
+ If (articleSettings.AuthorUsernameFilter) Then
+ If (articleSettings.AuthorUsernameParam <> "") Then
+ If (HttpContext.Current.Request(articleSettings.AuthorUsernameParam) <> "") Then
+ strURL = strURL & "&" & articleSettings.AuthorUsernameParam & "=" & HttpContext.Current.Request(articleSettings.AuthorUsernameParam)
+ End If
+ End If
+ End If
+
+ Return FriendlyUrl(targetTab, strURL, Common.FormatTitle(title, articleSettings), settings)
+
+ Else
+
+ Return Common.GetModuleLink(tabID, moduleID, "CategoryView", articleSettings, "categoryId=" & categoryID)
+
+ End If
+
+ End Function
+
+ Public Shared Function GetModuleLink(ByVal tabID As Integer, ByVal moduleID As Integer, ByVal ctl As String, ByVal articleSettings As ArticleSettings, ByVal ParamArray additionalParameters As String()) As String
+
+ Dim parameters As New List(Of String)
+ For Each item As String In additionalParameters
+ parameters.Add(item)
+ Next
+
+ If (articleSettings.AuthorUserIDFilter) Then
+ If (articleSettings.AuthorUserIDParam <> "") Then
+ If (HttpContext.Current.Request(articleSettings.AuthorUserIDParam) <> "") Then
+ parameters.Add(articleSettings.AuthorUserIDParam & "=" & HttpContext.Current.Request(articleSettings.AuthorUserIDParam))
+ End If
+ End If
+ End If
+
+ If (articleSettings.AuthorUsernameFilter) Then
+ If (articleSettings.AuthorUsernameParam <> "") Then
+ If (HttpContext.Current.Request(articleSettings.AuthorUsernameParam) <> "") Then
+ parameters.Add(articleSettings.AuthorUsernameParam & "=" & HttpContext.Current.Request(articleSettings.AuthorUsernameParam))
+ End If
+ End If
+ End If
+
+ Dim link As String = ""
+
+ If (ctl <> "") Then
+
+ If (articleSettings.LaunchLinks) Then
+ parameters.Insert(0, "mid=" & moduleID.ToString())
+ If (ctl.ToLower() = "submitnews") Then
+ link = NavigateURL(tabID, "edit", parameters.ToArray())
+ Else
+ link = NavigateURL(tabID, ctl, parameters.ToArray())
+ End If
+ Else
+ parameters.Insert(0, "articleType=" & ctl)
+ link = NavigateURL(tabID, Null.NullString, parameters.ToArray())
+ End If
+
+ Else
+
+ link = NavigateURL(tabID, Null.NullString, parameters.ToArray())
+
+ End If
+
+ If Not (link.ToLower().StartsWith("http://") Or link.ToLower().StartsWith("https://")) Then
+
+ If (System.Web.HttpContext.Current.Request.Url.Port = 80) Then
+ link = AddHTTP(System.Web.HttpContext.Current.Request.Url.Host & link)
+ Else
+ link = AddHTTP(System.Web.HttpContext.Current.Request.Url.Host & ":" & System.Web.HttpContext.Current.Request.Url.Port.ToString() & link)
+ End If
+
+ End If
+
+ Return link
+
+ End Function
+
+ Public Shared Sub NotifyAuthor(ByVal objArticle As ArticleInfo, ByVal settings As Hashtable, ByVal moduleID As Integer, ByVal objTab As DotNetNuke.Entities.Tabs.TabInfo, ByVal portalID As Integer, ByVal articleSettings As ArticleSettings)
+
+ If (settings.Contains(ArticleConstants.NOTIFY_APPROVAL_SETTING)) Then
+ If (Convert.ToBoolean(settings(ArticleConstants.NOTIFY_APPROVAL_SETTING))) Then
+
+ Dim objUserController As New UserController
+ Dim objUser As UserInfo = objUserController.GetUser(portalID, objArticle.AuthorID)
+
+ Dim objEmailTemplateController As New EmailTemplateController
+ If Not (objUser Is Nothing) Then
+ objEmailTemplateController.SendFormattedEmail(moduleID, Common.GetArticleLink(objArticle, objTab, articleSettings, False), objArticle, EmailTemplateType.ArticleApproved, objUser.Email, articleSettings)
+ End If
+
+ End If
+ End If
+
+ End Sub
+
+ Public Shared Function HtmlEncode(ByVal text As String) As String
+
+ Return System.Web.HttpUtility.HtmlEncode(text)
+
+ End Function
+
+ Public Shared Function HtmlDecode(ByVal text As String) As String
+
+ Return System.Web.HttpUtility.HtmlDecode(text)
+
+ End Function
+
+ Public Shared Function ProcessPostTokens(ByVal content As String, ByVal objTab As TabInfo, ByVal objArticleSettings As ArticleSettings) As String
+
+ If (objArticleSettings.ProcessPostTokens = False) Then
+ Return content
+ End If
+
+ Dim delimStr As String = "[]"
+ Dim delimiter As Char() = delimStr.ToCharArray()
+
+ Dim layoutArray As String() = content.Split(delimiter)
+ Dim formattedContent As String = ""
+
+ For iPtr As Integer = 0 To layoutArray.Length - 1 Step 2
+
+ formattedContent += layoutArray(iPtr).ToString()
+
+ If iPtr < layoutArray.Length - 1 Then
+ Select Case layoutArray(iPtr + 1)
+ Case Else
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("ARTICLELINK:")) Then
+ If (IsNumeric(layoutArray(iPtr + 1).Substring(12, layoutArray(iPtr + 1).Length - 12))) Then
+ Dim articleID As Integer = Convert.ToInt32(layoutArray(iPtr + 1).Substring(12, layoutArray(iPtr + 1).Length - 12))
+
+ Dim objArticleController As New ArticleController()
+ Dim objArticle As ArticleInfo = objArticleController.GetArticle(articleID)
+
+ If (objArticle IsNot Nothing) Then
+ Dim link As String = Common.GetArticleLink(objArticle, objTab, objArticleSettings, False)
+ formattedContent += "" & objArticle.Title & ""
+ End If
+ End If
+ Exit Select
+ End If
+
+ formattedContent += "[" & layoutArray(iPtr + 1) & "]"
+ End Select
+ End If
+
+ Next
+
+ Return formattedContent
+
+ End Function
+
+ Public Shared Function StripTags(ByVal HTML As String) As String
+ If (HTML Is Nothing OrElse HTML.Trim() = "") Then
+ Return ""
+ End If
+ Dim pattern As String = "<(.|\n)*?>"
+ Return Regex.Replace(HTML, pattern, String.Empty)
+ End Function
+
+#End Region
+
+ End Class
+
+End Namespace
diff --git a/Components/Common/ArticleConstants.vb b/Components/Common/ArticleConstants.vb
new file mode 100755
index 0000000..bfb22d3
--- /dev/null
+++ b/Components/Common/ArticleConstants.vb
@@ -0,0 +1,375 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Namespace Ventrian.NewsArticles
+
+ Public Class ArticleConstants
+
+#Region " Constants "
+
+ 'Token Settings
+ Public Const DEFAULT_TEMPLATE = "Standard"
+
+ ' Basic Settings
+ Public Const EXPAND_SUMMARY_SETTING As String = "ExpandSummary"
+
+ Public Const ENABLE_RATINGS_AUTHENTICATED_SETTING As String = "EnableRatings"
+ Public Const ENABLE_RATINGS_ANONYMOUS_SETTING As String = "EnableAnonymousRatings"
+
+ Public Const JOURNAL_INTEGRATION_SETTING As String = "JournalIntegration"
+ Public Const JOURNAL_INTEGRATION_GROUPS_SETTING As String = "JournalIntegrationGroups"
+
+ Public Const ACTIVE_SOCIAL_SETTING As String = "ActiveSocialFeed"
+ Public Const ACTIVE_SOCIAL_SUBMIT_SETTING As String = "ActiveSocialFeedSubmit"
+ Public Const ACTIVE_SOCIAL_COMMENT_SETTING As String = "ActiveSocialFeedComment"
+ Public Const ACTIVE_SOCIAL_RATE_SETTING As String = "ActiveSocialFeedRate"
+ Public Const AUTHOR_SELECT_TYPE As String = "AuthorSelectType"
+ Public Const ENABLE_CORE_SEARCH_SETTING As String = "EnableCoreSearch"
+ Public Const ENABLE_SYNDICATION_SETTING As String = "EnableSyndication"
+ Public Const ENABLE_SYNDICATION_ENCLOSURES_SETTING As String = "EnableSyndicationEnclosures"
+ Public Const ENABLE_SYNDICATION_HTML_SETTING As String = "EnableSyndicationHtml"
+ Public Const ENABLE_NOTIFICATION_PING_SETTING As String = "NotificationPing"
+ Public Const ENABLE_AUTO_TRACKBACK_SETTING As String = "AutoTrackback"
+ Public Const ENABLE_INCOMING_TRACKBACK_SETTING As String = "IncomingTrackback"
+ Public Const PAGE_SIZE_SETTING As String = "Number"
+ Public Const LAUNCH_LINKS As String = "LaunchLinks"
+ Public Const BUBBLE_FEATURED_ARTICLES As String = "BubbleFeaturedArticles"
+ Public Const REQUIRE_CATEGORY As String = "RequireCategory"
+ Public Const DISPLAY_MODE As String = "DisplayMode"
+ Public Const PROCESS_POST_TOKENS As String = "ProcessPostTokens"
+ Public Const RELATED_MODE As String = "RelatedMode"
+ Public Const TEMPLATE_SETTING As String = "Template"
+ Public Const ENABLE_SEO_TITLE_SETTING As String = "EnableSEOTitle"
+ Public Const SEO_TITLE_SETTING As String = "SEOTitle"
+ Public Const TITLE_REPLACEMENT_TYPE As String = "TitleReplacementType"
+ Public Const SMART_THINKER_STORY_FEED_SETTING As String = "EnableSmartThinkerStoryFeed"
+ Public Const TEXT_EDITOR_WIDTH As String = "TextEditorWidth"
+ Public Const TEXT_EDITOR_HEIGHT As String = "TextEditorHeight"
+ Public Const TEXT_EDITOR_SUMMARY_MODE As String = "TextEditorSummaryMode"
+ Public Const TEXT_EDITOR_SUMMARY_WIDTH As String = "TextEditorSummaryWidth"
+ Public Const TEXT_EDITOR_SUMMARY_HEIGHT As String = "TextEditorSummaryHeight"
+ Public Const SERVER_TIMEZONE As String = "ServerTimeZone"
+ Public Const SORT_BY As String = "SortBy"
+ Public Const SORT_DIRECTION As String = "SortDirection"
+ Public Const SYNDICATION_LINK_TYPE As String = "SyndicationLinkType"
+ Public Const SYNDICATION_SUMMARY_LENGTH As String = "SyndicationSummaryLength"
+ Public Const SYNDICATION_MAX_COUNT As String = "SyndicationMaxCount"
+ Public Const SYNDICATION_ENCLOSURE_TYPE As String = "SyndicationEnclosureType"
+ Public Const SYNDICATION_IMAGE_PATH As String = "SyndicationImagePath"
+ Public Const MENU_POSITION_TYPE As String = "MenuPositionType"
+
+ ' Image Settings
+ Public Const INCLUDE_JQUERY_SETTING As String = "IncludeJQuery"
+ Public Const IMAGE_JQUERY_PATH As String = "JQueryPath"
+ Public Const ENABLE_EXTERNAL_IMAGES_SETTING As String = "EnableImagesExternal"
+ Public Const ENABLE_UPLOAD_IMAGES_SETTING As String = "EnableImagesUpload"
+ Public Const ENABLE_PORTAL_IMAGES_SETTING As String = "EnableImages"
+ Public Const DEFAULT_IMAGES_FOLDER_SETTING As String = "DefaultImagesFolder"
+ Public Const DEFAULT_FILES_FOLDER_SETTING As String = "DefaultFilesFolder"
+ Public Const IMAGE_RESIZE_SETTING As String = "ResizeImages"
+ Public Const IMAGE_THUMBNAIL_SETTING As String = "ImageThumbnailType"
+ Public Const IMAGE_MAX_WIDTH_SETTING As String = "ImageMaxWidth"
+ Public Const IMAGE_MAX_HEIGHT_SETTING As String = "ImageMaxHeight"
+
+ Public Const IMAGE_WATERMARK_ENABLED_SETTING As String = "ImageWatermarkEnabled"
+ Public Const IMAGE_WATERMARK_ENABLED_SETTING_DEFAULT As Boolean = False
+ Public Const IMAGE_WATERMARK_TEXT_SETTING As String = "ImageWatermarkText"
+ Public Const IMAGE_WATERMARK_TEXT_SETTING_DEFAULT As String = ""
+ Public Const IMAGE_WATERMARK_IMAGE_SETTING As String = "ImageWatermarkImage"
+ Public Const IMAGE_WATERMARK_IMAGE_SETTING_DEFAULT As String = ""
+ Public Const IMAGE_WATERMARK_IMAGE_POSITION_SETTING As String = "ImageWatermarkImagePosition"
+ Public Const IMAGE_WATERMARK_IMAGE_POSITION_SETTING_DEFAULT As WatermarkPosition = WatermarkPosition.BottomRight
+
+ Public Const DEFAULT_IMAGE_RESIZE As Boolean = True
+ Public Const DEFAULT_IMAGE_THUMBNAIL As ThumbnailType = ThumbnailType.Proportion
+ Public Const DEFAULT_IMAGE_MAX_WIDTH As Integer = 600
+ Public Const DEFAULT_IMAGE_MAX_HEIGHT As Integer = 480
+ Public Const DEFAULT_THUMBNAIL_HEIGHT As Integer = 100
+ Public Const DEFAULT_THUMBNAIL_WIDTH As Integer = 100
+
+ ' Category Settings
+ Public Const ARCHIVE_CURRENT_ARTICLES_SETTING As String = "ArchiveCurrentArticles"
+ Public Const ARCHIVE_CURRENT_ARTICLES_SETTING_DEFAULT As Boolean = True
+ Public Const ARCHIVE_CATEGORIES_SETTING As String = "ArchiveCategories"
+ Public Const ARCHIVE_CATEGORIES_SETTING_DEFAULT As Boolean = True
+ Public Const ARCHIVE_AUTHOR_SETTING As String = "ArchiveAuthor"
+ Public Const ARCHIVE_AUTHOR_SETTING_DEFAULT As Boolean = True
+ Public Const ARCHIVE_MONTH_SETTING As String = "ArchiveMonth"
+ Public Const ARCHIVE_MONTH_SETTING_DEFAULT As Boolean = True
+
+ ' Category Settings
+ Public Const DEFAULT_CATEGORIES_SETTING As String = "DefaultCategories"
+ Public Const CATEGORY_SELECTION_HEIGHT_SETTING As String = "CategorySelectionHeight"
+ Public Const CATEGORY_SELECTION_HEIGHT_DEFAULT As Integer = 150
+ Public Const CATEGORY_BREADCRUMB_SETTING As String = "CategoryBreadcrumb"
+ Public Const CATEGORY_BREADCRUMB_SETTING_DEFAULT As Boolean = True
+ Public Const CATEGORY_NAME_SETTING As String = "CategoryName"
+ Public Const CATEGORY_NAME_SETTING_DEFAULT As Boolean = True
+ Public Const CATEGORY_FILTER_SUBMIT_SETTING As String = "CategoryFilterSubmit"
+ Public Const CATEGORY_FILTER_SUBMIT_SETTING_DEFAULT As Boolean = False
+ Public Const CATEGORY_SORT_SETTING As String = "CategorySortType"
+ Public Const CATEGORY_SORT_SETTING_DEFAULT As CategorySortType = CategorySortType.SortOrder
+
+ ' Category Security Settings
+ Public Const PERMISSION_CATEGORY_VIEW_SETTING As String = "PermissionCategoryView"
+ Public Const PERMISSION_CATEGORY_SUBMIT_SETTING As String = "PermissionCategorySubmit"
+
+ ' Comment Settings
+ Public Const ENABLE_COMMENTS_SETTING As String = "EnableComments"
+ Public Const ENABLE_ANONYMOUS_COMMENTS_SETTING As String = "EnableAnonymousComments"
+ Public Const ENABLE_COMMENT_MODERATION_SETTING As String = "EnableCommentModeration"
+ Public Const COMMENT_HIDE_WEBSITE_SETTING As String = "CommentHideWebsite"
+ Public Const COMMENT_REQUIRE_NAME_SETTING As String = "CommentRequireName"
+ Public Const COMMENT_REQUIRE_EMAIL_SETTING As String = "CommentRequireEmail"
+ Public Const USE_CAPTCHA_SETTING As String = "UseCaptcha"
+ Public Const NOTIFY_DEFAULT_SETTING As String = "NotifyDefault"
+ Public Const COMMENT_SORT_DIRECTION_SETTING As String = "CommentSortDirection"
+ Public Const COMMENT_AKISMET_SETTING As String = "CommentAkismet"
+
+ ' Content Sharing Settings
+ Public Const CONTENT_SHARING_SETTING As String = "ContentSharingPortals"
+
+ ' Filter Settings
+ Public Const MAX_ARTICLES_SETTING As String = "MaxArticles"
+ Public Const MAX_AGE_SETTING As String = "MaxArticlesAge"
+ Public Const CATEGORIES_SETTING As String = "Categories"
+ Public Const CATEGORIES_FILTER_SINGLE_SETTING As String = "CategoriesFilterSingle"
+ Public Const SHOW_PENDING_SETTING As String = "ShowPending"
+ Public Const SHOW_FEATURED_ONLY_SETTING As String = "ShowFeaturedOnly"
+ Public Const SHOW_NOT_FEATURED_ONLY_SETTING As String = "ShowNotFeaturedOnly"
+ Public Const SHOW_SECURED_ONLY_SETTING As String = "ShowSecuredOnly"
+ Public Const SHOW_NOT_SECURED_ONLY_SETTING As String = "ShowNotSecuredOnly"
+ Public Const AUTHOR_SETTING As String = "Author"
+ Public Const AUTHOR_DEFAULT_SETTING As String = "AuthorDefault"
+ Public Const MATCH_OPERATOR_SETTING As String = "MatchOperator"
+
+ Public Const AUTHOR_USERID_FILTER_SETTING As String = "AuthorUserIDFilter"
+ Public Const AUTHOR_USERID_PARAM_SETTING As String = "AuthorUserIDParam"
+ Public Const AUTHOR_USERNAME_FILTER_SETTING As String = "AuthorUsernameFilter"
+ Public Const AUTHOR_USERNAME_PARAM_SETTING As String = "AuthorUsernameParam"
+ Public Const AUTHOR_LOGGED_IN_USER_FILTER_SETTING As String = "AuthorLoggedInUserFilter"
+
+ ' Security Settings
+ Public Const PERMISSION_ROLE_GROUP_ID As String = "RoleGroupIDFilter"
+ Public Const PERMISSION_SECURE_SETTING As String = "SecureRoles"
+ Public Const PERMISSION_SECURE_URL_SETTING As String = "SecureUrl"
+ Public Const PERMISSION_AUTO_SECURE_SETTING As String = "AutoSecureRoles"
+ Public Const PERMISSION_SUBMISSION_SETTING As String = "SubmissionRoles"
+ Public Const PERMISSION_APPROVAL_SETTING As String = "ApprovalRoles"
+ Public Const PERMISSION_AUTO_APPROVAL_SETTING As String = "AutoApprovalRoles"
+ Public Const PERMISSION_AUTO_APPROVAL_COMMENT_SETTING As String = "AutoApprovalCommentRoles"
+ Public Const PERMISSION_FEATURE_SETTING As String = "FeatureRoles"
+ Public Const PERMISSION_AUTO_FEATURE_SETTING As String = "AutoFeatureRoles"
+
+ ' Security Form Settings
+ Public Const PERMISSION_CATEGORIES_SETTING As String = "PermissionCategoriesRoles"
+ Public Const PERMISSION_EXCERPT_SETTING As String = "PermissionExcerptRoles"
+ Public Const PERMISSION_IMAGE_SETTING As String = "PermissionImageRoles"
+ Public Const PERMISSION_FILE_SETTING As String = "PermissionFileRoles"
+ Public Const PERMISSION_LINK_SETTING As String = "PermissionLinkRoles"
+ Public Const PERMISSION_PUBLISH_SETTING As String = "PermissionPublishRoles"
+ Public Const PERMISSION_EXPIRY_SETTING As String = "PermissionExpiryRoles"
+ Public Const PERMISSION_META_SETTING As String = "PermissionMetaRoles"
+ Public Const PERMISSION_CUSTOM_SETTING As String = "PermissionCustomRoles"
+
+ ' Admin Settings
+ Public Const PERMISSION_SITE_TEMPLATES_SETTING As String = "PermissionSiteTemplates"
+
+ ' Notification Settings
+ Public Const NOTIFY_SUBMISSION_SETTING As String = "NotifySubmission"
+ Public Const NOTIFY_SUBMISSION_SETTING_EMAIL As String = "NotifySubmissionEmail"
+ Public Const NOTIFY_APPROVAL_SETTING As String = "NotifyApproval"
+ Public Const NOTIFY_COMMENT_SETTING As String = "NotifyComment"
+ Public Const NOTIFY_COMMENT_SETTING_EMAIL As String = "NotifyCommentEmail"
+ Public Const NOTIFY_COMMENT_APPROVAL_SETTING As String = "NotifyCommentApproval"
+ Public Const NOTIFY_COMMENT_APPROVAL_EMAIL_SETTING As String = "NotifyCommentApprovalEmail"
+
+ ' SEO Settings
+ Public Const SEO_ALWAYS_SHOW_PAGEID_SETTING As String = "AlwaysShowPageID"
+ Public Const SEO_URL_MODE_SETTING As String = "SEOUrlMode"
+ Public Const SEO_SHORTEN_ID_SETTING As String = "SEOShorternID"
+ Public Const SEO_USE_CANONICAL_LINK_SETTING As String = "SEOUseCanonicalLink"
+ Public Const SEO_EXPAND_META_INFORMATION_SETTING As String = "SEOExpandMetaInformation"
+ Public Const SEO_UNIQUE_PAGE_TITLES_SETTING As String = "SEOUniquePageTitles"
+
+ ' SEO Settings
+ Public Const TWITTER_USERNAME As String = "NA-TwitterUsername"
+ Public Const TWITTER_BITLY_LOGIN As String = "NA-BitLyLogin"
+ Public Const TWITTER_BITLY_API_KEY As String = "NA-BitLyAPI"
+
+ ' Latest Articles
+ Public Const LATEST_ARTICLES_TAB_ID As String = "LatestArticlesTabID"
+ Public Const LATEST_ARTICLES_MODULE_ID As String = "LatestArticlesModuleID"
+ Public Const LATEST_ARTICLES_CATEGORIES As String = "LatestArticlesCategories"
+ Public Const LATEST_ARTICLES_CATEGORIES_EXCLUDE As String = "LatestArticlesCategoriesExclude"
+ Public Const LATEST_ARTICLES_MATCH_OPERATOR As String = "LatestArticlesMatchOperator"
+ Public Const LATEST_ARTICLES_TAGS As String = "LatestArticlesTags"
+ Public Const LATEST_ARTICLES_TAGS_MATCH_OPERATOR As String = "LatestArticlesTagsMatchOperator"
+ Public Const LATEST_ARTICLES_IDS As String = "LatestArticlesIDS"
+ Public Const LATEST_ARTICLES_COUNT As String = "LatestArticlesCount"
+ Public Const LATEST_ARTICLES_START_POINT As String = "LatestArticlesStartPoint"
+ Public Const LATEST_ARTICLES_MAX_AGE As String = "LatestArticlesMaxAge"
+ Public Const LATEST_ARTICLES_START_DATE As String = "LatestArticlesStartDate"
+ Public Const LATEST_ARTICLES_SHOW_PENDING As String = "LatestArticlesShowPending"
+ Public Const LATEST_ARTICLES_SHOW_RELATED As String = "LatestArticlesShowRelated"
+ Public Const LATEST_ARTICLES_FEATURED_ONLY As String = "LatestArticlesFeaturedOnly"
+ Public Const LATEST_ARTICLES_NOT_FEATURED_ONLY As String = "LatestArticlesNotFeaturedOnly"
+ Public Const LATEST_ARTICLES_SECURED_ONLY As String = "LatestArticlesSecuredOnly"
+ Public Const LATEST_ARTICLES_NOT_SECURED_ONLY As String = "LatestArticlesNotSecuredOnly"
+ Public Const LATEST_ARTICLES_CUSTOM_FIELD_FILTER As String = "LatestArticlesCustomFieldFilter"
+ Public Const LATEST_ARTICLES_CUSTOM_FIELD_VALUE As String = "LatestArticlesCustomFieldValue"
+ Public Const LATEST_ARTICLES_LINK_FILTER As String = "LatestArticlesLinkFilter"
+ Public Const LATEST_ARTICLES_SORT_BY As String = "LatestArticlesSortBy"
+ Public Const LATEST_ARTICLES_SORT_DIRECTION As String = "LatestArticlesSortDirection"
+ Public Const LATEST_ARTICLES_ITEMS_PER_ROW As String = "ItemsPerRow"
+ Public Const LATEST_ARTICLES_ITEMS_PER_ROW_DEFAULT As Integer = 1
+ Public Const LATEST_ARTICLES_AUTHOR As String = "LatestArticlesAuthor"
+ Public Const LATEST_ARTICLES_AUTHOR_DEFAULT As Integer = -1
+ Public Const LATEST_ARTICLES_QUERY_STRING_FILTER As String = "LatestArticlesQueryStringFilter"
+ Public Const LATEST_ARTICLES_QUERY_STRING_FILTER_DEFAULT As Boolean = False
+ Public Const LATEST_ARTICLES_QUERY_STRING_PARAM As String = "LatestArticlesQueryStringParam"
+ Public Const LATEST_ARTICLES_QUERY_STRING_PARAM_DEFAULT As String = "ID"
+ Public Const LATEST_ARTICLES_USERNAME_FILTER As String = "LatestArticlesUsernameFilter"
+ Public Const LATEST_ARTICLES_USERNAME_FILTER_DEFAULT As Boolean = False
+ Public Const LATEST_ARTICLES_USERNAME_PARAM As String = "LatestArticlesUsernameParam"
+ Public Const LATEST_ARTICLES_USERNAME_PARAM_DEFAULT As String = "Username"
+ Public Const LATEST_ARTICLES_LOGGED_IN_USER_FILTER As String = "LatestArticlesLoggedInUserFilter"
+ Public Const LATEST_ARTICLES_LOGGED_IN_USER_FILTER_DEFAULT As Boolean = False
+ Public Const LATEST_ARTICLES_INCLUDE_STYLESHEET As String = "LatestArticlesIncludeStylesheet"
+ Public Const LATEST_ARTICLES_INCLUDE_STYLESHEET_DEFAULT As Boolean = False
+
+ Public Const LATEST_ENABLE_PAGER As String = "LatestEnablePager"
+ Public Const LATEST_ENABLE_PAGER_DEFAULT As Boolean = False
+ Public Const LATEST_PAGE_SIZE As String = "LatestPageSize"
+ Public Const LATEST_PAGE_SIZE_DEFAULT As Integer = 10
+
+ Public Const LATEST_ARTICLES_LAYOUT_MODE As String = "LayoutMode"
+ Public Const LATEST_ARTICLES_LAYOUT_MODE_DEFAULT As LayoutModeType = LayoutModeType.Simple
+
+ Public Const SETTING_HTML_HEADER As String = "HtmlHeader"
+ Public Const SETTING_HTML_BODY As String = "HtmlBody"
+ Public Const SETTING_HTML_FOOTER As String = "HtmlFooter"
+
+ Public Const SETTING_HTML_HEADER_ADVANCED As String = "HtmlHeaderAdvanced"
+ Public Const SETTING_HTML_BODY_ADVANCED As String = "HtmlBodyAdvanced"
+ Public Const SETTING_HTML_FOOTER_ADVANCED As String = "HtmlFooterAdvanced"
+
+ Public Const SETTING_HTML_NO_ARTICLES As String = "HtmlNoArticles"
+
+ Public Const DEFAULT_HTML_HEADER As String = "
"
+ Public Const DEFAULT_HTML_FOOTER As String = "
"
+ Public Const DEFAULT_HTML_HEADER_ADVANCED As String = ""
+ Public Const DEFAULT_HTML_BODY_ADVANCED As String = "[EDIT][TITLE] by [AUTHORUSERNAME] [SUMMARY]"
+ Public Const DEFAULT_HTML_FOOTER_ADVANCED As String = ""
+ Public Const DEFAULT_HTML_NO_ARTICLES As String = "No articles match criteria."
+ Public Const DEFAULT_SORT_BY As String = "StartDate"
+ Public Const DEFAULT_SORT_DIRECTION As String = "DESC"
+
+ ' Latest Comments
+ Public Const LATEST_COMMENTS_TAB_ID As String = "LatestCommentsTabID"
+ Public Const LATEST_COMMENTS_MODULE_ID As String = "LatestCommentsModuleID"
+ Public Const LATEST_COMMENTS_COUNT As String = "LatestCommentsCount"
+
+ Public Const LATEST_COMMENTS_HTML_HEADER As String = "HtmlHeaderLatestComments"
+ Public Const LATEST_COMMENTS_HTML_BODY As String = "HtmlBodyLatestComments"
+ Public Const LATEST_COMMENTS_HTML_FOOTER As String = "HtmlFooterLatestComments"
+ Public Const LATEST_COMMENTS_HTML_NO_COMMENTS As String = "HtmlNoCommentsLatestComments"
+ Public Const LATEST_COMMENTS_INCLUDE_STYLESHEET As String = "LatestCommentsIncludeStylesheet"
+
+ Public Const DEFAULT_LATEST_COMMENTS_HTML_HEADER As String = "
"
+ Public Const DEFAULT_LATEST_COMMENTS_HTML_BODY As String = "
"
+ Public Const DEFAULT_LATEST_COMMENTS_HTML_FOOTER As String = "
"
+ Public Const DEFAULT_LATEST_COMMENTS_HTML_NO_COMMENTS As String = "No comments match criteria."
+ Public Const DEFAULT_LATEST_COMMENTS_INCLUDE_STYLESHEET As Boolean = False
+
+ ' News Archives
+ Public Const NEWS_ARCHIVES_TAB_ID As String = "NewsArchivesTabID"
+ Public Const NEWS_ARCHIVES_TAB_ID_DEFAULT As Integer = -1
+ Public Const NEWS_ARCHIVES_MODULE_ID As String = "NewsArchivesModuleID"
+ Public Const NEWS_ARCHIVES_MODULE_ID_DEFAULT As Integer = -1
+ Public Const NEWS_ARCHIVES_MODE As String = "NewsArchivesMode"
+ Public Const NEWS_ARCHIVES_MODE_DEFAULT As ArchiveModeType = ArchiveModeType.Date
+ Public Const NEWS_ARCHIVES_HIDE_ZERO_CATEGORIES As String = "NewsArchivesHideZeroCategories"
+ Public Const NEWS_ARCHIVES_PARENT_CATEGORY As String = "NewsArchivesParentCategory"
+ Public Const NEWS_ARCHIVES_PARENT_CATEGORY_DEFAULT As Integer = -1
+ Public Const NEWS_ARCHIVES_MAX_DEPTH As String = "NewsArchivesMaxDepth"
+ Public Const NEWS_ARCHIVES_MAX_DEPTH_DEFAULT As Integer = -1
+ Public Const NEWS_ARCHIVES_AUTHOR_SORT_BY As String = "NewsArchivesAuthorSortBy"
+ Public Const NEWS_ARCHIVES_AUTHOR_SORT_BY_DEFAULT As AuthorSortByType = AuthorSortByType.DisplayName
+ Public Const NEWS_ARCHIVES_HIDE_ZERO_CATEGORIES_DEFAULT As Boolean = False
+ Public Const NEWS_ARCHIVES_GROUP_BY As String = "GroupBy"
+ Public Const NEWS_ARCHIVES_GROUP_BY_DEFAULT As GroupByType = GroupByType.Month
+ Public Const NEWS_ARCHIVES_LAYOUT_MODE As String = "LayoutMode"
+ Public Const NEWS_ARCHIVES_LAYOUT_MODE_DEFAULT As LayoutModeType = LayoutModeType.Simple
+ Public Const NEWS_ARCHIVES_ITEMS_PER_ROW As String = "ItemsPerRow"
+ Public Const NEWS_ARCHIVES_ITEMS_PER_ROW_DEFAULT As Integer = 1
+
+ Public Const NEWS_ARCHIVES_SETTING_HTML_HEADER As String = "NewsArchivesHtmlHeader"
+ Public Const NEWS_ARCHIVES_SETTING_HTML_BODY As String = "NewsArchivesHtmlBody"
+ Public Const NEWS_ARCHIVES_SETTING_HTML_FOOTER As String = "NewsArchivesHtmlFooter"
+
+ Public Const NEWS_ARCHIVES_SETTING_HTML_HEADER_ADVANCED As String = "NewsArchivesHtmlHeaderAdvanced"
+ Public Const NEWS_ARCHIVES_SETTING_HTML_BODY_ADVANCED As String = "NewsArchivesHtmlBodyAdvanced"
+ Public Const NEWS_ARCHIVES_SETTING_HTML_FOOTER_ADVANCED As String = "NewsArchivesHtmlFooterAdvanced"
+
+ Public Const NEWS_ARCHIVES_SETTING_CATEGORY_HTML_HEADER As String = "NewsArchivesCategoryHtmlHeader"
+ Public Const NEWS_ARCHIVES_SETTING_CATEGORY_HTML_BODY As String = "NewsArchivesCategoryHtmlBody"
+ Public Const NEWS_ARCHIVES_SETTING_CATEGORY_HTML_FOOTER As String = "NewsArchivesCategoryHtmlFooter"
+
+ Public Const NEWS_ARCHIVES_SETTING_CATEGORY_HTML_HEADER_ADVANCED As String = "NewsArchivesCategoryHtmlHeaderAdvanced"
+ Public Const NEWS_ARCHIVES_SETTING_CATEGORY_HTML_BODY_ADVANCED As String = "NewsArchivesCategoryHtmlBodyAdvanced"
+ Public Const NEWS_ARCHIVES_SETTING_CATEGORY_HTML_FOOTER_ADVANCED As String = "NewsArchivesCategoryHtmlFooterAdvanced"
+
+ Public Const NEWS_ARCHIVES_SETTING_AUTHOR_HTML_HEADER As String = "NewsArchivesAuthorHtmlHeader"
+ Public Const NEWS_ARCHIVES_SETTING_AUTHOR_HTML_BODY As String = "NewsArchivesAuthorHtmlBody"
+ Public Const NEWS_ARCHIVES_SETTING_AUTHOR_HTML_FOOTER As String = "NewsArchivesAuthorHtmlFooter"
+
+ Public Const NEWS_ARCHIVES_SETTING_AUTHOR_HTML_HEADER_ADVANCED As String = "NewsArchivesAuthorHtmlHeaderAdvanced"
+ Public Const NEWS_ARCHIVES_SETTING_AUTHOR_HTML_BODY_ADVANCED As String = "NewsArchivesAuthorHtmlBodyAdvanced"
+ Public Const NEWS_ARCHIVES_SETTING_AUTHOR_HTML_FOOTER_ADVANCED As String = "NewsArchivesAuthorHtmlFooterAdvanced"
+
+ Public Const NEWS_ARCHIVES_DEFAULT_HTML_HEADER As String = "
"
+ Public Const NEWS_ARCHIVES_DEFAULT_HTML_BODY As String = "
"
+ Public Const NEWS_ARCHIVES_DEFAULT_HTML_FOOTER As String = "
"
+
+ Public Const NEWS_ARCHIVES_DEFAULT_HTML_HEADER_ADVANCED As String = ""
+ Public Const NEWS_ARCHIVES_DEFAULT_HTML_BODY_ADVANCED As String = "[MONTH] [YEAR] ([COUNT])"
+ Public Const NEWS_ARCHIVES_DEFAULT_HTML_FOOTER_ADVANCED As String = ""
+
+ Public Const NEWS_ARCHIVES_DEFAULT_CATEGORY_HTML_HEADER As String = "
"
+ Public Const NEWS_ARCHIVES_DEFAULT_CATEGORY_HTML_BODY As String = "
"
+ Public Const NEWS_ARCHIVES_DEFAULT_CATEGORY_HTML_FOOTER As String = "
"
+
+ Public Const NEWS_ARCHIVES_DEFAULT_CATEGORY_HTML_HEADER_ADVANCED As String = ""
+ Public Const NEWS_ARCHIVES_DEFAULT_CATEGORY_HTML_BODY_ADVANCED As String = "[CATEGORY] ([COUNT])"
+ Public Const NEWS_ARCHIVES_DEFAULT_CATEGORY_HTML_FOOTER_ADVANCED As String = ""
+
+ Public Const NEWS_ARCHIVES_DEFAULT_AUTHOR_HTML_HEADER As String = "
"
+ Public Const NEWS_ARCHIVES_DEFAULT_AUTHOR_HTML_BODY As String = "
"
+ Public Const NEWS_ARCHIVES_DEFAULT_AUTHOR_HTML_FOOTER As String = "
"
+
+ Public Const NEWS_ARCHIVES_DEFAULT_AUTHOR_HTML_HEADER_ADVANCED As String = ""
+ Public Const NEWS_ARCHIVES_DEFAULT_AUTHOR_HTML_BODY_ADVANCED As String = "[AUTHORDISPLAYNAME] ([COUNT])"
+ Public Const NEWS_ARCHIVES_DEFAULT_AUTHOR_HTML_FOOTER_ADVANCED As String = ""
+
+ ' News Search
+
+ Public Const NEWS_SEARCH_TAB_ID As String = "NewsSearchTabID"
+ Public Const NEWS_SEARCH_MODULE_ID As String = "NewsSearchModuleID"
+
+ ' Caching Constants
+ Public Const CACHE_CATEGORY_ARTICLE As String = "NewsCategory_Cache_"
+ Public Const CACHE_IMAGE_ARTICLE As String = "NewsImage_Cache_"
+ Public Const CACHE_CATEGORY_ARTICLE_NO_LINK As String = "NewsCategory_Cache_NoLink"
+ Public Const CACHE_CATEGORY_ARTICLE_LATEST As String = "NewsCategory_Cache_Latest_"
+
+#End Region
+
+ End Class
+
+End Namespace
+
diff --git a/Components/Common/ArticleUtilities.vb b/Components/Common/ArticleUtilities.vb
new file mode 100755
index 0000000..71e00d2
--- /dev/null
+++ b/Components/Common/ArticleUtilities.vb
@@ -0,0 +1,49 @@
+Namespace Ventrian.NewsArticles.Components.Common
+
+ Public Class ArticleUtilities
+
+ Public Shared Function MapPath(ByVal path As String)
+
+ If (HttpContext.Current IsNot Nothing) Then
+ Return HttpContext.Current.Server.MapPath(path)
+ End If
+
+ Return path
+
+ End Function
+
+ Public Shared Function ResolveUrl(ByVal path As String)
+
+ Return SafeToAbsolute(path)
+
+ End Function
+
+ Public Shared Function ToAbsoluteUrl(relativeUrl As String) As String
+ If String.IsNullOrEmpty(relativeUrl) Then
+ Return relativeUrl
+ End If
+
+ If HttpContext.Current Is Nothing Then
+ Return relativeUrl
+ End If
+
+ Dim url = HttpContext.Current.Request.Url
+ Dim port = If(url.Port <> 80, (":" & url.Port), [String].Empty)
+
+ If relativeUrl.StartsWith("~") Then
+ Return [String].Format("{0}://{1}{2}{3}", url.Scheme, url.Host, port, SafeToAbsolute(relativeUrl))
+ Else
+ Return [String].Format("{0}://{1}{2}{3}", url.Scheme, url.Host, port, relativeUrl)
+ End If
+ End Function
+
+ Private Shared Function SafeToAbsolute(path As String) As String
+ Dim madeSafe As String = path.Replace("?", "UNLIKELY_TOKEN")
+ Dim absolute As String = VirtualPathUtility.ToAbsolute(madeSafe)
+ Dim restored As String = absolute.Replace("UNLIKELY_TOKEN", "?")
+ Return restored
+ End Function
+
+ End Class
+
+End Namespace
diff --git a/Components/ContentSharingInfo.vb b/Components/ContentSharingInfo.vb
new file mode 100755
index 0000000..bf55364
--- /dev/null
+++ b/Components/ContentSharingInfo.vb
@@ -0,0 +1,115 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.Data
+
+Imports DotNetNuke
+Imports DotNetNuke.Common.Utilities
+Imports DotNetNuke.Entities.Portals
+
+Namespace Ventrian.NewsArticles
+
+ Public Class ContentSharingInfo
+
+#Region " Private Methods "
+
+ ' local property declarations
+ Dim _linkedPortalID As Integer
+ Dim _portalTitle As String
+ Dim _linkedTabID As Integer
+ Dim _tabTitle As String
+ Dim _linkedModuleID As Integer
+ Dim _moduleTitle As String
+
+#End Region
+
+#Region " Public Properties "
+
+ Public Property LinkedPortalID() As Integer
+ Get
+ Return _linkedPortalID
+ End Get
+ Set(ByVal Value As Integer)
+ _linkedPortalID = Value
+ End Set
+ End Property
+
+ Public ReadOnly Property PortalTitle() As String
+ Get
+ If (_portalTitle = "") Then
+ Dim objPortalController As New PortalController()
+ Dim objPortal As PortalInfo = objPortalController.GetPortal(LinkedPortalID)
+
+ If (objPortal IsNot Nothing) Then
+ _portalTitle = objPortal.PortalName
+
+ Dim o As New PortalAliasController
+ Dim portalAliases As ArrayList = o.GetPortalAliasArrayByPortalID(_linkedPortalID)
+
+ If (portalAliases.Count > 0) Then
+ _portalTitle = DotNetNuke.Common.AddHTTP(CType(portalAliases(0), PortalAliasInfo).HTTPAlias)
+ End If
+ End If
+
+ End If
+ Return _portalTitle
+ End Get
+ End Property
+
+ Public Property LinkedTabID() As Integer
+ Get
+ Return _linkedTabID
+ End Get
+ Set(ByVal Value As Integer)
+ _linkedTabID = Value
+ End Set
+ End Property
+
+ Public Property TabTitle() As String
+ Get
+ Return _tabTitle
+ End Get
+ Set(ByVal Value As String)
+ _tabTitle = Value
+ End Set
+ End Property
+
+ Public Property LinkedModuleID() As Integer
+ Get
+ Return _linkedModuleID
+ End Get
+ Set(ByVal Value As Integer)
+ _linkedModuleID = Value
+ End Set
+ End Property
+
+ Public Property ModuleTitle() As String
+ Get
+ Return _moduleTitle
+ End Get
+ Set(ByVal Value As String)
+ _moduleTitle = Value
+ End Set
+ End Property
+
+ Public ReadOnly Property Title() As String
+ Get
+ Return PortalTitle & " -> " & _tabTitle & " -> " & _moduleTitle
+ End Get
+ End Property
+
+ Public ReadOnly Property LinkedID() As String
+ Get
+ Return _linkedPortalID & "-" & _linkedModuleID
+ End Get
+ End Property
+
+#End Region
+
+ End Class
+
+End Namespace
\ No newline at end of file
diff --git a/Components/Controllers/PageController.vb b/Components/Controllers/PageController.vb
new file mode 100755
index 0000000..9e4ff43
--- /dev/null
+++ b/Components/Controllers/PageController.vb
@@ -0,0 +1,53 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports DotNetNuke.Common.Utilities
+
+Namespace Ventrian.NewsArticles
+
+ Public Class PageController
+
+#Region " Public Methods "
+
+ Public Function GetPageList(ByVal articleId As Integer) As ArrayList
+
+ Return CBO.FillCollection(DataProvider.Instance().GetPageList(articleId), GetType(PageInfo))
+
+ End Function
+
+ Public Function GetPage(ByVal pageId As Integer) As PageInfo
+
+ Return CType(CBO.FillObject(DataProvider.Instance().GetPage(pageId), GetType(PageInfo)), PageInfo)
+
+ End Function
+
+ Public Sub DeletePage(ByVal pageId As Integer)
+
+ DataProvider.Instance().DeletePage(pageId)
+
+ End Sub
+
+ Public Function AddPage(ByVal objPage As PageInfo) As Integer
+
+ Dim pageId As Integer = DataProvider.Instance().AddPage(objPage.ArticleID, objPage.Title, objPage.PageText, objPage.SortOrder)
+ ArticleController.ClearArticleCache(objPage.ArticleID)
+ Return pageId
+
+ End Function
+
+ Public Sub UpdatePage(ByVal objPage As PageInfo)
+
+ DataProvider.Instance().UpdatePage(objPage.PageID, objPage.ArticleID, objPage.Title, objPage.PageText, objPage.SortOrder)
+
+ ArticleController.ClearArticleCache(objPage.ArticleID)
+
+ End Sub
+
+#End Region
+
+ End Class
+
+End Namespace
\ No newline at end of file
diff --git a/Components/Controllers/PageInfo.vb b/Components/Controllers/PageInfo.vb
new file mode 100755
index 0000000..6437c1a
--- /dev/null
+++ b/Components/Controllers/PageInfo.vb
@@ -0,0 +1,79 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.Data
+
+Imports DotNetNuke
+Imports DotNetNuke.Common.Utilities
+
+Namespace Ventrian.NewsArticles
+
+ Public Class PageInfo
+
+#Region " Private Methods "
+
+ ' local property declarations
+ Dim _pageID As Integer
+ Dim _articleID As Integer
+ Dim _title As String
+ Dim _pageText As String
+ Dim _sortOrder As Integer
+
+#End Region
+
+#Region " Public Properties "
+
+ Public Property PageID() As Integer
+ Get
+ Return _pageID
+ End Get
+ Set(ByVal Value As Integer)
+ _pageID = Value
+ End Set
+ End Property
+
+ Public Property ArticleID() As Integer
+ Get
+ Return _articleID
+ End Get
+ Set(ByVal Value As Integer)
+ _articleID = Value
+ End Set
+ End Property
+
+ Public Property Title() As String
+ Get
+ Return _title
+ End Get
+ Set(ByVal Value As String)
+ _title = Value
+ End Set
+ End Property
+
+ Public Property PageText() As String
+ Get
+ Return _pageText
+ End Get
+ Set(ByVal Value As String)
+ _pageText = Value
+ End Set
+ End Property
+
+ Public Property SortOrder() As Integer
+ Get
+ Return _sortOrder
+ End Get
+ Set(ByVal Value As Integer)
+ _sortOrder = Value
+ End Set
+ End Property
+
+#End Region
+
+ End Class
+
+End Namespace
\ No newline at end of file
diff --git a/Components/CustomFields/CustomFieldController.vb b/Components/CustomFields/CustomFieldController.vb
new file mode 100755
index 0000000..ad1cbbe
--- /dev/null
+++ b/Components/CustomFields/CustomFieldController.vb
@@ -0,0 +1,61 @@
+Imports DotNetNuke.Common.Utilities
+
+Namespace Ventrian.NewsArticles.Components.CustomFields
+
+ Public Class CustomFieldController
+
+#Region " Private Members "
+
+ Private Const CACHE_KEY As String = "-NewsArticles-CustomFields-All"
+
+#End Region
+
+#Region " Public Methods "
+
+ Public Function [Get](ByVal customFieldID As Integer) As CustomFieldInfo
+
+ Return CType(CBO.FillObject(DataProvider.Instance().GetCustomField(customFieldID), GetType(CustomFieldInfo)), CustomFieldInfo)
+
+ End Function
+
+ Public Function List(ByVal moduleID As Integer) As ArrayList
+
+ Dim key As String = moduleID.ToString() & CACHE_KEY
+
+ Dim objCustomFields As ArrayList = CType(DataCache.GetCache(key), ArrayList)
+
+ If (objCustomFields Is Nothing) Then
+ objCustomFields = CBO.FillCollection(DataProvider.Instance().GetCustomFieldList(moduleID), GetType(CustomFieldInfo))
+ DataCache.SetCache(key, objCustomFields)
+ End If
+
+ Return objCustomFields
+
+ End Function
+
+ Public Sub Delete(ByVal moduleID As Integer, ByVal customFieldID As Integer)
+
+ DataCache.RemoveCache(moduleID.ToString() & CACHE_KEY)
+ DataProvider.Instance().DeleteCustomField(customFieldID)
+
+ End Sub
+
+ Public Function Add(ByVal objCustomField As CustomFieldInfo) As Integer
+
+ DataCache.RemoveCache(objCustomField.ModuleID.ToString() & CACHE_KEY)
+ Return CType(DataProvider.Instance().AddCustomField(objCustomField.ModuleID, objCustomField.Name, objCustomField.FieldType, objCustomField.FieldElements, objCustomField.DefaultValue, objCustomField.Caption, objCustomField.CaptionHelp, objCustomField.IsRequired, objCustomField.IsVisible, objCustomField.SortOrder, objCustomField.ValidationType, objCustomField.Length, objCustomField.RegularExpression), Integer)
+
+ End Function
+
+ Public Sub Update(ByVal objCustomField As CustomFieldInfo)
+
+ DataCache.RemoveCache(objCustomField.ModuleID.ToString() & CACHE_KEY)
+ DataProvider.Instance().UpdateCustomField(objCustomField.CustomFieldID, objCustomField.ModuleID, objCustomField.Name, objCustomField.FieldType, objCustomField.FieldElements, objCustomField.DefaultValue, objCustomField.Caption, objCustomField.CaptionHelp, objCustomField.IsRequired, objCustomField.IsVisible, objCustomField.SortOrder, objCustomField.ValidationType, objCustomField.Length, objCustomField.RegularExpression)
+
+ End Sub
+
+#End Region
+
+ End Class
+
+End Namespace
diff --git a/Components/CustomFields/CustomFieldInfo.vb b/Components/CustomFields/CustomFieldInfo.vb
new file mode 100755
index 0000000..9d9e7c9
--- /dev/null
+++ b/Components/CustomFields/CustomFieldInfo.vb
@@ -0,0 +1,157 @@
+Namespace Ventrian.NewsArticles.Components.CustomFields
+
+ Public Class CustomFieldInfo
+
+#Region " Private Members "
+
+ Dim _customFieldID As Integer
+ Dim _moduleID As Integer
+ Dim _name As String
+ Dim _fieldType As CustomFieldType
+ Dim _fieldElements As String
+ Dim _defaultValue As String
+ Dim _caption As String
+ Dim _captionHelp As String
+ Dim _isRequired As Boolean
+ Dim _isVisible As Boolean
+ Dim _sortOrder As Integer
+ Dim _validationType As CustomFieldValidationType
+ Dim _regularExpression As String
+ Dim _length As Integer
+
+#End Region
+
+#Region " Public Properties "
+
+ Public Property CustomFieldID() As Integer
+ Get
+ Return _customFieldID
+ End Get
+ Set(ByVal Value As Integer)
+ _customFieldID = Value
+ End Set
+ End Property
+
+ Public Property ModuleID() As Integer
+ Get
+ Return _moduleID
+ End Get
+ Set(ByVal Value As Integer)
+ _moduleID = Value
+ End Set
+ End Property
+
+ Public Property Name() As String
+ Get
+ Return _name
+ End Get
+ Set(ByVal Value As String)
+ _name = Value
+ End Set
+ End Property
+
+ Public Property FieldElements() As String
+ Get
+ Return _fieldElements
+ End Get
+ Set(ByVal Value As String)
+ _fieldElements = Value
+ End Set
+ End Property
+
+ Public Property FieldType() As CustomFieldType
+ Get
+ Return _fieldType
+ End Get
+ Set(ByVal Value As CustomFieldType)
+ _fieldType = Value
+ End Set
+ End Property
+
+ Public Property DefaultValue() As String
+ Get
+ Return _defaultValue
+ End Get
+ Set(ByVal Value As String)
+ _defaultValue = Value
+ End Set
+ End Property
+
+ Public Property Caption() As String
+ Get
+ Return _caption
+ End Get
+ Set(ByVal Value As String)
+ _caption = Value
+ End Set
+ End Property
+
+ Public Property CaptionHelp() As String
+ Get
+ Return _captionHelp
+ End Get
+ Set(ByVal Value As String)
+ _captionHelp = Value
+ End Set
+ End Property
+
+ Public Property SortOrder() As Integer
+ Get
+ Return _sortOrder
+ End Get
+ Set(ByVal Value As Integer)
+ _sortOrder = Value
+ End Set
+ End Property
+
+ Public Property IsRequired() As Boolean
+ Get
+ Return _isRequired
+ End Get
+ Set(ByVal Value As Boolean)
+ _isRequired = Value
+ End Set
+ End Property
+
+ Public Property IsVisible() As Boolean
+ Get
+ Return _isVisible
+ End Get
+ Set(ByVal Value As Boolean)
+ _isVisible = Value
+ End Set
+ End Property
+
+ Public Property ValidationType() As CustomFieldValidationType
+ Get
+ Return _validationType
+ End Get
+ Set(ByVal Value As CustomFieldValidationType)
+ _validationType = Value
+ End Set
+ End Property
+
+ Public Property Length() As Integer
+ Get
+ Return _length
+ End Get
+ Set(ByVal Value As Integer)
+ _length = Value
+ End Set
+ End Property
+
+ Public Property RegularExpression() As String
+ Get
+ Return _regularExpression
+ End Get
+ Set(ByVal Value As String)
+ _regularExpression = Value
+ End Set
+ End Property
+
+#End Region
+
+ End Class
+
+End Namespace
+
diff --git a/Components/CustomFields/CustomFieldType.vb b/Components/CustomFields/CustomFieldType.vb
new file mode 100755
index 0000000..44d872a
--- /dev/null
+++ b/Components/CustomFields/CustomFieldType.vb
@@ -0,0 +1,16 @@
+Namespace Ventrian.NewsArticles.Components.CustomFields
+
+ Public Enum CustomFieldType
+
+ OneLineTextBox = 0
+ MultiLineTextBox = 1
+ RichTextBox = 2
+ DropDownList = 3
+ CheckBox = 4
+ MultiCheckBox = 5
+ RadioButton = 6
+ ColorPicker = 7
+
+ End Enum
+
+End Namespace
diff --git a/Components/CustomFields/CustomFieldValidationType.vb b/Components/CustomFields/CustomFieldValidationType.vb
new file mode 100755
index 0000000..bf0c64d
--- /dev/null
+++ b/Components/CustomFields/CustomFieldValidationType.vb
@@ -0,0 +1,15 @@
+Namespace Ventrian.NewsArticles.Components.CustomFields
+
+ Public Enum CustomFieldValidationType
+
+ [None] = 0
+ [Currency] = 1
+ [Date] = 2
+ [Double] = 3
+ [Integer] = 4
+ [Email] = 5
+ [Regex] = 6
+
+ End Enum
+
+End Namespace
diff --git a/Components/CustomFields/CustomValueController.vb b/Components/CustomFields/CustomValueController.vb
new file mode 100755
index 0000000..6303081
--- /dev/null
+++ b/Components/CustomFields/CustomValueController.vb
@@ -0,0 +1,69 @@
+Imports DotNetNuke.Common.Utilities
+
+Namespace Ventrian.NewsArticles.Components.CustomFields
+
+ Public Class CustomValueController
+
+#Region " Private Members "
+
+ Private Const CACHE_KEY As String = "-NewsArticles-CustomValues-All"
+
+#End Region
+
+#Region " Public Methods "
+
+ Public Function GetByCustomField(ByVal articleID As Integer, ByVal customFieldID As Integer) As CustomValueInfo
+
+ Dim objCustomValues As List(Of CustomValueInfo) = List(articleID)
+
+ For Each objCustomValue As CustomValueInfo In objCustomValues
+ If (objCustomValue.CustomFieldID = customFieldID) Then
+ Return objCustomValue
+ End If
+ Next
+
+ Return Nothing
+
+ End Function
+
+ Public Function List(ByVal articleID As Integer) As List(Of CustomValueInfo)
+
+ Dim key As String = articleID.ToString() & CACHE_KEY
+
+ Dim objCustomValues As List(Of CustomValueInfo) = CType(DataCache.GetCache(key), List(Of CustomValueInfo))
+
+ If (objCustomValues Is Nothing) Then
+ objCustomValues = CBO.FillCollection(Of CustomValueInfo)(DataProvider.Instance().GetCustomValueList(articleID))
+ DataCache.SetCache(key, objCustomValues)
+ End If
+
+ Return objCustomValues
+
+ End Function
+
+ Public Function Add(ByVal objCustomValue As CustomValueInfo) As Integer
+
+ DataCache.RemoveCache(objCustomValue.ArticleID.ToString() & CACHE_KEY)
+ Return CType(DataProvider.Instance().AddCustomValue(objCustomValue.ArticleID, objCustomValue.CustomFieldID, objCustomValue.CustomValue), Integer)
+
+ End Function
+
+ Public Sub Update(ByVal objCustomValue As CustomValueInfo)
+
+ DataCache.RemoveCache(objCustomValue.ArticleID.ToString() & CACHE_KEY)
+ DataProvider.Instance().UpdateCustomValue(objCustomValue.CustomValueID, objCustomValue.ArticleID, objCustomValue.CustomFieldID, objCustomValue.CustomValue)
+
+ End Sub
+
+ Public Sub Delete(ByVal articleID As Integer, ByVal customFieldID As Integer)
+
+ DataCache.RemoveCache(articleID.ToString() & CACHE_KEY)
+ DataProvider.Instance().DeleteCustomValue(articleID, customFieldID)
+
+ End Sub
+
+#End Region
+
+ End Class
+
+End Namespace
diff --git a/Components/CustomFields/CustomValueInfo.vb b/Components/CustomFields/CustomValueInfo.vb
new file mode 100755
index 0000000..7ea6352
--- /dev/null
+++ b/Components/CustomFields/CustomValueInfo.vb
@@ -0,0 +1,58 @@
+Namespace Ventrian.NewsArticles.Components.CustomFields
+
+ Public Class CustomValueInfo
+
+#Region " Private Members "
+
+ Dim _customValueID As Integer
+ Dim _articleID As Integer
+ Dim _customFieldID As Integer
+ Dim _customValue As String
+
+#End Region
+
+#Region " Public Properties "
+
+ Public Property CustomValueID() As Integer
+ Get
+ Return _customValueID
+ End Get
+ Set(ByVal Value As Integer)
+ _customValueID = Value
+ End Set
+ End Property
+
+ Public Property ArticleID() As Integer
+ Get
+ Return _articleID
+ End Get
+ Set(ByVal Value As Integer)
+ _articleID = Value
+ End Set
+ End Property
+
+ Public Property CustomFieldID() As Integer
+ Get
+ Return _customFieldID
+ End Get
+ Set(ByVal Value As Integer)
+ _customFieldID = Value
+ End Set
+ End Property
+
+ Public Property CustomValue() As String
+ Get
+ Return _customValue
+ End Get
+ Set(ByVal Value As String)
+ _customValue = Value
+ End Set
+ End Property
+
+#End Region
+
+ End Class
+
+End Namespace
+
+
diff --git a/Components/DisplayType.vb b/Components/DisplayType.vb
new file mode 100755
index 0000000..7c23590
--- /dev/null
+++ b/Components/DisplayType.vb
@@ -0,0 +1,24 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.Configuration
+Imports System.Data
+
+Imports DotNetNuke.Common.Utilities
+
+Namespace Ventrian.NewsArticles
+
+ Public Enum DisplayType
+
+ UserName
+ FirstName
+ LastName
+ FullName
+
+ End Enum
+
+End Namespace
diff --git a/Components/EmailTemplateController.vb b/Components/EmailTemplateController.vb
new file mode 100755
index 0000000..b5a7d9f
--- /dev/null
+++ b/Components/EmailTemplateController.vb
@@ -0,0 +1,402 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.Data
+
+Imports DotNetNuke.Common
+Imports DotNetNuke.Common.Utilities
+Imports Dotnetnuke.Entities.Portals
+Imports Dotnetnuke.Entities.Users
+Imports DotNetNuke.Framework
+Imports DotNetNuke.Security.Roles
+
+Namespace Ventrian.NewsArticles
+
+ Public Class EmailTemplateController
+
+#Region " Private Methods "
+
+ Public Function FormatArticleEmail(ByVal template As String, ByVal link As String, ByVal objArticle As ArticleInfo, ByVal articleSettings As ArticleSettings) As String
+
+ Dim formatted As String = template
+
+ formatted = formatted.Replace("[USERNAME]", objArticle.AuthorUserName)
+ formatted = formatted.Replace("[FIRSTNAME]", objArticle.AuthorFirstName)
+ formatted = formatted.Replace("[LASTNAME]", objArticle.AuthorLastName)
+ formatted = formatted.Replace("[FULLNAME]", objArticle.AuthorFullName)
+ formatted = formatted.Replace("[EMAIL]", objArticle.AuthorEmail)
+ formatted = formatted.Replace("[DISPLAYNAME]", objArticle.AuthorDisplayName)
+
+ Dim settings As PortalSettings = PortalController.GetCurrentPortalSettings()
+
+ formatted = formatted.Replace("[PORTALNAME]", settings.PortalName)
+ formatted = formatted.Replace("[CREATEDATE]", objArticle.CreatedDate.ToString("d") & " " & objArticle.CreatedDate.ToString("t"))
+ formatted = formatted.Replace("[POSTDATE]", objArticle.StartDate.ToString("d") & " " & objArticle.CreatedDate.ToString("t"))
+
+ formatted = formatted.Replace("[TITLE]", objArticle.Title)
+ formatted = formatted.Replace("[SUMMARY]", System.Web.HttpContext.Current.Server.HtmlDecode(objArticle.Summary))
+ formatted = formatted.Replace("[LINK]", link)
+
+ Return formatted
+
+ End Function
+
+ Public Function FormatCommentEmail(ByVal template As String, ByVal link As String, ByVal objArticle As ArticleInfo, ByVal objComment As CommentInfo, ByVal articleSettings As ArticleSettings) As String
+
+ Dim formatted As String = template
+
+ If (objComment.UserID = Null.NullInteger) Then
+ ' Anonymous Comment
+ formatted = formatted.Replace("[USERNAME]", objComment.AnonymousName)
+ formatted = formatted.Replace("[EMAIL]", objComment.AnonymousEmail)
+ formatted = formatted.Replace("[FIRSTNAME]", objComment.AnonymousName)
+ formatted = formatted.Replace("[LASTNAME]", objComment.AnonymousName)
+ formatted = formatted.Replace("[FULLNAME]", objComment.AnonymousName)
+ formatted = formatted.Replace("[DISPLAYNAME]", objComment.AnonymousName)
+ Else
+ ' Authenticated Comment
+ formatted = formatted.Replace("[USERNAME]", objComment.AuthorUserName)
+ formatted = formatted.Replace("[EMAIL]", objComment.AuthorEmail)
+ formatted = formatted.Replace("[FIRSTNAME]", objComment.AuthorFirstName)
+ formatted = formatted.Replace("[LASTNAME]", objComment.AuthorLastName)
+ formatted = formatted.Replace("[FULLNAME]", objComment.AuthorFirstName & " " & objComment.AuthorLastName)
+ formatted = formatted.Replace("[DISPLAYNAME]", objComment.AuthorDisplayName)
+ End If
+
+ Dim settings As PortalSettings = PortalController.GetCurrentPortalSettings()
+
+ formatted = formatted.Replace("[PORTALNAME]", settings.PortalName)
+ formatted = formatted.Replace("[POSTDATE]", DateTime.Now.ToShortDateString & " " & DateTime.Now.ToShortTimeString)
+
+ formatted = formatted.Replace("[TITLE]", objArticle.Title)
+ formatted = formatted.Replace("[COMMENT]", objComment.Comment.Replace(" ", vbCrLf))
+ formatted = formatted.Replace("[LINK]", link)
+ formatted = formatted.Replace("[APPROVELINK]", Common.GetModuleLink(settings.ActiveTab.TabID, objArticle.ModuleID, "ApproveComments", articleSettings))
+
+ Return formatted
+
+ End Function
+
+ Public Function GetApproverDistributionList(ByVal moduleID As Integer) As String
+
+ Dim settings As PortalSettings = PortalController.GetCurrentPortalSettings()
+ Dim moduleSettings As Hashtable = PortalSettings.GetModuleSettings(moduleID)
+ Dim distributionList As String = ""
+
+ If (moduleSettings.Contains(ArticleConstants.PERMISSION_APPROVAL_SETTING)) Then
+
+ Dim roles As String = moduleSettings(ArticleConstants.PERMISSION_APPROVAL_SETTING).ToString()
+ Dim rolesArray() As String = roles.Split(Convert.ToChar(";"))
+ Dim userList As Hashtable = New Hashtable
+
+ For Each role As String In rolesArray
+ If (role.Length > 0) Then
+ Dim objRoleController As RoleController = New RoleController
+ Dim objRole As RoleInfo = objRoleController.GetRoleByName(settings.PortalId, role)
+
+ If Not (objRole Is Nothing) Then
+ Dim objUsers As ArrayList = objRoleController.GetUserRolesByRoleName(settings.PortalId, objRole.RoleName)
+ For Each objUser As UserRoleInfo In objUsers
+ If (userList.Contains(objUser.UserID) = False) Then
+ Dim objUserController As UserController = New UserController
+ Dim objSelectedUser As UserInfo = objUserController.GetUser(settings.PortalId, objUser.UserID)
+ If Not (objSelectedUser Is Nothing) Then
+ If (objSelectedUser.Email.Length > 0) Then
+ userList.Add(objUser.UserID, objSelectedUser.Email)
+ End If
+ End If
+ End If
+ Next
+ End If
+ End If
+ Next
+
+ For Each email As DictionaryEntry In userList
+ If (distributionList.Length > 0) Then
+ distributionList += "; "
+ End If
+ distributionList += email.Value.ToString()
+ Next
+
+ End If
+
+ Return distributionList
+
+ End Function
+
+
+#End Region
+
+#Region " Public Methods "
+
+ Public Function [Get](ByVal templateID As Integer) As EmailTemplateInfo
+
+ Return CType(CBO.FillObject(DataProvider.Instance().GetEmailTemplate(templateID), GetType(EmailTemplateInfo)), EmailTemplateInfo)
+
+ End Function
+
+ Public Function [Get](ByVal moduleID As Integer, ByVal type As EmailTemplateType) As EmailTemplateInfo
+
+ Dim objEmailTemplate As EmailTemplateInfo = CType(CBO.FillObject(DataProvider.Instance().GetEmailTemplateByName(moduleID, type.ToString()), GetType(EmailTemplateInfo)), EmailTemplateInfo)
+
+ If (objEmailTemplate Is Nothing) Then
+
+ objEmailTemplate = New EmailTemplateInfo
+ objEmailTemplate.ModuleID = moduleID
+ objEmailTemplate.Name = type.ToString()
+
+ Select Case type
+
+ Case EmailTemplateType.ArticleApproved
+ objEmailTemplate.Subject = "[PORTALNAME]: Your Article Has Been Approved"
+ objEmailTemplate.Template = "" _
+ & "Your article titled [TITLE] has been approved." & vbCrLf & vbCrLf _
+ & "To visit the live article, please visit:" & vbCrLf _
+ & "[LINK]" & vbCrLf & vbCrLf _
+ & "Thank you," & vbCrLf _
+ & "[PORTALNAME]"
+ Exit Select
+
+ Case EmailTemplateType.ArticleSubmission
+ objEmailTemplate.Subject = "[PORTALNAME]: New Article Requires Approval"
+ objEmailTemplate.Template = "" _
+ & "At [POSTDATE] an article title [TITLE] has been submitted for approval." & vbCrLf & vbCrLf _
+ & "[SUMMARY]" & vbCrLf & vbCrLf _
+ & "To view the complete article and approve, please visit:" & vbCrLf _
+ & "[LINK]" & vbCrLf & vbCrLf _
+ & "Thank you," & vbCrLf _
+ & "[PORTALNAME]"
+ Exit Select
+
+ Case EmailTemplateType.ArticleUpdateMirrored
+ objEmailTemplate.Subject = "[PORTALNAME]: An article has been updated"
+ objEmailTemplate.Template = "" _
+ & "At [POSTDATE] an article you have mirrored '[TITLE]' was updated." & vbCrLf & vbCrLf _
+ & "To visit the mirrored article, please visit:" & vbCrLf _
+ & "[LINK]" & vbCrLf & vbCrLf _
+ & "Thank you," & vbCrLf _
+ & "[PORTALNAME]"
+ Exit Select
+
+ Case EmailTemplateType.CommentNotification
+ objEmailTemplate.Subject = "[PORTALNAME]: Comment Notification"
+ objEmailTemplate.Template = "" _
+ & "At [POSTDATE] a comment was posted to the article [TITLE]." & vbCrLf & vbCrLf _
+ & "[COMMENT]" & vbCrLf & vbCrLf _
+ & "To view the complete article and reply, please visit:" & vbCrLf _
+ & "[LINK]" & vbCrLf & vbCrLf _
+ & "Thank you," & vbCrLf _
+ & "[PORTALNAME]"
+ Exit Select
+
+ Case EmailTemplateType.CommentRequiringApproval
+ objEmailTemplate.Subject = "[PORTALNAME]: Comment requiring approval"
+ objEmailTemplate.Template = "" _
+ & "At [POSTDATE], a comment requiring approval was posted to your article [TITLE]." & vbCrLf & vbCrLf _
+ & "[COMMENT]" & vbCrLf & vbCrLf _
+ & "To approve this comment, please visit:" & vbCrLf _
+ & "[APPROVELINK]" & vbCrLf & vbCrLf _
+ & "Thank you," & vbCrLf _
+ & "[PORTALNAME]"
+ Exit Select
+
+ Case EmailTemplateType.CommentApproved
+ objEmailTemplate.Subject = "[PORTALNAME]: Your Comment Has Been Approved"
+ objEmailTemplate.Template = "" _
+ & "Your comment posted to [TITLE] has been approved." & vbCrLf & vbCrLf _
+ & "To visit the live article, please visit:" & vbCrLf _
+ & "[LINK]" & vbCrLf & vbCrLf _
+ & "Thank you," & vbCrLf _
+ & "[PORTALNAME]"
+ Exit Select
+
+ End Select
+
+ objEmailTemplate.TemplateID = Add(objEmailTemplate)
+
+ End If
+
+ Return objEmailTemplate
+
+ End Function
+
+ Public Function List(ByVal moduleID As Integer) As ArrayList
+
+ Return CBO.FillCollection(DataProvider.Instance().ListEmailTemplate(moduleID), GetType(EmailTemplateInfo))
+
+ End Function
+
+ Public Function Add(ByVal objEmailTemplate As EmailTemplateInfo) As Integer
+
+ Return CType(DataProvider.Instance().AddEmailTemplate(objEmailTemplate.ModuleID, objEmailTemplate.Name, objEmailTemplate.Subject, objEmailTemplate.Template), Integer)
+
+ End Function
+
+ Public Sub Update(ByVal objEmailTemplate As EmailTemplateInfo)
+
+ DataProvider.Instance().UpdateEmailTemplate(objEmailTemplate.TemplateID, objEmailTemplate.ModuleID, objEmailTemplate.Name, objEmailTemplate.Subject, objEmailTemplate.Template)
+
+ End Sub
+
+ Public Sub Delete(ByVal templateID As Integer)
+
+ DataProvider.Instance().DeleteEmailTemplate(templateID)
+
+ End Sub
+
+ Public Sub SendFormattedEmail(ByVal moduleID As Integer, ByVal link As String, ByVal objArticle As ArticleInfo, ByVal type As EmailTemplateType, ByVal sendTo As String, ByVal articleSettings As ArticleSettings)
+
+ Dim settings As PortalSettings = PortalController.GetCurrentPortalSettings()
+
+ Dim subject As String = ""
+ Dim template As String = ""
+
+ Select Case type
+
+ Case EmailTemplateType.ArticleSubmission
+ Dim objTemplate As EmailTemplateInfo = Me.Get(moduleID, EmailTemplateType.ArticleSubmission)
+ subject = objTemplate.Subject
+ template = objTemplate.Template
+
+ Exit Select
+
+ Case EmailTemplateType.ArticleApproved
+ Dim objTemplate As EmailTemplateInfo = Me.Get(moduleID, EmailTemplateType.ArticleApproved)
+ subject = objTemplate.Subject
+ template = objTemplate.Template
+
+ Exit Select
+
+ Case EmailTemplateType.ArticleUpdateMirrored
+ Dim objTemplate As EmailTemplateInfo = Me.Get(moduleID, EmailTemplateType.ArticleUpdateMirrored)
+ subject = objTemplate.Subject
+ template = objTemplate.Template
+
+ Exit Select
+
+ Case Else
+ Exit Sub
+
+ End Select
+
+ subject = FormatArticleEmail(subject, link, objArticle, articleSettings)
+ template = FormatArticleEmail(template, link, objArticle, articleSettings)
+
+ ' SendNotification(settings.Email, sendTo, Null.NullString, subject, template)
+ Try
+ DotNetNuke.Services.Mail.Mail.SendMail(settings.Email, sendTo, "", subject, template, "", "", "", "", "", "")
+ Catch
+ End Try
+
+ End Sub
+
+ Public Sub SendFormattedEmail(ByVal moduleID As Integer, ByVal link As String, ByVal objArticle As ArticleInfo, ByVal objComment As CommentInfo, ByVal type As EmailTemplateType, ByVal articleSettings As ArticleSettings)
+
+ Dim settings As PortalSettings = PortalController.GetCurrentPortalSettings()
+
+ Dim sendTo As String = ""
+
+ Select Case type
+
+ Case EmailTemplateType.CommentNotification
+
+ Dim objUserController As New UserController
+ Dim objUser As UserInfo = objUserController.GetUser(settings.PortalId, objArticle.AuthorID)
+
+ If Not (objUser Is Nothing) Then
+ sendTo = objUser.Membership.Email
+ SendFormattedEmail(moduleID, link, objArticle, objComment, EmailTemplateType.CommentNotification, articleSettings, sendTo)
+ End If
+
+ Exit Select
+
+ Case EmailTemplateType.CommentApproved
+
+ If (objComment.UserID <> Null.NullInteger) Then
+ Dim objUserController As New UserController
+ Dim objUser As UserInfo = objUserController.GetUser(settings.PortalId, objComment.UserID)
+
+ If Not (objUser Is Nothing) Then
+ sendTo = objUser.Membership.Email
+ SendFormattedEmail(moduleID, link, objArticle, objComment, EmailTemplateType.CommentApproved, articleSettings, sendTo)
+ End If
+ Else
+ SendFormattedEmail(moduleID, link, objArticle, objComment, EmailTemplateType.CommentApproved, articleSettings, objComment.AnonymousEmail)
+ End If
+
+ Exit Select
+
+ Case EmailTemplateType.CommentRequiringApproval
+
+ Dim objUserController As New UserController
+ Dim objUser As UserInfo = objUserController.GetUser(settings.PortalId, objArticle.AuthorID)
+
+ If Not (objUser Is Nothing) Then
+ sendTo = objUser.Membership.Email
+ SendFormattedEmail(moduleID, link, objArticle, objComment, EmailTemplateType.CommentRequiringApproval, articleSettings, sendTo)
+ End If
+
+ Exit Select
+
+ Case Else
+ Exit Sub
+
+ End Select
+
+ End Sub
+
+ Public Sub SendFormattedEmail(ByVal moduleID As Integer, ByVal link As String, ByVal objArticle As ArticleInfo, ByVal objComment As CommentInfo, ByVal type As EmailTemplateType, ByVal articleSettings As ArticleSettings, ByVal email As String)
+
+ Dim settings As PortalSettings = PortalController.GetCurrentPortalSettings()
+
+ Dim subject As String = ""
+ Dim template As String = ""
+ Dim sendTo As String = email
+
+ Select Case type
+
+ Case EmailTemplateType.CommentNotification
+ Dim objTemplate As EmailTemplateInfo = Me.Get(moduleID, EmailTemplateType.CommentNotification)
+ subject = objTemplate.Subject
+ template = objTemplate.Template
+
+ Exit Select
+
+ Case EmailTemplateType.CommentApproved
+ Dim objTemplate As EmailTemplateInfo = Me.Get(moduleID, EmailTemplateType.CommentApproved)
+ subject = objTemplate.Subject
+ template = objTemplate.Template
+
+ Exit Select
+
+ Case EmailTemplateType.CommentRequiringApproval
+ Dim objTemplate As EmailTemplateInfo = Me.Get(moduleID, EmailTemplateType.CommentRequiringApproval)
+ subject = objTemplate.Subject
+ template = objTemplate.Template
+
+ Exit Select
+
+ Case Else
+ Exit Sub
+
+ End Select
+
+ subject = FormatCommentEmail(subject, link, objArticle, objComment, articleSettings)
+ template = FormatCommentEmail(template, link, objArticle, objComment, articleSettings)
+
+ Try
+ DotNetNuke.Services.Mail.Mail.SendMail(settings.Email, sendTo, "", subject, template, "", "", "", "", "", "")
+ Catch
+ End Try
+
+ End Sub
+
+#End Region
+
+ End Class
+
+End Namespace
diff --git a/Components/EmailTemplateInfo.vb b/Components/EmailTemplateInfo.vb
new file mode 100755
index 0000000..bb8c569
--- /dev/null
+++ b/Components/EmailTemplateInfo.vb
@@ -0,0 +1,81 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Namespace Ventrian.NewsArticles
+
+ Public Class EmailTemplateInfo
+
+#Region "Private Members"
+ Dim _templateID As Integer
+ Dim _moduleID As Integer
+ Dim _name As String
+ Dim _subject As String
+ Dim _template As String
+#End Region
+
+#Region "Constructors"
+ Public Sub New()
+ End Sub
+
+ Public Sub New(ByVal templateID As Integer, ByVal moduleID As Integer, ByVal name As String, ByVal subject As String, ByVal template As String)
+ Me.TemplateID = templateID
+ Me.ModuleID = moduleID
+ Me.Name = name
+ Me.Subject = subject
+ Me.Template = template
+ End Sub
+#End Region
+
+#Region "Public Properties"
+ Public Property TemplateID() As Integer
+ Get
+ Return _templateID
+ End Get
+ Set(ByVal Value As Integer)
+ _templateID = Value
+ End Set
+ End Property
+
+ Public Property ModuleID() As Integer
+ Get
+ Return _moduleID
+ End Get
+ Set(ByVal Value As Integer)
+ _moduleID = Value
+ End Set
+ End Property
+
+ Public Property Name() As String
+ Get
+ Return _name
+ End Get
+ Set(ByVal Value As String)
+ _name = Value
+ End Set
+ End Property
+
+ Public Property Subject() As String
+ Get
+ Return _subject
+ End Get
+ Set(ByVal Value As String)
+ _subject = Value
+ End Set
+ End Property
+
+ Public Property Template() As String
+ Get
+ Return _template
+ End Get
+ Set(ByVal Value As String)
+ _template = Value
+ End Set
+ End Property
+#End Region
+
+ End Class
+
+End Namespace
diff --git a/Components/EmailTemplateType.vb b/Components/EmailTemplateType.vb
new file mode 100755
index 0000000..54476e1
--- /dev/null
+++ b/Components/EmailTemplateType.vb
@@ -0,0 +1,26 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.Configuration
+Imports System.Data
+
+Imports DotNetNuke.Common.Utilities
+
+Namespace Ventrian.NewsArticles
+
+ Public Enum EmailTemplateType
+
+ ArticleSubmission
+ ArticleApproved
+ ArticleUpdateMirrored
+ CommentNotification
+ CommentRequiringApproval
+ CommentApproved
+
+ End Enum
+
+End Namespace
diff --git a/Components/ExpiryType.vb b/Components/ExpiryType.vb
new file mode 100755
index 0000000..3febcca
--- /dev/null
+++ b/Components/ExpiryType.vb
@@ -0,0 +1,22 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.Configuration
+Imports System.Data
+
+Imports DotNetNuke.Common.Utilities
+
+Namespace Ventrian.NewsArticles
+
+ Public Enum ExpiryType
+
+ HideAll = 0
+ HidePartial = 1
+
+ End Enum
+
+End Namespace
diff --git a/Components/GroupByType.vb b/Components/GroupByType.vb
new file mode 100755
index 0000000..1ab4d7d
--- /dev/null
+++ b/Components/GroupByType.vb
@@ -0,0 +1,16 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Namespace Ventrian.NewsArticles
+
+ Public Enum GroupByType
+
+ Month
+ Year
+
+ End Enum
+
+End Namespace
diff --git a/Components/Handout/HandoutArticle.vb b/Components/Handout/HandoutArticle.vb
new file mode 100755
index 0000000..3dc31f7
--- /dev/null
+++ b/Components/Handout/HandoutArticle.vb
@@ -0,0 +1,57 @@
+Namespace Ventrian.NewsArticles
+
+ _
+ Public Class HandoutArticle
+
+#Region " Private Members "
+
+ Private _articleID As Integer
+ Private _title As String
+ Private _summary As String
+ Private _sortOrder As Integer
+
+#End Region
+
+#Region " Public Properties "
+
+ Public Property ArticleID() As Integer
+ Get
+ Return _articleID
+ End Get
+ Set(ByVal value As Integer)
+ _articleID = value
+ End Set
+ End Property
+
+ Public Property Title() As String
+ Get
+ Return _title
+ End Get
+ Set(ByVal value As String)
+ _title = value
+ End Set
+ End Property
+
+ Public Property Summary() As String
+ Get
+ Return _summary
+ End Get
+ Set(ByVal value As String)
+ _summary = value
+ End Set
+ End Property
+
+ Public Property SortOrder() As Integer
+ Get
+ Return _sortOrder
+ End Get
+ Set(ByVal value As Integer)
+ _sortOrder = value
+ End Set
+ End Property
+
+#End Region
+
+ End Class
+
+End Namespace
diff --git a/Components/Handout/HandoutController.vb b/Components/Handout/HandoutController.vb
new file mode 100755
index 0000000..6586525
--- /dev/null
+++ b/Components/Handout/HandoutController.vb
@@ -0,0 +1,62 @@
+Imports DotNetNuke.Common.Utilities
+
+Namespace Ventrian.NewsArticles
+
+ Public Class HandoutController
+
+#Region " Public Methods "
+
+ Public Function AddHandout(ByVal objHandout As HandoutInfo) As Integer
+
+ Dim handoutID As Integer = CType(DataProvider.Instance().AddHandout(objHandout.ModuleID, objHandout.UserID, objHandout.Name, objHandout.Description), Integer)
+
+ Dim i As Integer = 0
+ For Each objHandoutArticle As HandoutArticle In objHandout.Articles
+ DataProvider.Instance().AddHandoutArticle(handoutID, objHandoutArticle.ArticleID, i)
+ i = i + 1
+ Next
+
+ End Function
+
+ Public Sub DeleteHandout(ByVal handoutID As Integer)
+
+ DataProvider.Instance().DeleteHandout(handoutID)
+ DataProvider.Instance().DeleteHandoutArticleList(handoutID)
+
+ End Sub
+
+ Public Function GetHandout(ByVal handoutID As Integer) As HandoutInfo
+
+ Dim objHandout As HandoutInfo = CType(CBO.FillObject(DataProvider.Instance().GetHandout(handoutID), GetType(HandoutInfo)), HandoutInfo)
+
+ objHandout.Articles = CBO.FillCollection(Of HandoutArticle)(DataProvider.Instance().GetHandoutArticleList(handoutID))
+
+ Return objHandout
+
+ End Function
+
+ Public Function ListHandout(ByVal userID As Integer) As List(Of HandoutInfo)
+
+ Return CBO.FillCollection(Of HandoutInfo)(DataProvider.Instance().GetHandoutList(userID))
+
+ End Function
+
+ Public Sub UpdateHandout(ByVal objHandout As HandoutInfo)
+
+ DataProvider.Instance().UpdateHandout(objHandout.HandoutID, objHandout.ModuleID, objHandout.UserID, objHandout.Name, objHandout.Description)
+ DataProvider.Instance().DeleteHandoutArticleList(objHandout.HandoutID)
+
+ Dim i As Integer = 0
+ For Each objHandoutArticle As HandoutArticle In objHandout.Articles
+ DataProvider.Instance().AddHandoutArticle(objHandout.HandoutID, objHandoutArticle.ArticleID, i)
+ i = i + 1
+ Next
+
+ End Sub
+
+#End Region
+
+ End Class
+
+End Namespace
+
diff --git a/Components/Handout/HandoutFilterType.vb b/Components/Handout/HandoutFilterType.vb
new file mode 100755
index 0000000..6a7c26a
--- /dev/null
+++ b/Components/Handout/HandoutFilterType.vb
@@ -0,0 +1,16 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Namespace Ventrian.NewsArticles
+
+ Public Enum HandoutFilterType
+
+ All = 0
+ Selected = 1
+
+ End Enum
+
+End Namespace
diff --git a/Components/Handout/HandoutInfo.vb b/Components/Handout/HandoutInfo.vb
new file mode 100755
index 0000000..ea49226
--- /dev/null
+++ b/Components/Handout/HandoutInfo.vb
@@ -0,0 +1,80 @@
+Imports DotNetNuke.Common.Utilities
+
+Namespace Ventrian.NewsArticles
+
+ Public Class HandoutInfo
+
+#Region " Private Members "
+
+ Private _handoutID As Integer = Null.NullInteger
+ Private _moduleID As Integer = Null.NullInteger
+ Private _userID As Integer = Null.NullInteger
+ Private _name As String = Null.NullString
+ Private _description As String = Null.NullString
+
+ Private _articles As List(Of HandoutArticle)
+
+#End Region
+
+#Region " Public Properties "
+
+ Public Property HandoutID() As Integer
+ Get
+ Return _handoutID
+ End Get
+ Set(ByVal value As Integer)
+ _handoutID = value
+ End Set
+ End Property
+
+ Public Property ModuleID() As Integer
+ Get
+ Return _moduleID
+ End Get
+ Set(ByVal value As Integer)
+ _moduleID = value
+ End Set
+ End Property
+
+ Public Property UserID() As Integer
+ Get
+ Return _userID
+ End Get
+ Set(ByVal value As Integer)
+ _userID = value
+ End Set
+ End Property
+
+ Public Property Name() As String
+ Get
+ Return _name
+ End Get
+ Set(ByVal value As String)
+ _name = value
+ End Set
+ End Property
+
+ Public Property Description() As String
+ Get
+ Return _description
+ End Get
+ Set(ByVal value As String)
+ _description = value
+ End Set
+ End Property
+
+ Public Property Articles() As List(Of HandoutArticle)
+ Get
+ Return _articles
+ End Get
+ Set(ByVal value As List(Of HandoutArticle))
+ _articles = value
+ End Set
+ End Property
+
+#End Region
+
+ End Class
+
+End Namespace
+
diff --git a/Components/Handout/HandoutType.vb b/Components/Handout/HandoutType.vb
new file mode 100755
index 0000000..624341f
--- /dev/null
+++ b/Components/Handout/HandoutType.vb
@@ -0,0 +1,17 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Namespace Ventrian.NewsArticles
+
+ Public Enum HandoutOptionType
+
+ None = 0
+ Template = 1
+ Text = 2
+
+ End Enum
+
+End Namespace
diff --git a/Components/ImageController.vb b/Components/ImageController.vb
new file mode 100755
index 0000000..f951782
--- /dev/null
+++ b/Components/ImageController.vb
@@ -0,0 +1,57 @@
+Imports DotNetNuke.Common.Utilities
+
+Namespace Ventrian.NewsArticles
+
+ Public Class ImageController
+
+#Region " Public Methods "
+
+ Public Function [Get](ByVal imageID As Integer) As ImageInfo
+
+ Return CType(CBO.FillObject(DataProvider.Instance().GetImage(imageID), GetType(ImageInfo)), ImageInfo)
+
+ End Function
+
+ Public Function GetImageList(ByVal articleID As Integer, ByVal imageGuid As String) As List(Of ImageInfo)
+
+ Dim objImages As List(Of ImageInfo) = CType(DataCache.GetCache(ArticleConstants.CACHE_IMAGE_ARTICLE & articleID.ToString()), List(Of ImageInfo))
+
+ If (objImages Is Nothing) Then
+ objImages = CBO.FillCollection(Of ImageInfo)(DataProvider.Instance().GetImageList(articleID, imageGuid))
+ DataCache.SetCache(ArticleConstants.CACHE_IMAGE_ARTICLE & articleID.ToString() & imageGuid, objImages)
+ End If
+ Return objImages
+
+ End Function
+
+ Public Function Add(ByVal objImage As ImageInfo) As Integer
+
+ DataCache.RemoveCache(ArticleConstants.CACHE_IMAGE_ARTICLE & objImage.ArticleID.ToString() & objImage.ImageGuid)
+ Dim imageID As Integer = CType(DataProvider.Instance().AddImage(objImage.ArticleID, objImage.Title, objImage.FileName, objImage.Extension, objImage.Size, objImage.Width, objImage.Height, objImage.ContentType, objImage.Folder, objImage.SortOrder, objImage.ImageGuid, objImage.Description), Integer)
+ ArticleController.ClearArticleCache(objImage.ArticleID)
+ Return imageID
+
+ End Function
+
+ Public Sub Update(ByVal objImage As ImageInfo)
+
+ DataProvider.Instance().UpdateImage(objImage.ImageID, objImage.ArticleID, objImage.Title, objImage.FileName, objImage.Extension, objImage.Size, objImage.Width, objImage.Height, objImage.ContentType, objImage.Folder, objImage.SortOrder, objImage.ImageGuid, objImage.Description)
+ DataCache.RemoveCache(ArticleConstants.CACHE_IMAGE_ARTICLE & objImage.ArticleID.ToString() & objImage.ImageGuid)
+ DataCache.RemoveCache(ArticleConstants.CACHE_IMAGE_ARTICLE & objImage.ArticleID.ToString())
+ ArticleController.ClearArticleCache(objImage.ArticleID)
+
+ End Sub
+
+ Public Sub Delete(ByVal imageID As Integer, ByVal articleID As Integer, ByVal imageGuid As String)
+
+ DataProvider.Instance().DeleteImage(imageID)
+ DataCache.RemoveCache(ArticleConstants.CACHE_IMAGE_ARTICLE & articleID.ToString() & imageGuid)
+ ArticleController.ClearArticleCache(articleID)
+
+ End Sub
+
+#End Region
+
+ End Class
+
+End Namespace
diff --git a/Components/ImageInfo.vb b/Components/ImageInfo.vb
new file mode 100755
index 0000000..3210643
--- /dev/null
+++ b/Components/ImageInfo.vb
@@ -0,0 +1,153 @@
+Namespace Ventrian.NewsArticles
+
+ Public Class ImageInfo
+ Implements ICloneable
+
+#Region " Private Members "
+
+ Dim _imageID As Integer
+ Dim _articleID As Integer
+
+ Dim _title As String
+
+ Dim _fileName As String
+ Dim _extension As String
+ Dim _size As Integer
+ Dim _width As Integer
+ Dim _height As Integer
+ Dim _contentType As String
+ Dim _folder As String
+ Dim _sortOrder As Integer
+ Dim _imageGuid As String
+ Dim _description As String
+
+#End Region
+
+#Region " Public Properties "
+
+ Public Property ImageID() As Integer
+ Get
+ Return _imageID
+ End Get
+ Set(ByVal value As Integer)
+ _imageID = value
+ End Set
+ End Property
+
+ Public Property ArticleID() As Integer
+ Get
+ Return _articleID
+ End Get
+ Set(ByVal value As Integer)
+ _articleID = value
+ End Set
+ End Property
+
+ Public Property Title() As String
+ Get
+ Return _title
+ End Get
+ Set(ByVal value As String)
+ _title = value
+ End Set
+ End Property
+
+ Public Property FileName() As String
+ Get
+ Return _fileName
+ End Get
+ Set(ByVal value As String)
+ _fileName = value
+ End Set
+ End Property
+
+ Public Property Extension() As String
+ Get
+ Return _extension
+ End Get
+ Set(ByVal value As String)
+ _extension = value
+ End Set
+ End Property
+
+ Public Property Size() As Integer
+ Get
+ Return _size
+ End Get
+ Set(ByVal value As Integer)
+ _size = value
+ End Set
+ End Property
+
+ Public Property Width() As Integer
+ Get
+ Return _width
+ End Get
+ Set(ByVal value As Integer)
+ _width = value
+ End Set
+ End Property
+
+ Public Property Height() As Integer
+ Get
+ Return _height
+ End Get
+ Set(ByVal value As Integer)
+ _height = value
+ End Set
+ End Property
+
+ Public Property ContentType() As String
+ Get
+ Return _contentType
+ End Get
+ Set(ByVal value As String)
+ _contentType = value
+ End Set
+ End Property
+
+ Public Property Folder() As String
+ Get
+ Return _folder
+ End Get
+ Set(ByVal value As String)
+ _folder = value
+ End Set
+ End Property
+
+ Public Property SortOrder() As Integer
+ Get
+ Return _sortOrder
+ End Get
+ Set(ByVal value As Integer)
+ _sortOrder = value
+ End Set
+ End Property
+
+ Public Property ImageGuid() As String
+ Get
+ Return _imageGuid
+ End Get
+ Set(ByVal value As String)
+ _imageGuid = value
+ End Set
+ End Property
+
+ Public Property Description() As String
+ Get
+ Return _description
+ End Get
+ Set(ByVal value As String)
+ _description = value
+ End Set
+ End Property
+
+#End Region
+
+ Public Function Clone() As Object Implements System.ICloneable.Clone
+ Return Me.MemberwiseClone
+ End Function
+
+ End Class
+
+End Namespace
diff --git a/Components/Import/FeedController.vb b/Components/Import/FeedController.vb
new file mode 100755
index 0000000..52529c5
--- /dev/null
+++ b/Components/Import/FeedController.vb
@@ -0,0 +1,72 @@
+Imports DotNetNuke.Common.Utilities
+
+Namespace Ventrian.NewsArticles.Import
+
+ Public Class FeedController
+
+#Region " Public Methods "
+
+ Public Function [Get](ByVal feedID As Integer) As FeedInfo
+
+ Return CType(CBO.FillObject(DataProvider.Instance().GetFeed(feedID), GetType(FeedInfo)), FeedInfo)
+
+ End Function
+
+ Public Function GetFeedList(ByVal moduleID As Integer, ByVal showActiveOnly As Boolean) As List(Of FeedInfo)
+
+ Return CBO.FillCollection(Of FeedInfo)(DataProvider.Instance().GetFeedList(moduleID, showActiveOnly))
+
+ End Function
+
+ Public Function Add(ByVal objFeed As FeedInfo) As Integer
+
+ Dim feedID As Integer = CType(DataProvider.Instance().AddFeed(objFeed.ModuleID, objFeed.Title, objFeed.Url, objFeed.UserID, objFeed.AutoFeature, objFeed.IsActive, objFeed.DateMode, objFeed.AutoExpire, objFeed.AutoExpireUnit), Integer)
+
+ For Each objCategory As CategoryInfo In objFeed.Categories
+ AddFeedCategory(feedID, objCategory.CategoryID)
+ Next
+
+ Return feedID
+
+ End Function
+
+ Public Sub Update(ByVal objFeed As FeedInfo)
+
+ DataProvider.Instance().UpdateFeed(objFeed.FeedID, objFeed.ModuleID, objFeed.Title, objFeed.Url, objFeed.UserID, objFeed.AutoFeature, objFeed.IsActive, objFeed.DateMode, objFeed.AutoExpire, objFeed.AutoExpireUnit)
+
+ DeleteFeedCategory(objFeed.FeedID)
+ For Each objCategory As CategoryInfo In objFeed.Categories
+ AddFeedCategory(objFeed.FeedID, objCategory.CategoryID)
+ Next
+
+ End Sub
+
+ Public Sub Delete(ByVal feedID As Integer)
+
+ DataProvider.Instance().DeleteFeed(feedID)
+
+ End Sub
+
+ Public Function AddFeedCategory(ByVal feedID As Integer, ByVal categoryID As Integer) As Integer
+
+ DataProvider.Instance().AddFeedCategory(feedID, categoryID)
+
+ End Function
+
+ Public Function GetFeedCategoryList(ByVal feedID As Integer) As List(Of CategoryInfo)
+
+ Return CBO.FillCollection(Of CategoryInfo)(DataProvider.Instance().GetFeedCategoryList(feedID))
+
+ End Function
+
+ Public Sub DeleteFeedCategory(ByVal feedID As Integer)
+
+ DataProvider.Instance().DeleteFeedCategory(feedID)
+
+ End Sub
+
+#End Region
+
+ End Class
+
+End Namespace
diff --git a/Components/Import/FeedDateMode.vb b/Components/Import/FeedDateMode.vb
new file mode 100755
index 0000000..ee102d6
--- /dev/null
+++ b/Components/Import/FeedDateMode.vb
@@ -0,0 +1,22 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2010
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.Configuration
+Imports System.Data
+
+Imports DotNetNuke.Common.Utilities
+
+Namespace Ventrian.NewsArticles.Import
+
+ Public Enum FeedDateMode
+
+ ImportDate = 0
+ FeedDate = 1
+
+ End Enum
+
+End Namespace
diff --git a/Components/Import/FeedExpiryType.vb b/Components/Import/FeedExpiryType.vb
new file mode 100755
index 0000000..ab62fce
--- /dev/null
+++ b/Components/Import/FeedExpiryType.vb
@@ -0,0 +1,14 @@
+Namespace Ventrian.NewsArticles.Import
+
+ Public Enum FeedExpiryType
+
+ None = -1
+ Minute = 0
+ Hour = 1
+ Day = 2
+ Month = 3
+ Year = 4
+
+ End Enum
+
+End Namespace
diff --git a/Components/Import/FeedInfo.vb b/Components/Import/FeedInfo.vb
new file mode 100755
index 0000000..3039b9d
--- /dev/null
+++ b/Components/Import/FeedInfo.vb
@@ -0,0 +1,138 @@
+Imports DotNetNuke.Common.Utilities
+
+Namespace Ventrian.NewsArticles.Import
+
+ Public Class FeedInfo
+
+#Region " Private Members "
+
+ Dim _feedID As Integer = Null.NullInteger
+ Dim _moduleID As Integer
+ Dim _title As String
+ Dim _url As String
+ Dim _userID As Integer
+ Dim _autoFeature As Boolean
+ Dim _isActive As Boolean
+ Dim _dateMode As FeedDateMode
+
+ Dim _autoExpire As Integer
+ Dim _autoExpireUnit As FeedExpiryType
+
+ Dim _categories As List(Of CategoryInfo)
+
+#End Region
+
+#Region " Private Properties "
+
+ Public Property FeedID() As Integer
+ Get
+ Return _feedID
+ End Get
+ Set(ByVal Value As Integer)
+ _feedID = Value
+ End Set
+ End Property
+
+ Public Property ModuleID() As Integer
+ Get
+ Return _moduleID
+ End Get
+ Set(ByVal Value As Integer)
+ _moduleID = Value
+ End Set
+ End Property
+
+ Public Property Title() As String
+ Get
+ Return _title
+ End Get
+ Set(ByVal Value As String)
+ _title = Value
+ End Set
+ End Property
+
+ Public Property Url() As String
+ Get
+ Return _url
+ End Get
+ Set(ByVal Value As String)
+ _url = Value
+ End Set
+ End Property
+
+ Public Property UserID() As Integer
+ Get
+ Return _userID
+ End Get
+ Set(ByVal Value As Integer)
+ _userID = Value
+ End Set
+ End Property
+
+ Public Property AutoFeature() As Boolean
+ Get
+ Return _autoFeature
+ End Get
+ Set(ByVal Value As Boolean)
+ _autoFeature = Value
+ End Set
+ End Property
+
+ Public Property IsActive() As Boolean
+ Get
+ Return _isActive
+ End Get
+ Set(ByVal Value As Boolean)
+ _isActive = Value
+ End Set
+ End Property
+
+ Public Property DateMode() As FeedDateMode
+ Get
+ Return _dateMode
+ End Get
+ Set(ByVal Value As FeedDateMode)
+ _dateMode = Value
+ End Set
+ End Property
+
+ Public Property AutoExpire() As Integer
+ Get
+ Return _autoExpire
+ End Get
+ Set(ByVal Value As Integer)
+ _autoExpire = Value
+ End Set
+ End Property
+
+ Public Property AutoExpireUnit() As FeedExpiryType
+ Get
+ Return _autoExpireUnit
+ End Get
+ Set(ByVal Value As FeedExpiryType)
+ _autoExpireUnit = Value
+ End Set
+ End Property
+
+ Public Property Categories() As List(Of CategoryInfo)
+ Get
+ If (_categories Is Nothing) Then
+ If (_feedID = Null.NullInteger) Then
+ _categories = New List(Of CategoryInfo)
+ Else
+ Dim objFeedController As New FeedController
+ _categories = objFeedController.GetFeedCategoryList(_feedID)
+ End If
+ End If
+ Return _categories
+ End Get
+ Set(ByVal Value As List(Of CategoryInfo))
+ _categories = Value
+ End Set
+ End Property
+
+#End Region
+
+ End Class
+
+End Namespace
diff --git a/Components/Import/RssImportJob.vb b/Components/Import/RssImportJob.vb
new file mode 100755
index 0000000..67552b0
--- /dev/null
+++ b/Components/Import/RssImportJob.vb
@@ -0,0 +1,437 @@
+Imports System.Xml.XPath
+
+Imports DotNetNuke.Common.Utilities
+Imports DotNetNuke.Services.Exceptions
+Imports DotNetNuke.Services.Scheduling
+Imports System.Xml
+Imports DotNetNuke.Entities.Modules
+Imports DotNetNuke.Entities.Portals
+
+Namespace Ventrian.NewsArticles.Import
+
+ Public Class RssImportJob
+ Inherits SchedulerClient
+
+#Region " Private Methods "
+
+ Private Sub ImportFeed(ByVal objFeed As FeedInfo)
+
+ Dim doc As XPathDocument
+ Dim navigator As XPathNavigator
+ Dim nodes As XPathNodeIterator
+ Dim node As XPathNavigator
+
+ ' Create a new XmlDocument
+ doc = New XPathDocument(objFeed.Url)
+
+ ' Create navigator
+ navigator = doc.CreateNavigator()
+
+ Dim mngr As New XmlNamespaceManager(navigator.NameTable)
+ mngr.AddNamespace("content", "http://purl.org/rss/1.0/modules/content/")
+
+ ' Get forecast with XPath
+ nodes = navigator.Select("/rss/channel/item")
+
+ If (nodes.Count = 0) Then
+ ImportFeedRDF(objFeed)
+ End If
+
+ Dim publishedDate As DateTime = DateTime.Now
+
+ While nodes.MoveNext()
+ node = nodes.Current
+
+ Dim nodeTitle As XPathNavigator
+ Dim nodeDescription As XPathNavigator
+ Dim nodeLink As XPathNavigator
+ Dim nodeDate As XPathNavigator
+ Dim nodeGuid As XPathNavigator
+ Dim nodeEncoded As XPathNavigator
+
+ nodeTitle = node.SelectSingleNode("title")
+ nodeDescription = node.SelectSingleNode("description")
+ nodeLink = node.SelectSingleNode("link")
+ nodeDate = node.SelectSingleNode("pubDate")
+ nodeGuid = node.SelectSingleNode("guid")
+ nodeEncoded = node.SelectSingleNode("content:encoded", mngr)
+
+ Dim summary As String = ""
+ If (nodeDescription IsNot Nothing) Then
+ summary = nodeDescription.Value
+ End If
+
+ Dim pageDetail As String = ""
+ If (nodeEncoded IsNot Nothing) Then
+ pageDetail = nodeEncoded.Value
+ Else
+ If (nodeDescription IsNot Nothing) Then
+ pageDetail = nodeDescription.Value
+ End If
+ End If
+
+ Dim guid As String = ""
+ If (nodeGuid IsNot Nothing) Then
+ guid = nodeGuid.Value
+ Else
+ guid = nodeLink.Value
+ End If
+
+ Dim objArticleController As New ArticleController()
+ Dim objArticles As List(Of ArticleInfo) = objArticleController.GetArticleList(objFeed.ModuleID, DateTime.Now, Null.NullDate, Nothing, False, Nothing, 25, 1, 25, ArticleConstants.DEFAULT_SORT_BY, ArticleConstants.DEFAULT_SORT_DIRECTION, True, False, Null.NullString, Null.NullInteger, True, True, False, False, False, False, Null.NullString, Nothing, False, guid, Null.NullInteger, Null.NullString, Null.NullString, Nothing)
+
+ If (objArticles.Count = 0) Then
+
+ Dim objArticle As New ArticleInfo
+
+ objArticle.AuthorID = objFeed.UserID
+ objArticle.CreatedDate = DateTime.Now
+ objArticle.Status = StatusType.Published
+ objArticle.CommentCount = 0
+ objArticle.RatingCount = 0
+ objArticle.Rating = 0
+ objArticle.ShortUrl = ""
+
+ objArticle.Title = nodeTitle.Value
+ objArticle.IsFeatured = objFeed.AutoFeature
+ objArticle.IsSecure = False
+ objArticle.Summary = summary
+
+ objArticle.LastUpdate = objArticle.CreatedDate
+ objArticle.LastUpdateID = objFeed.UserID
+ objArticle.ModuleID = objFeed.ModuleID
+
+ objArticle.Url = nodeLink.Value
+ If (objFeed.DateMode = FeedDateMode.ImportDate) Then
+ objArticle.StartDate = publishedDate
+ Else
+ Try
+ Dim val As String = nodeDate.Value
+
+ val = val.Replace("PST", "-0800")
+ val = val.Replace("MST", "-0700")
+ val = val.Replace("CST", "-0600")
+ val = val.Replace("EST", "-0500")
+
+ objArticle.StartDate = DateTime.Parse(val)
+ Catch
+ objArticle.StartDate = publishedDate
+ End Try
+ End If
+
+ objArticle.EndDate = Null.NullDate
+ If (objFeed.AutoExpire <> Null.NullInteger And objFeed.AutoExpireUnit <> FeedExpiryType.None) Then
+ Select Case objFeed.AutoExpireUnit
+
+ Case FeedExpiryType.Minute
+ objArticle.EndDate = DateTime.Now.AddMinutes(objFeed.AutoExpire)
+ Exit Select
+
+ Case FeedExpiryType.Hour
+ objArticle.EndDate = DateTime.Now.AddHours(objFeed.AutoExpire)
+ Exit Select
+
+ Case FeedExpiryType.Day
+ objArticle.EndDate = DateTime.Now.AddDays(objFeed.AutoExpire)
+ Exit Select
+
+ Case FeedExpiryType.Month
+ objArticle.EndDate = DateTime.Now.AddMonths(objFeed.AutoExpire)
+ Exit Select
+
+ Case FeedExpiryType.Year
+ objArticle.EndDate = DateTime.Now.AddYears(objFeed.AutoExpire)
+ Exit Select
+
+ End Select
+ End If
+
+ objArticle.RssGuid = guid
+
+ objArticle.ArticleID = objArticleController.AddArticle(objArticle)
+
+ Dim objPage As New PageInfo
+ objPage.PageText = pageDetail
+ objPage.ArticleID = objArticle.ArticleID
+ objPage.Title = objArticle.Title
+
+ Dim objPageController As New PageController()
+ objPageController.AddPage(objPage)
+
+ For Each objCategory As CategoryInfo In objFeed.Categories
+ objArticleController.AddArticleCategory(objArticle.ArticleID, objCategory.CategoryID)
+ Next
+
+ publishedDate = publishedDate.AddSeconds(-1)
+
+ Else
+
+ If (objArticles.Count = 1) Then
+
+ objArticles(0).Title = nodeTitle.Value
+ objArticles(0).Summary = summary
+ objArticles(0).LastUpdate = DateTime.Now
+ objArticleController.UpdateArticle(objArticles(0))
+
+ Dim objPageController As New PageController()
+ Dim objPages As ArrayList = objPageController.GetPageList(objArticles(0).ArticleID)
+
+ If (objPages.Count > 0) Then
+ objPages(0).PageText = pageDetail
+ objPageController.UpdatePage(objPages(0))
+ End If
+
+ End If
+
+ End If
+
+ End While
+
+ End Sub
+
+ Private Sub ImportFeedRDF(ByVal objFeed As FeedInfo)
+
+ Dim doc As XPathDocument
+ Dim navigator As XPathNavigator
+ Dim nodes As XPathNodeIterator
+ Dim node As XPathNavigator
+
+ ' Create a new XmlDocument
+ doc = New XPathDocument(objFeed.Url)
+
+ ' Create navigator
+ navigator = doc.CreateNavigator()
+
+ Dim mngr As New XmlNamespaceManager(navigator.NameTable)
+ mngr.AddNamespace("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#")
+ mngr.AddNamespace("dc", "http://purl.org/dc/elements/1.1/")
+
+ ' Get forecast with XPath
+ nodes = navigator.Select("/rdf:RDF/*", mngr)
+
+ While nodes.MoveNext()
+ node = nodes.Current
+
+ If (node.Name.ToLower() = "item") Then
+
+ Dim title As String = ""
+ Dim description As String = ""
+ Dim link As String = ""
+ Dim dateNode As String = ""
+ Dim guid As String = ""
+
+ Dim objChildNodes As XPathNodeIterator = node.SelectChildren(XPathNodeType.All)
+
+ While objChildNodes.MoveNext()
+ Dim objChildNode As XPathNavigator = objChildNodes.Current
+
+ Select Case objChildNode.Name.ToLower()
+
+ Case "title"
+ title = objChildNode.Value
+ Exit Select
+
+ Case "description"
+ description = objChildNode.Value
+ Exit Select
+
+ Case "link"
+ link = objChildNode.Value
+ Exit Select
+
+ Case "date"
+ dateNode = objChildNode.Value
+ Exit Select
+
+ Case "guid"
+ guid = objChildNode.Value
+ Exit Select
+
+ End Select
+ End While
+
+ If (title <> "" And link <> "") Then
+
+ If (guid = "") Then
+ guid = link
+ End If
+
+ Dim objArticleController As New ArticleController()
+ Dim objArticles As List(Of ArticleInfo) = objArticleController.GetArticleList(objFeed.ModuleID, DateTime.Now, Null.NullDate, Nothing, False, Nothing, 1, 1, 10, ArticleConstants.DEFAULT_SORT_BY, ArticleConstants.DEFAULT_SORT_DIRECTION, True, False, Null.NullString, Null.NullInteger, True, True, False, False, False, False, Null.NullString, Nothing, False, guid, Null.NullInteger, Null.NullString, Null.NullString, Nothing)
+
+ If (objArticles.Count = 0) Then
+
+ Dim publishedDate As DateTime = DateTime.Now
+
+ Dim objArticle As New ArticleInfo
+
+ objArticle.AuthorID = objFeed.UserID
+ objArticle.CreatedDate = DateTime.Now
+ objArticle.Status = StatusType.Published
+ objArticle.CommentCount = 0
+ objArticle.RatingCount = 0
+ objArticle.Rating = 0
+ objArticle.ShortUrl = ""
+
+ objArticle.Title = title
+ objArticle.IsFeatured = objFeed.AutoFeature
+ objArticle.IsSecure = False
+ objArticle.Summary = description
+
+ objArticle.LastUpdate = publishedDate
+ objArticle.LastUpdateID = objFeed.UserID
+ objArticle.ModuleID = objFeed.ModuleID
+
+ objArticle.Url = link
+ If (objFeed.DateMode = FeedDateMode.ImportDate) Then
+ objArticle.StartDate = publishedDate
+ Else
+ Try
+ Dim val As String = dateNode
+
+ val = val.Replace("PST", "-0800")
+ val = val.Replace("MST", "-0700")
+ val = val.Replace("CST", "-0600")
+ val = val.Replace("EST", "-0500")
+
+ objArticle.StartDate = DateTime.Parse(val)
+ Catch
+ objArticle.StartDate = publishedDate
+ End Try
+ End If
+
+ objArticle.EndDate = Null.NullDate
+ If (objFeed.AutoExpire <> Null.NullInteger And objFeed.AutoExpireUnit <> FeedExpiryType.None) Then
+ Select Case objFeed.AutoExpireUnit
+
+ Case FeedExpiryType.Minute
+ objArticle.EndDate = DateTime.Now.AddMinutes(objFeed.AutoExpire)
+ Exit Select
+
+ Case FeedExpiryType.Hour
+ objArticle.EndDate = DateTime.Now.AddHours(objFeed.AutoExpire)
+ Exit Select
+
+ Case FeedExpiryType.Day
+ objArticle.EndDate = DateTime.Now.AddDays(objFeed.AutoExpire)
+ Exit Select
+
+ Case FeedExpiryType.Month
+ objArticle.EndDate = DateTime.Now.AddMonths(objFeed.AutoExpire)
+ Exit Select
+
+ Case FeedExpiryType.Year
+ objArticle.EndDate = DateTime.Now.AddYears(objFeed.AutoExpire)
+ Exit Select
+
+ End Select
+ End If
+
+ objArticle.RssGuid = guid
+
+ objArticle.ArticleID = objArticleController.AddArticle(objArticle)
+
+ Dim objPage As New PageInfo
+ objPage.PageText = description
+ objPage.ArticleID = objArticle.ArticleID
+ objPage.Title = objArticle.Title
+
+ Dim objPageController As New PageController()
+ objPageController.AddPage(objPage)
+
+ For Each objCategory As CategoryInfo In objFeed.Categories
+ objArticleController.AddArticleCategory(objArticle.ArticleID, objCategory.CategoryID)
+ Next
+
+ publishedDate = publishedDate.AddSeconds(-1)
+
+ End If
+
+ End If
+
+ End If
+
+ End While
+
+ End Sub
+
+#End Region
+
+#Region " Public Methods "
+
+ Public Sub ImportFeeds()
+
+ Dim objFeedController As New FeedController
+ Dim objFeeds As List(Of FeedInfo) = objFeedController.GetFeedList(Null.NullInteger, True)
+
+
+ For Each objFeed As FeedInfo In objFeeds
+ If (Me.ScheduleHistoryItem.GetSetting("NewsArticles-Import-Clear-" & objFeed.ModuleID) <> "") Then
+ If (Convert.ToBoolean(Me.ScheduleHistoryItem.GetSetting("NewsArticles-Import-Clear-" & objFeed.ModuleID))) Then
+ ' Delete Articles
+ Dim objArticleController As New ArticleController
+ Dim objArticles As List(Of ArticleInfo) = objArticleController.GetArticleList(objFeed.ModuleID, DateTime.Now, Null.NullDate, Nothing, False, Nothing, 1000, 1, 1000, ArticleConstants.DEFAULT_SORT_BY, ArticleConstants.DEFAULT_SORT_DIRECTION, True, False, Null.NullString, Null.NullInteger, True, True, False, False, False, False, Null.NullString, Nothing, False, Null.NullString, Null.NullInteger, Null.NullString, Null.NullString, Nothing)
+
+ Me.ScheduleHistoryItem.AddLogNote(objArticles.Count.ToString())
+ For Each objArticle As ArticleInfo In objArticles
+ objArticleController.DeleteArticleCategories(objArticle.ArticleID)
+ objArticleController.DeleteArticle(objArticle.ArticleID, objFeed.ModuleID)
+ Next
+
+ End If
+ End If
+ Next
+
+ For Each objFeed As FeedInfo In objFeeds
+ Try
+ Me.ScheduleHistoryItem.AddLogNote(objFeed.Url) 'OPTIONAL
+ ImportFeed(objFeed)
+ Catch ex As Exception
+ Me.ScheduleHistoryItem.AddLogNote("News Articles -> Failure to import feed: " + objFeed.Url + ex.ToString()) 'OPTIONAL
+ End Try
+ Next
+
+ End Sub
+
+#End Region
+
+#Region " Constructors "
+
+ Public Sub New(ByVal objScheduleHistoryItem As DotNetNuke.Services.Scheduling.ScheduleHistoryItem)
+
+ MyBase.new()
+ Me.ScheduleHistoryItem = objScheduleHistoryItem
+
+ End Sub
+
+#End Region
+
+#Region " Interface Methods "
+
+ Public Overrides Sub DoWork()
+
+
+ Try
+ 'notification that the event is progressing
+ Me.Progressing() 'OPTIONAL
+ ImportFeeds()
+ Me.ScheduleHistoryItem.Succeeded = True 'REQUIRED
+
+ Catch exc As Exception 'REQUIRED
+
+ Me.ScheduleHistoryItem.Succeeded = False 'REQUIRED
+ Me.ScheduleHistoryItem.AddLogNote("News Articles -> Import RSS job failed. " + exc.ToString) 'OPTIONAL
+ 'notification that we have errored
+ Me.Errored(exc) 'REQUIRED
+ 'log the exception
+ LogException(exc) 'OPTIONAL
+
+ End Try
+
+ End Sub
+
+#End Region
+
+ End Class
+
+End Namespace
diff --git a/Components/LatestArticleController.vb b/Components/LatestArticleController.vb
new file mode 100755
index 0000000..64fa536
--- /dev/null
+++ b/Components/LatestArticleController.vb
@@ -0,0 +1,58 @@
+Imports DotNetNuke.Entities.Modules
+Imports DotNetNuke.Common.Utilities
+Imports System.Xml
+
+Namespace Ventrian.NewsArticles
+
+ Public Class LatestArticleController
+ Implements IPortable
+
+ Public Function ExportModule(ByVal ModuleID As Integer) As String Implements IPortable.ExportModule
+
+ Dim objModuleController As New ModuleController
+ Dim settings As Hashtable = objModuleController.GetModuleSettings(ModuleID)
+
+ Dim objLatestLayoutController As New LatestLayoutController()
+
+ Dim objLayoutHeader As LayoutInfo = objLatestLayoutController.GetLayout(LatestLayoutType.Listing_Header_Html, ModuleID, settings)
+ Dim objLayoutItem As LayoutInfo = objLatestLayoutController.GetLayout(LatestLayoutType.Listing_Item_Html, ModuleID, settings)
+ Dim objLayoutFooter As LayoutInfo = objLatestLayoutController.GetLayout(LatestLayoutType.Listing_Footer_Html, ModuleID, settings)
+ Dim objLayoutEmpty As LayoutInfo = objLatestLayoutController.GetLayout(LatestLayoutType.Listing_Empty_Html, ModuleID, settings)
+
+ Dim strXML As String = ""
+
+ strXML += "" & XmlUtils.XMLEncode(objLayoutHeader.Template) & ""
+ strXML += "" & XmlUtils.XMLEncode(objLayoutItem.Template) & ""
+ strXML += "" & XmlUtils.XMLEncode(objLayoutFooter.Template) & ""
+ strXML += "" & XmlUtils.XMLEncode(objLayoutEmpty.Template) & ""
+
+ Return strXML
+
+ End Function
+
+ Public Sub ImportModule(ByVal ModuleID As Integer, ByVal Content As String, ByVal Version As String, ByVal UserId As Integer) Implements IPortable.ImportModule
+
+ Dim objXmlDocument As New XmlDocument()
+ objXmlDocument.LoadXml("" & Content & "")
+
+ Dim objLatestLayoutController As New LatestLayoutController()
+ For Each xmlChildNode As XmlNode In objXmlDocument.ChildNodes(0).ChildNodes
+ If (xmlChildNode.Name = "layoutHeader") Then
+ objLatestLayoutController.UpdateLayout(LatestLayoutType.Listing_Header_Html, ModuleID, xmlChildNode.InnerText)
+ End If
+ If (xmlChildNode.Name = "layoutItem") Then
+ objLatestLayoutController.UpdateLayout(LatestLayoutType.Listing_Item_Html, ModuleID, xmlChildNode.InnerText)
+ End If
+ If (xmlChildNode.Name = "layoutFooter") Then
+ objLatestLayoutController.UpdateLayout(LatestLayoutType.Listing_Footer_Html, ModuleID, xmlChildNode.InnerText)
+ End If
+ If (xmlChildNode.Name = "layoutEmpty") Then
+ objLatestLayoutController.UpdateLayout(LatestLayoutType.Listing_Empty_Html, ModuleID, xmlChildNode.InnerText)
+ End If
+ Next
+
+ End Sub
+
+ End Class
+
+End Namespace
\ No newline at end of file
diff --git a/Components/Layout/LatestLayoutController.vb b/Components/Layout/LatestLayoutController.vb
new file mode 100755
index 0000000..590dbd0
--- /dev/null
+++ b/Components/Layout/LatestLayoutController.vb
@@ -0,0 +1,160 @@
+Imports System.IO
+
+Imports DotNetNuke.Common.Utilities
+
+Namespace Ventrian.NewsArticles
+
+ Public Class LatestLayoutController
+
+#Region " Public Methods "
+
+ Public Function GetLayout(ByVal type As LatestLayoutType, ByVal moduleID As Integer, ByVal settings As Hashtable) As LayoutInfo
+
+ Dim cacheKey As String = "LatestArticles-" & moduleID.ToString() & "-" & type.ToString()
+ Dim objLayout As LayoutInfo = CType(DataCache.GetCache(cacheKey), LayoutInfo)
+
+ If (objLayout Is Nothing) Then
+
+ Dim delimStr As String = "[]"
+ Dim delimiter As Char() = delimStr.ToCharArray()
+
+ objLayout = New LayoutInfo
+ Dim folderPath As String = HttpContext.Current.Server.MapPath("~\DesktopModules\DnnForge - LatestArticles\Templates\" & moduleID.ToString())
+ Dim filePath As String = HttpContext.Current.Server.MapPath("~\DesktopModules\DnnForge - LatestArticles\Templates\" & moduleID.ToString() & "\" & type.ToString().Replace("_", "."))
+
+ If (File.Exists(filePath) = False) Then
+ ' Load from settings...
+
+ Dim _layoutMode As LayoutModeType = ArticleConstants.LATEST_ARTICLES_LAYOUT_MODE_DEFAULT
+ If (settings.Contains(ArticleConstants.LATEST_ARTICLES_LAYOUT_MODE)) Then
+ _layoutMode = CType(System.Enum.Parse(GetType(LayoutModeType), settings(ArticleConstants.LATEST_ARTICLES_LAYOUT_MODE).ToString()), LayoutModeType)
+ End If
+
+ Select Case type
+
+ Case LatestLayoutType.Listing_Header_Html
+
+ Dim layoutHeader As String
+
+ If (_layoutMode = LayoutModeType.Simple) Then
+ If (settings.Contains(ArticleConstants.SETTING_HTML_HEADER)) Then
+ layoutHeader = settings(ArticleConstants.SETTING_HTML_HEADER).ToString()
+ Else
+ layoutHeader = ArticleConstants.DEFAULT_HTML_HEADER
+ End If
+ Else
+ If (settings.Contains(ArticleConstants.SETTING_HTML_HEADER_ADVANCED)) Then
+ layoutHeader = settings(ArticleConstants.SETTING_HTML_HEADER_ADVANCED).ToString()
+ Else
+ layoutHeader = ArticleConstants.DEFAULT_HTML_HEADER_ADVANCED
+ End If
+ End If
+
+ If Not (Directory.Exists(folderPath)) Then
+ Directory.CreateDirectory(folderPath)
+ End If
+
+ File.WriteAllText(filePath, layoutHeader)
+ Exit Select
+
+ Case LatestLayoutType.Listing_Item_Html
+
+ Dim layoutItem As String
+
+ If (_layoutMode = LayoutModeType.Simple) Then
+ If (settings.Contains(ArticleConstants.SETTING_HTML_BODY)) Then
+ layoutItem = settings(ArticleConstants.SETTING_HTML_BODY).ToString()
+ Else
+ layoutItem = ArticleConstants.DEFAULT_HTML_BODY
+ End If
+ Else
+ If (settings.Contains(ArticleConstants.SETTING_HTML_BODY_ADVANCED)) Then
+ layoutItem = settings(ArticleConstants.SETTING_HTML_BODY_ADVANCED).ToString()
+ Else
+ layoutItem = ArticleConstants.DEFAULT_HTML_BODY_ADVANCED
+ End If
+ End If
+
+ If Not (Directory.Exists(folderPath)) Then
+ Directory.CreateDirectory(folderPath)
+ End If
+
+ File.WriteAllText(filePath, layoutItem)
+ Exit Select
+
+ Case LatestLayoutType.Listing_Footer_Html
+
+ Dim layoutFooter As String
+
+ If (_layoutMode = LayoutModeType.Simple) Then
+ If (settings.Contains(ArticleConstants.SETTING_HTML_FOOTER)) Then
+ layoutFooter = settings(ArticleConstants.SETTING_HTML_FOOTER).ToString()
+ Else
+ layoutFooter = ArticleConstants.DEFAULT_HTML_FOOTER
+ End If
+ Else
+ If (settings.Contains(ArticleConstants.SETTING_HTML_FOOTER_ADVANCED)) Then
+ layoutFooter = settings(ArticleConstants.SETTING_HTML_FOOTER_ADVANCED).ToString()
+ Else
+ layoutFooter = ArticleConstants.DEFAULT_HTML_FOOTER_ADVANCED
+ End If
+ End If
+
+ If Not (Directory.Exists(folderPath)) Then
+ Directory.CreateDirectory(folderPath)
+ End If
+
+ File.WriteAllText(filePath, layoutFooter)
+ Exit Select
+
+ Case LatestLayoutType.Listing_Empty_Html
+
+ Dim noArticles As String = ArticleConstants.SETTING_HTML_NO_ARTICLES
+ If (settings.Contains(ArticleConstants.SETTING_HTML_NO_ARTICLES)) Then
+ noArticles = settings(ArticleConstants.SETTING_HTML_NO_ARTICLES).ToString()
+ End If
+ noArticles = "
" & noArticles & "
"
+
+ If Not (Directory.Exists(folderPath)) Then
+ Directory.CreateDirectory(folderPath)
+ End If
+
+ File.WriteAllText(filePath, noArticles)
+ Exit Select
+
+ End Select
+
+ End If
+
+ objLayout.Template = File.ReadAllText(filePath)
+ objLayout.Tokens = objLayout.Template.Split(delimiter)
+
+ DataCache.SetCache(cacheKey, objLayout, New CacheDependency(filePath))
+
+ End If
+
+ Return objLayout
+
+ End Function
+
+ Public Sub UpdateLayout(ByVal type As LatestLayoutType, ByVal moduleID As Integer, ByVal content As String)
+
+ Dim folderPath As String = HttpContext.Current.Server.MapPath("~\DesktopModules\DnnForge - LatestArticles\Templates\" & moduleID.ToString())
+ Dim filePath As String = HttpContext.Current.Server.MapPath("~\DesktopModules\DnnForge - LatestArticles\Templates\" & moduleID.ToString() & "\" & type.ToString().Replace("_", "."))
+
+ If Not (Directory.Exists(folderPath)) Then
+ Directory.CreateDirectory(folderPath)
+ End If
+
+ File.WriteAllText(filePath, content)
+
+ Dim cacheKey As String = "LatestArticles-" & moduleID.ToString() & "-" & type.ToString()
+ DataCache.RemoveCache(cacheKey)
+
+ End Sub
+
+#End Region
+
+ End Class
+
+End Namespace
diff --git a/Components/Layout/LatestLayoutType.vb b/Components/Layout/LatestLayoutType.vb
new file mode 100755
index 0000000..6b576d9
--- /dev/null
+++ b/Components/Layout/LatestLayoutType.vb
@@ -0,0 +1,18 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Namespace Ventrian.NewsArticles
+
+ Public Enum LatestLayoutType
+
+ Listing_Header_Html
+ Listing_Item_Html
+ Listing_Footer_Html
+ Listing_Empty_Html
+
+ End Enum
+
+End Namespace
diff --git a/Components/Layout/LayoutController.vb b/Components/Layout/LayoutController.vb
new file mode 100755
index 0000000..504f4f5
--- /dev/null
+++ b/Components/Layout/LayoutController.vb
@@ -0,0 +1,4683 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System.IO
+Imports System.Text.RegularExpressions
+Imports System.Web
+Imports System.Web.UI
+Imports System.Web.UI.WebControls
+Imports Ventrian.NewsArticles.Components.Common
+
+Imports DotNetNuke.Common
+Imports DotNetNuke.Common.Utilities
+Imports DotNetNuke.Entities.Users
+Imports DotNetNuke.Entities.Modules
+Imports DotNetNuke.Services.Localization
+Imports DotNetNuke.Security
+Imports DotNetNuke.Entities.Profile
+Imports DotNetNuke.Common.Lists
+Imports DotNetNuke.Entities.Portals
+Imports Ventrian.NewsArticles.Components.CustomFields
+
+Imports Ventrian.NewsArticles.Base
+Imports DotNetNuke.Web.Client.ClientResourceManagement
+Imports DotNetNuke.Web.Client
+Imports DotNetNuke.Services.Cache
+
+Namespace Ventrian.NewsArticles
+
+ Public Class LayoutController
+
+#Region " Constructors "
+
+ Public Sub New(ByVal portalSettings As PortalSettings, ByVal articleSettings As ArticleSettings, ByVal objModule As ModuleInfo, ByVal objPage As Page)
+
+ _portalSettings = portalSettings
+ _articleSettings = articleSettings
+ _articleModule = objModule
+ _page = objPage
+
+ End Sub
+
+ Public Sub New(ByVal moduleContext As NewsArticleModuleBase)
+
+ _portalSettings = moduleContext.PortalSettings
+ _articleSettings = moduleContext.ArticleSettings
+ _articleModule = moduleContext.ModuleContext.Configuration
+ _page = moduleContext.Page
+
+ End Sub
+
+ Public Sub New(ByVal moduleContext As NewsArticleModuleBase, ByVal pageId As Integer)
+
+ _portalSettings = moduleContext.PortalSettings
+ _articleSettings = moduleContext.ArticleSettings
+ _articleModule = moduleContext.ModuleContext.Configuration
+ _page = moduleContext.Page
+ _pageId = pageId
+
+ End Sub
+
+#End Region
+
+#Region " Private Members "
+
+ Private ReadOnly _portalSettings As PortalSettings
+ Private ReadOnly _articleSettings As ArticleSettings
+ Private ReadOnly _articleModule As ModuleInfo
+ Private ReadOnly _page As Page
+
+ Private _pageId As Integer = Null.NullInteger
+ Private _tab As DotNetNuke.Entities.Tabs.TabInfo
+
+ Private _objPages As ArrayList
+ Private _objRelatedArticles As List(Of ArticleInfo)
+
+ Dim _author As UserInfo
+
+ Dim _includeCategory As Boolean = False
+
+ Dim _profileProperties As ProfilePropertyDefinitionCollection
+
+#End Region
+
+#Region " Private Properties "
+
+ Private ReadOnly Property PortalSettings() As PortalSettings
+ Get
+ Return _portalSettings
+ End Get
+ End Property
+
+ Private ReadOnly Property ArticleSettings() As ArticleSettings
+ Get
+ Return _articleSettings
+ End Get
+ End Property
+
+ Private ReadOnly Property ArticleModule() As ModuleInfo
+ Get
+ Return _articleModule
+ End Get
+ End Property
+
+ Private ReadOnly Property Page() As Page
+ Get
+ Return _page
+ End Get
+ End Property
+
+ Private ReadOnly Property Pages(ByVal articleId As Integer) As ArrayList
+ Get
+ If (_objPages Is Nothing) Then
+ Dim objPageController As New PageController
+ _objPages = objPageController.GetPageList(articleId)
+ End If
+ Return _objPages
+ End Get
+ End Property
+
+ Private ReadOnly Property Server() As HttpServerUtility
+ Get
+ Return _page.Server
+ End Get
+ End Property
+
+ Private ReadOnly Property Request() As HttpRequest
+ Get
+ Return _page.Request
+ End Get
+ End Property
+
+ Private ReadOnly Property UserId() As Integer
+ Get
+ Return UserController.GetCurrentUserInfo().UserID
+ End Get
+ End Property
+
+ Private ReadOnly Property Tab() As DotNetNuke.Entities.Tabs.TabInfo
+ Get
+ If (_tab Is Nothing) Then
+ Dim objTabController As New DotNetNuke.Entities.Tabs.TabController()
+ _tab = objTabController.GetTab(ArticleModule.TabID, PortalSettings.PortalId, False)
+ End If
+
+ Return _tab
+ End Get
+ End Property
+
+ Private ReadOnly Property IsEditable() As Boolean
+ Get
+ If (Permissions.ModulePermissionController.CanEditModuleContent(ArticleModule)) Then
+ Return True
+ End If
+ Return False
+ End Get
+ End Property
+
+#End Region
+
+#Region " Public Properties "
+
+
+ Public Property IncludeCategory() As Boolean
+ Get
+ Return _includeCategory
+ End Get
+ Set(ByVal value As Boolean)
+ _includeCategory = value
+ End Set
+ End Property
+
+#End Region
+
+#Region " Private Methods "
+
+ Private Function Author(ByVal authorID As Integer) As UserInfo
+
+ If (authorID = Null.NullInteger) Then
+ Return Nothing
+ End If
+
+ If (_author Is Nothing) Then
+ _author = UserController.GetUserById(PortalSettings.PortalId, authorID)
+ Else
+ If (_author.UserID = authorID) Then
+ Return _author
+ Else
+ _author = UserController.GetUserById(PortalSettings.PortalId, authorID)
+ End If
+ End If
+
+ Return _author
+
+ End Function
+
+ Public Function BBCode(ByVal strTextToReplace As String) As String
+
+ '//Define regex
+ Dim regExp As Regex
+
+ '//Regex for URL tag without anchor
+ regExp = New Regex("\[url\]([^\]]+)\[\/url\]", RegexOptions.IgnoreCase)
+ Dim m As Match = regExp.Match(strTextToReplace)
+ Do While m.Success
+ strTextToReplace = strTextToReplace.Replace(m.Value, "" & m.Groups(1).Value & "")
+ m = m.NextMatch()
+ Loop
+
+ '//Regex for URL with anchor
+ regExp = New Regex("\[url=([^\]]+)\]([^\]]+)\[\/url\]", RegexOptions.IgnoreCase)
+ m = regExp.Match(strTextToReplace)
+ Do While m.Success
+ strTextToReplace = strTextToReplace.Replace(m.Value, "" & m.Groups(2).Value & "")
+ m = m.NextMatch()
+ Loop
+
+ '//Quote text
+ regExp = New Regex("\[quote\](.+?)\[\/quote\]", RegexOptions.IgnoreCase)
+ strTextToReplace = regExp.Replace(strTextToReplace, "$1")
+
+ '//Bold text
+ regExp = New Regex("\[b\](.+?)\[\/b\]", RegexOptions.IgnoreCase)
+ strTextToReplace = regExp.Replace(strTextToReplace, "$1")
+
+ '//Italic text
+ regExp = New Regex("\[i\](.+?)\[\/i\]", RegexOptions.IgnoreCase)
+ strTextToReplace = regExp.Replace(strTextToReplace, "$1")
+
+ '//Underline text
+ regExp = New Regex("\[u\](.+?)\[\/u\]", RegexOptions.IgnoreCase)
+ strTextToReplace = regExp.Replace(strTextToReplace, "$1")
+
+ Return strTextToReplace
+
+ End Function
+
+ ' utility function to convert a byte array into a hex string
+ Private Function ByteArrayToString(ByVal arrInput() As Byte) As String
+
+ Dim strOutput As New System.Text.StringBuilder(arrInput.Length)
+
+ For i As Integer = 0 To arrInput.Length - 1
+ strOutput.Append(arrInput(i).ToString("X2"))
+ Next
+
+ Return strOutput.ToString().ToLower
+
+ End Function
+
+ Protected Function EncodeComment(ByVal objComment As CommentInfo) As String
+
+ If (objComment.Type = 0) Then
+ Dim body As String = objComment.Comment
+ Return BBCode(body)
+ Else
+ Return objComment.Comment
+ End If
+
+ End Function
+
+ ' Returns string with binary notation of b bytes,
+ ' rounded to 2 decimal places , eg
+ ' 123="123 Bytes", 2345="2.29 KB",
+ ' 1234567="1.18 MB", etc
+ ' b : double : numeric to convert
+ Function Numeric2Bytes(ByVal b As Double) As String
+ Dim bSize(8) As String
+ Dim i As Integer
+
+ bSize(0) = "Bytes"
+ bSize(1) = "KB" 'Kilobytes
+ bSize(2) = "MB" 'Megabytes
+ bSize(3) = "GB" 'Gigabytes
+ bSize(4) = "TB" 'Terabytes
+ bSize(5) = "PB" 'Petabytes
+ bSize(6) = "EB" 'Exabytes
+ bSize(7) = "ZB" 'Zettabytes
+ bSize(8) = "YB" 'Yottabytes
+
+ b = CDbl(b) ' Make sure var is a Double (not just
+ ' variant)
+ For i = UBound(bSize) To 0 Step -1
+ If b >= (1024 ^ i) Then
+ Numeric2Bytes = ThreeNonZeroDigits(b / (1024 ^ _
+ i)) & " " & bSize(i)
+ Return Numeric2Bytes
+ End If
+ Next
+
+ Return ""
+ End Function
+
+ ' Return the value formatted to include at most three
+ ' non-zero digits and at most two digits after the
+ ' decimal point. Examples:
+ ' 1
+ ' 123
+ ' 12.3
+ ' 1.23
+ ' 0.12
+ Private Function ThreeNonZeroDigits(ByVal value As Double) _
+ As String
+ If value >= 100 Then
+ ' No digits after the decimal.
+ Return Format$(CInt(value))
+ ElseIf value >= 10 Then
+ ' One digit after the decimal.
+ Return Format$(value, "0.0")
+ Else
+ ' Two digits after the decimal.
+ Return Format$(value, "0.00")
+ End If
+ End Function
+
+ Private Function FormatImageUrl(ByVal imageUrl As String) As String
+
+ If (imageUrl.ToLower().StartsWith("http://") Or imageUrl.ToLower().StartsWith("https://")) Then
+ Return imageUrl
+ Else
+ If (imageUrl.ToLower().StartsWith("fileid=")) Then
+ Dim objFileController As DotNetNuke.Services.FileSystem.FileController = New DotNetNuke.Services.FileSystem.FileController
+ Dim objFile As DotNetNuke.Services.FileSystem.FileInfo = objFileController.GetFileById(Convert.ToInt32(UrlUtils.GetParameterValue(imageUrl)), PortalSettings.PortalId)
+ If Not (objFile Is Nothing) Then
+ If (objFile.StorageLocation = 1) Then
+ ' Secure Url
+ Dim url As String = LinkClick(imageUrl, ArticleModule.TabID, ArticleModule.ModuleID)
+
+ If (HttpContext.Current.Request.Url.Port = 80) Then
+ Return AddHTTP(HttpContext.Current.Request.Url.Host & url)
+ Else
+ Return AddHTTP(HttpContext.Current.Request.Url.Host & ":" & System.Web.HttpContext.Current.Request.Url.Port.ToString() & url)
+ End If
+ Else
+ If (HttpContext.Current.Request.Url.Port = 80) Then
+ Return AddHTTP(HttpContext.Current.Request.Url.Host & PortalSettings.HomeDirectory & objFile.Folder & objFile.FileName)
+ Else
+ Return AddHTTP(HttpContext.Current.Request.Url.Host & ":" & HttpContext.Current.Request.Url.Port.ToString() & PortalSettings.HomeDirectory & objFile.Folder & objFile.FileName)
+ End If
+ End If
+ End If
+ End If
+ End If
+
+ Return ""
+
+ End Function
+
+ Public Function GetArticleResource(ByVal key As String) As String
+
+ Dim path As String = "~/DesktopModules/DnnForge - NewsArticles/" & Localization.LocalResourceDirectory & "/ViewArticle.ascx.resx"
+ Return Localization.GetString(key, path)
+
+ End Function
+
+ Private Function GetFieldValue(ByVal objCustomField As CustomFieldInfo, ByVal objArticle As ArticleInfo, ByVal showCaption As Boolean) As String
+
+ Dim value As String = objArticle.CustomList(objCustomField.CustomFieldID).ToString()
+ If (objCustomField.FieldType = CustomFieldType.RichTextBox) Then
+ value = Server.HtmlDecode(objArticle.CustomList(objCustomField.CustomFieldID).ToString())
+
+ Else
+ If (objCustomField.FieldType = CustomFieldType.MultiCheckBox) Then
+ value = objArticle.CustomList(objCustomField.CustomFieldID).ToString().Replace("|", ", ")
+ End If
+ If (objCustomField.FieldType = CustomFieldType.MultiLineTextBox) Then
+ value = objArticle.CustomList(objCustomField.CustomFieldID).ToString().Replace(vbCrLf, " ")
+ End If
+ If (value <> "" And objCustomField.ValidationType = CustomFieldValidationType.Date) Then
+ Try
+ value = DateTime.Parse(value).ToShortDateString()
+ Catch
+ value = objArticle.CustomList(objCustomField.CustomFieldID).ToString()
+ End Try
+ End If
+
+ If (value <> "" And objCustomField.ValidationType = CustomFieldValidationType.Currency) Then
+ Try
+ Dim culture As String = "en-US"
+
+ Dim portalFormat As System.Globalization.CultureInfo = New System.Globalization.CultureInfo(culture)
+ Dim format As String = "{0:C2}"
+ value = String.Format(portalFormat.NumberFormat, format, Double.Parse(value))
+
+ Catch
+ value = objArticle.CustomList(objCustomField.CustomFieldID).ToString()
+ End Try
+ End If
+ End If
+
+ If (showCaption) Then
+ value = "" & objCustomField.Caption & ": " & value
+ End If
+
+ Return value
+
+ End Function
+
+ Private Function GetRelatedArticles(ByVal objArticle As ArticleInfo, ByVal count As Integer) As List(Of ArticleInfo)
+
+ If (_objRelatedArticles IsNot Nothing) Then
+ Return _objRelatedArticles
+ End If
+
+ Dim matchAllCategories As Boolean = False
+ If (ArticleSettings.RelatedMode = RelatedType.MatchCategoriesAll Or ArticleSettings.RelatedMode = RelatedType.MatchCategoriesAllTagsAny) Then
+ matchAllCategories = True
+ End If
+
+ Dim matchAllTags As Boolean = False
+ If (ArticleSettings.RelatedMode = RelatedType.MatchCategoriesAnyTagsAll Or ArticleSettings.RelatedMode = RelatedType.MatchTagsAll) Then
+ matchAllTags = True
+ End If
+
+ Dim objArticleController As New ArticleController()
+
+ Dim categoriesArray() As Integer = Nothing
+ If (ArticleSettings.RelatedMode = RelatedType.MatchCategoriesAll Or ArticleSettings.RelatedMode = RelatedType.MatchCategoriesAllTagsAny Or ArticleSettings.RelatedMode = RelatedType.MatchCategoriesAny Or ArticleSettings.RelatedMode = RelatedType.MatchCategoriesAnyTagsAll Or ArticleSettings.RelatedMode = RelatedType.MatchCategoriesAnyTagsAny) Then
+ Dim categories As ArrayList = objArticleController.GetArticleCategories(objArticle.ArticleID)
+ Dim categoriesRelated As New List(Of Integer)
+ For Each objCategory As CategoryInfo In categories
+ categoriesRelated.Add(objCategory.CategoryID)
+ Next
+ If (categories.Count = 0) Then
+ categoriesRelated.Add(-1)
+ End If
+ categoriesArray = categoriesRelated.ToArray()
+ End If
+
+ Dim tagsArray() As Integer = Nothing
+ If (ArticleSettings.RelatedMode = RelatedType.MatchCategoriesAllTagsAny Or ArticleSettings.RelatedMode = RelatedType.MatchCategoriesAnyTagsAll Or ArticleSettings.RelatedMode = RelatedType.MatchCategoriesAnyTagsAny Or ArticleSettings.RelatedMode = RelatedType.MatchTagsAll Or ArticleSettings.RelatedMode = RelatedType.MatchTagsAny) Then
+ Dim tagsRelated As New List(Of Integer)
+ If (objArticle.Tags <> "") Then
+ Dim objTagController As New TagController()
+ For Each tag As String In objArticle.Tags.Split(","c)
+ Dim objTag As TagInfo = objTagController.Get(objArticle.ModuleID, tag.ToLower().Trim())
+ If (objTag IsNot Nothing) Then
+ tagsRelated.Add(objTag.TagID)
+ End If
+ Next
+ End If
+ If (tagsRelated.Count = 0) Then
+ tagsRelated.Add(-1)
+ End If
+ tagsArray = tagsRelated.ToArray()
+ End If
+
+ _objRelatedArticles = objArticleController.GetArticleList(objArticle.ModuleID, DateTime.Now, Null.NullDate, categoriesArray, matchAllCategories, Nothing, (count + 1), 1, (count + 1), ArticleSettings.SortBy, ArticleSettings.SortDirection, True, False, Null.NullString, Null.NullInteger, ArticleSettings.ShowPending, True, False, False, False, False, Null.NullString, tagsArray, matchAllTags, Null.NullString, Null.NullInteger, Null.NullString, Null.NullString, Nothing)
+
+ Dim positionToRemove As Integer = Null.NullInteger
+
+ Dim i As Integer = 0
+ For Each objRelatedArticle As ArticleInfo In _objRelatedArticles
+ If (objArticle.ArticleID = objRelatedArticle.ArticleID) Then
+ positionToRemove = i
+ End If
+ i = i + 1
+ Next
+
+ If (positionToRemove <> Null.NullInteger) Then
+ _objRelatedArticles.RemoveAt(positionToRemove)
+ End If
+
+ If (_objRelatedArticles.Count = (count + 1)) Then
+ _objRelatedArticles.RemoveAt(count)
+ End If
+
+ Return _objRelatedArticles
+
+ End Function
+
+ Private Function GetRatingImage(ByVal objArticle As ArticleInfo) As String
+
+ If (objArticle.Rating = Null.NullDouble) Then
+ Return ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Images/Rating/stars-0-0.gif")
+ Else
+
+ Select Case RoundToUnit(objArticle.Rating, 0.5, False)
+
+ Case 1
+ Return ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Images/Rating/stars-1-0.gif")
+
+ Case 1.5
+ Return ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Images/Rating/stars-1-5.gif")
+
+ Case 2
+ Return ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Images/Rating/stars-2-0.gif")
+
+ Case 2.5
+ Return ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Images/Rating/stars-2-5.gif")
+
+ Case 3
+ Return ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Images/Rating/stars-3-0.gif")
+
+ Case 3.5
+ Return ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Images/Rating/stars-3-5.gif")
+
+ Case 4
+ Return ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Images/Rating/stars-4-0.gif")
+
+ Case 4.5
+ Return ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Images/Rating/stars-4-5.gif")
+
+ Case 5
+ Return ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Images/Rating/stars-5-0.gif")
+
+ End Select
+
+ Return ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Images/Rating/stars-0-0.gif")
+
+ End If
+
+ End Function
+
+ Public Function GetSharedResource(ByVal key As String) As String
+
+ Dim path As String = "~/DesktopModules/DnnForge - NewsArticles/" & Localization.LocalResourceDirectory & "/" & Localization.LocalSharedResourceFile
+ Return Localization.GetString(key, path)
+
+ End Function
+
+ ' calculate the MD5 hash of a given string
+ ' the string is first converted to a byte array
+ Public Function MD5CalcString(ByVal strData As String) As String
+
+ Dim objMD5 As New System.Security.Cryptography.MD5CryptoServiceProvider
+ Dim arrData() As Byte
+ Dim arrHash() As Byte
+
+ ' first convert the string to bytes (using UTF8 encoding for unicode characters)
+ arrData = Text.Encoding.UTF8.GetBytes(strData)
+
+ ' hash contents of this byte array
+ arrHash = objMD5.ComputeHash(arrData)
+
+ ' thanks objects
+ objMD5 = Nothing
+
+ ' return formatted hash
+ Return ByteArrayToString(arrHash)
+
+ End Function
+
+ Private Function ProcessPostTokens(ByVal content As String, ByVal objArticle As ArticleInfo, ByRef generator As System.Random, ByVal objArticleSettings As ArticleSettings) As String
+
+ If (objArticleSettings.ProcessPostTokens = False) Then
+ Return content
+ End If
+
+ Dim delimStr As String = "[]"
+ Dim delimiter As Char() = delimStr.ToCharArray()
+
+ Dim layoutArray As String() = content.Split(delimiter)
+ Dim formattedContent As String = ""
+
+ For iPtr As Integer = 0 To layoutArray.Length - 1 Step 2
+
+ formattedContent += layoutArray(iPtr).ToString()
+
+ If iPtr < layoutArray.Length - 1 Then
+ Select Case layoutArray(iPtr + 1)
+ Case Else
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("ARTICLELINK:")) Then
+ If (IsNumeric(layoutArray(iPtr + 1).Substring(12, layoutArray(iPtr + 1).Length - 12))) Then
+ Dim articleID As Integer = Convert.ToInt32(layoutArray(iPtr + 1).Substring(12, layoutArray(iPtr + 1).Length - 12))
+
+ Dim objArticleController As New ArticleController
+ Dim objArticleTarget As ArticleInfo = objArticleController.GetArticle(articleID)
+
+ If (objArticleTarget IsNot Nothing) Then
+ Dim link As String = Common.GetArticleLink(objArticleTarget, Tab, ArticleSettings, False)
+ formattedContent += "" & objArticleTarget.Title & ""
+ End If
+ End If
+ Exit Select
+ End If
+
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("IMAGETHUMBRANDOM:")) Then
+
+ If (objArticle.ImageCount > 0) Then
+
+ Dim objImageController As New ImageController
+ Dim objImages As List(Of ImageInfo) = objImageController.GetImageList(objArticle.ArticleID, Null.NullString)
+ If (objImages.Count > 0) Then
+
+ Dim randomImage As ImageInfo = objImages(generator.Next(0, objImages.Count - 1))
+
+ Dim val As String = layoutArray(iPtr + 1).Substring(17, layoutArray(iPtr + 1).Length - 17)
+ If (val.IndexOf(":"c) = -1) Then
+ Dim length As Integer = Convert.ToInt32(val)
+
+ Dim objImage As New Image
+ objImage.ImageUrl = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & length.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(randomImage.Folder & randomImage.FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1")
+ objImage.EnableViewState = False
+ objImage.AlternateText = objArticle.Title
+
+ formattedContent += RenderControlAsString(objImage)
+ Else
+
+ Dim arr() As String = val.Split(":"c)
+
+ If (arr.Length = 2) Then
+ Dim width As Integer = Convert.ToInt32(val.Split(":"c)(0))
+ Dim height As Integer = Convert.ToInt32(val.Split(":"c)(1))
+
+ Dim objImage As New Image
+ objImage.ImageUrl = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & width.ToString() & "&Height=" & height.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(randomImage.Folder & randomImage.FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1")
+ objImage.EnableViewState = False
+ objImage.AlternateText = objArticle.Title
+
+ formattedContent += RenderControlAsString(objImage)
+ End If
+ End If
+
+ End If
+
+ End If
+ Exit Select
+ End If
+
+ formattedContent += "[" & layoutArray(iPtr + 1) & "]"
+ End Select
+ End If
+
+ Next
+
+ Return formattedContent
+
+ End Function
+
+ Private ReadOnly Property ProfileProperties() As ProfilePropertyDefinitionCollection
+ Get
+ If (_profileProperties Is Nothing) Then
+ _profileProperties = ProfileController.GetPropertyDefinitionsByPortal(PortalSettings.PortalId)
+ End If
+ Return _profileProperties
+ End Get
+ End Property
+
+ Private Function RenderControlAsString(ByVal objControl As Control) As String
+
+ Dim sb As New StringBuilder
+ Dim tw As New StringWriter(sb)
+ Dim hw As New HtmlTextWriter(tw)
+
+ objControl.RenderControl(hw)
+
+ Return sb.ToString()
+
+ End Function
+
+ Private Function RoundToUnit(ByVal d As Double, ByVal unit As Double, ByVal roundDown As Boolean) As Double
+
+ If (roundDown) Then
+ Return Math.Round(Math.Round((d / unit) - 0.5, 0) * unit, 2)
+ Else
+ Return Math.Round(Math.Round((d / unit) + 0.5, 0) * unit, 2)
+ End If
+
+ End Function
+
+ Private Function StripHtml(ByVal html As String) As String
+
+ Dim pattern As String = "<(.|\n)*?>"
+ Return Regex.Replace(html, pattern, String.Empty)
+
+ End Function
+
+#End Region
+
+
+ Public Shared Function GetLayout(ByVal moduleContext As NewsArticleModuleBase, ByVal type As LayoutType) As LayoutInfo
+
+ Return GetLayout(moduleContext.ArticleSettings, moduleContext.ModuleConfiguration, moduleContext.Page, type)
+
+ End Function
+
+ Public Shared Function GetLayout(ByVal articleSettings As ArticleSettings, ByVal articleModule As ModuleInfo, ByVal page As Page, ByVal type As LayoutType) As LayoutInfo
+
+ Dim cacheKey As String = "NewsArticles-" & articleModule.TabModuleID.ToString() & type.ToString()
+ Dim objLayout As LayoutInfo = CType(DataCache.GetCache(cacheKey), LayoutInfo)
+
+ If (objLayout Is Nothing) Then
+
+ Const delimStr As String = "[]"
+ Dim delimiter As Char() = delimStr.ToCharArray()
+
+ objLayout = New LayoutInfo
+ Dim path As String = page.MapPath("~\DesktopModules\DnnForge - NewsArticles\Templates\" & articleSettings.Template & "\" & type.ToString().Replace("_", "."))
+
+ If (File.Exists(path) = False) Then
+ ' Need to find a default...
+ path = page.MapPath("~\DesktopModules\DnnForge - NewsArticles\Templates\" & ArticleConstants.DEFAULT_TEMPLATE & "\" & type.ToString().Replace("_", "."))
+ End If
+
+ objLayout.Template = File.ReadAllText(path)
+ objLayout.Tokens = objLayout.Template.Split(delimiter)
+
+ DataCache.SetCache(cacheKey, objLayout, New DNNCacheDependency(path))
+
+ End If
+
+ Return objLayout
+
+ End Function
+
+ Public Shared Sub ClearCache(ByVal moduleContext As NewsArticleModuleBase)
+
+ For Each type As String In System.Enum.GetNames(GetType(LayoutType))
+ Dim cacheKey As String = "NewsArticles-" & moduleContext.TabModuleId.ToString() & type.ToString()
+ DataCache.RemoveCache(cacheKey)
+ Next
+
+ End Sub
+
+#Region " Public Methods "
+
+ Public Function GetLayoutObject(ByVal templateData As String) As LayoutInfo
+
+ Dim delimStr As String = "[]"
+ Dim delimiter As Char() = delimStr.ToCharArray()
+ Dim objLayout As New LayoutInfo
+
+ objLayout.Template = templateData
+ objLayout.Tokens = objLayout.Template.Split(delimiter)
+
+ Return objLayout
+
+ End Function
+
+ Public Function GetStylesheet(ByVal template As String) As String
+
+ Dim value As String = ""
+
+ Dim path As String = ArticleUtilities.MapPath("~\DnnForge - NewsArticles\Templates\" & template & "\Template.css")
+
+ If (File.Exists(path) = False) Then
+ ' Need to find a default...
+ End If
+
+ File.ReadAllText(path)
+
+ Return value
+
+ End Function
+
+ Public Sub UpdateStylesheet(ByVal template As String, ByVal text As String)
+
+ Dim path As String = ArticleUtilities.MapPath("~\DnnForge - NewsArticles\Templates\" & template & "\Template.css")
+ File.WriteAllText(path, text)
+
+ End Sub
+
+ Public Sub UpdateLayout(ByVal template As String, ByVal type As LayoutType, ByVal text As String)
+
+ Dim path As String = ArticleUtilities.MapPath("~\DnnForge - NewsArticles\Templates\" & template & "\" & type.ToString().Replace("_", "."))
+ File.WriteAllText(path, text)
+
+ End Sub
+
+ Public Sub LoadStyleSheet(ByVal template As String)
+
+ ClientResourceManager.RegisterStyleSheet(Page, ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Templates/" & template & "/Template.css"), FileOrder.Css.ModuleCss)
+
+ End Sub
+
+ Public Function ProcessImages(ByVal html As String) As String
+
+ If (html.ToLower().Contains("src=""images/") Or html.ToLower().Contains("src=""~/images/")) Then
+ html = html.Replace("src=""images/", "src=""" & ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Templates/" & ArticleSettings.Template & "/Images/"))
+ html = html.Replace("src=""Images/", "src=""" & ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Templates/" & ArticleSettings.Template & "/Images/"))
+ html = html.Replace("src=""~/images/", "src=""" & ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Images") & "/")
+ html = html.Replace("src=""~/Images/", "src=""" & ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Images") & "/")
+ End If
+
+ Return html
+
+ End Function
+
+#Region " Process Article Item "
+
+
+ Public Sub ProcessHeaderFooter(ByRef objPlaceHolder As ControlCollection, ByVal layoutArray As String(), ByVal objArticle As ArticleInfo)
+
+ For iPtr As Integer = 0 To layoutArray.Length - 1 Step 2
+ objPlaceHolder.Add(New LiteralControl(ProcessImages(layoutArray(iPtr).ToString())))
+ Next
+
+ End Sub
+
+ Private articleItemIndex As Integer = 0
+ Public Sub ProcessArticleItem(ByRef objPlaceHolder As ControlCollection, ByVal layoutArray As String(), ByVal objArticle As ArticleInfo)
+
+ articleItemIndex = articleItemIndex + 1
+ _objRelatedArticles = Nothing
+
+ Static Generator As System.Random = New System.Random()
+
+ For iPtr As Integer = 0 To layoutArray.Length - 1 Step 2
+
+ objPlaceHolder.Add(New LiteralControl(ProcessImages(layoutArray(iPtr).ToString())))
+
+ If iPtr < layoutArray.Length - 1 Then
+ Select Case layoutArray(iPtr + 1)
+
+ Case "APPROVERDISPLAYNAME"
+ If (objArticle.Approver(PortalSettings.PortalId) IsNot Nothing) Then
+ Dim objLiteral As New Literal
+ objLiteral.Text = objArticle.Approver(PortalSettings.PortalId).DisplayName
+ objPlaceHolder.Add(objLiteral)
+ End If
+
+ Case "APPROVERFIRSTNAME"
+ If (objArticle.Approver(PortalSettings.PortalId) IsNot Nothing) Then
+ Dim objLiteral As New Literal
+ objLiteral.Text = objArticle.Approver(PortalSettings.PortalId).FirstName
+ objPlaceHolder.Add(objLiteral)
+ End If
+
+ Case "APPROVERLASTNAME"
+ If (objArticle.Approver(PortalSettings.PortalId) IsNot Nothing) Then
+ Dim objLiteral As New Literal
+ objLiteral.Text = objArticle.Approver(PortalSettings.PortalId).LastName
+ objPlaceHolder.Add(objLiteral)
+ End If
+
+ Case "APPROVERUSERNAME"
+ If (objArticle.Approver(PortalSettings.PortalId) IsNot Nothing) Then
+ Dim objLiteral As New Literal
+ objLiteral.Text = objArticle.Approver(PortalSettings.PortalId).Username
+ objPlaceHolder.Add(objLiteral)
+ End If
+
+ Case "ARTICLEID"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objArticle.ArticleID.ToString()
+ objPlaceHolder.Add(objLiteral)
+
+ Case "ARTICLELINK"
+ Dim objLiteral As New Literal
+ Dim pageID As Integer = Null.NullInteger
+ If (ArticleSettings.AlwaysShowPageID) Then
+ If (Pages(objArticle.ArticleID).Count > 0) Then
+ pageID = CType(Pages(objArticle.ArticleID)(0), PageInfo).PageID
+ End If
+ End If
+ objLiteral.Text = Common.GetArticleLink(objArticle, Tab, ArticleSettings, IncludeCategory, pageID)
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+
+ Case "AUTHOR"
+ Dim objLiteral As New Literal
+ Select Case ArticleSettings.DisplayMode
+ Case DisplayType.FirstName
+ objLiteral.Text = objArticle.AuthorFirstName
+ Exit Select
+ Case DisplayType.LastName
+ objLiteral.Text = objArticle.AuthorLastName
+ Exit Select
+ Case DisplayType.UserName
+ objLiteral.Text = objArticle.AuthorUserName
+ Exit Select
+ Case DisplayType.FullName
+ objLiteral.Text = objArticle.AuthorDisplayName
+ Exit Select
+ Case Else
+ objLiteral.Text = objArticle.AuthorUserName
+ Exit Select
+ End Select
+ objPlaceHolder.Add(objLiteral)
+
+ Case "AUTHORDISPLAYNAME"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objArticle.AuthorDisplayName
+ objPlaceHolder.Add(objLiteral)
+
+ Case "AUTHOREMAIL"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objArticle.AuthorEmail.ToString()
+ objPlaceHolder.Add(objLiteral)
+
+ Case "AUTHORFIRSTNAME"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objArticle.AuthorFirstName
+ objPlaceHolder.Add(objLiteral)
+
+ Case "AUTHORFULLNAME"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objArticle.AuthorFullName
+ objPlaceHolder.Add(objLiteral)
+
+ Case "AUTHORID"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objArticle.AuthorID.ToString()
+ objPlaceHolder.Add(objLiteral)
+
+ Case "AUTHORLASTNAME"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objArticle.AuthorLastName
+ objPlaceHolder.Add(objLiteral)
+
+ Case "AUTHORLINK"
+ Dim objLiteral As New Literal
+ objLiteral.Text = Common.GetAuthorLink(ArticleModule.TabID, ArticleModule.ModuleID, objArticle.AuthorID, objArticle.AuthorUserName, ArticleSettings.LaunchLinks, ArticleSettings)
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+
+ Case "AUTHORUSERNAME"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objArticle.AuthorUserName.ToString()
+ objPlaceHolder.Add(objLiteral)
+
+ Case "CATEGORIES"
+ Dim objLiteral As New Literal
+
+ Dim objArticleCategories As ArrayList = CType(DataCache.GetCache(ArticleConstants.CACHE_CATEGORY_ARTICLE & objArticle.ArticleID.ToString()), ArrayList)
+ If (objArticleCategories Is Nothing) Then
+ Dim objArticleController As New ArticleController
+ objArticleCategories = objArticleController.GetArticleCategories(objArticle.ArticleID)
+ For Each objCategory As CategoryInfo In objArticleCategories
+ If (objCategory.InheritSecurity) Then
+ If (objLiteral.Text <> "") Then
+ objLiteral.Text = objLiteral.Text & ", " & objCategory.Name & ""
+ Else
+ objLiteral.Text = " " & objCategory.Name & ""
+ End If
+ Else
+ If (ArticleSettings.Settings.Contains(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING)) Then
+ If (PortalSecurity.IsInRoles(ArticleSettings.Settings(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING).ToString())) Then
+ If (objLiteral.Text <> "") Then
+ objLiteral.Text = objLiteral.Text & ", " & objCategory.Name & ""
+ Else
+ objLiteral.Text = " " & objCategory.Name & ""
+ End If
+ End If
+ End If
+ End If
+ Next
+ DataCache.SetCache(ArticleConstants.CACHE_CATEGORY_ARTICLE & objArticle.ArticleID.ToString(), objArticleCategories)
+ Else
+ For Each objCategory As CategoryInfo In objArticleCategories
+ If (objCategory.InheritSecurity) Then
+ If (objLiteral.Text <> "") Then
+ objLiteral.Text = objLiteral.Text & ", " & objCategory.Name & ""
+ Else
+ objLiteral.Text = " " & objCategory.Name & ""
+ End If
+ Else
+
+ If (ArticleSettings.Settings.Contains(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING)) Then
+ If (PortalSecurity.IsInRoles(ArticleSettings.Settings(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING).ToString())) Then
+ If (objLiteral.Text <> "") Then
+ objLiteral.Text = objLiteral.Text & ", " & objCategory.Name & ""
+ Else
+ objLiteral.Text = " " & objCategory.Name & ""
+ End If
+ End If
+ End If
+ End If
+ Next
+ End If
+ objPlaceHolder.Add(objLiteral)
+
+ Case "CATEGORIESNOLINK"
+ Dim objLiteral As New Literal
+ Dim objArticleCategories As ArrayList = CType(DataCache.GetCache(ArticleConstants.CACHE_CATEGORY_ARTICLE & objArticle.ArticleID.ToString()), ArrayList)
+ If (objArticleCategories Is Nothing) Then
+ Dim objArticleController As New ArticleController
+ objArticleCategories = (objArticleController.GetArticleCategories(objArticle.ArticleID))
+ For Each objCategory As CategoryInfo In objArticleCategories
+ If (objCategory.InheritSecurity) Then
+ If (objLiteral.Text <> "") Then
+ objLiteral.Text = objLiteral.Text & ", " & objCategory.Name
+ Else
+ objLiteral.Text = objCategory.Name
+ End If
+ Else
+ If (ArticleSettings.Settings.Contains(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING)) Then
+ If (PortalSecurity.IsInRoles(ArticleSettings.Settings(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING).ToString())) Then
+
+ If (objLiteral.Text <> "") Then
+ objLiteral.Text = objLiteral.Text & ", " & objCategory.Name
+ Else
+ objLiteral.Text = objCategory.Name
+ End If
+ End If
+ End If
+ End If
+ Next
+ DataCache.SetCache(ArticleConstants.CACHE_CATEGORY_ARTICLE_NO_LINK & objArticle.ArticleID.ToString(), objArticleCategories)
+ Else
+ For Each objCategory As CategoryInfo In objArticleCategories
+ If (objCategory.InheritSecurity) Then
+ If (objLiteral.Text <> "") Then
+ objLiteral.Text = objLiteral.Text & ", " & objCategory.Name
+ Else
+ objLiteral.Text = objCategory.Name
+ End If
+ Else
+ If (ArticleSettings.Settings.Contains(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING)) Then
+ If (PortalSecurity.IsInRoles(ArticleSettings.Settings(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING).ToString())) Then
+ If (objLiteral.Text <> "") Then
+ objLiteral.Text = objLiteral.Text & ", " & objCategory.Name
+ Else
+ objLiteral.Text = objCategory.Name
+ End If
+ End If
+ End If
+ End If
+ Next
+ End If
+ objPlaceHolder.Add(objLiteral)
+
+ Case "COMMENTCOUNT"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objArticle.CommentCount.ToString()
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+
+ Case "COMMENTLINK"
+ Dim objLiteral As New Literal
+ objLiteral.Text = Common.GetArticleLink(objArticle, Tab, ArticleSettings, IncludeCategory) & "#Comments"
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+
+ Case "COMMENTRSS"
+ Dim objLiteral As New Literal
+ objLiteral.Text = AddHTTP(Request.Url.Host & ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/RssComments.aspx?TabID=" & ArticleModule.TabID.ToString() & "&ModuleID=" & ArticleModule.ModuleID.ToString() & "&ArticleID=" & objArticle.ArticleID.ToString()).Replace(" ", "%20"))
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+
+ Case "COMMENTS"
+ commentItemIndex = 0
+
+ Dim phComments As New PlaceHolder
+ Dim objLayoutCommentItem As LayoutInfo = GetLayout(ArticleSettings, ArticleModule, Page, LayoutType.Comment_Item_Html)
+
+ Dim direction As SortDirection = SortDirection.Ascending
+ If (ArticleSettings.SortDirectionComments = 1) Then
+ direction = SortDirection.Descending
+ End If
+ Dim objCommentController As New CommentController
+ Dim objComments As List(Of CommentInfo) = objCommentController.GetCommentList(objArticle.ModuleID, objArticle.ArticleID, True, direction, Null.NullInteger)
+
+ For Each objComment As CommentInfo In objComments
+ ProcessComment(phComments.Controls, objArticle, objComment, objLayoutCommentItem.Tokens)
+ Next
+
+ objPlaceHolder.Add(phComments)
+
+ Case "CREATEDATE"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objArticle.CreatedDate.ToString("D")
+ objPlaceHolder.Add(objLiteral)
+
+ Case "CREATETIME"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objArticle.CreatedDate.ToString("t")
+ objPlaceHolder.Add(objLiteral)
+
+ Case "CURRENTPAGE"
+ Dim objLiteral As New Literal
+ If (objArticle.PageCount <= 1) Then
+ objLiteral.Text = "1"
+ Else
+ Dim pageID As Integer = Null.NullInteger
+ If (Request("PageID") <> "" AndAlso IsNumeric(Request("PageID"))) Then
+ pageID = Convert.ToInt32(Request("PageID"))
+ End If
+ If (pageID = Null.NullInteger) Then
+ pageID = CType(Pages(objArticle.ArticleID)(0), PageInfo).PageID
+ End If
+ For i As Integer = 0 To Pages(objArticle.ArticleID).Count - 1
+ Dim objPage As PageInfo = CType(Pages(objArticle.ArticleID)(i), PageInfo)
+ If (pageID = objPage.PageID) Then
+ objLiteral.Text = (i + 1).ToString()
+ Exit For
+ End If
+ Next
+ If (objLiteral.Text = Null.NullString) Then
+ objLiteral.Text = "1"
+ End If
+ End If
+ objPlaceHolder.Add(objLiteral)
+
+ Case "CUSTOMFIELDS"
+ Dim objCustomFieldController As New CustomFieldController()
+ Dim objCustomFields As ArrayList = objCustomFieldController.List(objArticle.ModuleID)
+ Dim i As Integer = 0
+ For Each objCustomField As CustomFieldInfo In objCustomFields
+ If (objCustomField.IsVisible = True) Then
+ Dim objLiteral As New Literal
+ objLiteral.Text = GetFieldValue(objCustomField, objArticle, True) & " "
+ If (objLiteral.Text <> "") Then
+ objPlaceHolder.Add(objLiteral)
+ End If
+ i = i + 1
+ End If
+ Next
+
+ Case "DETAILS"
+ Dim objLiteral As New Literal
+ If (objArticle.PageCount > 0) Then
+ Dim pageID As Integer = Null.NullInteger
+ If (IsNumeric(Request("PageID"))) Then
+ pageID = Convert.ToInt32(Request("PageID"))
+ End If
+ If (pageID = Null.NullInteger) Then
+ objLiteral.Text = ProcessPostTokens(Server.HtmlDecode(objArticle.Body), objArticle, Generator, ArticleSettings)
+ Else
+ Dim pageController As New PageController
+ Dim pageList As ArrayList = pageController.GetPageList(objArticle.ArticleID)
+ For Each objPage As PageInfo In pageList
+ If (objPage.PageID = pageID) Then
+ objLiteral.Text = ProcessPostTokens(Server.HtmlDecode(objPage.PageText), objArticle, Generator, ArticleSettings)
+ Exit For
+ End If
+ Next
+ If (objLiteral.Text = Null.NullString) Then
+ objLiteral.Text = ProcessPostTokens(Server.HtmlDecode(objArticle.Body), objArticle, Generator, ArticleSettings)
+ End If
+ End If
+ End If
+ objPlaceHolder.Add(objLiteral)
+
+ Case "DETAILSDATA"
+ Dim objLiteral As New Literal
+ If (objArticle.PageCount > 0) Then
+ Dim pageID As Integer = Null.NullInteger
+ If (IsNumeric(Request("PageID"))) Then
+ pageID = Convert.ToInt32(Request("PageID"))
+ End If
+ If (pageID = Null.NullInteger) Then
+ objLiteral.Text = ""
+ Else
+ Dim pageController As New PageController
+ Dim pageList As ArrayList = pageController.GetPageList(objArticle.ArticleID)
+ For Each objPage As PageInfo In pageList
+ If (objPage.PageID = pageID) Then
+ objLiteral.Text = ""
+ Exit For
+ End If
+ Next
+ If (objLiteral.Text = Null.NullString) Then
+ objLiteral.Text = ""
+ End If
+ End If
+ End If
+ objPlaceHolder.Add(objLiteral)
+
+ Case "EDIT"
+ If IsEditable OrElse (ArticleSettings.IsApprover) OrElse (objArticle.AuthorID = UserId And ArticleSettings.IsAutoApprover) Then
+ Dim objHyperLink As New HyperLink
+ objHyperLink.NavigateUrl = Common.GetModuleLink(ArticleModule.TabID, ArticleModule.ModuleID, "SubmitNews", ArticleSettings, "ArticleID=" & objArticle.ArticleID.ToString(), "ReturnUrl=" & Server.UrlEncode(Request.RawUrl))
+ objHyperLink.ImageUrl = "~/images/edit.gif"
+ objHyperLink.ToolTip = "Click to edit"
+ objHyperLink.EnableViewState = False
+ objPlaceHolder.Add(objHyperLink)
+ End If
+
+ Case "FILECOUNT"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objArticle.FileCount.ToString()
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+
+ Case "FILELINK"
+ If (objArticle.FileCount > 0) Then
+ Dim objFiles As List(Of FileInfo) = FileProvider.Instance().GetFiles(objArticle.ArticleID)
+
+ If (objFiles.Count > 0) Then
+ Dim objLiteral As New Literal
+ objLiteral.Text = CType(objFiles(0), FileInfo).Link
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+ End If
+
+ End If
+
+ Case "FILES"
+ ' File Count Check
+ If (objArticle.FileCount > 0) Then
+ ' Dim objFileController As New FileController
+ Dim objFiles As List(Of FileInfo) = FileProvider.Instance().GetFiles(objArticle.ArticleID)
+
+ If (objFiles.Count > 0) Then
+ Dim objLayoutFileHeader As LayoutInfo = GetLayout(ArticleSettings, ArticleModule, Page, LayoutType.File_Header_Html)
+ Dim objLayoutFileItem As LayoutInfo = GetLayout(ArticleSettings, ArticleModule, Page, LayoutType.File_Item_Html)
+ Dim objLayoutFileFooter As LayoutInfo = GetLayout(ArticleSettings, ArticleModule, Page, LayoutType.File_Footer_Html)
+
+ ProcessHeaderFooter(objPlaceHolder, objLayoutFileHeader.Tokens, objArticle)
+ For Each objFile As FileInfo In objFiles
+ ProcessFile(objPlaceHolder, objArticle, objFile, objLayoutFileItem.Tokens)
+ Next
+ ProcessHeaderFooter(objPlaceHolder, objLayoutFileFooter.Tokens, objArticle)
+ End If
+ End If
+
+ Case "GRAVATARURL"
+ If (objArticle.AuthorEmail <> "") Then
+ Dim objLiteral As New Literal
+ If Request.IsSecureConnection Then
+ objLiteral.Text = AddHTTP("secure.gravatar.com/avatar/" & MD5CalcString(objArticle.AuthorEmail.ToLower()))
+ Else
+ objLiteral.Text = AddHTTP("www.gravatar.com/avatar/" & MD5CalcString(objArticle.AuthorEmail.ToLower()))
+ End If
+ objPlaceHolder.Add(objLiteral)
+ End If
+
+ Case "HASAUTHOR"
+ If (objArticle.AuthorID = Null.NullInteger) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/HASAUTHOR") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/HASAUTHOR"
+ ' Do Nothing
+
+ Case "HASNOAUTHOR"
+ If (objArticle.AuthorID <> Null.NullInteger) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/HASNOAUTHOR") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/HASNOAUTHOR"
+ ' Do Nothing
+
+ Case "HASCATEGORIES"
+ Dim objLiteral As New Literal
+ If (DataCache.GetCache(ArticleConstants.CACHE_CATEGORY_ARTICLE & objArticle.ArticleID.ToString()) Is Nothing) Then
+ Dim objArticleController As New ArticleController
+ Dim objArticleCategories As ArrayList = objArticleController.GetArticleCategories(objArticle.ArticleID)
+ For Each objCategory As CategoryInfo In objArticleCategories
+ If (objLiteral.Text <> "") Then
+ objLiteral.Text = objLiteral.Text & ", " & objCategory.Name & ""
+ Else
+ objLiteral.Text = " " & objCategory.Name & ""
+ End If
+ Next
+ DataCache.SetCache(ArticleConstants.CACHE_CATEGORY_ARTICLE & objArticle.ArticleID.ToString(), objArticleCategories)
+ Else
+ Dim objArticleCategories As ArrayList = CType(DataCache.GetCache(ArticleConstants.CACHE_CATEGORY_ARTICLE & objArticle.ArticleID.ToString()), ArrayList)
+ For Each objCategory As CategoryInfo In objArticleCategories
+ If (objLiteral.Text <> "") Then
+ objLiteral.Text = objLiteral.Text & ", " & objCategory.Name & ""
+ Else
+ objLiteral.Text = " " & objCategory.Name & ""
+ End If
+ Next
+ End If
+ If (objLiteral.Text = "") Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/HASCATEGORIES") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/HASCATEGORIES"
+ ' Do Nothing
+
+ Case "HASCOMMENTS"
+ If (objArticle.CommentCount = 0) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/HASCOMMENTS") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/HASCOMMENTS"
+ ' Do Nothing
+
+ Case "HASCOMMENTSENABLED"
+ If (ArticleSettings.IsCommentsEnabled = False) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/HASCOMMENTSENABLED") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/HASCOMMENTSENABLED"
+ ' Do Nothing
+
+ Case "HASCUSTOMFIELDS"
+ Dim objCustomFieldController As New CustomFieldController()
+ Dim objCustomFields As ArrayList = objCustomFieldController.List(objArticle.ModuleID)
+
+ If (objCustomFields.Count = 0) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/HASCUSTOMFIELDS") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/HASCUSTOMFIELDS"
+ ' Do Nothing
+
+ Case "HASDETAILS"
+ Dim objLiteral As New Literal
+ objLiteral.Text = ""
+ If (objArticle.PageCount > 0) Then
+ Dim pageID As Integer = Null.NullInteger
+ If (IsNumeric(Request("PageID"))) Then
+ pageID = Convert.ToInt32(Request("PageID"))
+ End If
+ If (pageID = Null.NullInteger) Then
+ objLiteral.Text = ProcessPostTokens(Server.HtmlDecode(objArticle.Body), objArticle, Generator, ArticleSettings)
+ Else
+ Dim pageController As New PageController
+ Dim pageList As ArrayList = pageController.GetPageList(objArticle.ArticleID)
+ For Each objPage As PageInfo In pageList
+ If (objPage.PageID = pageID) Then
+ objLiteral.Text = ProcessPostTokens(Server.HtmlDecode(objPage.PageText), objArticle, Generator, ArticleSettings)
+ Exit For
+ End If
+ Next
+ If (objLiteral.Text = Null.NullString) Then
+ objLiteral.Text = ProcessPostTokens(Server.HtmlDecode(objArticle.Body), objArticle, Generator, ArticleSettings)
+ End If
+ End If
+ End If
+
+ If (objLiteral.Text.Replace("
", "").Trim() = "") Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/HASDETAILS") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/HASDETAILS"
+ ' Do Nothing
+
+ Case "HASNODETAILS"
+ Dim objLiteral As New Literal
+ objLiteral.Text = ""
+ If (objArticle.PageCount > 0) Then
+ Dim pageId As Integer = Null.NullInteger
+ If (IsNumeric(Request("PageID"))) Then
+ pageId = Convert.ToInt32(Request("PageID"))
+ End If
+ If (pageId = Null.NullInteger) Then
+ objLiteral.Text = ProcessPostTokens(Server.HtmlDecode(objArticle.Body), objArticle, Generator, ArticleSettings)
+ Else
+ Dim pageController As New PageController
+ Dim pageList As ArrayList = pageController.GetPageList(objArticle.ArticleID)
+ For Each objPage As PageInfo In pageList
+ If (objPage.PageID = pageId) Then
+ objLiteral.Text = ProcessPostTokens(Server.HtmlDecode(objPage.PageText), objArticle, Generator, ArticleSettings)
+ Exit For
+ End If
+ Next
+ If (objLiteral.Text = Null.NullString) Then
+ objLiteral.Text = ProcessPostTokens(Server.HtmlDecode(objArticle.Body), objArticle, Generator, ArticleSettings)
+ End If
+ End If
+ End If
+
+ If (objLiteral.Text.Replace("
", "").Trim() <> "") Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/HASNODETAILS") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/HASNODETAILS"
+ ' Do Nothing
+
+ Case "HASFILES"
+ If (objArticle.FileCount = 0) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/HASFILES") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/HASFILES"
+ ' Do Nothing
+
+ Case "HASIMAGE"
+ If (objArticle.ImageUrl = "" And objArticle.ImageCount = 0) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/HASIMAGE") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/HASIMAGE"
+ ' Do Nothing
+
+ Case "HASIMAGES"
+ If (objArticle.ImageCount = 0) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/HASIMAGES") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/HASIMAGES"
+ ' Do Nothing
+
+ Case "HASLINK"
+ If (objArticle.Url = Null.NullString()) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/HASLINK") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/HASLINK"
+ ' Do Nothing
+
+ Case "HASMOREDETAIL"
+ If (objArticle.Url = Null.NullString() And StripHtml(objArticle.Summary.Trim()) = "") Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/HASMOREDETAIL") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/HASMOREDETAIL"
+ ' Do Nothing
+
+ Case "HASMULTIPLEIMAGES"
+ If (objArticle.ImageCount <= 1) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/HASMULTIPLEIMAGES") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/HASMULTIPLEIMAGES"
+ ' Do Nothing
+
+ Case "HASMULTIPLEPAGES"
+ If (objArticle.PageCount <= 1) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/HASMULTIPLEPAGES") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/HASMULTIPLEPAGES"
+ ' Do Nothing
+
+ Case "HASNEXTPAGE"
+ If (Pages(objArticle.ArticleID).Count <= 1) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/HASNEXTPAGE") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ Else
+ If (_pageId = Null.NullInteger) Then
+ _pageId = Pages(objArticle.ArticleID)(0).PageID
+ End If
+ If (_pageId = Pages(objArticle.ArticleID)(Pages(objArticle.ArticleID).Count - 1).PageID) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/HASNEXTPAGE") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+ End If
+ Case "/HASNEXTPAGE"
+ ' Do Nothing
+
+ Case "HASNOCOMMENTS"
+ If (objArticle.CommentCount > 0) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/HASNOCOMMENTS") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/HASNOCOMMENTS"
+ ' Do Nothing
+
+ Case "HASNOFILES"
+ If (objArticle.FileCount > 0) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/HASNOFILES") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/HASNOFILES"
+ ' Do Nothing
+
+ Case "HASNOIMAGE"
+ If (objArticle.ImageUrl <> "" Or objArticle.ImageCount > 0) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/HASNOIMAGE") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/HASNOIMAGE"
+ ' Do Nothing
+
+ Case "HASNOIMAGES"
+ If (objArticle.ImageCount > 0) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/HASNOIMAGES") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/HASNOIMAGES"
+ ' Do Nothing
+
+ Case "HASNOLINK"
+ If (objArticle.Url <> Null.NullString()) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/HASNOLINK") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/HASNOLINK"
+ ' Do Nothing
+
+ Case "HASPREVPAGE"
+ If (objArticle.PageCount <= 1) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/HASPREVPAGE") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ Else
+ If (_pageId = Null.NullInteger) Then
+ _pageId = Pages(objArticle.ArticleID)(0).PageID
+ End If
+ If (_pageId = Pages(objArticle.ArticleID)(0).PageID) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/HASPREVPAGE") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+ End If
+ Case "/HASPREVPAGE"
+ ' Do Nothing
+
+ Case "HASRATING"
+ If (ArticleSettings.EnableRatings = False OrElse objArticle.RatingCount = 0) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/HASRATING") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/HASRATING"
+ ' Do Nothing
+
+ Case "HASRATINGSENABLED"
+ If (ArticleSettings.EnableRatings = False) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/HASRATINGSENABLED") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/HASRATINGSENABLED"
+ ' Do Nothing
+
+ Case "HASRELATED"
+ Dim objRelatedArticles As List(Of ArticleInfo) = GetRelatedArticles(objArticle, 5)
+ If (objRelatedArticles.Count = 0) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/HASRELATED") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/HASRELATED"
+ ' Do Nothing
+
+ Case "HASSUMMARY"
+ If (StripHtml(objArticle.Summary.Trim()) = "") Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/HASSUMMARY") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/HASSUMMARY"
+ ' Do Nothing
+
+ Case "HASNOSUMMARY"
+ If (StripHtml(objArticle.Summary.Trim()) <> "") Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/HASNOSUMMARY") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/HASNOSUMMARY"
+ ' Do Nothing
+
+ Case "HASTAGS"
+ If (objArticle.Tags = "") Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/HASTAGS") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/HASTAGS"
+ ' Do Nothing
+
+ Case "HASNOTAGS"
+ If (objArticle.Tags <> "") Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/HASNOTAGS") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/HASNOTAGS"
+ ' Do Nothing
+
+ Case "IMAGE"
+ If (objArticle.ImageUrl <> "") Then
+ Dim objImage As New Image
+ objImage.ImageUrl = FormatImageUrl(objArticle.ImageUrl)
+ objImage.EnableViewState = False
+ objImage.AlternateText = objArticle.Title
+ objPlaceHolder.Add(objImage)
+ Else
+ If (objArticle.ImageCount > 0) Then
+ Dim objImageController As New ImageController
+ Dim objImages As List(Of ImageInfo) = objImageController.GetImageList(objArticle.ArticleID, Null.NullString())
+
+ If (objImages.Count > 0) Then
+ Dim objImage As New Image
+ objImage.ImageUrl = PortalSettings.HomeDirectory & objImages(0).Folder & objImages(0).FileName
+ objImage.EnableViewState = False
+ objImage.AlternateText = objArticle.Title
+ objPlaceHolder.Add(objImage)
+ End If
+
+ End If
+ End If
+
+ Case "IMAGECOUNT"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objArticle.ImageCount.ToString()
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+
+ Case "IMAGELINK"
+ If (objArticle.ImageUrl <> "") Then
+ Dim objLiteral As New Literal
+ objLiteral.Text = FormatImageUrl(objArticle.ImageUrl)
+ objPlaceHolder.Add(objLiteral)
+ Else
+ Dim objImageController As New ImageController
+ Dim objImages As List(Of ImageInfo) = objImageController.GetImageList(objArticle.ArticleID, Null.NullString())
+
+ If (objImages.Count > 0) Then
+ Dim objLiteral As New Literal
+ objLiteral.Text = PortalSettings.HomeDirectory & objImages(0).Folder & objImages(0).FileName
+ objPlaceHolder.Add(objLiteral)
+ End If
+ End If
+
+ Case "IMAGES"
+
+ ' Image Count Check
+ If (objArticle.ImageCount > 0) Then
+ imageIndex = 0
+
+ Dim objImageController As New ImageController
+ Dim objImages As List(Of ImageInfo) = objImageController.GetImageList(objArticle.ArticleID, Null.NullString())
+
+ If (objImages.Count > 0) Then
+ Dim objLayoutImageHeader As LayoutInfo = GetLayout(ArticleSettings, ArticleModule, Page, LayoutType.Image_Header_Html)
+ Dim objLayoutImageItem As LayoutInfo = GetLayout(ArticleSettings, ArticleModule, Page, LayoutType.Image_Item_Html)
+ Dim objLayoutImageFooter As LayoutInfo = GetLayout(ArticleSettings, ArticleModule, Page, LayoutType.Image_Footer_Html)
+
+ ProcessHeaderFooter(objPlaceHolder, objLayoutImageHeader.Tokens, objArticle)
+ For Each objImage As ImageInfo In objImages
+ ProcessImage(objPlaceHolder, objArticle, objImage, objLayoutImageItem.Tokens)
+ Next
+ ProcessHeaderFooter(objPlaceHolder, objLayoutImageFooter.Tokens, objArticle)
+ End If
+
+ 'Dim script As String = "" _
+ '& "" & vbCrLf
+
+ 'Dim objScript As New Literal
+ 'objScript.Text = script
+ 'objPlaceHolder.AddAt(0, objScript)
+ End If
+
+ Case "ISAUTHOR"
+ Dim isAuthor As Boolean = False
+
+ If (Request.IsAuthenticated) Then
+ Dim objUser As UserInfo = UserController.GetCurrentUserInfo()
+ If (objUser IsNot Nothing) Then
+ If (objUser.UserID = objArticle.AuthorID) Then
+ isAuthor = True
+ End If
+ End If
+ End If
+
+ If (isAuthor = False) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/ISAUTHOR") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/ISAUTHOR"
+ ' Do Nothing
+
+ Case "ISANONYMOUS"
+ If (Request.IsAuthenticated) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/ISANONYMOUS") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/ISANONYMOUS"
+ ' Do Nothing
+
+ Case "ISDRAFT"
+ If (objArticle.Status <> StatusType.Draft) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/ISDRAFT") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/ISDRAFT"
+ ' Do Nothing
+
+ Case "ISFEATURED"
+ If (objArticle.IsFeatured = False) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/ISFEATURED") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/ISFEATURED"
+ ' Do Nothing
+
+ Case "ISNOTFEATURED"
+ If (objArticle.IsFeatured) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/ISNOTFEATURED") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/ISNOTFEATURED"
+ ' Do Nothing
+
+ Case "ISFIRST"
+ If (articleItemIndex > 1) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/ISFIRST") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/ISFIRST"
+ ' Do Nothing
+
+ Case "ISFIRST2"
+ If (articleItemIndex > 1 Or (Request("currentpage") <> "" And Request("currentpage") <> "1")) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/ISFIRST2") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/ISFIRST2"
+ ' Do Nothing
+
+ Case "ISNOTFIRST"
+ If (articleItemIndex = 1) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/ISNOTFIRST") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/ISNOTFIRST"
+ ' Do Nothing
+
+ Case "ISNOTFIRST2"
+ If (articleItemIndex = 1 And (Request("currentpage") = "" Or Request("currentpage") = "1")) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/ISNOTFIRST2") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/ISNOTFIRST2"
+ ' Do Nothing
+
+ Case "ISSECOND"
+ If (articleItemIndex <> 2) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/ISSECOND") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/ISSECOND"
+ ' Do Nothing
+
+ Case "ISNOTSECOND"
+ If (articleItemIndex = 2) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/ISNOTSECOND") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/ISNOTSECOND"
+ ' Do Nothing
+
+ Case "ISNOTANONYMOUS"
+ If (Request.IsAuthenticated = False) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/ISNOTANONYMOUS") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/ISNOTANONYMOUS"
+ ' Do Nothing
+
+ Case "ISNOTSECURE"
+ If (objArticle.IsSecure) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/ISNOTSECURE") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/ISNOTSECURE"
+ ' Do Nothing
+
+ Case "ISPUBLISHED"
+ If (objArticle.Status <> StatusType.Published) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/ISPUBLISHED") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/ISPUBLISHED"
+ ' Do Nothing
+
+ Case "ISRATEABLE"
+ If (ArticleSettings.IsRateable = False) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/ISRATEABLE") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/ISRATEABLE"
+ ' Do Nothing
+
+ Case "ISRSSITEM"
+ If (objArticle.RssGuid = Null.NullString) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/ISRSSITEM") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/ISRSSITEM"
+ ' Do Nothing
+
+ Case "ISNOTRSSITEM"
+ If (objArticle.RssGuid <> Null.NullString) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/ISNOTRSSITEM") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/ISNOTRSSITEM"
+ ' Do Nothing
+
+ Case "ISSECURE"
+ If (objArticle.IsSecure = False) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/ISSECURE") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/ISSECURE"
+ ' Do Nothing
+
+ Case "ISSYNDICATIONENABLED"
+ If (ArticleSettings.IsSyndicationEnabled = False) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/ISSYNDICATIONENABLED") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/ISSYNDICATIONENABLED"
+ ' Do Nothing
+
+ Case "ITEMINDEX"
+ Dim objLiteral As New Literal
+ objLiteral.Text = articleItemIndex.ToString()
+ objPlaceHolder.Add(objLiteral)
+
+ Case "LASTUPDATEDATE"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objArticle.LastUpdate.ToString("D")
+ objPlaceHolder.Add(objLiteral)
+
+ Case "LASTUPDATEEMAIL"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objArticle.LastUpdateEmail.ToString()
+ objPlaceHolder.Add(objLiteral)
+
+ Case "LASTUPDATEFIRSTNAME"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objArticle.LastUpdateFirstName.ToString()
+ objPlaceHolder.Add(objLiteral)
+
+ Case "LASTUPDATELASTNAME"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objArticle.LastUpdateLastName.ToString()
+ objPlaceHolder.Add(objLiteral)
+
+ Case "LASTUPDATEUSERNAME"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objArticle.LastUpdateUserName.ToString()
+ objPlaceHolder.Add(objLiteral)
+
+ Case "LASTUPDATEFULLNAME"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objArticle.LastUpdateFullName.ToString()
+ objPlaceHolder.Add(objLiteral)
+
+ Case "LASTUPDATEID"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objArticle.LastUpdateID.ToString()
+ objPlaceHolder.Add(objLiteral)
+
+ Case "LINK"
+ Dim objLiteral As New Literal
+ If objArticle.Url = "" Then
+ Dim pageID As Integer = Null.NullInteger
+ If (ArticleSettings.AlwaysShowPageID) Then
+ If (Pages(objArticle.ArticleID).Count > 0) Then
+ pageID = CType(Pages(objArticle.ArticleID)(0), PageInfo).PageID
+ End If
+ End If
+ objLiteral.Text = Common.GetArticleLink(objArticle, Tab, ArticleSettings, IncludeCategory, pageID)
+ Else
+ objLiteral.Text = Globals.LinkClick(objArticle.Url, Tab.TabID, objArticle.ModuleID, False)
+ End If
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+
+ Case "LINKNEXT"
+ Dim objLink As New HyperLink
+ objLink.CssClass = "CommandButton"
+ If (Pages(objArticle.ArticleID).Count <= 1) Then
+ objLink.Enabled = False
+ Else
+ If (_pageId = Null.NullInteger) Then
+ _pageId = CType(Pages(objArticle.ArticleID)(0), PageInfo).PageID
+ End If
+ If (_pageId = CType(Pages(objArticle.ArticleID)(Pages(objArticle.ArticleID).Count - 1), PageInfo).PageID) Then
+ objLink.Enabled = False
+ Else
+ objLink.Enabled = True
+ End If
+ End If
+ If (objLink.Enabled = True) Then
+ If (_pageId = Null.NullInteger) Then
+ _pageId = CType(Pages(objArticle.ArticleID)(0), PageInfo).PageID
+ End If
+ For i As Integer = 0 To Pages(objArticle.ArticleID).Count - 1
+ Dim objPage As PageInfo = CType(Pages(objArticle.ArticleID)(i), PageInfo)
+ If (_pageId = objPage.PageID) Then
+ objLink.NavigateUrl = Common.GetArticleLink(objArticle, Tab, ArticleSettings, IncludeCategory, "PageID=" + CType(Pages(objArticle.ArticleID)(i + 1), PageInfo).PageID.ToString())
+ End If
+ Next
+ End If
+ objLink.Text = GetSharedResource("NextPage")
+ objPlaceHolder.Add(objLink)
+
+ Case "LINKPREVIOUS"
+ Dim objLink As New HyperLink
+ objLink.CssClass = "CommandButton"
+ If (Pages(objArticle.ArticleID).Count <= 1) Then
+ objLink.Enabled = False
+ Else
+ If (_pageId = Null.NullInteger) Then
+ _pageId = CType(Pages(objArticle.ArticleID)(0), PageInfo).PageID
+ End If
+ If (_pageId = CType(Pages(objArticle.ArticleID)(0), PageInfo).PageID) Then
+ objLink.Enabled = False
+ Else
+ objLink.Enabled = True
+ End If
+ End If
+ If (objLink.Enabled = True) Then
+ For i As Integer = 0 To Pages(objArticle.ArticleID).Count - 1
+ Dim objPage As PageInfo = CType(Pages(objArticle.ArticleID)(i), PageInfo)
+ If (_pageId = objPage.PageID) Then
+ If (CType(Pages(objArticle.ArticleID)(i - 1), PageInfo).PageID.ToString() = CType(Pages(objArticle.ArticleID)(0), PageInfo).PageID.ToString()) Then
+ objLink.NavigateUrl = Common.GetArticleLink(objArticle, Tab, ArticleSettings, IncludeCategory)
+ Else
+ objLink.NavigateUrl = Common.GetArticleLink(objArticle, Tab, ArticleSettings, IncludeCategory, "PageID=" + CType(Pages(objArticle.ArticleID)(i - 1), PageInfo).PageID.ToString())
+ End If
+ Exit For
+ End If
+ Next
+ End If
+ objLink.Text = GetSharedResource("PreviousPage")
+ objPlaceHolder.Add(objLink)
+
+ Case "LINKTARGET"
+ If (objArticle.Url <> "") Then
+ Dim objLiteral As New Literal
+ If (objArticle.IsNewWindow) Then
+ objLiteral.Text = "_blank"
+ Else
+ objLiteral.Text = "_self"
+ End If
+ objPlaceHolder.Add(objLiteral)
+ End If
+
+ Case "MODULEID"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objArticle.ModuleID.ToString()
+ objPlaceHolder.Add(objLiteral)
+
+ Case "PAGECOUNT"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objArticle.PageCount.ToString()
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+
+ Case "PAGETEXT"
+ Dim objLiteral As New Literal
+ If (objArticle.PageCount > 0) Then
+ Dim pageID As Integer = Null.NullInteger
+ If (IsNumeric(Request("PageID"))) Then
+ pageID = Convert.ToInt32(Request("PageID"))
+ End If
+ If (pageID = Null.NullInteger) Then
+ objLiteral.Text = ProcessPostTokens(Server.HtmlDecode(objArticle.Body), objArticle, Generator, ArticleSettings)
+ Else
+ Dim pageController As New PageController
+ Dim pageList As ArrayList = pageController.GetPageList(objArticle.ArticleID)
+ For Each objPage As PageInfo In pageList
+ If (objPage.PageID = pageID) Then
+ objLiteral.Text = ProcessPostTokens(Server.HtmlDecode(objPage.PageText), objArticle, Generator, ArticleSettings)
+ Exit For
+ End If
+ Next
+ If (objLiteral.Text = Null.NullString) Then
+ objLiteral.Text = ProcessPostTokens(Server.HtmlDecode(objArticle.Body), objArticle, Generator, ArticleSettings)
+ End If
+ End If
+ Else
+ objLiteral.Text = ProcessPostTokens(Server.HtmlDecode(objArticle.Summary), objArticle, Generator, ArticleSettings)
+ End If
+ objPlaceHolder.Add(objLiteral)
+
+ Case "PAGETITLE"
+ Dim objLiteral As New Literal
+ If (objArticle.PageCount > 0) Then
+ Dim pageController As New PageController
+ Dim pageList As ArrayList = pageController.GetPageList(objArticle.ArticleID)
+ Dim pageID As Integer = Null.NullInteger
+ If (IsNumeric(Request("PageID"))) Then
+ pageID = Convert.ToInt32(Request("PageID"))
+ End If
+ If (pageID = Null.NullInteger) Then
+ objLiteral.Text = CType(pageList(0), PageInfo).Title
+ Else
+ For Each objPage As PageInfo In pageList
+ If (objPage.PageID = pageID) Then
+ objLiteral.Text = objPage.Title
+ Exit For
+ End If
+ Next
+ If (objLiteral.Text = Null.NullString) Then
+ objLiteral.Text = CType(pageList(0), PageInfo).Title
+ End If
+ End If
+ Else
+ objLiteral.Text = objArticle.Title
+ End If
+ objPlaceHolder.Add(objLiteral)
+
+ Case "PAGETITLENEXT"
+ Dim objLiteral As New Literal
+ If (Pages(objArticle.ArticleID).Count <= 1) Then
+ objLiteral.Visible = False
+ Else
+ If (_pageId = Null.NullInteger) Then
+ _pageId = CType(Pages(objArticle.ArticleID)(0), PageInfo).PageID
+ End If
+ If (_pageId = CType(Pages(objArticle.ArticleID)(Pages(objArticle.ArticleID).Count - 1), PageInfo).PageID) Then
+ objLiteral.Visible = False
+ Else
+ objLiteral.Visible = True
+ End If
+ End If
+ If (objLiteral.Visible = True) Then
+ If (_pageId = Null.NullInteger) Then
+ _pageId = CType(Pages(objArticle.ArticleID)(0), PageInfo).PageID
+ End If
+ For i As Integer = 0 To Pages(objArticle.ArticleID).Count - 1
+ Dim objPage As PageInfo = CType(Pages(objArticle.ArticleID)(i), PageInfo)
+ If (_pageId = objPage.PageID) Then
+ objLiteral.Text = CType(Pages(objArticle.ArticleID)(i + 1), PageInfo).Title
+ End If
+ Next
+ End If
+ If (objLiteral.Visible = True And objLiteral.Text <> "") Then
+ objPlaceHolder.Add(objLiteral)
+ End If
+
+ Case "PAGETITLEPREV"
+ Dim objLiteral As New Literal
+ If (Pages(objArticle.ArticleID).Count <= 1) Then
+ objLiteral.Visible = False
+ Else
+ If (_pageId = Null.NullInteger) Then
+ _pageId = CType(Pages(objArticle.ArticleID)(0), PageInfo).PageID
+ End If
+ If (_pageId = CType(Pages(objArticle.ArticleID)(0), PageInfo).PageID) Then
+ objLiteral.Visible = False
+ Else
+ objLiteral.Visible = True
+ End If
+ End If
+ If (objLiteral.Visible = True) Then
+ For i As Integer = 0 To Pages(objArticle.ArticleID).Count - 1
+ Dim objPage As PageInfo = CType(Pages(objArticle.ArticleID)(i), PageInfo)
+ If (_pageId = objPage.PageID) Then
+ If (CType(Pages(objArticle.ArticleID)(i - 1), PageInfo).PageID.ToString() = CType(Pages(objArticle.ArticleID)(0), PageInfo).PageID.ToString()) Then
+ objLiteral.Text = objArticle.Title
+ Else
+ objLiteral.Text = CType(Pages(objArticle.ArticleID)(i - 1), PageInfo).Title
+ End If
+ Exit For
+ End If
+ Next
+ End If
+ If (objLiteral.Visible And objLiteral.Text <> "") Then
+ objPlaceHolder.Add(objLiteral)
+ End If
+
+
+ Case "PAGES"
+ Dim drpPages As New DropDownList
+ Dim pageController As New PageController
+ Dim pageList As ArrayList = pageController.GetPageList(objArticle.ArticleID)
+ drpPages.Attributes.Add("onChange", "window.location.href=this.options[this.selectedIndex].value;")
+ drpPages.CssClass = "Normal"
+ Dim pageID As Integer = Null.NullInteger
+ If (IsNumeric(Request("PageID"))) Then
+ pageID = Convert.ToInt32(Request("PageID"))
+ End If
+ For Each objPage As PageInfo In pageList
+ Dim item As New ListItem
+
+ item.Value = Common.GetModuleLink(ArticleModule.TabID, ArticleModule.ModuleID, "ArticleView", ArticleSettings, "ArticleID=" & objArticle.ArticleID.ToString(), "PageID=" + objPage.PageID.ToString())
+ item.Text = objPage.Title
+
+ If (objPage.PageID = pageID) Then
+ item.Selected = True
+ End If
+ drpPages.Items.Add(item)
+ Next
+ If (drpPages.Items.Count > 1) Then
+ objPlaceHolder.Add(drpPages)
+ End If
+
+ Case "PAGER"
+
+ Dim pageController As New PageController
+ Dim pageList As ArrayList = pageController.GetPageList(objArticle.ArticleID)
+
+ Dim pageID As Integer = Null.NullInteger
+ If (IsNumeric(Request("PageID"))) Then
+ pageID = Convert.ToInt32(Request("PageID"))
+ End If
+
+ Dim pager As String = "" _
+ & "
" _
+ & "" _
+ & "
"
+
+ Dim pageNo As Integer = 1
+
+ Dim y As Integer = 1
+ For Each objPage As PageInfo In pageList
+ If (objPage.PageID = pageID) Then
+ pageNo = y
+ Exit For
+ End If
+ y = y + 1
+ Next
+
+ pager = pager & "
"
+
+ If (pageList.Count > 1) Then
+ If (pageNo = 1) Then
+ pager = pager & "" & GetSharedResource("First") & " "
+ Else
+ pager = pager & "" & GetSharedResource("First") & " "
+ End If
+ Else
+ pager = pager & "" & GetSharedResource("First") & " "
+ End If
+
+ If (pageList.Count > 1) Then
+ If (pageNo = 1) Then
+ pager = pager & "" & GetSharedResource("Previous") & " "
+ Else
+ Dim x As Integer = 0
+ For Each objPage As PageInfo In pageList
+ If (objPage.PageID = pageID) Then
+ pager = pager & "" & GetSharedResource("Previous") & " "
+ Exit For
+ End If
+ x = x + 1
+ Next
+ End If
+ Else
+ pager = pager & "" & GetSharedResource("Previous") & " "
+ End If
+
+ Dim i As Integer = 1
+ For Each objPage As PageInfo In pageList
+ If (objPage.PageID = pageID Or (pageID = Null.NullInteger And i = 1)) Then
+ pager = pager & "" & i.ToString() & " "
+ Else
+ pager = pager & "" & i.ToString() & " "
+ End If
+ i = i + 1
+ Next
+
+ If (pageList.Count > 1) Then
+ If (pageID <> Null.NullInteger) Then
+ If (CType(pageList(pageList.Count - 1), PageInfo).PageID = pageID) Then
+ pager = pager & "" & GetSharedResource("Next") & " "
+ Else
+ Dim x As Integer = 0
+ For Each objPage As PageInfo In pageList
+ If (objPage.PageID = pageID) Then
+ pager = pager & "" & GetSharedResource("Next") & " "
+ Exit For
+ End If
+ x = x + 1
+ Next
+ End If
+ Else
+ pager = pager & "" & GetSharedResource("Next") & " "
+ End If
+ Else
+ pager = pager & "" & GetSharedResource("Next") & " "
+ End If
+
+ If (pageList.Count > 1) Then
+ If (CType(pageList(pageList.Count - 1), PageInfo).PageID = pageID) Then
+ pager = pager & "" & GetSharedResource("Last") & " "
+ Else
+ pager = pager & "" & GetSharedResource("Last") & " "
+ End If
+ Else
+ pager = pager & "" & GetSharedResource("Last") & " "
+ End If
+
+ pager = pager & "" _
+ & "
" _
+ & "
" _
+ & "" _
+ & "
"
+
+ Dim objLiteral As New Literal
+ objLiteral.Text = pager
+ objPlaceHolder.Add(objLiteral)
+
+ Case "PAGESLIST"
+ Dim pages As String = ""
+ Dim pageController As New PageController
+ Dim pageList As ArrayList = pageController.GetPageList(objArticle.ArticleID)
+ Dim pageID As Integer = Null.NullInteger
+ If (IsNumeric(Request("PageID"))) Then
+ pageID = Convert.ToInt32(Request("PageID"))
+ End If
+
+ pages = "
"
+ For Each objPage As PageInfo In pageList
+ pages = pages & "
"
+
+ If (pageList.Count > 1) Then
+ Dim objLiteral As New Literal
+ objLiteral.Text = pages
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+ End If
+
+ Case "PAGESLIST2"
+ Dim pages As String = ""
+ Dim pageController As New PageController
+ Dim pageList As ArrayList = pageController.GetPageList(objArticle.ArticleID)
+ Dim pageID As Integer = Null.NullInteger
+ If (IsNumeric(Request("PageID"))) Then
+ pageID = Convert.ToInt32(Request("PageID"))
+ End If
+
+ pages = "
"
+ Dim isFirst As Boolean = True
+ For Each objPage As PageInfo In pageList
+ If (pageID = objPage.PageID Or (pageID = Null.NullInteger And isFirst)) Then
+ pages = pages & "
"
+ End If
+ isFirst = False
+ Next
+ pages = pages & "
"
+
+ If (pageList.Count > 1) Then
+ Dim objLiteral As New Literal
+ objLiteral.Text = pages
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+ End If
+
+ Case "PORTALROOT"
+ Dim objLiteral As New Literal
+ objLiteral.Text = PortalSettings.HomeDirectory
+ objPlaceHolder.Add(objLiteral)
+
+ Case "POSTCOMMENT"
+ If (ArticleSettings.IsCommentsEnabled) Then
+ Dim objControl As Control = Page.LoadControl("~/DesktopModules/DnnForge - NewsArticles/Controls/PostComment.ascx")
+ CType(objControl, NewsArticleControlBase).ArticleID = objArticle.ArticleID
+ objPlaceHolder.Add(objControl)
+ End If
+
+ Case "POSTRATING"
+ Dim objControl As Control = Page.LoadControl("~/DesktopModules/DnnForge - NewsArticles/Controls/PostRating.ascx")
+ objPlaceHolder.Add(objControl)
+
+ Case "PRINT"
+ Dim objHyperLink As New HyperLink
+ If (_pageId <> Null.NullInteger) Then
+ objHyperLink.NavigateUrl = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Print.aspx?tabid=" & ArticleModule.TabID.ToString() & "&tabmoduleid=" & ArticleModule.TabModuleID.ToString() & "&articleId=" & objArticle.ArticleID.ToString() & "&moduleId=" & objArticle.ModuleID.ToString() & "&PortalID=" & PortalSettings.PortalId.ToString() & "&PageID=" & _pageId.ToString())
+ Else
+ objHyperLink.NavigateUrl = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Print.aspx?tabid=" & ArticleModule.TabID.ToString() & "&tabmoduleid=" & ArticleModule.TabModuleID.ToString() & "&articleId=" & objArticle.ArticleID.ToString() & "&moduleId=" & objArticle.ModuleID.ToString() & "&PortalID=" & PortalSettings.PortalId.ToString())
+ End If
+ objHyperLink.ImageUrl = "~/images/print.gif"
+ objHyperLink.ToolTip = GetArticleResource("ClickPrint")
+ objHyperLink.EnableViewState = False
+ objHyperLink.Target = "_blank"
+ objHyperLink.Attributes.Add("rel", "nofollow")
+ objPlaceHolder.Add(objHyperLink)
+
+ Case "PRINTLINK"
+ Dim objLiteral As New Literal
+ If (_pageId <> Null.NullInteger) Then
+ objLiteral.Text = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Print.aspx?tabid=" & ArticleModule.TabID.ToString() & "&tabmoduleid=" & ArticleModule.TabModuleID.ToString() & "&articleId=" & objArticle.ArticleID.ToString() & "&moduleId=" & objArticle.ModuleID.ToString() & "&PortalID=" & PortalSettings.PortalId.ToString() & "&PageID=" & _pageId.ToString())
+ Else
+ objLiteral.Text = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Print.aspx?tabid=" & ArticleModule.TabID.ToString() & "&tabmoduleid=" & ArticleModule.TabModuleID.ToString() & "&articleId=" & objArticle.ArticleID.ToString() & "&moduleId=" & objArticle.ModuleID.ToString() & "&PortalID=" & PortalSettings.PortalId.ToString())
+ End If
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+
+ Case "PUBLISHDATE"
+ Dim objLiteral As New Literal
+ If (objArticle.StartDate = Null.NullDate) Then
+ objLiteral.Text = objArticle.CreatedDate.ToString("D")
+ Else
+ objLiteral.Text = objArticle.StartDate.ToString("D")
+ End If
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+
+ Case "PUBLISHSTARTDATE"
+ Dim objLiteral As New Literal
+ If (objArticle.StartDate = Null.NullDate) Then
+ objLiteral.Text = objArticle.CreatedDate.ToString("D")
+ Else
+ objLiteral.Text = objArticle.StartDate.ToString("D")
+ End If
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+
+ Case "PUBLISHTIME"
+ Dim objLiteral As New Literal
+ If (objArticle.StartDate = Null.NullDate) Then
+ objLiteral.Text = objArticle.CreatedDate.ToString("t")
+ Else
+ objLiteral.Text = objArticle.StartDate.ToString("t")
+ End If
+ objLiteral.EnableViewState = False
+
+ Case "PUBLISHSTARTTIME"
+ Dim objLiteral As New Literal
+ If (objArticle.StartDate = Null.NullDate) Then
+ objLiteral.Text = objArticle.CreatedDate.ToString("t")
+ Else
+ objLiteral.Text = objArticle.StartDate.ToString("t")
+ End If
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+
+ Case "PUBLISHENDDATE"
+ Dim objLiteral As New Literal
+ If (objArticle.EndDate = Null.NullDate) Then
+ objLiteral.Text = ""
+ Else
+ objLiteral.Text = objArticle.EndDate.ToString("D")
+ End If
+ objPlaceHolder.Add(objLiteral)
+
+ Case "PUBLISHENDTIME"
+ Dim objLiteral As New Literal
+ If (objArticle.EndDate = Null.NullDate) Then
+ objLiteral.Text = ""
+ Else
+ objLiteral.Text = objArticle.EndDate.ToString("t")
+ End If
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+
+ Case "RATING"
+ Dim objImage As New Image
+ objImage.ImageUrl = GetRatingImage(objArticle)
+ objImage.EnableViewState = False
+ objImage.ToolTip = "Article Rating"
+ objImage.AlternateText = "Article Rating"
+ objPlaceHolder.Add(objImage)
+
+ Case "RATINGCOUNT"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objArticle.RatingCount.ToString()
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+
+ Case "RATINGDETAIL"
+ If (objArticle.Rating <> Null.NullDouble) Then
+ Dim objLiteral As New Literal
+ objLiteral.Text = objArticle.Rating.ToString("R1")
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+ End If
+
+ Case "RELATED"
+ If (ArticleSettings.RelatedMode <> RelatedType.None) Then
+ Dim phRelated As New PlaceHolder
+
+ Dim objArticles As List(Of ArticleInfo) = GetRelatedArticles(objArticle, 5)
+
+ If (objArticles.Count > 0) Then
+ Dim _objLayoutRelatedHeader As LayoutInfo = GetLayout(ArticleSettings, ArticleModule, Page, LayoutType.Related_Header_Html)
+ Dim _objLayoutRelatedItem As LayoutInfo = GetLayout(ArticleSettings, ArticleModule, Page, LayoutType.Related_Item_Html)
+ Dim _objLayoutRelatedFooter As LayoutInfo = GetLayout(ArticleSettings, ArticleModule, Page, LayoutType.Related_Footer_Html)
+
+ ProcessArticleItem(phRelated.Controls, _objLayoutRelatedHeader.Tokens, objArticle)
+ For Each objRelatedArticle As ArticleInfo In objArticles
+ ProcessArticleItem(phRelated.Controls, _objLayoutRelatedItem.Tokens, objRelatedArticle)
+ Next
+ ProcessArticleItem(phRelated.Controls, _objLayoutRelatedFooter.Tokens, objArticle)
+
+ objPlaceHolder.Add(phRelated)
+ End If
+ End If
+
+ Case "SITEROOT"
+ Dim objLiteral As New Literal
+ objLiteral.Text = ArticleUtilities.ResolveUrl("~/")
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+
+ Case "SITETITLE"
+ Dim objLiteral As New Literal
+ objLiteral.Text = PortalSettings.PortalName
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+
+ Case "SHORTLINK"
+ If (objArticle.ShortUrl <> "") Then
+ Dim objLiteral As New Literal
+ objLiteral.Text = objArticle.ShortUrl
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+ Else
+ If (ArticleSettings.TwitterBitLyAPIKey <> "" And ArticleSettings.TwitterBitLyLogin <> "") Then
+ Dim link As String = Common.GetArticleLink(objArticle, Tab, ArticleSettings, False)
+ Dim b As New bitly(ArticleSettings.TwitterBitLyLogin, ArticleSettings.TwitterBitLyAPIKey)
+ Dim shortUrl As String = b.Shorten(link)
+
+ If (shortUrl <> "") Then
+ Dim objLiteral As New Literal
+ objLiteral.Text = shortUrl
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+
+ objArticle.ShortUrl = shortUrl
+ Dim objArticleController As New ArticleController()
+ objArticleController.UpdateArticle(objArticle)
+ End If
+ End If
+ End If
+
+ Case "SUMMARY"
+ Dim objLiteral As New Literal
+ objLiteral.Text = ProcessPostTokens(Server.HtmlDecode(objArticle.Summary), objArticle, Generator, ArticleSettings)
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+
+ Case "TABID"
+ Dim objLiteral As New Literal
+ objLiteral.Text = ArticleModule.TabID.ToString()
+ objPlaceHolder.Add(objLiteral)
+
+ Case "TABTITLE"
+ Dim objLiteral As New Literal
+ If (PortalSettings.ActiveTab.Title.Length = 0) Then
+ objLiteral.Text = PortalSettings.ActiveTab.TabName
+ Else
+ objLiteral.Text = PortalSettings.ActiveTab.Title
+ End If
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+
+ Case "TAGS"
+ If (objArticle.Tags.Trim() <> "") Then
+ Dim objLiteral As New Literal
+ For Each tag As String In objArticle.Tags.Split(","c)
+ If (objLiteral.Text = "") Then
+ objLiteral.Text = "" + tag + ""
+ Else
+ objLiteral.Text = objLiteral.Text + ", " + "" + tag + ""
+ End If
+ Next
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+ End If
+
+ Case "TAGSNOLINK"
+ If (objArticle.Tags.Trim() <> "") Then
+ Dim objLiteral As New Literal
+ For Each tag As String In objArticle.Tags.Split(","c)
+ If (objLiteral.Text = "") Then
+ objLiteral.Text = tag
+ Else
+ objLiteral.Text = objLiteral.Text + ", " + tag
+ End If
+ Next
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+ End If
+
+ Case "TEMPLATEPATH"
+ Dim objLiteral As New Literal
+ objLiteral.Text = ArticleUtilities.ResolveUrl("~/DnnForge - NewsArticles/Templates/" & ArticleSettings.Template & "/")
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+
+ Case "TITLE"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objArticle.Title
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+
+ Case "TITLESAFEJS"
+ If (objArticle.Title <> "") Then
+ Dim objLiteral As New Literal
+ objLiteral.Text = objArticle.Title.Replace("""", "")
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+ End If
+
+ Case "TITLEURLENCODED"
+ Dim objLiteral As New Literal
+ objLiteral.Text = Server.UrlEncode(objArticle.Title)
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+
+ Case "TWITTERNAME"
+ Dim objLiteral As New Literal
+ objLiteral.Text = ArticleSettings.TwitterName
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+
+ Case "UPDATEDATE"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objArticle.LastUpdate.ToString("D")
+ objPlaceHolder.Add(objLiteral)
+
+ Case "UPDATETIME"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objArticle.LastUpdate.ToString("t")
+ objPlaceHolder.Add(objLiteral)
+
+ Case "VIEWCOUNT"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objArticle.NumberOfViews.ToString()
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+
+ Case Else
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("AUTHOR:")) Then
+ If Author(objArticle.AuthorID) IsNot Nothing Then
+ ' token to be processed
+ Dim field As String = layoutArray(iPtr + 1).Substring(7, layoutArray(iPtr + 1).Length - 7).ToLower().Trim()
+
+ 'Gets the DNN profile property named like the token (field)
+ Dim profilePropertyFound As Boolean = False
+ Dim profilePropertyDataType As String = String.Empty
+ Dim profilePropertyName As String = String.Empty
+ Dim profilePropertyValue As String = String.Empty
+
+ For Each objProfilePropertyDefinition As ProfilePropertyDefinition In ProfileProperties
+ If (objProfilePropertyDefinition.PropertyName.ToLower().Trim() = field) Then
+
+ 'Gets the dnn profile property's datatype
+ Dim objListController As New ListController
+ Dim definitionEntry As ListEntryInfo = objListController.GetListEntryInfo(objProfilePropertyDefinition.DataType)
+ If Not definitionEntry Is Nothing Then
+ profilePropertyDataType = definitionEntry.Value
+ Else
+ profilePropertyDataType = "Unknown"
+ End If
+
+ 'Gets the dnn profile property's name and current value for the given user (Agent = AuthorID)
+ profilePropertyName = objProfilePropertyDefinition.PropertyName
+ profilePropertyValue = Author(objArticle.AuthorID).Profile.GetPropertyValue(profilePropertyName)
+
+ profilePropertyFound = True
+
+ End If
+ Next
+
+ If profilePropertyFound Then
+
+ Select Case profilePropertyDataType.ToLower()
+ Case "truefalse"
+ Dim objTrueFalse As New CheckBox
+ If profilePropertyValue = String.Empty Then
+ objTrueFalse.Checked = False
+ Else
+ objTrueFalse.Checked = CType(profilePropertyValue, Boolean)
+ End If
+ objTrueFalse.Enabled = False
+ objTrueFalse.EnableViewState = False
+ objPlaceHolder.Add(objTrueFalse)
+
+ Case "richtext"
+ Dim objLiteral As New Literal
+ If profilePropertyValue = String.Empty Then
+ objLiteral.Text = String.Empty
+ Else
+ objLiteral.Text = Server.HtmlDecode(profilePropertyValue)
+ End If
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+
+ Case "list"
+ Dim objLiteral As New Literal
+ objLiteral.Text = profilePropertyValue
+ Dim objListController As New ListController
+ Dim objListEntryInfoCollection As ListEntryInfoCollection = objListController.GetListEntryInfoCollection(profilePropertyName)
+ For Each objListEntryInfo As ListEntryInfo In objListEntryInfoCollection
+ If objListEntryInfo.Value = profilePropertyValue Then
+ objLiteral.Text = objListEntryInfo.Text
+ Exit For
+ End If
+ Next
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+
+ Case Else
+ Dim objLiteral As New Literal
+ If profilePropertyValue = String.Empty Then
+ objLiteral.Text = String.Empty
+ Else
+ If profilePropertyName.ToLower() = "website" Then
+ Dim url As String = profilePropertyValue
+ If url.ToLower.StartsWith("http://") Then
+ url = url.Substring(7) ' removes the "http://"
+ End If
+ objLiteral.Text = url
+ Else
+ objLiteral.Text = profilePropertyValue
+ End If
+ End If
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+ End Select 'profilePropertyDataType
+
+ End If ' DNN Profile property processing
+ End If
+ Exit Select
+ End If ' "AUTHOR:" token
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("CAPTION:")) Then
+
+ Dim objCustomFieldController As New CustomFieldController
+ Dim objCustomFields As ArrayList = objCustomFieldController.List(objArticle.ModuleID)
+
+ Dim field As String = layoutArray(iPtr + 1).Substring(8, layoutArray(iPtr + 1).Length - 8)
+
+ Dim i As Integer = 0
+ For Each objCustomField As CustomFieldInfo In objCustomFields
+ If (objCustomField.Name.ToLower() = field.ToLower()) Then
+ If (objArticle.CustomList.Contains(objCustomField.CustomFieldID)) Then
+ Dim objLiteral As New Literal
+ objLiteral.Text = objCustomField.Caption
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+ i = i + 1
+ End If
+ End If
+ Next
+
+ Exit Select
+
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("CATEGORIESSUB:")) Then
+ Dim values As String = layoutArray(iPtr + 1).Substring(14, layoutArray(iPtr + 1).Length - 14)
+
+ Dim splitValues As String() = values.Split(":"c)
+
+ If (splitValues.Length = 2) Then
+
+ Dim category As String = splitValues(0)
+ Dim number As String = splitValues(1)
+
+ If (IsNumeric(number)) Then
+ If (Convert.ToInt32(number) > 0) Then
+
+ ' Find category
+
+ Dim objCategoryController As New CategoryController
+ Dim objCategories As List(Of CategoryInfo) = objCategoryController.GetCategoriesAll(ArticleModule.ModuleID, Null.NullInteger)
+
+ Dim categoryID As Integer = Null.NullInteger
+ For Each objCategory As CategoryInfo In objCategories
+
+ If (objCategory.Name.ToLower() = category.ToLower()) Then
+ categoryID = objCategory.CategoryID
+ Exit For
+ End If
+
+ Next
+
+ If (categoryID <> Null.NullInteger) Then
+
+ Dim objCategoriesSelected As List(Of CategoryInfo) = objCategoryController.GetCategoriesAll(ArticleModule.ModuleID, categoryID, Nothing, Null.NullInteger, Convert.ToInt32(number), False, CategorySortType.Name)
+
+ Dim objArticleCategories As ArrayList = CType(DataCache.GetCache(ArticleConstants.CACHE_CATEGORY_ARTICLE & objArticle.ArticleID.ToString()), ArrayList)
+ If (objArticleCategories Is Nothing) Then
+ Dim objArticleController As New ArticleController
+ objArticleCategories = objArticleController.GetArticleCategories(objArticle.ArticleID)
+ DataCache.SetCache(ArticleConstants.CACHE_CATEGORY_ARTICLE & objArticle.ArticleID.ToString(), objArticleCategories)
+ End If
+
+
+ Dim objLiteral As New Literal
+ For Each objCategory As CategoryInfo In objArticleCategories
+
+ For Each objCategorySel As CategoryInfo In objCategoriesSelected
+ If (objCategory.CategoryID = objCategorySel.CategoryID) Then
+ If (objLiteral.Text <> "") Then
+ objLiteral.Text = objLiteral.Text & ", " & objCategory.Name & ""
+ Else
+ objLiteral.Text = " " & objCategory.Name & ""
+ End If
+ End If
+ Next
+
+ Next
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+ Exit Select
+
+ End If
+ End If
+
+ End If
+
+ End If
+
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("CREATEDATE:")) Then
+ Dim formatExpression As String = layoutArray(iPtr + 1).Substring(11, layoutArray(iPtr + 1).Length - 11)
+
+ Dim objLiteral As New Literal
+
+ Try
+ If (objArticle.CreatedDate = Null.NullDate) Then
+ objLiteral.Text = ""
+ Else
+ objLiteral.Text = objArticle.CreatedDate.ToString(formatExpression)
+ End If
+ Catch
+ If (objArticle.CreatedDate = Null.NullDate) Then
+ objLiteral.Text = ""
+ Else
+ objLiteral.Text = objArticle.CreatedDate.ToString("D")
+ End If
+ End Try
+
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("CREATEDATELESSTHAN:")) Then
+ Dim length As Integer = Convert.ToInt32(layoutArray(iPtr + 1).Substring(19, layoutArray(iPtr + 1).Length - 19))
+
+ If (objArticle.CreatedDate < DateTime.Now.AddDays(length * -1)) Then
+ Dim endVal As String = layoutArray(iPtr + 1).ToUpper()
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = ("/" & endVal)) Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("/CREATEDATELESSTHAN:")) Then
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("CUSTOM:")) Then
+ Dim field As String = layoutArray(iPtr + 1).Substring(7, layoutArray(iPtr + 1).Length - 7).ToLower()
+
+ Dim customFieldID As Integer = Null.NullInteger
+ Dim objCustomFieldSelected As New CustomFieldInfo
+ Dim isLink As Boolean = False
+
+ Dim objCustomFieldController As New CustomFieldController
+ Dim objCustomFields As ArrayList = objCustomFieldController.List(objArticle.ModuleID)
+
+ Dim maxLength As Integer = Null.NullInteger
+ If (field.IndexOf(":"c) <> -1) Then
+ Try
+ maxLength = Convert.ToInt32(field.Split(":"c)(1))
+ Catch
+ maxLength = Null.NullInteger
+ End Try
+ field = field.Split(":"c)(0)
+ End If
+ If (customFieldID = Null.NullInteger) Then
+ For Each objCustomField As CustomFieldInfo In objCustomFields
+ If (objCustomField.Name.ToLower() = field.ToLower()) Then
+ customFieldID = objCustomField.CustomFieldID
+ objCustomFieldSelected = objCustomField
+ End If
+ Next
+ End If
+
+ If (customFieldID <> Null.NullInteger) Then
+
+ Dim i As Integer = 0
+ If (objArticle.CustomList.Contains(customFieldID)) Then
+ Dim objLiteral As New Literal
+ Dim fieldValue As String = GetFieldValue(objCustomFieldSelected, objArticle, False)
+ If (maxLength <> Null.NullInteger) Then
+ If (fieldValue.Length > maxLength) Then
+ fieldValue = fieldValue.Substring(0, maxLength)
+ End If
+ End If
+ objLiteral.Text = fieldValue.TrimStart("#"c)
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+ i = i + 1
+ End If
+ End If
+ Exit Select
+ End If
+
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("DETAILS:")) Then
+ Dim length As Integer = Convert.ToInt32(layoutArray(iPtr + 1).Substring(8, layoutArray(iPtr + 1).Length - 8))
+
+ Dim objLiteral As New Literal
+ If (StripHtml(Server.HtmlDecode(objArticle.Body)).TrimStart().Length > length) Then
+ objLiteral.Text = ProcessPostTokens(Left(StripHtml(Server.HtmlDecode(objArticle.Body)).TrimStart(), length), objArticle, Generator, ArticleSettings) & "..."
+ Else
+ objLiteral.Text = ProcessPostTokens(Left(StripHtml(Server.HtmlDecode(objArticle.Body)).TrimStart(), length), objArticle, Generator, ArticleSettings)
+ End If
+
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("EXPRESSION:")) Then
+
+ Dim objCustomFieldController As New CustomFieldController
+ Dim objCustomFields As ArrayList = objCustomFieldController.List(objArticle.ModuleID)
+
+ Dim field As String = layoutArray(iPtr + 1).Substring(11, layoutArray(iPtr + 1).Length - 11)
+
+ Dim params As String() = field.Split(":"c)
+
+ If (params.Length <> 3) Then
+ Dim endToken As String = "/" & layoutArray(iPtr + 1)
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = endToken) Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ Exit Select
+ End If
+
+ Dim customField As String = params(0)
+ Dim customExpression As String = params(1)
+ Dim customValue As String = params(2)
+
+ Dim fieldValue As String = ""
+
+ For Each objCustomField As CustomFieldInfo In objCustomFields
+ If (objCustomField.Name.ToLower() = customField.ToLower()) Then
+ If (objArticle.CustomList.Contains(objCustomField.CustomFieldID)) Then
+ fieldValue = GetFieldValue(objCustomField, objArticle, False)
+ End If
+ End If
+ Next
+
+ Dim isValid As Boolean = False
+ Select Case customExpression
+ Case "="
+ If (customValue.ToLower() = fieldValue.ToLower()) Then
+ isValid = True
+ End If
+ Exit Select
+
+ Case "!="
+ If (customValue.ToLower() <> fieldValue.ToLower()) Then
+ isValid = True
+ End If
+ Exit Select
+
+ Case "<"
+ If (IsNumeric(customValue) AndAlso IsNumeric(fieldValue)) Then
+ If (Convert.ToInt32(fieldValue) < Convert.ToInt32(customValue)) Then
+ isValid = True
+ End If
+ End If
+ Exit Select
+
+ Case "<="
+ If (IsNumeric(customValue) AndAlso IsNumeric(fieldValue)) Then
+ If (Convert.ToInt32(fieldValue) <= Convert.ToInt32(customValue)) Then
+ isValid = True
+ End If
+ End If
+ Exit Select
+
+ Case ">"
+ If (IsNumeric(customValue) AndAlso IsNumeric(fieldValue)) Then
+ If (Convert.ToInt32(fieldValue) > Convert.ToInt32(customValue)) Then
+ isValid = True
+ End If
+ End If
+ Exit Select
+
+ Case ">="
+ If (IsNumeric(customValue) AndAlso IsNumeric(fieldValue)) Then
+ If (Convert.ToInt32(fieldValue) >= Convert.ToInt32(customValue)) Then
+ isValid = True
+ End If
+ End If
+ Exit Select
+
+ End Select
+
+ If (isValid = False) Then
+ Dim endToken As String = "/" & layoutArray(iPtr + 1)
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = endToken) Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Exit Select
+
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("/EXPRESSION:")) Then
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("HASIMAGES:")) Then
+
+ Dim field As String = layoutArray(iPtr + 1).Substring(10, layoutArray(iPtr + 1).Length - 10)
+
+ If (IsNumeric(field)) Then
+
+ If (objArticle.ImageCount < Convert.ToInt32(field)) Then
+ Dim endToken As String = "/" & layoutArray(iPtr + 1)
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = endToken) Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ End If
+
+ Exit Select
+
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("/HASIMAGES:")) Then
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("HASMOREDETAIL:")) Then
+ Dim length As Integer = Convert.ToInt32(layoutArray(iPtr + 1).Substring(14, layoutArray(iPtr + 1).Length - 14))
+ Dim endToken As String = "/" & layoutArray(iPtr + 1)
+
+ If (objArticle.Url = Null.NullString() And StripHtml(objArticle.Summary.Trim()) = "" And StripHtml(Server.HtmlDecode(objArticle.Body)).TrimStart().Length <= length) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = endToken) Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("/HASMOREDETAIL:")) Then
+ ' Do Nothing
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("HASNOVALUE:")) Then
+
+ Dim objCustomFieldController As New CustomFieldController
+ Dim objCustomFields As ArrayList = objCustomFieldController.List(objArticle.ModuleID)
+
+ Dim field As String = layoutArray(iPtr + 1).Substring(11, layoutArray(iPtr + 1).Length - 11)
+
+ For Each objCustomField As CustomFieldInfo In objCustomFields
+ If (objCustomField.Name.ToLower() = field.ToLower()) Then
+ If (objArticle.CustomList.Contains(objCustomField.CustomFieldID)) Then
+ Dim fieldValue As String = GetFieldValue(objCustomField, objArticle, False)
+ If (fieldValue.Trim() <> "") Then
+ Dim endToken As String = "/" & layoutArray(iPtr + 1)
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = endToken) Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+ End If
+ End If
+ Next
+
+ Exit Select
+
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("/HASNOVALUE:")) Then
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("HASVALUE:")) Then
+
+ Dim objCustomFieldController As New CustomFieldController
+ Dim objCustomFields As ArrayList = objCustomFieldController.List(objArticle.ModuleID)
+
+ Dim field As String = layoutArray(iPtr + 1).Substring(9, layoutArray(iPtr + 1).Length - 9)
+
+ For Each objCustomField As CustomFieldInfo In objCustomFields
+ If (objCustomField.Name.ToLower() = field.ToLower()) Then
+ If (objArticle.CustomList.Contains(objCustomField.CustomFieldID)) Then
+ Dim fieldValue As String = GetFieldValue(objCustomField, objArticle, False)
+ If (fieldValue.Trim() = "") Then
+ Dim endToken As String = "/" & layoutArray(iPtr + 1)
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = endToken) Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+ End If
+ End If
+ Next
+
+ Exit Select
+
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("/HASVALUE:")) Then
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("HASAUTHORVALUE:")) Then
+
+ Dim field As String = layoutArray(iPtr + 1).Substring(15, layoutArray(iPtr + 1).Length - 15).ToLower().Trim()
+
+ 'Gets the DNN profile property named like the token (field)
+ Dim profilePropertyName As String = String.Empty
+ Dim profilePropertyValue As String = String.Empty
+
+ For Each objProfilePropertyDefinition As ProfilePropertyDefinition In ProfileProperties
+ If (objProfilePropertyDefinition.PropertyName.ToLower().Trim() = field) Then
+
+ 'Gets the dnn profile property's datatype
+ Dim objListController As New ListController
+ Dim definitionEntry As ListEntryInfo = objListController.GetListEntryInfo(objProfilePropertyDefinition.DataType)
+ If Not definitionEntry Is Nothing Then
+ Else
+ End If
+
+ 'Gets the dnn profile property's name and current value for the given user (Agent = AuthorID)
+ profilePropertyName = objProfilePropertyDefinition.PropertyName
+ If (Author(objArticle.AuthorID) IsNot Nothing) Then
+ profilePropertyValue = Author(objArticle.AuthorID).Profile.GetPropertyValue(profilePropertyName)
+ Exit For
+ End If
+
+ End If
+ Next
+
+ If (profilePropertyValue = "") Then
+ Dim endToken As String = "/" & layoutArray(iPtr + 1)
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = endToken) Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Exit Select
+
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("/HASAUTHORVALUE:")) Then
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("IMAGE:")) Then
+ If (objArticle.ImageCount > 0) Then
+ Dim val As String = layoutArray(iPtr + 1).Substring(6, layoutArray(iPtr + 1).Length - 6)
+
+ If (IsNumeric(val)) Then
+ Dim objImageController As New ImageController
+ Dim objImages As List(Of ImageInfo) = objImageController.GetImageList(objArticle.ArticleID, Null.NullString())
+
+ If (objImages.Count > 0) Then
+ Dim count As Integer = 1
+ For Each objChildImage As ImageInfo In objImages
+ If (count = Convert.ToInt32(val)) Then
+ Dim objImage As New Image
+ objImage.ImageUrl = PortalSettings.HomeDirectory & objChildImage.Folder & objChildImage.FileName
+ objImage.EnableViewState = False
+ objImage.AlternateText = objArticle.Title
+ objPlaceHolder.Add(objImage)
+ End If
+ count = count + 1
+ Next
+ End If
+ End If
+ End If
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("IMAGETHUMB:")) Then
+
+ If (objArticle.ImageUrl <> "") Then
+ Dim objImage As New Image
+ objImage.ImageUrl = objArticle.ImageUrl
+ objImage.EnableViewState = False
+ objImage.AlternateText = objArticle.Title
+ objPlaceHolder.Add(objImage)
+ Else
+ If (objArticle.ImageCount > 0) Then
+
+ Dim objImageController As New ImageController
+ Dim objImages As List(Of ImageInfo) = objImageController.GetImageList(objArticle.ArticleID, Null.NullString)
+ If (objImages.Count > 0) Then
+
+ Dim val As String = layoutArray(iPtr + 1).Substring(11, layoutArray(iPtr + 1).Length - 11)
+ If (val.IndexOf(":"c) = -1) Then
+ Dim length As Integer = Convert.ToInt32(val)
+
+ Dim objImage As New Image
+ If (ArticleSettings.ImageThumbnailType = ThumbnailType.Proportion) Then
+ objImage.ImageUrl = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & length.ToString() & "&Height=" & length.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(objImages(0).Folder & objImages(0).FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1")
+ Else
+ objImage.ImageUrl = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & length.ToString() & "&Height=" & length.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(objImages(0).Folder & objImages(0).FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1&s=1")
+ End If
+ objImage.EnableViewState = False
+ objImage.AlternateText = objArticle.Title
+ objPlaceHolder.Add(objImage)
+ Else
+
+ Dim arr() As String = val.Split(":"c)
+
+ If (arr.Length = 2) Then
+ Dim width As Integer = Convert.ToInt32(val.Split(":"c)(0))
+ Dim height As Integer = Convert.ToInt32(val.Split(":"c)(1))
+
+ Dim objImage As New Image
+ If (ArticleSettings.ImageThumbnailType = ThumbnailType.Proportion) Then
+ objImage.ImageUrl = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & width.ToString() & "&Height=" & height.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(objImages(0).Folder & objImages(0).FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1")
+ Else
+ objImage.ImageUrl = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & width.ToString() & "&Height=" & height.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(objImages(0).Folder & objImages(0).FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1&s=1")
+ End If
+ objImage.EnableViewState = False
+ objImage.AlternateText = objArticle.Title
+ objPlaceHolder.Add(objImage)
+ Else
+ If (arr.Length = 3) Then
+ Dim width As Integer = Convert.ToInt32(val.Split(":"c)(0))
+ Dim height As Integer = Convert.ToInt32(val.Split(":"c)(1))
+ Dim item As Integer = Convert.ToInt32(val.Split(":"c)(2))
+
+ If (objImages.Count > 0) Then
+ Dim count As Integer = 1
+ For Each objChildImage As ImageInfo In objImages
+ If (count = item) Then
+ Dim objImage As New Image
+ If (ArticleSettings.ImageThumbnailType = ThumbnailType.Proportion) Then
+ objImage.ImageUrl = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & width.ToString() & "&Height=" & height.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(objChildImage.Folder & objChildImage.FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1")
+ Else
+ objImage.ImageUrl = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & width.ToString() & "&Height=" & height.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(objChildImage.Folder & objChildImage.FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1&s=1")
+ End If
+ objImage.EnableViewState = False
+ objImage.AlternateText = objArticle.Title
+ objPlaceHolder.Add(objImage)
+ End If
+ count = count + 1
+ Next
+ End If
+
+ End If
+ End If
+ End If
+
+ End If
+
+ End If
+ End If
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("IMAGETHUMBLINK:")) Then
+
+ If (objArticle.ImageUrl <> "") Then
+ Dim objImage As New Image
+ objImage.ImageUrl = objArticle.ImageUrl
+ objImage.EnableViewState = False
+ objImage.AlternateText = objArticle.Title
+ objPlaceHolder.Add(objImage)
+ Else
+ If (objArticle.ImageCount > 0) Then
+
+ Dim objImageController As New ImageController
+ Dim objImages As List(Of ImageInfo) = objImageController.GetImageList(objArticle.ArticleID, Null.NullString)
+
+ If (objImages.Count > 0) Then
+
+ Dim val As String = layoutArray(iPtr + 1).Substring(15, layoutArray(iPtr + 1).Length - 15)
+ If (val.IndexOf(":"c) = -1) Then
+ Dim length As Integer = Convert.ToInt32(val)
+
+ Dim objLiteral As New Literal
+ If (ArticleSettings.ImageThumbnailType = ThumbnailType.Proportion) Then
+ objLiteral.Text = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & length.ToString() & "&Height=" & length.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(objImages(0).Folder & objImages(0).FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1")
+ Else
+ objLiteral.Text = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & length.ToString() & "&Height=" & length.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(objImages(0).Folder & objImages(0).FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1&s=1")
+ End If
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+ Else
+ Dim arr() As String = val.Split(":"c)
+
+ If (arr.Length = 2) Then
+ Dim width As Integer = Convert.ToInt32(val.Split(":"c)(0))
+ Dim height As Integer = Convert.ToInt32(val.Split(":"c)(1))
+
+ Dim objLiteral As New Literal
+ If (objArticle.ImageUrl.ToLower().StartsWith("http://") Or objArticle.ImageUrl.ToLower().StartsWith("https://")) Then
+ objLiteral.Text = objArticle.ImageUrl
+ Else
+ If (ArticleSettings.ImageThumbnailType = ThumbnailType.Proportion) Then
+ objLiteral.Text = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & width.ToString() & "&Height=" & height.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(objImages(0).Folder & objImages(0).FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1")
+ Else
+ objLiteral.Text = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & width.ToString() & "&Height=" & height.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(objImages(0).Folder & objImages(0).FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1&s=1")
+ End If
+ End If
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+ Else
+ If (arr.Length = 3) Then
+ Dim width As Integer = Convert.ToInt32(val.Split(":"c)(0))
+ Dim height As Integer = Convert.ToInt32(val.Split(":"c)(1))
+ Dim item As Integer = Convert.ToInt32(val.Split(":"c)(2))
+
+ If (objImages.Count > 0) Then
+ Dim count As Integer = 1
+ For Each objChildImage As ImageInfo In objImages
+ If (count = item) Then
+ Dim objLiteral As New Literal
+ If (objArticle.ImageUrl.ToLower().StartsWith("http://") Or objArticle.ImageUrl.ToLower().StartsWith("https://")) Then
+ objLiteral.Text = objArticle.ImageUrl
+ Else
+ If (ArticleSettings.ImageThumbnailType = ThumbnailType.Proportion) Then
+ objLiteral.Text = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & width.ToString() & "&Height=" & height.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(objChildImage.Folder & objChildImage.FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1")
+ Else
+ objLiteral.Text = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & width.ToString() & "&Height=" & height.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(objChildImage.Folder & objChildImage.FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1&s=1")
+ End If
+ End If
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+ End If
+ count = count + 1
+ Next
+ End If
+
+ End If
+ End If
+
+ End If
+ End If
+ End If
+ End If
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("IMAGETHUMBRANDOM:")) Then
+
+ If (objArticle.ImageCount > 0) Then
+
+ Dim objImageController As New ImageController
+ Dim objImages As List(Of ImageInfo) = objImageController.GetImageList(objArticle.ArticleID, Null.NullString)
+ If (objImages.Count > 0) Then
+
+ Dim randomImage As ImageInfo = objImages(Generator.Next(0, objImages.Count - 1))
+
+ Dim val As String = layoutArray(iPtr + 1).Substring(17, layoutArray(iPtr + 1).Length - 17)
+ If (val.IndexOf(":"c) = -1) Then
+ Dim length As Integer = Convert.ToInt32(val)
+
+ Dim objImage As New Image
+ If (ArticleSettings.ImageThumbnailType = ThumbnailType.Proportion) Then
+ objImage.ImageUrl = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & length.ToString() & "&Height=" & length.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(randomImage.Folder & randomImage.FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1")
+ Else
+ objImage.ImageUrl = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & length.ToString() & "&Height=" & length.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(randomImage.Folder & randomImage.FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1&s=1")
+ End If
+ objImage.EnableViewState = False
+ objImage.AlternateText = objArticle.Title
+ objPlaceHolder.Add(objImage)
+ Else
+
+ Dim arr() As String = val.Split(":"c)
+
+ If (arr.Length = 2) Then
+ Dim width As Integer = Convert.ToInt32(val.Split(":"c)(0))
+ Dim height As Integer = Convert.ToInt32(val.Split(":"c)(1))
+
+ Dim objImage As New Image
+ If (ArticleSettings.ImageThumbnailType = ThumbnailType.Proportion) Then
+ objImage.ImageUrl = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & width.ToString() & "&Height=" & height.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(randomImage.Folder & randomImage.FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1")
+ Else
+ objImage.ImageUrl = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & width.ToString() & "&Height=" & height.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(randomImage.Folder & randomImage.FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1&s=1")
+ End If
+ objImage.EnableViewState = False
+ objImage.AlternateText = objArticle.Title
+ objPlaceHolder.Add(objImage)
+ End If
+ End If
+
+ End If
+
+ End If
+ Exit Select
+ End If
+
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("ISINROLE:")) Then
+ Dim field As String = layoutArray(iPtr + 1).Substring(9, layoutArray(iPtr + 1).Length - 9)
+ If (PortalSecurity.IsInRole(field) = False) Then
+ Dim endToken As String = "/" & layoutArray(iPtr + 1)
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = endToken) Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("/ISINROLE:")) Then
+ ' Do Nothing
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("ISITEMINDEX:")) Then
+ Dim field As String = layoutArray(iPtr + 1).Substring(12, layoutArray(iPtr + 1).Length - 12)
+ Try
+ If (Convert.ToInt32(field) <> articleItemIndex) Then
+ Dim endToken As String = "/" & layoutArray(iPtr + 1)
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = endToken) Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+ Catch
+ End Try
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("/ISITEMINDEX:")) Then
+ ' Do Nothing
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("ISPAGE:")) Then
+ Dim page As String = layoutArray(iPtr + 1).Substring(7, layoutArray(iPtr + 1).Length - 7)
+ If (IsNumeric(page)) Then
+ If (Convert.ToInt32(page) = 1) Then
+ If (Request("PageID") <> "") Then
+ Dim endToken As String = "/" & layoutArray(iPtr + 1)
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = endToken) Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+ Else
+ Dim objPageController As New PageController()
+ Dim objPages As ArrayList = objPageController.GetPageList(objArticle.ArticleID)
+
+ Dim found As Boolean = False
+ If (Request("PageID") <> "") Then
+ Dim pageNumber As Integer = 1
+ For Each objPage As PageInfo In objPages
+ If (Convert.ToInt32(page) = pageNumber) Then
+ If (Request("PageID") = objPage.PageID.ToString()) Then
+ found = True
+ End If
+ Exit For
+ End If
+ pageNumber = pageNumber + 1
+ Next
+ End If
+
+ If (found = False) Then
+ Dim endToken As String = "/" & layoutArray(iPtr + 1)
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = endToken) Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+ End If
+ End If
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("/ISPAGE:")) Then
+ ' Do Nothing
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("ISNOTPAGE:")) Then
+ Dim page As String = layoutArray(iPtr + 1).Substring(10, layoutArray(iPtr + 1).Length - 10)
+ If (IsNumeric(page)) Then
+ If (Convert.ToInt32(page) = 1) Then
+ If (Request("PageID") = "") Then
+ Dim endToken As String = "/" & layoutArray(iPtr + 1)
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = endToken) Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+ Else
+ Dim objPageController As New PageController()
+ Dim objPages As ArrayList = objPageController.GetPageList(objArticle.ArticleID)
+
+ Dim found As Boolean = False
+ If (Request("PageID") <> "") Then
+ Dim pageNumber As Integer = 1
+ For Each objPage As PageInfo In objPages
+ If (Convert.ToInt32(page) = pageNumber) Then
+ If (Request("PageID") = objPage.PageID.ToString()) Then
+ found = True
+ End If
+ Exit For
+ End If
+ pageNumber = pageNumber + 1
+ Next
+ End If
+
+ If (found = True) Then
+ Dim endToken As String = "/" & layoutArray(iPtr + 1)
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = endToken) Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+ End If
+ End If
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("/ISNOTPAGE:")) Then
+ ' Do Nothing
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("HASCATEGORY:")) Then
+ Dim category As String = layoutArray(iPtr + 1).Substring(12, layoutArray(iPtr + 1).Length - 12)
+
+ Dim objArticleCategories As ArrayList = CType(DataCache.GetCache(ArticleConstants.CACHE_CATEGORY_ARTICLE & objArticle.ArticleID.ToString()), ArrayList)
+ If (objArticleCategories Is Nothing) Then
+ Dim objArticleController As New ArticleController
+ objArticleCategories = objArticleController.GetArticleCategories(objArticle.ArticleID)
+ DataCache.SetCache(ArticleConstants.CACHE_CATEGORY_ARTICLE & objArticle.ArticleID.ToString(), objArticleCategories)
+ End If
+
+ Dim found As Boolean = False
+ If (category <> "") Then
+ For Each objCategory As CategoryInfo In objArticleCategories
+ If (category.ToLower() = objCategory.Name.ToLower()) Then
+ found = True
+ End If
+ Next
+ End If
+
+ If (found = False) Then
+ Dim endToken As String = "/" & layoutArray(iPtr + 1)
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = endToken) Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("/HASCATEGORY:")) Then
+ ' Do Nothing
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("HASTAG:")) Then
+
+ Dim tagSelected As String = layoutArray(iPtr + 1).Substring(7, layoutArray(iPtr + 1).Length - 7)
+
+ Dim found As Boolean = False
+ If (objArticle.Tags.Trim() <> "") Then
+ For Each tag As String In objArticle.Tags.Split(","c)
+ If (tag.ToLower() = tagSelected.ToLower()) Then
+ found = True
+ End If
+ Next
+ End If
+
+ If (found = False) Then
+ Dim endToken As String = "/" & layoutArray(iPtr + 1)
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = endToken) Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("/HASTAG:")) Then
+ ' Do Nothing
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("ISLOCALE:")) Then
+ Dim field As String = layoutArray(iPtr + 1).Substring(9, layoutArray(iPtr + 1).Length - 9)
+
+ If (CType(Page, DotNetNuke.Framework.PageBase).PageCulture.Name.ToLower() <> field.ToLower()) Then
+ Dim endToken As String = "/" & layoutArray(iPtr + 1)
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = endToken) Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("/ISLOCALE:")) Then
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("PAGE:")) Then
+ If (IsNumeric(layoutArray(iPtr + 1).Substring(5, layoutArray(iPtr + 1).Length - 5))) Then
+ Dim pageNumber As Integer = Convert.ToInt32(layoutArray(iPtr + 1).Substring(5, layoutArray(iPtr + 1).Length - 5))
+
+ Dim objLiteral As New Literal
+ If (pageNumber > 0) Then
+ Dim pageController As New PageController
+ Dim pageList As ArrayList = pageController.GetPageList(objArticle.ArticleID)
+
+ If (pageList.Count >= pageNumber) Then
+ objLiteral.Text = ProcessPostTokens(Server.HtmlDecode(CType(pageList(pageNumber - 1), PageInfo).PageText), objArticle, Generator, ArticleSettings)
+ End If
+ End If
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+ Exit Select
+ End If
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("PUBLISHENDDATE:")) Then
+ Dim formatExpression As String = layoutArray(iPtr + 1).Substring(15, layoutArray(iPtr + 1).Length - 15)
+
+ Dim objLiteral As New Literal
+
+ Try
+ If (objArticle.EndDate = Null.NullDate) Then
+ objLiteral.Text = ""
+ Else
+ objLiteral.Text = objArticle.EndDate.ToString(formatExpression)
+ End If
+ Catch
+ If (objArticle.EndDate = Null.NullDate) Then
+ objLiteral.Text = ""
+ Else
+ objLiteral.Text = objArticle.EndDate.ToString("D")
+ End If
+ End Try
+
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("PUBLISHDATE:")) Then
+ Dim formatExpression As String = layoutArray(iPtr + 1).Substring(12, layoutArray(iPtr + 1).Length - 12)
+
+ Dim objLiteral As New Literal
+
+ Try
+ If (objArticle.StartDate = Null.NullDate) Then
+ objLiteral.Text = objArticle.CreatedDate.ToString(formatExpression)
+ Else
+ objLiteral.Text = objArticle.StartDate.ToString(formatExpression)
+ End If
+ Catch
+ If (objArticle.StartDate = Null.NullDate) Then
+ objLiteral.Text = objArticle.CreatedDate.ToString("D")
+ Else
+ objLiteral.Text = objArticle.StartDate.ToString("D")
+ End If
+ End Try
+
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("PUBLISHSTARTDATE:")) Then
+ Dim formatExpression As String = layoutArray(iPtr + 1).Substring(17, layoutArray(iPtr + 1).Length - 17)
+
+ Dim objLiteral As New Literal
+
+ Try
+ If (objArticle.StartDate = Null.NullDate) Then
+ objLiteral.Text = objArticle.CreatedDate.ToString(formatExpression)
+ Else
+ objLiteral.Text = objArticle.StartDate.ToString(formatExpression)
+ End If
+ Catch
+ If (objArticle.StartDate = Null.NullDate) Then
+ objLiteral.Text = objArticle.CreatedDate.ToString("D")
+ Else
+ objLiteral.Text = objArticle.StartDate.ToString("D")
+ End If
+ End Try
+
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("QUERYSTRING:")) Then
+ Dim variable As String = layoutArray(iPtr + 1).Substring(12, layoutArray(iPtr + 1).Length - 12)
+
+ Dim objLiteral As New Literal
+ objLiteral.Text = Request.QueryString(variable)
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("RELATED:")) Then
+ _objRelatedArticles = Nothing
+ If (IsNumeric(layoutArray(iPtr + 1).Substring(8, layoutArray(iPtr + 1).Length - 8))) Then
+ Dim count As Integer = Convert.ToInt32(layoutArray(iPtr + 1).Substring(8, layoutArray(iPtr + 1).Length - 8))
+ If (count > 0) Then
+ If (ArticleSettings.RelatedMode <> RelatedType.None) Then
+ Dim phRelated As New PlaceHolder
+ Dim objArticles As List(Of ArticleInfo) = GetRelatedArticles(objArticle, count)
+ If (objArticles.Count > 0) Then
+ Dim _objLayoutRelatedHeader As LayoutInfo = GetLayout(ArticleSettings, ArticleModule, Page, LayoutType.Related_Header_Html)
+ Dim _objLayoutRelatedItem As LayoutInfo = GetLayout(ArticleSettings, ArticleModule, Page, LayoutType.Related_Item_Html)
+ Dim _objLayoutRelatedFooter As LayoutInfo = GetLayout(ArticleSettings, ArticleModule, Page, LayoutType.Related_Footer_Html)
+
+ ProcessArticleItem(phRelated.Controls, _objLayoutRelatedHeader.Tokens, objArticle)
+ For Each objRelatedArticle As ArticleInfo In objArticles
+ ProcessArticleItem(phRelated.Controls, _objLayoutRelatedItem.Tokens, objRelatedArticle)
+ Next
+ ProcessArticleItem(phRelated.Controls, _objLayoutRelatedFooter.Tokens, objArticle)
+
+ objPlaceHolder.Add(phRelated)
+ End If
+ End If
+ End If
+ End If
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("SUMMARY:")) Then
+ Dim summary As String = objArticle.Summary
+ If (IsNumeric(layoutArray(iPtr + 1).Substring(8, layoutArray(iPtr + 1).Length - 8))) Then
+ Dim length As Integer = Convert.ToInt32(layoutArray(iPtr + 1).Substring(8, layoutArray(iPtr + 1).Length - 8))
+ If (StripHtml(Server.HtmlDecode(objArticle.Summary)).TrimStart().Length > length) Then
+ summary = ProcessPostTokens(Left(StripHtml(Server.HtmlDecode(objArticle.Summary)).TrimStart(), length), objArticle, Generator, ArticleSettings) & "..."
+ Else
+ summary = ProcessPostTokens(Left(StripHtml(Server.HtmlDecode(objArticle.Summary)).TrimStart(), length), objArticle, Generator, ArticleSettings)
+ End If
+ End If
+
+ Dim objLiteral As New Literal
+ objLiteral.Text = summary
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("TITLE:")) Then
+ Dim title As String = objArticle.Title
+ If (IsNumeric(layoutArray(iPtr + 1).Substring(6, layoutArray(iPtr + 1).Length - 6))) Then
+ Dim length As Integer = Convert.ToInt32(layoutArray(iPtr + 1).Substring(6, layoutArray(iPtr + 1).Length - 6))
+ If (objArticle.Title.Length > length) Then
+ title = Left(objArticle.Title, length) & "..."
+ Else
+ title = Left(objArticle.Title, length)
+ End If
+ End If
+
+ Dim objLiteral As New Literal
+ objLiteral.Text = title
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("UPDATEDATE:")) Then
+ Dim formatExpression As String = layoutArray(iPtr + 1).Substring(11, layoutArray(iPtr + 1).Length - 11)
+
+ Dim objLiteral As New Literal
+
+ Try
+ If (objArticle.CreatedDate = Null.NullDate) Then
+ objLiteral.Text = ""
+ Else
+ objLiteral.Text = objArticle.LastUpdate.ToString(formatExpression)
+ End If
+ Catch
+ If (objArticle.CreatedDate = Null.NullDate) Then
+ objLiteral.Text = ""
+ Else
+ objLiteral.Text = objArticle.LastUpdate.ToString("D")
+ End If
+ End Try
+
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("UPDATEDATELESSTHAN:")) Then
+ Dim length As Integer = Convert.ToInt32(layoutArray(iPtr + 1).Substring(19, layoutArray(iPtr + 1).Length - 19))
+
+ If (objArticle.LastUpdate < DateTime.Now.AddDays(length * -1)) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/UPDATEDATELESSTHAN") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+ Exit Select
+ End If
+
+ If (layoutArray(iPtr + 1).ToUpper().StartsWith("/UPDATEDATELESSTHAN:")) Then
+ Exit Select
+ End If
+
+ Dim objLiteralOther As New Literal
+ objLiteralOther.Text = "[" & layoutArray(iPtr + 1) & "]"
+ objLiteralOther.EnableViewState = False
+ objPlaceHolder.Add(objLiteralOther)
+
+ End Select
+ End If
+
+ Next
+
+ End Sub
+
+#End Region
+
+#Region " Process Comment Item "
+
+ Dim commentItemIndex As Integer = 0
+ Public Sub ProcessComment(ByRef objPlaceHolder As ControlCollection, ByVal objArticle As ArticleInfo, ByVal objComment As CommentInfo, ByVal templateArray As String())
+
+ commentItemIndex = commentItemIndex + 1
+ Dim isAnonymous As Boolean = Null.IsNull(objComment.UserID)
+
+ For iPtr As Integer = 0 To templateArray.Length - 1 Step 2
+
+ objPlaceHolder.Add(New LiteralControl(ProcessImages(templateArray(iPtr).ToString())))
+
+ If iPtr < templateArray.Length - 1 Then
+ Select Case templateArray(iPtr + 1)
+ Case "ANONYMOUSURL"
+ Dim objLiteral As New Literal
+ objLiteral.Text = AddHTTP(objComment.AnonymousURL)
+ objPlaceHolder.Add(objLiteral)
+ Case "ARTICLETITLE"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objArticle.Title
+ objPlaceHolder.Add(objLiteral)
+ Case "AUTHOREMAIL"
+ Dim objLiteral As New Literal
+ If (objComment.UserID = Null.NullInteger) Then
+ objLiteral.Text = objComment.AnonymousEmail.ToString()
+ Else
+ objLiteral.Text = objComment.AuthorEmail.ToString()
+ End If
+ objPlaceHolder.Add(objLiteral)
+ Case "AUTHOR"
+ Dim objLiteral As New Literal
+ Select Case ArticleSettings.DisplayMode
+ Case DisplayType.FirstName
+ If (isAnonymous) Then
+ If (objComment.AnonymousName <> "") Then
+ objLiteral.Text = objComment.AnonymousName
+ Else
+ objLiteral.Text = GetArticleResource("AnonymousFirstName")
+ End If
+ Else
+ objLiteral.Text = objComment.AuthorFirstName
+ End If
+ Exit Select
+ Case DisplayType.LastName
+ If (isAnonymous) Then
+ If (objComment.AnonymousName <> "") Then
+ objLiteral.Text = objComment.AnonymousName
+ Else
+ objLiteral.Text = GetArticleResource("AnonymousLastName")
+ End If
+ Else
+ objLiteral.Text = objComment.AuthorLastName
+ End If
+ Exit Select
+ Case DisplayType.UserName
+ If (isAnonymous) Then
+ If (objComment.AnonymousName <> "") Then
+ objLiteral.Text = objComment.AnonymousName
+ Else
+ objLiteral.Text = GetArticleResource("AnonymousUserName")
+ End If
+ Else
+ objLiteral.Text = objComment.AuthorUserName
+ End If
+ Exit Select
+ Case DisplayType.FullName
+ If (isAnonymous) Then
+ If (objComment.AnonymousName <> "") Then
+ objLiteral.Text = objComment.AnonymousName
+ Else
+ objLiteral.Text = GetArticleResource("AnonymousFullName")
+ End If
+ Else
+ objLiteral.Text = objComment.AuthorDisplayName
+ End If
+ Exit Select
+ Case Else
+ If (isAnonymous) Then
+ If (objComment.AnonymousName <> "") Then
+ objLiteral.Text = objComment.AnonymousName
+ Else
+ objLiteral.Text = GetArticleResource("AnonymousUserName")
+ End If
+ Else
+ objLiteral.Text = objComment.AuthorUserName
+ End If
+ Exit Select
+ End Select
+ objPlaceHolder.Add(objLiteral)
+ Case "AUTHORID"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objComment.UserID.ToString()
+ objPlaceHolder.Add(objLiteral)
+ Case "AUTHORUSERNAME"
+ Dim objLiteral As New Literal
+ If (objComment.UserID = Null.NullInteger) Then
+ If (objComment.AnonymousName <> "") Then
+ objLiteral.Text = objComment.AnonymousName
+ Else
+ objLiteral.Text = GetArticleResource("AnonymousUserName")
+ End If
+ Else
+ objLiteral.Text = objComment.AuthorUserName.ToString()
+ End If
+ objPlaceHolder.Add(objLiteral)
+ Case "AUTHORDISPLAYNAME"
+ Dim objLiteral As New Literal
+ If (objComment.UserID = Null.NullInteger) Then
+ If (objComment.AnonymousName <> "") Then
+ objLiteral.Text = objComment.AnonymousName
+ Else
+ objLiteral.Text = GetArticleResource("AnonymousFullName")
+ End If
+ Else
+ objLiteral.Text = objComment.AuthorDisplayName.ToString()
+ End If
+ objPlaceHolder.Add(objLiteral)
+ Case "AUTHORFIRSTNAME"
+ Dim objLiteral As New Literal
+ If (objComment.UserID = Null.NullInteger) Then
+ If (objComment.AnonymousName <> "") Then
+ objLiteral.Text = objComment.AnonymousName
+ Else
+ objLiteral.Text = GetArticleResource("AnonymousFirstName")
+ End If
+ Else
+ objLiteral.Text = objComment.AuthorFirstName.ToString()
+ End If
+ objPlaceHolder.Add(objLiteral)
+ Case "AUTHORLASTNAME"
+ Dim objLiteral As New Literal
+ If (objComment.UserID = Null.NullInteger) Then
+ If (objComment.AnonymousName <> "") Then
+ objLiteral.Text = objComment.AnonymousName
+ Else
+ objLiteral.Text = GetArticleResource("AnonymousLastName")
+ End If
+ Else
+ objLiteral.Text = objComment.AuthorLastName.ToString()
+ End If
+ objPlaceHolder.Add(objLiteral)
+ Case "AUTHORFULLNAME"
+ Dim objLiteral As New Literal
+ If (objComment.UserID = Null.NullInteger) Then
+ If (objComment.AnonymousName <> "") Then
+ objLiteral.Text = objComment.AnonymousName
+ Else
+ objLiteral.Text = GetArticleResource("AnonymousFullName")
+ End If
+ Else
+ objLiteral.Text = objComment.AuthorFirstName.ToString() & " " & objComment.AuthorLastName.ToString()
+ End If
+ objPlaceHolder.Add(objLiteral)
+ Case "COMMENTID"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objComment.CommentID.ToString()
+ objPlaceHolder.Add(objLiteral)
+ Case "COMMENT"
+ Dim objLiteral As New Literal
+ objLiteral.Text = ProcessPostTokens(EncodeComment(objComment), objArticle, Nothing, ArticleSettings)
+ objPlaceHolder.Add(objLiteral)
+ Case "COMMENTLINK"
+ Dim objLiteral As New Literal
+ objLiteral.Text = Common.GetArticleLink(objArticle, Tab, ArticleSettings, IncludeCategory) & "#Comments"
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+ Case "CREATEDATE"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objComment.CreatedDate.ToString("D")
+ objPlaceHolder.Add(objLiteral)
+ Case "CREATETIME"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objComment.CreatedDate.ToString("t")
+ objPlaceHolder.Add(objLiteral)
+ Case "DELETE"
+ If (ArticleSettings.IsAdmin() Or ArticleSettings.IsApprover() Or (UserId = objArticle.AuthorID And objArticle.AuthorID <> Null.NullInteger)) Then
+ Dim cmdDelete As New LinkButton
+ cmdDelete.CssClass = "CommandButton"
+ cmdDelete.Text = GetArticleResource("Delete")
+ cmdDelete.Attributes.Add("onClick", "javascript:return confirm('Are You Sure You Wish To Delete This Item ?');")
+ cmdDelete.CommandArgument = objComment.CommentID.ToString()
+ cmdDelete.CommandName = "DeleteComment"
+ Dim objHandler As New System.Web.UI.WebControls.CommandEventHandler(AddressOf Comment_Command)
+ AddHandler cmdDelete.Command, objHandler
+ objPlaceHolder.Add(cmdDelete)
+ End If
+ Case "EDIT"
+ If (ArticleSettings.IsAdmin() Or ArticleSettings.IsApprover() Or (UserId = objArticle.AuthorID And objArticle.AuthorID <> Null.NullInteger)) Then
+ Dim objHyperLink As New HyperLink
+ objHyperLink.CssClass = "CommandButton"
+ objHyperLink.Text = GetArticleResource("Edit")
+ objHyperLink.NavigateUrl = Common.GetModuleLink(ArticleModule.TabID, ArticleModule.ModuleID, "EditComment", ArticleSettings, "CommentID=" & objComment.CommentID.ToString(), "ReturnUrl=" & Server.UrlEncode(Request.RawUrl))
+ objHyperLink.EnableViewState = False
+ objPlaceHolder.Add(objHyperLink)
+ End If
+ Case "GRAVATARURL"
+ Dim objLiteral As New Literal
+ If Request.IsSecureConnection Then
+ If (objComment.UserID = Null.NullInteger) Then
+ objLiteral.Text = AddHTTP("secure.gravatar.com/avatar/" & MD5CalcString(objComment.AnonymousEmail.ToLower()))
+ Else
+ objLiteral.Text = AddHTTP("secure.gravatar.com/avatar/" & MD5CalcString(objComment.AuthorEmail.ToLower()))
+ End If
+ Else
+ If (objComment.UserID = Null.NullInteger) Then
+ objLiteral.Text = AddHTTP("www.gravatar.com/avatar/" & MD5CalcString(objComment.AnonymousEmail.ToLower()))
+ Else
+ objLiteral.Text = AddHTTP("www.gravatar.com/avatar/" & MD5CalcString(objComment.AuthorEmail.ToLower()))
+ End If
+ End If
+ objPlaceHolder.Add(objLiteral)
+ Case "HASANONYMOUSURL"
+ If (objComment.AnonymousURL = "") Then
+ While (iPtr < templateArray.Length - 1)
+ If (templateArray(iPtr + 1) = "/HASANONYMOUSURL") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+ Case "/HASANONYMOUSURL"
+ ' Do Nothing
+ Case "IPADDRESS"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objComment.RemoteAddress
+ objPlaceHolder.Add(objLiteral)
+ Case "ISANONYMOUS"
+ If (objComment.UserID <> -1) Then
+ While (iPtr < templateArray.Length - 1)
+ If (templateArray(iPtr + 1) = "/ISANONYMOUS") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+ Case "/ISANONYMOUS"
+ ' Do Nothing
+ Case "ISNOTANONYMOUS"
+ If (objComment.UserID = -1) Then
+ While (iPtr < templateArray.Length - 1)
+ If (templateArray(iPtr + 1) = "/ISNOTANONYMOUS") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+ Case "/ISNOTANONYMOUS"
+ ' Do Nothing
+ Case "ISCOMMENT"
+ If (objComment.Type <> 0) Then
+ While (iPtr < templateArray.Length - 1)
+ If (templateArray(iPtr + 1) = "/ISCOMMENT") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+ Case "/ISCOMMENT"
+ ' Do Nothing
+ Case "ISPINGBACK"
+ If (objComment.Type <> 2) Then
+ While (iPtr < templateArray.Length - 1)
+ If (templateArray(iPtr + 1) = "/ISPINGBACK") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+ Case "/ISTRACKBACK"
+ ' Do Nothing
+ Case "ISTRACKBACK"
+ If (objComment.Type <> 1) Then
+ While (iPtr < templateArray.Length - 1)
+ If (templateArray(iPtr + 1) = "/ISTRACKBACK") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+ Case "/ISTRACKBACK"
+ ' Do Nothing
+ Case "ISAUTHOR"
+ If (objComment.UserID = Null.NullInteger Or (objComment.UserID <> objArticle.AuthorID)) Then
+ While (iPtr < templateArray.Length - 1)
+ If (templateArray(iPtr + 1) = "/ISAUTHOR") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+ Case "/ISAUTHOR"
+ ' Do Nothing
+ Case "ITEMINDEX"
+ Dim objLiteral As New Literal
+ objLiteral.Text = Me.commentItemIndex.ToString()
+ objPlaceHolder.Add(objLiteral)
+ Case "MODULEID"
+ Dim objLiteral As New Literal
+ objLiteral.Text = ArticleModule.ModuleID
+ objPlaceHolder.Add(objLiteral)
+ Case "PINGBACKURL"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objComment.TrackbackUrl
+ objPlaceHolder.Add(objLiteral)
+ Case "TRACKBACKBLOGNAME"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objComment.TrackbackBlogName
+ objPlaceHolder.Add(objLiteral)
+ Case "TRACKBACKEXCERPT"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objComment.TrackbackExcerpt
+ objPlaceHolder.Add(objLiteral)
+ Case "TRACKBACKTITLE"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objComment.TrackbackTitle
+ objPlaceHolder.Add(objLiteral)
+ Case "TRACKBACKURL"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objComment.TrackbackUrl
+ objPlaceHolder.Add(objLiteral)
+
+ Case Else
+ If (templateArray(iPtr + 1).ToUpper().StartsWith("AUTHOR:")) Then
+ If Author(objComment.UserID) IsNot Nothing Then
+ ' token to be processed
+ Dim field As String = templateArray(iPtr + 1).Substring(7, templateArray(iPtr + 1).Length - 7).ToLower().Trim()
+
+ 'Gets the DNN profile property named like the token (field)
+ Dim profilePropertyFound As Boolean = False
+ Dim profilePropertyDataType As String = String.Empty
+ Dim profilePropertyName As String = String.Empty
+ Dim profilePropertyValue As String = String.Empty
+
+ For Each objProfilePropertyDefinition As ProfilePropertyDefinition In ProfileProperties
+ If (objProfilePropertyDefinition.PropertyName.ToLower().Trim() = field) Then
+
+ 'Gets the dnn profile property's datatype
+ Dim objListController As New ListController
+ Dim definitionEntry As ListEntryInfo = objListController.GetListEntryInfo(objProfilePropertyDefinition.DataType)
+ If Not definitionEntry Is Nothing Then
+ profilePropertyDataType = definitionEntry.Value
+ Else
+ profilePropertyDataType = "Unknown"
+ End If
+
+ 'Gets the dnn profile property's name and current value for the given user (Agent = AuthorID)
+ profilePropertyName = objProfilePropertyDefinition.PropertyName
+ profilePropertyValue = Author(objComment.UserID).Profile.GetPropertyValue(profilePropertyName)
+
+ profilePropertyFound = True
+
+ End If
+ Next
+
+ If profilePropertyFound Then
+
+ Select Case profilePropertyDataType.ToLower()
+ Case "truefalse"
+ Dim objTrueFalse As New CheckBox
+ If profilePropertyValue = String.Empty Then
+ objTrueFalse.Checked = False
+ Else
+ objTrueFalse.Checked = CType(profilePropertyValue, Boolean)
+ End If
+ objTrueFalse.Enabled = False
+ objTrueFalse.EnableViewState = False
+ objPlaceHolder.Add(objTrueFalse)
+
+ Case "richtext"
+ Dim objLiteral As New Literal
+ If profilePropertyValue = String.Empty Then
+ objLiteral.Text = String.Empty
+ Else
+ objLiteral.Text = Page.Server.HtmlDecode(profilePropertyValue)
+ End If
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+
+ Case "list"
+ Dim objLiteral As New Literal
+ objLiteral.Text = profilePropertyValue
+ Dim objListController As New ListController
+ Dim objListEntryInfoCollection As ListEntryInfoCollection = objListController.GetListEntryInfoCollection(profilePropertyName)
+ For Each objListEntryInfo As ListEntryInfo In objListEntryInfoCollection
+ If objListEntryInfo.Value = profilePropertyValue Then
+ objLiteral.Text = objListEntryInfo.Text
+ Exit For
+ End If
+ Next
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+
+ Case Else
+ Dim objLiteral As New Literal
+ If profilePropertyValue = String.Empty Then
+ objLiteral.Text = String.Empty
+ Else
+ If profilePropertyName.ToLower() = "website" Then
+ Dim url As String = profilePropertyValue
+ If url.ToLower.StartsWith("http://") Then
+ url = url.Substring(7) ' removes the "http://"
+ End If
+ objLiteral.Text = url
+ Else
+ objLiteral.Text = profilePropertyValue
+ End If
+ End If
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+ End Select 'profilePropertyDataType
+
+ End If ' DNN Profile property processing
+ End If
+ Exit Select
+ End If ' "AUTHOR:" token
+
+ If (templateArray(iPtr + 1).ToUpper().StartsWith("CREATEDATE:")) Then
+ Dim formatExpression As String = templateArray(iPtr + 1).Substring(11, templateArray(iPtr + 1).Length - 11)
+ Dim objLiteral As New Literal
+ objLiteral.Text = objComment.CreatedDate.ToString(formatExpression)
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+ End If
+
+ If (templateArray(iPtr + 1).ToUpper().StartsWith("COMMENT:")) Then
+ Dim count As String = templateArray(iPtr + 1).Substring(8, templateArray(iPtr + 1).Length - 8)
+ If (IsNumeric(count)) Then
+ Dim comment As String = objComment.Comment
+ If (StripHtml(objComment.Comment).TrimStart().Length > Convert.ToInt32(count)) Then
+ comment = Left(StripHtml(Server.HtmlDecode(objComment.Comment)).TrimStart(), Convert.ToInt32(count)) & "..."
+ End If
+ Dim objLiteral As New Literal
+ objLiteral.Text = comment
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+ End If
+ End If
+
+ If (templateArray(iPtr + 1).ToUpper().StartsWith("ISINROLE:")) Then
+ Dim field As String = templateArray(iPtr + 1).Substring(9, templateArray(iPtr + 1).Length - 9)
+ If (PortalSecurity.IsInRole(field) = False) Then
+ Dim endToken As String = "/" & templateArray(iPtr + 1)
+ While (iPtr < templateArray.Length - 1)
+ If (templateArray(iPtr + 1) = endToken) Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+ End If
+
+ End Select
+ End If
+
+ Next
+
+ End Sub
+
+ Public Sub ProcessFile(ByRef objPlaceHolder As ControlCollection, ByVal objArticle As ArticleInfo, ByVal objFile As FileInfo, ByVal templateArray As String())
+
+ For iPtr As Integer = 0 To templateArray.Length - 1 Step 2
+
+ objPlaceHolder.Add(New LiteralControl(ProcessImages(templateArray(iPtr).ToString())))
+
+ If iPtr < templateArray.Length - 1 Then
+ Select Case templateArray(iPtr + 1)
+
+ Case "ARTICLEID"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objFile.ArticleID.ToString()
+ objPlaceHolder.Add(objLiteral)
+
+ Case "FILEID"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objFile.FileID.ToString()
+ objPlaceHolder.Add(objLiteral)
+
+ Case "FILENAME"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objFile.FileName.ToString()
+ objPlaceHolder.Add(objLiteral)
+
+ Case "FILELINK"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objFile.Link
+ objPlaceHolder.Add(objLiteral)
+
+ Case "SIZE"
+ Dim objLiteral As New Literal
+ objLiteral.Text = Numeric2Bytes(objFile.Size)
+ objPlaceHolder.Add(objLiteral)
+
+ Case "SORTORDER"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objFile.SortOrder.ToString()
+ objPlaceHolder.Add(objLiteral)
+
+ Case "TITLE"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objFile.Title
+ objPlaceHolder.Add(objLiteral)
+
+ Case Else
+
+ If (templateArray(iPtr + 1).ToUpper().StartsWith("ISEXTENSION:")) Then
+ Dim field As String = templateArray(iPtr + 1).Substring(12, templateArray(iPtr + 1).Length - 12)
+
+ If (objFile.FileName.ToUpper().EndsWith(field.ToUpper()) = False) Then
+ Dim endToken As String = "/" & templateArray(iPtr + 1)
+ While (iPtr < templateArray.Length - 1)
+ If (templateArray(iPtr + 1) = endToken) Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+ End If
+
+ If (templateArray(iPtr + 1).ToUpper().StartsWith("ISNOTEXTENSION:")) Then
+ Dim field As String = templateArray(iPtr + 1).Substring(15, templateArray(iPtr + 1).Length - 15)
+
+ If (objFile.FileName.ToUpper().EndsWith(field.ToUpper()) = True) Then
+ Dim endToken As String = "/" & templateArray(iPtr + 1)
+ While (iPtr < templateArray.Length - 1)
+ If (templateArray(iPtr + 1) = endToken) Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+ End If
+
+ End Select
+ End If
+
+ Next
+
+ End Sub
+
+ Private imageIndex As Integer = 0
+ Public Sub ProcessImage(ByRef objPlaceHolder As ControlCollection, ByVal objArticle As ArticleInfo, ByVal objImage As ImageInfo, ByVal templateArray As String())
+
+ imageIndex = imageIndex + 1
+
+ For iPtr As Integer = 0 To templateArray.Length - 1 Step 2
+
+ objPlaceHolder.Add(New LiteralControl(ProcessImages(templateArray(iPtr).ToString()).Replace("{|", "[").Replace("|}", "]")))
+
+ If iPtr < templateArray.Length - 1 Then
+ Select Case templateArray(iPtr + 1)
+
+ Case "ARTICLEID"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objImage.ArticleID.ToString()
+ objPlaceHolder.Add(objLiteral)
+
+ Case "DESCRIPTION"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objImage.Description
+ objPlaceHolder.Add(objLiteral)
+
+ Case "FILENAME"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objImage.FileName.ToString()
+ objPlaceHolder.Add(objLiteral)
+
+ Case "HEIGHT"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objImage.Height.ToString()
+ objPlaceHolder.Add(objLiteral)
+
+ Case "IMAGEID"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objImage.ImageID.ToString()
+ objPlaceHolder.Add(objLiteral)
+
+ Case "IMAGELINK"
+ Dim objLiteral As New Literal
+ objLiteral.Text = PortalSettings.HomeDirectory & objImage.Folder & objImage.FileName
+ objPlaceHolder.Add(objLiteral)
+
+ Case "ITEMINDEX"
+ Dim objLiteral As New Literal
+ objLiteral.Text = imageIndex.ToString()
+ objPlaceHolder.Add(objLiteral)
+
+ Case "SIZE"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objImage.Size.ToString()
+ objPlaceHolder.Add(objLiteral)
+
+ Case "SORTORDER"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objImage.SortOrder.ToString()
+ objPlaceHolder.Add(objLiteral)
+
+ Case "TITLE"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objImage.Title
+ objPlaceHolder.Add(objLiteral)
+
+ Case "WIDTH"
+ Dim objLiteral As New Literal
+ objLiteral.Text = objImage.Width.ToString()
+ objPlaceHolder.Add(objLiteral)
+
+ Case Else
+
+ If (templateArray(iPtr + 1).ToUpper().StartsWith("IMAGETHUMB:")) Then
+ Dim val As String = templateArray(iPtr + 1).Substring(11, templateArray(iPtr + 1).Length - 11)
+ If (val.IndexOf(":"c) <> -1) Then
+ Dim width As Integer = Convert.ToInt32(val.Split(":"c)(0))
+ Dim height As Integer = Convert.ToInt32(val.Split(":"c)(1))
+
+ Dim objImageItem As New Image
+ If (ArticleSettings.ImageThumbnailType = ThumbnailType.Proportion) Then
+ objImageItem.ImageUrl = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & width.ToString() & "&Height=" & height.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(objImage.Folder & objImage.FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1")
+ Else
+ objImageItem.ImageUrl = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & width.ToString() & "&Height=" & width.ToString() & "&HomeDirectory=" & Server.UrlEncode(PortalSettings.HomeDirectory) & "&FileName=" & Server.UrlEncode(objImage.Folder & objImage.FileName) & "&PortalID=" & PortalSettings.PortalId.ToString() & "&q=1&s=1")
+ End If
+ objImageItem.EnableViewState = False
+ objImageItem.AlternateText = objArticle.Title
+ objPlaceHolder.Add(objImageItem)
+ End If
+ Exit Select
+ End If
+
+ If (templateArray(iPtr + 1).ToUpper().StartsWith("ISITEMINDEX:")) Then
+ Dim field As String = templateArray(iPtr + 1).Substring(12, templateArray(iPtr + 1).Length - 12)
+ If (field <> imageIndex.ToString()) Then
+ Dim endToken As String = "/" & templateArray(iPtr + 1)
+ While (iPtr < templateArray.Length - 1)
+ If (templateArray(iPtr + 1) = endToken) Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+ Exit Select
+ End If
+
+ If (templateArray(iPtr + 1).ToUpper().StartsWith("/ISITEMINDEX:")) Then
+ Exit Select
+ End If
+
+ If (templateArray(iPtr + 1).ToUpper().StartsWith("ISNOTITEMINDEX:")) Then
+ Dim field As String = templateArray(iPtr + 1).Substring(15, templateArray(iPtr + 1).Length - 15)
+ If (field = imageIndex.ToString()) Then
+ Dim endToken As String = "/" & templateArray(iPtr + 1)
+ While (iPtr < templateArray.Length - 1)
+ If (templateArray(iPtr + 1) = endToken) Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+ Exit Select
+ End If
+
+
+ If (templateArray(iPtr + 1).ToUpper().StartsWith("/ISNOTITEMINDEX:")) Then
+ Exit Select
+ End If
+
+ Dim objLiteralOther As New Literal
+ objLiteralOther.Text = "[" & templateArray(iPtr + 1) & "]"
+ objLiteralOther.EnableViewState = False
+ objPlaceHolder.Add(objLiteralOther)
+
+ End Select
+ End If
+
+ Next
+
+ End Sub
+
+#End Region
+
+#End Region
+
+#Region " Event Handlers "
+
+ Private Sub Comment_Command(ByVal sender As Object, ByVal e As CommandEventArgs)
+
+ Select Case e.CommandName.ToLower()
+
+ Case "deletecomment"
+ Dim objArticleController As New ArticleController()
+ Dim objArticle As ArticleInfo = objArticleController.GetArticle(Convert.ToInt32(Request("ArticleID")))
+
+ If (objArticle IsNot Nothing) Then
+ Dim objCommentController As New CommentController
+ objCommentController.DeleteComment(Convert.ToInt32(e.CommandArgument), objArticle.ArticleID)
+ End If
+
+ HttpContext.Current.Response.Redirect(Request.RawUrl, True)
+
+ End Select
+
+ End Sub
+
+#End Region
+
+ End Class
+
+End Namespace
diff --git a/Components/Layout/LayoutInfo.vb b/Components/Layout/LayoutInfo.vb
new file mode 100755
index 0000000..066ec5b
--- /dev/null
+++ b/Components/Layout/LayoutInfo.vb
@@ -0,0 +1,43 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Namespace Ventrian.NewsArticles
+
+ Public Class LayoutInfo
+
+#Region " Private Members "
+
+ Dim _template As String
+ Dim _tokens As String()
+
+#End Region
+
+#Region " Public Properties "
+
+ Public Property Template() As String
+ Get
+ Return _template
+ End Get
+ Set(ByVal Value As String)
+ _template = Value
+ End Set
+ End Property
+
+
+ Public Property Tokens() As String()
+ Get
+ Return _tokens
+ End Get
+ Set(ByVal Value As String())
+ _tokens = Value
+ End Set
+ End Property
+
+#End Region
+
+ End Class
+
+End Namespace
diff --git a/Components/Layout/LayoutType.vb b/Components/Layout/LayoutType.vb
new file mode 100755
index 0000000..b6414c8
--- /dev/null
+++ b/Components/Layout/LayoutType.vb
@@ -0,0 +1,62 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Namespace Ventrian.NewsArticles
+
+ Public Enum LayoutType
+
+ Category_Html
+ Category_Child_Html
+
+ Comment_Item_Html
+
+ Handout_Cover_Html
+ Handout_Header_Html
+ Handout_Item_Html
+ Handout_Footer_Html
+ Handout_End_Html
+
+ File_Header_Html
+ File_Item_Html
+ File_Footer_Html
+
+ Image_Header_Html
+ Image_Item_Html
+ Image_Footer_Html
+
+ Listing_Header_Html
+ Listing_Item_Html
+ Listing_Featured_Html
+ Listing_Footer_Html
+ Listing_Empty_Html
+
+ Menu_Item_Html
+
+ Print_Header_Html
+ Print_Item_Html
+ Print_Footer_Html
+
+ Related_Header_Html
+ Related_Item_Html
+ Related_Footer_Html
+
+ Rss_Header_Html
+ Rss_Item_Html
+ Rss_Footer_Html
+
+ Rss_Comment_Header_Html
+ Rss_Comment_Item_Html
+ Rss_Comment_Footer_Html
+
+ View_Item_Html
+ View_Title_Html
+ View_Description_Html
+ View_Keyword_Html
+ View_PageHeader_Html
+
+ End Enum
+
+End Namespace
diff --git a/Components/Layout/TokenProcessor.vb b/Components/Layout/TokenProcessor.vb
new file mode 100755
index 0000000..6330cfe
--- /dev/null
+++ b/Components/Layout/TokenProcessor.vb
@@ -0,0 +1,372 @@
+
+
+Imports System.Web.UI
+Imports System.Web.UI.WebControls
+Imports Ventrian.NewsArticles.Components.Common
+
+Imports DotNetNuke
+Imports DotNetNuke.Common
+Imports DotNetNuke.Entities.Portals
+Imports DotNetNuke.Services.Localization
+
+Imports Ventrian.NewsArticles.Base
+
+Namespace Ventrian.NewsArticles
+
+ Public Class TokenProcessor
+
+#Region " Private Methods "
+
+ Private Shared Function GetModuleLink(ByVal key As String, ByVal moduleContext As NewsArticleModuleBase) As String
+ Return Common.GetModuleLink(moduleContext.TabId, moduleContext.ModuleId, key, moduleContext.ArticleSettings)
+ End Function
+
+#End Region
+
+#Region " Process Menu "
+
+ Public Shared Sub ProcessMenu(ByRef placeHolder As ControlCollection, ByRef moduleContext As NewsArticleModuleBase, ByVal selectedMenu As MenuOptionType)
+
+ Dim objLayoutController As New LayoutController(moduleContext)
+ Dim objLayout As LayoutInfo = LayoutController.GetLayout(moduleContext, LayoutType.Menu_Item_Html)
+
+ For iPtr As Integer = 0 To objLayout.Tokens.Length - 1 Step 2
+
+ placeHolder.Add(New LiteralControl(objLayoutController.ProcessImages(objLayout.Tokens(iPtr).ToString())))
+
+ If iPtr < objLayout.Tokens.Length - 1 Then
+ ProcessMenuItem(objLayout.Tokens(iPtr + 1), placeHolder, objLayoutController, moduleContext, iPtr, objLayout.Tokens, selectedMenu)
+ End If
+
+ Next
+
+ End Sub
+
+ Public Shared Sub ProcessMenuItem(ByVal token As String, ByRef objPlaceHolder As ControlCollection, ByVal objLayoutController As LayoutController, ByVal moduleContext As NewsArticleModuleBase, ByRef iPtr As Integer, ByVal templateArray As String(), ByVal selectedMenu As MenuOptionType)
+
+ 'Dim path As String = objPage.TemplateSourceDirectory & "/DesktopModules/DnnForge - NewsArticles/" & Localization.LocalResourceDirectory & "/" & Localization.LocalSharedResourceFile
+ 'path = "~" & path.Substring(path.IndexOf("/DesktopModules/"), path.Length - path.IndexOf("/DesktopModules/"))
+
+ Dim path As String = "~/DesktopModules/DnnForge - NewsArticles/" & Localization.LocalResourceDirectory & "/" & Localization.LocalSharedResourceFile
+
+ Select Case token
+
+ Case "ADMINLINK"
+ Dim objLiteral As New Literal
+
+ Dim parameters As New List(Of String)
+ parameters.Add("mid=" & moduleContext.ModuleId)
+
+ If (moduleContext.ArticleSettings.AuthorUserIDFilter) Then
+ If (moduleContext.ArticleSettings.AuthorUserIDParam <> "") Then
+ If (HttpContext.Current.Request(moduleContext.ArticleSettings.AuthorUserIDParam) <> "") Then
+ parameters.Add(moduleContext.ArticleSettings.AuthorUserIDParam & "=" & HttpContext.Current.Request(moduleContext.ArticleSettings.AuthorUserIDParam))
+ End If
+ End If
+ End If
+
+ If (moduleContext.ArticleSettings.AuthorUsernameFilter) Then
+ If (moduleContext.ArticleSettings.AuthorUsernameParam <> "") Then
+ If (HttpContext.Current.Request(moduleContext.ArticleSettings.AuthorUsernameParam) <> "") Then
+ parameters.Add(moduleContext.ArticleSettings.AuthorUsernameParam & "=" & HttpContext.Current.Request(moduleContext.ArticleSettings.AuthorUsernameParam))
+ End If
+ End If
+ End If
+
+ objLiteral.Text = NavigateURL(moduleContext.TabId, "AdminOptions", parameters.ToArray())
+ objPlaceHolder.Add(objLiteral)
+
+ Case "ARCHIVESLINK"
+ Dim objLiteral As New Literal
+ objLiteral.Text = GetModuleLink("Archives", moduleContext)
+ objPlaceHolder.Add(objLiteral)
+
+ Case "APPROVEARTICLESLINK"
+ Dim objLiteral As New Literal
+ objLiteral.Text = GetModuleLink("ApproveArticles", moduleContext)
+ objPlaceHolder.Add(objLiteral)
+
+ Case "APPROVECOMMENTSLINK"
+ Dim objLiteral As New Literal
+ objLiteral.Text = GetModuleLink("ApproveComments", moduleContext)
+ objPlaceHolder.Add(objLiteral)
+
+ Case "CATEGORIESLINK"
+ Dim objLiteral As New Literal
+ objLiteral.Text = GetModuleLink("Archives", moduleContext)
+ objPlaceHolder.Add(objLiteral)
+
+ Case "CURRENTARTICLESLINK"
+ Dim objLiteral As New Literal
+ objLiteral.Text = GetModuleLink("", moduleContext)
+ objPlaceHolder.Add(objLiteral)
+
+ Case "HASCOMMENTSENABLED"
+ If (moduleContext.ArticleSettings.IsCommentsEnabled = False Or moduleContext.ArticleSettings.IsCommentModerationEnabled = False) Then
+ While (iPtr < templateArray.Length - 1)
+ If (templateArray(iPtr + 1) = "/HASCOMMENTSENABLED") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/HASCOMMENTSENABLED"
+ ' Do Nothing
+
+ Case "ISADMIN"
+ If (moduleContext.ArticleSettings.IsAdmin = False) Then
+ While (iPtr < templateArray.Length - 1)
+ If (templateArray(iPtr + 1) = "/ISADMIN") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/ISADMIN"
+ ' Do Nothing
+
+ Case "ISAPPROVER"
+ If (moduleContext.ArticleSettings.IsApprover = False) Then
+ While (iPtr < templateArray.Length - 1)
+ If (templateArray(iPtr + 1) = "/ISAPPROVER") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/ISAPPROVER"
+ ' Do Nothing
+
+ Case "ISSELECTEDADMIN"
+ If (selectedMenu <> MenuOptionType.AdminOptions) Then
+ While (iPtr < templateArray.Length - 1)
+ If (templateArray(iPtr + 1) = "/ISSELECTEDADMIN") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/ISSELECTEDADMIN"
+ ' Do Nothing
+
+ Case "ISSELECTEDAPPROVEARTICLES"
+ If (selectedMenu <> MenuOptionType.ApproveArticles) Then
+ While (iPtr < templateArray.Length - 1)
+ If (templateArray(iPtr + 1) = "/ISSELECTEDAPPROVEARTICLES") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/ISSELECTEDAPPROVEARTICLES"
+ ' Do Nothing
+
+ Case "ISSELECTEDAPPROVECOMMENTS"
+ If (selectedMenu <> MenuOptionType.ApproveComments) Then
+ While (iPtr < templateArray.Length - 1)
+ If (templateArray(iPtr + 1) = "/ISSELECTEDAPPROVECOMMENTS") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/ISSELECTEDAPPROVECOMMENTS"
+ ' Do Nothing
+
+ Case "ISSELECTEDCATEGORIES"
+ If (selectedMenu <> MenuOptionType.Categories) Then
+ While (iPtr < templateArray.Length - 1)
+ If (templateArray(iPtr + 1) = "/ISSELECTEDCATEGORIES") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/ISSELECTEDCATEGORIES"
+ ' Do Nothing
+
+ Case "ISSELECTEDCURRENTARTICLES"
+ If (selectedMenu <> MenuOptionType.CurrentArticles) Then
+ While (iPtr < templateArray.Length - 1)
+ If (templateArray(iPtr + 1) = "/ISSELECTEDCURRENTARTICLES") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/ISSELECTEDCURRENTARTICLES"
+ ' Do Nothing
+
+ Case "ISSELECTEDMYARTICLES"
+ If (selectedMenu <> MenuOptionType.MyArticles) Then
+ While (iPtr < templateArray.Length - 1)
+ If (templateArray(iPtr + 1) = "/ISSELECTEDMYARTICLES") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/ISSELECTEDMYARTICLES"
+ ' Do Nothing
+
+ Case "ISSELECTEDSEARCH"
+ If (selectedMenu <> MenuOptionType.Search) Then
+ While (iPtr < templateArray.Length - 1)
+ If (templateArray(iPtr + 1) = "/ISSELECTEDSEARCH") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/ISSELECTEDSEARCH"
+ ' Do Nothing
+
+ Case "ISSELECTEDSYNDICATION"
+ If (selectedMenu <> MenuOptionType.Syndication) Then
+ While (iPtr < templateArray.Length - 1)
+ If (templateArray(iPtr + 1) = "/ISSELECTEDSYNDICATION") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/ISSELECTEDSYNDICATION"
+ ' Do Nothing
+
+ Case "ISSELECTEDSUBMITARTICLE"
+ If (selectedMenu <> MenuOptionType.SubmitArticle) Then
+ While (iPtr < templateArray.Length - 1)
+ If (templateArray(iPtr + 1) = "/ISSELECTEDSUBMITARTICLE") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/ISSELECTEDSUBMITARTICLE"
+ ' Do Nothing
+
+ Case "ISSYNDICATIONENABLED"
+ If (moduleContext.ArticleSettings.IsSyndicationEnabled = False) Then
+ While (iPtr < templateArray.Length - 1)
+ If (templateArray(iPtr + 1) = "/ISSYNDICATIONENABLED") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/ISSYNDICATIONENABLED"
+ ' Do Nothing
+
+ Case "ISSUBMITTER"
+ If (moduleContext.ArticleSettings.IsSubmitter = False) Then
+ While (iPtr < templateArray.Length - 1)
+ If (templateArray(iPtr + 1) = "/ISSUBMITTER") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/ISSUBMITTER"
+ ' Do Nothing
+
+ Case "MYARTICLESLINK"
+ Dim objLiteral As New Literal
+ objLiteral.Text = GetModuleLink("MyArticles", moduleContext)
+ objPlaceHolder.Add(objLiteral)
+
+ Case "RSSLATESTLINK"
+ Dim objLiteral As New Literal
+ Dim authorIDParam As String = ""
+ If (moduleContext.ArticleSettings.AuthorUserIDFilter) Then
+ If (moduleContext.ArticleSettings.AuthorUserIDParam <> "") Then
+ If (HttpContext.Current.Request(moduleContext.ArticleSettings.AuthorUserIDParam) <> "") Then
+ authorIDParam = "&AuthorID=" & HttpContext.Current.Request(moduleContext.ArticleSettings.AuthorUserIDParam)
+ End If
+ End If
+ End If
+
+ If (moduleContext.ArticleSettings.AuthorUsernameFilter) Then
+ If (moduleContext.ArticleSettings.AuthorUsernameParam <> "") Then
+ If (HttpContext.Current.Request(moduleContext.ArticleSettings.AuthorUsernameParam) <> "") Then
+ Try
+ Dim objUser As Entities.Users.UserInfo = Entities.Users.UserController.GetUserByName(PortalController.GetCurrentPortalSettings().PortalId, HttpContext.Current.Request.QueryString(moduleContext.ArticleSettings.AuthorUsernameParam))
+ If (objUser IsNot Nothing) Then
+ authorIDParam = "&AuthorID=" & objUser.UserID.ToString()
+ End If
+ Catch
+ End Try
+ End If
+ End If
+ End If
+ objLiteral.Text = ArticleUtilities.ResolveUrl("~/DesktopModules/DnnForge%20-%20NewsArticles/Rss.aspx") & "?TabID=" & moduleContext.TabId & "&ModuleID=" & moduleContext.ModuleId & "&MaxCount=25" & authorIDParam
+ objPlaceHolder.Add(objLiteral)
+
+ Case "SEARCHLINK"
+ Dim objLiteral As New Literal
+ objLiteral.Text = GetModuleLink("Search", moduleContext)
+ objPlaceHolder.Add(objLiteral)
+
+ Case "SUBMITARTICLELINK"
+ Dim objLiteral As New Literal
+ If (moduleContext.ArticleSettings.LaunchLinks) Then
+ objLiteral.Text = GetModuleLink("Edit", moduleContext)
+ Else
+ objLiteral.Text = GetModuleLink("SubmitNews", moduleContext)
+ End If
+ objPlaceHolder.Add(objLiteral)
+
+ Case "SYNDICATIONLINK"
+ Dim objLiteral As New Literal
+ objLiteral.Text = GetModuleLink("Syndication", moduleContext)
+ objPlaceHolder.Add(objLiteral)
+
+ Case Else
+ Dim isRendered As Boolean = False
+
+ If (templateArray(iPtr + 1).ToUpper().StartsWith("RESX:")) Then
+ Dim key As String = templateArray(iPtr + 1).Substring(5, templateArray(iPtr + 1).Length - 5)
+ Dim objLiteral As New Literal
+ Try
+ objLiteral.Text = Localization.GetString(key & ".Text", path)
+ If (objLiteral.Text = "") Then
+ objLiteral.Text = templateArray(iPtr + 1).Substring(5, templateArray(iPtr + 1).Length - 5)
+ End If
+ Catch
+ objLiteral.Text = templateArray(iPtr + 1).Substring(5, templateArray(iPtr + 1).Length - 5)
+ End Try
+ objLiteral.EnableViewState = False
+ objPlaceHolder.Add(objLiteral)
+ isRendered = True
+ End If
+
+ If (isRendered = False) Then
+ Dim objLiteralOther As New Literal
+ objLiteralOther.Text = "[" & templateArray(iPtr + 1) & "]"
+ objLiteralOther.EnableViewState = False
+ objPlaceHolder.Add(objLiteralOther)
+ End If
+
+ End Select
+
+ End Sub
+
+
+#End Region
+
+ End Class
+
+End Namespace
diff --git a/Components/LayoutModeType.vb b/Components/LayoutModeType.vb
new file mode 100755
index 0000000..80e7385
--- /dev/null
+++ b/Components/LayoutModeType.vb
@@ -0,0 +1,16 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Namespace Ventrian.NewsArticles
+
+ Public Enum LayoutModeType
+
+ Simple
+ Advanced
+
+ End Enum
+
+End Namespace
diff --git a/Components/LinkFilterType.vb b/Components/LinkFilterType.vb
new file mode 100755
index 0000000..cd7d710
--- /dev/null
+++ b/Components/LinkFilterType.vb
@@ -0,0 +1,23 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.Configuration
+Imports System.Data
+
+Imports DotNetNuke.Common.Utilities
+
+Namespace Ventrian.NewsArticles
+
+ Public Enum LinkFilterType
+
+ None
+ Url
+ Page
+
+ End Enum
+
+End Namespace
diff --git a/Components/MatchOperator.vb b/Components/MatchOperator.vb
new file mode 100755
index 0000000..be9f9b4
--- /dev/null
+++ b/Components/MatchOperator.vb
@@ -0,0 +1,22 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.Configuration
+Imports System.Data
+
+Imports DotNetNuke.Common.Utilities
+
+Namespace Ventrian.NewsArticles
+
+ Public Enum MatchOperatorType
+
+ MatchAny
+ MatchAll
+
+ End Enum
+
+End Namespace
diff --git a/Components/MenuOptionType.vb b/Components/MenuOptionType.vb
new file mode 100755
index 0000000..55505c2
--- /dev/null
+++ b/Components/MenuOptionType.vb
@@ -0,0 +1,29 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.Configuration
+Imports System.Data
+
+Imports DotNetNuke.Common.Utilities
+
+Namespace Ventrian.NewsArticles
+
+ Public Enum MenuOptionType
+
+ CurrentArticles
+ Categories
+ Search
+ Syndication
+ MyArticles
+ SubmitArticle
+ ApproveArticles
+ ApproveComments
+ AdminOptions
+
+ End Enum
+
+End Namespace
diff --git a/Components/MirrorArticleController.vb b/Components/MirrorArticleController.vb
new file mode 100755
index 0000000..fc5fcd0
--- /dev/null
+++ b/Components/MirrorArticleController.vb
@@ -0,0 +1,41 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.Data
+
+Imports DotNetNuke
+Imports DotNetNuke.Common.Utilities
+
+Namespace Ventrian.NewsArticles
+
+ Public Class MirrorArticleController
+
+#Region " Public Methods "
+
+ Public Sub AddMirrorArticle(ByVal objMirrorArticle As MirrorArticleInfo)
+
+ DataProvider.Instance().AddMirrorArticle(objMirrorArticle.ArticleID, objMirrorArticle.LinkedArticleID, objMirrorArticle.LinkedPortalID, objMirrorArticle.AutoUpdate)
+
+ End Sub
+
+ Public Function GetMirrorArticle(ByVal articleID As Integer) As MirrorArticleInfo
+
+ Return CType(CBO.FillObject(DataProvider.Instance().GetMirrorArticle(articleID), GetType(MirrorArticleInfo)), MirrorArticleInfo)
+
+ End Function
+
+ Public Function GetMirrorArticleList(ByVal linkedArticleID As Integer) As ArrayList
+
+ Return CBO.FillCollection(DataProvider.Instance().GetMirrorArticleList(linkedArticleID), GetType(MirrorArticleInfo))
+
+ End Function
+
+#End Region
+
+ End Class
+
+End Namespace
\ No newline at end of file
diff --git a/Components/MirrorArticleInfo.vb b/Components/MirrorArticleInfo.vb
new file mode 100755
index 0000000..3a647b1
--- /dev/null
+++ b/Components/MirrorArticleInfo.vb
@@ -0,0 +1,102 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.Data
+
+Imports DotNetNuke
+Imports DotNetNuke.Common.Utilities
+Imports DotNetNuke.Entities.Portals
+
+Namespace Ventrian.NewsArticles
+
+ Public Class MirrorArticleInfo
+
+#Region " Private Methods "
+
+ ' local property declarations
+ Dim _articleID As Integer
+ Dim _linkedArticleID As Integer
+ Dim _linkedPortalID As Integer
+ Dim _autoUpdate As Boolean
+ Dim _portalName As String = ""
+ Dim _portalID As Integer
+
+#End Region
+
+#Region " Public Properties "
+
+ Public Property ArticleID() As Integer
+ Get
+ Return _articleID
+ End Get
+ Set(ByVal Value As Integer)
+ _articleID = Value
+ End Set
+ End Property
+
+ Public Property PortalID() As Integer
+ Get
+ Return _portalID
+ End Get
+ Set(ByVal Value As Integer)
+ _portalID = Value
+ End Set
+ End Property
+
+ Public Property LinkedArticleID() As Integer
+ Get
+ Return _linkedArticleID
+ End Get
+ Set(ByVal Value As Integer)
+ _linkedArticleID = Value
+ End Set
+ End Property
+
+ Public Property LinkedPortalID() As Integer
+ Get
+ Return _linkedPortalID
+ End Get
+ Set(ByVal Value As Integer)
+ _linkedPortalID = Value
+ End Set
+ End Property
+
+ Public Property AutoUpdate() As Boolean
+ Get
+ Return _autoUpdate
+ End Get
+ Set(ByVal Value As Boolean)
+ _autoUpdate = Value
+ End Set
+ End Property
+
+ Public ReadOnly Property PortalName() As String
+ Get
+ If (_portalName = "") Then
+ Dim objPortalController As New PortalController()
+ Dim objPortal As PortalInfo = objPortalController.GetPortal(LinkedPortalID)
+
+ If (objPortal IsNot Nothing) Then
+ _portalName = objPortal.PortalName
+
+ Dim o As New PortalAliasController
+ Dim portalAliases As ArrayList = o.GetPortalAliasArrayByPortalID(_linkedPortalID)
+
+ If (portalAliases.Count > 0) Then
+ _portalName = DotNetNuke.Common.AddHTTP(CType(portalAliases(0), PortalAliasInfo).HTTPAlias)
+ End If
+ End If
+ End If
+ Return _portalName
+ End Get
+ End Property
+
+#End Region
+
+ End Class
+
+End Namespace
\ No newline at end of file
diff --git a/Components/RatingController.vb b/Components/RatingController.vb
new file mode 100755
index 0000000..621344c
--- /dev/null
+++ b/Components/RatingController.vb
@@ -0,0 +1,103 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.Data
+Imports DotNetNuke.Common.Utilities
+Imports DotNetNuke.Framework
+
+Namespace Ventrian.NewsArticles
+
+ Public Class RatingController
+
+#Region " Static Methods "
+
+ Public Shared Sub ClearCache(ByVal moduleID As Integer)
+
+ Dim itemsToRemove As New List(Of String)()
+
+ Dim enumerator As IDictionaryEnumerator = HttpContext.Current.Cache.GetEnumerator()
+ While enumerator.MoveNext()
+ If enumerator.Key.ToString().ToLower().StartsWith("ventrian-newsarticles-rating-" & moduleID.ToString()) Then
+ itemsToRemove.Add(enumerator.Key.ToString())
+ End If
+ End While
+
+ For Each itemToRemove As String In itemsToRemove
+ DataCache.RemoveCache(itemToRemove.Replace("DNN_", ""))
+ Next
+
+ End Sub
+
+#End Region
+
+#Region " Public Methods "
+
+ Public Function Add(ByVal objRating As RatingInfo, ByVal moduleID As Integer) As Integer
+
+ Dim ratingID As Integer = CType(DataProvider.Instance().AddRating(objRating.ArticleID, objRating.UserID, objRating.CreatedDate, objRating.Rating), Integer)
+
+ ArticleController.ClearArticleCache(objRating.ArticleID)
+
+ Dim cacheKey As String = "ventrian-newsarticles-rating-" & moduleID.ToString() & "-aid-" & objRating.ArticleID.ToString() & "-" & objRating.UserID.ToString()
+ DataCache.RemoveCache(cacheKey)
+
+ Return ratingID
+
+ End Function
+
+ Public Function [Get](ByVal articleID As Integer, ByVal userID As Integer, ByVal moduleID As Integer) As RatingInfo
+
+ Dim cacheKey As String = "ventrian-newsarticles-rating-" & moduleID.ToString() & "-aid-" & articleID.ToString() & "-" & userID.ToString()
+
+ Dim objRating As RatingInfo = CType(DataCache.GetCache(cacheKey), RatingInfo)
+
+ If (objRating Is Nothing) Then
+ objRating = CType(CBO.FillObject(DataProvider.Instance().GetRating(articleID, userID), GetType(RatingInfo)), RatingInfo)
+ If (objRating IsNot Nothing) Then
+ DataCache.SetCache(cacheKey, objRating)
+ Else
+ objRating = New RatingInfo()
+ objRating.RatingID = Null.NullInteger
+ DataCache.SetCache(cacheKey, objRating)
+ End If
+ End If
+
+ Return objRating
+
+ End Function
+
+ Public Function [GetByID](ByVal ratingID As Integer, ByVal articleID As Integer, ByVal moduleID As Integer) As RatingInfo
+
+ Dim cacheKey As String = "ventrian-newsarticles-rating-" & moduleID.ToString() & "-id-" & ratingID.ToString()
+
+ Dim objRating As RatingInfo = CType(DataCache.GetCache(cacheKey), RatingInfo)
+
+ If (objRating Is Nothing) Then
+ objRating = CType(CBO.FillObject(DataProvider.Instance().GetRatingByID(ratingID), GetType(RatingInfo)), RatingInfo)
+ DataCache.SetCache(cacheKey, objRating)
+ End If
+
+ Return objRating
+
+ End Function
+
+ Public Sub Delete(ByVal ratingID As Integer, ByVal articleID As Integer, ByVal moduleID As Integer)
+
+ DataProvider.Instance().DeleteRating(ratingID)
+
+ ArticleController.ClearArticleCache(articleID)
+
+ Dim cacheKey As String = "ventrian-newsarticles-rating-" & moduleID.ToString() & "-id-" & ratingID.ToString()
+ DataCache.RemoveCache(cacheKey)
+
+ End Sub
+
+#End Region
+
+ End Class
+
+End Namespace
diff --git a/Components/RatingInfo.vb b/Components/RatingInfo.vb
new file mode 100755
index 0000000..64ac867
--- /dev/null
+++ b/Components/RatingInfo.vb
@@ -0,0 +1,72 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Namespace Ventrian.NewsArticles
+
+ Public Class RatingInfo
+
+#Region " Private Members "
+
+ Dim _ratingID As Integer
+ Dim _articleID As Integer
+ Dim _userID As Integer
+ Dim _createdDate As DateTime
+ Dim _rating As Double
+
+#End Region
+
+#Region " Public Properties "
+
+ Public Property RatingID() As Integer
+ Get
+ Return _ratingID
+ End Get
+ Set(ByVal Value As Integer)
+ _ratingID = Value
+ End Set
+ End Property
+
+ Public Property ArticleID() As Integer
+ Get
+ Return _articleID
+ End Get
+ Set(ByVal Value As Integer)
+ _articleID = Value
+ End Set
+ End Property
+
+ Public Property UserID() As Integer
+ Get
+ Return _userID
+ End Get
+ Set(ByVal Value As Integer)
+ _userID = Value
+ End Set
+ End Property
+
+ Public Property CreatedDate() As DateTime
+ Get
+ Return _createdDate
+ End Get
+ Set(ByVal Value As DateTime)
+ _createdDate = Value
+ End Set
+ End Property
+
+ Public Property Rating() As Double
+ Get
+ Return _rating
+ End Get
+ Set(ByVal Value As Double)
+ _rating = Value
+ End Set
+ End Property
+
+#End Region
+
+ End Class
+
+End Namespace
diff --git a/Components/RelatedType.vb b/Components/RelatedType.vb
new file mode 100755
index 0000000..3fbba3f
--- /dev/null
+++ b/Components/RelatedType.vb
@@ -0,0 +1,28 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.Configuration
+Imports System.Data
+
+Imports DotNetNuke.Common.Utilities
+
+Namespace Ventrian.NewsArticles
+
+ Public Enum RelatedType
+
+ None
+ MatchCategoriesAny
+ MatchCategoriesAll
+ MatchTagsAny
+ MatchTagsAll
+ MatchCategoriesAnyTagsAny
+ MatchCategoriesAllTagsAny
+ MatchCategoriesAnyTagsAll
+
+ End Enum
+
+End Namespace
diff --git a/Components/Social/Journal.vb b/Components/Social/Journal.vb
new file mode 100755
index 0000000..d5a5232
--- /dev/null
+++ b/Components/Social/Journal.vb
@@ -0,0 +1,94 @@
+Imports DotNetNuke.Services.Journal
+
+Namespace Ventrian.NewsArticles.Components.Social
+
+ Public Class Journal
+
+ Public Const ContentTypeName As String = "Ventrian_Article_"
+
+#Region "Internal Methods"
+
+ Friend Sub AddArticleToJournal(ByVal objArticle As ArticleInfo, ByVal portalId As Integer, ByVal tabId As Integer, ByVal journalUserId As Integer, ByVal journalGroupID As Integer, ByVal url As String)
+ Dim objectKey As String = "Ventrian_Article_" + objArticle.ArticleID.ToString() + "_" + journalGroupID.ToString()
+ Dim ji As JournalItem = JournalController.Instance.GetJournalItemByKey(portalId, objectKey)
+
+ If Not ji Is Nothing Then
+ JournalController.Instance.DeleteJournalItemByKey(portalId, objectKey)
+ End If
+
+ ji = New JournalItem
+
+ ji.PortalId = portalId
+ ji.ProfileId = journalUserId
+ ji.UserId = journalUserId
+ ji.ContentItemId = objArticle.ArticleID
+ ji.Title = objArticle.Title
+ ji.ItemData = New ItemData()
+ ji.ItemData.Url = url
+ ji.Summary = objArticle.Summary
+ ji.Body = Nothing
+ ji.JournalTypeId = 15
+ ji.ObjectKey = objectKey
+ ji.SecuritySet = "E,"
+ ji.SocialGroupId = journalGroupID
+
+ JournalController.Instance.SaveJournalItem(ji, tabId)
+ End Sub
+
+ Friend Sub AddCommentToJournal(ByVal objArticle As ArticleInfo, ByVal objComment As CommentInfo, ByVal portalId As Integer, ByVal tabId As Integer, ByVal journalUserId As Integer, ByVal url As String)
+ Dim objectKey As String = "Ventrian_Article_Comment_" + objArticle.ArticleID.ToString() + ":" + objComment.CommentID.ToString()
+ Dim ji As JournalItem = JournalController.Instance.GetJournalItemByKey(portalId, objectKey)
+
+ If Not ji Is Nothing Then
+ JournalController.Instance.DeleteJournalItemByKey(portalId, objectKey)
+ End If
+
+ ji = New JournalItem
+
+ ji.PortalId = portalId
+ ji.ProfileId = journalUserId
+ ji.UserId = journalUserId
+ ji.ContentItemId = objComment.CommentID
+ ji.Title = objArticle.Title
+ ji.ItemData = New ItemData()
+ ji.ItemData.Url = url
+ ji.Summary = objComment.Comment
+ ji.Body = Nothing
+ ji.JournalTypeId = 18
+ ji.ObjectKey = objectKey
+ ji.SecuritySet = "E,"
+
+ JournalController.Instance.SaveJournalItem(ji, tabId)
+ End Sub
+
+ Friend Sub AddRatingToJournal(ByVal objArticle As ArticleInfo, ByVal objRating As RatingInfo, ByVal portalId As Integer, ByVal tabId As Integer, ByVal journalUserId As Integer, ByVal url As String)
+ Dim objectKey As String = "Ventrian_Article_Rating_" + objArticle.ArticleID.ToString() + ":" + objRating.RatingID.ToString()
+ Dim ji As JournalItem = JournalController.Instance.GetJournalItemByKey(portalId, objectKey)
+
+ If Not ji Is Nothing Then
+ JournalController.Instance.DeleteJournalItemByKey(portalId, objectKey)
+ End If
+
+ ji = New JournalItem
+
+ ji.PortalId = portalId
+ ji.ProfileId = journalUserId
+ ji.UserId = journalUserId
+ ji.ContentItemId = objRating.RatingID
+ ji.Title = objArticle.Title
+ ji.ItemData = New ItemData()
+ ji.ItemData.Url = url
+ ji.Summary = objRating.Rating.ToString()
+ ji.Body = Nothing
+ ji.JournalTypeId = 17
+ ji.ObjectKey = objectKey
+ ji.SecuritySet = "E,"
+
+ JournalController.Instance.SaveJournalItem(ji, tabId)
+ End Sub
+
+#End Region
+
+ End Class
+
+End Namespace
diff --git a/Components/StatusType.vb b/Components/StatusType.vb
new file mode 100755
index 0000000..c21717d
--- /dev/null
+++ b/Components/StatusType.vb
@@ -0,0 +1,23 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.Configuration
+Imports System.Data
+
+Imports DotNetNuke.Common.Utilities
+
+Namespace Ventrian.NewsArticles
+
+ Public Enum StatusType
+
+ Draft
+ AwaitingApproval
+ Published
+
+ End Enum
+
+End Namespace
diff --git a/Components/SyndicationEnclosureType.vb b/Components/SyndicationEnclosureType.vb
new file mode 100755
index 0000000..1df6df1
--- /dev/null
+++ b/Components/SyndicationEnclosureType.vb
@@ -0,0 +1,22 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.Configuration
+Imports System.Data
+
+Imports DotNetNuke.Common.Utilities
+
+Namespace Ventrian.NewsArticles
+
+ Public Enum SyndicationEnclosureType
+
+ Attachment
+ Image
+
+ End Enum
+
+End Namespace
diff --git a/Components/SyndicationLinkType.vb b/Components/SyndicationLinkType.vb
new file mode 100755
index 0000000..d871667
--- /dev/null
+++ b/Components/SyndicationLinkType.vb
@@ -0,0 +1,22 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.Configuration
+Imports System.Data
+
+Imports DotNetNuke.Common.Utilities
+
+Namespace Ventrian.NewsArticles
+
+ Public Enum SyndicationLinkType
+
+ Article
+ Attachment
+
+ End Enum
+
+End Namespace
diff --git a/Components/TagController.vb b/Components/TagController.vb
new file mode 100755
index 0000000..6a7c587
--- /dev/null
+++ b/Components/TagController.vb
@@ -0,0 +1,112 @@
+Imports DotNetNuke.Common.Utilities
+
+Namespace Ventrian.NewsArticles
+
+ Public Class TagController
+
+#Region " Private Methods "
+
+ Private Sub RemoveCache(ByVal tagID As Integer)
+
+ Dim objTag As TagInfo = [Get](tagID)
+
+ If Not (objTag Is Nothing) Then
+ RemoveCache(objTag.ModuleID, objTag.TagID.ToString())
+ End If
+
+ End Sub
+
+ Private Sub RemoveCache(ByVal moduleID As Integer, ByVal nameLowered As String)
+
+ If Not (DataCache.GetCache("Tag-" & moduleID.ToString() & "-" & nameLowered) Is Nothing) Then
+ DataCache.RemoveCache("Tag-" & moduleID.ToString() & "-" & nameLowered)
+ End If
+
+ End Sub
+
+#End Region
+
+#Region " Public Methods "
+
+ Public Function [Get](ByVal tagID As Integer) As TagInfo
+
+ Return CType(CBO.FillObject(DataProvider.Instance().GetTag(tagID), GetType(TagInfo)), TagInfo)
+
+ End Function
+
+ Public Function [Get](ByVal moduleID As Integer, ByVal nameLowered As String) As TagInfo
+
+ Dim objTag As TagInfo = CType(DataCache.GetCache("Tag-" & moduleID.ToString() & "-" & nameLowered), TagInfo)
+
+ If (objTag Is Nothing) Then
+ objTag = CType(CBO.FillObject(DataProvider.Instance().GetTagByName(moduleID, nameLowered), GetType(TagInfo)), TagInfo)
+ If Not (objTag Is Nothing) Then
+ DataCache.SetCache("Tag-" & moduleID.ToString() & "-" & nameLowered, objTag)
+ End If
+ End If
+
+ Return objTag
+
+ End Function
+
+ Public Function List(ByVal moduleID As Integer, ByVal maxCount As Integer) As ArrayList
+
+ Return CBO.FillCollection(DataProvider.Instance().ListTag(moduleID, maxCount), GetType(TagInfo))
+
+ End Function
+
+ Public Function Add(ByVal objTag As TagInfo) As Integer
+
+ Return CType(DataProvider.Instance().AddTag(objTag.ModuleID, objTag.Name, objTag.NameLowered), Integer)
+
+ End Function
+
+ Public Sub Update(ByVal objTag As TagInfo)
+
+ RemoveCache(objTag.ModuleID, objTag.NameLowered)
+ DataProvider.Instance().UpdateTag(objTag.TagID, objTag.ModuleID, objTag.Name, objTag.NameLowered, objTag.Usages)
+
+ End Sub
+
+ Public Sub Delete(ByVal tagID As Integer)
+
+ RemoveCache(tagID)
+ DataProvider.Instance().DeleteTag(tagID)
+
+ End Sub
+
+ Public Sub DeleteArticleTag(ByVal articleID As Integer)
+
+ Dim objArticleController As New ArticleController()
+ Dim objArticle As ArticleInfo = objArticleController.GetArticle(articleID)
+
+ If Not (objArticle Is Nothing) Then
+ If (objArticle.Tags.Trim() <> "") Then
+ For Each tag As String In objArticle.Tags.Split(","c)
+ RemoveCache(objArticle.ModuleID, tag.ToLower())
+ Next
+ End If
+ End If
+ DataProvider.Instance().DeleteArticleTag(articleID)
+
+ End Sub
+
+ Public Sub DeleteArticleTagByTag(ByVal tagID As Integer)
+
+ RemoveCache(tagID)
+ DataProvider.Instance().DeleteArticleTag(tagID)
+
+ End Sub
+
+ Public Sub Add(ByVal articleID As Integer, ByVal tagID As Integer)
+
+ RemoveCache(tagID)
+ DataProvider.Instance().AddArticleTag(articleID, tagID)
+
+ End Sub
+
+#End Region
+
+ End Class
+
+End Namespace
diff --git a/Components/TagInfo.vb b/Components/TagInfo.vb
new file mode 100755
index 0000000..108b877
--- /dev/null
+++ b/Components/TagInfo.vb
@@ -0,0 +1,93 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Namespace Ventrian.NewsArticles
+
+ Public Class TagInfo
+ Implements IComparable
+
+#Region " Private Members "
+
+ Dim _tagID As Integer
+ Dim _moduleID As Integer
+ Dim _name As String
+ Dim _nameLowered As String
+ Dim _usages As Integer
+
+#End Region
+
+#Region " Public Properties "
+
+ Public Property TagID() As Integer
+ Get
+ Return _tagID
+ End Get
+ Set(ByVal Value As Integer)
+ _tagID = Value
+ End Set
+ End Property
+
+ Public Property ModuleID() As Integer
+ Get
+ Return _moduleID
+ End Get
+ Set(ByVal Value As Integer)
+ _moduleID = Value
+ End Set
+ End Property
+
+ Public Property Name() As String
+ Get
+ Return _name
+ End Get
+ Set(ByVal Value As String)
+ _name = Value
+ End Set
+ End Property
+
+ Public Property NameLowered() As String
+ Get
+ Return _nameLowered
+ End Get
+ Set(ByVal Value As String)
+ _nameLowered = Value
+ End Set
+ End Property
+
+ Public Property Usages() As Integer
+ Get
+ Return _usages
+ End Get
+ Set(ByVal Value As Integer)
+ _usages = Value
+ End Set
+ End Property
+
+#End Region
+
+#Region " Optional Interfaces "
+
+ Public Function CompareTo(ByVal obj As Object) As Integer _
+ Implements System.IComparable.CompareTo
+
+ If Not TypeOf obj Is TagInfo Then
+ Throw New Exception("Object is not TagInfo")
+ End If
+
+ Dim Compare As TagInfo = CType(obj, TagInfo)
+ Dim result As Integer = Me.Name.CompareTo(Compare.Name)
+
+ If result = 0 Then
+ result = Me.Name.CompareTo(Compare.Name)
+ End If
+ Return result
+ End Function
+
+#End Region
+
+ End Class
+
+End Namespace
\ No newline at end of file
diff --git a/Components/TemplateConstants.vb b/Components/TemplateConstants.vb
new file mode 100755
index 0000000..501653a
--- /dev/null
+++ b/Components/TemplateConstants.vb
@@ -0,0 +1,36 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+
+Namespace Ventrian.NewsArticles
+
+ Public Class TemplateConstants
+
+#Region " Constants "
+
+ ' Listing Settings
+ Public Const LISTING_ITEM As String = "Listing.Item"
+ Public Const LISTING_FEATURED As String = "Listing.Featured"
+ Public Const LISTING_HEADER As String = "Listing.Header"
+ Public Const LISTING_FOOTER As String = "Listing.Footer"
+
+ Public Const VIEW_HEADER As String = "View.Header"
+ Public Const VIEW_FOOTER As String = "View.Footer"
+ Public Const VIEW_ITEM As String = "View.Item"
+
+ Public Const COMMENT_ITEM As String = "Comment.Item"
+ Public Const COMMENT_HEADER As String = "Comment.Header"
+ Public Const COMMENT_FOOTER As String = "Comment.Footer"
+
+ Public Const MENU_ITEM As String = "Menu.Item"
+
+#End Region
+
+ End Class
+
+End Namespace
+
diff --git a/Components/TemplateController.vb b/Components/TemplateController.vb
new file mode 100755
index 0000000..965d82a
--- /dev/null
+++ b/Components/TemplateController.vb
@@ -0,0 +1,80 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.IO
+Imports System.Web.Caching
+Imports System.Xml
+
+Imports DotNetNuke.Common.Utilities
+Imports DotNetNuke.Entities.Portals
+
+Namespace Ventrian.NewsArticles
+
+ Public Class TemplateController
+
+#Region " Public Methods "
+
+ Public Function GetTemplate(ByVal name As String, ByVal portalSettings As PortalSettings, ByVal template As String, ByVal tabModuleID As Integer) As TemplateInfo
+ ' Me.MapPath("Templates/" & Template & "/")
+ ' Dim pathToTemplate As String = articleModuleBase.TemplatePath
+
+ Dim pathToTemplate As String = portalSettings.HomeDirectoryMapPath & "DnnForge - News Articles\Templates\Templates\" & template & "\"
+
+ Dim cacheKey As String = tabModuleID.ToString() & name
+ Dim cacheKeyXml As String = tabModuleID.ToString() & name & ".xml"
+
+ Dim objTemplate As TemplateInfo = CType(DataCache.GetCache(cacheKey), TemplateInfo)
+ Dim objTemplateXml As TemplateInfo = CType(DataCache.GetCache(cacheKeyXml), TemplateInfo)
+
+ If (objTemplate Is Nothing Or objTemplateXml Is Nothing) Then
+ Dim delimStr As String = "[]"
+ Dim delimiter As Char() = delimStr.ToCharArray()
+
+ objTemplate = New TemplateInfo
+
+ Dim path As String = pathToTemplate & name & ".html"
+ Dim pathXml As String = pathToTemplate & name & ".xml"
+
+ If (System.IO.File.Exists(path) = False) Then
+ ' path = articleModuleBase.MapPath("Templates/Default/") & name & ".html"
+ path = pathToTemplate & "Standard\" & name & ".html"
+ End If
+
+ Dim sr As System.IO.StreamReader = New System.IO.StreamReader(path)
+ Try
+ objTemplate.Template = sr.ReadToEnd()
+ Catch
+ objTemplate.Template = " ERROR: UNABLE TO READ '" & name & "' TEMPLATE:"
+ Finally
+ If Not sr Is Nothing Then sr.Close()
+ End Try
+
+ Dim doc As New XmlDocument
+ Try
+ doc.Load(pathXml)
+ Catch
+ ' Do Nothing
+ Finally
+ objTemplate.Xml = doc
+ End Try
+
+ objTemplate.Tokens = objTemplate.Template.Split(delimiter)
+
+ DataCache.SetCache(cacheKey, objTemplate, New CacheDependency(path))
+ DataCache.SetCache(cacheKeyXml, objTemplate, New CacheDependency(pathXml))
+ End If
+
+ Return objTemplate
+
+ End Function
+
+#End Region
+
+ End Class
+
+End Namespace
+
diff --git a/Components/TemplateInfo.vb b/Components/TemplateInfo.vb
new file mode 100755
index 0000000..b0a595a
--- /dev/null
+++ b/Components/TemplateInfo.vb
@@ -0,0 +1,53 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System.Xml
+
+Namespace Ventrian.NewsArticles
+
+ Public Class TemplateInfo
+
+#Region "Private Members"
+ Dim _template As String
+ Dim _tokens As String()
+ Dim _xml As XmlDocument
+#End Region
+
+#Region "Public Properties"
+
+ Public Property Template() As String
+ Get
+ Return _template
+ End Get
+ Set(ByVal Value As String)
+ _template = Value
+ End Set
+ End Property
+
+
+ Public Property Tokens() As String()
+ Get
+ Return _tokens
+ End Get
+ Set(ByVal Value As String())
+ _tokens = Value
+ End Set
+ End Property
+
+ Public Property Xml() As XmlDocument
+ Get
+ Return _xml
+ End Get
+ Set(ByVal Value As XmlDocument)
+ _xml = Value
+ End Set
+ End Property
+
+#End Region
+
+ End Class
+
+End Namespace
diff --git a/Components/ThumbnailType.vb b/Components/ThumbnailType.vb
new file mode 100755
index 0000000..3c2a75d
--- /dev/null
+++ b/Components/ThumbnailType.vb
@@ -0,0 +1,20 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2011
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.Configuration
+Imports System.Data
+
+Namespace Ventrian.NewsArticles
+
+ Public Enum ThumbnailType
+
+ Proportion
+ Square
+
+ End Enum
+
+End Namespace
diff --git a/Components/TitleReplacementType.vb b/Components/TitleReplacementType.vb
new file mode 100755
index 0000000..8c48441
--- /dev/null
+++ b/Components/TitleReplacementType.vb
@@ -0,0 +1,22 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.Configuration
+Imports System.Data
+
+Imports DotNetNuke.Common.Utilities
+
+Namespace Ventrian.NewsArticles
+
+ Public Enum TitleReplacementType
+
+ Dash = 0
+ Underscore = 1
+
+ End Enum
+
+End Namespace
diff --git a/Components/Tracking/Notification.vb b/Components/Tracking/Notification.vb
new file mode 100755
index 0000000..f0b5813
--- /dev/null
+++ b/Components/Tracking/Notification.vb
@@ -0,0 +1,44 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports DotNetNuke.Common.Utilities
+
+Imports System.Threading
+
+Namespace Ventrian.NewsArticles.Tracking
+
+ Public Class Notification
+
+ Dim t As Thread
+
+ Public Sub NotifyExternalSites(ByVal objArticle As ArticleInfo, ByVal articleLink As String, ByVal portalTitle As String)
+
+ Dim objNotification As New NotificationJob
+ objNotification.Article = objArticle
+ objNotification.ArticleLink = articleLink
+ objNotification.PortalTitle = portalTitle
+
+ Dim t As New Thread(AddressOf objNotification.NotifyLinkedSites)
+ t.IsBackground = True
+ t.Start()
+
+ End Sub
+
+ Public Sub NotifyWeblogs(ByVal articleLink As String, ByVal portalTitle As String)
+
+ Dim objPing As New PingJob
+ Dim t As New Thread(AddressOf objPing.NotifyWeblogs)
+ objPing.ArticleLink = articleLink
+ objPing.PortalTitle = portalTitle
+ t.IsBackground = True
+ t.Start()
+
+ End Sub
+
+
+ End Class
+
+End Namespace
diff --git a/Components/Tracking/NotificationJob.vb b/Components/Tracking/NotificationJob.vb
new file mode 100755
index 0000000..4a26e4f
--- /dev/null
+++ b/Components/Tracking/NotificationJob.vb
@@ -0,0 +1,58 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System.Collections.Specialized
+
+Namespace Ventrian.NewsArticles.Tracking
+
+ Public Class NotificationJob
+
+ Public Article As ArticleInfo
+ Public ArticleLink As String
+ Public PortalTitle As String
+
+ Public Sub NotifyLinkedSites()
+
+ Try
+
+ Dim links As New StringCollection
+ TrackHelper.BuildLinks(Article.Summary, links)
+ TrackHelper.BuildLinks(Article.Body, links)
+
+ For Each link As String In links
+
+ Try
+
+ Dim pageText As String = TrackHelper.GetPageText(link)
+
+ If Not (pageText Is Nothing) Then
+ Dim success As Boolean = False
+
+ Dim objTrackBackProxy As New TrackBackProxy
+ success = objTrackBackProxy.TrackBackPing(pageText, link, Article.Title, ArticleLink, PortalTitle, "")
+
+ If (success = False) Then
+ ' objEventLog.AddLog("Ping Exception", "Trackback failed ->" & link, DotNetNuke.Common.Globals.GetPortalSettings(), -1, DotNetNuke.Services.Log.EventLog.EventLogController.EventLogType.ADMIN_ALERT)
+
+ Dim objPingBackProxy As New PingBackProxy
+ objPingBackProxy.Ping(pageText, ArticleLink, link)
+ End If
+
+ End If
+
+ Catch
+ End Try
+
+ Next
+
+ Catch
+ End Try
+
+ End Sub
+
+ End Class
+
+End Namespace
diff --git a/Components/Tracking/PingBackProxy.resx b/Components/Tracking/PingBackProxy.resx
new file mode 100755
index 0000000..dd0ea4d
--- /dev/null
+++ b/Components/Tracking/PingBackProxy.resx
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 1.0.0.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
diff --git a/Components/Tracking/PingBackProxy.vb b/Components/Tracking/PingBackProxy.vb
new file mode 100755
index 0000000..51ed920
--- /dev/null
+++ b/Components/Tracking/PingBackProxy.vb
@@ -0,0 +1,82 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.Text.RegularExpressions
+
+Imports CookComputing.XmlRpc
+
+Namespace Ventrian.NewsArticles.Tracking
+
+ Public Class PingBackProxy
+ Inherits XmlRpcClientProtocol
+
+#Region " Private Members "
+
+ Dim _errorMessage As String
+
+#End Region
+
+#Region " Private Properties "
+
+ Private Property ErrorMessage() As String
+ Get
+ Return _errorMessage
+ End Get
+ Set(ByVal Value As String)
+ _errorMessage = Value
+ End Set
+ End Property
+
+#End Region
+
+#Region " Public Methods "
+
+ Public Function Ping(ByVal pageText As String, ByVal sourceURI As String, ByVal targetURI As String) As Boolean
+ Dim pingbackURL As String = GetPingBackURL(pageText, targetURI, sourceURI)
+ If Not pingbackURL Is Nothing Then
+ Me.Url = pingbackURL
+ Try
+ Notifiy(sourceURI, targetURI)
+ Return True
+ Catch ex As Exception
+ ErrorMessage = "Error: " + ex.Message
+ End Try
+ End If
+ Return False
+
+ End Function
+
+ _
+ Public Sub Notifiy(ByVal sourceURI As String, ByVal targetURI As String)
+
+ Invoke("Notifiy", New Object() {sourceURI, targetURI})
+
+ End Sub
+
+#End Region
+
+#Region " Private Methods "
+
+ Private Function GetPingBackURL(ByVal pageText As String, ByVal url As String, ByVal PostUrl As String) As String
+ If Not Regex.IsMatch(pageText, PostUrl, RegexOptions.IgnoreCase Or RegexOptions.Singleline) Then
+ If Not pageText Is Nothing Then
+ Dim pat As String = ""
+ Dim reg As Regex = New Regex(pat, RegexOptions.IgnoreCase Or RegexOptions.Singleline)
+ Dim m As Match = reg.Match(pageText)
+ If m.Success Then
+ Return m.Result("$1")
+ End If
+ End If
+ End If
+ Return Nothing
+ End Function
+
+#End Region
+
+ End Class
+
+End Namespace
diff --git a/Components/Tracking/PingJob.vb b/Components/Tracking/PingJob.vb
new file mode 100755
index 0000000..90a711d
--- /dev/null
+++ b/Components/Tracking/PingJob.vb
@@ -0,0 +1,34 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System.Collections.Specialized
+
+Namespace Ventrian.NewsArticles.Tracking
+
+ Public Class PingJob
+
+ Public ArticleLink As String
+ Public PortalTitle As String
+
+ Public Sub NotifyWeblogs()
+
+ Try
+
+ Dim objPing As New PingProxy
+ objPing.Ping(PortalTitle, ArticleLink)
+
+ Catch
+ ' Anything can happen here, so just swallow exception
+ Finally
+ Threading.Thread.CurrentThread.Abort()
+ End Try
+
+
+ End Sub
+
+ End Class
+
+End Namespace
diff --git a/Components/Tracking/PingProxy.resx b/Components/Tracking/PingProxy.resx
new file mode 100755
index 0000000..dd0ea4d
--- /dev/null
+++ b/Components/Tracking/PingProxy.resx
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 1.0.0.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
diff --git a/Components/Tracking/PingProxy.vb b/Components/Tracking/PingProxy.vb
new file mode 100755
index 0000000..804c1e5
--- /dev/null
+++ b/Components/Tracking/PingProxy.vb
@@ -0,0 +1,39 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.Text.RegularExpressions
+
+Imports CookComputing.XmlRpc
+
+Namespace Ventrian.NewsArticles.Tracking
+
+ Public Class PingProxy
+ Inherits XmlRpcClientProtocol
+
+#Region " Public Methods "
+
+ Public Function Ping(ByVal WeblogName As String, ByVal WeblogURL As String) As WeblogsUpdateResponse
+ Dim proxy As IWebLogsUpdate = CType(XmlRpcProxyGen.Create(GetType(IWebLogsUpdate)), IWebLogsUpdate)
+ Return proxy.Ping(WeblogName, WeblogURL)
+ End Function
+
+ Structure WeblogsUpdateResponse
+ Public flerror As Boolean
+ Public message As String
+ End Structure
+
+ _
+ Public Interface IWebLogsUpdate
+ _
+ Function Ping(ByVal WeblogName As String, ByVal WeblogURL As String) As WeblogsUpdateResponse
+ End Interface
+
+#End Region
+
+ End Class
+
+End Namespace
diff --git a/Components/Tracking/TrackBackProxy.vb b/Components/Tracking/TrackBackProxy.vb
new file mode 100755
index 0000000..aaa1b91
--- /dev/null
+++ b/Components/Tracking/TrackBackProxy.vb
@@ -0,0 +1,114 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System.IO
+Imports System.Net
+Imports System.Text.RegularExpressions
+
+Namespace Ventrian.NewsArticles.Tracking
+
+ Public Class TrackBackProxy
+
+#Region " Public Methods "
+
+ Public Function TrackBackPing(ByVal pageText As String, ByVal url As String, ByVal title As String, ByVal link As String, ByVal blogname As String, ByVal description As String) As Boolean
+
+ Dim objLogController As New DotNetNuke.Services.Log.EventLog.EventLogController
+ Dim objEventLog As New DotNetNuke.Services.Log.EventLog.EventLogController
+
+ ' objEventLog.AddLog("Ping Exception", "Ping with a Return URL of ->" & link, DotNetNuke.Common.Globals.GetPortalSettings(), -1, DotNetNuke.Services.Log.EventLog.EventLogController.EventLogType.ADMIN_ALERT)
+
+ Dim trackBackItem As String = GetTrackBackText(pageText, url, link)
+
+ If Not trackBackItem Is Nothing Then
+
+ If Not trackBackItem.ToLower().StartsWith("http://") Then
+ trackBackItem = "http://" + trackBackItem
+ End If
+
+ Dim parameters As String = "title=" + HtmlEncode(title) + "&url=" + HtmlEncode(link) + "&blog_name=" + HtmlEncode(blogname) + "&excerpt=" + HtmlEncode(description)
+ SendPing(trackBackItem, parameters)
+
+ Else
+
+ ' objEventLog.AddLog("Ping Exception", "Pinging ->" & link & " -> Trackback Text not found on this page!", DotNetNuke.Common.Globals.GetPortalSettings(), -1, DotNetNuke.Services.Log.EventLog.EventLogController.EventLogType.ADMIN_ALERT)
+
+ End If
+
+ Return True
+
+ End Function
+
+#End Region
+
+#Region " Private Methods "
+
+ Private Function GetTrackBackText(ByVal pageText As String, ByVal url As String, ByVal PostUrl As String) As String
+ If Not Regex.IsMatch(pageText, PostUrl, RegexOptions.IgnoreCase Or RegexOptions.Singleline) Then
+
+ Dim sPattern As String = "]*?>()?"
+ Dim r As Regex = New Regex(sPattern, RegexOptions.IgnoreCase)
+ Dim m As Match
+
+ m = r.Match(pageText)
+ While (m.Success)
+ If m.Groups.ToString().Length > 0 Then
+
+ Dim text As String = m.Groups(0).ToString()
+ If text.IndexOf(url) > 0 Then
+ Dim tbPattern As String = "trackback:ping=\""([^\""]+)\"""
+ Dim reg As Regex = New Regex(tbPattern, RegexOptions.IgnoreCase)
+ Dim m2 As Match = reg.Match(text)
+ If m2.Success Then
+ Return m2.Result("$1")
+ End If
+
+ Return text
+ End If
+ End If
+ m = m.NextMatch
+ End While
+ End If
+
+ Return Nothing
+
+ End Function
+
+ Private Function HtmlEncode(ByVal text As String) As String
+
+ Return System.Web.HttpUtility.HtmlEncode(text)
+
+ End Function
+
+ Private Sub SendPing(ByVal trackBackItem As String, ByVal parameters As String)
+
+ Dim myWriter As StreamWriter = Nothing
+
+ Dim request As HttpWebRequest = CType(HttpWebRequest.Create(trackBackItem), HttpWebRequest)
+ If Not (request Is Nothing) Then
+ request.UserAgent = "My User Agent String"
+ request.Referer = "http://www.smcculloch.net/"
+ request.Timeout = 60000
+ End If
+
+ request.Method = "POST"
+ request.ContentLength = parameters.Length
+ request.ContentType = "application/x-www-form-urlencoded"
+ request.KeepAlive = False
+
+ ' Try
+ myWriter = New StreamWriter(request.GetRequestStream())
+ myWriter.Write(parameters)
+ 'Finally
+ myWriter.Close()
+ ' End Try
+ End Sub
+
+#End Region
+
+ End Class
+
+End Namespace
diff --git a/Components/Tracking/TrackHelper.vb b/Components/Tracking/TrackHelper.vb
new file mode 100755
index 0000000..21df027
--- /dev/null
+++ b/Components/Tracking/TrackHelper.vb
@@ -0,0 +1,61 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.Collections.Specialized
+Imports System.IO
+Imports System.Net
+Imports System.Text
+Imports System.Text.RegularExpressions
+
+Namespace Ventrian.NewsArticles.Tracking
+
+ Public Class TrackHelper
+
+ Public Shared Function BuildLinks(ByVal text As String, ByRef links As StringCollection) As StringCollection
+
+ Dim pattern As String = "(?:[hH][rR][eE][fF]\s*=)(?:[\s""""']*)(?!#|[Mm]ailto|[lL]ocation.|[jJ]avascript|.*css|.*this\.)(.*?)(?:[\s>""""'])"
+
+ Dim r As New Regex(pattern, RegexOptions.IgnoreCase)
+
+ Dim m As Match = r.Match(Common.HtmlDecode(text))
+ Dim link As String = ""
+ While (m.Success)
+ If (m.Groups.ToString().Length > 0) Then
+ link = m.Groups(1).ToString()
+ If (links.Contains(link) = False) Then
+ links.Add(link)
+ End If
+ End If
+ m = m.NextMatch
+ End While
+
+ Return links
+
+ End Function
+
+ Public Shared Function GetPageText(ByVal inURL As String) As String
+
+ Dim req As WebRequest = WebRequest.Create(inURL)
+ Dim wreq As HttpWebRequest = CType(req, HttpWebRequest)
+ If Not (wreq Is Nothing) Then
+ wreq.UserAgent = "My User Agent String"
+ wreq.Referer = "http://www.wwwcoder.com/"
+ wreq.Timeout = 60000
+ End If
+ Dim response As HttpWebResponse = CType(wreq.GetResponse, HttpWebResponse)
+ Dim s As Stream = response.GetResponseStream
+ Dim enc As String = response.ContentEncoding.Trim
+ If enc = "" Then enc = "us-ascii"
+ Dim encode As Encoding = System.Text.Encoding.GetEncoding(enc)
+ Dim sr As StreamReader = New StreamReader(s, encode)
+ Return sr.ReadToEnd
+
+ End Function
+
+ End Class
+
+End Namespace
diff --git a/Components/Types/AuthorSelectType.vb b/Components/Types/AuthorSelectType.vb
new file mode 100755
index 0000000..60b1371
--- /dev/null
+++ b/Components/Types/AuthorSelectType.vb
@@ -0,0 +1,22 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.Configuration
+Imports System.Data
+
+Imports DotNetNuke.Common.Utilities
+
+Namespace Ventrian.NewsArticles.Components.Types
+
+ Public Enum AuthorSelectType
+
+ ByDropdown
+ ByUsername
+
+ End Enum
+
+End Namespace
diff --git a/Components/Types/MenuPositionType.vb b/Components/Types/MenuPositionType.vb
new file mode 100755
index 0000000..dca144a
--- /dev/null
+++ b/Components/Types/MenuPositionType.vb
@@ -0,0 +1,22 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.Configuration
+Imports System.Data
+
+Imports DotNetNuke.Common.Utilities
+
+Namespace Ventrian.NewsArticles.Components.Types
+
+ Public Enum MenuPositionType
+
+ Top
+ Bottom
+
+ End Enum
+
+End Namespace
diff --git a/Components/Types/TextEditorModeType.vb b/Components/Types/TextEditorModeType.vb
new file mode 100755
index 0000000..11f430f
--- /dev/null
+++ b/Components/Types/TextEditorModeType.vb
@@ -0,0 +1,22 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.Configuration
+Imports System.Data
+
+Imports DotNetNuke.Common.Utilities
+
+Namespace Ventrian.NewsArticles.Components.Types
+
+ Public Enum TextEditorModeType
+
+ Basic
+ Rich
+
+ End Enum
+
+End Namespace
diff --git a/Components/Types/UrlModeType.vb b/Components/Types/UrlModeType.vb
new file mode 100755
index 0000000..b2f0347
--- /dev/null
+++ b/Components/Types/UrlModeType.vb
@@ -0,0 +1,22 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.Configuration
+Imports System.Data
+
+Imports DotNetNuke.Common.Utilities
+
+Namespace Ventrian.NewsArticles.Components.Types
+
+ Public Enum UrlModeType
+
+ Classic
+ Shorterned
+
+ End Enum
+
+End Namespace
diff --git a/Components/UserTime.vb b/Components/UserTime.vb
new file mode 100755
index 0000000..f03ba72
--- /dev/null
+++ b/Components/UserTime.vb
@@ -0,0 +1,91 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System
+Imports System.Data
+Imports System.web
+
+Imports DotNetNuke
+Imports DotNetNuke.Common.Utilities
+Imports DotNetNuke.Entities.Portals
+Imports DotNetNuke.Entities.Users
+
+Namespace Ventrian.NewsArticles
+
+ Public Class UserTime1
+
+ Public Sub New()
+
+ End Sub
+
+ Public Function ConvertToUserTime(ByVal dt As DateTime, ByVal ClientTimeZone As Double) As DateTime
+
+ Dim _portalSettings As PortalSettings = PortalController.GetCurrentPortalSettings
+
+ Return dt.AddMinutes(ClientTimeZone)
+
+ End Function
+
+ Public Function ConvertToServerTime(ByVal dt As DateTime, ByVal ClientTimeZone As Double) As DateTime
+
+ Dim _portalSettings As PortalSettings = PortalController.GetCurrentPortalSettings
+
+ Return dt.AddMinutes(ClientTimeZone * -1)
+
+
+ End Function
+
+ Public ReadOnly Property ClientToServerTimeZoneFactor(ByVal serverTimeZoneOffet As Integer) As Double
+
+ Get
+
+ Dim objUserInfo As UserInfo = UserController.GetCurrentUserInfo
+ Return FromClientToServerFactor(objUserInfo.Profile.TimeZone, serverTimeZoneOffet)
+
+ End Get
+
+ End Property
+
+ Public ReadOnly Property PortalToServerTimeZoneFactor(ByVal serverTimeZoneOffet As Integer) As Double
+
+ Get
+
+ Dim _portalSettings As PortalSettings = PortalController.GetCurrentPortalSettings
+ Return FromClientToServerFactor(_portalSettings.TimeZoneOffset, serverTimeZoneOffet)
+
+ End Get
+
+ End Property
+
+
+ Public ReadOnly Property ServerToClientTimeZoneFactor() As Double
+
+ Get
+
+ Dim objUser As UserInfo = UserController.GetCurrentUserInfo()
+ Dim _portalSettings As PortalSettings = PortalController.GetCurrentPortalSettings
+ Return FromServerToClientFactor(objUser.Profile.TimeZone, _portalSettings.TimeZoneOffset)
+
+ End Get
+
+ End Property
+
+ Private Function FromClientToServerFactor(ByVal Client As Double, ByVal Server As Double) As Double
+
+ Return Client - Server
+
+ End Function
+
+ Private Function FromServerToClientFactor(ByVal Client As Double, ByVal Server As Double) As Double
+
+ Return Server - Client
+
+ End Function
+
+ End Class
+
+End Namespace
+
diff --git a/Components/Utility/LocalizationUtil.vb b/Components/Utility/LocalizationUtil.vb
new file mode 100755
index 0000000..5f47a1e
--- /dev/null
+++ b/Components/Utility/LocalizationUtil.vb
@@ -0,0 +1,140 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2008
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports System.IO
+Imports System.Xml
+
+Imports DotNetNuke.Common
+Imports DotNetNuke.Common.Utilities
+Imports DotNetNuke.Entities.Portals
+Imports DotNetNuke.Services.Localization
+
+Namespace Ventrian.NewsArticles.Components.Utility
+
+ Public Class LocalizationUtil
+
+#Region " Private Members "
+
+ Private Shared _strUseLanguageInUrlDefault As String = Null.NullString
+
+#End Region
+
+#Region " Public Methods "
+
+ Private Shared Function GetHostSettingAsBoolean(ByVal key As String, ByVal defaultValue As Boolean) As Boolean
+ Dim retValue As Boolean = defaultValue
+ Try
+ Dim setting As String = DotNetNuke.Entities.Host.HostSettings.GetHostSetting(key)
+ If String.IsNullOrEmpty(setting) = False Then
+ retValue = (setting.ToUpperInvariant().StartsWith("Y") OrElse setting.ToUpperInvariant = "TRUE")
+ End If
+ Catch ex As Exception
+ 'we just want to trap the error as we may not be installed so there will be no Settings
+ End Try
+ Return retValue
+ End Function
+
+ Private Shared Function GetPortalSettingAsBoolean(ByVal portalID As Integer, ByVal key As String, ByVal defaultValue As Boolean) As Boolean
+ Dim retValue As Boolean = defaultValue
+ Try
+ Dim setting As String = DotNetNuke.Entities.Portals.PortalSettings.GetSiteSetting(portalID, key)
+ If String.IsNullOrEmpty(setting) = False Then
+ retValue = (setting.ToUpperInvariant().StartsWith("Y") OrElse setting.ToUpperInvariant = "TRUE")
+ End If
+ Catch ex As Exception
+ 'we just want to trap the error as we may not be installed so there will be no Settings
+ End Try
+ Return retValue
+ End Function
+
+ Public Shared Function UseLanguageInUrl() As Boolean
+
+ Dim hostSetting As String = DotNetNuke.Entities.Host.HostSettings.GetHostSetting("EnableUrlLanguage")
+ If (hostSetting <> "") Then
+ Return GetHostSettingAsBoolean("EnableUrlLanguage", True)
+ End If
+
+ Dim objSettings As PortalSettings = PortalController.GetCurrentPortalSettings()
+ Dim portalSetting As String = DotNetNuke.Entities.Portals.PortalSettings.GetSiteSetting(objSettings.PortalId, "EnableUrlLanguage")
+ If (portalSetting <> "") Then
+ Return GetPortalSettingAsBoolean(objSettings.PortalId, "EnableUrlLanguage", True)
+ End If
+
+ If (File.Exists(HttpContext.Current.Server.MapPath(Localization.ApplicationResourceDirectory + "/Locales.xml")) = False) Then
+ Return GetHostSettingAsBoolean("EnableUrlLanguage", True)
+ End If
+
+ Dim cacheKey As String = ""
+ Dim objPortalSettings As PortalSettings = PortalController.GetCurrentPortalSettings()
+ Dim useLanguage As Boolean = False
+
+ ' check default host setting
+ If String.IsNullOrEmpty(_strUseLanguageInUrlDefault) Then
+ Dim xmldoc As New XmlDocument
+ Dim languageInUrl As XmlNode
+
+ xmldoc.Load(HttpContext.Current.Server.MapPath(Localization.ApplicationResourceDirectory + "/Locales.xml"))
+ languageInUrl = xmldoc.SelectSingleNode("//root/languageInUrl")
+ If Not languageInUrl Is Nothing Then
+ _strUseLanguageInUrlDefault = languageInUrl.Attributes("enabled").InnerText
+ Else
+ Try
+ Dim version As Integer = Convert.ToInt32(PortalController.GetCurrentPortalSettings().Version.Replace(".", ""))
+ If (version >= 490) Then
+ _strUseLanguageInUrlDefault = "true"
+ Else
+ _strUseLanguageInUrlDefault = "false"
+ End If
+ Catch
+ _strUseLanguageInUrlDefault = "false"
+ End Try
+ End If
+ End If
+ useLanguage = Boolean.Parse(_strUseLanguageInUrlDefault)
+
+ ' check current portal setting
+ Dim FilePath As String = HttpContext.Current.Server.MapPath(Localization.ApplicationResourceDirectory + "/Locales.Portal-" + objPortalSettings.PortalId.ToString + ".xml")
+ If File.Exists(FilePath) Then
+ cacheKey = "dotnetnuke-uselanguageinurl" & objPortalSettings.PortalId.ToString
+ Try
+ Dim o As Object = DataCache.GetCache(cacheKey)
+ If o Is Nothing Then
+ Dim xmlLocales As New XmlDocument
+ Dim bXmlLoaded As Boolean = False
+
+ xmlLocales.Load(FilePath)
+ bXmlLoaded = True
+
+ Dim d As New XmlDocument
+ d.Load(FilePath)
+
+ If bXmlLoaded AndAlso Not xmlLocales.SelectSingleNode("//locales/languageInUrl") Is Nothing Then
+ useLanguage = Boolean.Parse(xmlLocales.SelectSingleNode("//locales/languageInUrl").Attributes("enabled").InnerText)
+ End If
+ If Globals.PerformanceSetting <> Globals.PerformanceSettings.NoCaching Then
+ Dim dp As New CacheDependency(FilePath)
+ DataCache.SetCache(cacheKey, useLanguage, dp)
+ End If
+ Else
+ useLanguage = CType(o, Boolean)
+ End If
+ Catch ex As Exception
+ End Try
+
+ Return useLanguage
+ Else
+ Return useLanguage
+ End If
+
+ End Function
+
+#End Region
+
+ End Class
+
+End Namespace
+
+
diff --git a/Components/Validators/CheckBoxListValidator.vb b/Components/Validators/CheckBoxListValidator.vb
new file mode 100755
index 0000000..1d5adfd
--- /dev/null
+++ b/Components/Validators/CheckBoxListValidator.vb
@@ -0,0 +1,114 @@
+Imports System.Web
+Imports System
+Imports System.ComponentModel
+Imports System.Collections.Generic
+Imports System.IO
+Imports System.Text
+Imports System.Web.UI
+Imports System.Web.UI.WebControls
+Imports System.Xml
+
+Namespace Ventrian.NewsArticles.Components.Validators
+ Public Class CheckBoxListValidator
+ Inherits BaseValidator
+ _
+ Public Property MinimumNumberOfSelectedCheckBoxes() As Integer
+ Get
+ Dim o As Object = ViewState("MinimumNumberOfSelectedCheckBoxes")
+ If o Is Nothing Then
+ Return 1
+ Else
+ Return CInt(o)
+ End If
+ End Get
+ Set(ByVal value As Integer)
+ ViewState("MinimumNumberOfSelectedCheckBoxes") = value
+ End Set
+ End Property
+
+ Private _ctrlToValidate As CheckBoxList = Nothing
+ Protected ReadOnly Property CheckBoxListToValidate() As CheckBoxList
+ Get
+ If _ctrlToValidate Is Nothing Then
+ _ctrlToValidate = TryCast(FindControl(Me.ControlToValidate), CheckBoxList)
+ End If
+
+ Return _ctrlToValidate
+ End Get
+ End Property
+
+ Protected Overloads Overrides Function ControlPropertiesValid() As Boolean
+ ' Make sure ControlToValidate is set
+ If Me.ControlToValidate.Length = 0 Then
+ Throw New HttpException(String.Format("The ControlToValidate property of '{0}' cannot be blank.", Me.ID))
+ End If
+
+ ' Ensure that the control being validated is a CheckBoxList
+ If CheckBoxListToValidate Is Nothing Then
+ Throw New HttpException(String.Format("The CheckBoxListValidator can only validate controls of type CheckBoxList."))
+ End If
+
+ ' ... and that it has at least MinimumNumberOfSelectedCheckBoxes ListItems
+ 'If CheckBoxListToValidate.Items.Count < MinimumNumberOfSelectedCheckBoxes Then
+ ' Throw New HttpException(String.Format("MinimumNumberOfSelectedCheckBoxes must be set to a value greater than or equal to the number of ListItems; MinimumNumberOfSelectedCheckBoxes is set to {0}, but there are only {1} ListItems in '{2}'", MinimumNumberOfSelectedCheckBoxes, CheckBoxListToValidate.Items.Count, CheckBoxListToValidate.ID))
+ 'End If
+
+ Return True
+ ' if we reach here, everything checks out
+ End Function
+
+ Protected Overloads Overrides Function EvaluateIsValid() As Boolean
+ ' Make sure that the CheckBoxList has at least MinimumNumberOfSelectedCheckBoxes ListItems selected
+ Dim selectedItemCount As Integer = 0
+ For Each cb As ListItem In CheckBoxListToValidate.Items
+ If cb.Selected Then
+ selectedItemCount += 1
+ End If
+ Next
+
+ Return selectedItemCount >= MinimumNumberOfSelectedCheckBoxes
+ End Function
+
+ Protected Overloads Overrides Sub AddAttributesToRender(ByVal writer As HtmlTextWriter)
+ MyBase.AddAttributesToRender(writer)
+
+ ' Add the client-side code (if needed)
+ If Me.RenderUplevel Then
+ ' Indicate the mustBeChecked value and the client-side function to used for evaluation
+ ' Use AddAttribute if Helpers.EnableLegacyRendering is true; otherwise, use expando attributes
+ If EnableLegacyRendering() Then
+ writer.AddAttribute("evaluationfunction", "CheckBoxListValidatorEvaluateIsValid", False)
+ writer.AddAttribute("minimumNumberOfSelectedCheckBoxes", MinimumNumberOfSelectedCheckBoxes.ToString(), False)
+ Else
+ Me.Page.ClientScript.RegisterExpandoAttribute(Me.ClientID, "evaluationfunction", "CheckBoxListValidatorEvaluateIsValid", False)
+ Me.Page.ClientScript.RegisterExpandoAttribute(Me.ClientID, "minimumNumberOfSelectedCheckBoxes", MinimumNumberOfSelectedCheckBoxes.ToString(), False)
+ End If
+ End If
+ End Sub
+
+ Protected Overloads Overrides Sub OnPreRender(ByVal e As EventArgs)
+ MyBase.OnPreRender(e)
+
+ ' Register the client-side function using WebResource.axd (if needed)
+ ' see: http://aspnet.4guysfromrolla.com/articles/080906-1.aspx
+ If Me.RenderUplevel AndAlso Me.Page IsNot Nothing AndAlso Not Me.Page.ClientScript.IsClientScriptIncludeRegistered(Me.[GetType](), "VentrianValidators") Then
+ Me.Page.ClientScript.RegisterClientScriptInclude(Me.[GetType](), "VentrianValidators", Me.Page.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/Includes/VentrianValidators.js"))
+ End If
+ End Sub
+
+ Private Function EnableLegacyRendering() As Boolean
+ Dim result As Boolean
+
+ Try
+ Dim webConfigFile As String = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, "web.config")
+ Dim webConfigReader As New XmlTextReader(New StreamReader(webConfigFile))
+ result = ((webConfigReader.ReadToFollowing("xhtmlConformance")) AndAlso (webConfigReader.GetAttribute("mode") = "Legacy"))
+ webConfigReader.Close()
+ Catch
+ result = False
+ End Try
+ Return result
+ End Function
+
+ End Class
+End Namespace
diff --git a/Components/WatermarkPosition.vb b/Components/WatermarkPosition.vb
new file mode 100755
index 0000000..ac974ab
--- /dev/null
+++ b/Components/WatermarkPosition.vb
@@ -0,0 +1,14 @@
+Namespace Ventrian.NewsArticles
+
+ Public Enum WatermarkPosition
+
+ TopLeft
+ TopRight
+ BottomLeft
+ BottomRight
+
+ End Enum
+
+End Namespace
+
+
diff --git a/Components/WebControls/PagingControl.vb b/Components/WebControls/PagingControl.vb
new file mode 100755
index 0000000..3228708
--- /dev/null
+++ b/Components/WebControls/PagingControl.vb
@@ -0,0 +1,391 @@
+'
+' DotNetNuke® - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by DotNetNuke Corporation
+'
+' Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
+' documentation files (the "Software"), to deal in the Software without restriction, including without limitation
+' the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
+' to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+'
+' The above copyright notice and this permission notice shall be included in all copies or substantial portions
+' of the Software.
+'
+' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+' TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+' THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+' CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+' DEALINGS IN THE SOFTWARE.
+'
+
+Imports System.ComponentModel
+Imports System.Web.UI
+Imports DotNetNuke
+Imports DotNetNuke.Common
+
+Namespace Ventrian.NewsArticles.Components.WebControls
+
+ {0}:PagingControl>")> Public Class PagingControl
+ Inherits System.Web.UI.WebControls.WebControl
+
+ Protected tablePageNumbers As System.Web.UI.WebControls.Table
+ Protected WithEvents PageNumbers As System.Web.UI.WebControls.Repeater
+ Protected cellDisplayStatus As System.Web.UI.WebControls.TableCell
+ Protected cellDisplayLinks As System.Web.UI.WebControls.TableCell
+
+ Private TotalPages As Integer = -1
+
+ Private _TotalRecords As Integer
+ Private _PageSize As Integer
+ Private _CurrentPage As Integer
+ Private _QuerystringParams As String
+ Private _PageParam As String = "lapg"
+ Private _TabID As Integer
+ Private _CSSClassLinkActive As String
+ Private _CSSClassLinkInactive As String
+ Private _CSSClassPagingStatus As String
+
+ Property TotalRecords() As Integer
+ Get
+ Return _TotalRecords
+ End Get
+
+ Set(ByVal Value As Integer)
+ _TotalRecords = Value
+ End Set
+ End Property
+ Property PageSize() As Integer
+ Get
+ Return _PageSize
+ End Get
+
+ Set(ByVal Value As Integer)
+ _PageSize = Value
+ End Set
+ End Property
+ Property CurrentPage() As Integer
+ Get
+ Return _CurrentPage
+ End Get
+
+ Set(ByVal Value As Integer)
+ _CurrentPage = Value
+ End Set
+ End Property
+ Property QuerystringParams() As String
+ Get
+ Return _QuerystringParams
+ End Get
+
+ Set(ByVal Value As String)
+ _QuerystringParams = Value
+ End Set
+ End Property
+ Property TabID() As Integer
+ Get
+ Return _TabID
+ End Get
+
+ Set(ByVal Value As Integer)
+ _TabID = Value
+ End Set
+ End Property
+ Property PageParam() As String
+ Get
+ Return _PageParam
+ End Get
+
+ Set(ByVal Value As String)
+ _PageParam = Value
+ End Set
+ End Property
+ Property CSSClassLinkActive() As String
+ Get
+ If _CSSClassLinkActive = "" Then
+ Return "CommandButton"
+ Else
+ Return _CSSClassLinkActive
+ End If
+ End Get
+
+ Set(ByVal Value As String)
+ _CSSClassLinkActive = Value
+ End Set
+ End Property
+ Property CSSClassLinkInactive() As String
+ Get
+ If _CSSClassLinkInactive = "" Then
+ Return "NormalDisabled"
+ Else
+ Return _CSSClassLinkInactive
+ End If
+ End Get
+
+ Set(ByVal Value As String)
+ _CSSClassLinkInactive = Value
+ End Set
+ End Property
+ Property CSSClassPagingStatus() As String
+ Get
+ If _CSSClassPagingStatus = "" Then
+ Return "Normal"
+ Else
+ Return _CSSClassPagingStatus
+ End If
+ End Get
+
+ Set(ByVal Value As String)
+ _CSSClassPagingStatus = Value
+ End Set
+ End Property
+
+ Protected Overrides Sub CreateChildControls()
+ tablePageNumbers = New System.Web.UI.WebControls.Table
+ cellDisplayStatus = New System.Web.UI.WebControls.TableCell
+ cellDisplayLinks = New System.Web.UI.WebControls.TableCell
+ cellDisplayStatus.CssClass = "Normal"
+ cellDisplayLinks.CssClass = "Normal"
+
+ If Me.CssClass = "" Then
+ tablePageNumbers.CssClass = "PagingTable"
+ Else
+ tablePageNumbers.CssClass = Me.CssClass
+ End If
+
+ Dim intRowIndex As Integer = tablePageNumbers.Rows.Add(New TableRow)
+
+ PageNumbers = New Repeater
+ Dim I As New PageNumberLinkTemplate(Me)
+ PageNumbers.ItemTemplate = I
+ BindPageNumbers(TotalRecords, PageSize)
+
+ cellDisplayStatus.HorizontalAlign = HorizontalAlign.Left
+ cellDisplayStatus.Width = New Unit("50%")
+ cellDisplayLinks.HorizontalAlign = HorizontalAlign.Right
+ cellDisplayLinks.Width = New Unit("50%")
+ Dim intTotalPages As Integer = TotalPages
+ If intTotalPages = 0 Then intTotalPages = 1
+
+ Dim str As String
+ str = String.Format(Services.Localization.Localization.GetString("Pages"), CurrentPage.ToString, intTotalPages.ToString)
+ Dim lit As New LiteralControl(str)
+ cellDisplayStatus.Controls.Add(lit)
+
+ tablePageNumbers.Rows(intRowIndex).Cells.Add(cellDisplayStatus)
+ tablePageNumbers.Rows(intRowIndex).Cells.Add(cellDisplayLinks)
+
+ End Sub
+
+ Protected Overrides Sub Render(ByVal output As System.Web.UI.HtmlTextWriter)
+ If PageNumbers Is Nothing Then
+ CreateChildControls()
+ End If
+
+ Dim str As New System.Text.StringBuilder
+
+ str.Append(GetFirstLink() + " ")
+ str.Append(GetPreviousLink() + " ")
+ Dim result As System.Text.StringBuilder = New System.Text.StringBuilder(1024)
+ PageNumbers.RenderControl(New HtmlTextWriter(New System.IO.StringWriter(result)))
+ str.Append(result.ToString())
+ str.Append(GetNextLink() + " ")
+ str.Append(GetLastLink() + " ")
+ cellDisplayLinks.Controls.Add(New LiteralControl(str.ToString))
+
+ tablePageNumbers.RenderControl(output)
+
+ End Sub
+
+
+ Private Sub BindPageNumbers(ByVal TotalRecords As Integer, ByVal RecordsPerPage As Integer)
+ Dim PageLinksPerPage As Integer = 10
+ If TotalRecords / RecordsPerPage >= 1 Then
+ TotalPages = Convert.ToInt32(Math.Ceiling(CType(TotalRecords / RecordsPerPage, Double)))
+ Else
+ TotalPages = 0
+ End If
+
+ If TotalPages > 0 Then
+ Dim ht As New DataTable
+ ht.Columns.Add("PageNum")
+ Dim tmpRow As DataRow
+
+ Dim LowNum As Integer = 1
+ Dim HighNum As Integer = CType(TotalPages, Integer)
+
+ Dim tmpNum As Double
+ tmpNum = CurrentPage - PageLinksPerPage / 2
+ If tmpNum < 1 Then tmpNum = 1
+
+ If CurrentPage > (PageLinksPerPage / 2) Then
+ LowNum = CType(Math.Floor(tmpNum), Integer)
+ End If
+
+ If CType(TotalPages, Integer) <= PageLinksPerPage Then
+ HighNum = CType(TotalPages, Integer)
+ Else
+ HighNum = LowNum + PageLinksPerPage - 1
+ End If
+
+ If HighNum > CType(TotalPages, Integer) Then
+ HighNum = CType(TotalPages, Integer)
+ If HighNum - LowNum < PageLinksPerPage Then
+ LowNum = HighNum - PageLinksPerPage + 1
+ End If
+ End If
+
+ If HighNum > CType(TotalPages, Integer) Then HighNum = CType(TotalPages, Integer)
+ If LowNum < 1 Then LowNum = 1
+
+ Dim i As Integer
+ For i = LowNum To HighNum
+ tmpRow = ht.NewRow
+ tmpRow("PageNum") = i
+ ht.Rows.Add(tmpRow)
+ Next
+
+ PageNumbers.DataSource = ht
+ PageNumbers.DataBind()
+ End If
+
+ End Sub
+
+ Private Function CreateURL(ByVal CurrentPage As String) As String
+
+ If QuerystringParams <> "" Then
+ If CurrentPage <> "" Then
+ Return Globals.NavigateURL(TabID, "", QuerystringParams, PageParam & "=" & CurrentPage)
+ Else
+ Return Globals.NavigateURL(TabID, "", QuerystringParams)
+ End If
+ Else
+ If CurrentPage <> "" Then
+ Return Globals.NavigateURL(TabID, "", PageParam & "=" & CurrentPage)
+ Else
+ Return Globals.NavigateURL(TabID)
+ End If
+ End If
+
+ End Function
+
+ ''' -----------------------------------------------------------------------------
+ '''
+ ''' GetLink returns the page number links for paging.
+ '''
+ '''
+ '''
+ '''
+ ''' [dancaron] 10/28/2004 Initial Version
+ '''
+ ''' -----------------------------------------------------------------------------
+ Private Function GetLink(ByVal PageNum As Integer) As String
+ If PageNum = CurrentPage Then
+ Return "[" + PageNum.ToString + "]"
+ Else
+ Return "" + PageNum.ToString + ""
+ End If
+ End Function
+
+ ''' -----------------------------------------------------------------------------
+ '''
+ ''' GetPreviousLink returns the link for the Previous page for paging.
+ '''
+ '''
+ '''
+ '''
+ ''' [dancaron] 10/28/2004 Initial Version
+ '''
+ ''' -----------------------------------------------------------------------------
+ Private Function GetPreviousLink() As String
+ If CurrentPage > 1 AndAlso TotalPages > 0 Then
+ Return "" & Services.Localization.Localization.GetString("Previous", DotNetNuke.Services.Localization.Localization.SharedResourceFile) & ""
+ Else
+ Return "" & Services.Localization.Localization.GetString("Previous", DotNetNuke.Services.Localization.Localization.SharedResourceFile) & ""
+ End If
+ End Function
+
+ ''' -----------------------------------------------------------------------------
+ '''
+ ''' GetNextLink returns the link for the Next Page for paging.
+ '''
+ '''
+ '''
+ '''
+ ''' [dancaron] 10/28/2004 Initial Version
+ '''
+ ''' -----------------------------------------------------------------------------
+ Private Function GetNextLink() As String
+ If CurrentPage <> TotalPages And TotalPages > 0 Then
+ Return "" & Services.Localization.Localization.GetString("Next", DotNetNuke.Services.Localization.Localization.SharedResourceFile) & ""
+ Else
+ Return "" & Services.Localization.Localization.GetString("Next", DotNetNuke.Services.Localization.Localization.SharedResourceFile) & ""
+ End If
+ End Function
+
+ ''' -----------------------------------------------------------------------------
+ '''
+ ''' GetFirstLink returns the First Page link for paging.
+ '''
+ '''
+ '''
+ '''
+ ''' [dancaron] 10/28/2004 Initial Version
+ '''
+ ''' -----------------------------------------------------------------------------
+ Private Function GetFirstLink() As String
+ If CurrentPage > 1 AndAlso TotalPages > 0 Then
+ Return "" & Services.Localization.Localization.GetString("First", DotNetNuke.Services.Localization.Localization.SharedResourceFile) & ""
+ Else
+ Return "" & Services.Localization.Localization.GetString("First", DotNetNuke.Services.Localization.Localization.SharedResourceFile) & ""
+ End If
+ End Function
+
+ ''' -----------------------------------------------------------------------------
+ '''
+ ''' GetLastLink returns the Last Page link for paging.
+ '''
+ '''
+ '''
+ '''
+ ''' [dancaron] 10/28/2004 Initial Version
+ '''
+ ''' -----------------------------------------------------------------------------
+ Private Function GetLastLink() As String
+ If CurrentPage <> TotalPages And TotalPages > 0 Then
+ Return "" & Services.Localization.Localization.GetString("Last", DotNetNuke.Services.Localization.Localization.SharedResourceFile) & ""
+ Else
+ Return "" & Services.Localization.Localization.GetString("Last", DotNetNuke.Services.Localization.Localization.SharedResourceFile) & ""
+ End If
+ End Function
+
+ Public Class PageNumberLinkTemplate
+ Implements ITemplate
+ Shared itemcount As Integer = 0
+ Private _PagingControl As PagingControl
+
+ Sub New(ByVal ctlPagingControl As PagingControl)
+ _PagingControl = ctlPagingControl
+ End Sub
+
+ Sub InstantiateIn(ByVal container As Control) _
+ Implements ITemplate.InstantiateIn
+
+ Dim l As New Literal
+ AddHandler l.DataBinding, AddressOf Me.BindData
+ container.Controls.Add(l)
+ End Sub
+
+ Private Sub BindData(ByVal sender As Object, ByVal e As System.EventArgs)
+ Dim lc As Literal
+ lc = CType(sender, Literal)
+ Dim container As RepeaterItem
+ container = CType(lc.NamingContainer, RepeaterItem)
+ lc.Text = _PagingControl.GetLink(Convert.ToInt32(DataBinder.Eval(container.DataItem, "PageNum"))) + " "
+ End Sub
+
+ End Class
+
+ End Class
+
+
+End Namespace
\ No newline at end of file
diff --git a/Components/WebControls/RefreshControl.vb b/Components/WebControls/RefreshControl.vb
new file mode 100755
index 0000000..f1187b1
--- /dev/null
+++ b/Components/WebControls/RefreshControl.vb
@@ -0,0 +1,9 @@
+
+Namespace Ventrian.NewsArticles.Components.WebControls
+
+ Public Class RefreshControl
+ Inherits System.Web.UI.WebControls.LinkButton
+
+ End Class
+
+End Namespace
diff --git a/Controls/Listing.ascx b/Controls/Listing.ascx
new file mode 100755
index 0000000..6069232
--- /dev/null
+++ b/Controls/Listing.ascx
@@ -0,0 +1,6 @@
+<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="Listing.ascx.vb" Inherits="Ventrian.NewsArticles.Controls.Listing" %>
+
+
+
+
+
\ No newline at end of file
diff --git a/Controls/Listing.ascx.designer.vb b/Controls/Listing.ascx.designer.vb
new file mode 100755
index 0000000..0b1313b
--- /dev/null
+++ b/Controls/Listing.ascx.designer.vb
@@ -0,0 +1,35 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+Namespace Ventrian.NewsArticles.Controls
+
+ Partial Public Class Listing
+
+ '''
+ '''rptListing control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents rptListing As Global.System.Web.UI.WebControls.Repeater
+
+ '''
+ '''phNoArticles control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents phNoArticles As Global.System.Web.UI.WebControls.PlaceHolder
+ End Class
+End Namespace
diff --git a/Controls/Listing.ascx.vb b/Controls/Listing.ascx.vb
new file mode 100755
index 0000000..ee4af6a
--- /dev/null
+++ b/Controls/Listing.ascx.vb
@@ -0,0 +1,1593 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports DotNetNuke.Common
+Imports DotNetNuke.Common.Utilities
+Imports DotNetNuke.Entities.Modules
+Imports DotNetNuke.Services.Exceptions
+Imports DotNetNuke.UI.WebControls
+Imports Ventrian.NewsArticles.Components.CustomFields
+Imports DotNetNuke.Security
+
+Imports Ventrian.NewsArticles.Base
+
+Namespace Ventrian.NewsArticles.Controls
+
+ Partial Public Class Listing
+ Inherits System.Web.UI.UserControl
+
+#Region " Private Members "
+
+ Private _objLayoutController As LayoutController
+
+ Private _objLayoutHeader As LayoutInfo
+ Private _objLayoutItem As LayoutInfo
+ Private _objLayoutFeatured As LayoutInfo
+ Private _objLayoutFooter As LayoutInfo
+ Private _objLayoutEmpty As LayoutInfo
+
+ Private _articleList As List(Of ArticleInfo)
+ Private _articleCount As Integer
+
+ Private _agedDate As DateTime
+ Private _author As Integer
+ Private _bindArticles As Boolean
+ Private _featuredOnly As Boolean
+ Private _filterCategories As Integer()
+ Private _includeCategory As Boolean
+ Private _matchCategories As MatchOperatorType
+ Private _maxArticles As Integer
+ Private _month As Integer
+ Private _notFeaturedOnly As Boolean
+ Private _notSecuredOnly As Boolean
+ Private _searchText As String
+ Private _securedOnly As Boolean
+ Private _showExpired As Boolean
+ Private _showMessage As Boolean
+ Private _showPending As Boolean
+ Private _sortBy As String
+ Private _sortDirection As String
+ Private _startDate As DateTime
+ Private _tag As String
+ Private _year As Integer
+
+ Public IsIndexed As Boolean = True
+
+ Private _customFieldID As Integer = Null.NullInteger
+ Private _customValue As String = Null.NullString
+
+#End Region
+
+#Region " Private Properties "
+
+ Private ReadOnly Property ArticleModuleBase() As NewsArticleModuleBase
+ Get
+ Return CType(Parent, NewsArticleModuleBase)
+ End Get
+ End Property
+
+ Private ReadOnly Property ArticleSettings() As ArticleSettings
+ Get
+ Return ArticleModuleBase.ArticleSettings
+ End Get
+ End Property
+
+ Private ReadOnly Property CurrentPage() As Integer
+ Get
+ If (Request("Page") = Null.NullString And Request("CurrentPage") = Null.NullString) Then
+ Return 1
+ Else
+ IsIndexed = False
+ Try
+ If (Request("Page") <> Null.NullString) Then
+ Return Convert.ToInt32(Request("Page"))
+ Else
+ Return Convert.ToInt32(Request("CurrentPage"))
+ End If
+ Catch
+ Return 1
+ End Try
+ End If
+ End Get
+ End Property
+
+#End Region
+
+#Region " Public Properties "
+
+ Public Property AgedDate() As DateTime
+ Get
+ Return _agedDate
+ End Get
+ Set(ByVal Value As DateTime)
+ _agedDate = Value
+ End Set
+ End Property
+
+ Public Property Author() As Integer
+ Get
+ Return _author
+ End Get
+ Set(ByVal Value As Integer)
+ _author = Value
+ End Set
+ End Property
+
+ Public Property BindArticles() As Boolean
+ Get
+ Return _bindArticles
+ End Get
+ Set(ByVal Value As Boolean)
+ _bindArticles = Value
+ End Set
+ End Property
+
+ Private ReadOnly Property DynamicAuthorID() As Integer
+ Get
+ Dim id As Integer = Null.NullInteger
+ If (Request("naauth-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ If (IsNumeric(Request("naauth-" & ArticleModuleBase.TabModuleId.ToString()))) Then
+ id = Convert.ToInt32(Request("naauth-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ End If
+
+ Return id
+ End Get
+ End Property
+
+ Private ReadOnly Property DynamicAZ() As String
+ Get
+ Dim id As String = Null.NullString
+ If (Request("naaz-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ id = Request("naaz-" & ArticleModuleBase.TabModuleId.ToString())
+ End If
+ Return id
+ End Get
+ End Property
+
+ Private ReadOnly Property DynamicCategoryID() As Integer
+ Get
+ Dim id As Integer = Null.NullInteger
+ If (Request("nacat-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ If (IsNumeric(Request("nacat-" & ArticleModuleBase.TabModuleId.ToString()))) Then
+ id = Convert.ToInt32(Request("nacat-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ End If
+
+ Return id
+ End Get
+ End Property
+
+ Private ReadOnly Property DynamicSortBy() As String
+ Get
+ Dim sort As String = ""
+
+ If (Request("nasort-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ Select Case Request("nasort-" & ArticleModuleBase.TabModuleId.ToString()).ToLower()
+ Case "publishdate"
+ sort = "StartDate"
+ Exit Select
+ Case "expirydate"
+ sort = "EndDate"
+ Exit Select
+ Case "lastupdate"
+ sort = "LastUpdate"
+ Exit Select
+ Case "rating"
+ sort = "Rating DESC, RatingCount"
+ Exit Select
+ Case "commentcount"
+ sort = "CommentCount"
+ Exit Select
+ Case "numberofviews"
+ sort = "NumberOfViews"
+ Exit Select
+ Case "random"
+ sort = "NewID()"
+ Exit Select
+ Case "title"
+ sort = "Title"
+ Exit Select
+ End Select
+ End If
+
+ Return sort
+ End Get
+ End Property
+
+ Private ReadOnly Property DynamicTime() As String
+ Get
+ Dim val As String = ""
+
+ If (Request("natime-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ val = Request("natime-" & ArticleModuleBase.TabModuleId.ToString())
+ End If
+
+ Return val
+ End Get
+ End Property
+
+ Public Property FeaturedOnly() As Boolean
+ Get
+ Return _featuredOnly
+ End Get
+ Set(ByVal Value As Boolean)
+ _featuredOnly = Value
+ End Set
+ End Property
+
+ Public Property FilterCategories() As Integer()
+ Get
+ Return _filterCategories
+ End Get
+ Set(ByVal Value As Integer())
+ _filterCategories = Value
+ End Set
+ End Property
+
+ Public Property IncludeCategory() As Boolean
+ Get
+ Return _includeCategory
+ End Get
+ Set(ByVal Value As Boolean)
+ _includeCategory = Value
+ End Set
+ End Property
+
+ Public Property MatchCategories() As MatchOperatorType
+ Get
+ Return _matchCategories
+ End Get
+ Set(ByVal Value As MatchOperatorType)
+ _matchCategories = Value
+ End Set
+ End Property
+
+ Public Property MaxArticles() As Integer
+ Get
+ Return _maxArticles
+ End Get
+ Set(ByVal Value As Integer)
+ _maxArticles = Value
+ End Set
+ End Property
+
+ Public Property Month() As Integer
+ Get
+ Return _month
+ End Get
+ Set(ByVal Value As Integer)
+ _month = Value
+ End Set
+ End Property
+
+ Public Property NotFeaturedOnly() As Boolean
+ Get
+ Return _notFeaturedOnly
+ End Get
+ Set(ByVal Value As Boolean)
+ _notFeaturedOnly = Value
+ End Set
+ End Property
+
+ Public Property NotSecuredOnly() As Boolean
+ Get
+ Return _notSecuredOnly
+ End Get
+ Set(ByVal Value As Boolean)
+ _notSecuredOnly = Value
+ End Set
+ End Property
+
+ Public Property SearchText() As String
+ Get
+ Return _searchText
+ End Get
+ Set(ByVal Value As String)
+ _searchText = Value
+ End Set
+ End Property
+
+ Public Property SecuredOnly() As Boolean
+ Get
+ Return _securedOnly
+ End Get
+ Set(ByVal Value As Boolean)
+ _securedOnly = Value
+ End Set
+ End Property
+
+ Public Property ShowExpired() As Boolean
+ Get
+ Return _showExpired
+ End Get
+ Set(ByVal Value As Boolean)
+ _showExpired = Value
+ End Set
+ End Property
+
+ Public Property ShowMessage() As Boolean
+ Get
+ Return _showMessage
+ End Get
+ Set(ByVal Value As Boolean)
+ _showMessage = Value
+ End Set
+ End Property
+
+ Public Property ShowPending() As Boolean
+ Get
+ Return _showPending
+ End Get
+ Set(ByVal Value As Boolean)
+ _showPending = Value
+ End Set
+ End Property
+
+ Public Property SortBy() As String
+ Get
+ Return _sortBy
+ End Get
+ Set(ByVal Value As String)
+ _sortBy = Value
+ End Set
+ End Property
+
+ Public Property SortDirection() As String
+ Get
+ Return _sortDirection
+ End Get
+ Set(ByVal Value As String)
+ _sortDirection = Value
+ End Set
+ End Property
+
+ Public Property StartDate() As DateTime
+ Get
+ Return _startDate
+ End Get
+ Set(ByVal Value As DateTime)
+ _startDate = Value
+ End Set
+ End Property
+
+ Public Property Tag() As String
+ Get
+ Return _tag
+ End Get
+ Set(ByVal Value As String)
+ _tag = Value
+ End Set
+ End Property
+
+ Public Property Year() As Integer
+ Get
+ Return _year
+ End Get
+ Set(ByVal Value As Integer)
+ _year = Value
+ End Set
+ End Property
+
+#End Region
+
+#Region " Private Methods "
+
+ Public Sub BindListing()
+
+ InitializeTemplate()
+
+ If (_year <> Null.NullInteger AndAlso _month <> Null.NullInteger) Then
+ _agedDate = New DateTime(_year, _month, 1)
+ StartDate = AgedDate.AddMonths(1).AddSeconds(-1)
+ End If
+
+ If (_year <> Null.NullInteger AndAlso _month = Null.NullInteger) Then
+ _agedDate = New DateTime(_year, 1, 1)
+ StartDate = AgedDate.AddYears(1).AddSeconds(-1)
+ End If
+
+ Dim objTags() As Integer = Nothing
+ If (_tag <> Null.NullString) Then
+ Dim objTagController As New TagController()
+ Dim objTag As TagInfo = objTagController.Get(ArticleModuleBase.ModuleId, _tag.ToLower())
+ If (objTag IsNot Nothing) Then
+ Dim tags As New List(Of Integer)
+ tags.Add(objTag.TagID)
+ objTags = tags.ToArray()
+ End If
+ End If
+
+ If (FilterCategories IsNot Nothing AndAlso FilterCategories.Length = 1) Then
+
+ Dim objCategoryController As New CategoryController
+ Dim objCategory As CategoryInfo = objCategoryController.GetCategory(FilterCategories(0), ArticleModuleBase.ModuleId)
+
+ If Not (objCategory Is Nothing) Then
+
+ If (objCategory.InheritSecurity = False) Then
+ If (ArticleModuleBase.Settings.Contains(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING)) Then
+ If (PortalSecurity.IsInRoles(ArticleModuleBase.Settings(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING).ToString()) = False) Then
+ Response.Redirect(NavigateURL(ArticleModuleBase.TabId), True)
+ End If
+ End If
+ End If
+
+ Dim objArticleController As New ArticleController
+ _articleList = objArticleController.GetArticleList(ArticleModuleBase.ModuleId, StartDate, _agedDate, FilterCategories, (MatchCategories = MatchOperatorType.MatchAll), Nothing, MaxArticles, CurrentPage, ArticleSettings.PageSize, SortBy, SortDirection, True, False, SearchText.Replace("'", "''"), Author, ShowPending, ShowExpired, FeaturedOnly, NotFeaturedOnly, SecuredOnly, NotSecuredOnly, Null.NullString, objTags, False, Null.NullString, _customFieldID, _customValue, Null.NullString, _articleCount)
+
+ End If
+ Else
+ Dim objCategoryController As New CategoryController
+ Dim objCategories As List(Of CategoryInfo) = objCategoryController.GetCategoriesAll(ArticleModuleBase.ModuleId, Null.NullInteger)
+
+ Dim excludeCategoriesRestrictive As New List(Of Integer)
+
+ For Each objCategory As CategoryInfo In objCategories
+ If (objCategory.InheritSecurity = False And objCategory.CategorySecurityType = CategorySecurityType.Restrict) Then
+ If (Request.IsAuthenticated) Then
+ If (ArticleModuleBase.Settings.Contains(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING)) Then
+ If (PortalSecurity.IsInRoles(ArticleModuleBase.Settings(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING).ToString()) = False) Then
+ excludeCategoriesRestrictive.Add(objCategory.CategoryID)
+ End If
+ End If
+ Else
+ excludeCategoriesRestrictive.Add(objCategory.CategoryID)
+ End If
+ End If
+ Next
+
+ Dim excludeCategories As New List(Of Integer)
+
+ For Each objCategory As CategoryInfo In objCategories
+ If (objCategory.InheritSecurity = False And objCategory.CategorySecurityType = CategorySecurityType.Loose) Then
+ If (Request.IsAuthenticated) Then
+ If (ArticleModuleBase.Settings.Contains(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING)) Then
+ If (PortalSecurity.IsInRoles(ArticleModuleBase.Settings(objCategory.CategoryID & "-" & ArticleConstants.PERMISSION_CATEGORY_VIEW_SETTING).ToString()) = False) Then
+ excludeCategories.Add(objCategory.CategoryID)
+ End If
+ End If
+ Else
+ excludeCategories.Add(objCategory.CategoryID)
+ End If
+ End If
+ Next
+
+ Dim includeCategories As New List(Of Integer)
+
+ If (excludeCategories.Count > 0) Then
+
+ For Each objCategoryToInclude As CategoryInfo In objCategories
+
+ Dim includeCategorySecurity As Boolean = True
+
+ For Each exclCategory As Integer In excludeCategories
+ If (exclCategory = objCategoryToInclude.CategoryID) Then
+ includeCategorySecurity = False
+ End If
+ Next
+
+
+ If (FilterCategories IsNot Nothing) Then
+ If (FilterCategories.Length > 0) Then
+ Dim filter As Boolean = False
+ For Each cat As Integer In FilterCategories
+ If (cat = objCategoryToInclude.CategoryID) Then
+ filter = True
+ End If
+ Next
+ If (filter = False) Then
+ includeCategorySecurity = False
+ End If
+ End If
+ End If
+
+ If (includeCategorySecurity) Then
+ includeCategories.Add(objCategoryToInclude.CategoryID)
+ End If
+
+ Next
+
+ If (includeCategories.Count > 0) Then
+ includeCategories.Add(-1)
+ End If
+
+ FilterCategories = includeCategories.ToArray()
+
+ End If
+
+ Dim objArticleController As New ArticleController
+ _articleList = objArticleController.GetArticleList(ArticleModuleBase.ModuleId, StartDate, _agedDate, FilterCategories, (MatchCategories = MatchOperatorType.MatchAll), excludeCategoriesRestrictive.ToArray(), MaxArticles, CurrentPage, ArticleSettings.PageSize, SortBy, SortDirection, True, False, SearchText.Replace("'", "''"), Author, ShowPending, ShowExpired, FeaturedOnly, NotFeaturedOnly, SecuredOnly, NotSecuredOnly, Null.NullString, objTags, False, Null.NullString, _customFieldID, _customValue, Null.NullString, _articleCount)
+ End If
+
+
+ If (_articleList.Count = 0) Then
+ If (ShowMessage) Then
+ ProcessHeader(phNoArticles.Controls, _objLayoutEmpty.Tokens)
+ End If
+ Else
+ rptListing.DataSource = _articleList
+ rptListing.DataBind()
+ End If
+
+ End Sub
+
+ Private Function GetParams(ByVal addDynamicFields As Boolean) As String
+
+ Dim params As String = ""
+
+ If (Request("ctl") <> "") Then
+ If (Request("ctl").ToLower = "categoryview" OrElse Request("ctl").ToLower = "authorview" OrElse Request("ctl").ToLower = "archiveview" OrElse Request("ctl").ToLower() = "search") Then
+ params += "ctl=" & Request("ctl") & "&mid=" & ArticleModuleBase.ModuleId.ToString()
+ End If
+ End If
+
+ If (Request("articleType") <> "") Then
+ If (Request("articleType").ToString().ToLower = "categoryview" OrElse Request("articleType").ToString().ToLower() = "authorview" OrElse Request("articleType").ToString().ToLower() = "archiveview" OrElse Request("articleType").ToString().ToLower() = "search" OrElse Request("articleType").ToString().ToLower() = "myarticles" OrElse Request("articleType").ToString().ToLower() = "tagview") Then
+ params += "articleType=" & Request("articleType")
+ End If
+ End If
+
+ If (FilterCategories IsNot Nothing AndAlso FilterCategories.Length > 0) Then
+ If (FilterCategories IsNot ArticleSettings.FilterCategories) Then
+ params += "&CategoryID=" & FilterCategories(0)
+ End If
+ End If
+
+ Dim authorSet As Boolean = False
+ If (ArticleSettings.AuthorUserIDFilter) Then
+ If (ArticleSettings.AuthorUserIDParam <> "") Then
+ If (HttpContext.Current.Request(ArticleSettings.AuthorUserIDParam) <> "") Then
+ params += "&" & ArticleSettings.AuthorUserIDParam & "=" & HttpContext.Current.Request(ArticleSettings.AuthorUserIDParam)
+ authorSet = True
+ End If
+ End If
+ End If
+
+ If (ArticleSettings.AuthorUsernameFilter) Then
+ If (ArticleSettings.AuthorUsernameParam <> "") Then
+ If (HttpContext.Current.Request(ArticleSettings.AuthorUsernameParam) <> "") Then
+ params += "&" & ArticleSettings.AuthorUsernameParam & "=" & HttpContext.Current.Request(ArticleSettings.AuthorUsernameParam)
+ authorSet = True
+ End If
+ End If
+ End If
+
+ If (authorSet = False) Then
+ If (Author <> ArticleSettings.Author) Then
+ params += "&AuthorID=" & Author.ToString()
+ End If
+ End If
+
+ If (Year <> Null.NullInteger) Then
+ params += "&Year=" & Year.ToString()
+ End If
+
+ If (Month <> Null.NullInteger) Then
+ params += "&Month=" & Month.ToString()
+ End If
+
+ If (Tag <> Null.NullString) Then
+ params += "&Tag=" & Server.UrlEncode(Tag)
+ End If
+
+ If (SearchText <> Null.NullString) Then
+ If (Request("naaz-" & ArticleModuleBase.TabModuleId.ToString()) = "") Then
+ params += "&Search=" & ArticleModuleBase.Server.UrlEncode(SearchText)
+ End If
+ End If
+
+ If (addDynamicFields) Then
+ If (Request("nasort-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params += "&nasort-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nasort-" & ArticleModuleBase.TabModuleId.ToString())
+ End If
+ If (Request("naauth-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params += "&naauth-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("naauth-" & ArticleModuleBase.TabModuleId.ToString())
+ End If
+ If (Request("nacat-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params += "&nacat-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacat-" & ArticleModuleBase.TabModuleId.ToString())
+ End If
+ If (Request("nacust-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params += "&nacust-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacust-" & ArticleModuleBase.TabModuleId.ToString())
+ End If
+ If (Request("natime-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params += "&natime-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("natime-" & ArticleModuleBase.TabModuleId.ToString())
+ End If
+ If (Request("naaz-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params += "&naaz-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("naaz-" & ArticleModuleBase.TabModuleId.ToString())
+ End If
+ End If
+
+ Return params
+
+ End Function
+
+ Private Sub InitializeTemplate()
+
+ _objLayoutController = New LayoutController(ArticleModuleBase)
+ _objLayoutController.IncludeCategory = IncludeCategory
+
+ _objLayoutHeader = LayoutController.GetLayout(ArticleModuleBase, LayoutType.Listing_Header_Html)
+ _objLayoutFeatured = LayoutController.GetLayout(ArticleModuleBase, LayoutType.Listing_Featured_Html)
+ _objLayoutItem = LayoutController.GetLayout(ArticleModuleBase, LayoutType.Listing_Item_Html)
+ _objLayoutFooter = LayoutController.GetLayout(ArticleModuleBase, LayoutType.Listing_Footer_Html)
+ _objLayoutEmpty = LayoutController.GetLayout(ArticleModuleBase, LayoutType.Listing_Empty_Html)
+
+ If (_objLayoutFeatured.Template.Trim().Length = 0) Then
+ ' Featured Template Empty or does not exist, use standard item.
+ _objLayoutFeatured = _objLayoutItem
+ End If
+
+ End Sub
+
+ Private Sub InitSettings()
+
+ _author = Null.NullInteger
+
+ If (ArticleSettings.AuthorUserIDFilter) Then
+ _author = -100
+ If (Request.QueryString(ArticleSettings.AuthorUserIDParam) <> "") Then
+ Try
+ _author = Convert.ToInt32(Request.QueryString(ArticleSettings.AuthorUserIDParam))
+ Catch
+ End Try
+ End If
+ End If
+
+ If (ArticleSettings.AuthorUsernameFilter) Then
+ _author = -100
+ If (Request.QueryString(ArticleSettings.AuthorUsernameParam) <> "") Then
+ Try
+ Dim objUser As DotNetNuke.Entities.Users.UserInfo = DotNetNuke.Entities.Users.UserController.GetUserByName(ArticleModuleBase.PortalId, Request.QueryString(ArticleSettings.AuthorUsernameParam))
+ If (objUser IsNot Nothing) Then
+ _author = objUser.UserID
+ End If
+ Catch
+ End Try
+ End If
+ End If
+
+ If (ArticleSettings.AuthorLoggedInUserFilter) Then
+ _author = -100
+ If (Request.IsAuthenticated) Then
+ _author = ArticleModuleBase.UserId
+ End If
+ End If
+
+ If (ArticleSettings.Author <> Null.NullInteger) Then
+ _author = ArticleSettings.Author
+ End If
+
+ If (DynamicAuthorID <> Null.NullInteger) Then
+ _author = DynamicAuthorID
+ End If
+
+ _agedDate = Null.NullDate
+ _bindArticles = True
+ _featuredOnly = ArticleSettings.FeaturedOnly
+ If (ArticleSettings.FilterSingleCategory <> Null.NullInteger) Then
+ Dim cats As New List(Of Integer)
+ cats.Add(ArticleSettings.FilterSingleCategory)
+ _filterCategories = cats.ToArray()
+ Else
+ _filterCategories = ArticleSettings.FilterCategories
+ End If
+ If (DynamicCategoryID <> Null.NullInteger) Then
+ Dim cats As New List(Of Integer)
+ cats.Add(DynamicCategoryID)
+ _filterCategories = cats.ToArray()
+ End If
+ _includeCategory = False
+ _matchCategories = ArticleSettings.MatchCategories
+ _maxArticles = ArticleSettings.MaxArticles
+ _month = Null.NullInteger
+ _notFeaturedOnly = ArticleSettings.NotFeaturedOnly
+ _notSecuredOnly = ArticleSettings.NotSecuredOnly
+ _searchText = ""
+ If (DynamicAZ <> Null.NullString) Then
+ _searchText = DynamicAZ
+ End If
+ _securedOnly = ArticleSettings.SecuredOnly
+ _showExpired = False
+ _showMessage = True
+ _showPending = ArticleSettings.ShowPending
+ _sortBy = ArticleSettings.SortBy
+ If (ArticleSettings.BubbleFeatured) Then
+ _sortBy = "IsFeatured DESC, " & ArticleSettings.SortBy
+ End If
+ _sortDirection = ArticleSettings.SortDirection
+ _startDate = DateTime.Now.AddMinutes(1)
+ _tag = Null.NullString
+ _year = Null.NullInteger
+
+ If (DynamicSortBy <> "") Then
+ _sortBy = DynamicSortBy
+ End If
+
+ If (DynamicTime <> "") Then
+ If (DynamicTime.ToLower() = "today") Then
+ _startDate = DateTime.Now
+ _agedDate = DateTime.Today
+ End If
+ If (DynamicTime.ToLower() = "yesterday") Then
+ _startDate = DateTime.Today
+ _agedDate = DateTime.Today.AddDays(-1)
+ End If
+ If (DynamicTime.ToLower() = "threedays") Then
+ _startDate = DateTime.Now
+ _agedDate = DateTime.Today.AddDays(-3)
+ End If
+ If (DynamicTime.ToLower() = "sevendays") Then
+ _startDate = DateTime.Now
+ _agedDate = DateTime.Today.AddDays(-7)
+ End If
+ If (DynamicTime.ToLower() = "thirtydays") Then
+ _startDate = DateTime.Now
+ _agedDate = DateTime.Today.AddDays(-30)
+ End If
+ If (DynamicTime.ToLower() = "ninetydays") Then
+ _startDate = DateTime.Now
+ _agedDate = DateTime.Today.AddDays(-90)
+ End If
+ If (DynamicTime.ToLower() = "thisyear") Then
+ _startDate = DateTime.Now
+ _agedDate = DateTime.Today.AddYears(-1)
+ End If
+ End If
+
+ If (Request("nacust-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ Dim val As String = Request("nacust-" & ArticleModuleBase.TabModuleId.ToString())
+ If (val.Split("-"c).Length = 2) Then
+ If (IsNumeric(val.Split("-"c)(0))) Then
+ _customFieldID = Convert.ToInt32(val.Split("-"c)(0))
+ _customValue = val.Split("-"c)(1)
+ End If
+ End If
+ End If
+
+ End Sub
+
+ Private Sub ProcessHeader(ByRef objPlaceHolder As ControlCollection, ByVal templateArray As String())
+
+ Dim pageCount As Integer = ((_articleCount - 1) \ ArticleSettings.PageSize) + 1
+
+ For iPtr As Integer = 0 To templateArray.Length - 1 Step 2
+
+ objPlaceHolder.Add(New LiteralControl(_objLayoutController.ProcessImages(templateArray(iPtr).ToString())))
+
+ If iPtr < templateArray.Length - 1 Then
+ Select Case templateArray(iPtr + 1)
+
+ Case "AUTHOR"
+ Dim objAuthorController As New AuthorController()
+ Dim drpAuthor As New DropDownList
+ drpAuthor.ID = Globals.CreateValidID("Article-Header-" & iPtr.ToString())
+ drpAuthor.DataTextField = "DisplayName"
+ drpAuthor.DataValueField = "UserID"
+ drpAuthor.DataSource = objAuthorController.GetAuthorList(ArticleModuleBase.ModuleId)
+ drpAuthor.DataBind()
+ drpAuthor.Items.Insert(0, New ListItem(ArticleModuleBase.GetSharedResource("SelectAuthor.Text"), "-1"))
+ drpAuthor.AutoPostBack = True
+ If (DynamicAuthorID <> Null.NullInteger) Then
+ If (drpAuthor.Items.FindByValue(DynamicAuthorID.ToString()) IsNot Nothing) Then
+ drpAuthor.SelectedValue = DynamicAuthorID.ToString()
+ End If
+ End If
+ Dim objHandler As New System.EventHandler(AddressOf drpAuthor_SelectedIndexChanged)
+ AddHandler drpAuthor.SelectedIndexChanged, objHandler
+ objPlaceHolder.Add(drpAuthor)
+
+ Case "AZ"
+
+ Dim list As String = ""
+ For Each c As Char In "ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray()
+
+ Dim params As New List(Of String)
+
+ Dim args As String = GetParams(False)
+ For Each arg As String In args.Split("&"c)
+ params.Add(arg)
+ Next
+
+ If (Request("nasort-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("nasort-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nasort-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ If (Request("nacust-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("nacust-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacust-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ If (Request("naauth-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("naauth-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("naauth-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ If (Request("nacat-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("nacat-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacat-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ If (Request("natime-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("natime-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("natime-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+
+ If (list = "") Then
+ If (Request("naaz-" & ArticleModuleBase.TabModuleId.ToString()) = c) Then
+ list = c
+ Else
+ Dim paramsCopy As List(Of String) = params
+ paramsCopy.Add("naaz-" & ArticleModuleBase.TabModuleId.ToString() & "=" & c)
+ list = "" & c & ""
+ End If
+ Else
+ If (Request("naaz-" & ArticleModuleBase.TabModuleId.ToString()) = c) Then
+ list = list & " " & c
+ Else
+ Dim paramsCopy As List(Of String) = params
+ paramsCopy.Add("naaz-" & ArticleModuleBase.TabModuleId.ToString() & "=" & c)
+ list = list & " " & "" & c & ""
+ End If
+ End If
+ Next
+ If (Request("naaz-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ list = list & " " & "" & "All" & ""
+ Else
+ list = list & " " & "All"
+ End If
+
+ Dim objLiteral As New Literal()
+ objLiteral.Text = list
+ objPlaceHolder.Add(objLiteral)
+
+ Case "CATEGORY"
+ Dim objCategoryController As New CategoryController()
+ Dim drpCategory As New DropDownList
+ drpCategory.ID = Globals.CreateValidID("Article-Header-" & iPtr.ToString())
+ drpCategory.DataTextField = "NameIndented"
+ drpCategory.DataValueField = "CategoryID"
+ drpCategory.DataSource = objCategoryController.GetCategoriesAll(ArticleModuleBase.ModuleId, Null.NullInteger, ArticleSettings.CategorySortType)
+ drpCategory.DataBind()
+ drpCategory.Items.Insert(0, New ListItem(ArticleModuleBase.GetSharedResource("SelectCategory.Text"), "-1"))
+ drpCategory.AutoPostBack = True
+ If (DynamicCategoryID <> Null.NullInteger) Then
+ If (drpCategory.Items.FindByValue(DynamicCategoryID.ToString()) IsNot Nothing) Then
+ drpCategory.SelectedValue = DynamicCategoryID.ToString()
+ End If
+ End If
+ Dim objHandler As New System.EventHandler(AddressOf drpCategory_SelectedIndexChanged)
+ AddHandler drpCategory.SelectedIndexChanged, objHandler
+ objPlaceHolder.Add(drpCategory)
+
+ Case "CATEGORYFILTER"
+ If (_filterCategories IsNot Nothing) Then
+ Dim categories As String = ""
+ Dim objCategoryController As New CategoryController
+ For Each ID As Integer In _filterCategories
+ Dim objCategory As CategoryInfo = objCategoryController.GetCategory(ID, ArticleModuleBase.ModuleId)
+ If (objCategory IsNot Nothing) Then
+ If (categories = "") Then
+ categories = objCategory.Name
+ Else
+ categories = categories & " | " & objCategory.Name
+ End If
+ End If
+ Next
+ Dim objLiteral As New Literal
+ objLiteral.ID = Globals.CreateValidID("Article-Header-" & iPtr.ToString())
+ objLiteral.Text = categories
+ objPlaceHolder.Add(objLiteral)
+ End If
+
+ Case "CATEGORYSELECTED"
+ If (Request("articleType") <> "" AndAlso Request("articleType").ToLower() <> "categoryview") Then
+ While (iPtr < templateArray.Length - 1)
+ If (templateArray(iPtr + 1) = "/CATEGORYSELECTED") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ Else
+ If (Request("articleType") = "") Then
+ While (iPtr < templateArray.Length - 1)
+ If (templateArray(iPtr + 1) = "/CATEGORYSELECTED") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+ End If
+
+ Case "/CATEGORYSELECTED"
+ ' Do Nothing
+
+ Case "CATEGORYNOTSELECTED"
+ If (Request("articleType") <> "" AndAlso Request("articleType").ToLower() = "categoryview") Then
+ While (iPtr < templateArray.Length - 1)
+ If (templateArray(iPtr + 1) = "/CATEGORYNOTSELECTED") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/CATEGORYNOTSELECTED"
+ ' Do Nothing
+
+ Case "CATEGORYNOTSELECTED2"
+ If (Request("articleType") <> "" AndAlso Request("articleType").ToLower() = "categoryview") Then
+ While (iPtr < templateArray.Length - 1)
+ If (templateArray(iPtr + 1) = "/CATEGORYNOTSELECTED") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/CATEGORYNOTSELECTED2"
+ ' Do Nothing
+
+ Case "CURRENTPAGE"
+ Dim objLiteral As New Literal
+ objLiteral.ID = Globals.CreateValidID("Article-Header-" & iPtr.ToString())
+ objLiteral.Text = CurrentPage.ToString()
+ objPlaceHolder.Add(objLiteral)
+
+ Case "HASMULTIPLEPAGES"
+ If (pageCount = 1) Then
+ While (iPtr < templateArray.Length - 1)
+ If (templateArray(iPtr + 1) = "/HASMULTIPLEPAGES") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/HASMULTIPLEPAGES"
+ ' Do Nothing
+
+ Case "HASNEXTPAGE"
+
+ If (CurrentPage = pageCount) Then
+ While (iPtr < templateArray.Length - 1)
+ If (templateArray(iPtr + 1) = "/HASNEXTPAGE") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/HASNEXTPAGE"
+ ' Do Nothing
+
+ Case "HASPREVPAGE"
+ If (CurrentPage = 1) Then
+ While (iPtr < templateArray.Length - 1)
+ If (templateArray(iPtr + 1) = "/HASPREVPAGE") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/HASPREVPAGE"
+ ' Do Nothing
+
+ Case "LINKNEXT"
+ Dim objLink As New HyperLink
+ objLink.ID = Globals.CreateValidID("Article-Header-" & iPtr.ToString())
+ objLink.CssClass = "CommandButton"
+ objLink.Enabled = (CurrentPage < pageCount)
+ objLink.NavigateUrl = NavigateURL(ArticleModuleBase.TabId, "", GetParams(True), "CurrentPage=" & (CurrentPage + 1).ToString())
+ objLink.Text = ArticleModuleBase.GetSharedResource("NextPage.Text")
+ objPlaceHolder.Add(objLink)
+
+ Case "LINKNEXTURL"
+ If (CurrentPage < pageCount) Then
+ Dim objLiteral As New Literal
+ objLiteral.ID = Globals.CreateValidID("Article-Header-" & iPtr.ToString())
+ objLiteral.Text = NavigateURL(ArticleModuleBase.TabId, "", GetParams(True), "CurrentPage=" & (CurrentPage + 1).ToString())
+ objPlaceHolder.Add(objLiteral)
+ End If
+
+ Case "LINKPREVIOUS"
+ Dim objLink As New HyperLink
+ objLink.ID = Globals.CreateValidID("Article-Header-" & iPtr.ToString())
+ objLink.CssClass = "CommandButton"
+ objLink.Enabled = (CurrentPage > 1)
+ objLink.NavigateUrl = NavigateURL(ArticleModuleBase.TabId, "", GetParams(True), "CurrentPage=" & (CurrentPage - 1).ToString())
+ objLink.Text = ArticleModuleBase.GetSharedResource("PreviousPage.Text")
+ objPlaceHolder.Add(objLink)
+
+ Case "LINKPREVIOUSURL"
+ If (CurrentPage > 1) Then
+ Dim objLiteral As New Literal
+ objLiteral.ID = Globals.CreateValidID("Article-Header-" & iPtr.ToString())
+ objLiteral.Text = NavigateURL(ArticleModuleBase.TabId, "", GetParams(True), "CurrentPage=" & (CurrentPage - 1).ToString())
+ objPlaceHolder.Add(objLiteral)
+ End If
+
+ Case "PAGECOUNT"
+ Dim objLiteral As New Literal
+ objLiteral.ID = Globals.CreateValidID("Article-Header-" & iPtr.ToString())
+ objLiteral.Text = pageCount.ToString()
+ objPlaceHolder.Add(objLiteral)
+
+ Case "PAGER"
+ Dim ctlPagingControl As New PagingControl
+ ctlPagingControl.Visible = True
+ ctlPagingControl.TotalRecords = _articleCount
+ ctlPagingControl.PageSize = ArticleSettings.PageSize
+ ctlPagingControl.CurrentPage = CurrentPage
+ ctlPagingControl.QuerystringParams = GetParams(True)
+ ctlPagingControl.TabID = ArticleModuleBase.TabId
+ ctlPagingControl.EnableViewState = False
+ objPlaceHolder.Add(ctlPagingControl)
+
+ Case "PAGER2"
+ Dim objLiteral As New Literal
+ If (_articleCount > 0) Then
+ Dim pages As Integer = _articleCount / ArticleSettings.PageSize
+ objLiteral.Text = objLiteral.Text & "
"
+ For i As Integer = 1 To pages
+ If (CurrentPage = i) Then
+ objLiteral.Text = objLiteral.Text & "
" & i.ToString() & "
"
+ Else
+ Dim params As String = GetParams(True)
+ If (i > 1) Then
+ params += "¤tpage=" & i.ToString()
+ End If
+ objLiteral.Text = objLiteral.Text & "
"
+ End If
+ Next
+ objLiteral.Text = objLiteral.Text & "
"
+ objPlaceHolder.Add(objLiteral)
+ End If
+
+ Case "SORT"
+ Dim drpSort As New DropDownList
+ drpSort.ID = Globals.CreateValidID("Article-Header-" & iPtr.ToString())
+ drpSort.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("PublishDate.Text"), "PublishDate"))
+ drpSort.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("ExpiryDate.Text"), "ExpiryDate"))
+ drpSort.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("LastUpdate.Text"), "LastUpdate"))
+ drpSort.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("HighestRated.Text"), "Rating"))
+ drpSort.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("MostCommented.Text"), "CommentCount"))
+ drpSort.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("MostViewed.Text"), "NumberOfViews"))
+ drpSort.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("Random.Text"), "Random"))
+ drpSort.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("SortTitle.Text"), "Title"))
+ drpSort.AutoPostBack = True
+
+ If (Request("nasort-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ If (drpSort.Items.FindByValue(Request("nasort-" & ArticleModuleBase.TabModuleId.ToString())) IsNot Nothing) Then
+ drpSort.SelectedValue = Request("nasort-" & ArticleModuleBase.TabModuleId.ToString())
+ End If
+ Else
+ Dim sort As String = SortBy
+
+ Select Case SortBy.ToLower()
+ Case "startdate"
+ sort = "PublishDate"
+ Exit Select
+ Case "enddate"
+ sort = "ExpiryDate"
+ Exit Select
+ Case "newid()"
+ sort = "random"
+ Exit Select
+ End Select
+
+ If (drpSort.Items.FindByValue(sort) IsNot Nothing) Then
+ drpSort.SelectedValue = sort
+ End If
+ End If
+
+ Dim objHandler As New System.EventHandler(AddressOf drpSort_SelectedIndexChanged)
+ AddHandler drpSort.SelectedIndexChanged, objHandler
+ objPlaceHolder.Add(drpSort)
+
+ Case "TABID"
+ Dim objLiteral As New Literal
+ objLiteral.ID = Globals.CreateValidID("Article-Header-" & iPtr.ToString())
+ objLiteral.Text = ArticleModuleBase.TabId.ToString()
+ objPlaceHolder.Add(objLiteral)
+
+ Case "TIME"
+ Dim drpTime As New DropDownList
+ drpTime.ID = Globals.CreateValidID("Article-Header-" & iPtr.ToString())
+
+ drpTime.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("Today.Text"), "Today"))
+ drpTime.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("Yesterday.Text"), "Yesterday"))
+ drpTime.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("ThreeDays.Text"), "ThreeDays"))
+ drpTime.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("SevenDays.Text"), "SevenDays"))
+ drpTime.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("ThirtyDays.Text"), "ThirtyDays"))
+ drpTime.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("NinetyDays.Text"), "NinetyDays"))
+ drpTime.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("ThisYear.Text"), "ThisYear"))
+ drpTime.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("AllTime.Text"), "AllTime"))
+ drpTime.AutoPostBack = True
+
+ If (DynamicTime <> "") Then
+ If (drpTime.Items.FindByValue(DynamicTime) IsNot Nothing) Then
+ drpTime.SelectedValue = DynamicTime
+ End If
+ Else
+ drpTime.SelectedValue = "AllTime"
+ End If
+
+ Dim objHandler As New System.EventHandler(AddressOf drpTime_SelectedIndexChanged)
+ AddHandler drpTime.SelectedIndexChanged, objHandler
+
+ objPlaceHolder.Add(drpTime)
+
+ Case Else
+
+ If (templateArray(iPtr + 1).ToUpper().StartsWith("CUSTOM:")) Then
+ Dim customField As String = templateArray(iPtr + 1).Substring(7, templateArray(iPtr + 1).Length - 7)
+
+ Dim objCustomFieldController As New CustomFieldController()
+ Dim objCustomFields As ArrayList = objCustomFieldController.List(ArticleModuleBase.ModuleId)
+
+ For Each objCustomField As CustomFieldInfo In objCustomFields
+ If (objCustomField.Name.ToLower() = customField.ToLower()) Then
+ If (objCustomField.FieldType = CustomFieldType.DropDownList) Then
+ Dim drpCustom As New DropDownList
+ drpCustom.ID = Globals.CreateValidID("Article-Header-" & iPtr.ToString())
+
+ For Each val As String In objCustomField.FieldElements.Split("|"c)
+ drpCustom.Items.Add(val)
+ Next
+
+ Dim sel As String = ArticleModuleBase.GetSharedResource("SelectCustom.Text")
+ If (sel.IndexOf("{0}") <> -1) Then
+ sel = sel.Replace("{0}", objCustomField.Caption)
+ End If
+ drpCustom.Items.Insert(0, New ListItem(sel, "-1"))
+ drpCustom.Attributes.Add("CustomFieldID", objCustomField.CustomFieldID.ToString())
+ drpCustom.AutoPostBack = True
+
+ If (Request("nacust-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ Dim val As String = Request("nacust-" & ArticleModuleBase.TabModuleId.ToString())
+ If (val.Split("-"c).Length = 2) Then
+ If (val.Split("-"c)(0) = objCustomField.CustomFieldID.ToString()) Then
+ If (drpCustom.Items.FindByValue(val.Split("-"c)(1).ToString()) IsNot Nothing) Then
+ drpCustom.SelectedValue = val.Split("-"c)(1).ToString()
+ End If
+ End If
+ End If
+ End If
+
+ Dim objHandler As New System.EventHandler(AddressOf drpCustom_SelectedIndexChanged)
+ AddHandler drpCustom.SelectedIndexChanged, objHandler
+ objPlaceHolder.Add(drpCustom)
+
+ End If
+ Exit For
+ End If
+ Next
+
+ Exit Select
+
+ End If
+
+ If (templateArray(iPtr + 1).ToUpper().StartsWith("RESX:")) Then
+ Dim entry As String = templateArray(iPtr + 1).Substring(5, templateArray(iPtr + 1).Length - 5)
+
+ If (entry <> "") Then
+ Dim objLiteral As New Literal
+ objLiteral.ID = Globals.CreateValidID("Article-Header-" & iPtr.ToString())
+ objLiteral.Text = ArticleModuleBase.GetSharedResource(entry)
+ objPlaceHolder.Add(objLiteral)
+ End If
+
+ Exit Select
+
+ End If
+
+ If (templateArray(iPtr + 1).ToUpper().StartsWith("SORT:")) Then
+
+ Dim params As New List(Of String)
+
+ Dim sortItem As String = templateArray(iPtr + 1).Substring(5, templateArray(iPtr + 1).Length - 5)
+ Dim sortValue As String = sortItem
+
+ Select Case sortItem.ToLower()
+ Case "highestrated"
+ sortValue = "Rating"
+ Exit Select
+ Case "mostcommented"
+ sortValue = "CommentCount"
+ Exit Select
+ Case "mostviewed"
+ sortValue = "NumberOfViews"
+ Exit Select
+ Case "sorttitle"
+ sortValue = "Title"
+ Exit Select
+ End Select
+
+ Dim sort As String = SortBy
+
+ Select Case sort.ToLower()
+ Case "startdate"
+ sort = "PublishDate"
+ Exit Select
+ Case "enddate"
+ sort = "ExpiryDate"
+ Exit Select
+ Case "newid()"
+ sort = "random"
+ Exit Select
+ Case "rating desc, ratingcount"
+ sort = "rating"
+ Exit Select
+ End Select
+
+ If (sortValue.ToLower() = sort.ToLower()) Then
+ Dim objLiteral As New Literal
+ objLiteral.ID = Globals.CreateValidID("Article-Header-" & iPtr.ToString())
+ objLiteral.Text = ArticleModuleBase.GetSharedResource(sortItem & ".Text")
+ objPlaceHolder.Add(objLiteral)
+ Else
+ Dim objLink As New HyperLink
+ objLink.ID = Globals.CreateValidID("Article-Header-" & iPtr.ToString())
+ params.Add("nasort-" & ArticleModuleBase.TabModuleId.ToString() & "=" & sortValue)
+ If (Request("naauth-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("naauth-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("naauth-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ If (Request("nacat-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("nacat-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacat-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ If (Request("nacust-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("nacust-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacust-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ If (Request("natime-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("natime-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("natime-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ objLink.NavigateUrl = NavigateURL(ArticleModuleBase.TabId, "", params.ToArray())
+ objLink.Text = ArticleModuleBase.GetSharedResource(sortItem & ".Text")
+ objPlaceHolder.Add(objLink)
+ End If
+ Exit Select
+
+ End If
+
+ If (templateArray(iPtr + 1).ToUpper().StartsWith("TIME:")) Then
+
+ Dim timeItem As String = templateArray(iPtr + 1).Substring(5, templateArray(iPtr + 1).Length - 5)
+
+ Dim drpTime As New DropDownList
+ drpTime.ID = Globals.CreateValidID("Article-Header-" & iPtr.ToString())
+
+ drpTime.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("Today"), "Today"))
+ drpTime.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("Yesterday"), "Yesterday"))
+ drpTime.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("ThreeDays"), "ThreeDays"))
+ drpTime.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("SevenDays"), "SevenDays"))
+ drpTime.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("ThirtyDays"), "ThirtyDays"))
+ drpTime.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("NinetyDays"), "NinetyDays"))
+ drpTime.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("ThisYear"), "ThisYear"))
+ drpTime.Items.Add(New ListItem(ArticleModuleBase.GetSharedResource("AllTime"), "AllTime"))
+ drpTime.AutoPostBack = True
+
+ If (DynamicTime <> "") Then
+ If (drpTime.Items.FindByValue(DynamicTime) IsNot Nothing) Then
+ drpTime.SelectedValue = DynamicTime
+ End If
+ Else
+ If (drpTime.Items.FindByValue(timeItem) IsNot Nothing) Then
+ Dim params As New List(Of String)
+ If (Request("nasort-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("nasort-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nasort-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ If (Request("naauth-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("naauth-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("naauth-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ If (Request("nacat-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("nacat-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacat-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+
+ params.Add("natime-" & ArticleModuleBase.TabModuleId.ToString() & "=" & timeItem)
+ Response.Redirect(NavigateURL(ArticleModuleBase.TabId, "", params.ToArray()), True)
+ Else
+ drpTime.SelectedValue = "AllTime"
+ End If
+ End If
+
+ Dim objHandler As New System.EventHandler(AddressOf drpTime_SelectedIndexChanged)
+ AddHandler drpTime.SelectedIndexChanged, objHandler
+ objPlaceHolder.Add(drpTime)
+ Exit Select
+ End If
+
+ TokenProcessor.ProcessMenuItem(templateArray(iPtr + 1), objPlaceHolder, _objLayoutController, ArticleModuleBase, iPtr, templateArray, MenuOptionType.CurrentArticles)
+
+ End Select
+ End If
+
+ Next
+
+ End Sub
+
+#End Region
+
+#Region " Event Handlers "
+
+ Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
+
+ Try
+
+ InitSettings()
+
+ Catch exc As Exception 'Module failed to load
+ ProcessModuleLoadException(Me, exc)
+ End Try
+
+ End Sub
+
+ Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
+
+ Try
+
+ Catch exc As Exception 'Module failed to load
+ ProcessModuleLoadException(Me, exc)
+ End Try
+
+ End Sub
+
+ Private Sub Page_PreRender(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.PreRender
+
+ Try
+
+ If (BindArticles) Then
+ BindListing()
+ End If
+ ArticleModuleBase.LoadStyleSheet()
+
+ If (IsIndexed = False) Then
+ ' no index but follow links
+
+ Try
+ 'remove the existing MetaRobots entry
+ Page.Header.Controls.Remove(Page.Header.FindControl("MetaRobots"))
+
+ 'build our own new entry
+ Dim mymetatag As New System.Web.UI.HtmlControls.HtmlMeta
+ mymetatag.Name = "robots"
+ mymetatag.Content = "NOINDEX, FOLLOW"
+ Page.Header.Controls.Add(mymetatag)
+ Catch ex As Exception
+ 'catch an exception if MetaRobots is not present
+
+ End Try
+
+
+ End If
+
+ Catch exc As Exception 'Module failed to load
+ ProcessModuleLoadException(Me, exc)
+ End Try
+
+ End Sub
+
+ Private Sub rptListing_OnItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptListing.ItemDataBound
+
+ Try
+
+ If (e.Item.ItemType = ListItemType.Header) Then
+ ProcessHeader(e.Item.Controls, _objLayoutHeader.Tokens)
+ End If
+
+ If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
+
+ Dim objArticle As ArticleInfo = CType(e.Item.DataItem, ArticleInfo)
+
+ If (objArticle.IsFeatured) Then
+ _objLayoutController.ProcessArticleItem(e.Item.Controls, _objLayoutFeatured.Tokens, objArticle)
+ Else
+ _objLayoutController.ProcessArticleItem(e.Item.Controls, _objLayoutItem.Tokens, objArticle)
+ End If
+
+ End If
+
+ If (e.Item.ItemType = ListItemType.Footer) Then
+ ProcessHeader(e.Item.Controls, _objLayoutFooter.Tokens)
+ End If
+
+ Catch exc As Exception 'Module failed to load
+ ProcessModuleLoadException(Me, exc)
+ End Try
+
+ End Sub
+
+ Private Sub drpAuthor_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
+
+ Dim params As New List(Of String)
+
+ Dim args As String = GetParams(False)
+ For Each arg As String In args.Split("&"c)
+ params.Add(arg)
+ Next
+
+ If (Request("nasort-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("nasort-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nasort-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+
+ Dim drpAuthor As DropDownList = CType(sender, DropDownList)
+
+ If (drpAuthor IsNot Nothing) Then
+ If (drpAuthor.SelectedValue <> "-1") Then
+ params.Add("naauth-" & ArticleModuleBase.TabModuleId.ToString() & "=" & drpAuthor.SelectedValue)
+ If (Request("nacat-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("nacat-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacat-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ If (Request("nacust-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("nacust-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacust-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ If (Request("natime-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("natime-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("natime-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ Response.Redirect(NavigateURL(ArticleModuleBase.TabId, "", params.ToArray()), True)
+ Else
+ If (Request("nacat-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("nacat-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacat-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ If (Request("nacust-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("nacust-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacust-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ If (Request("natime-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("natime-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("natime-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ Response.Redirect(NavigateURL(ArticleModuleBase.TabId, "", params.ToArray()), True)
+ End If
+ End If
+
+ End Sub
+
+ Private Sub drpCategory_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
+
+ Dim params As New List(Of String)
+
+ Dim args As String = GetParams(False)
+ For Each arg As String In args.Split("&"c)
+ params.Add(arg)
+ Next
+
+ If (Request("nasort-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("nasort-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nasort-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+
+ Dim drpCategory As DropDownList = CType(sender, DropDownList)
+
+ If (drpCategory IsNot Nothing) Then
+ If (drpCategory.SelectedValue <> "-1") Then
+ If (Request("naauth-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("naauth-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("naauth-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ params.Add("nacat-" & ArticleModuleBase.TabModuleId.ToString() & "=" & drpCategory.SelectedValue)
+ If (Request("nacust-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("nacust-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacust-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ If (Request("natime-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("natime-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("natime-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ Response.Redirect(NavigateURL(ArticleModuleBase.TabId, "", params.ToArray()), True)
+ Else
+ If (Request("naauth-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("naauth-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("naauth-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ If (Request("nacust-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("nacust-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacust-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ If (Request("natime-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("natime-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("natime-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ Response.Redirect(NavigateURL(ArticleModuleBase.TabId, "", params.ToArray()), True)
+ End If
+ End If
+
+ End Sub
+
+ Private Sub drpCustom_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
+
+ Dim params As New List(Of String)
+
+ Dim args As String = GetParams(False)
+ For Each arg As String In args.Split("&"c)
+ params.Add(arg)
+ Next
+
+ If (Request("nasort-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("nasort-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nasort-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+
+ Dim drpCustom As DropDownList = CType(sender, DropDownList)
+
+ If (drpCustom IsNot Nothing) Then
+ If (drpCustom.SelectedValue <> "-1") Then
+ params.Add("nacust-" & ArticleModuleBase.TabModuleId.ToString() & "=" & drpCustom.Attributes("CustomFieldID") & "-" & drpCustom.SelectedValue)
+ If (Request("naauth-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("naauth-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("naauth-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ If (Request("nacat-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("nacat-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacat-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ If (Request("natime-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("natime-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("natime-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ Response.Redirect(NavigateURL(ArticleModuleBase.TabId, "", params.ToArray()), True)
+ Else
+ If (Request("naauth-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("naauth-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("naauth-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ If (Request("nacat-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("nacat-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacat-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ If (Request("natime-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("natime-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("natime-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ Response.Redirect(NavigateURL(ArticleModuleBase.TabId, "", params.ToArray()), True)
+ End If
+ End If
+
+ End Sub
+
+ Private Sub drpSort_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
+
+ Dim params As New List(Of String)
+
+ Dim args As String = GetParams(False)
+ For Each arg As String In args.Split("&"c)
+ params.Add(arg)
+ Next
+
+ Dim drpSort As DropDownList = CType(sender, DropDownList)
+
+ If (drpSort IsNot Nothing) Then
+ params.Add("nasort-" & ArticleModuleBase.TabModuleId.ToString() & "=" & drpSort.SelectedValue)
+ If (Request("naauth-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("naauth-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("naauth-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ If (Request("nacat-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("nacat-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacat-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ If (Request("nacust-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("nacust-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacust-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ If (Request("natime-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("natime-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("natime-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ Response.Redirect(NavigateURL(ArticleModuleBase.TabId, "", params.ToArray()), True)
+ End If
+
+ End Sub
+
+ Private Sub drpTime_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
+
+ Dim params As New List(Of String)
+
+ Dim args As String = GetParams(False)
+ For Each arg As String In args.Split("&"c)
+ params.Add(arg)
+ Next
+
+ If (Request("nasort-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("nasort-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nasort-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ If (Request("naauth-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("naauth-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("naauth-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ If (Request("nacat-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("nacat-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacat-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+ If (Request("nacust-" & ArticleModuleBase.TabModuleId.ToString()) <> "") Then
+ params.Add("nacust-" & ArticleModuleBase.TabModuleId.ToString() & "=" & Request("nacust-" & ArticleModuleBase.TabModuleId.ToString()))
+ End If
+
+ Dim drpTime As DropDownList = CType(sender, DropDownList)
+
+ If (drpTime IsNot Nothing) Then
+ params.Add("natime-" & ArticleModuleBase.TabModuleId.ToString() & "=" & drpTime.SelectedValue)
+ Response.Redirect(NavigateURL(ArticleModuleBase.TabId, "", params.ToArray()), True)
+ End If
+
+ End Sub
+
+#End Region
+
+ End Class
+
+End Namespace
\ No newline at end of file
diff --git a/Controls/PostComment.ascx b/Controls/PostComment.ascx
new file mode 100755
index 0000000..8ff659c
--- /dev/null
+++ b/Controls/PostComment.ascx
@@ -0,0 +1,40 @@
+<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="PostComment.ascx.vb" Inherits="Ventrian.NewsArticles.Controls.PostComment" %>
+<%@ Register TagPrefix="dnn" Assembly="DotNetNuke" Namespace="DotNetNuke.UI.WebControls"%>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Controls/PostComment.ascx.designer.vb b/Controls/PostComment.ascx.designer.vb
new file mode 100755
index 0000000..cd621de
--- /dev/null
+++ b/Controls/PostComment.ascx.designer.vb
@@ -0,0 +1,215 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+Namespace Ventrian.NewsArticles.Controls
+
+ Partial Public Class PostComment
+
+ '''
+ '''phCommentForm control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents phCommentForm As Global.System.Web.UI.WebControls.PlaceHolder
+
+ '''
+ '''pName control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents pName As Global.System.Web.UI.HtmlControls.HtmlGenericControl
+
+ '''
+ '''txtName control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents txtName As Global.System.Web.UI.WebControls.TextBox
+
+ '''
+ '''lblName control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents lblName As Global.System.Web.UI.WebControls.Label
+
+ '''
+ '''valName control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents valName As Global.System.Web.UI.WebControls.RequiredFieldValidator
+
+ '''
+ '''pEmail control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents pEmail As Global.System.Web.UI.HtmlControls.HtmlGenericControl
+
+ '''
+ '''txtEmail control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents txtEmail As Global.System.Web.UI.WebControls.TextBox
+
+ '''
+ '''lblEmail control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents lblEmail As Global.System.Web.UI.WebControls.Label
+
+ '''
+ '''valEmail control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents valEmail As Global.System.Web.UI.WebControls.RequiredFieldValidator
+
+ '''
+ '''valEmailIsValid control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents valEmailIsValid As Global.System.Web.UI.WebControls.RegularExpressionValidator
+
+ '''
+ '''pUrl control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents pUrl As Global.System.Web.UI.HtmlControls.HtmlGenericControl
+
+ '''
+ '''txtURL control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents txtURL As Global.System.Web.UI.WebControls.TextBox
+
+ '''
+ '''lblUrl control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents lblUrl As Global.System.Web.UI.WebControls.Label
+
+ '''
+ '''txtComment control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents txtComment As Global.System.Web.UI.WebControls.TextBox
+
+ '''
+ '''valComment control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents valComment As Global.System.Web.UI.WebControls.RequiredFieldValidator
+
+ '''
+ '''ctlCaptcha control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents ctlCaptcha As Global.DotNetNuke.UI.WebControls.CaptchaControl
+
+ '''
+ '''btnAddComment control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents btnAddComment As Global.System.Web.UI.WebControls.Button
+
+ '''
+ '''chkNotifyMe control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents chkNotifyMe As Global.System.Web.UI.WebControls.CheckBox
+
+ '''
+ '''phCommentPosted control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents phCommentPosted As Global.System.Web.UI.WebControls.PlaceHolder
+
+ '''
+ '''lblRequiresApproval control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents lblRequiresApproval As Global.System.Web.UI.WebControls.Label
+
+ '''
+ '''phCommentAnonymous control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents phCommentAnonymous As Global.System.Web.UI.WebControls.PlaceHolder
+
+ '''
+ '''lblRequiresAccess control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents lblRequiresAccess As Global.System.Web.UI.WebControls.Label
+ End Class
+End Namespace
diff --git a/Controls/PostComment.ascx.vb b/Controls/PostComment.ascx.vb
new file mode 100755
index 0000000..3bb13c5
--- /dev/null
+++ b/Controls/PostComment.ascx.vb
@@ -0,0 +1,518 @@
+Imports DotNetNuke.Common.Utilities
+Imports DotNetNuke.Security
+Imports DotNetNuke.Services.Localization
+Imports Joel.Net
+Imports Ventrian.NewsArticles.Components.Social
+
+Imports Ventrian.NewsArticles.Base
+
+Namespace Ventrian.NewsArticles.Controls
+
+ Partial Public Class PostComment
+ Inherits NewsArticleControlBase
+
+#Region " Private Properties "
+
+ Private ReadOnly Property ArticleModuleBase() As NewsArticleModuleBase
+ Get
+ If (TypeOf Parent.Parent Is NewsArticleModuleBase) Then
+ Return CType(Parent.Parent, NewsArticleModuleBase)
+ Else
+ Return CType(Parent.Parent.Parent.Parent, NewsArticleModuleBase)
+ End If
+ End Get
+ End Property
+
+ Private ReadOnly Property ArticleSettings() As ArticleSettings
+ Get
+ Return ArticleModuleBase.ArticleSettings
+ End Get
+ End Property
+
+#End Region
+
+#Region " Private Methods "
+
+ Private Sub AssignLocalization()
+
+ lblName.Text = GetResourceKey("Name")
+ valName.ErrorMessage = GetResourceKey("valName.ErrorMessage")
+
+ If (ArticleSettings.CommentRequireName = False) Then
+ valName.Enabled = False
+ lblName.Text = GetResourceKey("NameNotRequired")
+ End If
+
+ lblEmail.Text = GetResourceKey("Email")
+ valEmail.ErrorMessage = GetResourceKey("valEmail.ErrorMessage")
+ valEmailIsValid.ErrorMessage = GetResourceKey("valEmailIsValid.ErrorMessage")
+
+ If (ArticleSettings.CommentRequireEmail = False) Then
+ valEmail.Enabled = False
+ valEmailIsValid.Enabled = False
+ lblEmail.Text = GetResourceKey("EmailNotRequired")
+ End If
+
+ lblUrl.Text = GetResourceKey("Website")
+
+ valComment.ErrorMessage = GetResourceKey("valComment.ErrorMessage")
+ ctlCaptcha.Text = GetResourceKey("ctlCaptcha.Text")
+ ctlCaptcha.ErrorMessage = GetResourceKey("ctlCaptcha.ErrorMessage")
+
+ btnAddComment.Text = GetResourceKey("AddComment")
+ chkNotifyMe.Text = GetResourceKey("NotifyMe")
+ lblRequiresApproval.Text = GetResourceKey("RequiresApproval")
+
+ lblRequiresAccess.Text = GetResourceKey("RequiresAccess")
+
+ End Sub
+
+ Private Sub CheckSecurity()
+
+ If (ArticleSettings.IsCommentsAnonymous = False And Request.IsAuthenticated = False) Then
+ phCommentForm.Visible = False
+ phCommentAnonymous.Visible = True
+ End If
+
+ End Sub
+
+ Private Function FilterInput(ByVal stringToFilter As String) As String
+
+ Dim objPortalSecurity As New PortalSecurity
+
+ stringToFilter = objPortalSecurity.InputFilter(stringToFilter, PortalSecurity.FilterFlag.NoScripting)
+
+ stringToFilter = Replace(stringToFilter, Chr(13), "")
+ stringToFilter = Replace(stringToFilter, ControlChars.Lf, " ")
+
+ Return stringToFilter
+
+ End Function
+
+ Private Sub GetCookie()
+
+ If (Request.IsAuthenticated = False) Then
+ Dim cookie As HttpCookie = Request.Cookies("comment")
+
+ If (cookie IsNot Nothing) Then
+ txtName.Text = cookie.Values("name")
+ txtEmail.Text = cookie.Values("email")
+ txtURL.Text = cookie.Values("url")
+ End If
+ End If
+
+ chkNotifyMe.Checked = ArticleSettings.NotifyDefault
+
+ End Sub
+
+ Public Function GetResourceKey(ByVal key As String) As String
+
+ Dim path As String = "~/DesktopModules/DnnForge - NewsArticles/" & Localization.LocalResourceDirectory & "/PostComment.ascx.resx"
+ Return DotNetNuke.Services.Localization.Localization.GetString(key, path)
+
+ End Function
+
+ Private Sub NotifyAuthor(ByVal objComment As CommentInfo, ByVal objArticle As ArticleInfo)
+
+ Dim objEmailTemplateController As New EmailTemplateController
+ objEmailTemplateController.SendFormattedEmail(ArticleModuleBase.ModuleId, Common.GetArticleLink(objArticle, ArticleModuleBase.PortalSettings.ActiveTab, ArticleSettings, False), objArticle, objComment, EmailTemplateType.CommentNotification, ArticleSettings)
+
+ End Sub
+
+ Private Sub NotifyComments(ByVal objComment As CommentInfo, ByVal objArticle As ArticleInfo)
+
+ Dim objEmailTemplateController As New EmailTemplateController
+ Dim objMailList As New Hashtable
+
+ Dim objCommentController As New CommentController
+ Dim objComments As List(Of CommentInfo) = objCommentController.GetCommentList(ArticleModuleBase.ModuleId, ArticleID, True, SortDirection.Ascending, Null.NullInteger)
+
+ For Each objNotifyComment As CommentInfo In objComments
+ If (objNotifyComment.CommentID <> objComment.CommentID And objNotifyComment.NotifyMe) Then
+ If (objNotifyComment.UserID = Null.NullInteger) Then
+ If (objNotifyComment.AnonymousEmail <> "") Then
+ If (objNotifyComment.AnonymousEmail <> objComment.AnonymousEmail) Then
+ If (objMailList.Contains(objNotifyComment.AnonymousEmail) = False) Then
+ objEmailTemplateController.SendFormattedEmail(ArticleModuleBase.ModuleId, Common.GetArticleLink(objArticle, ArticleModuleBase.PortalSettings.ActiveTab, ArticleSettings, False), objArticle, objComment, EmailTemplateType.CommentNotification, ArticleSettings, objNotifyComment.AnonymousEmail)
+ objMailList.Add(objNotifyComment.AnonymousEmail, objNotifyComment.AnonymousEmail)
+ End If
+ End If
+ End If
+ Else
+ If (objNotifyComment.AuthorEmail <> "") Then
+ If (objNotifyComment.UserID <> objComment.UserID) Then
+ If (objMailList.Contains(objNotifyComment.AuthorEmail.ToString()) = False) Then
+ objEmailTemplateController.SendFormattedEmail(ArticleModuleBase.ModuleId, Common.GetArticleLink(objArticle, ArticleModuleBase.PortalSettings.ActiveTab, ArticleSettings, False), objArticle, objComment, EmailTemplateType.CommentNotification, ArticleSettings, objNotifyComment.AuthorEmail)
+ objMailList.Add(objNotifyComment.AuthorEmail, objNotifyComment.AuthorEmail)
+ End If
+ End If
+ End If
+ End If
+
+ End If
+ Next
+
+ End Sub
+
+ Private Sub SetCookie()
+
+ If (Request.IsAuthenticated = False) Then
+ Dim objCookie As New HttpCookie("comment")
+
+ objCookie.Expires = DateTime.Now.AddMonths(24)
+ objCookie.Values.Add("name", txtName.Text)
+ objCookie.Values.Add("email", txtEmail.Text)
+ objCookie.Values.Add("url", txtURL.Text)
+
+ Response.Cookies.Add(objCookie)
+ End If
+
+ End Sub
+
+ Private Sub SetVisibility()
+
+ pName.Visible = Not Request.IsAuthenticated
+ pEmail.Visible = Not Request.IsAuthenticated
+ pUrl.Visible = Not Request.IsAuthenticated
+ ctlCaptcha.Visible = (ArticleSettings.UseCaptcha And Request.IsAuthenticated = False)
+
+ If (Request.IsAuthenticated = False) Then
+ pUrl.Visible = Not ArticleSettings.IsCommentWebsiteHidden
+ End If
+
+ End Sub
+
+#End Region
+
+#Region " Event Handlers "
+
+ Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
+
+ If Not (TypeOf Parent.Parent Is NewsArticleModuleBase Or TypeOf Parent.Parent.Parent.Parent Is NewsArticleModuleBase) Then
+ Visible = False
+ Return
+ End If
+
+ CheckSecurity()
+ AssignLocalization()
+ SetVisibility()
+
+ valName.ValidationGroup = "PostComment-" & ArticleID.ToString()
+ valEmail.ValidationGroup = "PostComment-" & ArticleID.ToString()
+ valEmailIsValid.ValidationGroup = "PostComment-" & ArticleID.ToString()
+ valComment.ValidationGroup = "PostComment-" & ArticleID.ToString()
+ btnAddComment.ValidationGroup = "PostComment-" & ArticleID.ToString()
+
+ If (Page.IsPostBack = False) Then
+ GetCookie()
+ End If
+
+ End Sub
+
+ Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
+
+ If (HttpContext.Current.Items.Contains("IgnoreCaptcha")) Then
+ ctlCaptcha.ErrorMessage = ""
+ End If
+
+ End Sub
+
+ Protected Sub btnAddComment_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnAddComment.Click
+
+ If (Page.IsValid) Then
+ If (ArticleSettings.UseCaptcha And Request.IsAuthenticated = False) Then
+ If (ctlCaptcha.IsValid = False) Then
+ txtComment.Focus()
+ Return
+ End If
+ End If
+
+ Dim objController As New ArticleController
+ Dim objArticle As ArticleInfo = objController.GetArticle(ArticleID)
+
+ Dim objCommentController As New CommentController
+ Dim objComments As List(Of CommentInfo) = objCommentController.GetCommentList(ArticleModuleBase.ModuleId, ArticleID, True, SortDirection.Ascending, Null.NullInteger)
+
+ For Each objArticleComment As CommentInfo In objComments
+ If (objArticleComment.CreatedDate > DateTime.Now.AddMinutes(-1)) Then
+ Dim id As Integer = Null.NullInteger
+ If (Request.IsAuthenticated) Then
+ id = ArticleModuleBase.UserId
+ End If
+ If (objArticleComment.Comment = FilterInput(txtComment.Text) And objArticleComment.UserID = id) Then
+ ' Existing Comment just posted - so ignore redirect.
+ If (Request("articleType") <> "ArticleView") Then
+ Response.Redirect(Request.RawUrl & "#Comment" & objArticleComment.CommentID.ToString(), True)
+ Else
+ Response.Redirect(Common.GetArticleLink(objArticle, ArticleModuleBase.PortalSettings.ActiveTab, ArticleSettings, False) & "#Comment" & objArticleComment.CommentID.ToString(), True)
+ End If
+ Return
+ End If
+ End If
+ Next
+
+ objComments = objCommentController.GetCommentList(ArticleModuleBase.ModuleId, ArticleID, False, SortDirection.Ascending, Null.NullInteger)
+
+ For Each objArticleComment As CommentInfo In objComments
+ If (objArticleComment.CreatedDate > DateTime.Now.AddMinutes(-1)) Then
+ Dim id As Integer = Null.NullInteger
+ If (Request.IsAuthenticated) Then
+ id = ArticleModuleBase.UserId
+ End If
+ If (objArticleComment.Comment = FilterInput(txtComment.Text) And objArticleComment.UserID = id) Then
+ ' Existing Comment just posted - so ignore redirect.
+ If (Request("articleType") <> "ArticleView") Then
+ Response.Redirect(Request.RawUrl & "#Comment" & objArticleComment.CommentID.ToString(), True)
+ Else
+ Response.Redirect(Common.GetArticleLink(objArticle, ArticleModuleBase.PortalSettings.ActiveTab, ArticleSettings, False) & "#Comment" & objArticleComment.CommentID.ToString(), True)
+ End If
+ Return
+ End If
+ End If
+ Next
+
+ Dim objComment As New CommentInfo
+ objComment.ArticleID = ArticleID
+ objComment.CreatedDate = DateTime.Now
+ If (Request.IsAuthenticated) Then
+ objComment.UserID = ArticleModuleBase.UserId
+ Else
+ objComment.UserID = Null.NullInteger
+ objComment.AnonymousName = txtName.Text
+ objComment.AnonymousEmail = txtEmail.Text
+ objComment.AnonymousURL = txtURL.Text
+ SetCookie()
+ End If
+ objComment.Comment = FilterInput(txtComment.Text)
+ objComment.RemoteAddress = Request.UserHostAddress
+ objComment.NotifyMe = chkNotifyMe.Checked
+ objComment.Type = 0
+
+ If (ArticleSettings.IsApprover Or ArticleSettings.IsAutoApproverComment) Then
+ objComment.IsApproved = True
+ objComment.ApprovedBy = ArticleModuleBase.UserId
+ Else
+ If (ArticleSettings.CommentModeration) Then
+ objComment.IsApproved = False
+ objComment.ApprovedBy = Null.NullInteger
+ Else
+ objComment.IsApproved = True
+ objComment.ApprovedBy = Null.NullInteger
+ End If
+ End If
+
+ ' Akismet
+ If (ArticleSettings.CommentAkismetKey <> "") Then
+ Dim api As New Akismet(ArticleSettings.CommentAkismetKey, DotNetNuke.Common.Globals.NavigateURL(CType(Parent.Parent, DotNetNuke.Entities.Modules.PortalModuleBase).TabId), "Test/1.0")
+ If (api.VerifyKey()) Then
+ Dim comment As New AkismetComment()
+
+ comment.Blog = DotNetNuke.Common.Globals.NavigateURL(CType(Parent.Parent, DotNetNuke.Entities.Modules.PortalModuleBase).TabId)
+ comment.UserIp = objComment.RemoteAddress
+ comment.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
+ comment.CommentContent = objComment.Comment
+ comment.CommentType = "comment"
+
+ If (Request.IsAuthenticated) Then
+ comment.CommentAuthor = CType(Parent.Parent, DotNetNuke.Entities.Modules.PortalModuleBase).UserInfo.DisplayName
+ comment.CommentAuthorEmail = CType(Parent.Parent, DotNetNuke.Entities.Modules.PortalModuleBase).UserInfo.Email
+ comment.CommentAuthorUrl = ""
+ Else
+ comment.CommentAuthor = objComment.AnonymousName
+ comment.CommentAuthorEmail = objComment.AnonymousEmail
+ comment.CommentAuthorUrl = objComment.AnonymousURL
+ End If
+
+ If (api.CommentCheck(comment)) Then
+ txtComment.Focus()
+ Return
+ End If
+ End If
+ End If
+
+ objComment.CommentID = objCommentController.AddComment(objComment)
+
+ ' Re-init for user details.
+ objComment = objCommentController.GetComment(objComment.CommentID)
+
+ If Not (objArticle Is Nothing) Then
+
+ ' Notifications
+ If (objComment.IsApproved) Then
+ If (ArticleSettings.NotifyAuthorOnComment) Then
+ NotifyAuthor(objComment, objArticle)
+ End If
+ NotifyComments(objComment, objArticle)
+
+ If (ArticleSettings.NotifyEmailOnComment <> "") Then
+ Dim objEmailTemplateController As New EmailTemplateController
+ For Each email As String In ArticleSettings.NotifyEmailOnComment.Split(Convert.ToChar(";"))
+ If (email <> "") Then
+ objEmailTemplateController.SendFormattedEmail(ArticleModuleBase.ModuleId, Common.GetArticleLink(objArticle, ArticleModuleBase.PortalSettings.ActiveTab, ArticleSettings, False), objArticle, objComment, EmailTemplateType.CommentNotification, ArticleSettings, email)
+ End If
+ Next
+ End If
+
+ If (ArticleSettings.EnableActiveSocialFeed And Request.IsAuthenticated) Then
+ If (ArticleSettings.ActiveSocialCommentKey <> "") Then
+ If IO.File.Exists(HttpContext.Current.Server.MapPath("~/bin/active.modules.social.dll")) Then
+ Dim ai As Object = Nothing
+ Dim asm As System.Reflection.Assembly
+ Dim ac As Object = Nothing
+ Try
+ asm = System.Reflection.Assembly.Load("Active.Modules.Social")
+ ac = asm.CreateInstance("Active.Modules.Social.API.Journal")
+ If Not ac Is Nothing Then
+ ac.AddProfileItem(New Guid(ArticleSettings.ActiveSocialCommentKey), objComment.UserID, Common.GetArticleLink(objArticle, ArticleModuleBase.PortalSettings.ActiveTab, ArticleSettings, False), objArticle.Title, objComment.Comment, objComment.Comment, 1, "")
+ End If
+ Catch ex As Exception
+ End Try
+ End If
+ End If
+ End If
+
+ If (Request.IsAuthenticated) Then
+ If (ArticleSettings.JournalIntegration) Then
+ Dim objJournal As New Journal
+ objJournal.AddCommentToJournal(objArticle, objComment, ArticleModuleBase.PortalId, ArticleModuleBase.TabId, ArticleModuleBase.UserId, Common.GetArticleLink(objArticle, ArticleModuleBase.PortalSettings.ActiveTab, ArticleSettings, False))
+ End If
+ End If
+
+ If (ArticleSettings.EnableSmartThinkerStoryFeed And Request.IsAuthenticated) Then
+ Dim objStoryFeed As New wsStoryFeed.StoryFeedWS
+ objStoryFeed.Url = DotNetNuke.Common.Globals.AddHTTP(Request.ServerVariables("HTTP_HOST") & Me.ResolveUrl("~/DesktopModules/Smart-Thinker%20-%20UserProfile/StoryFeed.asmx"))
+
+ Dim val As String = ArticleModuleBase.GetSharedResource("StoryFeed-AddComment")
+
+ Dim delimStr As String = "[]"
+ Dim delimiter As Char() = delimStr.ToCharArray()
+ Dim layoutArray As String() = val.Split(delimiter)
+
+ Dim valResult As String = ""
+
+ For iPtr As Integer = 0 To layoutArray.Length - 1 Step 2
+
+ valResult = valResult & layoutArray(iPtr)
+
+ If iPtr < layoutArray.Length - 1 Then
+ Select Case layoutArray(iPtr + 1)
+
+ Case "ARTICLEID"
+ valResult = valResult & objComment.ArticleID.ToString()
+
+ Case "AUTHORID"
+ valResult = valResult & objComment.UserID.ToString()
+
+ Case "AUTHOR"
+ If (objComment.UserID = Null.NullInteger) Then
+ valResult = valResult & objComment.AnonymousName
+ Else
+ valResult = valResult & objComment.AuthorDisplayName
+ End If
+
+ Case "ARTICLELINK"
+ valResult = valResult & Common.GetArticleLink(objArticle, ArticleModuleBase.PortalSettings.ActiveTab, ArticleSettings, False)
+
+ Case "ARTICLETITLE"
+ valResult = valResult & objArticle.Title
+
+ Case "ISANONYMOUS"
+ If (objComment.UserID <> Null.NullInteger) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/ISANONYMOUS") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/ISANONYMOUS"
+ ' Do Nothing
+
+ Case "ISNOTANONYMOUS"
+ If (objComment.UserID <> Null.NullInteger) Then
+ While (iPtr < layoutArray.Length - 1)
+ If (layoutArray(iPtr + 1) = "/ISNOTANONYMOUS") Then
+ Exit While
+ End If
+ iPtr = iPtr + 1
+ End While
+ End If
+
+ Case "/ISNOTANONYMOUS"
+ ' Do Nothing
+
+ End Select
+ End If
+ Next
+
+ Try
+ objStoryFeed.AddAction(81, objComment.CommentID, valResult, objComment.UserID, "VE6457624576460436531768")
+ Catch
+ End Try
+
+ End If
+ Else
+
+ If (ArticleSettings.NotifyApproverForCommentApproval) Then
+
+ ' Notify Approvers
+ Dim objEmailTemplateController As New EmailTemplateController
+ Dim emails As String = objEmailTemplateController.GetApproverDistributionList(ArticleModuleBase.ModuleId)
+
+ For Each email As String In emails.Split(Convert.ToChar(";"))
+ If (email <> "") Then
+ Try
+ objEmailTemplateController.SendFormattedEmail(ArticleModuleBase.ModuleId, Common.GetArticleLink(objArticle, ArticleModuleBase.PortalSettings.ActiveTab, ArticleSettings, False), objArticle, objComment, EmailTemplateType.CommentRequiringApproval, ArticleSettings, email)
+ Catch
+ End Try
+ End If
+ Next
+
+ End If
+
+ If (ArticleSettings.NotifyEmailForCommentApproval <> "") Then
+
+ Dim objEmailTemplateController As New EmailTemplateController
+
+ For Each email As String In ArticleSettings.NotifyEmailForCommentApproval.Split(Convert.ToChar(";"))
+ If (email <> "") Then
+ Try
+ objEmailTemplateController.SendFormattedEmail(ArticleModuleBase.ModuleId, Common.GetArticleLink(objArticle, ArticleModuleBase.PortalSettings.ActiveTab, ArticleSettings, False), objArticle, objComment, EmailTemplateType.CommentRequiringApproval, ArticleSettings, email)
+ Catch
+ End Try
+ End If
+ Next
+
+ End If
+
+ End If
+
+ ' Redirect
+ If (objComment.IsApproved) Then
+ If (Request("articleType") <> "ArticleView") Then
+ Response.Redirect(Request.RawUrl & "#Comment" & objComment.CommentID.ToString(), True)
+ Else
+ Response.Redirect(Common.GetArticleLink(objArticle, ArticleModuleBase.PortalSettings.ActiveTab, ArticleSettings, False) & "#Comment" & objComment.CommentID.ToString(), True)
+ End If
+ Else
+ phCommentForm.Visible = False
+ phCommentPosted.Visible = True
+ End If
+
+ Else
+
+ ' Should never be here.
+ Response.Redirect(DotNetNuke.Common.NavigateURL(), True)
+
+ End If
+
+ End If
+
+ End Sub
+
+#End Region
+
+ End Class
+
+End Namespace
\ No newline at end of file
diff --git a/Controls/PostRating.ascx b/Controls/PostRating.ascx
new file mode 100755
index 0000000..85629c3
--- /dev/null
+++ b/Controls/PostRating.ascx
@@ -0,0 +1,9 @@
+<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="PostRating.ascx.vb" Inherits="Ventrian.NewsArticles.Controls.PostRating" %>
+
+ 1
+ 2
+ 3
+ 4
+ 5
+
+
diff --git a/Controls/PostRating.ascx.designer.vb b/Controls/PostRating.ascx.designer.vb
new file mode 100755
index 0000000..7fdaeec
--- /dev/null
+++ b/Controls/PostRating.ascx.designer.vb
@@ -0,0 +1,35 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+Namespace Ventrian.NewsArticles.Controls
+
+ Partial Public Class PostRating
+
+ '''
+ '''lstRating control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents lstRating As Global.System.Web.UI.WebControls.RadioButtonList
+
+ '''
+ '''lblRatingSaved control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents lblRatingSaved As Global.System.Web.UI.WebControls.Label
+ End Class
+End Namespace
diff --git a/Controls/PostRating.ascx.vb b/Controls/PostRating.ascx.vb
new file mode 100755
index 0000000..b74666f
--- /dev/null
+++ b/Controls/PostRating.ascx.vb
@@ -0,0 +1,248 @@
+Imports DotNetNuke.Common.Utilities
+Imports DotNetNuke.Services.Localization
+Imports DotNetNuke.Framework
+Imports Ventrian.NewsArticles.Components.Social
+
+Imports Ventrian.NewsArticles.Base
+
+Namespace Ventrian.NewsArticles.Controls
+
+ Partial Public Class PostRating
+ Inherits System.Web.UI.UserControl
+
+#Region " Private Members "
+
+ Private _articleID As Integer = Null.NullInteger
+
+#End Region
+
+#Region " Private Properties "
+
+ Private ReadOnly Property ArticleModuleBase() As NewsArticleModuleBase
+ Get
+ Return CType(Parent.Parent, NewsArticleModuleBase)
+ End Get
+ End Property
+
+ Private ReadOnly Property ArticleSettings() As ArticleSettings
+ Get
+ Return ArticleModuleBase.ArticleSettings
+ End Get
+ End Property
+
+#End Region
+
+#Region " Private Methods "
+
+ Private Sub AssignLocalization()
+
+ lblRatingSaved.Text = GetResourceKey("RatingSaved")
+
+ End Sub
+
+ Public Function GetResourceKey(ByVal key As String) As String
+
+ Dim path As String = "~/DesktopModules/DnnForge - NewsArticles/" & Localization.LocalResourceDirectory & "/PostRating.ascx.resx"
+ Return DotNetNuke.Services.Localization.Localization.GetString(key, path)
+
+ End Function
+
+ Private Sub ReadQueryString()
+
+ If (ArticleSettings.UrlModeType = Components.Types.UrlModeType.Shorterned) Then
+ Try
+ If (IsNumeric(Request(ArticleSettings.ShortenedID))) Then
+ _articleID = Convert.ToInt32(Request(ArticleSettings.ShortenedID))
+ End If
+ Catch
+ End Try
+ End If
+
+ If (IsNumeric(Request("ArticleID"))) Then
+ _articleID = Convert.ToInt32(Request("ArticleID"))
+ End If
+
+ End Sub
+
+#End Region
+
+#Region " Event Handlers "
+
+ Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
+
+ If Not (TypeOf Parent.Parent Is NewsArticleModuleBase) Then
+ Visible = False
+ Return
+ End If
+
+ ReadQueryString()
+ AssignLocalization()
+
+ If (ArticleSettings.IsRateable = False) Then
+ Me.Visible = False
+ Return
+ End If
+
+ If (IsPostBack = False) Then
+
+ Dim objRatingController As New RatingController
+ If (Request.IsAuthenticated) Then
+ Dim objRating As RatingInfo = objRatingController.Get(_articleID, ArticleModuleBase.UserId, ArticleModuleBase.ModuleId)
+
+ If Not (objRating Is Nothing) Then
+ If (objRating.RatingID <> Null.NullInteger) Then
+ If Not (lstRating.Items.FindByValue(Convert.ToDouble(objRating.Rating).ToString()) Is Nothing) Then
+ lstRating.SelectedValue = Convert.ToDouble(objRating.Rating).ToString()
+ End If
+ End If
+ End If
+ Else
+ Dim cookie As HttpCookie = Request.Cookies("ArticleRating" & _articleID.ToString())
+ If Not (cookie Is Nothing) Then
+ Dim objRating As RatingInfo = objRatingController.GetByID(Convert.ToInt32(cookie.Value), _articleID, ArticleModuleBase.ModuleId)
+
+ If Not (objRating Is Nothing) Then
+ If Not (lstRating.Items.FindByValue(Convert.ToDouble(objRating.Rating).ToString()) Is Nothing) Then
+ lstRating.SelectedValue = Convert.ToDouble(objRating.Rating).ToString()
+ End If
+ End If
+ End If
+ End If
+
+ End If
+
+ End Sub
+
+ Protected Sub lstRating_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles lstRating.SelectedIndexChanged
+
+ If (Request.IsAuthenticated) Then
+
+ Dim objRatingController As New RatingController
+
+ Dim objRatingExists As RatingInfo = objRatingController.Get(_articleID, ArticleModuleBase.UserId, ArticleModuleBase.ModuleId)
+
+ If (objRatingExists.RatingID <> Null.NullInteger) Then
+ objRatingController.Delete(objRatingExists.RatingID, _articleID, ArticleModuleBase.ModuleId)
+ End If
+
+ Dim objRating As New RatingInfo
+
+ objRating.ArticleID = _articleID
+ objRating.CreatedDate = DateTime.Now
+ objRating.Rating = Convert.ToDouble(lstRating.SelectedValue)
+ objRating.UserID = ArticleModuleBase.UserId
+
+ objRating.RatingID = objRatingController.Add(objRating, ArticleModuleBase.ModuleId)
+
+ Dim objArticleController As New ArticleController
+ Dim objArticle As ArticleInfo = objArticleController.GetArticle(_articleID)
+
+ If (ArticleSettings.EnableActiveSocialFeed And Request.IsAuthenticated) Then
+ If (ArticleSettings.ActiveSocialRateKey <> "") Then
+ If IO.File.Exists(HttpContext.Current.Server.MapPath("~/bin/active.modules.social.dll")) Then
+ Dim ai As Object = Nothing
+ Dim asm As System.Reflection.Assembly
+ Dim ac As Object = Nothing
+ Try
+ asm = System.Reflection.Assembly.Load("Active.Modules.Social")
+ ac = asm.CreateInstance("Active.Modules.Social.API.Journal")
+ If Not ac Is Nothing Then
+ ac.AddProfileItem(New Guid(ArticleSettings.ActiveSocialRateKey), objRating.UserID, Common.GetArticleLink(objArticle, ArticleModuleBase.PortalSettings.ActiveTab, ArticleSettings, False), objArticle.Title, objRating.Rating.ToString(), objRating.Rating.ToString(), 1, "")
+ End If
+ Catch ex As Exception
+ End Try
+ End If
+ End If
+ End If
+
+ If (ArticleSettings.JournalIntegration) Then
+ Dim objJournal As New Journal
+ objJournal.AddRatingToJournal(objArticle, objRating, ArticleModuleBase.PortalId, ArticleModuleBase.TabId, ArticleModuleBase.UserId, Common.GetArticleLink(objArticle, ArticleModuleBase.PortalSettings.ActiveTab, ArticleSettings, False))
+ End If
+
+ If (ArticleSettings.EnableSmartThinkerStoryFeed) Then
+ Dim objStoryFeed As New wsStoryFeed.StoryFeedWS
+ objStoryFeed.Url = DotNetNuke.Common.Globals.AddHTTP(Request.ServerVariables("HTTP_HOST") & Me.ResolveUrl("~/DesktopModules/Smart-Thinker%20-%20UserProfile/StoryFeed.asmx"))
+
+ Dim val As String = ArticleModuleBase.GetSharedResource("StoryFeed-AddRating")
+
+ Dim delimStr As String = "[]"
+ Dim delimiter As Char() = delimStr.ToCharArray()
+ Dim layoutArray As String() = val.Split(delimiter)
+
+ Dim valResult As String = ""
+
+ For iPtr As Integer = 0 To layoutArray.Length - 1 Step 2
+
+ valResult = valResult & layoutArray(iPtr)
+
+ If iPtr < layoutArray.Length - 1 Then
+ Select Case layoutArray(iPtr + 1)
+
+ Case "ARTICLEID"
+ valResult = valResult & objRating.ArticleID.ToString()
+
+ Case "AUTHORID"
+ valResult = valResult & objRating.UserID.ToString()
+
+ Case "AUTHOR"
+ valResult = valResult & ArticleModuleBase.UserInfo.DisplayName
+
+ Case "ARTICLELINK"
+ valResult = valResult & Common.GetArticleLink(objArticle, ArticleModuleBase.PortalSettings.ActiveTab, ArticleSettings, False)
+
+ Case "ARTICLETITLE"
+ valResult = valResult & objArticle.Title
+
+ End Select
+ End If
+ Next
+
+ Try
+ objStoryFeed.AddAction(82, objRating.RatingID, valResult, objRating.UserID, "VE6457624576460436531768")
+ Catch
+ End Try
+ End If
+
+ Else
+
+ Dim objRatingController As New RatingController
+ Dim objRating As New RatingInfo
+ Dim cookie As HttpCookie = Request.Cookies("ArticleRating" & _articleID.ToString())
+ If Not (cookie Is Nothing) Then
+ objRating = objRatingController.GetByID(Convert.ToInt32(cookie.Value), _articleID, ArticleModuleBase.ModuleId)
+ If Not (objRating Is Nothing) Then
+ If (objRating.ArticleID <> Null.NullInteger) Then
+ objRatingController.Delete(objRating.RatingID, _articleID, ArticleModuleBase.ModuleId)
+ End If
+ End If
+ End If
+
+ objRating = New RatingInfo
+
+ objRating.ArticleID = _articleID
+ objRating.CreatedDate = DateTime.Now
+ objRating.Rating = Convert.ToDouble(lstRating.SelectedValue)
+ objRating.UserID = -1
+
+ Dim ratingID As Integer = objRatingController.Add(objRating, ArticleModuleBase.ModuleId)
+
+ cookie = New HttpCookie("ArticleRating" & _articleID.ToString())
+ cookie.Value = ratingID.ToString()
+ cookie.Expires = DateTime.Now.AddDays(7)
+ Context.Response.Cookies.Add(cookie)
+
+ End If
+
+ lblRatingSaved.Visible = True
+
+ HttpContext.Current.Items.Add("IgnoreCaptcha", "True")
+ Response.Redirect(Request.RawUrl, True)
+
+ End Sub
+
+#End Region
+
+ End Class
+
+End Namespace
diff --git a/Controls/SWFUploader.ashx b/Controls/SWFUploader.ashx
new file mode 100755
index 0000000..55489a2
--- /dev/null
+++ b/Controls/SWFUploader.ashx
@@ -0,0 +1 @@
+<%@ WebHandler Language="VB" CodeBehind="SWFUploader.ashx.vb" Class="Ventrian.NewsArticles.Controls.SWFUploader" %>
diff --git a/Controls/SWFUploader.ashx.vb b/Controls/SWFUploader.ashx.vb
new file mode 100755
index 0000000..30dfb36
--- /dev/null
+++ b/Controls/SWFUploader.ashx.vb
@@ -0,0 +1,415 @@
+Imports System.Web
+Imports System.Web.Services
+
+Imports DotNetNuke.Common.Utilities
+Imports DotNetNuke.Entities.Modules
+Imports DotNetNuke.Entities.Portals
+Imports DotNetNuke.Entities.Users
+Imports DotNetNuke.Security.Roles
+Imports DotNetNuke.Services.FileSystem
+Imports System.IO
+Imports System.Drawing
+Imports System.Drawing.Drawing2D
+Imports System.Drawing.Imaging
+
+Namespace Ventrian.NewsArticles.Controls
+
+ Public Class SWFUploader
+ Implements System.Web.IHttpHandler
+
+#Region " Private Members "
+
+ Private _articleID As Integer = Null.NullInteger
+ Private _moduleID As Integer = Null.NullInteger
+ Private _tabID As Integer = Null.NullInteger
+ Private _tabModuleID As Integer = Null.NullInteger
+ Private _portalID As Integer = Null.NullInteger
+ Private _ticket As String = Null.NullString
+ Private _userID As Integer = Null.NullInteger
+ Private _imageGuid As String = Null.NullString
+
+ Private _articleSettings As Ventrian.NewsArticles.ArticleSettings
+ Private _settings As Hashtable
+ Private _context As HttpContext
+
+#End Region
+
+#Region " Private Properties "
+
+ Private ReadOnly Property ArticleSettings() As Ventrian.NewsArticles.ArticleSettings
+ Get
+ If _articleSettings Is Nothing Then
+ Dim objModuleController As New ModuleController
+ Dim objModule As ModuleInfo = objModuleController.GetModule(_moduleID, _tabID)
+
+ _articleSettings = New Ventrian.NewsArticles.ArticleSettings(Settings, PortalController.GetCurrentPortalSettings(), objModule)
+ End If
+ Return _articleSettings
+ End Get
+ End Property
+
+ Private ReadOnly Property Settings() As Hashtable
+ Get
+ If _settings Is Nothing Then
+ Dim objModuleController As New ModuleController
+ _settings = objModuleController.GetModuleSettings(_moduleID)
+ _settings = GetTabModuleSettings(_tabModuleID, _settings)
+ End If
+ Return _settings
+ End Get
+ End Property
+
+#End Region
+
+#Region " Private Methods "
+
+ Private Sub AuthenticateUserFromTicket()
+
+ If (_ticket <> "") Then
+
+ Dim ticket As FormsAuthenticationTicket = FormsAuthentication.Decrypt(_ticket)
+ Dim fi As FormsIdentity = New FormsIdentity(ticket)
+
+ Dim roles As String() = Nothing
+ HttpContext.Current.User = New System.Security.Principal.GenericPrincipal(fi, roles)
+
+ Dim objUser As UserInfo = UserController.GetUserByName(_portalID, HttpContext.Current.User.Identity.Name)
+
+ If Not (objUser Is Nothing) Then
+ _userID = objUser.UserID
+ HttpContext.Current.Items("UserInfo") = objUser
+
+ Dim objRoleController As New RoleController
+ roles = objRoleController.GetRolesByUser(_userID, _portalID)
+
+ Dim strPortalRoles As String = Join(roles, New Char() {";"c})
+ _context.Items.Add("UserRoles", ";" + strPortalRoles + ";")
+ End If
+
+ End If
+
+ End Sub
+
+ Private Function GetTabModuleSettings(ByVal TabModuleId As Integer, ByVal settings As Hashtable) As Hashtable
+
+ Dim dr As IDataReader = DotNetNuke.Data.DataProvider.Instance().GetTabModuleSettings(TabModuleId)
+
+ While dr.Read()
+
+ If Not dr.IsDBNull(1) Then
+ settings(dr.GetString(0)) = dr.GetString(1)
+ Else
+ settings(dr.GetString(0)) = ""
+ End If
+
+ End While
+
+ dr.Close()
+
+ Return settings
+
+ End Function
+
+ Private Sub ReadQueryString()
+
+ If (_context.Request("ModuleID") <> "") Then
+ _moduleID = Convert.ToInt32(_context.Request("ModuleID"))
+ End If
+
+ If (_context.Request("PortalID") <> "") Then
+ _portalID = Convert.ToInt32(_context.Request("PortalID"))
+ End If
+
+ If (_context.Request("ArticleID") <> "") Then
+ _articleID = Convert.ToInt32(_context.Request("ArticleID"))
+ End If
+
+ If (_context.Request("TabModuleID") <> "") Then
+ _tabModuleID = Convert.ToInt32(_context.Request("TabModuleID"))
+ End If
+
+ If (_context.Request("TabID") <> "") Then
+ _tabID = Convert.ToInt32(_context.Request("TabID"))
+ End If
+
+ If (_context.Request("Ticket") <> "") Then
+ _ticket = _context.Request("Ticket")
+ End If
+
+ If (_articleID = Null.NullInteger) Then
+ If (_context.Request("ArticleGuid") <> "") Then
+ _imageGuid = _context.Request("ArticleGuid")
+ End If
+ End If
+
+ End Sub
+
+#End Region
+
+#Region " Interface Methods "
+
+ Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
+
+ _context = context
+ context.Response.ContentType = "text/plain"
+
+ ReadQueryString()
+ AuthenticateUserFromTicket()
+
+ If (_context.Request.IsAuthenticated = False) Then
+ _context.Response.Write("-2")
+ _context.Response.End()
+ End If
+
+ Dim objImageController As New ImageController()
+ Dim objFile As HttpPostedFile = _context.Request.Files("Filedata")
+
+ If Not (objFile Is Nothing) Then
+
+ Dim objPortalController As New PortalController()
+ If (objPortalController.HasSpaceAvailable(_portalID, objFile.ContentLength) = False) Then
+ _context.Response.Write("-1")
+ _context.Response.End()
+ End If
+
+ Dim username As String = _context.User.Identity.Name
+
+ Dim objImage As New ImageInfo
+
+ objImage.ArticleID = _articleID
+ If (_articleID = Null.NullInteger) Then
+ objImage.ImageGuid = _imageGuid
+ End If
+ objImage.FileName = objFile.FileName
+
+ If (objFile.FileName.ToLower().EndsWith(".jpg")) Then
+ objImage.ContentType = "image/jpeg"
+ End If
+
+ If (objFile.FileName.ToLower().EndsWith(".gif")) Then
+ objImage.ContentType = "image/gif"
+ End If
+
+ If (objFile.FileName.ToLower().EndsWith(".png")) Then
+ objImage.ContentType = "image/png"
+ End If
+
+ Dim maxWidth As Integer = ArticleSettings.MaxImageWidth
+ Dim maxHeight As Integer = ArticleSettings.MaxImageHeight
+
+ Dim photo As Drawing.Image = Drawing.Image.FromStream(objFile.InputStream)
+
+ objImage.Width = photo.Width
+ objImage.Height = photo.Height
+
+ If (objImage.Width > maxWidth) Then
+ objImage.Width = maxWidth
+ objImage.Height = Convert.ToInt32(objImage.Height / (photo.Width / maxWidth))
+ End If
+
+ If (objImage.Height > maxHeight) Then
+ objImage.Height = maxHeight
+ objImage.Width = Convert.ToInt32(photo.Width / (photo.Height / maxHeight))
+ End If
+
+ objImage.SortOrder = 0
+
+ Dim imagesList As List(Of ImageInfo) = objImageController.GetImageList(_articleID, _imageGuid)
+
+ If (imagesList.Count > 0) Then
+ objImage.SortOrder = CType(imagesList(imagesList.Count - 1), ImageInfo).SortOrder + 1
+ End If
+
+ Dim objPortalSettings As PortalSettings = PortalController.GetCurrentPortalSettings()
+
+ Dim folder As String = ""
+ Dim folderID As Integer = Null.NullInteger
+ If (IsNumeric(context.Request.Form("FolderID"))) Then
+ folderID = Convert.ToInt32(context.Request.Form("FolderID"))
+ End If
+
+ If (folderID <> Null.NullInteger) Then
+ Dim objFolderController As New FolderController
+ Dim objFolder As FolderInfo = objFolderController.GetFolderInfo(_portalID, folderID)
+ If (objFolder IsNot Nothing) Then
+ folder = objFolder.FolderPath
+ End If
+ End If
+
+ objImage.Folder = folder
+
+ Select Case objImage.ContentType.ToLower()
+ Case "image/jpeg"
+ objImage.Extension = "jpg"
+ Exit Select
+ Case "image/gif"
+ objImage.Extension = "gif"
+ Exit Select
+ Case "image/png"
+ objImage.Extension = "png"
+ Exit Select
+ End Select
+
+ objImage.Title = objFile.FileName.Replace("." & objImage.Extension, "")
+
+ Dim filePath As String = objPortalSettings.HomeDirectoryMapPath & folder.Replace("/", "\")
+
+ If Not (Directory.Exists(filePath)) Then
+ Directory.CreateDirectory(filePath)
+ End If
+
+ If (File.Exists(filePath & objImage.FileName)) Then
+ For i As Integer = 1 To 100
+ If (File.Exists(filePath & i.ToString() & "_" & objImage.FileName) = False) Then
+ objImage.FileName = i.ToString() & "_" & objImage.FileName
+ Exit For
+ End If
+ Next
+ End If
+
+ objImage.Size = objFile.ContentLength
+ If ((photo.Width < maxWidth And photo.Height < maxHeight) Or (ArticleSettings.ResizeImages = False)) Then
+ objFile.SaveAs(filePath & objImage.FileName)
+ Else
+ Dim bmp As New Bitmap(objImage.Width, objImage.Height)
+ Dim g As Graphics = Graphics.FromImage(DirectCast(bmp, Drawing.Image))
+
+ g.InterpolationMode = InterpolationMode.HighQualityBicubic
+ g.SmoothingMode = SmoothingMode.HighQuality
+ g.PixelOffsetMode = PixelOffsetMode.HighQuality
+ g.CompositingQuality = CompositingQuality.HighQuality
+
+ g.DrawImage(photo, 0, 0, objImage.Width, objImage.Height)
+
+ If (ArticleSettings.WatermarkEnabled And ArticleSettings.WatermarkText <> "") Then
+ Dim crSize As SizeF = New SizeF
+ Dim brushColor As Brush = Brushes.Yellow
+ Dim fnt As Font = New Font("Verdana", 11, FontStyle.Bold)
+ Dim strDirection As StringFormat = New StringFormat
+
+ strDirection.Alignment = StringAlignment.Center
+ crSize = g.MeasureString(ArticleSettings.WatermarkText, fnt)
+
+ Dim yPixelsFromBottom As Integer = Convert.ToInt32(Convert.ToDouble(objImage.Height) * 0.05)
+ Dim yPosFromBottom As Single = Convert.ToSingle((objImage.Height - yPixelsFromBottom) - (crSize.Height / 2))
+ Dim xCenterOfImage As Single = Convert.ToSingle((objImage.Width / 2))
+
+ g.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias
+
+ Dim semiTransBrush2 As SolidBrush = New SolidBrush(Color.FromArgb(153, 0, 0, 0))
+ g.DrawString(ArticleSettings.WatermarkText, fnt, semiTransBrush2, New PointF(xCenterOfImage + 1, yPosFromBottom + 1), strDirection)
+
+ Dim semiTransBrush As SolidBrush = New SolidBrush(Color.FromArgb(153, 255, 255, 255))
+ g.DrawString(ArticleSettings.WatermarkText, fnt, semiTransBrush, New PointF(xCenterOfImage, yPosFromBottom), strDirection)
+ End If
+
+ If (ArticleSettings.WatermarkEnabled And ArticleSettings.WatermarkImage <> "") Then
+ Dim watermark As String = objPortalSettings.HomeDirectoryMapPath & ArticleSettings.WatermarkImage
+ If (File.Exists(watermark)) Then
+ Dim imgWatermark As Image = New Bitmap(watermark)
+ Dim wmWidth As Integer = imgWatermark.Width
+ Dim wmHeight As Integer = imgWatermark.Height
+
+ Dim objImageAttributes As New ImageAttributes()
+ Dim objColorMap As New ColorMap()
+ objColorMap.OldColor = Color.FromArgb(255, 0, 255, 0)
+ objColorMap.NewColor = Color.FromArgb(0, 0, 0, 0)
+ Dim remapTable As ColorMap() = {objColorMap}
+ objImageAttributes.SetRemapTable(remapTable, ColorAdjustType.Bitmap)
+
+ Dim colorMatrixElements As Single()() = {New Single() {1.0F, 0.0F, 0.0F, 0.0F, 0.0F}, New Single() {0.0F, 1.0F, 0.0F, 0.0F, 0.0F}, New Single() {0.0F, 0.0F, 1.0F, 0.0F, 0.0F}, New Single() {0.0F, 0.0F, 0.0F, 0.3F, 0.0F}, New Single() {0.0F, 0.0F, 0.0F, 0.0F, 1.0F}}
+ Dim wmColorMatrix As New ColorMatrix(colorMatrixElements)
+ objImageAttributes.SetColorMatrix(wmColorMatrix, ColorMatrixFlag.[Default], ColorAdjustType.Bitmap)
+
+ Dim xPosOfWm As Integer = ((objImage.Width - wmWidth) - 10)
+ Dim yPosOfWm As Integer = 10
+
+ Select Case ArticleSettings.WatermarkPosition
+ Case WatermarkPosition.TopLeft
+ xPosOfWm = 10
+ yPosOfWm = 10
+ Exit Select
+
+ Case WatermarkPosition.TopRight
+ xPosOfWm = ((objImage.Width - wmWidth) - 10)
+ yPosOfWm = 10
+ Exit Select
+
+ Case WatermarkPosition.BottomLeft
+ xPosOfWm = 10
+ yPosOfWm = ((objImage.Height - wmHeight) - 10)
+
+ Case WatermarkPosition.BottomRight
+ xPosOfWm = ((objImage.Width - wmWidth) - 10)
+ yPosOfWm = ((objImage.Height - wmHeight) - 10)
+ End Select
+
+ g.DrawImage(imgWatermark, New Rectangle(xPosOfWm, yPosOfWm, wmWidth, wmHeight), 0, 0, wmWidth, wmHeight, _
+ GraphicsUnit.Pixel, objImageAttributes)
+ imgWatermark.Dispose()
+ End If
+ End If
+
+ photo.Dispose()
+
+ Select Case objFile.ContentType.ToLower()
+ Case "image/jpeg"
+ Dim info As ImageCodecInfo() = ImageCodecInfo.GetImageEncoders()
+ Dim encoderParameters As New EncoderParameters(1)
+ encoderParameters.Param(0) = New EncoderParameter(Encoder.Quality, 100L)
+ bmp.Save(filePath & objImage.FileName, info(1), encoderParameters)
+
+ Case "image/gif"
+ 'Dim quantizer As New ImageQuantization.OctreeQuantizer(255, 8)
+ 'Dim bmpQuantized As Bitmap = quantizer.Quantize(bmp)
+ 'bmpQuantized.Save(filePath & objPhoto.Filename, ImageFormat.Gif)
+ ' Not working in medium trust.
+ bmp.Save(filePath & objImage.FileName, ImageFormat.Gif)
+
+ Case Else
+ 'Shouldn't get to here because of validators.
+ Dim info As ImageCodecInfo() = ImageCodecInfo.GetImageEncoders()
+ Dim encoderParameters As New EncoderParameters(1)
+ encoderParameters.Param(0) = New EncoderParameter(Encoder.Quality, 100L)
+ bmp.Save(filePath & objImage.FileName, info(1), encoderParameters)
+ End Select
+
+ bmp.Dispose()
+
+ If (File.Exists(filePath & objImage.FileName)) Then
+ Dim fi As New IO.FileInfo(filePath & objImage.FileName)
+ If (fi IsNot Nothing) Then
+ objImage.Size = Convert.ToInt32(fi.Length)
+ End If
+ End If
+ End If
+
+ objImage.ImageID = objImageController.Add(objImage)
+
+ If (_articleID <> Null.NullInteger) Then
+ Dim objArticleController As New ArticleController
+ Dim objArticle As ArticleInfo = objArticleController.GetArticle(_articleID)
+ If (objArticle IsNot Nothing) Then
+ objArticle.ImageCount = objArticle.ImageCount + 1
+ objArticleController.UpdateArticle(objArticle)
+ End If
+ End If
+
+ End If
+
+ _context.Response.Write("0")
+ _context.Response.End()
+
+ End Sub
+
+ ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
+ Get
+ Return False
+ End Get
+ End Property
+
+#End Region
+
+ End Class
+
+End Namespace
\ No newline at end of file
diff --git a/Controls/SWFUploaderFiles.ashx b/Controls/SWFUploaderFiles.ashx
new file mode 100755
index 0000000..962213f
--- /dev/null
+++ b/Controls/SWFUploaderFiles.ashx
@@ -0,0 +1 @@
+<%@ WebHandler Language="VB" CodeBehind="SWFUploaderFiles.ashx.vb" Class="Ventrian.NewsArticles.Controls.SWFUploaderFiles" %>
diff --git a/Controls/SWFUploaderFiles.ashx.vb b/Controls/SWFUploaderFiles.ashx.vb
new file mode 100755
index 0000000..0443e62
--- /dev/null
+++ b/Controls/SWFUploaderFiles.ashx.vb
@@ -0,0 +1,281 @@
+Imports System.Web
+Imports System.Web.Services
+
+Imports DotNetNuke.Common.Utilities
+Imports DotNetNuke.Entities.Modules
+Imports DotNetNuke.Entities.Portals
+Imports DotNetNuke.Entities.Users
+Imports DotNetNuke.Security.Roles
+Imports DotNetNuke.Services.FileSystem
+Imports System.IO
+Imports System.Drawing
+Imports System.Drawing.Drawing2D
+Imports System.Drawing.Imaging
+
+Namespace Ventrian.NewsArticles.Controls
+
+ Public Class SWFUploaderFiles
+ Implements System.Web.IHttpHandler
+
+#Region " Private Members "
+
+ Private _articleID As Integer = Null.NullInteger
+ Private _moduleID As Integer = Null.NullInteger
+ Private _tabID As Integer = Null.NullInteger
+ Private _tabModuleID As Integer = Null.NullInteger
+ Private _portalID As Integer = Null.NullInteger
+ Private _ticket As String = Null.NullString
+ Private _userID As Integer = Null.NullInteger
+ Private _fileGuid As String = Null.NullString
+
+ Private _articleSettings As Ventrian.NewsArticles.ArticleSettings
+ Private _settings As Hashtable
+ Private _context As HttpContext
+
+#End Region
+
+#Region " Private Properties "
+
+ Private ReadOnly Property ArticleSettings() As Ventrian.NewsArticles.ArticleSettings
+ Get
+ If _articleSettings Is Nothing Then
+ Dim objModuleController As New ModuleController
+ Dim objModule As ModuleInfo = objModuleController.GetModule(_moduleID, _tabID)
+
+ _articleSettings = New Ventrian.NewsArticles.ArticleSettings(Settings, PortalController.GetCurrentPortalSettings(), objModule)
+ End If
+ Return _articleSettings
+ End Get
+ End Property
+
+ Private ReadOnly Property Settings() As Hashtable
+ Get
+ If _settings Is Nothing Then
+ Dim objModuleController As New ModuleController
+ _settings = objModuleController.GetModuleSettings(_moduleID)
+ _settings = GetTabModuleSettings(_tabModuleID, _settings)
+ End If
+ Return _settings
+ End Get
+ End Property
+
+#End Region
+
+#Region " Private Methods "
+
+ Private Sub AuthenticateUserFromTicket()
+
+ If (_ticket <> "") Then
+
+ Dim ticket As FormsAuthenticationTicket = FormsAuthentication.Decrypt(_ticket)
+ Dim fi As FormsIdentity = New FormsIdentity(ticket)
+
+ Dim roles As String() = Nothing
+ HttpContext.Current.User = New System.Security.Principal.GenericPrincipal(fi, roles)
+
+ Dim objUser As UserInfo = UserController.GetUserByName(_portalID, HttpContext.Current.User.Identity.Name)
+
+ If Not (objUser Is Nothing) Then
+ _userID = objUser.UserID
+ HttpContext.Current.Items("UserInfo") = objUser
+
+ Dim objRoleController As New RoleController
+ roles = objRoleController.GetRolesByUser(_userID, _portalID)
+
+ Dim strPortalRoles As String = Join(roles, New Char() {";"c})
+ _context.Items.Add("UserRoles", ";" + strPortalRoles + ";")
+ End If
+
+ End If
+
+ End Sub
+
+ Private Function GetTabModuleSettings(ByVal TabModuleId As Integer, ByVal settings As Hashtable) As Hashtable
+
+ Dim dr As IDataReader = DotNetNuke.Data.DataProvider.Instance().GetTabModuleSettings(TabModuleId)
+
+ While dr.Read()
+
+ If Not dr.IsDBNull(1) Then
+ settings(dr.GetString(0)) = dr.GetString(1)
+ Else
+ settings(dr.GetString(0)) = ""
+ End If
+
+ End While
+
+ dr.Close()
+
+ Return settings
+
+ End Function
+
+ Private Sub ReadQueryString()
+
+ If (_context.Request("ModuleID") <> "") Then
+ _moduleID = Convert.ToInt32(_context.Request("ModuleID"))
+ End If
+
+ If (_context.Request("PortalID") <> "") Then
+ _portalID = Convert.ToInt32(_context.Request("PortalID"))
+ End If
+
+ If (_context.Request("ArticleID") <> "") Then
+ _articleID = Convert.ToInt32(_context.Request("ArticleID"))
+ End If
+
+ If (_context.Request("TabModuleID") <> "") Then
+ _tabModuleID = Convert.ToInt32(_context.Request("TabModuleID"))
+ End If
+
+ If (_context.Request("TabID") <> "") Then
+ _tabID = Convert.ToInt32(_context.Request("TabID"))
+ End If
+
+ If (_context.Request("Ticket") <> "") Then
+ _ticket = _context.Request("Ticket")
+ End If
+
+ If (_articleID = Null.NullInteger) Then
+ If (_context.Request("ArticleGuid") <> "") Then
+ _fileGuid = _context.Request("ArticleGuid")
+ End If
+ End If
+
+ End Sub
+
+#End Region
+
+#Region " Interface Methods "
+
+ Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
+
+ _context = context
+ context.Response.ContentType = "text/plain"
+
+ ReadQueryString()
+ AuthenticateUserFromTicket()
+
+ If (_context.Request.IsAuthenticated = False) Then
+ _context.Response.Write("-2")
+ _context.Response.End()
+ End If
+
+ Dim objFileController As New FileController
+
+ Dim objFilePosted As HttpPostedFile = _context.Request.Files("Filedata")
+
+ If Not (objFilePosted Is Nothing) Then
+
+ Dim objPortalController As New PortalController()
+ If (objPortalController.HasSpaceAvailable(_portalID, objFilePosted.ContentLength) = False) Then
+ _context.Response.Write("-1")
+ _context.Response.End()
+ End If
+
+ Dim username As String = _context.User.Identity.Name
+
+ If (_articleID <> Null.NullInteger) Then
+ FileProvider.Instance().AddFile(_articleID, _moduleID, objFilePosted)
+ Else
+ FileProvider.Instance().AddFile(_fileGuid, _moduleID, objFilePosted)
+ End If
+
+ 'Dim objFile As New FileInfo
+
+ 'objFile.ArticleID = _articleID
+ 'If (_articleID = Null.NullInteger) Then
+ ' objFile.FileGuid = _fileGuid
+ 'End If
+ 'objFile.FileName = objFilePosted.FileName
+ 'objFile.SortOrder = 0
+
+ 'Dim filesList As List(Of FileInfo) = objFileController.GetFileList(_articleID, _fileGuid)
+
+ 'If (filesList.Count > 0) Then
+ ' objFile.SortOrder = CType(filesList(filesList.Count - 1), FileInfo).SortOrder + 1
+ 'End If
+
+ 'Dim objPortalSettings As PortalSettings = PortalController.GetCurrentPortalSettings()
+
+ 'Dim folder As String = ""
+ 'If (ArticleSettings.DefaultFilesFolder <> Null.NullInteger) Then
+ ' Dim objFolderController As New FolderController
+ ' Dim objFolder As FolderInfo = objFolderController.GetFolderInfo(_portalID, ArticleSettings.DefaultFilesFolder)
+ ' If (objFolder IsNot Nothing) Then
+ ' folder = objFolder.FolderPath
+ ' End If
+ 'End If
+
+ 'objFile.Folder = folder
+ 'objFile.ContentType = objFilePosted.ContentType
+
+ 'If (objFile.FileName.Split("."c).Length > 0) Then
+ ' objFile.Extension = objFile.FileName.Split("."c)(objFile.FileName.Split("."c).Length - 1)
+
+ ' If (objFile.Extension.ToLower() = "jpg") Then
+ ' objFile.ContentType = "image/jpeg"
+ ' End If
+ ' If (objFile.Extension.ToLower() = "gif") Then
+ ' objFile.ContentType = "image/gif"
+ ' End If
+ ' If (objFile.Extension.ToLower() = "txt") Then
+ ' objFile.ContentType = "text/plain"
+ ' End If
+ ' If (objFile.Extension.ToLower() = "html") Then
+ ' objFile.ContentType = "text/html"
+ ' End If
+ ' If (objFile.Extension.ToLower() = "mp3") Then
+ ' objFile.ContentType = "audio/mpeg"
+ ' End If
+
+ 'End If
+ 'objFile.Title = objFile.FileName.Replace("." & objFile.Extension, "")
+
+ 'Dim filePath As String = objPortalSettings.HomeDirectoryMapPath & folder.Replace("/", "\")
+
+ 'If Not (Directory.Exists(filePath)) Then
+ ' Directory.CreateDirectory(filePath)
+ 'End If
+
+ 'If (File.Exists(filePath & objFile.FileName)) Then
+ ' For i As Integer = 1 To 100
+ ' If (File.Exists(filePath & i.ToString() & "_" & objFile.FileName) = False) Then
+ ' objFile.FileName = i.ToString() & "_" & objFile.FileName
+ ' Exit For
+ ' End If
+ ' Next
+ 'End If
+
+ 'objFile.Size = objFilePosted.ContentLength
+ 'objFilePosted.SaveAs(filePath & objFile.FileName)
+
+ 'objFile.FileID = objFileController.Add(objFile)
+
+ 'If (_articleID <> Null.NullInteger) Then
+ ' Dim objArticleController As New ArticleController
+ ' Dim objArticle As ArticleInfo = objArticleController.GetArticle(_articleID)
+ ' If (objArticle IsNot Nothing) Then
+ ' objArticle.FileCount = objArticle.FileCount + 1
+ ' objArticleController.UpdateArticle(objArticle)
+ ' End If
+ 'End If
+
+ End If
+
+ _context.Response.Write("0")
+ _context.Response.End()
+
+ End Sub
+
+ ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
+ Get
+ Return False
+ End Get
+ End Property
+
+#End Region
+
+ End Class
+
+End Namespace
\ No newline at end of file
diff --git a/Controls/UploadFiles.ascx b/Controls/UploadFiles.ascx
new file mode 100755
index 0000000..1a36b8f
--- /dev/null
+++ b/Controls/UploadFiles.ascx
@@ -0,0 +1,183 @@
+<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="UploadFiles.ascx.vb" Inherits="Ventrian.NewsArticles.Controls.UploadFiles" %>
+<%@ Register TagPrefix="Ventrian" Assembly="Ventrian.NewsArticles" Namespace="Ventrian.NewsArticles.Components.WebControls" %>
+
+<%@ Register TagPrefix="dnn" TagName="SectionHead" Src="~/controls/SectionHeadControl.ascx" %>
+<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %>
+<%@ Register TagPrefix="dnn" TagName="URL" Src="~/controls/URLControl.ascx" %>
+
+
+
+
+
+
+
+
diff --git a/Controls/UploadFiles.ascx.designer.vb b/Controls/UploadFiles.ascx.designer.vb
new file mode 100755
index 0000000..57b9571
--- /dev/null
+++ b/Controls/UploadFiles.ascx.designer.vb
@@ -0,0 +1,233 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+Namespace Ventrian.NewsArticles.Controls
+
+ Partial Public Class UploadFiles
+
+ '''
+ '''litModuleID control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents litModuleID As Global.System.Web.UI.WebControls.Literal
+
+ '''
+ '''litTabModuleID control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents litTabModuleID As Global.System.Web.UI.WebControls.Literal
+
+ '''
+ '''litTicketID control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents litTicketID As Global.System.Web.UI.WebControls.Literal
+
+ '''
+ '''litArticleGuid control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents litArticleGuid As Global.System.Web.UI.WebControls.Literal
+
+ '''
+ '''lblSelectFiles control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents lblSelectFiles As Global.System.Web.UI.WebControls.Label
+
+ '''
+ '''dshFiles control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents dshFiles As DotNetNuke.UI.UserControls.SectionHeadControl
+
+ '''
+ '''tblFiles control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents tblFiles As Global.System.Web.UI.HtmlControls.HtmlTable
+
+ '''
+ '''lblFilesHelp control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents lblFilesHelp As Global.System.Web.UI.WebControls.Label
+
+ '''
+ '''phFiles control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents phFiles As Global.System.Web.UI.WebControls.PlaceHolder
+
+ '''
+ '''trUpload control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents trUpload As Global.System.Web.UI.HtmlControls.HtmlTableCell
+
+ '''
+ '''dshUploadFiles control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents dshUploadFiles As DotNetNuke.UI.UserControls.SectionHeadControl
+
+ '''
+ '''tblUploadFiles control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents tblUploadFiles As Global.System.Web.UI.HtmlControls.HtmlTable
+
+ '''
+ '''plFolder control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents plFolder As Global.System.Web.UI.UserControl
+
+ '''
+ '''drpUploadFilesFolder control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents drpUploadFilesFolder As Global.System.Web.UI.WebControls.DropDownList
+
+ '''
+ '''trExisting control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents trExisting As Global.System.Web.UI.HtmlControls.HtmlTableCell
+
+ '''
+ '''dshExistingFiles control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents dshExistingFiles As DotNetNuke.UI.UserControls.SectionHeadControl
+
+ '''
+ '''tblExistingFiles control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents tblExistingFiles As Global.System.Web.UI.HtmlControls.HtmlTable
+
+ '''
+ '''ctlFile control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents ctlFile As DotNetNuke.UI.UserControls.UrlControl
+
+ '''
+ '''cmdAddExistingFile control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents cmdAddExistingFile As Global.System.Web.UI.WebControls.LinkButton
+
+ '''
+ '''dshSelectedFiles control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents dshSelectedFiles As DotNetNuke.UI.UserControls.SectionHeadControl
+
+ '''
+ '''tblSelectedFiles control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents tblSelectedFiles As Global.System.Web.UI.HtmlControls.HtmlTable
+
+ '''
+ '''dlFiles control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents dlFiles As Global.System.Web.UI.WebControls.DataList
+
+ '''
+ '''lblNoFiles control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents lblNoFiles As Global.System.Web.UI.WebControls.Label
+
+ '''
+ '''cmdRefreshFiles control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents cmdRefreshFiles As Global.Ventrian.NewsArticles.Components.WebControls.RefreshControl
+ End Class
+End Namespace
diff --git a/Controls/UploadFiles.ascx.vb b/Controls/UploadFiles.ascx.vb
new file mode 100755
index 0000000..515c067
--- /dev/null
+++ b/Controls/UploadFiles.ascx.vb
@@ -0,0 +1,508 @@
+Imports DotNetNuke.Common.Utilities
+Imports DotNetNuke.Services.Exceptions
+Imports DotNetNuke.Services.FileSystem
+Imports DotNetNuke.Security
+
+Imports Ventrian.NewsArticles.Base
+
+Namespace Ventrian.NewsArticles.Controls
+
+ Partial Public Class UploadFiles
+ Inherits NewsArticleControlBase
+
+#Region " Private Members "
+
+ Private _articleID As Integer = Null.NullInteger
+
+ Private _filesInit As Boolean = False
+ Private _objFiles As List(Of FileInfo)
+
+#End Region
+
+#Region " Private Properties "
+
+ Private ReadOnly Property ArticleModuleBase() As NewsArticleModuleBase
+ Get
+ Return CType(Parent.Parent.Parent.Parent.Parent, NewsArticleModuleBase)
+ End Get
+ End Property
+
+ Private ReadOnly Property ArticleSettings() As ArticleSettings
+ Get
+ Return ArticleModuleBase.ArticleSettings
+ End Get
+ End Property
+
+#End Region
+
+#Region " Public Properties "
+
+ Public Property ArticleGuid() As Integer
+ Get
+ If (_articleID = Null.NullInteger) Then
+ If (litArticleGuid.Text = Null.NullString) Then
+ litArticleGuid.Text = (GetRandom(1, 100000) * -1).ToString()
+ End If
+ Return Convert.ToInt32(litArticleGuid.Text)
+ End If
+ Return _articleID
+ End Get
+ Set(ByVal value As Integer)
+ litArticleGuid.Text = value
+ End Set
+ End Property
+
+ Public ReadOnly Property AttachedFiles() As List(Of FileInfo)
+ Get
+
+ If (_filesInit = False) Then
+ '_objFiles = objFileController.GetFileList(_articleID, ArticleGuid)
+ If (_articleID = Null.NullInteger) Then
+ _objFiles = FileProvider.Instance().GetFiles(ArticleGuid)
+ Else
+ _objFiles = FileProvider.Instance().GetFiles(_articleID)
+ End If
+ _filesInit = True
+ End If
+
+ Return _objFiles
+
+ End Get
+ End Property
+
+#End Region
+
+#Region " Private Methods "
+
+ Private Sub BindFiles()
+
+ dlFiles.DataSource = AttachedFiles
+ dlFiles.DataBind()
+
+ dlFiles.Visible = (dlFiles.Items.Count > 0)
+ lblNoFiles.Visible = (dlFiles.Items.Count = 0)
+
+ End Sub
+
+ Private Sub BindFolders()
+
+ Dim ReadRoles As String = Null.NullString
+ Dim WriteRoles As String = Null.NullString
+
+ drpUploadFilesFolder.Items.Clear()
+
+ Dim folders As ArrayList = FileSystemUtils.GetFolders(ArticleModuleBase.PortalId)
+ For Each folder As FolderInfo In folders
+ Dim FolderItem As New ListItem()
+ If folder.FolderPath = Null.NullString Then
+ FolderItem.Text = ArticleModuleBase.GetSharedResource("Root")
+ ReadRoles = FileSystemUtils.GetRoles("", ArticleModuleBase.PortalId, "READ")
+ WriteRoles = FileSystemUtils.GetRoles("", ArticleModuleBase.PortalId, "WRITE")
+ Else
+ FolderItem.Text = folder.FolderPath
+ ReadRoles = FileSystemUtils.GetRoles(FolderItem.Text, ArticleModuleBase.PortalId, "READ")
+ WriteRoles = FileSystemUtils.GetRoles(FolderItem.Text, ArticleModuleBase.PortalId, "WRITE")
+ End If
+ FolderItem.Value = folder.FolderID
+
+ If PortalSecurity.IsInRoles(ReadRoles) OrElse PortalSecurity.IsInRoles(WriteRoles) Then
+ drpUploadFilesFolder.Items.Add(FolderItem)
+ End If
+ Next
+
+ If (drpUploadFilesFolder.Items.FindByValue(ArticleSettings.DefaultFilesFolder.ToString()) IsNot Nothing) Then
+ drpUploadFilesFolder.SelectedValue = ArticleSettings.DefaultFilesFolder.ToString()
+ End If
+
+ End Sub
+
+ Protected Function GetArticleID() As String
+
+ Return _articleID.ToString()
+
+ End Function
+
+ Protected Function GetMaximumFileSize() As String
+
+ Return "20480"
+
+ End Function
+
+ Protected Function GetPostBackReference() As String
+
+ Return Page.ClientScript.GetPostBackEventReference(cmdRefreshFiles, "Refresh")
+
+ End Function
+
+ Private Function GetRandom(ByVal Min As Integer, ByVal Max As Integer) As Integer
+ Dim Generator As System.Random = New System.Random()
+ Return Generator.Next(Min, Max)
+ End Function
+
+ Public Function GetResourceKey(ByVal key As String) As String
+
+ Dim path As String = "~/DesktopModules/DnnForge - NewsArticles/App_LocalResources/UploadFiles.ascx.resx"
+ Return DotNetNuke.Services.Localization.Localization.GetString(key, path)
+
+ End Function
+
+ Protected Function GetUploadUrl() As String
+
+ Dim link As String = Page.ResolveUrl("~/DesktopModules/DnnForge%20-%20NewsArticles/Controls/SWFUploaderFiles.ashx?PortalID=" & ArticleModuleBase.PortalId.ToString())
+
+ If (link.ToLower().StartsWith("http")) Then
+ Return link
+ Else
+ If (Request.Url.Port = 80) Then
+ Return DotNetNuke.Common.AddHTTP(Request.Url.Host & link)
+ Else
+ Return DotNetNuke.Common.AddHTTP(Request.Url.Host & ":" & Request.Url.Port.ToString() & link)
+ End If
+ End If
+
+ End Function
+
+ Private Sub ReadQueryString()
+
+ If (ArticleSettings.UrlModeType = Components.Types.UrlModeType.Shorterned) Then
+ Try
+ If (IsNumeric(Request(ArticleSettings.ShortenedID))) Then
+ _articleID = Convert.ToInt32(Request(ArticleSettings.ShortenedID))
+ End If
+ Catch
+ End Try
+ End If
+
+ If (IsNumeric(Request("ArticleID"))) Then
+ _articleID = Convert.ToInt32(Request("ArticleID"))
+ End If
+
+ End Sub
+
+ Private Sub RegisterScripts()
+
+ DotNetNuke.Framework.jQuery.RequestRegistration()
+
+ 'If (HttpContext.Current.Items("jquery_registered") Is Nothing And HttpContext.Current.Items("jQueryRequested") Is Nothing) Then
+ ' If (HttpContext.Current.Items("PropertyAgent-jQuery-ScriptsRegistered") Is Nothing And HttpContext.Current.Items("SimpleGallery-ScriptsRegistered") Is Nothing And HttpContext.Current.Items("NewsArticles-ScriptsRegistered") Is Nothing) Then
+ ' Dim objCSS As System.Web.UI.Control = Page.FindControl("CSS")
+
+ ' If Not (objCSS Is Nothing) Then
+ ' Dim litLink As New Literal
+ ' litLink.Text = "" & vbCrLf _
+ ' & "" & vbCrLf
+ ' objCSS.Controls.Add(litLink)
+ ' End If
+ ' HttpContext.Current.Items.Add("NewsArticles-ScriptsRegistered", "true")
+ ' End If
+ 'End If
+
+ End Sub
+
+ Private Sub SetLocalization()
+
+ dshFiles.Text = GetResourceKey("Files")
+ lblFilesHelp.Text = GetResourceKey("FilesHelp")
+
+ dshExistingFiles.Text = GetResourceKey("SelectExisting")
+ dshUploadFiles.Text = GetResourceKey("UploadFiles")
+ dshSelectedFiles.Text = GetResourceKey("SelectedFiles")
+
+ lblNoFiles.Text = GetResourceKey("NoFiles")
+
+ cmdAddExistingFile.Text = GetResourceKey("cmdAddExistingFile")
+
+ End Sub
+
+#End Region
+
+#Region " Public Methods "
+
+ Public Sub UpdateFiles(ByVal articleID As Integer)
+
+ For Each objFile As FileInfo In AttachedFiles
+ objFile.ArticleID = articleID
+ FileProvider.Instance().UpdateFile(objFile)
+ ' objFileController.Update(objFile)
+ Next
+
+ End Sub
+
+#End Region
+
+#Region " Event Handlers "
+
+ Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
+
+ Try
+
+ ReadQueryString()
+ SetLocalization()
+
+ 'trUpload.Visible = ArticleSettings.EnableImagesUpload
+ 'trExisting.Visible = ArticleSettings.EnablePortalImages
+
+ 'phFiles.Visible = (trUpload.Visible Or trExisting.Visible)
+
+ If (ArticleSettings.IsFilesEnabled = False) Then
+ Me.Visible = False
+ Return
+ End If
+
+ If (IsPostBack = False) Then
+
+ lblSelectFiles.Text = GetResourceKey("SelectFiles")
+ litModuleID.Text = Me.ArticleModuleBase.ModuleId.ToString()
+ litTabModuleID.Text = Me.ArticleModuleBase.TabModuleId.ToString()
+
+ If (Request.IsAuthenticated) Then
+ litTicketID.Text = Request.Cookies(System.Web.Security.FormsAuthentication.FormsCookieName()).Value
+ End If
+ litArticleGuid.Text = ArticleGuid.ToString()
+
+ BindFolders()
+ BindFiles()
+ End If
+
+ Catch exc As Exception 'Module failed to load
+ ProcessModuleLoadException(Me, exc)
+ End Try
+
+ End Sub
+
+ Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
+
+ Try
+
+ RegisterScripts()
+
+ Catch exc As Exception 'Module failed to load
+ ProcessModuleLoadException(Me, exc)
+ End Try
+
+ End Sub
+
+ Protected Sub cmdRefreshPhotos_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdRefreshFiles.Click
+
+ Try
+
+ BindFiles()
+
+ Catch exc As Exception 'Module failed to load
+ ProcessModuleLoadException(Me, exc)
+ End Try
+
+ End Sub
+
+
+ Private Sub dlFiles_OnItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles dlFiles.ItemDataBound
+
+ Try
+
+ If (e.Item.ItemType = Web.UI.WebControls.ListItemType.Item Or e.Item.ItemType = Web.UI.WebControls.ListItemType.AlternatingItem) Then
+
+ Dim objFile As FileInfo = CType(e.Item.DataItem, FileInfo)
+
+ Dim btnEdit As System.Web.UI.WebControls.ImageButton = CType(e.Item.FindControl("btnEdit"), System.Web.UI.WebControls.ImageButton)
+ Dim btnDelete As System.Web.UI.WebControls.ImageButton = CType(e.Item.FindControl("btnDelete"), System.Web.UI.WebControls.ImageButton)
+ Dim btnUp As System.Web.UI.WebControls.ImageButton = CType(e.Item.FindControl("btnUp"), System.Web.UI.WebControls.ImageButton)
+ Dim btnDown As System.Web.UI.WebControls.ImageButton = CType(e.Item.FindControl("btnDown"), System.Web.UI.WebControls.ImageButton)
+
+ If Not (btnDelete Is Nothing) Then
+ btnDelete.Attributes.Add("onClick", "javascript:return confirm('" & GetResourceKey("DeleteFile") & "');")
+
+ If Not (objFile Is Nothing) Then
+ btnDelete.CommandArgument = objFile.FileID.ToString()
+ End If
+
+ End If
+
+ If Not (btnEdit Is Nothing) Then
+
+ If Not (objFile Is Nothing) Then
+ btnEdit.CommandArgument = objFile.FileID.ToString()
+ End If
+
+ End If
+
+ If Not (btnUp Is Nothing And btnDown Is Nothing) Then
+
+ If (objFile.FileID = CType(AttachedFiles(0), FileInfo).FileID) Then
+ btnUp.Visible = False
+ End If
+
+ If (objFile.FileID = CType(AttachedFiles(AttachedFiles.Count - 1), FileInfo).FileID) Then
+ btnDown.Visible = False
+ End If
+
+ btnUp.CommandArgument = objFile.FileID.ToString()
+ btnUp.CommandName = "Up"
+ btnUp.CausesValidation = False
+
+ btnDown.CommandArgument = objFile.FileID.ToString()
+ btnDown.CommandName = "Down"
+ btnDown.CausesValidation = False
+
+ End If
+
+ End If
+
+ Catch exc As Exception 'Module failed to load
+ ProcessModuleLoadException(Me, exc)
+ End Try
+
+ End Sub
+
+ Private Sub dlFiles_OnItemCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) Handles dlFiles.ItemCommand
+
+ Try
+
+ If (e.CommandName = "Delete") Then
+
+ Dim objFile As FileInfo = FileProvider.Instance().GetFile(Convert.ToInt32(e.CommandArgument))
+
+ If Not (objFile Is Nothing) Then
+ 'Dim objPortalSettings As PortalSettings = PortalController.GetCurrentPortalSettings()
+ 'Dim filePath As String = objPortalSettings.HomeDirectoryMapPath & objFile.Folder & objFile.FileName
+ 'If (File.Exists(filePath)) Then
+ ' File.Delete(filePath)
+ 'End If
+ FileProvider.Instance().DeleteFile(_articleID, Convert.ToInt32(e.CommandArgument))
+ ' objFileController.Delete(Convert.ToInt32(e.CommandArgument))
+ End If
+
+ End If
+
+ If (e.CommandName = "Edit") Then
+
+ dlFiles.EditItemIndex = e.Item.ItemIndex
+
+ End If
+
+ If (e.CommandName = "Up") Then
+
+ Dim fileID As Integer = Convert.ToInt32(e.CommandArgument)
+
+ For i As Integer = 0 To AttachedFiles.Count - 1
+ Dim objFile As FileInfo = CType(AttachedFiles(i), FileInfo)
+ If (fileID = objFile.FileID) Then
+
+ Dim objFileToSwap As FileInfo = CType(AttachedFiles(i - 1), FileInfo)
+
+ Dim sortOrder As Integer = objFile.SortOrder
+ Dim sortOrderPrevious As Integer = objFileToSwap.SortOrder
+
+ objFile.SortOrder = sortOrderPrevious
+ objFileToSwap.SortOrder = sortOrder
+
+ FileProvider.Instance().UpdateFile(objFile)
+ FileProvider.Instance().UpdateFile(objFileToSwap)
+
+ End If
+ Next
+
+ End If
+
+ If (e.CommandName = "Down") Then
+
+ Dim fileID As Integer = Convert.ToInt32(e.CommandArgument)
+
+ For i As Integer = 0 To AttachedFiles.Count - 1
+ Dim objFile As FileInfo = CType(AttachedFiles(i), FileInfo)
+ If (fileID = objFile.FileID) Then
+ Dim objFileToSwap As FileInfo = CType(AttachedFiles(i + 1), FileInfo)
+
+ Dim sortOrder As Integer = objFile.SortOrder
+ Dim sortOrderNext As Integer = objFileToSwap.SortOrder
+
+ objFile.SortOrder = sortOrderNext
+ objFileToSwap.SortOrder = sortOrder
+
+ FileProvider.Instance().UpdateFile(objFile)
+ FileProvider.Instance().UpdateFile(objFileToSwap)
+ End If
+ Next
+
+ End If
+
+ If (e.CommandName = "Cancel") Then
+
+ dlFiles.EditItemIndex = -1
+
+ End If
+
+ If (e.CommandName = "Update") Then
+
+ Dim txtTitle As TextBox = CType(e.Item.FindControl("txtTitle"), TextBox)
+
+ Dim objFile As FileInfo = FileProvider.Instance().GetFile(Convert.ToInt32(dlFiles.DataKeys(e.Item.ItemIndex)))
+
+ If Not (objFile Is Nothing) Then
+ objFile.Title = txtTitle.Text
+ FileProvider.Instance().UpdateFile(objFile)
+ End If
+
+ dlFiles.EditItemIndex = -1
+
+ End If
+
+ _filesInit = False
+ BindFiles()
+
+ Catch exc As Exception 'Module failed to load
+ ProcessModuleLoadException(Me, exc)
+ End Try
+
+ End Sub
+
+ Protected Sub cmdAddExistingFile_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdAddExistingFile.Click
+
+ Try
+
+ If (ctlFile.Url <> "") Then
+ If (ctlFile.Url.ToLower().StartsWith("fileid=")) Then
+ If (IsNumeric(ctlFile.Url.ToLower().Replace("fileid=", ""))) Then
+ Dim fileID As Integer = Convert.ToInt32(ctlFile.Url.ToLower().Replace("fileid=", ""))
+ Dim objDnnFileController As New DotNetNuke.Services.FileSystem.FileController
+ Dim objDnnFile As DotNetNuke.Services.FileSystem.FileInfo = objDnnFileController.GetFileById(fileID, ArticleModuleBase.PortalId)
+ If (objDnnFile IsNot Nothing) Then
+
+ Dim objFileController As New FileController
+
+ Dim objFile As New FileInfo
+
+ objFile.ArticleID = _articleID
+ If (_articleID = Null.NullInteger) Then
+ objFile.ArticleID = ArticleGuid
+ End If
+ objFile.FileName = objDnnFile.FileName
+ objFile.ContentType = objDnnFile.ContentType
+ objFile.SortOrder = 0
+ Dim filesList As List(Of FileInfo) = objFileController.GetFileList(_articleID, ArticleGuid)
+ If (filesList.Count > 0) Then
+ objFile.SortOrder = CType(filesList(filesList.Count - 1), FileInfo).SortOrder + 1
+ End If
+ objFile.Folder = objDnnFile.Folder
+ objFile.Extension = objDnnFile.Extension
+ objFile.Size = objDnnFile.Size
+ objFile.Title = objFile.FileName.Replace("." & objFile.Extension, "")
+
+ objFileController.Add(objFile)
+ BindFiles()
+
+ End If
+ End If
+ End If
+ End If
+
+ Catch exc As Exception 'Module failed to load
+ ProcessModuleLoadException(Me, exc)
+ End Try
+
+ End Sub
+
+#End Region
+
+ End Class
+
+End Namespace
\ No newline at end of file
diff --git a/Controls/UploadImages.ascx b/Controls/UploadImages.ascx
new file mode 100755
index 0000000..109b0ea
--- /dev/null
+++ b/Controls/UploadImages.ascx
@@ -0,0 +1,197 @@
+<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="UploadImages.ascx.vb" Inherits="Ventrian.NewsArticles.Controls.UploadImages" %>
+<%@ Register TagPrefix="Ventrian" Assembly="Ventrian.NewsArticles" Namespace="Ventrian.NewsArticles.Components.WebControls" %>
+
+<%@ Register TagPrefix="dnn" TagName="SectionHead" Src="~/controls/SectionHeadControl.ascx" %>
+<%@ Register TagPrefix="dnn" TagName="Label" Src="~/controls/LabelControl.ascx" %>
+<%@ Register TagPrefix="dnn" TagName="URL" Src="~/controls/URLControl.ascx" %>
+
+
+
+
+
+
+
diff --git a/Controls/UploadImages.ascx.designer.vb b/Controls/UploadImages.ascx.designer.vb
new file mode 100755
index 0000000..d3bcf32
--- /dev/null
+++ b/Controls/UploadImages.ascx.designer.vb
@@ -0,0 +1,277 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+Namespace Ventrian.NewsArticles.Controls
+
+ Partial Public Class UploadImages
+
+ '''
+ '''litModuleID control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents litModuleID As Global.System.Web.UI.WebControls.Literal
+
+ '''
+ '''litTabModuleID control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents litTabModuleID As Global.System.Web.UI.WebControls.Literal
+
+ '''
+ '''litTicketID control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents litTicketID As Global.System.Web.UI.WebControls.Literal
+
+ '''
+ '''litArticleGuid control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents litArticleGuid As Global.System.Web.UI.WebControls.Literal
+
+ '''
+ '''lblSelectImages control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents lblSelectImages As Global.System.Web.UI.WebControls.Label
+
+ '''
+ '''dshImages control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents dshImages As DotNetNuke.UI.UserControls.SectionHeadControl
+
+ '''
+ '''tblImages control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents tblImages As Global.System.Web.UI.HtmlControls.HtmlTable
+
+ '''
+ '''lblImagesHelp control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents lblImagesHelp As Global.System.Web.UI.WebControls.Label
+
+ '''
+ '''phImages control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents phImages As Global.System.Web.UI.WebControls.PlaceHolder
+
+ '''
+ '''trUpload control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents trUpload As Global.System.Web.UI.HtmlControls.HtmlTableCell
+
+ '''
+ '''dshUploadImages control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents dshUploadImages As DotNetNuke.UI.UserControls.SectionHeadControl
+
+ '''
+ '''tblUploadImages control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents tblUploadImages As Global.System.Web.UI.HtmlControls.HtmlTable
+
+ '''
+ '''plFolder control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents plFolder As Global.System.Web.UI.UserControl
+
+ '''
+ '''drpUploadImageFolder control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents drpUploadImageFolder As Global.System.Web.UI.WebControls.DropDownList
+
+ '''
+ '''trExisting control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents trExisting As Global.System.Web.UI.HtmlControls.HtmlTableCell
+
+ '''
+ '''dshExistingImages control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents dshExistingImages As DotNetNuke.UI.UserControls.SectionHeadControl
+
+ '''
+ '''tblExistingImages control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents tblExistingImages As Global.System.Web.UI.HtmlControls.HtmlTable
+
+ '''
+ '''ctlImage control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents ctlImage As DotNetNuke.UI.UserControls.UrlControl
+ '''
+ '''cmdAddExistingImage control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents cmdAddExistingImage As Global.System.Web.UI.WebControls.LinkButton
+
+ '''
+ '''dshSelectedImages control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents dshSelectedImages As DotNetNuke.UI.UserControls.SectionHeadControl
+
+ '''
+ '''tblSelectedImages control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents tblSelectedImages As Global.System.Web.UI.HtmlControls.HtmlTable
+
+ '''
+ '''dlImages control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents dlImages As Global.System.Web.UI.WebControls.DataList
+
+ '''
+ '''lblNoImages control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents lblNoImages As Global.System.Web.UI.WebControls.Label
+
+ '''
+ '''phExternalImage control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents phExternalImage As Global.System.Web.UI.WebControls.PlaceHolder
+
+ '''
+ '''dshExternalImage control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents dshExternalImage As DotNetNuke.UI.UserControls.SectionHeadControl
+
+ '''
+ '''tblExternalImage control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents tblExternalImage As Global.System.Web.UI.HtmlControls.HtmlTable
+
+ '''
+ '''plImageUrl control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents plImageUrl As Global.System.Web.UI.UserControl
+
+ '''
+ '''txtImageExternal control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents txtImageExternal As Global.System.Web.UI.WebControls.TextBox
+
+ '''
+ '''cmdRefreshPhotos control.
+ '''
+ '''
+ '''Auto-generated field.
+ '''To modify move field declaration from designer file to code-behind file.
+ '''
+ Protected WithEvents cmdRefreshPhotos As Global.Ventrian.NewsArticles.Components.WebControls.RefreshControl
+ End Class
+End Namespace
diff --git a/Controls/UploadImages.ascx.vb b/Controls/UploadImages.ascx.vb
new file mode 100755
index 0000000..223b4ae
--- /dev/null
+++ b/Controls/UploadImages.ascx.vb
@@ -0,0 +1,606 @@
+Imports System.IO
+
+Imports DotNetNuke.Common.Utilities
+Imports DotNetNuke.Entities.Portals
+Imports DotNetNuke.Services.Exceptions
+Imports DotNetNuke.Services.Localization
+Imports DotNetNuke.Services.FileSystem
+Imports DotNetNuke.Security
+
+Imports Ventrian.NewsArticles.Base
+
+Namespace Ventrian.NewsArticles.Controls
+
+ Partial Public Class UploadImages
+ Inherits NewsArticleControlBase
+
+#Region " Private Members "
+
+ Private _articleID As Integer = Null.NullInteger
+
+ Private _imagesInit As Boolean = False
+ Private _objImages As List(Of ImageInfo)
+
+#End Region
+
+#Region " Private Properties "
+
+ Private ReadOnly Property ArticleModuleBase() As NewsArticleModuleBase
+ Get
+ Return CType(Parent.Parent.Parent.Parent.Parent, NewsArticleModuleBase)
+ End Get
+ End Property
+
+ Private ReadOnly Property ArticleSettings() As ArticleSettings
+ Get
+ Return ArticleModuleBase.ArticleSettings
+ End Get
+ End Property
+
+#End Region
+
+#Region " Public Properties "
+
+ Public Property ArticleGuid() As String
+ Get
+ If (_articleID = Null.NullInteger) Then
+ If (litArticleGuid.Text = Null.NullString) Then
+ litArticleGuid.Text = Guid.NewGuid.ToString()
+ End If
+ End If
+ Return litArticleGuid.Text
+ End Get
+ Set(ByVal value As String)
+ litArticleGuid.Text = value
+ End Set
+ End Property
+
+ Public ReadOnly Property AttachedImages() As List(Of ImageInfo)
+ Get
+
+ If (_imagesInit = False) Then
+ Dim objImageController As New ImageController
+ _objImages = objImageController.GetImageList(_articleID, ArticleGuid)
+ _imagesInit = True
+ End If
+
+ Return _objImages
+
+ End Get
+ End Property
+
+ Public Property ImageExternalUrl() As String
+ Get
+ Return txtImageExternal.Text
+ End Get
+ Set(ByVal value As String)
+ txtImageExternal.Text = value
+ End Set
+ End Property
+
+#End Region
+
+#Region " Private Methods "
+
+ Private Sub BindFolders()
+
+ Dim ReadRoles As String = Null.NullString
+ Dim WriteRoles As String = Null.NullString
+
+ drpUploadImageFolder.Items.Clear()
+
+ Dim folders As ArrayList = FileSystemUtils.GetFolders(ArticleModuleBase.PortalId)
+ For Each folder As FolderInfo In folders
+ Dim FolderItem As New ListItem()
+ If folder.FolderPath = Null.NullString Then
+ FolderItem.Text = ArticleModuleBase.GetSharedResource("Root")
+ ReadRoles = FileSystemUtils.GetRoles("", ArticleModuleBase.PortalId, "READ")
+ WriteRoles = FileSystemUtils.GetRoles("", ArticleModuleBase.PortalId, "WRITE")
+ Else
+ FolderItem.Text = folder.FolderPath
+ ReadRoles = FileSystemUtils.GetRoles(FolderItem.Text, ArticleModuleBase.PortalId, "READ")
+ WriteRoles = FileSystemUtils.GetRoles(FolderItem.Text, ArticleModuleBase.PortalId, "WRITE")
+ End If
+ FolderItem.Value = folder.FolderID
+
+ If PortalSecurity.IsInRoles(ReadRoles) OrElse PortalSecurity.IsInRoles(WriteRoles) Then
+ drpUploadImageFolder.Items.Add(FolderItem)
+ End If
+ Next
+
+ If (drpUploadImageFolder.Items.FindByValue(ArticleSettings.DefaultImagesFolder.ToString()) IsNot Nothing) Then
+ drpUploadImageFolder.SelectedValue = ArticleSettings.DefaultImagesFolder.ToString()
+ End If
+
+ End Sub
+
+ Private Sub BindImages()
+
+ Dim objImageController As New ImageController()
+
+ dlImages.DataSource = AttachedImages
+ dlImages.DataBind()
+
+ dlImages.Visible = (dlImages.Items.Count > 0)
+ lblNoImages.Visible = (dlImages.Items.Count = 0)
+
+ End Sub
+
+ Protected Function GetArticleID() As String
+
+ Return _articleID.ToString()
+
+ End Function
+
+ Protected Function GetImageUrl(ByVal objImage As ImageInfo) As String
+
+ Dim thumbWidth As Integer = 150
+ Dim thumbHeight As Integer = 150
+
+ Dim width As Integer
+ If (objImage.Width > thumbWidth) Then
+ width = thumbWidth
+ Else
+ width = objImage.Width
+ End If
+
+ Dim height As Integer = Convert.ToInt32(objImage.Height / (objImage.Width / width))
+ If (height > thumbHeight) Then
+ height = thumbHeight
+ width = Convert.ToInt32(objImage.Width / (objImage.Height / height))
+ End If
+
+ Dim settings As PortalSettings = PortalController.GetCurrentPortalSettings()
+
+ Return Page.ResolveUrl("~/DesktopModules/DnnForge - NewsArticles/ImageHandler.ashx?Width=" & width.ToString() & "&Height=" & height.ToString() & "&HomeDirectory=" & Server.UrlEncode(settings.HomeDirectory) & "&FileName=" & Server.UrlEncode(objImage.Folder & objImage.FileName) & "&PortalID=" & settings.PortalId.ToString() & "&q=1")
+
+ End Function
+
+ Protected Function GetMaximumFileSize() As String
+
+ Return "20480"
+
+ End Function
+
+ Protected Function GetPostBackReference() As String
+
+ Return Page.ClientScript.GetPostBackEventReference(cmdRefreshPhotos, "Refresh")
+
+ End Function
+
+ Public Function GetResourceKey(ByVal key As String) As String
+
+ Dim path As String = "~/DesktopModules/DnnForge - NewsArticles/App_LocalResources/UploadImages.ascx.resx"
+ Return DotNetNuke.Services.Localization.Localization.GetString(key, path)
+
+ End Function
+
+ Protected Function GetUploadUrl() As String
+
+ Dim link As String = Page.ResolveUrl("~/DesktopModules/DnnForge%20-%20NewsArticles/Controls/SWFUploader.ashx?PortalID=" & ArticleModuleBase.PortalId.ToString())
+
+ If (link.ToLower().StartsWith("http")) Then
+ Return link
+ Else
+ If (Request.Url.Port = 80) Then
+ Return DotNetNuke.Common.AddHTTP(Request.Url.Host & link)
+ Else
+ Return DotNetNuke.Common.AddHTTP(Request.Url.Host & ":" & Request.Url.Port.ToString() & link)
+ End If
+ End If
+
+ End Function
+
+ Private Sub ReadQueryString()
+
+ If (ArticleSettings.UrlModeType = Components.Types.UrlModeType.Shorterned) Then
+ Try
+ If (IsNumeric(Request(ArticleSettings.ShortenedID))) Then
+ _articleID = Convert.ToInt32(Request(ArticleSettings.ShortenedID))
+ End If
+ Catch
+ End Try
+ End If
+
+ If (IsNumeric(Request("ArticleID"))) Then
+ _articleID = Convert.ToInt32(Request("ArticleID"))
+ End If
+
+ End Sub
+
+ Private Sub RegisterScripts()
+
+ DotNetNuke.Framework.jQuery.RequestRegistration()
+
+ 'If (HttpContext.Current.Items("jquery_registered") Is Nothing And HttpContext.Current.Items("jQueryRequested") Is Nothing) Then
+ ' If (HttpContext.Current.Items("PropertyAgent-jQuery-ScriptsRegistered") Is Nothing And HttpContext.Current.Items("SimpleGallery-ScriptsRegistered") Is Nothing And HttpContext.Current.Items("NewsArticles-ScriptsRegistered") Is Nothing) Then
+ ' Dim objCSS As System.Web.UI.Control = Page.FindControl("CSS")
+
+ ' If Not (objCSS Is Nothing) Then
+ ' Dim litLink As New Literal
+ ' litLink.Text = "" & vbCrLf _
+ ' & "" & vbCrLf
+ ' If (HttpContext.Current.Items("NewsArticles-ScriptsRegistered") IsNot Nothing) Then
+ ' objCSS.Controls.Add(litLink)
+ ' End If
+ ' End If
+ ' If (HttpContext.Current.Items("NewsArticles-ScriptsRegistered") IsNot Nothing) Then
+ ' HttpContext.Current.Items.Add("NewsArticles-ScriptsRegistered", "true")
+ ' End If
+ ' End If
+ 'End If
+
+ End Sub
+
+ Private Sub SetLocalization()
+
+ dshImages.Text = GetResourceKey("Images")
+ lblImagesHelp.Text = GetResourceKey("ImagesHelp")
+
+ dshExistingImages.Text = GetResourceKey("SelectExisting")
+ dshUploadImages.Text = GetResourceKey("UploadImages")
+ dshSelectedImages.Text = GetResourceKey("SelectedImages")
+ dshExternalImage.Text = GetResourceKey("ExternalImage")
+
+ lblNoImages.Text = GetResourceKey("NoImages")
+
+ End Sub
+
+#End Region
+
+#Region " Public Methods "
+
+ Public Sub UpdateImages(ByVal articleID As Integer)
+
+ Dim objImageController As New ImageController
+ For Each objImage As ImageInfo In AttachedImages
+ objImage.ArticleID = articleID
+ objImageController.Update(objImage)
+ Next
+
+ End Sub
+
+#End Region
+
+#Region " Event Handlers "
+
+ Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
+
+ Try
+
+ ReadQueryString()
+ SetLocalization()
+
+ trUpload.Visible = ArticleSettings.EnableImagesUpload
+ trExisting.Visible = ArticleSettings.EnablePortalImages
+
+ phImages.Visible = (trUpload.Visible Or trExisting.Visible)
+
+ phExternalImage.Visible = ArticleSettings.EnableExternalImages
+
+ If (ArticleSettings.IsImagesEnabled = False Or (trUpload.Visible = False And trExisting.Visible = False And phExternalImage.Visible = False)) Then
+ Me.Visible = False
+ Return
+ End If
+
+ If (IsPostBack = False) Then
+ lblSelectImages.Text = GetResourceKey("SelectImages")
+ litModuleID.Text = Me.ArticleModuleBase.ModuleId.ToString()
+ litTabModuleID.Text = Me.ArticleModuleBase.TabModuleId.ToString()
+
+ If (Request.IsAuthenticated) Then
+ litTicketID.Text = Request.Cookies(System.Web.Security.FormsAuthentication.FormsCookieName()).Value
+ End If
+ litArticleGuid.Text = ArticleGuid.ToString()
+
+ BindFolders()
+ BindImages()
+ End If
+
+ Catch exc As Exception 'Module failed to load
+ ProcessModuleLoadException(Me, exc)
+ End Try
+
+ End Sub
+
+ Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
+
+ Try
+
+ RegisterScripts()
+
+ Catch exc As Exception 'Module failed to load
+ ProcessModuleLoadException(Me, exc)
+ End Try
+
+ End Sub
+
+ Protected Sub cmdRefreshPhotos_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdRefreshPhotos.Click
+
+ Try
+
+ BindImages()
+
+ Catch exc As Exception 'Module failed to load
+ ProcessModuleLoadException(Me, exc)
+ End Try
+
+ End Sub
+
+
+ Private Sub dlImages_OnItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles dlImages.ItemDataBound
+
+ Try
+
+ If (e.Item.ItemType = Web.UI.WebControls.ListItemType.Item Or e.Item.ItemType = Web.UI.WebControls.ListItemType.AlternatingItem) Then
+
+ Dim objImage As ImageInfo = CType(e.Item.DataItem, ImageInfo)
+
+ Dim btnEdit As System.Web.UI.WebControls.ImageButton = CType(e.Item.FindControl("btnEdit"), System.Web.UI.WebControls.ImageButton)
+ Dim btnDelete As System.Web.UI.WebControls.ImageButton = CType(e.Item.FindControl("btnDelete"), System.Web.UI.WebControls.ImageButton)
+ Dim btnTop As System.Web.UI.WebControls.ImageButton = CType(e.Item.FindControl("btnTop"), System.Web.UI.WebControls.ImageButton)
+ Dim btnUp As System.Web.UI.WebControls.ImageButton = CType(e.Item.FindControl("btnUp"), System.Web.UI.WebControls.ImageButton)
+ Dim btnDown As System.Web.UI.WebControls.ImageButton = CType(e.Item.FindControl("btnDown"), System.Web.UI.WebControls.ImageButton)
+ Dim btnBottom As System.Web.UI.WebControls.ImageButton = CType(e.Item.FindControl("btnBottom"), System.Web.UI.WebControls.ImageButton)
+
+ If Not (btnDelete Is Nothing) Then
+ btnDelete.Attributes.Add("onClick", "javascript:return confirm('" & GetResourceKey("DeleteImage") & "');")
+
+ If Not (objImage Is Nothing) Then
+ btnDelete.CommandArgument = objImage.ImageID.ToString()
+ End If
+
+ End If
+
+ If Not (btnEdit Is Nothing) Then
+
+ If Not (objImage Is Nothing) Then
+ btnEdit.CommandArgument = objImage.ImageID.ToString()
+ End If
+
+ End If
+
+ If Not (btnUp Is Nothing And btnDown Is Nothing) Then
+
+ If (objImage.ImageID = CType(AttachedImages(0), ImageInfo).ImageID) Then
+ btnUp.Visible = False
+ btnTop.Visible = False
+ End If
+
+ If (objImage.ImageID = CType(AttachedImages(AttachedImages.Count - 1), ImageInfo).ImageID) Then
+ btnDown.Visible = False
+ btnBottom.Visible = False
+ End If
+
+ btnTop.CommandArgument = objImage.ImageID.ToString()
+ btnTop.CommandName = "Top"
+ btnTop.CausesValidation = False
+
+ btnUp.CommandArgument = objImage.ImageID.ToString()
+ btnUp.CommandName = "Up"
+ btnUp.CausesValidation = False
+
+ btnDown.CommandArgument = objImage.ImageID.ToString()
+ btnDown.CommandName = "Down"
+ btnDown.CausesValidation = False
+
+ btnBottom.CommandArgument = objImage.ImageID.ToString()
+ btnBottom.CommandName = "Bottom"
+ btnBottom.CausesValidation = False
+
+ End If
+
+ End If
+
+ Catch exc As Exception 'Module failed to load
+ ProcessModuleLoadException(Me, exc)
+ End Try
+
+ End Sub
+
+ Private Sub dlImages_OnItemCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) Handles dlImages.ItemCommand
+
+ Try
+
+ Dim objImageController As New ImageController
+
+ If (e.CommandName = "Delete") Then
+
+ Dim objImage As ImageInfo = objImageController.Get(Convert.ToInt32(e.CommandArgument))
+
+ If Not (objImage Is Nothing) Then
+ objImageController.Delete(Convert.ToInt32(e.CommandArgument), _articleID, objImage.ImageGuid)
+ End If
+
+ End If
+
+ If (e.CommandName = "Edit") Then
+
+ dlImages.EditItemIndex = e.Item.ItemIndex
+
+ End If
+
+ If (e.CommandName = "Top") Then
+
+ Dim imageID As Integer = Convert.ToInt32(e.CommandArgument)
+
+ Dim objImagesSorted As New List(Of ImageInfo)
+
+ For i As Integer = 0 To AttachedImages.Count - 1
+ Dim objImage As ImageInfo = CType(AttachedImages(i), ImageInfo)
+ If (imageID = objImage.ImageID) Then
+ objImagesSorted.Insert(0, objImage)
+ Else
+ objImagesSorted.Add(objImage)
+ End If
+ Next
+
+ Dim sortOrder As Integer = 0
+ For Each objImage As ImageInfo In objImagesSorted
+ objImage.SortOrder = sortOrder
+ objImageController.Update(objImage)
+ sortOrder = sortOrder + 1
+ Next
+
+ End If
+
+ If (e.CommandName = "Up") Then
+
+ Dim imageID As Integer = Convert.ToInt32(e.CommandArgument)
+
+ For i As Integer = 0 To AttachedImages.Count - 1
+ Dim objImage As ImageInfo = CType(AttachedImages(i), ImageInfo)
+ If (imageID = objImage.ImageID) Then
+
+ Dim objImageToSwap As ImageInfo = CType(AttachedImages(i - 1), ImageInfo)
+
+ Dim sortOrder As Integer = objImage.SortOrder
+ Dim sortOrderPrevious As Integer = objImageToSwap.SortOrder
+
+ objImage.SortOrder = sortOrderPrevious
+ objImageToSwap.SortOrder = sortOrder
+
+ objImageController.Update(objImage)
+ objImageController.Update(objImageToSwap)
+
+ End If
+ Next
+
+ End If
+
+ If (e.CommandName = "Down") Then
+
+ Dim imageID As Integer = Convert.ToInt32(e.CommandArgument)
+
+ For i As Integer = 0 To AttachedImages.Count - 1
+ Dim objImage As ImageInfo = CType(AttachedImages(i), ImageInfo)
+ If (imageID = objImage.ImageID) Then
+ Dim objImageToSwap As ImageInfo = CType(AttachedImages(i + 1), ImageInfo)
+
+ Dim sortOrder As Integer = objImage.SortOrder
+ Dim sortOrderNext As Integer = objImageToSwap.SortOrder
+
+ objImage.SortOrder = sortOrderNext
+ objImageToSwap.SortOrder = sortOrder
+
+ objImageController.Update(objImage)
+ objImageController.Update(objImageToSwap)
+ End If
+ Next
+
+ End If
+
+ If (e.CommandName = "Bottom") Then
+
+ Dim imageID As Integer = Convert.ToInt32(e.CommandArgument)
+
+ Dim objImageEnd As ImageInfo = Nothing
+ Dim objImagesSorted As New List(Of ImageInfo)
+
+ For i As Integer = 0 To AttachedImages.Count - 1
+ Dim objImage As ImageInfo = CType(AttachedImages(i), ImageInfo)
+ If (imageID = objImage.ImageID) Then
+ objImageEnd = objImage
+ Else
+ objImagesSorted.Add(objImage)
+ End If
+ Next
+
+ If (objImageEnd IsNot Nothing) Then
+ objImagesSorted.Add(objImageEnd)
+
+ Dim sortOrder As Integer = 0
+ For Each objImage As ImageInfo In objImagesSorted
+ objImage.SortOrder = sortOrder
+ objImageController.Update(objImage)
+ sortOrder = sortOrder + 1
+ Next
+ End If
+
+ End If
+
+ If (e.CommandName = "Cancel") Then
+
+ dlImages.EditItemIndex = -1
+
+ End If
+
+ If (e.CommandName = "Update") Then
+
+ Dim txtTitle As TextBox = CType(e.Item.FindControl("txtTitle"), TextBox)
+ Dim txtDescription As TextBox = CType(e.Item.FindControl("txtDescription"), TextBox)
+
+ Dim objImage As ImageInfo = objImageController.Get(Convert.ToInt32(dlImages.DataKeys(e.Item.ItemIndex)))
+
+ If Not (objImage Is Nothing) Then
+ objImage.Title = txtTitle.Text
+ objImage.Description = txtDescription.Text
+ objImageController.Update(objImage)
+ End If
+
+ dlImages.EditItemIndex = -1
+
+ End If
+
+ _imagesInit = False
+ BindImages()
+
+ Catch exc As Exception 'Module failed to load
+ ProcessModuleLoadException(Me, exc)
+ End Try
+
+ End Sub
+
+ Protected Sub cmdAddExistingImage_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdAddExistingImage.Click
+
+ Try
+
+ If (ctlImage.Url <> "") Then
+ If (ctlImage.Url.ToLower().StartsWith("fileid=")) Then
+ If (IsNumeric(ctlImage.Url.ToLower().Replace("fileid=", ""))) Then
+ Dim fileID As Integer = Convert.ToInt32(ctlImage.Url.ToLower().Replace("fileid=", ""))
+ Dim objFileController As New DotNetNuke.Services.FileSystem.FileController
+ Dim objFile As DotNetNuke.Services.FileSystem.FileInfo = objFileController.GetFileById(fileID, ArticleModuleBase.PortalId)
+ If (objFile IsNot Nothing) Then
+
+ Dim objImageController As New ImageController
+ Dim objImage As New ImageInfo
+
+ objImage.ArticleID = _articleID
+ If (_articleID = Null.NullInteger) Then
+ objImage.ImageGuid = ArticleGuid
+ End If
+ objImage.FileName = objFile.FileName
+ objImage.ContentType = objFile.ContentType
+ objImage.Width = objFile.Width
+ objImage.Height = objFile.Height
+ objImage.SortOrder = 0
+ Dim imagesList As List(Of ImageInfo) = objImageController.GetImageList(_articleID, ArticleGuid)
+ If (imagesList.Count > 0) Then
+ objImage.SortOrder = CType(imagesList(imagesList.Count - 1), ImageInfo).SortOrder + 1
+ End If
+ objImage.Folder = objFile.Folder
+ objImage.Extension = objFile.Extension
+ objImage.Title = objFile.FileName.Replace("." & objImage.Extension, "")
+ objImage.Size = objFile.Size
+ objImage.Description = ""
+
+ objImageController.Add(objImage)
+ BindImages()
+
+ End If
+ End If
+ End If
+ End If
+
+ Catch exc As Exception 'Module failed to load
+ ProcessModuleLoadException(Me, exc)
+ End Try
+
+ End Sub
+
+#End Region
+
+ End Class
+
+End Namespace
\ No newline at end of file
diff --git a/ImageHandler.ashx b/ImageHandler.ashx
new file mode 100755
index 0000000..853aea5
--- /dev/null
+++ b/ImageHandler.ashx
@@ -0,0 +1 @@
+<%@ WebHandler Language="VB" CodeBehind="ImageHandler.ashx.vb" Class="Ventrian.NewsArticles.ImageHandler" %>
diff --git a/ImageHandler.ashx.vb b/ImageHandler.ashx.vb
new file mode 100755
index 0000000..713c9f8
--- /dev/null
+++ b/ImageHandler.ashx.vb
@@ -0,0 +1,264 @@
+'
+' News Articles for DotNetNuke - http://www.dotnetnuke.com
+' Copyright (c) 2002-2007
+' by Ventrian ( sales@ventrian.com ) ( http://www.ventrian.com )
+'
+
+Imports DotNetNuke.Common.Utilities
+
+Imports System.Drawing
+Imports System.Drawing.Drawing2d
+Imports System.Drawing.Imaging
+Imports System.Web
+Imports System.Web.Services
+Imports Ventrian.ImageResizer
+Imports System.IO
+
+Namespace Ventrian.NewsArticles
+
+ Public Class ImageHandler
+ Implements System.Web.IHttpHandler
+
+#Region " Private Members "
+
+ Private _width As Integer = ArticleConstants.DEFAULT_THUMBNAIL_WIDTH
+ Private _height As Integer = ArticleConstants.DEFAULT_THUMBNAIL_HEIGHT
+ Private _homeDirectory As String = Null.NullString
+ Private _fileName As String = Null.NullString
+ Private _quality As Boolean = False
+ Private _cropped As Boolean = False
+
+#End Region
+
+#Region " Private Methods "
+
+ Private Function GetPhotoHeight(ByVal objPhoto As Image) As Integer
+
+ Dim width As Integer
+ If (objPhoto.Width > _width) Then
+ width = _width
+ Else
+ width = objPhoto.Width
+ End If
+
+ Dim height As Integer = Convert.ToInt32(objPhoto.Height / (objPhoto.Width / width))
+ If (height > _height) Then
+ height = _height
+ width = Convert.ToInt32(objPhoto.Width / (objPhoto.Height / height))
+ End If
+
+ Return height
+
+ End Function
+
+ Private Function GetPhotoWidth(ByVal objPhoto As Image) As Integer
+
+ Dim width As Integer
+
+ If (objPhoto.Width > _width) Then
+ width = _width
+ Else
+ width = objPhoto.Width
+ End If
+
+ Dim height As Integer = Convert.ToInt32(objPhoto.Height / (objPhoto.Width / width))
+ If (height > _height) Then
+ height = _height
+ width = Convert.ToInt32(objPhoto.Width / (objPhoto.Height / height))
+ End If
+
+ Return width
+
+ End Function
+
+ Private Sub ReadQueryString(ByVal context As HttpContext)
+
+ If Not (context.Request("Width") Is Nothing) Then
+ If (IsNumeric(context.Request("Width"))) Then
+ _width = Convert.ToInt32(context.Request("Width"))
+ End If
+ End If
+
+ If Not (context.Request("Height") Is Nothing) Then
+ If (IsNumeric(context.Request("Height"))) Then
+ _height = Convert.ToInt32(context.Request("Height"))
+ End If
+ End If
+
+ If Not (context.Request("HomeDirectory") Is Nothing) Then
+ _homeDirectory = context.Server.UrlDecode(context.Request("HomeDirectory"))
+ End If
+
+ If Not (context.Request("FileName") Is Nothing) Then
+ _fileName = context.Server.UrlDecode(context.Request("FileName"))
+ End If
+
+ If Not (context.Request("Q") Is Nothing) Then
+ If (context.Request("Q") = "1") Then
+ _quality = True
+ End If
+ End If
+
+ If Not (context.Request("S") Is Nothing) Then
+ If (context.Request("S") = "1") Then
+ _cropped = True
+ End If
+ End If
+
+ End Sub
+
+#End Region
+
+#Region " Properties "
+
+ Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
+ Get
+ Return True
+ End Get
+ End Property
+
+#End Region
+
+#Region " Event Handlers "
+
+ Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
+
+ ' Set up the response settings
+ context.Response.ContentType = "image/jpeg"
+
+ ' Caching
+ context.Response.Cache.SetCacheability(HttpCacheability.Public)
+ context.Response.Cache.SetExpires(DateTime.Now.AddDays(30))
+ context.Response.Cache.VaryByParams("FileName") = True
+ context.Response.Cache.VaryByParams("HomeDirectory") = True
+ context.Response.Cache.VaryByParams("Width") = True
+ context.Response.Cache.VaryByParams("Height") = True
+ context.Response.Cache.VaryByParams("s") = True
+ context.Response.Cache.AppendCacheExtension("max-age=86400")
+
+ ReadQueryString(context)
+
+ Dim path As String = ""
+ If _fileName = "placeholder-600.jpg" Then
+ path = "Images/placeholder-600.jpg"
+ Else
+ path = _homeDirectory & "/" & _fileName
+ End If
+
+ context.Items.Add("httpcompress.attemptedinstall", "true")
+
+ If Not (System.IO.File.Exists(context.Server.MapPath(path))) Then
+ path = path & ".resources"
+ If Not (System.IO.File.Exists(context.Server.MapPath(path))) Then
+ Return
+ End If
+ End If
+
+ If (_cropped = False) Then
+ Dim photo As Image = Image.FromFile(context.Server.MapPath(path))
+
+ Dim width As Integer = GetPhotoWidth(photo)
+ Dim height As Integer = GetPhotoHeight(photo)
+
+ photo.Dispose()
+
+ _width = width
+ _height = height
+
+ End If
+
+ Dim objQueryString As New NameValueCollection()
+
+ For Each key As String In context.Request.QueryString.Keys
+ Dim values() As String = context.Request.QueryString.GetValues(key)
+ For Each value As String In values
+
+ If (key.ToLower() = "width" Or key.ToLower() = "height") Then
+ If (key.ToLower() = "width") Then
+ objQueryString.Add("maxwidth", _width.ToString())
+ objQueryString.Add(key, _width.ToString())
+ End If
+ If (key.ToLower() = "height") Then
+ objQueryString.Add("maxheight", _height.ToString())
+ objQueryString.Add(key, _height.ToString())
+ End If
+ Else
+ objQueryString.Add(key, value)
+ End If
+ Next
+ Next
+
+ If (_cropped) Then
+ objQueryString.Add("crop", "auto")
+ End If
+
+ Dim objImage As Bitmap = ImageManager.getBestInstance().BuildImage(context.Server.MapPath(path), objQueryString, New WatermarkSettings(objQueryString))
+ If (path.ToLower().EndsWith("jpg")) Then
+ objImage.Save(context.Response.OutputStream, ImageFormat.Jpeg)
+ Else
+ If (path.ToLower().EndsWith("gif")) Then
+ context.Response.ContentType = "image/gif"
+ Dim ios As ImageOutputSettings = New ImageOutputSettings(ImageOutputSettings.GetImageFormatFromPhysicalPath(context.Server.MapPath(path)), objQueryString)
+ ios.SaveImage(context.Response.OutputStream, objImage)
+ Else
+ If (path.ToLower().EndsWith("png")) Then
+ Dim objMemoryStream As New MemoryStream()
+ context.Response.ContentType = "image/png"
+ objImage.Save(objMemoryStream, ImageFormat.Png)
+ objMemoryStream.WriteTo(context.Response.OutputStream)
+ Else
+ objImage.Save(context.Response.OutputStream, ImageFormat.Jpeg)
+ End If
+ End If
+ End If
+
+ 'Dim photo As Image = Image.FromFile(context.Server.MapPath(path))
+
+ 'Dim width As Integer = GetPhotoWidth(photo)
+ 'Dim height As Integer = GetPhotoHeight(photo)
+
+ 'Dim bmp As New Bitmap(width, height)
+ 'Dim g As Graphics = Graphics.FromImage(DirectCast(bmp, Image))
+
+ 'If (_quality) Then
+ ' g.InterpolationMode = InterpolationMode.HighQualityBicubic
+ ' g.SmoothingMode = SmoothingMode.HighQuality
+ ' g.PixelOffsetMode = PixelOffsetMode.HighQuality
+ ' g.CompositingQuality = CompositingQuality.HighQuality
+ 'End If
+
+ 'g.FillRectangle(Brushes.White, 0, 0, width, height)
+ 'g.DrawImage(photo, 0, 0, width, height)
+
+ 'photo.Dispose()
+
+ 'If (_quality) Then
+ ' Dim info As ImageCodecInfo() = ImageCodecInfo.GetImageEncoders()
+ ' Dim params As New EncoderParameters
+ ' params.Param(0) = New EncoderParameter(Encoder.Quality, 90L)
+ ' bmp.Save(context.Response.OutputStream, info(1), params)
+ ' bmp.Dispose()
+ 'Else
+ ' bmp.Save(context.Response.OutputStream, Imaging.ImageFormat.Jpeg)
+ 'End If
+
+ End Sub
+
+ Public Shared Function GetEncoderInfo(ByVal mimeType As String) As ImageCodecInfo
+ Dim codecs() As ImageCodecInfo = ImageCodecInfo.GetImageEncoders()
+
+ Dim i As Integer
+ For i = 0 To codecs.Length - 1 Step i + 1
+ If codecs(i).MimeType = mimeType Then
+ Return codecs(i)
+ End If
+ Next
+
+ Return Nothing
+ End Function
+
+#End Region
+
+ End Class
+
+End Namespace
\ No newline at end of file
diff --git a/Images/Admin/Categories.gif b/Images/Admin/Categories.gif
new file mode 100755
index 0000000000000000000000000000000000000000..60269f41b4de73278cde7c33dfd123e89c1c0066
GIT binary patch
literal 1144
zcmV-;1c&=aNk%w1VITk?0Oo%H_4V~jurRf}xoMYQsv8t~dXbg=W7E^;rl#1Wq@;`X
zUB$x1gM)?L-T%zY{n^?7mX?{6l*8@q?d0U-{r+_5XBqqr}AP+1c4@YHs9FFmiHq
z*ocaPgpzyZQ2P4%*4F>j)b{A;{>H}n;o<*=hPSuE|Ky^tQI#v~6v@
zz4Gkr|K#NVjKe(f`QS+Qh{7X2?a^+4;7%>v7shy}j*c$UFIQMZm%2z{By$$?NIq`k0%m
z*4Fu;pws5&`k0u(tGv|F(f4#_YT)4exVYx-UNywT@z6mh-ro9`m&@PZ;^N}>kByS9
zt*xA#&+z5+|9?%(*6nuOPphkHkB`LWwyTDQpVZIf)7ScUx?%9DnD6iUK8-@_>+#yq
z-%D~xWny7_&t5p9CCSO&vWu~dO-YA)X{bCoBajtZz&!E)|NsC0A^8LW004ggEC2ui
z03ZM$000O7fPaF6f)sB+O-oobj4MlbUH}vvdwVhx6oi^6S1MXnP+TN0Bn?nGNC*fV
z8d+NeEM6a)e-u|EMLHF`6*@XDzz@Pe8e~cuJ+QKb6}S~BD7(JEA|eeSAVorHS!AvR
z1UwRhC__#t6w$rEE+VB5AY}`fZdu=ZU=xKyE)?m~zeK!f&_EcQIyJ^n@FSx~vJCkI
zH7MdwT`w1;2o`)$!-D}Fa=ZwDkO$9+1mh|UsgTa%l$TQ?$c%u)g8~Bv+JJ$ufyWRu
z5WG+b5uzn85lxadxxiGwk(&x^{0K1TNr)i`)GPpS;mW^V0!fr2_&~^yn+Bu?NHL&A
zju1xwEF_qKMa0*zF=w72g4V{7J}KZZQIP{k3kwXqV0qEfo!F&Jm$d0?rjH%LLt0cZ
zY+(ZiELV1s605ObN1Qe)Up6sBMT;v{4trh_LhM+AGjW)~slbEf8LV4taiWDrXAEnY
z3@qIsauVJihy<8HWkl;1U%nWLP#|#}8q3KF1FB**!UIAOEHa=69aexrg#%R-0U{KxDM$wxG0Y-}1U^LJzymC{*uf3eR3in|
z7ge+tg#`ud7y|%=P%wcH5g<_{2nS5D13W=EAmDaTX0Sm57*MIn2Uj8hf&)V~K|>S~
zL?K25B|uq#nGh^6fseFM-~}3Q4hcdO1r*Rh2Me0XKmvYBLJJ`u?0|%rRe*rT29Jgj
zh5!r1;DrQgPO8ZPXaphP185Ww#;BwM0H~?70I-9QDnQXi2Lg;k>#v1)QGysF&rZkAj+0@b4(am(L()s!M
z$&`=|chSkp%IWIrgoK2>yu2EO)v1n*;EjUS)z!ko#LCy$@bU5X_Vz)M$>+7J$l&ZG
zd&d@j(0~?z6SE*eVMmjM&l8(4^DvZK2Nm{QUGa4Y^A|jl}1!udm(6
z#(c8bx7X^a*z+57#>2|X^X%ybZO&Ae%IE0l40F%r76789rIU?}L7UmFHY#LyivRuk
zvEB7)Yi#N8^7;P%t%ZMVa(Fs@x{AHwH;>bt&+adR$hjgC(l{TDnVah6;qUG118>k+
zeV^mw(mX_evw{>+AFM^!D-aqR!{>_xYNhpYQzr_VVsWkIw)9|NsC0A^8LW004ggEC2ui
z03ZM$000O7fPaF2K`;R@FlrDGY&-{ectAibEDut7a)X+KPz|1+prN5Kcruxre`*bC
zP+12&Y!GUOo)s@fWiJ&K2nY)?Ij8{*L4L-^$bL^>I#eug0|5v|Gbq9hH-0%A+$kw`
zb|@%&I!RO?3c=OcPS_`GJ6V1Tmna8an`ADU;v&UZc|op*#mCR83{C$
zh!Mjej)oco3vL>g&D#_b5)$Ykutb7{B@ALv#BedAL2ny|Y?0u@50?l4deosPh9yRV
z!VqNf18#$f5D~VJh_FMCiGK_j_;k6kLY61uQiN!8#!Z9>bB2Ua8P(?npjEGmvlGID
zpC)eqs7UcJmZH>)XEkaHVD$+;6d`Q*83X5pAG$|YFff22jflL$`qrrfxQ7Q1GeVe9
z@`eroF^nBU-o&KuhYxi=m{`sF#Jv#LK}>4!;1lEd3JC&c^q9j%0)QdgCuCUD!81r9kh_#APt%U
zVF)MekW>UCn9zd(CA2tShaU=pfCxW$VSoV)XqH0+ZY0n~2|Y~EqK0cA;o)~O(rDxG
zjhgvkfg3aUVMCB5*kHqkM#lID7Bn(&paD(#!9g1zgwR8kR&EG}5L$BiLjea)-~j=2
z>Y;}c0@#4&l{l=~rVARtDP)|3Vt_#gh-QF60euv4Bq~?{T0o+S+Asha3oL+x5q)UU
z0un_OK>-L1pu&U;SZKQYK5`LI^jeWRYVa*6%K%~1Oa*o5P|_Ipz=o!V)Ot)w;+J4L=Q8V
l;DHSj;3!56yV-GyxpK&`m;v`5QHKmDq_Dxh=4uiM06ReJU?Nm64IU}eS
zVcJ0H^!q8c8{+lih^L6Z*z)-J_-&rX^78Ua$ugM9n5f053Wf)Jil;ETAj-D=7iOIv-s)xN&s!TkOH{QUge?fLuv|2n}Znwpxp;P$w<
zxa{@&Vt-=z`~6K_fJMhHJf=g_)6<8%n3cetyu{R7wqL@^*eiN1?D+9Fqc|s@CkLAa
z_x}Iy_x$Pg{56+1&g|2|!^FhJ$Z6k3r>dt3yNZEbDX*x3L7|NsC0A^8LW004ggEC2ui
z03ZM$000O7fE9v+5rru;Eq{uOjE#*Ievy)qYZGcDj+u^-Vx2cPK{^R-6IGZs8X7Pl
zH7z%qf1G}v3_3`5BNJ96B5(u*CWUAOf$9$dfmI33~zJxho_`C_DZeOMGC0*Uis71!hv1F@q+;gcT=H
zloh0EQXdx_$DZWX_;LM!F0jLy`*+H6jRVWWW+iyhwN~a2POvg9RW0Rmuwzq(K8t
z2b?&Ov*C)-D;Da&NMfScp9r&NiMhd`X9EbF(ll96lZ96nCCZ?ff~80zsGdFr`9kGt
zybl)t1{ladm+l4)e0a<-1~o|4Aa0U83G*h(OB+uz7+7pz!JRz-)Fk@zz>m)cY?3Uv
zpaQ{go22zbDx35qf$zOtCPph=oY
z%B;GE5G4wjEC9@q1s+KxF@*(3U9o{2ayW5-R8;B5Uw{Ac(MJ|%j4_50GSOs{5eY!3
z)@80mA%TBcSeV6%S%gFq83S~2L|=dPv|oP`{2&1sLRcsO27K@V009&YQ347SRCbxh
zPbHd|qZB{9&|@DW2+&6#Mbxo@KRciR1aSLJC_#=tbYP~G7BYgv3Dl&+MUt&GY2pt*
zNMWWHQlQyKBP2LL02dytqd*#C7Fy?>T4)hK0CdohCL=cp0KyW${9=Qlhjx%?qKh{A
zsG0)!fB_H`ETKUSQD~~EqKgKQ!>a{2x~C&JkT63PSnQGE7tg|#kD}=GIDDq>F*k-G3kQfM1ts+%kDek!BUMYYGfdBwIGE*6c
literal 0
HcmV?d00001
diff --git a/Images/Includes/Handout.xml b/Images/Includes/Handout.xml
new file mode 100755
index 0000000..f56407f
--- /dev/null
+++ b/Images/Includes/Handout.xml
@@ -0,0 +1,15 @@
+
+
+ PDF Handout Title
+ My Handout Description
+
+
+ Easy Freezy Vanilla Ice Cream
+ Detail
+
+
+ Test Title 2
+ Detail 2
+
+
+
\ No newline at end of file
diff --git a/Images/Includes/Handout.xsd b/Images/Includes/Handout.xsd
new file mode 100755
index 0000000..52d59bf
--- /dev/null
+++ b/Images/Includes/Handout.xsd
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Images/Includes/IIK.sps b/Images/Includes/IIK.sps
new file mode 100755
index 0000000..51c6071
--- /dev/null
+++ b/Images/Includes/IIK.sps
@@ -0,0 +1 @@
+