This commit is contained in:
Zel
2025-02-25 23:06:02 +08:00
parent 8b415588bc
commit f8519c41bf
23 changed files with 161 additions and 140 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -51,6 +51,7 @@ namespace ZelWiki.Models.ViewModels.Admin
public int PaginationPageSize { get; set; } public int PaginationPageSize { get; set; }
public int PaginationPageCount { get; set; } public int PaginationPageCount { get; set; }
[Display(Name = "角色")]
public string Role { get; set; } = string.Empty; public string Role { get; set; } = string.Empty;
public static AccountProfileAccountViewModel FromDataModel(AccountProfile model) public static AccountProfileAccountViewModel FromDataModel(AccountProfile model)

View File

@@ -7,14 +7,14 @@ namespace ZelWiki.Models.ViewModels.Shared
public const string NOTSET = "\\__!!_PASSWORD_NOT_SET_!!__//"; public const string NOTSET = "\\__!!_PASSWORD_NOT_SET_!!__//";
[Required] [Required]
[Display(Name = "Password")] [Display(Name = "密码")]
[StringLength(50, MinimumLength = 6, ErrorMessage = "Must have a minimum length of 5.")] [StringLength(50, MinimumLength = 6, ErrorMessage = "密码必须大于6位")]
public string Password { get; set; } = NOTSET; public string Password { get; set; } = NOTSET;
[Required] [Required]
[Display(Name = "Re-enter Password")] [Display(Name = "再次输入密码")]
[StringLength(50, MinimumLength = 6, ErrorMessage = "Must have a minimum length of 5.")] [StringLength(50, MinimumLength = 6, ErrorMessage = "密码必须大于6位")]
[Compare("Password", ErrorMessage = "The two entered passwords do not match.")] [Compare("Password", ErrorMessage = "两次密码输入不一致")]
public string ComparePassword { get; set; } = NOTSET; public string ComparePassword { get; set; } = NOTSET;
} }
} }

View File

