include Search Settings
This commit is contained in:
parent
deb6a9e51c
commit
76bdcea4b1
93
Oqtane.Client/Modules/Admin/Search/Index.razor
Normal file
93
Oqtane.Client/Modules/Admin/Search/Index.razor
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
@namespace Oqtane.Modules.Admin.Search
|
||||||
|
@inherits ModuleBase
|
||||||
|
@inject ISettingService SettingService
|
||||||
|
@inject IStringLocalizer<Index> Localizer
|
||||||
|
@inject IStringLocalizer<SharedResources> SharedLocalizer
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="row mb-1 align-items-center">
|
||||||
|
<Label Class="col-sm-3" For="enabled" HelpText="Specify if search indexing is enabled" ResourceKey="Enabled">Indexing Enabled? </Label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<select id="enabled" class="form-select" @bind="@_enabled">
|
||||||
|
<option value="True">@SharedLocalizer["Yes"]</option>
|
||||||
|
<option value="False">@SharedLocalizer["No"]</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-1 align-items-center">
|
||||||
|
<Label Class="col-sm-3" For="lastindexedon" HelpText="The date/time which the site was last indexed on" ResourceKey="LastIndexedOn">Last Indexed: </Label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input id="lastindexedon" class="form-control" @bind="@_lastIndexedOn" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-1 align-items-center">
|
||||||
|
<Label Class="col-sm-3" For="ignorepaths" HelpText="Comma delimited list of page paths which should be ignored" ResourceKey="IgnorePaths">Ignore Paths: </Label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<textarea id="ignorepaths" class="form-control" @bind="@_ignorePaths" rows="3"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-1 align-items-center">
|
||||||
|
<Label Class="col-sm-3" For="ignoreentities" HelpText="Comma delimited list of entities which should be ignored" ResourceKey="IgnoreEntities">Ignore Entities: </Label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<textarea id="ignoreentities" class="form-control" @bind="@_ignoreEntities" rows="3"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-1 align-items-center">
|
||||||
|
<Label Class="col-sm-3" For="minimumwordlength" HelpText="Minimum length of a word to be indexed" ResourceKey="MinimumWordLength">Word Length: </Label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<input id="minimumwordlength" class="form-control" type="number" min="0" step="1" @bind="@_minimumWordLength" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-1 align-items-center">
|
||||||
|
<Label Class="col-sm-3" For="ignorewords" HelpText="Comma delimited list of words which should be ignored" ResourceKey="IgnoreWords">Ignore Words: </Label>
|
||||||
|
<div class="col-sm-9">
|
||||||
|
<textarea id="ignorewords" class="form-control" @bind="@_ignoreWords" rows="3"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br /><br />
|
||||||
|
<button type="button" class="btn btn-success" @onclick="Save">@SharedLocalizer["Save"]</button>
|
||||||
|
<br /><br />
|
||||||
|
|
||||||
|
@code {
|
||||||
|
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Admin;
|
||||||
|
|
||||||
|
private string _enabled;
|
||||||
|
private string _lastIndexedOn;
|
||||||
|
private string _ignorePaths;
|
||||||
|
private string _ignoreEntities;
|
||||||
|
private string _minimumWordLength;
|
||||||
|
private string _ignoreWords;
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
var settings = await SettingService.GetSiteSettingsAsync(PageState.Site.SiteId);
|
||||||
|
_enabled = SettingService.GetSetting(settings, "Search_Enabled", "True");
|
||||||
|
_lastIndexedOn = SettingService.GetSetting(settings, "Search_LastIndexedOn", "");
|
||||||
|
_ignorePaths = SettingService.GetSetting(settings, "Search_IgnorePaths", "");
|
||||||
|
_ignoreEntities = SettingService.GetSetting(settings, "Search_IgnoreEntities", "");
|
||||||
|
_minimumWordLength = SettingService.GetSetting(settings, "Search_MininumWordLength", "3");
|
||||||
|
_ignoreWords = SettingService.GetSetting(settings, "Search_IgnoreWords", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task Save()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var settings = await SettingService.GetSiteSettingsAsync(PageState.Site.SiteId);
|
||||||
|
settings = SettingService.SetSetting(settings, "Search_Enabled", _enabled, true);
|
||||||
|
settings = SettingService.SetSetting(settings, "Search_LastIndexedOn", _lastIndexedOn, true);
|
||||||
|
settings = SettingService.SetSetting(settings, "Search_IgnorePaths", _ignorePaths, true);
|
||||||
|
settings = SettingService.SetSetting(settings, "Search_IgnoreEntities", _ignoreEntities, true);
|
||||||
|
settings = SettingService.SetSetting(settings, "Search_MininumWordLength", _minimumWordLength, true);
|
||||||
|
settings = SettingService.SetSetting(settings, "Search_IgnoreWords", _ignoreWords, true);
|
||||||
|
await SettingService.UpdateSiteSettingsAsync(settings, PageState.Site.SiteId);
|
||||||
|
AddModuleMessage(Localizer["Success.SaveSiteSettings"], MessageType.Success);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
await logger.LogError(ex, "Error Saving Site Settings {Error}", ex.Message);
|
||||||
|
AddModuleMessage(Localizer["Error.SaveSiteSettings"], MessageType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,7 +1,6 @@
|
||||||
using Oqtane.Models;
|
using Oqtane.Models;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Linq;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Oqtane.Shared;
|
using Oqtane.Shared;
|
||||||
using System;
|
using System;
|
||||||
|
|
|
@ -150,7 +150,7 @@ namespace Oqtane.SiteTemplates
|
||||||
Parent = "",
|
Parent = "",
|
||||||
Path = "search",
|
Path = "search",
|
||||||
Order = seed + 9,
|
Order = seed + 9,
|
||||||
Icon = "oi oi-magnifying-glass",
|
Icon = Icons.MagnifyingGlass,
|
||||||
IsNavigation = false,
|
IsNavigation = false,
|
||||||
IsPersonalizable = false,
|
IsPersonalizable = false,
|
||||||
PermissionList = new List<Permission> {
|
PermissionList = new List<Permission> {
|
||||||
|
@ -159,7 +159,7 @@ namespace Oqtane.SiteTemplates
|
||||||
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
},
|
},
|
||||||
PageTemplateModules = new List<PageTemplateModule> {
|
PageTemplateModules = new List<PageTemplateModule> {
|
||||||
new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.Admin.SearchResults, Oqtane.Client", Title = "Search", Pane = PaneNames.Default,
|
new PageTemplateModule { ModuleDefinitionName = typeof(Oqtane.Modules.Admin.SearchResults.Index).ToModuleDefinitionName(), Title = "Search", Pane = PaneNames.Default,
|
||||||
PermissionList = new List<Permission> {
|
PermissionList = new List<Permission> {
|
||||||
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
new Permission(PermissionNames.View, RoleNames.Everyone, true),
|
new Permission(PermissionNames.View, RoleNames.Everyone, true),
|
||||||
|
@ -481,14 +481,43 @@ namespace Oqtane.SiteTemplates
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// host pages
|
pageTemplates.Add(new PageTemplate
|
||||||
|
{
|
||||||
|
Name = "Search Settings",
|
||||||
|
Parent = "Admin",
|
||||||
|
Order = 19,
|
||||||
|
Path = "admin/search",
|
||||||
|
Icon = Icons.MagnifyingGlass,
|
||||||
|
IsNavigation = false,
|
||||||
|
IsPersonalizable = false,
|
||||||
|
PermissionList = new List<Permission>
|
||||||
|
{
|
||||||
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
|
},
|
||||||
|
PageTemplateModules = new List<PageTemplateModule>
|
||||||
|
{
|
||||||
|
new PageTemplateModule
|
||||||
|
{
|
||||||
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Search.Index).ToModuleDefinitionName(), Title = "Search Settings", Pane = PaneNames.Default,
|
||||||
|
PermissionList = new List<Permission>
|
||||||
|
{
|
||||||
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
|
},
|
||||||
|
Content = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// host pages (order starts at 51)
|
||||||
pageTemplates.Add(new PageTemplate
|
pageTemplates.Add(new PageTemplate
|
||||||
{
|
{
|
||||||
Name = "Event Log",
|
Name = "Event Log",
|
||||||
Parent = "Admin",
|
Parent = "Admin",
|
||||||
Order = 19,
|
Order = 51,
|
||||||
Path = "admin/log",
|
Path = "admin/log",
|
||||||
Icon = Icons.MagnifyingGlass,
|
Icon = Icons.List,
|
||||||
IsNavigation = false,
|
IsNavigation = false,
|
||||||
IsPersonalizable = false,
|
IsPersonalizable = false,
|
||||||
PermissionList = new List<Permission>
|
PermissionList = new List<Permission>
|
||||||
|
@ -514,7 +543,7 @@ namespace Oqtane.SiteTemplates
|
||||||
{
|
{
|
||||||
Name = "Site Management",
|
Name = "Site Management",
|
||||||
Parent = "Admin",
|
Parent = "Admin",
|
||||||
Order = 21,
|
Order = 53,
|
||||||
Path = "admin/sites",
|
Path = "admin/sites",
|
||||||
Icon = Icons.Globe,
|
Icon = Icons.Globe,
|
||||||
IsNavigation = false,
|
IsNavigation = false,
|
||||||
|
@ -542,7 +571,7 @@ namespace Oqtane.SiteTemplates
|
||||||
{
|
{
|
||||||
Name = "Module Management",
|
Name = "Module Management",
|
||||||
Parent = "Admin",
|
Parent = "Admin",
|
||||||
Order = 23,
|
Order = 55,
|
||||||
Path = "admin/modules",
|
Path = "admin/modules",
|
||||||
Icon = Icons.Browser,
|
Icon = Icons.Browser,
|
||||||
IsNavigation = false,
|
IsNavigation = false,
|
||||||
|
@ -570,7 +599,7 @@ namespace Oqtane.SiteTemplates
|
||||||
{
|
{
|
||||||
Name = "Theme Management",
|
Name = "Theme Management",
|
||||||
Parent = "Admin",
|
Parent = "Admin",
|
||||||
Order = 25,
|
Order = 57,
|
||||||
Path = "admin/themes",
|
Path = "admin/themes",
|
||||||
Icon = Icons.Brush,
|
Icon = Icons.Brush,
|
||||||
IsNavigation = false,
|
IsNavigation = false,
|
||||||
|
@ -598,7 +627,7 @@ namespace Oqtane.SiteTemplates
|
||||||
{
|
{
|
||||||
Name = "Language Management",
|
Name = "Language Management",
|
||||||
Parent = "Admin",
|
Parent = "Admin",
|
||||||
Order = 27,
|
Order = 59,
|
||||||
Path = "admin/languages",
|
Path = "admin/languages",
|
||||||
Icon = Icons.Text,
|
Icon = Icons.Text,
|
||||||
IsNavigation = false,
|
IsNavigation = false,
|
||||||
|
@ -630,7 +659,7 @@ namespace Oqtane.SiteTemplates
|
||||||
{
|
{
|
||||||
Name = "Scheduled Jobs",
|
Name = "Scheduled Jobs",
|
||||||
Parent = "Admin",
|
Parent = "Admin",
|
||||||
Order = 29,
|
Order = 61,
|
||||||
Path = "admin/jobs",
|
Path = "admin/jobs",
|
||||||
Icon = Icons.Timer,
|
Icon = Icons.Timer,
|
||||||
IsNavigation = false,
|
IsNavigation = false,
|
||||||
|
@ -658,7 +687,7 @@ namespace Oqtane.SiteTemplates
|
||||||
{
|
{
|
||||||
Name = "Sql Management",
|
Name = "Sql Management",
|
||||||
Parent = "Admin",
|
Parent = "Admin",
|
||||||
Order = 31,
|
Order = 63,
|
||||||
Path = "admin/sql",
|
Path = "admin/sql",
|
||||||
Icon = Icons.Spreadsheet,
|
Icon = Icons.Spreadsheet,
|
||||||
IsNavigation = false,
|
IsNavigation = false,
|
||||||
|
@ -686,7 +715,7 @@ namespace Oqtane.SiteTemplates
|
||||||
{
|
{
|
||||||
Name = "System Info",
|
Name = "System Info",
|
||||||
Parent = "Admin",
|
Parent = "Admin",
|
||||||
Order = 33,
|
Order = 65,
|
||||||
Path = "admin/system",
|
Path = "admin/system",
|
||||||
Icon = Icons.MedicalCross,
|
Icon = Icons.MedicalCross,
|
||||||
IsNavigation = false,
|
IsNavigation = false,
|
||||||
|
@ -714,7 +743,7 @@ namespace Oqtane.SiteTemplates
|
||||||
{
|
{
|
||||||
Name = "System Update",
|
Name = "System Update",
|
||||||
Parent = "Admin",
|
Parent = "Admin",
|
||||||
Order = 35,
|
Order = 67,
|
||||||
Path = "admin/update",
|
Path = "admin/update",
|
||||||
Icon = Icons.Aperture,
|
Icon = Icons.Aperture,
|
||||||
IsNavigation = false,
|
IsNavigation = false,
|
||||||
|
|
|
@ -139,71 +139,69 @@ namespace Oqtane.Infrastructure
|
||||||
|
|
||||||
private void Upgrade_3_0_1(Tenant tenant, IServiceScope scope)
|
private void Upgrade_3_0_1(Tenant tenant, IServiceScope scope)
|
||||||
{
|
{
|
||||||
var pageTemplates = new List<PageTemplate>();
|
var pageTemplates = new List<PageTemplate>
|
||||||
|
|
||||||
pageTemplates.Add(new PageTemplate
|
|
||||||
{
|
{
|
||||||
Name = "Url Mappings",
|
new PageTemplate
|
||||||
Parent = "Admin",
|
|
||||||
Order = 33,
|
|
||||||
Path = "admin/urlmappings",
|
|
||||||
Icon = Icons.LinkBroken,
|
|
||||||
IsNavigation = false,
|
|
||||||
IsPersonalizable = false,
|
|
||||||
PermissionList = new List<Permission>
|
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
Update = false,
|
||||||
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
Name = "Url Mappings",
|
||||||
},
|
Parent = "Admin",
|
||||||
PageTemplateModules = new List<PageTemplateModule>
|
Order = 33,
|
||||||
{
|
Path = "admin/urlmappings",
|
||||||
new PageTemplateModule
|
Icon = Icons.LinkBroken,
|
||||||
|
IsNavigation = false,
|
||||||
|
IsPersonalizable = false,
|
||||||
|
PermissionList = new List<Permission>
|
||||||
{
|
{
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.UrlMappings.Index).ToModuleDefinitionName(), Title = "Url Mappings", Pane = PaneNames.Default,
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
PermissionList = new List<Permission>
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
|
},
|
||||||
|
PageTemplateModules = new List<PageTemplateModule>
|
||||||
|
{
|
||||||
|
new PageTemplateModule
|
||||||
{
|
{
|
||||||
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.UrlMappings.Index).ToModuleDefinitionName(), Title = "Url Mappings", Pane = PaneNames.Default,
|
||||||
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
PermissionList = new List<Permission>
|
||||||
},
|
{
|
||||||
Content = ""
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
|
},
|
||||||
|
Content = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new PageTemplate
|
||||||
|
{
|
||||||
|
Update = false,
|
||||||
|
Name = "Visitor Management",
|
||||||
|
Parent = "Admin",
|
||||||
|
Order = 35,
|
||||||
|
Path = "admin/visitors",
|
||||||
|
Icon = Icons.Eye,
|
||||||
|
IsNavigation = false,
|
||||||
|
IsPersonalizable = false,
|
||||||
|
PermissionList = new List<Permission>
|
||||||
|
{
|
||||||
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
|
},
|
||||||
|
PageTemplateModules = new List<PageTemplateModule>
|
||||||
|
{
|
||||||
|
new PageTemplateModule
|
||||||
|
{
|
||||||
|
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Visitors.Index).ToModuleDefinitionName(), Title = "Visitor Management", Pane = PaneNames.Default,
|
||||||
|
PermissionList = new List<Permission>
|
||||||
|
{
|
||||||
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
|
},
|
||||||
|
Content = ""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
|
||||||
pageTemplates.Add(new PageTemplate
|
AddPagesToSites(scope, pageTemplates);
|
||||||
{
|
|
||||||
Name = "Visitor Management",
|
|
||||||
Parent = "Admin",
|
|
||||||
Order = 35,
|
|
||||||
Path = "admin/visitors",
|
|
||||||
Icon = Icons.Eye,
|
|
||||||
IsNavigation = false,
|
|
||||||
IsPersonalizable = false,
|
|
||||||
PermissionList = new List<Permission>
|
|
||||||
{
|
|
||||||
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
|
||||||
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
|
||||||
},
|
|
||||||
PageTemplateModules = new List<PageTemplateModule>
|
|
||||||
{
|
|
||||||
new PageTemplateModule
|
|
||||||
{
|
|
||||||
ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Visitors.Index).ToModuleDefinitionName(), Title = "Visitor Management", Pane = PaneNames.Default,
|
|
||||||
PermissionList = new List<Permission>
|
|
||||||
{
|
|
||||||
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
|
||||||
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
|
||||||
},
|
|
||||||
Content = ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var sites = scope.ServiceProvider.GetRequiredService<ISiteRepository>();
|
|
||||||
foreach (Site site in sites.GetSites().ToList())
|
|
||||||
{
|
|
||||||
sites.CreatePages(site, pageTemplates, null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Upgrade_3_1_3(Tenant tenant, IServiceScope scope)
|
private void Upgrade_3_1_3(Tenant tenant, IServiceScope scope)
|
||||||
|
@ -386,49 +384,69 @@ namespace Oqtane.Infrastructure
|
||||||
Debug.WriteLine($"Oqtane Error: Error In 5.1.0 Upgrade Logic - {ex}");
|
Debug.WriteLine($"Oqtane Error: Error In 5.1.0 Upgrade Logic - {ex}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Upgrade_5_2_0(Tenant tenant, IServiceScope scope)
|
private void Upgrade_5_2_0(Tenant tenant, IServiceScope scope)
|
||||||
{
|
{
|
||||||
CreateSearchResultsPages(tenant, scope);
|
var pageTemplates = new List<PageTemplate>
|
||||||
}
|
|
||||||
|
|
||||||
private void CreateSearchResultsPages(Tenant tenant, IServiceScope scope)
|
|
||||||
{
|
|
||||||
var pageTemplates = new List<PageTemplate>();
|
|
||||||
pageTemplates.Add(new PageTemplate
|
|
||||||
{
|
{
|
||||||
Name = "Search",
|
new PageTemplate
|
||||||
Parent = "",
|
{
|
||||||
Path = "search",
|
Update = false,
|
||||||
Icon = "oi oi-magnifying-glass",
|
Name = "Search",
|
||||||
IsNavigation = false,
|
Parent = "",
|
||||||
IsPersonalizable = false,
|
Path = "search",
|
||||||
PermissionList = new List<Permission> {
|
Icon = Icons.MagnifyingGlass,
|
||||||
new Permission(PermissionNames.View, RoleNames.Everyone, true),
|
IsNavigation = false,
|
||||||
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
IsPersonalizable = false,
|
||||||
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
PermissionList = new List<Permission> {
|
||||||
|
new Permission(PermissionNames.View, RoleNames.Everyone, true),
|
||||||
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
|
},
|
||||||
|
PageTemplateModules = new List<PageTemplateModule> {
|
||||||
|
new PageTemplateModule { ModuleDefinitionName = typeof(Oqtane.Modules.Admin.SearchResults.Index).ToModuleDefinitionName(), Title = "Search", Pane = PaneNames.Default,
|
||||||
|
PermissionList = new List<Permission> {
|
||||||
|
new Permission(PermissionNames.View, RoleNames.Everyone, true),
|
||||||
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
PageTemplateModules = new List<PageTemplateModule> {
|
new PageTemplate
|
||||||
new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.Admin.SearchResults, Oqtane.Client", Title = "Search", Pane = PaneNames.Default,
|
{
|
||||||
PermissionList = new List<Permission> {
|
Update = false,
|
||||||
new Permission(PermissionNames.View, RoleNames.Everyone, true),
|
Name = "Search Settings",
|
||||||
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
Parent = "",
|
||||||
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
Path = "admin/search",
|
||||||
|
Icon = Icons.MagnifyingGlass,
|
||||||
|
IsNavigation = false,
|
||||||
|
IsPersonalizable = false,
|
||||||
|
PermissionList = new List<Permission> {
|
||||||
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
|
},
|
||||||
|
PageTemplateModules = new List<PageTemplateModule> {
|
||||||
|
new PageTemplateModule { ModuleDefinitionName = typeof(Oqtane.Modules.Admin.Search.Index).ToModuleDefinitionName(), Title = "Search Settings", Pane = PaneNames.Default,
|
||||||
|
PermissionList = new List<Permission> {
|
||||||
|
new Permission(PermissionNames.View, RoleNames.Admin, true),
|
||||||
|
new Permission(PermissionNames.Edit, RoleNames.Admin, true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
|
||||||
var pages = scope.ServiceProvider.GetRequiredService<IPageRepository>();
|
AddPagesToSites(scope, pageTemplates);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddPagesToSites(IServiceScope scope, List<PageTemplate> pageTemplates)
|
||||||
|
{
|
||||||
var sites = scope.ServiceProvider.GetRequiredService<ISiteRepository>();
|
var sites = scope.ServiceProvider.GetRequiredService<ISiteRepository>();
|
||||||
foreach (var site in sites.GetSites().ToList())
|
foreach (var site in sites.GetSites().ToList())
|
||||||
{
|
{
|
||||||
if (!pages.GetPages(site.SiteId).ToList().Where(item => item.Path == "search").Any())
|
sites.CreatePages(site, pageTemplates, null);
|
||||||
{
|
|
||||||
sites.CreatePages(site, pageTemplates, null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user