Skip to content

Commit

Permalink
Fixed SubmitArticle too slow for sites with many folders
Browse files Browse the repository at this point in the history
  • Loading branch information
skamphuis committed Jan 8, 2019
1 parent ab460a0 commit 3da3ff6
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 12 deletions.
4 changes: 2 additions & 2 deletions App_LocalResources/ucViewOptions.ascx.resx
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@
<value>Always Show PageID</value>
</data>
<data name="plDefaultImageFolder.Help" xml:space="preserve">
<value>Select the default image folder.</value>
<value>Select the default image folder. Users will only be able to select this folder or its child folders.</value>
</data>
<data name="plDefaultImageFolder.Text" xml:space="preserve">
<value>Default Image Folder:</value>
Expand Down Expand Up @@ -976,7 +976,7 @@
<value>File Settings</value>
</data>
<data name="plDefaultFileFolder.Help" xml:space="preserve">
<value>Specify the default folder to upload files.</value>
<value>Specify the default folder to upload files. Users will only be able to select this folder or its child folders.</value>
</data>
<data name="plDefaultFileFolder.Text" xml:space="preserve">
<value>Default File Folder</value>
Expand Down
7 changes: 7 additions & 0 deletions Components/Utility/LogginUtils.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Imports DotNetNuke.Instrumentation

Module LogginUtils
Public Function Logger() As ILog
return LoggerSource.Instance.GetLogger("Ventrian.NA")
End Function
End Module
12 changes: 9 additions & 3 deletions Controls/UploadFiles.ascx.vb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Imports System
Imports System.Linq
Imports DotNetNuke.Common.Utilities
Imports DotNetNuke.Services.Exceptions
Imports DotNetNuke.Security
Expand Down Expand Up @@ -88,13 +89,19 @@ Namespace Ventrian.NewsArticles.Controls
End Sub

Private Sub BindFolders()

Dim ReadRoles As String = Null.NullString
Dim WriteRoles As String = Null.NullString

drpUploadFilesFolder.Items.Clear()

Dim folders As List(Of IFolderInfo) = FolderManager.Instance.GetFolders(ArticleModuleBase.PortalId, False)
Dim folders As New List(Of IFolderInfo)
If ArticleSettings.DefaultFilesFolder > 0 Then
Dim defaultFolder as IFolderInfo = FolderManager.Instance.GetFolder(ArticleSettings.DefaultFilesFolder)
folders.Add(defaultFolder)
folders.AddRange(FolderManager.Instance.GetFolders(defaultFolder))
Else
folders.AddRange(FolderManager.Instance.GetFolders(ArticleModuleBase.PortalId, False))
End If
For Each folder As DotNetNuke.Services.FileSystem.FolderInfo In folders
If Not folder.IsProtected Then
Dim FolderItem As New ListItem()
Expand All @@ -118,7 +125,6 @@ Namespace Ventrian.NewsArticles.Controls
If (drpUploadFilesFolder.Items.FindByValue(ArticleSettings.DefaultFilesFolder.ToString()) IsNot Nothing) Then
drpUploadFilesFolder.SelectedValue = ArticleSettings.DefaultFilesFolder.ToString()
End If

End Sub

Protected Function GetArticleID() As String
Expand Down
17 changes: 10 additions & 7 deletions Controls/UploadImages.ascx.vb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Imports Ventrian.NewsArticles.Base
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Drawing.Imaging
Imports System.Linq
Imports DotNetNuke.Security.Permissions
Imports DotNetNuke.Services.FileSystem

Expand Down Expand Up @@ -88,13 +89,20 @@ Namespace Ventrian.NewsArticles.Controls
#Region " Private Methods "

Private Sub BindFolders()

Dim ReadRoles As String = Null.NullString
Dim WriteRoles As String = Null.NullString

drpUploadImageFolder.Items.Clear()

Dim folders As List(Of IFolderInfo) = FolderManager.Instance.GetFolders(ArticleModuleBase.PortalId, False)

Dim folders As New List(Of IFolderInfo)()
If ArticleSettings.DefaultImagesFolder > 0 Then
Dim defaultFolder as IFolderInfo = FolderManager.Instance.GetFolder(ArticleSettings.DefaultImagesFolder)
folders.Add(defaultFolder)
folders.AddRange(FolderManager.Instance.GetFolders(defaultFolder))
Else
folders.AddRange(FolderManager.Instance.GetFolders(ArticleModuleBase.PortalId, False))
End If
For Each folder As DotNetNuke.Services.FileSystem.FolderInfo In folders
If Not folder.IsProtected Then
Dim FolderItem As New ListItem()
Expand All @@ -118,19 +126,14 @@ Namespace Ventrian.NewsArticles.Controls
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
Expand Down
Binary file modified Installs/NewsArticles.00.11.00.zip
Binary file not shown.
Binary file added Libraries/DotNetNuke.Instrumentation.dll
Binary file not shown.
Binary file added Libraries/DotNetNuke.Log4Net.dll
Binary file not shown.
11 changes: 11 additions & 0 deletions Ventrian.NewsArticles.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,16 @@
<HintPath>Libraries\DotNetNuke.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="DotNetNuke.Instrumentation, Version=8.0.4.226, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Libraries\DotNetNuke.Instrumentation.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="DotNetNuke.Log4Net, Version=3.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Libraries\DotNetNuke.Log4Net.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="DotNetNuke.Web.Client, Version=8.0.4.226, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Libraries\DotNetNuke.Web.Client.dll</HintPath>
Expand Down Expand Up @@ -164,6 +174,7 @@
<Compile Include="Components\Social\Journal.vb" />
<Compile Include="Components\ThumbnailType.vb" />
<Compile Include="Components\Utility\LocalizationUtil.vb" />
<Compile Include="Components\Utility\LogginUtils.vb" />
<Compile Include="Components\WebControls\RefreshControl.vb" />
<Compile Include="Controls\Honeypot.ascx.designer.vb">
<DependentUpon>Honeypot.ascx</DependentUpon>
Expand Down

0 comments on commit 3da3ff6

Please sign in to comment.