@@ -399,7 +399,7 @@
|
|||||||
<option value="-1"><@SharedLocalizer["Not Specified"]></option>
|
<option value="-1"><@SharedLocalizer["Not Specified"]></option>
|
||||||
@foreach (var alias in _aliases)
|
@foreach (var alias in _aliases)
|
||||||
{
|
{
|
||||||
<option value="@alias.AliasId">@alias.Name</option>
|
<option value="@alias.AliasId">@alias.Name @((alias.IsDefault) ? "(" + Localizer["Default"] + ")" : "")</option>
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
@if (!_addAlias)
|
@if (!_addAlias)
|
||||||
@@ -472,21 +472,6 @@
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@if (_siteGroupDefinitionId != -1 || _addSiteGroupDefinition)
|
@if (_siteGroupDefinitionId != -1 || _addSiteGroupDefinition)
|
||||||
{
|
|
||||||
@if (!_addSiteGroupDefinition)
|
|
||||||
{
|
|
||||||
<div class="row mb-1 align-items-center">
|
|
||||||
<Label Class="col-sm-3" For="member" HelpText="Indicates if the current site is a member of the selected group" ResourceKey="GroupMember">Member? </Label>
|
|
||||||
<div class="col-sm-9">
|
|
||||||
<select id="member" class="form-select" value="@_member" @onchange="(e => MemberChanged(e))">
|
|
||||||
<option value="False">@SharedLocalizer["No"]</option>
|
|
||||||
<option value="Primary">@Localizer["Primary"]</option>
|
|
||||||
<option value="Secondary">@Localizer["Secondary"]</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
@if (_member == "Primary")
|
|
||||||
{
|
{
|
||||||
<div class="row mb-1 align-items-center">
|
<div class="row mb-1 align-items-center">
|
||||||
<Label Class="col-sm-3" For="groupname" HelpText="Name of the site group" ResourceKey="GroupName">Group Name: </Label>
|
<Label Class="col-sm-3" For="groupname" HelpText="Name of the site group" ResourceKey="GroupName">Group Name: </Label>
|
||||||
@@ -498,8 +483,18 @@
|
|||||||
<Label Class="col-sm-3" For="synchronization" HelpText="Specifies if the group supports content synchronization between the primary site and other sites in the group" ResourceKey="Synchronization">Synchronization? </Label>
|
<Label Class="col-sm-3" For="synchronization" HelpText="Specifies if the group supports content synchronization between the primary site and other sites in the group" ResourceKey="Synchronization">Synchronization? </Label>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
<select id="synchronization" class="form-select" @bind="@_synchronization">
|
<select id="synchronization" class="form-select" @bind="@_synchronization">
|
||||||
<option value="True">@SharedLocalizer["Yes"]</option>
|
|
||||||
<option value="False">@SharedLocalizer["No"]</option>
|
<option value="False">@SharedLocalizer["No"]</option>
|
||||||
|
<option value="Compare">@Localizer["Compare"]</option>
|
||||||
|
<option value="Update">@Localizer["Update"]</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-1 align-items-center">
|
||||||
|
<Label Class="col-sm-3" For="notify" HelpText="Specifies if the site administrator of secondary sites should be notified of any synchronization activity" ResourceKey="Notify">Notify? </Label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<select id="notify" class="form-select" @bind="@_notify">
|
||||||
|
<option value="False">@SharedLocalizer["No"]</option>
|
||||||
|
<option value="True">@SharedLocalizer["Yes"]</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -513,29 +508,40 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@if (_member == "Secondary")
|
@if (_siteGroupDefinitionId != -1)
|
||||||
{
|
{
|
||||||
<div class="row mb-1 align-items-center">
|
<div class="row mb-1 align-items-center">
|
||||||
<Label Class="col-sm-3" For="synchronize" HelpText="Specifies the synchronization approach from the primary site to the current site" ResourceKey="Approach">Synchronization: </Label>
|
<Label Class="col-sm-3" For="site" HelpText="The sites in this tenant (database)" ResourceKey="Site">Site: </Label>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
<select id="synchronize" class="form-select" @bind="@_synchronize">
|
<div class="input-group">
|
||||||
<option value="False">@Localizer["Compare"]</option>
|
<select id="site" class="form-select" value="@_siteId" @onchange="(e => SiteChanged(e))">
|
||||||
<option value="True">@Localizer["Update"]</option>
|
<option value="-1"><@SharedLocalizer["Not Specified"]></option>
|
||||||
|
@foreach (var site in _sites)
|
||||||
|
{
|
||||||
|
<option value="@site.SiteId">@site.Name @((!string.IsNullOrEmpty(site.Fingerprint)) ? "(" + Localizer[site.Fingerprint] + ")" : "")</option>
|
||||||
|
}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row mb-1 align-items-center">
|
|
||||||
<Label Class="col-sm-3" For="notifyrolename" HelpText="Optionally specifies a role in the current site whose users should be notified of content changes in the primary site" ResourceKey="NotifyRole">Notify Role: </Label>
|
|
||||||
<div class="col-sm-9">
|
|
||||||
<input id="notifyrolename" class="form-control" @bind="@_notifyRoleName" />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
@if (_siteGroupDefinitionId != -1 && _siteId != -1)
|
||||||
|
{
|
||||||
|
<div class="row mb-1 align-items-center">
|
||||||
|
<Label Class="col-sm-3" For="member" HelpText="Indicates if the current site is a member of the selected group" ResourceKey="GroupMember">Member? </Label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<select id="member" class="form-select" @bind="@_member">
|
||||||
|
<option value="False">@SharedLocalizer["No"]</option>
|
||||||
|
<option value="Primary">@Localizer["Primary"]</option>
|
||||||
|
<option value="Secondary">@Localizer["Secondary"]</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
<div class="row mb-1 align-items-center">
|
<div class="row mb-1 align-items-center">
|
||||||
<div class="col-sm-3"></div>
|
<div class="col-sm-3"></div>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
@if ((_siteGroupDefinitionId != -1 || _addSiteGroupDefinition) && _member != "False")
|
@if ((_siteGroupDefinitionId != -1 || _addSiteGroupDefinition))
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-success me-2" @onclick="SaveSiteGroup">@SharedLocalizer["Save"]</button>
|
<button type="button" class="btn btn-success me-2" @onclick="SaveSiteGroup">@SharedLocalizer["Save"]</button>
|
||||||
}
|
}
|
||||||
@@ -577,7 +583,7 @@
|
|||||||
<br />
|
<br />
|
||||||
<button type="button" class="btn btn-success" @onclick="SaveSite">@SharedLocalizer["Save"]</button>
|
<button type="button" class="btn btn-success" @onclick="SaveSite">@SharedLocalizer["Save"]</button>
|
||||||
<ActionDialog Header="Delete Site" Message="@Localizer["Confirm.DeleteSite"]" Action="Delete" Security="SecurityAccessLevel.Host" Class="btn btn-danger" OnClick="@(async () => await DeleteSite())" ResourceKey="DeleteSite" />
|
<ActionDialog Header="Delete Site" Message="@Localizer["Confirm.DeleteSite"]" Action="Delete" Security="SecurityAccessLevel.Host" Class="btn btn-danger" OnClick="@(async () => await DeleteSite())" ResourceKey="DeleteSite" />
|
||||||
@if (UserSecurity.IsAuthorized(PageState.User, RoleNames.Host) && _siteGroupDefinitions.Any(item => item.PrimarySiteId == PageState.Site.SiteId && item.Synchronization))
|
@if (UserSecurity.IsAuthorized(PageState.User, RoleNames.Host) && _siteGroupDefinitions.Any(item => item.PrimarySiteId == PageState.Site.SiteId && item.Synchronization != null))
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-primary ms-1" @onclick="SynchronizeSite">@Localizer["Synchronize"]</button>
|
<button type="button" class="btn btn-primary ms-1" @onclick="SynchronizeSite">@Localizer["Synchronize"]</button>
|
||||||
}
|
}
|
||||||
@@ -645,26 +651,27 @@
|
|||||||
private int _pwasplashiconfileid = -1;
|
private int _pwasplashiconfileid = -1;
|
||||||
private FileManager _pwasplashiconfilemanager;
|
private FileManager _pwasplashiconfilemanager;
|
||||||
|
|
||||||
private List<Alias> _aliases;
|
|
||||||
private int _aliasid = -1;
|
|
||||||
private string _aliasname;
|
|
||||||
private string _defaultalias;
|
|
||||||
private bool _addAlias = false;
|
|
||||||
|
|
||||||
private string _rendermode = RenderModes.Interactive;
|
private string _rendermode = RenderModes.Interactive;
|
||||||
private string _enhancednavigation = "True";
|
private string _enhancednavigation = "True";
|
||||||
private string _runtime = Runtimes.Server;
|
private string _runtime = Runtimes.Server;
|
||||||
private string _prerender = "True";
|
private string _prerender = "True";
|
||||||
private string _hybrid = "False";
|
private string _hybrid = "False";
|
||||||
|
|
||||||
private List<Models.SiteGroupDefinition> _siteGroupDefinitions = new List<Models.SiteGroupDefinition>();
|
private List<Alias> _aliases;
|
||||||
|
private int _aliasid = -1;
|
||||||
|
private string _aliasname;
|
||||||
|
private string _defaultalias;
|
||||||
|
private bool _addAlias = false;
|
||||||
|
|
||||||
|
private List<SiteGroupDefinition> _siteGroupDefinitions = new List<SiteGroupDefinition>();
|
||||||
|
private List<Site> _sites = new List<Site>();
|
||||||
private int _siteGroupDefinitionId = -1;
|
private int _siteGroupDefinitionId = -1;
|
||||||
|
private int _siteId = -1;
|
||||||
private string _groupName = string.Empty;
|
private string _groupName = string.Empty;
|
||||||
private string _member = "Primary";
|
private string _synchronization = "Update";
|
||||||
private string _synchronization = "True";
|
private string _notify = "True";
|
||||||
private string _synchronize = "True";
|
|
||||||
private string _notifyRoleName = RoleNames.Admin;
|
|
||||||
private string _localization = "False";
|
private string _localization = "False";
|
||||||
|
private string _member = "Primary";
|
||||||
private bool _addSiteGroupDefinition = false;
|
private bool _addSiteGroupDefinition = false;
|
||||||
|
|
||||||
private string _tenant = string.Empty;
|
private string _tenant = string.Empty;
|
||||||
@@ -1246,36 +1253,80 @@
|
|||||||
if (group != null)
|
if (group != null)
|
||||||
{
|
{
|
||||||
_groupName = group.Name;
|
_groupName = group.Name;
|
||||||
_member = (group.PrimarySiteId == PageState.Site.SiteId) ? "Primary" : "Secondary";
|
if (group.Synchronization == null)
|
||||||
_synchronization = group.Synchronization.ToString();
|
|
||||||
_localization = group.Localization.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
var siteGroup = await SiteGroupService.GetSiteGroupAsync(PageState.Site.SiteId, _siteGroupDefinitionId);
|
|
||||||
if (siteGroup != null)
|
|
||||||
{
|
{
|
||||||
_synchronize = siteGroup.Synchronize.ToString();
|
_synchronization = "False";
|
||||||
_notifyRoleName = siteGroup.NotifyRoleName;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
_synchronization = (group.Synchronization.Value) ? "Update" : "Compare";
|
||||||
|
}
|
||||||
|
_notify = group.Notify.ToString();
|
||||||
|
_localization = group.Localization.ToString();
|
||||||
|
|
||||||
|
if (_sites.Count == 0)
|
||||||
|
{
|
||||||
|
_sites = await SiteService.GetSitesAsync();
|
||||||
|
}
|
||||||
|
_siteId = PageState.Site.SiteId;
|
||||||
_member = "False";
|
_member = "False";
|
||||||
_synchronize = "True";
|
|
||||||
_notifyRoleName = RoleNames.Admin;
|
var siteGroups = await SiteGroupService.GetSiteGroupsAsync(-1, _siteGroupDefinitionId);
|
||||||
|
foreach (var site in _sites)
|
||||||
|
{
|
||||||
|
site.Fingerprint = ""; // used as temporary state
|
||||||
|
var siteGroup = siteGroups.FirstOrDefault(item => item.SiteId == site.SiteId);
|
||||||
|
if (siteGroup != null)
|
||||||
|
{
|
||||||
|
if (group.PrimarySiteId == site.SiteId)
|
||||||
|
{
|
||||||
|
site.Fingerprint = "Primary";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
site.Fingerprint = "Secondary";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (siteGroup.SiteId == _siteId)
|
||||||
|
{
|
||||||
|
_member = site.Fingerprint;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void MemberChanged(ChangeEventArgs e)
|
private async void SiteChanged(ChangeEventArgs e)
|
||||||
{
|
{
|
||||||
_member = e.Value.ToString();
|
_siteId = int.Parse(e.Value.ToString());
|
||||||
|
if (_siteId != -1)
|
||||||
|
{
|
||||||
|
var siteGroup = await SiteGroupService.GetSiteGroupAsync(_siteId, _siteGroupDefinitionId);
|
||||||
|
if (siteGroup != null)
|
||||||
|
{
|
||||||
|
if (siteGroup.SiteGroupDefinition.PrimarySiteId == _siteId)
|
||||||
|
{
|
||||||
|
_member = "Primary";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_member = "Secondary";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_member = "False";
|
||||||
|
}
|
||||||
|
}
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task AddSiteGroup()
|
private async Task AddSiteGroup()
|
||||||
{
|
{
|
||||||
_groupName = "";
|
_groupName = "";
|
||||||
|
_siteId = PageState.Site.SiteId;
|
||||||
_member = "Primary";
|
_member = "Primary";
|
||||||
_addSiteGroupDefinition = true;
|
_addSiteGroupDefinition = true;
|
||||||
}
|
}
|
||||||
@@ -1284,6 +1335,10 @@
|
|||||||
{
|
{
|
||||||
SiteGroupDefinition siteGroupDefinition = null;
|
SiteGroupDefinition siteGroupDefinition = null;
|
||||||
|
|
||||||
|
bool? synchronization = null;
|
||||||
|
if (_synchronization == "Compare") synchronization = false;
|
||||||
|
if (_synchronization == "Update") synchronization = true;
|
||||||
|
|
||||||
if (_siteGroupDefinitionId == -1)
|
if (_siteGroupDefinitionId == -1)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(_groupName))
|
if (!string.IsNullOrEmpty(_groupName))
|
||||||
@@ -1291,8 +1346,9 @@
|
|||||||
siteGroupDefinition = new Models.SiteGroupDefinition
|
siteGroupDefinition = new Models.SiteGroupDefinition
|
||||||
{
|
{
|
||||||
Name = _groupName,
|
Name = _groupName,
|
||||||
PrimarySiteId = PageState.Site.SiteId,
|
PrimarySiteId = _siteId,
|
||||||
Synchronization = bool.Parse(_synchronization),
|
Synchronization = synchronization,
|
||||||
|
Notify = bool.Parse(_notify),
|
||||||
Localization = bool.Parse(_localization),
|
Localization = bool.Parse(_localization),
|
||||||
Synchronize = false
|
Synchronize = false
|
||||||
};
|
};
|
||||||
@@ -1303,25 +1359,14 @@
|
|||||||
{
|
{
|
||||||
siteGroupDefinition = _siteGroupDefinitions.FirstOrDefault(item => item.SiteGroupDefinitionId == _siteGroupDefinitionId);
|
siteGroupDefinition = _siteGroupDefinitions.FirstOrDefault(item => item.SiteGroupDefinitionId == _siteGroupDefinitionId);
|
||||||
if (siteGroupDefinition != null && !string.IsNullOrEmpty(_groupName))
|
if (siteGroupDefinition != null && !string.IsNullOrEmpty(_groupName))
|
||||||
{
|
|
||||||
if (_member == "False")
|
|
||||||
{
|
|
||||||
var siteGroup = await SiteGroupService.GetSiteGroupAsync(PageState.Site.SiteId, siteGroupDefinition.SiteGroupDefinitionId);
|
|
||||||
if (siteGroup != null)
|
|
||||||
{
|
|
||||||
await SiteGroupService.DeleteSiteGroupAsync(siteGroup.SiteGroupId);
|
|
||||||
}
|
|
||||||
siteGroupDefinition = null;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
siteGroupDefinition.Name = _groupName;
|
siteGroupDefinition.Name = _groupName;
|
||||||
siteGroupDefinition.PrimarySiteId = (_member == "Primary") ? PageState.Site.SiteId : siteGroupDefinition.PrimarySiteId;
|
siteGroupDefinition.PrimarySiteId = (_member == "Primary") ? _siteId : siteGroupDefinition.PrimarySiteId;
|
||||||
siteGroupDefinition.Synchronization = bool.Parse(_synchronization);
|
siteGroupDefinition.Synchronization = synchronization;
|
||||||
|
siteGroupDefinition.Notify = bool.Parse(_notify);
|
||||||
siteGroupDefinition.Localization = bool.Parse(_localization);
|
siteGroupDefinition.Localization = bool.Parse(_localization);
|
||||||
siteGroupDefinition = await SiteGroupDefinitionService.UpdateSiteGroupDefinitionAsync(siteGroupDefinition);
|
siteGroupDefinition = await SiteGroupDefinitionService.UpdateSiteGroupDefinitionAsync(siteGroupDefinition);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
siteGroupDefinition = null;
|
siteGroupDefinition = null;
|
||||||
@@ -1330,23 +1375,22 @@
|
|||||||
|
|
||||||
if (siteGroupDefinition != null)
|
if (siteGroupDefinition != null)
|
||||||
{
|
{
|
||||||
var siteGroup = await SiteGroupService.GetSiteGroupAsync(PageState.Site.SiteId, siteGroupDefinition.SiteGroupDefinitionId);
|
var siteGroup = await SiteGroupService.GetSiteGroupAsync(_siteId, siteGroupDefinition.SiteGroupDefinitionId);
|
||||||
if (siteGroup == null)
|
if (siteGroup == null)
|
||||||
{
|
{
|
||||||
siteGroup = new SiteGroup
|
siteGroup = new SiteGroup
|
||||||
{
|
{
|
||||||
SiteGroupDefinitionId = siteGroupDefinition.SiteGroupDefinitionId,
|
SiteGroupDefinitionId = siteGroupDefinition.SiteGroupDefinitionId,
|
||||||
SiteId = PageState.Site.SiteId,
|
SiteId = _siteId
|
||||||
Synchronize = bool.Parse(_synchronize),
|
|
||||||
NotifyRoleName= _notifyRoleName
|
|
||||||
};
|
};
|
||||||
await SiteGroupService.AddSiteGroupAsync(siteGroup);
|
await SiteGroupService.AddSiteGroupAsync(siteGroup);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
siteGroup.Synchronize = bool.Parse(_synchronize);
|
if (_member == "False")
|
||||||
siteGroup.NotifyRoleName = _notifyRoleName;
|
{
|
||||||
await SiteGroupService.UpdateSiteGroupAsync(siteGroup);
|
await SiteGroupService.DeleteSiteGroupAsync(siteGroup.SiteGroupId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await LoadSiteGroups();
|
await LoadSiteGroups();
|
||||||
@@ -1396,7 +1440,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// mark secondary sites for synchronization
|
// mark secondary sites for synchronization
|
||||||
foreach (var group in _siteGroupDefinitions.Where(item => item.PrimarySiteId == PageState.Site.SiteId && item.Synchronization))
|
foreach (var group in _siteGroupDefinitions.Where(item => item.PrimarySiteId == PageState.Site.SiteId && item.Synchronization != null))
|
||||||
{
|
{
|
||||||
group.Synchronize = true;
|
group.Synchronize = true;
|
||||||
await SiteGroupDefinitionService.UpdateSiteGroupDefinitionAsync(group);
|
await SiteGroupDefinitionService.UpdateSiteGroupDefinitionAsync(group);
|
||||||
|
|||||||
@@ -327,8 +327,8 @@
|
|||||||
<data name="AliasName.Text" xml:space="preserve">
|
<data name="AliasName.Text" xml:space="preserve">
|
||||||
<value>Url:</value>
|
<value>Url:</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="AliasDefault" xml:space="preserve">
|
<data name="Default" xml:space="preserve">
|
||||||
<value>Default?</value>
|
<value>Default</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Confirm.Alias.Delete" xml:space="preserve">
|
<data name="Confirm.Alias.Delete" xml:space="preserve">
|
||||||
<value>Are You Sure You Wish To Delete {0}?</value>
|
<value>Are You Sure You Wish To Delete {0}?</value>
|
||||||
@@ -540,18 +540,6 @@
|
|||||||
<data name="Update" xml:space="preserve">
|
<data name="Update" xml:space="preserve">
|
||||||
<value>Update</value>
|
<value>Update</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Approach.Text" xml:space="preserve">
|
|
||||||
<value>Synchronization:</value>
|
|
||||||
</data>
|
|
||||||
<data name="Approach.HelpText" xml:space="preserve">
|
|
||||||
<value>Specifies the synchronization approach from the primary site to the current site</value>
|
|
||||||
</data>
|
|
||||||
<data name="NotifyRole.Text" xml:space="preserve">
|
|
||||||
<value>Notify Role:</value>
|
|
||||||
</data>
|
|
||||||
<data name="NotifyRole.HelpText" xml:space="preserve">
|
|
||||||
<value>Optionally specifies a role in the current site whose users should be notified of content changes in the primary site</value>
|
|
||||||
</data>
|
|
||||||
<data name="DeleteSiteGroup.Header" xml:space="preserve">
|
<data name="DeleteSiteGroup.Header" xml:space="preserve">
|
||||||
<value>Delete Site Group</value>
|
<value>Delete Site Group</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -567,4 +555,16 @@
|
|||||||
<data name="Synchronize" xml:space="preserve">
|
<data name="Synchronize" xml:space="preserve">
|
||||||
<value>Synchronize</value>
|
<value>Synchronize</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Notify.Text" xml:space="preserve">
|
||||||
|
<value>Notify?</value>
|
||||||
|
</data>
|
||||||
|
<data name="Notify.HelpText" xml:space="preserve">
|
||||||
|
<value>Specifies if the site administrator of secondary sites should be notified of any synchronization activity</value>
|
||||||
|
</data>
|
||||||
|
<data name="Site.Text" xml:space="preserve">
|
||||||
|
<value>Site:</value>
|
||||||
|
</data>
|
||||||
|
<data name="Site.HelpText" xml:space="preserve">
|
||||||
|
<value>he sites in this tenant (database)</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -110,12 +110,12 @@ namespace Oqtane.Controllers
|
|||||||
if (siteGroup != null)
|
if (siteGroup != null)
|
||||||
{
|
{
|
||||||
_siteGroupRepository.DeleteSiteGroup(id);
|
_siteGroupRepository.DeleteSiteGroup(id);
|
||||||
_syncManager.AddSyncEvent(_alias, EntityNames.SiteGroup, siteGroup.SiteGroupDefinitionId, SyncEventActions.Delete);
|
_syncManager.AddSyncEvent(_alias, EntityNames.SiteGroup, siteGroup.SiteGroupId, SyncEventActions.Delete);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Site Group Deleted {SiteGroupDefinitionId}", id);
|
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Site Group Deleted {SiteGroupId}", id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized Site Group Delete Attempt {SiteGroupDefinitionId}", id);
|
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized Site Group Delete Attempt {SiteGroupId}", id);
|
||||||
HttpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden;
|
HttpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace Oqtane.Infrastructure
|
|||||||
var groups = siteGroupDefinitionRepository.GetSiteGroupDefinitions();
|
var groups = siteGroupDefinitionRepository.GetSiteGroupDefinitions();
|
||||||
|
|
||||||
// iterate through groups which need to be synchronized
|
// iterate through groups which need to be synchronized
|
||||||
foreach (var group in groups.Where(item => item.Synchronize))
|
foreach (var group in groups.Where(item => item.Synchronization != null && item.Synchronize))
|
||||||
{
|
{
|
||||||
// get data
|
// get data
|
||||||
if (siteGroups == null)
|
if (siteGroups == null)
|
||||||
@@ -64,7 +64,7 @@ namespace Oqtane.Infrastructure
|
|||||||
}
|
}
|
||||||
|
|
||||||
var aliasName = "https://" + aliases.First(item => item.TenantId == tenantManager.GetTenant().TenantId && item.SiteId == group.PrimarySiteId && item.IsDefault).Name;
|
var aliasName = "https://" + aliases.First(item => item.TenantId == tenantManager.GetTenant().TenantId && item.SiteId == group.PrimarySiteId && item.IsDefault).Name;
|
||||||
log += $"Processing Primary Site: {sites.First(item => item.SiteId == group.PrimarySiteId).Name} - {aliasName}<br />";
|
log += $"Processing Primary Site: {sites.First(item => item.SiteId == group.PrimarySiteId).Name} - {CreateLink(aliasName)}<br />";
|
||||||
|
|
||||||
// get primary site
|
// get primary site
|
||||||
var primarySite = sites.FirstOrDefault(item => item.SiteId == group.PrimarySiteId);
|
var primarySite = sites.FirstOrDefault(item => item.SiteId == group.PrimarySiteId);
|
||||||
@@ -97,17 +97,17 @@ namespace Oqtane.Infrastructure
|
|||||||
siteGroup.SynchronizedOn = DateTime.UtcNow;
|
siteGroup.SynchronizedOn = DateTime.UtcNow;
|
||||||
siteGroupRepository.UpdateSiteGroup(siteGroup);
|
siteGroupRepository.UpdateSiteGroup(siteGroup);
|
||||||
|
|
||||||
log += $"Processed Target Site: {secondarySite.Name} - {siteGroup.AliasName}<br />" + siteLog;
|
log += $"Processed Secondary Site: {secondarySite.Name} - {CreateLink(siteGroup.AliasName)}<br />" + siteLog;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
log += $"Site Group Has A SiteId {siteGroup.SiteId} Which Does Not Exist<br />";
|
log += $"Site Group {group.Name} Has A SiteId {siteGroup.SiteId} Which Does Not Exist<br />";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
log += $"Site Group Has A PrimarySiteId {group.PrimarySiteId} Which Does Not Exist<br />";
|
log += $"Site Group {group.Name} Has A PrimarySiteId {group.PrimarySiteId} Which Does Not Exist<br />";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,7 +177,7 @@ namespace Oqtane.Infrastructure
|
|||||||
secondarySite.DeletedOn = primarySite.DeletedOn;
|
secondarySite.DeletedOn = primarySite.DeletedOn;
|
||||||
|
|
||||||
var siteRepository = provider.GetRequiredService<ISiteRepository>();
|
var siteRepository = provider.GetRequiredService<ISiteRepository>();
|
||||||
if (siteGroup.Synchronize)
|
if (siteGroup.SiteGroupDefinition.Synchronization.Value)
|
||||||
{
|
{
|
||||||
siteRepository.UpdateSite(secondarySite);
|
siteRepository.UpdateSite(secondarySite);
|
||||||
}
|
}
|
||||||
@@ -195,10 +195,10 @@ namespace Oqtane.Infrastructure
|
|||||||
syncManager.AddSyncEvent(alias, EntityNames.Site, secondarySite.SiteId, SyncEventActions.Refresh);
|
syncManager.AddSyncEvent(alias, EntityNames.Site, secondarySite.SiteId, SyncEventActions.Refresh);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(log) && !string.IsNullOrEmpty(siteGroup.NotifyRoleName))
|
if (!string.IsNullOrEmpty(log) && siteGroup.SiteGroupDefinition.Notify)
|
||||||
{
|
{
|
||||||
// send change log to users in role
|
// send change log to administrators
|
||||||
SendNotifications(provider, secondarySite.SiteId, secondarySite.Name, siteGroup.NotifyRoleName, log);
|
SendNotifications(provider, secondarySite.SiteId, secondarySite.Name, log);
|
||||||
}
|
}
|
||||||
|
|
||||||
return log;
|
return log;
|
||||||
@@ -244,7 +244,7 @@ namespace Oqtane.Infrastructure
|
|||||||
|
|
||||||
if (role == null)
|
if (role == null)
|
||||||
{
|
{
|
||||||
if (siteGroup.Synchronize)
|
if (siteGroup.SiteGroupDefinition.Synchronization.Value)
|
||||||
{
|
{
|
||||||
roleRepository.AddRole(secondaryRole);
|
roleRepository.AddRole(secondaryRole);
|
||||||
}
|
}
|
||||||
@@ -252,7 +252,7 @@ namespace Oqtane.Infrastructure
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (siteGroup.Synchronize)
|
if (siteGroup.SiteGroupDefinition.Synchronization.Value)
|
||||||
{
|
{
|
||||||
roleRepository.UpdateRole(secondaryRole);
|
roleRepository.UpdateRole(secondaryRole);
|
||||||
}
|
}
|
||||||
@@ -265,7 +265,7 @@ namespace Oqtane.Infrastructure
|
|||||||
// remove roles in the secondary site which do not exist in the primary site
|
// remove roles in the secondary site which do not exist in the primary site
|
||||||
foreach (var secondaryRole in secondaryRoles.Where(item => !primaryRoles.Select(item => item.Name).Contains(item.Name)))
|
foreach (var secondaryRole in secondaryRoles.Where(item => !primaryRoles.Select(item => item.Name).Contains(item.Name)))
|
||||||
{
|
{
|
||||||
if (siteGroup.Synchronize)
|
if (siteGroup.SiteGroupDefinition.Synchronization.Value)
|
||||||
{
|
{
|
||||||
roleRepository.DeleteRole(secondaryRole.RoleId);
|
roleRepository.DeleteRole(secondaryRole.RoleId);
|
||||||
}
|
}
|
||||||
@@ -323,7 +323,7 @@ namespace Oqtane.Infrastructure
|
|||||||
|
|
||||||
if (folder == null)
|
if (folder == null)
|
||||||
{
|
{
|
||||||
if (siteGroup.Synchronize)
|
if (siteGroup.SiteGroupDefinition.Synchronization.Value)
|
||||||
{
|
{
|
||||||
folderRepository.AddFolder(secondaryFolder);
|
folderRepository.AddFolder(secondaryFolder);
|
||||||
}
|
}
|
||||||
@@ -331,7 +331,7 @@ namespace Oqtane.Infrastructure
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (siteGroup.Synchronize)
|
if (siteGroup.SiteGroupDefinition.Synchronization.Value)
|
||||||
{
|
{
|
||||||
folderRepository.UpdateFolder(secondaryFolder);
|
folderRepository.UpdateFolder(secondaryFolder);
|
||||||
}
|
}
|
||||||
@@ -370,21 +370,21 @@ namespace Oqtane.Infrastructure
|
|||||||
|
|
||||||
if (file == null)
|
if (file == null)
|
||||||
{
|
{
|
||||||
if (siteGroup.Synchronize)
|
if (siteGroup.SiteGroupDefinition.Synchronization.Value)
|
||||||
{
|
{
|
||||||
fileRepository.AddFile(secondaryFile);
|
fileRepository.AddFile(secondaryFile);
|
||||||
ReplicateFile(folderRepository, primaryFolder, primaryFile, secondaryFolder, secondaryFile);
|
ReplicateFile(folderRepository, primaryFolder, primaryFile, secondaryFolder, secondaryFile);
|
||||||
}
|
}
|
||||||
log += Log(siteGroup, $"File Added: {siteGroup.AliasName}{secondaryFolder.Path}{secondaryFile.Name}");
|
log += Log(siteGroup, $"File Added: {CreateLink(siteGroup.AliasName + secondaryFolder.Path + secondaryFile.Name)}");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (siteGroup.Synchronize)
|
if (siteGroup.SiteGroupDefinition.Synchronization.Value)
|
||||||
{
|
{
|
||||||
fileRepository.UpdateFile(secondaryFile);
|
fileRepository.UpdateFile(secondaryFile);
|
||||||
ReplicateFile(folderRepository, primaryFolder, primaryFile, secondaryFolder, secondaryFile);
|
ReplicateFile(folderRepository, primaryFolder, primaryFile, secondaryFolder, secondaryFile);
|
||||||
}
|
}
|
||||||
log += Log(siteGroup, $"File Updated: {siteGroup.AliasName}{secondaryFolder.Path}{secondaryFile.Name}");
|
log += Log(siteGroup, $"File Updated: {CreateLink(siteGroup.AliasName + secondaryFolder.Path + secondaryFile.Name)}");
|
||||||
secondaryFiles.Remove(file);
|
secondaryFiles.Remove(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -393,20 +393,20 @@ namespace Oqtane.Infrastructure
|
|||||||
// remove files in the secondary site which do not exist in the primary site
|
// remove files in the secondary site which do not exist in the primary site
|
||||||
foreach (var secondaryFile in secondaryFiles.Where(item => !primaryFiles.Select(item => item.Name).Contains(item.Name)))
|
foreach (var secondaryFile in secondaryFiles.Where(item => !primaryFiles.Select(item => item.Name).Contains(item.Name)))
|
||||||
{
|
{
|
||||||
if (siteGroup.Synchronize)
|
if (siteGroup.SiteGroupDefinition.Synchronization.Value)
|
||||||
{
|
{
|
||||||
fileRepository.DeleteFile(secondaryFile.FileId);
|
fileRepository.DeleteFile(secondaryFile.FileId);
|
||||||
var secondaryPath = Path.Combine(folderRepository.GetFolderPath(secondaryFolder), secondaryFile.Name);
|
var secondaryPath = Path.Combine(folderRepository.GetFolderPath(secondaryFolder), secondaryFile.Name);
|
||||||
System.IO.File.Delete(secondaryPath);
|
System.IO.File.Delete(secondaryPath);
|
||||||
}
|
}
|
||||||
log += Log(siteGroup, $"File Deleted: {siteGroup.AliasName}{secondaryFolder.Path}{secondaryFile.Name}");
|
log += Log(siteGroup, $"File Deleted: {CreateLink(siteGroup.AliasName + secondaryFolder.Path + secondaryFile.Name)}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove folders in the secondary site which do not exist in the primary site
|
// remove folders in the secondary site which do not exist in the primary site
|
||||||
foreach (var secondaryFolder in secondaryFolders.Where(item => !primaryFolders.Select(item => item.Path).Contains(item.Path)))
|
foreach (var secondaryFolder in secondaryFolders.Where(item => !primaryFolders.Select(item => item.Path).Contains(item.Path)))
|
||||||
{
|
{
|
||||||
if (siteGroup.Synchronize)
|
if (siteGroup.SiteGroupDefinition.Synchronization.Value)
|
||||||
{
|
{
|
||||||
folderRepository.DeleteFolder(secondaryFolder.FolderId);
|
folderRepository.DeleteFolder(secondaryFolder.FolderId);
|
||||||
}
|
}
|
||||||
@@ -490,19 +490,19 @@ namespace Oqtane.Infrastructure
|
|||||||
|
|
||||||
if (page == null)
|
if (page == null)
|
||||||
{
|
{
|
||||||
if (siteGroup.Synchronize)
|
if (siteGroup.SiteGroupDefinition.Synchronization.Value)
|
||||||
{
|
{
|
||||||
secondaryPage = pageRepository.AddPage(secondaryPage);
|
secondaryPage = pageRepository.AddPage(secondaryPage);
|
||||||
}
|
}
|
||||||
log += Log(siteGroup, $"Page Added: {siteGroup.AliasName}{secondaryPage.Path}");
|
log += Log(siteGroup, $"Page Added: {CreateLink(siteGroup.AliasName + secondaryPage.Path)}");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (siteGroup.Synchronize)
|
if (siteGroup.SiteGroupDefinition.Synchronization.Value)
|
||||||
{
|
{
|
||||||
secondaryPage = pageRepository.UpdatePage(secondaryPage);
|
secondaryPage = pageRepository.UpdatePage(secondaryPage);
|
||||||
}
|
}
|
||||||
log += Log(siteGroup, $"Page Updated: {siteGroup.AliasName}{secondaryPage.Path}");
|
log += Log(siteGroup, $"Page Updated: {CreateLink(siteGroup.AliasName + secondaryPage.Path)}");
|
||||||
secondaryPages.Remove(page);
|
secondaryPages.Remove(page);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -558,22 +558,22 @@ namespace Oqtane.Infrastructure
|
|||||||
if (module == null)
|
if (module == null)
|
||||||
{
|
{
|
||||||
// add new module
|
// add new module
|
||||||
if (siteGroup.Synchronize)
|
if (siteGroup.SiteGroupDefinition.Synchronization.Value)
|
||||||
{
|
{
|
||||||
module = moduleRepository.AddModule(secondaryPageModule.Module);
|
module = moduleRepository.AddModule(secondaryPageModule.Module);
|
||||||
updateContent = true;
|
updateContent = true;
|
||||||
}
|
}
|
||||||
log += Log(siteGroup, $"Module Added: {module.Title} - {siteGroup.AliasName}{secondaryPage.Path}");
|
log += Log(siteGroup, $"Module Added: {module.Title} - {CreateLink(siteGroup.AliasName + secondaryPage.Path)}");
|
||||||
}
|
}
|
||||||
if (module != null)
|
if (module != null)
|
||||||
{
|
{
|
||||||
secondaryPageModule.ModuleId = module.ModuleId;
|
secondaryPageModule.ModuleId = module.ModuleId;
|
||||||
secondaryPageModule.Module = null; // remove tracking
|
secondaryPageModule.Module = null; // remove tracking
|
||||||
if (siteGroup.Synchronize)
|
if (siteGroup.SiteGroupDefinition.Synchronization.Value)
|
||||||
{
|
{
|
||||||
secondaryPageModule = pageModuleRepository.AddPageModule(secondaryPageModule);
|
secondaryPageModule = pageModuleRepository.AddPageModule(secondaryPageModule);
|
||||||
}
|
}
|
||||||
log += Log(siteGroup, $"Page Module Added: {module.Title} - {siteGroup.AliasName}{secondaryPage.Path}");
|
log += Log(siteGroup, $"Page Module Added: {module.Title} - {CreateLink(siteGroup.AliasName + secondaryPage.Path)}");
|
||||||
secondaryPageModule.Module = module;
|
secondaryPageModule.Module = module;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -582,20 +582,20 @@ namespace Oqtane.Infrastructure
|
|||||||
// update existing module
|
// update existing module
|
||||||
if (primaryPageModule.Module.ModifiedOn > siteGroup.SynchronizedOn)
|
if (primaryPageModule.Module.ModifiedOn > siteGroup.SynchronizedOn)
|
||||||
{
|
{
|
||||||
if (siteGroup.Synchronize)
|
if (siteGroup.SiteGroupDefinition.Synchronization.Value)
|
||||||
{
|
{
|
||||||
moduleRepository.UpdateModule(secondaryPageModule.Module);
|
moduleRepository.UpdateModule(secondaryPageModule.Module);
|
||||||
updateContent = true;
|
updateContent = true;
|
||||||
}
|
}
|
||||||
log += Log(siteGroup, $"Module Updated: {secondaryPageModule.Title} - {siteGroup.AliasName}{secondaryPage.Path}");
|
log += Log(siteGroup, $"Module Updated: {secondaryPageModule.Title} - {CreateLink(siteGroup.AliasName + secondaryPage.Path)}");
|
||||||
}
|
}
|
||||||
if (primaryPageModule.ModifiedOn > siteGroup.SynchronizedOn)
|
if (primaryPageModule.ModifiedOn > siteGroup.SynchronizedOn)
|
||||||
{
|
{
|
||||||
if (siteGroup.Synchronize)
|
if (siteGroup.SiteGroupDefinition.Synchronization.Value)
|
||||||
{
|
{
|
||||||
secondaryPageModule = pageModuleRepository.UpdatePageModule(secondaryPageModule);
|
secondaryPageModule = pageModuleRepository.UpdatePageModule(secondaryPageModule);
|
||||||
}
|
}
|
||||||
log += Log(siteGroup, $"Page Module Updated: {secondaryPageModule.Title} - {siteGroup.AliasName}{secondaryPage.Path}");
|
log += Log(siteGroup, $"Page Module Updated: {secondaryPageModule.Title} - {CreateLink(siteGroup.AliasName + secondaryPage.Path)}");
|
||||||
secondaryPageModules.Remove(pageModule);
|
secondaryPageModules.Remove(pageModule);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -613,11 +613,11 @@ namespace Oqtane.Infrastructure
|
|||||||
var secondaryModuleContent = ((ISynchronizable)moduleObject).ExtractModule(secondaryPageModule.Module);
|
var secondaryModuleContent = ((ISynchronizable)moduleObject).ExtractModule(secondaryPageModule.Module);
|
||||||
if (primaryModuleContent != secondaryModuleContent)
|
if (primaryModuleContent != secondaryModuleContent)
|
||||||
{
|
{
|
||||||
if (siteGroup.Synchronize)
|
if (siteGroup.SiteGroupDefinition.Synchronization.Value)
|
||||||
{
|
{
|
||||||
((ISynchronizable)moduleObject).LoadModule(secondaryPageModule.Module, primaryModuleContent, primaryPageModule.Module.ModuleDefinition.Version);
|
((ISynchronizable)moduleObject).LoadModule(secondaryPageModule.Module, primaryModuleContent, primaryPageModule.Module.ModuleDefinition.Version);
|
||||||
}
|
}
|
||||||
log += Log(siteGroup, $"Module Content Updated: {secondaryPageModule.Title} - {siteGroup.AliasName}{secondaryPage.Path}");
|
log += Log(siteGroup, $"Module Content Updated: {secondaryPageModule.Title} - {CreateLink(siteGroup.AliasName + secondaryPage.Path)}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
@@ -648,22 +648,22 @@ namespace Oqtane.Infrastructure
|
|||||||
}
|
}
|
||||||
if (!primaryPageModules.Any(item => item.PageId == primaryPageId && item.Module.ModuleDefinitionName == secondaryPageModule.Module.ModuleDefinitionName && item.Title.ToLower() == secondaryPageModule.Title.ToLower()))
|
if (!primaryPageModules.Any(item => item.PageId == primaryPageId && item.Module.ModuleDefinitionName == secondaryPageModule.Module.ModuleDefinitionName && item.Title.ToLower() == secondaryPageModule.Title.ToLower()))
|
||||||
{
|
{
|
||||||
if (siteGroup.Synchronize)
|
if (siteGroup.SiteGroupDefinition.Synchronization.Value)
|
||||||
{
|
{
|
||||||
pageModuleRepository.DeletePageModule(secondaryPageModule.PageModuleId);
|
pageModuleRepository.DeletePageModule(secondaryPageModule.PageModuleId);
|
||||||
}
|
}
|
||||||
log += Log(siteGroup, $"Page Module Deleted: {secondaryPageModule.Title} - {siteGroup.AliasName}{secondaryPageModule.Page.Path}");
|
log += Log(siteGroup, $"Page Module Deleted: {secondaryPageModule.Title} - {CreateLink(siteGroup.AliasName + secondaryPageModule.Page.Path)}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove pages in the secondary site which do not exist in the primary site
|
// remove pages in the secondary site which do not exist in the primary site
|
||||||
foreach (var secondaryPage in secondaryPages.Where(item => !primaryPages.Select(item => item.Path).Contains(item.Path)))
|
foreach (var secondaryPage in secondaryPages.Where(item => !primaryPages.Select(item => item.Path).Contains(item.Path)))
|
||||||
{
|
{
|
||||||
if (siteGroup.Synchronize)
|
if (siteGroup.SiteGroupDefinition.Synchronization.Value)
|
||||||
{
|
{
|
||||||
pageRepository.DeletePage(secondaryPage.PageId);
|
pageRepository.DeletePage(secondaryPage.PageId);
|
||||||
}
|
}
|
||||||
log += Log(siteGroup, $"Page Deleted: {siteGroup.AliasName}{secondaryPage.Path}");
|
log += Log(siteGroup, $"Page Deleted: {CreateLink(siteGroup.AliasName + secondaryPage.Path)}");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (siteGroup.SynchronizedOn == DateTime.MinValue || !string.IsNullOrEmpty(log))
|
if (siteGroup.SynchronizedOn == DateTime.MinValue || !string.IsNullOrEmpty(log))
|
||||||
@@ -710,7 +710,7 @@ namespace Oqtane.Infrastructure
|
|||||||
secondarySetting.SettingName = primarySetting.SettingName;
|
secondarySetting.SettingName = primarySetting.SettingName;
|
||||||
secondarySetting.SettingValue = primarySetting.SettingValue;
|
secondarySetting.SettingValue = primarySetting.SettingValue;
|
||||||
secondarySetting.IsPrivate = primarySetting.IsPrivate;
|
secondarySetting.IsPrivate = primarySetting.IsPrivate;
|
||||||
if (siteGroup.Synchronize && !excludedSettings.Any(item => item.EntityName == secondarySetting.EntityName && item.SettingName == secondarySetting.SettingName))
|
if (siteGroup.SiteGroupDefinition.Synchronization.Value && !excludedSettings.Any(item => item.EntityName == secondarySetting.EntityName && item.SettingName == secondarySetting.SettingName))
|
||||||
{
|
{
|
||||||
settingRepository.AddSetting(secondarySetting);
|
settingRepository.AddSetting(secondarySetting);
|
||||||
updated = true;
|
updated = true;
|
||||||
@@ -722,7 +722,7 @@ namespace Oqtane.Infrastructure
|
|||||||
{
|
{
|
||||||
secondarySetting.SettingValue = primarySetting.SettingValue;
|
secondarySetting.SettingValue = primarySetting.SettingValue;
|
||||||
secondarySetting.IsPrivate = primarySetting.IsPrivate;
|
secondarySetting.IsPrivate = primarySetting.IsPrivate;
|
||||||
if (siteGroup.Synchronize && !excludedSettings.Any(item => item.EntityName == secondarySetting.EntityName && item.SettingName == secondarySetting.SettingName))
|
if (siteGroup.SiteGroupDefinition.Synchronization.Value && !excludedSettings.Any(item => item.EntityName == secondarySetting.EntityName && item.SettingName == secondarySetting.SettingName))
|
||||||
{
|
{
|
||||||
settingRepository.UpdateSetting(secondarySetting);
|
settingRepository.UpdateSetting(secondarySetting);
|
||||||
updated = true;
|
updated = true;
|
||||||
@@ -735,7 +735,7 @@ namespace Oqtane.Infrastructure
|
|||||||
// any remaining secondary settings need to be deleted
|
// any remaining secondary settings need to be deleted
|
||||||
foreach (var secondarySetting in secondarySettings)
|
foreach (var secondarySetting in secondarySettings)
|
||||||
{
|
{
|
||||||
if (siteGroup.Synchronize && !excludedSettings.Any(item => item.EntityName == secondarySetting.EntityName && item.SettingName == secondarySetting.SettingName))
|
if (siteGroup.SiteGroupDefinition.Synchronization.Value && !excludedSettings.Any(item => item.EntityName == secondarySetting.EntityName && item.SettingName == secondarySetting.SettingName))
|
||||||
{
|
{
|
||||||
settingRepository.DeleteSetting(secondarySetting.EntityName, secondarySetting.SettingId);
|
settingRepository.DeleteSetting(secondarySetting.EntityName, secondarySetting.SettingId);
|
||||||
updated = true;
|
updated = true;
|
||||||
@@ -750,12 +750,12 @@ namespace Oqtane.Infrastructure
|
|||||||
return log;
|
return log;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SendNotifications(IServiceProvider provider, int siteId, string siteName, string roleName, string log)
|
private void SendNotifications(IServiceProvider provider, int siteId, string siteName, string log)
|
||||||
{
|
{
|
||||||
var userRoleRepository = provider.GetRequiredService<IUserRoleRepository>();
|
var userRoleRepository = provider.GetRequiredService<IUserRoleRepository>();
|
||||||
var notificationRepository = provider.GetRequiredService<INotificationRepository>();
|
var notificationRepository = provider.GetRequiredService<INotificationRepository>();
|
||||||
|
|
||||||
foreach (var userRole in userRoleRepository.GetUserRoles(roleName, siteId))
|
foreach (var userRole in userRoleRepository.GetUserRoles(RoleNames.Admin, siteId))
|
||||||
{
|
{
|
||||||
var notification = new Notification(siteId, userRole.User, $"{siteName} Change Log", log);
|
var notification = new Notification(siteId, userRole.User, $"{siteName} Change Log", log);
|
||||||
notificationRepository.AddNotification(notification);
|
notificationRepository.AddNotification(notification);
|
||||||
@@ -774,5 +774,10 @@ namespace Oqtane.Infrastructure
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string CreateLink(string url)
|
||||||
|
{
|
||||||
|
return "<a href=\"" + url + "\" target=\"_new\">" + url + "</a>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ namespace Oqtane.Migrations.EntityBuilders
|
|||||||
SiteGroupDefinitionId = AddAutoIncrementColumn(table, "SiteGroupDefinitionId");
|
SiteGroupDefinitionId = AddAutoIncrementColumn(table, "SiteGroupDefinitionId");
|
||||||
Name = AddStringColumn(table, "Name", 200);
|
Name = AddStringColumn(table, "Name", 200);
|
||||||
PrimarySiteId = AddIntegerColumn(table, "PrimarySiteId");
|
PrimarySiteId = AddIntegerColumn(table, "PrimarySiteId");
|
||||||
Synchronization = AddBooleanColumn(table, "Synchronization");
|
Synchronization = AddBooleanColumn(table, "Synchronization", true);
|
||||||
|
Notify = AddBooleanColumn(table, "Notify");
|
||||||
Synchronize = AddBooleanColumn(table, "Synchronize");
|
Synchronize = AddBooleanColumn(table, "Synchronize");
|
||||||
Localization = AddBooleanColumn(table, "Localization");
|
Localization = AddBooleanColumn(table, "Localization");
|
||||||
|
|
||||||
@@ -41,6 +42,8 @@ namespace Oqtane.Migrations.EntityBuilders
|
|||||||
|
|
||||||
public OperationBuilder<AddColumnOperation> Synchronization { get; set; }
|
public OperationBuilder<AddColumnOperation> Synchronization { get; set; }
|
||||||
|
|
||||||
|
public OperationBuilder<AddColumnOperation> Notify { get; set; }
|
||||||
|
|
||||||
public OperationBuilder<AddColumnOperation> Synchronize { get; set; }
|
public OperationBuilder<AddColumnOperation> Synchronize { get; set; }
|
||||||
|
|
||||||
public OperationBuilder<AddColumnOperation> Localization { get; set; }
|
public OperationBuilder<AddColumnOperation> Localization { get; set; }
|
||||||
|
|||||||
@@ -28,8 +28,6 @@ namespace Oqtane.Migrations.EntityBuilders
|
|||||||
SiteGroupId = AddAutoIncrementColumn(table, "SiteGroupId");
|
SiteGroupId = AddAutoIncrementColumn(table, "SiteGroupId");
|
||||||
SiteGroupDefinitionId = AddIntegerColumn(table, "SiteGroupDefinitionId");
|
SiteGroupDefinitionId = AddIntegerColumn(table, "SiteGroupDefinitionId");
|
||||||
SiteId = AddIntegerColumn(table, "SiteId");
|
SiteId = AddIntegerColumn(table, "SiteId");
|
||||||
Synchronize = AddBooleanColumn(table, "Synchronize");
|
|
||||||
NotifyRoleName = AddStringColumn(table, "NotifyRoleName", 256, true);
|
|
||||||
SynchronizedOn = AddDateTimeColumn(table, "SynchronizedOn", true);
|
SynchronizedOn = AddDateTimeColumn(table, "SynchronizedOn", true);
|
||||||
|
|
||||||
AddAuditableColumns(table);
|
AddAuditableColumns(table);
|
||||||
@@ -43,10 +41,6 @@ namespace Oqtane.Migrations.EntityBuilders
|
|||||||
|
|
||||||
public OperationBuilder<AddColumnOperation> SiteId { get; set; }
|
public OperationBuilder<AddColumnOperation> SiteId { get; set; }
|
||||||
|
|
||||||
public OperationBuilder<AddColumnOperation> Synchronize { get; set; }
|
|
||||||
|
|
||||||
public OperationBuilder<AddColumnOperation> NotifyRoleName { get; set; }
|
|
||||||
|
|
||||||
public OperationBuilder<AddColumnOperation> SynchronizedOn { get; set; }
|
public OperationBuilder<AddColumnOperation> SynchronizedOn { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ namespace Oqtane.Migrations.Tenant
|
|||||||
|
|
||||||
var siteGroupEntityBuilder = new SiteGroupEntityBuilder(migrationBuilder, ActiveDatabase);
|
var siteGroupEntityBuilder = new SiteGroupEntityBuilder(migrationBuilder, ActiveDatabase);
|
||||||
siteGroupEntityBuilder.Create();
|
siteGroupEntityBuilder.Create();
|
||||||
|
siteGroupEntityBuilder.AddIndex("IX_SiteGroup", new[] { "SiteId", "SiteGroupDefinitionId" }, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ namespace Oqtane.Repository
|
|||||||
IEnumerable<SiteGroup> GetSiteGroups(int siteId, int siteGroupDefinitionId);
|
IEnumerable<SiteGroup> GetSiteGroups(int siteId, int siteGroupDefinitionId);
|
||||||
SiteGroup AddSiteGroup(SiteGroup siteGroup);
|
SiteGroup AddSiteGroup(SiteGroup siteGroup);
|
||||||
SiteGroup UpdateSiteGroup(SiteGroup siteGroup);
|
SiteGroup UpdateSiteGroup(SiteGroup siteGroup);
|
||||||
SiteGroup GetSiteGroup(int siteSiteGroupDefinitionId);
|
SiteGroup GetSiteGroup(int siteSiteGroupId);
|
||||||
SiteGroup GetSiteGroup(int siteSiteGroupDefinitionId, bool tracking);
|
SiteGroup GetSiteGroup(int siteSiteGroupId, bool tracking);
|
||||||
void DeleteSiteGroup(int siteSiteGroupDefinitionId);
|
void DeleteSiteGroup(int siteSiteGroupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SiteGroupRepository : ISiteGroupRepository
|
public class SiteGroupRepository : ISiteGroupRepository
|
||||||
@@ -55,32 +55,32 @@ namespace Oqtane.Repository
|
|||||||
return SiteGroup;
|
return SiteGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SiteGroup GetSiteGroup(int SiteGroupDefinitionId)
|
public SiteGroup GetSiteGroup(int SiteGroupId)
|
||||||
{
|
{
|
||||||
return GetSiteGroup(SiteGroupDefinitionId, true);
|
return GetSiteGroup(SiteGroupId, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SiteGroup GetSiteGroup(int SiteGroupDefinitionId, bool tracking)
|
public SiteGroup GetSiteGroup(int SiteGroupId, bool tracking)
|
||||||
{
|
{
|
||||||
using var db = _dbContextFactory.CreateDbContext();
|
using var db = _dbContextFactory.CreateDbContext();
|
||||||
if (tracking)
|
if (tracking)
|
||||||
{
|
{
|
||||||
return db.SiteGroup
|
return db.SiteGroup
|
||||||
.Include(item => item.SiteGroupDefinition) // eager load
|
.Include(item => item.SiteGroupDefinition) // eager load
|
||||||
.FirstOrDefault(item => item.SiteGroupDefinitionId == SiteGroupDefinitionId);
|
.FirstOrDefault(item => item.SiteGroupId == SiteGroupId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return db.SiteGroup.AsNoTracking()
|
return db.SiteGroup.AsNoTracking()
|
||||||
.Include(item => item.SiteGroupDefinition) // eager load
|
.Include(item => item.SiteGroupDefinition) // eager load
|
||||||
.FirstOrDefault(item => item.SiteGroupDefinitionId == SiteGroupDefinitionId);
|
.FirstOrDefault(item => item.SiteGroupId == SiteGroupId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeleteSiteGroup(int SiteGroupDefinitionId)
|
public void DeleteSiteGroup(int SiteGroupId)
|
||||||
{
|
{
|
||||||
using var db = _dbContextFactory.CreateDbContext();
|
using var db = _dbContextFactory.CreateDbContext();
|
||||||
SiteGroup SiteGroup = db.SiteGroup.Find(SiteGroupDefinitionId);
|
SiteGroup SiteGroup = db.SiteGroup.Find(SiteGroupId);
|
||||||
db.SiteGroup.Remove(SiteGroup);
|
db.SiteGroup.Remove(SiteGroup);
|
||||||
db.SaveChanges();
|
db.SaveChanges();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,16 +20,6 @@ namespace Oqtane.Models
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int SiteId { get; set; }
|
public int SiteId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Indicates if content should be synchronized for the site (false = compare, true = update)
|
|
||||||
/// </summary>
|
|
||||||
public bool Synchronize { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The role who should be notified of changes to the site (non-primary site only)
|
|
||||||
/// </summary>
|
|
||||||
public string NotifyRoleName { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The last date/time the site was synchronized
|
/// The last date/time the site was synchronized
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -18,9 +18,14 @@ namespace Oqtane.Models
|
|||||||
public int PrimarySiteId { get; set; }
|
public int PrimarySiteId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Indicates if the group supports synchronization
|
/// Indicates if the group supports synchronization (null = no, false = compare, true = update)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Synchronization { get; set; }
|
public bool? Synchronization { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates if the site administrator should be notified of any synchronization activity
|
||||||
|
/// </summary>
|
||||||
|
public bool Notify { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Specifies if the group needs to be synchronized
|
/// Specifies if the group needs to be synchronized
|
||||||
|
|||||||
Reference in New Issue
Block a user