This commit is contained in:
2021-07-10 14:23:14 +01:00
parent 03ea1058be
commit 10907d3aff
97 changed files with 2048 additions and 521 deletions
@@ -69,6 +69,8 @@ namespace Saxonite.Net.Core.Web.Base.App
applicationParams.Add("Documents root", SessionConfig.Documents.RootFolder);
applicationParams.Add("Email context", SessionConfig.Email.Context + (!StringUtil.IsEmpty(EmailConfig.SMTP.Server) ? " [" + EmailConfig.SMTP.Server + "]" : ""));
SaLogger.Info(fn + " Application start." + applicationParams.Select(item => StringUtil.PadRight(item.Item1 + ":", 20, ' ') + item.Item2).Concat("", "\n\t"), true);
if (StringUtil.IsEmpty(EmailConfig.SMTP.Server) || StringUtil.IsEmpty(EmailConfig.Message.AddressFrom))
SaLogger.Warn(fn + " Incomplete email configuration.", true);
}
//-------------------------------------------------------------------
@@ -40,6 +40,16 @@ namespace Saxonite.Net.Core.Web.Base.App
foreach (ConfigurationSection environment in configSection.GetSection("Environments").GetChildren())
environments.Add(StringUtil.TrimAll(environment.Value));
Instance = StringUtil.OnEmpty(configSection["Instance"], Instance);
// URLs.
IConfigurationSection urls = configSection.GetSection("URLs");
if (urls.Exists())
{
IConfigurationSection onlineUrls = urls.GetSection("Online");
if (onlineUrls.Exists())
{
URL.Online.Root = onlineUrls["Root"];
}
}
// Security.
IConfigurationSection security = configSection.GetSection("Security");
if (security.Exists())
@@ -124,6 +134,16 @@ namespace Saxonite.Net.Core.Web.Base.App
public String Context { get; }
public List<String> Environments { get { return new List<String>(environments); } }
public String Instance { get; set; } = "";
// URLs.
public class URLConfig
{
public class OnlineConfig
{
public String Root { get; set; }
}
public OnlineConfig Online { get; } = new OnlineConfig();
}
public URLConfig URL { get; } = new URLConfig();
// Security.
public class SecurityConfig
{
@@ -1,6 +0,0 @@
namespace Saxonite.Net.Core.Web.Base.App
{
internal class SaxyAuthenticationHandler
{
}
}
@@ -109,13 +109,13 @@ namespace Saxonite.Net.Core.Web.Base.Controllers
// Redirection locations.
//-------------------------------------------------------------------
public static readonly String ParamName_SessionExpired = "SessionExpired";
protected enum RedirectLocation
public enum RedirectLocation
{
WebAppBase,
WebAppHome,
WebAppHome_SessionExpired,
}
protected String GetRedirectLocation(RedirectLocation redirectLocation)
public String GetRedirectLocation(RedirectLocation redirectLocation)
{
string protocol = Request.Scheme;
var parameters = new RouteValueDictionary();
@@ -481,7 +481,7 @@ namespace Saxonite.Net.Core.Web.Base.Controllers
public class PagingData
{
public PagingData(SaxModel_Base model) :
this(model.DataPageNo, model.DataPageLength, model.DataItemCount, model.DataItemTotal)
this(model.Paging.PageNo, model.Paging.PageLength, model.Paging.ItemCount, model.Paging.ItemTotal)
{ }
public PagingData(uint pageNo, ushort pageLength, ushort itemCount, ulong itemTotal)
{
+13 -8
View File
@@ -87,7 +87,7 @@ namespace Saxonite.Net.Core.Web.Base.Models
{
return Internals.GetUserAccountDisplayName(userAccountId);
}
// User Accounts.
// Organisations.
public SaxOrganisation GetOrganisation(SysId organisationId)
{
return Internals.GetOrganisation(organisationId);
@@ -292,15 +292,20 @@ namespace Saxonite.Net.Core.Web.Base.Models
public ushort PageLength { get { return paging.PageLength; } set { paging.PageLength = value; } }
public uint PageCount { get { return (PageLength > 0 ? (uint)Math.Ceiling((decimal)ItemTotal / PageLength) : 0); } }
public ushort ItemCount { get; set; }
public ulong ItemTotal { get; set; }
private ulong itemTotal = 0;
public ulong ItemTotal
{
get { return itemTotal; }
set
{
itemTotal = value;
// Check whether the total number of items is less than the current page and reduce page no if needed.
if (IsPaged && (PageNo - 1) * PageLength > itemTotal)
PageNo = (uint)((itemTotal - 1) / PageLength + 1);
}
}
}
public DataPaging Paging { get; } = new DataPaging();
public bool DataPaged { get { return Paging.IsPaged; } }
public uint DataPageNo { get { return Paging.PageNo; } set { Paging.PageNo = value; } }
public ushort DataPageLength { get { return Paging.PageLength; } set { Paging.PageLength = value; } }
public uint DataPageCount { get { return (DataPageLength > 0 ? (uint)Math.Ceiling((decimal)DataItemTotal / DataPageLength) : 0); } }
public ushort DataItemCount { get; set; }
public ulong DataItemTotal { get; set; }
public void PopulatePagingTo(DbQuery.Paging resultsPaging)
{
Paging.PopulatePagingTo(resultsPaging);
+1 -1
View File
@@ -22,7 +22,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="3.1.13" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="3.1.16" />
</ItemGroup>
</Project>