Added Favicon support, Progressive Web App support, page title and url support, and private/public user registration options

This commit is contained in:
Shaun Walker
2020-03-30 20:42:43 -04:00
parent 928111dbac
commit 35f87d25be
23 changed files with 422 additions and 47 deletions

View File

@ -12,7 +12,7 @@
<table class="table table-borderless">
<tr>
<td>
<label class="control-label">Name: </label>
<label class="control-label">Name: </label>
</td>
<td>
<input class="form-control" @bind="@_name" />
@ -20,7 +20,7 @@
</tr>
<tr>
<td>
<label class="control-label">Tenant: </label>
<label class="control-label">Tenant: </label>
</td>
<td>
<input class="form-control" @bind="@_tenant" readonly />
@ -28,7 +28,7 @@
</tr>
<tr>
<td>
<label class="control-label">Aliases: </label>
<label class="control-label">Aliases: </label>
</td>
<td>
<textarea class="form-control" @bind="@_urls" rows="3"></textarea>
@ -36,15 +36,23 @@
</tr>
<tr>
<td>
<label class="control-label">Logo: </label>
<label class="control-label">Logo: </label>
</td>
<td>
<FileManager FileId="@_logofileid.ToString()" @ref="_filemanager" />
<FileManager FileId="@_logofileid.ToString()" Filter="@Constants.ImageFiles" @ref="_logofilemanager" />
</td>
</tr>
<tr>
<td>
<label class="control-label">Default Theme: </label>
<label class="control-label">Favicon: </label>
</td>
<td>
<FileManager FileId="@_faviconfileid.ToString()" Filter="ico" @ref="_faviconfilemanager" />
</td>
</tr>
<tr>
<td>
<label class="control-label">Default Theme: </label>
</td>
<td>
<select class="form-control" @onchange="(e => ThemeChanged(e))">
@ -65,7 +73,7 @@
</tr>
<tr>
<td>
<label class="control-label">Default Layout: </label>
<label class="control-label">Default Layout: </label>
</td>
<td>
<select class="form-control" @bind="@_layouttype">
@ -79,7 +87,7 @@
</tr>
<tr>
<td>
<label class="control-label">Default Container: </label>
<label class="control-label">Default Container: </label>
</td>
<td>
<select class="form-control" @bind="@_containertype">
@ -93,7 +101,18 @@
</tr>
<tr>
<td>
<label class="control-label">Is Deleted? </label>
<label class="control-label">Allow User Registration? </label>
</td>
<td>
<select class="form-control" @bind="@_allowregistration">
<option value="True">Yes</option>
<option value="False">No</option>
</select>
</td>
</tr>
<tr>
<td>
<label class="control-label">Is Deleted? </label>
</td>
<td>
<select class="form-control" @bind="@_isdeleted">
@ -111,7 +130,7 @@
<table class="table table-borderless">
<tr>
<td>
<label class="control-label">Host: </label>
<label class="control-label">Host: </label>
</td>
<td>
<input class="form-control" @bind="@_smtphost" />
@ -119,7 +138,7 @@
</tr>
<tr>
<td>
<label class="control-label">Port: </label>
<label class="control-label">Port: </label>
</td>
<td>
<input class="form-control" @bind="@_smtpport" />
@ -127,7 +146,7 @@
</tr>
<tr>
<td>
<label class="control-label">SSL Enabled: </label>
<label class="control-label">SSL Enabled: </label>
</td>
<td>
<input class="form-control" @bind="@_smtpssl" />
@ -135,7 +154,7 @@
</tr>
<tr>
<td>
<label class="control-label">Username: </label>
<label class="control-label">Username: </label>
</td>
<td>
<input class="form-control" @bind="@_smtpusername" />
@ -143,7 +162,7 @@
</tr>
<tr>
<td>
<label class="control-label">Password: </label>
<label class="control-label">Password: </label>
</td>
<td>
<input type="password" class="form-control" @bind="@_smtppassword" />
@ -151,6 +170,43 @@
</tr>
</table>
</div>
<a data-toggle="collapse" class="app-link-unstyled" href="#PWA" aria-expanded="false" aria-controls="PWA">
<h5><i class="oi oi-chevron-bottom"></i>&nbsp;Progressive Web Application Settings</h5><hr class="app-rule" />
</a>
<div class="collapse" id="PWA">
<table class="table table-borderless">
<tr>
<td>
<label class="control-label">Is Enabled? </label>
</td>
<td>
<select class="form-control" @bind="@_pwaisenabled">
<option value="True">Yes</option>
<option value="False">No</option>
</select>
</td>
</tr>
<tr>
<td>
<label class="control-label">App Icon: </label>
</td>
<td>
<FileManager FileId="@_pwaappiconfileid.ToString()" Filter="png" @ref="_pwaappiconfilemanager" />
</td>
</tr>
<tr>
<td>
<label class="control-label">Splash Icon: </label>
</td>
<td>
<FileManager FileId="@_pwasplashiconfileid.ToString()" Filter="png" @ref="_pwasplashiconfilemanager" />
</td>
</tr>
</table>
</div>
<br />
<button type="button" class="btn btn-success" @onclick="SaveSite">Save</button>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
@ -173,10 +229,13 @@
List<Alias> _aliasList;
string _urls = "";
int _logofileid = -1;
FileManager _filemanager;
FileManager _logofilemanager;
int _faviconfileid = -1;
FileManager _faviconfilemanager;
string _themetype;
string _layouttype;
string _containertype;
string _allowregistration;
string _smtphost = "";
string _smtpport = "";
@ -184,6 +243,12 @@
string _smtpusername = "";
string _smtppassword = "";
string _pwaisenabled;
int _pwaappiconfileid = -1;
FileManager _pwaappiconfilemanager;
int _pwasplashiconfileid = -1;
FileManager _pwasplashiconfilemanager;
string _createdby;
DateTime _createdon;
string _modifiedby;
@ -212,10 +277,15 @@
{
_logofileid = site.LogoFileId.Value;
}
if (site.FaviconFileId != null)
{
_faviconfileid = site.FaviconFileId.Value;
}
_themetype = site.DefaultThemeType;
_panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype);
_layouttype = site.DefaultLayoutType;
_containertype = site.DefaultContainerType;
_allowregistration = site.AllowRegistration.ToString();
Dictionary<string, string> settings = await SettingService.GetSiteSettingsAsync(site.SiteId);
_smtphost = SettingService.GetSetting(settings, "SMTPHost", "");
@ -224,6 +294,16 @@
_smtpusername = SettingService.GetSetting(settings, "SMTPUsername", "");
_smtppassword = SettingService.GetSetting(settings, "SMTPPassword", "");
_pwaisenabled = site.PwaIsEnabled.ToString();
if (site.PwaAppIconFileId != null)
{
_pwaappiconfileid = site.PwaAppIconFileId.Value;
}
if (site.PwaSplashIconFileId != null)
{
_pwasplashiconfileid = site.PwaSplashIconFileId.Value;
}
_createdby = site.CreatedBy;
_createdon = site.CreatedOn;
_modifiedby = site.ModifiedBy;
@ -286,16 +366,34 @@
{
site.Name = _name;
site.LogoFileId = null;
int logofileid = _filemanager.GetFileId();
int logofileid = _logofilemanager.GetFileId();
if (logofileid != -1)
{
site.LogoFileId = logofileid;
}
int faviconfileid = _faviconfilemanager.GetFileId();
if (faviconfileid != -1)
{
site.FaviconFileId = faviconfileid;
}
site.DefaultThemeType = _themetype;
site.DefaultLayoutType = (_layouttype == null ? "" : _layouttype);
site.DefaultContainerType = _containertype;
site.AllowRegistration = (_allowregistration == null ? true : Boolean.Parse(_allowregistration));
site.IsDeleted = (_isdeleted == null ? true : Boolean.Parse(_isdeleted));
site.PwaIsEnabled = (_pwaisenabled == null ? true : Boolean.Parse(_pwaisenabled));
int pwaappiconfileid = _pwaappiconfilemanager.GetFileId();
if (pwaappiconfileid != -1)
{
site.PwaAppIconFileId = pwaappiconfileid;
}
int pwasplashiconfileid = _pwasplashiconfilemanager.GetFileId();
if (pwasplashiconfileid != -1)
{
site.PwaSplashIconFileId = pwasplashiconfileid;
}
site = await SiteService.UpdateSiteAsync(site, PageState.Alias);
_urls = _urls.Replace("\n", ",");