diff --git a/Oqtane.Client/Modules/Admin/ModuleDefinitions/Edit.razor b/Oqtane.Client/Modules/Admin/ModuleDefinitions/Edit.razor
index 9c1f4633a..1e0c427cc 100644
--- a/Oqtane.Client/Modules/Admin/ModuleDefinitions/Edit.razor
+++ b/Oqtane.Client/Modules/Admin/ModuleDefinitions/Edit.razor
@@ -32,7 +32,7 @@
diff --git a/Oqtane.Client/Themes/Controls/Theme/ControlPanelInteractive.razor b/Oqtane.Client/Themes/Controls/Theme/ControlPanelInteractive.razor
index fe8c01286..bd386c01e 100644
--- a/Oqtane.Client/Themes/Controls/Theme/ControlPanelInteractive.razor
+++ b/Oqtane.Client/Themes/Controls/Theme/ControlPanelInteractive.razor
@@ -294,7 +294,7 @@
_containerType = PageState.Site.DefaultContainerType;
_allModuleDefinitions = await ModuleDefinitionService.GetModuleDefinitionsAsync(PageState.Site.SiteId);
_moduleDefinitions = _allModuleDefinitions.Where(item => item.Categories.Contains(_category)).ToList();
- _categories = _allModuleDefinitions.SelectMany(m => m.Categories.Split(',')).Distinct().ToList();
+ _categories = _allModuleDefinitions.SelectMany(m => m.Categories.Split(',', StringSplitOptions.RemoveEmptyEntries)).Distinct().Where(item => item != "Library").ToList();
}
}
diff --git a/Oqtane.Server/Repository/ModuleDefinitionRepository.cs b/Oqtane.Server/Repository/ModuleDefinitionRepository.cs
index 563a5a1d5..124897e3b 100644
--- a/Oqtane.Server/Repository/ModuleDefinitionRepository.cs
+++ b/Oqtane.Server/Repository/ModuleDefinitionRepository.cs
@@ -287,7 +287,9 @@ private List
LoadModuleDefinitionsFromAssembly(List item.GetInterfaces().Contains(typeof(IModule))).ToArray();
Type[] modulecontroltypes = assembly.GetTypes().Where(item => item.GetInterfaces().Contains(typeof(IModuleControl))).ToArray();
+
foreach (Type modulecontroltype in modulecontroltypes)
{
// Check if type should be ignored
@@ -299,12 +301,9 @@ private List LoadModuleDefinitionsFromAssembly(List item.ModuleDefinitionName == qualifiedModuleType);
if (index == -1)
{
- // determine if this module implements IModule
- Type moduletype = assembly
- .GetTypes()
- .Where(item => item.Namespace != null)
- .Where(item => item.Namespace == modulecontroltype.Namespace || item.Namespace.StartsWith(modulecontroltype.Namespace + "."))
- .FirstOrDefault(item => item.GetInterfaces().Contains(typeof(IModule)));
+ // determine if this component is part of a module which implements IModule
+ Type moduletype = moduletypes.FirstOrDefault(item => item.Namespace == modulecontroltype.Namespace);
+
if (moduletype != null)
{
// get property values from IModule
@@ -399,6 +398,22 @@ private List LoadModuleDefinitionsFromAssembly(List !modulecontroltypes.Any(m2 => m1.Namespace == m2.Namespace)))
+ {
+ // get property values from IModule
+ var moduleobject = Activator.CreateInstance(moduletype) as IModule;
+ moduledefinition = moduleobject.ModuleDefinition;
+ moduledefinition.ModuleDefinitionName = moduletype.Namespace + ", " + moduletype.Assembly.GetName().Name;
+ moduledefinition.AssemblyName = assembly.GetName().Name;
+ moduledefinition.Categories = "Library";
+ moduledefinition.PermissionList = new List
+ {
+ new Permission(PermissionNames.Utilize, RoleNames.Host, true)
+ };
+ moduledefinitions.Add(moduledefinition);
+ }
+
return moduledefinitions;
}
diff --git a/Oqtane.Server/Repository/ThemeRepository.cs b/Oqtane.Server/Repository/ThemeRepository.cs
index ae44815db..bd557bdd9 100644
--- a/Oqtane.Server/Repository/ThemeRepository.cs
+++ b/Oqtane.Server/Repository/ThemeRepository.cs
@@ -13,6 +13,7 @@
using Oqtane.Themes;
using System.Reflection.Metadata;
using Oqtane.Migrations.Master;
+using Oqtane.Modules;
namespace Oqtane.Repository
{
@@ -224,9 +225,11 @@ private List LoadThemesFromAssemblies()
private List LoadThemesFromAssembly(List themes, Assembly assembly)
{
Theme theme;
- List themeTypes = new List();
+ Type[] themeTypes = assembly.GetTypes().Where(item => item.GetInterfaces().Contains(typeof(ITheme))).ToArray();
Type[] themeControlTypes = assembly.GetTypes().Where(item => item.GetInterfaces().Contains(typeof(IThemeControl))).ToArray();
+ Type[] containerControlTypes = assembly.GetTypes().Where(item => item.GetInterfaces().Contains(typeof(IContainerControl))).ToArray();
+
foreach (Type themeControlType in themeControlTypes)
{
// Check if type should be ignored
@@ -240,16 +243,9 @@ private List LoadThemesFromAssembly(List themes, Assembly assembly
int index = themes.FindIndex(item => item.ThemeName == qualifiedThemeType);
if (index == -1)
{
- // Find all types in the assembly with the same namespace root
- themeTypes = assembly.GetTypes()
- .Where(item => !item.IsOqtaneIgnore())
- .Where(item => item.Namespace != null)
- .Where(item => item.Namespace == themeControlType.Namespace || item.Namespace.StartsWith(themeControlType.Namespace + "."))
- .ToList();
-
- // determine if this theme implements ITheme
- Type themetype = themeTypes
- .FirstOrDefault(item => item.GetInterfaces().Contains(typeof(ITheme)));
+ // determine if this component is part of a theme which implements ITheme
+ Type themetype = themeTypes.FirstOrDefault(item => item.Namespace == themeControlType.Namespace);
+
if (themetype != null)
{
var themeobject = Activator.CreateInstance(themetype) as ITheme;
@@ -285,6 +281,7 @@ private List LoadThemesFromAssembly(List themes, Assembly assembly
}
theme = themes[index];
+ // add theme control
var themecontrolobject = Activator.CreateInstance(themeControlType) as IThemeControl;
theme.Themes.Add(
new ThemeControl
@@ -296,14 +293,12 @@ private List LoadThemesFromAssembly(List themes, Assembly assembly
}
);
- // containers
- Type[] containertypes = themeTypes
- .Where(item => item.GetInterfaces().Contains(typeof(IContainerControl))).ToArray();
- foreach (Type containertype in containertypes)
+ if (!theme.Containers.Any())
{
- var containerobject = Activator.CreateInstance(containertype) as IThemeControl;
- if (theme.Containers.FirstOrDefault(item => item.TypeName == containertype.FullName + ", " + themeControlType.Assembly.GetName().Name) == null)
+ // add container controls
+ foreach (Type containertype in containerControlTypes.Where(item => item.Namespace == themeControlType.Namespace))
{
+ var containerobject = Activator.CreateInstance(containertype) as IThemeControl;
theme.Containers.Add(
new ThemeControl
{