@@ -19,7 +19,10 @@ using static ZelWiki.Library.Images;
namespace ZelWiki.Controllers namespace ZelWiki.Controllers
{ {
[Route("")] [Route("")]
public class PageController(IZelEngine zelEngine, SignInManager<IdentityUser> signInManager, UserManager<IdentityUser> userManager) public class PageController(
IZelEngine zelEngine,
SignInManager<IdentityUser> signInManager,
UserManager<IdentityUser> userManager)
: WikiControllerBase(signInManager, userManager) : WikiControllerBase(signInManager, userManager)
{ {
[AllowAnonymous] [AllowAnonymous]
@@ -76,7 +79,8 @@ namespace ZelWiki.Controllers
queryKey += $"{query.Key}:{query.Value}"; queryKey += $"{query.Key}:{query.Value}";
} }
var cacheKey = WikiCacheKeyFunction.Build(WikiCache.Category.Page, [page.Navigation, page.Revision, queryKey]); var cacheKey = WikiCacheKeyFunction.Build(WikiCache.Category.Page,
[page.Navigation, page.Revision, queryKey]);
if (WikiCache.TryGet<PageCache>(cacheKey, out var cached)) if (WikiCache.TryGet<PageCache>(cacheKey, out var cached))
{ {
model.Body = cached.Body; model.Body = cached.Body;
@@ -96,7 +100,8 @@ namespace ZelWiki.Controllers
PageTitle = state.PageTitle PageTitle = state.PageTitle
}; };
WikiCache.Put(cacheKey, toBeCached); //This is cleared with the call to Cache.ClearCategory($"Page:{page.Navigation}"); WikiCache.Put(cacheKey,
toBeCached); //This is cleared with the call to Cache.ClearCategory($"Page:{page.Navigation}");
} }
} }
} }
@@ -107,7 +112,8 @@ namespace ZelWiki.Controllers
model.Body = state.HtmlResult; model.Body = state.HtmlResult;
} }
if (GlobalConfiguration.EnablePageComments && GlobalConfiguration.ShowCommentsOnPageFooter && model.HideFooterComments == false) if (GlobalConfiguration.EnablePageComments && GlobalConfiguration.ShowCommentsOnPageFooter &&
model.HideFooterComments == false)
{ {
var comments = PageRepository.GetPageCommentsPaged(navigation.Canonical, 1); var comments = PageRepository.GetPageCommentsPaged(navigation.Canonical, 1);
@@ -128,7 +134,8 @@ namespace ZelWiki.Controllers
} }
else if (pageRevision != null) else if (pageRevision != null)
{ {
var notExistPageName = ConfigurationRepository.Get<string>("Customization", "Revision Does Not Exists Page"); var notExistPageName =
ConfigurationRepository.Get<string>("Customization", "Revision Does Not Exists Page");
string notExistPageNavigation = NamespaceNavigation.CleanAndValidate(notExistPageName); string notExistPageNavigation = NamespaceNavigation.CleanAndValidate(notExistPageName);
var notExistsPage = PageRepository.GetPageRevisionByNavigation(notExistPageNavigation).EnsureNotNull(); var notExistsPage = PageRepository.GetPageRevisionByNavigation(notExistPageNavigation).EnsureNotNull();
@@ -183,7 +190,8 @@ namespace ZelWiki.Controllers
{ {
var model = new PageSearchViewModel() var model = new PageSearchViewModel()
{ {
Pages = PageRepository.PageSearchPaged(Utility.SplitToTokens(searchString), GetQueryValue("page", 1)), Pages = PageRepository.PageSearchPaged(Utility.SplitToTokens(searchString),
GetQueryValue("page", 1)),
SearchString = searchString SearchString = searchString
}; };
@@ -208,7 +216,8 @@ namespace ZelWiki.Controllers
{ {
model = new PageSearchViewModel() model = new PageSearchViewModel()
{ {
Pages = PageRepository.PageSearchPaged(Utility.SplitToTokens(searchString), GetQueryValue("page", 1)), Pages = PageRepository.PageSearchPaged(Utility.SplitToTokens(searchString),
GetQueryValue("page", 1)),
SearchString = searchString SearchString = searchString
}; };
@@ -252,7 +261,8 @@ namespace ZelWiki.Controllers
} }
else else
{ {
PageRepository.DeletePageCommentByUserAndId(pageInfo.Id, SessionState.Profile.EnsureNotNull().UserId, int.Parse(deleteAction)); PageRepository.DeletePageCommentByUserAndId(pageInfo.Id,
SessionState.Profile.EnsureNotNull().UserId, int.Parse(deleteAction));
} }
} }
@@ -375,7 +385,8 @@ namespace ZelWiki.Controllers
var model = new RevisionsViewModel() var model = new RevisionsViewModel()
{ {
Revisions = PageRepository.GetPageRevisionsInfoByNavigationPaged(pageNavigation, pageNumber, orderBy, orderByDirection) Revisions = PageRepository.GetPageRevisionsInfoByNavigationPaged(pageNavigation, pageNumber, orderBy,
orderByDirection)
}; };
model.PaginationPageCount = (model.Revisions.FirstOrDefault()?.PaginationPageCount ?? 0); model.PaginationPageCount = (model.Revisions.FirstOrDefault()?.PaginationPageCount ?? 0);
@@ -417,7 +428,8 @@ namespace ZelWiki.Controllers
var instructions = PageRepository.GetPageProcessingInstructionsByPageId(page.EnsureNotNull().Id); var instructions = PageRepository.GetPageProcessingInstructionsByPageId(page.EnsureNotNull().Id);
if (instructions.Contains(WikiInstruction.Protect)) if (instructions.Contains(WikiInstruction.Protect))
{ {
return NotifyOfError("The page is protected and cannot be deleted. A moderator or an administrator must remove the protection before deletion."); return NotifyOfError(
"The page is protected and cannot be deleted. A moderator or an administrator must remove the protection before deletion.");
} }
bool confirmAction = bool.Parse(GetFormValue("IsActionConfirmed").EnsureNotNull()); bool confirmAction = bool.Parse(GetFormValue("IsActionConfirmed").EnsureNotNull());
@@ -455,7 +467,8 @@ namespace ZelWiki.Controllers
var instructions = PageRepository.GetPageProcessingInstructionsByPageId(page.Id); var instructions = PageRepository.GetPageProcessingInstructionsByPageId(page.Id);
if (instructions.Contains(WikiInstruction.Protect)) if (instructions.Contains(WikiInstruction.Protect))
{ {
return NotifyOfError("The page is protected and cannot be deleted. A moderator or an administrator must remove the protection before deletion."); return NotifyOfError(
"The page is protected and cannot be deleted. A moderator or an administrator must remove the protection before deletion.");
} }
return View(model); return View(model);
@@ -534,7 +547,8 @@ namespace ZelWiki.Controllers
var instructions = PageRepository.GetPageProcessingInstructionsByPageId(page.EnsureNotNull().Id); var instructions = PageRepository.GetPageProcessingInstructionsByPageId(page.EnsureNotNull().Id);
if (SessionState.CanModerate == false && instructions.Contains(WikiInstruction.Protect)) if (SessionState.CanModerate == false && instructions.Contains(WikiInstruction.Protect))
{ {
return NotifyOfError("The page is protected and cannot be modified except by a moderator or an administrator unless the protection is removed."); return NotifyOfError(
"The page is protected and cannot be modified except by a moderator or an administrator unless the protection is removed.");
} }
SessionState.SetPageId(page.Id); SessionState.SetPageId(page.Id);
@@ -552,7 +566,8 @@ namespace ZelWiki.Controllers
{ {
var pageName = GetQueryValue("Name").DefaultWhenNullOrEmpty(pageNavigation); var pageName = GetQueryValue("Name").DefaultWhenNullOrEmpty(pageNavigation);
string templateName = ConfigurationRepository.Get<string>("Customization", "New Page Template").EnsureNotNull(); string templateName = ConfigurationRepository.Get<string>("Customization", "New Page Template")
.EnsureNotNull();
string templateNavigation = NamespaceNavigation.CleanAndValidate(templateName); string templateNavigation = NamespaceNavigation.CleanAndValidate(templateName);
var templatePage = PageRepository.GetPageRevisionByNavigation(templateNavigation); var templatePage = PageRepository.GetPageRevisionByNavigation(templateNavigation);
@@ -611,7 +626,8 @@ namespace ZelWiki.Controllers
var instructions = PageRepository.GetPageProcessingInstructionsByPageId(page.Id); var instructions = PageRepository.GetPageProcessingInstructionsByPageId(page.Id);
if (SessionState.CanModerate == false && instructions.Contains(WikiInstruction.Protect)) if (SessionState.CanModerate == false && instructions.Contains(WikiInstruction.Protect))
{ {
return NotifyOfError("The page is protected and cannot be modified except by a moderator or an administrator unless the protection is removed."); return NotifyOfError(
"The page is protected and cannot be modified except by a moderator or an administrator unless the protection is removed.");
} }
string originalNavigation = string.Empty; string originalNavigation = string.Empty;
@@ -626,7 +642,8 @@ namespace ZelWiki.Controllers
return View(model); return View(model);
} }
originalNavigation = page.Navigation; //So we can clear cache and this also indicates that we need to redirect to the new name. originalNavigation =
page.Navigation; //So we can clear cache and this also indicates that we need to redirect to the new name.
} }
page.ModifiedDate = DateTime.UtcNow; page.ModifiedDate = DateTime.UtcNow;
@@ -658,11 +675,11 @@ namespace ZelWiki.Controllers
#region File. #region File.
/// <summary> /// <summary>
/// Gets an image attached to a page. /// 获取图片
/// </summary> /// </summary>
/// <param name="givenPageNavigation">The navigation link of the page.</param> /// <param name="givenPageNavigation"></param>
/// <param name="givenFileNavigation">The navigation link of the file.</param> /// <param name="givenFileNavigation"></param>
/// <param name="pageRevision">The revision of the the PAGE that the file is attached to (NOT THE FILE REVISION)</param> /// <param name="pageRevision"></param>
/// <returns></returns> /// <returns></returns>
[HttpGet("Page/Image/{givenPageNavigation}/{givenFileNavigation}/{pageRevision:int?}")] [HttpGet("Page/Image/{givenPageNavigation}/{givenFileNavigation}/{pageRevision:int?}")]
public ActionResult Image(string givenPageNavigation, string givenFileNavigation, int? pageRevision = null) public ActionResult Image(string givenPageNavigation, string givenFileNavigation, int? pageRevision = null)
@@ -670,21 +687,22 @@ namespace ZelWiki.Controllers
var pageNavigation = new NamespaceNavigation(givenPageNavigation); var pageNavigation = new NamespaceNavigation(givenPageNavigation);
var fileNavigation = new NamespaceNavigation(givenFileNavigation); var fileNavigation = new NamespaceNavigation(givenFileNavigation);
string givenScale = GetQueryValue("Scale", "100"); var givenScale = GetQueryValue("Scale", "100");
var cacheKey = WikiCacheKeyFunction.Build(WikiCache.Category.Page, [givenPageNavigation, givenFileNavigation, pageRevision, givenScale]); var cacheKey = WikiCacheKeyFunction.Build(WikiCache.Category.Page,
[givenPageNavigation, givenFileNavigation, pageRevision, givenScale]);
if (WikiCache.TryGet<ImageCacheItem>(cacheKey, out var cached)) if (WikiCache.TryGet<ImageCacheItem>(cacheKey, out var cached))
{ {
return File(cached.Bytes, cached.ContentType); return File(cached.Bytes, cached.ContentType);
} }
var file = PageFileRepository.GetPageFileAttachmentByPageNavigationPageRevisionAndFileNavigation(pageNavigation.Canonical, fileNavigation.Canonical, pageRevision); var file = PageFileRepository.GetPageFileAttachmentByPageNavigationPageRevisionAndFileNavigation(
pageNavigation.Canonical, fileNavigation.Canonical, pageRevision);
if (file != null) if (file != null)
{ {
if (file.ContentType == "image/x-icon") if (file.ContentType == "image/x-icon")
{ {
//We do not handle the resizing of icon file. Maybe later....
return File(file.Data, file.ContentType); return File(file.Data, file.ContentType);
} }
@@ -695,19 +713,18 @@ namespace ZelWiki.Controllers
{ {
parsedScale = 500; parsedScale = 500;
} }
if (parsedScale != 100) if (parsedScale != 100)
{ {
int width = (int)(img.Width * (parsedScale / 100.0)); var width = (int)(img.Width * (parsedScale / 100.0));
int height = (int)(img.Height * (parsedScale / 100.0)); var height = (int)(img.Height * (parsedScale / 100.0));
//Adjusting by a ratio (and especially after applying additional scaling) may have caused one
// dimension to become very small (or even negative). So here we will check the height and width
// to ensure they are both at least n pixels and adjust both dimensions.
if (height < 16) if (height < 16)
{ {
height += 16 - height; height += 16 - height;
width += 16 - height; width += 16 - height;
} }
if (width < 16) if (width < 16)
{ {
height += 16 - width; height += 16 - width;
@@ -741,11 +758,11 @@ namespace ZelWiki.Controllers
} }
/// <summary> /// <summary>
/// Gets an image from the database, converts it to a PNG with optional scaling and returns it to the client. /// PNG
/// </summary> /// </summary>
/// <param name="givenPageNavigation">The navigation link of the page.</param> /// <param name="givenPageNavigation"></param>
/// <param name="givenFileNavigation">The navigation link of the file.</param> /// <param name="givenFileNavigation"></param>
/// <param name="pageRevision">The revision of the the PAGE that the file is attached to (NOT THE FILE REVISION)</param> /// <param name="pageRevision"></param>
/// <returns></returns> /// <returns></returns>
[AllowAnonymous] [AllowAnonymous]
[HttpGet("Page/Png/{givenPageNavigation}/{givenFileNavigation}/{pageRevision:int?}")] [HttpGet("Page/Png/{givenPageNavigation}/{givenFileNavigation}/{pageRevision:int?}")]
@@ -756,14 +773,15 @@ namespace ZelWiki.Controllers
var pageNavigation = new NamespaceNavigation(givenPageNavigation); var pageNavigation = new NamespaceNavigation(givenPageNavigation);
var fileNavigation = new NamespaceNavigation(givenFileNavigation); var fileNavigation = new NamespaceNavigation(givenFileNavigation);
string givenScale = GetQueryValue("Scale", "100"); var givenScale = GetQueryValue("Scale", "100");
var file = PageFileRepository.GetPageFileAttachmentByPageNavigationPageRevisionAndFileNavigation(pageNavigation.Canonical, fileNavigation.Canonical, pageRevision); var file = PageFileRepository.GetPageFileAttachmentByPageNavigationPageRevisionAndFileNavigation(
pageNavigation.Canonical, fileNavigation.Canonical, pageRevision);
if (file != null) if (file != null)
{ {
var img = SixLabors.ImageSharp.Image.Load(new MemoryStream(Utility.Decompress(file.Data))); var img = SixLabors.ImageSharp.Image.Load(new MemoryStream(Utility.Decompress(file.Data)));
int parsedScale = int.Parse(givenScale); var parsedScale = int.Parse(givenScale);
if (parsedScale > 500) if (parsedScale > 500)
{ {
parsedScale = 500; parsedScale = 500;
@@ -771,17 +789,15 @@ namespace ZelWiki.Controllers
if (parsedScale != 100) if (parsedScale != 100)
{ {
int width = (int)(img.Width * (parsedScale / 100.0)); var width = (int)(img.Width * (parsedScale / 100.0));
int height = (int)(img.Height * (parsedScale / 100.0)); var height = (int)(img.Height * (parsedScale / 100.0));
//Adjusting by a ratio (and especially after applying additional scaling) may have caused one
// dimension to become very small (or even negative). So here we will check the height and width
// to ensure they are both at least n pixels and adjust both dimensions.
if (height < 16) if (height < 16)
{ {
height += 16 - height; height += 16 - height;
width += 16 - height; width += 16 - height;
} }
if (width < 16) if (width < 16)
{ {
height += 16 - width; height += 16 - width;
@@ -807,11 +823,12 @@ namespace ZelWiki.Controllers
} }
/// <summary> /// <summary>
/// Gets a file from the database and returns it to the client. /// 二进制
/// <param name="givenPageNavigation">The navigation link of the page.</param>
/// <param name="givenFileNavigation">The navigation link of the file.</param>
/// <param name="pageRevision">The revision of the the PAGE that the file is attached to (NOT THE FILE REVISION)</param>
/// </summary> /// </summary>
/// <param name="givenPageNavigation"></param>
/// <param name="givenFileNavigation"></param>
/// <param name="pageRevision"></param>
/// <returns></returns>
[AllowAnonymous] [AllowAnonymous]
[HttpGet("Page/Binary/{givenPageNavigation}/{givenFileNavigation}/{pageRevision:int?}")] [HttpGet("Page/Binary/{givenPageNavigation}/{givenFileNavigation}/{pageRevision:int?}")]
public ActionResult Binary(string givenPageNavigation, string givenFileNavigation, int? pageRevision = null) public ActionResult Binary(string givenPageNavigation, string givenFileNavigation, int? pageRevision = null)
@@ -821,7 +838,8 @@ namespace ZelWiki.Controllers
var pageNavigation = new NamespaceNavigation(givenPageNavigation); var pageNavigation = new NamespaceNavigation(givenPageNavigation);
var fileNavigation = new NamespaceNavigation(givenFileNavigation); var fileNavigation = new NamespaceNavigation(givenFileNavigation);
var file = PageFileRepository.GetPageFileAttachmentByPageNavigationPageRevisionAndFileNavigation(pageNavigation.Canonical, fileNavigation.Canonical, pageRevision); var file = PageFileRepository.GetPageFileAttachmentByPageNavigationPageRevisionAndFileNavigation(
pageNavigation.Canonical, fileNavigation.Canonical, pageRevision);
if (file != null) if (file != null)
{ {
@@ -836,4 +854,4 @@ namespace ZelWiki.Controllers
#endregion #endregion
} }
} }

View File

@@ -6,11 +6,10 @@
} }
<h3> <h3>
Database 数据库
</h3> </h3>
<p> <p>
Various utilities to assist in management of the SQLite database.
</p> </p>
@if (!string.IsNullOrEmpty(Model.ErrorMessage)) @if (!string.IsNullOrEmpty(Model.ErrorMessage))
@@ -42,14 +41,14 @@
<td>@NTDLS.Helpers.Formatters.FileSize((long)info.DatabaseSize)</td> <td>@NTDLS.Helpers.Formatters.FileSize((long)info.DatabaseSize)</td>
<td> <td>
@Html.Raw(ZelWiki.Library.ConfirmActionHelper.GenerateSafeLink(GlobalConfiguration.BasePath, @Html.Raw(ZelWiki.Library.ConfirmActionHelper.GenerateSafeLink(GlobalConfiguration.BasePath,
"This will optimize the database indexes and structure. Continue?", "即将优化数据库索引和结构,继续?",
"Optimize", $"/Admin/Database/Optimize/{info.Name}", Context.Request.Path.Value)) "优化", $"/Admin/Database/Optimize/{info.Name}", Context.Request.Path.Value))
@Html.Raw(ZelWiki.Library.ConfirmActionHelper.GenerateSafeLink(GlobalConfiguration.BasePath, @Html.Raw(ZelWiki.Library.ConfirmActionHelper.GenerateSafeLink(GlobalConfiguration.BasePath,
"This will remove empty space from the database, which can free space if a lot of data has been deleted. Continue?", "即将从数据库中删除空白空间,如果删除了大量数据,则可以释放空间,继续吗?",
"Vacuum", $"/Admin/Database/Vacuum/{info.Name}", Context.Request.Path.Value)) "真空化", $"/Admin/Database/Vacuum/{info.Name}", Context.Request.Path.Value))
@Html.Raw(ZelWiki.Library.ConfirmActionHelper.GenerateSafeLink(GlobalConfiguration.BasePath, @Html.Raw(ZelWiki.Library.ConfirmActionHelper.GenerateSafeLink(GlobalConfiguration.BasePath,
"This will check the database integrity and validate all foreign keys. Continue?", "即将检查数据库的完整性并验证所有外键,继续吗?",
"Verify", $"/Admin/Database/Verify/{info.Name}", Context.Request.Path.Value)) "校验", $"/Admin/Database/Verify/{info.Name}", Context.Request.Path.Value))
</td> </td>
</tr> </tr>
} }

View File

@@ -7,15 +7,15 @@
<div class="card border-warning mb-3"> <div class="card border-warning mb-3">
<div class="card-header bg-warning"> <div class="card-header bg-warning">
<strong>Viewing a deleted page</strong> <strong>正在浏览一个已删除的页面</strong>
</div> </div>
<div class="card-body"> <div class="card-body">
<p class="card-text"> <p class="card-text">
You are viewing a page which was deleted on @Model.DeletedDate by @Model.DeletedByUserName.<br /> 您正在浏览的页面于 @Model.DeletedDate @Model.DeletedByUserName 删除<br />
@Html.Raw(ZelWiki.Library.ConfirmActionHelper.GenerateWarnLink(GlobalConfiguration.BasePath, @Html.Raw(ZelWiki.Library.ConfirmActionHelper.GenerateWarnLink(GlobalConfiguration.BasePath,
"This will restore the deleted page and all of its history. Continue?", "这将恢复已删除的页面及其所有修订历史,继续吗?",
"Restore This Page", "/Admin/RestoreDeletedPage/" + @Model.PageId, "/Admin/DeletedPages", Context.Request.Path.Value)) "恢复这个页面", "/Admin/RestoreDeletedPage/" + @Model.PageId, "/Admin/DeletedPages", Context.Request.Path.Value))
<br /> <br />
</p> </p>
</div> </div>

View File

@@ -7,15 +7,15 @@
<div class="card border-warning mb-3"> <div class="card border-warning mb-3">
<div class="card-header bg-warning"> <div class="card-header bg-warning">
<strong>Viewing a deleted page revision</strong> <strong>查看已删除的页面修订</strong>
</div> </div>
<div class="card-body"> <div class="card-body">
<p class="card-text"> <p class="card-text">
You are viewing a page revision which was deleted on @Model.DeletedDate by @Model.DeletedByUserName.<br /> 您正在查看于 @Model.DeletedDate @Model.DeletedByUserName 删除的页面修订<br />
@Html.Raw(ZelWiki.Library.ConfirmActionHelper.GenerateWarnLink(GlobalConfiguration.BasePath, @Html.Raw(ZelWiki.Library.ConfirmActionHelper.GenerateWarnLink(GlobalConfiguration.BasePath,
"This will restore the deleted page and all of its history. Continue?", "这将还原已删除的页面及其所有历史记录,继续?",
"Restore This Revision", $"/Admin/RestoreDeletedPageRevision/{Model.PageId}/{Model.Revision}", "/Admin/DeletedPageRevisions", Context.Request.Path.Value)) "恢复", $"/Admin/RestoreDeletedPageRevision/{Model.PageId}/{Model.Revision}", "/Admin/DeletedPageRevisions", Context.Request.Path.Value))
<br /> <br />
</p> </p>
</div> </div>

View File

@@ -7,11 +7,11 @@
} }
<h3> <h3>
Deleted Page Revisions 删除页面修订
</h3> </h3>
<p> <p>
Page revision that have been deleted for the given page. These can be purged or restored.<br /><br /> <br /><br />
</p> </p>
@if (!string.IsNullOrEmpty(Model.ErrorMessage)) @if (!string.IsNullOrEmpty(Model.ErrorMessage))
@@ -24,8 +24,8 @@
} }
@Html.Raw(ZelWiki.Library.ConfirmActionHelper.GenerateDangerLink(GlobalConfiguration.BasePath, @Html.Raw(ZelWiki.Library.ConfirmActionHelper.GenerateDangerLink(GlobalConfiguration.BasePath,
$"This will permanently purge all deleted pages revisions for \"{Model.Name}\". Continue?", $"这将永久清除 \"{Model.Name}\" 所有已删除的页面修订 继续吗?",
"Purge Deleted Revisions", $"/Admin/PurgeDeletedPageRevisions/{Model.PageId}", Context.Request.Path.Value)) "清除所有修订", $"/Admin/PurgeDeletedPageRevisions/{Model.PageId}", Context.Request.Path.Value))
<br /> <br />
<br /> <br />
@@ -36,9 +36,9 @@
<table class="table fixedTable100 table-striped" border="0" cellspacing="0" cellpadding="0"> <table class="table fixedTable100 table-striped" border="0" cellspacing="0" cellpadding="0">
<thead> <thead>
<tr> <tr>
<td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "Revision")">Revision</a></strong></td> <td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "Revision")">修订</a></strong></td>
<td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "DeletedDate")">Deleted Date</a></strong></td> <td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "DeletedDate")">删除时间</a></strong></td>
<td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "DeletedBy")">Deleted By</a></strong></td> <td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "DeletedBy")">删除人</a></strong></td>
<td><strong>Action</strong></td> <td><strong>Action</strong></td>
</tr> </tr>
</thead> </thead>
@@ -53,12 +53,12 @@
<td>@p.DeletedByUserName</td> <td>@p.DeletedByUserName</td>
<td> <td>
@Html.Raw(ZelWiki.Library.ConfirmActionHelper.GenerateSafeLink(GlobalConfiguration.BasePath, @Html.Raw(ZelWiki.Library.ConfirmActionHelper.GenerateSafeLink(GlobalConfiguration.BasePath,
"This will restore the deleted page and all of its history. Continue?", "这将恢复已删除的页面及其所有历史记录,继续?",
"Restore", $"/Admin/RestoreDeletedPageRevision/{p.Id}/{p.Revision}", Context.Request.Path.Value)) "恢复", $"/Admin/RestoreDeletedPageRevision/{p.Id}/{p.Revision}", Context.Request.Path.Value))
@Html.Raw(ZelWiki.Library.ConfirmActionHelper.GenerateDangerLink(GlobalConfiguration.BasePath, @Html.Raw(ZelWiki.Library.ConfirmActionHelper.GenerateDangerLink(GlobalConfiguration.BasePath,
"This will permanently delete the specified page, all revisions and attachments. Continue?", "这将永久删除指定的页面、所有修订和附件,继续?",
"Purge", $"/Admin/PurgeDeletedPageRevision/{p.Id}/{p.Revision}", Context.Request.Path.Value)) "删除", $"/Admin/PurgeDeletedPageRevision/{p.Id}/{p.Revision}", Context.Request.Path.Value))
</td> </td>
</tr> </tr>
} }

