添加项目文件。

This commit is contained in:
Zel
2025-01-22 23:31:03 +08:00
parent 1b8ba6771f
commit 2ae76476fb
894 changed files with 774558 additions and 0 deletions

View File

@@ -0,0 +1,81 @@
using System.ComponentModel.DataAnnotations;
using TightWiki.Models.DataModels;
namespace TightWiki.Models.ViewModels.Admin
{
public partial class AccountProfileAccountViewModel
{
[Display(Name = "Theme")]
public string? Theme { get; set; } = string.Empty;
public Guid UserId { get; set; }
[Display(Name = "Email Address")]
[Required(ErrorMessage = "Email address is required")]
public string EmailAddress { get; set; } = string.Empty;
[Display(Name = "Account Name")]
[Required(ErrorMessage = "Account name is required")]
public string AccountName { get; set; } = string.Empty;
public string? Navigation { get; set; } = string.Empty;
[Display(Name = "First Name")]
public string? FirstName { get; set; }
[Display(Name = "Last Name")]
public string? LastName { get; set; } = string.Empty;
[Display(Name = "Time-Zone")]
[Required(ErrorMessage = "TimeZone is required")]
public string TimeZone { get; set; } = string.Empty;
[Display(Name = "Country")]
[Required(ErrorMessage = "Country is required")]
public string Country { get; set; } = string.Empty;
[Display(Name = "Language")]
[Required(ErrorMessage = "Language is required")]
public string Language { get; set; } = string.Empty;
[Display(Name = "Biography")]
public string? Biography { get; set; } = string.Empty;
[Display(Name = "Email Confirmed?")]
public bool EmailConfirmed { get; set; }
public byte[]? Avatar { get; set; }
public DateTime CreatedDate { get; set; }
public DateTime ModifiedDate { get; set; }
public int PaginationPageSize { get; set; }
public int PaginationPageCount { get; set; }
public string Role { get; set; } = string.Empty;
public static AccountProfileAccountViewModel FromDataModel(AccountProfile model)
{
return new AccountProfileAccountViewModel
{
Theme = model.Theme,
UserId = model.UserId,
EmailAddress = model.EmailAddress,
AccountName = model.AccountName,
Avatar = model.Avatar,
Biography = model.Biography,
Country = model.Country,
Language = model.Language,
CreatedDate = model.CreatedDate,
EmailConfirmed = model.EmailConfirmed,
FirstName = model.FirstName,
LastName = model.LastName,
ModifiedDate = model.ModifiedDate,
Navigation = model.Navigation,
PaginationPageCount = model.PaginationPageCount,
Role = model.Role,
PaginationPageSize = model.PaginationPageSize,
TimeZone = model.TimeZone
};
}
}
}

View File

@@ -0,0 +1,17 @@
using TightWiki.Library;
using TightWiki.Models.DataModels;
using TightWiki.Models.ViewModels.Shared;
namespace TightWiki.Models.ViewModels.Admin
{
public class AccountProfileViewModel : ViewModelBase
{
public List<Theme> Themes { get; set; } = new();
public List<TimeZoneItem> TimeZones { get; set; } = new();
public List<CountryItem> Countries { get; set; } = new();
public List<LanguageItem> Languages { get; set; } = new();
public List<Role> Roles { get; set; } = new();
public AccountProfileAccountViewModel AccountProfile { get; set; } = new();
public CredentialViewModel Credential { get; set; } = new();
}
}

View File

@@ -0,0 +1,11 @@
using TightWiki.Models.DataModels;
namespace TightWiki.Models.ViewModels.Admin
{
public class AccountsViewModel : ViewModelBase
{
public List<AccountProfile> Users { get; set; } = new();
public string SearchString { get; set; } = string.Empty;
public int PaginationPageCount { get; set; }
}
}

View File

