refactor Site Groups
This commit is contained in:
@@ -484,23 +484,10 @@
|
|||||||
<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="False">@SharedLocalizer["No"]</option>
|
<option value="False">@SharedLocalizer["No"]</option>
|
||||||
<option value="Compare">@Localizer["Compare"]</option>
|
<option value="True">@Localizer["Yes"]</option>
|
||||||
<option value="Update">@Localizer["Update"]</option>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@if (_synchronization != "False")
|
|
||||||
{
|
|
||||||
<div class="row mb-1 align-items-center">
|
|
||||||
<Label Class="col-sm-3" For="notify" HelpText="Specifies if the administrators 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>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
<div class="row mb-1 align-items-center">
|
<div class="row mb-1 align-items-center">
|
||||||
<Label Class="col-sm-3" For="localization" HelpText="Specifies if the content of the sites in the group are localized" ResourceKey="Localization">Localization? </Label>
|
<Label Class="col-sm-3" For="localization" HelpText="Specifies if the content of the sites in the group are localized" ResourceKey="Localization">Localization? </Label>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
@@ -539,7 +526,27 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@if (_member == "Secondary")
|
@if (_member == "Secondary" && _synchronization == "True")
|
||||||
|
{
|
||||||
|
<div class="row mb-1 align-items-center">
|
||||||
|
<Label Class="col-sm-3" For="synchronize" HelpText="Specifies the synchronization approach between the primary site and the selected site" ResourceKey="Synchronize">Synchronize? </Label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<select id="synchronize" class="form-select" @bind="@_synchronize">
|
||||||
|
<option value="False">@Localizer["Compare"]</option>
|
||||||
|
<option value="True">@Localizer["Update"]</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-1 align-items-center">
|
||||||
|
<Label Class="col-sm-3" For="notify" HelpText="Specifies if site administrators 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>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@if (!string.IsNullOrEmpty(_synchronized))
|
||||||
{
|
{
|
||||||
<div class="row mb-1 align-items-center">
|
<div class="row mb-1 align-items-center">
|
||||||
<Label Class="col-sm-3" For="synchronized" HelpText="The date/time of the last synchronization for the site" ResourceKey="Synchronized">Synchronized: </Label>
|
<Label Class="col-sm-3" For="synchronized" HelpText="The date/time of the last synchronization for the site" ResourceKey="Synchronized">Synchronized: </Label>
|
||||||
@@ -549,6 +556,7 @@
|
|||||||
</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">
|
||||||
@@ -594,7 +602,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 != null))
|
@if (UserSecurity.IsAuthorized(PageState.User, RoleNames.Host) && _siteGroupDefinitions.Any(item => item.PrimarySiteId == PageState.Site.SiteId && item.Synchronization))
|
||||||
{
|
{
|
||||||
<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>
|
||||||
}
|
}
|
||||||
@@ -679,10 +687,11 @@
|
|||||||
private int _siteGroupDefinitionId = -1;
|
private int _siteGroupDefinitionId = -1;
|
||||||
private int _siteId;
|
private int _siteId;
|
||||||
private string _groupName = string.Empty;
|
private string _groupName = string.Empty;
|
||||||
private string _synchronization = "Update";
|
private string _synchronization = "True";
|
||||||
private string _notify = "True";
|
|
||||||
private string _localization = "False";
|
private string _localization = "False";
|
||||||
private string _member = "Primary";
|
private string _member = "Primary";
|
||||||
|
private string _synchronize = "True";
|
||||||
|
private string _notify = "True";
|
||||||
private string _synchronized = string.Empty;
|
private string _synchronized = string.Empty;
|
||||||
private bool _addSiteGroupDefinition = false;
|
private bool _addSiteGroupDefinition = false;
|
||||||
|
|
||||||
@@ -1265,15 +1274,7 @@
|
|||||||
if (group != null)
|
if (group != null)
|
||||||
{
|
{
|
||||||
_groupName = group.Name;
|
_groupName = group.Name;
|
||||||
if (group.Synchronization == null)
|
_synchronization = group.Synchronization.ToString();
|
||||||
{
|
|
||||||
_synchronization = "False";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_synchronization = (group.Synchronization.Value) ? "Update" : "Compare";
|
|
||||||
}
|
|
||||||
_notify = group.Notify.ToString();
|
|
||||||
_localization = group.Localization.ToString();
|
_localization = group.Localization.ToString();
|
||||||
|
|
||||||
if (_sites.Count == 0)
|
if (_sites.Count == 0)
|
||||||
@@ -1302,6 +1303,8 @@
|
|||||||
if (siteGroup.SiteId == _siteId)
|
if (siteGroup.SiteId == _siteId)
|
||||||
{
|
{
|
||||||
_member = site.Fingerprint;
|
_member = site.Fingerprint;
|
||||||
|
_synchronize = siteGroup.Synchronize.ToString();
|
||||||
|
_notify = siteGroup.Notify.ToString();
|
||||||
_synchronized = UtcToLocal(siteGroup.SynchronizedOn).ToString();
|
_synchronized = UtcToLocal(siteGroup.SynchronizedOn).ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1347,10 +1350,6 @@
|
|||||||
{
|
{
|
||||||
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))
|
||||||
@@ -1359,8 +1358,7 @@
|
|||||||
{
|
{
|
||||||
Name = _groupName,
|
Name = _groupName,
|
||||||
PrimarySiteId = _siteId,
|
PrimarySiteId = _siteId,
|
||||||
Synchronization = synchronization,
|
Synchronization = bool.Parse(_synchronization),
|
||||||
Notify = bool.Parse(_notify),
|
|
||||||
Localization = bool.Parse(_localization),
|
Localization = bool.Parse(_localization),
|
||||||
Synchronize = false
|
Synchronize = false
|
||||||
};
|
};
|
||||||
@@ -1374,8 +1372,7 @@
|
|||||||
{
|
{
|
||||||
siteGroupDefinition.Name = _groupName;
|
siteGroupDefinition.Name = _groupName;
|
||||||
siteGroupDefinition.PrimarySiteId = (_member == "Primary") ? _siteId : siteGroupDefinition.PrimarySiteId;
|
siteGroupDefinition.PrimarySiteId = (_member == "Primary") ? _siteId : siteGroupDefinition.PrimarySiteId;
|
||||||
siteGroupDefinition.Synchronization = synchronization;
|
siteGroupDefinition.Synchronization = bool.Parse(_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);
|
||||||
}
|
}
|
||||||
@@ -1393,7 +1390,9 @@
|
|||||||
siteGroup = new SiteGroup
|
siteGroup = new SiteGroup
|
||||||
{
|
{
|
||||||
SiteGroupDefinitionId = siteGroupDefinition.SiteGroupDefinitionId,
|
SiteGroupDefinitionId = siteGroupDefinition.SiteGroupDefinitionId,
|
||||||
SiteId = _siteId
|
SiteId = _siteId,
|
||||||
|
Synchronize = bool.Parse(_synchronize),
|
||||||
|
Notify = bool.Parse(_notify)
|
||||||
};
|
};
|
||||||
await SiteGroupService.AddSiteGroupAsync(siteGroup);
|
await SiteGroupService.AddSiteGroupAsync(siteGroup);
|
||||||
}
|
}
|
||||||
@@ -1403,6 +1402,12 @@
|
|||||||
{
|
{
|
||||||
await SiteGroupService.DeleteSiteGroupAsync(siteGroup.SiteGroupId);
|
await SiteGroupService.DeleteSiteGroupAsync(siteGroup.SiteGroupId);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
siteGroup.Synchronize = bool.Parse(_synchronize);
|
||||||
|
siteGroup.Notify = bool.Parse(_notify);
|
||||||
|
await SiteGroupService.UpdateSiteGroupAsync(siteGroup);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await LoadSiteGroups();
|
await LoadSiteGroups();
|
||||||
@@ -1452,7 +1457,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 != null))
|
foreach (var group in _siteGroupDefinitions.Where(item => item.PrimarySiteId == PageState.Site.SiteId && item.Synchronization))
|
||||||
{
|
{
|
||||||
group.Synchronize = true;
|
group.Synchronize = true;
|
||||||
await SiteGroupDefinitionService.UpdateSiteGroupDefinitionAsync(group);
|
await SiteGroupDefinitionService.UpdateSiteGroupDefinitionAsync(group);
|
||||||
|
|||||||
@@ -559,7 +559,7 @@
|
|||||||
<value>Notify?</value>
|
<value>Notify?</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Notify.HelpText" xml:space="preserve">
|
<data name="Notify.HelpText" xml:space="preserve">
|
||||||
<value>Specifies if the administrators of secondary sites should be notified of any synchronization activity</value>
|
<value>Specifies if site administrators should be notified of any synchronization activity</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Site.Text" xml:space="preserve">
|
<data name="Site.Text" xml:space="preserve">
|
||||||
<value>Site:</value>
|
<value>Site:</value>
|
||||||
@@ -573,4 +573,10 @@
|
|||||||
<data name="Synchronized.HelpText" xml:space="preserve">
|
<data name="Synchronized.HelpText" xml:space="preserve">
|
||||||
<value>The date/time of the last synchronization for the site</value>
|
<value>The date/time of the last synchronization for the site</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Synchronize.Text" xml:space="preserve">
|
||||||
|
<value>Synchronize?</value>
|
||||||
|
</data>
|
||||||
|
<data name="Synchronize.HelpText" xml:space="preserve">
|
||||||
|
<value>Specifies the synchronization approach between the primary site and the selected site</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -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.Synchronization != null && item.Synchronize))
|
foreach (var group in groups.Where(item => item.Synchronization && item.Synchronize))
|
||||||
{
|
{
|
||||||
// get data
|
// get data
|
||||||
if (siteGroups == null)
|
if (siteGroups == null)
|
||||||
@@ -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.SiteGroupDefinition.Synchronization.Value)
|
if (siteGroup.Synchronize)
|
||||||
{
|
{
|
||||||
siteRepository.UpdateSite(secondarySite);
|
siteRepository.UpdateSite(secondarySite);
|
||||||
}
|
}
|
||||||
@@ -195,7 +195,7 @@ 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) && siteGroup.SiteGroupDefinition.Notify)
|
if (!string.IsNullOrEmpty(log) && siteGroup.Notify)
|
||||||
{
|
{
|
||||||
// send change log to administrators
|
// send change log to administrators
|
||||||
SendNotifications(provider, secondarySite.SiteId, secondarySite.Name, log);
|
SendNotifications(provider, secondarySite.SiteId, secondarySite.Name, log);
|
||||||
@@ -244,7 +244,7 @@ namespace Oqtane.Infrastructure
|
|||||||
|
|
||||||
if (role == null)
|
if (role == null)
|
||||||
{
|
{
|
||||||
if (siteGroup.SiteGroupDefinition.Synchronization.Value)
|
if (siteGroup.Synchronize)
|
||||||
{
|
{
|
||||||
roleRepository.AddRole(secondaryRole);
|
roleRepository.AddRole(secondaryRole);
|
||||||
}
|
}
|
||||||
@@ -252,7 +252,7 @@ namespace Oqtane.Infrastructure
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (siteGroup.SiteGroupDefinition.Synchronization.Value)
|
if (siteGroup.Synchronize)
|
||||||
{
|
{
|
||||||
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.SiteGroupDefinition.Synchronization.Value)
|
if (siteGroup.Synchronize)
|
||||||
{
|
{
|
||||||
roleRepository.DeleteRole(secondaryRole.RoleId);
|
roleRepository.DeleteRole(secondaryRole.RoleId);
|
||||||
}
|
}
|
||||||
@@ -323,7 +323,7 @@ namespace Oqtane.Infrastructure
|
|||||||
|
|
||||||
if (folder == null)
|
if (folder == null)
|
||||||
{
|
{
|
||||||
if (siteGroup.SiteGroupDefinition.Synchronization.Value)
|
if (siteGroup.Synchronize)
|
||||||
{
|
{
|
||||||
folderRepository.AddFolder(secondaryFolder);
|
folderRepository.AddFolder(secondaryFolder);
|
||||||
}
|
}
|
||||||
@@ -331,7 +331,7 @@ namespace Oqtane.Infrastructure
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (siteGroup.SiteGroupDefinition.Synchronization.Value)
|
if (siteGroup.Synchronize)
|
||||||
{
|
{
|
||||||
folderRepository.UpdateFolder(secondaryFolder);
|
folderRepository.UpdateFolder(secondaryFolder);
|
||||||
}
|
}
|
||||||
@@ -370,7 +370,7 @@ namespace Oqtane.Infrastructure
|
|||||||
|
|
||||||
if (file == null)
|
if (file == null)
|
||||||
{
|
{
|
||||||
if (siteGroup.SiteGroupDefinition.Synchronization.Value)
|
if (siteGroup.Synchronize)
|
||||||
{
|
{
|
||||||
fileRepository.AddFile(secondaryFile);
|
fileRepository.AddFile(secondaryFile);
|
||||||
ReplicateFile(folderRepository, primaryFolder, primaryFile, secondaryFolder, secondaryFile);
|
ReplicateFile(folderRepository, primaryFolder, primaryFile, secondaryFolder, secondaryFile);
|
||||||
@@ -379,7 +379,7 @@ namespace Oqtane.Infrastructure
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (siteGroup.SiteGroupDefinition.Synchronization.Value)
|
if (siteGroup.Synchronize)
|
||||||
{
|
{
|
||||||
fileRepository.UpdateFile(secondaryFile);
|
fileRepository.UpdateFile(secondaryFile);
|
||||||
ReplicateFile(folderRepository, primaryFolder, primaryFile, secondaryFolder, secondaryFile);
|
ReplicateFile(folderRepository, primaryFolder, primaryFile, secondaryFolder, secondaryFile);
|
||||||
@@ -393,7 +393,7 @@ 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.SiteGroupDefinition.Synchronization.Value)
|
if (siteGroup.Synchronize)
|
||||||
{
|
{
|
||||||
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);
|
||||||
@@ -406,7 +406,7 @@ namespace Oqtane.Infrastructure
|
|||||||
// 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.SiteGroupDefinition.Synchronization.Value)
|
if (siteGroup.Synchronize)
|
||||||
{
|
{
|
||||||
folderRepository.DeleteFolder(secondaryFolder.FolderId);
|
folderRepository.DeleteFolder(secondaryFolder.FolderId);
|
||||||
}
|
}
|
||||||
@@ -490,7 +490,7 @@ namespace Oqtane.Infrastructure
|
|||||||
|
|
||||||
if (page == null)
|
if (page == null)
|
||||||
{
|
{
|
||||||
if (siteGroup.SiteGroupDefinition.Synchronization.Value)
|
if (siteGroup.Synchronize)
|
||||||
{
|
{
|
||||||
secondaryPage = pageRepository.AddPage(secondaryPage);
|
secondaryPage = pageRepository.AddPage(secondaryPage);
|
||||||
}
|
}
|
||||||
@@ -498,7 +498,7 @@ namespace Oqtane.Infrastructure
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (siteGroup.SiteGroupDefinition.Synchronization.Value)
|
if (siteGroup.Synchronize)
|
||||||
{
|
{
|
||||||
secondaryPage = pageRepository.UpdatePage(secondaryPage);
|
secondaryPage = pageRepository.UpdatePage(secondaryPage);
|
||||||
}
|
}
|
||||||
@@ -558,7 +558,7 @@ namespace Oqtane.Infrastructure
|
|||||||
if (module == null)
|
if (module == null)
|
||||||
{
|
{
|
||||||
// add new module
|
// add new module
|
||||||
if (siteGroup.SiteGroupDefinition.Synchronization.Value)
|
if (siteGroup.Synchronize)
|
||||||
{
|
{
|
||||||
module = moduleRepository.AddModule(secondaryPageModule.Module);
|
module = moduleRepository.AddModule(secondaryPageModule.Module);
|
||||||
updateContent = true;
|
updateContent = true;
|
||||||
@@ -569,7 +569,7 @@ namespace Oqtane.Infrastructure
|
|||||||
{
|
{
|
||||||
secondaryPageModule.ModuleId = module.ModuleId;
|
secondaryPageModule.ModuleId = module.ModuleId;
|
||||||
secondaryPageModule.Module = null; // remove tracking
|
secondaryPageModule.Module = null; // remove tracking
|
||||||
if (siteGroup.SiteGroupDefinition.Synchronization.Value)
|
if (siteGroup.Synchronize)
|
||||||
{
|
{
|
||||||
secondaryPageModule = pageModuleRepository.AddPageModule(secondaryPageModule);
|
secondaryPageModule = pageModuleRepository.AddPageModule(secondaryPageModule);
|
||||||
}
|
}
|
||||||
@@ -582,7 +582,7 @@ namespace Oqtane.Infrastructure
|
|||||||
// update existing module
|
// update existing module
|
||||||
if (primaryPageModule.Module.ModifiedOn > siteGroup.SynchronizedOn)
|
if (primaryPageModule.Module.ModifiedOn > siteGroup.SynchronizedOn)
|
||||||
{
|
{
|
||||||
if (siteGroup.SiteGroupDefinition.Synchronization.Value)
|
if (siteGroup.Synchronize)
|
||||||
{
|
{
|
||||||
moduleRepository.UpdateModule(secondaryPageModule.Module);
|
moduleRepository.UpdateModule(secondaryPageModule.Module);
|
||||||
updateContent = true;
|
updateContent = true;
|
||||||
@@ -591,7 +591,7 @@ namespace Oqtane.Infrastructure
|
|||||||
}
|
}
|
||||||
if (primaryPageModule.ModifiedOn > siteGroup.SynchronizedOn)
|
if (primaryPageModule.ModifiedOn > siteGroup.SynchronizedOn)
|
||||||
{
|
{
|
||||||
if (siteGroup.SiteGroupDefinition.Synchronization.Value)
|
if (siteGroup.Synchronize)
|
||||||
{
|
{
|
||||||
secondaryPageModule = pageModuleRepository.UpdatePageModule(secondaryPageModule);
|
secondaryPageModule = pageModuleRepository.UpdatePageModule(secondaryPageModule);
|
||||||
}
|
}
|
||||||
@@ -613,7 +613,7 @@ 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.SiteGroupDefinition.Synchronization.Value)
|
if (siteGroup.Synchronize)
|
||||||
{
|
{
|
||||||
((ISynchronizable)moduleObject).LoadModule(secondaryPageModule.Module, primaryModuleContent, primaryPageModule.Module.ModuleDefinition.Version);
|
((ISynchronizable)moduleObject).LoadModule(secondaryPageModule.Module, primaryModuleContent, primaryPageModule.Module.ModuleDefinition.Version);
|
||||||
}
|
}
|
||||||
@@ -648,7 +648,7 @@ 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.SiteGroupDefinition.Synchronization.Value)
|
if (siteGroup.Synchronize)
|
||||||
{
|
{
|
||||||
pageModuleRepository.DeletePageModule(secondaryPageModule.PageModuleId);
|
pageModuleRepository.DeletePageModule(secondaryPageModule.PageModuleId);
|
||||||
}
|
}
|
||||||
@@ -659,7 +659,7 @@ namespace Oqtane.Infrastructure
|
|||||||
// 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.SiteGroupDefinition.Synchronization.Value)
|
if (siteGroup.Synchronize)
|
||||||
{
|
{
|
||||||
pageRepository.DeletePage(secondaryPage.PageId);
|
pageRepository.DeletePage(secondaryPage.PageId);
|
||||||
}
|
}
|
||||||
@@ -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.SiteGroupDefinition.Synchronization.Value && !excludedSettings.Any(item => item.EntityName == secondarySetting.EntityName && item.SettingName == secondarySetting.SettingName))
|
if (siteGroup.Synchronize && !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.SiteGroupDefinition.Synchronization.Value && !excludedSettings.Any(item => item.EntityName == secondarySetting.EntityName && item.SettingName == secondarySetting.SettingName))
|
if (siteGroup.Synchronize && !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.SiteGroupDefinition.Synchronization.Value && !excludedSettings.Any(item => item.EntityName == secondarySetting.EntityName && item.SettingName == secondarySetting.SettingName))
|
if (siteGroup.Synchronize && !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;
|
||||||
|
|||||||
@@ -24,8 +24,7 @@ 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", true);
|
Synchronization = AddBooleanColumn(table, "Synchronization");
|
||||||
Notify = AddBooleanColumn(table, "Notify");
|
|
||||||
Synchronize = AddBooleanColumn(table, "Synchronize");
|
Synchronize = AddBooleanColumn(table, "Synchronize");
|
||||||
Localization = AddBooleanColumn(table, "Localization");
|
Localization = AddBooleanColumn(table, "Localization");
|
||||||
|
|
||||||
@@ -42,8 +41,6 @@ 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,6 +28,8 @@ 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");
|
||||||
|
Notify = AddBooleanColumn(table, "Notify");
|
||||||
SynchronizedOn = AddDateTimeColumn(table, "SynchronizedOn", true);
|
SynchronizedOn = AddDateTimeColumn(table, "SynchronizedOn", true);
|
||||||
|
|
||||||
AddAuditableColumns(table);
|
AddAuditableColumns(table);
|
||||||
@@ -41,6 +43,10 @@ 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> Notify { get; set; }
|
||||||
|
|
||||||
public OperationBuilder<AddColumnOperation> SynchronizedOn { get; set; }
|
public OperationBuilder<AddColumnOperation> SynchronizedOn { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,16 @@ namespace Oqtane.Models
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int SiteId { get; set; }
|
public int SiteId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Specifies the site synchronization approach (false = compare, true = update)
|
||||||
|
/// </summary>
|
||||||
|
public bool Synchronize { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates if the site administrator should be notified of any synchronization activity
|
||||||
|
/// </summary>
|
||||||
|
public bool Notify { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The last date/time the site was synchronized
|
/// The last date/time the site was synchronized
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -18,14 +18,9 @@ namespace Oqtane.Models
|
|||||||
public int PrimarySiteId { get; set; }
|
public int PrimarySiteId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Indicates if the group supports synchronization (null = no, false = compare, true = update)
|
/// Indicates if the group supports synchronization
|
||||||
/// </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