#467 cat editor
This commit is contained in:
parent
1f8ba49cc9
commit
fea213b2ae
@ -20,44 +20,44 @@
|
||||
}
|
||||
|
||||
<script>
|
||||
function moderateCorrections(correctionId) {
|
||||
function moderateCorrections(correctionId) {
|
||||
|
||||
$('#moderatecorrections').hide();
|
||||
$('#saving').text('در حال بررسی ...');
|
||||
$('#moderatecorrections').hide();
|
||||
$('#saving').text('در حال بررسی ...');
|
||||
|
||||
|
||||
var descriptionReviewResult = 'DontCare';
|
||||
if ($('#description_review_result_Approved').length > 0) { //has title
|
||||
descriptionReviewResult = $('input[name=description_review_result]:checked').val()
|
||||
}
|
||||
var descriptionReviewResult = 'DontCare';
|
||||
if ($('#description_review_result_Approved').length > 0) { //has title
|
||||
descriptionReviewResult = $('input[name=description_review_result]:checked').val()
|
||||
}
|
||||
|
||||
|
||||
var url = '?handler=SendCorrectionsModeration';
|
||||
var url = '?handler=SendCorrectionsModeration';
|
||||
|
||||
var pms = {};
|
||||
var pms = {};
|
||||
|
||||
pms.correctionId= correctionId;
|
||||
pms.titleReviewResult = descriptionReviewResult;
|
||||
pms.titleReviewNote= $('#review_note') == null ? null : $('#review_note').val();
|
||||
pms.correctionId= correctionId;
|
||||
pms.titleReviewResult = descriptionReviewResult;
|
||||
pms.titleReviewNote= $('#review_note') == null ? null : $('#review_note').val();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url,
|
||||
data: JSON.stringify(pms),
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
success: function() {
|
||||
location.reload(true);
|
||||
},
|
||||
error: function(e) {
|
||||
if (e.responseText == null)
|
||||
alert(e);
|
||||
else
|
||||
alert(e.responseText);
|
||||
$('#moderatecorrections').show();
|
||||
$('#saving').text('');
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url,
|
||||
data: JSON.stringify(pms),
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
success: function() {
|
||||
location.reload(true);
|
||||
},
|
||||
error: function(e) {
|
||||
if (e.responseText == null)
|
||||
alert(e);
|
||||
else
|
||||
alert(e.responseText);
|
||||
$('#moderatecorrections').show();
|
||||
$('#saving').text('');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@ -119,12 +119,59 @@
|
||||
<p id="description-lastedit-compare">@Model.Correction.OriginalDescription</p>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
compareCorrectionBlocks('description-lastedit-original', 'description-lastedit-edited', 'description-lastedit-compare');
|
||||
compareCorrectionBlocks('description-lastedit-original', 'description-lastedit-edited', 'description-lastedit-compare');
|
||||
});
|
||||
</script>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
Html
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
@Html.Raw(Model.Correction.DescriptionHtml)
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@if(Model.Links != null)
|
||||
foreach (var link in Model.Links)
|
||||
{
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<a href="@link">پیوند داخل متن:</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<p class="red-color lft">
|
||||
@if (link.Length > 20)
|
||||
{
|
||||
@Html.Raw(link.Substring(0, 19) + " ...")
|
||||
}
|
||||
else
|
||||
{
|
||||
@Html.Raw(link)
|
||||
}
|
||||
|
||||
</p>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<textarea rows="10" cols="50" style="direction:ltr;text-align:left">
|
||||
@Html.Raw(Model.Correction.DescriptionHtml)
|
||||
</textarea>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
@ -12,6 +12,8 @@ using RMuseum.Models.Ganjoor;
|
||||
using static GanjooRazor.Areas.Admin.Pages.ReviewEditsModel;
|
||||
using System.Text;
|
||||
using System;
|
||||
using RMuseum.Utils;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace GanjooRazor.Areas.Admin.Pages
|
||||
{
|
||||
@ -37,6 +39,11 @@ namespace GanjooRazor.Areas.Admin.Pages
|
||||
/// </summary>
|
||||
public int TotalCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// links
|
||||
/// </summary>
|
||||
public List<string> Links { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// page
|
||||
/// </summary>
|
||||
@ -83,6 +90,8 @@ namespace GanjooRazor.Areas.Admin.Pages
|
||||
}
|
||||
PageInformation = JObject.Parse(await pageQuery.Content.ReadAsStringAsync()).ToObject<GanjoorPageCompleteViewModel>();
|
||||
|
||||
Links = GanjoorPoemTools.ExtractLinksWithRegex(Correction.DescriptionHtml);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Web;
|
||||
|
||||
namespace RMuseum.Utils
|
||||
@ -49,5 +51,24 @@ namespace RMuseum.Utils
|
||||
// Decode HTML entities (e.g., & → &)
|
||||
return HttpUtility.HtmlDecode(textWithoutTags);
|
||||
}
|
||||
|
||||
public static List<string> ExtractLinksWithRegex(string html)
|
||||
{
|
||||
List<string> links = new List<string>();
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user