Skip to content

Commit

Permalink
re-applied file upload fix by vmasanas
Browse files Browse the repository at this point in the history
  • Loading branch information
skamphuis committed Sep 4, 2018
1 parent f6ae78a commit 3f1f577
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 41 deletions.
24 changes: 11 additions & 13 deletions Controls/UploadFiles.ascx.vb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ Imports DotNetNuke.Security

Imports Ventrian.NewsArticles.Base
Imports DotNetNuke.Entities.Portals
Imports DotNetNuke.Security.Permissions
Imports DotNetNuke.Services.FileSystem

Namespace Ventrian.NewsArticles.Controls

Expand All @@ -23,7 +21,7 @@ Namespace Ventrian.NewsArticles.Controls

#Region " Private Properties "

Private Overloads ReadOnly Property ArticleModuleBase() As NewsArticleModuleBase
Private ReadOnly Property ArticleModuleBase() As NewsArticleModuleBase
Get
Return CType(Parent.Parent.Parent.Parent.Parent, NewsArticleModuleBase)
End Get
Expand Down Expand Up @@ -93,19 +91,18 @@ Namespace Ventrian.NewsArticles.Controls

drpUploadFilesFolder.Items.Clear()

Dim folders As IEnumerable(Of FolderInfo) = FolderManager.Instance.GetFolders(ArticleModuleBase.PortalId)
Dim folders As ArrayList = FileSystemUtils.GetFolders(ArticleModuleBase.PortalId)
For Each folder As DotNetNuke.Services.FileSystem.FolderInfo In folders
If Not folder.IsProtected Then
Dim folderPermissions as FolderPermissionCollection = FolderPermissionController.GetFolderPermissionsCollectionByFolder(ArticleModuleBase.PortalId,folder.FolderPath)
Dim FolderItem As New ListItem()
If folder.FolderPath = Null.NullString Then
FolderItem.Text = ArticleModuleBase.GetSharedResource("Root")
ReadRoles = folderPermissions.ToString("READ")
WriteRoles = folderPermissions.ToString("WRITE")
ReadRoles = FileSystemUtils.GetRoles("", ArticleModuleBase.PortalId, "READ")
WriteRoles = FileSystemUtils.GetRoles("", ArticleModuleBase.PortalId, "WRITE")
Else
FolderItem.Text = folder.FolderPath
ReadRoles = folderPermissions.ToString("READ")
WriteRoles = folderPermissions.ToString("WRITE")
ReadRoles = FileSystemUtils.GetRoles(FolderItem.Text, ArticleModuleBase.PortalId, "READ")
WriteRoles = FileSystemUtils.GetRoles(FolderItem.Text, ArticleModuleBase.PortalId, "WRITE")
End If
FolderItem.Value = folder.FolderID

Expand Down Expand Up @@ -245,7 +242,7 @@ Namespace Ventrian.NewsArticles.Controls

End Sub

Protected Sub cmdRefreshPhotos_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdRefreshFiles.Click
Protected Sub cmdRefreshPhotos_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdRefreshFiles.Click

Try

Expand Down Expand Up @@ -412,15 +409,16 @@ Namespace Ventrian.NewsArticles.Controls

End Sub