View File

@@ -7,11 +7,11 @@
} }
<h3> <h3>
Deleted Pages 被删除页面
</h3> </h3>
<p> <p>
Pages that have been deleted. Can be purged or restored.<br /><br /> <br /><br />
</p> </p>
@if (!string.IsNullOrEmpty(Model.ErrorMessage)) @if (!string.IsNullOrEmpty(Model.ErrorMessage))
@@ -24,8 +24,8 @@
} }
@Html.Raw(ZelWiki.Library.ConfirmActionHelper.GenerateDangerLink(GlobalConfiguration.BasePath, @Html.Raw(ZelWiki.Library.ConfirmActionHelper.GenerateDangerLink(GlobalConfiguration.BasePath,
"This will permanently purge all deleted pages. Continue?", "这将永久清除所有已删除的页面,确定吗?",
"Purge Deleted Pages", "/Admin/PurgeDeletedPages", Context.Request.Path.Value)) "清除已删除的页面", "/Admin/PurgeDeletedPages", Context.Request.Path.Value))
<br /> <br />
<br /> <br />
@@ -46,8 +46,8 @@
<table class="table fixedTable100 table-striped" border="0" cellspacing="0" cellpadding="0"> <table class="table fixedTable100 table-striped" border="0" cellspacing="0" cellpadding="0">
<thead> <thead>
<tr> <tr>
<td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "Page")">Page</a></strong></td> <td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "Page")">页面</a></strong></td>
<td><strong>Action</strong></td> <td><strong>操作</strong></td>
</tr> </tr>
</thead> </thead>
@foreach (var p in Model.Pages) @foreach (var p in Model.Pages)
@@ -61,11 +61,11 @@
</td> </td>
<td> <td>
@Html.Raw(ZelWiki.Library.ConfirmActionHelper.GenerateSafeLink(GlobalConfiguration.BasePath, @Html.Raw(ZelWiki.Library.ConfirmActionHelper.GenerateSafeLink(GlobalConfiguration.BasePath,
"This will restore the deleted page and all of its history. Continue?", "这将恢复已删除的页面及其所有历史记录,继续吗?",
"Restore", "/Admin/RestoreDeletedPage/" + @p.Id, Context.Request.Path.Value)) "恢复", "/Admin/RestoreDeletedPage/" + @p.Id, Context.Request.Path.Value))
@Html.Raw(ZelWiki.Library.ConfirmActionHelper.GenerateDangerLink(GlobalConfiguration.BasePath, @Html.Raw(ZelWiki.Library.ConfirmActionHelper.GenerateDangerLink(GlobalConfiguration.BasePath,
"This will permanently delete the specified page, all revisions and attachments. Continue?", "这将永久删除指定的页面、所有修订和附件,继续吗?",
"Purge", "/Admin/PurgeDeletedPage/" + @p.Id, Context.Request.Path.Value)) "清除", "/Admin/PurgeDeletedPage/" + @p.Id, Context.Request.Path.Value))
</td> </td>
</tr> </tr>
} }
@@ -77,7 +77,7 @@
{ {
<div class="d-flex small text-muted mb-0"> <div class="d-flex small text-muted mb-0">
<strong> <strong>
Either the deleted pages queue is empty or your search criteria returned no results. 暂无数据.
</strong> </strong>
</div> </div>
} }

