Skip to content

Commit ab7d999

Browse files
committed
Merge branch 'dev' into issues/localization-for-advanced-search-1340
2 parents 68d5951 + 553fabd commit ab7d999

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+438
-310
lines changed

Dnn.CommunityForums/App_LocalResources/LegacyTokenResources.resx

+3
Original file line numberDiff line numberDiff line change
@@ -417,4 +417,7 @@
417417
<data name="[LIKESx3].Text" xml:space="preserve">
418418
<value>&lt;i id="af-topicview-likes-[FORUMPOST:CONTENTID]" class="fa [FORUMPOST:ISLIKED|fa-thumbs-o-up|fa-thumbs-up] fa-3x" style="cursor: pointer" onclick="{0}"&gt; [FORUMPOST:LIKECOUNT]&lt;/i&gt;|&lt;i id="af-topicview-likes" class="fa [FORUMPOST:ISLIKED|fa-thumbs-o-up|fa-thumbs-up] fa-2x"&gt; [FORUMPOST:LIKECOUNT]&lt;/i&gt;</value>
419419
</data>
420+
<data name="[SUBJECTLINK].Text" xml:space="preserve">
421+
<value>&lt;a href="{0}" class="dcf-topic-link"&gt;[FORUMTOPIC:SUBJECT]&lt;/a&gt;</value>
422+
</data>
420423
</root>

Dnn.CommunityForums/Controllers/ForumUserController.cs

+34-26
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,18 @@
2222

