diff --git a/GanjooRazor/Areas/Admin/Pages/ReviewEdits.cshtml b/GanjooRazor/Areas/Admin/Pages/ReviewEdits.cshtml index 68bcf191..7bc324ef 100644 --- a/GanjooRazor/Areas/Admin/Pages/ReviewEdits.cshtml +++ b/GanjooRazor/Areas/Admin/Pages/ReviewEdits.cshtml @@ -856,9 +856,10 @@ else { var geoTag = Model.Correction.GeoDateTags[gi]; var geoIndex = gi + 1; + var isPersonTag = geoTag.PersonId != null || !string.IsNullOrEmpty(geoTag.SuggestedPersonGraphJson); - برچسب جغرافیایی/تاریخی + @(isPersonTag ? "برچسب شخصیت" : "برچسب جغرافیایی/تاریخی") @{ var geoCouplet = geoTag.CoupletIndex == null ? null : (Model.Couplets ?? Array.Empty>()).Where(c => c.Item1 == geoTag.CoupletIndex).Select(c => c.Item2).FirstOrDefault(); } @@ -889,13 +890,136 @@ else درخواست حذف برچسب: @if (existingTag != null) { - @(existingTag.Location != null ? existingTag.Location.Name : "") - @(existingTag.LunarYear != null ? $" - سال {existingTag.LunarYear}" : "") + @if (isPersonTag) + { + @(existingTag.Person != null ? existingTag.Person.Name : "") + } + else + { + @(existingTag.Location != null ? existingTag.Location.Name : "") + @(existingTag.LunarYear != null ? $" - سال {existingTag.LunarYear}" : "") + } }

} + else if (isPersonTag) + { + RMuseum.Models.Ganjoor.ViewModels.PersonGraphSuggestion personGraph = null; + string personGraphError = null; + if (geoTag.PersonId == null && !string.IsNullOrEmpty(geoTag.SuggestedPersonGraphJson)) + { + try + { + personGraph = Newtonsoft.Json.JsonConvert.DeserializeObject(geoTag.SuggestedPersonGraphJson); + } + catch (Exception ex) + { + personGraphError = ex.Message; + } + } + + متن اولیه + پیشنهاد + + + +

-

+ + +

+ @if (geoTag.PersonId != null) + { + شخصیت: @(geoTag.Person != null ? geoTag.Person.Name : $"شخصیت #{geoTag.PersonId}") + } + else if (personGraph?.Person != null) + { + شخصیت جدید: @personGraph.Person.Name + if (personGraph.Relations != null && personGraph.Relations.Count > 0) + { + (@personGraph.Relations.Count.ToPersianNumbers() رابطهٔ همراه) + } + } + else if (personGraphError != null) + { + خطا در تفسیر اطلاعات شخصیت پیشنهادی: @personGraphError + } +

+ @if (!string.IsNullOrEmpty(geoTag.SuggestionNote)) + { +

یادداشت پیشنهاد دهنده: @geoTag.SuggestionNote

+ } + @if (personGraph?.Person != null) + { +
+

+ + @if (!string.IsNullOrEmpty(personGraph.Person.Description)) { توضیحات: @personGraph.Person.Description
} + @if (personGraph.Person.BirthYearInLHijri != null) { تولد: @personGraph.Person.BirthYearInLHijri @(personGraph.Person.ValidBirthDate ? "(قطعی)" : "(تخمینی)")
} + @if (personGraph.Person.DeathYearInLHijri != null) { وفات: @personGraph.Person.DeathYearInLHijri @(personGraph.Person.ValidDeathDate ? "(قطعی)" : "(تخمینی)")
} + @if (!string.IsNullOrEmpty(personGraph.Person.FamilyTreeCaption)) { عنوان شجره‌نامه: @personGraph.Person.FamilyTreeCaption
} +
+

+ @if (personGraph.RelatedPeople != null && personGraph.RelatedPeople.Count > 0) + { +

خویشاوندان/وابستگان همراه این پیشنهاد:

+
    + @foreach (var relation in personGraph.Relations ?? new List()) + { + var otherNode = personGraph.RelatedPeople.Where(p => p.LocalKey == (relation.Person1 == personGraph.Person.LocalKey ? relation.Person2 : relation.Person1)).FirstOrDefault(); + var otherName = otherNode != null + ? (otherNode.ExistingPersonId != null ? (Model.People ?? new List()).Where(p => p.Id == otherNode.ExistingPersonId).Select(p => p.Name).FirstOrDefault() : otherNode.Name) + : null; +
  • + + @(relation.Kind == "affiliation" ? relation.AffiliationType : relation.RelationType) + — @otherName + @if (!string.IsNullOrEmpty(relation.Note)) { (@relation.Note) } + +
  • + } +
+ } +
+ } + + + + +

+ اگر کاربر شخصیت را اشتباه تشخیص داده (مثلاً شخصیتی که از قبل در فهرست است را به‌عنوان شخصیت جدید پیشنهاد کرده)، به‌جای رد کردن می‌توانید آن را به شخصیت موجود متصل کنید؛ + برای شخصیت تازه فقط نام قابل اصلاح است - اصلاح روابط/تاریخ‌ها نیازمند رد کردن و ارسال دوبارهٔ پیشنهاد توسط کاربر است: +

+ +
+ + + +
+

برای اتصال به یک شخصیت موجود، نام او را تایپ کنید و از فهرست انتخاب کنید؛ برای رها کردن اتصال و پیشنهاد به‌عنوان شخصیت جدید، این فیلد را خالی کنید.

+ + @if (geoTag.PersonId == null) + { +
+
+ + +
+ } + + + } else { @@ -928,65 +1052,11 @@ else } } } - @{ - RMuseum.Models.Ganjoor.ViewModels.PersonGraphSuggestion personGraph = null; - if (geoTag.PersonId == null && !string.IsNullOrEmpty(geoTag.SuggestedPersonGraphJson)) - { - try - { - personGraph = Newtonsoft.Json.JsonConvert.DeserializeObject(geoTag.SuggestedPersonGraphJson); - } - catch (Exception) { } - } - } - @if (geoTag.PersonId != null) - { - - شخصیت: @(geoTag.Person != null ? geoTag.Person.Name : $"شخصیت #{geoTag.PersonId}") - } - else if (personGraph?.Person != null) - { - - شخصیت جدید: @personGraph.Person.Name - if (personGraph.Relations != null && personGraph.Relations.Count > 0) - { - (@personGraph.Relations.Count.ToPersianNumbers() رابطهٔ همراه) - } - }

