Skip to content

Commit

Permalink
Merge pull request #192 from donker/fixdg
Browse files Browse the repository at this point in the history
Fix Posts Datagrid
  • Loading branch information
donker authored May 13, 2022
2 parents 3b22899 + 1234ca5 commit 88408f9
Show file tree
Hide file tree
Showing 13 changed files with 688 additions and 447 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
[Dd]ebug/
[Rr]elease/
x64/
build/
[Bb]in/
[Oo]bj/

Expand Down Expand Up @@ -167,4 +166,4 @@ tools/
**/obj/
!Server/References/*.dll
Releases/

node_modules/
8 changes: 6 additions & 2 deletions DotNetNuke.Modules.Blog.sln
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.902
# Visual Studio Version 17
VisualStudioVersion = 17.1.32328.378
MinimumVisualStudioVersion = 10.0.40219.1
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "DotNetNuke.Modules.Blog", "Server\Blog\DotNetNuke.Modules.Blog.vbproj", "{4E2BCA3B-927C-4AF2-9999-B1C074FD0539}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "OpenUrlRewriterDNNBlogProvider", "Server\OpenUrlRewriter\OpenUrlRewriterDNNBlogProvider.vbproj", "{1CE16AF6-17DE-440C-83F4-7B96431F52E7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Build", "build\Build.csproj", "{22A9DE4E-9CFD-4ABA-8C82-87D1C22F2FD9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -21,6 +23,8 @@ Global
{1CE16AF6-17DE-440C-83F4-7B96431F52E7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1CE16AF6-17DE-440C-83F4-7B96431F52E7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1CE16AF6-17DE-440C-83F4-7B96431F52E7}.Release|Any CPU.Build.0 = Release|Any CPU
{22A9DE4E-9CFD-4ABA-8C82-87D1C22F2FD9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{22A9DE4E-9CFD-4ABA-8C82-87D1C22F2FD9}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
4 changes: 2 additions & 2 deletions Server/Blog/Manage.ascx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<asp:Panel id="Posts" runat="server" CssClass="dnnClear">
<div class="coreMessaging" id="blogPostsError"></div>
<asp:GridView id="grdPosts" autogeneratecolumns="false" cssclass="dnnGrid dnnSecurityRolesGrid"
runat="server" allowpaging="True" allowcustompaging="True" enableviewstate="True" AllowSorting="true" OnSorting="GridView_Sorting">
runat="server" allowpaging="True" allowcustompaging="True" enableviewstate="True" AllowSorting="true">
<Columns>
<asp:TemplateField HeaderText="Actions">
<ItemStyle Width="90px"></ItemStyle>
Expand All @@ -57,7 +57,7 @@
style="display:<%# IIF(CType(Container.DataItem, DotNetNuke.Modules.Blog.Entities.Posts.PostInfo).Blog.CanApprove AND NOT CType(Container.DataItem, DotNetNuke.Modules.Blog.Entities.Posts.PostInfo).Published, "inline", "none") %>"><i class="fa fa-check icon16"></i></a>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField headertext="Date">
<asp:TemplateField headertext="Date" SortExpression="PublishedOnDate">
<ItemTemplate>
<%# DotNetNuke.Modules.Blog.Common.Globals.UtcToLocalTime(Eval("PublishedOnDate"), UserController.GetCurrentUserInfo().Profile.PreferredTimeZone)%>
</ItemTemplate>
Expand Down
157 changes: 83 additions & 74 deletions Server/Blog/Manage.ascx.vb
Original file line number Diff line number Diff line change
Expand Up @@ -23,99 +23,108 @@ Imports System.Linq
Imports DotNetNuke.Modules.Blog.Entities.Posts

Public Class Manage
Inherits BlogModuleBase
Inherits BlogModuleBase

Private _totalPosts As Integer = -1
Private Const ASCENDING As String = " ASC"
Private Const DESCENDING As String = " DESC"
Private _totalPosts As Integer = -1
Private Const ASCENDING As String = " ASC"
Private Const DESCENDING As String = " DESC"

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load

If Not BlogContext.security.CanDoSomethingWithPosts Then
Throw New Exception("You do not have access to this resource. Please check your login status.")
End If
cmdAdd.Visible = BlogContext.Security.IsBlogger
blogsLink.Visible = BlogContext.Security.IsBlogger
Blogs.Visible = BlogContext.Security.IsBlogger
If Not BlogContext.Security.CanDoSomethingWithPosts Then
Throw New Exception("You do not have access to this resource. Please check your login status.")
End If
cmdAdd.Visible = BlogContext.Security.IsBlogger
blogsLink.Visible = BlogContext.Security.IsBlogger
Blogs.Visible = BlogContext.Security.IsBlogger

postsLink.Visible = BlogContext.Security.CanAddPost Or BlogContext.Security.CanEditPost
Posts.Visible = BlogContext.Security.CanAddPost Or BlogContext.Security.CanEditPost
postsLink.Visible = BlogContext.Security.CanAddPost Or BlogContext.Security.CanEditPost
Posts.Visible = BlogContext.Security.CanAddPost Or BlogContext.Security.CanEditPost

If Not IsPostBack Then
DataBind()
End If
If Not IsPostBack Then
DataBind()
End If

End Sub
End Sub

Private Sub cmdAdd_Click(sender As Object, e As EventArgs) Handles cmdAdd.Click
Response.Redirect(EditUrl("BlogEdit"), False)
End Sub
Private Sub cmdAdd_Click(sender As Object, e As EventArgs) Handles cmdAdd.Click
Response.Redirect(EditUrl("BlogEdit"), False)
End Sub

Private Sub cmdReturn_Click(sender As Object, e As EventArgs) Handles cmdReturn.Click
Response.Redirect(DotNetNuke.Common.NavigateURL(TabId), False)
End Sub
Private Sub cmdReturn_Click(sender As Object, e As EventArgs) Handles cmdReturn.Click
Response.Redirect(DotNetNuke.Common.NavigateURL(TabId), False)
End Sub

Public Overrides Sub DataBind()
Public Overrides Sub DataBind()

MyBase.DataBind()
MyBase.DataBind()

If BlogContext.security.IsEditor Then
dlBlogs.DataSource = BlogsController.GetBlogsByModule(Settings.ModuleId, UserId, BlogContext.Locale).Values
Else
dlBlogs.DataSource = BlogsController.GetBlogsByModule(Settings.ModuleId, UserId, BlogContext.Locale).Values.Where(Function(b)
Return b.OwnerUserId = UserId
End Function)
End If
dlBlogs.DataBind()
If BlogContext.Security.IsEditor Then
dlBlogs.DataSource = BlogsController.GetBlogsByModule(Settings.ModuleId, UserId, BlogContext.Locale).Values
Else
dlBlogs.DataSource = BlogsController.GetBlogsByModule(Settings.ModuleId, UserId, BlogContext.Locale).Values.Where(Function(b)
Return b.OwnerUserId = UserId
End Function)
End If
dlBlogs.DataBind()

If dlBlogs.Items.Count = 0 Then dlBlogs.Visible = False
If dlBlogs.Items.Count = 0 Then dlBlogs.Visible = False

GetPosts()
GetPosts()

End Sub
End Sub

Public Sub GetPosts()
grdPosts.DataSource = PostsController.GetPosts(Settings.ModuleId, -1, BlogContext.Locale, -1, "", Nothing, -1, True, grdPosts.PageIndex, grdPosts.PageSize, SortOrder, _totalPosts, UserId, BlogContext.Security.UserIsAdmin).Values
grdPosts.VirtualItemCount = _totalPosts
Public Sub GetPosts()
grdPosts.DataSource = PostsController.GetPosts(Settings.ModuleId, -1, BlogContext.Locale, -1, "", Nothing, -1, True, grdPosts.PageIndex, grdPosts.PageSize, SortOrder, _totalPosts, UserId, BlogContext.Security.UserIsAdmin).Values
grdPosts.VirtualItemCount = _totalPosts
grdPosts.DataBind()
End Sub

Public Property GridViewSortDirection As SortDirection
Get
If ViewState("sortDirection") Is Nothing Then ViewState("sortDirection") = SortDirection.Descending
Return CType(ViewState("sortDirection"), SortDirection)
End Get
Set(ByVal value As SortDirection)
ViewState("sortDirection") = value
End Set
End Property

Public Property GridViewSortExpression As String
Get
If ViewState("sortExpression") Is Nothing Then ViewState("sortExpression") = "PUBLISHEDONDATE"
Return ViewState("sortExpression").ToString()
End Get
Set(ByVal value As String)
ViewState("sortExpression") = value
End Set
End Property

Private ReadOnly Property SortOrder As String
Get
Return String.Concat(GridViewSortExpression, " ", GridViewSortDirection)
End Sub

Public Property GridViewSortDirection As SortDirection
Get
If ViewState("sortDirection") Is Nothing Then ViewState("sortDirection") = SortDirection.Descending
Return CType(ViewState("sortDirection"), SortDirection)
End Get
Set(ByVal value As SortDirection)
ViewState("sortDirection") = value
End Set
End Property

Public Property GridViewSortExpression As String
Get
If ViewState("sortExpression") Is Nothing Then ViewState("sortExpression") = "PUBLISHEDONDATE"
Return ViewState("sortExpression").ToString()
End Get
End Property
Set(ByVal value As String)
ViewState("sortExpression") = value
End Set
End Property

Private ReadOnly Property SortOrder As String
Get
If GridViewSortDirection = SortDirection.Ascending Then
Return String.Concat(GridViewSortExpression, " ASC")
Else
Return String.Concat(GridViewSortExpression, " DESC")
End If
End Get
End Property

Protected Sub GridView_Sorting(sender As Object, e As GridViewSortEventArgs) Handles grdPosts.Sorting
Dim sortExpression As String = e.SortExpression

Protected Sub GridView_Sorting(ByVal sender As Object, ByVal e As GridViewSortEventArgs)
Dim sortExpression As String = e.SortExpression
If GridViewSortDirection = SortDirection.Ascending Then
GridViewSortDirection = SortDirection.Descending
Else
GridViewSortDirection = SortDirection.Ascending
End If

If GridViewSortDirection = SortDirection.Ascending Then
GridViewSortDirection = SortDirection.Descending
Else
GridViewSortDirection = SortDirection.Ascending
End If
GetPosts()
End Sub

GetPosts()
End Sub
Protected Sub GridView_Paging(sender As Object, e As GridViewPageEventArgs) Handles grdPosts.PageIndexChanging
grdPosts.PageIndex = e.NewPageIndex
GetPosts()
End Sub

End Class
6 changes: 3 additions & 3 deletions Server/Blog/My Project/AssemblyInfo.vb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Imports System.Runtime.InteropServices
<Assembly: AssemblyDescription("The DotNetNuke Blog module is an easy to use content publishing module that is tightly integrated with the core DotNetNuke framework. It can be used in single or multi-author environments and also permits content authoring using off-site tools such as Windows Live Writer.")>
<Assembly: AssemblyCompany("DNN Connect")>
<Assembly: AssemblyProduct("http://www.dotnetnuke.com")>
<Assembly: AssemblyCopyright("Copyright 2021 by DNN Connect")>
<Assembly: AssemblyCopyright("Copyright 2022 by DNN Connect")>
<Assembly: AssemblyTrademark("DotNetNuke")>

' Version information for an assembly consists of the following four values:
Expand All @@ -44,8 +44,8 @@ Imports System.Runtime.InteropServices
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:

<Assembly: AssemblyVersion("6.5.2")>
<Assembly: AssemblyVersion("6.5.3")>

<Assembly: Guid("49cae2ac-30c7-45fe-8663-948e1543d8d3")>
<Assembly: AssemblyInformationalVersion("06.04.01")>
<Assembly: AssemblyFileVersion("6.5.2")>
<Assembly: AssemblyFileVersion("6.5.3")>
6 changes: 3 additions & 3 deletions Server/OpenUrlRewriter/My Project/AssemblyInfo.vb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Imports System.Runtime.InteropServices
<Assembly: AssemblyDescription("The DotNetNuke Blog module is an easy to use content publishing module that is tightly integrated with the core DotNetNuke framework. It can be used in single or multi-author environments and also permits content authoring using off-site tools such as Windows Live Writer.")>
<Assembly: AssemblyCompany("DNN Connect")>
<Assembly: AssemblyProduct("OpenUrlRewriterDNNBlogProvider")>
<Assembly: AssemblyCopyright("Copyright 2021 by DNN Connect")>
<Assembly: AssemblyCopyright("Copyright 2022 by DNN Connect")>
<Assembly: AssemblyTrademark("")>

<Assembly: ComVisible(False)>
Expand All @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>

<Assembly: AssemblyVersion("6.5.2")>
<Assembly: AssemblyFileVersion("6.5.2")>
<Assembly: AssemblyVersion("6.5.3")>
<Assembly: AssemblyFileVersion("6.5.3")>
116 changes: 0 additions & 116 deletions build.cake

This file was deleted.

Loading

0 comments on commit 88408f9

Please sign in to comment.