View File

@@ -7,11 +7,11 @@
} }
<h3> <h3>
Namespace 命名空间
</h3> </h3>
<p> <p>
All pages contained in the namespace.<br /><br /> <br /><br />
</p> </p>
@if (!string.IsNullOrEmpty(Model.ErrorMessage)) @if (!string.IsNullOrEmpty(Model.ErrorMessage))
@@ -28,10 +28,10 @@
<table class="table fixedTable100 table-striped" border="0" cellspacing="0" cellpadding="0"> <table class="table fixedTable100 table-striped" border="0" cellspacing="0" cellpadding="0">
<thead> <thead>
<tr> <tr>
<td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "Name")">Name</a></strong></td> <td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "Name")">名称</a></strong></td>
<td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "Revision")">Revision</a></strong></td> <td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "Revision")">修订</a></strong></td>
<td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "ModifiedBy")">Modified By</a></strong></td> <td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "ModifiedBy")">上次一修改人</a></strong></td>
<td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "ModifiedDate")">Modified Date</a></strong></td> <td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "ModifiedDate")">上一次修改时间</a></strong></td>
</tr> </tr>
</thead> </thead>

View File

@@ -7,11 +7,11 @@
} }
<h3> <h3>
Namespaces 命名空间
</h3> </h3>
<p> <p>
All namespaces contained in the wiki.<br /><br /> <br/><br/>
</p> </p>
@if (!string.IsNullOrEmpty(Model.ErrorMessage)) @if (!string.IsNullOrEmpty(Model.ErrorMessage))
@@ -29,16 +29,19 @@
{ {
<table class="table fixedTable100 table-striped" border="0" cellspacing="0" cellpadding="0"> <table class="table fixedTable100 table-striped" border="0" cellspacing="0" cellpadding="0">
<thead> <thead>
<tr> <tr>
<td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "Name")">Name</a></strong></td> <td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "Name")">命名</a></strong></td>
<td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "Pages")">Pages</a></strong></td> <td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "Pages")">包含页数</a></strong>
</tr> </td>
</tr>
</thead> </thead>
@foreach (var p in Model.Namespaces) @foreach (var p in Model.Namespaces)
{ {
<tr> <tr>
<td><a href="@GlobalConfiguration.BasePath/Admin/Namespace/@(p.Namespace?? string.Empty)">@(string.IsNullOrEmpty(p.Namespace) ? "(Default)" : p.Namespace)</a></td> <td>
<a href="@GlobalConfiguration.BasePath/Admin/Namespace/@(p.Namespace ?? string.Empty)">@(string.IsNullOrEmpty(p.Namespace) ? "(Default)" : p.Namespace)</a>
</td>
<td>@p.CountOfPages.ToString("N0")</td> <td>@p.CountOfPages.ToString("N0")</td>
</tr> </tr>
} }
@@ -50,7 +53,7 @@
{ {
<div class="d-flex small text-muted mb-0"> <div class="d-flex small text-muted mb-0">
<strong> <strong>
There are currently no pages which exist within namespaces. 暂无数据
</strong> </strong>
</div> </div>
} }

