diff --git a/GanjooRazor/Areas/Admin/Pages/ReviewCatEdits.cshtml.cs b/GanjooRazor/Areas/Admin/Pages/ReviewCatEdits.cshtml.cs index 65f76c2c..495d87a2 100644 --- a/GanjooRazor/Areas/Admin/Pages/ReviewCatEdits.cshtml.cs +++ b/GanjooRazor/Areas/Admin/Pages/ReviewCatEdits.cshtml.cs @@ -9,11 +9,11 @@ using System.Net.Http; using System.Threading.Tasks; using System.Linq; using RMuseum.Models.Ganjoor; -using static GanjooRazor.Areas.Admin.Pages.ReviewEditsModel; using System.Text; using System; using RMuseum.Utils; using System.Collections.Generic; +using GanjooRazor.Models; namespace GanjooRazor.Areas.Admin.Pages { diff --git a/GanjooRazor/Areas/Admin/Pages/ReviewEdits.cshtml.cs b/GanjooRazor/Areas/Admin/Pages/ReviewEdits.cshtml.cs index 49122a72..c56b4e71 100644 --- a/GanjooRazor/Areas/Admin/Pages/ReviewEdits.cshtml.cs +++ b/GanjooRazor/Areas/Admin/Pages/ReviewEdits.cshtml.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Net.Http; using System.Text; using System.Threading.Tasks; +using GanjooRazor.Models; using GanjooRazor.Utils; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; @@ -223,24 +224,6 @@ namespace GanjooRazor.Areas.Admin.Pages return Page(); } - public class PoemMoerationStructure - { - public int correctionId{ get; set; } - public string titleReviewResult { get; set; } - public string summaryReviewResult { get; set; } - public string rhythmReviewResult { get; set; } - public string rhythm2ReviewResult { get; set; } - public string rhymeReviewResult { get; set; } - public string titleReviewNote { get; set; } - public string[] verseReviewResult { get; set; } - public string[] versePosReviewResult { get; set; } - public string[] verseSummaryResults { get; set; } - public string[] verseLanguageReviewResult { get; set; } - public string[] verseReviewNotes { get; set; } - public string poemformatReviewResult { get; set; } - public string poemformatReviewNote { get; set; } - } - public async Task OnPostSendCorrectionsModerationAsync([FromBody] PoemMoerationStructure pms) diff --git a/GanjooRazor/Models/PoemMoerationStructure.cs b/GanjooRazor/Models/PoemMoerationStructure.cs new file mode 100644 index 00000000..abbd440a --- /dev/null +++ b/GanjooRazor/Models/PoemMoerationStructure.cs @@ -0,0 +1,20 @@ +namespace GanjooRazor.Models +{ + public class PoemMoerationStructure + { + public int correctionId { get; set; } + public string titleReviewResult { get; set; } + public string summaryReviewResult { get; set; } + public string rhythmReviewResult { get; set; } + public string rhythm2ReviewResult { get; set; } + public string rhymeReviewResult { get; set; } + public string titleReviewNote { get; set; } + public string[] verseReviewResult { get; set; } + public string[] versePosReviewResult { get; set; } + public string[] verseSummaryResults { get; set; } + public string[] verseLanguageReviewResult { get; set; } + public string[] verseReviewNotes { get; set; } + public string poemformatReviewResult { get; set; } + public string poemformatReviewNote { get; set; } + } +} diff --git a/RMuseum/Utils/GanjoorHtmlTools.cs b/RMuseum/Utils/GanjoorHtmlTools.cs new file mode 100644 index 00000000..1c22ea3a --- /dev/null +++ b/RMuseum/Utils/GanjoorHtmlTools.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; +using System.Linq; +using System.Text.RegularExpressions; +using System.Web; + +namespace RMuseum.Utils +{ + public class GanjoorHtmlTools + { + public static string StripHtmlTags(string input) + { + // Remove HTML tags using Regex + string textWithoutTags = Regex.Replace(input, "<.*?>", string.Empty); + + // Decode HTML entities (e.g., & → &) + return HttpUtility.HtmlDecode(textWithoutTags); + } + + public static List ExtractLinksWithRegex(string html) + { + List links = new List(); + string pattern = @"<(a|img)\b[^>]*?\b(href|src)\s*=\s*[""']?([^""' >]+)[""']?"; + MatchCollection matches = Regex.Matches(html, pattern, RegexOptions.IgnoreCase); + + foreach (Match match in matches) + { + if (match.Groups.Count >= 4) + { + string url = match.Groups[3].Value; + if (!string.IsNullOrEmpty(url)) + links.Add(url); + } + } + + return links.Distinct().ToList(); // Remove duplicates + } + } +} diff --git a/RMuseum/Utils/GanjoorPoemTools.cs b/RMuseum/Utils/GanjoorPoemTools.cs index 10e72f07..efde2b7b 100644 --- a/RMuseum/Utils/GanjoorPoemTools.cs +++ b/RMuseum/Utils/GanjoorPoemTools.cs @@ -1,9 +1,4 @@ -using System.Collections.Generic; -using System.Linq; -using System.Text.RegularExpressions; -using System.Web; - -namespace RMuseum.Utils +namespace RMuseum.Utils { /// /// ganjoor poem tools @@ -43,32 +38,5 @@ namespace RMuseum.Utils return poemHtml; } - public static string StripHtmlTags(string input) - { - // Remove HTML tags using Regex - string textWithoutTags = Regex.Replace(input, "<.*?>", string.Empty); - - // Decode HTML entities (e.g., & → &) - return HttpUtility.HtmlDecode(textWithoutTags); - } - - public static List ExtractLinksWithRegex(string html) - { - List links = new List(); - string pattern = @"<(a|img)\b[^>]*?\b(href|src)\s*=\s*[""']?([^""' >]+)[""']?"; - MatchCollection matches = Regex.Matches(html, pattern, RegexOptions.IgnoreCase); - - foreach (Match match in matches) - { - if (match.Groups.Count >= 4) - { - string url = match.Groups[3].Value; - if (!string.IsNullOrEmpty(url)) - links.Add(url); - } - } - - return links.Distinct().ToList(); // Remove duplicates - } } }