@@ -0,0 +1,10 @@
namespace TightWiki.Models.ViewModels.Admin
{
public class AddEmojiViewModel : ViewModelBase
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public string? OriginalName { get; set; }
public string Categories { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,15 @@
using TightWiki.Library;
using TightWiki.Models.DataModels;
namespace TightWiki.Models.ViewModels.Admin
{
public class ConfigurationViewModel : ViewModelBase
{
public List<Theme> Themes { get; set; } = new();
public List<Role> Roles { get; set; } = new();
public List<TimeZoneItem> TimeZones { get; set; } = new();
public List<CountryItem> Countries { get; set; } = new();
public List<LanguageItem> Languages { get; set; } = new();
public List<ConfigurationNest> Nest { get; set; } = new();
}
}

View File

@@ -0,0 +1,9 @@
using TightWiki.Models.DataModels;
namespace TightWiki.Models.ViewModels.Admin
{
public class DatabaseViewModel : ViewModelBase
{
public List<DatabaseInfo> Info { get; set; } = new();
}
}

View File

@@ -0,0 +1,11 @@
namespace TightWiki.Models.ViewModels.Page
{
public class DeletedPageRevisionViewModel : ViewModelBase
{
public int PageId { get; set; }
public int Revision { get; set; }
public string Body { get; set; } = string.Empty;
public string DeletedByUserName { get; set; } = string.Empty;
public DateTime DeletedDate { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
using TightWiki.Models.DataModels;
namespace TightWiki.Models.ViewModels.Page
{
public class DeletedPageViewModel : ViewModelBase
{
public int PageId { get; set; }
public string Body { get; set; } = string.Empty;
public string DeletedByUserName { get; set; } = string.Empty;
public DateTime DeletedDate { get; set; }
public List<PageComment> Comments { get; set; } = new();
}
}

View File

@@ -0,0 +1,14 @@
using TightWiki.Models.DataModels;
namespace TightWiki.Models.ViewModels.Admin
{
public class DeletedPagesRevisionsViewModel : ViewModelBase
{
public int PageId { get; set; }
public string Name { get; set; } = string.Empty;
public string Namespace { get; set; } = string.Empty;
public string Navigation { get; set; } = string.Empty;
public List<DeletedPageRevision> Revisions { get; set; } = new();
public int PaginationPageCount { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
namespace TightWiki.Models.ViewModels.Admin
{
public class DeletedPagesViewModel : ViewModelBase
{
public List<DataModels.Page> Pages { get; set; } = new();
public string SearchString { get; set; } = string.Empty;
public int PaginationPageCount { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
using TightWiki.Models.DataModels;
namespace TightWiki.Models.ViewModels.Admin
{
public class EmojiViewModel : ViewModelBase
{
public Emoji Emoji { get; set; } = new();
public string OriginalName { get; set; } = string.Empty;
public string Categories { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,11 @@
using TightWiki.Models.DataModels;
namespace TightWiki.Models.ViewModels.Admin
{
public class EmojisViewModel : ViewModelBase
{
public List<Emoji> Emojis { get; set; } = new();
public string SearchString { get; set; } = string.Empty;
public int PaginationPageCount { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
using TightWiki.Models.DataModels;
namespace TightWiki.Models.ViewModels.Admin
{
public class ExceptionViewModel : ViewModelBase
{
public WikiException Exception { get; set; } = new();
}
}

View File

@@ -0,0 +1,10 @@
using TightWiki.Models.DataModels;
namespace TightWiki.Models.ViewModels.Admin
{
public class ExceptionsViewModel : ViewModelBase
{
public List<WikiException> Exceptions { get; set; } = new();
public int PaginationPageCount { get; set; }
}
}

View File

@@ -0,0 +1,23 @@
using TightWiki.Models.DataModels;
namespace TightWiki.Models.ViewModels.Admin
{
public class MenuItemViewModel : ViewModelBase
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Link { get; set; } = string.Empty;
public int Ordinal { get; set; }
public MenuItem ToDataModel()
{
return new MenuItem
{
Name = Name,
Id = Id,
Link = Link,
Ordinal = Ordinal
};
}
}
}

View File

@@ -0,0 +1,9 @@
using TightWiki.Models.DataModels;
namespace TightWiki.Models.ViewModels.Admin
{
public class MenuItemsViewModel : ViewModelBase
{
public List<MenuItem> Items { get; set; } = new();
}
}

View File

@@ -0,0 +1,10 @@
using TightWiki.Models.DataModels;
namespace TightWiki.Models.ViewModels.Admin
{
public class MetricsViewModel : ViewModelBase
{
public WikiDatabaseStatistics Metrics { get; set; } = new();
public string ApplicationVersion { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,10 @@
using TightWiki.Models.DataModels;
namespace TightWiki.Models.ViewModels.Admin
{
public class MissingPagesViewModel : ViewModelBase
{
public List<NonexistentPage> Pages { get; set; } = new();
public int PaginationPageCount { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
namespace TightWiki.Models.ViewModels.Admin
{
public class NamespaceViewModel : ViewModelBase
{
public List<DataModels.Page> Pages { get; set; } = new();
public string Namespace { get; set; } = string.Empty;
public int PaginationPageCount { get; set; }
}
}

View File

@@ -0,0 +1,10 @@
using TightWiki.Models.DataModels;
namespace TightWiki.Models.ViewModels.Admin
{
public class NamespacesViewModel : ViewModelBase
{
public List<NamespaceStat> Namespaces { get; set; } = new();
public int PaginationPageCount { get; set; }
}
}

View File

@@ -0,0 +1,8 @@
namespace TightWiki.Models.ViewModels.Admin
{
public class OrphanedPageAttachmentsViewModel : ViewModelBase
{
public List<DataModels.OrphanedPageAttachment> Files { get; set; } = new();
public int PaginationPageCount { get; set; }
}
}

View File

@@ -0,0 +1,10 @@
using TightWiki.Models.DataModels;
namespace TightWiki.Models.ViewModels.Admin
{
public class PageCompilationStatisticsViewModel : ViewModelBase
{
public List<PageCompilationStatistics> Statistics { get; set; } = new();
public int PaginationPageCount { get; set; }
}
}

View File

@@ -0,0 +1,10 @@
namespace TightWiki.Models.ViewModels.Admin
{
public class PageModerateViewModel : ViewModelBase
{
public List<string> Instructions { get; set; } = new();
public List<DataModels.Page> Pages { get; set; } = new();
public string Instruction { get; set; } = string.Empty;
public int PaginationPageCount { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
using TightWiki.Models.DataModels;
namespace TightWiki.Models.ViewModels.Admin
{
public class PageRevisionsViewModel : ViewModelBase
{
public List<PageRevision> Revisions { get; set; } = new();
public int PaginationPageCount { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
namespace TightWiki.Models.ViewModels.Admin
{
public class PagesViewModel : ViewModelBase
{
public List<DataModels.Page> Pages { get; set; } = new();
public string SearchString { get; set; } = string.Empty;
public int PaginationPageCount { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
using TightWiki.Models.DataModels;
namespace TightWiki.Models.ViewModels.Admin
{
public class RoleViewModel : ViewModelBase
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public List<AccountProfile> Users { get; set; } = new();
public int PaginationPageCount { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
using TightWiki.Models.DataModels;
namespace TightWiki.Models.ViewModels.Admin
{
public class RolesViewModel : ViewModelBase
{
public List<Role> Roles { get; set; } = new();
}
}

View File

@@ -0,0 +1,6 @@
namespace TightWiki.Models.ViewModels
{
public class ExternalLoginCallbackViewModel : ViewModelBase
{
}
}

View File

@@ -0,0 +1,12 @@
using TightWiki.Models.DataModels;
namespace TightWiki.Models.ViewModels.File
{
public class FileAttachmentViewModel : ViewModelBase
{
public string PageNavigation { get; set; } = string.Empty;
public int PageRevision { get; set; } = 0;
public List<PageFileAttachmentInfo> Files { get; set; } = new();
}
}

View File

@@ -0,0 +1,12 @@
using TightWiki.Models.DataModels;
namespace TightWiki.Models.ViewModels.File
{
public class PageFileRevisionsViewModel : ViewModelBase
{
public string PageNavigation { get; set; } = string.Empty;
public string FileNavigation { get; set; } = string.Empty;
public List<PageFileAttachmentInfo> Revisions { get; set; } = new();
public int PaginationPageCount { get; set; }
}
}

View File

@@ -0,0 +1,8 @@
namespace TightWiki.Models.ViewModels.Page
{
public class BrowseViewModel : ViewModelBase
{
public string? AssociatedPages { get; set; }
public string? TagCloud { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
using TightWiki.Models.DataModels;
namespace TightWiki.Models.ViewModels.Page
{
public class PageCommentsViewModel : ViewModelBase
{
public List<PageComment> Comments { get; set; } = new();
public string Comment { get; set; } = string.Empty;
public int PaginationPageCount { get; set; }
}
}

View File

@@ -0,0 +1,10 @@
namespace TightWiki.Models.ViewModels.Page
{
public class PageDeleteViewModel : ViewModelBase
{
public int CountOfAttachments { get; set; }
public int MostCurrentRevision { get; set; }
public string? PageName { get; set; }
public int PageRevision { get; set; }
}
}

View File

@@ -0,0 +1,20 @@
using TightWiki.Models.DataModels;
namespace TightWiki.Models.ViewModels.Page
{
public class PageDisplayViewModel : ViewModelBase
{
public string Body { get; set; } = string.Empty;
public string ModifiedByUserName { get; set; } = string.Empty;
public DateTime ModifiedDate { get; set; }
public List<PageComment> Comments { get; set; } = new();
public bool HideFooterComments { get; set; }
public bool HideFooterLastModified { get; set; }
public string Name { get; set; } = string.Empty;
public string Navigation { get; set; } = string.Empty;
public string Namespace { get; set; } = string.Empty;
public int Revision { get; set; }
public int MostCurrentRevision { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
using System.ComponentModel.DataAnnotations;
namespace TightWiki.Models.ViewModels.Page
{
public class PageEditViewModel : ViewModelBase
{
public int Id { get; set; }
[Required]
public string Name { get; set; } = string.Empty;
public string Navigation { get; set; } = string.Empty;
public string? Description { get; set; } = string.Empty;
public string? Body { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,15 @@
namespace TightWiki.Models.ViewModels.Page
{
public class PageRevertViewModel : ViewModelBase
{
public string? PageName { get; set; }
/// <summary>
/// The highest revision for the page.
/// </summary>
public int HighestRevision { get; set; }
/// <summary>
/// The number of revisions that are higher than the current page revision.
/// </summary>
public int HigherRevisionCount { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
using TightWiki.Models.DataModels;
namespace TightWiki.Models.ViewModels.Page
{
public class RevisionsViewModel : ViewModelBase
{
public List<PageRevision> Revisions { get; set; } = new();
public int PaginationPageCount { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
namespace TightWiki.Models.ViewModels.Page
{
public class PageSearchViewModel : ViewModelBase
{
public List<DataModels.Page> Pages { get; set; } = new();
public string SearchString { get; set; } = string.Empty;
public int PaginationPageCount { get; set; }
}
}

View File

@@ -0,0 +1,82 @@
using System.ComponentModel.DataAnnotations;
using TightWiki.Models.DataModels;
namespace TightWiki.Models.ViewModels.Profile
{
public partial class AccountProfileAccountViewModel
{
[Display(Name = "Theme")]
public string? Theme { get; set; } = string.Empty;
[Required(ErrorMessage = "UserId is required")]
public Guid UserId { get; set; }
[Display(Name = "Email Address")]
public string EmailAddress { get; set; } = string.Empty;
[Display(Name = "Account Name")]
[Required(ErrorMessage = "Account Name is required")]
public string AccountName { get; set; } = string.Empty;
public string Navigation { get; set; } = string.Empty;
[Display(Name = "First Name")]
public string? FirstName { get; set; }
[Display(Name = "Last Name")]
public string? LastName { get; set; } = string.Empty;
[Display(Name = "Time-Zone")]
[Required(ErrorMessage = "TimeZone is required")]
public string TimeZone { get; set; } = string.Empty;
[Display(Name = "Country")]
[Required(ErrorMessage = "Country is required")]
public string Country { get; set; } = string.Empty;
[Display(Name = "Language")]
[Required(ErrorMessage = "Language is required")]
public string Language { get; set; } = string.Empty;
[Display(Name = "Biography")]
public string? Biography { get; set; } = string.Empty;
[Display(Name = "Email Confirmed?")]
public bool EmailConfirmed { get; set; }
public byte[]? Avatar { get; set; }
public DateTime CreatedDate { get; set; }
public DateTime ModifiedDate { get; set; }
public int PaginationPageSize { get; set; }
public int PaginationPageCount { get; set; }
public string? Role { get; set; } = string.Empty;
public static AccountProfileAccountViewModel FromDataModel(AccountProfile model)
{
return new AccountProfileAccountViewModel
{
Theme = model.Theme,
UserId = model.UserId,
EmailAddress = model.EmailAddress,
AccountName = model.AccountName,
Avatar = model.Avatar,
Biography = model.Biography,
Country = model.Country,
Language = model.Language,
CreatedDate = model.CreatedDate,
EmailConfirmed = model.EmailConfirmed,
FirstName = model.FirstName,
LastName = model.LastName,
ModifiedDate = model.ModifiedDate,
Navigation = model.Navigation,
PaginationPageCount = model.PaginationPageCount,
Role = model.Role,
PaginationPageSize = model.PaginationPageSize,
TimeZone = model.TimeZone
};
}
}
}

View File

@@ -0,0 +1,13 @@
using TightWiki.Library;
namespace TightWiki.Models.ViewModels.Profile
{
public class AccountProfileViewModel : ViewModelBase
{
public List<Theme> Themes { get; set; } = new();
public List<TimeZoneItem> TimeZones { get; set; } = new();
public List<CountryItem> Countries { get; set; } = new();
public List<LanguageItem> Languages { get; set; } = new();
public AccountProfileAccountViewModel AccountProfile { get; set; } = new();
}
}

View File

@@ -0,0 +1,14 @@
using TightWiki.Library;
using TightWiki.Models.DataModels;
namespace TightWiki.Models.ViewModels.Profile
{
public class AccountViewModel : ViewModelBase
{
public List<TimeZoneItem> TimeZones { get; set; } = new();
public List<CountryItem> Countries { get; set; } = new();
public List<LanguageItem> Languages { get; set; } = new();
public List<Role> Roles { get; set; } = new();
public AccountProfile Account { get; set; } = new();
}
}

View File

@@ -0,0 +1,6 @@
namespace TightWiki.Models.ViewModels.Profile
{
public class ConfirmViewModel : ViewModelBase
{
}
}

View File

@@ -0,0 +1,7 @@
namespace TightWiki.Models.ViewModels.Profile
{
public class DeleteAccountViewModel : ViewModelBase
{
public string? AccountName { get; set; }
}
}

View File

@@ -0,0 +1,6 @@
namespace TightWiki.Models.ViewModels.Profile
{
public class DeletedAccountViewModel : ViewModelBase
{
}
}

View File

@@ -0,0 +1,36 @@
using Microsoft.AspNetCore.Mvc.ModelBinding;
using System.ComponentModel.DataAnnotations;
using TightWiki.Models.DataModels;
namespace TightWiki.Models.ViewModels.Profile
{
public class PublicViewModel : ViewModelBase
{
public string Navigation { get; set; } = string.Empty;
public Guid Id { get; set; }
[Display(Name = "Name")]
public string AccountName { get; set; } = string.Empty;
[Display(Name = "Personal Bio")]
public string Biography { get; set; } = string.Empty;
[Display(Name = "Avatar")]
[BindNever]
public byte[]? Avatar { get; set; }
[Required]
[Display(Name = "Country")]
public string Country { get; set; } = string.Empty;
[Required]
[Display(Name = "Language")]
public string Language { get; set; } = string.Empty;
[Required]
[Display(Name = "Time Zone")]
public string TimeZone { get; set; } = string.Empty;
public List<PageRevision> RecentlyModified { get; set; } = new();
}
}

View File

@@ -0,0 +1,20 @@
using System.ComponentModel.DataAnnotations;
namespace TightWiki.Models.ViewModels.Shared
{
public class CredentialViewModel
{
public const string NOTSET = "\\__!!_PASSWORD_NOT_SET_!!__//";
[Required]
[Display(Name = "Password")]
[StringLength(50, MinimumLength = 6, ErrorMessage = "Must have a minimum length of 5.")]
public string Password { get; set; } = NOTSET;
[Required]
[Display(Name = "Re-enter Password")]
[StringLength(50, MinimumLength = 6, ErrorMessage = "Must have a minimum length of 5.")]
[Compare("Password", ErrorMessage = "The two entered passwords do not match.")]
public string ComparePassword { get; set; } = NOTSET;
}
}

View File

@@ -0,0 +1,13 @@
namespace TightWiki.Models.ViewModels.Utility
{
public class ConfirmActionViewModel : ViewModelBase
{
public string ControllerURL { get; set; } = string.Empty;
public string YesRedirectURL { get; set; } = string.Empty;
public string NoRedirectURL { get; set; } = string.Empty;
public string Message { get; set; } = string.Empty;
public string Style { get; set; } = string.Empty;
public string? Parameter { get; set; } = string.Empty;
public bool UserSelection { get; set; }
}
}

View File

@@ -0,0 +1,8 @@
namespace TightWiki.Models.ViewModels.Utility
{
public class NotifyViewModel : ViewModelBase
{
public string RedirectURL { get; set; } = string.Empty;
public int RedirectTimeout { get; set; }
}
}

View File

@@ -0,0 +1,8 @@
namespace TightWiki.Models.ViewModels
{
public class ViewModelBase
{
public string SuccessMessage { get; set; } = string.Empty;
public string ErrorMessage { get; set; } = string.Empty;
}
}