Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working version on DNN9.2 #14

Merged
Merged
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Installs/NewsArticles.00.09.11/
Installs/NewsArticles.00.10.00/
7 changes: 3 additions & 4 deletions API/MetaWebLog/Handler.ashx.vb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Namespace Ventrian.NewsArticles.API.MetaWebLog

Private ReadOnly Property PortalSettings() As PortalSettings
Get
Return PortalController.GetCurrentPortalSettings()
Return PortalController.Instance.GetCurrentPortalSettings()
End Get
End Property

Expand Down Expand Up @@ -108,8 +108,7 @@ Namespace Ventrian.NewsArticles.API.MetaWebLog

Dim check As Boolean = False

Dim objModuleController As New ModuleController
Dim settings As Hashtable = objModuleController.GetModuleSettings(moduleId)
Dim settings As Hashtable = Common.GetModuleSettings(moduleId)

If (user.IsSuperUser) Then
Return True
Expand Down Expand Up @@ -437,7 +436,7 @@ Namespace Ventrian.NewsArticles.API.MetaWebLog
Throw New MetaException("01", "You do not have permission to post articles")
End If

Dim objSettings As Hashtable = objModuleController.GetModuleSettings(objTabModule.ModuleID)
Dim objSettings As Hashtable = Common.GetModuleSettings(objTabModule.ModuleID)
Dim objArticleSettings As New ArticleSettings(objSettings, PortalSettings, objTabModule)

Dim objArticle As New ArticleInfo
Expand Down
7 changes: 5 additions & 2 deletions App_LocalResources/UploadFiles.ascx.resx
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="DeleteFile.Text" xml:space="preserve">
<value>Are you sure you want to remove this file?</value>
Expand Down Expand Up @@ -144,4 +144,7 @@
<data name="cmdAddExistingFile.Text" xml:space="preserve">
<value>Add Existing File</value>
</data>
<data name="Upload.Text" xml:space="preserve">
<value>Upload</value>
</data>
</root>
41 changes: 23 additions & 18 deletions Base/NewsArticleModuleBase.vb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Imports DotNetNuke.Common
Imports DotNetNuke.Common.Utilities
Imports DotNetNuke.Entities.Modules
Imports DotNetNuke.Security
Imports DotNetNuke.Security.Permissions
Imports DotNetNuke.Services.Localization

Namespace Ventrian.NewsArticles.Base
Expand Down Expand Up @@ -45,10 +46,8 @@ Namespace Ventrian.NewsArticles.Base
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)
Dim objSettings As Hashtable = ModuleConfiguration.ModuleSettings
Dim objTabSettings As Hashtable = ModuleConfiguration.TabModuleSettings

For Each item As DictionaryEntry In objTabSettings
If (objSettings.ContainsKey(item.Key) = False) Then
Expand All @@ -57,7 +56,7 @@ Namespace Ventrian.NewsArticles.Base
Next

_articleSettings = New ArticleSettings(objSettings, PortalSettings, ModuleConfiguration)
objModuleController.UpdateModuleSetting(ModuleId, "ResetArticleSettings", "true")
ModuleController.Instance.UpdateModuleSetting(ModuleId, "ResetArticleSettings", "true")
End Try
End If
Return _articleSettings
Expand Down Expand Up @@ -226,25 +225,31 @@ Namespace Ventrian.NewsArticles.Base
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)
Public Function StripHtml(ByVal html As String) As String

End Function
Return StripHtml(html, False)

End Function

Private Function RoundToUnit(ByVal d As Double, ByVal unit As Double, ByVal roundDown As Boolean) As Double
Public Function StripHtml(ByVal html As String, ByVal cleanLineBreaks As Boolean) As String

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
Dim pattern As String = "<(.|\n)*?>"
Return Regex.Replace(html, pattern, String.Empty).Replace(System.Environment.NewLine, " ")

End Function
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
Protected Function GetRatingImage(ByVal objDataItem As Object) As String

Dim objArticle As ArticleInfo = CType(objDataItem, ArticleInfo)

Expand Down Expand Up @@ -350,7 +355,7 @@ Namespace Ventrian.NewsArticles.Base

' Admin of Module
'
If (PortalSecurity.HasEditPermissions(objModule.ModulePermissions)) Then
If (ModulePermissionController.HasModuleAccess(SecurityAccessLevel.Edit, "EDIT" , objModule)) Then

Return True

Expand Down
7 changes: 3 additions & 4 deletions Components/ArticleController.vb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Namespace Ventrian.NewsArticles

Dim objArticles As New List(Of ArticleInfo)
While dr.Read
objArticles.Add(CType(CBO.FillObject(dr, GetType(ArticleInfo), False), ArticleInfo))
objArticles.Add(CBO.FillObject(Of ArticleInfo)(dr, False))
End While

Dim nextResult As Boolean = dr.NextResult()
Expand Down Expand Up @@ -124,7 +124,7 @@ Namespace Ventrian.NewsArticles
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)
objArticle = CBO.FillObject(Of ArticleInfo)(DataProvider.Instance().GetArticle(articleID))
If (objArticle Is Nothing) Then
Return Nothing
End If
Expand Down Expand Up @@ -288,8 +288,7 @@ Namespace Ventrian.NewsArticles

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)
Dim settings As Hashtable = Common.GetModuleSettings(ModInfo.ModuleID)
settings = GetTabModuleSettings(ModInfo.TabModuleID, settings)

Dim doSearch As Boolean = False
Expand Down
Loading