Museum subsystem: remove public UI, keep backend dormant (#5)

- poem page: drop manuscripts/images tab and Pinterest/museum image suggestion form
- remove image recommendation (Pin) page and route
- museum API, services and tables stay dormant (no schema change)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Anas Rashid 2026-10-05 00:24:30 +02:00
parent bbef4df563
commit 68594d1697
4 changed files with 1 additions and 313 deletions

View File

@ -1,102 +0,0 @@
@page
@model DiwanRazor.Pages.PinModel
@{
Layout = null;
}
<!DOCTYPE html>
<html lang="ur-PK" dir="rtl">
<head>
<meta charset="utf-8" />
<title>پیشنهاد شعر مرتبط با تصویر</title>
<meta name="robots" content="noindex, nofollow" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="shortcut icon" href="/favicon.ico?version=1" type="image/x-icon" />
<link href="~/css/p8.css" asp-append-version="true" rel="stylesheet" type="text/css" />
<partial name="_DiwanHead" />
<link href="/css/spotify.css" rel="stylesheet" type="text/css" />
<script src="/lib/jquery/dist/jquery.min.js"></script>
<script>
function assignEvents() {
const inputPinterestUrl = document.getElementById('RelatedImageSuggestionModel_PinterestUrl');
const inputPinterestImageUrl = document.getElementById('RelatedImageSuggestionModel_PinterestImageUrl');
const inputHandler = function (e) {
if (e.target.value.indexOf("instagram.com") != -1) {
inputPinterestImageUrl.value = e.target.value + 'media/?size=l';
}
}
inputPinterestUrl.addEventListener('input', inputHandler);
inputPinterestUrl.addEventListener('propertychange', inputHandler); // for IE8
}
</script>
<style>
.inputlabel {
width: 100%;
display: block;
}
textarea {
background-color: white;
}
input#submit {
text-align: center;
background-color: #fff;
border: 2px solid #300;
color: #300
}
input#submit:hover {
background-color: #300;
color: #fff;
border: 2px solid #433;
}
</style>
</head>
<body onload="assignEvents()">
<div id="fa">
<div class="poem">
@if (Model.Succeeded)
{
<p>با تشکر، تصویر پیشنهادی جهت بررسی ارسال شد.</p>
<p>لطفاً توجه فرمایید که تصاویر دارای واترمارک نازیبا یا دارای کیفیت پایین یا دارای مشکلات دیگر تأیید نخواهند شد.</p>
<p>تصویر ارسالی:</p>
}
else
{
<p>
@Model.LastError
</p>
<form method="post" action="/pin/?final=1">
@Html.AntiForgeryToken()
<input type="hidden" asp-for="RelatedImageSuggestionModel.DiwanTitle">
<input type="hidden" asp-for="RelatedImageSuggestionModel.PoemId">
<input type="hidden" asp-for="RelatedImageSuggestionModel.DiwanUrl">
<span class="inputlabel">نشانی سایت منبع (در این صفحه می‌بایست تصویر دیده شود): </span><input type="text" asp-for="RelatedImageSuggestionModel.PinterestUrl" style="direction:ltr" size="50">
<span class="inputlabel">نشانی تصویر (در مرحلهٔ بعد با توجه به این نشانی باید تصویر نمایش داده شود): </span><input type="text" asp-for="RelatedImageSuggestionModel.PinterestImageUrl" style="direction:ltr" size="50">
<br />
<span class="inputlabel">توضیحات (<small>می‌توانید اطلاعاتی مانند نام هنرمند و ... را اضافه کنید.</small>):</span>
<textarea asp-for="RelatedImageSuggestionModel.AltText" class="editor" rows="10" cols="50"></textarea>
<br />
<input type="submit" name="pinterest_suggest" value="پیشنهاد" style="background-color:red;color:white">
</form>
}
@if (Model.RelatedImageSuggestionModel.PinterestUrl != "manual")
{
<img src="@Html.Raw(Model.RelatedImageSuggestionModel.PinterestImageUrl)" width="400" />
}
</div>
</div>
</body>
</html>

View File

