divan/GanjooRazor/Areas/User/Pages/Edits.cshtml
2023-11-28 14:57:13 +03:30

663 lines
31 KiB
Plaintext

@page
@model GanjooRazor.Areas.User.Pages.EditsModel
@using RMuseum.Models.Ganjoor
@using RMuseum.Services.Implementation
@{
Layout = "_UserPanelLayout";
ViewData["Title"] = "ویرایش‌های من";
await GanjooRazor.Utils.GanjoorSessionChecker.ApplyPermissionsToViewData(Request, Response, ViewData);
string color = "gray";
}
<h1>@ViewData["Title"]</h1>
@if (Model.LastError != "")
{
<h2>@Model.LastError</h2>
}
else
{
if (@Model.CanEdit)
{
@if (Model.Profile != null)
{
<div id="profile">
<p>
<a href="/hashieha?userId=@Model.Profile.Id">@Model.Profile.NickName</a>
@if (!string.IsNullOrEmpty(Model.Profile.Website))
{
<a href="@Model.Profile.Website">🌐</a>
}
</p>
@if (!string.IsNullOrEmpty(Model.Profile.Bio))
{
@Html.Raw(Model.Profile.Bio)
}
</div>
<hr />
}
else
{
<div class="clear-both">
<p>
<a role="button" href="/User/Edits?AllUsers=1" class="pagebutton">ویرایش‌های همه</a>
</p>
</div>
}
<script>
function rollBackCorrection(correctionId){
if (!confirm('ویرایش معکوس ایجاد شود؟')) {
return;
}
$.ajax({
type: "POST",
url: '?handler=RollBackCorrection',
data: {
correctionId: correctionId,
},
success: function () {
alert('انجام شد.');
location.reload(true);
},
error: function (e) {
if (e.responseText == null)
alert(e);
else
alert(e.responseText);
}
});
}
</script>
}
@if (Model.Corrections.Count == 0)
{
<p>
شما هنوز هیچ ویرایشی در گنجور انجام نداده‌اید. برای آشنایی با نحوهٔ ویرایش اشعار <a href="https://blog.ganjoor.net/1400/05/23/notes-for-suggesting-corrections/" target="_blank">اینجا</a> را ببینید.
</p>
}
<p style="text-align:center">
@foreach (var paginationLink in Model.PaginationLinks)
{
if (!string.IsNullOrEmpty(paginationLink.Url))
{
<a href="@paginationLink.Url">@paginationLink.Name</a>
}
else
{
@paginationLink.Name
}
}
</p>
@foreach (var correction in Model.Corrections)
{
if (color == "gray")
color = "lightsteelblue";
else
color = "gray";
<div style="background-color:@color" id="correction-@correction.Id">
<table>
<tr>
<td colspan="3"><a href="/?p=@correction.PoemId" target="_blank">مشاهدهٔ متن شعر یا بخش</a></td>
</tr>
@if (Model.AllUsersEdits)
{
<tr>
<td colspan="3"><a href="/hashieha/?userid=@correction.UserId" target="_blank">@correction.UserNickname</a></td>
</tr>
}
<tr>
<td>متن اولیه</td>
<td>تغییرات من</td>
<td>نتیجهٔ بررسی</td>
</tr>
@if (correction.Title != null)
{
<tr>
<td>
<p style="color:red" id="title-original-@correction.Id">@correction.OriginalTitle</p>
</td>
<td>
<p style="color:green" id="title-edited-@correction.Id">@correction.Title</p>
</td>
<td>
@if (correction.Result == CorrectionReviewResult.NotReviewed)
{
<p style="color:blue">@CorrectionReviewResultConvertor.GetString(correction.Result)</p>
}
else
@if (correction.Result == CorrectionReviewResult.Approved)
{
<p style="color:green">@CorrectionReviewResultConvertor.GetString(correction.Result)</p>
}
else
{
<p style="color:red">@CorrectionReviewResultConvertor.GetString(correction.Result)</p>
}
</td>
</tr>
<tr>
<td colspan="3">
<p id="title-compare-@correction.Id">@correction.OriginalTitle</p>
<script>
$(document).ready(function () {
compareCorrectionBlocks('title-original-@correction.Id', 'title-edited-@correction.Id', 'title-compare-@correction.Id');
});
</script>
</td>
</tr>
@if (!string.IsNullOrEmpty(correction.ReviewNote))
{
<tr>
<td colspan="3">
<p>@correction.ReviewNote</p>
</td>
</tr>
}
<tr><td colspan="3" style="background-color:black">&nbsp;</td></tr>
}
@if (correction.Rhythm != null)
{
<tr>
<td>
<p style="color:red">@correction.OriginalRhythm</p>
</td>
<td>
<p style="color:green">@correction.Rhythm</p>
</td>
<td>
@if (correction.RhythmResult == CorrectionReviewResult.NotReviewed)
{
<p style="color:blue">@CorrectionReviewResultConvertor.GetString(correction.RhythmResult)</p>
}
else
@if (correction.RhythmResult == CorrectionReviewResult.Approved)
{
<p style="color:green">@CorrectionReviewResultConvertor.GetString(correction.RhythmResult)</p>
}
else
{
<p style="color:red">@CorrectionReviewResultConvertor.GetString(correction.RhythmResult)</p>
}
</td>
</tr>
@if (!string.IsNullOrEmpty(correction.ReviewNote))
{
<tr>
<td colspan="3">
<p>@correction.ReviewNote</p>
</td>
</tr>
}
<tr><td colspan="3" style="background-color:black">&nbsp;</td></tr>
}
@if (correction.PoemSummary != null)
{
<tr>
<td>
خلاصه: <p style="color:red" id="summary-original-@correction.Id">@correction.OriginalPoemSummary</p>
</td>
<td>
<p style="color:green" id="summary-edited-@correction.Id">@correction.PoemSummary</p>
</td>
<td>
@if (correction.SummaryReviewResult == CorrectionReviewResult.NotReviewed)
{
<p style="color:blue">@CorrectionReviewResultConvertor.GetString(correction.SummaryReviewResult)</p>
}
else
@if (correction.SummaryReviewResult == CorrectionReviewResult.Approved)
{
<p style="color:green" id="summary-original-@correction.Id">@CorrectionReviewResultConvertor.GetString(correction.SummaryReviewResult)</p>
}
else
{
<p style="color:red" id="summary-edited-@correction.Id">@CorrectionReviewResultConvertor.GetString(correction.SummaryReviewResult)</p>
}
</td>
</tr>
<tr>
<td colspan="3">
<p id="summary-compare-@correction.Id">@correction.OriginalPoemSummary</p>
<script>
$(document).ready(function () {
compareCorrectionBlocks('summary-original-@correction.Id', 'summary-edited-@correction.Id', 'summary-compare-@correction.Id');
});
</script>
</td>
</tr>
@if (!string.IsNullOrEmpty(correction.ReviewNote))
{
<tr>
<td colspan="3">
<p>@correction.ReviewNote</p>
</td>
</tr>
}
<tr><td colspan="3" style="background-color:black">&nbsp;</td></tr>
}
@if (correction.RhymeLetters != null)
{
<tr>
<td>
<p style="color:red">قافیه: @correction.OriginalRhymeLetters</p>
</td>
<td>
<p style="color:green">@correction.RhymeLetters</p>
</td>
<td>
@if (correction.RhymeLettersReviewResult == CorrectionReviewResult.Approved)
{
<p style="color:blue">@CorrectionReviewResultConvertor.GetString(correction.RhymeLettersReviewResult)</p>
}
else
@if (correction.RhymeLettersReviewResult == CorrectionReviewResult.Approved)
{
<p style="color:green">@CorrectionReviewResultConvertor.GetString(correction.RhymeLettersReviewResult)</p>
}
else
{
<p style="color:red">@CorrectionReviewResultConvertor.GetString(correction.RhymeLettersReviewResult)</p>
}
</td>
</tr>
@if (!string.IsNullOrEmpty(correction.ReviewNote))
{
<tr>
<td colspan="3">
<p>@correction.ReviewNote</p>
</td>
</tr>
}
<tr><td colspan="3" style="background-color:black">&nbsp;</td></tr>
}
@if (correction.Rhythm2 != null)
{
<tr>
<td colspan="3">
وزن دوم
</td>
</tr>
<tr>
<td>
<p style="color:red">@correction.OriginalRhythm2</p>
</td>
<td>
<p style="color:green">@correction.Rhythm2</p>
</td>
<td>
@if (correction.Rhythm2Result == CorrectionReviewResult.NotReviewed)
{
<p style="color:blue">@CorrectionReviewResultConvertor.GetString(correction.Rhythm2Result)</p>
}
else
@if (correction.Rhythm2Result == CorrectionReviewResult.Approved)
{
<p style="color:green">@CorrectionReviewResultConvertor.GetString(correction.Rhythm2Result)</p>
}
else
{
<p style="color:red">@CorrectionReviewResultConvertor.GetString(correction.Rhythm2Result)</p>
}
</td>
</tr>
@if (!string.IsNullOrEmpty(correction.ReviewNote))
{
<tr>
<td colspan="3">
<p>@correction.ReviewNote</p>
</td>
</tr>
}
<tr><td colspan="3" style="background-color:black">&nbsp;</td></tr>
}
@if (correction.PoemFormat != null)
{
<tr>
<td colspan="3">
قالب شعری
</td>
</tr>
<tr>
<td>
<p style="color:red">@RMuseum.Services.Implementation.GanjoorPoemFormatConvertor.GetString(correction.OriginalPoemFormat)</p>
</td>
<td>
<p style="color:green">@RMuseum.Services.Implementation.GanjoorPoemFormatConvertor.GetString(correction.PoemFormat)</p>
</td>
<td>
@if (correction.PoemFormatReviewResult == CorrectionReviewResult.NotReviewed)
{
<p style="color:blue">@CorrectionReviewResultConvertor.GetString(correction.PoemFormatReviewResult)</p>
}
else
@if (correction.PoemFormatReviewResult == CorrectionReviewResult.Approved)
{
<p style="color:green">@CorrectionReviewResultConvertor.GetString(correction.PoemFormatReviewResult)</p>
}
else
{
<p style="color:red">@CorrectionReviewResultConvertor.GetString(correction.PoemFormatReviewResult)</p>
}
</td>
</tr>
@if (!string.IsNullOrEmpty(correction.ReviewNote))
{
<tr>
<td colspan="3">
<p>@correction.ReviewNote</p>
</td>
</tr>
}
<tr><td colspan="3" style="background-color:black">&nbsp;</td></tr>
}
@if (correction.VerseOrderText != null && correction.VerseOrderText.Length > 0)
@foreach (var verse in correction.VerseOrderText)
{
@if (verse.MarkForDelete)
{
<tr>
<td>
<p>@verse.OriginalText</p>
</td>
<td>
<p>باید حذف شود</p>
</td>
<td>
@if (verse.MarkForDeleteResult == CorrectionReviewResult.NotReviewed)
{
<p style="color:blue">@CorrectionReviewResultConvertor.GetString(verse.MarkForDeleteResult)</p>
}
else
if (verse.MarkForDeleteResult == CorrectionReviewResult.Approved)
{
<p style="color:green">@CorrectionReviewResultConvertor.GetString(verse.MarkForDeleteResult)</p>
}
else
{
<p style="color:red">@CorrectionReviewResultConvertor.GetString(verse.MarkForDeleteResult)</p>
}
</td>
</tr>
<tr><td colspan="3" style="background-color:black">&nbsp;</td></tr>
}
else if (verse.NewVerse)
{
<tr>
<td>
<p>پیشنهاد مصرع جدید</p>
</td>
<td>
<p>@verse.Text</p>
</td>
<td>
@if (verse.NewVerseResult == CorrectionReviewResult.NotReviewed)
{
<p style="color:blue">@CorrectionReviewResultConvertor.GetString(verse.NewVerseResult)</p>
}
else
if (verse.NewVerseResult == CorrectionReviewResult.Approved)
{
<p style="color:green">@CorrectionReviewResultConvertor.GetString(verse.NewVerseResult)</p>
}
else
{
<p style="color:red">@CorrectionReviewResultConvertor.GetString(verse.NewVerseResult)</p>
}
</td>
</tr>
<tr><td colspan="3" style="background-color:black">&nbsp;</td></tr>
}
else if (verse.Text != null)
{
<tr>
<td>
<p style="color:red" id="verse-@verse.Id-original-@correction.Id">@verse.OriginalText</p>
</td>
<td>
<p style="color:green" id="verse-@verse.Id-edited-@correction.Id">@verse.Text</p>
</td>
<td>
@if (verse.Result == CorrectionReviewResult.NotReviewed)
{
<p style="color:blue">@CorrectionReviewResultConvertor.GetString(verse.Result)</p>
}
else
if (verse.Result == CorrectionReviewResult.Approved)
{
<p style="color:green">@CorrectionReviewResultConvertor.GetString(verse.Result)</p>
}
else
{
<p style="color:red">@CorrectionReviewResultConvertor.GetString(verse.Result)</p>
}
</td>
</tr>
<tr>
<td colspan="3">
<p id="verse-@verse.Id-compare-@correction.Id">@verse.OriginalText</p>
<script>
$(document).ready(function () {
compareCorrectionBlocks('verse-@verse.Id-original-@correction.Id', 'verse-@verse.Id-edited-@correction.Id', 'verse-@verse.Id-compare-@correction.Id');
});
</script>
</td>
</tr>
<tr><td colspan="3" style="background-color:black">&nbsp;</td></tr>
}
@if (verse.CoupletSummary != null)
{
<tr>
<td colspan="3">
@verse.OriginalText
</td>
</tr>
<tr>
<td>
معنی: <p style="color:red" id="verse-summary-@verse.Id-original-@correction.Id">@verse.OriginalCoupletSummary</p>
</td>
<td>
<p style="color:green" id="verse-summary-@verse.Id-edited-@correction.Id">@verse.CoupletSummary</p>
</td>
<td>
@if (verse.SummaryReviewResult == CorrectionReviewResult.NotReviewed)
{
<p style="color:blue">@CorrectionReviewResultConvertor.GetString(verse.SummaryReviewResult)</p>
}
else
if (verse.SummaryReviewResult == CorrectionReviewResult.Approved)
{
<p style="color:green">@CorrectionReviewResultConvertor.GetString(verse.SummaryReviewResult)</p>
}
else
{
<p style="color:red">@CorrectionReviewResultConvertor.GetString(verse.SummaryReviewResult)</p>
}
</td>
</tr>
<tr>
<td colspan="3">
<p id="verse-summary-@verse.Id-compare-@correction.Id">@verse.OriginalCoupletSummary</p>
<script>
$(document).ready(function () {
compareCorrectionBlocks('verse-summary-@verse.Id-original-@correction.Id', 'verse-summary-@verse.Id-edited-@correction.Id', 'verse-summary-@verse.Id-compare-@correction.Id');
});
</script>
</td>
</tr>
<tr><td colspan="3" style="background-color:black">&nbsp;</td></tr>
}
@if (verse.VersePosition != null && !verse.NewVerse && verse.VersePositionResult != CorrectionReviewResult.NotSuggestedByUser)
{
<tr>
<td colspan="3">
@verse.OriginalText
</td>
</tr>
<tr>
<td>
@if (verse.OriginalVersePosition != null)
{
<p>تبدیل نوع مصرع از @RMuseum.Models.Ganjoor.VersePositionHelper.GetVersePositionString((VersePosition)verse.OriginalVersePosition)</p>
}
</td>
<td>
<p style="color:orange">تبدیل نوع مصرع به @RMuseum.Models.Ganjoor.VersePositionHelper.GetVersePositionString((VersePosition)verse.VersePosition)</p>
</td>
<td>
@if (verse.VersePositionResult == CorrectionReviewResult.NotReviewed)
{
<p style="color:blue">@CorrectionReviewResultConvertor.GetString(verse.VersePositionResult)</p>
}
else
if (verse.VersePositionResult == CorrectionReviewResult.Approved)
{
<p style="color:green">@CorrectionReviewResultConvertor.GetString(verse.VersePositionResult)</p>
}
else
{
<p style="color:red">@CorrectionReviewResultConvertor.GetString(verse.VersePositionResult)</p>
}
</td>
</tr>
<tr><td colspan="3" style="background-color:black">&nbsp;</td></tr>
}
@if (verse.LanguageId != null && !verse.NewVerse && verse.LanguageReviewResult != CorrectionReviewResult.NotSuggestedByUser)
{
<tr>
<td colspan="3">
@verse.OriginalText
</td>
</tr>
<tr>
<td>
@if (verse.OriginalLanguageId != null)
{
<p>تغییر زبان از @Model.Languages.Where(l => l.Id == verse.OriginalLanguageId).Single().Name </p>
}
else
{
<p>تغییر زبان از فارسی</p>
}
</td>
<td>
@if (verse.LanguageId != null)
{
<p>به @Model.Languages.Where(l => l.Id == verse.LanguageId).Single().Name </p>
}
else
{
<p>به فارسی</p>
}
</td>
<td>
@if (verse.LanguageReviewResult == CorrectionReviewResult.NotReviewed)
{
<p style="color:blue">@CorrectionReviewResultConvertor.GetString(verse.LanguageReviewResult)</p>
}
else
if (verse.LanguageReviewResult == CorrectionReviewResult.Approved)
{
<p style="color:green">@CorrectionReviewResultConvertor.GetString(verse.LanguageReviewResult)</p>
}
else
{
<p style="color:red">@CorrectionReviewResultConvertor.GetString(verse.LanguageReviewResult)</p>
}
</td>
</tr>
<tr><td colspan="3" style="background-color:black">&nbsp;</td></tr>
}
@if (!string.IsNullOrEmpty(verse.ReviewNote))
{
<tr>
<td colspan="3">
<p>@verse.ReviewNote</p>
</td>
</tr>
<tr><td colspan="3" style="background-color:black">&nbsp;</td></tr>
}
}
@if (!string.IsNullOrEmpty(correction.Note))
{
<tr>
<td>یادداشت:</td>
<td colspan="2">
@correction.Note
</td>
</tr>
<tr><td colspan="3" style="background-color:black">&nbsp;</td></tr>
}
<tr>
<td colspan="3">
@if (correction.Reviewed)
{
<a role="button" style="cursor:pointer;width:100%;color:white;background-color:red;display:block" href="/User/Editor?id=@correction.PoemId">ویرایش مجدد</a>
}
else
{
<a role="button" style="cursor:pointer;width:100%;color:white;background-color:blue;display:block" href="/User/Editor?id=@correction.PoemId">مشاهده</a>
}
</td>
</tr>
@if (correction.Reviewed)
{
<tr>
<td colspan="3">
<a role="button" style="cursor:pointer;width:100%;color:white;background-color:orange;display:block" onclick="rollBackCorrection(@correction.Id)">برگشت به وضعیت قبل از این ویرایش</a>
</td>
</tr>
}
</table>
</div>
<hr />
}
<p style="text-align:center">
@foreach (var paginationLink in Model.PaginationLinks)
{
if (!string.IsNullOrEmpty(paginationLink.Url))
{
<a href="@paginationLink.Url">@paginationLink.Name</a>
}
else
{
@paginationLink.Name
}
}
</p>
}