();
private string _title;
private string _containerType;
private string _allPages = "false";
@@ -105,7 +105,7 @@
protected override async Task OnInitializedAsync()
{
_title = ModuleState.Title;
- _containers = ThemeService.GetContainerTypes(await ThemeService.GetThemesAsync(), PageState.Page.ThemeType);
+ _containers = ThemeService.GetContainerControls(await ThemeService.GetThemesAsync(), PageState.Page.ThemeType);
_containerType = ModuleState.ContainerType;
if (!string.IsNullOrEmpty(PageState.Page.DefaultContainerType) && _containerType == PageState.Page.DefaultContainerType)
{
diff --git a/Oqtane.Client/Modules/Admin/Pages/Add.razor b/Oqtane.Client/Modules/Admin/Pages/Add.razor
index f5fb7a1a..2970d442 100644
--- a/Oqtane.Client/Modules/Admin/Pages/Add.razor
+++ b/Oqtane.Client/Modules/Admin/Pages/Add.razor
@@ -102,21 +102,21 @@
|
- @if (_panelayouts.Count > 0)
+ @if (_layouts.Count > 0)
{
@@ -125,15 +125,15 @@
|
@@ -147,9 +147,9 @@
|
|
@@ -202,10 +202,10 @@
Cancel
@code {
- private Dictionary _themes = new Dictionary();
- private Dictionary _panelayouts = new Dictionary();
- private Dictionary _containers = new Dictionary();
private List _themeList;
+ private List _themes = new List();
+ private List _layouts = new List();
+ private List _containers = new List();
private List _pageList;
private string _name;
private string _title;
@@ -235,7 +235,7 @@
_pageList = PageState.Pages;
_children = PageState.Pages.Where(item => item.ParentId == null).ToList();
- _themes = ThemeService.GetThemeTypes(_themeList);
+ _themes = ThemeService.GetThemeControls(_themeList);
_permissions = string.Empty;
}
catch (Exception ex)
@@ -287,13 +287,13 @@
_themetype = (string)e.Value;
if (_themetype != "-")
{
- _panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype);
- _containers = ThemeService.GetContainerTypes(_themeList, _themetype);
+ _layouts = ThemeService.GetLayoutControls(_themeList, _themetype);
+ _containers = ThemeService.GetContainerControls(_themeList, _themetype);
}
else
{
- _panelayouts = new Dictionary();
- _containers = new Dictionary();
+ _layouts = new List();
+ _containers = new List();
}
_layouttype = "-";
_containertype = "-";
@@ -311,7 +311,7 @@
Page page = null;
try
{
- if (_name != string.Empty && !string.IsNullOrEmpty(_themetype) && (_panelayouts.Count == 0 || !string.IsNullOrEmpty(_layouttype)))
+ if (_name != string.Empty && !string.IsNullOrEmpty(_themetype) && (_layouts.Count == 0 || !string.IsNullOrEmpty(_layouttype)))
{
page = new Page();
page.SiteId = PageState.Page.SiteId;
diff --git a/Oqtane.Client/Modules/Admin/Pages/Edit.razor b/Oqtane.Client/Modules/Admin/Pages/Edit.razor
index 4c399950..305420d5 100644
--- a/Oqtane.Client/Modules/Admin/Pages/Edit.razor
+++ b/Oqtane.Client/Modules/Admin/Pages/Edit.razor
@@ -113,21 +113,21 @@
|
- @if (_panelayouts.Count > 0)
+ @if (_layouts.Count > 0)
{
@@ -136,15 +136,15 @@
|
@@ -158,9 +158,9 @@
|
|
@@ -215,10 +215,10 @@
Cancel
@code {
- private Dictionary _themes = new Dictionary();
- private Dictionary _panelayouts = new Dictionary();
- private Dictionary _containers = new Dictionary();
private List _themeList;
+ private List _themes = new List();
+ private List _layouts = new List();
+ private List _containers = new List();
private List _pageList;
private int _pageId;
private string _name;
@@ -255,11 +255,11 @@
{
try
{
- _themeList = await ThemeService.GetThemesAsync();
_pageList = PageState.Pages;
_children = PageState.Pages.Where(item => item.ParentId == null).ToList();
- _themes = ThemeService.GetThemeTypes(_themeList);
+ _themeList = await ThemeService.GetThemesAsync();
+ _themes = ThemeService.GetThemeControls(_themeList);
_pageId = Int32.Parse(PageState.QueryString["id"]);
var page = PageState.Pages.FirstOrDefault(item => item.PageId == _pageId);
@@ -293,13 +293,13 @@
{
_themetype = "-";
}
- _panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, page.ThemeType);
+ _layouts = ThemeService.GetLayoutControls(_themeList, page.ThemeType);
_layouttype = page.LayoutType;
if (_layouttype == PageState.Site.DefaultLayoutType)
{
_layouttype = "-";
}
- _containers = ThemeService.GetContainerTypes(_themeList, page.ThemeType);
+ _containers = ThemeService.GetContainerControls(_themeList, page.ThemeType);
_containertype = page.DefaultContainerType;
if (string.IsNullOrEmpty(_containertype))
{
@@ -372,13 +372,13 @@
_themetype = (string)e.Value;
if (_themetype != "-")
{
- _panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype);
- _containers = ThemeService.GetContainerTypes(_themeList, _themetype);
+ _layouts = ThemeService.GetLayoutControls(_themeList, _themetype);
+ _containers = ThemeService.GetContainerControls(_themeList, _themetype);
}
else
{
- _panelayouts = new Dictionary();
- _containers = new Dictionary();
+ _layouts = new List();
+ _containers = new List();
}
_layouttype = "-";
_containertype = "-";
diff --git a/Oqtane.Client/Modules/Admin/Site/Index.razor b/Oqtane.Client/Modules/Admin/Site/Index.razor
index 1d5ae583..9d4e4611 100644
--- a/Oqtane.Client/Modules/Admin/Site/Index.razor
+++ b/Oqtane.Client/Modules/Admin/Site/Index.razor
@@ -57,21 +57,21 @@
|
- @if (_panelayouts.Count > 0)
+ @if (_layouts.Count > 0)
{
@@ -80,9 +80,9 @@
|
|
@@ -95,9 +95,9 @@
|
@@ -211,10 +211,10 @@
}
@code {
- private Dictionary _themes = new Dictionary();
- private Dictionary _panelayouts = new Dictionary();
- private Dictionary _containers = new Dictionary();
private List _themeList;
+ private List _themes = new List();
+ private List _layouts = new List();
+ private List _containers = new List();
private string _name = string.Empty;
private List _tenantList;
private string _tenant = string.Empty;
@@ -274,10 +274,11 @@
_faviconfileid = site.FaviconFileId.Value;
}
+ _themes = ThemeService.GetThemeControls(_themeList);
_themetype = site.DefaultThemeType;
- _panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype);
+ _layouts = ThemeService.GetLayoutControls(_themeList, _themetype);
_layouttype = site.DefaultLayoutType;
- _containers = ThemeService.GetContainerTypes(_themeList, _themetype);
+ _containers = ThemeService.GetContainerControls(_themeList, _themetype);
_containertype = site.DefaultContainerType;
_allowregistration = site.AllowRegistration.ToString();
@@ -318,9 +319,6 @@
_deletedon = site.DeletedOn;
_isdeleted = site.IsDeleted.ToString();
}
-
- _themes = ThemeService.GetThemeTypes(_themeList);
- _containers = ThemeService.GetContainerTypes(_themeList, _themetype);
}
catch (Exception ex)
{
@@ -336,13 +334,13 @@
_themetype = (string)e.Value;
if (_themetype != "-")
{
- _panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype);
- _containers = ThemeService.GetContainerTypes(_themeList, _themetype);
+ _layouts = ThemeService.GetLayoutControls(_themeList, _themetype);
+ _containers = ThemeService.GetContainerControls(_themeList, _themetype);
}
else
{
- _panelayouts = new Dictionary();
- _containers = new Dictionary();
+ _layouts = new List();
+ _containers = new List();
}
_layouttype = "-";
_containertype = "-";
@@ -359,7 +357,7 @@
{
try
{
- if (_name != string.Empty && _urls != string.Empty && _themetype != "-" && (_panelayouts.Count == 0 || _layouttype != "-") && _containertype != "-")
+ if (_name != string.Empty && _urls != string.Empty && _themetype != "-" && (_layouts.Count == 0 || _layouttype != "-") && _containertype != "-")
{
var unique = true;
foreach (string name in _urls.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
diff --git a/Oqtane.Client/Modules/Admin/Sites/Add.razor b/Oqtane.Client/Modules/Admin/Sites/Add.razor
index 85f2e962..b2b9414d 100644
--- a/Oqtane.Client/Modules/Admin/Sites/Add.razor
+++ b/Oqtane.Client/Modules/Admin/Sites/Add.razor
@@ -39,14 +39,14 @@ else
|
- @if (_panelayouts.Count > 0)
+ @if (_layouts.Count > 0)
{
@@ -55,9 +55,9 @@ else
|
|
@@ -70,9 +70,9 @@ else
|
@@ -201,11 +201,11 @@ else
}
@code {
- private Dictionary _themes = new Dictionary();
- private Dictionary _panelayouts = new Dictionary();
- private Dictionary _containers = new Dictionary();
- private List _siteTemplates;
private List _themeList;
+ private List _themes = new List();
+ private List _layouts = new List();
+ private List _containers = new List();
+ private List _siteTemplates;
private List _tenants;
private string _tenantid = "-";
@@ -230,10 +230,10 @@ else
protected override async Task OnInitializedAsync()
{
- _themeList = await ThemeService.GetThemesAsync();
_tenants = await TenantService.GetTenantsAsync();
_urls = PageState.Alias.Name;
- _themes = ThemeService.GetThemeTypes(_themeList);
+ _themeList = await ThemeService.GetThemesAsync();
+ _themes = ThemeService.GetThemeControls(_themeList);
_siteTemplates = await SiteTemplateService.GetSiteTemplatesAsync();
}
@@ -267,13 +267,13 @@ else
_themetype = (string)e.Value;
if (_themetype != "-")
{
- _panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype);
- _containers = ThemeService.GetContainerTypes(_themeList, _themetype);
+ _layouts = ThemeService.GetLayoutControls(_themeList, _themetype);
+ _containers = ThemeService.GetContainerControls(_themeList, _themetype);
}
else
{
- _panelayouts = new Dictionary();
- _containers = new Dictionary();
+ _layouts = new List();
+ _containers = new List();
}
_layouttype = "-";
_containertype = "-";
@@ -288,7 +288,7 @@ else
private async Task SaveSite()
{
- if (_tenantid != "-" && _name != string.Empty && _urls != string.Empty && _themetype != "-" && (_panelayouts.Count == 0 || _layouttype != "-") && _containertype != "-" && _sitetemplatetype != "-")
+ if (_tenantid != "-" && _name != string.Empty && _urls != string.Empty && _themetype != "-" && (_layouts.Count == 0 || _layouttype != "-") && _containertype != "-" && _sitetemplatetype != "-")
{
var duplicates = new List();
var aliases = await AliasService.GetAliasesAsync();
diff --git a/Oqtane.Client/Modules/Admin/Sites/Edit.razor b/Oqtane.Client/Modules/Admin/Sites/Edit.razor
index ab5f2112..00e3d9f9 100644
--- a/Oqtane.Client/Modules/Admin/Sites/Edit.razor
+++ b/Oqtane.Client/Modules/Admin/Sites/Edit.razor
@@ -40,21 +40,21 @@
|
- @if (_panelayouts.Count > 0)
+ @if (_layouts.Count > 0)
{
@@ -63,9 +63,9 @@
|
|
@@ -78,9 +78,9 @@
|
@@ -106,11 +106,11 @@
}
@code {
- private Dictionary _themes = new Dictionary();
- private Dictionary _panelayouts = new Dictionary();
- private Dictionary _containers = new Dictionary();
- private Alias _alias;
private List _themeList;
+ private List _themes = new List();
+ private List _layouts = new List();
+ private List _containers = new List();
+ private Alias _alias;
private string _name = string.Empty;
private List _tenantList;
private string _tenant = string.Empty;
@@ -150,11 +150,11 @@
_urls += alias.Name + "\n";
}
- _themes = ThemeService.GetThemeTypes(_themeList);
+ _themes = ThemeService.GetThemeControls(_themeList);
_themetype = site.DefaultThemeType;
- _panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype);
+ _layouts = ThemeService.GetLayoutControls(_themeList, _themetype);
_layouttype = site.DefaultLayoutType;
- _containers = ThemeService.GetContainerTypes(_themeList, _themetype);
+ _containers = ThemeService.GetContainerControls(_themeList, _themetype);
_containertype = site.DefaultContainerType;
_createdby = site.CreatedBy;
_createdon = site.CreatedOn;
@@ -179,13 +179,13 @@
_themetype = (string)e.Value;
if (_themetype != "-")
{
- _panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype);
- _containers = ThemeService.GetContainerTypes(_themeList, _themetype);
+ _layouts = ThemeService.GetLayoutControls(_themeList, _themetype);
+ _containers = ThemeService.GetContainerControls(_themeList, _themetype);
}
else
{
- _panelayouts = new Dictionary();
- _containers = new Dictionary();
+ _layouts = new List();
+ _containers = new List();
}
_layouttype = "-";
_containertype = "-";
@@ -202,7 +202,7 @@
{
try
{
- if (_name != string.Empty && _urls != string.Empty && _themetype != "-" && (_panelayouts.Count == 0 || _layouttype != "-") && _containertype != "-")
+ if (_name != string.Empty && _urls != string.Empty && _themetype != "-" && (_layouts.Count == 0 || _layouttype != "-") && _containertype != "-")
{
var unique = true;
foreach (string name in _urls.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
diff --git a/Oqtane.Client/Services/Interfaces/IThemeService.cs b/Oqtane.Client/Services/Interfaces/IThemeService.cs
index 32bb01ad..b75a2988 100644
--- a/Oqtane.Client/Services/Interfaces/IThemeService.cs
+++ b/Oqtane.Client/Services/Interfaces/IThemeService.cs
@@ -7,9 +7,9 @@ namespace Oqtane.Services
public interface IThemeService
{
Task> GetThemesAsync();
- Dictionary GetThemeTypes(List themes);
- Dictionary GetPaneLayoutTypes(List themes, string themeName);
- Dictionary GetContainerTypes(List themes, string themeName);
+ List GetThemeControls(List themes);
+ List GetLayoutControls(List themes, string themeName);
+ List GetContainerControls(List themes, string themeName);
Task InstallThemesAsync();
Task DeleteThemeAsync(string themeName);
}
diff --git a/Oqtane.Client/Services/ThemeService.cs b/Oqtane.Client/Services/ThemeService.cs
index a2250d95..3e6a3690 100644
--- a/Oqtane.Client/Services/ThemeService.cs
+++ b/Oqtane.Client/Services/ThemeService.cs
@@ -26,49 +26,21 @@ namespace Oqtane.Services
return themes.OrderBy(item => item.Name).ToList();
}
- public Dictionary GetThemeTypes(List themes)
+ public List GetThemeControls(List themes)
{
- var selectableThemes = new Dictionary();
- foreach (Theme theme in themes)
- {
- foreach (string themecontrol in theme.ThemeControls.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
- {
- selectableThemes.Add(themecontrol, theme.Name + " - " + Utilities.GetTypeNameLastSegment(themecontrol, 0));
- }
- }
- return selectableThemes;
+ return themes.SelectMany(item => item.Themes).ToList();
}
- public Dictionary GetPaneLayoutTypes(List themes, string themeName)
+ public List GetLayoutControls(List themes, string themeName)
{
- var selectablePaneLayouts = new Dictionary();
- foreach (Theme theme in themes)
- {
- if (Utilities.GetTypeName(themeName).StartsWith(Utilities.GetTypeName(theme.ThemeName)))
- {
- foreach (string panelayout in theme.PaneLayouts.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
- {
- selectablePaneLayouts.Add(panelayout, theme.Name + " - " + @Utilities.GetTypeNameLastSegment(panelayout, 0));
- }
- }
- }
- return selectablePaneLayouts;
+ return themes.Where(item => Utilities.GetTypeName(themeName).StartsWith(Utilities.GetTypeName(item.ThemeName)))
+ .SelectMany(item => item.Layouts).ToList();
}
- public Dictionary GetContainerTypes(List themes, string themeName)
+ public List GetContainerControls(List themes, string themeName)
{
- var selectableContainers = new Dictionary();
- foreach (Theme theme in themes)
- {
- if (Utilities.GetTypeName(themeName).StartsWith(Utilities.GetTypeName(theme.ThemeName)))
- {
- foreach (string container in theme.ContainerControls.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
- {
- selectableContainers.Add(container, theme.Name + " - " + @Utilities.GetTypeNameLastSegment(container, 0));
- }
- }
- }
- return selectableContainers;
+ return themes.Where(item => Utilities.GetTypeName(themeName).StartsWith(Utilities.GetTypeName(item.ThemeName)))
+ .SelectMany(item => item.Containers).ToList();
}
public async Task InstallThemesAsync()
diff --git a/Oqtane.Client/Themes/ContainerBase.cs b/Oqtane.Client/Themes/ContainerBase.cs
index af4ff355..5b1491ae 100644
--- a/Oqtane.Client/Themes/ContainerBase.cs
+++ b/Oqtane.Client/Themes/ContainerBase.cs
@@ -17,6 +17,8 @@ namespace Oqtane.Themes
[CascadingParameter]
protected Module ModuleState { get; set; }
+ public virtual string Name { get; set; }
+ public virtual string Thumbnail { get; set; }
public string ThemePath()
{
diff --git a/Oqtane.Client/Themes/Controls/ControlPanel.razor b/Oqtane.Client/Themes/Controls/ControlPanel.razor
index 8fa031d5..24e8ac48 100644
--- a/Oqtane.Client/Themes/Controls/ControlPanel.razor
+++ b/Oqtane.Client/Themes/Controls/ControlPanel.razor
@@ -161,9 +161,9 @@
@@ -218,7 +218,7 @@
private List _moduleDefinitions;
private List _pages = new List();
private List _modules = new List();
- private Dictionary _containers = new Dictionary();
+ private List _containers = new List();
private string _display = "display: none;";
private string _category = "Common";
@@ -301,7 +301,7 @@
var panes = PageState.Page.Panes;
Pane = panes.Count() == 1 ? panes.SingleOrDefault() : "";
var themes = await ThemeService.GetThemesAsync();
- _containers = ThemeService.GetContainerTypes(themes, PageState.Page.ThemeType);
+ _containers = ThemeService.GetContainerControls(themes, PageState.Page.ThemeType);
ContainerType = PageState.Site.DefaultContainerType;
_allModuleDefinitions = await ModuleDefinitionService.GetModuleDefinitionsAsync(PageState.Site.SiteId);
diff --git a/Oqtane.Client/Themes/IContainerControl.cs b/Oqtane.Client/Themes/IContainerControl.cs
index a76959ff..bfd77a9c 100644
--- a/Oqtane.Client/Themes/IContainerControl.cs
+++ b/Oqtane.Client/Themes/IContainerControl.cs
@@ -2,5 +2,7 @@
{
public interface IContainerControl
{
+ string Name { get; } // friendly name for a container
+ string Thumbnail { get; } // screen shot of a container - assumed to be in the ThemePath() folder
}
}
diff --git a/Oqtane.Client/Themes/ILayoutControl.cs b/Oqtane.Client/Themes/ILayoutControl.cs
index 59123ce4..69f9cfd1 100644
--- a/Oqtane.Client/Themes/ILayoutControl.cs
+++ b/Oqtane.Client/Themes/ILayoutControl.cs
@@ -2,7 +2,9 @@
{
public interface ILayoutControl
{
- string Panes { get; } // identifies all panes in a theme ( delimited by ";" )
+ string Name { get; } // friendly name for a layout
+ string Thumbnail { get; } // screen shot of a layout - assumed to be in the ThemePath() folder
+ string Panes { get; } // identifies all panes in a theme ( delimited by "," or ";" )
}
}
diff --git a/Oqtane.Client/Themes/LayoutBase.cs b/Oqtane.Client/Themes/LayoutBase.cs
index cd8d92e4..f8a83b14 100644
--- a/Oqtane.Client/Themes/LayoutBase.cs
+++ b/Oqtane.Client/Themes/LayoutBase.cs
@@ -8,6 +8,8 @@ namespace Oqtane.Themes
{
[CascadingParameter]
protected PageState PageState { get; set; }
+ public virtual string Name { get; set; }
+ public virtual string Thumbnail { get; set; }
public virtual string Panes { get; set; }
public string LayoutPath()
diff --git a/Oqtane.Client/Themes/OqtaneTheme/Container.razor b/Oqtane.Client/Themes/OqtaneTheme/Container.razor
index b7ea2559..6d0148fa 100644
--- a/Oqtane.Client/Themes/OqtaneTheme/Container.razor
+++ b/Oqtane.Client/Themes/OqtaneTheme/Container.razor
@@ -12,4 +12,8 @@
-
\ No newline at end of file
+
+
+@code {
+ public override string Name => "Standard Header";
+}
\ No newline at end of file
diff --git a/Oqtane.Client/Themes/OqtaneTheme/Default.razor b/Oqtane.Client/Themes/OqtaneTheme/Default.razor
index ae0ce8ec..7d8fa135 100644
--- a/Oqtane.Client/Themes/OqtaneTheme/Default.razor
+++ b/Oqtane.Client/Themes/OqtaneTheme/Default.razor
@@ -17,6 +17,8 @@
@code {
+ public override string Name => "Default";
+
public override string Panes => string.Empty;
public override List Resources => new List()
diff --git a/Oqtane.Client/Themes/OqtaneTheme/MultiPane.razor b/Oqtane.Client/Themes/OqtaneTheme/MultiPane.razor
index 24ba1146..b40d1989 100644
--- a/Oqtane.Client/Themes/OqtaneTheme/MultiPane.razor
+++ b/Oqtane.Client/Themes/OqtaneTheme/MultiPane.razor
@@ -14,5 +14,7 @@
@code {
- public override string Panes => "Top;Left;Content;Right;Bottom";
+ public override string Name => "Multiple Panes";
+
+ public override string Panes => "Top,Left,Content,Right,Bottom";
}
\ No newline at end of file
diff --git a/Oqtane.Client/Themes/OqtaneTheme/NoTitle.razor b/Oqtane.Client/Themes/OqtaneTheme/NoTitle.razor
index 0d48bc64..082bbe5a 100644
--- a/Oqtane.Client/Themes/OqtaneTheme/NoTitle.razor
+++ b/Oqtane.Client/Themes/OqtaneTheme/NoTitle.razor
@@ -6,4 +6,8 @@
}
-
\ No newline at end of file
+
+
+@code {
+ public override string Name => "No Header";
+}
\ No newline at end of file
diff --git a/Oqtane.Client/Themes/OqtaneTheme/SinglePane.razor b/Oqtane.Client/Themes/OqtaneTheme/SinglePane.razor
index c89c6318..864209e1 100644
--- a/Oqtane.Client/Themes/OqtaneTheme/SinglePane.razor
+++ b/Oqtane.Client/Themes/OqtaneTheme/SinglePane.razor
@@ -6,5 +6,7 @@
@code {
+ public override string Name => "Single Pane";
+
public override string Panes => "Content";
}
\ No newline at end of file
diff --git a/Oqtane.Client/Themes/ThemeBase.cs b/Oqtane.Client/Themes/ThemeBase.cs
index af05f94a..a2eacbeb 100644
--- a/Oqtane.Client/Themes/ThemeBase.cs
+++ b/Oqtane.Client/Themes/ThemeBase.cs
@@ -17,6 +17,8 @@ namespace Oqtane.Themes
[CascadingParameter]
protected PageState PageState { get; set; }
+ public virtual string Name { get; set; }
+ public virtual string Thumbnail { get; set; }
public virtual string Panes { get; set; }
public virtual List Resources { get; set; }
diff --git a/Oqtane.Client/UI/ContainerBuilder.razor b/Oqtane.Client/UI/ContainerBuilder.razor
index 488b48c4..1273f784 100644
--- a/Oqtane.Client/UI/ContainerBuilder.razor
+++ b/Oqtane.Client/UI/ContainerBuilder.razor
@@ -27,18 +27,13 @@
DynamicComponent = builder =>
{
Type containerType = Type.GetType(container);
- if (containerType != null)
+ if (containerType == null)
{
- builder.OpenComponent(0, containerType);
- builder.CloseComponent();
- }
- else
- {
- // container does not exist with type specified
- builder.OpenComponent(0, Type.GetType(Constants.ModuleMessageComponent));
- builder.AddAttribute(1, "Message", "Error Loading Module Container " + container);
- builder.CloseComponent();
+ // fallback
+ containerType = Type.GetType(Constants.DefaultContainer);
}
+ builder.OpenComponent(0, containerType);
+ builder.CloseComponent();
};
}
}
diff --git a/Oqtane.Client/UI/PaneLayout.razor b/Oqtane.Client/UI/PaneLayout.razor
index 2226c8c0..95e7a776 100644
--- a/Oqtane.Client/UI/PaneLayout.razor
+++ b/Oqtane.Client/UI/PaneLayout.razor
@@ -13,15 +13,13 @@
DynamicComponent = builder =>
{
var layoutType = Type.GetType(PageState.Page.LayoutType);
- if (layoutType != null)
+ if (layoutType == null)
{
- builder.OpenComponent(0, layoutType);
- builder.CloseComponent();
- }
- else
- {
- // layout does not exist with type specified
+ // fallback
+ layoutType = Type.GetType(Constants.DefaultLayout);
}
+ builder.OpenComponent(0, layoutType);
+ builder.CloseComponent();
};
}
}
\ No newline at end of file
diff --git a/Oqtane.Client/UI/ThemeBuilder.razor b/Oqtane.Client/UI/ThemeBuilder.razor
index 8857bad9..30052342 100644
--- a/Oqtane.Client/UI/ThemeBuilder.razor
+++ b/Oqtane.Client/UI/ThemeBuilder.razor
@@ -66,18 +66,13 @@
DynamicComponent = builder =>
{
var themeType = Type.GetType(PageState.Page.ThemeType);
- if (themeType != null)
+ if (themeType == null)
{
- builder.OpenComponent(0, themeType);
- builder.CloseComponent();
- }
- else
- {
- // theme does not exist with type specified
- builder.OpenComponent(0, Type.GetType(Constants.ModuleMessageComponent));
- builder.AddAttribute(1, "Message", "Error Loading Page Theme " + PageState.Page.ThemeType);
- builder.CloseComponent();
+ // fallback
+ themeType = Type.GetType(Constants.DefaultTheme);
}
+ builder.OpenComponent(0, themeType);
+ builder.CloseComponent();
};
}
diff --git a/Oqtane.Server/Repository/ThemeRepository.cs b/Oqtane.Server/Repository/ThemeRepository.cs
index bc14de74..41ceef26 100644
--- a/Oqtane.Server/Repository/ThemeRepository.cs
+++ b/Oqtane.Server/Repository/ThemeRepository.cs
@@ -87,26 +87,41 @@ namespace Oqtane.Repository
}
// set internal properties
theme.ThemeName = qualifiedThemeType;
- theme.ThemeControls = "";
- theme.PaneLayouts = "";
- theme.ContainerControls = "";
+ theme.Themes = new List();
+ theme.Layouts = new List();
+ theme.Containers = new List();
theme.AssemblyName = assembly.FullName.Split(",")[0];
themes.Add(theme);
index = themes.FindIndex(item => item.ThemeName == qualifiedThemeType);
}
theme = themes[index];
- theme.ThemeControls += (themeControlType.FullName + ", " + themeControlType.Assembly.GetName().Name + ";");
+
+ var themecontrolobject = Activator.CreateInstance(themeControlType) as IThemeControl;
+ theme.Themes.Add(
+ new ThemeControl
+ {
+ TypeName = themeControlType.FullName + ", " + themeControlType.Assembly.GetName().Name,
+ Name = theme.Name + " - " + ((string.IsNullOrEmpty(themecontrolobject.Name)) ? Utilities.GetTypeNameLastSegment(themeControlType.FullName, 0) : themecontrolobject.Name),
+ Thumbnail = themecontrolobject.Thumbnail,
+ Panes = themecontrolobject.Panes
+ }
+ );
// layouts
Type[] layouttypes = themeTypes
.Where(item => item.GetInterfaces().Contains(typeof(ILayoutControl))).ToArray();
foreach (Type layouttype in layouttypes)
{
- string panelayout = layouttype.FullName + ", " + themeControlType.Assembly.GetName().Name + ";";
- if (!theme.PaneLayouts.Contains(panelayout))
- {
- theme.PaneLayouts += panelayout;
- }
+ var layoutobject = Activator.CreateInstance(layouttype) as ILayoutControl;
+ theme.Layouts.Add(
+ new ThemeControl
+ {
+ TypeName = layouttype.FullName + ", " + themeControlType.Assembly.GetName().Name,
+ Name = (string.IsNullOrEmpty(layoutobject.Name)) ? Utilities.GetTypeNameLastSegment(layouttype.FullName, 0) : layoutobject.Name,
+ Thumbnail = layoutobject.Thumbnail,
+ Panes = layoutobject.Panes
+ }
+ );
}
// containers
@@ -114,11 +129,16 @@ namespace Oqtane.Repository
.Where(item => item.GetInterfaces().Contains(typeof(IContainerControl))).ToArray();
foreach (Type containertype in containertypes)
{
- string container = containertype.FullName + ", " + themeControlType.Assembly.GetName().Name + ";";
- if (!theme.ContainerControls.Contains(container))
- {
- theme.ContainerControls += container;
- }
+ var containerobject = Activator.CreateInstance(containertype) as IContainerControl;
+ theme.Containers.Add(
+ new ThemeControl
+ {
+ TypeName = containertype.FullName + ", " + themeControlType.Assembly.GetName().Name,
+ Name = (string.IsNullOrEmpty(containerobject.Name)) ? Utilities.GetTypeNameLastSegment(containertype.FullName, 0) : containerobject.Name,
+ Thumbnail = containerobject.Thumbnail,
+ Panes = ""
+ }
+ );
}
themes[index] = theme;
diff --git a/Oqtane.Shared/Interfaces/IThemeControl.cs b/Oqtane.Shared/Interfaces/IThemeControl.cs
index 0f6ad00a..f147afba 100644
--- a/Oqtane.Shared/Interfaces/IThemeControl.cs
+++ b/Oqtane.Shared/Interfaces/IThemeControl.cs
@@ -5,7 +5,9 @@ namespace Oqtane.Themes
{
public interface IThemeControl
{
- string Panes { get; } // identifies all panes in a theme ( delimited by ";" ) - assumed to be a layout if no panes specified
+ string Name { get; } // friendly name for a theme
+ string Thumbnail { get; } // screen shot of a theme - assumed to be in the ThemePath() folder
+ string Panes { get; } // identifies all panes in a theme ( delimited by "," or ";") - assumed to be a layout if no panes specified
List Resources { get; } // identifies all resources in a theme
}
}
diff --git a/Oqtane.Shared/Models/Theme.cs b/Oqtane.Shared/Models/Theme.cs
index d5a29552..ee420dd9 100644
--- a/Oqtane.Shared/Models/Theme.cs
+++ b/Oqtane.Shared/Models/Theme.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
namespace Oqtane.Models
{
@@ -23,9 +24,16 @@ namespace Oqtane.Models
public string Contact { get; set; }
public string License { get; set; }
public string Dependencies { get; set; }
- public string ThemeControls { get; set; }
- public string PaneLayouts { get; set; }
- public string ContainerControls { get; set; }
public string AssemblyName { get; set; }
+ public List Themes { get; set; }
+ public List Layouts { get; set; }
+ public List Containers { get; set; }
+
+ //[Obsolete("This property is obsolete. Use Themes instead.", false)]
+ public string ThemeControls { get; set; }
+ //[Obsolete("This property is obsolete. Use Layouts instead.", false)]
+ public string PaneLayouts { get; set; }
+ //[Obsolete("This property is obsolete. Use Containers instead.", false)]
+ public string ContainerControls { get; set; }
}
}
diff --git a/Oqtane.Shared/Models/ThemeControl.cs b/Oqtane.Shared/Models/ThemeControl.cs
new file mode 100644
index 00000000..d6bb67eb
--- /dev/null
+++ b/Oqtane.Shared/Models/ThemeControl.cs
@@ -0,0 +1,10 @@
+namespace Oqtane.Models
+{
+ public class ThemeControl
+ {
+ public string TypeName { get; set; }
+ public string Name { get; set; }
+ public string Thumbnail { get; set; }
+ public string Panes { get; set; }
+ }
+}