@ -1,84 +0,0 @@
using DiwanRazor.Models.MuseumLink;
using DiwanRazor.Utils;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Newtonsoft.Json;
using RMuseum.Models.DiwanIntegration.ViewModels;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace DiwanRazor.Pages
{
public class PinModel : PageModel
{
/// <summary>
/// related image suggestion model
/// </summary>
[BindProperty]
public RelatedImageSuggestionModel RelatedImageSuggestionModel { get; set; }
/// <summary>
/// ارسال موفق
/// </summary>
public bool Succeeded { get; set; }
/// <summary>
/// خطا
/// </summary>
public string LastError { get; set; }
/// <summary>
/// is logged on
/// </summary>
public bool LoggedIn { get; set; }
public async Task<IActionResult> OnPostAsync()
{
Succeeded = false;
LastError = "";
LoggedIn = !string.IsNullOrEmpty(Request.Cookies["Token"]);
if(!LoggedIn)
{
LastError = $"اشعار سے متعلق تصاویر تجویز کرنے کے لیے پہلے دیوان میں داخل ہوں. </p><p><a href=\"/login/?redirect={RelatedImageSuggestionModel.DiwanUrl}\")>دیوان میں داخلہ</a>";
}
else
if (Request.Query["final"] == "1")
{
using (HttpClient secureClient = new HttpClient(new DiwanReloginHandler(Request, Response)))
{
if(await DiwanSessionChecker.PrepareClient(secureClient, Request, Response))
{
PinterestLinkViewModel model = new PinterestLinkViewModel()
{
DiwanPostId = RelatedImageSuggestionModel.PoemId,
DiwanUrl = $"https://ganjoor.net{RelatedImageSuggestionModel.DiwanUrl}",
DiwanTitle = RelatedImageSuggestionModel.DiwanTitle,
AltText = RelatedImageSuggestionModel.AltText,
LinkType = RMuseum.Models.DiwanIntegration.LinkType.Pinterest,
PinterestUrl = RelatedImageSuggestionModel.PinterestUrl,
PinterestImageUrl = RelatedImageSuggestionModel.PinterestImageUrl
};
var stringContent = new StringContent(JsonConvert.SerializeObject(model), Encoding.UTF8, "application/json");
var response = await secureClient.PostAsync($"{APIRoot.Url}/api/artifacts/pinterest", stringContent);
if (response.StatusCode != HttpStatusCode.OK)
{
LastError = JsonConvert.DeserializeObject<string>(await response.Content.ReadAsStringAsync());
}
else
{
Succeeded = true;
}
}
else
{
LastError = "براہِ کرم دیوان سے خروج کر کے دوبارہ داخل ہوں.";
}
}
}
return Page();
}
}
}

View File

