mirror of https://github.com/abpframework/abp.git
1285 changed files with 266689 additions and 0 deletions
@ -0,0 +1 @@ |
|||
**/wwwroot/libs/** linguist-vendored |
|||
@ -0,0 +1,259 @@ |
|||
## Ignore Visual Studio temporary files, build results, and |
|||
## files generated by popular Visual Studio add-ons. |
|||
|
|||
# User-specific files |
|||
*.suo |
|||
*.user |
|||
*.userosscache |
|||
*.sln.docstates |
|||
|
|||
# User-specific files (MonoDevelop/Xamarin Studio) |
|||
*.userprefs |
|||
|
|||
# Build results |
|||
[Dd]ebug/ |
|||
[Dd]ebugPublic/ |
|||
[Rr]elease/ |
|||
[Rr]eleases/ |
|||
x64/ |
|||
x86/ |
|||
bld/ |
|||
[Bb]in/ |
|||
[Oo]bj/ |
|||
[Ll]og/ |
|||
|
|||
# Visual Studio 2015 cache/options directory |
|||
.vs/ |
|||
# Uncomment if you have tasks that create the project's static files in wwwroot |
|||
#wwwroot/ |
|||
|
|||
# MSTest test Results |
|||
[Tt]est[Rr]esult*/ |
|||
[Bb]uild[Ll]og.* |
|||
|
|||
# NUNIT |
|||
*.VisualState.xml |
|||
TestResult.xml |
|||
|
|||
# Build Results of an ATL Project |
|||
[Dd]ebugPS/ |
|||
[Rr]eleasePS/ |
|||
dlldata.c |
|||
|
|||
# DNX |
|||
project.lock.json |
|||
artifacts/ |
|||
|
|||
*_i.c |
|||
*_p.c |
|||
*_i.h |
|||
*.ilk |
|||
*.meta |
|||
*.obj |
|||
*.pch |
|||
*.pdb |
|||
*.pgc |
|||
*.pgd |
|||
*.rsp |
|||
*.sbr |
|||
*.tlb |
|||
*.tli |
|||
*.tlh |
|||
*.tmp |
|||
*.tmp_proj |
|||
*.log |
|||
*.vspscc |
|||
*.vssscc |
|||
.builds |
|||
*.pidb |
|||
*.svclog |
|||
*.scc |
|||
|
|||
# Chutzpah Test files |
|||
_Chutzpah* |
|||
|
|||
# Visual C++ cache files |
|||
ipch/ |
|||
*.aps |
|||
*.ncb |
|||
*.opendb |
|||
*.opensdf |
|||
*.sdf |
|||
*.cachefile |
|||
*.VC.db |
|||
*.VC.VC.opendb |
|||
|
|||
# Visual Studio profiler |
|||
*.psess |
|||
*.vsp |
|||
*.vspx |
|||
*.sap |
|||
|
|||
# TFS 2012 Local Workspace |
|||
$tf/ |
|||
|
|||
# Guidance Automation Toolkit |
|||
*.gpState |
|||
|
|||
# ReSharper is a .NET coding add-in |
|||
_ReSharper*/ |
|||
*.[Rr]e[Ss]harper |
|||
*.DotSettings.user |
|||
|
|||
# JustCode is a .NET coding add-in |
|||
.JustCode |
|||
|
|||
# TeamCity is a build add-in |
|||
_TeamCity* |
|||
|
|||
# DotCover is a Code Coverage Tool |
|||
*.dotCover |
|||
|
|||
# NCrunch |
|||
_NCrunch_* |
|||
.*crunch*.local.xml |
|||
nCrunchTemp_* |
|||
|
|||
# MightyMoose |
|||
*.mm.* |
|||
AutoTest.Net/ |
|||
|
|||
# Web workbench (sass) |
|||
.sass-cache/ |
|||
|
|||
# Installshield output folder |
|||
[Ee]xpress/ |
|||
|
|||
# DocProject is a documentation generator add-in |
|||
DocProject/buildhelp/ |
|||
DocProject/Help/*.HxT |
|||
DocProject/Help/*.HxC |
|||
DocProject/Help/*.hhc |
|||
DocProject/Help/*.hhk |
|||
DocProject/Help/*.hhp |
|||
DocProject/Help/Html2 |
|||
DocProject/Help/html |
|||
|
|||
# Click-Once directory |
|||
publish/ |
|||
|
|||
# Publish Web Output |
|||
*.[Pp]ublish.xml |
|||
*.azurePubxml |
|||
# TODO: Comment the next line if you want to checkin your web deploy settings |
|||
# but database connection strings (with potential passwords) will be unencrypted |
|||
*.pubxml |
|||
*.publishproj |
|||
|
|||
# Microsoft Azure Web App publish settings. Comment the next line if you want to |
|||
# checkin your Azure Web App publish settings, but sensitive information contained |
|||
# in these scripts will be unencrypted |
|||
PublishScripts/ |
|||
|
|||
# NuGet Packages |
|||
*.nupkg |
|||
# The packages folder can be ignored because of Package Restore |
|||
**/packages/* |
|||
# except build/, which is used as an MSBuild target. |
|||
!**/packages/build/ |
|||
# Uncomment if necessary however generally it will be regenerated when needed |
|||
#!**/packages/repositories.config |
|||
# NuGet v3's project.json files produces more ignoreable files |
|||
*.nuget.props |
|||
*.nuget.targets |
|||
|
|||
# Microsoft Azure Build Output |
|||
csx/ |
|||
*.build.csdef |
|||
|
|||
# Microsoft Azure Emulator |
|||
ecf/ |
|||
rcf/ |
|||
|
|||
# Windows Store app package directories and files |
|||
AppPackages/ |
|||
BundleArtifacts/ |
|||
Package.StoreAssociation.xml |
|||
_pkginfo.txt |
|||
|
|||
# Visual Studio cache files |
|||
# files ending in .cache can be ignored |
|||
*.[Cc]ache |
|||
# but keep track of directories ending in .cache |
|||
!*.[Cc]ache/ |
|||
|
|||
# Others |
|||
ClientBin/ |
|||
~$* |
|||
*~ |
|||
*.dbmdl |
|||
*.dbproj.schemaview |
|||
*.pfx |
|||
*.publishsettings |
|||
node_modules/ |
|||
orleans.codegen.cs |
|||
|
|||
# Since there are multiple workflows, uncomment next line to ignore bower_components |
|||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) |
|||
#bower_components/ |
|||
|
|||
# RIA/Silverlight projects |
|||
Generated_Code/ |
|||
|
|||
# Backup & report files from converting an old project file |
|||
# to a newer Visual Studio version. Backup files are not needed, |
|||
# because we have git ;-) |
|||
_UpgradeReport_Files/ |
|||
Backup*/ |
|||
UpgradeLog*.XML |
|||
UpgradeLog*.htm |
|||
|
|||
# SQL Server files |
|||
*.mdf |
|||
*.ldf |
|||
|
|||
# Business Intelligence projects |
|||
*.rdl.data |
|||
*.bim.layout |
|||
*.bim_*.settings |
|||
|
|||
# Microsoft Fakes |
|||
FakesAssemblies/ |
|||
|
|||
# GhostDoc plugin setting file |
|||
*.GhostDoc.xml |
|||
|
|||
# Node.js Tools for Visual Studio |
|||
.ntvs_analysis.dat |
|||
|
|||
# Visual Studio 6 build log |
|||
*.plg |
|||
|
|||
# Visual Studio 6 workspace options file |
|||
*.opt |
|||
|
|||
# Visual Studio LightSwitch build output |
|||
**/*.HTMLClient/GeneratedArtifacts |
|||
**/*.DesktopClient/GeneratedArtifacts |
|||
**/*.DesktopClient/ModelManifest.xml |
|||
**/*.Server/GeneratedArtifacts |
|||
**/*.Server/ModelManifest.xml |
|||
_Pvt_Extensions |
|||
|
|||
# Paket dependency manager |
|||
.paket/paket.exe |
|||
paket-files/ |
|||
|
|||
# FAKE - F# Make |
|||
.fake/ |
|||
|
|||
# JetBrains Rider |
|||
.idea/ |
|||
*.sln.iml |
|||
|
|||
# BookStore |
|||
src/Acme.BookStore.Web/Logs/* |
|||
src/Acme.BookStore.Web.Host/Logs/* |
|||
src/Acme.BookStore.IdentityServer/Logs/* |
|||
src/Acme.BookStore.HttpApi.Host/Logs/* |
|||
src/Acme.BookStore.HttpApi.HostWithIds/Logs/* |
|||
@ -0,0 +1,137 @@ |
|||
|
|||
Microsoft Visual Studio Solution File, Format Version 12.00 |
|||
# Visual Studio Version 16 |
|||
VisualStudioVersion = 16.0.29020.237 |
|||
MinimumVisualStudioVersion = 10.0.40219.1 |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Acme.BookStore.Domain", "src\Acme.BookStore.Domain\Acme.BookStore.Domain.csproj", "{554AD327-6DBA-4F8F-96F8-81CE7A0C863F}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Acme.BookStore.Application", "src\Acme.BookStore.Application\Acme.BookStore.Application.csproj", "{1A94A50E-06DC-43C1-80B5-B662820EC3EB}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Acme.BookStore.EntityFrameworkCore", "src\Acme.BookStore.EntityFrameworkCore\Acme.BookStore.EntityFrameworkCore.csproj", "{C956DD76-69C8-4A9C-83EA-D17DF83340FD}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Acme.BookStore.Web", "src\Acme.BookStore.Web\Acme.BookStore.Web.csproj", "{068855E8-9240-4F1A-910B-CF825794513B}" |
|||
EndProject |
|||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{CA9AC87F-097E-4F15-8393-4BC07735A5B0}" |
|||
EndProject |
|||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{04DBDB01-70F4-4E06-B468-8F87850B22BE}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Acme.BookStore.Application.Tests", "test\Acme.BookStore.Application.Tests\Acme.BookStore.Application.Tests.csproj", "{50B2631D-129C-47B3-A587-029CCD6099BC}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Acme.BookStore.Web.Tests", "test\Acme.BookStore.Web.Tests\Acme.BookStore.Web.Tests.csproj", "{5F1B28C6-8D0C-4155-92D0-252F7EA5F674}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Acme.BookStore.EntityFrameworkCore.DbMigrations", "src\Acme.BookStore.EntityFrameworkCore.DbMigrations\Acme.BookStore.EntityFrameworkCore.DbMigrations.csproj", "{0372FA84-C517-4EB3-9A9F-B9ACAC0CA5E0}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Acme.BookStore.Domain.Shared", "src\Acme.BookStore.Domain.Shared\Acme.BookStore.Domain.Shared.csproj", "{42F719ED-8413-4895-B5B4-5AB56079BC66}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Acme.BookStore.Application.Contracts", "src\Acme.BookStore.Application.Contracts\Acme.BookStore.Application.Contracts.csproj", "{520659C8-C734-4298-A3DA-B539DB9DFC0B}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Acme.BookStore.HttpApi", "src\Acme.BookStore.HttpApi\Acme.BookStore.HttpApi.csproj", "{4164BDF7-F527-4E85-9CE6-E3C2D7426A27}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Acme.BookStore.HttpApi.Client", "src\Acme.BookStore.HttpApi.Client\Acme.BookStore.HttpApi.Client.csproj", "{3B5A0094-670D-4BB1-BFDD-61B88A8773DC}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Acme.BookStore.EntityFrameworkCore.Tests", "test\Acme.BookStore.EntityFrameworkCore.Tests\Acme.BookStore.EntityFrameworkCore.Tests.csproj", "{1FE30EB9-74A9-47F5-A9F6-7B1FAB672D81}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Acme.BookStore.TestBase", "test\Acme.BookStore.TestBase\Acme.BookStore.TestBase.csproj", "{91853F21-9CD9-4132-BC29-A7D5D84FFFE7}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Acme.BookStore.Domain.Tests", "test\Acme.BookStore.Domain.Tests\Acme.BookStore.Domain.Tests.csproj", "{E512F4D9-9375-480F-A2F6-A46509F9D824}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Acme.BookStore.HttpApi.Client.ConsoleTestApp", "test\Acme.BookStore.HttpApi.Client.ConsoleTestApp\Acme.BookStore.HttpApi.Client.ConsoleTestApp.csproj", "{EF480016-9127-4916-8735-D2466BDBC582}" |
|||
EndProject |
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Acme.BookStore.DbMigrator", "src\Acme.BookStore.DbMigrator\Acme.BookStore.DbMigrator.csproj", "{AA94D832-1CCC-4715-95A9-A483F23A1A5D}" |
|||
EndProject |
|||
Global |
|||
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
|||
Debug|Any CPU = Debug|Any CPU |
|||
Release|Any CPU = Release|Any CPU |
|||
EndGlobalSection |
|||
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
|||
{554AD327-6DBA-4F8F-96F8-81CE7A0C863F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{554AD327-6DBA-4F8F-96F8-81CE7A0C863F}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{554AD327-6DBA-4F8F-96F8-81CE7A0C863F}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{554AD327-6DBA-4F8F-96F8-81CE7A0C863F}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{1A94A50E-06DC-43C1-80B5-B662820EC3EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{1A94A50E-06DC-43C1-80B5-B662820EC3EB}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{1A94A50E-06DC-43C1-80B5-B662820EC3EB}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{1A94A50E-06DC-43C1-80B5-B662820EC3EB}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{C956DD76-69C8-4A9C-83EA-D17DF83340FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{C956DD76-69C8-4A9C-83EA-D17DF83340FD}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{C956DD76-69C8-4A9C-83EA-D17DF83340FD}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{C956DD76-69C8-4A9C-83EA-D17DF83340FD}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{068855E8-9240-4F1A-910B-CF825794513B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{068855E8-9240-4F1A-910B-CF825794513B}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{068855E8-9240-4F1A-910B-CF825794513B}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{068855E8-9240-4F1A-910B-CF825794513B}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{50B2631D-129C-47B3-A587-029CCD6099BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{50B2631D-129C-47B3-A587-029CCD6099BC}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{50B2631D-129C-47B3-A587-029CCD6099BC}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{50B2631D-129C-47B3-A587-029CCD6099BC}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{5F1B28C6-8D0C-4155-92D0-252F7EA5F674}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{5F1B28C6-8D0C-4155-92D0-252F7EA5F674}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{5F1B28C6-8D0C-4155-92D0-252F7EA5F674}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{5F1B28C6-8D0C-4155-92D0-252F7EA5F674}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{0372FA84-C517-4EB3-9A9F-B9ACAC0CA5E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{0372FA84-C517-4EB3-9A9F-B9ACAC0CA5E0}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{0372FA84-C517-4EB3-9A9F-B9ACAC0CA5E0}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{0372FA84-C517-4EB3-9A9F-B9ACAC0CA5E0}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{42F719ED-8413-4895-B5B4-5AB56079BC66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{42F719ED-8413-4895-B5B4-5AB56079BC66}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{42F719ED-8413-4895-B5B4-5AB56079BC66}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{42F719ED-8413-4895-B5B4-5AB56079BC66}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{520659C8-C734-4298-A3DA-B539DB9DFC0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{520659C8-C734-4298-A3DA-B539DB9DFC0B}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{520659C8-C734-4298-A3DA-B539DB9DFC0B}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{520659C8-C734-4298-A3DA-B539DB9DFC0B}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{4164BDF7-F527-4E85-9CE6-E3C2D7426A27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{4164BDF7-F527-4E85-9CE6-E3C2D7426A27}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{4164BDF7-F527-4E85-9CE6-E3C2D7426A27}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{4164BDF7-F527-4E85-9CE6-E3C2D7426A27}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{3B5A0094-670D-4BB1-BFDD-61B88A8773DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{3B5A0094-670D-4BB1-BFDD-61B88A8773DC}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{3B5A0094-670D-4BB1-BFDD-61B88A8773DC}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{3B5A0094-670D-4BB1-BFDD-61B88A8773DC}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{1FE30EB9-74A9-47F5-A9F6-7B1FAB672D81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{1FE30EB9-74A9-47F5-A9F6-7B1FAB672D81}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{1FE30EB9-74A9-47F5-A9F6-7B1FAB672D81}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{1FE30EB9-74A9-47F5-A9F6-7B1FAB672D81}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{91853F21-9CD9-4132-BC29-A7D5D84FFFE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{91853F21-9CD9-4132-BC29-A7D5D84FFFE7}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{91853F21-9CD9-4132-BC29-A7D5D84FFFE7}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{91853F21-9CD9-4132-BC29-A7D5D84FFFE7}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{E512F4D9-9375-480F-A2F6-A46509F9D824}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{E512F4D9-9375-480F-A2F6-A46509F9D824}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{E512F4D9-9375-480F-A2F6-A46509F9D824}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{E512F4D9-9375-480F-A2F6-A46509F9D824}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{EF480016-9127-4916-8735-D2466BDBC582}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{EF480016-9127-4916-8735-D2466BDBC582}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{EF480016-9127-4916-8735-D2466BDBC582}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{EF480016-9127-4916-8735-D2466BDBC582}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{AA94D832-1CCC-4715-95A9-A483F23A1A5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{AA94D832-1CCC-4715-95A9-A483F23A1A5D}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{AA94D832-1CCC-4715-95A9-A483F23A1A5D}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{AA94D832-1CCC-4715-95A9-A483F23A1A5D}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
EndGlobalSection |
|||
GlobalSection(SolutionProperties) = preSolution |
|||
HideSolutionNode = FALSE |
|||
EndGlobalSection |
|||
GlobalSection(NestedProjects) = preSolution |
|||
{554AD327-6DBA-4F8F-96F8-81CE7A0C863F} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} |
|||
{1A94A50E-06DC-43C1-80B5-B662820EC3EB} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} |
|||
{C956DD76-69C8-4A9C-83EA-D17DF83340FD} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} |
|||
{068855E8-9240-4F1A-910B-CF825794513B} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} |
|||
{50B2631D-129C-47B3-A587-029CCD6099BC} = {04DBDB01-70F4-4E06-B468-8F87850B22BE} |
|||
{5F1B28C6-8D0C-4155-92D0-252F7EA5F674} = {04DBDB01-70F4-4E06-B468-8F87850B22BE} |
|||
{0372FA84-C517-4EB3-9A9F-B9ACAC0CA5E0} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} |
|||
{42F719ED-8413-4895-B5B4-5AB56079BC66} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} |
|||
{520659C8-C734-4298-A3DA-B539DB9DFC0B} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} |
|||
{4164BDF7-F527-4E85-9CE6-E3C2D7426A27} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} |
|||
{3B5A0094-670D-4BB1-BFDD-61B88A8773DC} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} |
|||
{1FE30EB9-74A9-47F5-A9F6-7B1FAB672D81} = {04DBDB01-70F4-4E06-B468-8F87850B22BE} |
|||
{91853F21-9CD9-4132-BC29-A7D5D84FFFE7} = {04DBDB01-70F4-4E06-B468-8F87850B22BE} |
|||
{E512F4D9-9375-480F-A2F6-A46509F9D824} = {04DBDB01-70F4-4E06-B468-8F87850B22BE} |
|||
{EF480016-9127-4916-8735-D2466BDBC582} = {04DBDB01-70F4-4E06-B468-8F87850B22BE} |
|||
{AA94D832-1CCC-4715-95A9-A483F23A1A5D} = {CA9AC87F-097E-4F15-8393-4BC07735A5B0} |
|||
EndGlobalSection |
|||
GlobalSection(ExtensibilityGlobals) = postSolution |
|||
SolutionGuid = {28315BFD-90E7-4E14-A2EA-F3D23AF4126F} |
|||
EndGlobalSection |
|||
EndGlobal |
|||
@ -0,0 +1,23 @@ |
|||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> |
|||
<s:Boolean x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/IntelliSenseCompletingCharacters/CSharpCompletingCharacters/UpgradedFromVSSettings/@EntryValue">True</s:Boolean> |
|||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceDoWhileStatementBraces/@EntryIndexedValue">WARNING</s:String> |
|||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceFixedStatementBraces/@EntryIndexedValue">WARNING</s:String> |
|||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceForeachStatementBraces/@EntryIndexedValue">WARNING</s:String> |
|||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceForStatementBraces/@EntryIndexedValue">WARNING</s:String> |
|||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceIfStatementBraces/@EntryIndexedValue">WARNING</s:String> |
|||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceLockStatementBraces/@EntryIndexedValue">WARNING</s:String> |
|||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceUsingStatementBraces/@EntryIndexedValue">WARNING</s:String> |
|||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=EnforceWhileStatementBraces/@EntryIndexedValue">WARNING</s:String> |
|||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/BRACES_FOR_FOR/@EntryValue">Required</s:String> |
|||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/BRACES_FOR_FOREACH/@EntryValue">Required</s:String> |
|||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/BRACES_FOR_IFELSE/@EntryValue">Required</s:String> |
|||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/BRACES_FOR_WHILE/@EntryValue">Required</s:String> |
|||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/BRACES_REDUNDANT/@EntryValue">False</s:Boolean> |
|||
<s:Boolean x:Key="/Default/CodeStyle/Generate/=Implementations/@KeyIndexDefined">True</s:Boolean> |
|||
<s:String x:Key="/Default/CodeStyle/Generate/=Implementations/Options/=Async/@EntryIndexedValue">False</s:String> |
|||
<s:String x:Key="/Default/CodeStyle/Generate/=Implementations/Options/=Mutable/@EntryIndexedValue">False</s:String> |
|||
<s:Boolean x:Key="/Default/CodeStyle/Generate/=Overrides/@KeyIndexDefined">True</s:Boolean> |
|||
<s:String x:Key="/Default/CodeStyle/Generate/=Overrides/Options/=Async/@EntryIndexedValue">False</s:String> |
|||
<s:String x:Key="/Default/CodeStyle/Generate/=Overrides/Options/=Mutable/@EntryIndexedValue">False</s:String> |
|||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SQL/@EntryIndexedValue">SQL</s:String> |
|||
</wpf:ResourceDictionary> |
|||
@ -0,0 +1,7 @@ |
|||
<Project> |
|||
<PropertyGroup> |
|||
<LangVersion>latest</LangVersion> |
|||
<Version>1.0.0</Version> |
|||
<NoWarn>$(NoWarn);CS1591</NoWarn> |
|||
</PropertyGroup> |
|||
</Project> |
|||
@ -0,0 +1,23 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netstandard2.0</TargetFramework> |
|||
<RootNamespace>Acme.BookStore</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\Acme.BookStore.Domain.Shared\Acme.BookStore.Domain.Shared.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.Account.Application.Contracts" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.Identity.Application.Contracts" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.PermissionManagement.Application.Contracts" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.TenantManagement.Application.Contracts" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.FeatureManagement.Application.Contracts" Version="0.19.0" /> |
|||
<ProjectReference Include="..\..\..\modules\book-management\src\Acme.BookStore.BookManagement.Application.Contracts\Acme.BookStore.BookManagement.Application.Contracts.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,24 @@ |
|||
using Acme.BookStore.BookManagement; |
|||
using Volo.Abp.Account; |
|||
using Volo.Abp.FeatureManagement; |
|||
using Volo.Abp.Identity; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.PermissionManagement; |
|||
using Volo.Abp.TenantManagement; |
|||
|
|||
namespace Acme.BookStore |
|||
{ |
|||
[DependsOn( |
|||
typeof(BookStoreDomainSharedModule), |
|||
typeof(AbpAccountApplicationContractsModule), |
|||
typeof(AbpFeatureManagementApplicationContractsModule), |
|||
typeof(AbpIdentityApplicationContractsModule), |
|||
typeof(AbpPermissionManagementApplicationContractsModule), |
|||
typeof(AbpTenantManagementApplicationContractsModule), |
|||
typeof(BookManagementApplicationContractsModule) |
|||
)] |
|||
public class BookStoreApplicationContractsModule : AbpModule |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
using Acme.BookStore.Localization; |
|||
using Volo.Abp.Authorization.Permissions; |
|||
using Volo.Abp.Localization; |
|||
|
|||
namespace Acme.BookStore.Permissions |
|||
{ |
|||
public class BookStorePermissionDefinitionProvider : PermissionDefinitionProvider |
|||
{ |
|||
public override void Define(IPermissionDefinitionContext context) |
|||
{ |
|||
var myGroup = context.AddGroup(BookStorePermissions.GroupName); |
|||
|
|||
//Define your own permissions here. Example:
|
|||
//myGroup.AddPermission(BookStorePermissions.MyPermission1, L("Permission:MyPermission1"));
|
|||
} |
|||
|
|||
private static LocalizableString L(string name) |
|||
{ |
|||
return LocalizableString.Create<BookStoreResource>(name); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
namespace Acme.BookStore.Permissions |
|||
{ |
|||
public static class BookStorePermissions |
|||
{ |
|||
public const string GroupName = "BookStore"; |
|||
|
|||
//Add your own permission names. Example:
|
|||
//public const string MyPermission1 = GroupName + ".MyPermission1";
|
|||
} |
|||
} |
|||
@ -0,0 +1,24 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netcoreapp2.2</TargetFramework> |
|||
<RootNamespace>Acme.BookStore</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\Acme.BookStore.Domain\Acme.BookStore.Domain.csproj" /> |
|||
<ProjectReference Include="..\Acme.BookStore.Application.Contracts\Acme.BookStore.Application.Contracts.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.Account.Application" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.Identity.Application" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.PermissionManagement.Application" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.TenantManagement.Application" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.FeatureManagement.Application" Version="0.19.0" /> |
|||
<ProjectReference Include="..\..\..\modules\book-management\src\Acme.BookStore.BookManagement.Application\Acme.BookStore.BookManagement.Application.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,18 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
using Acme.BookStore.Localization; |
|||
using Volo.Abp.Application.Services; |
|||
|
|||
namespace Acme.BookStore |
|||
{ |
|||
/* Inherit your application services from this class. |
|||
*/ |
|||
public abstract class BookStoreAppService : ApplicationService |
|||
{ |
|||
protected BookStoreAppService() |
|||
{ |
|||
LocalizationResource = typeof(BookStoreResource); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
using AutoMapper; |
|||
|
|||
namespace Acme.BookStore |
|||
{ |
|||
public class BookStoreApplicationAutoMapperProfile : Profile |
|||
{ |
|||
public BookStoreApplicationAutoMapperProfile() |
|||
{ |
|||
/* You can configure your AutoMapper mapping configuration here. |
|||
* Alternatively, you can split your mapping configurations |
|||
* into multiple profile classes for a better organization. */ |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,36 @@ |
|||
using Acme.BookStore.BookManagement; |
|||
using Volo.Abp.Account; |
|||
using Volo.Abp.AutoMapper; |
|||
using Volo.Abp.FeatureManagement; |
|||
using Volo.Abp.Identity; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.PermissionManagement; |
|||
using Volo.Abp.TenantManagement; |
|||
|
|||
namespace Acme.BookStore |
|||
{ |
|||
[DependsOn( |
|||
typeof(BookStoreDomainModule), |
|||
typeof(AbpAccountApplicationModule), |
|||
typeof(BookStoreApplicationContractsModule), |
|||
typeof(AbpIdentityApplicationModule), |
|||
typeof(AbpPermissionManagementApplicationModule), |
|||
typeof(AbpTenantManagementApplicationModule), |
|||
typeof(AbpFeatureManagementApplicationModule), |
|||
typeof(BookManagementApplicationModule) |
|||
)] |
|||
public class BookStoreApplicationModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
Configure<AbpAutoMapperOptions>(options => |
|||
{ |
|||
/* Use `true` for the `validate` parameter if you want to |
|||
* validate the profile on application startup. |
|||
* See http://docs.automapper.org/en/stable/Configuration-validation.html for more info
|
|||
* about the configuration validation. */ |
|||
options.AddProfile<BookStoreApplicationAutoMapperProfile>(); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,33 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<OutputType>Exe</OutputType> |
|||
<TargetFramework>netcoreapp2.2</TargetFramework> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<None Remove="appsettings.json" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<Content Include="appsettings.json"> |
|||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory> |
|||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
|||
</Content> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Serilog.Extensions.Logging" Version="2.0.4" /> |
|||
<PackageReference Include="Serilog.Sinks.File" Version="4.0.0" /> |
|||
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.Autofac" Version="0.19.0" /> |
|||
<ProjectReference Include="..\Acme.BookStore.Application.Contracts\Acme.BookStore.Application.Contracts.csproj" /> |
|||
<ProjectReference Include="..\Acme.BookStore.EntityFrameworkCore.DbMigrations\Acme.BookStore.EntityFrameworkCore.DbMigrations.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,20 @@ |
|||
using Acme.BookStore.EntityFrameworkCore; |
|||
using Volo.Abp.Autofac; |
|||
using Volo.Abp.BackgroundJobs; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace Acme.BookStore.DbMigrator |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpAutofacModule), |
|||
typeof(BookStoreEntityFrameworkCoreDbMigrationsModule), |
|||
typeof(BookStoreApplicationContractsModule) |
|||
)] |
|||
public class BookStoreDbMigratorModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
Configure<BackgroundJobOptions>(options => options.IsJobExecutionEnabled = false); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,53 @@ |
|||
using System.IO; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Acme.BookStore.Data; |
|||
using Serilog; |
|||
using Serilog.Events; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Threading; |
|||
|
|||
namespace Acme.BookStore.DbMigrator |
|||
{ |
|||
class Program |
|||
{ |
|||
static void Main(string[] args) |
|||
{ |
|||
ConfigureLogging(); |
|||
|
|||
using (var application = AbpApplicationFactory.Create<BookStoreDbMigratorModule>(options => |
|||
{ |
|||
options.UseAutofac(); |
|||
options.Services.AddLogging(c => c.AddSerilog()); |
|||
})) |
|||
{ |
|||
application.Initialize(); |
|||
|
|||
AsyncHelper.RunSync( |
|||
() => application |
|||
.ServiceProvider |
|||
.GetRequiredService<BookStoreDbMigrationService>() |
|||
.MigrateAsync() |
|||
); |
|||
|
|||
application.Shutdown(); |
|||
} |
|||
} |
|||
|
|||
private static void ConfigureLogging() |
|||
{ |
|||
Log.Logger = new LoggerConfiguration() |
|||
.MinimumLevel.Information() |
|||
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning) |
|||
.MinimumLevel.Override("Volo.Abp", LogEventLevel.Warning) |
|||
#if DEBUG
|
|||
.MinimumLevel.Override("Acme.BookStore", LogEventLevel.Debug) |
|||
#else
|
|||
.MinimumLevel.Override("Acme.BookStore", LogEventLevel.Information) |
|||
#endif
|
|||
.Enrich.FromLogContext() |
|||
.WriteTo.File(Path.Combine(Directory.GetCurrentDirectory(), "Logs/logs.txt")) |
|||
.WriteTo.Console() |
|||
.CreateLogger(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
{ |
|||
"ConnectionStrings": { |
|||
"Default": "Server=localhost;Database=BookStore;Trusted_Connection=True;MultipleActiveResultSets=true" |
|||
}, |
|||
"IdentityServer": { |
|||
"Clients": { |
|||
"BookStore_Web": { |
|||
"ClientId": "BookStore_Web", |
|||
"ClientSecret": "1q2w3e*", |
|||
"RootUrl": "https://localhost:44388" |
|||
}, |
|||
"BookStore_App": { |
|||
"ClientId": "BookStore_App", |
|||
"ClientSecret": "1q2w3e*" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netstandard2.0</TargetFramework> |
|||
<RootNamespace>Acme.BookStore</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.Identity.Domain.Shared" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.IdentityServer.Domain.Shared" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.BackgroundJobs.Domain.Shared" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.AuditLogging.Domain.Shared" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.TenantManagement.Domain.Shared" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.FeatureManagement.Domain.Shared" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.PermissionManagement.Domain.Shared" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.SettingManagement.Domain.Shared" Version="0.19.0" /> |
|||
<ProjectReference Include="..\..\..\modules\book-management\src\Acme.BookStore.BookManagement.Domain.Shared\Acme.BookStore.BookManagement.Domain.Shared.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<EmbeddedResource Include="Localization\BookStore\*.json" /> |
|||
<Content Remove="Localization\BookStore\*.json" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,7 @@ |
|||
namespace Acme.BookStore |
|||
{ |
|||
public static class BookStoreDomainErrorCodes |
|||
{ |
|||
/* You can add your business exception error codes here, as constants */ |
|||
} |
|||
} |
|||
@ -0,0 +1,47 @@ |
|||
using Acme.BookStore.BookManagement; |
|||
using Acme.BookStore.Localization; |
|||
using Volo.Abp.AuditLogging; |
|||
using Volo.Abp.BackgroundJobs; |
|||
using Volo.Abp.FeatureManagement; |
|||
using Volo.Abp.Identity; |
|||
using Volo.Abp.IdentityServer; |
|||
using Volo.Abp.Localization; |
|||
using Volo.Abp.Localization.Resources.AbpValidation; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.PermissionManagement; |
|||
using Volo.Abp.SettingManagement; |
|||
using Volo.Abp.TenantManagement; |
|||
using Volo.Abp.VirtualFileSystem; |
|||
|
|||
namespace Acme.BookStore |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpAuditLoggingDomainSharedModule), |
|||
typeof(BackgroundJobsDomainSharedModule), |
|||
typeof(AbpFeatureManagementDomainSharedModule), |
|||
typeof(AbpIdentityDomainSharedModule), |
|||
typeof(AbpIdentityServerDomainSharedModule), |
|||
typeof(AbpPermissionManagementDomainSharedModule), |
|||
typeof(AbpSettingManagementDomainSharedModule), |
|||
typeof(AbpTenantManagementDomainSharedModule), |
|||
typeof(BookManagementDomainSharedModule) |
|||
)] |
|||
public class BookStoreDomainSharedModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
Configure<VirtualFileSystemOptions>(options => |
|||
{ |
|||
options.FileSets.AddEmbedded<BookStoreDomainSharedModule>("Acme.BookStore"); |
|||
}); |
|||
|
|||
Configure<AbpLocalizationOptions>(options => |
|||
{ |
|||
options.Resources |
|||
.Add<BookStoreResource>("en") |
|||
.AddBaseTypes(typeof(AbpValidationResource)) |
|||
.AddVirtualJson("/Localization/BookStore"); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"culture": "cs", |
|||
"texts": { |
|||
"Menu:Home": "Úvod", |
|||
"Welcome": "Vítejte", |
|||
"LongWelcomeMessage": "Vítejte v aplikaci. Toto je startovací projekt založený na ABP frameworku. Pro více informací, navštivte abp.io." |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"culture": "en", |
|||
"texts": { |
|||
"Menu:Home": "Home", |
|||
"Welcome": "Welcome", |
|||
"LongWelcomeMessage": "Welcome to the application. This is a startup project based on the ABP framework. For more information, visit abp.io." |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"culture": "pl", |
|||
"texts": { |
|||
"Menu:Home": "Home", |
|||
"Welcome": "Witaj", |
|||
"LongWelcomeMessage": "Witaj w aplikacji. To jest inicjalny projekt bazujący na ABP framework. Po więcej informacji odwiedź stronę abp.io." |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"culture": "pt-BR", |
|||
"texts": { |
|||
"Menu:Home": "Principal", |
|||
"Welcome": "Seja bem-vindo!", |
|||
"LongWelcomeMessage": "Bem-vindo a esta aplicação. Este é um projeto inicial baseado no ABP framework. Para mais informações, visite abp.io." |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"culture": "tr", |
|||
"texts": { |
|||
"Menu:Home": "Ana sayfa", |
|||
"Welcome": "Hoşgeldiniz", |
|||
"LongWelcomeMessage": "Uygulamaya hoşgeldiniz. Bu, ABP framework'ü üzerine bina edilmiş bir başlangıç projesidir. Daha fazla bilgi için abp.io adresini ziyaret edebilirsiniz." |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"culture": "vi", |
|||
"texts": { |
|||
"Menu:Home": "Trang chủ", |
|||
"Welcome": "Chào mừng bạn", |
|||
"LongWelcomeMessage": "Chào mừng bạn đến ứng dụng. Đây là một dự án khởi nghiệp dựa trên khung ABP. Để biết thêm thông tin, hãy truy cập abp.io." |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"culture": "zh-Hans", |
|||
"texts": { |
|||
"Menu:Home": "首页", |
|||
"Welcome": "欢迎", |
|||
"LongWelcomeMessage": "欢迎来到该应用程序. 这是一个基于ABP框架的启动项目. 有关更多信息, 请访问 cn.abp.io." |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
using Volo.Abp.Localization; |
|||
|
|||
namespace Acme.BookStore.Localization |
|||
{ |
|||
[LocalizationResourceName("BookStore")] |
|||
public class BookStoreResource |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
namespace Acme.BookStore.MultiTenancy |
|||
{ |
|||
public static class MultiTenancyConsts |
|||
{ |
|||
/* Enable/disable multi-tenancy easily in a single point. |
|||
* If you will never need to multi-tenancy, you can remove |
|||
* related modules and code parts, including this file. |
|||
*/ |
|||
public const bool IsEnabled = true; |
|||
} |
|||
} |
|||
@ -0,0 +1,28 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netcoreapp2.2</TargetFramework> |
|||
<RootNamespace>Acme.BookStore</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\Acme.BookStore.Domain.Shared\Acme.BookStore.Domain.Shared.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.AspNetCore.Mvc.DataAnnotations" Version="2.2.0" /> |
|||
<PackageReference Include="Volo.Abp.Identity.Domain" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.PermissionManagement.Domain.Identity" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.IdentityServer.Domain" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.PermissionManagement.Domain.IdentityServer" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.BackgroundJobs.Domain" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.AuditLogging.Domain" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.TenantManagement.Domain" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.FeatureManagement.Domain" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.SettingManagement.Domain" Version="0.19.0" /> |
|||
<ProjectReference Include="..\..\..\modules\book-management\src\Acme.BookStore.BookManagement.Domain\Acme.BookStore.BookManagement.Domain.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,9 @@ |
|||
namespace Acme.BookStore |
|||
{ |
|||
public static class BookStoreConsts |
|||
{ |
|||
public const string DbTablePrefix = "App"; |
|||
|
|||
public const string DbSchema = null; |
|||
} |
|||
} |
|||
@ -0,0 +1,40 @@ |
|||
using Acme.BookStore.MultiTenancy; |
|||
using Volo.Abp.AuditLogging; |
|||
using Volo.Abp.BackgroundJobs; |
|||
using Volo.Abp.FeatureManagement; |
|||
using Volo.Abp.Identity; |
|||
using Volo.Abp.IdentityServer; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.MultiTenancy; |
|||
using Volo.Abp.PermissionManagement.Identity; |
|||
using Volo.Abp.PermissionManagement.IdentityServer; |
|||
using Volo.Abp.SettingManagement; |
|||
using Volo.Abp.TenantManagement; |
|||
using Acme.BookStore.BookManagement; |
|||
|
|||
namespace Acme.BookStore |
|||
{ |
|||
[DependsOn( |
|||
typeof(BookStoreDomainSharedModule), |
|||
typeof(AbpAuditLoggingDomainModule), |
|||
typeof(BackgroundJobsDomainModule), |
|||
typeof(AbpFeatureManagementDomainModule), |
|||
typeof(AbpIdentityDomainModule), |
|||
typeof(AbpPermissionManagementDomainIdentityModule), |
|||
typeof(AbpIdentityServerDomainModule), |
|||
typeof(AbpPermissionManagementDomainIdentityServerModule), |
|||
typeof(AbpSettingManagementDomainModule), |
|||
typeof(AbpTenantManagementDomainModule), |
|||
typeof(BookManagementDomainModule) |
|||
)] |
|||
public class BookStoreDomainModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
Configure<MultiTenancyOptions>(options => |
|||
{ |
|||
options.IsEnabled = MultiTenancyConsts.IsEnabled; |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,39 @@ |
|||
using System.Threading.Tasks; |
|||
using Microsoft.Extensions.Logging; |
|||
using Microsoft.Extensions.Logging.Abstractions; |
|||
using Volo.Abp.Data; |
|||
using Volo.Abp.DependencyInjection; |
|||
|
|||
namespace Acme.BookStore.Data |
|||
{ |
|||
public class BookStoreDbMigrationService : ITransientDependency |
|||
{ |
|||
public ILogger<BookStoreDbMigrationService> Logger { get; set; } |
|||
|
|||
private readonly IDataSeeder _dataSeeder; |
|||
private readonly IBookStoreDbSchemaMigrator _dbSchemaMigrator; |
|||
|
|||
public BookStoreDbMigrationService( |
|||
IDataSeeder dataSeeder, |
|||
IBookStoreDbSchemaMigrator dbSchemaMigrator) |
|||
{ |
|||
_dataSeeder = dataSeeder; |
|||
_dbSchemaMigrator = dbSchemaMigrator; |
|||
|
|||
Logger = NullLogger<BookStoreDbMigrationService>.Instance; |
|||
} |
|||
|
|||
public async Task MigrateAsync() |
|||
{ |
|||
Logger.LogInformation("Started database migrations..."); |
|||
|
|||
Logger.LogInformation("Migrating database schema..."); |
|||
await _dbSchemaMigrator.MigrateAsync(); |
|||
|
|||
Logger.LogInformation("Executing database seed..."); |
|||
await _dataSeeder.SeedAsync(); |
|||
|
|||
Logger.LogInformation("Successfully completed database migrations."); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Acme.BookStore.Data |
|||
{ |
|||
public interface IBookStoreDbSchemaMigrator |
|||
{ |
|||
Task MigrateAsync(); |
|||
} |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.DependencyInjection; |
|||
|
|||
namespace Acme.BookStore.Data |
|||
{ |
|||
/* This is used if database provider does't define |
|||
* IBookStoreDbSchemaMigrator implementation. |
|||
*/ |
|||
public class NullBookStoreDbSchemaMigrator : IBookStoreDbSchemaMigrator, ITransientDependency |
|||
{ |
|||
public Task MigrateAsync() |
|||
{ |
|||
return Task.CompletedTask; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,223 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using IdentityServer4.Models; |
|||
using Volo.Abp.Authorization.Permissions; |
|||
using Volo.Abp.Configuration; |
|||
using Volo.Abp.Data; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.Guids; |
|||
using Volo.Abp.IdentityServer.ApiResources; |
|||
using Volo.Abp.IdentityServer.Clients; |
|||
using Volo.Abp.IdentityServer.IdentityResources; |
|||
using Volo.Abp.PermissionManagement; |
|||
using Volo.Abp.Uow; |
|||
using ApiResource = Volo.Abp.IdentityServer.ApiResources.ApiResource; |
|||
using Client = Volo.Abp.IdentityServer.Clients.Client; |
|||
|
|||
namespace Acme.BookStore.IdentityServer |
|||
{ |
|||
public class IdentityServerDataSeedContributor : IDataSeedContributor, ITransientDependency |
|||
{ |
|||
private readonly IApiResourceRepository _apiResourceRepository; |
|||
private readonly IClientRepository _clientRepository; |
|||
private readonly IIdentityResourceDataSeeder _identityResourceDataSeeder; |
|||
private readonly IGuidGenerator _guidGenerator; |
|||
private readonly IPermissionDataSeeder _permissionDataSeeder; |
|||
private readonly IConfigurationAccessor _configurationAccessor; |
|||
|
|||
public IdentityServerDataSeedContributor( |
|||
IClientRepository clientRepository, |
|||
IApiResourceRepository apiResourceRepository, |
|||
IIdentityResourceDataSeeder identityResourceDataSeeder, |
|||
IGuidGenerator guidGenerator, |
|||
IPermissionDataSeeder permissionDataSeeder, |
|||
IConfigurationAccessor configurationAccessor) |
|||
{ |
|||
_clientRepository = clientRepository; |
|||
_apiResourceRepository = apiResourceRepository; |
|||
_identityResourceDataSeeder = identityResourceDataSeeder; |
|||
_guidGenerator = guidGenerator; |
|||
_permissionDataSeeder = permissionDataSeeder; |
|||
_configurationAccessor = configurationAccessor; |
|||
} |
|||
|
|||
[UnitOfWork] |
|||
public virtual async Task SeedAsync(DataSeedContext context) |
|||
{ |
|||
await _identityResourceDataSeeder.CreateStandardResourcesAsync(); |
|||
await CreateApiResourcesAsync(); |
|||
await CreateClientsAsync(); |
|||
} |
|||
|
|||
private async Task CreateApiResourcesAsync() |
|||
{ |
|||
var commonApiUserClaims = new[] |
|||
{ |
|||
"email", |
|||
"email_verified", |
|||
"name", |
|||
"phone_number", |
|||
"phone_number_verified", |
|||
"role" |
|||
}; |
|||
|
|||
await CreateApiResourceAsync("BookStore", commonApiUserClaims); |
|||
} |
|||
|
|||
private async Task<ApiResource> CreateApiResourceAsync(string name, IEnumerable<string> claims) |
|||
{ |
|||
var apiResource = await _apiResourceRepository.FindByNameAsync(name); |
|||
if (apiResource == null) |
|||
{ |
|||
apiResource = await _apiResourceRepository.InsertAsync( |
|||
new ApiResource( |
|||
_guidGenerator.Create(), |
|||
name, |
|||
name + " API" |
|||
), |
|||
autoSave: true |
|||
); |
|||
} |
|||
|
|||
foreach (var claim in claims) |
|||
{ |
|||
if (apiResource.FindClaim(claim) == null) |
|||
{ |
|||
apiResource.AddUserClaim(claim); |
|||
} |
|||
} |
|||
|
|||
return await _apiResourceRepository.UpdateAsync(apiResource); |
|||
} |
|||
|
|||
private async Task CreateClientsAsync() |
|||
{ |
|||
var commonScopes = new[] |
|||
{ |
|||
"email", |
|||
"openid", |
|||
"profile", |
|||
"role", |
|||
"phone", |
|||
"address", |
|||
"BookStore" |
|||
}; |
|||
|
|||
var configurationSection = _configurationAccessor.Configuration.GetSection("IdentityServer:Clients"); |
|||
|
|||
//Web Client
|
|||
var webClientId = configurationSection["BookStore_Web:ClientId"]; |
|||
if (!webClientId.IsNullOrWhiteSpace()) |
|||
{ |
|||
var webClientRootUrl = configurationSection["BookStore_Web:RootUrl"].EnsureEndsWith('/'); |
|||
|
|||
/* BookStore_Web client is only needed if you created a tiered |
|||
* solution. Otherwise, you can delete this client. */ |
|||
|
|||
await CreateClientAsync( |
|||
webClientId, |
|||
commonScopes, |
|||
new[] { "hybrid" }, |
|||
(configurationSection["BookStore_Web:ClientSecret"] ?? "1q2w3e*").Sha256(), |
|||
redirectUri: $"{webClientRootUrl}signin-oidc", |
|||
postLogoutRedirectUri: $"{webClientRootUrl}signout-callback-oidc" |
|||
); |
|||
} |
|||
|
|||
//Console Test Client
|
|||
var consoleClientId = configurationSection["BookStore_App:ClientId"]; |
|||
if (!consoleClientId.IsNullOrWhiteSpace()) |
|||
{ |
|||
await CreateClientAsync( |
|||
consoleClientId, |
|||
commonScopes, |
|||
new[] { "password", "client_credentials" }, |
|||
(configurationSection["BookStore_App:ClientSecret"] ?? "1q2w3e*").Sha256() |
|||
); |
|||
} |
|||
} |
|||
|
|||
private async Task<Client> CreateClientAsync( |
|||
string name, |
|||
IEnumerable<string> scopes, |
|||
IEnumerable<string> grantTypes, |
|||
string secret, |
|||
string redirectUri = null, |
|||
string postLogoutRedirectUri = null, |
|||
IEnumerable<string> permissions = null) |
|||
{ |
|||
var client = await _clientRepository.FindByCliendIdAsync(name); |
|||
if (client == null) |
|||
{ |
|||
client = await _clientRepository.InsertAsync( |
|||
new Client( |
|||
_guidGenerator.Create(), |
|||
name |
|||
) |
|||
{ |
|||
ClientName = name, |
|||
ProtocolType = "oidc", |
|||
Description = name, |
|||
AlwaysIncludeUserClaimsInIdToken = true, |
|||
AllowOfflineAccess = true, |
|||
AbsoluteRefreshTokenLifetime = 31536000, //365 days
|
|||
AccessTokenLifetime = 31536000, //365 days
|
|||
AuthorizationCodeLifetime = 300, |
|||
IdentityTokenLifetime = 300, |
|||
RequireConsent = false |
|||
}, |
|||
autoSave: true |
|||
); |
|||
} |
|||
|
|||
foreach (var scope in scopes) |
|||
{ |
|||
if (client.FindScope(scope) == null) |
|||
{ |
|||
client.AddScope(scope); |
|||
} |
|||
} |
|||
|
|||
foreach (var grantType in grantTypes) |
|||
{ |
|||
if (client.FindGrantType(grantType) == null) |
|||
{ |
|||
client.AddGrantType(grantType); |
|||
} |
|||
} |
|||
|
|||
if (client.FindSecret(secret) == null) |
|||
{ |
|||
client.AddSecret(secret); |
|||
} |
|||
|
|||
if (redirectUri != null) |
|||
{ |
|||
if (client.FindRedirectUri(redirectUri) == null) |
|||
{ |
|||
client.AddRedirectUri(redirectUri); |
|||
} |
|||
} |
|||
|
|||
if (postLogoutRedirectUri != null) |
|||
{ |
|||
if (client.FindPostLogoutRedirectUri(postLogoutRedirectUri) == null) |
|||
{ |
|||
client.AddPostLogoutRedirectUri(postLogoutRedirectUri); |
|||
} |
|||
} |
|||
|
|||
if (permissions != null) |
|||
{ |
|||
await _permissionDataSeeder.SeedAsync( |
|||
ClientPermissionValueProvider.ProviderName, |
|||
name, |
|||
permissions |
|||
); |
|||
} |
|||
|
|||
return await _clientRepository.UpdateAsync(client); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
using Volo.Abp.Settings; |
|||
|
|||
namespace Acme.BookStore.Settings |
|||
{ |
|||
public class BookStoreSettingDefinitionProvider : SettingDefinitionProvider |
|||
{ |
|||
public override void Define(ISettingDefinitionContext context) |
|||
{ |
|||
//Define your own settings here. Example:
|
|||
//context.Add(new SettingDefinition(BookStoreSettings.MySetting1));
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
namespace Acme.BookStore.Settings |
|||
{ |
|||
public static class BookStoreSettings |
|||
{ |
|||
private const string Prefix = "BookStore"; |
|||
|
|||
//Add your own setting names here. Example:
|
|||
//public const string MySetting1 = Prefix + ".MySetting1";
|
|||
} |
|||
} |
|||
@ -0,0 +1,53 @@ |
|||
using System; |
|||
using Volo.Abp.Domain.Entities.Auditing; |
|||
using Volo.Abp.Users; |
|||
|
|||
namespace Acme.BookStore.Users |
|||
{ |
|||
/* This entity shares the same table/collection ("AbpUsers" by default) with the |
|||
* IdentityUser entity of the Identity module. |
|||
* |
|||
* - You can define your custom properties into this class. |
|||
* - You never create or delete this entity, because it is Identity module's job. |
|||
* - You can query users from database with this entity. |
|||
* - You can update values of your custom properties. |
|||
*/ |
|||
public class AppUser : FullAuditedAggregateRoot<Guid>, IUser |
|||
{ |
|||
#region Base properties
|
|||
|
|||
/* These properties are shared with the IdentityUser entity of the Identity module. |
|||
* Do not change these properties through this class. Instead, use Identity module |
|||
* services (like IdentityUserManager) to change them. |
|||
* So, this properties are designed as read only! |
|||
*/ |
|||
|
|||
public virtual Guid? TenantId { get; private set; } |
|||
|
|||
public virtual string UserName { get; private set; } |
|||
|
|||
public virtual string Name { get; private set; } |
|||
|
|||
public virtual string Surname { get; private set; } |
|||
|
|||
public virtual string Email { get; private set; } |
|||
|
|||
public virtual bool EmailConfirmed { get; private set; } |
|||
|
|||
public virtual string PhoneNumber { get; private set; } |
|||
|
|||
public virtual bool PhoneNumberConfirmed { get; private set; } |
|||
|
|||
#endregion
|
|||
|
|||
/* Add your own properties here. Example: |
|||
* |
|||
* public virtual string MyProperty { get; set; } |
|||
*/ |
|||
|
|||
private AppUser() |
|||
{ |
|||
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netcoreapp2.2</TargetFramework> |
|||
<RootNamespace>Acme.BookStore</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\Acme.BookStore.EntityFrameworkCore\Acme.BookStore.EntityFrameworkCore.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.2.6" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,16 @@ |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace Acme.BookStore.EntityFrameworkCore |
|||
{ |
|||
[DependsOn( |
|||
typeof(BookStoreEntityFrameworkCoreModule) |
|||
)] |
|||
public class BookStoreEntityFrameworkCoreDbMigrationsModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
context.Services.AddAbpDbContext<BookStoreMigrationsDbContext>(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,55 @@ |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Volo.Abp.AuditLogging.EntityFrameworkCore; |
|||
using Volo.Abp.BackgroundJobs.EntityFrameworkCore; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
using Volo.Abp.FeatureManagement.EntityFrameworkCore; |
|||
using Volo.Abp.Identity; |
|||
using Volo.Abp.Identity.EntityFrameworkCore; |
|||
using Volo.Abp.IdentityServer.EntityFrameworkCore; |
|||
using Volo.Abp.PermissionManagement.EntityFrameworkCore; |
|||
using Volo.Abp.SettingManagement.EntityFrameworkCore; |
|||
using Volo.Abp.TenantManagement.EntityFrameworkCore; |
|||
|
|||
namespace Acme.BookStore.EntityFrameworkCore |
|||
{ |
|||
/* This DbContext is only used for database migrations. |
|||
* It is not used on runtime. See BookStoreDbContext for the runtime DbContext. |
|||
* It is a unified model that includes configuration for |
|||
* all used modules and your application. |
|||
*/ |
|||
public class BookStoreMigrationsDbContext : AbpDbContext<BookStoreMigrationsDbContext> |
|||
{ |
|||
public BookStoreMigrationsDbContext(DbContextOptions<BookStoreMigrationsDbContext> options) |
|||
: base(options) |
|||
{ |
|||
|
|||
} |
|||
|
|||
protected override void OnModelCreating(ModelBuilder builder) |
|||
{ |
|||
base.OnModelCreating(builder); |
|||
|
|||
/* Include modules to your migration db context */ |
|||
|
|||
builder.ConfigurePermissionManagement(); |
|||
builder.ConfigureSettingManagement(); |
|||
builder.ConfigureBackgroundJobs(); |
|||
builder.ConfigureAuditLogging(); |
|||
builder.ConfigureIdentity(); |
|||
builder.ConfigureIdentityServer(); |
|||
builder.ConfigureFeatureManagement(); |
|||
builder.ConfigureTenantManagement(); |
|||
|
|||
/* Configure customizations for entities from the modules included */ |
|||
|
|||
builder.Entity<IdentityUser>(b => |
|||
{ |
|||
b.ConfigureCustomUserProperties(); |
|||
}); |
|||
|
|||
/* Configure your own tables/entities inside the ConfigureBookStore method */ |
|||
|
|||
builder.ConfigureBookStore(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,31 @@ |
|||
using System.IO; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore.Design; |
|||
using Microsoft.Extensions.Configuration; |
|||
|
|||
namespace Acme.BookStore.EntityFrameworkCore |
|||
{ |
|||
/* This class is needed for EF Core console commands |
|||
* (like Add-Migration and Update-Database commands) */ |
|||
public class BookStoreMigrationsDbContextFactory : IDesignTimeDbContextFactory<BookStoreMigrationsDbContext> |
|||
{ |
|||
public BookStoreMigrationsDbContext CreateDbContext(string[] args) |
|||
{ |
|||
var configuration = BuildConfiguration(); |
|||
|
|||
var builder = new DbContextOptionsBuilder<BookStoreMigrationsDbContext>() |
|||
.UseSqlServer(configuration.GetConnectionString("Default")); |
|||
|
|||
return new BookStoreMigrationsDbContext(builder.Options); |
|||
} |
|||
|
|||
private static IConfigurationRoot BuildConfiguration() |
|||
{ |
|||
var builder = new ConfigurationBuilder() |
|||
.SetBasePath(Directory.GetCurrentDirectory()) |
|||
.AddJsonFile("appsettings.json", optional: false); |
|||
|
|||
return builder.Build(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,24 @@ |
|||
using System.Threading.Tasks; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Acme.BookStore.Data; |
|||
using Volo.Abp.DependencyInjection; |
|||
|
|||
namespace Acme.BookStore.EntityFrameworkCore |
|||
{ |
|||
[Dependency(ReplaceServices = true)] |
|||
public class EntityFrameworkCoreBookStoreDbSchemaMigrator |
|||
: IBookStoreDbSchemaMigrator, ITransientDependency |
|||
{ |
|||
private readonly BookStoreMigrationsDbContext _dbContext; |
|||
|
|||
public EntityFrameworkCoreBookStoreDbSchemaMigrator(BookStoreMigrationsDbContext dbContext) |
|||
{ |
|||
_dbContext = dbContext; |
|||
} |
|||
|
|||
public async Task MigrateAsync() |
|||
{ |
|||
await _dbContext.Database.MigrateAsync(); |
|||
} |
|||
} |
|||
} |
|||
File diff suppressed because it is too large
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -0,0 +1,24 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netcoreapp2.2</TargetFramework> |
|||
<RootNamespace>Acme.BookStore</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\Acme.BookStore.Domain\Acme.BookStore.Domain.csproj" /> |
|||
<PackageReference Include="Volo.Abp.EntityFrameworkCore.SqlServer" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.PermissionManagement.EntityFrameworkCore" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.SettingManagement.EntityFrameworkCore" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.Identity.EntityFrameworkCore" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.IdentityServer.EntityFrameworkCore" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.BackgroundJobs.EntityFrameworkCore" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.AuditLogging.EntityFrameworkCore" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.TenantManagement.EntityFrameworkCore" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.FeatureManagement.EntityFrameworkCore" Version="0.19.0" /> |
|||
<ProjectReference Include="..\..\..\modules\book-management\src\Acme.BookStore.BookManagement.EntityFrameworkCore\Acme.BookStore.BookManagement.EntityFrameworkCore.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,55 @@ |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Acme.BookStore.Users; |
|||
using Volo.Abp.Data; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
using Volo.Abp.EntityFrameworkCore.Modeling; |
|||
using Volo.Abp.Users.EntityFrameworkCore; |
|||
|
|||
namespace Acme.BookStore.EntityFrameworkCore |
|||
{ |
|||
/* This is your actual DbContext used on runtime. |
|||
* It includes only your entities. |
|||
* It does not include entities of the used modules, because each module has already |
|||
* its own DbContext class. If you want to share some database tables with the used modules, |
|||
* just create a structure like done for AppUser. |
|||
* |
|||
* Don't use this DbContext for database migrations since it does not contain tables of the |
|||
* used modules (as explained above). See BookStoreMigrationsDbContext for migrations. |
|||
*/ |
|||
[ConnectionStringName("Default")] |
|||
public class BookStoreDbContext : AbpDbContext<BookStoreDbContext> |
|||
{ |
|||
public DbSet<AppUser> Users { get; set; } |
|||
|
|||
/* Add DbSet properties for your Aggregate Roots / Entities here. |
|||
* Also map them inside BookStoreDbContextModelCreatingExtensions.ConfigureBookStore |
|||
*/ |
|||
|
|||
public BookStoreDbContext(DbContextOptions<BookStoreDbContext> options) |
|||
: base(options) |
|||
{ |
|||
|
|||
} |
|||
|
|||
protected override void OnModelCreating(ModelBuilder builder) |
|||
{ |
|||
base.OnModelCreating(builder); |
|||
|
|||
/* Configure the shared tables (with included modules) here */ |
|||
|
|||
builder.Entity<AppUser>(b => |
|||
{ |
|||
b.ToTable("AbpUsers"); //Sharing the same table "AbpUsers" with the IdentityUser
|
|||
b.ConfigureByConvention(); |
|||
b.ConfigureAbpUser(); |
|||
|
|||
//Moved customization to a method so we can share it with the BookStoreMigrationsDbContext class
|
|||
b.ConfigureCustomUserProperties(); |
|||
}); |
|||
|
|||
/* Configure your own tables/entities inside the ConfigureBookStore method */ |
|||
|
|||
builder.ConfigureBookStore(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,30 @@ |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore.Metadata.Builders; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Users; |
|||
|
|||
namespace Acme.BookStore.EntityFrameworkCore |
|||
{ |
|||
public static class BookStoreDbContextModelCreatingExtensions |
|||
{ |
|||
public static void ConfigureBookStore(this ModelBuilder builder) |
|||
{ |
|||
Check.NotNull(builder, nameof(builder)); |
|||
|
|||
/* Configure your own tables/entities inside here */ |
|||
|
|||
//builder.Entity<YourEntity>(b =>
|
|||
//{
|
|||
// b.ToTable(BookStoreConsts.DbTablePrefix + "YourEntities", BookStoreConsts.DbSchema);
|
|||
|
|||
// //...
|
|||
//});
|
|||
} |
|||
|
|||
public static void ConfigureCustomUserProperties<TUser>(this EntityTypeBuilder<TUser> b) |
|||
where TUser: class, IUser |
|||
{ |
|||
//b.Property<string>(nameof(AppUser.MyProperty))...
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,49 @@ |
|||
using Acme.BookStore.BookManagement.EntityFrameworkCore; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp.AuditLogging.EntityFrameworkCore; |
|||
using Volo.Abp.BackgroundJobs.EntityFrameworkCore; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
using Volo.Abp.EntityFrameworkCore.SqlServer; |
|||
using Volo.Abp.FeatureManagement.EntityFrameworkCore; |
|||
using Volo.Abp.Identity.EntityFrameworkCore; |
|||
using Volo.Abp.IdentityServer.EntityFrameworkCore; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.PermissionManagement.EntityFrameworkCore; |
|||
using Volo.Abp.SettingManagement.EntityFrameworkCore; |
|||
using Volo.Abp.TenantManagement.EntityFrameworkCore; |
|||
|
|||
namespace Acme.BookStore.EntityFrameworkCore |
|||
{ |
|||
[DependsOn( |
|||
typeof(BookStoreDomainModule), |
|||
typeof(AbpIdentityEntityFrameworkCoreModule), |
|||
typeof(AbpIdentityServerEntityFrameworkCoreModule), |
|||
typeof(AbpPermissionManagementEntityFrameworkCoreModule), |
|||
typeof(AbpSettingManagementEntityFrameworkCoreModule), |
|||
typeof(AbpEntityFrameworkCoreSqlServerModule), |
|||
typeof(BackgroundJobsEntityFrameworkCoreModule), |
|||
typeof(AbpAuditLoggingEntityFrameworkCoreModule), |
|||
typeof(AbpTenantManagementEntityFrameworkCoreModule), |
|||
typeof(AbpFeatureManagementEntityFrameworkCoreModule), |
|||
typeof(BookManagementEntityFrameworkCoreModule) |
|||
)] |
|||
public class BookStoreEntityFrameworkCoreModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
context.Services.AddAbpDbContext<BookStoreDbContext>(options => |
|||
{ |
|||
/* Remove "includeAllEntities: true" to create |
|||
* default repositories only for aggregate roots */ |
|||
options.AddDefaultRepositories(includeAllEntities: true); |
|||
}); |
|||
|
|||
Configure<AbpDbContextOptions>(options => |
|||
{ |
|||
/* The main point to change your DBMS. |
|||
* See also BookStoreMigrationsDbContextFactory for EF Core tooling. */ |
|||
options.UseSqlServer(); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netstandard2.0</TargetFramework> |
|||
<RootNamespace>Acme.BookStore</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\Acme.BookStore.Application.Contracts\Acme.BookStore.Application.Contracts.csproj" /> |
|||
<ProjectReference Include="..\..\..\modules\book-management\src\Acme.BookStore.BookManagement.HttpApi.Client\Acme.BookStore.BookManagement.HttpApi.Client.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.Account.HttpApi.Client" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.Identity.HttpApi.Client" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.PermissionManagement.HttpApi.Client" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.TenantManagement.HttpApi.Client" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.FeatureManagement.HttpApi.Client" Version="0.19.0" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,33 @@ |
|||
using Acme.BookStore.BookManagement; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp.Account; |
|||
using Volo.Abp.FeatureManagement; |
|||
using Volo.Abp.Identity; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.PermissionManagement; |
|||
using Volo.Abp.TenantManagement; |
|||
|
|||
namespace Acme.BookStore |
|||
{ |
|||
[DependsOn( |
|||
typeof(BookStoreApplicationContractsModule), |
|||
typeof(AbpAccountHttpApiClientModule), |
|||
typeof(AbpIdentityHttpApiClientModule), |
|||
typeof(AbpPermissionManagementHttpApiClientModule), |
|||
typeof(AbpTenantManagementHttpApiClientModule), |
|||
typeof(AbpFeatureManagementHttpApiClientModule), |
|||
typeof(BookManagementHttpApiClientModule) |
|||
)] |
|||
public class BookStoreHttpApiClientModule : AbpModule |
|||
{ |
|||
public const string RemoteServiceName = "Default"; |
|||
|
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
context.Services.AddHttpClientProxies( |
|||
typeof(BookStoreApplicationContractsModule).Assembly, |
|||
RemoteServiceName |
|||
); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netcoreapp2.2</TargetFramework> |
|||
<RootNamespace>Acme.BookStore</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\Acme.BookStore.Application.Contracts\Acme.BookStore.Application.Contracts.csproj" /> |
|||
<ProjectReference Include="..\..\..\modules\book-management\src\Acme.BookStore.BookManagement.HttpApi\Acme.BookStore.BookManagement.HttpApi.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Volo.Abp.Account.HttpApi" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.Identity.HttpApi" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.PermissionManagement.HttpApi" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.TenantManagement.HttpApi" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.FeatureManagement.HttpApi" Version="0.19.0" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,24 @@ |
|||
using Acme.BookStore.BookManagement; |
|||
using Volo.Abp.Account; |
|||
using Volo.Abp.FeatureManagement; |
|||
using Volo.Abp.Identity; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.PermissionManagement.HttpApi; |
|||
using Volo.Abp.TenantManagement; |
|||
|
|||
namespace Acme.BookStore |
|||
{ |
|||
[DependsOn( |
|||
typeof(BookStoreApplicationContractsModule), |
|||
typeof(AbpAccountHttpApiModule), |
|||
typeof(AbpIdentityHttpApiModule), |
|||
typeof(AbpPermissionManagementHttpApiModule), |
|||
typeof(AbpTenantManagementHttpApiModule), |
|||
typeof(AbpFeatureManagementHttpApiModule), |
|||
typeof(BookManagementHttpApiModule) |
|||
)] |
|||
public class BookStoreHttpApiModule : AbpModule |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
using Acme.BookStore.Localization; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
|
|||
namespace Acme.BookStore.Controllers |
|||
{ |
|||
/* Inherit your controllers from this class. |
|||
*/ |
|||
public abstract class BookStoreController : AbpController |
|||
{ |
|||
protected BookStoreController() |
|||
{ |
|||
LocalizationResource = typeof(BookStoreResource); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,28 @@ |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Acme.BookStore.Models.Test; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Acme.BookStore.Controllers |
|||
{ |
|||
[Route("api/test")] |
|||
public class TestController : BookStoreController |
|||
{ |
|||
public TestController() |
|||
{ |
|||
|
|||
} |
|||
|
|||
[HttpGet] |
|||
[Route("")] |
|||
public async Task<List<TestModel>> GetAsync() |
|||
{ |
|||
return new List<TestModel> |
|||
{ |
|||
new TestModel {Name = "John", BirthDate = new DateTime(1942, 11, 18)}, |
|||
new TestModel {Name = "Adams", BirthDate = new DateTime(1997, 05, 24)} |
|||
}; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
using System; |
|||
|
|||
namespace Acme.BookStore.Models.Test |
|||
{ |
|||
public class TestModel |
|||
{ |
|||
public string Name { get; set; } |
|||
|
|||
public DateTime BirthDate { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,57 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk.Web"> |
|||
|
|||
<Import Project="..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netcoreapp2.2</TargetFramework> |
|||
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel> |
|||
<RootNamespace>Acme.BookStore.Web</RootNamespace> |
|||
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> |
|||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> |
|||
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType> |
|||
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles> |
|||
<PreserveCompilationContext>true</PreserveCompilationContext> |
|||
<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<Compile Remove="Logs\**" /> |
|||
<Content Remove="Logs\**" /> |
|||
<EmbeddedResource Remove="Logs\**" /> |
|||
<None Remove="Logs\**" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<None Update="Pages\**\*.js"> |
|||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
|||
</None> |
|||
<None Update="Pages\**\*.css"> |
|||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
|||
</None> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Microsoft.AspNetCore.App" /> |
|||
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" /> |
|||
<PackageReference Include="Serilog.AspNetCore" Version="2.1.1" /> |
|||
<PackageReference Include="Serilog.Sinks.File" Version="4.0.0" /> |
|||
<PackageReference Include="Serilog.Sinks.Async" Version="1.4.0" /> |
|||
<PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" /> |
|||
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="2.7.0" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\..\modules\book-management\src\Acme.BookStore.BookManagement.Web\Acme.BookStore.BookManagement.Web.csproj" /> |
|||
<ProjectReference Include="..\Acme.BookStore.Application\Acme.BookStore.Application.csproj" /> |
|||
<ProjectReference Include="..\Acme.BookStore.HttpApi\Acme.BookStore.HttpApi.csproj" /> |
|||
<ProjectReference Include="..\Acme.BookStore.EntityFrameworkCore.DbMigrations\Acme.BookStore.EntityFrameworkCore.DbMigrations.csproj" /> |
|||
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.Autofac" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.AspNetCore.Authentication.JwtBearer" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.Identity.Web" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.Account.Web.IdentityServer" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.TenantManagement.Web" Version="0.19.0" /> |
|||
<PackageReference Include="Volo.Abp.FeatureManagement.Web" Version="0.19.0" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,11 @@ |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Components; |
|||
using Volo.Abp.DependencyInjection; |
|||
|
|||
namespace Acme.BookStore.Web |
|||
{ |
|||
[Dependency(ReplaceServices = true)] |
|||
public class BookStoreBrandingProvider : DefaultBrandingProvider |
|||
{ |
|||
public override string AppName => "BookStore"; |
|||
} |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
using AutoMapper; |
|||
|
|||
namespace Acme.BookStore.Web |
|||
{ |
|||
public class BookStoreWebAutoMapperProfile : Profile |
|||
{ |
|||
public BookStoreWebAutoMapperProfile() |
|||
{ |
|||
//Define your AutoMapper configuration here for the Web project.
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,207 @@ |
|||
using System.IO; |
|||
using Acme.BookStore.BookManagement.Web; |
|||
using Localization.Resources.AbpUi; |
|||
using Microsoft.AspNetCore.Builder; |
|||
using Microsoft.AspNetCore.Hosting; |
|||
using Microsoft.Extensions.Configuration; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Acme.BookStore.EntityFrameworkCore; |
|||
using Acme.BookStore.Localization; |
|||
using Acme.BookStore.MultiTenancy; |
|||
using Acme.BookStore.Web.Menus; |
|||
using Swashbuckle.AspNetCore.Swagger; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Account.Web; |
|||
using Volo.Abp.AspNetCore.Authentication.JwtBearer; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
using Volo.Abp.AspNetCore.Mvc.Localization; |
|||
using Volo.Abp.AspNetCore.Mvc.UI; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; |
|||
using Volo.Abp.Autofac; |
|||
using Volo.Abp.AutoMapper; |
|||
using Volo.Abp.Identity.Web; |
|||
using Volo.Abp.Localization; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.PermissionManagement.Web; |
|||
using Volo.Abp.TenantManagement.Web; |
|||
using Volo.Abp.UI.Navigation.Urls; |
|||
using Volo.Abp.UI; |
|||
using Volo.Abp.UI.Navigation; |
|||
using Volo.Abp.VirtualFileSystem; |
|||
|
|||
namespace Acme.BookStore.Web |
|||
{ |
|||
[DependsOn( |
|||
typeof(BookStoreHttpApiModule), |
|||
typeof(BookStoreApplicationModule), |
|||
typeof(BookStoreEntityFrameworkCoreDbMigrationsModule), |
|||
typeof(AbpAutofacModule), |
|||
typeof(AbpIdentityWebModule), |
|||
typeof(AbpAccountWebIdentityServerModule), |
|||
typeof(AbpAspNetCoreMvcUiBasicThemeModule), |
|||
typeof(AbpAspNetCoreAuthenticationJwtBearerModule), |
|||
typeof(AbpTenantManagementWebModule), |
|||
typeof(BookManagementWebModule) |
|||
)] |
|||
public class BookStoreWebModule : AbpModule |
|||
{ |
|||
public override void PreConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
context.Services.PreConfigure<AbpMvcDataAnnotationsLocalizationOptions>(options => |
|||
{ |
|||
options.AddAssemblyResource( |
|||
typeof(BookStoreResource), |
|||
typeof(BookStoreDomainModule).Assembly, |
|||
typeof(BookStoreDomainSharedModule).Assembly, |
|||
typeof(BookStoreApplicationModule).Assembly, |
|||
typeof(BookStoreApplicationContractsModule).Assembly, |
|||
typeof(BookStoreWebModule).Assembly |
|||
); |
|||
}); |
|||
} |
|||
|
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
var hostingEnvironment = context.Services.GetHostingEnvironment(); |
|||
var configuration = context.Services.GetConfiguration(); |
|||
|
|||
ConfigureUrls(configuration); |
|||
ConfigureAuthentication(context, configuration); |
|||
ConfigureAutoMapper(); |
|||
ConfigureVirtualFileSystem(hostingEnvironment); |
|||
ConfigureLocalizationServices(); |
|||
ConfigureNavigationServices(); |
|||
ConfigureAutoApiControllers(); |
|||
ConfigureSwaggerServices(context.Services); |
|||
} |
|||
|
|||
private void ConfigureUrls(IConfigurationRoot configuration) |
|||
{ |
|||
Configure<AppUrlOptions>(options => |
|||
{ |
|||
options.Applications["MVC"].RootUrl = configuration["App:SelfUrl"]; |
|||
}); |
|||
} |
|||
|
|||
private void ConfigureAuthentication(ServiceConfigurationContext context, IConfigurationRoot configuration) |
|||
{ |
|||
context.Services.AddAuthentication() |
|||
.AddIdentityServerAuthentication(options => |
|||
{ |
|||
options.Authority = configuration["AuthServer:Authority"]; |
|||
options.RequireHttpsMetadata = false; |
|||
options.ApiName = "BookStore"; |
|||
}); |
|||
} |
|||
|
|||
private void ConfigureAutoMapper() |
|||
{ |
|||
Configure<AbpAutoMapperOptions>(options => |
|||
{ |
|||
/* use `true` for the `validate` parameter if you want to |
|||
* validate the profile on application startup. |
|||
* See http://docs.automapper.org/en/stable/Configuration-validation.html for more
|
|||
* about configuration validation. |
|||
*/ |
|||
options.AddProfile<BookStoreWebAutoMapperProfile>(); |
|||
}); |
|||
} |
|||
|
|||
private void ConfigureVirtualFileSystem(IHostingEnvironment hostingEnvironment) |
|||
{ |
|||
if (hostingEnvironment.IsDevelopment()) |
|||
{ |
|||
Configure<VirtualFileSystemOptions>(options => |
|||
{ |
|||
options.FileSets.ReplaceEmbeddedByPhysical<BookStoreDomainSharedModule>(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}Acme.BookStore.Domain.Shared")); |
|||
options.FileSets.ReplaceEmbeddedByPhysical<BookStoreDomainModule>(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}Acme.BookStore.Domain")); |
|||
options.FileSets.ReplaceEmbeddedByPhysical<BookStoreApplicationContractsModule>(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}Acme.BookStore.Application.Contracts")); |
|||
options.FileSets.ReplaceEmbeddedByPhysical<BookStoreApplicationModule>(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}Acme.BookStore.Application")); |
|||
options.FileSets.ReplaceEmbeddedByPhysical<BookStoreWebModule>(hostingEnvironment.ContentRootPath); |
|||
}); |
|||
} |
|||
} |
|||
|
|||
private void ConfigureLocalizationServices() |
|||
{ |
|||
Configure<AbpLocalizationOptions>(options => |
|||
{ |
|||
options.Resources |
|||
.Get<BookStoreResource>() |
|||
.AddBaseTypes( |
|||
typeof(AbpUiResource) |
|||
); |
|||
|
|||
options.Languages.Add(new LanguageInfo("cs", "cs", "Čeština")); |
|||
options.Languages.Add(new LanguageInfo("en", "en", "English")); |
|||
options.Languages.Add(new LanguageInfo("pt-BR", "pt-BR", "Português")); |
|||
options.Languages.Add(new LanguageInfo("tr", "tr", "Türkçe")); |
|||
options.Languages.Add(new LanguageInfo("zh-Hans", "zh-Hans", "简体中文")); |
|||
}); |
|||
} |
|||
|
|||
private void ConfigureNavigationServices() |
|||
{ |
|||
Configure<NavigationOptions>(options => |
|||
{ |
|||
options.MenuContributors.Add(new BookStoreMenuContributor()); |
|||
}); |
|||
} |
|||
|
|||
private void ConfigureAutoApiControllers() |
|||
{ |
|||
Configure<AbpAspNetCoreMvcOptions>(options => |
|||
{ |
|||
options.ConventionalControllers.Create(typeof(BookStoreApplicationModule).Assembly); |
|||
}); |
|||
} |
|||
|
|||
private void ConfigureSwaggerServices(IServiceCollection services) |
|||
{ |
|||
services.AddSwaggerGen( |
|||
options => |
|||
{ |
|||
options.SwaggerDoc("v1", new Info { Title = "BookStore API", Version = "v1" }); |
|||
options.DocInclusionPredicate((docName, description) => true); |
|||
options.CustomSchemaIds(type => type.FullName); |
|||
} |
|||
); |
|||
} |
|||
|
|||
public override void OnApplicationInitialization(ApplicationInitializationContext context) |
|||
{ |
|||
var app = context.GetApplicationBuilder(); |
|||
var env = context.GetEnvironment(); |
|||
|
|||
if (env.IsDevelopment()) |
|||
{ |
|||
app.UseDeveloperExceptionPage(); |
|||
} |
|||
else |
|||
{ |
|||
app.UseErrorPage(); |
|||
} |
|||
|
|||
app.UseVirtualFiles(); |
|||
app.UseAuthentication(); |
|||
app.UseJwtTokenMiddleware(); |
|||
|
|||
if (MultiTenancyConsts.IsEnabled) |
|||
{ |
|||
app.UseMultiTenancy(); |
|||
} |
|||
|
|||
app.UseIdentityServer(); |
|||
app.UseAbpRequestLocalization(); |
|||
app.UseSwagger(); |
|||
app.UseSwaggerUI(options => |
|||
{ |
|||
options.SwaggerEndpoint("/swagger/v1/swagger.json", "BookStore API"); |
|||
}); |
|||
app.UseAuditing(); |
|||
app.UseMvcWithDefaultRouteAndArea(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,34 @@ |
|||
using System.Threading.Tasks; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Microsoft.Extensions.Localization; |
|||
using Acme.BookStore.Localization; |
|||
using Acme.BookStore.MultiTenancy; |
|||
using Volo.Abp.TenantManagement.Web.Navigation; |
|||
using Volo.Abp.UI.Navigation; |
|||
|
|||
namespace Acme.BookStore.Web.Menus |
|||
{ |
|||
public class BookStoreMenuContributor : IMenuContributor |
|||
{ |
|||
public async Task ConfigureMenuAsync(MenuConfigurationContext context) |
|||
{ |
|||
if (context.Menu.Name == StandardMenus.Main) |
|||
{ |
|||
await ConfigureMainMenuAsync(context); |
|||
} |
|||
} |
|||
|
|||
private async Task ConfigureMainMenuAsync(MenuConfigurationContext context) |
|||
{ |
|||
if (!MultiTenancyConsts.IsEnabled) |
|||
{ |
|||
var administration = context.Menu.GetAdministration(); |
|||
administration.TryRemoveMenuItem(TenantManagementMenuNames.GroupName); |
|||
} |
|||
|
|||
var l = context.ServiceProvider.GetRequiredService<IStringLocalizer<BookStoreResource>>(); |
|||
|
|||
context.Menu.Items.Insert(0, new ApplicationMenuItem("BookStore.Home", l["Menu:Home"], "/")); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
using Microsoft.AspNetCore.Mvc.Localization; |
|||
using Microsoft.AspNetCore.Mvc.Razor.Internal; |
|||
using Acme.BookStore.Localization; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; |
|||
|
|||
namespace Acme.BookStore.Web.Pages |
|||
{ |
|||
/* Inherit your UI Pages from this class. To do that, add this line to your Pages (.cshtml files under the Page folder): |
|||
* @inherits Acme.BookStore.Web.Pages.BookStorePage |
|||
*/ |
|||
public abstract class BookStorePage : AbpPage |
|||
{ |
|||
[RazorInject] |
|||
public IHtmlLocalizer<BookStoreResource> L { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
using Acme.BookStore.Localization; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; |
|||
|
|||
namespace Acme.BookStore.Web.Pages |
|||
{ |
|||
/* Inherit your PageModel classes from this class. |
|||
*/ |
|||
public abstract class BookStorePageModel : AbpPageModel |
|||
{ |
|||
protected BookStorePageModel() |
|||
{ |
|||
LocalizationResourceType = typeof(BookStoreResource); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
@page |
|||
@inherits Acme.BookStore.Web.Pages.BookStorePage |
|||
@model Acme.BookStore.Web.Pages.IndexModel |
|||
@section styles { |
|||
<abp-style-bundle> |
|||
<abp-style src="/Pages/Index.css" /> |
|||
</abp-style-bundle> |
|||
} |
|||
@section scripts { |
|||
<abp-script-bundle> |
|||
<abp-script src="/Pages/Index.js" /> |
|||
</abp-script-bundle> |
|||
} |
|||
<abp-card> |
|||
<abp-card-header>@L["Welcome"]</abp-card-header> |
|||
<abp-card-body> |
|||
<p>@L["LongWelcomeMessage"]</p> |
|||
@if (!CurrentUser.IsAuthenticated) |
|||
{ |
|||
<p><a abp-button="Primary" href="/Account/Login"><i class="fa fa-sign-in"></i> @L["Login"]</a></p> |
|||
} |
|||
<hr /> |
|||
<p class="text-right"><a href="https://abp.io?ref=tmpl" target="_blank">abp.io</a></p> |
|||
</abp-card-body> |
|||
</abp-card> |
|||
@ -0,0 +1,10 @@ |
|||
namespace Acme.BookStore.Web.Pages |
|||
{ |
|||
public class IndexModel : BookStorePageModel |
|||
{ |
|||
public void OnGet() |
|||
{ |
|||
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,3 @@ |
|||
body { |
|||
|
|||
} |
|||
@ -0,0 +1,3 @@ |
|||
$(function () { |
|||
abp.log.debug('Index.js initialized!'); |
|||
}); |
|||
@ -0,0 +1,4 @@ |
|||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bundling |
|||
@ -0,0 +1,54 @@ |
|||
using System; |
|||
using System.IO; |
|||
using Microsoft.AspNetCore.Hosting; |
|||
using Microsoft.AspNetCore.InProcess; |
|||
using Serilog; |
|||
using Serilog.Events; |
|||
|
|||
namespace Acme.BookStore.Web |
|||
{ |
|||
public class Program |
|||
{ |
|||
public static int Main(string[] args) |
|||
{ |
|||
CurrentDirectoryHelpers.SetCurrentDirectory(); |
|||
|
|||
Log.Logger = new LoggerConfiguration() |
|||
#if DEBUG
|
|||
.MinimumLevel.Debug() |
|||
#else
|
|||
.MinimumLevel.Information() |
|||
#endif
|
|||
.MinimumLevel.Override("Microsoft", LogEventLevel.Information) |
|||
.Enrich.FromLogContext() |
|||
.WriteTo.Async(c => c.File("Logs/logs.txt")) |
|||
.CreateLogger(); |
|||
|
|||
try |
|||
{ |
|||
Log.Information("Starting web host."); |
|||
BuildWebHostInternal(args).Run(); |
|||
return 0; |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
Log.Fatal(ex, "Host terminated unexpectedly!"); |
|||
return 1; |
|||
} |
|||
finally |
|||
{ |
|||
Log.CloseAndFlush(); |
|||
} |
|||
} |
|||
|
|||
public static IWebHost BuildWebHostInternal(string[] args) => |
|||
new WebHostBuilder() |
|||
.UseKestrel() |
|||
.UseContentRoot(Directory.GetCurrentDirectory()) |
|||
.UseIIS() |
|||
.UseIISIntegration() |
|||
.UseStartup<Startup>() |
|||
.UseSerilog() |
|||
.Build(); |
|||
} |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
{ |
|||
"iisSettings": { |
|||
"windowsAuthentication": false, |
|||
"anonymousAuthentication": true, |
|||
"iisExpress": { |
|||
"applicationUrl": "https://localhost:44388/", |
|||
"sslPort": 44388 |
|||
} |
|||
}, |
|||
"profiles": { |
|||
"IIS Express": { |
|||
"commandName": "IISExpress", |
|||
"launchBrowser": true, |
|||
"environmentVariables": { |
|||
"ASPNETCORE_ENVIRONMENT": "Development" |
|||
} |
|||
}, |
|||
"Acme.BookStore.Web": { |
|||
"commandName": "Project", |
|||
"launchBrowser": true, |
|||
"environmentVariables": { |
|||
"ASPNETCORE_ENVIRONMENT": "Development" |
|||
}, |
|||
"applicationUrl": "https://localhost:44388/" |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
using System; |
|||
using Microsoft.AspNetCore.Builder; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Microsoft.Extensions.Logging; |
|||
using Volo.Abp; |
|||
|
|||
namespace Acme.BookStore.Web |
|||
{ |
|||
public class Startup |
|||
{ |
|||
public IServiceProvider ConfigureServices(IServiceCollection services) |
|||
{ |
|||
services.AddApplication<BookStoreWebModule>(options => |
|||
{ |
|||
options.UseAutofac(); |
|||
}); |
|||
|
|||
return services.BuildServiceProviderFromFactory(); |
|||
} |
|||
|
|||
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory) |
|||
{ |
|||
app.InitializeApplication(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,4 @@ |
|||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap |
|||
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bundling |
|||
@ -0,0 +1,8 @@ |
|||
module.exports = { |
|||
aliases: { |
|||
|
|||
}, |
|||
mappings: { |
|||
|
|||
} |
|||
}; |
|||
@ -0,0 +1,2 @@ |
|||
{ |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
{ |
|||
"App": { |
|||
"SelfUrl": "https://localhost:44388" |
|||
}, |
|||
"ConnectionStrings": { |
|||
"Default": "Server=localhost;Database=BookStore;Trusted_Connection=True;MultipleActiveResultSets=true" |
|||
}, |
|||
"AuthServer": { |
|||
"Authority": "https://localhost:44388" |
|||
}, |
|||
"IdentityServer": { |
|||
"Clients": { |
|||
"BookStore_App": { |
|||
"ClientId": "BookStore_App" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
"use strict"; |
|||
|
|||
var gulp = require("gulp"), |
|||
path = require('path'), |
|||
copyResources = require('./node_modules/@abp/aspnetcore.mvc.ui/gulp/copy-resources.js'); |
|||
|
|||
exports.default = function(){ |
|||
return copyResources(path.resolve('./')); |
|||
}; |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"version": "1.0.0", |
|||
"name": "my-app", |
|||
"private": true, |
|||
"dependencies": { |
|||
"@abp/aspnetcore.mvc.ui.theme.basic": "^0.8.0" |
|||
} |
|||
} |
|||
@ -0,0 +1 @@ |
|||
{"KeyId":"ac0d2edf3c04d13cd95cc41b9b33ab03","Parameters":{"D":"FFymEWbX3XBT5YnTngOKwtz3XKsyaQbyDvvw9jbmkdvLKUmrb1hkmylqVYwU/3G1u79rrD8AZXJDoYVLegyZymK/iNeePMLI4i5vScF7PdQXn/g6CvQ8j3J60YYyfDWuxjBH8nCEUIfQIv14BpcH6CWi1BVZUbnbWcpe2ji8D5I3FHOZpvksQztst5eE836ODdN9jgk35kgrdUQ14MEFHA6m6fAzvFI1csFxD3Kwej4rI8RYZ0WYLkndz9ID88+v9VxqI8+wN6wR6tIOR510uT1FI5wONBVBUzgeZ6cCEpg0jC9tgqcP03gMDpmE7vKp34ExxH/iOWyhQ0gAxHOVlQ==","DP":"qSQfNZvEkepgY12d+uwTbRoOp+0g1CBiMU9kqyoIB56hAUnzENSCDzunjLRrvDLFPgXiUcoccskyVRnKKOGPOqPE6VjgzBrdLgA/hBf8hPg0GnTVoPyLxR9G6GsGUKsAYVn8G7cnK5wXzK4jCjsflkfxCzFfdASJ/+sa5QPWZMM=","DQ":"u+56T1+rhMvlurid9kBS2Ypfm4vOiNAXLD9kGz2wx8Ob0yYlWo55kn11qPs6Ej9bnQIY3N+TY2tXMamfhAhntoHaKrFjOpCmlHZ0GAeQOJVuWSlFvu/NBoxfjZzcUCNua22oJjy++wSdkkLLGEqau62byaQoSSqUxUzwL36RexM=","Exponent":"AQAB","InverseQ":"E+uq9g6D5LjUk+M7gtt0srnT8duwu8P83AgFqjtGOnSCy71omSboxb4zC9bGq/WaEFauFBwqxbkXwFyXuYNfIelfmSERulU9jgf0+KH6QmFdtjrJ5UO7VArqET1WUquwiDvOyO8udCxi8RRAiM5G3dTzIs5JTalGhlKEZSAgPtQ=","Modulus":"rgHACxzqvuE72RF/NdDTLsIEy3F/n6P4lkgrER60FU8uRNwSmAMRxvxYOaE3Ot/krRYcw2+MP8ewR1VBXywXVT1zuACA3SacMHJYmZQ2UkuwsD9bmpjvqoMhR/hjsI74jTzKpclHtEu7D7WYDZaIPAEIs/8+5H/z1mXVfgACaeaQt3C0OhwXSOPPDP71VKGfoFucXYED1keZ0PKxYAlhiHOe7cnSlfJseujwD2Rhyq8mUhe6aEMTYBjuruWgpfvnSOARAqu5vwzK35KpAirHwa1DJSZyanNMFdlLkVNKWUKEqd6PwRneiHacmaaDF6oQQstuSbf9cuJeSMbKh7WVQQ==","P":"0CJDit2NHk0Z1bN5ZVIYZRUYbrAI2bEOafAKqfffcA/Os7yXsY14Ye4pSpDxfdZGcPGRL04HPkJsogFtyI7k4ujrvsC66I5cg45+BhBMM0zyLJ7LZkD2HGwX2+a/xrXhhIIOnGWWy2zzW3dkayRhi1bR9krfTA5uBw1LX9qZ3Yc=","Q":"1gZITAaB+r0+PgOfyDCeVzSnTyQuKSkgbUkIgQP9jQZa6edrbAXogdJipxmUTrW7JaxifG1z9ubK+TOqhjZHqT4gd8U8Bh7jCBizZNVe60pez1OtNGpEOW2N+ZrXBSMNcV8PFaMg/B+fcaX+i7NWpTqmztR/V0DGXmD+XosuaPc="}} |
|||
@ -0,0 +1,56 @@ |
|||
@keyframes spin { |
|||
0% { |
|||
transform: translateZ(0) rotate(0deg); |
|||
} |
|||
|
|||
100% { |
|||
transform: translateZ(0) rotate(360deg); |
|||
} |
|||
} |
|||
|
|||
.abp-block-area { |
|||
position: fixed; |
|||
top: 0; |
|||
left: 0; |
|||
width: 100%; |
|||
height: 100%; |
|||
z-index: 999999999; |
|||
background-color: #fff; |
|||
opacity: .8; |
|||
transition: opacity .25s; |
|||
} |
|||
|
|||
.abp-block-area.abp-block-area-disappearing { |
|||
opacity: 0; |
|||
} |
|||
|
|||
.abp-block-area.abp-block-area-busy:after { |
|||
content: attr(data-text); |
|||
display: block; |
|||
max-width: 125px; |
|||
position: absolute; |
|||
top: 50%; |
|||
left: 50%; |
|||
transform: translate(-50%, -50%); |
|||
font-size: 20px; |
|||
font-family: sans-serif; |
|||
color: #343a40; |
|||
text-align: center; |
|||
text-transform: uppercase; |
|||
} |
|||
|
|||
.abp-block-area.abp-block-area-busy:before { |
|||
content: ""; |
|||
display: block; |
|||
width: 150px; |
|||
height: 150px; |
|||
border-radius: 50%; |
|||
border-width: 2px; |
|||
border-style: solid; |
|||
border-color: transparent #228ae6 #228ae6 #228ae6; |
|||
position: absolute; |
|||
top: calc(50% - 75px); |
|||
left: calc(50% - 75px); |
|||
will-change: transform; |
|||
animation: spin .75s infinite ease-in-out; |
|||
} |
|||
@ -0,0 +1,636 @@ |
|||
var abp = abp || {}; |
|||
(function () { |
|||
|
|||
/* Application paths *****************************************/ |
|||
|
|||
//Current application root path (including virtual directory if exists).
|
|||
abp.appPath = abp.appPath || '/'; |
|||
|
|||
abp.pageLoadTime = new Date(); |
|||
|
|||
//Converts given path to absolute path using abp.appPath variable.
|
|||
abp.toAbsAppPath = function (path) { |
|||
if (path.indexOf('/') == 0) { |
|||
path = path.substring(1); |
|||
} |
|||
|
|||
return abp.appPath + path; |
|||
}; |
|||
|
|||
/* LOGGING ***************************************************/ |
|||
//Implements Logging API that provides secure & controlled usage of console.log
|
|||
|
|||
abp.log = abp.log || {}; |
|||
|
|||
abp.log.levels = { |
|||
DEBUG: 1, |
|||
INFO: 2, |
|||
WARN: 3, |
|||
ERROR: 4, |
|||
FATAL: 5 |
|||
}; |
|||
|
|||
abp.log.level = abp.log.levels.DEBUG; |
|||
|
|||
abp.log.log = function (logObject, logLevel) { |
|||
if (!window.console || !window.console.log) { |
|||
return; |
|||
} |
|||
|
|||
if (logLevel != undefined && logLevel < abp.log.level) { |
|||
return; |
|||
} |
|||
|
|||
console.log(logObject); |
|||
}; |
|||
|
|||
abp.log.debug = function (logObject) { |
|||
abp.log.log("DEBUG: ", abp.log.levels.DEBUG); |
|||
abp.log.log(logObject, abp.log.levels.DEBUG); |
|||
}; |
|||
|
|||
abp.log.info = function (logObject) { |
|||
abp.log.log("INFO: ", abp.log.levels.INFO); |
|||
abp.log.log(logObject, abp.log.levels.INFO); |
|||
}; |
|||
|
|||
abp.log.warn = function (logObject) { |
|||
abp.log.log("WARN: ", abp.log.levels.WARN); |
|||
abp.log.log(logObject, abp.log.levels.WARN); |
|||
}; |
|||
|
|||
abp.log.error = function (logObject) { |
|||
abp.log.log("ERROR: ", abp.log.levels.ERROR); |
|||
abp.log.log(logObject, abp.log.levels.ERROR); |
|||
}; |
|||
|
|||
abp.log.fatal = function (logObject) { |
|||
abp.log.log("FATAL: ", abp.log.levels.FATAL); |
|||
abp.log.log(logObject, abp.log.levels.FATAL); |
|||
}; |
|||
|
|||
/* LOCALIZATION ***********************************************/ |
|||
|
|||
abp.localization = abp.localization || {}; |
|||
|
|||
abp.localization.values = {}; |
|||
|
|||
abp.localization.localize = function (key, sourceName) { |
|||
sourceName = sourceName || abp.localization.defaultResourceName; |
|||
|
|||
var source = abp.localization.values[sourceName]; |
|||
|
|||
if (!source) { |
|||
abp.log.warn('Could not find localization source: ' + sourceName); |
|||
return key; |
|||
} |
|||
|
|||
var value = source[key]; |
|||
if (value == undefined) { |
|||
return key; |
|||
} |
|||
|
|||
var copiedArguments = Array.prototype.slice.call(arguments, 0); |
|||
copiedArguments.splice(1, 1); |
|||
copiedArguments[0] = value; |
|||
|
|||
return abp.utils.formatString.apply(this, copiedArguments); |
|||
}; |
|||
|
|||
abp.localization.getResource = function (name) { |
|||
return function () { |
|||
var copiedArguments = Array.prototype.slice.call(arguments, 0); |
|||
copiedArguments.splice(1, 0, name); |
|||
return abp.localization.localize.apply(this, copiedArguments); |
|||
}; |
|||
}; |
|||
|
|||
abp.localization.defaultResourceName = undefined; |
|||
|
|||
/* AUTHORIZATION **********************************************/ |
|||
|
|||
abp.auth = abp.auth || {}; |
|||
|
|||
abp.auth.policies = abp.auth.policies || {}; |
|||
|
|||
abp.auth.grantedPolicies = abp.auth.grantedPolicies || {}; |
|||
|
|||
abp.auth.isGranted = function (policyName) { |
|||
return abp.auth.policies[policyName] != undefined && abp.auth.grantedPolicies[policyName] != undefined; |
|||
}; |
|||
|
|||
abp.auth.isAnyGranted = function () { |
|||
if (!arguments || arguments.length <= 0) { |
|||
return true; |
|||
} |
|||
|
|||
for (var i = 0; i < arguments.length; i++) { |
|||
if (abp.auth.isGranted(arguments[i])) { |
|||
return true; |
|||
} |
|||
} |
|||
|
|||
return false; |
|||
}; |
|||
|
|||
abp.auth.areAllGranted = function () { |
|||
if (!arguments || arguments.length <= 0) { |
|||
return true; |
|||
} |
|||
|
|||
for (var i = 0; i < arguments.length; i++) { |
|||
if (!abp.auth.isGranted(arguments[i])) { |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
return true; |
|||
}; |
|||
|
|||
abp.auth.tokenCookieName = 'Abp.AuthToken'; |
|||
|
|||
abp.auth.setToken = function (authToken, expireDate) { |
|||
abp.utils.setCookieValue(abp.auth.tokenCookieName, authToken, expireDate, abp.appPath, abp.domain); |
|||
}; |
|||
|
|||
abp.auth.getToken = function () { |
|||
return abp.utils.getCookieValue(abp.auth.tokenCookieName); |
|||
} |
|||
|
|||
abp.auth.clearToken = function () { |
|||
abp.auth.setToken(); |
|||
} |
|||
|
|||
/* SETTINGS *************************************************/ |
|||
|
|||
abp.setting = abp.setting || {}; |
|||
|
|||
abp.setting.values = abp.setting.values || {}; |
|||
|
|||
abp.setting.get = function (name) { |
|||
return abp.setting.values[name]; |
|||
}; |
|||
|
|||
abp.setting.getBoolean = function (name) { |
|||
var value = abp.setting.get(name); |
|||
return value == 'true' || value == 'True'; |
|||
}; |
|||
|
|||
abp.setting.getInt = function (name) { |
|||
return parseInt(abp.setting.values[name]); |
|||
}; |
|||
|
|||
/* NOTIFICATION *********************************************/ |
|||
//Defines Notification API, not implements it
|
|||
|
|||
abp.notify = abp.notify || {}; |
|||
|
|||
abp.notify.success = function (message, title, options) { |
|||
abp.log.warn('abp.notify.success is not implemented!'); |
|||
}; |
|||
|
|||
abp.notify.info = function (message, title, options) { |
|||
abp.log.warn('abp.notify.info is not implemented!'); |
|||
}; |
|||
|
|||
abp.notify.warn = function (message, title, options) { |
|||
abp.log.warn('abp.notify.warn is not implemented!'); |
|||
}; |
|||
|
|||
abp.notify.error = function (message, title, options) { |
|||
abp.log.warn('abp.notify.error is not implemented!'); |
|||
}; |
|||
|
|||
/* MESSAGE **************************************************/ |
|||
//Defines Message API, not implements it
|
|||
|
|||
abp.message = abp.message || {}; |
|||
|
|||
abp.message._showMessage = function (message, title) { |
|||
alert((title || '') + ' ' + message); |
|||
}; |
|||
|
|||
abp.message.info = function (message, title) { |
|||
abp.log.warn('abp.message.info is not implemented!'); |
|||
return abp.message._showMessage(message, title); |
|||
}; |
|||
|
|||
abp.message.success = function (message, title) { |
|||
abp.log.warn('abp.message.success is not implemented!'); |
|||
return abp.message._showMessage(message, title); |
|||
}; |
|||
|
|||
abp.message.warn = function (message, title) { |
|||
abp.log.warn('abp.message.warn is not implemented!'); |
|||
return abp.message._showMessage(message, title); |
|||
}; |
|||
|
|||
abp.message.error = function (message, title) { |
|||
abp.log.warn('abp.message.error is not implemented!'); |
|||
return abp.message._showMessage(message, title); |
|||
}; |
|||
|
|||
abp.message.confirm = function (message, titleOrCallback, callback) { |
|||
abp.log.warn('abp.message.confirm is not properly implemented!'); |
|||
|
|||
if (titleOrCallback && !(typeof titleOrCallback == 'string')) { |
|||
callback = titleOrCallback; |
|||
} |
|||
|
|||
var result = confirm(message); |
|||
callback && callback(result); |
|||
}; |
|||
|
|||
/* UI *******************************************************/ |
|||
|
|||
abp.ui = abp.ui || {}; |
|||
|
|||
/* UI BLOCK */ |
|||
//Defines UI Block API and implements basically
|
|||
|
|||
var $abpBlockArea = document.createElement('div'); |
|||
$abpBlockArea.classList.add('abp-block-area'); |
|||
|
|||
/* opts: { //Can be an object with options or a string for query a selector |
|||
* elm: a query selector (optional - default: document.body) |
|||
* busy: boolean (optional - default: false) |
|||
* promise: A promise with always or finally handler (optional - auto unblocks the ui if provided) |
|||
* } |
|||
*/ |
|||
abp.ui.block = function (opts) { |
|||
if (!opts) { |
|||
opts = {}; |
|||
} else if (typeof opts == 'string') { |
|||
opts = { |
|||
elm: opts |
|||
}; |
|||
} |
|||
|
|||
var $elm = document.querySelector(opts.elm) || document.body; |
|||
|
|||
if (opts.busy) { |
|||
$abpBlockArea.classList.add('abp-block-area-busy'); |
|||
} else { |
|||
$abpBlockArea.classList.remove('abp-block-area-busy'); |
|||
} |
|||
|
|||
if (document.querySelector(opts.elm)) { |
|||
$abpBlockArea.style.position = 'absolute'; |
|||
} else { |
|||
$abpBlockArea.style.position = 'fixed'; |
|||
} |
|||
|
|||
$elm.appendChild($abpBlockArea); |
|||
|
|||
if (opts.promise) { |
|||
if (opts.promise.always) { //jQuery.Deferred style
|
|||
opts.promise.always(function () { |
|||
abp.ui.unblock({ |
|||
$elm: opts.elm |
|||
}); |
|||
}); |
|||
} else if (opts.promise['finally']) { //Q style
|
|||
opts.promise['finally'](function () { |
|||
abp.ui.unblock({ |
|||
$elm: opts.elm |
|||
}); |
|||
}); |
|||
} |
|||
} |
|||
}; |
|||
|
|||
/* opts: { |
|||
* |
|||
* } |
|||
*/ |
|||
abp.ui.unblock = function (opts) { |
|||
var element = document.querySelector('.abp-block-area'); |
|||
if (element) { |
|||
element.classList.add('abp-block-area-disappearing'); |
|||
setTimeout(function () { |
|||
if (element) { |
|||
element.classList.remove('abp-block-area-disappearing'); |
|||
element.parentElement.removeChild(element); |
|||
} |
|||
}, 250); |
|||
} |
|||
}; |
|||
|
|||
/* UI BUSY */ |
|||
//Defines UI Busy API, not implements it
|
|||
|
|||
abp.ui.setBusy = function (opts) { |
|||
if (!opts) { |
|||
opts = { |
|||
busy: true |
|||
}; |
|||
} else if (typeof opts == 'string') { |
|||
opts = { |
|||
elm: opts, |
|||
busy: true |
|||
}; |
|||
} |
|||
|
|||
abp.ui.block(opts); |
|||
}; |
|||
|
|||
abp.ui.clearBusy = function (opts) { |
|||
abp.ui.unblock(opts); |
|||
}; |
|||
|
|||
/* SIMPLE EVENT BUS *****************************************/ |
|||
|
|||
abp.event = (function () { |
|||
|
|||
var _callbacks = {}; |
|||
|
|||
var on = function (eventName, callback) { |
|||
if (!_callbacks[eventName]) { |
|||
_callbacks[eventName] = []; |
|||
} |
|||
|
|||
_callbacks[eventName].push(callback); |
|||
}; |
|||
|
|||
var off = function (eventName, callback) { |
|||
var callbacks = _callbacks[eventName]; |
|||
if (!callbacks) { |
|||
return; |
|||
} |
|||
|
|||
var index = -1; |
|||
for (var i = 0; i < callbacks.length; i++) { |
|||
if (callbacks[i] === callback) { |
|||
index = i; |
|||
break; |
|||
} |
|||
} |
|||
|
|||
if (index < 0) { |
|||
return; |
|||
} |
|||
|
|||
_callbacks[eventName].splice(index, 1); |
|||
}; |
|||
|
|||
var trigger = function (eventName) { |
|||
var callbacks = _callbacks[eventName]; |
|||
if (!callbacks || !callbacks.length) { |
|||
return; |
|||
} |
|||
|
|||
var args = Array.prototype.slice.call(arguments, 1); |
|||
for (var i = 0; i < callbacks.length; i++) { |
|||
callbacks[i].apply(this, args); |
|||
} |
|||
}; |
|||
|
|||
// Public interface ///////////////////////////////////////////////////
|
|||
|
|||
return { |
|||
on: on, |
|||
off: off, |
|||
trigger: trigger |
|||
}; |
|||
})(); |
|||
|
|||
|
|||
/* UTILS ***************************************************/ |
|||
|
|||
abp.utils = abp.utils || {}; |
|||
|
|||
/* Creates a name namespace. |
|||
* Example: |
|||
* var taskService = abp.utils.createNamespace(abp, 'services.task'); |
|||
* taskService will be equal to abp.services.task |
|||
* first argument (root) must be defined first |
|||
************************************************************/ |
|||
abp.utils.createNamespace = function (root, ns) { |
|||
var parts = ns.split('.'); |
|||
for (var i = 0; i < parts.length; i++) { |
|||
if (typeof root[parts[i]] == 'undefined') { |
|||
root[parts[i]] = {}; |
|||
} |
|||
|
|||
root = root[parts[i]]; |
|||
} |
|||
|
|||
return root; |
|||
}; |
|||
|
|||
/* Find and replaces a string (search) to another string (replacement) in |
|||
* given string (str). |
|||
* Example: |
|||
* abp.utils.replaceAll('This is a test string', 'is', 'X') = 'ThX X a test string' |
|||
************************************************************/ |
|||
abp.utils.replaceAll = function (str, search, replacement) { |
|||
var fix = search.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); |
|||
return str.replace(new RegExp(fix, 'g'), replacement); |
|||
}; |
|||
|
|||
/* Formats a string just like string.format in C#. |
|||
* Example: |
|||
* abp.utils.formatString('Hello {0}','Tuana') = 'Hello Tuana' |
|||
************************************************************/ |
|||
abp.utils.formatString = function () { |
|||
if (arguments.length < 1) { |
|||
return null; |
|||
} |
|||
|
|||
var str = arguments[0]; |
|||
|
|||
for (var i = 1; i < arguments.length; i++) { |
|||
var placeHolder = '{' + (i - 1) + '}'; |
|||
str = abp.utils.replaceAll(str, placeHolder, arguments[i]); |
|||
} |
|||
|
|||
return str; |
|||
}; |
|||
|
|||
abp.utils.toPascalCase = function (str) { |
|||
if (!str || !str.length) { |
|||
return str; |
|||
} |
|||
|
|||
if (str.length === 1) { |
|||
return str.charAt(0).toUpperCase(); |
|||
} |
|||
|
|||
return str.charAt(0).toUpperCase() + str.substr(1); |
|||
} |
|||
|
|||
abp.utils.toCamelCase = function (str) { |
|||
if (!str || !str.length) { |
|||
return str; |
|||
} |
|||
|
|||
if (str.length === 1) { |
|||
return str.charAt(0).toLowerCase(); |
|||
} |
|||
|
|||
return str.charAt(0).toLowerCase() + str.substr(1); |
|||
} |
|||
|
|||
abp.utils.truncateString = function (str, maxLength) { |
|||
if (!str || !str.length || str.length <= maxLength) { |
|||
return str; |
|||
} |
|||
|
|||
return str.substr(0, maxLength); |
|||
}; |
|||
|
|||
abp.utils.truncateStringWithPostfix = function (str, maxLength, postfix) { |
|||
postfix = postfix || '...'; |
|||
|
|||
if (!str || !str.length || str.length <= maxLength) { |
|||
return str; |
|||
} |
|||
|
|||
if (maxLength <= postfix.length) { |
|||
return postfix.substr(0, maxLength); |
|||
} |
|||
|
|||
return str.substr(0, maxLength - postfix.length) + postfix; |
|||
}; |
|||
|
|||
abp.utils.isFunction = function (obj) { |
|||
return !!(obj && obj.constructor && obj.call && obj.apply); |
|||
}; |
|||
|
|||
/** |
|||
* parameterInfos should be an array of { name, value } objects |
|||
* where name is query string parameter name and value is it's value. |
|||
* includeQuestionMark is true by default. |
|||
*/ |
|||
abp.utils.buildQueryString = function (parameterInfos, includeQuestionMark) { |
|||
if (includeQuestionMark === undefined) { |
|||
includeQuestionMark = true; |
|||
} |
|||
|
|||
var qs = ''; |
|||
|
|||
function addSeperator() { |
|||
if (!qs.length) { |
|||
if (includeQuestionMark) { |
|||
qs = qs + '?'; |
|||
} |
|||
} else { |
|||
qs = qs + '&'; |
|||
} |
|||
} |
|||
|
|||
for (var i = 0; i < parameterInfos.length; ++i) { |
|||
var parameterInfo = parameterInfos[i]; |
|||
if (parameterInfo.value === undefined) { |
|||
continue; |
|||
} |
|||
|
|||
if (parameterInfo.value === null) { |
|||
parameterInfo.value = ''; |
|||
} |
|||
|
|||
addSeperator(); |
|||
|
|||
if (parameterInfo.value.toJSON && typeof parameterInfo.value.toJSON === "function") { |
|||
qs = qs + parameterInfo.name + '=' + encodeURIComponent(parameterInfo.value.toJSON()); |
|||
} else if (Array.isArray(parameterInfo.value) && parameterInfo.value.length) { |
|||
for (var j = 0; j < parameterInfo.value.length; j++) { |
|||
if (j > 0) { |
|||
addSeperator(); |
|||
} |
|||
|
|||
qs = qs + parameterInfo.name + '[' + j + ']=' + encodeURIComponent(parameterInfo.value[j]); |
|||
} |
|||
} else { |
|||
qs = qs + parameterInfo.name + '=' + encodeURIComponent(parameterInfo.value); |
|||
} |
|||
} |
|||
|
|||
return qs; |
|||
} |
|||
|
|||
/** |
|||
* Sets a cookie value for given key. |
|||
* This is a simple implementation created to be used by ABP. |
|||
* Please use a complete cookie library if you need. |
|||
* @param {string} key |
|||
* @param {string} value |
|||
* @param {Date} expireDate (optional). If not specified the cookie will expire at the end of session. |
|||
* @param {string} path (optional) |
|||
*/ |
|||
abp.utils.setCookieValue = function (key, value, expireDate, path) { |
|||
var cookieValue = encodeURIComponent(key) + '='; |
|||
|
|||
if (value) { |
|||
cookieValue = cookieValue + encodeURIComponent(value); |
|||
} |
|||
|
|||
if (expireDate) { |
|||
cookieValue = cookieValue + "; expires=" + expireDate.toUTCString(); |
|||
} |
|||
|
|||
if (path) { |
|||
cookieValue = cookieValue + "; path=" + path; |
|||
} |
|||
|
|||
document.cookie = cookieValue; |
|||
}; |
|||
|
|||
/** |
|||
* Gets a cookie with given key. |
|||
* This is a simple implementation created to be used by ABP. |
|||
* Please use a complete cookie library if you need. |
|||
* @param {string} key |
|||
* @returns {string} Cookie value or null |
|||
*/ |
|||
abp.utils.getCookieValue = function (key) { |
|||
var equalities = document.cookie.split('; '); |
|||
for (var i = 0; i < equalities.length; i++) { |
|||
if (!equalities[i]) { |
|||
continue; |
|||
} |
|||
|
|||
var splitted = equalities[i].split('='); |
|||
if (splitted.length != 2) { |
|||
continue; |
|||
} |
|||
|
|||
if (decodeURIComponent(splitted[0]) === key) { |
|||
return decodeURIComponent(splitted[1] || ''); |
|||
} |
|||
} |
|||
|
|||
return null; |
|||
}; |
|||
|
|||
/** |
|||
* Deletes cookie for given key. |
|||
* This is a simple implementation created to be used by ABP. |
|||
* Please use a complete cookie library if you need. |
|||
* @param {string} key |
|||
* @param {string} path (optional) |
|||
*/ |
|||
abp.utils.deleteCookie = function (key, path) { |
|||
var cookieValue = encodeURIComponent(key) + '='; |
|||
|
|||
cookieValue = cookieValue + "; expires=" + (new Date(new Date().getTime() - 86400000)).toUTCString(); |
|||
|
|||
if (path) { |
|||
cookieValue = cookieValue + "; path=" + path; |
|||
} |
|||
|
|||
document.cookie = cookieValue; |
|||
} |
|||
|
|||
/* SECURITY ***************************************/ |
|||
abp.security = abp.security || {}; |
|||
abp.security.antiForgery = abp.security.antiForgery || {}; |
|||
|
|||
abp.security.antiForgery.tokenCookieName = 'XSRF-TOKEN'; |
|||
abp.security.antiForgery.tokenHeaderName = 'X-XSRF-TOKEN'; |
|||
|
|||
abp.security.antiForgery.getToken = function () { |
|||
return abp.utils.getCookieValue(abp.security.antiForgery.tokenCookieName); |
|||
}; |
|||
|
|||
})(); |
|||
@ -0,0 +1,389 @@ |
|||
var abp = abp || {}; |
|||
(function($) { |
|||
|
|||
if (!$) { |
|||
throw "abp/jquery library requires the jquery library included to the page!"; |
|||
} |
|||
|
|||
// ABP CORE OVERRIDES /////////////////////////////////////////////////////
|
|||
|
|||
abp.message._showMessage = function (message, title) { |
|||
alert((title || '') + ' ' + message); |
|||
|
|||
return $.Deferred(function ($dfd) { |
|||
$dfd.resolve(); |
|||
}); |
|||
}; |
|||
|
|||
abp.message.confirm = function (message, titleOrCallback, callback) { |
|||
if (titleOrCallback && !(typeof titleOrCallback == 'string')) { |
|||
callback = titleOrCallback; |
|||
} |
|||
|
|||
var result = confirm(message); |
|||
callback && callback(result); |
|||
|
|||
return $.Deferred(function ($dfd) { |
|||
$dfd.resolve(result); |
|||
}); |
|||
}; |
|||
|
|||
abp.utils.isFunction = function (obj) { |
|||
return $.isFunction(obj); |
|||
}; |
|||
|
|||
// JQUERY EXTENSIONS //////////////////////////////////////////////////////
|
|||
|
|||
$.fn.findWithSelf = function (selector) { |
|||
return this.filter(selector).add(this.find(selector)); |
|||
}; |
|||
|
|||
// DOM ////////////////////////////////////////////////////////////////////
|
|||
|
|||
abp.dom = abp.dom || {}; |
|||
|
|||
abp.dom.onNodeAdded = function (callback) { |
|||
abp.event.on('abp.dom.nodeAdded', callback); |
|||
}; |
|||
|
|||
abp.dom.onNodeRemoved = function (callback) { |
|||
abp.event.on('abp.dom.nodeRemoved', callback); |
|||
}; |
|||
|
|||
var mutationObserverCallback = function (mutationsList) { |
|||
for (var i = 0; i < mutationsList.length; i++) { |
|||
var mutation = mutationsList[i]; |
|||
if (mutation.type === 'childList') { |
|||
if (mutation.addedNodes && mutation.removedNodes.length) { |
|||
for (var k = 0; k < mutation.removedNodes.length; k++) { |
|||
abp.event.trigger( |
|||
'abp.dom.nodeRemoved', |
|||
{ |
|||
$el: $(mutation.removedNodes[k]) |
|||
} |
|||
); |
|||
} |
|||
} |
|||
|
|||
if (mutation.addedNodes && mutation.addedNodes.length) { |
|||
for (var j = 0; j < mutation.addedNodes.length; j++) { |
|||
abp.event.trigger( |
|||
'abp.dom.nodeAdded', |
|||
{ |
|||
$el: $(mutation.addedNodes[j]) |
|||
} |
|||
); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
}; |
|||
|
|||
new MutationObserver(mutationObserverCallback).observe( |
|||
$('body')[0], |
|||
{ |
|||
subtree: true, |
|||
childList: true |
|||
} |
|||
); |
|||
|
|||
// AJAX ///////////////////////////////////////////////////////////////////
|
|||
|
|||
abp.ajax = function (userOptions) { |
|||
userOptions = userOptions || {}; |
|||
|
|||
var options = $.extend(true, {}, abp.ajax.defaultOpts, userOptions); |
|||
|
|||
options.success = undefined; |
|||
options.error = undefined; |
|||
|
|||
return $.Deferred(function ($dfd) { |
|||
$.ajax(options) |
|||
.done(function (data, textStatus, jqXHR) { |
|||
$dfd.resolve(data); |
|||
userOptions.success && userOptions.success(data); |
|||
}).fail(function (jqXHR) { |
|||
if (jqXHR.getResponseHeader('_AbpErrorFormat') === 'true') { |
|||
abp.ajax.handleAbpErrorResponse(jqXHR, userOptions, $dfd); |
|||
} else { |
|||
abp.ajax.handleNonAbpErrorResponse(jqXHR, userOptions, $dfd); |
|||
} |
|||
}); |
|||
}); |
|||
}; |
|||
|
|||
$.extend(abp.ajax, { |
|||
defaultOpts: { |
|||
dataType: 'json', |
|||
type: 'POST', |
|||
contentType: 'application/json', |
|||
headers: { |
|||
'X-Requested-With': 'XMLHttpRequest' |
|||
} |
|||
}, |
|||
|
|||
defaultError: { |
|||
message: 'An error has occurred!', |
|||
details: 'Error detail not sent by server.' |
|||
}, |
|||
|
|||
defaultError401: { |
|||
message: 'You are not authenticated!', |
|||
details: 'You should be authenticated (sign in) in order to perform this operation.' |
|||
}, |
|||
|
|||
defaultError403: { |
|||
message: 'You are not authorized!', |
|||
details: 'You are not allowed to perform this operation.' |
|||
}, |
|||
|
|||
defaultError404: { |
|||
message: 'Resource not found!', |
|||
details: 'The resource requested could not found on the server.' |
|||
}, |
|||
|
|||
logError: function (error) { |
|||
abp.log.error(error); |
|||
}, |
|||
|
|||
showError: function (error) { |
|||
if (error.details) { |
|||
return abp.message.error(error.details, error.message); |
|||
} else { |
|||
return abp.message.error(error.message || abp.ajax.defaultError.message); |
|||
} |
|||
}, |
|||
|
|||
handleTargetUrl: function (targetUrl) { |
|||
if (!targetUrl) { |
|||
location.href = abp.appPath; |
|||
} else { |
|||
location.href = targetUrl; |
|||
} |
|||
}, |
|||
|
|||
handleErrorStatusCode: function (status) { |
|||
switch (status) { |
|||
case 401: |
|||
abp.ajax.handleUnAuthorizedRequest( |
|||
abp.ajax.showError(abp.ajax.defaultError401), |
|||
abp.appPath |
|||
); |
|||
break; |
|||
case 403: |
|||
abp.ajax.showError(abp.ajax.defaultError403); |
|||
break; |
|||
case 404: |
|||
abp.ajax.showError(abp.ajax.defaultError404); |
|||
break; |
|||
default: |
|||
abp.ajax.showError(abp.ajax.defaultError); |
|||
break; |
|||
} |
|||
}, |
|||
|
|||
handleNonAbpErrorResponse: function (jqXHR, userOptions, $dfd) { |
|||
if (userOptions.abpHandleError !== false) { |
|||
abp.ajax.handleErrorStatusCode(jqXHR.status); |
|||
} |
|||
|
|||
$dfd.reject.apply(this, arguments); |
|||
userOptions.error && userOptions.error.apply(this, arguments); |
|||
}, |
|||
|
|||
handleAbpErrorResponse: function (jqXHR, userOptions, $dfd) { |
|||
var messagePromise = null; |
|||
|
|||
if (userOptions.abpHandleError !== false) { |
|||
messagePromise = abp.ajax.showError(jqXHR.responseJSON.error); |
|||
} |
|||
|
|||
abp.ajax.logError(jqXHR.responseJSON.error); |
|||
|
|||
$dfd && $dfd.reject(jqXHR.responseJSON.error, jqXHR); |
|||
userOptions.error && userOptions.error(jqXHR.responseJSON.error, jqXHR); |
|||
|
|||
if (jqXHR.status === 401 && userOptions.abpHandleError !== false) { |
|||
abp.ajax.handleUnAuthorizedRequest(messagePromise); |
|||
} |
|||
}, |
|||
|
|||
handleUnAuthorizedRequest: function (messagePromise, targetUrl) { |
|||
if (messagePromise) { |
|||
messagePromise.done(function () { |
|||
abp.ajax.handleTargetUrl(targetUrl); |
|||
}); |
|||
} else { |
|||
abp.ajax.handleTargetUrl(targetUrl); |
|||
} |
|||
}, |
|||
|
|||
blockUI: function (options) { |
|||
if (options.blockUI) { |
|||
if (options.blockUI === true) { //block whole page
|
|||
abp.ui.setBusy(); |
|||
} else { //block an element
|
|||
abp.ui.setBusy(options.blockUI); |
|||
} |
|||
} |
|||
}, |
|||
|
|||
unblockUI: function (options) { |
|||
if (options.blockUI) { |
|||
if (options.blockUI === true) { //unblock whole page
|
|||
abp.ui.clearBusy(); |
|||
} else { //unblock an element
|
|||
abp.ui.clearBusy(options.blockUI); |
|||
} |
|||
} |
|||
}, |
|||
|
|||
ajaxSendHandler: function (event, request, settings) { |
|||
var token = abp.security.antiForgery.getToken(); |
|||
if (!token) { |
|||
return; |
|||
} |
|||
|
|||
if (!settings.headers || settings.headers[abp.security.antiForgery.tokenHeaderName] === undefined) { |
|||
request.setRequestHeader(abp.security.antiForgery.tokenHeaderName, token); |
|||
} |
|||
} |
|||
}); |
|||
|
|||
$(document).ajaxSend(function (event, request, settings) { |
|||
return abp.ajax.ajaxSendHandler(event, request, settings); |
|||
}); |
|||
|
|||
abp.event.on('abp.configurationInitialized', function () { |
|||
var l = abp.localization.getResource('AbpUi'); |
|||
|
|||
abp.ajax.defaultError.message = l('DefaultErrorMessage'); |
|||
abp.ajax.defaultError.details = l('DefaultErrorMessageDetail'); |
|||
abp.ajax.defaultError401.message = l('DefaultErrorMessage401'); |
|||
abp.ajax.defaultError401.details = l('DefaultErrorMessage401Detail'); |
|||
abp.ajax.defaultError403.message = l('DefaultErrorMessage403'); |
|||
abp.ajax.defaultError403.details = l('DefaultErrorMessage403Detail'); |
|||
abp.ajax.defaultError404.message = l('DefaultErrorMessage404'); |
|||
abp.ajax.defaultError404.details = l('DefaultErrorMessage404Detail'); |
|||
}); |
|||
|
|||
// RESOURCE LOADER ////////////////////////////////////////////////////////
|
|||
|
|||
/* UrlStates enum */ |
|||
var UrlStates = { |
|||
LOADING: 'LOADING', |
|||
LOADED: 'LOADED', |
|||
FAILED: 'FAILED' |
|||
}; |
|||
|
|||
/* UrlInfo class */ |
|||
function UrlInfo(url) { |
|||
this.url = url; |
|||
this.state = UrlStates.LOADING; |
|||
this.loadCallbacks = []; |
|||
this.failCallbacks = []; |
|||
} |
|||
|
|||
UrlInfo.prototype.succeed = function () { |
|||
this.state = UrlStates.LOADED; |
|||
for (var i = 0; i < this.loadCallbacks.length; i++) { |
|||
this.loadCallbacks[i](); |
|||
} |
|||
}; |
|||
|
|||
UrlInfo.prototype.failed = function () { |
|||
this.state = UrlStates.FAILED; |
|||
for (var i = 0; i < this.failCallbacks.length; i++) { |
|||
this.failCallbacks[i](); |
|||
} |
|||
}; |
|||
|
|||
UrlInfo.prototype.handleCallbacks = function (loadCallback, failCallback) { |
|||
switch (this.state) { |
|||
case UrlStates.LOADED: |
|||
loadCallback && loadCallback(); |
|||
break; |
|||
case UrlStates.FAILED: |
|||
failCallback && failCallback(); |
|||
break; |
|||
case UrlStates.LOADING: |
|||
this.addCallbacks(loadCallback, failCallback); |
|||
break; |
|||
} |
|||
}; |
|||
|
|||
UrlInfo.prototype.addCallbacks = function (loadCallback, failCallback) { |
|||
loadCallback && this.loadCallbacks.push(loadCallback); |
|||
failCallback && this.failCallbacks.push(failCallback); |
|||
}; |
|||
|
|||
/* ResourceLoader API */ |
|||
|
|||
abp.ResourceLoader = (function () { |
|||
|
|||
var _urlInfos = {}; |
|||
|
|||
function getCacheKey(url) { |
|||
return url; |
|||
} |
|||
|
|||
function appendTimeToUrl(url) { |
|||
|
|||
if (url.indexOf('?') < 0) { |
|||
url += '?'; |
|||
} else { |
|||
url += '&'; |
|||
} |
|||
|
|||
url += '_=' + new Date().getTime(); |
|||
|
|||
return url; |
|||
} |
|||
|
|||
var _loadFromUrl = function (url, loadCallback, failCallback, serverLoader) { |
|||
|
|||
var cacheKey = getCacheKey(url); |
|||
|
|||
var urlInfo = _urlInfos[cacheKey]; |
|||
|
|||
if (urlInfo) { |
|||
urlInfo.handleCallbacks(loadCallback, failCallback); |
|||
return; |
|||
} |
|||
|
|||
_urlInfos[cacheKey] = urlInfo = new UrlInfo(url); |
|||
urlInfo.addCallbacks(loadCallback, failCallback); |
|||
|
|||
serverLoader(urlInfo); |
|||
}; |
|||
|
|||
var _loadScript = function (url, loadCallback, failCallback) { |
|||
_loadFromUrl(url, loadCallback, failCallback, function (urlInfo) { |
|||
$.getScript(url) |
|||
.done(function () { |
|||
urlInfo.succeed(); |
|||
}) |
|||
.fail(function () { |
|||
urlInfo.failed(); |
|||
}); |
|||
}); |
|||
}; |
|||
|
|||
var _loadStyle = function (url) { |
|||
_loadFromUrl(url, undefined, undefined, function (urlInfo) { |
|||
|
|||
$('<link/>', { |
|||
rel: 'stylesheet', |
|||
type: 'text/css', |
|||
href: appendTimeToUrl(url) |
|||
}).appendTo('head'); |
|||
}); |
|||
}; |
|||
|
|||
return { |
|||
loadScript: _loadScript, |
|||
loadStyle: _loadStyle |
|||
} |
|||
})(); |
|||
|
|||
})(jQuery); |
|||
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -0,0 +1,202 @@ |
|||
table.dataTable { |
|||
clear: both; |
|||
margin-top: 6px !important; |
|||
margin-bottom: 6px !important; |
|||
max-width: none !important; |
|||
border-collapse: separate !important; |
|||
} |
|||
table.dataTable td, |
|||
table.dataTable th { |
|||
-webkit-box-sizing: content-box; |
|||
box-sizing: content-box; |
|||
} |
|||
table.dataTable td.dataTables_empty, |
|||
table.dataTable th.dataTables_empty { |
|||
text-align: center; |
|||
} |
|||
table.dataTable.nowrap th, |
|||
table.dataTable.nowrap td { |
|||
white-space: nowrap; |
|||
} |
|||
|
|||
div.dataTables_wrapper div.dataTables_length label { |
|||
font-weight: normal; |
|||
text-align: left; |
|||
white-space: nowrap; |
|||
} |
|||
div.dataTables_wrapper div.dataTables_length select { |
|||
width: 75px; |
|||
display: inline-block; |
|||
} |
|||
div.dataTables_wrapper div.dataTables_filter { |
|||
text-align: right; |
|||
} |
|||
div.dataTables_wrapper div.dataTables_filter label { |
|||
font-weight: normal; |
|||
white-space: nowrap; |
|||
text-align: left; |
|||
} |
|||
div.dataTables_wrapper div.dataTables_filter input { |
|||
margin-left: 0.5em; |
|||
display: inline-block; |
|||
width: auto; |
|||
} |
|||
div.dataTables_wrapper div.dataTables_info { |
|||
padding-top: 0.85em; |
|||
white-space: nowrap; |
|||
} |
|||
div.dataTables_wrapper div.dataTables_paginate { |
|||
margin: 0; |
|||
white-space: nowrap; |
|||
text-align: right; |
|||
} |
|||
div.dataTables_wrapper div.dataTables_paginate ul.pagination { |
|||
margin: 2px 0; |
|||
white-space: nowrap; |
|||
justify-content: flex-end; |
|||
} |
|||
div.dataTables_wrapper div.dataTables_processing { |
|||
position: absolute; |
|||
top: 50%; |
|||
left: 50%; |
|||
width: 200px; |
|||
margin-left: -100px; |
|||
margin-top: -26px; |
|||
text-align: center; |
|||
padding: 1em 0; |
|||
} |
|||
|
|||
table.dataTable thead > tr > th.sorting_asc, table.dataTable thead > tr > th.sorting_desc, table.dataTable thead > tr > th.sorting, |
|||
table.dataTable thead > tr > td.sorting_asc, |
|||
table.dataTable thead > tr > td.sorting_desc, |
|||
table.dataTable thead > tr > td.sorting { |
|||
padding-right: 30px; |
|||
} |
|||
table.dataTable thead > tr > th:active, |
|||
table.dataTable thead > tr > td:active { |
|||
outline: none; |
|||
} |
|||
table.dataTable thead .sorting, |
|||
table.dataTable thead .sorting_asc, |
|||
table.dataTable thead .sorting_desc, |
|||
table.dataTable thead .sorting_asc_disabled, |
|||
table.dataTable thead .sorting_desc_disabled { |
|||
cursor: pointer; |
|||
position: relative; |
|||
} |
|||
table.dataTable thead .sorting:before, table.dataTable thead .sorting:after, |
|||
table.dataTable thead .sorting_asc:before, |
|||
table.dataTable thead .sorting_asc:after, |
|||
table.dataTable thead .sorting_desc:before, |
|||
table.dataTable thead .sorting_desc:after, |
|||
table.dataTable thead .sorting_asc_disabled:before, |
|||
table.dataTable thead .sorting_asc_disabled:after, |
|||
table.dataTable thead .sorting_desc_disabled:before, |
|||
table.dataTable thead .sorting_desc_disabled:after { |
|||
position: absolute; |
|||
bottom: 0.9em; |
|||
display: block; |
|||
opacity: 0.3; |
|||
} |
|||
table.dataTable thead .sorting:before, |
|||
table.dataTable thead .sorting_asc:before, |
|||
table.dataTable thead .sorting_desc:before, |
|||
table.dataTable thead .sorting_asc_disabled:before, |
|||
table.dataTable thead .sorting_desc_disabled:before { |
|||
right: 1em; |
|||
content: "\2191"; |
|||
} |
|||
table.dataTable thead .sorting:after, |
|||
table.dataTable thead .sorting_asc:after, |
|||
table.dataTable thead .sorting_desc:after, |
|||
table.dataTable thead .sorting_asc_disabled:after, |
|||
table.dataTable thead .sorting_desc_disabled:after { |
|||
right: 0.5em; |
|||
content: "\2193"; |
|||
} |
|||
table.dataTable thead .sorting_asc:before, |
|||
table.dataTable thead .sorting_desc:after { |
|||
opacity: 1; |
|||
} |
|||
table.dataTable thead .sorting_asc_disabled:before, |
|||
table.dataTable thead .sorting_desc_disabled:after { |
|||
opacity: 0; |
|||
} |
|||
|
|||
div.dataTables_scrollHead table.dataTable { |
|||
margin-bottom: 0 !important; |
|||
} |
|||
|
|||
div.dataTables_scrollBody table { |
|||
border-top: none; |
|||
margin-top: 0 !important; |
|||
margin-bottom: 0 !important; |
|||
} |
|||
div.dataTables_scrollBody table thead .sorting:after, |
|||
div.dataTables_scrollBody table thead .sorting_asc:after, |
|||
div.dataTables_scrollBody table thead .sorting_desc:after { |
|||
display: none; |
|||
} |
|||
div.dataTables_scrollBody table tbody tr:first-child th, |
|||
div.dataTables_scrollBody table tbody tr:first-child td { |
|||
border-top: none; |
|||
} |
|||
|
|||
div.dataTables_scrollFoot > .dataTables_scrollFootInner { |
|||
box-sizing: content-box; |
|||
} |
|||
div.dataTables_scrollFoot > .dataTables_scrollFootInner > table { |
|||
margin-top: 0 !important; |
|||
border-top: none; |
|||
} |
|||
|
|||
@media screen and (max-width: 767px) { |
|||
div.dataTables_wrapper div.dataTables_length, |
|||
div.dataTables_wrapper div.dataTables_filter, |
|||
div.dataTables_wrapper div.dataTables_info, |
|||
div.dataTables_wrapper div.dataTables_paginate { |
|||
text-align: center; |
|||
} |
|||
} |
|||
table.dataTable.table-sm > thead > tr > th { |
|||
padding-right: 20px; |
|||
} |
|||
table.dataTable.table-sm .sorting:before, |
|||
table.dataTable.table-sm .sorting_asc:before, |
|||
table.dataTable.table-sm .sorting_desc:before { |
|||
top: 5px; |
|||
right: 0.85em; |
|||
} |
|||
table.dataTable.table-sm .sorting:after, |
|||
table.dataTable.table-sm .sorting_asc:after, |
|||
table.dataTable.table-sm .sorting_desc:after { |
|||
top: 5px; |
|||
} |
|||
|
|||
table.table-bordered.dataTable th, |
|||
table.table-bordered.dataTable td { |
|||
border-left-width: 0; |
|||
} |
|||
table.table-bordered.dataTable th:last-child, table.table-bordered.dataTable th:last-child, |
|||
table.table-bordered.dataTable td:last-child, |
|||
table.table-bordered.dataTable td:last-child { |
|||
border-right-width: 0; |
|||
} |
|||
table.table-bordered.dataTable tbody th, |
|||
table.table-bordered.dataTable tbody td { |
|||
border-bottom-width: 0; |
|||
} |
|||
|
|||
div.dataTables_scrollHead table.table-bordered { |
|||
border-bottom-width: 0; |
|||
} |
|||
|
|||
div.table-responsive > div.dataTables_wrapper > div.row { |
|||
margin: 0; |
|||
} |
|||
div.table-responsive > div.dataTables_wrapper > div.row > div[class^="col-"]:first-child { |
|||
padding-left: 0; |
|||
} |
|||
div.table-responsive > div.dataTables_wrapper > div.row > div[class^="col-"]:last-child { |
|||
padding-right: 0; |
|||
} |
|||
@ -0,0 +1,184 @@ |
|||
/*! DataTables Bootstrap 3 integration |
|||
* ©2011-2015 SpryMedia Ltd - datatables.net/license |
|||
*/ |
|||
|
|||
/** |
|||
* DataTables integration for Bootstrap 3. This requires Bootstrap 3 and |
|||
* DataTables 1.10 or newer. |
|||
* |
|||
* This file sets the defaults and adds options to DataTables to style its |
|||
* controls using Bootstrap. See http://datatables.net/manual/styling/bootstrap
|
|||
* for further information. |
|||
*/ |
|||
(function( factory ){ |
|||
if ( typeof define === 'function' && define.amd ) { |
|||
// AMD
|
|||
define( ['jquery', 'datatables.net'], function ( $ ) { |
|||
return factory( $, window, document ); |
|||
} ); |
|||
} |
|||
else if ( typeof exports === 'object' ) { |
|||
// CommonJS
|
|||
module.exports = function (root, $) { |
|||
if ( ! root ) { |
|||
root = window; |
|||
} |
|||
|
|||
if ( ! $ || ! $.fn.dataTable ) { |
|||
// Require DataTables, which attaches to jQuery, including
|
|||
// jQuery if needed and have a $ property so we can access the
|
|||
// jQuery object that is used
|
|||
$ = require('datatables.net')(root, $).$; |
|||
} |
|||
|
|||
return factory( $, root, root.document ); |
|||
}; |
|||
} |
|||
else { |
|||
// Browser
|
|||
factory( jQuery, window, document ); |
|||
} |
|||
}(function( $, window, document, undefined ) { |
|||
'use strict'; |
|||
var DataTable = $.fn.dataTable; |
|||
|
|||
|
|||
/* Set the defaults for DataTables initialisation */ |
|||
$.extend( true, DataTable.defaults, { |
|||
dom: |
|||
"<'row'<'col-sm-12 col-md-6'l><'col-sm-12 col-md-6'f>>" + |
|||
"<'row'<'col-sm-12'tr>>" + |
|||
"<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>", |
|||
renderer: 'bootstrap' |
|||
} ); |
|||
|
|||
|
|||
/* Default class modification */ |
|||
$.extend( DataTable.ext.classes, { |
|||
sWrapper: "dataTables_wrapper container-fluid dt-bootstrap4", |
|||
sFilterInput: "form-control form-control-sm", |
|||
sLengthSelect: "form-control form-control-sm", |
|||
sProcessing: "dataTables_processing card", |
|||
sPageButton: "paginate_button page-item" |
|||
} ); |
|||
|
|||
|
|||
/* Bootstrap paging button renderer */ |
|||
DataTable.ext.renderer.pageButton.bootstrap = function ( settings, host, idx, buttons, page, pages ) { |
|||
var api = new DataTable.Api( settings ); |
|||
var classes = settings.oClasses; |
|||
var lang = settings.oLanguage.oPaginate; |
|||
var aria = settings.oLanguage.oAria.paginate || {}; |
|||
var btnDisplay, btnClass, counter=0; |
|||
|
|||
var attach = function( container, buttons ) { |
|||
var i, ien, node, button; |
|||
var clickHandler = function ( e ) { |
|||
e.preventDefault(); |
|||
if ( !$(e.currentTarget).hasClass('disabled') && api.page() != e.data.action ) { |
|||
api.page( e.data.action ).draw( 'page' ); |
|||
} |
|||
}; |
|||
|
|||
for ( i=0, ien=buttons.length ; i<ien ; i++ ) { |
|||
button = buttons[i]; |
|||
|
|||
if ( $.isArray( button ) ) { |
|||
attach( container, button ); |
|||
} |
|||
else { |
|||
btnDisplay = ''; |
|||
btnClass = ''; |
|||
|
|||
switch ( button ) { |
|||
case 'ellipsis': |
|||
btnDisplay = '…'; |
|||
btnClass = 'disabled'; |
|||
break; |
|||
|
|||
case 'first': |
|||
btnDisplay = lang.sFirst; |
|||
btnClass = button + (page > 0 ? |
|||
'' : ' disabled'); |
|||
break; |
|||
|
|||
case 'previous': |
|||
btnDisplay = lang.sPrevious; |
|||
btnClass = button + (page > 0 ? |
|||
'' : ' disabled'); |
|||
break; |
|||
|
|||
case 'next': |
|||
btnDisplay = lang.sNext; |
|||
btnClass = button + (page < pages-1 ? |
|||
'' : ' disabled'); |
|||
break; |
|||
|
|||
case 'last': |
|||
btnDisplay = lang.sLast; |
|||
btnClass = button + (page < pages-1 ? |
|||
'' : ' disabled'); |
|||
break; |
|||
|
|||
default: |
|||
btnDisplay = button + 1; |
|||
btnClass = page === button ? |
|||
'active' : ''; |
|||
break; |
|||
} |
|||
|
|||
if ( btnDisplay ) { |
|||
node = $('<li>', { |
|||
'class': classes.sPageButton+' '+btnClass, |
|||
'id': idx === 0 && typeof button === 'string' ? |
|||
settings.sTableId +'_'+ button : |
|||
null |
|||
} ) |
|||
.append( $('<a>', { |
|||
'href': '#', |
|||
'aria-controls': settings.sTableId, |
|||
'aria-label': aria[ button ], |
|||
'data-dt-idx': counter, |
|||
'tabindex': settings.iTabIndex, |
|||
'class': 'page-link' |
|||
} ) |
|||
.html( btnDisplay ) |
|||
) |
|||
.appendTo( container ); |
|||
|
|||
settings.oApi._fnBindAction( |
|||
node, {action: button}, clickHandler |
|||
); |
|||
|
|||
counter++; |
|||
} |
|||
} |
|||
} |
|||
}; |
|||
|
|||
// IE9 throws an 'unknown error' if document.activeElement is used
|
|||
// inside an iframe or frame.
|
|||
var activeEl; |
|||
|
|||
try { |
|||
// Because this approach is destroying and recreating the paging
|
|||
// elements, focus is lost on the select button which is bad for
|
|||
// accessibility. So we want to restore focus once the draw has
|
|||
// completed
|
|||
activeEl = $(host).find(document.activeElement).data('dt-idx'); |
|||
} |
|||
catch (e) {} |
|||
|
|||
attach( |
|||
$(host).empty().html('<ul class="pagination"/>').children('ul'), |
|||
buttons |
|||
); |
|||
|
|||
if ( activeEl !== undefined ) { |
|||
$(host).find( '[data-dt-idx='+activeEl+']' ).focus(); |
|||
} |
|||
}; |
|||
|
|||
|
|||
return DataTable; |
|||
})); |
|||
File diff suppressed because it is too large
File diff suppressed because it is too large
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 434 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
@ -0,0 +1,431 @@ |
|||
// Unobtrusive validation support library for jQuery and jQuery Validate
|
|||
// Copyright (C) Microsoft Corporation. All rights reserved.
|
|||
// @version v3.2.9
|
|||
|
|||
/*jslint white: true, browser: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: false */ |
|||
/*global document: false, jQuery: false */ |
|||
|
|||
(function (factory) { |
|||
if (typeof define === 'function' && define.amd) { |
|||
// AMD. Register as an anonymous module.
|
|||
define("jquery.validate.unobtrusive", ['jquery.validation'], factory); |
|||
} else if (typeof module === 'object' && module.exports) { |
|||
// CommonJS-like environments that support module.exports
|
|||
module.exports = factory(require('jquery-validation')); |
|||
} else { |
|||
// Browser global
|
|||
jQuery.validator.unobtrusive = factory(jQuery); |
|||
} |
|||
}(function ($) { |
|||
var $jQval = $.validator, |
|||
adapters, |
|||
data_validation = "unobtrusiveValidation"; |
|||
|
|||
function setValidationValues(options, ruleName, value) { |
|||
options.rules[ruleName] = value; |
|||
if (options.message) { |
|||
options.messages[ruleName] = options.message; |
|||
} |
|||
} |
|||
|
|||
function splitAndTrim(value) { |
|||
return value.replace(/^\s+|\s+$/g, "").split(/\s*,\s*/g); |
|||
} |
|||
|
|||
function escapeAttributeValue(value) { |
|||
// As mentioned on http://api.jquery.com/category/selectors/
|
|||
return value.replace(/([!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~])/g, "\\$1"); |
|||
} |
|||
|
|||
function getModelPrefix(fieldName) { |
|||
return fieldName.substr(0, fieldName.lastIndexOf(".") + 1); |
|||
} |
|||
|
|||
function appendModelPrefix(value, prefix) { |
|||
if (value.indexOf("*.") === 0) { |
|||
value = value.replace("*.", prefix); |
|||
} |
|||
return value; |
|||
} |
|||
|
|||
function onError(error, inputElement) { // 'this' is the form element
|
|||
var container = $(this).find("[data-valmsg-for='" + escapeAttributeValue(inputElement[0].name) + "']"), |
|||
replaceAttrValue = container.attr("data-valmsg-replace"), |
|||
replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) !== false : null; |
|||
|
|||
container.removeClass("field-validation-valid").addClass("field-validation-error"); |
|||
error.data("unobtrusiveContainer", container); |
|||
|
|||
if (replace) { |
|||
container.empty(); |
|||
error.removeClass("input-validation-error").appendTo(container); |
|||
} |
|||
else { |
|||
error.hide(); |
|||
} |
|||
} |
|||
|
|||
function onErrors(event, validator) { // 'this' is the form element
|
|||
var container = $(this).find("[data-valmsg-summary=true]"), |
|||
list = container.find("ul"); |
|||
|
|||
if (list && list.length && validator.errorList.length) { |
|||
list.empty(); |
|||
container.addClass("validation-summary-errors").removeClass("validation-summary-valid"); |
|||
|
|||
$.each(validator.errorList, function () { |
|||
$("<li />").html(this.message).appendTo(list); |
|||
}); |
|||
} |
|||
} |
|||
|
|||
function onSuccess(error) { // 'this' is the form element
|
|||
var container = error.data("unobtrusiveContainer"); |
|||
|
|||
if (container) { |
|||
var replaceAttrValue = container.attr("data-valmsg-replace"), |
|||
replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) : null; |
|||
|
|||
container.addClass("field-validation-valid").removeClass("field-validation-error"); |
|||
error.removeData("unobtrusiveContainer"); |
|||
|
|||
if (replace) { |
|||
container.empty(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
function onReset(event) { // 'this' is the form element
|
|||
var $form = $(this), |
|||
key = '__jquery_unobtrusive_validation_form_reset'; |
|||
if ($form.data(key)) { |
|||
return; |
|||
} |
|||
// Set a flag that indicates we're currently resetting the form.
|
|||
$form.data(key, true); |
|||
try { |
|||
$form.data("validator").resetForm(); |
|||
} finally { |
|||
$form.removeData(key); |
|||
} |
|||
|
|||
$form.find(".validation-summary-errors") |
|||
.addClass("validation-summary-valid") |
|||
.removeClass("validation-summary-errors"); |
|||
$form.find(".field-validation-error") |
|||
.addClass("field-validation-valid") |
|||
.removeClass("field-validation-error") |
|||
.removeData("unobtrusiveContainer") |
|||
.find(">*") // If we were using valmsg-replace, get the underlying error
|
|||
.removeData("unobtrusiveContainer"); |
|||
} |
|||
|
|||
function validationInfo(form) { |
|||
var $form = $(form), |
|||
result = $form.data(data_validation), |
|||
onResetProxy = $.proxy(onReset, form), |
|||
defaultOptions = $jQval.unobtrusive.options || {}, |
|||
execInContext = function (name, args) { |
|||
var func = defaultOptions[name]; |
|||
func && $.isFunction(func) && func.apply(form, args); |
|||
}; |
|||
|
|||
if (!result) { |
|||
result = { |
|||
options: { // options structure passed to jQuery Validate's validate() method
|
|||
errorClass: defaultOptions.errorClass || "input-validation-error", |
|||
errorElement: defaultOptions.errorElement || "span", |
|||
errorPlacement: function () { |
|||
onError.apply(form, arguments); |
|||
execInContext("errorPlacement", arguments); |
|||
}, |
|||
invalidHandler: function () { |
|||
onErrors.apply(form, arguments); |
|||
execInContext("invalidHandler", arguments); |
|||
}, |
|||
messages: {}, |
|||
rules: {}, |
|||
success: function () { |
|||
onSuccess.apply(form, arguments); |
|||
execInContext("success", arguments); |
|||
} |
|||
}, |
|||
attachValidation: function () { |
|||
$form |
|||
.off("reset." + data_validation, onResetProxy) |
|||
.on("reset." + data_validation, onResetProxy) |
|||
.validate(this.options); |
|||
}, |
|||
validate: function () { // a validation function that is called by unobtrusive Ajax
|
|||
$form.validate(); |
|||
return $form.valid(); |
|||
} |
|||
}; |
|||
$form.data(data_validation, result); |
|||
} |
|||
|
|||
return result; |
|||
} |
|||
|
|||
$jQval.unobtrusive = { |
|||
adapters: [], |
|||
|
|||
parseElement: function (element, skipAttach) { |
|||
/// <summary>
|
|||
/// Parses a single HTML element for unobtrusive validation attributes.
|
|||
/// </summary>
|
|||
/// <param name="element" domElement="true">The HTML element to be parsed.</param>
|
|||
/// <param name="skipAttach" type="Boolean">[Optional] true to skip attaching the
|
|||
/// validation to the form. If parsing just this single element, you should specify true.
|
|||
/// If parsing several elements, you should specify false, and manually attach the validation
|
|||
/// to the form when you are finished. The default is false.</param>
|
|||
var $element = $(element), |
|||
form = $element.parents("form")[0], |
|||
valInfo, rules, messages; |
|||
|
|||
if (!form) { // Cannot do client-side validation without a form
|
|||
return; |
|||
} |
|||
|
|||
valInfo = validationInfo(form); |
|||
valInfo.options.rules[element.name] = rules = {}; |
|||
valInfo.options.messages[element.name] = messages = {}; |
|||
|
|||
$.each(this.adapters, function () { |
|||
var prefix = "data-val-" + this.name, |
|||
message = $element.attr(prefix), |
|||
paramValues = {}; |
|||
|
|||
if (message !== undefined) { // Compare against undefined, because an empty message is legal (and falsy)
|
|||
prefix += "-"; |
|||
|
|||
$.each(this.params, function () { |
|||
paramValues[this] = $element.attr(prefix + this); |
|||
}); |
|||
|
|||
this.adapt({ |
|||
element: element, |
|||
form: form, |
|||
message: message, |
|||
params: paramValues, |
|||
rules: rules, |
|||
messages: messages |
|||
}); |
|||
} |
|||
}); |
|||
|
|||
$.extend(rules, { "__dummy__": true }); |
|||
|
|||
if (!skipAttach) { |
|||
valInfo.attachValidation(); |
|||
} |
|||
}, |
|||
|
|||
parse: function (selector) { |
|||
/// <summary>
|
|||
/// Parses all the HTML elements in the specified selector. It looks for input elements decorated
|
|||
/// with the [data-val=true] attribute value and enables validation according to the data-val-*
|
|||
/// attribute values.
|
|||
/// </summary>
|
|||
/// <param name="selector" type="String">Any valid jQuery selector.</param>
|
|||
|
|||
// $forms includes all forms in selector's DOM hierarchy (parent, children and self) that have at least one
|
|||
// element with data-val=true
|
|||
var $selector = $(selector), |
|||
$forms = $selector.parents() |
|||
.addBack() |
|||
.filter("form") |
|||
.add($selector.find("form")) |
|||
.has("[data-val=true]"); |
|||
|
|||
$selector.find("[data-val=true]").each(function () { |
|||
$jQval.unobtrusive.parseElement(this, true); |
|||
}); |
|||
|
|||
$forms.each(function () { |
|||
var info = validationInfo(this); |
|||
if (info) { |
|||
info.attachValidation(); |
|||
} |
|||
}); |
|||
} |
|||
}; |
|||
|
|||
adapters = $jQval.unobtrusive.adapters; |
|||
|
|||
adapters.add = function (adapterName, params, fn) { |
|||
/// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation.</summary>
|
|||
/// <param name="adapterName" type="String">The name of the adapter to be added. This matches the name used
|
|||
/// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).</param>
|
|||
/// <param name="params" type="Array" optional="true">[Optional] An array of parameter names (strings) that will
|
|||
/// be extracted from the data-val-nnnn-mmmm HTML attributes (where nnnn is the adapter name, and
|
|||
/// mmmm is the parameter name).</param>
|
|||
/// <param name="fn" type="Function">The function to call, which adapts the values from the HTML
|
|||
/// attributes into jQuery Validate rules and/or messages.</param>
|
|||
/// <returns type="jQuery.validator.unobtrusive.adapters" />
|
|||
if (!fn) { // Called with no params, just a function
|
|||
fn = params; |
|||
params = []; |
|||
} |
|||
this.push({ name: adapterName, params: params, adapt: fn }); |
|||
return this; |
|||
}; |
|||
|
|||
adapters.addBool = function (adapterName, ruleName) { |
|||
/// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where
|
|||
/// the jQuery Validate validation rule has no parameter values.</summary>
|
|||
/// <param name="adapterName" type="String">The name of the adapter to be added. This matches the name used
|
|||
/// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).</param>
|
|||
/// <param name="ruleName" type="String" optional="true">[Optional] The name of the jQuery Validate rule. If not provided, the value
|
|||
/// of adapterName will be used instead.</param>
|
|||
/// <returns type="jQuery.validator.unobtrusive.adapters" />
|
|||
return this.add(adapterName, function (options) { |
|||
setValidationValues(options, ruleName || adapterName, true); |
|||
}); |
|||
}; |
|||
|
|||
adapters.addMinMax = function (adapterName, minRuleName, maxRuleName, minMaxRuleName, minAttribute, maxAttribute) { |
|||
/// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where
|
|||
/// the jQuery Validate validation has three potential rules (one for min-only, one for max-only, and
|
|||
/// one for min-and-max). The HTML parameters are expected to be named -min and -max.</summary>
|
|||
/// <param name="adapterName" type="String">The name of the adapter to be added. This matches the name used
|
|||
/// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).</param>
|
|||
/// <param name="minRuleName" type="String">The name of the jQuery Validate rule to be used when you only
|
|||
/// have a minimum value.</param>
|
|||
/// <param name="maxRuleName" type="String">The name of the jQuery Validate rule to be used when you only
|
|||
/// have a maximum value.</param>
|
|||
/// <param name="minMaxRuleName" type="String">The name of the jQuery Validate rule to be used when you
|
|||
/// have both a minimum and maximum value.</param>
|
|||
/// <param name="minAttribute" type="String" optional="true">[Optional] The name of the HTML attribute that
|
|||
/// contains the minimum value. The default is "min".</param>
|
|||
/// <param name="maxAttribute" type="String" optional="true">[Optional] The name of the HTML attribute that
|
|||
/// contains the maximum value. The default is "max".</param>
|
|||
/// <returns type="jQuery.validator.unobtrusive.adapters" />
|
|||
return this.add(adapterName, [minAttribute || "min", maxAttribute || "max"], function (options) { |
|||
var min = options.params.min, |
|||
max = options.params.max; |
|||
|
|||
if (min && max) { |
|||
setValidationValues(options, minMaxRuleName, [min, max]); |
|||
} |
|||
else if (min) { |
|||
setValidationValues(options, minRuleName, min); |
|||
} |
|||
else if (max) { |
|||
setValidationValues(options, maxRuleName, max); |
|||
} |
|||
}); |
|||
}; |
|||
|
|||
adapters.addSingleVal = function (adapterName, attribute, ruleName) { |
|||
/// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where
|
|||
/// the jQuery Validate validation rule has a single value.</summary>
|
|||
/// <param name="adapterName" type="String">The name of the adapter to be added. This matches the name used
|
|||
/// in the data-val-nnnn HTML attribute(where nnnn is the adapter name).</param>
|
|||
/// <param name="attribute" type="String">[Optional] The name of the HTML attribute that contains the value.
|
|||
/// The default is "val".</param>
|
|||
/// <param name="ruleName" type="String" optional="true">[Optional] The name of the jQuery Validate rule. If not provided, the value
|
|||
/// of adapterName will be used instead.</param>
|
|||
/// <returns type="jQuery.validator.unobtrusive.adapters" />
|
|||
return this.add(adapterName, [attribute || "val"], function (options) { |
|||
setValidationValues(options, ruleName || adapterName, options.params[attribute]); |
|||
}); |
|||
}; |
|||
|
|||
$jQval.addMethod("__dummy__", function (value, element, params) { |
|||
return true; |
|||
}); |
|||
|
|||
$jQval.addMethod("regex", function (value, element, params) { |
|||
var match; |
|||
if (this.optional(element)) { |
|||
return true; |
|||
} |
|||
|
|||
match = new RegExp(params).exec(value); |
|||
return (match && (match.index === 0) && (match[0].length === value.length)); |
|||
}); |
|||
|
|||
$jQval.addMethod("nonalphamin", function (value, element, nonalphamin) { |
|||
var match; |
|||
if (nonalphamin) { |
|||
match = value.match(/\W/g); |
|||
match = match && match.length >= nonalphamin; |
|||
} |
|||
return match; |
|||
}); |
|||
|
|||
if ($jQval.methods.extension) { |
|||
adapters.addSingleVal("accept", "mimtype"); |
|||
adapters.addSingleVal("extension", "extension"); |
|||
} else { |
|||
// for backward compatibility, when the 'extension' validation method does not exist, such as with versions
|
|||
// of JQuery Validation plugin prior to 1.10, we should use the 'accept' method for
|
|||
// validating the extension, and ignore mime-type validations as they are not supported.
|
|||
adapters.addSingleVal("extension", "extension", "accept"); |
|||
} |
|||
|
|||
adapters.addSingleVal("regex", "pattern"); |
|||
adapters.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url"); |
|||
adapters.addMinMax("length", "minlength", "maxlength", "rangelength").addMinMax("range", "min", "max", "range"); |
|||
adapters.addMinMax("minlength", "minlength").addMinMax("maxlength", "minlength", "maxlength"); |
|||
adapters.add("equalto", ["other"], function (options) { |
|||
var prefix = getModelPrefix(options.element.name), |
|||
other = options.params.other, |
|||
fullOtherName = appendModelPrefix(other, prefix), |
|||
element = $(options.form).find(":input").filter("[name='" + escapeAttributeValue(fullOtherName) + "']")[0]; |
|||
|
|||
setValidationValues(options, "equalTo", element); |
|||
}); |
|||
adapters.add("required", function (options) { |
|||
// jQuery Validate equates "required" with "mandatory" for checkbox elements
|
|||
if (options.element.tagName.toUpperCase() !== "INPUT" || options.element.type.toUpperCase() !== "CHECKBOX") { |
|||
setValidationValues(options, "required", true); |
|||
} |
|||
}); |
|||
adapters.add("remote", ["url", "type", "additionalfields"], function (options) { |
|||
var value = { |
|||
url: options.params.url, |
|||
type: options.params.type || "GET", |
|||
data: {} |
|||
}, |
|||
prefix = getModelPrefix(options.element.name); |
|||
|
|||
$.each(splitAndTrim(options.params.additionalfields || options.element.name), function (i, fieldName) { |
|||
var paramName = appendModelPrefix(fieldName, prefix); |
|||
value.data[paramName] = function () { |
|||
var field = $(options.form).find(":input").filter("[name='" + escapeAttributeValue(paramName) + "']"); |
|||
// For checkboxes and radio buttons, only pick up values from checked fields.
|
|||
if (field.is(":checkbox")) { |
|||
return field.filter(":checked").val() || field.filter(":hidden").val() || ''; |
|||
} |
|||
else if (field.is(":radio")) { |
|||
return field.filter(":checked").val() || ''; |
|||
} |
|||
return field.val(); |
|||
}; |
|||
}); |
|||
|
|||
setValidationValues(options, "remote", value); |
|||
}); |
|||
adapters.add("password", ["min", "nonalphamin", "regex"], function (options) { |
|||
if (options.params.min) { |
|||
setValidationValues(options, "minlength", options.params.min); |
|||
} |
|||
if (options.params.nonalphamin) { |
|||
setValidationValues(options, "nonalphamin", options.params.nonalphamin); |
|||
} |
|||
if (options.params.regex) { |
|||
setValidationValues(options, "regex", options.params.regex); |
|||
} |
|||
}); |
|||
adapters.add("fileextensions", ["extensions"], function (options) { |
|||
setValidationValues(options, "extension", options.params.extensions); |
|||
}); |
|||
|
|||
$(function () { |
|||
$jQval.unobtrusive.parse(document); |
|||
}); |
|||
|
|||
return $jQval.unobtrusive; |
|||
})); |
|||
File diff suppressed because it is too large
@ -0,0 +1,35 @@ |
|||
(function( factory ) { |
|||
if ( typeof define === "function" && define.amd ) { |
|||
define( ["jquery", "../jquery.validate"], factory ); |
|||
} else if (typeof module === "object" && module.exports) { |
|||
module.exports = factory( require( "jquery" ) ); |
|||
} else { |
|||
factory( jQuery ); |
|||
} |
|||
}(function( $ ) { |
|||
|
|||
/* |
|||
* Translated default messages for the jQuery validation plugin. |
|||
* Locale: AR (Arabic; العربية) |
|||
*/ |
|||
$.extend( $.validator.messages, { |
|||
required: "هذا الحقل إلزامي", |
|||
remote: "يرجى تصحيح هذا الحقل للمتابعة", |
|||
email: "رجاء إدخال عنوان بريد إلكتروني صحيح", |
|||
url: "رجاء إدخال عنوان موقع إلكتروني صحيح", |
|||
date: "رجاء إدخال تاريخ صحيح", |
|||
dateISO: "رجاء إدخال تاريخ صحيح (ISO)", |
|||
number: "رجاء إدخال عدد بطريقة صحيحة", |
|||
digits: "رجاء إدخال أرقام فقط", |
|||
creditcard: "رجاء إدخال رقم بطاقة ائتمان صحيح", |
|||
equalTo: "رجاء إدخال نفس القيمة", |
|||
extension: "رجاء إدخال ملف بامتداد موافق عليه", |
|||
maxlength: $.validator.format( "الحد الأقصى لعدد الحروف هو {0}" ), |
|||
minlength: $.validator.format( "الحد الأدنى لعدد الحروف هو {0}" ), |
|||
rangelength: $.validator.format( "عدد الحروف يجب أن يكون بين {0} و {1}" ), |
|||
range: $.validator.format( "رجاء إدخال عدد قيمته بين {0} و {1}" ), |
|||
max: $.validator.format( "رجاء إدخال عدد أقل من أو يساوي {0}" ), |
|||
min: $.validator.format( "رجاء إدخال عدد أكبر من أو يساوي {0}" ) |
|||
} ); |
|||
return $; |
|||
})); |
|||
@ -0,0 +1,35 @@ |
|||
(function( factory ) { |
|||
if ( typeof define === "function" && define.amd ) { |
|||
define( ["jquery", "../jquery.validate"], factory ); |
|||
} else if (typeof module === "object" && module.exports) { |
|||
module.exports = factory( require( "jquery" ) ); |
|||
} else { |
|||
factory( jQuery ); |
|||
} |
|||
}(function( $ ) { |
|||
|
|||
/* |
|||
* Translated default messages for the jQuery validation plugin. |
|||
* Locale: Az (Azeri; azərbaycan dili) |
|||
*/ |
|||
$.extend( $.validator.messages, { |
|||
required: "Bu xana mütləq doldurulmalıdır.", |
|||
remote: "Zəhmət olmasa, düzgün məna daxil edin.", |
|||
email: "Zəhmət olmasa, düzgün elektron poçt daxil edin.", |
|||
url: "Zəhmət olmasa, düzgün URL daxil edin.", |
|||
date: "Zəhmət olmasa, düzgün tarix daxil edin.", |
|||
dateISO: "Zəhmət olmasa, düzgün ISO formatlı tarix daxil edin.", |
|||
number: "Zəhmət olmasa, düzgün rəqəm daxil edin.", |
|||
digits: "Zəhmət olmasa, yalnız rəqəm daxil edin.", |
|||
creditcard: "Zəhmət olmasa, düzgün kredit kart nömrəsini daxil edin.", |
|||
equalTo: "Zəhmət olmasa, eyni mənanı bir daha daxil edin.", |
|||
extension: "Zəhmət olmasa, düzgün genişlənməyə malik faylı seçin.", |
|||
maxlength: $.validator.format( "Zəhmət olmasa, {0} simvoldan çox olmayaraq daxil edin." ), |
|||
minlength: $.validator.format( "Zəhmət olmasa, {0} simvoldan az olmayaraq daxil edin." ), |
|||
rangelength: $.validator.format( "Zəhmət olmasa, {0} - {1} aralığında uzunluğa malik simvol daxil edin." ), |
|||
range: $.validator.format( "Zəhmət olmasa, {0} - {1} aralığında rəqəm daxil edin." ), |
|||
max: $.validator.format( "Zəhmət olmasa, {0} və ondan kiçik rəqəm daxil edin." ), |
|||
min: $.validator.format( "Zəhmət olmasa, {0} və ondan böyük rəqəm daxil edin" ) |
|||
} ); |
|||
return $; |
|||
})); |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue