divan/GanjooRazor/Pages/Simi.cshtml
Hamid Reza Mohammadi 8ff63db78e #458 unlink links
2025-01-16 18:26:27 +03:30

411 lines
20 KiB
Plaintext

@page
@model GanjooRazor.Pages.SimiModel
@{
Layout = null;
}
<!DOCTYPE html>
<html lang="fa-IR" dir="rtl">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>
@ViewData["Title"]
</title>
<link href="/css/p8.css?version=78" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="/favicon.ico?version=1" type="image/x-icon" />
<link rel="search" type="application/opensearchdescription+xml" title="گنجور" href="https://ganjoor.net/search.xml" />
<script src="/lib/jquery/dist/jquery.min.js"></script>
<script src="/js/bk.js?version=66"></script>
<script>
var cookieValue = getCookie("playerScrollLock");
var playerScrollLock = cookieValue === "true";
cookieValue = getCookie("stickyEnabled");
var stickyEnabled = cookieValue != "false";
</script>
@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>
}
</head>
<body>
@if (!string.IsNullOrEmpty(Model.LastError))
{
@Html.Raw(Model.LastError)
}
else
{
<div id="hdr2" class="clearfix">
<h1><a href="/" title="گنجور"><img src="/image/gdapk.png" alt="گنجور" /></a></h1>
<div class="actionbox">
<form action="/search" method="get" id="searchform">
<input type="text" name="s" id="s" class="inputText" value="" placeholder="جستجو" />
<input type="hidden" name="es" id="es" value="1" />
<select name="author" id="author" onchange="onSelectedPoetChanged()">
@{
if (Model.PoetId != 0)
{
<option value="0">در آثار همهٔ سخنوران</option>
}
else
{
<option value="0" selected>در آثار همهٔ سخنوران</option>
}
if (Model.Poets != null)
{
foreach (RMuseum.Models.Ganjoor.ViewModels.GanjoorPoetViewModel 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>
@{
if (Model.Poet != null)
{
<select name="cat" id="cat" style="width:150px">
<option value="0" selected>در همهٔ بخشها</option>
@{
foreach (var gran in Model.Poet.Cat.Ancestors)
{
<option value="@gran.Id">@gran.Title</option>
}
<option value="@Model.Poet.Cat.Id">@Model.Poet.Cat.Title</option>
foreach (var child in Model.Poet.Cat.Children)
{
<option value="@child.Id">@child.Title</option>
}
}
</select>
}
}
<input type="submit" value="بیاب" />
</form>
</div><!-- .actionbox -->
</div>
<!-- #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.Ganjoor.ViewModels.GanjoorPoetViewModel 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.Ganjoor.GanjoorPoemFormat)))
{
if ((RMuseum.Models.Ganjoor.GanjoorPoemFormat)poemFormat == RMuseum.Models.Ganjoor.GanjoorPoemFormat.Unknown)
{
if (RMuseum.Models.Ganjoor.GanjoorPoemFormat.Unknown == Model.Format)
{
<option value="@((int)poemFormat)" selected>همهٔ قالب‌ها</option>
}
else
{
<option value="@((int)poemFormat)">همهٔ قالب‌ها</option>
}
}
else
{
if((RMuseum.Models.Ganjoor.GanjoorPoemFormat)poemFormat == Model.Format)
{
<option value="@((int)poemFormat)" selected>@RMuseum.Services.Implementation.GanjoorPoemFormatConvertor.GetString((RMuseum.Models.Ganjoor.GanjoorPoemFormat)poemFormat)</option>
}
else
{
<option value="@((int)poemFormat)">@RMuseum.Services.Implementation.GanjoorPoemFormatConvertor.GetString((RMuseum.Models.Ganjoor.GanjoorPoemFormat)poemFormat)</option>
}
}
}
</select>
<label for="f" 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 (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>
<img src="@($"{GanjooRazor.APIRoot.InternetUrl}{poem.Category.Poet.ImageUrl}")" alt="@($"{poem.Category.Poet.Nickname}")" />
<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>
}
<div class="spacer">&nbsp;</div>
@Html.Raw(Model.PagingToolsHtml)
</div>
<partial name="_FooterPartial" model=@(new _FooterPartialModel(){StickyEnabled = true}) />
</div>
<script src="/js/vaabd.js?version=10"></script>
@if (!string.IsNullOrEmpty(ViewData["GoogleAnalyticsCode"].ToString()))
{
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=@(ViewData["GoogleAnalyticsCode"])"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', '@ViewData["GoogleAnalyticsCode"]');
</script>
}
}
</body>
</html>