View File

@@ -7,11 +7,11 @@
} }
<h3> <h3>
Orphaned Page Attachments 孤立页附件
</h3> </h3>
<p> <p>
These are all of the page attachments that are no longer attached to any page revision.<br /><br /> 这些是不再附加到任何页面修订的所有页面附件<br /><br />
</p> </p>
@if (!string.IsNullOrEmpty(Model.ErrorMessage)) @if (!string.IsNullOrEmpty(Model.ErrorMessage))
@@ -24,8 +24,8 @@
} }
@Html.Raw(ZelWiki.Library.ConfirmActionHelper.GenerateDangerLink(GlobalConfiguration.BasePath, @Html.Raw(ZelWiki.Library.ConfirmActionHelper.GenerateDangerLink(GlobalConfiguration.BasePath,
"This will permanently purge all orphaned page attachments. Continue?", "这将永久清除所有孤立的页面附件,继续吗?",
"Purge Orphaned Attachments", "/Admin/PurgeOrphanedAttachments", Context.Request.Path.Value)) "清除所有孤立附件", "/Admin/PurgeOrphanedAttachments", Context.Request.Path.Value))
<br /> <br />
<br /> <br />
@@ -35,10 +35,10 @@
{ {
<table class="table fixedTable100 table-striped" border="0" cellspacing="0" cellpadding="0"> <table class="table fixedTable100 table-striped" border="0" cellspacing="0" cellpadding="0">
<tr> <tr>
<td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "Page")">Page</a></strong></td> <td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "Page")">页面</a></strong></td>
<td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "File")">File</a></strong></td> <td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "File")">文件</a></strong></td>
<td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "Size")">Size</a></strong></td> <td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "Size")">大小</a></strong></td>
<td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "Revision")">Revision</a></strong></td> <td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "Revision")">修订</a></strong></td>
<td><strong>Action</strong></td> <td><strong>Action</strong></td>
</tr> </tr>
@@ -56,8 +56,8 @@
<td>@p.FileRevision</td> <td>@p.FileRevision</td>
<td> <td>
@Html.Raw(ZelWiki.Library.ConfirmActionHelper.GenerateDangerLink(GlobalConfiguration.BasePath, @Html.Raw(ZelWiki.Library.ConfirmActionHelper.GenerateDangerLink(GlobalConfiguration.BasePath,
"This will permanently delete the specified attachment. Continue?", "这将永久清除这个附件,继续吗?",
"Delete", $"/Admin/PurgeOrphanedAttachment/{@p.PageFileId}/{@p.FileRevision}", Context.Request.Path.Value)) "删除", $"/Admin/PurgeOrphanedAttachment/{@p.PageFileId}/{@p.FileRevision}", Context.Request.Path.Value))
</td> </td>
</tr> </tr>
} }