Protected Sub cmdAddExistingFile_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdAddExistingFile.Click
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 objDnnFile As DotNetNuke.Services.FileSystem.FileInfo = FileManager.Instance.GetFile(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
Expand Down Expand Up @@ -457,7 +455,7 @@ Namespace Ventrian.NewsArticles.Controls

End Sub

Protected Sub btUpload_Click(sender As Object, e As System.EventArgs)
Protected Sub btUpload_Click(sender As Object, e As EventArgs)
Dim objFileController As New FileController
Dim objPortalController As New PortalController()

Expand Down
35 changes: 17 additions & 18 deletions Controls/UploadImages.ascx.vb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ Imports Ventrian.NewsArticles.Base
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Drawing.Imaging
Imports DotNetNuke.Security.Permissions
Imports DotNetNuke.Services.FileSystem

Namespace Ventrian.NewsArticles.Controls

Expand All @@ -29,8 +27,8 @@ Namespace Ventrian.NewsArticles.Controls

#Region " Private Properties "

Private Overloads ReadOnly Property ArticleModuleBase() As NewsArticleModuleBase
Get
Private ReadOnly Property ArticleModuleBase() As NewsArticleModuleBase
Get
Return CType(Parent.Parent.Parent.Parent.Parent, NewsArticleModuleBase)
End Get
End Property
Expand Down Expand Up @@ -93,19 +91,18 @@ Namespace Ventrian.NewsArticles.Controls

drpUploadImageFolder.Items.Clear()

Dim folders As IEnumerable(Of FolderInfo) = FolderManager.Instance.GetFolders(ArticleModuleBase.PortalId)
Dim folders As ArrayList = FileSystemUtils.GetFolders(ArticleModuleBase.PortalId)
For Each folder As DotNetNuke.Services.FileSystem.FolderInfo In folders
If Not folder.IsProtected Then
Dim folderPermissions as FolderPermissionCollection = FolderPermissionController.GetFolderPermissionsCollectionByFolder(ArticleModuleBase.PortalId,folder.FolderPath)
Dim FolderItem As New ListItem()
If folder.FolderPath = Null.NullString Then
FolderItem.Text = ArticleModuleBase.GetSharedResource("Root")
ReadRoles = folderPermissions.ToString("READ")
WriteRoles = folderPermissions.ToString("WRITE")
ReadRoles = FileSystemUtils.GetRoles("", ArticleModuleBase.PortalId, "READ")
WriteRoles = FileSystemUtils.GetRoles("", ArticleModuleBase.PortalId, "WRITE")
Else
FolderItem.Text = folder.FolderPath
ReadRoles = folderPermissions.ToString("READ")
WriteRoles = folderPermissions.ToString("WRITE")
ReadRoles = FileSystemUtils.GetRoles(FolderItem.Text, ArticleModuleBase.PortalId, "READ")
WriteRoles = FileSystemUtils.GetRoles(FolderItem.Text, ArticleModuleBase.PortalId, "WRITE")
End If
FolderItem.Value = folder.FolderID

Expand Down Expand Up @@ -157,7 +154,7 @@ Namespace Ventrian.NewsArticles.Controls
width = Convert.ToInt32(objImage.Width / (objImage.Height / height))
End If

Dim settings As PortalSettings = PortalController.Instance.GetCurrentPortalSettings()
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")

Expand Down Expand Up @@ -282,7 +279,7 @@ Namespace Ventrian.NewsArticles.Controls

End Sub

Protected Sub cmdRefreshPhotos_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdRefreshPhotos.Click
Protected Sub cmdRefreshPhotos_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdRefreshPhotos.Click

Try

Expand Down Expand Up @@ -518,15 +515,16 @@ Namespace Ventrian.NewsArticles.Controls

End Sub

Protected Sub cmdAddExistingImage_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdAddExistingImage.Click
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 objFile As DotNetNuke.Services.FileSystem.FileInfo = FileManager.Instance.GetFile(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
Expand All @@ -543,7 +541,7 @@ Namespace Ventrian.NewsArticles.Controls
objImage.SortOrder = 0
Dim imagesList As List(Of ImageInfo) = objImageController.GetImageList(_articleID, ArticleGuid)
If (imagesList.Count > 0) Then
objImage.SortOrder = imagesList(imagesList.Count - 1).SortOrder + 1
objImage.SortOrder = CType(imagesList(imagesList.Count - 1), ImageInfo).SortOrder + 1
End If
objImage.Folder = objFile.Folder
objImage.Extension = objFile.Extension
Expand All @@ -565,7 +563,7 @@ Namespace Ventrian.NewsArticles.Controls

End Sub

Protected Sub btUpload_Click(sender As Object, e As System.EventArgs)
Protected Sub btUpload_Click(sender As Object, e As EventArgs)
Dim objImageController As New ImageController
Dim objPortalController As New PortalController()

Expand Down Expand Up @@ -618,13 +616,14 @@ Namespace Ventrian.NewsArticles.Controls
objImage.SortOrder = CType(imagesList(imagesList.Count - 1), ImageInfo).SortOrder + 1
End If

Dim objPortalSettings As PortalSettings = PortalController.Instance.GetCurrentPortalSettings()
Dim objPortalSettings As PortalSettings = PortalController.GetCurrentPortalSettings()

Dim folder As String = ""
Dim folderId As Integer = Integer.Parse(drpUploadImageFolder.SelectedValue)

If (folderId <> Null.NullInteger) Then
Dim objFolder As FolderInfo = FolderManager.Instance.GetFolder(folderId)
Dim objFolderController As New DotNetNuke.Services.FileSystem.FolderController
Dim objFolder As DotNetNuke.Services.FileSystem.FolderInfo = objFolderController.GetFolderInfo(ArticleModuleBase.PortalId, folderId)
If (objFolder IsNot Nothing) Then
folder = objFolder.FolderPath
End If
Expand Down
Binary file modified Installs/NewsArticles.00.10.00.zip
Binary file not shown.
10 changes: 5 additions & 5 deletions NewsArticles.dnn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dotnetnuke type="Package" version="6.0">
<packages>
<package name="DnnForge - NewsArticles" type="Module"version="00.10.00">
<package name="DnnForge - NewsArticles" type="Module" version="00.10.00">
<friendlyName>News Articles</friendlyName>
<description>Allows you to publish News Articles to your portal.</description>
<owner>
Expand Down Expand Up @@ -860,7 +860,7 @@
</component>
</components>
</package>
<package name="DnnForge - LatestArticles" type="Module"version="00.10.00">
<package name="DnnForge - LatestArticles" type="Module" version="00.10.00">
<friendlyName>News Articles Latest</friendlyName>
<description>Allows you to display a list of the latest articles.</description>
<iconFile />
Expand Down Expand Up @@ -921,7 +921,7 @@
</component>
</components>
</package>
<package name="DnnForge - LatestComments" type="Module"version="00.10.00">
<package name="DnnForge - LatestComments" type="Module" version="00.10.00">
<friendlyName>News Articles Comments</friendlyName>
<description>Allows you to display a list of the latest comments.</description>
<iconFile />
Expand Down Expand Up @@ -982,7 +982,7 @@
</component>
</components>
</package>
<package name="DnnForge - NewsArchives" type="Module"version="00.10.00">
<package name="DnnForge - NewsArchives" type="Module" version="00.10.00">
<friendlyName>News Articles Archives</friendlyName>
<description>Allows you to display a list of articles by month.</description>
<iconFile />
Expand Down Expand Up @@ -1043,7 +1043,7 @@
</component>
</components>
</package>
<package name="DnnForge - NewsSearch" type="Module"version="00.10.00">
<package name="DnnForge - NewsSearch" type="Module" version="00.10.00">
<friendlyName>News Articles Search</friendlyName>
<description>Allows you to display a list of articles by month.</description>
<iconFile />
Expand Down
13 changes: 9 additions & 4 deletions Ventrian.NewsArticles.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@
<IISExpressUseClassicPipelineMode />
<TargetFrameworkProfile />
<UseGlobalApplicationHostFile />
<Use64BitIISExpress />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>..\..\bin\</OutputPath>
<DocumentationFile>Ventrian.xml</DocumentationFile>
<DocumentationFile>
</DocumentationFile>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42353,42354,42355</NoWarn>
<WarningsAsErrors>
</WarningsAsErrors>
Expand All @@ -44,8 +46,9 @@
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DocumentationFile>Ventrian.xml</DocumentationFile>
<OutputPath>..\..\bin\</OutputPath>
<DocumentationFile>
</DocumentationFile>
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42353,42354,42355</NoWarn>
<WarningsAsErrors>
</WarningsAsErrors>
Expand All @@ -56,10 +59,12 @@
<Reference Include="DotNetNuke, Version=6.2.3.141, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\DotNetNuke482\Website\Bin\DotNetNuke.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="DotNetNuke.Web.Client, Version=6.1.2.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\bin\DotNetNuke.Web.Client.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="ephtmltopdf, Version=4.0.6.31734, Culture=neutral, PublicKeyToken=5b5f377bc08a4d32, processorArchitecture=MSIL" />
<Reference Include="Joel.Net.Akismet, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL" />
Expand All @@ -79,7 +84,7 @@
<Reference Include="System.Web.Mobile" />
<Reference Include="System.Xml.Linq" />
<Reference Include="Ventrian.ImageResizer, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="Ventrian.NewsArticles.Secure, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL" />
</ItemGroup>
Expand Down
9 changes: 8 additions & 1 deletion Ventrian.NewsArticles.vbproj.user
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
<ProjectView>ShowAllFiles</ProjectView>
<UseIISExpress>false</UseIISExpress>
<Use64BitIISExpress />
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
</PropertyGroup>
<ProjectExtensions>
<VisualStudio>
Expand Down

0 comments on commit 3f1f577

Please sign in to comment.