Skip to content

Commit ee6115f

Browse files
committed
Merge branch 'dev' into issues/module-load-exceptions-1333
2 parents c444cfc + 3023e4e commit ee6115f

File tree

9 files changed

+474
-400
lines changed

9 files changed

+474
-400
lines changed

Dnn.CommunityForums/controls/af_post.ascx.cs

+27-21
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ private void PrepareReply()
531531
this.ctlForm.EditorMode = Modules.ActiveForums.Controls.SubmitForm.EditorModes.Reply;
532532

533533
string template = TemplateCache.GetCachedTemplate(this.ForumModuleId, "ReplyEditor", this.ForumInfo.FeatureSettings.ReplyFormId);
534-
534+
535535
#region "Backward compatilbility -- remove in v10.00.00"
536536
template = DotNetNuke.Modules.ActiveForums.Services.Tokens.TokenReplacer.MapLegacyAuthorTokenSynonyms(new StringBuilder(template), this.PortalSettings, this.MainSettings, this.ForumUser.UserInfo?.Profile?.PreferredLocale).ToString();
537537
template = DotNetNuke.Modules.ActiveForums.Services.Tokens.TokenReplacer.MapLegacyPostTokenSynonyms(new StringBuilder(template), this.PortalSettings, this.ForumUser.UserInfo?.Profile?.PreferredLocale).ToString();
@@ -569,11 +569,10 @@ private void PrepareReply()
569569
this.Response.Redirect(this.NavigateUrl(this.TabId), false);
570570
this.Context.ApplicationInstance.CompleteRequest();
571571
}
572-
else
573-
{
574-
this.ctlForm.Subject = Utilities.GetSharedResource("[RESX:SubjectPrefix]") + " " + System.Net.WebUtility.HtmlDecode(ti.Content.Subject);
575-
this.ctlForm.TopicSubject = System.Net.WebUtility.HtmlDecode(ti.Content.Subject);
576-
var body = string.Empty;
572+
573+
this.ctlForm.Subject = Utilities.GetSharedResource("[RESX:SubjectPrefix]") + " " + System.Net.WebUtility.HtmlDecode(ti.Content.Subject);
574+
this.ctlForm.TopicSubject = System.Net.WebUtility.HtmlDecode(ti.Content.Subject);
575+
var body = string.Empty;
577576

578577
if (ti.IsLocked && (this.ForumUser.CurrentUserType == CurrentUserTypes.Anon || this.ForumUser.CurrentUserType == CurrentUserTypes.Auth))
579578
{
@@ -586,7 +585,6 @@ private void PrepareReply()
586585
// Setup form for Quote or Reply with body display
587586
var isQuote = false;
588587
var postId = 0;
589-
var sPostedBy = Utilities.GetSharedResource("[RESX:PostedBy]") + " {0} {1} {2}";
590588
if (this.Request.Params[ParamKeys.QuoteId] != null)
591589
{
592590
isQuote = true;
@@ -610,19 +608,17 @@ private void PrepareReply()
610608
}
611609
}
612610

613-
if (postId != 0)
614-
{
615-
var post = postId == this.TopicId ? ti : (DotNetNuke.Modules.ActiveForums.Entities.IPostInfo)new DotNetNuke.Modules.ActiveForums.Controllers.ReplyController(this.ForumModuleId).GetById(postId);
616-
if (post != null)
617-
{
618-
sPostedBy = string.Format(sPostedBy, DotNetNuke.Modules.ActiveForums.Controllers.ForumUserController.GetDisplayName(this.PortalSettings, this.MainSettings, false, false, post.Author.AuthorId, post.Author.Username, post.Author.FirstName, post.Author.LastName, post.Author.DisplayName), Utilities.GetSharedResource("On.Text"), Utilities.GetUserFormattedDateTime(post.Content.DateCreated, this.PortalId, this.UserId));
619-
body = post.Content.Body;
620-
}
621-
}
622-
611+
if (postId != 0)
612+
{
613+
var post = postId == this.TopicId ? ti : (DotNetNuke.Modules.ActiveForums.Entities.IPostInfo)new DotNetNuke.Modules.ActiveForums.Controllers.ReplyController(this.ForumModuleId).GetById(postId);
614+
if (post != null)
615+
{
616+
var sPostedBy = Utilities.GetSharedResource("[RESX:PostedBy]") + " {0} {1} {2}";
617+
sPostedBy = string.Format(sPostedBy, DotNetNuke.Modules.ActiveForums.Controllers.ForumUserController.GetDisplayName(this.PortalSettings, this.MainSettings, false, false, post.Author.AuthorId, post.Author.Username, post.Author.FirstName, post.Author.LastName, post.Author.DisplayName), Utilities.GetSharedResource("On.Text"), Utilities.GetUserFormattedDateTime(post.Content.DateCreated, this.PortalId, this.UserId));
618+
body = post.Content.Body;
623619
if (this.allowHTML && this.editorType != EditorTypes.TEXTBOX)
624620
{
625-
if (body.ToUpper().Contains("<CODE") | body.ToUpper().Contains("[CODE]"))
621+
if (body.ToUpperInvariant().Contains("<CODE") || body.ToUpperInvariant().Contains("[CODE]"))
626622
{
627623
body = CodeParser.ParseCode(System.Net.WebUtility.HtmlDecode(body));
628624
}
@@ -651,12 +647,22 @@ private void PrepareReply()
651647
}
652648

653649
this.ctlForm.Body = body;
650+
651+
if (this.ctlForm.EditorMode != SubmitForm.EditorModes.EditReply && this.canModApprove)
652+
{
653+
this.ctlForm.ShowModOptions = false;
654+
}
655+
}
656+
else
657+
{
658+
var im = new InfoMessage { Message = this.GetSharedResource("[RESX:Message:LoadTopicFailed]") };
659+
this.plhContent.Controls.Add(im);
654660
}
655661
}
656-
657-
if (this.ctlForm.EditorMode != SubmitForm.EditorModes.EditReply && this.canModApprove)
662+
else
658663
{
659-
this.ctlForm.ShowModOptions = false;
664+
var im = new InfoMessage { Message = this.GetSharedResource("[RESX:Message:LoadTopicFailed]") };
665+
this.plhContent.Controls.Add(im);
660666
}
661667
}
662668
}

0 commit comments

Comments
 (0)