View File

@@ -7,11 +7,11 @@
} }
<h3> <h3>
Page revisions for <a href="@GlobalConfiguration.BasePath/@sessionState.PageNavigation">@sessionState.Page.Name</a>. 关于页面 <a href="@GlobalConfiguration.BasePath/@sessionState.PageNavigation">@sessionState.Page.Name</a> 的修订
</h3> </h3>
<p> <p>
All changes that have been made to the page.<br /><br /> <br /><br />
</p> </p>
@if (!string.IsNullOrEmpty(Model.ErrorMessage)) @if (!string.IsNullOrEmpty(Model.ErrorMessage))
@@ -30,11 +30,11 @@
<table class="table fixedTable100 table-striped" border="0" cellspacing="0" cellpadding="0"> <table class="table fixedTable100 table-striped" border="0" cellspacing="0" cellpadding="0">
<thead> <thead>
<tr> <tr>
<td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "Revision")">Revision</a></strong></td> <td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "Revision")">修订好</a></strong></td>
<td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "ModifiedBy")">Modified By</a></strong></td> <td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "ModifiedBy")">修改人</a></strong></td>
<td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "ModifiedDate")">Modified Date</a></strong></td> <td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "ModifiedDate")">修改日期</a></strong></td>
<td><strong>Summary</strong></td> <td><strong>摘要</strong></td>
<td><strong>Action</strong></td> <td><strong>操作</strong></td>
</tr> </tr>
</thead> </thead>
@@ -48,14 +48,14 @@
<td>@Html.DisplayTextFor(x => h.ChangeSummary)</td> <td>@Html.DisplayTextFor(x => h.ChangeSummary)</td>
<td> <td>
@Html.Raw(ZelWiki.Library.ConfirmActionHelper.GenerateWarnLink(GlobalConfiguration.BasePath, @Html.Raw(ZelWiki.Library.ConfirmActionHelper.GenerateWarnLink(GlobalConfiguration.BasePath,
$"Reverting {h.Name} from revision {h.HighestRevision} to {h.Revision} will rollback {h.HigherRevisionCount} changes.<br />" $"将{h.Name} 从 {h.HighestRevision} 回滚至 {h.Revision} 将会 {h.HigherRevisionCount} 个更改<br />"
+ "Reverting does not mean that changes will be lost however, the revert process will create a new revision with the reverted changes.<br /><br />" + "还原并不意味着更改将丢失,但是还原过程将使用还原的更改创建新的修订.<br /><br />"
+ "Are you sure you want to continue?<br /><br />", + "继续吗?",
"Revert", $"/Admin/RevertPageRevision/{h.Navigation}/{h.Revision}", Context.Request.Path.Value)) "回滚", $"/Admin/RevertPageRevision/{h.Navigation}/{h.Revision}", Context.Request.Path.Value))
@Html.Raw(ZelWiki.Library.ConfirmActionHelper.GenerateDangerLink(GlobalConfiguration.BasePath, @Html.Raw(ZelWiki.Library.ConfirmActionHelper.GenerateDangerLink(GlobalConfiguration.BasePath,
$"Deleting revision {h.Revision} of \"{h.Name}\" will move the page revision to the deletion queue. This action can only be undone by an administrator or moderator. Continue?", $" {h.Revision} \"{h.Name}\" 的修订记录中删除,继续吗?",
"Delete", $"/Admin/DeletePageRevision/{h.Navigation}/{h.Revision}", Context.Request.Path.Value)) "删除", $"/Admin/DeletePageRevision/{h.Navigation}/{h.Revision}", Context.Request.Path.Value))
</td> </td>
</tr> </tr>
} }