@ -95,41 +95,7 @@
<div class="ribbon"><a href="#qpoems">کئی شعرا سے منسوب</a></div>
}
@{
if (!string.IsNullOrEmpty(Model.PinterestUrl))
{
if (!Model.LoggedIn)
{
<div class="width-100per">
<div class="width-100per text-align-center">
<p class="alert-text">
اشعار سے متعلق تصاویر تجویز کرنے کے لیے پہلے دیوان میں داخل ہوں.
</p>
<p class="text-align-center">
<a href="/login">دیوان میں داخلہ</a>
</p>
</div>
</div>
}
else
{
<div class="width-100per display-block">
<form method="post" action="/pin">
@Html.AntiForgeryToken()
<input type="hidden" id="RelatedImageSuggestionModel_PoemId" name="RelatedImageSuggestionModel.PoemId" value="@Model.DiwanPage.Id">
<input type="hidden" id="RelatedImageSuggestionModel_DiwanUrl" name="RelatedImageSuggestionModel.DiwanUrl" value="@Model.DiwanPage.FullUrl">
<input type="hidden" id="RelatedImageSuggestionModel_DiwanTitle" name="RelatedImageSuggestionModel.DiwanTitle" value="@Model.DiwanPage.FullTitle">
<input type="hidden" id="RelatedImageSuggestionModel_PinterestUrl" name="RelatedImageSuggestionModel.PinterestUrl" value="@Model.PinterestUrl">
<input type="submit" name="pinterest_suggest" value="شعر منتخب کریں" class="pinterest_suggest">
</form>
@if (Model.PinterestUrl == "manual")
{
<span>فائرفاکس ایکسٹینشن سے انسٹاگرام اور پنٹرسٹ سے آسان تجویز</span>
}
</div>
}
}
}
@* diwan: museum/Pinterest image suggestions removed *@
<article id="garticle">
@if (Model.DiwanPage.PoetOrCat != null)
@ -219,7 +185,6 @@
<div class="poemtab" id="tab-items">
<div class="poemtablinks active"><a href="#pretab">معلومات</a></div>
<div class="poemtablinks"><a href="#words" onclick="javascript:countPoemWords(@Model.DiwanPage.Id, @Model.DiwanPage.PoetOrCat.Cat.Id, @Model.DiwanPage.PoetOrCat.Poet.Id)">الفاظ</a></div>
<div class="poemtablinks"><a href="#manuscripts">تصاویر</a></div>
@if (Model.DiwanPage.Poem.Recitations.Where(a => a.RecitationType == RMuseum.Models.DiwanAudio.RecitationType.Normal).Any())
{
<div class="poemtablinks"><a href="#recitations">قرأتیں</a></div>
@ -463,7 +428,6 @@
<div class="poemtab">
<div class="poemtablinks"><a href="#pretab">معلومات</a></div>
<div class="poemtablinks active"><a href="#words" onclick="javascript:countPoemWords(@Model.DiwanPage.Id, @Model.DiwanPage.PoetOrCat.Cat.Id, @Model.DiwanPage.PoetOrCat.Poet.Id)">الفاظ</a></div>
<div class="poemtablinks"><a href="#manuscripts">تصاویر</a></div>
@if (Model.DiwanPage.Poem.Recitations.Where(a => a.RecitationType == RMuseum.Models.DiwanAudio.RecitationType.Normal).Any())
{
<div class="poemtablinks"><a href="#recitations">قرأتیں</a></div>
@ -488,90 +452,6 @@
</div>
</div>
@* ============ MANUSCRIPTS TAB ============ *@
<div class="poempretab" id="manuscripts"></div>
<div class="poemtab">
<div class="poemtablinks"><a href="#pretab">معلومات</a></div>
<div class="poemtablinks"><a href="#words" onclick="javascript:countPoemWords(@Model.DiwanPage.Id, @Model.DiwanPage.PoetOrCat.Cat.Id, @Model.DiwanPage.PoetOrCat.Poet.Id)">الفاظ</a></div>
<div class="poemtablinks active"><a href="#manuscripts">تصاویر</a></div>
@if (Model.DiwanPage.Poem.Recitations.Where(a => a.RecitationType == RMuseum.Models.DiwanAudio.RecitationType.Normal).Any())
{
<div class="poemtablinks"><a href="#recitations">قرأتیں</a></div>
}
@if (Model.DiwanPage.Poem.Recitations.Where(a => a.RecitationType == RMuseum.Models.DiwanAudio.RecitationType.Commentary).Any())
{
<div class="poemtablinks"><a href="#commentaries">صوتی شرحیں</a></div>
}
<div class="poemtablinks"><a href="#qpoems">مشقِ سخن</a></div>
@if (Model.SectionsWithRelated.Count > 0)
{
<div class="poemtablinks"><a href="#rpoems">ہم آہنگ</a></div>
}
<div class="poemtablinks"><a href="#discussions">حاشیے</a></div>
</div>
<div class="related-images-frame poemtabcontent">
@if (Model.DiwanPage.Poem.Images.Length > 0)
{
<div id="images-section">
<div class="related-images">
@foreach (var image in Model.DiwanPage.Poem.Images.Where(image => image.IsTextOriginalSource))
{
<div class="width-100per">
<div class="related-image-container-main">
<a target="_blank" href="@Html.Raw(image.TargetPageUrl)">
<div class="main-image-container">
<div class="main-image-ribbon">دیوان کا مطبوعہ ماخذ</div>
<img src="@Html.Raw(image.ThumbnailImageUrl)" alt="@image.AltText" loading="lazy" class="main-image-source">
<div class="related-image-is-text-source">
<div class="width-100per">@image.AltText.ToPersianNumbers()</div>
</div>
</div>
</a>
@if (Model.CanEdit)
{
<a onclick="deleteRelatedImage(@((int)image.PoemRelatedImageType), '@image.Id', '@image.AltText')" class="pagebutton comments-link">یہ ربط ہٹائیں<i class="notranslate info-buttons delete-icon"></i></a>
}
</div>
</div>
}
@foreach (var image in Model.DiwanPage.Poem.Images.Where(image => image.IsTextOriginalSource == false))
{
<div class="related-image-container">
<a target="_blank" href="@Html.Raw(image.TargetPageUrl)">
<img src="@Html.Raw(image.ThumbnailImageUrl)" alt="@image.AltText" loading="lazy" class="related-image">
</a>
<div class="related-image-is-text-source"><a target="_blank" href="@Html.Raw(image.TargetPageUrl)">@image.AltText.ToPersianNumbers()</a></div>
@if (Model.CanEdit)
{
<a onclick="deleteRelatedImage(@((int)image.PoemRelatedImageType), '@image.Id', '@image.AltText')" class="pagebutton comments-link">یہ ربط ہٹائیں<i class="notranslate info-buttons delete-icon"></i></a>
}
</div>
}
</div>
<div id="suggest-images">
<p>
<a onclick="wpopen('?pinterest_url=manual'); return false" class="pagebutton comments-link">انٹرنیٹ سے متعلقہ تصاویر تجویز کریں<i class="notranslate info-buttons photo_camera"></i></a>
</p>
<p>
متعلقہ تصاویر تجویز کرنے کی رہنمائی<i class="notranslate info-buttons help-button"></i>
</p>
</div>
</div>
}
else
{
<div id="suggest-images">
<p>
<a onclick="wpopen('?pinterest_url=manual'); return false" class="pagebutton comments-link">انٹرنیٹ سے متعلقہ تصاویر تجویز کریں<i class="notranslate info-buttons photo_camera"></i></a>
</p>
<p>
متعلقہ تصاویر تجویز کرنے کی رہنمائی<i class="notranslate info-buttons help-button"></i>
</p>
</div>
}
</div>
@* ============ RECITATIONS TAB ============ *@
@if (Model.DiwanPage.Poem.Recitations.Where(a => a.RecitationType == RMuseum.Models.DiwanAudio.RecitationType.Normal).Any())
{
@ -579,7 +459,6 @@
<div class="poemtab">
<div class="poemtablinks"><a href="#pretab">معلومات</a></div>
<div class="poemtablinks"><a href="#words" onclick="javascript:countPoemWords(@Model.DiwanPage.Id, @Model.DiwanPage.PoetOrCat.Cat.Id, @Model.DiwanPage.PoetOrCat.Poet.Id)">الفاظ</a></div>
<div class="poemtablinks"><a href="#manuscripts">تصاویر</a></div>
<div class="poemtablinks active"><a href="#recitations">قرأتیں</a></div>
@if (Model.DiwanPage.Poem.Recitations.Where(a => a.RecitationType == RMuseum.Models.DiwanAudio.RecitationType.Commentary).Any())
{
@ -609,7 +488,6 @@
<div class="poemtab">
<div class="poemtablinks"><a href="#pretab">معلومات</a></div>
<div class="poemtablinks"><a href="#words" onclick="javascript:countPoemWords(@Model.DiwanPage.Id, @Model.DiwanPage.PoetOrCat.Cat.Id, @Model.DiwanPage.PoetOrCat.Poet.Id)">الفاظ</a></div>
<div class="poemtablinks"><a href="#manuscripts">تصاویر</a></div>
@if (Model.DiwanPage.Poem.Recitations.Where(a => a.RecitationType == RMuseum.Models.DiwanAudio.RecitationType.Normal).Any())
{
<div class="poemtablinks"><a href="#recitations">قرأتیں</a></div>
@ -636,7 +514,6 @@
<div class="poemtab">
<div class="poemtablinks"><a href="#pretab">معلومات</a></div>
<div class="poemtablinks"><a href="#words" onclick="javascript:countPoemWords(@Model.DiwanPage.Id, @Model.DiwanPage.PoetOrCat.Cat.Id, @Model.DiwanPage.PoetOrCat.Poet.Id)">الفاظ</a></div>
<div class="poemtablinks"><a href="#manuscripts">تصاویر</a></div>
@if (Model.DiwanPage.Poem.Recitations.Where(a => a.RecitationType == RMuseum.Models.DiwanAudio.RecitationType.Normal).Any())
{
<div class="poemtablinks"><a href="#recitations">قرأتیں</a></div>
@ -686,7 +563,6 @@
<div class="poemtab">
<div class="poemtablinks"><a href="#pretab">معلومات</a></div>
<div class="poemtablinks"><a href="#words" onclick="javascript:countPoemWords(@Model.DiwanPage.Id, @Model.DiwanPage.PoetOrCat.Cat.Id, @Model.DiwanPage.PoetOrCat.Poet.Id)">الفاظ</a></div>
<div class="poemtablinks"><a href="#manuscripts">تصاویر</a></div>
@if (Model.DiwanPage.Poem.Recitations.Where(a => a.RecitationType == RMuseum.Models.DiwanAudio.RecitationType.Normal).Any())
{
<div class="poemtablinks"><a href="#recitations">قرأتیں</a></div>
@ -770,7 +646,6 @@
<div class="poemtab">
<div class="poemtablinks"><a href="#pretab">معلومات</a></div>
<div class="poemtablinks"><a href="#words" onclick="javascript:countPoemWords(@Model.DiwanPage.Id, @Model.DiwanPage.PoetOrCat.Cat.Id, @Model.DiwanPage.PoetOrCat.Poet.Id)">الفاظ</a></div>
<div class="poemtablinks"><a href="#manuscripts">تصاویر</a></div>
@if (Model.DiwanPage.Poem.Recitations.Where(a => a.RecitationType == RMuseum.Models.DiwanAudio.RecitationType.Normal).Any())
{
<div class="poemtablinks"><a href="#recitations">قرأتیں</a></div>

View File

@ -85,7 +85,6 @@ namespace DiwanRazor
options.Conventions.AddPageRoute("/Auth/ResetPassword", "/ResetPassword");
options.Conventions.AddPageRoute("/ImageRecommendation/Pin", "/Pin");
options.Conventions.AddPageRoute("/Recitations/AudioClip", "/AudioClip");
options.Conventions.AddPageRoute("/Recitations/RecitationsOrder", "/RecitationsOrder");