Skip to content

Commit

Permalink
Merge pull request #956 from DNNCommunity/dev
Browse files Browse the repository at this point in the history
Sync master and dev
  • Loading branch information
WillStrohl authored Jul 2, 2024
2 parents fc95b84 + 870a538 commit 403a180
Show file tree
Hide file tree
Showing 36 changed files with 776 additions and 114 deletions.
26 changes: 13 additions & 13 deletions Dnn.CommunityForums/Controllers/ModerationController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//
//
// Community Forums
// Copyright (c) 2013-2024
// by DNN Community
Expand Down Expand Up @@ -51,23 +51,23 @@ internal static bool SendModerationNotification(int PortalId, int TabId, int Mod
{
DotNetNuke.Modules.ActiveForums.Entities.ReplyInfo reply = new DotNetNuke.Modules.ActiveForums.Controllers.ReplyController().GetById(ReplyId);
subject = Utilities.GetSharedResource("NotificationSubjectReply");
subject = subject.Replace("[DisplayName]", reply.Content.AuthorName);
subject = subject.Replace("[TopicSubject]", reply.Topic.Content.Subject);
subject = subject.Replace("[DisplayName]", reply.Content?.AuthorName);
subject = subject.Replace("[TopicSubject]", reply.Topic?.Content.Subject);
body = Utilities.GetSharedResource("NotificationBodyReply");
body = body.Replace("[DisplayName]", reply.Content.AuthorName);
body = body.Replace("[TopicSubject]", reply.Content.Subject);
body = body.Replace("[DisplayName]", reply.Content?.AuthorName);
body = body.Replace("[TopicSubject]", reply.Content?.Subject);
authorId = reply.Content.AuthorId;
}
else
{
DotNetNuke.Modules.ActiveForums.Entities.ReplyInfo reply = new DotNetNuke.Modules.ActiveForums.Controllers.ReplyController().GetById(ReplyId);
subject = Utilities.GetSharedResource("NotificationSubjectReply");
subject = subject.Replace("[DisplayName]", reply.Content.AuthorName);
subject = subject.Replace("[TopicSubject]", reply.Topic.Content.Subject);
body = Utilities.GetSharedResource("NotificationBodyReply");
body = body.Replace("[DisplayName]", reply.Content.AuthorName);
body = body.Replace("[TopicSubject]", reply.Content.Subject);
authorId = reply.Content.AuthorId;
DotNetNuke.Modules.ActiveForums.Entities.TopicInfo topic = new DotNetNuke.Modules.ActiveForums.Controllers.TopicController().GetById(TopicId);
subject = Utilities.GetSharedResource("NotificationSubjectTopic");
subject = subject.Replace("[DisplayName]", topic.Content?.AuthorName);
subject = subject.Replace("[TopicSubject]", topic.Content?.Subject);
body = Utilities.GetSharedResource("NotificationBodyTopic");
body = body.Replace("[DisplayName]", topic.Content?.AuthorName);
body = body.Replace("[TopicSubject]", topic.Content?.Subject);
authorId = topic.Content.AuthorId;
}
string modLink = Utilities.NavigateURL(TabId, string.Empty, new[] { $"{ParamKeys.ViewType}={Views.ModerateTopics}", $"{ParamKeys.ForumId}={ForumId}" });
body = body.Replace("[MODLINK]", modLink);
Expand Down
10 changes: 6 additions & 4 deletions Dnn.CommunityForums/CustomControls/HTML/TopicBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,9 @@ private string ParseDataRow(IDataRecord row, string tmp)
if (int.Parse(row["LastAuthorId"].ToString()) == -1)
{
try
{
tmp = tmp.Replace("[LASTAUTHOR]", UserProfiles.GetDisplayName(ModuleId, true, ForumUser.Profile.IsMod, ForumUser.IsAdmin || ForumUser.IsSuperUser, -1, auth.Username, auth.FirstName, auth.LastName, auth.DisplayName));
{
DotNetNuke.Entities.Portals.PortalSettings portalSettings = Utilities.GetPortalSettings(PortalId);
tmp = tmp.Replace("[LASTAUTHOR]", UserProfiles.GetDisplayName(portalSettings, ModuleId, true, ForumUser.Profile.IsMod, ForumUser.IsAdmin || ForumUser.IsSuperUser, -1, auth.Username, auth.FirstName, auth.LastName, auth.DisplayName));
}
catch (Exception ex)
{
Expand All @@ -404,8 +405,9 @@ private string ParseDataRow(IDataRecord row, string tmp)

}
else
{
tmp = tmp.Replace("[LASTAUTHOR]", UserProfiles.GetDisplayName(ModuleId, true, ForumUser.Profile.IsMod, ForumUser.IsAdmin || ForumUser.IsSuperUser, int.Parse(row["LastAuthorId"].ToString()), auth.Username, auth.FirstName, auth.LastName, auth.DisplayName));
{
DotNetNuke.Entities.Portals.PortalSettings portalSettings = Utilities.GetPortalSettings(PortalId);
tmp = tmp.Replace("[LASTAUTHOR]", UserProfiles.GetDisplayName(portalSettings, ModuleId, true, ForumUser.Profile.IsMod, ForumUser.IsAdmin || ForumUser.IsSuperUser, int.Parse(row["LastAuthorId"].ToString()), auth.Username, auth.FirstName, auth.LastName, auth.DisplayName));
}

if (_canEdit)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ private string ParseForumRow(string Template, DotNetNuke.Modules.ActiveForums.En
{
bool isMod = CurrentUserType == CurrentUserTypes.Admin || CurrentUserType == CurrentUserTypes.ForumMod || CurrentUserType == CurrentUserTypes.SuperUser;
bool isAdmin = CurrentUserType == CurrentUserTypes.Admin || CurrentUserType == CurrentUserTypes.SuperUser;
Template = Template.Replace("[DISPLAYNAME]", "<i class=\"fa fa-user fa-fw fa-blue\"></i>&nbsp;" + UserProfiles.GetDisplayName(ForumModuleId, true, isMod, isAdmin, fi.LastPostUserID, fi.LastPostUserName, fi.LastPostFirstName, fi.LastPostLastName, fi.LastPostDisplayName));
Template = Template.Replace("[DISPLAYNAME]", "<i class=\"fa fa-user fa-fw fa-blue\"></i>&nbsp;" + UserProfiles.GetDisplayName(PortalSettings, ForumModuleId, true, isMod, isAdmin, fi.LastPostUserID, fi.LastPostUserName, fi.LastPostFirstName, fi.LastPostLastName, fi.LastPostDisplayName));
}
DateTime dtLastPostDate = fi.LastPostDateTime;
Template = Template.Replace("[LASTPOSTDATE]", Utilities.GetUserFormattedDateTime(dtLastPostDate,PortalId, CurrentUserId));
Expand Down
13 changes: 8 additions & 5 deletions Dnn.CommunityForums/CustomControls/UserControls/TopicView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,12 @@ private void LoadData(int pageId)

// Get our Row Index
_rowIndex = (pageId - 1) * _pageSize;
DataSet ds = (DataSet)DataCache.ContentCacheRetrieve(ForumModuleId, string.Format(CacheKeys.TopicViewForUser, ModuleId, TopicId, UserId, HttpContext.Current?.Response?.Cookies["language"]?.Value));
string cacheKey = string.Format(CacheKeys.TopicViewForUser, ModuleId, TopicId, UserId, HttpContext.Current?.Response?.Cookies["language"]?.Value, _rowIndex, _pageSize);
DataSet ds = (DataSet)DataCache.ContentCacheRetrieve(ForumModuleId, cacheKey);
if (ds == null)
{
ds = DataProvider.Instance().UI_TopicView(PortalId, ForumModuleId, ForumId, TopicId, UserId, _rowIndex, _pageSize, UserInfo.IsSuperUser, _defaultSort);
DataCache.ContentCacheStore(ModuleId, string.Format(CacheKeys.TopicViewForUser, ModuleId, TopicId, UserId, HttpContext.Current?.Response?.Cookies["language"]?.Value), ds); ;
DataCache.ContentCacheStore(ModuleId, cacheKey, ds); ;
}
// Test for a proper dataset
if (ds.Tables.Count < 4 || ds.Tables[0].Rows.Count == 0 || ds.Tables[1].Rows.Count == 0)
Expand Down Expand Up @@ -991,12 +992,14 @@ private string ParseControls(string sOutput)
// View Count
sbOutput.Replace("[VIEWCOUNT]", _viewCount.ToString());


DotNetNuke.Entities.Portals.PortalSettings portalSettings = Utilities.GetPortalSettings(PortalId);
// Last Post
sbOutput.Replace("[AF:LABEL:LastPostDate]", _lastPostDate);
sbOutput.Replace("[AF:LABEL:LastPostAuthor]", UserProfiles.GetDisplayName(ForumModuleId, true, _bModApprove, ForumUser.IsAdmin || ForumUser.IsSuperUser, _lastPostAuthor.AuthorId, _lastPostAuthor.Username, _lastPostAuthor.FirstName, _lastPostAuthor.LastName, _lastPostAuthor.DisplayName));
sbOutput.Replace("[AF:LABEL:LastPostAuthor]", UserProfiles.GetDisplayName(portalSettings, ForumModuleId, true, _bModApprove, ForumUser.IsAdmin || ForumUser.IsSuperUser, _lastPostAuthor.AuthorId, _lastPostAuthor.Username, _lastPostAuthor.FirstName, _lastPostAuthor.LastName, _lastPostAuthor.DisplayName));

// Topic Info
sbOutput.Replace("[AF:LABEL:TopicAuthor]", UserProfiles.GetDisplayName(ForumModuleId, _topicAuthorId, _topicAuthorDisplayName, string.Empty, string.Empty, _topicAuthorDisplayName));
sbOutput.Replace("[AF:LABEL:TopicAuthor]", UserProfiles.GetDisplayName(portalSettings, ForumModuleId, false, false, false, _topicAuthorId, _topicAuthorDisplayName, string.Empty, string.Empty, _topicAuthorDisplayName));
sbOutput.Replace("[AF:LABEL:TopicDateCreated]", _topicDateCreated);


Expand Down Expand Up @@ -1443,7 +1446,7 @@ private string ParseContent(DataRow dr, string tempate, int rowcount)
else
{
// Not Answered
if ((UserId == _topicAuthorId && !_bLocked) || _bModEdit)
if (replyId > 0 && ((UserId == _topicAuthorId && !_bLocked) || _bModEdit))
{
// Can mark answer
if (_useListActions)
Expand Down
9 changes: 5 additions & 4 deletions Dnn.CommunityForums/CustomControls/UserControls/TopicsView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,12 @@ protected override void OnLoad(EventArgs e)
TopicsTemplate = TopicsTemplate.Replace("[AF:SORT:REPLYCREATED]", string.Empty);
if (TopicsTemplate.Contains("[TOPICS]"))
{
DataSet ds = (DataSet)DataCache.ContentCacheRetrieve(ForumModuleId, string.Format(CacheKeys.TopicsViewForUser, ModuleId, ForumId, UserId, HttpContext.Current?.Response?.Cookies["language"]?.Value));
string cacheKey = string.Format(CacheKeys.TopicsViewForUser, ModuleId, ForumId, UserId, HttpContext.Current?.Response?.Cookies["language"]?.Value, RowIndex, PageSize);
DataSet ds = (DataSet)DataCache.ContentCacheRetrieve(ForumModuleId, cacheKey);
if (ds == null)
{
ds = DataProvider.Instance().UI_TopicsView(PortalId, ForumModuleId, ForumId, UserId, RowIndex, PageSize, UserInfo.IsSuperUser, sort);
DataCache.ContentCacheStore(ModuleId, string.Format(CacheKeys.TopicsViewForUser, ModuleId,ForumId, UserId, HttpContext.Current?.Response?.Cookies["language"]?.Value), ds);
DataCache.ContentCacheStore(ModuleId, cacheKey, ds);
}
if (ds.Tables.Count > 0)
{
Expand Down Expand Up @@ -947,7 +948,7 @@ private string ParseTopics(string Template, DataTable Topics, string Section)
sTopicsTemplate = sTopicsTemplate.Replace("[SUBJECT]", Subject + sPollImage);
sTopicsTemplate = sTopicsTemplate.Replace("[SUBJECTLINK]", GetTopic(TabId, ForumId, TopicId, Subject, sBodyTitle, UserId, AuthorId, ReplyCount, -1, sTopicURL) + sPollImage);

var displayName = UserProfiles.GetDisplayName(ForumModuleId, true, bModApprove, ForumUser.IsAdmin || ForumUser.IsSuperUser, AuthorId, AuthorUserName, AuthorFirstName, AuthorLastName, AuthorDisplayName).ToString().Replace("&amp;#", "&#");
var displayName = UserProfiles.GetDisplayName(PortalSettings, ForumModuleId, true, bModApprove, ForumUser.IsAdmin || ForumUser.IsSuperUser, AuthorId, AuthorUserName, AuthorFirstName, AuthorLastName, AuthorDisplayName).ToString().Replace("&amp;#", "&#");
if (Utilities.StripHTMLTag(displayName) == Utilities.GetSharedResource("[RESX:Anonymous]"))
{
displayName = displayName.Replace(Utilities.GetSharedResource("[RESX:Anonymous]"), AuthorName);
Expand Down Expand Up @@ -1013,7 +1014,7 @@ private string ParseTopics(string Template, DataTable Topics, string Section)
//sLastReplyTemp = sLastReplyTemp.Replace("[RESX:BY]", Utilities.GetSharedResource("By.Text"))
if (LastReplyAuthorId > 0)
{
sLastReplyTemp = sLastReplyTemp.Replace("[LASTPOSTDISPLAYNAME]", UserProfiles.GetDisplayName(ForumModuleId, true, bModApprove, ForumUser.IsAdmin || ForumUser.IsSuperUser, LastReplyAuthorId, LastReplyUserName, LastReplyFirstName, LastReplyLastName, LastReplyDisplayName).ToString().Replace("&amp;#", "&#"));
sLastReplyTemp = sLastReplyTemp.Replace("[LASTPOSTDISPLAYNAME]", UserProfiles.GetDisplayName(PortalSettings, ForumModuleId, true, bModApprove, ForumUser.IsAdmin || ForumUser.IsSuperUser, LastReplyAuthorId, LastReplyUserName, LastReplyFirstName, LastReplyLastName, LastReplyDisplayName).ToString().Replace("&amp;#", "&#"));
}
else
{
Expand Down
21 changes: 13 additions & 8 deletions Dnn.CommunityForums/DnnCommunityForums.dnn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dotnetnuke type="Package" version="5.0">
<packages>
<package name="Active Forums" type="Module" version="08.01.00">
<package name="Active Forums" type="Module" version="08.01.01">
<friendlyName>DNN Community Forums</friendlyName>
<description>DNN Community Forums: The official online forums module for the DNN Community.</description>
<iconFile>DesktopModules/ActiveForums/images/branding/logo/DNN-Community-Forums-Icon-64px.png</iconFile>
Expand Down Expand Up @@ -86,7 +86,7 @@
<assembly>
<name>DotNetNuke.Modules.ActiveForums.dll</name>
<sourceFileName>bin\DotNetNuke.Modules.ActiveForums.dll</sourceFileName>
<version>08.01.00</version>
<version>08.01.01</version>
</assembly>
</assemblies>
</component>
Expand Down Expand Up @@ -384,14 +384,19 @@
<name>08.01.00.SqlDataProvider</name>
<version>08.01.00</version>
</script>
<script type="Install">
<path>sql</path>
<name>08.01.01.SqlDataProvider</name>
<version>08.01.01</version>
</script>
<script type="UnInstall">
<path>sql</path>
<name>Uninstall.SqlDataProvider</name>
<version>08.01.00</version>
<version>08.01.01</version>
</script>
</scripts>
</component>

<component type="ResourceFile">
<resourceFiles>
<basePath>DesktopModules\ActiveForums</basePath>
Expand All @@ -401,7 +406,7 @@
</resourceFile>
</resourceFiles>
</component>

<component type="Config">
<config>
<configFile>web.config</configFile>
Expand All @@ -424,11 +429,11 @@
<component type="Cleanup" version="07.00.03" fileName="07.00.03.txt" />
<component type="Cleanup" version="07.00.11" fileName="07.00.11.txt" />
<component type="Cleanup" version="08.00.00" fileName="08.00.00.txt" />
<component type="Cleanup" version="08.01.00" fileName="08.01.00.txt" />
<component type="Cleanup" version="08.01.00" fileName="08.01.00.txt" />
</components>
</package>

<package name="Active Forums What's New" type="Module" version="08.01.00">
<package name="Active Forums What's New" type="Module" version="08.01.01">

<friendlyName>DNN Community Forums What's New</friendlyName>
<foldername>ActiveForumsWhatsNew</foldername>
Expand Down Expand Up @@ -498,7 +503,7 @@
</components>
</package>

<package name="Active Forums Viewer" type="Module" version="08.01.00">
<package name="Active Forums Viewer" type="Module" version="08.01.01">
<friendlyName>DNN Community Forums Forums Viewer</friendlyName>
<foldername>ActiveForumsViewer</foldername>
<description>DNN Community Forums: Display any forum topic view on any page within your site.</description>
Expand Down
4 changes: 2 additions & 2 deletions Dnn.CommunityForums/DnnCommunityForums_Symbols.dnn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dotnetnuke type="Package" version="5.0">
<packages>
<package name="Active Forums_Symbols" type="Library" version="08.01.00">
<package name="Active Forums_Symbols" type="Library" version="08.01.01">

<friendlyName>DNN Community Forums Symbols</friendlyName>
<description>DNN Community Forums: The official online forums module for the DNN Community.</description>
Expand All @@ -16,7 +16,7 @@
<azureCompatible>True</azureCompatible>
<dependencies>

<dependency type="managedPackage" version="8.1.0">Active Forums</dependency>
<dependency type="managedPackage" version="8.1.1">Active Forums</dependency>

</dependencies>
<components>
Expand Down
4 changes: 2 additions & 2 deletions Dnn.CommunityForums/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:

[assembly: AssemblyVersion("08.01.00")]
[assembly: AssemblyVersion("08.01.01")]

[assembly: AssemblyFileVersion("08.01.00")]
[assembly: AssemblyFileVersion("08.01.01")]


[assembly: WebResource("DotNetNuke.Modules.ActiveForums.CustomControls.Resources.cb.js", "text/javascript")]
Expand Down
Loading

0 comments on commit 403a180

Please sign in to comment.