divan/DiwanRazor/Pages/Simi.cshtml
Anas Rashid 020b010483 Urdu public pages, batch 2 (#2): auth, errors, map, FAQ, similar poems, people pages, page titles
- translate remaining public views and page-model strings (titles, messages, relation names)
- Urdu stopword list for word-frequency stats (replaces Persian list)
- error pages: drop list of alternative Ganjoor services

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 00:22:09 +02:00

346 lines
18 KiB
Plaintext

@page
@using DNTPersianUtils.Core
@model DiwanRazor.Pages.SimiModel
@{
Layout = "_Layout";
}
@section Head {
@if (Model.CanEdit)
{
<script>
function redirectToTransferMeter() {
var meter = document.getElementById("v").value;
window.location.href = "/Admin/TransferMeter?m=" + encodeURIComponent(meter);
}
</script>
}
@if (Model.LoggedIn)
{
<script>
function sendSectionMetreSuggection(poemId, sectionIndex) {
var ext = '-' + poemId.toString() + '-' + sectionIndex.toString();
var elName = '#rhythm-new' + '-' + poemId.toString() + '-' + sectionIndex.toString();
var rhythm_new = $(elName).val();
$('#savecorrections' + ext).hide();
var url = '?handler=SendSectionMetreSuggestion';
$.ajax({
type: "POST",
url: url,
data: {
poemId: poemId,
sectionIndex: sectionIndex,
rhythm: rhythm_new,
},
success: function () {
var block = "#poem-" + poemId.toString() + "-section-" + sectionIndex.toString();
$(block).remove();
},
error: function (e) {
if (e.responseText == null)
alert(e);
else
alert(e.responseText);
}
});
}
</script>
}
}
@if (!string.IsNullOrEmpty(Model.LastError))
{
@Html.Raw(Model.LastError)
}
else
{
<partial name="_SearchHeaderPartial" model="@(new _SearchHeaderPartialModel(){ Poets = Model.Poets, SelectedPoetId = Model.PoetId, CurrentCategory = Model.Poet?.Cat })" />
<!-- #hdr2 -->
<div id="fa">
<div id="maincnt">
<partial name="_InlineLoginPartial" model="Model" />
<div class="sitem actionbox">
<div class="related-images-frame">
<form method="get" id="simiform">
<label for="a" class="width-100per">شاعر:</label>
<script>
function syncInputs(){
document.getElementById('poets-search').value = document.getElementById('fake-poet-search').value;
doSearchInRhythmsCombo('poets-search', 'a');
}
</script>
<input class="width-100per" type="text" id="fake-poet-search" placeholder="شاعر تلاش کریں" oninput="syncInputs()" autocomplete="off" size="50" />
<input type="hidden" id="poets-search" placeholder="شاعر تلاش کریں" list="inputPoets" autocomplete="off" size="50" />
<datalist id="inputPoets">
@if (Model.Poets != null)
@foreach (var poet in Model.Poets)
{
<option value="@poet.Id">@poet.Nickname</option>
}
</datalist>
<select name="a" id="a" class="width-100per">
@{
if (Model.PoetId != 0)
{
<option value="0">تمام شعرا کے کلام میں</option>
}
else
{
<option value="0" selected>تمام شعرا کے کلام میں</option>
}
if (Model.Poets != null)
{
foreach (RMuseum.Models.Diwan.ViewModels.DiwanPoetViewModel poet in Model.Poets)
{
if (poet.Id == Model.PoetId)
{
<option value="@poet.Id" selected>@poet.Nickname</option>
}
else
{
<option value="@poet.Id">@poet.Nickname</option>
}
}
}
}
</select>
<label for="v" class="width-100per">بحر:</label>
<input class="width-100per" type="text" id="select-search" placeholder="بحر تلاش کریں" oninput="doSearchInRhythmsCombo('select-search', 'v')" list="inputRhythms" autocomplete="off" size="50" />
<datalist id="inputRhythms">
@if (Model.RhythmsByVerseCount != null)
@foreach (var rhythm in Model.RhythmsByVerseCount)
{
<option value="@rhythm.Rhythm">@rhythm.Rhythm</option>
}
</datalist>
<select id="v" name="v" class="width-100per">
@foreach (var rhythm in Model.RhythmsAlphabetically)
{
if (Model.Metre == rhythm.Rhythm)
{
<option value="@rhythm.Rhythm" selected>@(rhythm.Rhythm == "" ? "کوئی نہیں" : rhythm.Rhythm == "null" ? "بحر متعین نہیں" : rhythm.Rhythm)</option>
}
else
{
<option value="@rhythm.Rhythm">@(rhythm.Rhythm == "" ? "کوئی نہیں" : rhythm.Rhythm == "null" ? "بحر متعین نہیں" : rhythm.Rhythm)</option>
}
}
</select>
<label for="g" class="width-100per">قافیہ:</label>
<input type="text" name="g" id="g" class="width-100per" value="@Model.Rhyme" placeholder="حروفِ قافیہ" />
<label for="v" class="width-100per">غالب زبان:</label>
<select id="l" name="l" class="width-100per">
@foreach (var language in Model.Languages)
{
if (Model.Language == language.Code)
{
<option value="@language.Code" selected>@language.Name</option>
}
else
{
<option value="@language.Code">@language.Name</option>
}
}
</select>
<label for="f" class="width-100per">صنفِ سخن:</label>
<select id="f" name="f" class="width-100per">
@foreach (var poemFormat in System.Enum.GetValues(typeof(RMuseum.Models.Diwan.DiwanPoemFormat)))
{
if ((RMuseum.Models.Diwan.DiwanPoemFormat)poemFormat == RMuseum.Models.Diwan.DiwanPoemFormat.Unknown)
{
if (RMuseum.Models.Diwan.DiwanPoemFormat.Unknown == Model.Format)
{
<option value="@((int)poemFormat)" selected>تمام اصناف</option>
}
else
{
<option value="@((int)poemFormat)">تمام اصناف</option>
}
}
else
{
if ((RMuseum.Models.Diwan.DiwanPoemFormat)poemFormat == Model.Format)
{
<option value="@((int)poemFormat)" selected>@RMuseum.Services.Implementation.DiwanPoemFormatConvertor.GetString((RMuseum.Models.Diwan.DiwanPoemFormat)poemFormat)</option>
}
else
{
<option value="@((int)poemFormat)">@RMuseum.Services.Implementation.DiwanPoemFormatConvertor.GetString((RMuseum.Models.Diwan.DiwanPoemFormat)poemFormat)</option>
}
}
}
</select>
<label for="c1" class="width-100per">اشعار کی کم از کم تعداد:</label>
<input type="number" name="c1" id="c1" class="width-100per" value="@Model.CoupletCountsFrom" placeholder="اشعار کی کم از کم تعداد" />
<label for="c2" class="width-100per">اشعار کی زیادہ سے زیادہ تعداد:</label>
<input type="number" name="c2" id="c2" class="width-100per" value="@Model.CoupletCountsTo" placeholder="اشعار کی زیادہ سے زیادہ تعداد" />
<label class="width-100per">کلیدی لفظ (پورے صفحے میں تلاش؛ بہتر تلاش کے لیے <a href="/search?s=@Model.Query">تلاش کا صفحہ</a> استعمال کریں):</label>
<input type="text" name="s" id="s" class="width-100per" value="@Model.Query" placeholder="کلیدی لفظ" />
@if (Model.ExactSearch)
{
<input type="hidden" name="es" id="es" value="1" />
}
@if (Model.CatId != 0)
{
<div class="width-100per">
صرف اس حصے میں <a href="@Model.CatFullUrl">@Model.CatFullTitle</a>
</div>
}
<input type="submit" class="width-100per margin-top-5px" value="شرائط لاگو کریں" />
@if (Model.CanEdit)
{
<a onclick="redirectToTransferMeter()" class="pagebutton" role="button">بحر منتقل کریں</a>
}
</form>
</div><!-- related-images-frame -->
</div> <!-- comments-like-div -->
@if (!string.IsNullOrEmpty(Model.PagingToolsHtml))
{
<div class="spacer">&nbsp;</div>
@Html.Raw(Model.PagingToolsHtml)
<div class="spacer">&nbsp;</div>
}
@if (Model.Poems == null)
{
<div class="sitem">
<p>براہِ کرم مطلوبہ اشعار کی معلومات درج کریں.</p>
</div>
}
else
if (Model.Poems.Count == 0)
{
<div class="sitem">
<p>مطلوبہ شعر نہیں ملا.</p>
</div>
}
else
foreach (var poem in Model.Poems)
{
<div class="sitem" id="poem-@poem.Id-section-@poem.SectionIndex">
<h2>
<a href="@poem.FullUrl">@poem.FullTitle</a>
</h2>
<div class="spacer">&nbsp;</div>
<div class="sit">
@Html.Raw(poem.HtmlText)
</div>
<div>
@($"{(poem.CoupletsCount ?? 0).ToPersianNumbers()} شعر")
</div>
<div class="poet">
<img src="@($"{DiwanRazor.APIRoot.InternetUrl}{poem.Category.Poet.ImageUrl}")" alt="@($"{poem.Category.Poet.Nickname}")" />
<a role="button" onclick="deletePoetFromSearch(@poem.Category.Poet.Id, '@(poem.Category.Poet.Nickname)')" class="actionlink" title="ہٹائیں @($"{poem.Category.Poet.Nickname}") نتائج سے"><i class="notranslate noindent-info-button close-button"></i></a>
</div>
<div class="spacer">&nbsp;</div>
<div>
@if (Model.LoggedIn)
{
<a href="/User/Section?poemId=@poem.Id&index=@poem.SectionIndex" role="button" class="cursor-pointer" title="ترمیم">
<div class="circled-number">
<i class="notranslate noindent-info-button edit-poem-button"></i>
</div>
</a>
if (Model.LoggedIn && Model.Metre == "null")
{
<table>
<tr>
<td>
<label for="select-search-@poem.Id-@poem.SectionIndex">بحر تلاش کریں:</label><br />
<input type="text" id="select-search-@poem.Id-@poem.SectionIndex" value="" oninput="doSearchInRhythmsCombo('select-search-@poem.Id-@poem.SectionIndex', 'rhythm-new-@poem.Id-@poem.SectionIndex')" list="inputRhythms-@poem.Id-@poem.SectionIndex" autocomplete="off" size="50" />
<datalist id="inputRhythms-@poem.Id-@poem.SectionIndex">
@if (Model.RhythmsByVerseCount != null)
@foreach (var rhythm in Model.RhythmsByVerseCount)
{
<option value="@rhythm.Rhythm">@rhythm.Rhythm</option>
}
</datalist>
</td>
</tr>
<tr>
<td>
<label for="rhythm-new-@poem.Id-@poem.SectionIndex">منتخب بحر:</label>
<br />
<select id="rhythm-new-@poem.Id-@poem.SectionIndex" name="rhythm-new-@poem.Id-@poem.SectionIndex">
@foreach (var rhythm in Model.RhythmsAlphabetically)
{
<option value="@rhythm.Rhythm">@(rhythm.Rhythm == "" ? "کوئی نہیں" : rhythm.Rhythm == "null" ? "بحر متعین نہیں" : rhythm.Rhythm)</option>
}
</select>
</td>
</tr>
<tr>
<td>
<a role="button" id="savecorrections-@poem.Id-@poem.SectionIndex" style="cursor:pointer;width:100%;color:white;background-color:green;display:block" onclick="sendSectionMetreSuggection(@poem.Id, @poem.SectionIndex)">محفوظ کریں</a>
</td>
</tr>
</table>
}
}
</div>
</div>
}
@if (!string.IsNullOrEmpty(Model.PagingToolsHtml))
{
<div class="spacer">&nbsp;</div>
@Html.Raw(Model.PagingToolsHtml)
<div class="spacer">&nbsp;</div>
<div>
کل نتائج: @Model.PaginationMetadata.totalCount.ToPersianNumbers()
</div>
}
</div>
<partial name="_FooterPartial" model=@(new _FooterPartialModel(){StickyEnabled = true}) />
</div>
@if (ViewData["TrackingScript"] != null && !string.IsNullOrEmpty(ViewData["TrackingScript"].ToString()))
{
@Html.Raw(ViewData["TrackingScript"])
}
}