@if (!string.IsNullOrEmpty(geoTag.SuggestionNote)) {

یادداشت پیشنهاد دهنده: @geoTag.SuggestionNote

} - @if (personGraph?.Person != null) - { -

- - @if (!string.IsNullOrEmpty(personGraph.Person.Description)) { توضیحات: @personGraph.Person.Description
} - @if (personGraph.Person.BirthYearInLHijri != 0) { تولد: @personGraph.Person.BirthYearInLHijri @(personGraph.Person.ValidBirthDate ? "(قطعی)" : "(تخمینی)")
} - @if (personGraph.Person.DeathYearInLHijri != 0) { وفات: @personGraph.Person.DeathYearInLHijri @(personGraph.Person.ValidDeathDate ? "(قطعی)" : "(تخمینی)")
} - @if (!string.IsNullOrEmpty(personGraph.Person.FamilyTreeCaption)) { عنوان شجره‌نامه: @personGraph.Person.FamilyTreeCaption
} - @if (personGraph.RelatedPeople != null && personGraph.RelatedPeople.Count > 0) - { - - خویشاوندان/وابستگان همراه این پیشنهاد: -

    - @foreach (var relation in personGraph.Relations ?? new List()) - { - var otherNode = personGraph.RelatedPeople.Where(p => p.LocalKey == (relation.Person1 == personGraph.Person.LocalKey ? relation.Person2 : relation.Person1)).FirstOrDefault(); - var otherName = otherNode != null - ? (otherNode.ExistingPersonId != null ? (Model.People ?? new List()).Where(p => p.Id == otherNode.ExistingPersonId).Select(p => p.Name).FirstOrDefault() : otherNode.Name) - : null; -
  • - @(relation.Kind == "affiliation" ? relation.AffiliationType : relation.RelationType) - — @otherName - @if (!string.IsNullOrEmpty(relation.Note)) { (@relation.Note) } -
  • - } -
- - } - -

- } @@ -1026,43 +1096,6 @@ else } - @if (geoTag.PersonId != null || !string.IsNullOrEmpty(geoTag.SuggestedPersonGraphJson)) - { - - -

- اگر کاربر شخصیت را اشتباه تشخیص داده (مثلاً شخصیتی که از قبل در فهرست است را به‌عنوان شخصیت جدید پیشنهاد کرده)، به‌جای رد کردن می‌توانید آن را به شخصیت موجود متصل کنید؛ - برای شخصیت تازه فقط نام قابل اصلاح است - اصلاح روابط/تاریخ‌ها نیازمند رد کردن و ارسال دوبارهٔ پیشنهاد توسط کاربر است: -

- -
- - - -
-

برای اتصال به یک شخصیت موجود، نام او را تایپ کنید و از فهرست انتخاب کنید؛ برای رها کردن اتصال و پیشنهاد به‌عنوان شخصیت جدید، این فیلد را خالی کنید.

- - @if (geoTag.PersonId == null) - { -
-
- - -
- } - - - } } diff --git a/RMuseum/Models/Ganjoor/ViewModels/PersonGraphSuggestion.cs b/RMuseum/Models/Ganjoor/ViewModels/PersonGraphSuggestion.cs index 446ff309..2a997ee0 100644 --- a/RMuseum/Models/Ganjoor/ViewModels/PersonGraphSuggestion.cs +++ b/RMuseum/Models/Ganjoor/ViewModels/PersonGraphSuggestion.cs @@ -48,8 +48,8 @@ namespace RMuseum.Models.Ganjoor.ViewModels public string Name { get; set; } public string Description { get; set; } public string WikiUrl { get; set; } - public int BirthYearInLHijri { get; set; } - public int DeathYearInLHijri { get; set; } + public int? BirthYearInLHijri { get; set; } + public int? DeathYearInLHijri { get; set; } public bool ValidBirthDate { get; set; } public bool ValidDeathDate { get; set; } public int? BirthLocationId { get; set; } diff --git a/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-ModeratePoemCorrection.cs b/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-ModeratePoemCorrection.cs index 3f8c589e..c2de9e7c 100644 --- a/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-ModeratePoemCorrection.cs +++ b/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-ModeratePoemCorrection.cs @@ -905,8 +905,8 @@ namespace RMuseum.Services.Implementation Name = node.Name.Trim(), Description = node.Description, WikiUrl = node.WikiUrl, - BirthYearInLHijri = node.BirthYearInLHijri, - DeathYearInLHijri = node.DeathYearInLHijri, + BirthYearInLHijri = node.BirthYearInLHijri ?? 0, + DeathYearInLHijri = node.DeathYearInLHijri ?? 0, ValidBirthDate = node.ValidBirthDate, ValidDeathDate = node.ValidDeathDate, BirthLocationId = node.BirthLocationId,