removing unused pages
This commit is contained in:
parent
ad3c9a8d88
commit
0e8b8d16e0
@ -1,104 +0,0 @@
|
||||
@page
|
||||
@model GanjooRazor.Pages.BooksModel
|
||||
@{
|
||||
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=86" 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=81"></script>
|
||||
<script>
|
||||
var cookieValue = getCookie("playerScrollLock");
|
||||
var playerScrollLock = cookieValue === "true";
|
||||
|
||||
cookieValue = getCookie("stickyEnabled");
|
||||
var stickyEnabled = cookieValue != "false";
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<div id="hdr">
|
||||
<h1><a href="/" title="گنجور"><img src="/image/gdap.png" alt="گنجور" class="home-logo"></a></h1>
|
||||
</div>
|
||||
|
||||
<div id="fa">
|
||||
|
||||
<div class="actionbox">
|
||||
<form action="/search" method="get" id="searchhorm">
|
||||
<input type="text" name="s" id="s" placeholder="جستجو" class="inputText" size="35" value="">
|
||||
<input type="hidden" name="es" id="es" value="1">
|
||||
<select name="author" id="author">
|
||||
<option value="0" selected>در آثار همهٔ سخنوران</option>
|
||||
@{
|
||||
foreach (RMuseum.Models.Ganjoor.ViewModels.GanjoorPoetViewModel poet in Model.Poets)
|
||||
{
|
||||
<option value="@poet.Id">@poet.Nickname</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
<input type="submit" value="بیاب">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<partial name="_InlineLoginPartial" model="Model">
|
||||
|
||||
<div id="main">
|
||||
<div id="guides">
|
||||
|
||||
@if (!string.IsNullOrEmpty(Model.LastError))
|
||||
{
|
||||
@Model.LastError
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="clear-both">
|
||||
<input type="text" id="findbook" placeholder="جستجوی کتاب" size="35" value="" oninput="onInlineSearch(this.value, 'found-books', 'book')">
|
||||
<div class="spacer" id="found-books"></div>
|
||||
</div>
|
||||
<div class="century">
|
||||
فهرست الفبایی کتابها
|
||||
</div>
|
||||
<div class="spacer">
|
||||
@foreach (var book in Model.Books)
|
||||
{
|
||||
|
||||
<div class="poet book" data-value="@book.BookName">
|
||||
@if (book.RImageId != null)
|
||||
{
|
||||
<a href="@book.FullUrl" title="@book.BookName">
|
||||
<img src="@($"{GanjooRazor.APIRoot.InternetUrl}/api/rimages/{book.RImageId}.jpg")" alt="@book.BookName">
|
||||
</a>
|
||||
}
|
||||
|
||||
<div class="caption">
|
||||
<a href="@book.FullUrl">@book.BookName</a>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<partial name="_FooterPartial" model=@(new _FooterPartialModel(){StickyEnabled = true})>
|
||||
|
||||
</div>
|
||||
|
||||
@if (ViewData["TrackingScript"] != null && !string.IsNullOrEmpty(ViewData["TrackingScript"].ToString()))
|
||||
{
|
||||
@Html.Raw(ViewData["TrackingScript"])
|
||||
}
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -1,70 +0,0 @@
|
||||
using GanjooRazor.Utils;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using RMuseum.Models.Ganjoor.ViewModels;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace GanjooRazor.Pages
|
||||
{
|
||||
[IgnoreAntiforgeryToken(Order = 1001)]
|
||||
public class BooksModel : LoginPartialEnabledPageModel
|
||||
{
|
||||
private readonly PoetCacheService _poetCache;
|
||||
|
||||
public async Task<IActionResult> OnGetAsync()
|
||||
{
|
||||
var maintenanceResult = TryGetMaintenanceModeResult();
|
||||
if (maintenanceResult != null)
|
||||
{
|
||||
return maintenanceResult;
|
||||
}
|
||||
|
||||
ViewData["Title"] = "فهرست کتابها";
|
||||
InitializeCommonPageState();
|
||||
|
||||
var (poetsOk, poets, poetsError) = await _poetCache.GetPoetsAsync(AggressiveCacheEnabled);
|
||||
if (!poetsOk)
|
||||
{
|
||||
LastError = poetsError;
|
||||
return Page();
|
||||
}
|
||||
Poets = poets;
|
||||
|
||||
var response = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/books");
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
LastError = await ReadErrorMessageAsync(response);
|
||||
return Page();
|
||||
}
|
||||
Books = JArray.Parse(await response.Content.ReadAsStringAsync()).ToObject<List<GanjoorCatViewModel>>();
|
||||
return Page();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// books
|
||||
/// </summary>
|
||||
public List<GanjoorCatViewModel> Books { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Poets
|
||||
/// </summary>
|
||||
public List<GanjoorPoetViewModel> Poets { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// last error
|
||||
/// </summary>
|
||||
public string LastError { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// constructor
|
||||
/// </summary>
|
||||
public BooksModel(IConfiguration configuration, HttpClient httpClient, PoetCacheService poetCache) : base(httpClient, configuration)
|
||||
{
|
||||
_poetCache = poetCache;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,234 +0,0 @@
|
||||
@page
|
||||
@model GanjooRazor.Pages.TaggedModel
|
||||
@{
|
||||
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" />
|
||||
<meta name="robots" content="noindex, nofollow" />
|
||||
<title>
|
||||
@ViewData["Title"]
|
||||
</title>
|
||||
<link href="/css/p8.css?version=86" 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=81"></script>
|
||||
<script>
|
||||
var cookieValue = getCookie("playerScrollLock");
|
||||
var playerScrollLock = cookieValue === "true";
|
||||
|
||||
cookieValue = getCookie("stickyEnabled");
|
||||
var stickyEnabled = cookieValue != "false";
|
||||
</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">
|
||||
|
||||
<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>
|
||||
<datalist id="inputRhythms">
|
||||
@foreach (var language in Model.Languages)
|
||||
{
|
||||
<option value="@language.Code">@language.Name</option>
|
||||
}
|
||||
</datalist>
|
||||
<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>
|
||||
|
||||
<input type="submit" class="width-100per margin-top-5px" value="اعمال ورودیها" />
|
||||
|
||||
|
||||
</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">
|
||||
<h2>
|
||||
<a href="@poem.FullUrl">@poem.FullTitle</a>
|
||||
</h2>
|
||||
<div class="spacer"> </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"> </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>
|
||||
}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="spacer"> </div>
|
||||
|
||||
@Html.Raw(Model.PagingToolsHtml)
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<partial name="_FooterPartial" model=@(new _FooterPartialModel(){StickyEnabled = true}) />
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<script src="/js/vaabd.js?version=10"></script>
|
||||
|
||||
@if (ViewData["TrackingScript"] != null && !string.IsNullOrEmpty(ViewData["TrackingScript"].ToString()))
|
||||
{
|
||||
@Html.Raw(ViewData["TrackingScript"])
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -1,202 +0,0 @@
|
||||
using DNTPersianUtils.Core;
|
||||
using GanjooRazor.Utils;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using RMuseum.Models.Ganjoor.ViewModels;
|
||||
using RMuseum.Models.Ganjoor;
|
||||
using RMuseum.Utils;
|
||||
using RSecurityBackend.Models.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
|
||||
namespace GanjooRazor.Pages
|
||||
{
|
||||
[IgnoreAntiforgeryToken(Order = 1001)]
|
||||
public class TaggedModel : LoginPartialEnabledPageModel
|
||||
{
|
||||
private readonly PoetCacheService _poetCache;
|
||||
|
||||
/// <summary>
|
||||
/// constructor
|
||||
/// </summary>
|
||||
public TaggedModel(HttpClient httpClient, IConfiguration configuration, PoetCacheService poetCache) : base(httpClient, configuration)
|
||||
{
|
||||
_poetCache = poetCache;
|
||||
}
|
||||
|
||||
public List<GanjoorPoetViewModel> Poets { get; set; }
|
||||
public int PoetId { get; set; }
|
||||
public GanjoorPoetCompleteViewModel Poet { get; set; }
|
||||
public List<GanjoorPoemCompleteViewModel> Poems { get; set; }
|
||||
public string PagingToolsHtml { get; set; }
|
||||
public string LastError { get; set; }
|
||||
public string Language { get; set; }
|
||||
|
||||
public GanjoorLanguage[] Languages { get; set; }
|
||||
|
||||
private async Task ReadLanguagesAsync()
|
||||
{
|
||||
HttpResponseMessage response = await _httpClient.GetAsync($"{APIRoot.Url}/api/translations/languages");
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
LastError = await ReadErrorMessageAsync(response);
|
||||
return;
|
||||
}
|
||||
|
||||
Languages = JsonConvert.DeserializeObject<GanjoorLanguage[]>(await response.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnGetPoetInformationAsync(int id)
|
||||
{
|
||||
if (id == 0)
|
||||
{
|
||||
return new OkObjectResult(null);
|
||||
}
|
||||
var (success, poet, error) = await _poetCache.GetPoetAsync(id, AggressiveCacheEnabled);
|
||||
if (!success)
|
||||
{
|
||||
return BadRequest(error);
|
||||
}
|
||||
return new OkObjectResult(poet);
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnGetAsync()
|
||||
{
|
||||
var maintenanceResult = TryGetMaintenanceModeResult();
|
||||
if (maintenanceResult != null)
|
||||
{
|
||||
return maintenanceResult;
|
||||
}
|
||||
|
||||
InitializeCommonPageState();
|
||||
|
||||
PoetId = string.IsNullOrEmpty(Request.Query["a"]) ? 0 : int.Parse(Request.Query["a"]);
|
||||
|
||||
//todo: use html master layout or make it partial
|
||||
// 1. poets
|
||||
var (poetsOk, poets, poetsError) = await _poetCache.GetPoetsAsync(AggressiveCacheEnabled);
|
||||
if (!poetsOk)
|
||||
{
|
||||
LastError = poetsError;
|
||||
return Page();
|
||||
}
|
||||
Poets = poets;
|
||||
await ReadLanguagesAsync();
|
||||
|
||||
if (PoetId != 0)
|
||||
{
|
||||
var (poetOk, poet, poetError) = await _poetCache.GetPoetAsync(PoetId, AggressiveCacheEnabled);
|
||||
if (!poetOk)
|
||||
{
|
||||
LastError = poetError;
|
||||
return Page();
|
||||
}
|
||||
Poet = poet;
|
||||
}
|
||||
|
||||
// 2. search verses
|
||||
|
||||
|
||||
|
||||
var rhythmResponse = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/rhythms?sortOnVerseCount=true");
|
||||
if (!rhythmResponse.IsSuccessStatusCode)
|
||||
{
|
||||
LastError = await ReadErrorMessageAsync(rhythmResponse);
|
||||
return Page();
|
||||
}
|
||||
|
||||
|
||||
int pageNumber = 1;
|
||||
if (!string.IsNullOrEmpty(Request.Query["page"]))
|
||||
{
|
||||
pageNumber = int.Parse(Request.Query["page"]);
|
||||
}
|
||||
|
||||
Language = Request.Query["l"];
|
||||
|
||||
Language ??= "fa-IR";
|
||||
|
||||
|
||||
|
||||
string title = "شعرها یا ابیات ";
|
||||
|
||||
if (PoetId != 0)
|
||||
{
|
||||
var poetInfo = Poets.Where(p => p.Id == PoetId).SingleOrDefault();
|
||||
if (poetInfo != null)
|
||||
{
|
||||
title += $"{poetInfo.Nickname} ";
|
||||
}
|
||||
}
|
||||
var langModel = Languages.Where(l => l.Code == Language).FirstOrDefault();
|
||||
if (langModel != null)
|
||||
{
|
||||
title += $"با زبان غالب «{langModel.Name}»";
|
||||
}
|
||||
|
||||
|
||||
|
||||
string url = $"{APIRoot.Url}/api/ganjoor/sections/tagged/language?PageNumber={pageNumber}&PageSize=20&language={Language}&poetId={PoetId}";
|
||||
var response = await _httpClient.GetAsync(url);
|
||||
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
LastError = await ReadErrorMessageAsync(response);
|
||||
return Page();
|
||||
}
|
||||
|
||||
Poems = JArray.Parse(await response.Content.ReadAsStringAsync()).ToObject<List<GanjoorPoemCompleteViewModel>>();
|
||||
|
||||
foreach (var poem in Poems)
|
||||
{
|
||||
poem.HtmlText = GanjoorPoemTools.GetPoemHtmlExcerpt(poem.HtmlText);
|
||||
}
|
||||
|
||||
string paginnationMetadata = response.Headers.GetValues("paging-headers").FirstOrDefault();
|
||||
PaginationMetadata paginationMetadata = JsonConvert.DeserializeObject<PaginationMetadata>(paginnationMetadata);
|
||||
|
||||
string htmlText = "";
|
||||
if (paginationMetadata.totalPages > 1)
|
||||
{
|
||||
htmlText = $"<div>{Environment.NewLine}";
|
||||
string authorParam = PoetId != 0 ? $"&a={PoetId}" : "";
|
||||
title += $" - صفحهٔ {pageNumber.ToPersianNumbers()}";
|
||||
if (paginationMetadata.currentPage > 3)
|
||||
{
|
||||
htmlText += $"<a href=\"/tagged/?l={Uri.EscapeDataString(Language)}&page=1{authorParam}\"><div class=\"circled-number\">۱</div></a> …";
|
||||
}
|
||||
for (int i = paginationMetadata.currentPage - 2; i <= (paginationMetadata.currentPage + 2); i++)
|
||||
{
|
||||
if (i >= 1 && i <= paginationMetadata.totalPages)
|
||||
{
|
||||
if (i == paginationMetadata.currentPage)
|
||||
{
|
||||
htmlText += $"<div class=\"circled-number-diff\">{i.ToPersianNumbers()}</div>{Environment.NewLine}";
|
||||
}
|
||||
else
|
||||
{
|
||||
htmlText += $"<a href=\"/tagged/?l={Uri.EscapeDataString(Language)}&page={i}{authorParam}\"><div class=\"circled-number\">{i.ToPersianNumbers()}</div></a>{Environment.NewLine}";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (paginationMetadata.totalPages > (paginationMetadata.currentPage + 2))
|
||||
{
|
||||
htmlText += $"… <a href=\"/tagged/?l={Uri.EscapeDataString(Language)}&page={paginationMetadata.totalPages}{authorParam}\"><div class=\"circled-number\">{paginationMetadata.totalPages.ToPersianNumbers()}</div></a>{Environment.NewLine}";
|
||||
}
|
||||
htmlText += $"</div>{Environment.NewLine}";
|
||||
}
|
||||
|
||||
ViewData["Title"] = $"گنجور » {title}";
|
||||
PagingToolsHtml = htmlText;
|
||||
|
||||
return Page();
|
||||
}
|
||||
public string HtmlText { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user