2323
namespace DotNetNuke.Modules.ActiveForums.Controllers
2424
{
25-
using DotNetNuke.Data;
26-
using DotNetNuke.Entities.Portals;
27-
using DotNetNuke.Entities.Users;
28-
using DotNetNuke.Services.Journal;
29-
using DotNetNuke.Services.Log.EventLog;
30-
using DotNetNuke.Services.Social.Notifications;
31-
using DotNetNuke.UI.UserControls;
3225
using System;
3326
using System.Linq;
3427
using System.Text;
3528
using System.Threading;
3629
using System.Web;
3730

31+
using DotNetNuke.Data;
32+
using DotNetNuke.Entities.Portals;
33+
using DotNetNuke.Entities.Users;
34+
using DotNetNuke.Services.Journal;
35+
using DotNetNuke.Services.Log.EventLog;
36+
3837
internal class ForumUserController : DotNetNuke.Modules.ActiveForums.Controllers.RepositoryControllerBase<DotNetNuke.Modules.ActiveForums.Entities.ForumUserInfo>
3938
{
4039
private readonly int moduleId = -1;
@@ -227,7 +226,7 @@ public bool GetUserIsSuperUser(int portalId, int moduleId, int userId)
227226
return this.GetByUserId(portalId, userId).IsSuperUser;
228227
}
229228

230-
private struct JournalContentForUser
229+
private class JournalContentForUser
231230
{
232231
internal int ForumId { get; set; }
233232

@@ -250,28 +249,29 @@ internal static void BanUser(int portalId, int tabId, int moduleId, string modul
250249
string sSubject = string.Empty;
251250
if (replyId > 0)
252251
{
253-
DotNetNuke.Modules.ActiveForums.Entities.ReplyInfo reply = new DotNetNuke.Modules.ActiveForums.Controllers.ReplyController(moduleId).GetById(replyId);
252+
var reply = new DotNetNuke.Modules.ActiveForums.Controllers.ReplyController(moduleId).GetById(replyId);
254253
sBody = reply.Content.Body;
255254
sSubject = reply.Content.Subject;
256255
authorName = reply.Author.DisplayName;
257256
}
258257
else
259258
{
260-
DotNetNuke.Modules.ActiveForums.Entities.TopicInfo topic = new DotNetNuke.Modules.ActiveForums.Controllers.TopicController(moduleId).GetById(topicId);
259+
var topic = new DotNetNuke.Modules.ActiveForums.Controllers.TopicController(moduleId).GetById(topicId);
261260
sBody = topic.Content.Body;
262261
sSubject = topic.Content.Subject;
263262
authorName = topic.Author.DisplayName;
264263
}
264+
265265
string notificationSubject = Utilities.GetSharedResource("[RESX:BanAlertSubject]");
266-
notificationSubject = notificationSubject.Replace("[Username]", bannedUser.Username);
267-
notificationSubject = notificationSubject.Replace("[DisplayName]", bannedUser.DisplayName);
266+
notificationSubject = notificationSubject.Replace("[Username]", bannedUser == null ? string.Concat(Utilities.GetSharedResource("[RESX:DeletedUser]"), "(", authorId, ")") : bannedUser.Username);
267+
notificationSubject = notificationSubject.Replace("[DisplayName]", bannedUser == null ? string.Concat(Utilities.GetSharedResource("[RESX:DeletedUser]"), "(", authorId, ")") : bannedUser.DisplayName);
268268
notificationSubject = notificationSubject.Replace("[BannedBy]", bannedBy.DisplayName);
269269
string body = Utilities.GetSharedResource("[RESX:BanAlertBody]");
270270
body = body.Replace("[Subject]", sSubject);
271271

272-
StringBuilder postsRemoved = new StringBuilder();
272+
var postsRemoved = new StringBuilder();
273273

274-
var contentForBannedUser = DataContext.Instance().ExecuteQuery<JournalContentForUser>(System.Data.CommandType.StoredProcedure, "{databaseOwner}{objectQualifier}activeforums_Content_GetJournalKeysForUser", bannedUser.UserID, moduleId).ToList();
274+
var contentForBannedUser = DataContext.Instance().ExecuteQuery<JournalContentForUser>(System.Data.CommandType.StoredProcedure, "{databaseOwner}{objectQualifier}activeforums_Content_GetJournalKeysForUser", authorId, moduleId).ToList();
275275
string objectKey;
276276
contentForBannedUser.ForEach(c =>
277277
{
@@ -280,31 +280,39 @@ internal static void BanUser(int portalId, int tabId, int moduleId, string modul
280280
{
281281
JournalController.Instance.DeleteJournalItemByKey(portalId, objectKey);
282282
}
283+
283284
postsRemoved.AppendLine($"{Utilities.GetUserFriendlyDateTimeString(c.DateUpdated, moduleId, bannedBy)}\t{c.Subject}");
284285
DotNetNuke.Modules.ActiveForums.Controllers.ModerationController.RemoveModerationNotifications(tabId, moduleId, c.ForumId, c.TopicId, c.ReplyId);
285286
});
286287
body = body.Replace("[PostsRemoved]", postsRemoved.ToString());
287288

288-
Notification notification = new Notification();
289-
notification.NotificationTypeID = NotificationsController.Instance.GetNotificationType(Globals.BanUserNotificationType).NotificationTypeId;
290-
notification.Subject = notificationSubject;
291-
notification.Body = body;
292-
notification.IncludeDismissAction = true;
293-
notification.SenderUserID = bannedBy.UserID;
294-
notification.Context = DotNetNuke.Modules.ActiveForums.Controllers.ModerationController.BuildNotificationContextKey(tabId, moduleId, forumId, topicId, replyId);
289+
var notification = new DotNetNuke.Services.Social.Notifications.Notification
290+
{
291+
NotificationTypeID = DotNetNuke.Services.Social.Notifications.NotificationsController.Instance.GetNotificationType(Globals.BanUserNotificationType).NotificationTypeId,
292+
Subject = notificationSubject,
293+
Body = body,
294+
IncludeDismissAction = true,
295+
SenderUserID = bannedBy.UserID,
296+
Context = DotNetNuke.Modules.ActiveForums.Controllers.ModerationController.BuildNotificationContextKey(tabId, moduleId, forumId, topicId, replyId),
297+
};
295298

296299
var modRoles = DotNetNuke.Modules.ActiveForums.Controllers.ModerationController.GetModeratorRoles(portalId, moduleId, forumId);
297-
NotificationsController.Instance.SendNotification(notification, portalId, modRoles, null);
300+
DotNetNuke.Services.Social.Notifications.NotificationsController.Instance.SendNotification(notification, portalId, modRoles, null);
298301

299302
var log = new DotNetNuke.Services.Log.EventLog.LogInfo { LogTypeKey = DotNetNuke.Abstractions.Logging.EventLogType.ADMIN_ALERT.ToString() };
300303
log.LogProperties.Add(new LogDetailInfo("Module", moduleTitle));
301-
string userBannedMsg = String.Format(Utilities.GetSharedResource("[RESX:UserBanned]"), bannedUser.Username);
304+
string userBannedMsg = string.Format(Utilities.GetSharedResource("[RESX:UserBanned]"), bannedUser == null ? string.Concat(Utilities.GetSharedResource("[RESX:DeletedUser]"), "(", authorId, ")") : bannedUser.Username);
302305
log.AddProperty("Message", userBannedMsg);
303306
DotNetNuke.Services.Log.EventLog.LogController.Instance.AddLog(log);
304307

305-
DotNetNuke.Modules.ActiveForums.DataProvider.Instance().Topics_Delete_For_User(moduleId: moduleId, userId: bannedUser.UserID, delBehavior: SettingsBase.GetModuleSettings(moduleId).DeleteBehavior);
306-
bannedUser.Membership.Approved = false;
307-
DotNetNuke.Entities.Users.UserController.UpdateUser(portalId: portalId, user: bannedUser, loggedAction: true);
308+
DotNetNuke.Modules.ActiveForums.DataProvider.Instance().Topics_Delete_For_User(moduleId: moduleId, userId: authorId, delBehavior: SettingsBase.GetModuleSettings(moduleId).DeleteBehavior);
309+
310+
if (bannedUser != null)
311+
{
312+
bannedUser.Membership.Approved = false;
313+
DotNetNuke.Entities.Users.UserController.UpdateUser(portalId: portalId, user: bannedUser, loggedAction: true);
314+
}
315+
308316
DataCache.ClearAllCache(moduleId);
309317
}
310318
}

Dnn.CommunityForums/Controllers/UrlController.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ internal static class UrlController
2828
internal static string BuildTopicUrlSegment(int portalId, int moduleId, int topicId, string subject, DotNetNuke.Modules.ActiveForums.Entities.ForumInfo forumInfo)
2929
{
3030
var cleanSubject = Utilities.CleanName(subject).ToLowerInvariant();
31-
if (SimulateIsNumeric.IsNumeric(cleanSubject))
31+
if (Utilities.IsNumeric(cleanSubject))
3232
{
3333
cleanSubject = "Topic-" + cleanSubject;
3434
}

Dnn.CommunityForums/CustomControls/ServerControls/ActiveGrid.cs

+5-8
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ namespace DotNetNuke.Modules.ActiveForums.Controls
3030
using System.Web.UI;
3131
using System.Web.UI.Design;
3232
using System.Web.UI.WebControls;
33+
using DotNetNuke.Web.Client.ClientResourceManagement;
3334

3435
[DefaultProperty("Text"), Designer("DotNetNuke.Modules.ActiveForums.Controls.ActiveGridDesigner"), ToolboxData("<{0}:activegrid runat=server><headertemplate></headertemplate><itemtemplate></itemtemplate><footertemplate></footertemplate></{0}:activegrid>")]
3536
public class ActiveGrid : CompositeControl
@@ -567,17 +568,17 @@ protected override void Render(HtmlTextWriter output)
567568
str.Append("window." + this.ClientID + "=new ActiveGrid('" + this.ClientID + "');");
568569
if (this.SpacerImage == string.Empty)
569570
{
570-
this.SpacerImage = this.Page.ClientScript.GetWebResourceUrl(this.GetType(), "DotNetNuke.Modules.ActiveForums.CustomControls.Resources.spacer.gif");
571+
this.SpacerImage = this.Page.ResolveUrl(Globals.ModulePath + "/CustomControls/Resources/spacer.gif");
571572
}
572573

573574
if (this.AscImage == string.Empty)
574575
{
575-
this.AscImage = this.Page.ClientScript.GetWebResourceUrl(this.GetType(), "DotNetNuke.Modules.ActiveForums.CustomControls.Resources.asc.gif");
576+
this.ascImage = this.Page.ResolveUrl(Globals.ModulePath + "/CustomControls/Resources/asc.gif");
576577
}
577578

578579
if (this.DescImage == string.Empty)
579580
{
580-
this.DescImage = this.Page.ClientScript.GetWebResourceUrl(this.GetType(), "DotNetNuke.Modules.ActiveForums.CustomControls.Resources.desc.gif");
581+
this.DescImage = this.Page.ResolveUrl(Globals.ModulePath + "/CustomControls/Resources/desc.gif");
581582
}
582583

583584
str.Append("window." + this.ClientID + ".SpacerImage='" + this.SpacerImage + "';");
@@ -715,11 +716,7 @@ protected virtual void OnCallback(CallBackEventArgs e)
715716
protected override void OnLoad(EventArgs e)
716717
{
717718
base.OnLoad(e);
718-
719-
if (!this.Page.ClientScript.IsClientScriptIncludeRegistered("AMActiveGrid"))
720-
{
721-
this.Page.ClientScript.RegisterClientScriptInclude("AMActiveGrid", this.Page.ClientScript.GetWebResourceUrl(this.GetType(), "DotNetNuke.Modules.ActiveForums.CustomControls.Resources.ActiveGrid.js"));
722-
}
719+
ClientResourceManager.RegisterScript(this.Page, Globals.ModulePath + "customcontrols/resources/ActiveGrid.js", 102);
723720
}
724721
#endregion
725722

Dnn.CommunityForums/CustomControls/ServerControls/Callback.cs

+28-29
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1919
// DEALINGS IN THE SOFTWARE.
2020

21+
using DotNetNuke.Web.Client.ClientResourceManagement;
22+
2123
namespace DotNetNuke.Modules.ActiveForums.Controls
2224
{
2325
using System;
@@ -546,43 +548,40 @@ protected override void OnLoad(EventArgs e)
546548
{
547549
base.OnLoad(e);
548550

549-
if (!this.Page.ClientScript.IsClientScriptIncludeRegistered("AMCallback"))
551+
bool cbloaded = false;
552+
if (HttpContext.Current.Items["cbld"] != null)
550553
{
551-
bool cbloaded = false;
552-
if (HttpContext.Current.Items["cbld"] != null)
553-
{
554-
cbloaded = bool.Parse(HttpContext.Current.Items["cbld"].ToString());
555-
}
554+
cbloaded = bool.Parse(HttpContext.Current.Items["cbld"].ToString());
555+
}
556556

557-
if (!this.IsCallback && !this.Page.IsPostBack)
557+
if (!this.IsCallback && !this.Page.IsPostBack)
558+
{
559+
if (cbloaded == false && HttpContext.Current.Request.Params["hidreq"] == null)
558560
{
559-
if (cbloaded == false && HttpContext.Current.Request.Params["hidreq"] == null)
561+
DotNetNuke.Security.PortalSecurity dnn = new DotNetNuke.Security.PortalSecurity();
562+
string ticket = dnn.Encrypt("afexp41", HttpContext.Current.Session.SessionID);
563+
564+
HttpCookie myCookie = new HttpCookie("amcit");
565+
if (HttpContext.Current.Request.Cookies["amcit"] != null)
560566
{
561-
DotNetNuke.Security.PortalSecurity dnn = new DotNetNuke.Security.PortalSecurity();
562-
string ticket = dnn.Encrypt("afexp41", HttpContext.Current.Session.SessionID);
567+
HttpContext.Current.Response.Cookies["amcit"].Value = string.Empty;
568+
HttpContext.Current.Response.Cookies["amcit"].Expires = DateTime.UtcNow.AddYears(-1);
569+
HttpContext.Current.Response.Cookies["amcit"].Domain = string.Empty;
570+
HttpContext.Current.Response.Cookies["amcit"].HttpOnly = true;
571+
}
563572

564-
HttpCookie myCookie = new HttpCookie("amcit");
565-
if (HttpContext.Current.Request.Cookies["amcit"] != null)
566-
{
567-
HttpContext.Current.Response.Cookies["amcit"].Value = string.Empty;
568-
HttpContext.Current.Response.Cookies["amcit"].Expires = DateTime.UtcNow.AddYears(-1);
569-
HttpContext.Current.Response.Cookies["amcit"].Domain = string.Empty;
570-
HttpContext.Current.Response.Cookies["amcit"].HttpOnly = true;
571-
}
573+
myCookie.HttpOnly = true;
572574

573-
myCookie.HttpOnly = true;
575+
// myCookie.Path = "/"
576+
// myCookie.Domain = HttpContext.Current.Request.Url.Host
577+
myCookie.Expires = DateTime.UtcNow.AddHours(2);
578+
myCookie.Value = ticket;
579+
HttpContext.Current.Response.Cookies.Add(myCookie);
580+
this.Page.ClientScript.RegisterHiddenField("amcbid", ticket);
581+
HttpContext.Current.Items.Add("cbld", "True");
574582

575-
// myCookie.Path = "/"
576-
// myCookie.Domain = HttpContext.Current.Request.Url.Host
577-
myCookie.Expires = DateTime.UtcNow.AddHours(2);
578-
myCookie.Value = ticket;
579-
HttpContext.Current.Response.Cookies.Add(myCookie);
580-
this.Page.ClientScript.RegisterHiddenField("amcbid", ticket);
581-
HttpContext.Current.Items.Add("cbld", "True");
582-
}
583+
ClientResourceManager.RegisterScript(this.Page, Globals.ModulePath + "customcontrols/resources/cb.js", 102);
583584
}
584-
585-
this.Page.ClientScript.RegisterClientScriptInclude("AMCallback", this.Page.ClientScript.GetWebResourceUrl(this.GetType(), "DotNetNuke.Modules.ActiveForums.CustomControls.Resources.cb.js"));
586585
}
587586
}
588587
#endregion

Dnn.CommunityForums/CustomControls/ServerControls/CategoryNavigator.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ protected override void Render(HtmlTextWriter writer)
176176
tb.HeaderTemplate = this.HeaderTemplate.Text;
177177
tb.FooterTemplate = this.FooterTemplate.Text;
178178
tb.CSSClass = this.CssClass;
179-
if (HttpContext.Current.Request.QueryString[ParamKeys.Category] != null && SimulateIsNumeric.IsNumeric(HttpContext.Current.Request.QueryString[ParamKeys.Category]))
179+
if (HttpContext.Current.Request.QueryString[ParamKeys.Category] != null && Utilities.IsNumeric(HttpContext.Current.Request.QueryString[ParamKeys.Category]))
180180
{
181181
tb.SelectedCategory = int.Parse(HttpContext.Current.Request.QueryString[ParamKeys.Category]);
182182
}

Dnn.CommunityForums/CustomControls/ServerControls/DatePicker.cs

+6-14
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ namespace DotNetNuke.Modules.ActiveForums.Controls
2626
using System.Threading;
2727
using System.Web.UI;
2828
using System.Web.UI.WebControls;
29+
using DotNetNuke.Web.Client.ClientResourceManagement;
2930

3031
[DefaultProperty("Text"), ValidationProperty("SelectedDate"), ToolboxData("<{0}:datepicker runat=server></{0}:datepicker>")]
3132
public class DatePicker : CompositeControl
@@ -535,7 +536,7 @@ protected override void Render(HtmlTextWriter writer)
535536
writer.RenderBeginTag(HtmlTextWriterTag.Td);
536537
if (this.ImageUrl == string.Empty)
537538
{
538-
this.ImageUrl = this.Page.ClientScript.GetWebResourceUrl(this.GetType(), "DotNetNuke.Modules.ActiveForums.CustomControls.Resources.calendar.gif");
539+
this.ImageUrl = this.Page.ResolveUrl(Globals.ModulePath + "/CustomControls/Resources/calendar.gif");
539540
}
540541

541542
if (this.Enabled)
@@ -631,7 +632,7 @@ protected override void Render(HtmlTextWriter writer)
631632
str.Append("window." + this.ClientID + ".SelectedTime='" + sTime + "';");
632633
if (string.IsNullOrEmpty(this.ImgNext))
633634
{
634-
str.Append("window." + this.ClientID + ".ImgNext='" + this.Page.ClientScript.GetWebResourceUrl(this.GetType(), "DotNetNuke.Modules.ActiveForums.CustomControls.Resources.cal_nextMonth.gif") + "';");
635+
str.Append("window." + this.ClientID + ".ImgNext='" + this.Page.ResolveUrl(Globals.ModulePath + "/CustomControls/Resources/cal_nextMonth.gif") + "';");
635636
}
636637
else
637638
{
@@ -640,7 +641,8 @@ protected override void Render(HtmlTextWriter writer)
640641

641642
if (string.IsNullOrEmpty(this.ImgPrev))
642643
{
643-
str.Append("window." + this.ClientID + ".ImgPrev='" + this.Page.ClientScript.GetWebResourceUrl(this.GetType(), "DotNetNuke.Modules.ActiveForums.CustomControls.Resources.cal_prevMonth.gif") + "';");
644+
645+
str.Append("window." + this.ClientID + ".ImgPrev='" + this.Page.ResolveUrl(Globals.ModulePath + "/CustomControls/Resources/cal_prevMonth.gif") + "';");
644646
}
645647
else
646648
{
@@ -754,17 +756,7 @@ protected override void OnInit(EventArgs e)
754756
protected override void OnLoad(EventArgs e)
755757
{
756758
base.OnLoad(e);
757-
758-
if (!this.Page.ClientScript.IsClientScriptIncludeRegistered("AMDatePicker"))
759-
{
760-
#if DEBUG
761-
this.Page.ClientScript.RegisterClientScriptInclude("AMDatePicker", this.Page.ResolveUrl("~/DesktopModules/activeforums/customcontrols/resources/datepicker.js"));
762-
763-
#else
764-
this.Page.ClientScript.RegisterClientScriptInclude("AMDatePicker", this.Page.ClientScript.GetWebResourceUrl(this.GetType(), "DotNetNuke.Modules.ActiveForums.CustomControls.Resources.datepicker.js"));
765-
#endif
766-
767-
}
759+
ClientResourceManager.RegisterScript(this.Page, Globals.ModulePath + "customcontrols/resources/datepicker.js", 102);
768760

769761
try
770762
{

0 commit comments

Comments
 (0)