diff --git a/GanjooRazor/Areas/Admin/Pages/CatUtils.cshtml.cs b/DiwanRazor/Areas/Admin/Pages/CatUtils.cshtml.cs
similarity index 83%
rename from GanjooRazor/Areas/Admin/Pages/CatUtils.cshtml.cs
rename to DiwanRazor/Areas/Admin/Pages/CatUtils.cshtml.cs
index d6e2e5c2..ae73b227 100644
--- a/GanjooRazor/Areas/Admin/Pages/CatUtils.cshtml.cs
+++ b/DiwanRazor/Areas/Admin/Pages/CatUtils.cshtml.cs
@@ -1,20 +1,20 @@
-using GanjooRazor.Pages;
-using GanjooRazor.Utils;
+using DiwanRazor.Pages;
+using DiwanRazor.Utils;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Memory;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
-using RMuseum.Models.Ganjoor;
-using RMuseum.Models.Ganjoor.ViewModels;
+using RMuseum.Models.Diwan;
+using RMuseum.Models.Diwan.ViewModels;
using System.IO;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
-namespace GanjooRazor.Areas.Admin.Pages
+namespace DiwanRazor.Areas.Admin.Pages
{
- public class CatUtilsModel : GanjoorPageModelBase
+ public class CatUtilsModel : DiwanPageModelBase
{
///
/// constructor
@@ -28,21 +28,21 @@ namespace GanjooRazor.Areas.Admin.Pages
///
/// category
///
- public GanjoorPoetCompleteViewModel Cat { get; set; }
+ public DiwanPoetCompleteViewModel Cat { get; set; }
///
/// cat page
///
- public GanjoorPageCompleteViewModel PageInformation { get; set; }
+ public DiwanPageCompleteViewModel PageInformation { get; set; }
[BindProperty]
- public GanjoorBatchNamingModel NamingModel { get; set; }
+ public DiwanBatchNamingModel NamingModel { get; set; }
///
/// rythm
///
- public GanjoorMetre[] Rhythms { get; set; }
+ public DiwanMetre[] Rhythms { get; set; }
///
@@ -58,18 +58,18 @@ namespace GanjooRazor.Areas.Admin.Pages
///
/// numbering patterns
///
- public GanjoorNumbering[] Numberings { get; set; }
+ public DiwanNumbering[] Numberings { get; set; }
///
/// numbering model
///
[BindProperty]
- public GanjoorNumbering NumberingModel { get; set; }
+ public DiwanNumbering NumberingModel { get; set; }
- public GanjoorLanguage[] Languages { get; set; }
+ public DiwanLanguage[] Languages { get; set; }
[BindProperty]
- public GanjoorCatViewModel CatMeta { get; set; }
+ public DiwanCatViewModel CatMeta { get; set; }
public PoemRelatedImageEx[] PoemRelatedImages { get; set; }
@@ -82,7 +82,7 @@ namespace GanjooRazor.Areas.Admin.Pages
return;
}
- Languages = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync());
+ Languages = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync());
}
[BindProperty]
@@ -90,17 +90,17 @@ namespace GanjooRazor.Areas.Admin.Pages
private async Task GetInformationAsync()
{
- var response = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/cat?url={Request.Query["url"]}&poems=true&mainSections=true");
+ var response = await _httpClient.GetAsync($"{APIRoot.Url}/api/diwan/cat?url={Request.Query["url"]}&poems=true&mainSections=true");
if (!response.IsSuccessStatusCode)
{
LastMessage = await ReadErrorMessageAsync(response);
return false;
}
- Cat = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync());
+ Cat = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync());
if (CatMeta == null)
{
- CatMeta = new GanjoorCatViewModel()
+ CatMeta = new DiwanCatViewModel()
{
Id = Cat.Cat.Id,
BookName = Cat.Cat.BookName,
@@ -110,21 +110,21 @@ namespace GanjooRazor.Areas.Admin.Pages
}
- var pageQuery = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/page?url={Request.Query["url"]}");
+ var pageQuery = await _httpClient.GetAsync($"{APIRoot.Url}/api/diwan/page?url={Request.Query["url"]}");
if (!pageQuery.IsSuccessStatusCode)
{
LastMessage = await ReadErrorMessageAsync(pageQuery);
return false;
}
- PageInformation = JObject.Parse(await pageQuery.Content.ReadAsStringAsync()).ToObject();
+ PageInformation = JObject.Parse(await pageQuery.Content.ReadAsStringAsync()).ToObject();
- var rhythmsResponse = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/rhythms");
+ var rhythmsResponse = await _httpClient.GetAsync($"{APIRoot.Url}/api/diwan/rhythms");
if (!rhythmsResponse.IsSuccessStatusCode)
{
LastMessage = await ReadErrorMessageAsync(rhythmsResponse);
return false;
}
- Rhythms = JsonConvert.DeserializeObject(await rhythmsResponse.Content.ReadAsStringAsync());
+ Rhythms = JsonConvert.DeserializeObject(await rhythmsResponse.Content.ReadAsStringAsync());
var numberings = await _httpClient.GetAsync($"{APIRoot.Url}/api/numberings/cat/{Cat.Cat.Id}");
if (!numberings.IsSuccessStatusCode)
@@ -132,11 +132,11 @@ namespace GanjooRazor.Areas.Admin.Pages
LastMessage = await ReadErrorMessageAsync(numberings);
return false;
}
- Numberings = JsonConvert.DeserializeObject(await numberings.Content.ReadAsStringAsync());
+ Numberings = JsonConvert.DeserializeObject(await numberings.Content.ReadAsStringAsync());
if (!string.IsNullOrEmpty(Request.Query["images"]))
{
- var images = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/cat/{Cat.Cat.Id}/images");
+ var images = await _httpClient.GetAsync($"{APIRoot.Url}/api/diwan/cat/{Cat.Cat.Id}/images");
if (!images.IsSuccessStatusCode)
{
LastMessage = await ReadErrorMessageAsync(images);
@@ -168,7 +168,7 @@ namespace GanjooRazor.Areas.Admin.Pages
await GetInformationAsync();
- NamingModel = new GanjoorBatchNamingModel()
+ NamingModel = new DiwanBatchNamingModel()
{
StartWithNotIncludingSpaces = "شمارهٔ ",
RemovePreviousPattern = true,
@@ -176,7 +176,7 @@ namespace GanjooRazor.Areas.Admin.Pages
Simulate = true
};
- NumberingModel = new GanjoorNumbering()
+ NumberingModel = new DiwanNumbering()
{
Name = Cat.Cat.Title,
StartCatId = Cat.Cat.Id,
@@ -191,11 +191,11 @@ namespace GanjooRazor.Areas.Admin.Pages
///
///
///
- public async Task OnPostAsync(GanjoorBatchNamingModel NamingModel)
+ public async Task OnPostAsync(DiwanBatchNamingModel NamingModel)
{
await GetInformationAsync();
- NumberingModel = new GanjoorNumbering()
+ NumberingModel = new DiwanNumbering()
{
Name = Cat.Cat.Title,
StartCatId = Cat.Cat.Id,
@@ -205,15 +205,15 @@ namespace GanjooRazor.Areas.Admin.Pages
// Full-page form post: re-renders the page with LastMessage on failure rather than
// returning a bare error result, so this keeps its own client/session block instead of
// going through WithSecureClientAsync (which is for AJAX-style handlers).
- using (HttpClient secureClient = new HttpClient(new GanjoorReloginHandler(Request, Response)))
+ using (HttpClient secureClient = new HttpClient(new DiwanReloginHandler(Request, Response)))
{
- await GanjoorSessionChecker.PrepareClient(secureClient, Request, Response);
+ await DiwanSessionChecker.PrepareClient(secureClient, Request, Response);
if (Request.Form["renameSubcats"].Count == 1)
{
foreach (var subCat in Cat.Cat.Children)
{
- HttpResponseMessage response = await secureClient.PutAsync($"{APIRoot.Url}/api/ganjoor/cat/recaptionpoems/{subCat.Id}", new StringContent(JsonConvert.SerializeObject(NamingModel), Encoding.UTF8, "application/json"));
+ HttpResponseMessage response = await secureClient.PutAsync($"{APIRoot.Url}/api/diwan/cat/recaptionpoems/{subCat.Id}", new StringContent(JsonConvert.SerializeObject(NamingModel), Encoding.UTF8, "application/json"));
if (!response.IsSuccessStatusCode)
{
LastMessage = await ReadErrorMessageAsync(response);
@@ -227,7 +227,7 @@ namespace GanjooRazor.Areas.Admin.Pages
}
else
{
- HttpResponseMessage response = await secureClient.PutAsync($"{APIRoot.Url}/api/ganjoor/cat/recaptionpoems/{Cat.Cat.Id}", new StringContent(JsonConvert.SerializeObject(NamingModel), Encoding.UTF8, "application/json"));
+ HttpResponseMessage response = await secureClient.PutAsync($"{APIRoot.Url}/api/diwan/cat/recaptionpoems/{Cat.Cat.Id}", new StringContent(JsonConvert.SerializeObject(NamingModel), Encoding.UTF8, "application/json"));
if (!response.IsSuccessStatusCode)
{
LastMessage = await ReadErrorMessageAsync(response);
@@ -245,12 +245,12 @@ namespace GanjooRazor.Areas.Admin.Pages
return Page();
}
- public async Task OnPostNumberingAsync(GanjoorNumbering NumberingModel)
+ public async Task OnPostNumberingAsync(DiwanNumbering NumberingModel)
{
// Same note as OnPostAsync above re: full-page form post.
- using (HttpClient secureClient = new HttpClient(new GanjoorReloginHandler(Request, Response)))
+ using (HttpClient secureClient = new HttpClient(new DiwanReloginHandler(Request, Response)))
{
- await GanjoorSessionChecker.PrepareClient(secureClient, Request, Response);
+ await DiwanSessionChecker.PrepareClient(secureClient, Request, Response);
HttpResponseMessage response = await secureClient.PostAsync($"{APIRoot.Url}/api/numberings", new StringContent(JsonConvert.SerializeObject(NumberingModel), Encoding.UTF8, "application/json"));
if (!response.IsSuccessStatusCode)
@@ -261,7 +261,7 @@ namespace GanjooRazor.Areas.Admin.Pages
await GetInformationAsync();
- NamingModel = new GanjoorBatchNamingModel()
+ NamingModel = new DiwanBatchNamingModel()
{
StartWithNotIncludingSpaces = "شمارهٔ ",
RemovePreviousPattern = true,
@@ -289,7 +289,7 @@ namespace GanjooRazor.Areas.Admin.Pages
{
return WithSecureClientAsync(async secureClient =>
{
- var response = await secureClient.PutAsync($"{APIRoot.Url}/api/ganjoor/cat/startassigningrhymes/{id}/{false}", null);
+ var response = await secureClient.PutAsync($"{APIRoot.Url}/api/diwan/cat/startassigningrhymes/{id}/{false}", null);
if (!response.IsSuccessStatusCode)
{
return new BadRequestObjectResult(await ReadErrorMessageAsync(response));
@@ -302,7 +302,7 @@ namespace GanjooRazor.Areas.Admin.Pages
{
return WithSecureClientAsync(async secureClient =>
{
- var response = await secureClient.PutAsync($"{APIRoot.Url}/api/ganjoor/cat/subcats/startgentoc/{id}", null);
+ var response = await secureClient.PutAsync($"{APIRoot.Url}/api/diwan/cat/subcats/startgentoc/{id}", null);
if (!response.IsSuccessStatusCode)
{
return new BadRequestObjectResult(await ReadErrorMessageAsync(response));
@@ -315,7 +315,7 @@ namespace GanjooRazor.Areas.Admin.Pages
{
return WithSecureClientAsync(async secureClient =>
{
- var response = await secureClient.PutAsync($"{APIRoot.Url}/api/ganjoor/cat/startassigningrhythms/{id}/{false}?rhythm={rhythm}", null);
+ var response = await secureClient.PutAsync($"{APIRoot.Url}/api/diwan/cat/startassigningrhythms/{id}/{false}?rhythm={rhythm}", null);
if (!response.IsSuccessStatusCode)
{
return new BadRequestObjectResult(await ReadErrorMessageAsync(response));
@@ -328,7 +328,7 @@ namespace GanjooRazor.Areas.Admin.Pages
{
return WithSecureClientAsync(async secureClient =>
{
- var response = await secureClient.PutAsync($"{APIRoot.Url}/api/ganjoor/cat/{id}/regenrelatedsections", null);
+ var response = await secureClient.PutAsync($"{APIRoot.Url}/api/diwan/cat/{id}/regenrelatedsections", null);
if (!response.IsSuccessStatusCode)
{
return new BadRequestObjectResult(await ReadErrorMessageAsync(response));
@@ -341,7 +341,7 @@ namespace GanjooRazor.Areas.Admin.Pages
{
return WithSecureClientAsync(async secureClient =>
{
- var response = await secureClient.PutAsync($"{APIRoot.Url}/api/ganjoor/cat/language/{id}/{language}", null);
+ var response = await secureClient.PutAsync($"{APIRoot.Url}/api/diwan/cat/language/{id}/{language}", null);
if (!response.IsSuccessStatusCode)
{
return new BadRequestObjectResult(await ReadErrorMessageAsync(response));
@@ -350,11 +350,11 @@ namespace GanjooRazor.Areas.Admin.Pages
}, new OkObjectResult(false));
}
- public Task OnPostSetCategoryPoemFormatAsync(int id, GanjoorPoemFormat format)
+ public Task OnPostSetCategoryPoemFormatAsync(int id, DiwanPoemFormat format)
{
return WithSecureClientAsync(async secureClient =>
{
- var response = await secureClient.PutAsync($"{APIRoot.Url}/api/ganjoor/cat/poemformat/{id}/{format}", null);
+ var response = await secureClient.PutAsync($"{APIRoot.Url}/api/diwan/cat/poemformat/{id}/{format}", null);
if (!response.IsSuccessStatusCode)
{
return new BadRequestObjectResult(await ReadErrorMessageAsync(response));
@@ -395,9 +395,9 @@ namespace GanjooRazor.Areas.Admin.Pages
// Full-page form post (file upload): re-renders the page with LastMessage, so this keeps
// its own client/session block rather than using WithSecureClientAsync.
- using (HttpClient secureClient = new HttpClient(new GanjoorReloginHandler(Request, Response)))
+ using (HttpClient secureClient = new HttpClient(new DiwanReloginHandler(Request, Response)))
{
- await GanjoorSessionChecker.PrepareClient(secureClient, Request, Response);
+ await DiwanSessionChecker.PrepareClient(secureClient, Request, Response);
MultipartFormDataContent form = new MultipartFormDataContent();
@@ -407,7 +407,7 @@ namespace GanjooRazor.Areas.Admin.Pages
var fileContent = stream.ToArray();
form.Add(new ByteArrayContent(fileContent, 0, fileContent.Length), Cat.Poet.Nickname, SQLiteDb.FileName);
- HttpResponseMessage response = await secureClient.PostAsync($"{APIRoot.Url}/api/ganjoor/sqlite/import/cat/{Cat.Cat.Id}", form);
+ HttpResponseMessage response = await secureClient.PostAsync($"{APIRoot.Url}/api/diwan/sqlite/import/cat/{Cat.Cat.Id}", form);
if (!response.IsSuccessStatusCode)
{
LastMessage = await ReadErrorMessageAsync(response);
@@ -426,7 +426,7 @@ namespace GanjooRazor.Areas.Admin.Pages
{
return WithSecureClientAsync(async secureClient =>
{
- var response = await secureClient.DeleteAsync($"{APIRoot.Url}/api/ganjoor/poem/{id}");
+ var response = await secureClient.DeleteAsync($"{APIRoot.Url}/api/diwan/poem/{id}");
if (!response.IsSuccessStatusCode)
{
return new BadRequestObjectResult(await ReadErrorMessageAsync(response));
@@ -439,7 +439,7 @@ namespace GanjooRazor.Areas.Admin.Pages
{
return WithSecureClientAsync(async secureClient =>
{
- var response = await secureClient.PutAsync($"{APIRoot.Url}/api/ganjoor/cat/reslugpoems/{id}", null);
+ var response = await secureClient.PutAsync($"{APIRoot.Url}/api/diwan/cat/reslugpoems/{id}", null);
if (!response.IsSuccessStatusCode)
{
return new BadRequestObjectResult(await ReadErrorMessageAsync(response));
@@ -448,16 +448,16 @@ namespace GanjooRazor.Areas.Admin.Pages
}, new OkObjectResult(false));
}
- public async Task OnPostUpdateCatMeta(GanjoorCatViewModel CatMeta)
+ public async Task OnPostUpdateCatMeta(DiwanCatViewModel CatMeta)
{
await GetInformationAsync();
// Full-page form post: re-renders the page with LastMessage on failure (or redirects on
// success), so this keeps its own client/session block rather than using
// WithSecureClientAsync.
- using (HttpClient secureClient = new HttpClient(new GanjoorReloginHandler(Request, Response)))
+ using (HttpClient secureClient = new HttpClient(new DiwanReloginHandler(Request, Response)))
{
- await GanjoorSessionChecker.PrepareClient(secureClient, Request, Response);
+ await DiwanSessionChecker.PrepareClient(secureClient, Request, Response);
CatMeta.BookName ??= "";
CatMeta.MapName ??= "";
@@ -478,7 +478,7 @@ namespace GanjooRazor.Areas.Admin.Pages
form.Add(new ByteArrayContent(fileContent, 0, fileContent.Length), CatMeta.BookName, CatMeta.NewImage.FileName);
}
}
- HttpResponseMessage response = await secureClient.PutAsync($"{APIRoot.Url}/api/ganjoor/cat/extra/{Cat.Cat.Id}", form);
+ HttpResponseMessage response = await secureClient.PutAsync($"{APIRoot.Url}/api/diwan/cat/extra/{Cat.Cat.Id}", form);
if (!response.IsSuccessStatusCode)
{
LastMessage = await ReadErrorMessageAsync(response);
@@ -497,7 +497,7 @@ namespace GanjooRazor.Areas.Admin.Pages
// consistent with the rest of this file via WithSecureClientAsync.
return WithSecureClientAsync(async secureClient =>
{
- HttpResponseMessage response = await secureClient.DeleteAsync($"{APIRoot.Url}/api/ganjoor/naskban?naskbanUrl={url}");
+ HttpResponseMessage response = await secureClient.DeleteAsync($"{APIRoot.Url}/api/diwan/naskban?naskbanUrl={url}");
if (!response.IsSuccessStatusCode)
{
return new BadRequestObjectResult(await ReadErrorMessageAsync(response));
@@ -510,7 +510,7 @@ namespace GanjooRazor.Areas.Admin.Pages
{
return WithSecureClientAsync(async secureClient =>
{
- HttpResponseMessage response = await secureClient.GetAsync($"{APIRoot.Url}/api/ganjoor/source?sourceUrlSlug={tag}");
+ HttpResponseMessage response = await secureClient.GetAsync($"{APIRoot.Url}/api/diwan/source?sourceUrlSlug={tag}");
if (!response.IsSuccessStatusCode)
{
return new BadRequestObjectResult(await ReadErrorMessageAsync(response));
@@ -531,7 +531,7 @@ namespace GanjooRazor.Areas.Admin.Pages
};
}
- HttpResponseMessage responsePost = await secureClient.PutAsync($"{APIRoot.Url}/api/ganjoor/source/{id}",
+ HttpResponseMessage responsePost = await secureClient.PutAsync($"{APIRoot.Url}/api/diwan/source/{id}",
new StringContent(JsonConvert.SerializeObject(source), Encoding.UTF8, "application/json")
);
if (!responsePost.IsSuccessStatusCode)
diff --git a/GanjooRazor/Areas/Admin/Pages/DonationEdit.cshtml b/DiwanRazor/Areas/Admin/Pages/DonationEdit.cshtml
similarity index 93%
rename from GanjooRazor/Areas/Admin/Pages/DonationEdit.cshtml
rename to DiwanRazor/Areas/Admin/Pages/DonationEdit.cshtml
index 8b6644ec..43860cb0 100644
--- a/GanjooRazor/Areas/Admin/Pages/DonationEdit.cshtml
+++ b/DiwanRazor/Areas/Admin/Pages/DonationEdit.cshtml
@@ -1,5 +1,5 @@
@page
-@model GanjooRazor.Areas.Admin.Pages.DonationEditModel
+@model DiwanRazor.Areas.Admin.Pages.DonationEditModel
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
Layout = "_AdminLayout";
diff --git a/GanjooRazor/Areas/Admin/Pages/DonationEdit.cshtml.cs b/DiwanRazor/Areas/Admin/Pages/DonationEdit.cshtml.cs
similarity index 87%
rename from GanjooRazor/Areas/Admin/Pages/DonationEdit.cshtml.cs
rename to DiwanRazor/Areas/Admin/Pages/DonationEdit.cshtml.cs
index dd9e5daf..458ba8e4 100644
--- a/GanjooRazor/Areas/Admin/Pages/DonationEdit.cshtml.cs
+++ b/DiwanRazor/Areas/Admin/Pages/DonationEdit.cshtml.cs
@@ -1,13 +1,13 @@
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
-using GanjooRazor.Utils;
+using DiwanRazor.Utils;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Newtonsoft.Json;
using RMuseum.Models.Accounting.ViewModels;
-namespace GanjooRazor.Areas.Admin.Pages
+namespace DiwanRazor.Areas.Admin.Pages
{
public class DonationEditModel : PageModel
{
@@ -44,7 +44,7 @@ namespace GanjooRazor.Areas.Admin.Pages
return Page();
}
- var donation = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync());
+ var donation = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync());
Donation = new UpdateDateDescriptionViewModel()
{
@@ -58,9 +58,9 @@ namespace GanjooRazor.Areas.Admin.Pages
public async Task OnPostAsync()
{
LastMessage = "";
- using (HttpClient secureClient = new HttpClient(new GanjoorReloginHandler(Request, Response)))
+ using (HttpClient secureClient = new HttpClient(new DiwanReloginHandler(Request, Response)))
{
- await GanjoorSessionChecker.PrepareClient(secureClient, Request, Response);
+ await DiwanSessionChecker.PrepareClient(secureClient, Request, Response);
HttpResponseMessage response = await secureClient.PutAsync($"{APIRoot.Url}/api/donations/{Request.Query["id"]}", new StringContent(JsonConvert.SerializeObject(Donation), Encoding.UTF8, "application/json"));
if (!response.IsSuccessStatusCode)
{
diff --git a/GanjooRazor/Areas/Admin/Pages/Donations.cshtml b/DiwanRazor/Areas/Admin/Pages/Donations.cshtml
similarity index 98%
rename from GanjooRazor/Areas/Admin/Pages/Donations.cshtml
rename to DiwanRazor/Areas/Admin/Pages/Donations.cshtml
index f6b9a8e7..b29884a9 100644
--- a/GanjooRazor/Areas/Admin/Pages/Donations.cshtml
+++ b/DiwanRazor/Areas/Admin/Pages/Donations.cshtml
@@ -1,5 +1,5 @@
@page
-@model GanjooRazor.Areas.Admin.Pages.DonationsModel
+@model DiwanRazor.Areas.Admin.Pages.DonationsModel
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
Layout = "_AdminLayout";
diff --git a/GanjooRazor/Areas/Admin/Pages/Donations.cshtml.cs b/DiwanRazor/Areas/Admin/Pages/Donations.cshtml.cs
similarity index 86%
rename from GanjooRazor/Areas/Admin/Pages/Donations.cshtml.cs
rename to DiwanRazor/Areas/Admin/Pages/Donations.cshtml.cs
index 4896b503..fdce1dbc 100644
--- a/GanjooRazor/Areas/Admin/Pages/Donations.cshtml.cs
+++ b/DiwanRazor/Areas/Admin/Pages/Donations.cshtml.cs
@@ -4,14 +4,14 @@ using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using DNTPersianUtils.Core;
-using GanjooRazor.Utils;
+using DiwanRazor.Utils;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Newtonsoft.Json;
using RMuseum.Models.Accounting.ViewModels;
using RMuseum.Utils;
-namespace GanjooRazor.Areas.Admin.Pages
+namespace DiwanRazor.Areas.Admin.Pages
{
public class DonationsModel : PageModel
{
@@ -39,12 +39,12 @@ namespace GanjooRazor.Areas.Admin.Pages
public string EmailContent { get; set; }
[BindProperty]
- public GanjoorDonationViewModel Donation { get; set; }
+ public DiwanDonationViewModel Donation { get; set; }
///
/// donations
///
- public GanjoorDonationViewModel[] Donations { get; set; }
+ public DiwanDonationViewModel[] Donations { get; set; }
///
/// show account info
@@ -60,11 +60,11 @@ namespace GanjooRazor.Areas.Admin.Pages
return;
}
- Donations = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync());
+ Donations = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync());
- using (HttpClient secureClient = new HttpClient(new GanjoorReloginHandler(Request, Response)))
+ using (HttpClient secureClient = new HttpClient(new DiwanReloginHandler(Request, Response)))
{
- if (await GanjoorSessionChecker.PrepareClient(secureClient, Request, Response))
+ if (await DiwanSessionChecker.PrepareClient(secureClient, Request, Response))
{
HttpResponseMessage resAccountInfo = await secureClient.GetAsync($"{APIRoot.Url}/api/donations/accountinfo/visible");
if (!resAccountInfo.IsSuccessStatusCode)
@@ -87,7 +87,7 @@ namespace GanjooRazor.Areas.Admin.Pages
LastMessage = "";
- Donation = new GanjoorDonationViewModel()
+ Donation = new DiwanDonationViewModel()
{
RecordDate = DateTime.Now.Date,
Unit = "تومان"
@@ -101,7 +101,7 @@ namespace GanjooRazor.Areas.Admin.Pages
if(donation != null)
{
int rowNumber = Donations.Length - Array.IndexOf(Donations, donation);
- string donorName = GanjoorHtmlTools.StripHtmlTags(donation.DonorName);
+ string donorName = DiwanHtmlTools.StripHtmlTags(donation.DonorName);
if(donorName.StartsWith("آقای"))
{
donorName = $"جناب {donorName}";
@@ -121,12 +121,12 @@ namespace GanjooRazor.Areas.Admin.Pages
return Page();
}
- public async Task OnPostAsync(GanjoorDonationViewModel Donation)
+ public async Task OnPostAsync(DiwanDonationViewModel Donation)
{
LastMessage = "";
- using (HttpClient secureClient = new HttpClient(new GanjoorReloginHandler(Request, Response)))
+ using (HttpClient secureClient = new HttpClient(new DiwanReloginHandler(Request, Response)))
{
- if (await GanjoorSessionChecker.PrepareClient(secureClient, Request, Response))
+ if (await DiwanSessionChecker.PrepareClient(secureClient, Request, Response))
{
Donation.ImportedRecord = false;
@@ -159,9 +159,9 @@ namespace GanjooRazor.Areas.Admin.Pages
public async Task OnPostRebuildPageAsync()
{
- using (HttpClient secureClient = new HttpClient(new GanjoorReloginHandler(Request, Response)))
+ using (HttpClient secureClient = new HttpClient(new DiwanReloginHandler(Request, Response)))
{
- if (await GanjoorSessionChecker.PrepareClient(secureClient, Request, Response))
+ if (await DiwanSessionChecker.PrepareClient(secureClient, Request, Response))
{
HttpResponseMessage response = await secureClient.PutAsync($"{APIRoot.Url}/api/donations/page", null);
if(!response.IsSuccessStatusCode)
@@ -176,9 +176,9 @@ namespace GanjooRazor.Areas.Admin.Pages
public async Task OnDeleteAsync(int id)
{
- using (HttpClient secureClient = new HttpClient(new GanjoorReloginHandler(Request, Response)))
+ using (HttpClient secureClient = new HttpClient(new DiwanReloginHandler(Request, Response)))
{
- if (await GanjoorSessionChecker.PrepareClient(secureClient, Request, Response))
+ if (await DiwanSessionChecker.PrepareClient(secureClient, Request, Response))
{
var response = await secureClient.DeleteAsync($"{APIRoot.Url}/api/donations/{id}");
if (!response.IsSuccessStatusCode)
diff --git a/GanjooRazor/Areas/Admin/Pages/EarlierVersion.cshtml b/DiwanRazor/Areas/Admin/Pages/EarlierVersion.cshtml
similarity index 97%
rename from GanjooRazor/Areas/Admin/Pages/EarlierVersion.cshtml
rename to DiwanRazor/Areas/Admin/Pages/EarlierVersion.cshtml
index 9499a886..19be3f7f 100644
--- a/GanjooRazor/Areas/Admin/Pages/EarlierVersion.cshtml
+++ b/DiwanRazor/Areas/Admin/Pages/EarlierVersion.cshtml
@@ -1,5 +1,5 @@
@page
-@model GanjooRazor.Areas.Admin.Pages.EarlierVersionModel
+@model DiwanRazor.Areas.Admin.Pages.EarlierVersionModel
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
Layout = "_AdminLayout";
diff --git a/GanjooRazor/Areas/Admin/Pages/EarlierVersion.cshtml.cs b/DiwanRazor/Areas/Admin/Pages/EarlierVersion.cshtml.cs
similarity index 74%
rename from GanjooRazor/Areas/Admin/Pages/EarlierVersion.cshtml.cs
rename to DiwanRazor/Areas/Admin/Pages/EarlierVersion.cshtml.cs
index 27828bfe..1e4cdc1e 100644
--- a/GanjooRazor/Areas/Admin/Pages/EarlierVersion.cshtml.cs
+++ b/DiwanRazor/Areas/Admin/Pages/EarlierVersion.cshtml.cs
@@ -1,12 +1,12 @@
-using GanjooRazor.Utils;
+using DiwanRazor.Utils;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Newtonsoft.Json;
-using RMuseum.Models.Ganjoor.ViewModels;
+using RMuseum.Models.Diwan.ViewModels;
using System.Net.Http;
using System.Threading.Tasks;
-namespace GanjooRazor.Areas.Admin.Pages
+namespace DiwanRazor.Areas.Admin.Pages
{
public class EarlierVersionModel : PageModel
{
@@ -19,7 +19,7 @@ namespace GanjooRazor.Areas.Admin.Pages
/// model
///
[BindProperty]
- public GanjoorModifyPageViewModel EarlierVersion { get; set; }
+ public DiwanModifyPageViewModel EarlierVersion { get; set; }
public async Task OnGetAsync()
{
@@ -29,18 +29,18 @@ namespace GanjooRazor.Areas.Admin.Pages
LastMessage = "";
- using (HttpClient secureClient = new HttpClient(new GanjoorReloginHandler(Request, Response)))
+ using (HttpClient secureClient = new HttpClient(new DiwanReloginHandler(Request, Response)))
{
- if (await GanjoorSessionChecker.PrepareClient(secureClient, Request, Response))
+ if (await DiwanSessionChecker.PrepareClient(secureClient, Request, Response))
{
- var response = await secureClient.GetAsync($"{APIRoot.Url}/api/ganjoor/oldversion/{Request.Query["id"]}");
+ var response = await secureClient.GetAsync($"{APIRoot.Url}/api/diwan/oldversion/{Request.Query["id"]}");
if (!response.IsSuccessStatusCode)
{
LastMessage = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync());
return Page();
}
- EarlierVersion = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync());
+ EarlierVersion = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync());
}
else
diff --git a/GanjooRazor/Areas/Admin/Pages/EditQuoted.cshtml b/DiwanRazor/Areas/Admin/Pages/EditQuoted.cshtml
similarity index 61%
rename from GanjooRazor/Areas/Admin/Pages/EditQuoted.cshtml
rename to DiwanRazor/Areas/Admin/Pages/EditQuoted.cshtml
index 202e7ea0..984ad318 100644
--- a/GanjooRazor/Areas/Admin/Pages/EditQuoted.cshtml
+++ b/DiwanRazor/Areas/Admin/Pages/EditQuoted.cshtml
@@ -1,5 +1,5 @@
@page
-@model GanjooRazor.Areas.Admin.Pages.EditQuotedModel
+@model DiwanRazor.Areas.Admin.Pages.EditQuotedModel
@using DNTPersianUtils.Core
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
@@ -122,11 +122,11 @@
-@if (Model.GanjoorQuotedPoem != null && Model.Couplets != null)
+@if (Model.DiwanQuotedPoem != null && Model.Couplets != null)
{
- @if ((Model.GanjoorPage != null && Model.GanjoorPage.NoIndex) || !string.IsNullOrEmpty(Model.PinterestUrl))
+ @if ((Model.DiwanPage != null && Model.DiwanPage.NoIndex) || !string.IsNullOrEmpty(Model.PinterestUrl))
{
}
- @if (Model.GanjoorPage != null)
+ @if (Model.DiwanPage != null)
{
if (Model.IsPoemPage)
{
". Instead it is serialized
// as a JSON string literal (which escapes '<', '>', '&', quotes, etc.) and then
diff --git a/GanjooRazor/Pages/GanjoorPage.cshtml.cs b/DiwanRazor/Pages/DiwanPage.cshtml.cs
similarity index 74%
rename from GanjooRazor/Pages/GanjoorPage.cshtml.cs
rename to DiwanRazor/Pages/DiwanPage.cshtml.cs
index b05bffed..9552162b 100644
--- a/GanjooRazor/Pages/GanjoorPage.cshtml.cs
+++ b/DiwanRazor/Pages/DiwanPage.cshtml.cs
@@ -1,5 +1,5 @@
using DNTPersianUtils.Core;
-using GanjooRazor.Utils;
+using DiwanRazor.Utils;
using KontorService.Models.Reporting.ViewModels;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
@@ -7,10 +7,10 @@ using Microsoft.AspNetCore.OutputCaching;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
-using RMuseum.Models.Ganjoor;
-using RMuseum.Models.Ganjoor.ViewModels;
-using RMuseum.Models.GanjoorAudio;
-using RMuseum.Models.GanjoorAudio.ViewModels;
+using RMuseum.Models.Diwan;
+using RMuseum.Models.Diwan.ViewModels;
+using RMuseum.Models.DiwanAudio;
+using RMuseum.Models.DiwanAudio.ViewModels;
using RMuseum.Services.Implementation;
using RMuseum.Utils;
using System;
@@ -21,17 +21,17 @@ using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
-namespace GanjooRazor.Pages
+namespace DiwanRazor.Pages
{
///
- /// Renders a single Ganjoor content page (poem/poet/category). Split out of IndexModel, which
+ /// Renders a single Diwan content page (poem/poet/category). Split out of IndexModel, which
/// used to serve both this and the home page from one class dispatching on
- /// Request.Path == "/" - see _HomePagePartial.cshtml / _GanjoorPagePartial.cshtml, and
- /// Startup.cs's AddPageRoute("/GanjoorPage", "{*url}") which now owns the site's catch-all route
+ /// Request.Path == "/" - see _HomePagePartial.cshtml / _DiwanPagePartial.cshtml, and
+ /// Startup.cs's AddPageRoute("/DiwanPage", "{*url}") which now owns the site's catch-all route
/// (Index.cshtml keeps its own automatic "/" route unchanged, so home is unaffected).
///
- [OutputCache(PolicyName = "GanjoorPublicPage")]
- public partial class GanjoorPageModel : LoginPartialEnabledPageModel
+ [OutputCache(PolicyName = "DiwanPublicPage")]
+ public partial class DiwanPageModel : LoginPartialEnabledPageModel
{
///
/// Persian stop words excluded from category word-count listings when remStopWords is
@@ -56,12 +56,12 @@ namespace GanjooRazor.Pages
public bool ReadOnlyMode => GetConfigFlag("ReadOnlyMode");
- public const int GanjoorSlashVaznPageId = 39401;
+ public const int DiwanSlashVaznPageId = 39401;
///
/// constructor
///
- public GanjoorPageModel(IConfiguration configuration,
+ public DiwanPageModel(IConfiguration configuration,
HttpClient httpClient,
PoetCacheService poetCache
) : base(httpClient, configuration)
@@ -77,7 +77,7 @@ namespace GanjooRazor.Pages
///
/// banner
///
- public GanjoorSiteBannerViewModel Banner { get; set; }
+ public DiwanSiteBannerViewModel Banner { get; set; }
///
/// If the response failed, stores the API's error message in and
@@ -94,7 +94,7 @@ namespace GanjooRazor.Pages
return true;
}
- public _CommentPartialModel GetCommentModel(GanjoorCommentSummaryViewModel comment, int poemId)
+ public _CommentPartialModel GetCommentModel(DiwanCommentSummaryViewModel comment, int poemId)
{
return new _CommentPartialModel()
{
@@ -120,11 +120,11 @@ namespace GanjooRazor.Pages
};
}
- public _QuotedPoemPartialModel GetQuotedPoemModel(GanjoorQuotedPoemViewModel quotedPoem, GanjoorPageCompleteViewModel page, bool canEdit)
+ public _QuotedPoemPartialModel GetQuotedPoemModel(DiwanQuotedPoemViewModel quotedPoem, DiwanPageCompleteViewModel page, bool canEdit)
{
return new _QuotedPoemPartialModel()
{
- GanjoorQuotedPoemViewModel = quotedPoem,
+ DiwanQuotedPoemViewModel = quotedPoem,
PoetImageUrl = page.PoetOrCat.Poet.ImageUrl,
PoetNickName = page.PoetOrCat.Poet.Nickname,
CanEdit = canEdit,
@@ -134,14 +134,14 @@ namespace GanjooRazor.Pages
///
/// re-fetch a poem's comments sorted by rating, oldest, or newest (AJAX, called from sortComments() in bk.js)
///
- public async Task OnGetCommentsPartialAsync(int poemId, GanjoorCommentSortOrder sortOrder = GanjoorCommentSortOrder.TopRated)
+ public async Task OnGetCommentsPartialAsync(int poemId, DiwanCommentSortOrder sortOrder = DiwanCommentSortOrder.TopRated)
{
- var response = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/poem/{poemId}/comments?sortOrder={sortOrder}");
+ var response = await _httpClient.GetAsync($"{APIRoot.Url}/api/diwan/poem/{poemId}/comments?sortOrder={sortOrder}");
if (!response.IsSuccessStatusCode)
{
return BadRequest(await ReadErrorMessageAsync(response));
}
- var comments = JArray.Parse(await response.Content.ReadAsStringAsync()).ToObject();
+ var comments = JArray.Parse(await response.Content.ReadAsStringAsync()).ToObject();
LoggedIn = !string.IsNullOrEmpty(Request.Cookies["Token"]);
@@ -149,32 +149,32 @@ namespace GanjooRazor.Pages
&& Guid.TryParse(Request.Cookies["UserId"], out Guid userId)
&& userId != Guid.Empty)
{
- using (HttpClient secureClient = new HttpClient(new GanjoorReloginHandler(Request, Response)))
+ using (HttpClient secureClient = new HttpClient(new DiwanReloginHandler(Request, Response)))
{
- if (await GanjoorSessionChecker.PrepareClient(secureClient, Request, Response))
+ if (await DiwanSessionChecker.PrepareClient(secureClient, Request, Response))
{
- GanjoorUserBookmarkViewModel[] bookmarks = Array.Empty();
- HttpResponseMessage bookmarksResponse = await secureClient.GetAsync($"{APIRoot.Url}/api/ganjoor/bookmark/{poemId}");
+ DiwanUserBookmarkViewModel[] bookmarks = Array.Empty();
+ HttpResponseMessage bookmarksResponse = await secureClient.GetAsync($"{APIRoot.Url}/api/diwan/bookmark/{poemId}");
if (bookmarksResponse.IsSuccessStatusCode)
{
- bookmarks = JsonConvert.DeserializeObject(await bookmarksResponse.Content.ReadAsStringAsync());
+ bookmarks = JsonConvert.DeserializeObject(await bookmarksResponse.Content.ReadAsStringAsync());
}
- foreach (GanjoorCommentSummaryViewModel comment in comments)
+ foreach (DiwanCommentSummaryViewModel comment in comments)
{
comment.MyComment = comment.UserId == userId;
comment.IsBookmarked = bookmarks.Where(b => b.CoupletIndex == -comment.Id).Any();
_markMyReplies(comment, userId, bookmarks);
}
- HttpResponseMessage ratingsResponse = await secureClient.GetAsync($"{APIRoot.Url}/api/ganjoor/poem/{poemId}/comments/myratings");
+ HttpResponseMessage ratingsResponse = await secureClient.GetAsync($"{APIRoot.Url}/api/diwan/poem/{poemId}/comments/myratings");
if (ratingsResponse.IsSuccessStatusCode)
{
- var ratings = JsonConvert.DeserializeObject(await ratingsResponse.Content.ReadAsStringAsync());
+ var ratings = JsonConvert.DeserializeObject(await ratingsResponse.Content.ReadAsStringAsync());
if (ratings.Length > 0)
{
var ratingsDic = ratings.ToDictionary(r => r.CommentId, r => r.Value);
- foreach (GanjoorCommentSummaryViewModel comment in comments)
+ foreach (DiwanCommentSummaryViewModel comment in comments)
{
_applyCommentRatings(comment, ratingsDic);
}
@@ -184,7 +184,7 @@ namespace GanjooRazor.Pages
}
}
- return Partial("~/Pages/Partials/GanjoorPage/_CommentsListPartial.cshtml", new _CommentsListPartialModel()
+ return Partial("~/Pages/Partials/DiwanPage/_CommentsListPartial.cshtml", new _CommentsListPartialModel()
{
Comments = comments,
PoemId = poemId,
@@ -202,7 +202,7 @@ namespace GanjooRazor.Pages
///
public Task OnPostComment(string comment, int poemId, int inReplytoId, int coupletIndex)
{
- var unauthorized = Partial("~/Pages/Partials/GanjoorPage/_CommentPartial.cshtml", new _CommentPartialModel()
+ var unauthorized = Partial("~/Pages/Partials/DiwanPage/_CommentPartial.cshtml", new _CommentPartialModel()
{
Comment = null,
Error = NotLoggedInMessage,
@@ -212,7 +212,7 @@ namespace GanjooRazor.Pages
return WithSecureClientAsync(async secureClient =>
{
var stringContent = new StringContent(
- JsonConvert.SerializeObject(new GanjoorCommentPostViewModel()
+ JsonConvert.SerializeObject(new DiwanCommentPostViewModel()
{
HtmlComment = comment,
InReplyToId = inReplytoId == 0 ? null : inReplytoId,
@@ -221,18 +221,18 @@ namespace GanjooRazor.Pages
}),
Encoding.UTF8, "application/json");
- var response = await secureClient.PostAsync($"{APIRoot.Url}/api/ganjoor/comment", stringContent);
+ var response = await secureClient.PostAsync($"{APIRoot.Url}/api/diwan/comment", stringContent);
if (response.StatusCode == HttpStatusCode.OK)
{
- var resComment = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync());
+ var resComment = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync());
resComment.MyComment = true;
- return Partial("~/Pages/Partials/GanjoorPage/_CommentPartial.cshtml", new _CommentPartialModel()
+ return Partial("~/Pages/Partials/DiwanPage/_CommentPartial.cshtml", new _CommentPartialModel()
{
Comment = resComment,
Error = "",
- InReplyTo = inReplytoId == 0 ? null : new GanjoorCommentSummaryViewModel(),
+ InReplyTo = inReplytoId == 0 ? null : new DiwanCommentSummaryViewModel(),
LoggedIn = !string.IsNullOrEmpty(Request.Cookies["Token"]),
PoemId = poemId,
});
@@ -241,7 +241,7 @@ namespace GanjooRazor.Pages
string rawError = await ReadErrorMessageAsync(response);
var sanitizerInfo = TryParseSanitizerTextDroppedError(rawError);
- return Partial("~/Pages/Partials/GanjoorPage/_CommentPartial.cshtml", new _CommentPartialModel()
+ return Partial("~/Pages/Partials/DiwanPage/_CommentPartial.cshtml", new _CommentPartialModel()
{
Comment = null,
Error = sanitizerInfo != null ? sanitizerInfo.Message : rawError,
@@ -257,7 +257,7 @@ namespace GanjooRazor.Pages
{
return WithSecureClientAsync(async secureClient =>
{
- var response = await secureClient.DeleteAsync($"{APIRoot.Url}/api/ganjoor/comment?id={id}");
+ var response = await secureClient.DeleteAsync($"{APIRoot.Url}/api/diwan/comment?id={id}");
if (!response.IsSuccessStatusCode)
{
return new BadRequestObjectResult(await ReadErrorMessageAsync(response));
@@ -270,7 +270,7 @@ namespace GanjooRazor.Pages
{
return WithSecureClientAsync(async secureClient =>
{
- var response = await secureClient.PutAsync($"{APIRoot.Url}/api/ganjoor/comment/{id}", new StringContent(JsonConvert.SerializeObject(comment), Encoding.UTF8, "application/json"));
+ var response = await secureClient.PutAsync($"{APIRoot.Url}/api/diwan/comment/{id}", new StringContent(JsonConvert.SerializeObject(comment), Encoding.UTF8, "application/json"));
if (!response.IsSuccessStatusCode)
{
return await BadRequestFromApiErrorAsync(response);
@@ -286,12 +286,12 @@ namespace GanjooRazor.Pages
{
return WithSecureClientAsync(async secureClient =>
{
- var response = await secureClient.PostAsync($"{APIRoot.Url}/api/ganjoor/poem/comment/{id}/rate?value={value}", null);
+ var response = await secureClient.PostAsync($"{APIRoot.Url}/api/diwan/poem/comment/{id}/rate?value={value}", null);
if (!response.IsSuccessStatusCode)
{
return new BadRequestObjectResult(await ReadErrorMessageAsync(response));
}
- var result = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync());
+ var result = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync());
return new JsonResult(result);
});
}
@@ -299,7 +299,7 @@ namespace GanjooRazor.Pages
///
/// Poets (for this page's own #hdr2 author dropdown - same pattern as Search/Simi/etc.)
///
- public List Poets { get; set; }
+ public List Poets { get; set; }
public bool IsPoetPage { get; set; }
@@ -307,7 +307,7 @@ namespace GanjooRazor.Pages
public bool IsPoemPage { get; set; }
- public string CanonicalUrl => $"{Configuration["SiteUrl"]}{GanjoorPage.FullUrl}";
+ public string CanonicalUrl => $"{Configuration["SiteUrl"]}{DiwanPage.FullUrl}";
public bool CanEdit { get; set; }
@@ -319,7 +319,7 @@ namespace GanjooRazor.Pages
public string ActiveTab { get; set; }
- private void _preparePoemExcerpt(GanjoorPoemSummaryViewModel poem)
+ private void _preparePoemExcerpt(DiwanPoemSummaryViewModel poem)
{
if (poem == null || poem.Excerpt == null)
{
@@ -345,11 +345,11 @@ namespace GanjooRazor.Pages
///
private async Task _markMyCommentsAndBringUpMyRecitations()
{
- if (GanjoorPage == null)
+ if (DiwanPage == null)
{
return;
}
- if (GanjoorPage.Poem == null)
+ if (DiwanPage.Poem == null)
{
return;
}
@@ -365,29 +365,29 @@ namespace GanjooRazor.Pages
{
return;
}
- foreach (GanjoorCommentSummaryViewModel comment in GanjoorPage.Poem.Comments)
+ foreach (DiwanCommentSummaryViewModel comment in DiwanPage.Poem.Comments)
{
comment.MyComment = comment.UserId == userId;
_markMyReplies(comment, userId, null);
}
- if (GanjoorPage.Poem.Recitations.Length > 0)
+ if (DiwanPage.Poem.Recitations.Length > 0)
{
- using (HttpClient secureClient = new HttpClient(new GanjoorReloginHandler(Request, Response)))
+ using (HttpClient secureClient = new HttpClient(new DiwanReloginHandler(Request, Response)))
{
- if (await GanjoorSessionChecker.PrepareClient(secureClient, Request, Response))
+ if (await DiwanSessionChecker.PrepareClient(secureClient, Request, Response))
{
- HttpResponseMessage response = await secureClient.GetAsync($"{APIRoot.Url}/api/ganjoor/poem/{GanjoorPage.Poem.Id}/recitations/upvotes");
+ HttpResponseMessage response = await secureClient.GetAsync($"{APIRoot.Url}/api/diwan/poem/{DiwanPage.Poem.Id}/recitations/upvotes");
if (response.IsSuccessStatusCode)
{
var upVotedIds = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync());
if (upVotedIds.Length > 0)
{
- foreach (var recitation in GanjoorPage.Poem.Recitations)
+ foreach (var recitation in DiwanPage.Poem.Recitations)
{
recitation.UpVotedByUser = upVotedIds.Contains(recitation.Id);
}
- Array.Sort(GanjoorPage.Poem.Recitations, (a, b) => b.UpVotedByUser == a.UpVotedByUser ? a.AudioOrder.CompareTo(b.AudioOrder) : b.UpVotedByUser.CompareTo(a.UpVotedByUser));
+ Array.Sort(DiwanPage.Poem.Recitations, (a, b) => b.UpVotedByUser == a.UpVotedByUser ? a.AudioOrder.CompareTo(b.AudioOrder) : b.UpVotedByUser.CompareTo(a.UpVotedByUser));
}
}
@@ -395,20 +395,20 @@ namespace GanjooRazor.Pages
}
}
- if (GanjoorPage.Poem.Comments.Length > 0)
+ if (DiwanPage.Poem.Comments.Length > 0)
{
- using (HttpClient secureClient = new HttpClient(new GanjoorReloginHandler(Request, Response)))
+ using (HttpClient secureClient = new HttpClient(new DiwanReloginHandler(Request, Response)))
{
- if (await GanjoorSessionChecker.PrepareClient(secureClient, Request, Response))
+ if (await DiwanSessionChecker.PrepareClient(secureClient, Request, Response))
{
- HttpResponseMessage response = await secureClient.GetAsync($"{APIRoot.Url}/api/ganjoor/poem/{GanjoorPage.Poem.Id}/comments/myratings");
+ HttpResponseMessage response = await secureClient.GetAsync($"{APIRoot.Url}/api/diwan/poem/{DiwanPage.Poem.Id}/comments/myratings");
if (response.IsSuccessStatusCode)
{
- var ratings = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync());
+ var ratings = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync());
if (ratings.Length > 0)
{
var ratingsDic = ratings.ToDictionary(r => r.CommentId, r => r.Value);
- foreach (GanjoorCommentSummaryViewModel comment in GanjoorPage.Poem.Comments)
+ foreach (DiwanCommentSummaryViewModel comment in DiwanPage.Poem.Comments)
{
_applyCommentRatings(comment, ratingsDic);
}
@@ -419,7 +419,7 @@ namespace GanjooRazor.Pages
}
}
- private void _applyCommentRatings(GanjoorCommentSummaryViewModel comment, Dictionary ratings)
+ private void _applyCommentRatings(DiwanCommentSummaryViewModel comment, Dictionary ratings)
{
if (ratings.TryGetValue(comment.Id, out short value))
{
@@ -431,7 +431,7 @@ namespace GanjooRazor.Pages
}
}
- private void _markMyReplies(GanjoorCommentSummaryViewModel parent, Guid userId, GanjoorUserBookmarkViewModel[] bookmarks)
+ private void _markMyReplies(DiwanCommentSummaryViewModel parent, Guid userId, DiwanUserBookmarkViewModel[] bookmarks)
{
foreach (var reply in parent.Replies)
{
@@ -509,62 +509,62 @@ namespace GanjooRazor.Pages
private void _prepareNextPre()
{
- switch (GanjoorPage.GanjoorPageType)
+ switch (DiwanPage.DiwanPageType)
{
- case GanjoorPageType.PoemPage:
+ case DiwanPageType.PoemPage:
{
- if (GanjoorPage.Poem.Next != null)
+ if (DiwanPage.Poem.Next != null)
{
- NextUrl = GanjoorPage.PoetOrCat.Cat.FullUrl + "/" + GanjoorPage.Poem.Next.UrlSlug;
- NextTitle = GanjoorPage.Poem.Next.Title + ": " + GanjoorPage.Poem.Next.Excerpt;
+ NextUrl = DiwanPage.PoetOrCat.Cat.FullUrl + "/" + DiwanPage.Poem.Next.UrlSlug;
+ NextTitle = DiwanPage.Poem.Next.Title + ": " + DiwanPage.Poem.Next.Excerpt;
}
else
- if (GanjoorPage.Poem.MixedModeOrder > 0
- && GanjoorPage.Poem.Category.Cat.Children.Where(c => c.MixedModeOrder == 0 || c.MixedModeOrder > GanjoorPage.Poem.MixedModeOrder).Any())
+ if (DiwanPage.Poem.MixedModeOrder > 0
+ && DiwanPage.Poem.Category.Cat.Children.Where(c => c.MixedModeOrder == 0 || c.MixedModeOrder > DiwanPage.Poem.MixedModeOrder).Any())
{
- var nextCat = GanjoorPage.Poem.Category.Cat.Children.Where(c => c.MixedModeOrder == 0 || c.MixedModeOrder > GanjoorPage.Poem.MixedModeOrder).OrderBy(c => c.MixedModeOrder).First();
+ var nextCat = DiwanPage.Poem.Category.Cat.Children.Where(c => c.MixedModeOrder == 0 || c.MixedModeOrder > DiwanPage.Poem.MixedModeOrder).OrderBy(c => c.MixedModeOrder).First();
NextUrl = nextCat.FullUrl;
NextTitle = nextCat.Title;
}
else
- if (GanjoorPage.Poem.Category.Cat.Next != null)
+ if (DiwanPage.Poem.Category.Cat.Next != null)
{
- NextUrl = GanjoorPage.Poem.Category.Cat.Next.FullUrl;
- NextTitle = GanjoorPage.Poem.Category.Cat.Next.Title;
+ NextUrl = DiwanPage.Poem.Category.Cat.Next.FullUrl;
+ NextTitle = DiwanPage.Poem.Category.Cat.Next.Title;
}
- if (GanjoorPage.Poem.Previous != null)
+ if (DiwanPage.Poem.Previous != null)
{
- PreviousUrl = GanjoorPage.PoetOrCat.Cat.FullUrl + "/" + GanjoorPage.Poem.Previous.UrlSlug;
- PreviousTitle = GanjoorPage.Poem.Previous.Title + ": " + GanjoorPage.Poem.Previous.Excerpt;
+ PreviousUrl = DiwanPage.PoetOrCat.Cat.FullUrl + "/" + DiwanPage.Poem.Previous.UrlSlug;
+ PreviousTitle = DiwanPage.Poem.Previous.Title + ": " + DiwanPage.Poem.Previous.Excerpt;
}
else
- if (GanjoorPage.Poem.MixedModeOrder > 0
- && GanjoorPage.Poem.Category.Cat.Children.Where(c => c.MixedModeOrder != 0 && c.MixedModeOrder < GanjoorPage.Poem.MixedModeOrder).Any())
+ if (DiwanPage.Poem.MixedModeOrder > 0
+ && DiwanPage.Poem.Category.Cat.Children.Where(c => c.MixedModeOrder != 0 && c.MixedModeOrder < DiwanPage.Poem.MixedModeOrder).Any())
{
- var prevCat = GanjoorPage.Poem.Category.Cat.Children.Where(c => c.MixedModeOrder != 0 && c.MixedModeOrder < GanjoorPage.Poem.MixedModeOrder).OrderByDescending(c => c.MixedModeOrder).First();
+ var prevCat = DiwanPage.Poem.Category.Cat.Children.Where(c => c.MixedModeOrder != 0 && c.MixedModeOrder < DiwanPage.Poem.MixedModeOrder).OrderByDescending(c => c.MixedModeOrder).First();
PreviousUrl = prevCat.FullUrl;
PreviousTitle = prevCat.Title;
}
else
- if (GanjoorPage.Poem.Category.Cat.Previous != null)
+ if (DiwanPage.Poem.Category.Cat.Previous != null)
{
- PreviousUrl = GanjoorPage.Poem.Category.Cat.Previous.FullUrl;
- PreviousTitle = GanjoorPage.Poem.Category.Cat.Previous.Title;
+ PreviousUrl = DiwanPage.Poem.Category.Cat.Previous.FullUrl;
+ PreviousTitle = DiwanPage.Poem.Category.Cat.Previous.Title;
}
}
break;
- case GanjoorPageType.CatPage:
+ case DiwanPageType.CatPage:
{
- if (GanjoorPage.PoetOrCat.Cat.Next != null)
+ if (DiwanPage.PoetOrCat.Cat.Next != null)
{
- NextUrl = GanjoorPage.PoetOrCat.Cat.Next.FullUrl;
- NextTitle = GanjoorPage.PoetOrCat.Cat.Next.Title;
+ NextUrl = DiwanPage.PoetOrCat.Cat.Next.FullUrl;
+ NextTitle = DiwanPage.PoetOrCat.Cat.Next.Title;
}
- if (GanjoorPage.PoetOrCat.Cat.Previous != null)
+ if (DiwanPage.PoetOrCat.Cat.Previous != null)
{
- PreviousUrl = GanjoorPage.PoetOrCat.Cat.Previous.FullUrl;
- PreviousTitle = GanjoorPage.PoetOrCat.Cat.Previous.Title;
+ PreviousUrl = DiwanPage.PoetOrCat.Cat.Previous.FullUrl;
+ PreviousTitle = DiwanPage.PoetOrCat.Cat.Previous.Title;
}
}
break;
@@ -575,22 +575,22 @@ namespace GanjooRazor.Pages
private void _prepareRelatedSecions()
{
- SectionsWithRelated = new List();
- SectionsWithMetreAndRhymes = new List();
- MutiPartPoemPage = GanjoorPage.Poem.Verses.Where(v => v.VersePosition == VersePosition.Paragraph || v.VersePosition == VersePosition.Single).Any()
+ SectionsWithRelated = new List();
+ SectionsWithMetreAndRhymes = new List();
+ MutiPartPoemPage = DiwanPage.Poem.Verses.Where(v => v.VersePosition == VersePosition.Paragraph || v.VersePosition == VersePosition.Single).Any()
||
- GanjoorPage.Poem.Sections.Count(s => s.SectionType == PoemSectionType.WholePoem && s.VerseType == VersePoemSectionType.First) != 1;
+ DiwanPage.Poem.Sections.Count(s => s.SectionType == PoemSectionType.WholePoem && s.VerseType == VersePoemSectionType.First) != 1;
if (
!MutiPartPoemPage
)
{
- foreach (var section in GanjoorPage.Poem.Sections)
+ foreach (var section in DiwanPage.Poem.Sections)
{
if (section.Top6RelatedSections.Length > 0)
{
SectionsWithRelated.Add(section);
}
- if (section.SectionType == PoemSectionType.WholePoem && section.GanjoorMetre != null && !string.IsNullOrEmpty(section.RhymeLetters))
+ if (section.SectionType == PoemSectionType.WholePoem && section.DiwanMetre != null && !string.IsNullOrEmpty(section.RhymeLetters))
{
SectionsWithMetreAndRhymes.Add(section);
}
@@ -598,7 +598,7 @@ namespace GanjooRazor.Pages
}
}
- public GanjoorPoetSuggestedPictureViewModel Photo { get; set; }
+ public DiwanPoetSuggestedPictureViewModel Photo { get; set; }
///
/// Get. Unlike the old IndexModel.OnGetAsync, this never needs to check
@@ -632,7 +632,7 @@ namespace GanjooRazor.Pages
var breadCrumbList = new GoogleBreadCrumbList();
Banner = null;
- var pageLoadResult = await LoadGanjoorPageAsync();
+ var pageLoadResult = await LoadDiwanPageAsync();
if (pageLoadResult != null)
{
return pageLoadResult;
@@ -713,7 +713,7 @@ namespace GanjooRazor.Pages
///
private async Task RedirectByPageIdAsync(string pageId)
{
- var pageUrlResponse = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/pageurl?id={pageId}");
+ var pageUrlResponse = await _httpClient.GetAsync($"{APIRoot.Url}/api/diwan/pageurl?id={pageId}");
if (await CaptureErrorIfFailedAsync(pageUrlResponse))
{
return Page();
@@ -723,19 +723,19 @@ namespace GanjooRazor.Pages
}
///
- /// Fetches the GanjoorPage for the current URL and applies the page-type-specific preparation
+ /// Fetches the DiwanPage for the current URL and applies the page-type-specific preparation
/// that depends only on the page payload itself (excerpts, related sections, next/previous
/// links). Returns null to let OnGetAsync continue, or a terminal IActionResult
/// (redirect/404/error page) to short-circuit.
///
- private async Task LoadGanjoorPageAsync()
+ private async Task LoadDiwanPageAsync()
{
- var pageQuery = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/page?url={Request.Path}");
+ var pageQuery = await _httpClient.GetAsync($"{APIRoot.Url}/api/diwan/page?url={Request.Path}");
if (!pageQuery.IsSuccessStatusCode)
{
if (pageQuery.StatusCode == HttpStatusCode.NotFound)
{
- var redirectQuery = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/redirecturl?url={Request.Path}");
+ var redirectQuery = await _httpClient.GetAsync($"{APIRoot.Url}/api/diwan/redirecturl?url={Request.Path}");
if (redirectQuery.IsSuccessStatusCode)
{
var redirectUrl = JsonConvert.DeserializeObject(await redirectQuery.Content.ReadAsStringAsync());
@@ -748,27 +748,27 @@ namespace GanjooRazor.Pages
return Page();
}
- GanjoorPage = JObject.Parse(await pageQuery.Content.ReadAsStringAsync()).ToObject();
- if (!string.IsNullOrEmpty(GanjoorPage.HtmlText))
+ DiwanPage = JObject.Parse(await pageQuery.Content.ReadAsStringAsync()).ToObject();
+ if (!string.IsNullOrEmpty(DiwanPage.HtmlText))
{
- GanjoorPage.HtmlText = GanjoorPage.HtmlText.Replace("https://ganjoor.net/", "/").Replace("http://ganjoor.net/", "/");
+ DiwanPage.HtmlText = DiwanPage.HtmlText.Replace("https://ganjoor.net/", "/").Replace("http://ganjoor.net/", "/");
}
- switch (GanjoorPage.GanjoorPageType)
+ switch (DiwanPage.DiwanPageType)
{
- case GanjoorPageType.PoemPage:
+ case DiwanPageType.PoemPage:
await _markMyCommentsAndBringUpMyRecitations();
- _preparePoemExcerpt(GanjoorPage.Poem.Next);
- _preparePoemExcerpt(GanjoorPage.Poem.Previous);
- GanjoorPage.PoetOrCat = GanjoorPage.Poem.Category;
+ _preparePoemExcerpt(DiwanPage.Poem.Next);
+ _preparePoemExcerpt(DiwanPage.Poem.Previous);
+ DiwanPage.PoetOrCat = DiwanPage.Poem.Category;
_prepareNextPre();
_prepareRelatedSecions();
IsPoemPage = true;
break;
- case GanjoorPageType.PoetPage:
+ case DiwanPageType.PoetPage:
IsPoetPage = true;
break;
- case GanjoorPageType.CatPage:
+ case DiwanPageType.CatPage:
_prepareNextPre();
IsCatPage = true;
break;
@@ -785,7 +785,7 @@ namespace GanjooRazor.Pages
{
if (IsPoetPage || IsCatPage)
{
- var catHasAnyRecitationQuery = await _httpClient.GetAsync($"{APIRoot.Url}/api/audio/catany/{GanjoorPage.PoetOrCat.Cat.Id}");
+ var catHasAnyRecitationQuery = await _httpClient.GetAsync($"{APIRoot.Url}/api/audio/catany/{DiwanPage.PoetOrCat.Cat.Id}");
if (await CaptureErrorIfFailedAsync(catHasAnyRecitationQuery))
{
return Page();
@@ -795,12 +795,12 @@ namespace GanjooRazor.Pages
if (IsPoetPage)
{
- var responsePhotos = await _httpClient.GetAsync($"{APIRoot.Url}/api/poetphotos/poet/{GanjoorPage.PoetOrCat.Poet.Id}");
+ var responsePhotos = await _httpClient.GetAsync($"{APIRoot.Url}/api/poetphotos/poet/{DiwanPage.PoetOrCat.Poet.Id}");
if (await CaptureErrorIfFailedAsync(responsePhotos))
{
return Page();
}
- var photos = JArray.Parse(await responsePhotos.Content.ReadAsStringAsync()).ToObject>();
+ var photos = JArray.Parse(await responsePhotos.Content.ReadAsStringAsync()).ToObject>();
if (photos.Any())
{
Photo = photos.First();
@@ -809,7 +809,7 @@ namespace GanjooRazor.Pages
if (IsPoemPage)
{
- HtmlLanguage = string.IsNullOrEmpty(GanjoorPage.Poem.Language) ? "ur-PK" : GanjoorPage.Poem.Language;
+ HtmlLanguage = string.IsNullOrEmpty(DiwanPage.Poem.Language) ? "ur-PK" : DiwanPage.Poem.Language;
if (GetConfigFlag("BannersEnabled"))
{
var bannerQuery = await _httpClient.GetAsync($"{APIRoot.Url}/api/banners/random");
@@ -820,7 +820,7 @@ namespace GanjooRazor.Pages
var bannerResponse = await bannerQuery.Content.ReadAsStringAsync();
if (!string.IsNullOrEmpty(bannerResponse))
{
- Banner = JObject.Parse(bannerResponse).ToObject();
+ Banner = JObject.Parse(bannerResponse).ToObject();
}
}
}
@@ -855,83 +855,83 @@ namespace GanjooRazor.Pages
private void BuildPoetPageTitleAndBreadCrumbs(GoogleBreadCrumbList breadCrumbList)
{
- ViewData["Title"] = $"دیوان » {GanjoorPage.PoetOrCat.Poet.Nickname}";
- breadCrumbList.AddItem(GanjoorPage.PoetOrCat.Poet.Nickname, GanjoorPage.PoetOrCat.Cat.FullUrl, $"{APIRoot.InternetUrl + GanjoorPage.PoetOrCat.Poet.ImageUrl}");
+ ViewData["Title"] = $"دیوان » {DiwanPage.PoetOrCat.Poet.Nickname}";
+ breadCrumbList.AddItem(DiwanPage.PoetOrCat.Poet.Nickname, DiwanPage.PoetOrCat.Cat.FullUrl, $"{APIRoot.InternetUrl + DiwanPage.PoetOrCat.Poet.ImageUrl}");
}
private void BuildCatPageTitleAndBreadCrumbs(GoogleBreadCrumbList breadCrumbList)
{
string title = $"دیوان » ";
bool poetCat = true;
- foreach (var gran in GanjoorPage.PoetOrCat.Cat.Ancestors)
+ foreach (var gran in DiwanPage.PoetOrCat.Cat.Ancestors)
{
title += $"{gran.Title} » ";
- breadCrumbList.AddItem(gran.Title, gran.FullUrl, poetCat ? $"{APIRoot.InternetUrl + GanjoorPage.PoetOrCat.Poet.ImageUrl}" : "https://i.ganjoor.net/cat.png");
+ breadCrumbList.AddItem(gran.Title, gran.FullUrl, poetCat ? $"{APIRoot.InternetUrl + DiwanPage.PoetOrCat.Poet.ImageUrl}" : "https://i.ganjoor.net/cat.png");
poetCat = false;
}
- breadCrumbList.AddItem(GanjoorPage.PoetOrCat.Cat.Title, GanjoorPage.PoetOrCat.Cat.FullUrl, "https://i.ganjoor.net/cat.png");
- title += GanjoorPage.PoetOrCat.Cat.Title;
+ breadCrumbList.AddItem(DiwanPage.PoetOrCat.Cat.Title, DiwanPage.PoetOrCat.Cat.FullUrl, "https://i.ganjoor.net/cat.png");
+ title += DiwanPage.PoetOrCat.Cat.Title;
ViewData["Title"] = title;
}
private void BuildPoemPageTitleAndBreadCrumbs(GoogleBreadCrumbList breadCrumbList)
{
- ViewData["Title"] = $"دیوان » {GanjoorPage.Poem.FullTitle}";
+ ViewData["Title"] = $"دیوان » {DiwanPage.Poem.FullTitle}";
bool poetCat = true;
- foreach (var gran in GanjoorPage.Poem.Category.Cat.Ancestors)
+ foreach (var gran in DiwanPage.Poem.Category.Cat.Ancestors)
{
- breadCrumbList.AddItem(gran.Title, gran.FullUrl, poetCat ? $"{APIRoot.InternetUrl + GanjoorPage.PoetOrCat.Poet.ImageUrl}" : "https://i.ganjoor.net/cat.png");
+ breadCrumbList.AddItem(gran.Title, gran.FullUrl, poetCat ? $"{APIRoot.InternetUrl + DiwanPage.PoetOrCat.Poet.ImageUrl}" : "https://i.ganjoor.net/cat.png");
poetCat = false;
}
- breadCrumbList.AddItem(GanjoorPage.PoetOrCat.Cat.Title, GanjoorPage.PoetOrCat.Cat.FullUrl, "https://i.ganjoor.net/cat.png");
+ breadCrumbList.AddItem(DiwanPage.PoetOrCat.Cat.Title, DiwanPage.PoetOrCat.Cat.FullUrl, "https://i.ganjoor.net/cat.png");
- var aiMuseumImage = GanjoorPage.Poem.Images.FirstOrDefault(i => i.TargetPageUrl.StartsWith("https://museum.ganjoor.net/items/ai"));
+ var aiMuseumImage = DiwanPage.Poem.Images.FirstOrDefault(i => i.TargetPageUrl.StartsWith("https://museum.ganjoor.net/items/ai"));
if (aiMuseumImage != null)
{
- breadCrumbList.AddItem(GanjoorPage.Poem.Title, GanjoorPage.Poem.FullUrl, aiMuseumImage.ThumbnailImageUrl.Replace("/thumb/", "/orig/"));
+ breadCrumbList.AddItem(DiwanPage.Poem.Title, DiwanPage.Poem.FullUrl, aiMuseumImage.ThumbnailImageUrl.Replace("/thumb/", "/orig/"));
}
- else if (GanjoorPage.Poem.Images.Any())
+ else if (DiwanPage.Poem.Images.Any())
{
- breadCrumbList.AddItem(GanjoorPage.Poem.Title, GanjoorPage.Poem.FullUrl, GanjoorPage.Poem.Images.First().ThumbnailImageUrl.Replace("/thumb/", "/orig/"));
+ breadCrumbList.AddItem(DiwanPage.Poem.Title, DiwanPage.Poem.FullUrl, DiwanPage.Poem.Images.First().ThumbnailImageUrl.Replace("/thumb/", "/orig/"));
}
else
{
- breadCrumbList.AddItem(GanjoorPage.Poem.Title, GanjoorPage.Poem.FullUrl, "https://i.ganjoor.net/poem.png");
+ breadCrumbList.AddItem(DiwanPage.Poem.Title, DiwanPage.Poem.FullUrl, "https://i.ganjoor.net/poem.png");
}
}
private void BuildGenericPageTitleAndBreadCrumbs(GoogleBreadCrumbList breadCrumbList)
{
- if (GanjoorPage.PoetOrCat != null)
+ if (DiwanPage.PoetOrCat != null)
{
bool poetCat = true;
string fullTitle = "دیوان » ";
- if (GanjoorPage.PoetOrCat.Cat.Ancestors.Count == 0)
+ if (DiwanPage.PoetOrCat.Cat.Ancestors.Count == 0)
{
- fullTitle += $"{GanjoorPage.PoetOrCat.Poet.Nickname} » ";
+ fullTitle += $"{DiwanPage.PoetOrCat.Poet.Nickname} » ";
}
else
{
- foreach (var gran in GanjoorPage.PoetOrCat.Cat.Ancestors)
+ foreach (var gran in DiwanPage.PoetOrCat.Cat.Ancestors)
{
- breadCrumbList.AddItem(gran.Title, gran.FullUrl, poetCat ? $"{APIRoot.InternetUrl + GanjoorPage.PoetOrCat.Poet.ImageUrl}" : "https://i.ganjoor.net/cat.png");
+ breadCrumbList.AddItem(gran.Title, gran.FullUrl, poetCat ? $"{APIRoot.InternetUrl + DiwanPage.PoetOrCat.Poet.ImageUrl}" : "https://i.ganjoor.net/cat.png");
poetCat = false;
fullTitle += $"{gran.Title} » ";
}
}
- ViewData["Title"] = $"{fullTitle}{GanjoorPage.Title}";
- breadCrumbList.AddItem(GanjoorPage.PoetOrCat.Poet.Nickname, GanjoorPage.PoetOrCat.Cat.FullUrl, $"{APIRoot.InternetUrl + GanjoorPage.PoetOrCat.Poet.ImageUrl}");
+ ViewData["Title"] = $"{fullTitle}{DiwanPage.Title}";
+ breadCrumbList.AddItem(DiwanPage.PoetOrCat.Poet.Nickname, DiwanPage.PoetOrCat.Cat.FullUrl, $"{APIRoot.InternetUrl + DiwanPage.PoetOrCat.Poet.ImageUrl}");
}
else
{
- ViewData["Title"] = $"دیوان » {GanjoorPage.FullTitle}";
+ ViewData["Title"] = $"دیوان » {DiwanPage.FullTitle}";
}
- breadCrumbList.AddItem(GanjoorPage.Title, GanjoorPage.FullUrl, "https://i.ganjoor.net/cat.png");
+ breadCrumbList.AddItem(DiwanPage.Title, DiwanPage.FullUrl, "https://i.ganjoor.net/cat.png");
}
private async Task LoadCategoryGeoTagsAsync()
{
- var tagsResponse = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/cat/{GanjoorPage.PoetOrCat.Cat.Id}/geotag");
+ var tagsResponse = await _httpClient.GetAsync($"{APIRoot.Url}/api/diwan/cat/{DiwanPage.PoetOrCat.Cat.Id}/geotag");
if (await CaptureErrorIfFailedAsync(tagsResponse))
{
return Page();
@@ -942,38 +942,38 @@ namespace GanjooRazor.Pages
public async Task OnGetBNumPartialAsync(int poemId, int coupletIndex)
{
- var responseCoupletComments = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/poem/{poemId}/comments?coupletIndex={coupletIndex}");
+ var responseCoupletComments = await _httpClient.GetAsync($"{APIRoot.Url}/api/diwan/poem/{poemId}/comments?coupletIndex={coupletIndex}");
if (!responseCoupletComments.IsSuccessStatusCode)
{
return BadRequest(await ReadErrorMessageAsync(responseCoupletComments));
}
- var comments = JArray.Parse(await responseCoupletComments.Content.ReadAsStringAsync()).ToObject>();
+ var comments = JArray.Parse(await responseCoupletComments.Content.ReadAsStringAsync()).ToObject>();
var responseCoupletNumbers = await _httpClient.GetAsync($"{APIRoot.Url}/api/numberings/couplet/{poemId}/{coupletIndex}");
if (!responseCoupletNumbers.IsSuccessStatusCode)
{
return BadRequest(await ReadErrorMessageAsync(responseCoupletNumbers));
}
- var numbers = JArray.Parse(await responseCoupletNumbers.Content.ReadAsStringAsync()).ToObject>();
+ var numbers = JArray.Parse(await responseCoupletNumbers.Content.ReadAsStringAsync()).ToObject>();
- var responseCoupletSections = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/couplet/{poemId}/{coupletIndex}/sections");
+ var responseCoupletSections = await _httpClient.GetAsync($"{APIRoot.Url}/api/diwan/couplet/{poemId}/{coupletIndex}/sections");
if (!responseCoupletSections.IsSuccessStatusCode)
{
return BadRequest(await ReadErrorMessageAsync(responseCoupletSections));
}
- var responseVerses = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/poem/{poemId}/verses?coupletIndex={coupletIndex}");
+ var responseVerses = await _httpClient.GetAsync($"{APIRoot.Url}/api/diwan/poem/{poemId}/verses?coupletIndex={coupletIndex}");
if (!responseVerses.IsSuccessStatusCode)
{
return BadRequest(await ReadErrorMessageAsync(responseVerses));
}
- var verses = JArray.Parse(await responseVerses.Content.ReadAsStringAsync()).ToObject>();
- var sections = JArray.Parse(await responseCoupletSections.Content.ReadAsStringAsync()).ToObject>();
- var sectionsWithMetreAndRhymes = new List();
+ var verses = JArray.Parse(await responseVerses.Content.ReadAsStringAsync()).ToObject>();
+ var sections = JArray.Parse(await responseCoupletSections.Content.ReadAsStringAsync()).ToObject>();
+ var sectionsWithMetreAndRhymes = new List();
foreach (var section in sections)
{
- if (section.GanjoorMetreId != null && !string.IsNullOrEmpty(section.RhymeLetters))
+ if (section.DiwanMetreId != null && !string.IsNullOrEmpty(section.RhymeLetters))
{
- if (!sectionsWithMetreAndRhymes.Any(s => s.GanjoorMetreId == section.GanjoorMetreId && s.RhymeLetters == section.RhymeLetters))
+ if (!sectionsWithMetreAndRhymes.Any(s => s.DiwanMetreId == section.DiwanMetreId && s.RhymeLetters == section.RhymeLetters))
{
sectionsWithMetreAndRhymes.Add(section);
}
@@ -987,34 +987,34 @@ namespace GanjooRazor.Pages
if (Guid.TryParse(Request.Cookies["UserId"], out Guid userId))
if (userId != Guid.Empty)
{
- using (HttpClient secureClient = new HttpClient(new GanjoorReloginHandler(Request, Response)))
+ using (HttpClient secureClient = new HttpClient(new DiwanReloginHandler(Request, Response)))
{
- if (await GanjoorSessionChecker.PrepareClient(secureClient, Request, Response))
+ if (await DiwanSessionChecker.PrepareClient(secureClient, Request, Response))
{
- HttpResponseMessage responseIsBookmarked = await secureClient.GetAsync($"{APIRoot.Url}/api/ganjoor/bookmark/{poemId}");
+ HttpResponseMessage responseIsBookmarked = await secureClient.GetAsync($"{APIRoot.Url}/api/diwan/bookmark/{poemId}");
if (!responseIsBookmarked.IsSuccessStatusCode)
{
return BadRequest(await ReadErrorMessageAsync(responseIsBookmarked));
}
- var bookmarks = JsonConvert.DeserializeObject(await responseIsBookmarked.Content.ReadAsStringAsync());
+ var bookmarks = JsonConvert.DeserializeObject(await responseIsBookmarked.Content.ReadAsStringAsync());
if (bookmarks.Where(b => b.CoupletIndex == coupletIndex).Any())
isBookmarked = true;
- foreach (GanjoorCommentSummaryViewModel comment in comments)
+ foreach (DiwanCommentSummaryViewModel comment in comments)
{
comment.MyComment = comment.UserId == userId;
comment.IsBookmarked = bookmarks.Where(b => b.CoupletIndex == -comment.Id).Any();
_markMyReplies(comment, userId, bookmarks);
}
- HttpResponseMessage responseRatings = await secureClient.GetAsync($"{APIRoot.Url}/api/ganjoor/poem/{poemId}/comments/myratings");
+ HttpResponseMessage responseRatings = await secureClient.GetAsync($"{APIRoot.Url}/api/diwan/poem/{poemId}/comments/myratings");
if (responseRatings.IsSuccessStatusCode)
{
- var ratings = JsonConvert.DeserializeObject(await responseRatings.Content.ReadAsStringAsync());
+ var ratings = JsonConvert.DeserializeObject(await responseRatings.Content.ReadAsStringAsync());
if (ratings.Length > 0)
{
var ratingsDic = ratings.ToDictionary(r => r.CommentId, r => r.Value);
- foreach (GanjoorCommentSummaryViewModel comment in comments)
+ foreach (DiwanCommentSummaryViewModel comment in comments)
{
_applyCommentRatings(comment, ratingsDic);
}
@@ -1025,7 +1025,7 @@ namespace GanjooRazor.Pages
}
}
- return Partial("~/Pages/Partials/GanjoorPage/_BNumPartial.cshtml", new _BNumPartialModel()
+ return Partial("~/Pages/Partials/DiwanPage/_BNumPartial.cshtml", new _BNumPartialModel()
{
PoemId = poemId,
CoupletIndex = coupletIndex,
@@ -1043,7 +1043,7 @@ namespace GanjooRazor.Pages
{
return WithSecureClientAsync(async secureClient =>
{
- var response = await secureClient.PostAsync($"{APIRoot.Url}/api/ganjoor/bookmark/switch/ret/{poemId}/{coupletIndex}", null);
+ var response = await secureClient.PostAsync($"{APIRoot.Url}/api/diwan/bookmark/switch/ret/{poemId}/{coupletIndex}", null);
if (!response.IsSuccessStatusCode)
{
return new BadRequestObjectResult(await ReadErrorMessageAsync(response));
@@ -1057,7 +1057,7 @@ namespace GanjooRazor.Pages
{
return WithSecureClientAsync(async secureClient =>
{
- var response = await secureClient.GetAsync($"{APIRoot.Url}/api/ganjoor/bookmark/{poemId}/{coupletIndex}");
+ var response = await secureClient.GetAsync($"{APIRoot.Url}/api/diwan/bookmark/{poemId}/{coupletIndex}");
if (!response.IsSuccessStatusCode)
{
return new BadRequestObjectResult(await ReadErrorMessageAsync(response));
@@ -1071,12 +1071,12 @@ namespace GanjooRazor.Pages
{
return WithSecureClientAsync(async secureClient =>
{
- var response = await secureClient.GetAsync($"{APIRoot.Url}/api/ganjoor/bookmark/{poemId}");
+ var response = await secureClient.GetAsync($"{APIRoot.Url}/api/diwan/bookmark/{poemId}");
if (!response.IsSuccessStatusCode)
{
return new BadRequestObjectResult(await ReadErrorMessageAsync(response));
}
- var res = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync());
+ var res = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync());
return new OkObjectResult(res);
});
}
@@ -1088,7 +1088,7 @@ namespace GanjooRazor.Pages
{
return WithSecureClientAsync(async secureClient =>
{
- var response = await secureClient.GetAsync($"{APIRoot.Url}/api/ganjoor/poem/{poemId}/recitations/upvotes");
+ var response = await secureClient.GetAsync($"{APIRoot.Url}/api/diwan/poem/{poemId}/recitations/upvotes");
if (!response.IsSuccessStatusCode)
{
return new BadRequestObjectResult(await ReadErrorMessageAsync(response));
@@ -1121,7 +1121,7 @@ namespace GanjooRazor.Pages
{
return new BadRequestObjectResult(await ReadErrorMessageAsync(response));
}
- var res = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync());
+ var res = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync());
if (res.KeepTrack == false)
{
if (Request.Cookies["KeepHistory"] != null)
@@ -1145,7 +1145,7 @@ namespace GanjooRazor.Pages
{
return WithSecureClientAsync(async secureClient =>
{
- var response = await secureClient.PutAsync($"{APIRoot.Url}/api/ganjoor/bookmark/{id}", new StringContent(JsonConvert.SerializeObject(note), Encoding.UTF8, "application/json"));
+ var response = await secureClient.PutAsync($"{APIRoot.Url}/api/diwan/bookmark/{id}", new StringContent(JsonConvert.SerializeObject(note), Encoding.UTF8, "application/json"));
if (!response.IsSuccessStatusCode)
{
return await BadRequestFromApiErrorAsync(response);
@@ -1192,12 +1192,12 @@ namespace GanjooRazor.Pages
public async Task OnGetMoreQuotedPoemsForRelatedPoemPartialAsync(int poemId, int relatedPoemId, string poetImageUrl, string poetNickName, bool canEdit)
{
- string url = $"{APIRoot.Url}/api/ganjoor/poem/{poemId}/quoteds/{relatedPoemId}?published=true";
+ string url = $"{APIRoot.Url}/api/diwan/poem/{poemId}/quoteds/{relatedPoemId}?published=true";
var response = await _httpClient.GetAsync(url);
if (!response.IsSuccessStatusCode)
return BadRequest(await ReadErrorMessageAsync(response));
- var quoteds = JArray.Parse(await response.Content.ReadAsStringAsync()).ToObject>();
+ var quoteds = JArray.Parse(await response.Content.ReadAsStringAsync()).ToObject>();
if (!quoteds.Any())
{
return BadRequest("مورد دیگری یافت نشد.");
@@ -1209,9 +1209,9 @@ namespace GanjooRazor.Pages
quoteds.Remove(mainList);
}
- return Partial("~/Pages/Partials/GanjoorPage/_MultipleQuotedPoemsPartial.cshtml", new _MultipleQuotedPoemsPartialModel()
+ return Partial("~/Pages/Partials/DiwanPage/_MultipleQuotedPoemsPartial.cshtml", new _MultipleQuotedPoemsPartialModel()
{
- GanjoorQuotedPoems = quoteds.ToArray(),
+ DiwanQuotedPoems = quoteds.ToArray(),
PoetImageUrl = poetImageUrl,
PoetNickName = poetNickName,
CanEdit = canEdit
@@ -1220,29 +1220,29 @@ namespace GanjooRazor.Pages
public async Task OnGetMoreQuotedPoemsPartialAsync(int poemId, int skip, string poetImageUrl, string poetNickName, bool canEdit)
{
- string url = $"{APIRoot.Url}/api/ganjoor/poem/{poemId}/quoteds?skip={skip}&itemsCount=1000";
+ string url = $"{APIRoot.Url}/api/diwan/poem/{poemId}/quoteds?skip={skip}&itemsCount=1000";
var response = await _httpClient.GetAsync(url);
if (!response.IsSuccessStatusCode)
return BadRequest(await ReadErrorMessageAsync(response));
- var quoteds = JArray.Parse(await response.Content.ReadAsStringAsync()).ToObject>();
+ var quoteds = JArray.Parse(await response.Content.ReadAsStringAsync()).ToObject>();
- return Partial("~/Pages/Partials/GanjoorPage/_MultipleQuotedPoemsPartial.cshtml", new _MultipleQuotedPoemsPartialModel()
+ return Partial("~/Pages/Partials/DiwanPage/_MultipleQuotedPoemsPartial.cshtml", new _MultipleQuotedPoemsPartialModel()
{
- GanjoorQuotedPoems = quoteds.ToArray(),
+ DiwanQuotedPoems = quoteds.ToArray(),
PoetImageUrl = poetImageUrl,
PoetNickName = poetNickName,
CanEdit = canEdit
});
}
- public string PoemBlockClass => GanjoorPage != null && GanjoorPage.Poem != null && GanjoorPage.Poem.ClaimedByMultiplePoets ? "poem ribbon-parent" : "poem";
+ public string PoemBlockClass => DiwanPage != null && DiwanPage.Poem != null && DiwanPage.Poem.ClaimedByMultiplePoets ? "poem ribbon-parent" : "poem";
public Task OnPostMarkAsTextOriginalAsync(int bookId, int categoryId)
{
return WithSecureClientAsync(async secureClient =>
{
- var response = await secureClient.PutAsync($"{APIRoot.Url}/api/ganjoor/naskban/textoriginal/{bookId}/{categoryId}/true", null);
+ var response = await secureClient.PutAsync($"{APIRoot.Url}/api/diwan/naskban/textoriginal/{bookId}/{categoryId}/true", null);
if (!response.IsSuccessStatusCode)
{
return new BadRequestObjectResult(await ReadErrorMessageAsync(response));
@@ -1257,7 +1257,7 @@ namespace GanjooRazor.Pages
{
var response = await secureClient.DeleteAsync(
relatedImageType == PoemRelatedImageType.MuseumLink
- ? $"{APIRoot.Url}/api/artifacts/ganjoor?linkId={linkId}&removeItemLink={removeItemLink}"
+ ? $"{APIRoot.Url}/api/artifacts/diwan?linkId={linkId}&removeItemLink={removeItemLink}"
: $"{APIRoot.Url}/api/artifacts/pinterest?linkId={linkId}");
if (!response.IsSuccessStatusCode)
{
@@ -1276,7 +1276,7 @@ namespace GanjooRazor.Pages
}
var categoryTop1Recitations = JsonConvert.DeserializeObject(await catTop1RecitationsQuery.Content.ReadAsStringAsync());
- return Partial("~/Pages/Partials/GanjoorPage/_AudioPlayerPartial.cshtml", new _AudioPlayerPartialModel()
+ return Partial("~/Pages/Partials/DiwanPage/_AudioPlayerPartial.cshtml", new _AudioPlayerPartialModel()
{
LoggedIn = !string.IsNullOrEmpty(Request.Cookies["Token"]),
Recitations = categoryTop1Recitations,
@@ -1287,21 +1287,21 @@ namespace GanjooRazor.Pages
///
/// on-demand "شخصیتها" (characters) tab on a poet/category page - fetches the
- /// category-scoped person/relation graph (see GanjoorRelatedPersonService.GetCatPersonGraphAsync)
+ /// category-scoped person/relation graph (see DiwanRelatedPersonService.GetCatPersonGraphAsync)
/// and renders it with the same peoplegraph.js force-directed viewer used by /PeopleGraph
///
///
///
public async Task OnGetPersonGraphAsync(int catId)
{
- var response = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/cat/{catId}/persongraph");
+ var response = await _httpClient.GetAsync($"{APIRoot.Url}/api/diwan/cat/{catId}/persongraph");
if (!response.IsSuccessStatusCode)
{
return BadRequest(await ReadErrorMessageAsync(response));
}
- var graph = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync());
+ var graph = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync());
- return Partial("~/Pages/Partials/GanjoorPage/_PersonGraphPartial.cshtml", new _PersonGraphPartialModel()
+ return Partial("~/Pages/Partials/DiwanPage/_PersonGraphPartial.cshtml", new _PersonGraphPartialModel()
{
CatId = catId,
Graph = graph,
@@ -1310,7 +1310,7 @@ namespace GanjooRazor.Pages
private async Task<_CategoryWordsCountPartialModel> _GetCategoryWordCountsAsync(int catId, int poetId, bool remStopWords = false)
{
- var wordSumsResponse = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/wordsums/{catId}");
+ var wordSumsResponse = await _httpClient.GetAsync($"{APIRoot.Url}/api/diwan/wordsums/{catId}");
if (!wordSumsResponse.IsSuccessStatusCode)
{
return null;
@@ -1321,7 +1321,7 @@ namespace GanjooRazor.Pages
return null;
}
int pageSize = remStopWords ? 200 : 100;
- var wordCountsResponse = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/wordcounts/{catId}?PageNumber=1&PageSize={pageSize}");
+ var wordCountsResponse = await _httpClient.GetAsync($"{APIRoot.Url}/api/diwan/wordcounts/{catId}?PageNumber=1&PageSize={pageSize}");
if (!wordCountsResponse.IsSuccessStatusCode)
{
return null;
@@ -1353,7 +1353,7 @@ namespace GanjooRazor.Pages
return BadRequest("خطا در دسترسی به شمارش واژگان");
}
- return Partial("~/Pages/Partials/GanjoorPage/_CategoryWordsCountPartial.cshtml", res);
+ return Partial("~/Pages/Partials/DiwanPage/_CategoryWordsCountPartial.cshtml", res);
}
public async Task OnGetSearchCategoryWordCountsAsync(int catId, int poetId, string term, int totalWordCount)
@@ -1362,14 +1362,14 @@ namespace GanjooRazor.Pages
{
term = term.Trim();
}
- var wordCountsResponse = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/wordcounts/{catId}?PageNumber=1&PageSize=100&term={term}");
+ var wordCountsResponse = await _httpClient.GetAsync($"{APIRoot.Url}/api/diwan/wordcounts/{catId}?PageNumber=1&PageSize=100&term={term}");
if (!wordCountsResponse.IsSuccessStatusCode)
{
return BadRequest(await ReadErrorMessageAsync(wordCountsResponse));
}
var wordCounts = JsonConvert.DeserializeObject(await wordCountsResponse.Content.ReadAsStringAsync());
- return Partial("~/Pages/Partials/GanjoorPage/_CategoryWordsCountTablePartial.cshtml", new _CategoryWordsCountTablePartialModel()
+ return Partial("~/Pages/Partials/DiwanPage/_CategoryWordsCountTablePartial.cshtml", new _CategoryWordsCountTablePartialModel()
{
CatId = catId,
PoetId = poetId,
@@ -1380,12 +1380,12 @@ namespace GanjooRazor.Pages
public async Task OnGetPoemWordCountsAsync(int poemId)
{
- var poemQuery = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/poem/{poemId}");
+ var poemQuery = await _httpClient.GetAsync($"{APIRoot.Url}/api/diwan/poem/{poemId}");
if (!poemQuery.IsSuccessStatusCode)
{
return BadRequest(await ReadErrorMessageAsync(poemQuery));
}
- var poem = JObject.Parse(await poemQuery.Content.ReadAsStringAsync()).ToObject();
+ var poem = JObject.Parse(await poemQuery.Content.ReadAsStringAsync()).ToObject();
List counts = new List();
foreach (var verse in poem.Verses.Where(v => v.VersePosition != VersePosition.Comment))
@@ -1420,7 +1420,7 @@ namespace GanjooRazor.Pages
RowNmbrInCat = 0,
});
- return Partial("~/Pages/Partials/GanjoorPage/_CategoryWordsCountTablePartial.cshtml", new _CategoryWordsCountTablePartialModel()
+ return Partial("~/Pages/Partials/DiwanPage/_CategoryWordsCountTablePartial.cshtml", new _CategoryWordsCountTablePartialModel()
{
CatId = -1,
PoetId = -1,
@@ -1433,13 +1433,13 @@ namespace GanjooRazor.Pages
public async Task OnGetSimilarPoemsPartialAsync(int poemId, int skip, string prosodyMetre, string rhymeLetters, string poemFullUrl, int sectionIndex)
{
- string url = $"{APIRoot.Url}/api/ganjoor/section/{poemId}/{sectionIndex}/related?skip={skip}&itemsCount=21";
+ string url = $"{APIRoot.Url}/api/diwan/section/{poemId}/{sectionIndex}/related?skip={skip}&itemsCount=21";
var response = await _httpClient.GetAsync(url);
if (!response.IsSuccessStatusCode)
return BadRequest(await ReadErrorMessageAsync(response));
- var relatedSections = JArray.Parse(await response.Content.ReadAsStringAsync()).ToObject>();
+ var relatedSections = JArray.Parse(await response.Content.ReadAsStringAsync()).ToObject>();
- return Partial("~/Pages/Partials/GanjoorPage/_SimiPartialView.cshtml", new _SimiPartialViewModel()
+ return Partial("~/Pages/Partials/DiwanPage/_SimiPartialView.cshtml", new _SimiPartialViewModel()
{
RelatedSections = relatedSections.ToArray(),
Rhythm = prosodyMetre,
@@ -1453,12 +1453,12 @@ namespace GanjooRazor.Pages
public async Task OnGetSimilarPoemsFromPoetPartialAsync(int poetId, string prosodyMetre, string rhymeLetters, string skipPoemFullUrl1, string skipPoemFullUrl2)
{
- string url = $"{APIRoot.Url}/api/ganjoor/poems/similar?metre={prosodyMetre}&rhyme={rhymeLetters}&poetId={poetId}";
+ string url = $"{APIRoot.Url}/api/diwan/poems/similar?metre={prosodyMetre}&rhyme={rhymeLetters}&poetId={poetId}";
var response = await _httpClient.GetAsync(url);
if (!response.IsSuccessStatusCode)
return BadRequest(await ReadErrorMessageAsync(response));
- var poems = JArray.Parse(await response.Content.ReadAsStringAsync()).ToObject>();
+ var poems = JArray.Parse(await response.Content.ReadAsStringAsync()).ToObject>();
if (poems.Any(p => p.FullUrl == skipPoemFullUrl1))
poems.RemoveAll(p => p.FullUrl == skipPoemFullUrl1); //TODO: fix errors here
if (poems.Any(p => p.FullUrl == skipPoemFullUrl2))
@@ -1466,10 +1466,10 @@ namespace GanjooRazor.Pages
foreach (var poem in poems)
{
- poem.HtmlText = GanjoorPoemTools.GetPoemHtmlExcerpt(poem.HtmlText);
+ poem.HtmlText = DiwanPoemTools.GetPoemHtmlExcerpt(poem.HtmlText);
}
- return Partial("~/Pages/Partials/GanjoorPage/_SimiPartialFromPoetView.cshtml", new _SimiPartialFromPoetViewModel()
+ return Partial("~/Pages/Partials/DiwanPage/_SimiPartialFromPoetView.cshtml", new _SimiPartialFromPoetViewModel()
{
Poems = poems,
});
diff --git a/GanjooRazor/Pages/GanjoorPageModelBase.cs b/DiwanRazor/Pages/DiwanPageModelBase.cs
similarity index 88%
rename from GanjooRazor/Pages/GanjoorPageModelBase.cs
rename to DiwanRazor/Pages/DiwanPageModelBase.cs
index 2a7b36f8..2a40d36b 100644
--- a/GanjooRazor/Pages/GanjoorPageModelBase.cs
+++ b/DiwanRazor/Pages/DiwanPageModelBase.cs
@@ -4,12 +4,12 @@ using Newtonsoft.Json;
using System;
using System.Net.Http;
using System.Threading.Tasks;
-using GanjooRazor.Utils;
+using DiwanRazor.Utils;
-namespace GanjooRazor.Pages
+namespace DiwanRazor.Pages
{
///
- /// Base class for Razor page models that call the Ganjoor API.
+ /// Base class for Razor page models that call the Diwan API.
///
/// Centralizes three patterns that were previously copy-pasted across dozens of page-model
/// files in this project (Index.cshtml.cs alone had ~35+10+14 copies before this class existed):
@@ -20,9 +20,9 @@ namespace GanjooRazor.Pages
/// (the base class used by public-site pages) derives
/// from this. Admin/User-area page models that used to derive directly from
/// can derive from this instead to get the same helpers without inheriting the public-site-specific
- /// properties (GanjoorPage, NextUrl, etc.) that live on .
+ /// properties (DiwanPage, NextUrl, etc.) that live on .
///
- public class GanjoorPageModelBase : PageModel
+ public class DiwanPageModelBase : PageModel
{
///
/// Message shown whenever an action requiring a session couldn't prepare an authenticated
@@ -36,7 +36,7 @@ namespace GanjooRazor.Pages
///
protected readonly HttpClient _httpClient;
- protected GanjoorPageModelBase(HttpClient httpClient)
+ protected DiwanPageModelBase(HttpClient httpClient)
{
_httpClient = httpClient;
}
@@ -51,7 +51,7 @@ namespace GanjooRazor.Pages
///
/// Shape of the special error string the API sends (still just a plain string, see
- /// GanjoorService._BuildSanitizerDroppedTextError on the RMuseum side) when a comment/note/
+ /// DiwanService._BuildSanitizerDroppedTextError on the RMuseum side) when a comment/note/
/// suggestion was rejected because sanitizing it had to drop real text. Message is the
/// human-readable explanation; RemainingText is the plain text that would have remained,
/// so the client can diff it against what the user actually typed and show exactly what
@@ -86,7 +86,7 @@ namespace GanjooRazor.Pages
///
/// Runs against an HttpClient authenticated from the current
- /// session cookies (via ). If the session
+ /// session cookies (via ). If the session
/// can't be prepared (missing/expired cookies), returns
/// (defaulting to a 400 with ) instead of every handler
/// re-implementing the same using/if/else block.
@@ -123,8 +123,8 @@ namespace GanjooRazor.Pages
Func> operation,
IActionResult unauthorizedResult = null)
{
- using var secureClient = new HttpClient(new GanjoorReloginHandler(Request, Response));
- if (!await GanjoorSessionChecker.PrepareClient(secureClient, Request, Response))
+ using var secureClient = new HttpClient(new DiwanReloginHandler(Request, Response));
+ if (!await DiwanSessionChecker.PrepareClient(secureClient, Request, Response))
{
return unauthorizedResult ?? new BadRequestObjectResult(NotLoggedInMessage);
}
diff --git a/GanjooRazor/Pages/Error.cshtml b/DiwanRazor/Pages/Error.cshtml
similarity index 100%
rename from GanjooRazor/Pages/Error.cshtml
rename to DiwanRazor/Pages/Error.cshtml
diff --git a/GanjooRazor/Pages/Error.cshtml.cs b/DiwanRazor/Pages/Error.cshtml.cs
similarity index 97%
rename from GanjooRazor/Pages/Error.cshtml.cs
rename to DiwanRazor/Pages/Error.cshtml.cs
index c3dbc011..76edf564 100644
--- a/GanjooRazor/Pages/Error.cshtml.cs
+++ b/DiwanRazor/Pages/Error.cshtml.cs
@@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
using System.Diagnostics;
-namespace GanjooRazor.Pages
+namespace DiwanRazor.Pages
{
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public class ErrorModel : PageModel
diff --git a/GanjooRazor/Pages/FAQ.cshtml b/DiwanRazor/Pages/FAQ.cshtml
similarity index 94%
rename from GanjooRazor/Pages/FAQ.cshtml
rename to DiwanRazor/Pages/FAQ.cshtml
index b5b30f8a..ce85f2d2 100644
--- a/GanjooRazor/Pages/FAQ.cshtml
+++ b/DiwanRazor/Pages/FAQ.cshtml
@@ -1,5 +1,5 @@
@page
-@model GanjooRazor.Pages.FAQModel
+@model DiwanRazor.Pages.FAQModel
@{
Layout = "_Layout";
}
@@ -30,7 +30,7 @@ else
@Model.Question.Question
-
+
@Html.Raw(Model.Question.AnswerExcerpt)
@@ -51,7 +51,7 @@ else
-
+
@Html.Raw(item.AnswerExcerpt)
diff --git a/GanjooRazor/Pages/FAQ.cshtml.cs b/DiwanRazor/Pages/FAQ.cshtml.cs
similarity index 92%
rename from GanjooRazor/Pages/FAQ.cshtml.cs
rename to DiwanRazor/Pages/FAQ.cshtml.cs
index 81381bb7..52eca26e 100644
--- a/GanjooRazor/Pages/FAQ.cshtml.cs
+++ b/DiwanRazor/Pages/FAQ.cshtml.cs
@@ -1,25 +1,25 @@
-using GanjooRazor.Utils;
+using DiwanRazor.Utils;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.OutputCaching;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using RMuseum.Models.FAQ;
-using RMuseum.Models.Ganjoor.ViewModels;
+using RMuseum.Models.Diwan.ViewModels;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
-namespace GanjooRazor.Pages
+namespace DiwanRazor.Pages
{
- [OutputCache(PolicyName = "GanjoorPublicPage")]
+ [OutputCache(PolicyName = "DiwanPublicPage")]
public class FAQModel : LoginPartialEnabledPageModel
{
private readonly PoetCacheService _poetCache;
public string LastError { get; set; }
- public List Poets { get; set; }
+ public List Poets { get; set; }
public List PinnedItemsCategories { get; set; }
diff --git a/GanjooRazor/Pages/FamilyTreeWindow.cshtml b/DiwanRazor/Pages/FamilyTreeWindow.cshtml
similarity index 97%
rename from GanjooRazor/Pages/FamilyTreeWindow.cshtml
rename to DiwanRazor/Pages/FamilyTreeWindow.cshtml
index 612c3f62..64509129 100644
--- a/GanjooRazor/Pages/FamilyTreeWindow.cshtml
+++ b/DiwanRazor/Pages/FamilyTreeWindow.cshtml
@@ -1,5 +1,5 @@
@page "{id:int}"
-@model GanjooRazor.Pages.FamilyTreeWindowModel
+@model DiwanRazor.Pages.FamilyTreeWindowModel
@{
Layout = null;
}
@@ -56,7 +56,7 @@ else
@* not an executable script - just a data holder, parsed and rendered explicitly by
FamilyTreeWindow.open()'s onReady callback in personwindow.js once this fragment has
been injected into the modal body (innerHTML never executes a
diff --git a/GanjooRazor/Pages/FamilyTreeWindow.cshtml.cs b/DiwanRazor/Pages/FamilyTreeWindow.cshtml.cs
similarity index 83%
rename from GanjooRazor/Pages/FamilyTreeWindow.cshtml.cs
rename to DiwanRazor/Pages/FamilyTreeWindow.cshtml.cs
index c6b395b5..197b1763 100644
--- a/GanjooRazor/Pages/FamilyTreeWindow.cshtml.cs
+++ b/DiwanRazor/Pages/FamilyTreeWindow.cshtml.cs
@@ -3,10 +3,10 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
-using RMuseum.Models.Ganjoor;
-using RMuseum.Models.Ganjoor.ViewModels;
+using RMuseum.Models.Diwan;
+using RMuseum.Models.Diwan.ViewModels;
-namespace GanjooRazor.Pages
+namespace DiwanRazor.Pages
{
///
/// interactive family-tree chart, drawn client-side (vanilla JS/SVG - see familytree.js) from
@@ -24,9 +24,9 @@ namespace GanjooRazor.Pages
public string LastError { get; set; }
- public GanjoorRelatedPerson RootPerson { get; set; }
+ public DiwanRelatedPerson RootPerson { get; set; }
- public GanjoorFamilyTreeViewModel Tree { get; set; }
+ public DiwanFamilyTreeViewModel Tree { get; set; }
///
/// Tree, re-serialized with an explicit camelCase contract (same convention
@@ -50,7 +50,7 @@ namespace GanjooRazor.Pages
LastError = await ReadErrorMessageAsync(personResponse);
return Page();
}
- RootPerson = JsonConvert.DeserializeObject(await personResponse.Content.ReadAsStringAsync());
+ RootPerson = JsonConvert.DeserializeObject(await personResponse.Content.ReadAsStringAsync());
if (RootPerson == null)
{
LastError = "شخصیتی با این کد پیدا نشد.";
@@ -63,7 +63,7 @@ namespace GanjooRazor.Pages
LastError = await ReadErrorMessageAsync(treeResponse);
return Page();
}
- Tree = JsonConvert.DeserializeObject(await treeResponse.Content.ReadAsStringAsync());
+ Tree = JsonConvert.DeserializeObject(await treeResponse.Content.ReadAsStringAsync());
return Page();
}
diff --git a/GanjooRazor/Pages/Hashieha.cshtml b/DiwanRazor/Pages/Hashieha.cshtml
similarity index 99%
rename from GanjooRazor/Pages/Hashieha.cshtml
rename to DiwanRazor/Pages/Hashieha.cshtml
index 50d9bd6a..77f5991a 100644
--- a/GanjooRazor/Pages/Hashieha.cshtml
+++ b/DiwanRazor/Pages/Hashieha.cshtml
@@ -1,6 +1,6 @@
@page
@using DNTPersianUtils.Core;
-@model GanjooRazor.Pages.HashiehaModel
+@model DiwanRazor.Pages.HashiehaModel
@{
Layout = "_Layout";
}
@@ -195,7 +195,7 @@ else
else
foreach (var comment in Model.Comments)
{
-
+
@if (comment.UserId == null)
{
diff --git a/GanjooRazor/Pages/Hashieha.cshtml.cs b/DiwanRazor/Pages/Hashieha.cshtml.cs
similarity index 88%
rename from GanjooRazor/Pages/Hashieha.cshtml.cs
rename to DiwanRazor/Pages/Hashieha.cshtml.cs
index 7302ab3c..bf330a2e 100644
--- a/GanjooRazor/Pages/Hashieha.cshtml.cs
+++ b/DiwanRazor/Pages/Hashieha.cshtml.cs
@@ -5,21 +5,21 @@ using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using DNTPersianUtils.Core;
-using GanjooRazor.Utils;
+using DiwanRazor.Utils;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.OutputCaching;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using RMuseum.Models.Auth.ViewModel;
-using RMuseum.Models.Ganjoor.ViewModels;
+using RMuseum.Models.Diwan.ViewModels;
using RMuseum.Services.Implementation;
using RSecurityBackend.Models.Auth.Memory;
using RSecurityBackend.Models.Generic;
-namespace GanjooRazor.Pages
+namespace DiwanRazor.Pages
{
- [OutputCache(PolicyName = "GanjoorPublicPage")]
+ [OutputCache(PolicyName = "DiwanPublicPage")]
public class HashiehaModel : LoginPartialEnabledPageModel
{
private readonly PoetCacheService _poetCache;
@@ -32,13 +32,13 @@ namespace GanjooRazor.Pages
_poetCache = poetCache;
}
- public List Poets { get; set; }
+ public List Poets { get; set; }
public int PoetId { get; set; }
- public GanjoorPoetCompleteViewModel Poet { get; set; }
+ public DiwanPoetCompleteViewModel Poet { get; set; }
public string PagingToolsHtml { get; set; }
public string LastError { get; set; }
- public List Comments { get; set; }
+ public List Comments { get; set; }
public async Task OnGetPoetInformationAsync(int id)
{
@@ -54,7 +54,7 @@ namespace GanjooRazor.Pages
return new OkObjectResult(poet);
}
- public GanjoorUserPublicProfile Profile { get; set; }
+ public DiwanUserPublicProfile Profile { get; set; }
public UserContributionsViewModel Contributions { get; set; }
@@ -110,19 +110,19 @@ namespace GanjooRazor.Pages
Query = Request.Query["w"];
var filterUserId = Request.Query["userid"];
- string url = $"{APIRoot.Url}/api/ganjoor/comments?PageNumber={pageNumber}&PageSize=20";
+ string url = $"{APIRoot.Url}/api/diwan/comments?PageNumber={pageNumber}&PageSize=20";
Title = "حاشیهها";
HomeLink = "/hashieha";
if (!string.IsNullOrEmpty(filterUserId))
{
- var responseUserProfile = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/user/profile/{filterUserId}");
+ var responseUserProfile = await _httpClient.GetAsync($"{APIRoot.Url}/api/diwan/user/profile/{filterUserId}");
if (!responseUserProfile.IsSuccessStatusCode)
{
LastError = await ReadErrorMessageAsync(responseUserProfile);
return Page();
}
- Profile = JsonConvert.DeserializeObject(await responseUserProfile.Content.ReadAsStringAsync());
+ Profile = JsonConvert.DeserializeObject(await responseUserProfile.Content.ReadAsStringAsync());
var responseContributions = await _httpClient.GetAsync($"{APIRoot.Url}/api/contributions/{filterUserId}");
@@ -144,10 +144,10 @@ namespace GanjooRazor.Pages
{
// Was previously a hand-rolled HttpClient with the Bearer token set directly from
// the cookie, manually searching /api/users/securableitems for a matching
- // securable + operation. GanjoorSessionChecker.IsPermitted already does exactly
+ // securable + operation. DiwanSessionChecker.IsPermitted already does exactly
// this and (unlike the hand-rolled version) goes through PrepareClient's session
// renewal, so it also correctly handles a token that needs refreshing.
- CanAdministerUsers = await GanjoorSessionChecker.IsPermitted(Request, Response, SecurableItem.UserEntityShortName, SecurableItem.Administer);
+ CanAdministerUsers = await DiwanSessionChecker.IsPermitted(Request, Response, SecurableItem.UserEntityShortName, SecurableItem.Administer);
}
url += $"&filterUserId={filterUserId}";
@@ -173,7 +173,7 @@ namespace GanjooRazor.Pages
}
- Comments = JArray.Parse(await response.Content.ReadAsStringAsync()).ToObject>();
+ Comments = JArray.Parse(await response.Content.ReadAsStringAsync()).ToObject>();
string paginnationMetadata = response.Headers.GetValues("paging-headers").FirstOrDefault();
PaginationMetadata paginationMetadata = JsonConvert.DeserializeObject(paginnationMetadata);
diff --git a/GanjooRazor/Pages/ImageRecommendation/Pin.cshtml b/DiwanRazor/Pages/ImageRecommendation/Pin.cshtml
similarity index 97%
rename from GanjooRazor/Pages/ImageRecommendation/Pin.cshtml
rename to DiwanRazor/Pages/ImageRecommendation/Pin.cshtml
index 3bef465f..888a2e77 100644
--- a/GanjooRazor/Pages/ImageRecommendation/Pin.cshtml
+++ b/DiwanRazor/Pages/ImageRecommendation/Pin.cshtml
@@ -1,5 +1,5 @@
@page
-@model GanjooRazor.Pages.PinModel
+@model DiwanRazor.Pages.PinModel
@{
Layout = null;
}
@@ -76,9 +76,9 @@
ورود به دیوان";
+ LastError = $"برای پیشنهاد تصاویر مرتبط با اشعار لازم است ابتدا با نام کاربری خود وارد دیوان شوید.
ورود به دیوان";
}
else
if (Request.Query["final"] == "1")
{
- using (HttpClient secureClient = new HttpClient(new GanjoorReloginHandler(Request, Response)))
+ using (HttpClient secureClient = new HttpClient(new DiwanReloginHandler(Request, Response)))
{
- if(await GanjoorSessionChecker.PrepareClient(secureClient, Request, Response))
+ if(await DiwanSessionChecker.PrepareClient(secureClient, Request, Response))
{
PinterestLinkViewModel model = new PinterestLinkViewModel()
{
- GanjoorPostId = RelatedImageSuggestionModel.PoemId,
- GanjoorUrl = $"https://ganjoor.net{RelatedImageSuggestionModel.GanjoorUrl}",
- GanjoorTitle = RelatedImageSuggestionModel.GanjoorTitle,
+ DiwanPostId = RelatedImageSuggestionModel.PoemId,
+ DiwanUrl = $"https://ganjoor.net{RelatedImageSuggestionModel.DiwanUrl}",
+ DiwanTitle = RelatedImageSuggestionModel.DiwanTitle,
AltText = RelatedImageSuggestionModel.AltText,
- LinkType = RMuseum.Models.GanjoorIntegration.LinkType.Pinterest,
+ LinkType = RMuseum.Models.DiwanIntegration.LinkType.Pinterest,
PinterestUrl = RelatedImageSuggestionModel.PinterestUrl,
PinterestImageUrl = RelatedImageSuggestionModel.PinterestImageUrl
};
diff --git a/GanjooRazor/Pages/Index.cshtml b/DiwanRazor/Pages/Index.cshtml
similarity index 96%
rename from GanjooRazor/Pages/Index.cshtml
rename to DiwanRazor/Pages/Index.cshtml
index ef29fdcb..e1713c26 100644
--- a/GanjooRazor/Pages/Index.cshtml
+++ b/DiwanRazor/Pages/Index.cshtml
@@ -65,7 +65,7 @@ else
@@ -837,7 +837,7 @@
تذکر مهم: از آنجا که دیوان فاقد نیروی انسانی کافی برای رسیدگی به حجم بالایی از تخلف در حاشیهها میباشد در صورت تکرار موارد عنوان شده توسط یک کاربر در حاشیههای متعدد، حساب کاربر متخلف بدون اخطار قبلی حذف خواهد شد. ضمناً فحاشی یا هر اقدامی که نشان دهد کاربر تلاش داشته با انجام آن عامدانه خرابکاری کند یا مشکلی برای سایت ایجاد کند حتی اگر فقط یک بار اتفاق بیفتد منجر به حذف حساب کاربر متخلف بدون اخطار قبلی خواهد شد.
- لطفاً در صورتی که تفاوتها را با استناد به نسخههای چاپی یا خطی گزارش میکنید این مسئله را با ذکر منبع مطرح نمایید. اشتباهات تایپی و غلطهای املایی را ویرایش و تصحیح کنید.
+ لطفاً در صورتی که تفاوتها را با استناد به نسخههای چاپی یا خطی گزارش میکنید این مسئله را با ذکر منبع مطرح نمایید. اشتباهات تایپی و غلطهای املایی را ویرایش و تصحیح کنید.
لطفاً از درج اطلاعات خصوصی مانند تلفن همراه و مانند آن در حاشیه خودداری کنید. انتشار چنین اطلاعاتی به صورت عمومی ممکن است باعث سوء استفادهٔ کلاهبرداران شود.
@@ -873,7 +873,7 @@
@{
- foreach (var gran in Model.GanjoorPage.PoetOrCat.Cat.Ancestors)
+ foreach (var gran in Model.DiwanPage.PoetOrCat.Cat.Ancestors)
{
@Html.Raw(gran.Title) »
}
-
diff --git a/GanjooRazor/Pages/Partials/GanjoorPage/_MultipleQuotedPoemsPartial.cshtml b/DiwanRazor/Pages/Partials/DiwanPage/_MultipleQuotedPoemsPartial.cshtml
similarity index 62%
rename from GanjooRazor/Pages/Partials/GanjoorPage/_MultipleQuotedPoemsPartial.cshtml
rename to DiwanRazor/Pages/Partials/DiwanPage/_MultipleQuotedPoemsPartial.cshtml
index 01b34bdf..db72eb19 100644
--- a/GanjooRazor/Pages/Partials/GanjoorPage/_MultipleQuotedPoemsPartial.cshtml
+++ b/DiwanRazor/Pages/Partials/DiwanPage/_MultipleQuotedPoemsPartial.cshtml
@@ -1,10 +1,10 @@
-@model GanjooRazor.Pages._MultipleQuotedPoemsPartialModel
+@model DiwanRazor.Pages._MultipleQuotedPoemsPartialModel
@using DNTPersianUtils.Core
@{
Layout = null;
}
-@foreach (var q in Model.GanjoorQuotedPoems)
+@foreach (var q in Model.DiwanQuotedPoems)
{
}
\ No newline at end of file
diff --git a/GanjooRazor/Pages/Partials/GanjoorPage/_MultipleQuotedPoemsPartial.cshtml.cs b/DiwanRazor/Pages/Partials/DiwanPage/_MultipleQuotedPoemsPartial.cshtml.cs
similarity index 58%
rename from GanjooRazor/Pages/Partials/GanjoorPage/_MultipleQuotedPoemsPartial.cshtml.cs
rename to DiwanRazor/Pages/Partials/DiwanPage/_MultipleQuotedPoemsPartial.cshtml.cs
index 02f2a0fa..8a1567f9 100644
--- a/GanjooRazor/Pages/Partials/GanjoorPage/_MultipleQuotedPoemsPartial.cshtml.cs
+++ b/DiwanRazor/Pages/Partials/DiwanPage/_MultipleQuotedPoemsPartial.cshtml.cs
@@ -1,11 +1,11 @@
using Microsoft.AspNetCore.Mvc.RazorPages;
-using RMuseum.Models.Ganjoor.ViewModels;
+using RMuseum.Models.Diwan.ViewModels;
-namespace GanjooRazor.Pages
+namespace DiwanRazor.Pages
{
public class _MultipleQuotedPoemsPartialModel : PageModel
{
- public GanjoorQuotedPoemViewModel[] GanjoorQuotedPoems { get; set; }
+ public DiwanQuotedPoemViewModel[] DiwanQuotedPoems { get; set; }
public string PoetImageUrl { get; set; }
@@ -13,11 +13,11 @@ namespace GanjooRazor.Pages
public bool CanEdit { get; set; }
- public _QuotedPoemPartialModel GetQuotedPoemModel(GanjoorQuotedPoemViewModel quotedPoem, string poetImageUrl, string poetNickName)
+ public _QuotedPoemPartialModel GetQuotedPoemModel(DiwanQuotedPoemViewModel quotedPoem, string poetImageUrl, string poetNickName)
{
return new _QuotedPoemPartialModel()
{
- GanjoorQuotedPoemViewModel = quotedPoem,
+ DiwanQuotedPoemViewModel = quotedPoem,
PoetImageUrl = poetImageUrl,
PoetNickName = poetNickName,
CanEdit = CanEdit,
diff --git a/GanjooRazor/Pages/Partials/GanjoorPage/_PersonGraphPartial.cshtml b/DiwanRazor/Pages/Partials/DiwanPage/_PersonGraphPartial.cshtml
similarity index 98%
rename from GanjooRazor/Pages/Partials/GanjoorPage/_PersonGraphPartial.cshtml
rename to DiwanRazor/Pages/Partials/DiwanPage/_PersonGraphPartial.cshtml
index d7f5ce0c..5e1186a7 100644
--- a/GanjooRazor/Pages/Partials/GanjoorPage/_PersonGraphPartial.cshtml
+++ b/DiwanRazor/Pages/Partials/DiwanPage/_PersonGraphPartial.cshtml
@@ -1,4 +1,4 @@
-@model GanjooRazor.Pages._PersonGraphPartialModel
+@model DiwanRazor.Pages._PersonGraphPartialModel
@if (Model.Graph == null || Model.Graph.Nodes == null || Model.Graph.Nodes.Count == 0)
{
diff --git a/GanjooRazor/Pages/Partials/GanjoorPage/_PersonGraphPartial.cshtml.cs b/DiwanRazor/Pages/Partials/DiwanPage/_PersonGraphPartial.cshtml.cs
similarity index 86%
rename from GanjooRazor/Pages/Partials/GanjoorPage/_PersonGraphPartial.cshtml.cs
rename to DiwanRazor/Pages/Partials/DiwanPage/_PersonGraphPartial.cshtml.cs
index fce785c1..368969d2 100644
--- a/GanjooRazor/Pages/Partials/GanjoorPage/_PersonGraphPartial.cshtml.cs
+++ b/DiwanRazor/Pages/Partials/DiwanPage/_PersonGraphPartial.cshtml.cs
@@ -1,14 +1,14 @@
using Microsoft.AspNetCore.Mvc.RazorPages;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
-using RMuseum.Models.Ganjoor.ViewModels;
+using RMuseum.Models.Diwan.ViewModels;
-namespace GanjooRazor.Pages
+namespace DiwanRazor.Pages
{
///
/// model for the on-demand "شخصیتها" (characters) tab shown on a poet/category page - renders
/// the same force-directed graph as the PeopleExplorer.open() modal/peoplegraph.js, but scoped
- /// to one work/category (see GanjoorRelatedPersonService.GetCatPersonGraphAsync) instead of the
+ /// to one work/category (see DiwanRelatedPersonService.GetCatPersonGraphAsync) instead of the
/// whole site. Element ids are prefixed "pg-cat-" so this partial can sit on the same page as
/// (and not collide with) any other graph instance.
///
@@ -20,9 +20,9 @@ namespace GanjooRazor.Pages
public int CatId { get; set; }
///
- /// the graph data returned by GET api/ganjoor/cat/{id}/persongraph
+ /// the graph data returned by GET api/diwan/cat/{id}/persongraph
///
- public GanjoorPersonGraphViewModel Graph { get; set; }
+ public DiwanPersonGraphViewModel Graph { get; set; }
///
/// Graph, re-serialized with an explicit camelCase contract (same convention
diff --git a/DiwanRazor/Pages/Partials/DiwanPage/_QuotedPoemPartial.cshtml b/DiwanRazor/Pages/Partials/DiwanPage/_QuotedPoemPartial.cshtml
new file mode 100644
index 00000000..29fd01b9
--- /dev/null
+++ b/DiwanRazor/Pages/Partials/DiwanPage/_QuotedPoemPartial.cshtml
@@ -0,0 +1,239 @@
+@model DiwanRazor.Pages._QuotedPoemPartialModel
+@using DNTPersianUtils.Core
+@{
+ Layout = null;
+}
+
+