View File

@@ -6,11 +6,11 @@
} }
<h3> <h3>
Page File Revisions 页面附件修订
</h3> </h3>
<p> <p>
All changes that have been made to the attached file. <br /><br /> <br /><br />
</p> </p>
@if (!string.IsNullOrEmpty(Model.ErrorMessage)) @if (!string.IsNullOrEmpty(Model.ErrorMessage))
@@ -27,10 +27,10 @@
<table class="table fixedTable100 table-striped" border="0" cellspacing="0" cellpadding="0"> <table class="table fixedTable100 table-striped" border="0" cellspacing="0" cellpadding="0">
<thead> <thead>
<tr> <tr>
<td><strong>Revision</strong></td> <td><strong>修订</strong></td>
<td><strong>Modified By</strong></td> <td><strong>修订人</strong></td>
<td><strong>Modified Date</strong></td> <td><strong>修订时间</strong></td>
<td><strong>Summary</strong></td> <td><strong>摘要</strong></td>
</tr> </tr>
</thead> </thead>

View File

@@ -30,9 +30,9 @@
<div class="container"> <div class="container">
<div class="d-flex justify-content-end mb-4"> <div class="d-flex justify-content-end mb-4">
<div class="flex-grow-1 me-2"> <div class="flex-grow-1 me-2">
<input type="text" name="Comment" id="Comment" class="form-control" placeholder="输入关键字" /> <input type="text" name="Comment" id="Comment" class="form-control" placeholder="发表一下你的看法吧" />
</div> </div>
<button type="submit" value="Find" class="btn btn-primary">搜一搜</button> <button type="submit" value="Find" class="btn btn-primary">发送</button>
</div> </div>
</div> </div>
} }
@@ -63,7 +63,7 @@
</div> </div>
@if (sessionState.CanModerate == true || h.UserId == sessionState.Profile?.UserId) @if (sessionState.CanModerate == true || h.UserId == sessionState.Profile?.UserId)
{ {
<a href="?Delete=@h.Id" class="small text-danger text-decoration-none" onclick="return confirm('真的要删除吗?')">Delete</a> <a href="?Delete=@h.Id" class="small text-danger text-decoration-none" onclick="return confirm('真的要删除吗?')">删除</a>
} }
</div> </div>
</div> </div>

View File

@@ -31,7 +31,7 @@
<br /> <br />
if (ZelWiki.Models.GlobalConfiguration.EnablePublicProfiles) if (ZelWiki.Models.GlobalConfiguration.EnablePublicProfiles)
{ {
<small><cite title="Modified By">Last modified by <a href="@GlobalConfiguration.BasePath/Profile/@Model.ModifiedByUserName/Public">@Model.ModifiedByUserName</a> @@ @Model.ModifiedDate</cite></small> <small><cite title="Modified By"> <a href="@GlobalConfiguration.BasePath/Profile/@Model.ModifiedByUserName/Public">@Model.ModifiedByUserName</a> @@修改于 @Model.ModifiedDate</cite></small>
} }
else else
{ {
@@ -55,9 +55,9 @@
<div class="container"> <div class="container">
<div class="d-flex justify-content-end mb-4"> <div class="d-flex justify-content-end mb-4">
<div class="flex-grow-1 me-2"> <div class="flex-grow-1 me-2">
<input type="text" name="Comment" id="Comment" class="form-control" placeholder="输入一条评论" /> <input type="text" name="Comment" id="Comment" class="form-control" placeholder="发表一下你的看法吧" />
</div> </div>
<button type="submit" value="Post" class="btn btn-primary">Post</button> <button type="submit" value="Post" class="btn btn-primary">发送</button>
</div> </div>
</div> </div>
</form> </form>
@@ -83,7 +83,7 @@
</div> </div>
@if (sessionState.CanModerate == true || h.UserId == sessionState.Profile?.UserId) @if (sessionState.CanModerate == true || h.UserId == sessionState.Profile?.UserId)
{ {
<a href="@GlobalConfiguration.BasePath/@sessionState.PageNavigation/Comments?Delete=@h.Id" class="small text-danger text-decoration-none" onclick="return confirm('确定要删除此评论吗?')">Delete</a> <a href="@GlobalConfiguration.BasePath/@sessionState.PageNavigation/Comments?Delete=@h.Id" class="small text-danger text-decoration-none" onclick="return confirm('确定要删除此评论吗?')">删除</a>
} }
</div> </div>
</div> </div>
@@ -92,6 +92,6 @@
} }
@if (ZelWiki.Models.GlobalConfiguration.EnablePageComments && ZelWiki.Models.GlobalConfiguration.ShowCommentsOnPageFooter) @if (ZelWiki.Models.GlobalConfiguration.EnablePageComments && ZelWiki.Models.GlobalConfiguration.ShowCommentsOnPageFooter)
{ {
<a href="@GlobalConfiguration.BasePath/@sessionState.PageNavigation/Comments">View all comments</a> <a href="@GlobalConfiguration.BasePath/@sessionState.PageNavigation/Comments">查看所有评论</a>
} }
} }

Binary file not shown.

Binary file not shown.