From 81b4cea86ddcd9c34674ae680b4144afffc8864f Mon Sep 17 00:00:00 2001 From: Rene Schwarzer Date: Sun, 7 Jul 2024 14:08:02 +0200 Subject: [PATCH 01/30] start 0.0.8-alpha --- README.md | 27 ++++++++------- .../WebExpress.WebApp.Test.csproj | 4 +-- .../WebExpress.WebApp.csproj | 20 ++++------- .../WebSettingPage/PageWebAppSetting.cs | 33 ++++++++++--------- .../WebSettingPage/PageWebAppSettingLog.cs | 10 +++--- 5 files changed, 46 insertions(+), 48 deletions(-) diff --git a/README.md b/README.md index 52cedf9..e3a9f30 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,40 @@ ![WebExpress](https://raw.githubusercontent.com/ReneSchwarzer/WebExpress/main/assets/banner.png) # WebExpress -WebExpress is a lightweight web server optimized for use in low-performance environments (e.g. Rasperry PI). By providing +`WebExpress` is a lightweight web server optimized for use in low-performance environments (e.g. Rasperry PI). By providing a powerful plugin system and a comprehensive API, web applications can be easily and quickly integrated into a .net -language (e.g. C#). Some advantages of WebExpress are: +language (e.g. C#). Some advantages of `WebExpress` are: - It is easy to use. - It offers a variety of features and tools that can help you build and manage your website. - It is fast and efficient and can help you save time and money. - It is flexible and can be customized to meet your specific requirements. -The WebExpress family includes the following projects: +The `WebExpress` family includes the following projects: -- [WebExpress](https://github.com/ReneSchwarzer/WebExpress#readme) - The web server for WebExpress applications and the documentation. -- [WebExpress.WebCore](https://github.com/ReneSchwarzer/WebExpress.WebCore#readme) - The core for WebExpress applications. -- [WebExpress.WebUI](https://github.com/ReneSchwarzer/WebExpress.WebUI#readme) - Common templates and controls for WebExpress applications. -- [WebExpress.WebIndex](https://github.com/ReneSchwarzer/WebExpress.WebIndex#readme) - Reverse index for WebExpress applications. -- [WebExpress.WebApp](https://github.com/ReneSchwarzer/WebExpress.WebApp#readme) - Business application template for WebExpress applications. +- [WebExpress](https://github.com/ReneSchwarzer/WebExpress#readme) - The web server for `WebExpress` applications and the documentation. +- [WebExpress.WebCore](https://github.com/ReneSchwarzer/WebExpress.WebCore#readme) - The core for `WebExpress` applications. +- [WebExpress.WebUI](https://github.com/ReneSchwarzer/WebExpress.WebUI#readme) - Common templates and controls for `WebExpress` applications. +- [WebExpress.WebIndex](https://github.com/ReneSchwarzer/WebExpress.WebIndex#readme) - Reverse index for `WebExpress` applications. +- [WebExpress.WebApp](https://github.com/ReneSchwarzer/WebExpress.WebApp#readme) - Business application template for `WebExpress` applications. # WebExpress.WebApp -WebExpress.WebApp is part of the WebExpress family. Provides a business application template for WebExpress applications. +`WebExpress.WebApp` is part of the WebExpress family. Provides a business application template for `WebExpress` applications. # Download The current binaries are available for download [here](https://github.com/ReneSchwarzer/WebExpress/releases). # Start -To get started with WebExpress, use the following links and tutorials. +If you're looking to get started with `WebExpress`, we would recommend using the following documentation. It can help you understand the platform. - [installation guide](https://github.com/ReneSchwarzer/WebExpress/blob/main/doc/installation_guide.md) - [development guide](https://github.com/ReneSchwarzer/WebExpress/blob/main/doc/development_guide.md) -## Tutorials +# Learning +The following tutorials illustrate the essential techniques of `WebExpress`. These tutorials are designed to assist you, as a developer, in understanding the various aspects of `WebExpress`. Each tutorial provides a detailed, step-by-step guide that you can work through using an example. If you’re interested in beginning the development of `WebExpress` components, we would recommend you to complete some of these tutorials. + - [HelloWorld](https://github.com/ReneSchwarzer/WebExpress.Tutorial.HelloWorld#readme) +- [WebApp](https://github.com/ReneSchwarzer/WebExpress.Tutorial.WebApp#readme) # Tags -#WebExpress #BusinessApplication \ No newline at end of file +#WebApp #WebExpress #BusinessApplication #DotNet #NETCore \ No newline at end of file diff --git a/src/WebExpress.WebApp.Test/WebExpress.WebApp.Test.csproj b/src/WebExpress.WebApp.Test/WebExpress.WebApp.Test.csproj index c945db7..4198d9a 100644 --- a/src/WebExpress.WebApp.Test/WebExpress.WebApp.Test.csproj +++ b/src/WebExpress.WebApp.Test/WebExpress.WebApp.Test.csproj @@ -9,8 +9,8 @@ - - + + runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/WebExpress.WebApp/WebExpress.WebApp.csproj b/src/WebExpress.WebApp/WebExpress.WebApp.csproj index d7b045d..ab3ec77 100644 --- a/src/WebExpress.WebApp/WebExpress.WebApp.csproj +++ b/src/WebExpress.WebApp/WebExpress.WebApp.csproj @@ -3,8 +3,8 @@ Library WebExpress.WebApp - 0.0.7.0 - 0.0.7.0 + 0.0.8.0 + 0.0.8.0 net8.0 any https://github.com/ReneSchwarzer/WebExpress.WebApp @@ -14,7 +14,7 @@ true True Provide a business application template for the WebExpress web server. - 0.0.7-alpha + 0.0.8-alpha https://github.com/ReneSchwarzer/WebExpress icon.png README.md @@ -58,18 +58,10 @@ - - - - - - - - - - - + + + diff --git a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSetting.cs b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSetting.cs index 3b601bf..a21f344 100644 --- a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSetting.cs +++ b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSetting.cs @@ -1,8 +1,8 @@ using System.Collections.Generic; using System.Linq; +using WebExpress.WebApp.WebPage; using WebExpress.WebCore.WebComponent; using WebExpress.WebCore.WebResource; -using WebExpress.WebApp.WebPage; using WebExpress.WebUI.SettingPage; using WebExpress.WebUI.WebAttribute; using WebExpress.WebUI.WebControl; @@ -130,23 +130,26 @@ private void AddSettingMenu(IEnumerable sectio .Select(x => new { Name = x.Key, Pages = x.Value }) .OrderBy(x => x.Name)) { - control.Items.Add(new ControlNavigationItemHeader() { Text = group.Name }); - - foreach (var page in group.Pages + var pages = group.Pages .Select(x => new { Item = x, ResourceContext = GetResourceContext(x) }) - .Where(x => x.ResourceContext != null)) + .Where(x => x.ResourceContext != null) + .Where(x => !x.Item.Hide && (!x.ResourceContext.Conditions.Any() || x.ResourceContext.Conditions.All(y => y.Fulfillment(context.Request)))); + + if (pages.Any()) + { + control.Items.Add(new ControlNavigationItemHeader() { Text = group.Name }); + } + + foreach (var page in pages) { - if (!page.Item.Hide && (!page.ResourceContext.Conditions.Any() || page.ResourceContext.Conditions.All(x => x.Fulfillment(context.Request)))) + control.Items.Add(new ControlNavigationItemLink() { - control.Items.Add(new ControlNavigationItemLink() - { - Text = page.ResourceContext?.ResourceTitle, - Icon = page.Item.Icon, - Uri = page?.ResourceContext.Uri, - Active = page.Item.Id.Equals(Id, System.StringComparison.OrdinalIgnoreCase) ? TypeActive.Active : TypeActive.None, - NoWrap = true - }); - } + Text = page.ResourceContext?.ResourceTitle, + Icon = page.Item.Icon, + Uri = page?.ResourceContext.Uri, + Active = page.Item.Id.Equals(Id, System.StringComparison.OrdinalIgnoreCase) ? TypeActive.Active : TypeActive.None, + NoWrap = true + }); } } } diff --git a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingLog.cs b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingLog.cs index 7cc111b..24819c8 100644 --- a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingLog.cs +++ b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingLog.cs @@ -1,15 +1,15 @@ using System; using System.IO; using System.Linq; -using WebExpress.WebCore; -using WebExpress.WebCore.Internationalization; -using WebExpress.WebCore.WebAttribute; -using WebExpress.WebCore.WebMessage; -using WebExpress.WebCore.WebScope; using WebExpress.Internationalization; using WebExpress.WebApp.WebControl; using WebExpress.WebApp.WebPage; using WebExpress.WebApp.WebScope; +using WebExpress.WebCore.Internationalization; +using WebExpress.WebCore.WebAttribute; +using WebExpress.WebCore.WebLog; +using WebExpress.WebCore.WebMessage; +using WebExpress.WebCore.WebScope; using WebExpress.WebUI.WebAttribute; using WebExpress.WebUI.WebControl; From 1722f8f947fe94d6135afb1fbff08f1d4c009c21 Mon Sep 17 00:00:00 2001 From: Rene Schwarzer Date: Mon, 8 Jul 2024 22:56:16 +0200 Subject: [PATCH 02/30] quality improvements --- .../WebControl/ControlFormularConfirm.cs | 9 +++--- .../WebControl/ControlModalFormularConfirm.cs | 25 +++++++++++----- .../ControlModalFormularFileUpload.cs | 30 +++++-------------- .../WebSettingPage/PageWebAppSettingLog.cs | 4 +-- 4 files changed, 31 insertions(+), 37 deletions(-) diff --git a/src/WebExpress.WebApp/WebControl/ControlFormularConfirm.cs b/src/WebExpress.WebApp/WebControl/ControlFormularConfirm.cs index 91b1823..51e1915 100644 --- a/src/WebExpress.WebApp/WebControl/ControlFormularConfirm.cs +++ b/src/WebExpress.WebApp/WebControl/ControlFormularConfirm.cs @@ -19,12 +19,12 @@ public class ControlFormularConfirm : ControlForm public PropertyIcon ButtonIcon { get => SubmitButton.Icon; set => SubmitButton.Icon = value; } /// - /// Returns or sets the color. der Schaltfläche + /// Returns or sets the button color. /// public PropertyColorButton ButtonColor { get => SubmitButton.Color; set => SubmitButton.Color = value; } /// - /// Returns or sets the label. der Schaltfläche + /// Returns or sets the button label. /// public string ButtonLabel { get => SubmitButton.Text; set => SubmitButton.Text = value; } @@ -64,6 +64,8 @@ public override void Initialize(RenderContextFormular context) ButtonLabel = context.Page.I18N("webexpress.webapp", "confirm.label"); Content.Text = context.Page.I18N("webexpress.webapp", "confirm.description"); + + Add(Content); } /// @@ -84,9 +86,6 @@ protected override void OnProcess(RenderContextFormular context) /// The control as html. public override IHtmlNode Render(RenderContext context) { - Items.Clear(); - Items.Add(Content); - return base.Render(context); } } diff --git a/src/WebExpress.WebApp/WebControl/ControlModalFormularConfirm.cs b/src/WebExpress.WebApp/WebControl/ControlModalFormularConfirm.cs index 55a0efa..fec351e 100644 --- a/src/WebExpress.WebApp/WebControl/ControlModalFormularConfirm.cs +++ b/src/WebExpress.WebApp/WebControl/ControlModalFormularConfirm.cs @@ -85,6 +85,22 @@ protected virtual void OnConfirm(RenderContextFormular context) /// The context in which the control is rendered. /// The control as html. public override IHtmlNode Render(RenderContext context) + { + var content = Content ?? new ControlFormItemStaticText() + { + Text = context.Page.I18N("webexpress.webapp", "confirm.description") + }; + + return Render(context, content); + } + + /// + /// Convert to html. + /// + /// The context in which the control is rendered. + /// The formular items. + /// The control as html. + public override IHtmlNode Render(RenderContext context, params ControlFormItem[] items) { if (string.IsNullOrWhiteSpace(Header)) { @@ -96,11 +112,6 @@ public override IHtmlNode Render(RenderContext context) ButtonLabel = context.Page.I18N("webexpress.webapp", "confirm.label"); } - if (Content == null) - { - Content = new ControlFormItemStaticText() { Text = context.Page.I18N("webexpress.webapp", "confirm.description") }; - } - if (ButtonColor == null) { ButtonColor = new PropertyColorButton(TypeColorButton.Primary); @@ -110,10 +121,8 @@ public override IHtmlNode Render(RenderContext context) Formular.SubmitButton.Text = ButtonLabel; Formular.SubmitButton.Icon = ButtonIcon; Formular.SubmitButton.Color = ButtonColor; - Formular.Items.Clear(); - Formular.Add(Content); - return base.Render(context); + return base.Render(context, items); } } } diff --git a/src/WebExpress.WebApp/WebControl/ControlModalFormularFileUpload.cs b/src/WebExpress.WebApp/WebControl/ControlModalFormularFileUpload.cs index ac3bd66..1f0b880 100644 --- a/src/WebExpress.WebApp/WebControl/ControlModalFormularFileUpload.cs +++ b/src/WebExpress.WebApp/WebControl/ControlModalFormularFileUpload.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using WebExpress.WebCore.WebHtml; using WebExpress.WebCore.WebMessage; using WebExpress.WebCore.WebPage; @@ -47,34 +48,15 @@ public class ControlModalFormularFileUpload : ControlModalFormular /// public string ButtonLabel { get; set; } - /// - /// Teh prologue. - /// - private ControlFormItem prologue; - /// /// Returns or sets the prologue area. /// - public ControlFormItem Prologue - { - get => prologue; - set { Formular.Items.Remove(prologue); prologue = value; Formular.Items.Insert(0, prologue); } - } - - /// - /// The epilogue. - /// - private ControlFormItem epilogue; - + public ControlFormItem Prologue { get; set; } /// /// Returns or sets the epilogue area. /// - public ControlFormItem Epilogue - { - get => epilogue; - set { Formular.Items.Remove(epilogue); epilogue = value; Formular.Items.Add(epilogue); } - } + public ControlFormItem Epilogue { get; set; } /// /// Returns or sets the redirect uri. @@ -164,7 +146,11 @@ public override IHtmlNode Render(RenderContext context) Formular.SubmitButton.Icon = ButtonIcon; Formular.SubmitButton.Color = ButtonColor; - return base.Render(context); + var list = new[] { Epilogue } + .Concat(Formular.Items) + .Concat([Prologue]); + + return base.Render(context, list); } } } diff --git a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingLog.cs b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingLog.cs index 24819c8..ecf6902 100644 --- a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingLog.cs +++ b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingLog.cs @@ -87,7 +87,7 @@ public override void Process(RenderContextWebApp context) switchOnForm.Confirm += (s, e) => { - context.Host.Log.LogMode = Log.Mode.Override; + context.Host.Log.LogMode = LogMode.Override; context.Host.Log.Info(this.I18N("webexpress.webapp", "setting.logfile.switchon.success")); }; @@ -143,7 +143,7 @@ public override void Process(RenderContextWebApp context) Text = context.Host.Log.LogMode.ToString(), Format = TypeFormatText.Code }, - context.Host.Log.LogMode == Log.Mode.Off ? new ControlButton() + context.Host.Log.LogMode == LogMode.Off ? new ControlButton() { Text = this.I18N("webexpress.webapp", "setting.logfile.switchon.label"), Modal = new PropertyModal(TypeModal.Modal, switchOnForm), From 3439745a14f1c5059d06f1924bdff663ab57961b Mon Sep 17 00:00:00 2001 From: Rene Schwarzer Date: Tue, 9 Jul 2024 21:26:32 +0200 Subject: [PATCH 03/30] bug fixing --- .../WebControl/ControlModalFormularConfirm.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/WebExpress.WebApp/WebControl/ControlModalFormularConfirm.cs b/src/WebExpress.WebApp/WebControl/ControlModalFormularConfirm.cs index fec351e..7641836 100644 --- a/src/WebExpress.WebApp/WebControl/ControlModalFormularConfirm.cs +++ b/src/WebExpress.WebApp/WebControl/ControlModalFormularConfirm.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using WebExpress.WebCore.Internationalization; using WebExpress.WebCore.WebHtml; using WebExpress.WebCore.WebPage; @@ -91,7 +92,7 @@ public override IHtmlNode Render(RenderContext context) Text = context.Page.I18N("webexpress.webapp", "confirm.description") }; - return Render(context, content); + return Render(context, [content]); } /// @@ -100,7 +101,7 @@ public override IHtmlNode Render(RenderContext context) /// The context in which the control is rendered. /// The formular items. /// The control as html. - public override IHtmlNode Render(RenderContext context, params ControlFormItem[] items) + public override IHtmlNode Render(RenderContext context, IEnumerable items) { if (string.IsNullOrWhiteSpace(Header)) { @@ -112,10 +113,7 @@ public override IHtmlNode Render(RenderContext context, params ControlFormItem[] ButtonLabel = context.Page.I18N("webexpress.webapp", "confirm.label"); } - if (ButtonColor == null) - { - ButtonColor = new PropertyColorButton(TypeColorButton.Primary); - } + ButtonColor ??= new PropertyColorButton(TypeColorButton.Primary); Formular.RedirectUri = RedirectUri ?? context.Uri; Formular.SubmitButton.Text = ButtonLabel; From 59c2fbd97f109132b209fa8e936559246c328e5f Mon Sep 17 00:00:00 2001 From: Rene Schwarzer Date: Wed, 10 Jul 2024 21:24:34 +0200 Subject: [PATCH 04/30] quality improvements --- src/WebExpress.WebApp/Module.cs | 16 ++++++++-------- .../WebControl/ControlModalFormularFileUpload.cs | 2 +- .../ControlWebAppHeaderAppNavigator.cs | 4 ++-- .../WebControl/ControlWebAppHeaderAppTitle.cs | 6 +++--- .../WebFragment/FragmentPropertyReboot.cs | 8 ++++---- .../WebFragment/FragmentUserManagementTable.cs | 6 +++--- .../WebSettingPage/PageWebAppSetting.cs | 4 ++-- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/WebExpress.WebApp/Module.cs b/src/WebExpress.WebApp/Module.cs index 282080a..ce85f39 100644 --- a/src/WebExpress.WebApp/Module.cs +++ b/src/WebExpress.WebApp/Module.cs @@ -9,7 +9,7 @@ namespace WebExpress.WebApp [Icon("/assets/img/Logo.png")] [AssetPath("/")] [ContextPath("/modules/wxapp")] - public sealed class Module : IModule + public sealed class Module : WebCore.WebModule.Module { /// /// Constructor @@ -21,26 +21,26 @@ public Module() /// /// Instillation of the module. Here, for example, managed resources can be loaded. /// - /// The context that applies to the execution of the plugin. - public void Initialization(IModuleContext context) + /// The context that applies to the execution of the plugin. + public override void Initialization(IModuleContext moduleContext) { - + base.Initialization(moduleContext); } /// /// Invoked when the module starts working. The call is concurrent. /// - public void Run() + public override void Run() { - + base.Run(); } /// /// Release unmanaged resources that have been reserved during use. /// - public void Dispose() + public override void Dispose() { - + base.Dispose(); } } } diff --git a/src/WebExpress.WebApp/WebControl/ControlModalFormularFileUpload.cs b/src/WebExpress.WebApp/WebControl/ControlModalFormularFileUpload.cs index 1f0b880..9dee944 100644 --- a/src/WebExpress.WebApp/WebControl/ControlModalFormularFileUpload.cs +++ b/src/WebExpress.WebApp/WebControl/ControlModalFormularFileUpload.cs @@ -150,7 +150,7 @@ public override IHtmlNode Render(RenderContext context) .Concat(Formular.Items) .Concat([Prologue]); - return base.Render(context, list); + return base.Render(context, list.Where(x => x != null)); } } } diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigator.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigator.cs index ee607d9..2caf1b1 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigator.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigator.cs @@ -52,11 +52,11 @@ private void Init() /// The control as html. public override IHtmlNode Render(RenderContext context) { - var application = ComponentManager.ApplicationManager.GetApplcation(context.Page.ApplicationContext?.ApplicationId); + var application = ComponentManager.ApplicationManager.GetApplcation(context.Page?.ResourceContext.ApplicationContext?.ApplicationId); var hamburger = new List { - new ControlDropdownItemHeader() { Text = context.I18N(context.Page.ApplicationContext, context.Page.ApplicationContext?.ApplicationName) } + new ControlDropdownItemHeader() { Text = context.I18N(context.Page?.ResourceContext.ApplicationContext, context.Page?.ResourceContext.ApplicationContext?.ApplicationName) } }; hamburger.AddRange(Primary); diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppTitle.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppTitle.cs index 0afba02..41579ba 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppTitle.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppTitle.cs @@ -1,7 +1,7 @@ -using WebExpress.WebCore.Internationalization; +using WebExpress.WebApp.WebPage; +using WebExpress.WebCore.Internationalization; using WebExpress.WebCore.WebHtml; using WebExpress.WebCore.WebPage; -using WebExpress.WebApp.WebPage; using WebExpress.WebUI.WebControl; namespace WebExpress.WebApp.WebControl @@ -48,7 +48,7 @@ public override IHtmlNode Render(RenderContext context) return new HtmlElementTextSemanticsA(apptitle.Render(context)) { Id = Id, - Href = context?.Page?.ApplicationContext?.ContextPath?.ToString(), + Href = context?.Page?.ResourceContext.ApplicationContext?.ContextPath?.ToString(), Class = Css.Concatenate("", GetClasses()), Style = Style.Concatenate("", GetStyles()), Role = Role diff --git a/src/WebExpress.WebApp/WebFragment/FragmentPropertyReboot.cs b/src/WebExpress.WebApp/WebFragment/FragmentPropertyReboot.cs index e01c50c..a03b9f4 100644 --- a/src/WebExpress.WebApp/WebFragment/FragmentPropertyReboot.cs +++ b/src/WebExpress.WebApp/WebFragment/FragmentPropertyReboot.cs @@ -1,12 +1,12 @@ using System; using System.Diagnostics; using System.Threading.Tasks; -using WebExpress.WebCore.WebAttribute; -using WebExpress.WebCore.WebHtml; -using WebExpress.WebCore.WebPage; using WebExpress.WebApp.WebCondition; using WebExpress.WebApp.WebControl; using WebExpress.WebApp.WebSettingPage; +using WebExpress.WebCore.WebAttribute; +using WebExpress.WebCore.WebHtml; +using WebExpress.WebCore.WebPage; using WebExpress.WebUI.WebAttribute; using WebExpress.WebUI.WebControl; using WebExpress.WebUI.WebFragment; @@ -89,7 +89,7 @@ private void OnConfirm(object sender, FormularEventArgs e) } catch (Exception ex) { - e.Context.Log.Exception(ex); + e.Context.ApplicationContext.PluginContext.Host.Log.Exception(ex); } }); } diff --git a/src/WebExpress.WebApp/WebFragment/FragmentUserManagementTable.cs b/src/WebExpress.WebApp/WebFragment/FragmentUserManagementTable.cs index 7d7d008..ff63e37 100644 --- a/src/WebExpress.WebApp/WebFragment/FragmentUserManagementTable.cs +++ b/src/WebExpress.WebApp/WebFragment/FragmentUserManagementTable.cs @@ -1,8 +1,8 @@ -using WebExpress.WebCore.WebAttribute; +using WebExpress.WebApp.WebSettingPage; +using WebExpress.WebCore.WebAttribute; using WebExpress.WebCore.WebComponent; using WebExpress.WebCore.WebHtml; using WebExpress.WebCore.WebPage; -using WebExpress.WebApp.WebSettingPage; using WebExpress.WebUI.WebAttribute; using WebExpress.WebUI.WebControl; using WebExpress.WebUI.WebFragment; @@ -32,7 +32,7 @@ public override void Initialization(IFragmentContext context, IPage page) { base.Initialization(context, page); - var module = ComponentManager.ModuleManager.GetModule(page.ApplicationContext, typeof(Module)); + var module = ComponentManager.ModuleManager.GetModule(page?.ResourceContext.ApplicationContext, typeof(Module)); RestApiUri = module.ContextPath.Append("/api/v1/user"); diff --git a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSetting.cs b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSetting.cs index a21f344..7ac004c 100644 --- a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSetting.cs +++ b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSetting.cs @@ -58,7 +58,7 @@ public override void Process(RenderContextWebApp context) SettingTab.Items.Clear(); var settinPageManager = ComponentManager.GetComponent(); - var searchResult = settinPageManager?.FindPage(ApplicationContext, ModuleContext, Id); + var searchResult = settinPageManager?.FindPage(ApplicationContext, ModuleContext, context.Page?.ResourceContext.ResourceId); if (searchResult != null) { var contexts = settinPageManager.GetContexts(ApplicationContext); @@ -147,7 +147,7 @@ private void AddSettingMenu(IEnumerable sectio Text = page.ResourceContext?.ResourceTitle, Icon = page.Item.Icon, Uri = page?.ResourceContext.Uri, - Active = page.Item.Id.Equals(Id, System.StringComparison.OrdinalIgnoreCase) ? TypeActive.Active : TypeActive.None, + Active = page.Item.Id.Equals(ResourceContext.ResourceId, System.StringComparison.OrdinalIgnoreCase) ? TypeActive.Active : TypeActive.None, NoWrap = true }); } From 5c45d9aa82e4f55ef940257587f4fb468dda4ffb Mon Sep 17 00:00:00 2001 From: Rene Schwarzer Date: Thu, 11 Jul 2024 21:57:47 +0200 Subject: [PATCH 05/30] quality improvements --- src/WebExpress.WebApp/Plugin.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/WebExpress.WebApp/Plugin.cs b/src/WebExpress.WebApp/Plugin.cs index fca2ddf..70e585a 100644 --- a/src/WebExpress.WebApp/Plugin.cs +++ b/src/WebExpress.WebApp/Plugin.cs @@ -1,12 +1,12 @@ using System.Collections.Generic; +using WebExpress.WebApp.WebJob; +using WebExpress.WebApp.WebScope; using WebExpress.WebCore.WebAttribute; using WebExpress.WebCore.WebComponent; using WebExpress.WebCore.WebJob; using WebExpress.WebCore.WebPage; using WebExpress.WebCore.WebPlugin; using WebExpress.WebCore.WebResource; -using WebExpress.WebApp.WebJob; -using WebExpress.WebApp.WebScope; using WebExpress.WebUI.WebSettingPage; [assembly: SystemPlugin()] @@ -17,7 +17,7 @@ namespace WebExpress.WebApp [Description("plugin.description")] [Icon("/assets/img/Logo.png")] [Dependency("webexpress.webui")] - public sealed class Plugin : IPlugin + public sealed class Plugin : WebCore.WebPlugin.Plugin { /// /// Constructor @@ -31,23 +31,28 @@ public Plugin() /// Initialization of the plugin. Here, for example, managed resources can be loaded. /// /// The context of the plugin that applies to the execution of the plugin. - public void Initialization(IPluginContext context) + public override void Initialization(IPluginContext context) { + base.Initialization(context); + ComponentManager.JobManager.Register(context, new Cron(context.Host, "30", "0", "1", "*", "*")); } /// /// Called when the plugin starts working. Run is called concurrently. /// - public void Run() + public override void Run() { + base.Run(); } /// /// Release of unmanaged resources reserved during use. /// - public void Dispose() + public override void Dispose() { + base.Dispose(); + ComponentManager.ResourceManager.AddResource -= AddResource; } From 673a6e0caaf921920777923fb5398263a84f66fb Mon Sep 17 00:00:00 2001 From: Rene Schwarzer Date: Sun, 11 Aug 2024 21:34:18 +0200 Subject: [PATCH 06/30] form refactoring --- src/WebExpress.WebApp/Model/WebItem.cs | 2 +- src/WebExpress.WebApp/Module.cs | 2 +- src/WebExpress.WebApp/Plugin.cs | 2 +- .../WebApi/V1/RestPopupNotification.cs | 2 +- .../WebApi/V1/RestTaskStatus.cs | 2 +- .../WebApi/V1/RestUserManagement.cs | 2 +- ...cs => ControlApiFormItemInputSelection.cs} | 8 +- .../ControlApiModalProgressTaskState.cs | 2 +- .../ControlApiNotificationPopup.cs | 2 +- .../ControlApiProgressBarTaskState.cs | 2 +- .../WebApiControl/ControlApiTable.cs | 2 +- .../WebApiControl/ControlApiTableOption.cs | 2 +- .../ControlApiTableOptionItem.cs | 4 +- ...rmularConfirm.cs => ControlFormConfirm.cs} | 40 +++-- ...mDelete.cs => ControlFormConfirmDelete.cs} | 20 +-- ...rConfirm.cs => ControlModalFormConfirm.cs} | 59 ++++--- ...te.cs => ControlModalFormConfirmDelete.cs} | 24 +-- ...pload.cs => ControlModalFormFileUpload.cs} | 61 +++---- ...oupEdit.cs => ControlModalFormGoupEdit.cs} | 16 +- ...rGoupNew.cs => ControlModalFormGoupNew.cs} | 12 +- ...lete.cs => ControlModalFormGroupDelete.cs} | 10 +- ...elete.cs => ControlModalFormUserDelete.cs} | 12 +- ...serEdit.cs => ControlModalFormUserEdit.cs} | 40 ++--- ...rUserNew.cs => ControlModalFormUserNew.cs} | 36 ++-- .../WebControl/ControlWebAppContent.cs | 2 +- .../WebControl/ControlWebAppFooter.cs | 2 +- .../WebControl/ControlWebAppHeader.cs | 2 +- .../ControlWebAppHeaderAppNavigation.cs | 2 +- .../ControlWebAppHeaderAppNavigator.cs | 2 +- .../WebControl/ControlWebAppHeaderAppTitle.cs | 2 +- .../WebControl/ControlWebAppHeaderHelp.cs | 2 +- .../ControlWebAppHeaderQuickCreate.cs | 2 +- .../WebControl/ControlWebAppHeaderSettings.cs | 2 +- .../WebControl/ControlWebAppHeadline.cs | 2 +- .../WebControl/ControlWebAppProperty.cs | 2 +- .../WebControl/ControlWebAppSidebar.cs | 2 +- ...oadEventArgs.cs => FormUploadEventArgs.cs} | 6 +- .../FragmentControlModalFormConfirmDelete.cs | 8 +- .../WebFragment/FragmentCrudTable.cs | 2 +- .../FragmentCrudTableEditorItem.cs | 2 +- .../FragmentCrudTableEditorLinkItem.cs | 2 +- .../FragmentCrudTableEditorSeperatorItem.cs | 2 +- ...FragmentHeaderSettingsSystemInformation.cs | 2 +- .../WebFragment/FragmentPropertyReboot.cs | 15 +- .../FragmentUserManagementAddGroup.cs | 13 +- .../FragmentUserManagementAddUser.cs | 13 +- .../FragmentUserManagementDescription.cs | 9 +- .../FragmentUserManagementTable.cs | 7 +- .../WebIndex/IndexManager.cs | 2 +- .../WebNotificaation/Notification.cs | 2 +- .../WebNotificaation/NotificationManager.cs | 2 +- src/WebExpress.WebApp/WebPage/LayoutSchema.cs | 4 +- src/WebExpress.WebApp/WebPage/PageWebApp.cs | 154 +++++++++--------- ...ageWebAppFormular.cs => PageWebAppForm.cs} | 26 +-- ...larConfirm.cs => PageWebAppFormConfirm.cs} | 18 +- .../WebPage/RenderContextWebApp.cs | 4 +- .../WebPage/VisualTreeWebApp.cs | 2 +- src/WebExpress.WebApp/WebResource/Asset.cs | 2 +- .../WebResource/ResourceRestCrudColumn.cs | 2 +- .../SectionWebApp.cs} | 76 ++++----- ...ngFormular.cs => PageWebAppSettingForm.cs} | 28 ++-- ...irm.cs => PageWebAppSettingFormConfirm.cs} | 18 +- .../WebSettingPage/PageWebAppSettingLog.cs | 28 ++-- .../PageWebAppSettingLogDownload.cs | 2 +- .../WebSettingPage/PageWebAppSettingPlugin.cs | 10 +- .../PageWebAppSettingSystemInformation.cs | 2 +- .../PageWebAppSettingUserManagementGroup.cs | 6 +- .../PageWebAppSettingUserManagementUser.cs | 2 +- .../WebStatusPage/PageStatusWebApp.cs | 2 +- .../PageStatusWebAppBadRequest.cs | 2 +- .../PageStatusWebAppInternalServerError.cs | 2 +- .../WebStatusPage/PageStatusWebAppNotFound.cs | 2 +- 72 files changed, 445 insertions(+), 422 deletions(-) rename src/WebExpress.WebApp/WebApiControl/{ControlApiFormularItemInputSelection.cs => ControlApiFormItemInputSelection.cs} (88%) rename src/WebExpress.WebApp/WebControl/{ControlFormularConfirm.cs => ControlFormConfirm.cs} (56%) rename src/WebExpress.WebApp/WebControl/{ControlFormularConfirmDelete.cs => ControlFormConfirmDelete.cs} (63%) rename src/WebExpress.WebApp/WebControl/{ControlModalFormularConfirm.cs => ControlModalFormConfirm.cs} (58%) rename src/WebExpress.WebApp/WebControl/{ControlModalFormularConfirmDelete.cs => ControlModalFormConfirmDelete.cs} (62%) rename src/WebExpress.WebApp/WebControl/{ControlModalFormularFileUpload.cs => ControlModalFormFileUpload.cs} (66%) rename src/WebExpress.WebApp/WebControl/{ControlModalFormularGoupEdit.cs => ControlModalFormGoupEdit.cs} (85%) rename src/WebExpress.WebApp/WebControl/{ControlModalFormularGoupNew.cs => ControlModalFormGoupNew.cs} (87%) rename src/WebExpress.WebApp/WebControl/{ControlModalFormularGroupDelete.cs => ControlModalFormGroupDelete.cs} (87%) rename src/WebExpress.WebApp/WebControl/{ControlModalFormularUserDelete.cs => ControlModalFormUserDelete.cs} (83%) rename src/WebExpress.WebApp/WebControl/{ControlModalFormularUserEdit.cs => ControlModalFormUserEdit.cs} (84%) rename src/WebExpress.WebApp/WebControl/{ControlModalFormularUserNew.cs => ControlModalFormUserNew.cs} (84%) rename src/WebExpress.WebApp/WebControl/{FormularUploadEventArgs.cs => FormUploadEventArgs.cs} (72%) rename src/WebExpress.WebApp/WebPage/{PageWebAppFormular.cs => PageWebAppForm.cs} (82%) rename src/WebExpress.WebApp/WebPage/{PageWebAppFormularConfirm.cs => PageWebAppFormConfirm.cs} (77%) rename src/WebExpress.WebApp/{WebFragment/Section.cs => WebSection/SectionWebApp.cs} (65%) rename src/WebExpress.WebApp/WebSettingPage/{PageWebAppSettingFormular.cs => PageWebAppSettingForm.cs} (81%) rename src/WebExpress.WebApp/WebSettingPage/{PageWebAppSettingFormularConfirm.cs => PageWebAppSettingFormConfirm.cs} (76%) diff --git a/src/WebExpress.WebApp/Model/WebItem.cs b/src/WebExpress.WebApp/Model/WebItem.cs index 56d1e11..e8b21ad 100644 --- a/src/WebExpress.WebApp/Model/WebItem.cs +++ b/src/WebExpress.WebApp/Model/WebItem.cs @@ -34,7 +34,7 @@ public class WebItem : IIndexItem public virtual string Label { get; set; } /// - /// Constructor + /// Initializes a new instance of the class. /// public WebItem() { diff --git a/src/WebExpress.WebApp/Module.cs b/src/WebExpress.WebApp/Module.cs index ce85f39..1d02193 100644 --- a/src/WebExpress.WebApp/Module.cs +++ b/src/WebExpress.WebApp/Module.cs @@ -12,7 +12,7 @@ namespace WebExpress.WebApp public sealed class Module : WebCore.WebModule.Module { /// - /// Constructor + /// Initializes a new instance of the class. /// public Module() { diff --git a/src/WebExpress.WebApp/Plugin.cs b/src/WebExpress.WebApp/Plugin.cs index 70e585a..2e7f7e0 100644 --- a/src/WebExpress.WebApp/Plugin.cs +++ b/src/WebExpress.WebApp/Plugin.cs @@ -20,7 +20,7 @@ namespace WebExpress.WebApp public sealed class Plugin : WebCore.WebPlugin.Plugin { /// - /// Constructor + /// Initializes a new instance of the class. /// public Plugin() { diff --git a/src/WebExpress.WebApp/WebApi/V1/RestPopupNotification.cs b/src/WebExpress.WebApp/WebApi/V1/RestPopupNotification.cs index fa3f8b8..2eb522b 100644 --- a/src/WebExpress.WebApp/WebApi/V1/RestPopupNotification.cs +++ b/src/WebExpress.WebApp/WebApi/V1/RestPopupNotification.cs @@ -18,7 +18,7 @@ namespace WebExpress.WebApp.WebAPI.V1 public sealed class RestPopupNotification : ResourceRest { /// - /// Constructor + /// Initializes a new instance of the class. /// public RestPopupNotification() { diff --git a/src/WebExpress.WebApp/WebApi/V1/RestTaskStatus.cs b/src/WebExpress.WebApp/WebApi/V1/RestTaskStatus.cs index aa0ed08..f7921a7 100644 --- a/src/WebExpress.WebApp/WebApi/V1/RestTaskStatus.cs +++ b/src/WebExpress.WebApp/WebApi/V1/RestTaskStatus.cs @@ -18,7 +18,7 @@ namespace WebExpress.WebApp.WebAPI.V1 public sealed class RestTaskStatus : ResourceRest { /// - /// Constructor + /// Initializes a new instance of the class. /// public RestTaskStatus() { diff --git a/src/WebExpress.WebApp/WebApi/V1/RestUserManagement.cs b/src/WebExpress.WebApp/WebApi/V1/RestUserManagement.cs index edda088..cf69863 100644 --- a/src/WebExpress.WebApp/WebApi/V1/RestUserManagement.cs +++ b/src/WebExpress.WebApp/WebApi/V1/RestUserManagement.cs @@ -21,7 +21,7 @@ namespace WebExpress.WebAPI.V1 public sealed class RestUserManagement : ResourceRestCrud { /// - /// Constructor + /// Initializes a new instance of the class. /// public RestUserManagement() { diff --git a/src/WebExpress.WebApp/WebApiControl/ControlApiFormularItemInputSelection.cs b/src/WebExpress.WebApp/WebApiControl/ControlApiFormItemInputSelection.cs similarity index 88% rename from src/WebExpress.WebApp/WebApiControl/ControlApiFormularItemInputSelection.cs rename to src/WebExpress.WebApp/WebApiControl/ControlApiFormItemInputSelection.cs index edec937..d4d6a13 100644 --- a/src/WebExpress.WebApp/WebApiControl/ControlApiFormularItemInputSelection.cs +++ b/src/WebExpress.WebApp/WebApiControl/ControlApiFormItemInputSelection.cs @@ -5,7 +5,7 @@ namespace WebExpress.WebApp.WebApiControl; -public class ControlApiFormularItemInputSelection : ControlFormItemInputSelection, IControlApi +public class ControlApiFormItemInputSelection : ControlFormItemInputSelection, IControlApi { /// /// Returns or sets the uri that determines the options. @@ -13,10 +13,10 @@ public class ControlApiFormularItemInputSelection : ControlFormItemInputSelectio public string RestUri { get; set; } /// - /// Constructor + /// Initializes a new instance of the class. /// /// The control id. - public ControlApiFormularItemInputSelection(string id = null) + public ControlApiFormItemInputSelection(string id = null) : base(id) { } @@ -28,7 +28,7 @@ public ControlApiFormularItemInputSelection(string id = null) /// The id of the control. /// The CSS classes that are assigned to the control. /// The javascript code. - protected override string GetScript(RenderContextFormular context, string id, string css) + protected override string GetScript(RenderContextForm context, string id, string css) { var settings = new { diff --git a/src/WebExpress.WebApp/WebApiControl/ControlApiModalProgressTaskState.cs b/src/WebExpress.WebApp/WebApiControl/ControlApiModalProgressTaskState.cs index 75a3243..29b5096 100644 --- a/src/WebExpress.WebApp/WebApiControl/ControlApiModalProgressTaskState.cs +++ b/src/WebExpress.WebApp/WebApiControl/ControlApiModalProgressTaskState.cs @@ -22,7 +22,7 @@ public class ControlApiModalProgressTaskState : ControlModal private ControlText Message { get; set; } /// - /// Constructor + /// Initializes a new instance of the class. /// /// The control id. public ControlApiModalProgressTaskState(string id) diff --git a/src/WebExpress.WebApp/WebApiControl/ControlApiNotificationPopup.cs b/src/WebExpress.WebApp/WebApiControl/ControlApiNotificationPopup.cs index bd8482b..eef1a88 100644 --- a/src/WebExpress.WebApp/WebApiControl/ControlApiNotificationPopup.cs +++ b/src/WebExpress.WebApp/WebApiControl/ControlApiNotificationPopup.cs @@ -14,7 +14,7 @@ namespace WebExpress.WebApp.WebApiControl public class ControlApiNotificationPopup : ControlPanel { /// - /// Constructor + /// Initializes a new instance of the class. /// /// Die Steuerelement-Id public ControlApiNotificationPopup(string id = null) diff --git a/src/WebExpress.WebApp/WebApiControl/ControlApiProgressBarTaskState.cs b/src/WebExpress.WebApp/WebApiControl/ControlApiProgressBarTaskState.cs index 74058b7..00271a4 100644 --- a/src/WebExpress.WebApp/WebApiControl/ControlApiProgressBarTaskState.cs +++ b/src/WebExpress.WebApp/WebApiControl/ControlApiProgressBarTaskState.cs @@ -17,7 +17,7 @@ public class ControlApiProgressBarTaskState : ControlProgressBar public string OnFinishScript { get; set; } /// - /// Constructor + /// Initializes a new instance of the class. /// /// The control id. public ControlApiProgressBarTaskState(string id) diff --git a/src/WebExpress.WebApp/WebApiControl/ControlApiTable.cs b/src/WebExpress.WebApp/WebApiControl/ControlApiTable.cs index 9f612c9..80ddece 100644 --- a/src/WebExpress.WebApp/WebApiControl/ControlApiTable.cs +++ b/src/WebExpress.WebApp/WebApiControl/ControlApiTable.cs @@ -27,7 +27,7 @@ public class ControlApiTable : ControlPanel, IControlApi public ICollection OptionItems { get; private set; } = new List(); /// - /// Constructor + /// Initializes a new instance of the class. /// /// The control id. public ControlApiTable(string id = null) diff --git a/src/WebExpress.WebApp/WebApiControl/ControlApiTableOption.cs b/src/WebExpress.WebApp/WebApiControl/ControlApiTableOption.cs index f8788d9..0eac6ca 100644 --- a/src/WebExpress.WebApp/WebApiControl/ControlApiTableOption.cs +++ b/src/WebExpress.WebApp/WebApiControl/ControlApiTableOption.cs @@ -26,7 +26,7 @@ public class ControlApiTableOption public string Color { get; set; } /// - /// Constructor + /// Initializes a new instance of the class. /// public ControlApiTableOption() { diff --git a/src/WebExpress.WebApp/WebApiControl/ControlApiTableOptionItem.cs b/src/WebExpress.WebApp/WebApiControl/ControlApiTableOptionItem.cs index 6649657..f37bb85 100644 --- a/src/WebExpress.WebApp/WebApiControl/ControlApiTableOptionItem.cs +++ b/src/WebExpress.WebApp/WebApiControl/ControlApiTableOptionItem.cs @@ -65,7 +65,7 @@ public enum OptionType { Item, Header, Divider }; public string OnClick { get; set; } /// - /// Constructor + /// Initializes a new instance of the class. /// public ControlApiTableOptionItem() { @@ -73,7 +73,7 @@ public ControlApiTableOptionItem() } /// - /// Constructor + /// Initializes a new instance of the class. /// /// The label of the column. /// The type of option entry. diff --git a/src/WebExpress.WebApp/WebControl/ControlFormularConfirm.cs b/src/WebExpress.WebApp/WebControl/ControlFormConfirm.cs similarity index 56% rename from src/WebExpress.WebApp/WebControl/ControlFormularConfirm.cs rename to src/WebExpress.WebApp/WebControl/ControlFormConfirm.cs index 51e1915..429c7c1 100644 --- a/src/WebExpress.WebApp/WebControl/ControlFormularConfirm.cs +++ b/src/WebExpress.WebApp/WebControl/ControlFormConfirm.cs @@ -6,27 +6,32 @@ namespace WebExpress.WebApp.WebControl { - public class ControlFormularConfirm : ControlForm + public class ControlFormConfirm : ControlForm { /// /// Event is triggered when deletion is confirmed. /// - public event EventHandler Confirm; + public event EventHandler Confirm; /// - /// Returns or sets the icon. + /// Returns or sets the submit button icon. /// - public PropertyIcon ButtonIcon { get => SubmitButton.Icon; set => SubmitButton.Icon = value; } + public PropertyIcon SubmitButtonIcon { get => SubmitButton.Icon; set => SubmitButton.Icon = value; } /// - /// Returns or sets the button color. + /// Returns or sets the submit button color. /// - public PropertyColorButton ButtonColor { get => SubmitButton.Color; set => SubmitButton.Color = value; } + public PropertyColorButton SubmitButtonColor { get => SubmitButton.Color; set => SubmitButton.Color = value; } /// - /// Returns or sets the button label. + /// Returns or sets the submit button label. /// - public string ButtonLabel { get => SubmitButton.Text; set => SubmitButton.Text = value; } + public string SubmitButtonLabel { get => SubmitButton.Text; set => SubmitButton.Text = value; } + + /// + /// Returns or sets the submit button. + /// + private ControlFormItemButtonSubmit SubmitButton { get; set; } /// /// Returns or sets the content. @@ -36,33 +41,34 @@ public class ControlFormularConfirm : ControlForm }; /// - /// Constructor + /// Initializes a new instance of the class. /// /// The control id. - public ControlFormularConfirm(string id = null) + public ControlFormConfirm(string id = null) : base(id, null) { - ButtonColor = new PropertyColorButton(TypeColorButton.Primary); + SubmitButton = new ControlFormItemButtonSubmit("submit"); + SubmitButtonColor = new PropertyColorButton(TypeColorButton.Primary); } /// /// Triggers the confirm event. /// /// The context in which the control is rendered. - protected virtual void OnConfirm(RenderContextFormular context) + protected virtual void OnConfirm(RenderContextForm context) { - Confirm?.Invoke(this, new FormularEventArgs() { Context = context }); + Confirm?.Invoke(this, new FormEventArgs() { Context = context }); } /// /// Initializes the form. /// /// The context in which the control is rendered. - public override void Initialize(RenderContextFormular context) + public override void Initialize(RenderContextForm context) { base.Initialize(context); - ButtonLabel = context.Page.I18N("webexpress.webapp", "confirm.label"); + SubmitButtonLabel = context.Page.I18N("webexpress.webapp", "confirm.label"); Content.Text = context.Page.I18N("webexpress.webapp", "confirm.description"); Add(Content); @@ -71,8 +77,8 @@ public override void Initialize(RenderContextFormular context) /// /// Triggers the crocess event. /// - /// - protected override void OnProcess(RenderContextFormular context) + /// The render context. + protected override void OnProcess(RenderContextForm context) { base.OnProcess(context); diff --git a/src/WebExpress.WebApp/WebControl/ControlFormularConfirmDelete.cs b/src/WebExpress.WebApp/WebControl/ControlFormConfirmDelete.cs similarity index 63% rename from src/WebExpress.WebApp/WebControl/ControlFormularConfirmDelete.cs rename to src/WebExpress.WebApp/WebControl/ControlFormConfirmDelete.cs index 7b580d2..cac857d 100644 --- a/src/WebExpress.WebApp/WebControl/ControlFormularConfirmDelete.cs +++ b/src/WebExpress.WebApp/WebControl/ControlFormConfirmDelete.cs @@ -5,37 +5,37 @@ namespace WebExpress.WebApp.WebControl { - public class ControlFormularConfirmDelete : ControlFormularConfirm + public class ControlFormConfirmDelete : ControlFormConfirm { /// - /// Constructor + /// Initializes a new instance of the class. /// /// The control id. - public ControlFormularConfirmDelete() + public ControlFormConfirmDelete() : this(null) { } /// - /// Constructor + /// Initializes a new instance of the class. /// /// The control id. - public ControlFormularConfirmDelete(string id = null) + public ControlFormConfirmDelete(string id = null) : base(id) { - ButtonIcon = new PropertyIcon(TypeIcon.TrashAlt); - ButtonColor = new PropertyColorButton(TypeColorButton.Danger); + SubmitButtonIcon = new PropertyIcon(TypeIcon.TrashAlt); + SubmitButtonColor = new PropertyColorButton(TypeColorButton.Danger); } /// /// Initializes the form. /// /// The context in which the control is rendered. - public override void Initialize(RenderContextFormular context) + public override void Initialize(RenderContextForm context) { base.Initialize(context); - ButtonLabel = context.Page.I18N("webexpress.webapp", "delete.label"); + SubmitButtonLabel = context.Page.I18N("webexpress.webapp", "delete.label"); Content.Text = context.Page.I18N("webexpress.webapp", "delete.description"); } @@ -46,7 +46,7 @@ public override void Initialize(RenderContextFormular context) /// The control as html. public override IHtmlNode Render(RenderContext context) { - ButtonLabel = context.Page.I18N("webexpress.webapp", "delete.label"); + SubmitButtonLabel = context.Page.I18N("webexpress.webapp", "delete.label"); return base.Render(context); } diff --git a/src/WebExpress.WebApp/WebControl/ControlModalFormularConfirm.cs b/src/WebExpress.WebApp/WebControl/ControlModalFormConfirm.cs similarity index 58% rename from src/WebExpress.WebApp/WebControl/ControlModalFormularConfirm.cs rename to src/WebExpress.WebApp/WebControl/ControlModalFormConfirm.cs index 7641836..4ffeefc 100644 --- a/src/WebExpress.WebApp/WebControl/ControlModalFormularConfirm.cs +++ b/src/WebExpress.WebApp/WebControl/ControlModalFormConfirm.cs @@ -7,54 +7,62 @@ namespace WebExpress.WebApp.WebControl { - public class ControlModalFormularConfirm : ControlModalFormular + /// + /// Represents a modal confirmation form. + /// + public class ControlModalFormConfirm : ControlModalForm { /// /// Event is triggered when deletion is confirmed. /// - public event EventHandler Confirm; + public event EventHandler Confirm; /// - /// Returns or sets the icon. + /// Returns or sets the submit button icon. /// - public PropertyIcon ButtonIcon { get; set; } + public PropertyIcon SubmitButtonIcon { get { return SubmitButton?.Icon; } set { SubmitButton.Icon = value; } } /// - /// Returns or sets the color. der Schaltfläche + /// Returns or sets the submit button color. /// - public PropertyColorButton ButtonColor { get; set; } + public PropertyColorButton SubmitButtonColor { get { return SubmitButton?.Color; } set { SubmitButton.Color = value; } } /// - /// Returns or sets the label. der Schaltfläche + /// Returns or sets the submit button label. /// - public string ButtonLabel { get; set; } + public string SubmitButtonLabel { get; set; } /// /// Returns or sets the content. /// public new ControlFormItem Content { get; set; } + /// + /// Returns or sets the submit button. + /// + private ControlFormItemButtonSubmit SubmitButton { get; set; } + /// /// Returns or sets the redirect uri. /// - public string RedirectUri { get { return Formular?.RedirectUri; } set { Formular.RedirectUri = value; } } + public string RedirectUri { get { return Form?.RedirectUri; } set { Form.RedirectUri = value; } } /// - /// Constructor + /// Initializes a new instance of the class. /// /// The id. - public ControlModalFormularConfirm(string id = null) + public ControlModalFormConfirm(string id = null) : this(id, null) { } /// - /// Constructor + /// Initializes a new instance of the class. /// /// The id. - /// Die Formularsteuerelemente - public ControlModalFormularConfirm(string id, params ControlFormItem[] content) + /// The form controls. + public ControlModalFormConfirm(string id, params ControlFormItem[] content) : base(id, string.Empty, content) { Init(); @@ -65,19 +73,23 @@ public ControlModalFormularConfirm(string id, params ControlFormItem[] content) /// private void Init() { - Formular.ProcessFormular += (s, e) => + SubmitButton = new ControlFormItemButtonSubmit("submit"); + + Form.ProcessForm += (s, e) => { OnConfirm(e.Context); }; + + Form.AddPrimaryButton(SubmitButton); } /// /// Triggers the Confirm event. /// /// The context in which the control is rendered. - protected virtual void OnConfirm(RenderContextFormular context) + protected virtual void OnConfirm(RenderContextForm context) { - Confirm?.Invoke(this, new FormularEventArgs() { Context = context }); + Confirm?.Invoke(this, new FormEventArgs() { Context = context }); } /// @@ -99,7 +111,7 @@ public override IHtmlNode Render(RenderContext context) /// Convert to html. /// /// The context in which the control is rendered. - /// The formular items. + /// The form items. /// The control as html. public override IHtmlNode Render(RenderContext context, IEnumerable items) { @@ -108,17 +120,12 @@ public override IHtmlNode Render(RenderContext context, IEnumerable - /// Constructor + /// Initializes a new instance of the class. /// /// The control id. - public ControlModalFormularConfirmDelete(string id = null) + public ControlModalFormConfirmDelete(string id = null) : this(id, null) { } /// - /// Constructor + /// Initializes a new instance of the class. /// /// The control id. - /// Die Formularsteuerelemente - public ControlModalFormularConfirmDelete(string id, params ControlFormItem[] content) + /// The form controls. + public ControlModalFormConfirmDelete(string id, params ControlFormItem[] content) : base(id, content) { } @@ -39,9 +39,9 @@ public override IHtmlNode Render(RenderContext context) Header = context.Page.I18N("webexpress.webapp", "delete.header"); } - if (string.IsNullOrWhiteSpace(ButtonLabel)) + if (string.IsNullOrWhiteSpace(SubmitButtonLabel)) { - ButtonLabel = context.Page.I18N("webexpress.webapp", "delete.label"); + SubmitButtonLabel = context.Page.I18N("webexpress.webapp", "delete.label"); } if (Content == null) @@ -49,14 +49,14 @@ public override IHtmlNode Render(RenderContext context) Content = new ControlFormItemStaticText() { Text = context.Page.I18N("webexpress.webapp", "delete.description") }; } - if (ButtonIcon == null) + if (SubmitButtonIcon == null) { - ButtonIcon = new PropertyIcon(TypeIcon.TrashAlt); + SubmitButtonIcon = new PropertyIcon(TypeIcon.TrashAlt); } - if (ButtonColor == null) + if (SubmitButtonColor == null) { - ButtonColor = new PropertyColorButton(TypeColorButton.Danger); + SubmitButtonColor = new PropertyColorButton(TypeColorButton.Danger); } return base.Render(context); diff --git a/src/WebExpress.WebApp/WebControl/ControlModalFormularFileUpload.cs b/src/WebExpress.WebApp/WebControl/ControlModalFormFileUpload.cs similarity index 66% rename from src/WebExpress.WebApp/WebControl/ControlModalFormularFileUpload.cs rename to src/WebExpress.WebApp/WebControl/ControlModalFormFileUpload.cs index 9dee944..294a12c 100644 --- a/src/WebExpress.WebApp/WebControl/ControlModalFormularFileUpload.cs +++ b/src/WebExpress.WebApp/WebControl/ControlModalFormFileUpload.cs @@ -9,7 +9,7 @@ namespace WebExpress.WebApp.WebControl { - public class ControlModalFormularFileUpload : ControlModalFormular + public class ControlModalFormFileUpload : ControlModalForm { /// /// Returns or sets the files that are accepted. @@ -19,7 +19,7 @@ public class ControlModalFormularFileUpload : ControlModalFormular /// /// Event is triggered when the upload is confirmed. /// - public event EventHandler Upload; + public event EventHandler Upload; /// /// Returns or sets the document. @@ -34,19 +34,19 @@ public class ControlModalFormularFileUpload : ControlModalFormular }; /// - /// Returns or sets the icon. + /// Returns or sets the submit button icon. /// - public PropertyIcon ButtonIcon { get; set; } + public PropertyIcon SubmitButtonIcon { get { return SubmitButton?.Icon; } set { SubmitButton.Icon = value; } } /// - /// Returns or sets the button color. + /// Returns or sets the submit button color. /// - public PropertyColorButton ButtonColor { get; set; } + public PropertyColorButton SubmitButtonColor { get { return SubmitButton?.Color; } set { SubmitButton.Color = value; } } /// - /// Returns or sets the button label. + /// Returns or sets the submit button label. /// - public string ButtonLabel { get; set; } + public string SubmitButtonLabel { get { return SubmitButton?.Text; } set { SubmitButton.Text = value; } } /// /// Returns or sets the prologue area. @@ -61,23 +61,28 @@ public class ControlModalFormularFileUpload : ControlModalFormular /// /// Returns or sets the redirect uri. /// - public string RedirectUri { get { return Formular?.RedirectUri; } set { Formular.RedirectUri = value; } } + public string RedirectUri { get { return Form?.RedirectUri; } set { Form.RedirectUri = value; } } /// - /// Constructor + /// Returns or sets the submit button. + /// + private ControlFormItemButtonSubmit SubmitButton { get; set; } + + /// + /// Initializes a new instance of the class. /// /// The control id. - public ControlModalFormularFileUpload(string id = null) + public ControlModalFormFileUpload(string id = null) : this(id, null) { } /// - /// Constructor + /// Initializes a new instance of the class. /// /// The control id. - /// Die Formularsteuerelemente - public ControlModalFormularFileUpload(string id, params ControlFormItem[] content) + /// The form controls. + public ControlModalFormFileUpload(string id, params ControlFormItem[] content) : base(id, string.Empty, content) { Init(); @@ -88,15 +93,18 @@ public ControlModalFormularFileUpload(string id, params ControlFormItem[] conten /// private void Init() { + SubmitButton = new ControlFormItemButtonSubmit("submit"); Header = I18N("webexpress.webapp:fileupload.header"); - ButtonLabel = I18N("webexpress.webapp:fileupload.label"); - ButtonIcon = new PropertyIcon(TypeIcon.Upload); - ButtonColor = new PropertyColorButton(TypeColorButton.Primary); + SubmitButtonLabel = I18N("webexpress.webapp:fileupload.label"); + SubmitButtonIcon = new PropertyIcon(TypeIcon.Upload); + SubmitButtonColor = new PropertyColorButton(TypeColorButton.Primary); File.Validation += OnValidationFile; - Formular.ProcessFormular += OnProcessFormular; + Form.ProcessForm += OnProcessForm; + + Form.Add(File); + Form.AddPrimaryButton(SubmitButton); - Formular.Add(File); } /// @@ -113,15 +121,15 @@ private void OnValidationFile(object sender, ValidationEventArgs e) } /// - /// Processing of the resource. des Formulares + /// Processing of the form. /// /// The trigger of the event. /// The event argument. - private void OnProcessFormular(object sender, FormularEventArgs e) + private void OnProcessForm(object sender, FormEventArgs e) { if (e.Context.Request.GetParameter(File.Name) is ParameterFile file) { - OnUpload(new FormularUploadEventArgs(e) { File = file }); + OnUpload(new FormUploadEventArgs(e) { File = file }); } } @@ -129,7 +137,7 @@ private void OnProcessFormular(object sender, FormularEventArgs e) /// Löst das Upload-Event aus /// /// The event argument. - protected virtual void OnUpload(FormularUploadEventArgs args) + protected virtual void OnUpload(FormUploadEventArgs args) { Upload?.Invoke(this, args); } @@ -141,13 +149,10 @@ protected virtual void OnUpload(FormularUploadEventArgs args) /// The control as html. public override IHtmlNode Render(RenderContext context) { - Formular.RedirectUri = RedirectUri ?? context.Uri; - Formular.SubmitButton.Text = ButtonLabel; - Formular.SubmitButton.Icon = ButtonIcon; - Formular.SubmitButton.Color = ButtonColor; + Form.RedirectUri = RedirectUri ?? context.Uri; var list = new[] { Epilogue } - .Concat(Formular.Items) + .Concat(Form.Items) .Concat([Prologue]); return base.Render(context, list.Where(x => x != null)); diff --git a/src/WebExpress.WebApp/WebControl/ControlModalFormularGoupEdit.cs b/src/WebExpress.WebApp/WebControl/ControlModalFormGoupEdit.cs similarity index 85% rename from src/WebExpress.WebApp/WebControl/ControlModalFormularGoupEdit.cs rename to src/WebExpress.WebApp/WebControl/ControlModalFormGoupEdit.cs index b91777e..c1cb525 100644 --- a/src/WebExpress.WebApp/WebControl/ControlModalFormularGoupEdit.cs +++ b/src/WebExpress.WebApp/WebControl/ControlModalFormGoupEdit.cs @@ -5,7 +5,7 @@ namespace WebExpress.WebApp.WebControl { - internal sealed class ControlModalFormularGoupEdit : ControlModalFormular + internal sealed class ControlModalFormGoupEdit : ControlModalForm { /// /// Returns or sets the group to be deleted. @@ -31,10 +31,10 @@ internal sealed class ControlModalFormularGoupEdit : ControlModalFormular }; /// - /// Constructor + /// Initializes a new instance of the class. /// /// The control id. - public ControlModalFormularGoupEdit(string id = null) + public ControlModalFormGoupEdit(string id = null) : base(id) { Add(Description); @@ -43,9 +43,9 @@ public ControlModalFormularGoupEdit(string id = null) Header = "webexpress.webapp:setting.usermanager.group.edit.header"; GroupName.Validation += OnGroupNameValidation; - Formular.SubmitButton.Text = "webexpress.webapp:setting.usermanager.group.edit.confirm"; - Formular.FillFormular += OnFillFormular; - Formular.ProcessFormular += OnConfirm; + //Form.SubmitButton.Text = "webexpress.webapp:setting.usermanager.group.edit.confirm"; + Form.FillForm += OnFillForm; + Form.ProcessForm += OnConfirm; } /// @@ -53,7 +53,7 @@ public ControlModalFormularGoupEdit(string id = null) /// /// The trigger of the event. /// The event argument. - private void OnFillFormular(object sender, FormularEventArgs e) + private void OnFillForm(object sender, FormEventArgs e) { GroupName.Value = Item?.Name; } @@ -81,7 +81,7 @@ private void OnGroupNameValidation(object sender, ValidationEventArgs e) /// /// The trigger of the event. /// The event argument. - private void OnConfirm(object sender, FormularEventArgs e) + private void OnConfirm(object sender, FormEventArgs e) { Item.Name = GroupName.Value; diff --git a/src/WebExpress.WebApp/WebControl/ControlModalFormularGoupNew.cs b/src/WebExpress.WebApp/WebControl/ControlModalFormGoupNew.cs similarity index 87% rename from src/WebExpress.WebApp/WebControl/ControlModalFormularGoupNew.cs rename to src/WebExpress.WebApp/WebControl/ControlModalFormGoupNew.cs index c0243d0..1dff3fc 100644 --- a/src/WebExpress.WebApp/WebControl/ControlModalFormularGoupNew.cs +++ b/src/WebExpress.WebApp/WebControl/ControlModalFormGoupNew.cs @@ -5,7 +5,7 @@ namespace WebExpress.WebApp.WebControl { - internal sealed class ControlModalFormularGoupNew : ControlModalFormular + internal sealed class ControlModalFormGoupNew : ControlModalForm { /// /// Returns the description of the form. @@ -26,10 +26,10 @@ internal sealed class ControlModalFormularGoupNew : ControlModalFormular }; /// - /// Constructor + /// Initializes a new instance of the class. /// /// The control id. - public ControlModalFormularGoupNew(string id = null) + public ControlModalFormGoupNew(string id = null) : base(id) { Add(Description); @@ -38,8 +38,8 @@ public ControlModalFormularGoupNew(string id = null) Header = "webexpress.webapp:setting.usermanager.group.add.header"; GroupName.Validation += OnGroupNameValidation; - Formular.SubmitButton.Text = "webexpress.webapp:setting.usermanager.group.add.confirm"; - Formular.ProcessFormular += OnConfirm; + //Form.SubmitButton.Text = "webexpress.webapp:setting.usermanager.group.add.confirm"; + Form.ProcessForm += OnConfirm; } /// @@ -65,7 +65,7 @@ private void OnGroupNameValidation(object sender, ValidationEventArgs e) /// /// The trigger of the event. /// The event argument. - private void OnConfirm(object sender, FormularEventArgs e) + private void OnConfirm(object sender, FormEventArgs e) { var group = new Group() { diff --git a/src/WebExpress.WebApp/WebControl/ControlModalFormularGroupDelete.cs b/src/WebExpress.WebApp/WebControl/ControlModalFormGroupDelete.cs similarity index 87% rename from src/WebExpress.WebApp/WebControl/ControlModalFormularGroupDelete.cs rename to src/WebExpress.WebApp/WebControl/ControlModalFormGroupDelete.cs index 60051b2..293644e 100644 --- a/src/WebExpress.WebApp/WebControl/ControlModalFormularGroupDelete.cs +++ b/src/WebExpress.WebApp/WebControl/ControlModalFormGroupDelete.cs @@ -1,13 +1,13 @@ using System; +using WebExpress.WebApp.WebUser; using WebExpress.WebCore.WebHtml; using WebExpress.WebCore.WebPage; -using WebExpress.WebApp.WebUser; using WebExpress.WebUI.WebControl; using static WebExpress.WebCore.Internationalization.InternationalizationManager; namespace WebExpress.WebApp.WebControl { - internal sealed class ControlModalFormularGroupDelete : ControlModalFormularConfirmDelete + internal sealed class ControlModalFormGroupDelete : ControlModalFormConfirmDelete { /// /// Returns or sets the group to be edited. @@ -20,10 +20,10 @@ internal sealed class ControlModalFormularGroupDelete : ControlModalFormularConf private ControlFormItemStaticText Description { get; } = new ControlFormItemStaticText(); /// - /// Constructor + /// Initializes a new instance of the class. /// /// The control id. - public ControlModalFormularGroupDelete(string id = null) + public ControlModalFormGroupDelete(string id = null) : base("delete_" + id) { Confirm += OnConfirm; @@ -38,7 +38,7 @@ public ControlModalFormularGroupDelete(string id = null) /// The trigger of the event. /// The event argument. /// - private void OnConfirm(object sender, FormularEventArgs e) + private void OnConfirm(object sender, FormEventArgs e) { UserManager.RemoveGroup(Item); diff --git a/src/WebExpress.WebApp/WebControl/ControlModalFormularUserDelete.cs b/src/WebExpress.WebApp/WebControl/ControlModalFormUserDelete.cs similarity index 83% rename from src/WebExpress.WebApp/WebControl/ControlModalFormularUserDelete.cs rename to src/WebExpress.WebApp/WebControl/ControlModalFormUserDelete.cs index 0425258..713c2fb 100644 --- a/src/WebExpress.WebApp/WebControl/ControlModalFormularUserDelete.cs +++ b/src/WebExpress.WebApp/WebControl/ControlModalFormUserDelete.cs @@ -1,12 +1,12 @@ -using WebExpress.WebCore.WebHtml; +using WebExpress.WebApp.WebUser; +using WebExpress.WebCore.WebHtml; using WebExpress.WebCore.WebPage; -using WebExpress.WebApp.WebUser; using WebExpress.WebUI.WebControl; using static WebExpress.WebCore.Internationalization.InternationalizationManager; namespace WebExpress.WebApp.WebControl { - internal sealed class ControlModalFormularUserDelete : ControlModalFormularConfirmDelete + internal sealed class ControlModalFormUserDelete : ControlModalFormConfirmDelete { /// /// Returns or sets the user to be deleted. @@ -19,10 +19,10 @@ internal sealed class ControlModalFormularUserDelete : ControlModalFormularConfi private ControlFormItemStaticText Description { get; } = new ControlFormItemStaticText(); /// - /// Constructor + /// Initializes a new instance of the class. /// /// The control id. - public ControlModalFormularUserDelete(string id = null) + public ControlModalFormUserDelete(string id = null) : base("delete_" + id) { Confirm += OnConfirm; @@ -36,7 +36,7 @@ public ControlModalFormularUserDelete(string id = null) /// /// The trigger of the event. /// The event argument. - private void OnConfirm(object sender, FormularEventArgs e) + private void OnConfirm(object sender, FormEventArgs e) { UserManager.RemoveUser(Item); diff --git a/src/WebExpress.WebApp/WebControl/ControlModalFormularUserEdit.cs b/src/WebExpress.WebApp/WebControl/ControlModalFormUserEdit.cs similarity index 84% rename from src/WebExpress.WebApp/WebControl/ControlModalFormularUserEdit.cs rename to src/WebExpress.WebApp/WebControl/ControlModalFormUserEdit.cs index 15b8b31..412d549 100644 --- a/src/WebExpress.WebApp/WebControl/ControlModalFormularUserEdit.cs +++ b/src/WebExpress.WebApp/WebControl/ControlModalFormUserEdit.cs @@ -1,20 +1,20 @@ using System; using System.Collections.Generic; using System.Linq; -using WebExpress.WebUI.WebControl; using WebExpress.WebApp.WebUser; +using WebExpress.WebUI.WebControl; namespace WebExpress.WebApp.WebControl { - internal sealed class ControlModalFormularUserEdit : ControlModalFormular + internal sealed class ControlModalFormUserEdit : ControlModalForm { /// - /// Der zu bearbeitende Benutzer + /// Returns or sets the user to edit. /// public User Item { get; set; } /// - /// Liefert die Beschreibung des Formulars + /// Returns the description of the form. /// private ControlFormItemStaticText Description { get; } = new ControlFormItemStaticText() { @@ -23,7 +23,7 @@ internal sealed class ControlModalFormularUserEdit : ControlModalFormular }; /// - /// Liefert das Steuerlement zur Eingabe der Loginkennung + /// Returns the control for entering the login id. /// private ControlFormItemInputTextBox Login { get; } = new ControlFormItemInputTextBox() { @@ -32,7 +32,7 @@ internal sealed class ControlModalFormularUserEdit : ControlModalFormular }; /// - /// Liefert das Steuerlement zur Eingabe des Vornamens + /// Returns the control for entering the first name. /// private ControlFormItemInputTextBox Firstname { get; } = new ControlFormItemInputTextBox() { @@ -41,7 +41,7 @@ internal sealed class ControlModalFormularUserEdit : ControlModalFormular }; /// - /// Liefert das Steuerlement zur Eingabe des Nachnamens + /// Returns the control for entering the last name. /// private ControlFormItemInputTextBox Lastname { get; } = new ControlFormItemInputTextBox() { @@ -50,7 +50,7 @@ internal sealed class ControlModalFormularUserEdit : ControlModalFormular }; /// - /// Liefert das Steuerlement zur Eingabe der Email-Adresse + /// Returns the control for entering the email address. /// private ControlFormItemInputTextBox Email { get; } = new ControlFormItemInputTextBox() { @@ -60,15 +60,15 @@ internal sealed class ControlModalFormularUserEdit : ControlModalFormular }; /// - /// Liefert die Gruppen + /// Returns or sets the groups. /// private ControlFormItemInputMove Groups { get; set; } /// - /// Constructor + /// Initializes a new instance of the class. /// /// The id. - public ControlModalFormularUserEdit(string id = null) + public ControlModalFormUserEdit(string id = null) : base(id) { Groups = new ControlFormItemInputMove(id) @@ -91,9 +91,9 @@ public ControlModalFormularUserEdit(string id = null) Add(new ControlFormItemGroupColumnVertical(Firstname, Lastname) { Distribution = new int[] { 50 } }); Add(Email); Add(Groups); - Formular.SubmitButton.Text = "webexpress.webapp:setting.usermanager.user.edit.confirm"; - Formular.FillFormular += OnFillFormular; - Formular.ProcessFormular += OnConfirm; + //Form.SubmitButton.Text = "webexpress.webapp:setting.usermanager.user.edit.confirm"; + Form.FillForm += OnFillForm; + Form.ProcessForm += OnConfirm; Header = "webexpress.webapp:setting.usermanager.user.edit.header"; } @@ -103,7 +103,7 @@ public ControlModalFormularUserEdit(string id = null) /// /// The trigger of the event. /// The event argument. - private void OnFillFormular(object sender, FormularEventArgs e) + private void OnFillForm(object sender, FormEventArgs e) { Login.Value = Item?.Login; Firstname.Value = Item?.Firstname; @@ -123,7 +123,7 @@ private void OnFillFormular(object sender, FormularEventArgs e) } /// - /// Wird aufgerufen, wenn die eingegebene Loginkennung überprüft werden soll + /// Called when the entered login id is to be checked. /// /// The trigger of the event. /// The event argument. @@ -141,7 +141,7 @@ private void OnLoginValidation(object sender, ValidationEventArgs e) } /// - /// Wird aufgerufen, wenn der eingegebene Vorname überprüft werden soll + /// Called when the entered first name is to be checked. /// /// The trigger of the event. /// The event argument. @@ -154,7 +154,7 @@ private void OnFirstnameValidation(object sender, ValidationEventArgs e) } /// - /// Wird aufgerufen, wenn der eingegebene Nachname überprüft werden soll + /// Called when the entered last name is to be checked. /// /// The trigger of the event. /// The event argument. @@ -167,7 +167,7 @@ private void OnLastnameValidation(object sender, ValidationEventArgs e) } /// - /// Wird aufgerufen, wenn die eingegebene E-Mail-Adresse überprüft werden soll + /// Invoked when the entered email address is to be verified. /// /// The trigger of the event. /// The event argument. @@ -184,7 +184,7 @@ private void OnEmailValidation(object sender, ValidationEventArgs e) /// /// The trigger of the event. /// The event argument. - private void OnConfirm(object sender, FormularEventArgs e) + private void OnConfirm(object sender, FormEventArgs e) { Item.Login = Login.Value; Item.Firstname = Firstname.Value; diff --git a/src/WebExpress.WebApp/WebControl/ControlModalFormularUserNew.cs b/src/WebExpress.WebApp/WebControl/ControlModalFormUserNew.cs similarity index 84% rename from src/WebExpress.WebApp/WebControl/ControlModalFormularUserNew.cs rename to src/WebExpress.WebApp/WebControl/ControlModalFormUserNew.cs index a3932b8..b42eb93 100644 --- a/src/WebExpress.WebApp/WebControl/ControlModalFormularUserNew.cs +++ b/src/WebExpress.WebApp/WebControl/ControlModalFormUserNew.cs @@ -6,10 +6,10 @@ namespace WebExpress.WebApp.WebControl { - internal sealed class ControlModalFormularUserNew : ControlModalFormular + internal sealed class ControlModalFormUserNew : ControlModalForm { /// - /// Liefert die Beschreibung des Formulars + /// Returns the description of the form. /// private ControlFormItemStaticText Description { get; } = new ControlFormItemStaticText() { @@ -18,7 +18,7 @@ internal sealed class ControlModalFormularUserNew : ControlModalFormular }; /// - /// Liefert das Steuerlement zur Eingabe der Loginkennung + /// Returns the control for entering the login id. /// private ControlFormItemInputTextBox Login { get; } = new ControlFormItemInputTextBox() { @@ -27,7 +27,7 @@ internal sealed class ControlModalFormularUserNew : ControlModalFormular }; /// - /// Liefert das Steuerlement zur Eingabe des Vornamens + /// Returns the control for entering the first name. /// private ControlFormItemInputTextBox Firstname { get; } = new ControlFormItemInputTextBox() { @@ -36,7 +36,7 @@ internal sealed class ControlModalFormularUserNew : ControlModalFormular }; /// - /// Liefert das Steuerlement zur Eingabe des Nachnamens + /// Returns the control for entering the last name. /// private ControlFormItemInputTextBox Lastname { get; } = new ControlFormItemInputTextBox() { @@ -45,7 +45,7 @@ internal sealed class ControlModalFormularUserNew : ControlModalFormular }; /// - /// Liefert das Steuerlement zur Eingabe der Email-Adresse + /// Returns the control for entering the email address. /// private ControlFormItemInputTextBox Email { get; } = new ControlFormItemInputTextBox() { @@ -55,7 +55,7 @@ internal sealed class ControlModalFormularUserNew : ControlModalFormular }; /// - /// Liefert die Gruppen + /// Returns the groups. /// private ControlFormItemInputMove Groups { get; } = new ControlFormItemInputMove("group") { @@ -68,10 +68,10 @@ internal sealed class ControlModalFormularUserNew : ControlModalFormular }; /// - /// Constructor + /// Initializes a new instance of the class. /// /// The id. - public ControlModalFormularUserNew(string id = null) + public ControlModalFormUserNew(string id = null) : base(id) { Login.Validation += OnLoginValidation; @@ -84,9 +84,9 @@ public ControlModalFormularUserNew(string id = null) Add(new ControlFormItemGroupColumnVertical(Firstname, Lastname) { Distribution = new int[] { 50 } }); Add(Email); Add(Groups); - Formular.SubmitButton.Text = "webexpress.webapp:setting.usermanager.user.add.confirm"; - Formular.FillFormular += OnFillFormular; - Formular.ProcessFormular += OnConfirm; + //Form.SubmitButton.Text = "webexpress.webapp:setting.usermanager.user.add.confirm"; + Form.FillForm += OnFillForm; + Form.ProcessForm += OnConfirm; Header = "webexpress.webapp:setting.usermanager.user.add.header"; } @@ -96,7 +96,7 @@ public ControlModalFormularUserNew(string id = null) /// /// The trigger of the event. /// The event argument. - private void OnFillFormular(object sender, FormularEventArgs e) + private void OnFillForm(object sender, FormEventArgs e) { foreach (var v in UserManager.Groups.OrderBy(x => x.Name)) { @@ -109,7 +109,7 @@ private void OnFillFormular(object sender, FormularEventArgs e) } /// - /// Wird aufgerufen, wenn die eingegebene Loginkennung überprüft werden soll + /// Called when the entered login id is to be checked. /// /// The trigger of the event. /// The event argument. @@ -127,7 +127,7 @@ private void OnLoginValidation(object sender, ValidationEventArgs e) } /// - /// Wird aufgerufen, wenn der eingegebene Vorname überprüft werden soll + /// Called when the entered first name is to be checked. /// /// The trigger of the event. /// The event argument. @@ -140,7 +140,7 @@ private void OnFirstnameValidation(object sender, ValidationEventArgs e) } /// - /// Wird aufgerufen, wenn der eingegebene Nachname überprüft werden soll + /// Called when the entered last name is to be checked. /// /// The trigger of the event. /// The event argument. @@ -153,7 +153,7 @@ private void OnLastnameValidation(object sender, ValidationEventArgs e) } /// - /// Wird aufgerufen, wenn die eingegebene E-Mail-Adresse überprüft werden soll + /// Invoked when the entered email address is to be verified. /// /// The trigger of the event. /// The event argument. @@ -170,7 +170,7 @@ private void OnEmailValidation(object sender, ValidationEventArgs e) /// /// The trigger of the event. /// The event argument. - private void OnConfirm(object sender, FormularEventArgs e) + private void OnConfirm(object sender, FormEventArgs e) { var user = new User() { diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppContent.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppContent.cs index 61d59ae..f77740e 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppContent.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppContent.cs @@ -63,7 +63,7 @@ public class ControlWebAppContent : ControlPanel public List Secondary { get; } = new List(); /// - /// Constructor + /// Initializes a new instance of the class. /// /// The control id. public ControlWebAppContent(string id = null) diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppFooter.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppFooter.cs index 88da476..6b3f9ea 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppFooter.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppFooter.cs @@ -28,7 +28,7 @@ public class ControlWebAppFooter : Control public List Secondary { get; protected set; } = new List(); /// - /// Constructor + /// Initializes a new instance of the class. /// /// The control id. public ControlWebAppFooter(string id = null) diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeader.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeader.cs index b2b7d24..3ac0439 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeader.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeader.cs @@ -83,7 +83,7 @@ public virtual TypeSticky Sticky }; /// - /// Constructor + /// Initializes a new instance of the class. /// /// The control id. public ControlWebAppHeader(string id = null) diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigation.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigation.cs index eb67063..b48d233 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigation.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigation.cs @@ -27,7 +27,7 @@ public class ControlWebAppHeaderAppNavigation : ControlPanelFlexbox public List Secondary { get; protected set; } = new List(); /// - /// Constructor + /// Initializes a new instance of the class. /// /// The control id. public ControlWebAppHeaderAppNavigation(string id = null) diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigator.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigator.cs index 2caf1b1..23e5991 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigator.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigator.cs @@ -28,7 +28,7 @@ public class ControlWebAppHeaderAppNavigator : Control public List Secondary { get; protected set; } = new List(); /// - /// Constructor + /// Initializes a new instance of the class. /// /// The control id. public ControlWebAppHeaderAppNavigator(string id = null) diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppTitle.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppTitle.cs index 41579ba..b628ec8 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppTitle.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppTitle.cs @@ -12,7 +12,7 @@ namespace WebExpress.WebApp.WebControl public class ControlWebAppHeaderAppTitle : ControlLink { /// - /// Constructor + /// Initializes a new instance of the class. /// /// The control id. public ControlWebAppHeaderAppTitle(string id = null) diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderHelp.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderHelp.cs index 356e244..62a9a91 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderHelp.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderHelp.cs @@ -27,7 +27,7 @@ public class ControlWebAppHeaderHelp : Control public List Secondary { get; protected set; } = new List(); /// - /// Constructor + /// Initializes a new instance of the class. /// /// The controls id. public ControlWebAppHeaderHelp(string id = null) diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderQuickCreate.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderQuickCreate.cs index 887564b..bca69ea 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderQuickCreate.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderQuickCreate.cs @@ -29,7 +29,7 @@ public class ControlWebAppHeaderQuickCreate : Control public List Secondary { get; protected set; } = new List(); /// - /// Constructor + /// Initializes a new instance of the class. /// /// The control id. public ControlWebAppHeaderQuickCreate(string id = null) diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs index d56dcf3..b708379 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs @@ -27,7 +27,7 @@ public class ControlWebAppHeaderSettings : Control public List Secondary { get; protected set; } = new List(); /// - /// Constructor + /// Initializes a new instance of the class. /// /// The control id. public ControlWebAppHeaderSettings(string id = null) diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeadline.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeadline.cs index b397489..6505210 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeadline.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeadline.cs @@ -54,7 +54,7 @@ public class ControlWebAppHeadline : Control public List Metadata { get; protected set; } = new List(); /// - /// Constructor + /// Initializes a new instance of the class. /// /// The control id. public ControlWebAppHeadline(string id = null) diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppProperty.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppProperty.cs index 46d6645..f904b75 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppProperty.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppProperty.cs @@ -28,7 +28,7 @@ public class ControlWebAppProperty : Control public List Secondary { get; protected set; } = new List(); /// - /// Constructor + /// Initializes a new instance of the class. /// /// The control id. public ControlWebAppProperty(string id = null) diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppSidebar.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppSidebar.cs index 7edfff1..208731b 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppSidebar.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppSidebar.cs @@ -38,7 +38,7 @@ public class ControlWebAppSidebar : Control public bool HasContent => Header.Any() || Preferences.Any() || Primary.Any() || Secondary.Any(); /// - /// Constructor + /// Initializes a new instance of the class. /// /// The control id. public ControlWebAppSidebar(string id = null) diff --git a/src/WebExpress.WebApp/WebControl/FormularUploadEventArgs.cs b/src/WebExpress.WebApp/WebControl/FormUploadEventArgs.cs similarity index 72% rename from src/WebExpress.WebApp/WebControl/FormularUploadEventArgs.cs rename to src/WebExpress.WebApp/WebControl/FormUploadEventArgs.cs index b144c59..d20240f 100644 --- a/src/WebExpress.WebApp/WebControl/FormularUploadEventArgs.cs +++ b/src/WebExpress.WebApp/WebControl/FormUploadEventArgs.cs @@ -3,7 +3,7 @@ namespace WebExpress.WebApp.WebControl { - public class FormularUploadEventArgs : FormularEventArgs + public class FormUploadEventArgs : FormEventArgs { /// /// Returns or sets the file. @@ -11,10 +11,10 @@ public class FormularUploadEventArgs : FormularEventArgs public ParameterFile File { get; set; } /// - /// Constructor + /// Initializes a new instance of the class. /// /// The event argument. - public FormularUploadEventArgs(FormularEventArgs args) + public FormUploadEventArgs(FormEventArgs args) { Context = args.Context; } diff --git a/src/WebExpress.WebApp/WebFragment/FragmentControlModalFormConfirmDelete.cs b/src/WebExpress.WebApp/WebFragment/FragmentControlModalFormConfirmDelete.cs index 995345c..3dca9a9 100644 --- a/src/WebExpress.WebApp/WebFragment/FragmentControlModalFormConfirmDelete.cs +++ b/src/WebExpress.WebApp/WebFragment/FragmentControlModalFormConfirmDelete.cs @@ -1,10 +1,10 @@ -using WebExpress.WebCore.WebPage; -using WebExpress.WebApp.WebControl; +using WebExpress.WebApp.WebControl; +using WebExpress.WebCore.WebPage; using WebExpress.WebUI.WebFragment; namespace WebExpress.WebApp.WebFragment { - public class FragmentControlModalFormConfirmDelete : ControlModalFormularConfirmDelete, IFragment + public class FragmentControlModalFormConfirmDelete : ControlModalFormConfirmDelete, IFragment { /// /// Returns the context. @@ -12,7 +12,7 @@ public class FragmentControlModalFormConfirmDelete : ControlModalFormularConfirm public IFragmentContext FragmentContext { get; private set; } /// - /// Constructor + /// Initializes a new instance of the class. /// /// The id of the fragment or null. public FragmentControlModalFormConfirmDelete(string id = null) diff --git a/src/WebExpress.WebApp/WebFragment/FragmentCrudTable.cs b/src/WebExpress.WebApp/WebFragment/FragmentCrudTable.cs index 6c4dc45..4e01a21 100644 --- a/src/WebExpress.WebApp/WebFragment/FragmentCrudTable.cs +++ b/src/WebExpress.WebApp/WebFragment/FragmentCrudTable.cs @@ -20,7 +20,7 @@ public abstract class FragmentCrudTable : FragmentControlPanel public ICollection Editors { get; } = new List(); /// - /// Constructor + /// Initializes a new instance of the class. /// /// The fragment id. public FragmentCrudTable(string id = null) diff --git a/src/WebExpress.WebApp/WebFragment/FragmentCrudTableEditorItem.cs b/src/WebExpress.WebApp/WebFragment/FragmentCrudTableEditorItem.cs index ab43c1b..49f685d 100644 --- a/src/WebExpress.WebApp/WebFragment/FragmentCrudTableEditorItem.cs +++ b/src/WebExpress.WebApp/WebFragment/FragmentCrudTableEditorItem.cs @@ -6,7 +6,7 @@ public abstract class FragmentCrudTableEditorItem { /// - /// Constructor + /// Initializes a new instance of the class. /// public FragmentCrudTableEditorItem() { diff --git a/src/WebExpress.WebApp/WebFragment/FragmentCrudTableEditorLinkItem.cs b/src/WebExpress.WebApp/WebFragment/FragmentCrudTableEditorLinkItem.cs index 71236fb..71a0ee8 100644 --- a/src/WebExpress.WebApp/WebFragment/FragmentCrudTableEditorLinkItem.cs +++ b/src/WebExpress.WebApp/WebFragment/FragmentCrudTableEditorLinkItem.cs @@ -23,7 +23,7 @@ public class FragmentCrudTableEditorLinkItem : FragmentCrudTableEditorItem public PropertyColorText Color { get; set; } /// - /// Constructor + /// Initializes a new instance of the class. /// /// The label of the column. public FragmentCrudTableEditorLinkItem(string label) diff --git a/src/WebExpress.WebApp/WebFragment/FragmentCrudTableEditorSeperatorItem.cs b/src/WebExpress.WebApp/WebFragment/FragmentCrudTableEditorSeperatorItem.cs index 3fdf438..a636af9 100644 --- a/src/WebExpress.WebApp/WebFragment/FragmentCrudTableEditorSeperatorItem.cs +++ b/src/WebExpress.WebApp/WebFragment/FragmentCrudTableEditorSeperatorItem.cs @@ -6,7 +6,7 @@ public class FragmentCrudTableEditorSeperatorItem : FragmentCrudTableEditorItem { /// - /// Constructor + /// Initializes a new instance of the class. /// public FragmentCrudTableEditorSeperatorItem() { diff --git a/src/WebExpress.WebApp/WebFragment/FragmentHeaderSettingsSystemInformation.cs b/src/WebExpress.WebApp/WebFragment/FragmentHeaderSettingsSystemInformation.cs index 9a3a736..35d9ea5 100644 --- a/src/WebExpress.WebApp/WebFragment/FragmentHeaderSettingsSystemInformation.cs +++ b/src/WebExpress.WebApp/WebFragment/FragmentHeaderSettingsSystemInformation.cs @@ -9,7 +9,7 @@ namespace WebExpress.WebApp.WebFragment public abstract class FragmentHeaderSettingsSystemInformation : FragmentControlDropdownItemLink { /// - /// Constructor + /// Initializes a new instance of the class. /// public FragmentHeaderSettingsSystemInformation() : base() diff --git a/src/WebExpress.WebApp/WebFragment/FragmentPropertyReboot.cs b/src/WebExpress.WebApp/WebFragment/FragmentPropertyReboot.cs index a03b9f4..87bac16 100644 --- a/src/WebExpress.WebApp/WebFragment/FragmentPropertyReboot.cs +++ b/src/WebExpress.WebApp/WebFragment/FragmentPropertyReboot.cs @@ -3,6 +3,7 @@ using System.Threading.Tasks; using WebExpress.WebApp.WebCondition; using WebExpress.WebApp.WebControl; +using WebExpress.WebApp.WebSection; using WebExpress.WebApp.WebSettingPage; using WebExpress.WebCore.WebAttribute; using WebExpress.WebCore.WebHtml; @@ -13,7 +14,7 @@ namespace WebExpress.WebApp.WebFragment { - [Section(Section.HeadlineSecondary)] + [Section(SectionWebApp.HeadlineSecondary)] [Module] [Scope] [Condition] @@ -22,14 +23,14 @@ public sealed class FragmentPropertyReboot : FragmentControlButtonLink /// /// Returns the modal dialog to confirm the delete action. /// - private ControlModalFormularConfirm ModalDlg = new ControlModalFormularConfirm("archive_btn") + private ControlModalFormConfirm ModalDlg = new ControlModalFormConfirm("archive_btn") { Header = "webexpress.webapp:setting.systeminformation.reboot.header", Content = new ControlFormItemStaticText() { Text = "webexpress.webapp:setting.systeminformation.reboot.description" } }; /// - /// Constructor + /// Initializes a new instance of the class. /// public FragmentPropertyReboot() : base("archive_btn") @@ -51,9 +52,9 @@ public override void Initialization(IFragmentContext context, IPage page) Icon = new PropertyIcon(TypeIcon.PowerOff); TextColor = new PropertyColorText(TypeColorText.Light); - ModalDlg.ButtonIcon = Icon; - ModalDlg.ButtonLabel = Text; - ModalDlg.ButtonColor = new PropertyColorButton(TypeColorButton.Danger); + ModalDlg.SubmitButtonIcon = Icon; + ModalDlg.SubmitButtonLabel = Text; + ModalDlg.SubmitButtonColor = new PropertyColorButton(TypeColorButton.Danger); ModalDlg.Confirm += OnConfirm; Modal = new PropertyModal(TypeModal.Modal, ModalDlg); @@ -64,7 +65,7 @@ public override void Initialization(IFragmentContext context, IPage page) /// /// The trigger of the event. /// The event argument. - private void OnConfirm(object sender, FormularEventArgs e) + private void OnConfirm(object sender, FormEventArgs e) { var process = new Process() { diff --git a/src/WebExpress.WebApp/WebFragment/FragmentUserManagementAddGroup.cs b/src/WebExpress.WebApp/WebFragment/FragmentUserManagementAddGroup.cs index c89c772..4ea453d 100644 --- a/src/WebExpress.WebApp/WebFragment/FragmentUserManagementAddGroup.cs +++ b/src/WebExpress.WebApp/WebFragment/FragmentUserManagementAddGroup.cs @@ -1,15 +1,16 @@ -using WebExpress.WebCore.WebAttribute; +using WebExpress.WebApp.WebControl; +using WebExpress.WebApp.WebSection; +using WebExpress.WebApp.WebSettingPage; +using WebExpress.WebCore.WebAttribute; using WebExpress.WebCore.WebHtml; using WebExpress.WebCore.WebPage; -using WebExpress.WebApp.WebControl; -using WebExpress.WebApp.WebSettingPage; using WebExpress.WebUI.WebAttribute; using WebExpress.WebUI.WebControl; using WebExpress.WebUI.WebFragment; namespace WebExpress.WebApp.WebFragment { - [Section(Section.HeadlineSecondary)] + [Section(SectionWebApp.HeadlineSecondary)] [Module] [Scope] public sealed class FragmentUserManagementAddGroup : FragmentControlButtonLink @@ -17,13 +18,13 @@ public sealed class FragmentUserManagementAddGroup : FragmentControlButtonLink /// /// Provides the modal dialog for adding a group. /// - private ControlModalFormularGoupNew ModalDlg = new ControlModalFormularGoupNew("add_group") + private ControlModalFormGoupNew ModalDlg = new ControlModalFormGoupNew("add_group") { }; /// - /// Constructor + /// Initializes a new instance of the class. /// public FragmentUserManagementAddGroup() : base("add_group") diff --git a/src/WebExpress.WebApp/WebFragment/FragmentUserManagementAddUser.cs b/src/WebExpress.WebApp/WebFragment/FragmentUserManagementAddUser.cs index 27738ba..4a9c748 100644 --- a/src/WebExpress.WebApp/WebFragment/FragmentUserManagementAddUser.cs +++ b/src/WebExpress.WebApp/WebFragment/FragmentUserManagementAddUser.cs @@ -1,15 +1,16 @@ -using WebExpress.WebCore.WebAttribute; +using WebExpress.WebApp.WebControl; +using WebExpress.WebApp.WebSection; +using WebExpress.WebApp.WebSettingPage; +using WebExpress.WebCore.WebAttribute; using WebExpress.WebCore.WebHtml; using WebExpress.WebCore.WebPage; -using WebExpress.WebApp.WebControl; -using WebExpress.WebApp.WebSettingPage; using WebExpress.WebUI.WebAttribute; using WebExpress.WebUI.WebControl; using WebExpress.WebUI.WebFragment; namespace WebExpress.WebApp.WebFragment { - [Section(Section.HeadlineSecondary)] + [Section(SectionWebApp.HeadlineSecondary)] [Module] [Scope] public sealed class FragmentUserManagementAddUser : FragmentControlButtonLink @@ -17,10 +18,10 @@ public sealed class FragmentUserManagementAddUser : FragmentControlButtonLink /// /// Returns the modal dialog for adding a user. /// - private ControlModalFormularUserNew ModalDlg = new ControlModalFormularUserNew("add_user"); + private ControlModalFormUserNew ModalDlg = new ControlModalFormUserNew("add_user"); /// - /// Constructor + /// Initializes a new instance of the class. /// public FragmentUserManagementAddUser() : base("add_user") diff --git a/src/WebExpress.WebApp/WebFragment/FragmentUserManagementDescription.cs b/src/WebExpress.WebApp/WebFragment/FragmentUserManagementDescription.cs index 10f210e..f431208 100644 --- a/src/WebExpress.WebApp/WebFragment/FragmentUserManagementDescription.cs +++ b/src/WebExpress.WebApp/WebFragment/FragmentUserManagementDescription.cs @@ -1,14 +1,15 @@ -using WebExpress.WebCore.WebAttribute; +using WebExpress.WebApp.WebSection; +using WebExpress.WebApp.WebSettingPage; +using WebExpress.WebCore.WebAttribute; using WebExpress.WebCore.WebHtml; using WebExpress.WebCore.WebPage; -using WebExpress.WebApp.WebSettingPage; using WebExpress.WebUI.WebAttribute; using WebExpress.WebUI.WebControl; using WebExpress.WebUI.WebFragment; namespace WebExpress.WebApp.WebFragment { - [Section(Section.ContentPreferences)] + [Section(SectionWebApp.ContentPreferences)] [Module] [Scope] [Cache()] @@ -34,7 +35,7 @@ public sealed class FragmentUserManagementDescription : FragmentControlPanel }; /// - /// Constructor + /// Initializes a new instance of the class. /// public FragmentUserManagementDescription() { diff --git a/src/WebExpress.WebApp/WebFragment/FragmentUserManagementTable.cs b/src/WebExpress.WebApp/WebFragment/FragmentUserManagementTable.cs index ff63e37..a3d0436 100644 --- a/src/WebExpress.WebApp/WebFragment/FragmentUserManagementTable.cs +++ b/src/WebExpress.WebApp/WebFragment/FragmentUserManagementTable.cs @@ -1,4 +1,5 @@ -using WebExpress.WebApp.WebSettingPage; +using WebExpress.WebApp.WebSection; +using WebExpress.WebApp.WebSettingPage; using WebExpress.WebCore.WebAttribute; using WebExpress.WebCore.WebComponent; using WebExpress.WebCore.WebHtml; @@ -9,14 +10,14 @@ namespace WebExpress.WebApp.WebFragment { - [Section(Section.ContentPrimary)] + [Section(SectionWebApp.ContentPrimary)] [Module] [Scope] [Cache()] public sealed class FragmentUserManagementTable : FragmentCrudTable { /// - /// Constructor + /// Initializes a new instance of the class. /// public FragmentUserManagementTable() : base("4fd155dd-f6e2-4411-b6ed-14ee78713272") diff --git a/src/WebExpress.WebApp/WebIndex/IndexManager.cs b/src/WebExpress.WebApp/WebIndex/IndexManager.cs index c020100..295c9ab 100644 --- a/src/WebExpress.WebApp/WebIndex/IndexManager.cs +++ b/src/WebExpress.WebApp/WebIndex/IndexManager.cs @@ -16,7 +16,7 @@ public sealed class IndexManager : WebExpress.WebIndex.IndexManager, IComponentP public IHttpServerContext HttpServerContext { get; private set; } /// - /// Constructor + /// Initializes a new instance of the class. /// internal IndexManager() { diff --git a/src/WebExpress.WebApp/WebNotificaation/Notification.cs b/src/WebExpress.WebApp/WebNotificaation/Notification.cs index e955d1a..7742aac 100644 --- a/src/WebExpress.WebApp/WebNotificaation/Notification.cs +++ b/src/WebExpress.WebApp/WebNotificaation/Notification.cs @@ -54,7 +54,7 @@ public class Notification public TypeNotification Type { get; set; } /// - /// Constructor + /// Initializes a new instance of the class. /// public Notification() { diff --git a/src/WebExpress.WebApp/WebNotificaation/NotificationManager.cs b/src/WebExpress.WebApp/WebNotificaation/NotificationManager.cs index 60f4d32..bd4e7e8 100644 --- a/src/WebExpress.WebApp/WebNotificaation/NotificationManager.cs +++ b/src/WebExpress.WebApp/WebNotificaation/NotificationManager.cs @@ -32,7 +32,7 @@ public sealed class NotificationManager : IComponent private static IDictionary GlobalNotifications { get; } = new Dictionary(); /// - /// Constructor + /// Initializes a new instance of the class. /// internal NotificationManager() { diff --git a/src/WebExpress.WebApp/WebPage/LayoutSchema.cs b/src/WebExpress.WebApp/WebPage/LayoutSchema.cs index 3e47a91..5fc48cd 100644 --- a/src/WebExpress.WebApp/WebPage/LayoutSchema.cs +++ b/src/WebExpress.WebApp/WebPage/LayoutSchema.cs @@ -140,9 +140,9 @@ public static class LayoutSchema public static PropertyColorBackground ContentBackground => new(); /// - /// The background color of the formular area. + /// The background color of the form area. /// - public static PropertyColorBackground FormularBackground => new(TypeColorBackground.Light); + public static PropertyColorBackground FormBackground => new(TypeColorBackground.Light); /// /// The background color of a button. diff --git a/src/WebExpress.WebApp/WebPage/PageWebApp.cs b/src/WebExpress.WebApp/WebPage/PageWebApp.cs index 8415f65..dc7ac05 100644 --- a/src/WebExpress.WebApp/WebPage/PageWebApp.cs +++ b/src/WebExpress.WebApp/WebPage/PageWebApp.cs @@ -1,11 +1,11 @@ using System.Collections.Generic; using System.Linq; +using WebExpress.WebApp.WebApiControl; +using WebExpress.WebApp.WebSection; using WebExpress.WebCore.WebComponent; using WebExpress.WebCore.WebHtml; using WebExpress.WebCore.WebResource; using WebExpress.WebCore.WebUri; -using WebExpress.WebApp.WebApiControl; -using WebExpress.WebApp.WebFragment; using WebExpress.WebUI.WebControl; using WebExpress.WebUI.WebFragment; using WebExpress.WebUI.WebPage; @@ -18,55 +18,55 @@ namespace WebExpress.WebApp.WebPage public abstract class PageWebApp : PageControl { // header - private List HeaderAppNavigatorPreferences { get; } = new List(); - private List HeaderAppNavigatorPrimary { get; } = new List(); - private List HeaderAppNavigatorSecondary { get; } = new List(); - private List HeaderNavigationPreferences { get; } = new List(); - private List HeaderNavigationPrimary { get; } = new List(); - private List HeaderNavigationSecondary { get; } = new List(); - private List HeaderQuickCreatePreferences { get; } = new List(); - private List HeaderQuickCreatePrimary { get; } = new List(); - private List HeaderQuickCreateSecondary { get; } = new List(); - private List HeaderHelpPreferences { get; } = new List(); - private List HeaderHelpPrimary { get; } = new List(); - private List HeaderHelpSecondary { get; } = new List(); - private List HeaderSettingsPreferences { get; } = new List(); - private List HeaderSettingsPrimary { get; } = new List(); - private List HeaderSettingsSecondary { get; } = new List(); + private List HeaderAppNavigatorPreferences { get; } = []; + private List HeaderAppNavigatorPrimary { get; } = []; + private List HeaderAppNavigatorSecondary { get; } = []; + private List HeaderNavigationPreferences { get; } = []; + private List HeaderNavigationPrimary { get; } = []; + private List HeaderNavigationSecondary { get; } = []; + private List HeaderQuickCreatePreferences { get; } = []; + private List HeaderQuickCreatePrimary { get; } = []; + private List HeaderQuickCreateSecondary { get; } = []; + private List HeaderHelpPreferences { get; } = []; + private List HeaderHelpPrimary { get; } = []; + private List HeaderHelpSecondary { get; } = []; + private List HeaderSettingsPreferences { get; } = []; + private List HeaderSettingsPrimary { get; } = []; + private List HeaderSettingsSecondary { get; } = []; // sidebar - private List SidebarHeader { get; } = new List(); - private List SidebarPreferences { get; } = new List(); - private List SidebarPrimary { get; } = new List(); - private List SidebarSecondary { get; } = new List(); + private List SidebarHeader { get; } = []; + private List SidebarPreferences { get; } = []; + private List SidebarPrimary { get; } = []; + private List SidebarSecondary { get; } = []; // headline - private List ContentHeadlinePrologue { get; } = new List(); - private List ContentHeadlinePreferences { get; } = new List(); - private List ContentHeadlinePrimary { get; } = new List(); - private List ContentHeadlineSecondary { get; } = new List(); - private List ContentHeadlineMorePreferences { get; } = new List(); - private List ContentHeadlineMorePrimary { get; } = new List(); - private List ContentHeadlineMoreSecondary { get; } = new List(); - private List ContentHeadlineMetadata { get; } = new List(); + private List ContentHeadlinePrologue { get; } = []; + private List ContentHeadlinePreferences { get; } = []; + private List ContentHeadlinePrimary { get; } = []; + private List ContentHeadlineSecondary { get; } = []; + private List ContentHeadlineMorePreferences { get; } = []; + private List ContentHeadlineMorePrimary { get; } = []; + private List ContentHeadlineMoreSecondary { get; } = []; + private List ContentHeadlineMetadata { get; } = []; // property - private List ContentPropertyPreferences { get; } = new List(); - private List ContentPropertyPrimary { get; } = new List(); - private List ContentPropertySecondary { get; } = new List(); + private List ContentPropertyPreferences { get; } = []; + private List ContentPropertyPrimary { get; } = []; + private List ContentPropertySecondary { get; } = []; // content - private List ContentPreferences { get; } = new List(); - private List ContentPrimary { get; } = new List(); - private List ContentSecondary { get; } = new List(); + private List ContentPreferences { get; } = []; + private List ContentPrimary { get; } = []; + private List ContentSecondary { get; } = []; // footer - private List FooterPreferences { get; } = new List(); - private List FooterPrimary { get; } = new List(); - private List FooterSecondary { get; } = new List(); + private List FooterPreferences { get; } = []; + private List FooterPrimary { get; } = []; + private List FooterSecondary { get; } = []; /// - /// Constructor + /// Initializes a new instance of the class. /// public PageWebApp() { @@ -95,51 +95,51 @@ public override void Initialization(IResourceContext context) } // header - HeaderAppNavigatorPreferences.AddRange(fm.GetCacheableFragments(Section.AppPreferences, this, context.Scopes)); - HeaderAppNavigatorPrimary.AddRange(fm.GetCacheableFragments(Section.AppPrimary, this, context.Scopes)); - HeaderAppNavigatorSecondary.AddRange(fm.GetCacheableFragments(Section.AppSecondary, this, context.Scopes)); - HeaderNavigationPreferences.AddRange(fm.GetCacheableFragments(Section.AppNavigationPreferences, this, context.Scopes)); - HeaderNavigationPrimary.AddRange(fm.GetCacheableFragments(Section.AppNavigationPrimary, this, context.Scopes)); - HeaderNavigationSecondary.AddRange(fm.GetCacheableFragments(Section.AppNavigationSecondary, this, context.Scopes)); - HeaderQuickCreatePreferences.AddRange(fm.GetCacheableFragments(Section.AppQuickcreatePreferences, this, context.Scopes)); - HeaderQuickCreatePrimary.AddRange(fm.GetCacheableFragments(Section.AppQuickcreatePrimary, this, context.Scopes)); - HeaderQuickCreateSecondary.AddRange(fm.GetCacheableFragments(Section.AppQuickcreateSecondary, this, context.Scopes)); - HeaderHelpPreferences.AddRange(fm.GetCacheableFragments(Section.AppHelpPreferences, this, context.Scopes)); - HeaderHelpPrimary.AddRange(fm.GetCacheableFragments(Section.AppHelpPrimary, this, context.Scopes)); - HeaderHelpSecondary.AddRange(fm.GetCacheableFragments(Section.AppHelpSecondary, this, context.Scopes)); - HeaderSettingsPrimary.AddRange(fm.GetCacheableFragments(Section.AppSettingsPrimary, this, context.Scopes)); - HeaderSettingsSecondary.AddRange(fm.GetCacheableFragments(Section.AppSettingsSecondary, this, context.Scopes)); + HeaderAppNavigatorPreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.AppPreferences, this, context.Scopes)); + HeaderAppNavigatorPrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppPrimary, this, context.Scopes)); + HeaderAppNavigatorSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppSecondary, this, context.Scopes)); + HeaderNavigationPreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.AppNavigationPreferences, this, context.Scopes)); + HeaderNavigationPrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppNavigationPrimary, this, context.Scopes)); + HeaderNavigationSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppNavigationSecondary, this, context.Scopes)); + HeaderQuickCreatePreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.AppQuickcreatePreferences, this, context.Scopes)); + HeaderQuickCreatePrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppQuickcreatePrimary, this, context.Scopes)); + HeaderQuickCreateSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppQuickcreateSecondary, this, context.Scopes)); + HeaderHelpPreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.AppHelpPreferences, this, context.Scopes)); + HeaderHelpPrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppHelpPrimary, this, context.Scopes)); + HeaderHelpSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppHelpSecondary, this, context.Scopes)); + HeaderSettingsPrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppSettingsPrimary, this, context.Scopes)); + HeaderSettingsSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppSettingsSecondary, this, context.Scopes)); // sidebar - SidebarHeader.AddRange(fm.GetCacheableFragments(Section.SidebarHeader, this, context.Scopes)); - SidebarPreferences.AddRange(fm.GetCacheableFragments(Section.SidebarPreferences, this, context.Scopes)); - SidebarPrimary.AddRange(fm.GetCacheableFragments(Section.SidebarPrimary, this, context.Scopes)); - SidebarSecondary.AddRange(fm.GetCacheableFragments(Section.SidebarSecondary, this, context.Scopes)); + SidebarHeader.AddRange(fm.GetCacheableFragments(SectionWebApp.SidebarHeader, this, context.Scopes)); + SidebarPreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.SidebarPreferences, this, context.Scopes)); + SidebarPrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.SidebarPrimary, this, context.Scopes)); + SidebarSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.SidebarSecondary, this, context.Scopes)); // headline - ContentHeadlinePrologue.AddRange(fm.GetCacheableFragments(Section.HeadlinePrologue, this, context.Scopes)); - ContentHeadlinePreferences.AddRange(fm.GetCacheableFragments(Section.HeadlinePreferences, this, context.Scopes)); - ContentHeadlinePrimary.AddRange(fm.GetCacheableFragments(Section.HeadlinePrimary, this, context.Scopes)); - ContentHeadlineSecondary.AddRange(fm.GetCacheableFragments(Section.HeadlineSecondary, this, context.Scopes)); - ContentHeadlineMorePreferences.AddRange(fm.GetCacheableFragments(Section.MorePreferences, this, context.Scopes)); - ContentHeadlineMorePrimary.AddRange(fm.GetCacheableFragments(Section.MorePrimary, this, context.Scopes)); - ContentHeadlineMoreSecondary.AddRange(fm.GetCacheableFragments(Section.MoreSecondary, this, context.Scopes)); - ContentHeadlineMetadata.AddRange(fm.GetCacheableFragments(Section.Metadata, this, context.Scopes)); + ContentHeadlinePrologue.AddRange(fm.GetCacheableFragments(SectionWebApp.HeadlinePrologue, this, context.Scopes)); + ContentHeadlinePreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.HeadlinePreferences, this, context.Scopes)); + ContentHeadlinePrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.HeadlinePrimary, this, context.Scopes)); + ContentHeadlineSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.HeadlineSecondary, this, context.Scopes)); + ContentHeadlineMorePreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.MorePreferences, this, context.Scopes)); + ContentHeadlineMorePrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.MorePrimary, this, context.Scopes)); + ContentHeadlineMoreSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.MoreSecondary, this, context.Scopes)); + ContentHeadlineMetadata.AddRange(fm.GetCacheableFragments(SectionWebApp.Metadata, this, context.Scopes)); // property - ContentPropertyPreferences.AddRange(fm.GetCacheableFragments(Section.PropertyPreferences, this, context.Scopes)); - ContentPropertyPrimary.AddRange(fm.GetCacheableFragments(Section.PropertyPrimary, this, context.Scopes)); - ContentPropertySecondary.AddRange(fm.GetCacheableFragments(Section.PropertySecondary, this, context.Scopes)); + ContentPropertyPreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.PropertyPreferences, this, context.Scopes)); + ContentPropertyPrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.PropertyPrimary, this, context.Scopes)); + ContentPropertySecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.PropertySecondary, this, context.Scopes)); // content - ContentPreferences.AddRange(fm.GetCacheableFragments(Section.ContentPreferences, this, context.Scopes)); - ContentPrimary.AddRange(fm.GetCacheableFragments(Section.ContentPrimary, this, context.Scopes)); - ContentSecondary.AddRange(fm.GetCacheableFragments(Section.ContentSecondary, this, context.Scopes)); + ContentPreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.ContentPreferences, this, context.Scopes)); + ContentPrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.ContentPrimary, this, context.Scopes)); + ContentSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.ContentSecondary, this, context.Scopes)); // footer - FooterPreferences.AddRange(fm.GetCacheableFragments(Section.FooterPreferences, this, context.Scopes)); - FooterPrimary.AddRange(fm.GetCacheableFragments(Section.FooterPrimary, this, context.Scopes)); - FooterSecondary.AddRange(fm.GetCacheableFragments(Section.FooterSecondary, this, context.Scopes)); + FooterPreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.FooterPreferences, this, context.Scopes)); + FooterPrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.FooterPrimary, this, context.Scopes)); + FooterSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.FooterSecondary, this, context.Scopes)); } /// @@ -209,15 +209,15 @@ public override void Process(RenderContextWebApp context) var split = new ControlPanelSplit ( "split", - new Control[] { context.VisualTree.Sidebar }, - new Control[] { context.VisualTree.Content } + [context.VisualTree.Sidebar], + [context.VisualTree.Content] ) { Orientation = TypeOrientationSplit.Horizontal, SplitterColor = LayoutSchema.SplitterColor, Panel1InitialSize = 20, Panel1MinSize = 150, - Styles = new List() { "min-height: 85%;" } + Styles = ["min-height: 85%;"] }; visualTreeControl.Content.Add(context.VisualTree.Header); diff --git a/src/WebExpress.WebApp/WebPage/PageWebAppFormular.cs b/src/WebExpress.WebApp/WebPage/PageWebAppForm.cs similarity index 82% rename from src/WebExpress.WebApp/WebPage/PageWebAppFormular.cs rename to src/WebExpress.WebApp/WebPage/PageWebAppForm.cs index 6b70293..11a427d 100644 --- a/src/WebExpress.WebApp/WebPage/PageWebAppFormular.cs +++ b/src/WebExpress.WebApp/WebPage/PageWebAppForm.cs @@ -1,8 +1,8 @@ using System; +using WebExpress.WebApp.WebNotificaation; using WebExpress.WebCore.Internationalization; using WebExpress.WebCore.WebComponent; using WebExpress.WebCore.WebResource; -using WebExpress.WebApp.WebNotificaation; using WebExpress.WebUI.WebControl; namespace WebExpress.WebApp.WebPage @@ -10,7 +10,7 @@ namespace WebExpress.WebApp.WebPage /// /// A form based page. /// - public abstract class PageWebAppFormular : PageWebApp where T : ControlForm, new() + public abstract class PageWebAppForm : PageWebApp where T : ControlForm, new() { /// /// Returns the form @@ -18,18 +18,18 @@ namespace WebExpress.WebApp.WebPage protected T Form { get; private set; } /// - /// Constructor + /// Initializes a new instance of the class. /// - public PageWebAppFormular() + public PageWebAppForm() { Form = new T(); } /// - /// Constructor + /// Initializes a new instance of the class. /// /// The id. - public PageWebAppFormular(string id) + public PageWebAppForm(string id) { Form = Activator.CreateInstance(typeof(T), id) as T; } @@ -42,9 +42,9 @@ public override void Initialization(IResourceContext context) { base.Initialization(context); - Form.InitializeFormular += OnInitializeFormular; - Form.FillFormular += OnFillFormular; - Form.ProcessFormular += OnProcessFormular; + Form.InitializeForm += OnInitializeForm; + Form.FillForm += OnFillForm; + Form.ProcessForm += OnProcessForm; } /// @@ -52,7 +52,7 @@ public override void Initialization(IResourceContext context) /// /// The trigger of the event. /// The event argument. - protected virtual void OnInitializeFormular(object sender, FormularEventArgs e) + protected virtual void OnInitializeForm(object sender, FormEventArgs e) { } @@ -61,7 +61,7 @@ protected virtual void OnInitializeFormular(object sender, FormularEventArgs e) /// /// The trigger of the event. /// The event argument. - protected virtual void OnFillFormular(object sender, FormularEventArgs e) + protected virtual void OnFillForm(object sender, FormEventArgs e) { } @@ -70,7 +70,7 @@ protected virtual void OnFillFormular(object sender, FormularEventArgs e) /// /// The trigger of the event. /// The event argument./param> - protected virtual void OnProcessFormular(object sender, FormularEventArgs e) + protected virtual void OnProcessForm(object sender, FormEventArgs e) { } @@ -100,7 +100,7 @@ protected void SetRedirectUri(string redirectUri) /// The notification message. /// The notification color. /// The image. - protected void AddNotification(RenderContextFormular context, string title, string text, PropertyColorText color, string image) + protected void AddNotification(RenderContextForm context, string title, string text, PropertyColorText color, string image) { ComponentManager.GetComponent()?.AddNotification ( diff --git a/src/WebExpress.WebApp/WebPage/PageWebAppFormularConfirm.cs b/src/WebExpress.WebApp/WebPage/PageWebAppFormConfirm.cs similarity index 77% rename from src/WebExpress.WebApp/WebPage/PageWebAppFormularConfirm.cs rename to src/WebExpress.WebApp/WebPage/PageWebAppFormConfirm.cs index def9436..8385d38 100644 --- a/src/WebExpress.WebApp/WebPage/PageWebAppFormularConfirm.cs +++ b/src/WebExpress.WebApp/WebPage/PageWebAppFormConfirm.cs @@ -1,5 +1,5 @@ -using WebExpress.WebCore.WebResource; -using WebExpress.WebApp.WebControl; +using WebExpress.WebApp.WebControl; +using WebExpress.WebCore.WebResource; using WebExpress.WebUI.WebControl; namespace WebExpress.WebApp.WebPage @@ -7,21 +7,21 @@ namespace WebExpress.WebApp.WebPage /// /// A form based page. /// - public abstract class PageWebAppFormularConfirm : PageWebAppFormular where T : ControlFormularConfirm, new() + public abstract class PageWebAppFormConfirm : PageWebAppForm where T : ControlFormConfirm, new() { /// - /// Constructor + /// Initializes a new instance of the class. /// /// The id. - public PageWebAppFormularConfirm() + public PageWebAppFormConfirm() { } /// - /// Constructor + /// Initializes a new instance of the class. /// /// The id. - public PageWebAppFormularConfirm(string id) + public PageWebAppFormConfirm(string id) : base(id) { } @@ -34,7 +34,7 @@ public override void Initialization(IResourceContext context) { base.Initialization(context); - Form.Confirm += OnConfirmFormular; + Form.Confirm += OnConfirmForm; } /// @@ -42,7 +42,7 @@ public override void Initialization(IResourceContext context) /// /// The trigger of the event. /// The event argument./param> - protected virtual void OnConfirmFormular(object sender, FormularEventArgs e) + protected virtual void OnConfirmForm(object sender, FormEventArgs e) { } diff --git a/src/WebExpress.WebApp/WebPage/RenderContextWebApp.cs b/src/WebExpress.WebApp/WebPage/RenderContextWebApp.cs index 052cfcb..c93f50a 100644 --- a/src/WebExpress.WebApp/WebPage/RenderContextWebApp.cs +++ b/src/WebExpress.WebApp/WebPage/RenderContextWebApp.cs @@ -16,7 +16,7 @@ public class RenderContextWebApp : RenderContextControl } /// - /// Constructor + /// Initializes a new instance of the class. /// public RenderContextWebApp() { @@ -24,7 +24,7 @@ public RenderContextWebApp() } /// - /// Constructor + /// Initializes a new instance of the class. /// /// The page where the control is rendered. /// The request. diff --git a/src/WebExpress.WebApp/WebPage/VisualTreeWebApp.cs b/src/WebExpress.WebApp/WebPage/VisualTreeWebApp.cs index 4593535..b19b083 100644 --- a/src/WebExpress.WebApp/WebPage/VisualTreeWebApp.cs +++ b/src/WebExpress.WebApp/WebPage/VisualTreeWebApp.cs @@ -48,7 +48,7 @@ public class VisualTreeWebApp : VisualTreeControl public ControlWebAppSidebar Sidebar { get; protected set; } = new ControlWebAppSidebar("webexpress.webapp.sidebar"); /// - /// Constructor + /// Initializes a new instance of the class. /// public VisualTreeWebApp() { diff --git a/src/WebExpress.WebApp/WebResource/Asset.cs b/src/WebExpress.WebApp/WebResource/Asset.cs index 000728f..ca92562 100644 --- a/src/WebExpress.WebApp/WebResource/Asset.cs +++ b/src/WebExpress.WebApp/WebResource/Asset.cs @@ -12,7 +12,7 @@ namespace WebExpress.WebApp.WebResource public sealed class Asset : WebExpress.WebCore.WebResource.ResourceAsset { /// - /// Constructor + /// Initializes a new instance of the class. /// public Asset() { diff --git a/src/WebExpress.WebApp/WebResource/ResourceRestCrudColumn.cs b/src/WebExpress.WebApp/WebResource/ResourceRestCrudColumn.cs index 4549d58..75ff45c 100644 --- a/src/WebExpress.WebApp/WebResource/ResourceRestCrudColumn.cs +++ b/src/WebExpress.WebApp/WebResource/ResourceRestCrudColumn.cs @@ -32,7 +32,7 @@ public class ResourceRestCrudColumn public string Render { get; set; } /// - /// Constructor + /// Initializes a new instance of the class. /// /// The label of the column. public ResourceRestCrudColumn(string label) diff --git a/src/WebExpress.WebApp/WebFragment/Section.cs b/src/WebExpress.WebApp/WebSection/SectionWebApp.cs similarity index 65% rename from src/WebExpress.WebApp/WebFragment/Section.cs rename to src/WebExpress.WebApp/WebSection/SectionWebApp.cs index ea127b8..f775940 100644 --- a/src/WebExpress.WebApp/WebFragment/Section.cs +++ b/src/WebExpress.WebApp/WebSection/SectionWebApp.cs @@ -1,187 +1,187 @@ -namespace WebExpress.WebApp.WebFragment +namespace WebExpress.WebApp.WebSection { /// /// Definition of keys to identify sections in wen pages that can be occupied by components. /// - public static class Section + public static class SectionWebApp { /// - /// Returns or sets the app.preferences section. + /// Returns app.preferences section. /// public const string AppPreferences = "app.preferences"; /// - /// Returns or sets the app.primary section. + /// Returns the app.primary section. /// public const string AppPrimary = "app.primary"; /// - /// Returns or sets the app.secondary section. + /// Returns the app.secondary section. /// public const string AppSecondary = "app.secondary"; /// - /// Returns or sets the app.navigation.preferences section. + /// Returns the app.navigation.preferences section. /// public const string AppNavigationPreferences = "app.navigation.preferences"; /// - /// Returns or sets the app.navigation.primary section. + /// Returns the app.navigation.primary section. /// public const string AppNavigationPrimary = "app.navigation.primary"; /// - /// Returns or sets the app.navigation.secondary section. + /// Returns the app.navigation.secondary section. /// public const string AppNavigationSecondary = "app.navigation.secondary"; /// - /// Returns or sets the app.quickcreate.primary section. + /// Returns the app.quickcreate.primary section. /// public const string AppQuickcreatePreferences = "app.quickcreate.preferences"; /// - /// Returns or sets the app.quickcreate.primary section. + /// Returns the app.quickcreate.primary section. /// public const string AppQuickcreatePrimary = "app.quickcreate.primary"; /// - /// Returns or sets the app.quickcreate.secondary section. + /// Returns the app.quickcreate.secondary section. /// public const string AppQuickcreateSecondary = "app.quickcreate.secondary"; /// - /// Returns or sets the app.help.preferences section. + /// Returns the app.help.preferences section. /// public const string AppHelpPreferences = "app.help.preferences"; /// - /// Returns or sets the app.help.primary section. + /// Returns the app.help.primary section. /// public const string AppHelpPrimary = "app.help.primary"; /// - /// Returns or sets the app.help.secondary section. + /// Returns the app.help.secondary section. /// public const string AppHelpSecondary = "app.help.secondary"; /// - /// Returns or sets the app.settings.primary section. + /// Returns the app.settings.primary section. /// public const string AppSettingsPreferences = "app.settings.preferences"; /// - /// Returns or sets the app.settings.primary section. + /// Returns the app.settings.primary section. /// public const string AppSettingsPrimary = "app.settings.primary"; /// - /// Returns or sets the app.settings.secondary section. + /// Returns the app.settings.secondary section. /// public const string AppSettingsSecondary = "app.settings.secondary"; /// - /// Returns or sets the sidebar.header section. + /// Returns the sidebar.header section. /// public const string SidebarHeader = "sidebar.header"; /// - /// Returns or sets the sidebar.preferences section. + /// Returns the sidebar.preferences section. /// public const string SidebarPreferences = "sidebar.preferences"; /// - /// Returns or sets the sidebar.primary section. + /// Returns the sidebar.primary section. /// public const string SidebarPrimary = "sidebar.primary"; /// - /// Returns or sets the sidebar.secondary section. + /// Returns the sidebar.secondary section. /// public const string SidebarSecondary = "sidebar.secondary"; /// - /// Returns or sets the property.preferences section. + /// Returns the property.preferences section. /// public const string PropertyPreferences = "property.preferences"; /// - /// Returns or sets the property.primary section. + /// Returns the property.primary section. /// public const string PropertyPrimary = "property.primary"; /// - /// Returns or sets the property.secondary section. + /// Returns the property.secondary section. /// public const string PropertySecondary = "property.secondary"; /// - /// Returns or sets the headline.prologue section. + /// Returns the headline.prologue section. /// public const string HeadlinePrologue = "headline.prologue"; /// - /// Returns or sets the headline.preferences section. + /// Returns the headline.preferences section. /// public const string HeadlinePreferences = "headline.preferences"; /// - /// Returns or sets the headline.primary section. + /// Returns the headline.primary section. /// public const string HeadlinePrimary = "headline.primary"; /// - /// Returns or sets the headline.secondary section. + /// Returns the headline.secondary section. /// public const string HeadlineSecondary = "headline.secondary"; /// - /// Returns or sets the more.preferences section. + /// Returns the more.preferences section. /// public const string MorePreferences = "more.preferences"; /// - /// Returns or sets the more.primary section. + /// Returns the more.primary section. /// public const string MorePrimary = "more.primary"; /// - /// Returns or sets the more.secondary section. + /// Returns the more.secondary section. /// public const string MoreSecondary = "more.secondary"; /// - /// Returns or sets the metadata section. + /// Returns the metadata section. /// public const string Metadata = "metadata"; /// - /// Returns or sets the content.preferences section. + /// Returns the content.preferences section. /// public const string ContentPreferences = "content.preferences"; /// - /// Returns or sets the content.primary section. + /// Returns the content.primary section. /// public const string ContentPrimary = "content.primary"; /// - /// Returns or sets the content.secondary section. + /// Returns the content.secondary section. /// public const string ContentSecondary = "content.secondary"; /// - /// Returns or sets the footer.preferences section. + /// Returns the footer.preferences section. /// public const string FooterPreferences = "footer.preferences"; /// - /// Returns or sets the footer.primary section. + /// Returns the footer.primary section. /// public const string FooterPrimary = "footer.primary"; /// - /// Returns or sets the footer.secondary section. + /// Returns the footer.secondary section. /// public const string FooterSecondary = "footer.secondary"; diff --git a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingFormular.cs b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingForm.cs similarity index 81% rename from src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingFormular.cs rename to src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingForm.cs index dbb1fc7..ab21498 100644 --- a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingFormular.cs +++ b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingForm.cs @@ -1,9 +1,9 @@ using System; +using WebExpress.WebApp.WebNotificaation; +using WebExpress.WebApp.WebSettingPage; using WebExpress.WebCore.Internationalization; using WebExpress.WebCore.WebComponent; using WebExpress.WebCore.WebResource; -using WebExpress.WebApp.WebNotificaation; -using WebExpress.WebApp.WebSettingPage; using WebExpress.WebUI.WebControl; namespace WebExpress.WebApp.WebPage @@ -11,7 +11,7 @@ namespace WebExpress.WebApp.WebPage /// /// A form based page. /// - public abstract class PageWebAppSettingFormular : PageWebAppSetting where T : ControlForm, new() + public abstract class PageWebAppSettingForm : PageWebAppSetting where T : ControlForm, new() { /// /// Returns the form. @@ -19,18 +19,18 @@ namespace WebExpress.WebApp.WebPage protected T Form { get; private set; } /// - /// Constructor + /// Initializes a new instance of the class. /// - public PageWebAppSettingFormular() + public PageWebAppSettingForm() { Form = new T(); } /// - /// Constructor + /// Initializes a new instance of the class. /// /// The page id. - public PageWebAppSettingFormular(string id) + public PageWebAppSettingForm(string id) { Form = Activator.CreateInstance(typeof(T), id) as T; } @@ -43,9 +43,9 @@ public override void Initialization(IResourceContext context) { base.Initialization(context); - Form.InitializeFormular += OnInitializeFormular; - Form.FillFormular += OnFillFormular; - Form.ProcessFormular += OnProcessFormular; + Form.InitializeForm += OnInitializeForm; + Form.FillForm += OnFillForm; + Form.ProcessForm += OnProcessForm; } /// @@ -53,7 +53,7 @@ public override void Initialization(IResourceContext context) /// /// The trigger of the event. /// The event argument. - protected virtual void OnInitializeFormular(object sender, FormularEventArgs e) + protected virtual void OnInitializeForm(object sender, FormEventArgs e) { } @@ -62,7 +62,7 @@ protected virtual void OnInitializeFormular(object sender, FormularEventArgs e) /// /// The trigger of the event. /// The event argument. - protected virtual void OnFillFormular(object sender, FormularEventArgs e) + protected virtual void OnFillForm(object sender, FormEventArgs e) { } @@ -71,7 +71,7 @@ protected virtual void OnFillFormular(object sender, FormularEventArgs e) /// /// The trigger of the event. /// The event argument./param> - protected virtual void OnProcessFormular(object sender, FormularEventArgs e) + protected virtual void OnProcessForm(object sender, FormEventArgs e) { } @@ -101,7 +101,7 @@ protected void SetRedirectUri(string redirectUri) /// The notification message. /// The notification color. /// The image. - protected void AddNotification(RenderContextFormular context, string title, string text, PropertyColorText color, string image) + protected void AddNotification(RenderContextForm context, string title, string text, PropertyColorText color, string image) { ComponentManager.GetComponent()?.AddNotification ( diff --git a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingFormularConfirm.cs b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingFormConfirm.cs similarity index 76% rename from src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingFormularConfirm.cs rename to src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingFormConfirm.cs index 61f2c13..15adfe4 100644 --- a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingFormularConfirm.cs +++ b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingFormConfirm.cs @@ -1,5 +1,5 @@ -using WebExpress.WebCore.WebResource; -using WebExpress.WebApp.WebControl; +using WebExpress.WebApp.WebControl; +using WebExpress.WebCore.WebResource; using WebExpress.WebUI.WebControl; namespace WebExpress.WebApp.WebPage @@ -7,21 +7,21 @@ namespace WebExpress.WebApp.WebPage /// /// A form based page. /// - public abstract class PageWebAppSettingFormularConfirm : PageWebAppSettingFormular where T : ControlFormularConfirm, new() + public abstract class PageWebAppSettingFormConfirm : PageWebAppSettingForm where T : ControlFormConfirm, new() { /// - /// Constructor + /// Initializes a new instance of the class. /// /// The page id. - public PageWebAppSettingFormularConfirm() + public PageWebAppSettingFormConfirm() { } /// - /// Constructor + /// Initializes a new instance of the class. /// /// The page id. - public PageWebAppSettingFormularConfirm(string id) + public PageWebAppSettingFormConfirm(string id) : base(id) { } @@ -34,7 +34,7 @@ public override void Initialization(IResourceContext context) { base.Initialization(context); - Form.Confirm += OnConfirmFormular; + Form.Confirm += OnConfirmForm; } /// @@ -42,7 +42,7 @@ public override void Initialization(IResourceContext context) /// /// The trigger of the event. /// The event argument./param> - protected virtual void OnConfirmFormular(object sender, FormularEventArgs e) + protected virtual void OnConfirmForm(object sender, FormEventArgs e) { } diff --git a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingLog.cs b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingLog.cs index ecf6902..a935e80 100644 --- a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingLog.cs +++ b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingLog.cs @@ -36,7 +36,7 @@ public sealed class PageWebAppSettingLog : PageWebAppSetting, IScope public string DownloadUri { get; set; } /// - /// Constructor + /// Initializes a new instance of the class. /// public PageWebAppSettingLog() { @@ -62,10 +62,10 @@ public override void Process(RenderContextWebApp context) { base.Process(context); - var file = new FileInfo(context.Host.Log.Filename); + var file = new FileInfo(context.PluginContext.Host.Log.Filename); var fileSize = string.Format(new FileSizeFormatProvider() { Culture = Culture }, "{0:fs}", file.Exists ? file.Length : 0); - var deleteForm = new ControlModalFormularConfirmDelete("delte_log") + var deleteForm = new ControlModalFormConfirmDelete("delte_log") { Header = this.I18N("webexpress.webapp", "setting.logfile.delete.header"), Content = new ControlFormItemStaticText() { Text = this.I18N("webexpress.webapp", "setting.logfile.delete.description") } @@ -73,22 +73,22 @@ public override void Process(RenderContextWebApp context) deleteForm.Confirm += (s, e) => { - File.Delete(context.Host.Log.Filename); + File.Delete(context.PluginContext.Host.Log.Filename); }; - var switchOnForm = new ControlModalFormularConfirm("swichon_log") + var switchOnForm = new ControlModalFormConfirm("swichon_log") { Header = this.I18N("webexpress.webapp", "setting.logfile.switchon.header"), Content = new ControlFormItemStaticText() { Text = this.I18N("webexpress.webapp", "setting.logfile.switchon.description") }, - ButtonIcon = new PropertyIcon(TypeIcon.PowerOff), - ButtonColor = new PropertyColorButton(TypeColorButton.Success), - ButtonLabel = this.I18N("webexpress.webapp", "setting.logfile.switchon.label") + SubmitButtonIcon = new PropertyIcon(TypeIcon.PowerOff), + SubmitButtonColor = new PropertyColorButton(TypeColorButton.Success), + SubmitButtonLabel = this.I18N("webexpress.webapp", "setting.logfile.switchon.label") }; switchOnForm.Confirm += (s, e) => { - context.Host.Log.LogMode = LogMode.Override; - context.Host.Log.Info(this.I18N("webexpress.webapp", "setting.logfile.switchon.success")); + context.PluginContext.Host.Log.LogMode = LogMode.Override; + context.PluginContext.Host.Log.Info(this.I18N("webexpress.webapp", "setting.logfile.switchon.success")); }; var info = new ControlTable() { Striped = false }; @@ -100,7 +100,7 @@ public override void Process(RenderContextWebApp context) }, new ControlText() { - Text = context.Host.Log.Filename, + Text = context.PluginContext.Host.Log.Filename, Format = TypeFormatText.Code }, DownloadUri != null && file.Exists ? new ControlButtonLink() @@ -140,10 +140,10 @@ public override void Process(RenderContextWebApp context) }, new ControlText() { - Text = context.Host.Log.LogMode.ToString(), + Text = context.PluginContext.Host.Log.LogMode.ToString(), Format = TypeFormatText.Code }, - context.Host.Log.LogMode == LogMode.Off ? new ControlButton() + context.PluginContext.Host.Log.LogMode == LogMode.Off ? new ControlButton() { Text = this.I18N("webexpress.webapp", "setting.logfile.switchon.label"), Modal = new PropertyModal(TypeModal.Modal, switchOnForm), @@ -157,7 +157,7 @@ public override void Process(RenderContextWebApp context) if (file.Exists) { - var content = File.ReadLines(context.Host.Log.Filename).TakeLast(100); + var content = File.ReadLines(context.PluginContext.Host.Log.Filename).TakeLast(100); context.VisualTree.Content.Primary.Add(new ControlText() { diff --git a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingLogDownload.cs b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingLogDownload.cs index dc57aa3..f6159e2 100644 --- a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingLogDownload.cs +++ b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingLogDownload.cs @@ -18,7 +18,7 @@ namespace WebExpress.WebApp.WebSettingPage public sealed class PageWebAppSettingLogDownload : ResourceBinary { /// - /// Constructor + /// Initializes a new instance of the class. /// public PageWebAppSettingLogDownload() { diff --git a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingPlugin.cs b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingPlugin.cs index a6c40d9..8163902 100644 --- a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingPlugin.cs +++ b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingPlugin.cs @@ -72,7 +72,7 @@ public sealed class PageWebAppSettingPlugin : PageWebAppSetting, IScope /// /// Form for uploading a plugin. /// - private ControlModalFormularFileUpload ModalUploadForm { get; } = new ControlModalFormularFileUpload("plugin_upload") + private ControlModalFormFileUpload ModalUploadForm { get; } = new ControlModalFormFileUpload("plugin_upload") { Header = "webexpress.webapp:setting.plugin.upload.header" }; @@ -86,7 +86,7 @@ public sealed class PageWebAppSettingPlugin : PageWebAppSetting, IScope }; /// - /// Constructor + /// Initializes a new instance of the class. /// public PageWebAppSettingPlugin() { @@ -112,7 +112,7 @@ public override void Initialization(IResourceContext context) /// /// The trigger. /// The event argument. - private void OnUpload(object sender, FormularUploadEventArgs e) + private void OnUpload(object sender, FormUploadEventArgs e) { var task = ComponentManager.TaskManager.CreateTask(TaskId, OnTaskProcess, e); task.Run(); @@ -126,8 +126,8 @@ private void OnUpload(object sender, FormularUploadEventArgs e) private void OnTaskProcess(object sender, EventArgs e) { var task = sender as Task; - var file = (task.Arguments.FirstOrDefault() as FormularUploadEventArgs)?.File as ParameterFile; - var context = (task.Arguments.FirstOrDefault() as FormularUploadEventArgs)?.Context as RenderContext; + var file = (task.Arguments.FirstOrDefault() as FormUploadEventArgs)?.File as ParameterFile; + var context = (task.Arguments.FirstOrDefault() as FormUploadEventArgs)?.Context as RenderContext; // determine any installed package diff --git a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingSystemInformation.cs b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingSystemInformation.cs index cd36df5..ea9782b 100644 --- a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingSystemInformation.cs +++ b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingSystemInformation.cs @@ -29,7 +29,7 @@ namespace WebExpress.WebApp.WebSettingPage public sealed class PageWebAppSettingSystemInformation : PageWebAppSetting, IScope { /// - /// Constructor + /// Initializes a new instance of the class. /// public PageWebAppSettingSystemInformation() { diff --git a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingUserManagementGroup.cs b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingUserManagementGroup.cs index 57900b9..3a962d3 100644 --- a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingUserManagementGroup.cs +++ b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingUserManagementGroup.cs @@ -47,7 +47,7 @@ public sealed class PageWebAppSettingUserManagementGroup : PageWebAppSetting, IS }; /// - /// Constructor + /// Initializes a new instance of the class. /// public PageWebAppSettingUserManagementGroup() { @@ -90,7 +90,7 @@ public override void Process(RenderContextWebApp context) Text = "webexpress.webapp:setting.usermanager.group.edit.label", Uri = new UriFragment(), Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.Null), - Modal = new PropertyModal(TypeModal.Modal, new ControlModalFormularGoupEdit(group.Id) { Item = group }) + Modal = new PropertyModal(TypeModal.Modal, new ControlModalFormGoupEdit(group.Id) { Item = group }) }, new ControlText() { @@ -103,7 +103,7 @@ public override void Process(RenderContextWebApp context) TextColor = new PropertyColorText(TypeColorText.Danger), Uri = new UriFragment(), Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.Null), - Modal = new PropertyModal(TypeModal.Modal, new ControlModalFormularGroupDelete(group.Id) { Item = group }) + Modal = new PropertyModal(TypeModal.Modal, new ControlModalFormGroupDelete(group.Id) { Item = group }) } ) { diff --git a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingUserManagementUser.cs b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingUserManagementUser.cs index 400fc21..97bddc5 100644 --- a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingUserManagementUser.cs +++ b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingUserManagementUser.cs @@ -24,7 +24,7 @@ namespace WebExpress.WebApp.WebSettingPage public sealed class PageWebAppSettingUserManagementUser : PageWebAppSetting, IScope { /// - /// Constructor + /// Initializes a new instance of the class. /// public PageWebAppSettingUserManagementUser() { diff --git a/src/WebExpress.WebApp/WebStatusPage/PageStatusWebApp.cs b/src/WebExpress.WebApp/WebStatusPage/PageStatusWebApp.cs index 7cc869c..4edeac4 100644 --- a/src/WebExpress.WebApp/WebStatusPage/PageStatusWebApp.cs +++ b/src/WebExpress.WebApp/WebStatusPage/PageStatusWebApp.cs @@ -40,7 +40,7 @@ namespace WebExpress.WebApp.WebStatusPage public ControlWebAppHeader Header { get; protected set; } = new ControlWebAppHeader("header"); /// - /// Constructor + /// Initializes a new instance of the class. /// public PageStatusWebApp() { diff --git a/src/WebExpress.WebApp/WebStatusPage/PageStatusWebAppBadRequest.cs b/src/WebExpress.WebApp/WebStatusPage/PageStatusWebAppBadRequest.cs index c9c7e6f..55c9b2d 100644 --- a/src/WebExpress.WebApp/WebStatusPage/PageStatusWebAppBadRequest.cs +++ b/src/WebExpress.WebApp/WebStatusPage/PageStatusWebAppBadRequest.cs @@ -13,7 +13,7 @@ namespace WebExpress.WebApp.WebStatusPage public sealed class PageStatusWebAppBadRequest : PageStatusWebApp { /// - /// Constructor + /// Initializes a new instance of the class. /// public PageStatusWebAppBadRequest() { diff --git a/src/WebExpress.WebApp/WebStatusPage/PageStatusWebAppInternalServerError.cs b/src/WebExpress.WebApp/WebStatusPage/PageStatusWebAppInternalServerError.cs index 4b88a81..30d217c 100644 --- a/src/WebExpress.WebApp/WebStatusPage/PageStatusWebAppInternalServerError.cs +++ b/src/WebExpress.WebApp/WebStatusPage/PageStatusWebAppInternalServerError.cs @@ -13,7 +13,7 @@ namespace WebExpress.WebApp.WebStatusPage public sealed class PageStatusWebAppInternalServerError : PageStatusWebApp { /// - /// Constructor + /// Initializes a new instance of the class. /// public PageStatusWebAppInternalServerError() { diff --git a/src/WebExpress.WebApp/WebStatusPage/PageStatusWebAppNotFound.cs b/src/WebExpress.WebApp/WebStatusPage/PageStatusWebAppNotFound.cs index 277c2fa..581070a 100644 --- a/src/WebExpress.WebApp/WebStatusPage/PageStatusWebAppNotFound.cs +++ b/src/WebExpress.WebApp/WebStatusPage/PageStatusWebAppNotFound.cs @@ -13,7 +13,7 @@ namespace WebExpress.WebApp.WebStatusPage public sealed class PageStatusWebAppNotFound : PageStatusWebApp { /// - /// Constructor + /// Initializes a new instance of the class. /// public PageStatusWebAppNotFound() { From 2a389f7f3a6e80f2400fd54a3ec6466e7e17dc5c Mon Sep 17 00:00:00 2001 From: Rene Schwarzer Date: Thu, 19 Dec 2024 22:44:50 +0100 Subject: [PATCH 07/30] refactoring and add tests --- .../Fixture/NonParallelTestsCollection.cs | 11 + .../Fixture/UnitTestControlFixture.cs | 286 ++++++++++ src/WebExpress.WebApp.Test/TestApplication.cs | 44 ++ src/WebExpress.WebApp.Test/TestPage.cs | 63 +++ src/WebExpress.WebApp.Test/TestPlugin.cs | 38 ++ src/WebExpress.WebApp.Test/UnitTest.cs | 23 - .../WebControl/UnitTestControlWebAppHeader.cs | 119 ++++ ...UnitTestControlWebAppHeaderAppNavigator.cs | 33 ++ .../UnitTestControlWebAppHeaderAppTitle.cs | 33 ++ .../WebExpress.WebApp.Test.csproj | 12 +- .../WebPage/UnitTestPageManager.cs | 34 ++ src/WebExpress.WebApp/Model/WebItem.cs | 65 --- src/WebExpress.WebApp/Model/WebItemGroup.cs | 7 - src/WebExpress.WebApp/Model/WebItemUser.cs | 45 -- src/WebExpress.WebApp/Module.cs | 46 -- src/WebExpress.WebApp/Plugin.cs | 83 --- .../WebApi/V1/RestPopupNotification.cs | 108 ++-- .../WebApi/V1/RestTaskStatus.cs | 132 ++--- .../WebApi/V1/RestUserManagement.cs | 188 +++---- .../ControlApiFormItemInputSelection.cs | 120 ++--- .../ControlApiModalProgressTaskState.cs | 114 ++-- .../ControlApiNotificationPopup.cs | 102 ++-- .../ControlApiProgressBarTaskState.cs | 76 +-- .../WebApiControl/ControlApiTable.cs | 158 +++--- .../WebApiControl/ControlApiTableOption.cs | 62 +-- .../ControlApiTableOptionItem.cs | 150 +++--- .../WebApiControl/IControlApi.cs | 5 +- .../WebCondition/ConditionUnix.cs | 7 +- .../WebControl/ControlFormConfirm.cs | 168 +++--- .../WebControl/ControlFormConfirmDelete.cs | 96 ++-- .../WebControl/ControlModalFormConfirm.cs | 266 ++++----- .../ControlModalFormConfirmDelete.cs | 112 ++-- .../WebControl/ControlModalFormFileUpload.cs | 322 +++++------ .../WebControl/ControlModalFormGoupEdit.cs | 162 +++--- .../WebControl/ControlModalFormGoupNew.cs | 146 ++--- .../WebControl/ControlModalFormGroupDelete.cs | 120 ++--- .../WebControl/ControlModalFormUserDelete.cs | 116 ++-- .../WebControl/ControlModalFormUserEdit.cs | 406 +++++++------- .../WebControl/ControlModalFormUserNew.cs | 382 ++++++------- .../WebControl/ControlWebAppContent.cs | 252 ++++----- .../WebControl/ControlWebAppFooter.cs | 130 ++--- .../WebControl/ControlWebAppHeader.cs | 90 ++-- .../ControlWebAppHeaderAppNavigation.cs | 156 +++--- .../ControlWebAppHeaderAppNavigator.cs | 40 +- .../WebControl/ControlWebAppHeaderAppTitle.cs | 29 +- .../WebControl/ControlWebAppHeaderHelp.cs | 150 +++--- .../ControlWebAppHeaderQuickCreate.cs | 162 +++--- .../WebControl/ControlWebAppHeaderSettings.cs | 150 +++--- .../WebControl/ControlWebAppHeadline.cs | 332 ++++++------ .../WebControl/ControlWebAppProperty.cs | 130 ++--- .../WebControl/ControlWebAppSidebar.cs | 152 +++--- .../WebControl/FormUploadEventArgs.cs | 40 +- .../WebExpress.WebApp.csproj | 2 +- .../FragmentControlModalFormConfirmDelete.cs | 60 +-- .../WebFragment/FragmentCrudTable.cs | 140 ++--- .../FragmentCrudTableEditorItem.cs | 30 +- .../FragmentCrudTableEditorLinkItem.cs | 60 +-- .../FragmentCrudTableEditorSeperatorItem.cs | 30 +- ...FragmentHeaderSettingsSystemInformation.cs | 82 +-- .../WebFragment/FragmentPropertyReboot.cs | 194 ++++--- .../FragmentUserManagementAddGroup.cs | 108 ++-- .../FragmentUserManagementAddUser.cs | 104 ++-- .../FragmentUserManagementDescription.cs | 122 ++--- .../FragmentUserManagementTable.cs | 98 ++-- .../WebIdentity/IIdentity.cs | 6 - .../WebIdentity/IIdentityResource.cs | 6 - .../WebIdentity/IIdentityRole.cs | 6 - .../WebIdentity/IdentityDictionary.cs | 29 - .../WebIdentity/IdentityItem.cs | 6 - .../WebIdentity/IdentityManager.cs | 162 ------ .../WebIdentity/IdentityResourceItem.cs | 6 - .../WebIdentity/IdentityRoleItem.cs | 6 - .../WebIndex/IndexManager.cs | 158 +++--- .../WebJob/JobSessionCleaning.cs | 52 +- .../WebNotificaation/Notification.cs | 126 ++--- .../WebNotificaation/NotificationManager.cs | 506 +++++++++--------- .../SessionPropertyNotification.cs | 26 +- .../WebNotificaation/TypeNotification.cs | 90 ++-- .../TypeNotificationConverter.cs | 66 +-- src/WebExpress.WebApp/WebPage/LayoutSchema.cs | 394 +++++++------- src/WebExpress.WebApp/WebPage/PageWebApp.cs | 468 ++++++++-------- .../WebPage/PageWebAppForm.cs | 242 ++++----- .../WebPage/PageWebAppFormConfirm.cs | 136 ++--- .../WebPage/RenderContextWebApp.cs | 84 +-- .../WebPage/VisualTreeWebApp.cs | 169 ++++-- src/WebExpress.WebApp/WebResource/Asset.cs | 40 +- .../WebResource/Pagination.cs | 36 +- .../WebResource/ResourceRestCrud.cs | 150 +++--- .../WebResource/ResourceRestCrudColumn.cs | 76 +-- .../WebSettingPage/PageWebAppSetting.cs | 338 ++++++------ .../WebSettingPage/PageWebAppSettingForm.cs | 244 ++++----- .../PageWebAppSettingFormConfirm.cs | 136 ++--- .../WebSettingPage/PageWebAppSettingLog.cs | 352 ++++++------ .../PageWebAppSettingLogDownload.cs | 86 +-- .../WebSettingPage/PageWebAppSettingPlugin.cs | 484 ++++++++--------- .../PageWebAppSettingSystemInformation.cs | 162 +++--- .../PageWebAppSettingUserManagementGroup.cs | 228 ++++---- .../PageWebAppSettingUserManagementUser.cs | 98 ++-- .../WebStatusPage/PageStatusWebApp.cs | 258 ++++----- .../PageStatusWebAppBadRequest.cs | 62 +-- .../PageStatusWebAppInternalServerError.cs | 62 +-- .../WebStatusPage/PageStatusWebAppNotFound.cs | 64 +-- src/WebExpress.WebApp/WebUser/Group.cs | 56 +- .../WebUser/Model/WebItem.cs | 65 +++ .../WebUser/Model/WebItemGroup.cs | 7 + .../WebUser/Model/WebItemUser.cs | 45 ++ src/WebExpress.WebApp/WebUser/User.cs | 122 ++--- src/WebExpress.WebApp/WebUser/UserManager.cs | 466 ++++++++-------- 108 files changed, 7011 insertions(+), 6673 deletions(-) create mode 100644 src/WebExpress.WebApp.Test/Fixture/NonParallelTestsCollection.cs create mode 100644 src/WebExpress.WebApp.Test/Fixture/UnitTestControlFixture.cs create mode 100644 src/WebExpress.WebApp.Test/TestApplication.cs create mode 100644 src/WebExpress.WebApp.Test/TestPage.cs create mode 100644 src/WebExpress.WebApp.Test/TestPlugin.cs delete mode 100644 src/WebExpress.WebApp.Test/UnitTest.cs create mode 100644 src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeader.cs create mode 100644 src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderAppNavigator.cs create mode 100644 src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderAppTitle.cs create mode 100644 src/WebExpress.WebApp.Test/WebPage/UnitTestPageManager.cs delete mode 100644 src/WebExpress.WebApp/Model/WebItem.cs delete mode 100644 src/WebExpress.WebApp/Model/WebItemGroup.cs delete mode 100644 src/WebExpress.WebApp/Model/WebItemUser.cs delete mode 100644 src/WebExpress.WebApp/Module.cs delete mode 100644 src/WebExpress.WebApp/Plugin.cs delete mode 100644 src/WebExpress.WebApp/WebIdentity/IIdentity.cs delete mode 100644 src/WebExpress.WebApp/WebIdentity/IIdentityResource.cs delete mode 100644 src/WebExpress.WebApp/WebIdentity/IIdentityRole.cs delete mode 100644 src/WebExpress.WebApp/WebIdentity/IdentityDictionary.cs delete mode 100644 src/WebExpress.WebApp/WebIdentity/IdentityItem.cs delete mode 100644 src/WebExpress.WebApp/WebIdentity/IdentityManager.cs delete mode 100644 src/WebExpress.WebApp/WebIdentity/IdentityResourceItem.cs delete mode 100644 src/WebExpress.WebApp/WebIdentity/IdentityRoleItem.cs create mode 100644 src/WebExpress.WebApp/WebUser/Model/WebItem.cs create mode 100644 src/WebExpress.WebApp/WebUser/Model/WebItemGroup.cs create mode 100644 src/WebExpress.WebApp/WebUser/Model/WebItemUser.cs diff --git a/src/WebExpress.WebApp.Test/Fixture/NonParallelTestsCollection.cs b/src/WebExpress.WebApp.Test/Fixture/NonParallelTestsCollection.cs new file mode 100644 index 0000000..bf57e89 --- /dev/null +++ b/src/WebExpress.WebApp.Test/Fixture/NonParallelTestsCollection.cs @@ -0,0 +1,11 @@ +namespace WebExpress.WebApp.Test.Fixture +{ + /// + /// Defines a collection of tests that should not be run in parallel. + /// + [CollectionDefinition("NonParallelTests", DisableParallelization = true)] + public class NonParallelTestsCollection : ICollectionFixture + { + + } +} diff --git a/src/WebExpress.WebApp.Test/Fixture/UnitTestControlFixture.cs b/src/WebExpress.WebApp.Test/Fixture/UnitTestControlFixture.cs new file mode 100644 index 0000000..e37905b --- /dev/null +++ b/src/WebExpress.WebApp.Test/Fixture/UnitTestControlFixture.cs @@ -0,0 +1,286 @@ +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Http.Features; +using System.Globalization; +using System.Net; +using System.Reflection; +using System.Text; +using System.Text.RegularExpressions; +using WebExpress.WebCore; +using WebExpress.WebCore.WebApplication; +using WebExpress.WebCore.WebComponent; +using WebExpress.WebCore.WebEndpoint; +using WebExpress.WebCore.WebLog; +using WebExpress.WebCore.WebMessage; +using WebExpress.WebCore.WebPage; +using WebExpress.WebCore.WebPlugin; +using WebExpress.WebCore.WebUri; +using WebExpress.WebUI.WebComponent; +using WebExpress.WebUI.WebPage; + +namespace WebExpress.WebApp.Test.Fixture +{ + /// + /// A fixture class for unit tests, providing various mock objects and utility methods. + /// + public partial class UnitTestControlFixture : IDisposable + { + private static readonly string[] _separator = ["\r\n", "\r", "\n"]; + + [GeneratedRegex(@">\s+<")] + private static partial Regex WhitespaceRegex(); + + /// + /// Initializes a new instance of the class and boot the component manager. + /// + public UnitTestControlFixture() + { + } + + /// + /// Create a fake server context. + /// + /// The server context. + public static IHttpServerContext CreateHttpServerContextMock() + { + return new HttpServerContext + ( + "localhost", + [], + "", + Environment.CurrentDirectory, + Environment.CurrentDirectory, + Environment.CurrentDirectory, + new UriResource("/server"), + CultureInfo.GetCultureInfo("en"), + new Log() { LogMode = LogMode.Off }, + null + ); + } + + /// + /// Create a component hub. + /// + /// The component hub. + public static ComponentHub CreateComponentHubMock() + { + var ctorComponentHub = typeof(ComponentHubUI).GetConstructor + ( + BindingFlags.NonPublic | BindingFlags.Instance, + null, + [typeof(HttpServerContext)], + null + ); + + var componentHub = (ComponentHub)ctorComponentHub.Invoke([CreateHttpServerContextMock()]); + + // set static field in the webex class + var type = typeof(WebEx); + var field = type.GetField("_componentHub", BindingFlags.Static | BindingFlags.NonPublic); + + field.SetValue(null, componentHub); + + return componentHub; + } + + /// + /// Create a component hub and register the plugins. + /// + /// The component hub. + public static ComponentHub CreateAndRegisterComponentHubMock() + { + var componentHub = CreateComponentHubMock(); + var pluginManager = componentHub.PluginManager as PluginManager; + + var registerMethod = pluginManager.GetType().GetMethod("Register", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, []); + registerMethod.Invoke(pluginManager, null); + + return componentHub; + } + + /// + /// Create a fake request. + /// + /// The content of the request. + /// The URI of the request. + /// A fake request for testing. + public static Request CrerateRequestMock(string content = "", string uri = "") + { + var context = CreateHttpContextMock(content); + + var request = context.Request; + + if (!string.IsNullOrEmpty(uri)) + { + var uriProperty = typeof(Request).GetProperty("Uri", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); + uriProperty.SetValue(request, new UriResource(uri)); + } + + return request; + } + + /// + /// Create a fake http context. + /// + /// The content. + /// A fake http context for testing. + public static WebCore.WebMessage.HttpContext CreateHttpContextMock(string content = "") + { + var ctorRequest = typeof(Request).GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance, null, [typeof(IFeatureCollection), typeof(RequestHeaderFields), typeof(IHttpServerContext)], null); + var featureCollection = new FeatureCollection(); + var firstLine = content.Split('\n').FirstOrDefault(); + var lines = content.Split(_separator, StringSplitOptions.None); + var filteredLines = lines.Skip(1).TakeWhile(line => !string.IsNullOrWhiteSpace(line)); + var pos = content.Length > 0 ? content.IndexOf(filteredLines.LastOrDefault()) + filteredLines.LastOrDefault().Length + 4 : 0; + var innerContent = pos < content.Length ? content[pos..] : ""; + var contentBytes = Encoding.UTF8.GetBytes(innerContent); + + var requestFeature = new HttpRequestFeature + { + Headers = new HeaderDictionary + { + ["Host"] = "localhost", + ["Connection"] = "keep-alive", + ["ContentType"] = "text/html", + ["ContentLength"] = innerContent.Length.ToString(), + ["ContentLanguage"] = "en", + ["ContentEncoding"] = "gzip, deflate, br, zstd", + ["Accept"] = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7", + ["AcceptEncoding"] = "gzip, deflate, br, zstd", + ["AcceptLanguage"] = "de,de-DE;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6", + ["UserAgent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Edg/126.0.0.0", + ["Referer"] = "0HN50661TV8TP", + ["Cookie"] = "session=AB333C76-E73F-45E0-85FD-123320D9B85F" + }, + Body = contentBytes.Length > 0 ? new MemoryStream(contentBytes) : null, + Method = firstLine.Split(' ')?.Where(x => !string.IsNullOrEmpty(x)).FirstOrDefault() ?? "GET", + RawTarget = firstLine.Split(' ')?.Skip(1)?.FirstOrDefault()?.Split('?')?.FirstOrDefault() ?? "/", + QueryString = "?" + firstLine.Split(' ')?.Skip(1)?.FirstOrDefault()?.Split('?')?.Skip(1)?.FirstOrDefault() ?? "", + }; + + foreach (var line in filteredLines) + { + var key = line.Split(':').FirstOrDefault().Trim(); + var value = line.Split(':').Skip(1).FirstOrDefault().Trim(); + requestFeature.Headers[key] = value; + } + + requestFeature.Headers.ContentLength = contentBytes.Length; + + var requestIdentifierFeature = new HttpRequestIdentifierFeature + { + TraceIdentifier = "Ihr TraceIdentifier-Wert" + }; + + var connectionFeature = new HttpConnectionFeature + { + LocalPort = 8080, + LocalIpAddress = IPAddress.Parse("192.168.0.1"), + RemotePort = 8080, + RemoteIpAddress = IPAddress.Parse("127.0.0.1"), + ConnectionId = "0HN50661TV8TP" + }; + + featureCollection.Set(requestFeature); + featureCollection.Set(requestIdentifierFeature); + featureCollection.Set(connectionFeature); + + var componentManager = CreateComponentHubMock(); + var context = new WebCore.WebMessage.HttpContext(featureCollection, CreateHttpServerContextMock()); + + return context; + } + + /// + /// Creates a mock render context for unit testing. + /// + /// The application context. If null, defaults to null. + /// The scopes of the page. If null, defaults to null. + /// A mock render context for testing. + public static IRenderControlContext CrerateRenderContextMock(IApplicationContext applicationContext = null, IEnumerable scopes = null) + { + var request = CrerateRequestMock(); + + return new RenderControlContext(CreratePageContextMock(applicationContext, scopes), request); + } + + /// + /// Create a fake page context for unit testing. + /// + /// The application context. If null, defaults to null. + /// The scopes of the page. + /// A fake context for testing. + public static PageContext CreratePageContextMock(IApplicationContext applicationContext = null, IEnumerable scopes = null) + { + var ctorPageContext = typeof(PageContext).GetConstructor(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance, null, [typeof(IEndpointManager), typeof(Type), typeof(UriResource), typeof(IUriPathSegment)], null); + + var pageContext = (PageContext)ctorPageContext.Invoke([WebEx.ComponentHub.EndpointManager, null, new UriResource(), null]); + var applicationContextProperty = typeof(PageContext).GetProperty("ApplicationContext", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); + applicationContextProperty.SetValue(pageContext, applicationContext); + + var scopesProperty = typeof(PageContext).GetProperty("Scopes", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); + scopesProperty.SetValue(pageContext, scopes); + + return pageContext; + } + + /// + /// Gets the content of an embedded resource as a string. + /// + /// The name of the resource file. + /// The content of the embedded resource as a string. + public static string GetEmbeddedResource(string fileName) + { + var assembly = typeof(UnitTestControlFixture).Assembly; + var resourceName = assembly.GetManifestResourceNames() + .FirstOrDefault(name => name.EndsWith(fileName, StringComparison.OrdinalIgnoreCase)); + + using var stream = assembly.GetManifestResourceStream(resourceName); + using var memoryStream = new MemoryStream(); + stream.CopyTo(memoryStream); + var data = memoryStream.ToArray(); + + return Encoding.UTF8.GetString(data); + } + + /// + /// Removes all line breaks from the input string. + /// + /// The input string from which to remove line breaks. + /// A string with all line breaks removed. + public static string RemoveLineBreaks(string input) + { + if (string.IsNullOrEmpty(input)) + { + return input; + } + + // remove all line breaks + string result = input.Replace("\r\n", "").Replace("\r", "").Replace("\n", ""); + + // remove whitespace of any length between '>' and '<' + result = WhitespaceRegex().Replace(result, "><"); + + return result; + } + + /// + /// Compares two strings, allowing for placeholders in the expected string. + /// + /// The expected string, which may contain '*' as a wildcard character. + /// The actual string to compare against the expected string. + /// True if the actual string matches the expected string with placeholders; otherwise, false. + public static bool AreEqualWithPlaceholders(string expected, string actual) + { + var pattern = "^" + Regex.Escape(expected).Replace(@"\*", ".*") + "$"; + return Regex.IsMatch(actual, pattern); + } + + /// + /// Release of unmanaged resources reserved during use. + /// + public void Dispose() + { + GC.SuppressFinalize(this); + } + } +} diff --git a/src/WebExpress.WebApp.Test/TestApplication.cs b/src/WebExpress.WebApp.Test/TestApplication.cs new file mode 100644 index 0000000..087b612 --- /dev/null +++ b/src/WebExpress.WebApp.Test/TestApplication.cs @@ -0,0 +1,44 @@ +using WebExpress.WebCore.WebApplication; +using WebExpress.WebCore.WebAttribute; + +namespace WebExpress.WebApp.Test +{ + /// + /// A dummy application for testing purposes. + /// + [Name("TestApplication")] + [Description("application.description")] + [Icon("/assets/img/Logo.png")] + [ContextPath("/app")] + [AssetPath("/asset")] + [DataPath("/data")] + public sealed class TestApplication : IApplication + { + /// + /// Initializes a new instance of the class. + /// + /// The application context, for testing the injection. + private TestApplication(IApplicationContext applicationContext) + { + // test the injection + if (applicationContext == null) + { + throw new ArgumentNullException(nameof(applicationContext), "Parameter cannot be null or empty."); + } + } + + /// + /// Called when the plugin starts working. The call is concurrent. + /// + public void Run() + { + } + + /// + /// Release of unmanaged resources reserved during use. + /// + public void Dispose() + { + } + } +} diff --git a/src/WebExpress.WebApp.Test/TestPage.cs b/src/WebExpress.WebApp.Test/TestPage.cs new file mode 100644 index 0000000..025fa74 --- /dev/null +++ b/src/WebExpress.WebApp.Test/TestPage.cs @@ -0,0 +1,63 @@ +using WebExpress.WebApp.WebPage; +using WebExpress.WebCore.WebAttribute; +using WebExpress.WebCore.WebPage; + +namespace WebExpress.WebApp.Test +{ + /// + /// A dummy class for testing purposes. + /// + [Title("webindex:pagea.label")] + [Segment("pagea", "webindex:homepage.label")] + [ContextPath(null)] + public sealed class TestPage : IPage + { + /// + /// Returns or sets the title of the page. + /// + public string Title { get; set; } + + /// + /// Returns or sets the page context. + /// + public IPageContext PageContext { get; private set; } + + /// + /// Initialization of the page. Here, for example, managed resources can be loaded. + /// + /// The context of the page. + public TestPage(IPageContext pageContext) + { + PageContext = pageContext; + + // test the injection + if (pageContext == null) + { + throw new ArgumentNullException(nameof(pageContext), "Parameter cannot be null or empty."); + } + } + + /// + /// Processing of the page. + /// + /// The context for rendering the page. + /// The visual tree control to be processed. + public void Process(IRenderContext renderContext, VisualTreeWebApp visualTree) + { + // test the context + if (renderContext == null) + { + throw new ArgumentNullException(nameof(renderContext), "Parameter cannot be null or empty."); + } + + //visualTree.Content.Add(new ControlText() { Text = "Hello World" }); + } + + /// + /// Release of unmanaged resources reserved during use. + /// + public void Dispose() + { + } + } +} diff --git a/src/WebExpress.WebApp.Test/TestPlugin.cs b/src/WebExpress.WebApp.Test/TestPlugin.cs new file mode 100644 index 0000000..840a3be --- /dev/null +++ b/src/WebExpress.WebApp.Test/TestPlugin.cs @@ -0,0 +1,38 @@ +using WebExpress.WebCore.WebAttribute; +using WebExpress.WebCore.WebPlugin; + +namespace WebExpress.WebApp.Test +{ + /// + /// A dummy plugin for testing purposes. + /// + [Name("TestPlugin")] + [Description("plugin.description")] + [Icon("/assets/img/Logo.png")] + [Application()] + public sealed class TestPlugin : IPlugin + { + /// + /// Initializes a new instance of the class. + /// + /// The plugin context. + private TestPlugin(IPluginContext pluginContext) + { + + } + + /// + /// Called when the plugin starts working. The call is concurrent. + /// + public void Run() + { + } + + /// + /// Release of unmanaged resources reserved during use. + /// + public void Dispose() + { + } + } +} diff --git a/src/WebExpress.WebApp.Test/UnitTest.cs b/src/WebExpress.WebApp.Test/UnitTest.cs deleted file mode 100644 index 9e1b74f..0000000 --- a/src/WebExpress.WebApp.Test/UnitTest.cs +++ /dev/null @@ -1,23 +0,0 @@ -using WebExpress.WebCore; -using Xunit.Abstractions; - -namespace WebExpress.WebApp.Test -{ - public class UnitTest - { - public ITestOutputHelper Output { get; private set; } - - public UnitTest(ITestOutputHelper output) - { - Output = output; - } - - [Fact] - public void StartServer() - { - //Process.Start("http://localhost/"); - - WebEx.Main([]); - } - } -} diff --git a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeader.cs b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeader.cs new file mode 100644 index 0000000..a19cb75 --- /dev/null +++ b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeader.cs @@ -0,0 +1,119 @@ +using WebExpress.WebApp.Test.Fixture; +using WebExpress.WebApp.WebControl; +using WebExpress.WebUI.WebControl; + +namespace WebExpress.WebApp.Test.WebControl +{ + /// + /// Tests the web app header control. + /// + [Collection("NonParallelTests")] + public class UnitTestControlWebAppHeader + { + /// + /// Tests the id property of the web app header control. + /// + [Theory] + [InlineData(null, @"
*
")] + [InlineData("id", @"
*
")] + public void Id(string id, string expected) + { + // preconditions + UnitTestControlFixture.CreateAndRegisterComponentHubMock(); + var context = UnitTestControlFixture.CrerateRenderContextMock(); + var control = new ControlWebAppHeader(id) + { + }; + + // test execution + var html = control.Render(context); + + AssertEqualWithPlaceholders(expected, UnitTestControlFixture.RemoveLineBreaks(html.ToString())); + } + + /// + /// Tests the text color property of the web app header control. + /// + [Theory] + [InlineData(TypeColorNavbar.Primary, @"
*
")] + [InlineData(TypeColorNavbar.Secondary, @"
*
")] + [InlineData(TypeColorNavbar.Info, @"
*
")] + [InlineData(TypeColorNavbar.Success, @"
*
")] + [InlineData(TypeColorNavbar.Warning, @"
*
")] + [InlineData(TypeColorNavbar.Danger, @"
*
")] + [InlineData(TypeColorNavbar.Light, @"
*
")] + [InlineData(TypeColorNavbar.Dark, @"
*
")] + [InlineData(TypeColorNavbar.White, @"
*
")] + [InlineData(TypeColorNavbar.Transparent, @"
*
")] + public void TextColor(TypeColorNavbar textColor, string expected) + { + // preconditions + UnitTestControlFixture.CreateAndRegisterComponentHubMock(); + var context = UnitTestControlFixture.CrerateRenderContextMock(); + var control = new ControlWebAppHeader() + { + TextColor = new PropertyColorNavbar(textColor) + }; + + // test execution + var html = control.Render(context); + + AssertEqualWithPlaceholders(expected, UnitTestControlFixture.RemoveLineBreaks(html.ToString())); + } + + /// + /// Tests the fixed property of the web app header control. + /// + [Theory] + [InlineData(TypeFixed.None, @"
*
")] + [InlineData(TypeFixed.Top, @"
*
")] + [InlineData(TypeFixed.Bottom, @"
*
")] + public void Fixed(TypeFixed fixedProperty, string expected) + { + // preconditions + UnitTestControlFixture.CreateAndRegisterComponentHubMock(); + var context = UnitTestControlFixture.CrerateRenderContextMock(); + var control = new ControlWebAppHeader() + { + Fixed = fixedProperty + }; + + // test execution + var html = control.Render(context); + + AssertEqualWithPlaceholders(expected, UnitTestControlFixture.RemoveLineBreaks(html.ToString())); + } + + /// + /// Tests the sticky property of the web app header control. + /// + [Theory] + [InlineData(TypeSticky.None, @"
*
")] + [InlineData(TypeSticky.Top, @"
*
")] + public void Sticky(TypeSticky sticky, string expected) + { + // preconditions + UnitTestControlFixture.CreateAndRegisterComponentHubMock(); + var context = UnitTestControlFixture.CrerateRenderContextMock(); + var control = new ControlWebAppHeader() + { + Sticky = sticky + }; + + // test execution + var html = control.Render(context); + + AssertEqualWithPlaceholders(expected, UnitTestControlFixture.RemoveLineBreaks(html.ToString())); + } + + /// + /// Asserts that the actual string is equal to the expected string, allowing for placeholders. + /// + /// The expected string with placeholders. + /// The actual string to compare. + private void AssertEqualWithPlaceholders(string expected, string actual) + { + Assert.True(UnitTestControlFixture.AreEqualWithPlaceholders(expected, actual), $"Expected: {expected}, Actual: {actual}"); + } + } +} diff --git a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderAppNavigator.cs b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderAppNavigator.cs new file mode 100644 index 0000000..a4edf66 --- /dev/null +++ b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderAppNavigator.cs @@ -0,0 +1,33 @@ +using WebExpress.WebApp.Test.Fixture; +using WebExpress.WebApp.WebControl; + +namespace WebExpress.WebApp.Test.WebControl +{ + /// + /// Tests the web app header app navigator control. + /// + [Collection("NonParallelTests")] + public class UnitTestControlWebAppHeaderAppNavigator + { + /// + /// Tests the id property of the web app header app navigator control. + /// + [Theory] + [InlineData(null, @"")] + [InlineData("id", @"")] + public void Id(string id, string expected) + { + // preconditions + UnitTestControlFixture.CreateAndRegisterComponentHubMock(); + var context = UnitTestControlFixture.CrerateRenderContextMock(); + var control = new ControlWebAppHeaderAppNavigator(id) + { + }; + + // test execution + var html = control.Render(context); + + Assert.Equal(expected, UnitTestControlFixture.RemoveLineBreaks(html.ToString())); + } + } +} diff --git a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderAppTitle.cs b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderAppTitle.cs new file mode 100644 index 0000000..d726547 --- /dev/null +++ b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderAppTitle.cs @@ -0,0 +1,33 @@ +using WebExpress.WebApp.Test.Fixture; +using WebExpress.WebApp.WebControl; + +namespace WebExpress.WebApp.Test.WebControl +{ + /// + /// Tests the web app header app title control. + /// + [Collection("NonParallelTests")] + public class UnitTestControlWebAppHeaderAppTitle + { + /// + /// Tests the id property of the web app header app title control. + /// + [Theory] + [InlineData(null, @"

TestApplication

")] + [InlineData("id", @"

TestApplication

")] + public void Id(string id, string expected) + { + // preconditions + var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); + var context = UnitTestControlFixture.CrerateRenderContextMock(componentHub?.ApplicationManager.Applications.FirstOrDefault()); + var control = new ControlWebAppHeaderAppTitle(id) + { + }; + + // test execution + var html = control.Render(context); + + Assert.Equal(expected, UnitTestControlFixture.RemoveLineBreaks(html.ToString())); + } + } +} diff --git a/src/WebExpress.WebApp.Test/WebExpress.WebApp.Test.csproj b/src/WebExpress.WebApp.Test/WebExpress.WebApp.Test.csproj index 4198d9a..004ddce 100644 --- a/src/WebExpress.WebApp.Test/WebExpress.WebApp.Test.csproj +++ b/src/WebExpress.WebApp.Test/WebExpress.WebApp.Test.csproj @@ -1,12 +1,18 @@  - net8.0 + net9.0 enable false true + + + + + + @@ -18,10 +24,6 @@ - - - - diff --git a/src/WebExpress.WebApp.Test/WebPage/UnitTestPageManager.cs b/src/WebExpress.WebApp.Test/WebPage/UnitTestPageManager.cs new file mode 100644 index 0000000..25a72db --- /dev/null +++ b/src/WebExpress.WebApp.Test/WebPage/UnitTestPageManager.cs @@ -0,0 +1,34 @@ +using WebExpress.WebApp.Test.Fixture; + +namespace WebExpress.WebApp.Test.WebPage +{ + /// + /// Test the page manager. + /// + [Collection("NonParallelTests")] + public class UnitTestPageManager + { + /// + /// Test the id property of the page manager. + /// + [Theory] + [InlineData(typeof(TestApplication), typeof(TestPage), "webexpress.webapp.test.testpage")] + public void Id(Type applicationType, Type pageType, string id) + { + // preconditions + var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); + var application = componentHub.ApplicationManager.GetApplications(applicationType).FirstOrDefault(); + + // test execution + var page = componentHub.PageManager.GetPages(pageType, application); + + if (id == null) + { + Assert.Empty(page); + return; + } + + Assert.Contains(id, page.Select(x => x.EndpointId?.ToString())); + } + } +} diff --git a/src/WebExpress.WebApp/Model/WebItem.cs b/src/WebExpress.WebApp/Model/WebItem.cs deleted file mode 100644 index e8b21ad..0000000 --- a/src/WebExpress.WebApp/Model/WebItem.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; -using System.Text.Json.Serialization; -using WebExpress.WebIndex; -using WebExpress.WebIndex.WebAttribute; - -namespace WebExpress.WebApp.Model -{ - public class WebItem : IIndexItem - { - /// - /// Returns or sets the id. - /// - [JsonPropertyName("id")] - [IndexIgnore] - public Guid Id { get; set; } = Guid.NewGuid(); - - /// - /// Returns or sets the name. - /// - [JsonPropertyName("name")] - [IndexIgnore] - public virtual string Name { get; set; } - - /// - /// Returns or sets the uri of the web item. - /// - [JsonPropertyName("uri")] - public virtual string Uri { get; set; } - - /// - /// Returns or sets the label of the web item. - /// - [JsonPropertyName("label")] - public virtual string Label { get; set; } - - /// - /// Initializes a new instance of the class. - /// - public WebItem() - { - } - - /// - /// Copy-Constructor - /// Creates a deep copy. - /// - /// The web item to be copied. - public WebItem(WebItem item) - { - Id = item.Id; - Name = item.Name; - Uri = item.Uri; - Label = item.Label; - } - - /// - /// Conversion to string. - /// - /// The object in its string representation. - public override string ToString() - { - return $"{Label} ({Id})"; - } - } -} diff --git a/src/WebExpress.WebApp/Model/WebItemGroup.cs b/src/WebExpress.WebApp/Model/WebItemGroup.cs deleted file mode 100644 index 0b571cd..0000000 --- a/src/WebExpress.WebApp/Model/WebItemGroup.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace WebExpress.WebApp.Model -{ - public class WebItemGroup : WebItem - { - - } -} diff --git a/src/WebExpress.WebApp/Model/WebItemUser.cs b/src/WebExpress.WebApp/Model/WebItemUser.cs deleted file mode 100644 index 8dd90b5..0000000 --- a/src/WebExpress.WebApp/Model/WebItemUser.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System.Collections.Generic; - -namespace WebExpress.WebApp.Model -{ - /// - /// Represents a user in the web item context. - /// - public class WebItemUser : WebItem - { - /// - /// Returns the label of the object. - /// - public override string Label => !string.IsNullOrWhiteSpace(Firstname) ? $"{Lastname}, {Firstname}" : Lastname; - - /// - /// Returns the name of the object. - /// - public override string Name => Label; - - /// - /// Returns or sets the login name. - /// - public string Login { get; set; } - - /// - /// Returns or sets the first name. - /// - public string Firstname { get; set; } - - /// - /// Returns or sets the last name. - /// - public string Lastname { get; set; } - - /// - /// Returns or sets the email address. - /// - public string Email { get; set; } - - /// - /// Returns or sets the groups. - /// - public IEnumerable Groups { get; set; } - } -} diff --git a/src/WebExpress.WebApp/Module.cs b/src/WebExpress.WebApp/Module.cs deleted file mode 100644 index 1d02193..0000000 --- a/src/WebExpress.WebApp/Module.cs +++ /dev/null @@ -1,46 +0,0 @@ -using WebExpress.WebCore.WebAttribute; -using WebExpress.WebCore.WebModule; - -namespace WebExpress.WebApp -{ - [Application("*")] - [Name("module.name")] - [Description("module.description")] - [Icon("/assets/img/Logo.png")] - [AssetPath("/")] - [ContextPath("/modules/wxapp")] - public sealed class Module : WebCore.WebModule.Module - { - /// - /// Initializes a new instance of the class. - /// - public Module() - { - } - - /// - /// Instillation of the module. Here, for example, managed resources can be loaded. - /// - /// The context that applies to the execution of the plugin. - public override void Initialization(IModuleContext moduleContext) - { - base.Initialization(moduleContext); - } - - /// - /// Invoked when the module starts working. The call is concurrent. - /// - public override void Run() - { - base.Run(); - } - - /// - /// Release unmanaged resources that have been reserved during use. - /// - public override void Dispose() - { - base.Dispose(); - } - } -} diff --git a/src/WebExpress.WebApp/Plugin.cs b/src/WebExpress.WebApp/Plugin.cs deleted file mode 100644 index 2e7f7e0..0000000 --- a/src/WebExpress.WebApp/Plugin.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System.Collections.Generic; -using WebExpress.WebApp.WebJob; -using WebExpress.WebApp.WebScope; -using WebExpress.WebCore.WebAttribute; -using WebExpress.WebCore.WebComponent; -using WebExpress.WebCore.WebJob; -using WebExpress.WebCore.WebPage; -using WebExpress.WebCore.WebPlugin; -using WebExpress.WebCore.WebResource; -using WebExpress.WebUI.WebSettingPage; - -[assembly: SystemPlugin()] - -namespace WebExpress.WebApp -{ - [Name("WebExpress.WebApp")] - [Description("plugin.description")] - [Icon("/assets/img/Logo.png")] - [Dependency("webexpress.webui")] - public sealed class Plugin : WebCore.WebPlugin.Plugin - { - /// - /// Initializes a new instance of the class. - /// - public Plugin() - { - ComponentManager.ResourceManager.AddResource += AddResource; - } - - /// - /// Initialization of the plugin. Here, for example, managed resources can be loaded. - /// - /// The context of the plugin that applies to the execution of the plugin. - public override void Initialization(IPluginContext context) - { - base.Initialization(context); - - ComponentManager.JobManager.Register(context, new Cron(context.Host, "30", "0", "1", "*", "*")); - } - - /// - /// Called when the plugin starts working. Run is called concurrently. - /// - public override void Run() - { - base.Run(); - } - - /// - /// Release of unmanaged resources reserved during use. - /// - public override void Dispose() - { - base.Dispose(); - - ComponentManager.ResourceManager.AddResource -= AddResource; - } - - /// - /// Manipulates the new resources by adding the default scops. - /// - /// The trigger of the event. - /// The resource context. - private void AddResource(object sender, IResourceContext resourceContext) - { - if (resourceContext?.Scopes is List scopes) - { - var scopeGeneral = typeof(ScopeGeneral).FullName.ToString().ToLower(); - var scopeSetting = typeof(ScopeSetting).FullName.ToString().ToLower(); - - if (resourceContext is IPage && !scopes.Contains(scopeGeneral)) - { - scopes.Add(scopeGeneral); - } - - if (resourceContext is IPageSetting && !scopes.Contains(scopeSetting)) - { - scopes.Add(scopeSetting); - } - } - } - } -} diff --git a/src/WebExpress.WebApp/WebApi/V1/RestPopupNotification.cs b/src/WebExpress.WebApp/WebApi/V1/RestPopupNotification.cs index 2eb522b..b0dd2e2 100644 --- a/src/WebExpress.WebApp/WebApi/V1/RestPopupNotification.cs +++ b/src/WebExpress.WebApp/WebApi/V1/RestPopupNotification.cs @@ -1,59 +1,59 @@ -using System.Collections; -using WebExpress.WebCore.WebAttribute; -using WebExpress.WebCore.WebComponent; -using WebExpress.WebCore.WebMessage; -using WebExpress.WebCore.WebResource; -using WebExpress.WebApp.WebNotificaation; +//using System.Collections; +//using WebExpress.WebCore.WebAttribute; +//using WebExpress.WebCore.WebComponent; +//using WebExpress.WebCore.WebMessage; +//using WebExpress.WebCore.WebResource; +//using WebExpress.WebApp.WebNotificaation; -namespace WebExpress.WebApp.WebAPI.V1 -{ - /// - /// Returns the status and progress of a task (WebTask). - /// - [Segment("popupnotifications", "")] - [ContextPath("/api/v1")] - [Module] - [IncludeSubPaths(true)] - [Optional] - public sealed class RestPopupNotification : ResourceRest - { - /// - /// Initializes a new instance of the class. - /// - public RestPopupNotification() - { - } +//namespace WebExpress.WebApp.WebAPI.V1 +//{ +// /// +// /// Returns the status and progress of a task (WebTask). +// /// +// [Segment("popupnotifications", "")] +// [ContextPath("/api/v1")] +// [Module] +// [IncludeSubPaths(true)] +// [Optional] +// public sealed class RestPopupNotification : ResourceRest +// { +// /// +// /// Initializes a new instance of the class. +// /// +// public RestPopupNotification() +// { +// } - /// - /// Initialization - /// - /// The context. - public override void Initialization(IResourceContext context) - { - base.Initialization(context); - } +// /// +// /// Initialization +// /// +// /// The context. +// public override void Initialization(IResourceContext context) +// { +// base.Initialization(context); +// } - /// - /// Processing of the resource that was called via the get request. - /// - /// The request. - /// An enumeration that can be serialized using the JsonSerializer. - public override ICollection GetData(Request request) - { - return (ICollection)ComponentManager.GetComponent()?.GetNotifications(request); - } +// /// +// /// Processing of the resource that was called via the get request. +// /// +// /// The request. +// /// An enumeration that can be serialized using the JsonSerializer. +// public override ICollection GetData(Request request) +// { +// return (ICollection)ComponentManager.GetComponent()?.GetNotifications(request); +// } - /// - /// Processing of the resource that was called via the delete request. - /// - /// The id to delete. - /// The request. - /// The result of the deletion. - public override bool DeleteData(string id, Request request) - { - ComponentManager.GetComponent()?.RemoveNotification(request, id); +// /// +// /// Processing of the resource that was called via the delete request. +// /// +// /// The id to delete. +// /// The request. +// /// The result of the deletion. +// public override bool DeleteData(string id, Request request) +// { +// ComponentManager.GetComponent()?.RemoveNotification(request, id); - return true; - } - } -} +// return true; +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebApi/V1/RestTaskStatus.cs b/src/WebExpress.WebApp/WebApi/V1/RestTaskStatus.cs index f7921a7..8b4bf77 100644 --- a/src/WebExpress.WebApp/WebApi/V1/RestTaskStatus.cs +++ b/src/WebExpress.WebApp/WebApi/V1/RestTaskStatus.cs @@ -1,72 +1,72 @@ -using System.Collections; -using System.Linq; -using WebExpress.WebCore.WebAttribute; -using WebExpress.WebCore.WebComponent; -using WebExpress.WebCore.WebMessage; -using WebExpress.WebCore.WebResource; +//using System.Collections; +//using System.Linq; +//using WebExpress.WebCore.WebAttribute; +//using WebExpress.WebCore.WebComponent; +//using WebExpress.WebCore.WebMessage; +//using WebExpress.WebCore.WebResource; -namespace WebExpress.WebApp.WebAPI.V1 -{ - /// - /// Determines the status and progress of a task (WebTask). - /// - [Segment("taskstatus", "")] - [ContextPath("/api/v1")] - [IncludeSubPaths(true)] - [Module] - [Optional] - public sealed class RestTaskStatus : ResourceRest - { - /// - /// Initializes a new instance of the class. - /// - public RestTaskStatus() - { - } +//namespace WebExpress.WebApp.WebAPI.V1 +//{ +// /// +// /// Determines the status and progress of a task (WebTask). +// /// +// [Segment("taskstatus", "")] +// [ContextPath("/api/v1")] +// [IncludeSubPaths(true)] +// [Module] +// [Optional] +// public sealed class RestTaskStatus : ResourceRest +// { +// /// +// /// Initializes a new instance of the class. +// /// +// public RestTaskStatus() +// { +// } - /// - /// Initialization - /// - /// The context. - public override void Initialization(IResourceContext context) - { - base.Initialization(context); - } +// /// +// /// Initialization +// /// +// /// The context. +// public override void Initialization(IResourceContext context) +// { +// base.Initialization(context); +// } - /// - /// Processing of the resource. - /// - /// The request. - /// An enumeration that can be serialized using the JsonSerializer. - public override ICollection GetData(Request request) - { - var id = request.Uri.PathSegments.Last().Value; +// /// +// /// Processing of the resource. +// /// +// /// The request. +// /// An enumeration that can be serialized using the JsonSerializer. +// public override ICollection GetData(Request request) +// { +// var id = request.Uri.PathSegments.Last().Value; - if (ComponentManager.TaskManager.ContainsTask(id)) - { - var task = ComponentManager.TaskManager.GetTask(id); +// if (ComponentManager.TaskManager.ContainsTask(id)) +// { +// var task = ComponentManager.TaskManager.GetTask(id); - return new object[] - { - new - { - Id = id, - task.State, - task.Progress, - task.Message - } - }; - } +// return new object[] +// { +// new +// { +// Id = id, +// task.State, +// task.Progress, +// task.Message +// } +// }; +// } - return new object[] - { - new - { - Id = id, - State = default(string), - Progress = 0 - } - }; - } - } -} +// return new object[] +// { +// new +// { +// Id = id, +// State = default(string), +// Progress = 0 +// } +// }; +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebApi/V1/RestUserManagement.cs b/src/WebExpress.WebApp/WebApi/V1/RestUserManagement.cs index cf69863..78dccd4 100644 --- a/src/WebExpress.WebApp/WebApi/V1/RestUserManagement.cs +++ b/src/WebExpress.WebApp/WebApi/V1/RestUserManagement.cs @@ -1,100 +1,100 @@ -using System.Collections.Generic; -using System.Linq; -using WebExpress.WebCore.WebAttribute; -using WebExpress.WebCore.WebMessage; -using WebExpress.WebCore.WebResource; -using WebExpress.WebApp.Model; -using WebExpress.WebApp.WebResource; -using WebExpress.WebIndex.Wql; -using WebExpress.WebUI; -using static WebExpress.WebCore.Internationalization.InternationalizationManager; +//using System.Collections.Generic; +//using System.Linq; +//using WebExpress.WebCore.WebAttribute; +//using WebExpress.WebCore.WebMessage; +//using WebExpress.WebCore.WebResource; +//using WebExpress.WebApp.WebResource; +//using WebExpress.WebIndex.Wql; +//using WebExpress.WebUI; +//using static WebExpress.WebCore.Internationalization.InternationalizationManager; +//using WebExpress.WebApp.WebUser.Model; -namespace WebExpress.WebAPI.V1 -{ - /// - /// REST API for user management. - /// - [Segment("user", "")] - [ContextPath("/api/v1")] - [Module] - [Optional] - public sealed class RestUserManagement : ResourceRestCrud - { - /// - /// Initializes a new instance of the class. - /// - public RestUserManagement() - { - } +//namespace WebExpress.WebAPI.V1 +//{ +// /// +// /// REST API for user management. +// /// +// [Segment("user", "")] +// [ContextPath("/api/v1")] +// [Module] +// [Optional] +// public sealed class RestUserManagement : ResourceRestCrud +// { +// /// +// /// Initializes a new instance of the class. +// /// +// public RestUserManagement() +// { +// } - /// - /// Initialization - /// - /// The context. - public override void Initialization(IResourceContext context) - { - base.Initialization(context); - } +// /// +// /// Initialization +// /// +// /// The context. +// public override void Initialization(IResourceContext context) +// { +// base.Initialization(context); +// } - /// - /// Processing of the resource that was called via the get request. - /// - /// The request. - /// An enumeration of which json serializer can be serialized. - public override IEnumerable GetColumns(Request request) - { - return new ResourceRestCrudColumn[] - { - new ResourceRestCrudColumn(I18N(request, "webexpress.webapp:setting.usermanager.user.login.label")) - { - Render = "return item.Login;", - Width = 5 - }, - new ResourceRestCrudColumn(I18N(request, "webexpress.webapp:setting.usermanager.user.name.label")) - { - Render = "return item.Lastname + ', ' + item.Firstname;" - }, - new ResourceRestCrudColumn(I18N(request, "webexpress.webapp:setting.usermanager.user.groups.label")) - { - Render = "var html = '
    ' + item.Groups.map(function(group) { return '
  • ' + group.Name + '
  • '; }).join('') + '
'; return html;" - }, - new ResourceRestCrudColumn(I18N(request, "webexpress.webapp:setting.usermanager.user.email.label")) - { - Render = "return item.Email;" - } - }; - } +// /// +// /// Processing of the resource that was called via the get request. +// /// +// /// The request. +// /// An enumeration of which json serializer can be serialized. +// public override IEnumerable GetColumns(Request request) +// { +// return new ResourceRestCrudColumn[] +// { +// new ResourceRestCrudColumn(I18N(request, "webexpress.webapp:setting.usermanager.user.login.label")) +// { +// Render = "return item.Login;", +// Width = 5 +// }, +// new ResourceRestCrudColumn(I18N(request, "webexpress.webapp:setting.usermanager.user.name.label")) +// { +// Render = "return item.Lastname + ', ' + item.Firstname;" +// }, +// new ResourceRestCrudColumn(I18N(request, "webexpress.webapp:setting.usermanager.user.groups.label")) +// { +// Render = "var html = '
    ' + item.Groups.map(function(group) { return '
  • ' + group.Name + '
  • '; }).join('') + '
'; return html;" +// }, +// new ResourceRestCrudColumn(I18N(request, "webexpress.webapp:setting.usermanager.user.email.label")) +// { +// Render = "return item.Email;" +// } +// }; +// } - /// - /// Processing of the resource that was called via the get request. - /// - /// The filtering and sorting options. - /// The request. - /// An enumeration of which json serializer can be serialized. - public override IEnumerable GetData(IWqlStatement wql, Request request) - { - var users = wql.Apply(); +// /// +// /// Processing of the resource that was called via the get request. +// /// +// /// The filtering and sorting options. +// /// The request. +// /// An enumeration of which json serializer can be serialized. +// public override IEnumerable GetData(IWqlStatement wql, Request request) +// { +// var users = wql.Apply(); - return users.Select(x => new WebItemUser() - { - Id = x.Id, - Login = x.Login, - Firstname = x.Firstname, - Lastname = x.Lastname, - Email = x.Email, - Groups = x.Groups.Select(y => new WebItemGroup() { Id = y.Id, Name = y.Name }) - }); - } +// return users.Select(x => new WebItemUser() +// { +// Id = x.Id, +// Login = x.Login, +// Firstname = x.Firstname, +// Lastname = x.Lastname, +// Email = x.Email, +// Groups = x.Groups.Select(y => new WebItemGroup() { Id = y.Id, Name = y.Name }) +// }); +// } - /// - /// Processing of the resource that was called via the delete request. - /// - /// The id to delete. - /// The request. - /// The result of the deletion. - public override bool DeleteData(string id, Request request) - { - return true; - } - } -} +// /// +// /// Processing of the resource that was called via the delete request. +// /// +// /// The id to delete. +// /// The request. +// /// The result of the deletion. +// public override bool DeleteData(string id, Request request) +// { +// return true; +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebApiControl/ControlApiFormItemInputSelection.cs b/src/WebExpress.WebApp/WebApiControl/ControlApiFormItemInputSelection.cs index d4d6a13..d7079dc 100644 --- a/src/WebExpress.WebApp/WebApiControl/ControlApiFormItemInputSelection.cs +++ b/src/WebExpress.WebApp/WebApiControl/ControlApiFormItemInputSelection.cs @@ -1,67 +1,67 @@ -using System.Linq; -using System.Text; -using System.Text.Json; -using WebExpress.WebUI.WebControl; +//using System.Linq; +//using System.Text; +//using System.Text.Json; +//using WebExpress.WebUI.WebControl; -namespace WebExpress.WebApp.WebApiControl; +//namespace WebExpress.WebApp.WebApiControl; -public class ControlApiFormItemInputSelection : ControlFormItemInputSelection, IControlApi -{ - /// - /// Returns or sets the uri that determines the options. - /// - public string RestUri { get; set; } +//public class ControlApiFormItemInputSelection : ControlFormItemInputSelection, IControlApi +//{ +// /// +// /// Returns or sets the uri that determines the options. +// /// +// public string RestUri { get; set; } - /// - /// Initializes a new instance of the class. - /// - /// The control id. - public ControlApiFormItemInputSelection(string id = null) - : base(id) - { - } +// /// +// /// Initializes a new instance of the class. +// /// +// /// The control id. +// public ControlApiFormItemInputSelection(string id = null) +// : base(id) +// { +// } - /// - /// Generates the javascript to control the control. - /// - /// The context in which the control is rendered. - /// The id of the control. - /// The CSS classes that are assigned to the control. - /// The javascript code. - protected override string GetScript(RenderContextForm context, string id, string css) - { - var settings = new - { - id = id, - name = Name, - css = css, - placeholder = Placeholder, - hidedescription = HideDescription, - multiSelect = MultiSelect, - optionuri = RestUri?.ToString() - }; +// /// +// /// Generates the javascript to control the control. +// /// +// /// The context in which the control is rendered. +// /// The id of the control. +// /// The CSS classes that are assigned to the control. +// /// The javascript code. +// protected override string GetScript(RenderContextForm context, string id, string css) +// { +// var settings = new +// { +// id = id, +// name = Name, +// css = css, +// placeholder = Placeholder, +// hidedescription = HideDescription, +// multiSelect = MultiSelect, +// optionuri = RestUri?.ToString() +// }; - var jsonOptions = new JsonSerializerOptions { WriteIndented = false }; - var settingsJson = JsonSerializer.Serialize(settings, jsonOptions); - var optionsJson = JsonSerializer.Serialize(Options, jsonOptions); - var builder = new StringBuilder(); +// var jsonOptions = new JsonSerializerOptions { WriteIndented = false }; +// var settingsJson = JsonSerializer.Serialize(settings, jsonOptions); +// var optionsJson = JsonSerializer.Serialize(Options, jsonOptions); +// var builder = new StringBuilder(); - builder.AppendLine($"$(document).ready(function () {{"); - builder.AppendLine($"let settings = {settingsJson};"); - builder.AppendLine($"var options = {optionsJson};"); - builder.AppendLine($"let container = $('#{id}');"); - builder.AppendLine($"let obj = new webexpress.webapp.selectionCtrl(settings);"); - builder.AppendLine($"obj.options = options;"); - builder.AppendLine($"obj.receiveData();"); - builder.AppendLine($"obj.value = [{string.Join(",", Values.Select(x => $"'{x}'"))}];"); - builder.AppendLine($"obj.on('webexpress.webui.change.filter', function(key) {{ obj.receiveData(key); }});"); - if (OnChange != null) - { - builder.AppendLine($"obj.on('webexpress.webui.change.value', function() {{ {OnChange} }});"); - } - builder.AppendLine($"container.replaceWith(obj.getCtrl);"); - builder.AppendLine($"}});"); +// builder.AppendLine($"$(document).ready(function () {{"); +// builder.AppendLine($"let settings = {settingsJson};"); +// builder.AppendLine($"var options = {optionsJson};"); +// builder.AppendLine($"let container = $('#{id}');"); +// builder.AppendLine($"let obj = new webexpress.webapp.selectionCtrl(settings);"); +// builder.AppendLine($"obj.options = options;"); +// builder.AppendLine($"obj.receiveData();"); +// builder.AppendLine($"obj.value = [{string.Join(",", Values.Select(x => $"'{x}'"))}];"); +// builder.AppendLine($"obj.on('webexpress.webui.change.filter', function(key) {{ obj.receiveData(key); }});"); +// if (OnChange != null) +// { +// builder.AppendLine($"obj.on('webexpress.webui.change.value', function() {{ {OnChange} }});"); +// } +// builder.AppendLine($"container.replaceWith(obj.getCtrl);"); +// builder.AppendLine($"}});"); - return builder.ToString(); - } -} +// return builder.ToString(); +// } +//} diff --git a/src/WebExpress.WebApp/WebApiControl/ControlApiModalProgressTaskState.cs b/src/WebExpress.WebApp/WebApiControl/ControlApiModalProgressTaskState.cs index 29b5096..0355652 100644 --- a/src/WebExpress.WebApp/WebApiControl/ControlApiModalProgressTaskState.cs +++ b/src/WebExpress.WebApp/WebApiControl/ControlApiModalProgressTaskState.cs @@ -1,67 +1,67 @@ -using System; -using WebExpress.WebCore.WebComponent; -using WebExpress.WebCore.WebHtml; -using WebExpress.WebCore.WebPage; -using WebExpress.WebUI.WebControl; +//using System; +//using WebExpress.WebCore.WebComponent; +//using WebExpress.WebCore.WebHtml; +//using WebExpress.WebCore.WebPage; +//using WebExpress.WebUI.WebControl; -namespace WebExpress.WebApp.WebApiControl -{ - /// - /// Dialog that contains the progress bar of a web task. - /// - public class ControlApiModalProgressTaskState : ControlModal - { - /// - /// Returns or sets the progress bar. - /// - private ControlProgressBar ProgressBar { get; set; } +//namespace WebExpress.WebApp.WebApiControl +//{ +// /// +// /// Dialog that contains the progress bar of a web task. +// /// +// public class ControlApiModalProgressTaskState : ControlModal +// { +// /// +// /// Returns or sets the progress bar. +// /// +// private ControlProgressBar ProgressBar { get; set; } - /// - /// Returns or sets the progress message. - /// - private ControlText Message { get; set; } +// /// +// /// Returns or sets the progress message. +// /// +// private ControlText Message { get; set; } - /// - /// Initializes a new instance of the class. - /// - /// The control id. - public ControlApiModalProgressTaskState(string id) - : base(id ?? Guid.NewGuid().ToString()) - { - ProgressBar = new ControlProgressBar($"progressbar_{Id}") - { - Margin = new PropertySpacingMargin(PropertySpacing.Space.Two), - Color = new PropertyColorProgress(TypeColorProgress.Primary), - Format = TypeFormatProgress.Animated - }; +// /// +// /// Initializes a new instance of the class. +// /// +// /// The control id. +// public ControlApiModalProgressTaskState(string id) +// : base(id ?? Guid.NewGuid().ToString()) +// { +// ProgressBar = new ControlProgressBar($"progressbar_{Id}") +// { +// Margin = new PropertySpacingMargin(PropertySpacing.Space.Two), +// Color = new PropertyColorProgress(TypeColorProgress.Primary), +// Format = TypeFormatProgress.Animated +// }; - Message = new ControlText($"message_{Id}") - { - Margin = new PropertySpacingMargin(PropertySpacing.Space.Two), - TextColor = new PropertyColorText(TypeColorText.Secondary) - }; +// Message = new ControlText($"message_{Id}") +// { +// Margin = new PropertySpacingMargin(PropertySpacing.Space.Two), +// TextColor = new PropertyColorText(TypeColorText.Secondary) +// }; - Fade = false; - ShowIfCreated = true; +// Fade = false; +// ShowIfCreated = true; - Content.Add(ProgressBar); - Content.Add(Message); - } +// Content.Add(ProgressBar); +// Content.Add(Message); +// } - /// - /// Convert to html. - /// - /// The context in which the control is rendered. - /// The control as html. - public override IHtmlNode Render(RenderContext context) - { - var module = ComponentManager.ModuleManager.GetModule(context.ApplicationContext, typeof(Module)); - var code = $"updateTaskModal('{Id}', '{module?.ContextPath.Append("api/v1/taskstatus")}')"; +// /// +// /// Convert to html. +// /// +// /// The context in which the control is rendered. +// /// The control as html. +// public override IHtmlNode Render(RenderContext context) +// { +// var module = ComponentManager.ModuleManager.GetModule(context.ApplicationContext, typeof(Module)); +// var code = $"updateTaskModal('{Id}', '{module?.ContextPath.Append("api/v1/taskstatus")}')"; - context.VisualTree.AddScript("webexpress.webapp:controlapimodalprogresstaskstate", code); +// context.VisualTree.AddScript("webexpress.webapp:controlapimodalprogresstaskstate", code); - return base.Render(context); - } - } -} +// return base.Render(context); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebApiControl/ControlApiNotificationPopup.cs b/src/WebExpress.WebApp/WebApiControl/ControlApiNotificationPopup.cs index eef1a88..fe4d384 100644 --- a/src/WebExpress.WebApp/WebApiControl/ControlApiNotificationPopup.cs +++ b/src/WebExpress.WebApp/WebApiControl/ControlApiNotificationPopup.cs @@ -1,58 +1,58 @@ -using System; -using System.Text; -using System.Text.Json; -using WebExpress.WebCore.WebComponent; -using WebExpress.WebCore.WebHtml; -using WebExpress.WebCore.WebPage; -using WebExpress.WebUI.WebControl; +//using System; +//using System.Text; +//using System.Text.Json; +//using WebExpress.WebCore.WebComponent; +//using WebExpress.WebCore.WebHtml; +//using WebExpress.WebCore.WebPage; +//using WebExpress.WebUI.WebControl; -namespace WebExpress.WebApp.WebApiControl -{ - /// - /// Popup-Benachrichtigungen - /// - public class ControlApiNotificationPopup : ControlPanel - { - /// - /// Initializes a new instance of the class. - /// - /// Die Steuerelement-Id - public ControlApiNotificationPopup(string id = null) - : base(id ?? Guid.NewGuid().ToString()) - { - Classes.Add("popupnotification"); - } +//namespace WebExpress.WebApp.WebApiControl +//{ +// /// +// /// Popup-Benachrichtigungen +// /// +// public class ControlApiNotificationPopup : ControlPanel +// { +// /// +// /// Initializes a new instance of the class. +// /// +// /// Die Steuerelement-Id +// public ControlApiNotificationPopup(string id = null) +// : base(id ?? Guid.NewGuid().ToString()) +// { +// Classes.Add("popupnotification"); +// } - /// - /// Convert to html. - /// - /// The context in which the control is rendered. - /// The control as html. - public override IHtmlNode Render(RenderContext context) - { - var module = ComponentManager.ModuleManager.GetModule(context.ApplicationContext, typeof(Module)); +// /// +// /// Convert to html. +// /// +// /// The context in which the control is rendered. +// /// The control as html. +// public override IHtmlNode Render(RenderContext context) +// { +// var module = ComponentManager.ModuleManager.GetModule(context.ApplicationContext, typeof(Module)); - var settings = new - { - id = "26E517F5-56F7-485E-A212-6033618708F3", - resturi = module?.ContextPath.Append("api/v1/popupnotifications")?.ToString(), - intervall = 15000 - }; +// var settings = new +// { +// id = "26E517F5-56F7-485E-A212-6033618708F3", +// resturi = module?.ContextPath.Append("api/v1/popupnotifications")?.ToString(), +// intervall = 15000 +// }; - var jsonOptions = new JsonSerializerOptions { WriteIndented = false }; - var settingsJson = JsonSerializer.Serialize(settings, jsonOptions); - var builder = new StringBuilder(); +// var jsonOptions = new JsonSerializerOptions { WriteIndented = false }; +// var settingsJson = JsonSerializer.Serialize(settings, jsonOptions); +// var builder = new StringBuilder(); - builder.AppendLine($"$(document).ready(function () {{"); - builder.AppendLine($"let settings = {settingsJson};"); - builder.AppendLine($"let container = $('#{Id}');"); - builder.AppendLine($"let obj = new webexpress.webapp.popupNotificationCtrl(settings);"); - builder.AppendLine($"container.replaceWith(obj.getCtrl);"); - builder.AppendLine($"}});"); +// builder.AppendLine($"$(document).ready(function () {{"); +// builder.AppendLine($"let settings = {settingsJson};"); +// builder.AppendLine($"let container = $('#{Id}');"); +// builder.AppendLine($"let obj = new webexpress.webapp.popupNotificationCtrl(settings);"); +// builder.AppendLine($"container.replaceWith(obj.getCtrl);"); +// builder.AppendLine($"}});"); - context.VisualTree.AddScript("webexpress.webapp:controlapinotificationpopup", builder.ToString()); +// context.VisualTree.AddScript("webexpress.webapp:controlapinotificationpopup", builder.ToString()); - return base.Render(context); - } - } -} +// return base.Render(context); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebApiControl/ControlApiProgressBarTaskState.cs b/src/WebExpress.WebApp/WebApiControl/ControlApiProgressBarTaskState.cs index 00271a4..8a1f2ea 100644 --- a/src/WebExpress.WebApp/WebApiControl/ControlApiProgressBarTaskState.cs +++ b/src/WebExpress.WebApp/WebApiControl/ControlApiProgressBarTaskState.cs @@ -1,44 +1,44 @@ -using System; -using WebExpress.WebCore.WebComponent; -using WebExpress.WebCore.WebHtml; -using WebExpress.WebCore.WebPage; -using WebExpress.WebUI.WebControl; +//using System; +//using WebExpress.WebCore.WebComponent; +//using WebExpress.WebCore.WebHtml; +//using WebExpress.WebCore.WebPage; +//using WebExpress.WebUI.WebControl; -namespace WebExpress.WebApp.WebApiControl -{ - /// - /// Task progress bar. - /// - public class ControlApiProgressBarTaskState : ControlProgressBar - { - /// - /// Returns or sets the Java script function, which is called when the task is completed. - /// - public string OnFinishScript { get; set; } +//namespace WebExpress.WebApp.WebApiControl +//{ +// /// +// /// Task progress bar. +// /// +// public class ControlApiProgressBarTaskState : ControlProgressBar +// { +// /// +// /// Returns or sets the Java script function, which is called when the task is completed. +// /// +// public string OnFinishScript { get; set; } - /// - /// Initializes a new instance of the class. - /// - /// The control id. - public ControlApiProgressBarTaskState(string id) - : base(id ?? Guid.NewGuid().ToString()) - { - } +// /// +// /// Initializes a new instance of the class. +// /// +// /// The control id. +// public ControlApiProgressBarTaskState(string id) +// : base(id ?? Guid.NewGuid().ToString()) +// { +// } - /// - /// Convert to html. - /// - /// The context in which the control is rendered. - /// The control as html. - public override IHtmlNode Render(RenderContext context) - { - var module = ComponentManager.ModuleManager.GetModule(context.ApplicationContext, typeof(Module)); - var code = $"updateTaskProgressBar('{Id}', '{module?.ContextPath.Append("api/v1/taskstatus")}', {OnFinishScript});"; +// /// +// /// Convert to html. +// /// +// /// The context in which the control is rendered. +// /// The control as html. +// public override IHtmlNode Render(RenderContext context) +// { +// var module = ComponentManager.ModuleManager.GetModule(context.ApplicationContext, typeof(Module)); +// var code = $"updateTaskProgressBar('{Id}', '{module?.ContextPath.Append("api/v1/taskstatus")}', {OnFinishScript});"; - context.VisualTree.AddScript("webexpress.webapp:controlapiprogressbartaskstate", code); +// context.VisualTree.AddScript("webexpress.webapp:controlapiprogressbartaskstate", code); - return base.Render(context); - } - } -} +// return base.Render(context); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebApiControl/ControlApiTable.cs b/src/WebExpress.WebApp/WebApiControl/ControlApiTable.cs index 80ddece..7c21148 100644 --- a/src/WebExpress.WebApp/WebApiControl/ControlApiTable.cs +++ b/src/WebExpress.WebApp/WebApiControl/ControlApiTable.cs @@ -1,90 +1,90 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.Json; -using WebExpress.WebCore.WebHtml; -using WebExpress.WebCore.WebPage; -using WebExpress.WebUI.WebControl; +//using System; +//using System.Collections.Generic; +//using System.Linq; +//using System.Text; +//using System.Text.Json; +//using WebExpress.WebCore.WebHtml; +//using WebExpress.WebCore.WebPage; +//using WebExpress.WebUI.WebControl; -namespace WebExpress.WebApp.WebApiControl -{ - public class ControlApiTable : ControlPanel, IControlApi - { - /// - /// Returns or sets the uri that determines the data. - /// - public string RestUri { get; set; } +//namespace WebExpress.WebApp.WebApiControl +//{ +// public class ControlApiTable : ControlPanel, IControlApi +// { +// /// +// /// Returns or sets the uri that determines the data. +// /// +// public string RestUri { get; set; } - /// - /// Returns or sets the settings for the editing options (e.g. Edit, Delete, ...). - /// - public ControlApiTableOption OptionSettings { get; private set; } = new ControlApiTableOption(); +// /// +// /// Returns or sets the settings for the editing options (e.g. Edit, Delete, ...). +// /// +// public ControlApiTableOption OptionSettings { get; private set; } = new ControlApiTableOption(); - /// - /// Returns or sets the editing options (e.g. Edit, Delete, ...). - /// - public ICollection OptionItems { get; private set; } = new List(); +// /// +// /// Returns or sets the editing options (e.g. Edit, Delete, ...). +// /// +// public ICollection OptionItems { get; private set; } = new List(); - /// - /// Initializes a new instance of the class. - /// - /// The control id. - public ControlApiTable(string id = null) - : base(id ?? Guid.NewGuid().ToString()) - { - } +// /// +// /// Initializes a new instance of the class. +// /// +// /// The control id. +// public ControlApiTable(string id = null) +// : base(id ?? Guid.NewGuid().ToString()) +// { +// } - /// - /// Generates the javascript to control the control. - /// - /// The context in which the control is rendered. - /// The id of the control. - /// The css classes that are assigned to the control. - /// The javascript code. - protected virtual string GetScript(RenderContext context, string id, string css) - { - var settings = new - { - id = id, - css = css, - resturi = RestUri?.ToString(), - optionsettings = OptionSettings, - optionitems = OptionItems - }; +// /// +// /// Generates the javascript to control the control. +// /// +// /// The context in which the control is rendered. +// /// The id of the control. +// /// The css classes that are assigned to the control. +// /// The javascript code. +// protected virtual string GetScript(RenderContext context, string id, string css) +// { +// var settings = new +// { +// id = id, +// css = css, +// resturi = RestUri?.ToString(), +// optionsettings = OptionSettings, +// optionitems = OptionItems +// }; - var jsonOptions = new JsonSerializerOptions { WriteIndented = false }; - var settingsJson = JsonSerializer.Serialize(settings, jsonOptions); - var builder = new StringBuilder(); - builder.AppendLine($"$(document).ready(function () {{"); - builder.AppendLine($"let settings = {settingsJson};"); - builder.AppendLine($"let container = $('#{id}');"); - builder.AppendLine($"let obj = new webexpress.webapp.tableCtrl(settings);"); - builder.AppendLine($"obj.on('webexpress.webui.change.columns', function() {{ obj.receiveData(); }});"); - builder.AppendLine($"container.replaceWith(obj.getCtrl);"); - builder.AppendLine($"}});"); +// var jsonOptions = new JsonSerializerOptions { WriteIndented = false }; +// var settingsJson = JsonSerializer.Serialize(settings, jsonOptions); +// var builder = new StringBuilder(); +// builder.AppendLine($"$(document).ready(function () {{"); +// builder.AppendLine($"let settings = {settingsJson};"); +// builder.AppendLine($"let container = $('#{id}');"); +// builder.AppendLine($"let obj = new webexpress.webapp.tableCtrl(settings);"); +// builder.AppendLine($"obj.on('webexpress.webui.change.columns', function() {{ obj.receiveData(); }});"); +// builder.AppendLine($"container.replaceWith(obj.getCtrl);"); +// builder.AppendLine($"}});"); - return builder.ToString(); - } +// return builder.ToString(); +// } - /// - /// Convert to html. - /// - /// The context in which the control is rendered. - /// The control as html. - public override IHtmlNode Render(RenderContext context) - { - var classes = Classes.ToList(); +// /// +// /// Convert to html. +// /// +// /// The context in which the control is rendered. +// /// The control as html. +// public override IHtmlNode Render(RenderContext context) +// { +// var classes = Classes.ToList(); - var html = new HtmlElementTextContentDiv() - { - Id = Id, - Style = GetStyles() - }; +// var html = new HtmlElementTextContentDiv() +// { +// Id = Id, +// Style = GetStyles() +// }; - context.VisualTree.AddScript(Id, GetScript(context, Id, string.Join(" ", classes))); +// context.VisualTree.AddScript(Id, GetScript(context, Id, string.Join(" ", classes))); - return html; - } - } -} +// return html; +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebApiControl/ControlApiTableOption.cs b/src/WebExpress.WebApp/WebApiControl/ControlApiTableOption.cs index 0eac6ca..ab9814c 100644 --- a/src/WebExpress.WebApp/WebApiControl/ControlApiTableOption.cs +++ b/src/WebExpress.WebApp/WebApiControl/ControlApiTableOption.cs @@ -1,35 +1,35 @@ -using System.Text.Json.Serialization; +//using System.Text.Json.Serialization; -namespace WebExpress.WebApp.WebApiControl -{ - /// - /// Meta information of a CRUD option (e.g. Edit, Delete, ...). - /// - public class ControlApiTableOption - { - /// - /// Returns or sets the label of the option entry. Null for separators. - /// - [JsonPropertyName("label")] - public string Label { get; set; } +//namespace WebExpress.WebApp.WebApiControl +//{ +// /// +// /// Meta information of a CRUD option (e.g. Edit, Delete, ...). +// /// +// public class ControlApiTableOption +// { +// /// +// /// Returns or sets the label of the option entry. Null for separators. +// /// +// [JsonPropertyName("label")] +// public string Label { get; set; } - /// - /// Returns or sets the icon of the option entry. - /// - [JsonPropertyName("icon")] - public string Icon { get; set; } +// /// +// /// Returns or sets the icon of the option entry. +// /// +// [JsonPropertyName("icon")] +// public string Icon { get; set; } - /// - /// Returns or sets the color of the option entry. - /// - [JsonPropertyName("color")] - public string Color { get; set; } +// /// +// /// Returns or sets the color of the option entry. +// /// +// [JsonPropertyName("color")] +// public string Color { get; set; } - /// - /// Initializes a new instance of the class. - /// - public ControlApiTableOption() - { - } - } -} +// /// +// /// Initializes a new instance of the class. +// /// +// public ControlApiTableOption() +// { +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebApiControl/ControlApiTableOptionItem.cs b/src/WebExpress.WebApp/WebApiControl/ControlApiTableOptionItem.cs index f37bb85..86fc2f7 100644 --- a/src/WebExpress.WebApp/WebApiControl/ControlApiTableOptionItem.cs +++ b/src/WebExpress.WebApp/WebApiControl/ControlApiTableOptionItem.cs @@ -1,86 +1,86 @@ -using System.Text.Json.Serialization; +//using System.Text.Json.Serialization; -namespace WebExpress.WebApp.WebApiControl -{ - /// - /// Meta information of a CRUD option (e.g. Edit, Delete, ...). - /// - public class ControlApiTableOptionItem - { - /// - /// The types of an option entry. - /// - public enum OptionType { Item, Header, Divider }; +//namespace WebExpress.WebApp.WebApiControl +//{ +// /// +// /// Meta information of a CRUD option (e.g. Edit, Delete, ...). +// /// +// public class ControlApiTableOptionItem +// { +// /// +// /// The types of an option entry. +// /// +// public enum OptionType { Item, Header, Divider }; - /// - /// Returns or sets the type of an option entry. - /// - [JsonIgnore] - public OptionType Type { get; private set; } +// /// +// /// Returns or sets the type of an option entry. +// /// +// [JsonIgnore] +// public OptionType Type { get; private set; } - /// - /// Returns or sets the label of an option entry. Null for separators. - /// - [JsonPropertyName("label")] - public string Label { get; set; } +// /// +// /// Returns or sets the label of an option entry. Null for separators. +// /// +// [JsonPropertyName("label")] +// public string Label { get; set; } - /// - /// Returns or sets the icon of an option entry. - /// - [JsonPropertyName("icon")] - public string Icon { get; set; } +// /// +// /// Returns or sets the icon of an option entry. +// /// +// [JsonPropertyName("icon")] +// public string Icon { get; set; } - /// - /// Returns or sets the color of the option entry. - /// - [JsonPropertyName("color")] - public string Color { get; set; } +// /// +// /// Returns or sets the color of the option entry. +// /// +// [JsonPropertyName("color")] +// public string Color { get; set; } - /// - ///Returns or sets the uri. - /// - [JsonPropertyName("uri")] - public string Uri { get; set; } +// /// +// ///Returns or sets the uri. +// /// +// [JsonPropertyName("uri")] +// public string Uri { get; set; } - /// - /// Returns or sets the css. - /// - [JsonPropertyName("css")] - public string CSS => Type switch { OptionType.Divider => "dropdown-divider", OptionType.Header => "dropdown-header", _ => "dropdown-item" }; +// /// +// /// Returns or sets the css. +// /// +// [JsonPropertyName("css")] +// public string CSS => Type switch { OptionType.Divider => "dropdown-divider", OptionType.Header => "dropdown-header", _ => "dropdown-item" }; - /// - /// Returns or sets a function that determines whether the entry should be disabled. The value describes the - /// body of a java script function that returns a bool value (e.g. return true;). The parameter is the - /// item (data object). - /// - [JsonPropertyName("disabled")] - public string Disabled { get; set; } +// /// +// /// Returns or sets a function that determines whether the entry should be disabled. The value describes the +// /// body of a java script function that returns a bool value (e.g. return true;). The parameter is the +// /// item (data object). +// /// +// [JsonPropertyName("disabled")] +// public string Disabled { get; set; } - /// - /// Returns or sets an action to be called when the link is clicked. The value describes the body of a - /// java script function, which is called when the link is clicked (e.g. older("hello");). The parameters - /// are the item (data object) and the options (this object). - /// - [JsonPropertyName("onclick")] - public string OnClick { get; set; } +// /// +// /// Returns or sets an action to be called when the link is clicked. The value describes the body of a +// /// java script function, which is called when the link is clicked (e.g. older("hello");). The parameters +// /// are the item (data object) and the options (this object). +// /// +// [JsonPropertyName("onclick")] +// public string OnClick { get; set; } - /// - /// Initializes a new instance of the class. - /// - public ControlApiTableOptionItem() - { - Type = OptionType.Divider; - } +// /// +// /// Initializes a new instance of the class. +// /// +// public ControlApiTableOptionItem() +// { +// Type = OptionType.Divider; +// } - /// - /// Initializes a new instance of the class. - /// - /// The label of the column. - /// The type of option entry. - public ControlApiTableOptionItem(string label, OptionType type = OptionType.Item) - { - Label = label; - Type = type; - } - } -} +// /// +// /// Initializes a new instance of the class. +// /// +// /// The label of the column. +// /// The type of option entry. +// public ControlApiTableOptionItem(string label, OptionType type = OptionType.Item) +// { +// Label = label; +// Type = type; +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebApiControl/IControlApi.cs b/src/WebExpress.WebApp/WebApiControl/IControlApi.cs index ef47ae4..df9ff3c 100644 --- a/src/WebExpress.WebApp/WebApiControl/IControlApi.cs +++ b/src/WebExpress.WebApp/WebApiControl/IControlApi.cs @@ -1,6 +1,9 @@ namespace WebExpress.WebApp.WebApiControl { - internal interface IControlApi + /// + /// Interface for controlling API interactions. + /// + public interface IControlApi { /// /// Returns or sets the uri that determines the data. diff --git a/src/WebExpress.WebApp/WebCondition/ConditionUnix.cs b/src/WebExpress.WebApp/WebCondition/ConditionUnix.cs index 22db781..74590ba 100644 --- a/src/WebExpress.WebApp/WebCondition/ConditionUnix.cs +++ b/src/WebExpress.WebApp/WebCondition/ConditionUnix.cs @@ -4,13 +4,16 @@ namespace WebExpress.WebApp.WebCondition { + /// + /// Represents a condition that checks if the operating system is Unix. + /// public class ConditionUnix : ICondition { /// - /// Die Bedingung + /// Check whether the condition is fulfilled. /// /// The request. - /// true wenn die Bedingung erfüllt ist, false sonst + /// True if the condition is fulfilled, false otherwise. public bool Fulfillment(Request request) { return Environment.OSVersion.ToString().Contains("unix", StringComparison.OrdinalIgnoreCase); diff --git a/src/WebExpress.WebApp/WebControl/ControlFormConfirm.cs b/src/WebExpress.WebApp/WebControl/ControlFormConfirm.cs index 429c7c1..62970e7 100644 --- a/src/WebExpress.WebApp/WebControl/ControlFormConfirm.cs +++ b/src/WebExpress.WebApp/WebControl/ControlFormConfirm.cs @@ -1,98 +1,98 @@ -using System; -using WebExpress.WebCore.Internationalization; -using WebExpress.WebCore.WebHtml; -using WebExpress.WebCore.WebPage; -using WebExpress.WebUI.WebControl; +//using System; +//using WebExpress.WebCore.Internationalization; +//using WebExpress.WebCore.WebHtml; +//using WebExpress.WebCore.WebPage; +//using WebExpress.WebUI.WebControl; -namespace WebExpress.WebApp.WebControl -{ - public class ControlFormConfirm : ControlForm - { - /// - /// Event is triggered when deletion is confirmed. - /// - public event EventHandler Confirm; +//namespace WebExpress.WebApp.WebControl +//{ +// public class ControlFormConfirm : ControlForm +// { +// /// +// /// Event is triggered when deletion is confirmed. +// /// +// public event EventHandler Confirm; - /// - /// Returns or sets the submit button icon. - /// - public PropertyIcon SubmitButtonIcon { get => SubmitButton.Icon; set => SubmitButton.Icon = value; } +// /// +// /// Returns or sets the submit button icon. +// /// +// public PropertyIcon SubmitButtonIcon { get => SubmitButton.Icon; set => SubmitButton.Icon = value; } - /// - /// Returns or sets the submit button color. - /// - public PropertyColorButton SubmitButtonColor { get => SubmitButton.Color; set => SubmitButton.Color = value; } +// /// +// /// Returns or sets the submit button color. +// /// +// public PropertyColorButton SubmitButtonColor { get => SubmitButton.Color; set => SubmitButton.Color = value; } - /// - /// Returns or sets the submit button label. - /// - public string SubmitButtonLabel { get => SubmitButton.Text; set => SubmitButton.Text = value; } +// /// +// /// Returns or sets the submit button label. +// /// +// public string SubmitButtonLabel { get => SubmitButton.Text; set => SubmitButton.Text = value; } - /// - /// Returns or sets the submit button. - /// - private ControlFormItemButtonSubmit SubmitButton { get; set; } +// /// +// /// Returns or sets the submit button. +// /// +// private ControlFormItemButtonSubmit SubmitButton { get; set; } - /// - /// Returns or sets the content. - /// - public ControlFormItemStaticText Content { get; } = new ControlFormItemStaticText() - { - }; +// /// +// /// Returns or sets the content. +// /// +// public ControlFormItemStaticText Content { get; } = new ControlFormItemStaticText() +// { +// }; - /// - /// Initializes a new instance of the class. - /// - /// The control id. - public ControlFormConfirm(string id = null) - : base(id, null) - { - SubmitButton = new ControlFormItemButtonSubmit("submit"); - SubmitButtonColor = new PropertyColorButton(TypeColorButton.Primary); - } +// /// +// /// Initializes a new instance of the class. +// /// +// /// The control id. +// public ControlFormConfirm(string id = null) +// : base(id, null) +// { +// SubmitButton = new ControlFormItemButtonSubmit("submit"); +// SubmitButtonColor = new PropertyColorButton(TypeColorButton.Primary); +// } - /// - /// Triggers the confirm event. - /// - /// The context in which the control is rendered. - protected virtual void OnConfirm(RenderContextForm context) - { - Confirm?.Invoke(this, new FormEventArgs() { Context = context }); - } +// /// +// /// Triggers the confirm event. +// /// +// /// The context in which the control is rendered. +// protected virtual void OnConfirm(RenderContextForm context) +// { +// Confirm?.Invoke(this, new FormEventArgs() { Context = context }); +// } - /// - /// Initializes the form. - /// - /// The context in which the control is rendered. - public override void Initialize(RenderContextForm context) - { - base.Initialize(context); +// /// +// /// Initializes the form. +// /// +// /// The context in which the control is rendered. +// public override void Initialize(RenderContextForm context) +// { +// base.Initialize(context); - SubmitButtonLabel = context.Page.I18N("webexpress.webapp", "confirm.label"); - Content.Text = context.Page.I18N("webexpress.webapp", "confirm.description"); +// SubmitButtonLabel = context.Page.I18N("webexpress.webapp", "confirm.label"); +// Content.Text = context.Page.I18N("webexpress.webapp", "confirm.description"); - Add(Content); - } +// Add(Content); +// } - /// - /// Triggers the crocess event. - /// - /// The render context. - protected override void OnProcess(RenderContextForm context) - { - base.OnProcess(context); +// /// +// /// Triggers the crocess event. +// /// +// /// The render context. +// protected override void OnProcess(RenderContextForm context) +// { +// base.OnProcess(context); - OnConfirm(context); - } +// OnConfirm(context); +// } - /// - /// Convert to html. - /// - /// The context in which the control is rendered. - /// The control as html. - public override IHtmlNode Render(RenderContext context) - { - return base.Render(context); - } - } -} +// /// +// /// Convert to html. +// /// +// /// The context in which the control is rendered. +// /// The control as html. +// public override IHtmlNode Render(RenderContext context) +// { +// return base.Render(context); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebControl/ControlFormConfirmDelete.cs b/src/WebExpress.WebApp/WebControl/ControlFormConfirmDelete.cs index cac857d..bc619f2 100644 --- a/src/WebExpress.WebApp/WebControl/ControlFormConfirmDelete.cs +++ b/src/WebExpress.WebApp/WebControl/ControlFormConfirmDelete.cs @@ -1,54 +1,54 @@ -using WebExpress.WebCore.Internationalization; -using WebExpress.WebCore.WebHtml; -using WebExpress.WebCore.WebPage; -using WebExpress.WebUI.WebControl; +//using WebExpress.WebCore.Internationalization; +//using WebExpress.WebCore.WebHtml; +//using WebExpress.WebCore.WebPage; +//using WebExpress.WebUI.WebControl; -namespace WebExpress.WebApp.WebControl -{ - public class ControlFormConfirmDelete : ControlFormConfirm - { - /// - /// Initializes a new instance of the class. - /// - /// The control id. - public ControlFormConfirmDelete() - : this(null) - { - } +//namespace WebExpress.WebApp.WebControl +//{ +// public class ControlFormConfirmDelete : ControlFormConfirm +// { +// /// +// /// Initializes a new instance of the class. +// /// +// /// The control id. +// public ControlFormConfirmDelete() +// : this(null) +// { +// } - /// - /// Initializes a new instance of the class. - /// - /// The control id. - public ControlFormConfirmDelete(string id = null) - : base(id) - { - SubmitButtonIcon = new PropertyIcon(TypeIcon.TrashAlt); - SubmitButtonColor = new PropertyColorButton(TypeColorButton.Danger); - } +// /// +// /// Initializes a new instance of the class. +// /// +// /// The control id. +// public ControlFormConfirmDelete(string id = null) +// : base(id) +// { +// SubmitButtonIcon = new PropertyIcon(TypeIcon.TrashAlt); +// SubmitButtonColor = new PropertyColorButton(TypeColorButton.Danger); +// } - /// - /// Initializes the form. - /// - /// The context in which the control is rendered. - public override void Initialize(RenderContextForm context) - { - base.Initialize(context); +// /// +// /// Initializes the form. +// /// +// /// The context in which the control is rendered. +// public override void Initialize(RenderContextForm context) +// { +// base.Initialize(context); - SubmitButtonLabel = context.Page.I18N("webexpress.webapp", "delete.label"); - Content.Text = context.Page.I18N("webexpress.webapp", "delete.description"); - } +// SubmitButtonLabel = context.Page.I18N("webexpress.webapp", "delete.label"); +// Content.Text = context.Page.I18N("webexpress.webapp", "delete.description"); +// } - /// - /// Convert to html. - /// - /// The context in which the control is rendered. - /// The control as html. - public override IHtmlNode Render(RenderContext context) - { - SubmitButtonLabel = context.Page.I18N("webexpress.webapp", "delete.label"); +// /// +// /// Convert to html. +// /// +// /// The context in which the control is rendered. +// /// The control as html. +// public override IHtmlNode Render(RenderContext context) +// { +// SubmitButtonLabel = context.Page.I18N("webexpress.webapp", "delete.label"); - return base.Render(context); - } - } -} +// return base.Render(context); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebControl/ControlModalFormConfirm.cs b/src/WebExpress.WebApp/WebControl/ControlModalFormConfirm.cs index 4ffeefc..db0367e 100644 --- a/src/WebExpress.WebApp/WebControl/ControlModalFormConfirm.cs +++ b/src/WebExpress.WebApp/WebControl/ControlModalFormConfirm.cs @@ -1,133 +1,133 @@ -using System; -using System.Collections.Generic; -using WebExpress.WebCore.Internationalization; -using WebExpress.WebCore.WebHtml; -using WebExpress.WebCore.WebPage; -using WebExpress.WebUI.WebControl; - -namespace WebExpress.WebApp.WebControl -{ - /// - /// Represents a modal confirmation form. - /// - public class ControlModalFormConfirm : ControlModalForm - { - /// - /// Event is triggered when deletion is confirmed. - /// - public event EventHandler Confirm; - - /// - /// Returns or sets the submit button icon. - /// - public PropertyIcon SubmitButtonIcon { get { return SubmitButton?.Icon; } set { SubmitButton.Icon = value; } } - - /// - /// Returns or sets the submit button color. - /// - public PropertyColorButton SubmitButtonColor { get { return SubmitButton?.Color; } set { SubmitButton.Color = value; } } - - /// - /// Returns or sets the submit button label. - /// - public string SubmitButtonLabel { get; set; } - - /// - /// Returns or sets the content. - /// - public new ControlFormItem Content { get; set; } - - /// - /// Returns or sets the submit button. - /// - private ControlFormItemButtonSubmit SubmitButton { get; set; } - - /// - /// Returns or sets the redirect uri. - /// - public string RedirectUri { get { return Form?.RedirectUri; } set { Form.RedirectUri = value; } } - - /// - /// Initializes a new instance of the class. - /// - /// The id. - public ControlModalFormConfirm(string id = null) - : this(id, null) - { - - } - - /// - /// Initializes a new instance of the class. - /// - /// The id. - /// The form controls. - public ControlModalFormConfirm(string id, params ControlFormItem[] content) - : base(id, string.Empty, content) - { - Init(); - } - - /// - /// Initialization - /// - private void Init() - { - SubmitButton = new ControlFormItemButtonSubmit("submit"); - - Form.ProcessForm += (s, e) => - { - OnConfirm(e.Context); - }; - - Form.AddPrimaryButton(SubmitButton); - } - - /// - /// Triggers the Confirm event. - /// - /// The context in which the control is rendered. - protected virtual void OnConfirm(RenderContextForm context) - { - Confirm?.Invoke(this, new FormEventArgs() { Context = context }); - } - - /// - /// Convert to html. - /// - /// The context in which the control is rendered. - /// The control as html. - public override IHtmlNode Render(RenderContext context) - { - var content = Content ?? new ControlFormItemStaticText() - { - Text = context.Page.I18N("webexpress.webapp", "confirm.description") - }; - - return Render(context, [content]); - } - - /// - /// Convert to html. - /// - /// The context in which the control is rendered. - /// The form items. - /// The control as html. - public override IHtmlNode Render(RenderContext context, IEnumerable items) - { - if (string.IsNullOrWhiteSpace(Header)) - { - Header = context.Page.I18N("webexpress.webapp", "confirm.header"); - } - - if (string.IsNullOrWhiteSpace(SubmitButtonLabel)) - { - SubmitButtonLabel = context.Page.I18N("webexpress.webapp", "confirm.label"); - } - - Form.RedirectUri = RedirectUri ?? context.Uri; - - return base.Render(context, items); - } - } -} +//using System; +//using System.Collections.Generic; +//using WebExpress.WebCore.Internationalization; +//using WebExpress.WebCore.WebHtml; +//using WebExpress.WebCore.WebPage; +//using WebExpress.WebUI.WebControl; + +//namespace WebExpress.WebApp.WebControl +//{ +// /// +// /// Represents a modal confirmation form. +// /// +// public class ControlModalFormConfirm : ControlModalForm +// { +// /// +// /// Event is triggered when deletion is confirmed. +// /// +// public event EventHandler Confirm; + +// /// +// /// Returns or sets the submit button icon. +// /// +// public PropertyIcon SubmitButtonIcon { get { return SubmitButton?.Icon; } set { SubmitButton.Icon = value; } } + +// /// +// /// Returns or sets the submit button color. +// /// +// public PropertyColorButton SubmitButtonColor { get { return SubmitButton?.Color; } set { SubmitButton.Color = value; } } + +// /// +// /// Returns or sets the submit button label. +// /// +// public string SubmitButtonLabel { get; set; } + +// /// +// /// Returns or sets the content. +// /// +// public new ControlFormItem Content { get; set; } + +// /// +// /// Returns or sets the submit button. +// /// +// private ControlFormItemButtonSubmit SubmitButton { get; set; } + +// /// +// /// Returns or sets the redirect uri. +// /// +// public string RedirectUri { get { return Form?.RedirectUri; } set { Form.RedirectUri = value; } } + +// /// +// /// Initializes a new instance of the class. +// /// +// /// The id. +// public ControlModalFormConfirm(string id = null) +// : this(id, null) +// { + +// } + +// /// +// /// Initializes a new instance of the class. +// /// +// /// The id. +// /// The form controls. +// public ControlModalFormConfirm(string id, params ControlFormItem[] content) +// : base(id, string.Empty, content) +// { +// Init(); +// } + +// /// +// /// Initialization +// /// +// private void Init() +// { +// SubmitButton = new ControlFormItemButtonSubmit("submit"); + +// Form.ProcessForm += (s, e) => +// { +// OnConfirm(e.Context); +// }; + +// Form.AddPrimaryButton(SubmitButton); +// } + +// /// +// /// Triggers the Confirm event. +// /// +// /// The context in which the control is rendered. +// protected virtual void OnConfirm(RenderContextForm context) +// { +// Confirm?.Invoke(this, new FormEventArgs() { Context = context }); +// } + +// /// +// /// Convert to html. +// /// +// /// The context in which the control is rendered. +// /// The control as html. +// public override IHtmlNode Render(RenderContext context) +// { +// var content = Content ?? new ControlFormItemStaticText() +// { +// Text = context.Page.I18N("webexpress.webapp", "confirm.description") +// }; + +// return Render(context, [content]); +// } + +// /// +// /// Convert to html. +// /// +// /// The context in which the control is rendered. +// /// The form items. +// /// The control as html. +// public override IHtmlNode Render(RenderContext context, IEnumerable items) +// { +// if (string.IsNullOrWhiteSpace(Header)) +// { +// Header = context.Page.I18N("webexpress.webapp", "confirm.header"); +// } + +// if (string.IsNullOrWhiteSpace(SubmitButtonLabel)) +// { +// SubmitButtonLabel = context.Page.I18N("webexpress.webapp", "confirm.label"); +// } + +// Form.RedirectUri = RedirectUri ?? context.Uri; + +// return base.Render(context, items); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebControl/ControlModalFormConfirmDelete.cs b/src/WebExpress.WebApp/WebControl/ControlModalFormConfirmDelete.cs index 16fb6a8..3693fd0 100644 --- a/src/WebExpress.WebApp/WebControl/ControlModalFormConfirmDelete.cs +++ b/src/WebExpress.WebApp/WebControl/ControlModalFormConfirmDelete.cs @@ -1,65 +1,65 @@ -using WebExpress.WebCore.Internationalization; -using WebExpress.WebCore.WebHtml; -using WebExpress.WebCore.WebPage; -using WebExpress.WebUI.WebControl; +//using WebExpress.WebCore.Internationalization; +//using WebExpress.WebCore.WebHtml; +//using WebExpress.WebCore.WebPage; +//using WebExpress.WebUI.WebControl; -namespace WebExpress.WebApp.WebControl -{ - public class ControlModalFormConfirmDelete : ControlModalFormConfirm - { - /// - /// Initializes a new instance of the class. - /// - /// The control id. - public ControlModalFormConfirmDelete(string id = null) - : this(id, null) - { +//namespace WebExpress.WebApp.WebControl +//{ +// public class ControlModalFormConfirmDelete : ControlModalFormConfirm +// { +// /// +// /// Initializes a new instance of the class. +// /// +// /// The control id. +// public ControlModalFormConfirmDelete(string id = null) +// : this(id, null) +// { - } +// } - /// - /// Initializes a new instance of the class. - /// - /// The control id. - /// The form controls. - public ControlModalFormConfirmDelete(string id, params ControlFormItem[] content) - : base(id, content) - { - } +// /// +// /// Initializes a new instance of the class. +// /// +// /// The control id. +// /// The form controls. +// public ControlModalFormConfirmDelete(string id, params ControlFormItem[] content) +// : base(id, content) +// { +// } - /// - /// Convert to html. - /// - /// The context in which the control is rendered. - /// The control as html. - public override IHtmlNode Render(RenderContext context) - { - if (string.IsNullOrWhiteSpace(Header)) - { - Header = context.Page.I18N("webexpress.webapp", "delete.header"); - } +// /// +// /// Convert to html. +// /// +// /// The context in which the control is rendered. +// /// The control as html. +// public override IHtmlNode Render(RenderContext context) +// { +// if (string.IsNullOrWhiteSpace(Header)) +// { +// Header = context.Page.I18N("webexpress.webapp", "delete.header"); +// } - if (string.IsNullOrWhiteSpace(SubmitButtonLabel)) - { - SubmitButtonLabel = context.Page.I18N("webexpress.webapp", "delete.label"); - } +// if (string.IsNullOrWhiteSpace(SubmitButtonLabel)) +// { +// SubmitButtonLabel = context.Page.I18N("webexpress.webapp", "delete.label"); +// } - if (Content == null) - { - Content = new ControlFormItemStaticText() { Text = context.Page.I18N("webexpress.webapp", "delete.description") }; - } +// if (Content == null) +// { +// Content = new ControlFormItemStaticText() { Text = context.Page.I18N("webexpress.webapp", "delete.description") }; +// } - if (SubmitButtonIcon == null) - { - SubmitButtonIcon = new PropertyIcon(TypeIcon.TrashAlt); - } +// if (SubmitButtonIcon == null) +// { +// SubmitButtonIcon = new PropertyIcon(TypeIcon.TrashAlt); +// } - if (SubmitButtonColor == null) - { - SubmitButtonColor = new PropertyColorButton(TypeColorButton.Danger); - } +// if (SubmitButtonColor == null) +// { +// SubmitButtonColor = new PropertyColorButton(TypeColorButton.Danger); +// } - return base.Render(context); - } - } -} +// return base.Render(context); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebControl/ControlModalFormFileUpload.cs b/src/WebExpress.WebApp/WebControl/ControlModalFormFileUpload.cs index 294a12c..ced1ee2 100644 --- a/src/WebExpress.WebApp/WebControl/ControlModalFormFileUpload.cs +++ b/src/WebExpress.WebApp/WebControl/ControlModalFormFileUpload.cs @@ -1,161 +1,161 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using WebExpress.WebCore.WebHtml; -using WebExpress.WebCore.WebMessage; -using WebExpress.WebCore.WebPage; -using WebExpress.WebUI.WebControl; -using static WebExpress.WebCore.Internationalization.InternationalizationManager; - -namespace WebExpress.WebApp.WebControl -{ - public class ControlModalFormFileUpload : ControlModalForm - { - /// - /// Returns or sets the files that are accepted. - /// - public ICollection AcceptFile { get => File.AcceptFile; set => File.AcceptFile = value; } - - /// - /// Event is triggered when the upload is confirmed. - /// - public event EventHandler Upload; - - /// - /// Returns or sets the document. - /// - public ControlFormItemInputFile File { get; } = new ControlFormItemInputFile() - { - Name = "file", - Help = "webexpress.webapp:fileupload.file.description", - //Icon = new PropertyIcon(TypeIcon.Image), - //AcceptFile = new string[] { "image/*, video/*, audio/*, .pdf, .doc, .docx, .txt" }, - Margin = new PropertySpacingMargin(PropertySpacing.Space.None, PropertySpacing.Space.None, PropertySpacing.Space.None, PropertySpacing.Space.Three) - }; - - /// - /// Returns or sets the submit button icon. - /// - public PropertyIcon SubmitButtonIcon { get { return SubmitButton?.Icon; } set { SubmitButton.Icon = value; } } - - /// - /// Returns or sets the submit button color. - /// - public PropertyColorButton SubmitButtonColor { get { return SubmitButton?.Color; } set { SubmitButton.Color = value; } } - - /// - /// Returns or sets the submit button label. - /// - public string SubmitButtonLabel { get { return SubmitButton?.Text; } set { SubmitButton.Text = value; } } - - /// - /// Returns or sets the prologue area. - /// - public ControlFormItem Prologue { get; set; } - - /// - /// Returns or sets the epilogue area. - /// - public ControlFormItem Epilogue { get; set; } - - /// - /// Returns or sets the redirect uri. - /// - public string RedirectUri { get { return Form?.RedirectUri; } set { Form.RedirectUri = value; } } - - /// - /// Returns or sets the submit button. - /// - private ControlFormItemButtonSubmit SubmitButton { get; set; } - - /// - /// Initializes a new instance of the class. - /// - /// The control id. - public ControlModalFormFileUpload(string id = null) - : this(id, null) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// The control id. - /// The form controls. - public ControlModalFormFileUpload(string id, params ControlFormItem[] content) - : base(id, string.Empty, content) - { - Init(); - } - - /// - /// Initialization - /// - private void Init() - { - SubmitButton = new ControlFormItemButtonSubmit("submit"); - Header = I18N("webexpress.webapp:fileupload.header"); - SubmitButtonLabel = I18N("webexpress.webapp:fileupload.label"); - SubmitButtonIcon = new PropertyIcon(TypeIcon.Upload); - SubmitButtonColor = new PropertyColorButton(TypeColorButton.Primary); - - File.Validation += OnValidationFile; - Form.ProcessForm += OnProcessForm; - - Form.Add(File); - Form.AddPrimaryButton(SubmitButton); - - } - - /// - /// Validation of the upload file. - /// - /// The trigger of the event. - /// The event argument. - private void OnValidationFile(object sender, ValidationEventArgs e) - { - if (!(e.Context.Request.GetParameter(File.Name) is ParameterFile)) - { - e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:fileupload.file.validation.error.nofile")); - } - } - - /// - /// Processing of the form. - /// - /// The trigger of the event. - /// The event argument. - private void OnProcessForm(object sender, FormEventArgs e) - { - if (e.Context.Request.GetParameter(File.Name) is ParameterFile file) - { - OnUpload(new FormUploadEventArgs(e) { File = file }); - } - } - - /// - /// Löst das Upload-Event aus - /// - /// The event argument. - protected virtual void OnUpload(FormUploadEventArgs args) - { - Upload?.Invoke(this, args); - } - - /// - /// Convert to html. - /// - /// The context in which the control is rendered. - /// The control as html. - public override IHtmlNode Render(RenderContext context) - { - Form.RedirectUri = RedirectUri ?? context.Uri; - - var list = new[] { Epilogue } - .Concat(Form.Items) - .Concat([Prologue]); - - return base.Render(context, list.Where(x => x != null)); - } - } -} +//using System; +//using System.Collections.Generic; +//using System.Linq; +//using WebExpress.WebCore.WebHtml; +//using WebExpress.WebCore.WebMessage; +//using WebExpress.WebCore.WebPage; +//using WebExpress.WebUI.WebControl; +//using static WebExpress.WebCore.Internationalization.InternationalizationManager; + +//namespace WebExpress.WebApp.WebControl +//{ +// public class ControlModalFormFileUpload : ControlModalForm +// { +// /// +// /// Returns or sets the files that are accepted. +// /// +// public ICollection AcceptFile { get => File.AcceptFile; set => File.AcceptFile = value; } + +// /// +// /// Event is triggered when the upload is confirmed. +// /// +// public event EventHandler Upload; + +// /// +// /// Returns or sets the document. +// /// +// public ControlFormItemInputFile File { get; } = new ControlFormItemInputFile() +// { +// Name = "file", +// Help = "webexpress.webapp:fileupload.file.description", +// //Icon = new PropertyIcon(TypeIcon.Image), +// //AcceptFile = new string[] { "image/*, video/*, audio/*, .pdf, .doc, .docx, .txt" }, +// Margin = new PropertySpacingMargin(PropertySpacing.Space.None, PropertySpacing.Space.None, PropertySpacing.Space.None, PropertySpacing.Space.Three) +// }; + +// /// +// /// Returns or sets the submit button icon. +// /// +// public PropertyIcon SubmitButtonIcon { get { return SubmitButton?.Icon; } set { SubmitButton.Icon = value; } } + +// /// +// /// Returns or sets the submit button color. +// /// +// public PropertyColorButton SubmitButtonColor { get { return SubmitButton?.Color; } set { SubmitButton.Color = value; } } + +// /// +// /// Returns or sets the submit button label. +// /// +// public string SubmitButtonLabel { get { return SubmitButton?.Text; } set { SubmitButton.Text = value; } } + +// /// +// /// Returns or sets the prologue area. +// /// +// public ControlFormItem Prologue { get; set; } + +// /// +// /// Returns or sets the epilogue area. +// /// +// public ControlFormItem Epilogue { get; set; } + +// /// +// /// Returns or sets the redirect uri. +// /// +// public string RedirectUri { get { return Form?.RedirectUri; } set { Form.RedirectUri = value; } } + +// /// +// /// Returns or sets the submit button. +// /// +// private ControlFormItemButtonSubmit SubmitButton { get; set; } + +// /// +// /// Initializes a new instance of the class. +// /// +// /// The control id. +// public ControlModalFormFileUpload(string id = null) +// : this(id, null) +// { +// } + +// /// +// /// Initializes a new instance of the class. +// /// +// /// The control id. +// /// The form controls. +// public ControlModalFormFileUpload(string id, params ControlFormItem[] content) +// : base(id, string.Empty, content) +// { +// Init(); +// } + +// /// +// /// Initialization +// /// +// private void Init() +// { +// SubmitButton = new ControlFormItemButtonSubmit("submit"); +// Header = I18N("webexpress.webapp:fileupload.header"); +// SubmitButtonLabel = I18N("webexpress.webapp:fileupload.label"); +// SubmitButtonIcon = new PropertyIcon(TypeIcon.Upload); +// SubmitButtonColor = new PropertyColorButton(TypeColorButton.Primary); + +// File.Validation += OnValidationFile; +// Form.ProcessForm += OnProcessForm; + +// Form.Add(File); +// Form.AddPrimaryButton(SubmitButton); + +// } + +// /// +// /// Validation of the upload file. +// /// +// /// The trigger of the event. +// /// The event argument. +// private void OnValidationFile(object sender, ValidationEventArgs e) +// { +// if (!(e.Context.Request.GetParameter(File.Name) is ParameterFile)) +// { +// e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:fileupload.file.validation.error.nofile")); +// } +// } + +// /// +// /// Processing of the form. +// /// +// /// The trigger of the event. +// /// The event argument. +// private void OnProcessForm(object sender, FormEventArgs e) +// { +// if (e.Context.Request.GetParameter(File.Name) is ParameterFile file) +// { +// OnUpload(new FormUploadEventArgs(e) { File = file }); +// } +// } + +// /// +// /// Löst das Upload-Event aus +// /// +// /// The event argument. +// protected virtual void OnUpload(FormUploadEventArgs args) +// { +// Upload?.Invoke(this, args); +// } + +// /// +// /// Convert to html. +// /// +// /// The context in which the control is rendered. +// /// The control as html. +// public override IHtmlNode Render(RenderContext context) +// { +// Form.RedirectUri = RedirectUri ?? context.Uri; + +// var list = new[] { Epilogue } +// .Concat(Form.Items) +// .Concat([Prologue]); + +// return base.Render(context, list.Where(x => x != null)); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebControl/ControlModalFormGoupEdit.cs b/src/WebExpress.WebApp/WebControl/ControlModalFormGoupEdit.cs index c1cb525..49ff50a 100644 --- a/src/WebExpress.WebApp/WebControl/ControlModalFormGoupEdit.cs +++ b/src/WebExpress.WebApp/WebControl/ControlModalFormGoupEdit.cs @@ -1,93 +1,93 @@ -using System; -using System.Linq; -using WebExpress.WebApp.WebUser; -using WebExpress.WebUI.WebControl; +//using System; +//using System.Linq; +//using WebExpress.WebApp.WebUser; +//using WebExpress.WebUI.WebControl; -namespace WebExpress.WebApp.WebControl -{ - internal sealed class ControlModalFormGoupEdit : ControlModalForm - { - /// - /// Returns or sets the group to be deleted. - /// - public Group Item { get; set; } +//namespace WebExpress.WebApp.WebControl +//{ +// internal sealed class ControlModalFormGoupEdit : ControlModalForm +// { +// /// +// /// Returns or sets the group to be deleted. +// /// +// public Group Item { get; set; } - /// - /// Returns the description of the form. - /// - private ControlFormItemStaticText Description { get; } = new ControlFormItemStaticText() - { - Text = "webexpress.webapp:setting.usermanager.group.edit.description", - TextColor = new PropertyColorText(TypeColorText.Secondary) - }; +// /// +// /// Returns the description of the form. +// /// +// private ControlFormItemStaticText Description { get; } = new ControlFormItemStaticText() +// { +// Text = "webexpress.webapp:setting.usermanager.group.edit.description", +// TextColor = new PropertyColorText(TypeColorText.Secondary) +// }; - /// - /// Returns the control element for entering the group name. - /// - private ControlFormItemInputTextBox GroupName { get; } = new ControlFormItemInputTextBox() - { - Label = "webexpress.webapp:setting.usermanager.group.edit.name.label", - Name = "groupname" - }; +// /// +// /// Returns the control element for entering the group name. +// /// +// private ControlFormItemInputTextBox GroupName { get; } = new ControlFormItemInputTextBox() +// { +// Label = "webexpress.webapp:setting.usermanager.group.edit.name.label", +// Name = "groupname" +// }; - /// - /// Initializes a new instance of the class. - /// - /// The control id. - public ControlModalFormGoupEdit(string id = null) - : base(id) - { - Add(Description); - Add(GroupName); +// /// +// /// Initializes a new instance of the class. +// /// +// /// The control id. +// public ControlModalFormGoupEdit(string id = null) +// : base(id) +// { +// Add(Description); +// Add(GroupName); - Header = "webexpress.webapp:setting.usermanager.group.edit.header"; +// Header = "webexpress.webapp:setting.usermanager.group.edit.header"; - GroupName.Validation += OnGroupNameValidation; - //Form.SubmitButton.Text = "webexpress.webapp:setting.usermanager.group.edit.confirm"; - Form.FillForm += OnFillForm; - Form.ProcessForm += OnConfirm; - } +// GroupName.Validation += OnGroupNameValidation; +// //Form.SubmitButton.Text = "webexpress.webapp:setting.usermanager.group.edit.confirm"; +// Form.FillForm += OnFillForm; +// Form.ProcessForm += OnConfirm; +// } - /// - /// Invoked when the form is to be filled with initial values. - /// - /// The trigger of the event. - /// The event argument. - private void OnFillForm(object sender, FormEventArgs e) - { - GroupName.Value = Item?.Name; - } +// /// +// /// Invoked when the form is to be filled with initial values. +// /// +// /// The trigger of the event. +// /// The event argument. +// private void OnFillForm(object sender, FormEventArgs e) +// { +// GroupName.Value = Item?.Name; +// } - /// - /// Invoked when you want to check the group name you entered. - /// - /// The trigger of the event. - /// The event argument. - private void OnGroupNameValidation(object sender, ValidationEventArgs e) - { - if (string.IsNullOrWhiteSpace(GroupName.Value)) - { - e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.group.edit.name.error.empty")); - } +// /// +// /// Invoked when you want to check the group name you entered. +// /// +// /// The trigger of the event. +// /// The event argument. +// private void OnGroupNameValidation(object sender, ValidationEventArgs e) +// { +// if (string.IsNullOrWhiteSpace(GroupName.Value)) +// { +// e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.group.edit.name.error.empty")); +// } - if (UserManager.Groups.Where(x => x != Item && x.Name.Equals(GroupName.Value, StringComparison.OrdinalIgnoreCase)).Any()) - { - e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.group.edit.name.error.duplicate")); - } - } +// if (UserManager.Groups.Where(x => x != Item && x.Name.Equals(GroupName.Value, StringComparison.OrdinalIgnoreCase)).Any()) +// { +// e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.group.edit.name.error.duplicate")); +// } +// } - /// - /// Called when the delete action has been confirmed. - /// - /// The trigger of the event. - /// The event argument. - private void OnConfirm(object sender, FormEventArgs e) - { - Item.Name = GroupName.Value; +// /// +// /// Called when the delete action has been confirmed. +// /// +// /// The trigger of the event. +// /// The event argument. +// private void OnConfirm(object sender, FormEventArgs e) +// { +// Item.Name = GroupName.Value; - UserManager.UpdateGroup(Item); +// UserManager.UpdateGroup(Item); - e.Context.Page.Redirecting(e.Context.Uri); - } - } -} +// e.Context.Page.Redirecting(e.Context.Uri); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebControl/ControlModalFormGoupNew.cs b/src/WebExpress.WebApp/WebControl/ControlModalFormGoupNew.cs index 1dff3fc..66dd1d0 100644 --- a/src/WebExpress.WebApp/WebControl/ControlModalFormGoupNew.cs +++ b/src/WebExpress.WebApp/WebControl/ControlModalFormGoupNew.cs @@ -1,83 +1,83 @@ -using System; -using System.Linq; -using WebExpress.WebApp.WebUser; -using WebExpress.WebUI.WebControl; +//using System; +//using System.Linq; +//using WebExpress.WebApp.WebUser; +//using WebExpress.WebUI.WebControl; -namespace WebExpress.WebApp.WebControl -{ - internal sealed class ControlModalFormGoupNew : ControlModalForm - { - /// - /// Returns the description of the form. - /// - private ControlFormItemStaticText Description { get; } = new ControlFormItemStaticText() - { - Text = "webexpress.webapp:setting.usermanager.group.add.description", - TextColor = new PropertyColorText(TypeColorText.Secondary) - }; +//namespace WebExpress.WebApp.WebControl +//{ +// internal sealed class ControlModalFormGoupNew : ControlModalForm +// { +// /// +// /// Returns the description of the form. +// /// +// private ControlFormItemStaticText Description { get; } = new ControlFormItemStaticText() +// { +// Text = "webexpress.webapp:setting.usermanager.group.add.description", +// TextColor = new PropertyColorText(TypeColorText.Secondary) +// }; - /// - /// Returns the control element for entering the group name. - /// - private ControlFormItemInputTextBox GroupName { get; } = new ControlFormItemInputTextBox() - { - Label = "webexpress.webapp:setting.usermanager.group.add.name.label", - Name = "groupname" - }; +// /// +// /// Returns the control element for entering the group name. +// /// +// private ControlFormItemInputTextBox GroupName { get; } = new ControlFormItemInputTextBox() +// { +// Label = "webexpress.webapp:setting.usermanager.group.add.name.label", +// Name = "groupname" +// }; - /// - /// Initializes a new instance of the class. - /// - /// The control id. - public ControlModalFormGoupNew(string id = null) - : base(id) - { - Add(Description); - Add(GroupName); +// /// +// /// Initializes a new instance of the class. +// /// +// /// The control id. +// public ControlModalFormGoupNew(string id = null) +// : base(id) +// { +// Add(Description); +// Add(GroupName); - Header = "webexpress.webapp:setting.usermanager.group.add.header"; +// Header = "webexpress.webapp:setting.usermanager.group.add.header"; - GroupName.Validation += OnGroupNameValidation; - //Form.SubmitButton.Text = "webexpress.webapp:setting.usermanager.group.add.confirm"; - Form.ProcessForm += OnConfirm; - } +// GroupName.Validation += OnGroupNameValidation; +// //Form.SubmitButton.Text = "webexpress.webapp:setting.usermanager.group.add.confirm"; +// Form.ProcessForm += OnConfirm; +// } - /// - /// Invoked when you want to check the group name you entered. - /// - /// The trigger of the event. - /// The event argument. - private void OnGroupNameValidation(object sender, ValidationEventArgs e) - { - if (string.IsNullOrWhiteSpace(GroupName.Value)) - { - e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.group.add.name.error.empty")); - } +// /// +// /// Invoked when you want to check the group name you entered. +// /// +// /// The trigger of the event. +// /// The event argument. +// private void OnGroupNameValidation(object sender, ValidationEventArgs e) +// { +// if (string.IsNullOrWhiteSpace(GroupName.Value)) +// { +// e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.group.add.name.error.empty")); +// } - if (UserManager.Groups.Where(x => x.Name.Equals(GroupName.Value, StringComparison.OrdinalIgnoreCase)).Any()) - { - e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.group.add.name.error.duplicate")); - } - } +// if (UserManager.Groups.Where(x => x.Name.Equals(GroupName.Value, StringComparison.OrdinalIgnoreCase)).Any()) +// { +// e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.group.add.name.error.duplicate")); +// } +// } - /// - /// Called when the delete action has been confirmed. - /// - /// The trigger of the event. - /// The event argument. - private void OnConfirm(object sender, FormEventArgs e) - { - var group = new Group() - { - Id = Guid.NewGuid().ToString(), - Name = GroupName.Value, - Created = DateTime.Now, - Updated = DateTime.Now - }; +// /// +// /// Called when the delete action has been confirmed. +// /// +// /// The trigger of the event. +// /// The event argument. +// private void OnConfirm(object sender, FormEventArgs e) +// { +// var group = new Group() +// { +// Id = Guid.NewGuid().ToString(), +// Name = GroupName.Value, +// Created = DateTime.Now, +// Updated = DateTime.Now +// }; - UserManager.AddGroup(group); +// UserManager.AddGroup(group); - e.Context.Page.Redirecting(e.Context.Uri); - } - } -} +// e.Context.Page.Redirecting(e.Context.Uri); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebControl/ControlModalFormGroupDelete.cs b/src/WebExpress.WebApp/WebControl/ControlModalFormGroupDelete.cs index 293644e..1051f73 100644 --- a/src/WebExpress.WebApp/WebControl/ControlModalFormGroupDelete.cs +++ b/src/WebExpress.WebApp/WebControl/ControlModalFormGroupDelete.cs @@ -1,60 +1,60 @@ -using System; -using WebExpress.WebApp.WebUser; -using WebExpress.WebCore.WebHtml; -using WebExpress.WebCore.WebPage; -using WebExpress.WebUI.WebControl; -using static WebExpress.WebCore.Internationalization.InternationalizationManager; - -namespace WebExpress.WebApp.WebControl -{ - internal sealed class ControlModalFormGroupDelete : ControlModalFormConfirmDelete - { - /// - /// Returns or sets the group to be edited. - /// - public Group Item { get; set; } - - /// - /// Returns the description. - /// - private ControlFormItemStaticText Description { get; } = new ControlFormItemStaticText(); - - /// - /// Initializes a new instance of the class. - /// - /// The control id. - public ControlModalFormGroupDelete(string id = null) - : base("delete_" + id) - { - Confirm += OnConfirm; - - Header = "webexpress.webapp:setting.usermanager.group.delete.header"; - Content = Description; - } - - /// - /// Invoked when the deletion is confirmed. - /// - /// The trigger of the event. - /// The event argument. - /// - private void OnConfirm(object sender, FormEventArgs e) - { - UserManager.RemoveGroup(Item); - - e.Context.Page.Redirecting(e.Context.Uri); - } - - /// - /// Convert to html. - /// - /// The context in which the control is rendered. - /// The control as html. - public override IHtmlNode Render(RenderContext context) - { - Description.Text = string.Format(I18N(context.Culture, "webexpress.webapp:setting.usermanager.group.delete.description"), Item.Name); - - return base.Render(context); - } - } -} +//using System; +//using WebExpress.WebApp.WebUser; +//using WebExpress.WebCore.WebHtml; +//using WebExpress.WebCore.WebPage; +//using WebExpress.WebUI.WebControl; +//using static WebExpress.WebCore.Internationalization.InternationalizationManager; + +//namespace WebExpress.WebApp.WebControl +//{ +// internal sealed class ControlModalFormGroupDelete : ControlModalFormConfirmDelete +// { +// /// +// /// Returns or sets the group to be edited. +// /// +// public Group Item { get; set; } + +// /// +// /// Returns the description. +// /// +// private ControlFormItemStaticText Description { get; } = new ControlFormItemStaticText(); + +// /// +// /// Initializes a new instance of the class. +// /// +// /// The control id. +// public ControlModalFormGroupDelete(string id = null) +// : base("delete_" + id) +// { +// Confirm += OnConfirm; + +// Header = "webexpress.webapp:setting.usermanager.group.delete.header"; +// Content = Description; +// } + +// /// +// /// Invoked when the deletion is confirmed. +// /// +// /// The trigger of the event. +// /// The event argument. +// /// +// private void OnConfirm(object sender, FormEventArgs e) +// { +// UserManager.RemoveGroup(Item); + +// e.Context.Page.Redirecting(e.Context.Uri); +// } + +// /// +// /// Convert to html. +// /// +// /// The context in which the control is rendered. +// /// The control as html. +// public override IHtmlNode Render(RenderContext context) +// { +// Description.Text = string.Format(I18N(context.Culture, "webexpress.webapp:setting.usermanager.group.delete.description"), Item.Name); + +// return base.Render(context); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebControl/ControlModalFormUserDelete.cs b/src/WebExpress.WebApp/WebControl/ControlModalFormUserDelete.cs index 713c2fb..e0fd951 100644 --- a/src/WebExpress.WebApp/WebControl/ControlModalFormUserDelete.cs +++ b/src/WebExpress.WebApp/WebControl/ControlModalFormUserDelete.cs @@ -1,58 +1,58 @@ -using WebExpress.WebApp.WebUser; -using WebExpress.WebCore.WebHtml; -using WebExpress.WebCore.WebPage; -using WebExpress.WebUI.WebControl; -using static WebExpress.WebCore.Internationalization.InternationalizationManager; - -namespace WebExpress.WebApp.WebControl -{ - internal sealed class ControlModalFormUserDelete : ControlModalFormConfirmDelete - { - /// - /// Returns or sets the user to be deleted. - /// - public User Item { get; set; } - - /// - /// Returns the description. - /// - private ControlFormItemStaticText Description { get; } = new ControlFormItemStaticText(); - - /// - /// Initializes a new instance of the class. - /// - /// The control id. - public ControlModalFormUserDelete(string id = null) - : base("delete_" + id) - { - Confirm += OnConfirm; - - Header = "webexpress.webapp:setting.usermanager.user.delete.header"; - Content = Description; - } - - /// - /// Invoked when the deletion is confirmed. - /// - /// The trigger of the event. - /// The event argument. - private void OnConfirm(object sender, FormEventArgs e) - { - UserManager.RemoveUser(Item); - - e.Context.Page.Redirecting(e.Context.Uri); - } - - /// - /// Convert to html. - /// - /// The context in which the control is rendered. - /// The control as html. - public override IHtmlNode Render(RenderContext context) - { - Description.Text = string.Format(I18N(context.Culture, "webexpress.webapp:setting.usermanager.user.delete.description"), Item.Login); - - return base.Render(context); - } - } -} +//using WebExpress.WebApp.WebUser; +//using WebExpress.WebCore.WebHtml; +//using WebExpress.WebCore.WebPage; +//using WebExpress.WebUI.WebControl; +//using static WebExpress.WebCore.Internationalization.InternationalizationManager; + +//namespace WebExpress.WebApp.WebControl +//{ +// internal sealed class ControlModalFormUserDelete : ControlModalFormConfirmDelete +// { +// /// +// /// Returns or sets the user to be deleted. +// /// +// public User Item { get; set; } + +// /// +// /// Returns the description. +// /// +// private ControlFormItemStaticText Description { get; } = new ControlFormItemStaticText(); + +// /// +// /// Initializes a new instance of the class. +// /// +// /// The control id. +// public ControlModalFormUserDelete(string id = null) +// : base("delete_" + id) +// { +// Confirm += OnConfirm; + +// Header = "webexpress.webapp:setting.usermanager.user.delete.header"; +// Content = Description; +// } + +// /// +// /// Invoked when the deletion is confirmed. +// /// +// /// The trigger of the event. +// /// The event argument. +// private void OnConfirm(object sender, FormEventArgs e) +// { +// UserManager.RemoveUser(Item); + +// e.Context.Page.Redirecting(e.Context.Uri); +// } + +// /// +// /// Convert to html. +// /// +// /// The context in which the control is rendered. +// /// The control as html. +// public override IHtmlNode Render(RenderContext context) +// { +// Description.Text = string.Format(I18N(context.Culture, "webexpress.webapp:setting.usermanager.user.delete.description"), Item.Login); + +// return base.Render(context); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebControl/ControlModalFormUserEdit.cs b/src/WebExpress.WebApp/WebControl/ControlModalFormUserEdit.cs index 412d549..21b7c02 100644 --- a/src/WebExpress.WebApp/WebControl/ControlModalFormUserEdit.cs +++ b/src/WebExpress.WebApp/WebControl/ControlModalFormUserEdit.cs @@ -1,203 +1,203 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using WebExpress.WebApp.WebUser; -using WebExpress.WebUI.WebControl; - -namespace WebExpress.WebApp.WebControl -{ - internal sealed class ControlModalFormUserEdit : ControlModalForm - { - /// - /// Returns or sets the user to edit. - /// - public User Item { get; set; } - - /// - /// Returns the description of the form. - /// - private ControlFormItemStaticText Description { get; } = new ControlFormItemStaticText() - { - Text = "webexpress.webapp:setting.usermanager.user.edit.description", - TextColor = new PropertyColorText(TypeColorText.Secondary) - }; - - /// - /// Returns the control for entering the login id. - /// - private ControlFormItemInputTextBox Login { get; } = new ControlFormItemInputTextBox() - { - Label = "webexpress.webapp:setting.usermanager.user.edit.login.label", - Name = "login" - }; - - /// - /// Returns the control for entering the first name. - /// - private ControlFormItemInputTextBox Firstname { get; } = new ControlFormItemInputTextBox() - { - Label = "webexpress.webapp:setting.usermanager.user.edit.firstname.label", - Name = "firstname" - }; - - /// - /// Returns the control for entering the last name. - /// - private ControlFormItemInputTextBox Lastname { get; } = new ControlFormItemInputTextBox() - { - Label = "webexpress.webapp:setting.usermanager.user.edit.lastname.label", - Name = "lastname" - }; - - /// - /// Returns the control for entering the email address. - /// - private ControlFormItemInputTextBox Email { get; } = new ControlFormItemInputTextBox() - { - Label = "webexpress.webapp:setting.usermanager.user.edit.email.label", - Name = "email", - Placeholder = "user@example.com" - }; - - /// - /// Returns or sets the groups. - /// - private ControlFormItemInputMove Groups { get; set; } - - /// - /// Initializes a new instance of the class. - /// - /// The id. - public ControlModalFormUserEdit(string id = null) - : base(id) - { - Groups = new ControlFormItemInputMove(id) - { - Name = "groups", - Label = "webexpress.webapp:setting.usermanager.user.edit.groups.label", - Help = "webexpress.webapp:setting.usermanager.user.edit.groups.description", - SelectedHeader = "webexpress.webapp:setting.usermanager.user.edit.groups.selected", - AvailableHeader = "webexpress.webapp:setting.usermanager.user.edit.groups.available", - Icon = new PropertyIcon(TypeIcon.Users) - }; - - Login.Validation += OnLoginValidation; - Firstname.Validation += OnFirstnameValidation; - Lastname.Validation += OnLastnameValidation; - Email.Validation += OnEmailValidation; - - Add(Description); - Add(Login); - Add(new ControlFormItemGroupColumnVertical(Firstname, Lastname) { Distribution = new int[] { 50 } }); - Add(Email); - Add(Groups); - //Form.SubmitButton.Text = "webexpress.webapp:setting.usermanager.user.edit.confirm"; - Form.FillForm += OnFillForm; - Form.ProcessForm += OnConfirm; - - Header = "webexpress.webapp:setting.usermanager.user.edit.header"; - } - - /// - /// Invoked when the form is to be filled with initial values. - /// - /// The trigger of the event. - /// The event argument. - private void OnFillForm(object sender, FormEventArgs e) - { - Login.Value = Item?.Login; - Firstname.Value = Item?.Firstname; - Lastname.Value = Item?.Lastname; - Email.Value = Item?.Email; - - foreach (var v in UserManager.Groups.OrderBy(x => x.Name)) - { - Groups.Options.Add(new ControlFormItemInputSelectionItem() - { - Id = v.Id, - Label = v.Name - }); - } - - Groups.Value = string.Join(";", Item.GroupIds); - } - - /// - /// Called when the entered login id is to be checked. - /// - /// The trigger of the event. - /// The event argument. - private void OnLoginValidation(object sender, ValidationEventArgs e) - { - if (string.IsNullOrWhiteSpace(Login.Value)) - { - e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.user.edit.login.error.empty")); - } - - if (UserManager.Users.Where(x => x != Item && x.Login.Equals(Login.Value, StringComparison.OrdinalIgnoreCase)).Any()) - { - e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.user.edit.login.error.duplicate")); - } - } - - /// - /// Called when the entered first name is to be checked. - /// - /// The trigger of the event. - /// The event argument. - private void OnFirstnameValidation(object sender, ValidationEventArgs e) - { - if (string.IsNullOrWhiteSpace(Firstname.Value)) - { - e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.user.edit.firstname.error.empty")); - } - } - - /// - /// Called when the entered last name is to be checked. - /// - /// The trigger of the event. - /// The event argument. - private void OnLastnameValidation(object sender, ValidationEventArgs e) - { - if (string.IsNullOrWhiteSpace(Lastname.Value)) - { - e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.user.edit.lastname.error.empty")); - } - } - - /// - /// Invoked when the entered email address is to be verified. - /// - /// The trigger of the event. - /// The event argument. - private void OnEmailValidation(object sender, ValidationEventArgs e) - { - if (string.IsNullOrWhiteSpace(Email.Value)) - { - e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.user.edit.email.error.empty")); - } - } - - /// - /// Called when the delete action has been confirmed. - /// - /// The trigger of the event. - /// The event argument. - private void OnConfirm(object sender, FormEventArgs e) - { - Item.Login = Login.Value; - Item.Firstname = Firstname.Value; - Item.Lastname = Lastname.Value; - Item.Email = Email.Value; - - var groups = Groups.Value?.Split(";", StringSplitOptions.RemoveEmptyEntries); - Item.GroupIds = new List(); - Item.GroupIds.AddRange(groups); - - UserManager.UpdateUser(Item); - - e.Context.Page.Redirecting(e.Context.Uri); - } - } -} +//using System; +//using System.Collections.Generic; +//using System.Linq; +//using WebExpress.WebApp.WebUser; +//using WebExpress.WebUI.WebControl; + +//namespace WebExpress.WebApp.WebControl +//{ +// internal sealed class ControlModalFormUserEdit : ControlModalForm +// { +// /// +// /// Returns or sets the user to edit. +// /// +// public User Item { get; set; } + +// /// +// /// Returns the description of the form. +// /// +// private ControlFormItemStaticText Description { get; } = new ControlFormItemStaticText() +// { +// Text = "webexpress.webapp:setting.usermanager.user.edit.description", +// TextColor = new PropertyColorText(TypeColorText.Secondary) +// }; + +// /// +// /// Returns the control for entering the login id. +// /// +// private ControlFormItemInputTextBox Login { get; } = new ControlFormItemInputTextBox() +// { +// Label = "webexpress.webapp:setting.usermanager.user.edit.login.label", +// Name = "login" +// }; + +// /// +// /// Returns the control for entering the first name. +// /// +// private ControlFormItemInputTextBox Firstname { get; } = new ControlFormItemInputTextBox() +// { +// Label = "webexpress.webapp:setting.usermanager.user.edit.firstname.label", +// Name = "firstname" +// }; + +// /// +// /// Returns the control for entering the last name. +// /// +// private ControlFormItemInputTextBox Lastname { get; } = new ControlFormItemInputTextBox() +// { +// Label = "webexpress.webapp:setting.usermanager.user.edit.lastname.label", +// Name = "lastname" +// }; + +// /// +// /// Returns the control for entering the email address. +// /// +// private ControlFormItemInputTextBox Email { get; } = new ControlFormItemInputTextBox() +// { +// Label = "webexpress.webapp:setting.usermanager.user.edit.email.label", +// Name = "email", +// Placeholder = "user@example.com" +// }; + +// /// +// /// Returns or sets the groups. +// /// +// private ControlFormItemInputMove Groups { get; set; } + +// /// +// /// Initializes a new instance of the class. +// /// +// /// The id. +// public ControlModalFormUserEdit(string id = null) +// : base(id) +// { +// Groups = new ControlFormItemInputMove(id) +// { +// Name = "groups", +// Label = "webexpress.webapp:setting.usermanager.user.edit.groups.label", +// Help = "webexpress.webapp:setting.usermanager.user.edit.groups.description", +// SelectedHeader = "webexpress.webapp:setting.usermanager.user.edit.groups.selected", +// AvailableHeader = "webexpress.webapp:setting.usermanager.user.edit.groups.available", +// Icon = new PropertyIcon(TypeIcon.Users) +// }; + +// Login.Validation += OnLoginValidation; +// Firstname.Validation += OnFirstnameValidation; +// Lastname.Validation += OnLastnameValidation; +// Email.Validation += OnEmailValidation; + +// Add(Description); +// Add(Login); +// Add(new ControlFormItemGroupColumnVertical(Firstname, Lastname) { Distribution = new int[] { 50 } }); +// Add(Email); +// Add(Groups); +// //Form.SubmitButton.Text = "webexpress.webapp:setting.usermanager.user.edit.confirm"; +// Form.FillForm += OnFillForm; +// Form.ProcessForm += OnConfirm; + +// Header = "webexpress.webapp:setting.usermanager.user.edit.header"; +// } + +// /// +// /// Invoked when the form is to be filled with initial values. +// /// +// /// The trigger of the event. +// /// The event argument. +// private void OnFillForm(object sender, FormEventArgs e) +// { +// Login.Value = Item?.Login; +// Firstname.Value = Item?.Firstname; +// Lastname.Value = Item?.Lastname; +// Email.Value = Item?.Email; + +// foreach (var v in UserManager.Groups.OrderBy(x => x.Name)) +// { +// Groups.Options.Add(new ControlFormItemInputSelectionItem() +// { +// Id = v.Id, +// Label = v.Name +// }); +// } + +// Groups.Value = string.Join(";", Item.GroupIds); +// } + +// /// +// /// Called when the entered login id is to be checked. +// /// +// /// The trigger of the event. +// /// The event argument. +// private void OnLoginValidation(object sender, ValidationEventArgs e) +// { +// if (string.IsNullOrWhiteSpace(Login.Value)) +// { +// e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.user.edit.login.error.empty")); +// } + +// if (UserManager.Users.Where(x => x != Item && x.Login.Equals(Login.Value, StringComparison.OrdinalIgnoreCase)).Any()) +// { +// e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.user.edit.login.error.duplicate")); +// } +// } + +// /// +// /// Called when the entered first name is to be checked. +// /// +// /// The trigger of the event. +// /// The event argument. +// private void OnFirstnameValidation(object sender, ValidationEventArgs e) +// { +// if (string.IsNullOrWhiteSpace(Firstname.Value)) +// { +// e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.user.edit.firstname.error.empty")); +// } +// } + +// /// +// /// Called when the entered last name is to be checked. +// /// +// /// The trigger of the event. +// /// The event argument. +// private void OnLastnameValidation(object sender, ValidationEventArgs e) +// { +// if (string.IsNullOrWhiteSpace(Lastname.Value)) +// { +// e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.user.edit.lastname.error.empty")); +// } +// } + +// /// +// /// Invoked when the entered email address is to be verified. +// /// +// /// The trigger of the event. +// /// The event argument. +// private void OnEmailValidation(object sender, ValidationEventArgs e) +// { +// if (string.IsNullOrWhiteSpace(Email.Value)) +// { +// e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.user.edit.email.error.empty")); +// } +// } + +// /// +// /// Called when the delete action has been confirmed. +// /// +// /// The trigger of the event. +// /// The event argument. +// private void OnConfirm(object sender, FormEventArgs e) +// { +// Item.Login = Login.Value; +// Item.Firstname = Firstname.Value; +// Item.Lastname = Lastname.Value; +// Item.Email = Email.Value; + +// var groups = Groups.Value?.Split(";", StringSplitOptions.RemoveEmptyEntries); +// Item.GroupIds = new List(); +// Item.GroupIds.AddRange(groups); + +// UserManager.UpdateUser(Item); + +// e.Context.Page.Redirecting(e.Context.Uri); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebControl/ControlModalFormUserNew.cs b/src/WebExpress.WebApp/WebControl/ControlModalFormUserNew.cs index b42eb93..f08a179 100644 --- a/src/WebExpress.WebApp/WebControl/ControlModalFormUserNew.cs +++ b/src/WebExpress.WebApp/WebControl/ControlModalFormUserNew.cs @@ -1,191 +1,191 @@ -using System; -using System.Linq; -using WebExpress.WebApp.WebUser; -using WebExpress.WebUI.WebControl; - - -namespace WebExpress.WebApp.WebControl -{ - internal sealed class ControlModalFormUserNew : ControlModalForm - { - /// - /// Returns the description of the form. - /// - private ControlFormItemStaticText Description { get; } = new ControlFormItemStaticText() - { - Text = "webexpress.webapp:setting.usermanager.user.add.description", - TextColor = new PropertyColorText(TypeColorText.Secondary) - }; - - /// - /// Returns the control for entering the login id. - /// - private ControlFormItemInputTextBox Login { get; } = new ControlFormItemInputTextBox() - { - Label = "webexpress.webapp:setting.usermanager.user.add.login.label", - Name = "login" - }; - - /// - /// Returns the control for entering the first name. - /// - private ControlFormItemInputTextBox Firstname { get; } = new ControlFormItemInputTextBox() - { - Label = "webexpress.webapp:setting.usermanager.user.add.firstname.label", - Name = "firstname" - }; - - /// - /// Returns the control for entering the last name. - /// - private ControlFormItemInputTextBox Lastname { get; } = new ControlFormItemInputTextBox() - { - Label = "webexpress.webapp:setting.usermanager.user.add.lastname.label", - Name = "lastname" - }; - - /// - /// Returns the control for entering the email address. - /// - private ControlFormItemInputTextBox Email { get; } = new ControlFormItemInputTextBox() - { - Label = "webexpress.webapp:setting.usermanager.user.add.email.label", - Name = "email", - Placeholder = "user@example.com" - }; - - /// - /// Returns the groups. - /// - private ControlFormItemInputMove Groups { get; } = new ControlFormItemInputMove("group") - { - Name = "groups", - Label = "webexpress.webapp:setting.usermanager.user.edit.groups.label", - Help = "webexpress.webapp:setting.usermanager.user.edit.groups.description", - SelectedHeader = "webexpress.webapp:setting.usermanager.user.edit.groups.selected", - AvailableHeader = "webexpress.webapp:setting.usermanager.user.edit.groups.available", - Icon = new PropertyIcon(TypeIcon.Users) - }; - - /// - /// Initializes a new instance of the class. - /// - /// The id. - public ControlModalFormUserNew(string id = null) - : base(id) - { - Login.Validation += OnLoginValidation; - Firstname.Validation += OnFirstnameValidation; - Lastname.Validation += OnLastnameValidation; - Email.Validation += OnEmailValidation; - - Add(Description); - Add(Login); - Add(new ControlFormItemGroupColumnVertical(Firstname, Lastname) { Distribution = new int[] { 50 } }); - Add(Email); - Add(Groups); - //Form.SubmitButton.Text = "webexpress.webapp:setting.usermanager.user.add.confirm"; - Form.FillForm += OnFillForm; - Form.ProcessForm += OnConfirm; - - Header = "webexpress.webapp:setting.usermanager.user.add.header"; - } - - /// - /// Invoked when the form is to be filled with initial values. - /// - /// The trigger of the event. - /// The event argument. - private void OnFillForm(object sender, FormEventArgs e) - { - foreach (var v in UserManager.Groups.OrderBy(x => x.Name)) - { - Groups.Options.Add(new ControlFormItemInputSelectionItem() - { - Id = v.Id, - Label = v.Name - }); - } - } - - /// - /// Called when the entered login id is to be checked. - /// - /// The trigger of the event. - /// The event argument. - private void OnLoginValidation(object sender, ValidationEventArgs e) - { - if (string.IsNullOrWhiteSpace(Login.Value)) - { - e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.user.add.login.error.empty")); - } - - if (UserManager.Users.Where(x => x.Login.Equals(Login.Value, StringComparison.OrdinalIgnoreCase)).Any()) - { - e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.user.add.login.error.duplicate")); - } - } - - /// - /// Called when the entered first name is to be checked. - /// - /// The trigger of the event. - /// The event argument. - private void OnFirstnameValidation(object sender, ValidationEventArgs e) - { - if (string.IsNullOrWhiteSpace(Firstname.Value)) - { - e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.user.add.firstname.error.empty")); - } - } - - /// - /// Called when the entered last name is to be checked. - /// - /// The trigger of the event. - /// The event argument. - private void OnLastnameValidation(object sender, ValidationEventArgs e) - { - if (string.IsNullOrWhiteSpace(Lastname.Value)) - { - e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.user.add.lastname.error.empty")); - } - } - - /// - /// Invoked when the entered email address is to be verified. - /// - /// The trigger of the event. - /// The event argument. - private void OnEmailValidation(object sender, ValidationEventArgs e) - { - if (string.IsNullOrWhiteSpace(Email.Value)) - { - e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.user.add.email.error.empty")); - } - } - - /// - /// Called when the delete action has been confirmed. - /// - /// The trigger of the event. - /// The event argument. - private void OnConfirm(object sender, FormEventArgs e) - { - var user = new User() - { - Id = Guid.NewGuid(), - Login = Login.Value, - Firstname = Firstname.Value, - Lastname = Lastname.Value, - Email = Email.Value, - Created = DateTime.Now, - Updated = DateTime.Now - }; - - UserManager.AddUser(user); - - e.Context.Page.Redirecting(e.Context.Uri); - } - } -} +//using System; +//using System.Linq; +//using WebExpress.WebApp.WebUser; +//using WebExpress.WebUI.WebControl; + + +//namespace WebExpress.WebApp.WebControl +//{ +// internal sealed class ControlModalFormUserNew : ControlModalForm +// { +// /// +// /// Returns the description of the form. +// /// +// private ControlFormItemStaticText Description { get; } = new ControlFormItemStaticText() +// { +// Text = "webexpress.webapp:setting.usermanager.user.add.description", +// TextColor = new PropertyColorText(TypeColorText.Secondary) +// }; + +// /// +// /// Returns the control for entering the login id. +// /// +// private ControlFormItemInputTextBox Login { get; } = new ControlFormItemInputTextBox() +// { +// Label = "webexpress.webapp:setting.usermanager.user.add.login.label", +// Name = "login" +// }; + +// /// +// /// Returns the control for entering the first name. +// /// +// private ControlFormItemInputTextBox Firstname { get; } = new ControlFormItemInputTextBox() +// { +// Label = "webexpress.webapp:setting.usermanager.user.add.firstname.label", +// Name = "firstname" +// }; + +// /// +// /// Returns the control for entering the last name. +// /// +// private ControlFormItemInputTextBox Lastname { get; } = new ControlFormItemInputTextBox() +// { +// Label = "webexpress.webapp:setting.usermanager.user.add.lastname.label", +// Name = "lastname" +// }; + +// /// +// /// Returns the control for entering the email address. +// /// +// private ControlFormItemInputTextBox Email { get; } = new ControlFormItemInputTextBox() +// { +// Label = "webexpress.webapp:setting.usermanager.user.add.email.label", +// Name = "email", +// Placeholder = "user@example.com" +// }; + +// /// +// /// Returns the groups. +// /// +// private ControlFormItemInputMove Groups { get; } = new ControlFormItemInputMove("group") +// { +// Name = "groups", +// Label = "webexpress.webapp:setting.usermanager.user.edit.groups.label", +// Help = "webexpress.webapp:setting.usermanager.user.edit.groups.description", +// SelectedHeader = "webexpress.webapp:setting.usermanager.user.edit.groups.selected", +// AvailableHeader = "webexpress.webapp:setting.usermanager.user.edit.groups.available", +// Icon = new PropertyIcon(TypeIcon.Users) +// }; + +// /// +// /// Initializes a new instance of the class. +// /// +// /// The id. +// public ControlModalFormUserNew(string id = null) +// : base(id) +// { +// Login.Validation += OnLoginValidation; +// Firstname.Validation += OnFirstnameValidation; +// Lastname.Validation += OnLastnameValidation; +// Email.Validation += OnEmailValidation; + +// Add(Description); +// Add(Login); +// Add(new ControlFormItemGroupColumnVertical(Firstname, Lastname) { Distribution = new int[] { 50 } }); +// Add(Email); +// Add(Groups); +// //Form.SubmitButton.Text = "webexpress.webapp:setting.usermanager.user.add.confirm"; +// Form.FillForm += OnFillForm; +// Form.ProcessForm += OnConfirm; + +// Header = "webexpress.webapp:setting.usermanager.user.add.header"; +// } + +// /// +// /// Invoked when the form is to be filled with initial values. +// /// +// /// The trigger of the event. +// /// The event argument. +// private void OnFillForm(object sender, FormEventArgs e) +// { +// foreach (var v in UserManager.Groups.OrderBy(x => x.Name)) +// { +// Groups.Options.Add(new ControlFormItemInputSelectionItem() +// { +// Id = v.Id, +// Label = v.Name +// }); +// } +// } + +// /// +// /// Called when the entered login id is to be checked. +// /// +// /// The trigger of the event. +// /// The event argument. +// private void OnLoginValidation(object sender, ValidationEventArgs e) +// { +// if (string.IsNullOrWhiteSpace(Login.Value)) +// { +// e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.user.add.login.error.empty")); +// } + +// if (UserManager.Users.Where(x => x.Login.Equals(Login.Value, StringComparison.OrdinalIgnoreCase)).Any()) +// { +// e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.user.add.login.error.duplicate")); +// } +// } + +// /// +// /// Called when the entered first name is to be checked. +// /// +// /// The trigger of the event. +// /// The event argument. +// private void OnFirstnameValidation(object sender, ValidationEventArgs e) +// { +// if (string.IsNullOrWhiteSpace(Firstname.Value)) +// { +// e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.user.add.firstname.error.empty")); +// } +// } + +// /// +// /// Called when the entered last name is to be checked. +// /// +// /// The trigger of the event. +// /// The event argument. +// private void OnLastnameValidation(object sender, ValidationEventArgs e) +// { +// if (string.IsNullOrWhiteSpace(Lastname.Value)) +// { +// e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.user.add.lastname.error.empty")); +// } +// } + +// /// +// /// Invoked when the entered email address is to be verified. +// /// +// /// The trigger of the event. +// /// The event argument. +// private void OnEmailValidation(object sender, ValidationEventArgs e) +// { +// if (string.IsNullOrWhiteSpace(Email.Value)) +// { +// e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.user.add.email.error.empty")); +// } +// } + +// /// +// /// Called when the delete action has been confirmed. +// /// +// /// The trigger of the event. +// /// The event argument. +// private void OnConfirm(object sender, FormEventArgs e) +// { +// var user = new User() +// { +// Id = Guid.NewGuid(), +// Login = Login.Value, +// Firstname = Firstname.Value, +// Lastname = Lastname.Value, +// Email = Email.Value, +// Created = DateTime.Now, +// Updated = DateTime.Now +// }; + +// UserManager.AddUser(user); + +// e.Context.Page.Redirecting(e.Context.Uri); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppContent.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppContent.cs index f77740e..1d5dc2e 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppContent.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppContent.cs @@ -1,126 +1,126 @@ -using System.Collections.Generic; -using System.Linq; -using WebExpress.WebCore.WebHtml; -using WebExpress.WebCore.WebPage; -using WebExpress.WebApp.WebPage; -using WebExpress.WebUI.WebControl; - -namespace WebExpress.WebApp.WebControl -{ - /// - /// Content of a web app page. - /// - public class ControlWebAppContent : ControlPanel - { - /// - /// Returns the main panel. - /// - private ControlPanelMain MainPanel { get; } = new ControlPanelMain("webexpress.webapp.content.main") - { - Padding = new PropertySpacingPadding(PropertySpacing.Space.Two, PropertySpacing.Space.Null), - Margin = new PropertySpacingMargin(PropertySpacing.Space.Null, PropertySpacing.Space.Two, PropertySpacing.Space.Null, PropertySpacing.Space.Null), - BackgroundColor = LayoutSchema.ContentBackground, - Classes = new() { "flex-grow-1" } - }; - - /// - /// Returns the flexbox. - /// - private ControlPanelFlexbox Flexbox { get; } = new ControlPanelFlexbox() - { - Layout = TypeLayoutFlexbox.Default, - Align = TypeAlignFlexbox.Stretch - }; - - /// - /// Returns the page properties. - /// - public ControlWebAppProperty Property { get; } = new ControlWebAppProperty("webexpress.webapp.content.property"); - - /// - /// Returns the toolbar. - /// - public ControlToolbar Toolbar { get; } = new ControlToolbar("webexpress.webapp.content.toolbar"); - - /// - /// Returns the headline control. - /// - public ControlWebAppHeadline Headline { get; } = new ControlWebAppHeadline("webexpress.webapp.content.main.headline"); - - /// - /// Returns the preferences area. - /// - public List Preferences { get; } = new List(); - - /// - /// Returns the primary area. - /// - public List Primary { get; } = new List(); - - /// - /// Returns the secondary area. - /// - public List Secondary { get; } = new List(); - - /// - /// Initializes a new instance of the class. - /// - /// The control id. - public ControlWebAppContent(string id = null) - : base(id) - { - Init(); - - Classes.Add("content"); - } - - /// - /// Initialization - /// - private void Init() - { - BackgroundColor = LayoutSchema.ContentBackground; - Toolbar.BackgroundColor = LayoutSchema.ToolbarBackground; - Margin = new PropertySpacingMargin(PropertySpacing.Space.Two); - - Flexbox.Content.Add(MainPanel); - Flexbox.Content.Add(Property); - - Content.Add(Toolbar); - Content.Add(Flexbox); - } - - /// - /// Convert to html. - /// - /// The context in which the control is rendered. - /// The control as html. - public override IHtmlNode Render(RenderContext context) - { - MainPanel.Content.Clear(); - - MainPanel.Content.Add(Headline); - MainPanel.Content.Add(new ControlPanel("webexpress.webapp.content.main.preferences", Preferences)); - MainPanel.Content.Add(new ControlPanel("webexpress.webapp.content.main.primary", Primary)); - MainPanel.Content.Add(new ControlPanel("webexpress.webapp.content.main.secondary", Secondary)); - - Content.Clear(); - - if (Toolbar.Items.Any()) - { - Content.Add(Toolbar); - } - - if (Property.Preferences.Any() || Property.Primary.Any() || Property.Secondary.Any()) - { - Content.Add(Flexbox); - } - else - { - Content.Add(MainPanel); - } - - return base.Render(context); - } - } -} +//using System.Collections.Generic; +//using System.Linq; +//using WebExpress.WebCore.WebHtml; +//using WebExpress.WebCore.WebPage; +//using WebExpress.WebApp.WebPage; +//using WebExpress.WebUI.WebControl; + +//namespace WebExpress.WebApp.WebControl +//{ +// /// +// /// Content of a web app page. +// /// +// public class ControlWebAppContent : ControlPanel +// { +// /// +// /// Returns the main panel. +// /// +// private ControlPanelMain MainPanel { get; } = new ControlPanelMain("webexpress.webapp.content.main") +// { +// Padding = new PropertySpacingPadding(PropertySpacing.Space.Two, PropertySpacing.Space.Null), +// Margin = new PropertySpacingMargin(PropertySpacing.Space.Null, PropertySpacing.Space.Two, PropertySpacing.Space.Null, PropertySpacing.Space.Null), +// BackgroundColor = LayoutSchema.ContentBackground, +// Classes = new() { "flex-grow-1" } +// }; + +// /// +// /// Returns the flexbox. +// /// +// private ControlPanelFlexbox Flexbox { get; } = new ControlPanelFlexbox() +// { +// Layout = TypeLayoutFlexbox.Default, +// Align = TypeAlignFlexbox.Stretch +// }; + +// /// +// /// Returns the page properties. +// /// +// public ControlWebAppProperty Property { get; } = new ControlWebAppProperty("webexpress.webapp.content.property"); + +// /// +// /// Returns the toolbar. +// /// +// public ControlToolbar Toolbar { get; } = new ControlToolbar("webexpress.webapp.content.toolbar"); + +// /// +// /// Returns the headline control. +// /// +// public ControlWebAppHeadline Headline { get; } = new ControlWebAppHeadline("webexpress.webapp.content.main.headline"); + +// /// +// /// Returns the preferences area. +// /// +// public List Preferences { get; } = new List(); + +// /// +// /// Returns the primary area. +// /// +// public List Primary { get; } = new List(); + +// /// +// /// Returns the secondary area. +// /// +// public List Secondary { get; } = new List(); + +// /// +// /// Initializes a new instance of the class. +// /// +// /// The control id. +// public ControlWebAppContent(string id = null) +// : base(id) +// { +// Init(); + +// Classes.Add("content"); +// } + +// /// +// /// Initialization +// /// +// private void Init() +// { +// BackgroundColor = LayoutSchema.ContentBackground; +// Toolbar.BackgroundColor = LayoutSchema.ToolbarBackground; +// Margin = new PropertySpacingMargin(PropertySpacing.Space.Two); + +// Flexbox.Content.Add(MainPanel); +// Flexbox.Content.Add(Property); + +// Content.Add(Toolbar); +// Content.Add(Flexbox); +// } + +// /// +// /// Convert to html. +// /// +// /// The context in which the control is rendered. +// /// The control as html. +// public override IHtmlNode Render(RenderContext context) +// { +// MainPanel.Content.Clear(); + +// MainPanel.Content.Add(Headline); +// MainPanel.Content.Add(new ControlPanel("webexpress.webapp.content.main.preferences", Preferences)); +// MainPanel.Content.Add(new ControlPanel("webexpress.webapp.content.main.primary", Primary)); +// MainPanel.Content.Add(new ControlPanel("webexpress.webapp.content.main.secondary", Secondary)); + +// Content.Clear(); + +// if (Toolbar.Items.Any()) +// { +// Content.Add(Toolbar); +// } + +// if (Property.Preferences.Any() || Property.Primary.Any() || Property.Secondary.Any()) +// { +// Content.Add(Flexbox); +// } +// else +// { +// Content.Add(MainPanel); +// } + +// return base.Render(context); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppFooter.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppFooter.cs index 6b3f9ea..27e1825 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppFooter.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppFooter.cs @@ -1,72 +1,72 @@ -using System.Collections.Generic; -using System.Linq; -using WebExpress.WebApp.WebPage; -using WebExpress.WebCore.WebHtml; -using WebExpress.WebCore.WebPage; -using WebExpress.WebUI.WebControl; +//using System.Collections.Generic; +//using System.Linq; +//using WebExpress.WebApp.WebPage; +//using WebExpress.WebCore.WebHtml; +//using WebExpress.WebCore.WebPage; +//using WebExpress.WebUI.WebControl; -namespace WebExpress.WebApp.WebControl -{ - /// - /// Footer for a web app. - /// - public class ControlWebAppFooter : Control - { - /// - /// Returns or sets the preferences area. - /// - public List Preferences { get; protected set; } = new List(); +//namespace WebExpress.WebApp.WebControl +//{ +// /// +// /// Footer for a web app. +// /// +// public class ControlWebAppFooter : Control +// { +// /// +// /// Returns or sets the preferences area. +// /// +// public List Preferences { get; protected set; } = new List(); - /// - /// Returns or sets the primary area. - /// - public List Primary { get; protected set; } = new List(); +// /// +// /// Returns or sets the primary area. +// /// +// public List Primary { get; protected set; } = new List(); - /// - /// Returns or sets the secondary area. - /// - public List Secondary { get; protected set; } = new List(); +// /// +// /// Returns or sets the secondary area. +// /// +// public List Secondary { get; protected set; } = new List(); - /// - /// Initializes a new instance of the class. - /// - /// The control id. - public ControlWebAppFooter(string id = null) - : base(id) - { - Init(); - } +// /// +// /// Initializes a new instance of the class. +// /// +// /// The control id. +// public ControlWebAppFooter(string id = null) +// : base(id) +// { +// Init(); +// } - /// - /// Initialization - /// - private void Init() - { - BackgroundColor = LayoutSchema.FooterBackground; - TextColor = LayoutSchema.FooterText; - } +// /// +// /// Initialization +// /// +// private void Init() +// { +// BackgroundColor = LayoutSchema.FooterBackground; +// TextColor = LayoutSchema.FooterText; +// } - /// - /// Convert to html. - /// - /// The context in which the control is rendered. - /// The control as html. - public override IHtmlNode Render(RenderContext context) - { - var elements = new List - { - new HtmlElementTextContentDiv(Preferences.Select(x => x.Render(context))), - new HtmlElementTextContentDiv(Primary.Select(x => x.Render(context))) { Class = "justify-content-center" }, - new HtmlElementTextContentDiv(Secondary.Select(x => x.Render(context))) - }; +// /// +// /// Convert to html. +// /// +// /// The context in which the control is rendered. +// /// The control as html. +// public override IHtmlNode Render(RenderContext context) +// { +// var elements = new List +// { +// new HtmlElementTextContentDiv(Preferences.Select(x => x.Render(context))), +// new HtmlElementTextContentDiv(Primary.Select(x => x.Render(context))) { Class = "justify-content-center" }, +// new HtmlElementTextContentDiv(Secondary.Select(x => x.Render(context))) +// }; - return new HtmlElementTextContentDiv(elements) - { - Id = Id, - Class = Css.Concatenate("footer", GetClasses()), - Style = Style.Concatenate("", GetStyles()), - Role = Role - }; - } - } -} +// return new HtmlElementTextContentDiv(elements) +// { +// Id = Id, +// Class = Css.Concatenate("footer", GetClasses()), +// Style = Style.Concatenate("", GetStyles()), +// Role = Role +// }; +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeader.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeader.cs index 3ac0439..22d3dbd 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeader.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeader.cs @@ -1,8 +1,7 @@ using System.Collections.Generic; using WebExpress.WebCore.WebHtml; -using WebExpress.WebCore.WebPage; -using WebExpress.WebApp.WebPage; using WebExpress.WebUI.WebControl; +using WebExpress.WebUI.WebPage; namespace WebExpress.WebApp.WebControl { @@ -52,35 +51,35 @@ public virtual TypeSticky Sticky { }; - /// - /// Returns or sets the navigation of the application. - /// - public ControlWebAppHeaderAppNavigation AppNavigation { get; } = new ControlWebAppHeaderAppNavigation("webexpress.webapp.header.appnavigation") - { - Layout = TypeLayoutFlexbox.Inline, - Justify = TypeJustifiedFlexbox.Start - }; + ///// + ///// Returns or sets the navigation of the application. + ///// + //public ControlWebAppHeaderAppNavigation AppNavigation { get; } = new ControlWebAppHeaderAppNavigation("webexpress.webapp.header.appnavigation") + //{ + // Layout = TypeLayoutFlexbox.Inline, + // Justify = TypeJustifiedFlexbox.Start + //}; - /// - /// Returns or sets the quick create. - /// - public ControlWebAppHeaderQuickCreate QuickCreate { get; } = new ControlWebAppHeaderQuickCreate("webexpress.webapp.header.quickcreate") - { - }; + ///// + ///// Returns or sets the quick create. + ///// + //public ControlWebAppHeaderQuickCreate QuickCreate { get; } = new ControlWebAppHeaderQuickCreate("webexpress.webapp.header.quickcreate") + //{ + //}; - /// - /// Returns or sets the navigation of the application helpers. - /// - public ControlWebAppHeaderHelp Help { get; } = new ControlWebAppHeaderHelp("webexpress.webapp.header.help") - { - }; + ///// + ///// Returns or sets the navigation of the application helpers. + ///// + //public ControlWebAppHeaderHelp Help { get; } = new ControlWebAppHeaderHelp("webexpress.webapp.header.help") + //{ + //}; - /// - /// Returns or sets the navigation of the application settings. - /// - public ControlWebAppHeaderSettings Settings { get; } = new ControlWebAppHeaderSettings("webexpress.webapp.header.settings") - { - }; + ///// + ///// Returns or sets the navigation of the application settings. + ///// + //public ControlWebAppHeaderSettings Settings { get; } = new ControlWebAppHeaderSettings("webexpress.webapp.header.settings") + //{ + //}; /// /// Initializes a new instance of the class. @@ -88,44 +87,37 @@ public virtual TypeSticky Sticky /// The control id. public ControlWebAppHeader(string id = null) : base(id) - { - Init(); - } - - /// - /// Initialization - /// - private void Init() { Fixed = TypeFixed.Top; - Styles = new List(new[] { "position: sticky; top: 0; z-index: 99;" }); + Styles = new List(["position: sticky; top: 0; z-index: 99;"]); Padding = new PropertySpacingPadding(PropertySpacing.Space.Null); - BackgroundColor = LayoutSchema.HeaderBackground; + //BackgroundColor = LayoutSchema.HeaderBackground; } /// - /// Convert to html. + /// Convert the control to HTML. /// - /// The context in which the control is rendered. - /// The control as html. - public override IHtmlNode Render(RenderContext context) + /// The context in which the control is rendered. + /// An HTML node representing the rendered control. + public override IHtmlNode Render(IRenderControlContext renderContext) { var content = new ControlPanelFlexbox ( + null, AppNavigator, - AppTitle, - AppNavigation, - QuickCreate, - new ControlPanel() { Margin = new PropertySpacingMargin(PropertySpacing.Space.Auto, PropertySpacing.Space.None) }, - Help, - Settings + AppTitle//, + //AppNavigation, + //QuickCreate, + //new ControlPanel() { Margin = new PropertySpacingMargin(PropertySpacing.Space.Auto, PropertySpacing.Space.None) }, + //Help, + //Settings ) { Layout = TypeLayoutFlexbox.Default, Align = TypeAlignFlexbox.Center }; - return new HtmlElementSectionHeader(content.Render(context)) + return new HtmlElementSectionHeader(content.Render(renderContext)) { Id = Id, Class = Css.Concatenate("navbar", GetClasses()), diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigation.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigation.cs index b48d233..c648a60 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigation.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigation.cs @@ -1,88 +1,88 @@ -using System.Collections.Generic; -using WebExpress.WebCore.WebHtml; -using WebExpress.WebCore.WebPage; -using WebExpress.WebApp.WebPage; -using WebExpress.WebUI.WebControl; +//using System.Collections.Generic; +//using WebExpress.WebCore.WebHtml; +//using WebExpress.WebCore.WebPage; +//using WebExpress.WebApp.WebPage; +//using WebExpress.WebUI.WebControl; -namespace WebExpress.WebApp.WebControl -{ - /// - /// Header for a web app. - /// - public class ControlWebAppHeaderAppNavigation : ControlPanelFlexbox - { - /// - /// Returns or sets the preferences area. - /// - public List Preferences { get; protected set; } = new List(); +//namespace WebExpress.WebApp.WebControl +//{ +// /// +// /// Header for a web app. +// /// +// public class ControlWebAppHeaderAppNavigation : ControlPanelFlexbox +// { +// /// +// /// Returns or sets the preferences area. +// /// +// public List Preferences { get; protected set; } = new List(); - /// - /// Returns or sets the primary area. - /// - public List Primary { get; protected set; } = new List(); +// /// +// /// Returns or sets the primary area. +// /// +// public List Primary { get; protected set; } = new List(); - /// - /// Returns or sets the secondary area. - /// - public List Secondary { get; protected set; } = new List(); +// /// +// /// Returns or sets the secondary area. +// /// +// public List Secondary { get; protected set; } = new List(); - /// - /// Initializes a new instance of the class. - /// - /// The control id. - public ControlWebAppHeaderAppNavigation(string id = null) - : base(id) - { - Init(); - } +// /// +// /// Initializes a new instance of the class. +// /// +// /// The control id. +// public ControlWebAppHeaderAppNavigation(string id = null) +// : base(id) +// { +// Init(); +// } - /// - /// Initialization - /// - private void Init() - { - Padding = new PropertySpacingPadding(PropertySpacing.Space.Null); - } +// /// +// /// Initialization +// /// +// private void Init() +// { +// Padding = new PropertySpacingPadding(PropertySpacing.Space.Null); +// } - /// - /// Convert to html. - /// - /// The context in which the control is rendered. - /// The control as html. - public override IHtmlNode Render(RenderContext context) - { +// /// +// /// Convert to html. +// /// +// /// The context in which the control is rendered. +// /// The control as html. +// public override IHtmlNode Render(RenderContext context) +// { - var preferences = new ControlNavigation("webexpress.webapp.header.appnavigation.preferences", Preferences) - { - Layout = TypeLayoutTab.Default, - ActiveColor = LayoutSchema.HeaderNavigationActiveBackground, - ActiveTextColor = LayoutSchema.HeaderNavigationActive, - LinkColor = LayoutSchema.HeaderNavigationLink - }; +// var preferences = new ControlNavigation("webexpress.webapp.header.appnavigation.preferences", Preferences) +// { +// Layout = TypeLayoutTab.Default, +// ActiveColor = LayoutSchema.HeaderNavigationActiveBackground, +// ActiveTextColor = LayoutSchema.HeaderNavigationActive, +// LinkColor = LayoutSchema.HeaderNavigationLink +// }; - var primary = new ControlNavigation("webexpress.webapp.header.appnavigation.primary", Primary) - { - Layout = TypeLayoutTab.Default, - ActiveColor = LayoutSchema.HeaderNavigationActiveBackground, - ActiveTextColor = LayoutSchema.HeaderNavigationActive, - LinkColor = LayoutSchema.HeaderNavigationLink - }; +// var primary = new ControlNavigation("webexpress.webapp.header.appnavigation.primary", Primary) +// { +// Layout = TypeLayoutTab.Default, +// ActiveColor = LayoutSchema.HeaderNavigationActiveBackground, +// ActiveTextColor = LayoutSchema.HeaderNavigationActive, +// LinkColor = LayoutSchema.HeaderNavigationLink +// }; - var secondary = new ControlNavigation("webexpress.webapp.header.appnavigation.secondary", Secondary) - { - Layout = TypeLayoutTab.Default, - ActiveColor = LayoutSchema.HeaderNavigationActiveBackground, - ActiveTextColor = LayoutSchema.HeaderNavigationActive, - LinkColor = LayoutSchema.HeaderNavigationLink - }; +// var secondary = new ControlNavigation("webexpress.webapp.header.appnavigation.secondary", Secondary) +// { +// Layout = TypeLayoutTab.Default, +// ActiveColor = LayoutSchema.HeaderNavigationActiveBackground, +// ActiveTextColor = LayoutSchema.HeaderNavigationActive, +// LinkColor = LayoutSchema.HeaderNavigationLink +// }; - return new HtmlElementTextContentDiv(preferences.Render(context), primary.Render(context), secondary.Render(context)) - { - Id = Id, - Class = Css.Concatenate("", GetClasses()), - Style = Style.Concatenate("", GetStyles()), - Role = Role - }; - } - } -} +// return new HtmlElementTextContentDiv(preferences.Render(context), primary.Render(context), secondary.Render(context)) +// { +// Id = Id, +// Class = Css.Concatenate("", GetClasses()), +// Style = Style.Concatenate("", GetStyles()), +// Role = Role +// }; +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigator.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigator.cs index 23e5991..b63ca7c 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigator.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigator.cs @@ -1,9 +1,9 @@ using System.Collections.Generic; +using System.Linq; using WebExpress.WebCore.Internationalization; -using WebExpress.WebCore.WebComponent; using WebExpress.WebCore.WebHtml; -using WebExpress.WebCore.WebPage; using WebExpress.WebUI.WebControl; +using WebExpress.WebUI.WebPage; namespace WebExpress.WebApp.WebControl { @@ -15,17 +15,17 @@ public class ControlWebAppHeaderAppNavigator : Control /// /// Returns or sets the preferences area. /// - public List Preferences { get; protected set; } = new List(); + public IEnumerable Preferences { get; protected set; } = []; /// /// Returns or sets the primary area. /// - public List Primary { get; protected set; } = new List(); + public IEnumerable Primary { get; protected set; } = []; /// /// Returns or sets the secondary area. /// - public List Secondary { get; protected set; } = new List(); + public IEnumerable Secondary { get; protected set; } = []; /// /// Initializes a new instance of the class. @@ -33,35 +33,27 @@ public class ControlWebAppHeaderAppNavigator : Control /// The control id. public ControlWebAppHeaderAppNavigator(string id = null) : base(id) - { - Init(); - } - - /// - /// Initialization - /// - private void Init() { Padding = new PropertySpacingPadding(PropertySpacing.Space.Null); } /// - /// Convert to html. + /// Convert the control to HTML. /// - /// The context in which the control is rendered. - /// The control as html. - public override IHtmlNode Render(RenderContext context) + /// The context in which the control is rendered. + /// An HTML node representing the rendered control. + public override IHtmlNode Render(IRenderControlContext renderContext) { - var application = ComponentManager.ApplicationManager.GetApplcation(context.Page?.ResourceContext.ApplicationContext?.ApplicationId); + var application = renderContext?.PageContext?.ApplicationContext; var hamburger = new List { - new ControlDropdownItemHeader() { Text = context.I18N(context.Page?.ResourceContext.ApplicationContext, context.Page?.ResourceContext.ApplicationContext?.ApplicationName) } + new ControlDropdownItemHeader() { Text = I18N.Translate(renderContext.Request.Culture, application?.ApplicationName) } }; hamburger.AddRange(Primary); - if (Primary.Count > 0 && Secondary.Count > 0) + if (Primary.Count() > 0 && Secondary.Count() > 0) { hamburger.Add(new ControlDropdownItemDivider()); } @@ -69,14 +61,14 @@ public override IHtmlNode Render(RenderContext context) hamburger.AddRange(Secondary); var logo = (hamburger.Count > 1) ? - (IControl)new ControlDropdown("webexpress.webapp.header.icon", hamburger) + (IControl)new ControlDropdown(Id, hamburger.ToArray()) { Image = application?.Icon, Height = 50, Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None), - Styles = new List() { "padding: 0.5em;" } + Styles = ["padding: 0.5em;"] } : - new ControlImage("webexpress.webapp.header.icon") + new ControlImage(Id) { Uri = application?.Icon, Height = 50, @@ -84,7 +76,7 @@ public override IHtmlNode Render(RenderContext context) Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None) }; - return logo?.Render(context); + return logo?.Render(renderContext); } } } diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppTitle.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppTitle.cs index b628ec8..4c516f6 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppTitle.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppTitle.cs @@ -1,8 +1,7 @@ -using WebExpress.WebApp.WebPage; -using WebExpress.WebCore.Internationalization; +using WebExpress.WebCore.Internationalization; using WebExpress.WebCore.WebHtml; -using WebExpress.WebCore.WebPage; using WebExpress.WebUI.WebControl; +using WebExpress.WebUI.WebPage; namespace WebExpress.WebApp.WebControl { @@ -17,38 +16,30 @@ public class ControlWebAppHeaderAppTitle : ControlLink /// The control id. public ControlWebAppHeaderAppTitle(string id = null) : base(id) - { - Init(); - } - - /// - /// Initialization - /// - private void Init() { Decoration = TypeTextDecoration.None; } /// - /// Convert to html. + /// Convert the control to HTML. /// - /// The context in which the control is rendered. - /// The control as html. - public override IHtmlNode Render(RenderContext context) + /// The context in which the control is rendered. + /// An HTML node representing the rendered control. + public override IHtmlNode Render(IRenderControlContext renderContext) { var apptitle = new ControlText() { - Text = context.I18N(context.ApplicationContext, context.ApplicationContext?.ApplicationName), - TextColor = LayoutSchema.HeaderTitle, + Text = I18N.Translate(renderContext.Request.Culture, renderContext.PageContext?.ApplicationContext?.ApplicationName), + //TextColor = LayoutSchema.HeaderTitle, Format = TypeFormatText.H1, Padding = new PropertySpacingPadding(PropertySpacing.Space.One), Margin = new PropertySpacingMargin(PropertySpacing.Space.None, PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.Null) }; - return new HtmlElementTextSemanticsA(apptitle.Render(context)) + return new HtmlElementTextSemanticsA(apptitle.Render(renderContext)) { Id = Id, - Href = context?.Page?.ResourceContext.ApplicationContext?.ContextPath?.ToString(), + Href = renderContext?.PageContext?.ApplicationContext?.ContextPath?.ToString(), Class = Css.Concatenate("", GetClasses()), Style = Style.Concatenate("", GetStyles()), Role = Role diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderHelp.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderHelp.cs index 62a9a91..8c44091 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderHelp.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderHelp.cs @@ -1,86 +1,86 @@ -using System.Collections.Generic; -using WebExpress.WebCore.Internationalization; -using WebExpress.WebCore.WebHtml; -using WebExpress.WebCore.WebPage; -using WebExpress.WebUI.WebControl; +//using System.Collections.Generic; +//using WebExpress.WebCore.Internationalization; +//using WebExpress.WebCore.WebHtml; +//using WebExpress.WebCore.WebPage; +//using WebExpress.WebUI.WebControl; -namespace WebExpress.WebApp.WebControl -{ - /// - /// Help control for a WebApp. - /// - public class ControlWebAppHeaderHelp : Control - { - /// - /// Returns or sets the preferences area. - /// - public List Preferences { get; protected set; } = new List(); +//namespace WebExpress.WebApp.WebControl +//{ +// /// +// /// Help control for a WebApp. +// /// +// public class ControlWebAppHeaderHelp : Control +// { +// /// +// /// Returns or sets the preferences area. +// /// +// public List Preferences { get; protected set; } = new List(); - /// - /// Returns or sets the primary area. - /// - public List Primary { get; protected set; } = new List(); +// /// +// /// Returns or sets the primary area. +// /// +// public List Primary { get; protected set; } = new List(); - /// - /// Returns or sets the secondary area. - /// - public List Secondary { get; protected set; } = new List(); +// /// +// /// Returns or sets the secondary area. +// /// +// public List Secondary { get; protected set; } = new List(); - /// - /// Initializes a new instance of the class. - /// - /// The controls id. - public ControlWebAppHeaderHelp(string id = null) - : base(id) - { - Init(); - } +// /// +// /// Initializes a new instance of the class. +// /// +// /// The controls id. +// public ControlWebAppHeaderHelp(string id = null) +// : base(id) +// { +// Init(); +// } - /// - /// Initialization - /// - private void Init() - { - Padding = new PropertySpacingPadding(PropertySpacing.Space.Null); - } +// /// +// /// Initialization +// /// +// private void Init() +// { +// Padding = new PropertySpacingPadding(PropertySpacing.Space.Null); +// } - /// - /// Convert to html. - /// - /// The context in which the control is rendered. - /// The control as html. - public override IHtmlNode Render(RenderContext context) - { - var helpList = new List - { - new ControlDropdownItemHeader() { Text = context.I18N("webexpress.webapp", "header.help.label") } - }; +// /// +// /// Convert to html. +// /// +// /// The context in which the control is rendered. +// /// The control as html. +// public override IHtmlNode Render(RenderContext context) +// { +// var helpList = new List +// { +// new ControlDropdownItemHeader() { Text = context.I18N("webexpress.webapp", "header.help.label") } +// }; - helpList.AddRange(Preferences); - if (Preferences.Count > 0 && Primary.Count > 0) - { - helpList.Add(new ControlDropdownItemDivider()); - } +// helpList.AddRange(Preferences); +// if (Preferences.Count > 0 && Primary.Count > 0) +// { +// helpList.Add(new ControlDropdownItemDivider()); +// } - helpList.AddRange(Primary); - if (Primary.Count > 0 && Secondary.Count > 0) - { - helpList.Add(new ControlDropdownItemDivider()); - } +// helpList.AddRange(Primary); +// if (Primary.Count > 0 && Secondary.Count > 0) +// { +// helpList.Add(new ControlDropdownItemDivider()); +// } - helpList.AddRange(Secondary); +// helpList.AddRange(Secondary); - var help = (helpList.Count > 1) ? - new ControlDropdown(Id, helpList) - { - Icon = new PropertyIcon(TypeIcon.InfoCircle), - AlignmentMenu = TypeAlignmentDropdownMenu.Right, - BackgroundColor = new PropertyColorButton(TypeColorButton.Dark), - Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.None, PropertySpacing.Space.None) - } : - null; +// var help = (helpList.Count > 1) ? +// new ControlDropdown(Id, helpList) +// { +// Icon = new PropertyIcon(TypeIcon.InfoCircle), +// AlignmentMenu = TypeAlignmentDropdownMenu.Right, +// BackgroundColor = new PropertyColorButton(TypeColorButton.Dark), +// Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.None, PropertySpacing.Space.None) +// } : +// null; - return help?.Render(context); - } - } -} +// return help?.Render(context); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderQuickCreate.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderQuickCreate.cs index bca69ea..0834224 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderQuickCreate.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderQuickCreate.cs @@ -1,90 +1,90 @@ -using System.Collections.Generic; -using System.Linq; -using WebExpress.WebCore.Internationalization; -using WebExpress.WebCore.WebHtml; -using WebExpress.WebCore.WebPage; -using WebExpress.WebApp.WebPage; -using WebExpress.WebUI.WebControl; +//using System.Collections.Generic; +//using System.Linq; +//using WebExpress.WebCore.Internationalization; +//using WebExpress.WebCore.WebHtml; +//using WebExpress.WebCore.WebPage; +//using WebExpress.WebApp.WebPage; +//using WebExpress.WebUI.WebControl; -namespace WebExpress.WebApp.WebControl -{ - /// - /// Quick create control element for a WebApp. - /// - public class ControlWebAppHeaderQuickCreate : Control - { - /// - /// Returns or sets the preferences area. - /// - public List Preferences { get; protected set; } = new List(); +//namespace WebExpress.WebApp.WebControl +//{ +// /// +// /// Quick create control element for a WebApp. +// /// +// public class ControlWebAppHeaderQuickCreate : Control +// { +// /// +// /// Returns or sets the preferences area. +// /// +// public List Preferences { get; protected set; } = new List(); - /// - /// Returns or sets the primary area. - /// - public List Primary { get; protected set; } = new List(); +// /// +// /// Returns or sets the primary area. +// /// +// public List Primary { get; protected set; } = new List(); - /// - /// Returns or sets the secondary area. - /// - public List Secondary { get; protected set; } = new List(); +// /// +// /// Returns or sets the secondary area. +// /// +// public List Secondary { get; protected set; } = new List(); - /// - /// Initializes a new instance of the class. - /// - /// The control id. - public ControlWebAppHeaderQuickCreate(string id = null) - : base(id) - { - Init(); - } +// /// +// /// Initializes a new instance of the class. +// /// +// /// The control id. +// public ControlWebAppHeaderQuickCreate(string id = null) +// : base(id) +// { +// Init(); +// } - /// - /// Initialization - /// - private void Init() - { - Padding = new PropertySpacingPadding(PropertySpacing.Space.Null); - } +// /// +// /// Initialization +// /// +// private void Init() +// { +// Padding = new PropertySpacingPadding(PropertySpacing.Space.Null); +// } - /// - /// Convert to html. - /// - /// The context in which the control is rendered. - /// The control as html. - public override IHtmlNode Render(RenderContext context) - { - var quickcreateList = new List(Preferences); - quickcreateList.AddRange(Primary); - quickcreateList.AddRange(Secondary); +// /// +// /// Convert to html. +// /// +// /// The context in which the control is rendered. +// /// The control as html. +// public override IHtmlNode Render(RenderContext context) +// { +// var quickcreateList = new List(Preferences); +// quickcreateList.AddRange(Primary); +// quickcreateList.AddRange(Secondary); - var firstQuickcreate = (quickcreateList.FirstOrDefault() as ControlLink); - firstQuickcreate?.Render(context); +// var firstQuickcreate = (quickcreateList.FirstOrDefault() as ControlLink); +// firstQuickcreate?.Render(context); - var quickcreate = (quickcreateList.Count > 1) ? - (IControl)new ControlSplitButtonLink(Id, quickcreateList.Skip(1)) - { - Text = context.I18N("webexpress.webapp", "header.quickcreate.label"), - Uri = firstQuickcreate?.Uri, - BackgroundColor = LayoutSchema.HeaderQuickCreateButtonBackground, - Size = LayoutSchema.HeaderQuickCreateButtonSize, - Margin = new PropertySpacingMargin(PropertySpacing.Space.Auto, PropertySpacing.Space.None), - OnClick = firstQuickcreate?.OnClick, - Modal = firstQuickcreate?.Modal - } : - (Preferences.Count > 0) ? - new ControlButtonLink(Id) - { - Text = context.I18N("webexpress.webapp", "header.quickcreate.label"), - Uri = firstQuickcreate?.Uri, - BackgroundColor = LayoutSchema.HeaderQuickCreateButtonBackground, - Size = LayoutSchema.HeaderQuickCreateButtonSize, - Margin = new PropertySpacingMargin(PropertySpacing.Space.Auto, PropertySpacing.Space.None), - OnClick = firstQuickcreate?.OnClick, - Modal = firstQuickcreate?.Modal - } : - null; +// var quickcreate = (quickcreateList.Count > 1) ? +// (IControl)new ControlSplitButtonLink(Id, quickcreateList.Skip(1)) +// { +// Text = context.I18N("webexpress.webapp", "header.quickcreate.label"), +// Uri = firstQuickcreate?.Uri, +// BackgroundColor = LayoutSchema.HeaderQuickCreateButtonBackground, +// Size = LayoutSchema.HeaderQuickCreateButtonSize, +// Margin = new PropertySpacingMargin(PropertySpacing.Space.Auto, PropertySpacing.Space.None), +// OnClick = firstQuickcreate?.OnClick, +// Modal = firstQuickcreate?.Modal +// } : +// (Preferences.Count > 0) ? +// new ControlButtonLink(Id) +// { +// Text = context.I18N("webexpress.webapp", "header.quickcreate.label"), +// Uri = firstQuickcreate?.Uri, +// BackgroundColor = LayoutSchema.HeaderQuickCreateButtonBackground, +// Size = LayoutSchema.HeaderQuickCreateButtonSize, +// Margin = new PropertySpacingMargin(PropertySpacing.Space.Auto, PropertySpacing.Space.None), +// OnClick = firstQuickcreate?.OnClick, +// Modal = firstQuickcreate?.Modal +// } : +// null; - return quickcreate?.Render(context); - } - } -} +// return quickcreate?.Render(context); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs index b708379..d0c3ca4 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs @@ -1,86 +1,86 @@ -using System.Collections.Generic; -using WebExpress.WebCore.Internationalization; -using WebExpress.WebCore.WebHtml; -using WebExpress.WebCore.WebPage; -using WebExpress.WebUI.WebControl; +//using System.Collections.Generic; +//using WebExpress.WebCore.Internationalization; +//using WebExpress.WebCore.WebHtml; +//using WebExpress.WebCore.WebPage; +//using WebExpress.WebUI.WebControl; -namespace WebExpress.WebApp.WebControl -{ - /// - /// Settings controls for a web app. - /// - public class ControlWebAppHeaderSettings : Control - { - /// - /// Returns or sets the preferences area. - /// - public List Preferences { get; protected set; } = new List(); +//namespace WebExpress.WebApp.WebControl +//{ +// /// +// /// Settings controls for a web app. +// /// +// public class ControlWebAppHeaderSettings : Control +// { +// /// +// /// Returns or sets the preferences area. +// /// +// public List Preferences { get; protected set; } = new List(); - /// - /// Returns or sets the primary area. - /// - public List Primary { get; protected set; } = new List(); +// /// +// /// Returns or sets the primary area. +// /// +// public List Primary { get; protected set; } = new List(); - /// - /// Returns or sets the secondary area. - /// - public List Secondary { get; protected set; } = new List(); +// /// +// /// Returns or sets the secondary area. +// /// +// public List Secondary { get; protected set; } = new List(); - /// - /// Initializes a new instance of the class. - /// - /// The control id. - public ControlWebAppHeaderSettings(string id = null) - : base(id) - { - Init(); - } +// /// +// /// Initializes a new instance of the class. +// /// +// /// The control id. +// public ControlWebAppHeaderSettings(string id = null) +// : base(id) +// { +// Init(); +// } - /// - /// Initialization - /// - private void Init() - { - Padding = new PropertySpacingPadding(PropertySpacing.Space.Null); - } +// /// +// /// Initialization +// /// +// private void Init() +// { +// Padding = new PropertySpacingPadding(PropertySpacing.Space.Null); +// } - /// - /// Convert to html. - /// - /// The context in which the control is rendered. - /// The control as html. - public override IHtmlNode Render(RenderContext context) - { - var settingsList = new List - { - new ControlDropdownItemHeader() { Text = context.I18N("webexpress.webapp", "header.setting.label") } - }; +// /// +// /// Convert to html. +// /// +// /// The context in which the control is rendered. +// /// The control as html. +// public override IHtmlNode Render(RenderContext context) +// { +// var settingsList = new List +// { +// new ControlDropdownItemHeader() { Text = context.I18N("webexpress.webapp", "header.setting.label") } +// }; - settingsList.AddRange(Preferences); - if (Preferences.Count > 0 && Primary.Count > 0) - { - settingsList.Add(new ControlDropdownItemDivider()); - } +// settingsList.AddRange(Preferences); +// if (Preferences.Count > 0 && Primary.Count > 0) +// { +// settingsList.Add(new ControlDropdownItemDivider()); +// } - settingsList.AddRange(Primary); - if (Primary.Count > 0 && Secondary.Count > 0) - { - settingsList.Add(new ControlDropdownItemDivider()); - } +// settingsList.AddRange(Primary); +// if (Primary.Count > 0 && Secondary.Count > 0) +// { +// settingsList.Add(new ControlDropdownItemDivider()); +// } - settingsList.AddRange(Secondary); +// settingsList.AddRange(Secondary); - var settings = (settingsList.Count > 1) ? - new ControlDropdown(Id, settingsList) - { - Icon = new PropertyIcon(TypeIcon.Cog), - AlignmentMenu = TypeAlignmentDropdownMenu.Right, - BackgroundColor = new PropertyColorButton(TypeColorButton.Dark), - Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.None, PropertySpacing.Space.None) - } : - null; +// var settings = (settingsList.Count > 1) ? +// new ControlDropdown(Id, settingsList) +// { +// Icon = new PropertyIcon(TypeIcon.Cog), +// AlignmentMenu = TypeAlignmentDropdownMenu.Right, +// BackgroundColor = new PropertyColorButton(TypeColorButton.Dark), +// Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.None, PropertySpacing.Space.None) +// } : +// null; - return settings?.Render(context); - } - } -} +// return settings?.Render(context); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeadline.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeadline.cs index 6505210..c0d2eaf 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeadline.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeadline.cs @@ -1,166 +1,166 @@ -using System.Collections.Generic; -using System.Linq; -using WebExpress.WebCore.WebHtml; -using WebExpress.WebCore.WebPage; -using WebExpress.WebApp.WebPage; -using WebExpress.WebUI.WebControl; -using static WebExpress.WebCore.Internationalization.InternationalizationManager; - -namespace WebExpress.WebApp.WebControl -{ - /// - /// Headline for an web app. - /// - public class ControlWebAppHeadline : Control - { - /// - /// Returns or sets the prologue area. - /// - public List Prologue { get; protected set; } = new List(); - - /// - /// Returns or sets the preferences area. - /// - public List Preferences { get; protected set; } = new List(); - - /// - /// Returns or sets the primary area. - /// - public List Primary { get; protected set; } = new List(); - - /// - /// Returns or sets the secondary area. - /// - public List Secondary { get; protected set; } = new List(); - - /// - /// Returns or sets the preferences area for the more control. - /// - public List MorePreferences { get; protected set; } = new List(); - - /// - /// Returns or sets the primary area for the more control. - /// - public List MorePrimary { get; protected set; } = new List(); - - /// - /// Returns or sets the secondary area for the more control. - /// - public List MoreSecondary { get; protected set; } = new List(); - - /// - /// Returns or sets the secondary area for the metadata. - /// - public List Metadata { get; protected set; } = new List(); - - /// - /// Initializes a new instance of the class. - /// - /// The control id. - public ControlWebAppHeadline(string id = null) - : base(id) - { - Init(); - } - - /// - /// Initialization - /// - private void Init() - { - BackgroundColor = LayoutSchema.HeadlineBackground; - } - - /// - /// Convert to html. - /// - /// The context in which the control is rendered. - /// The control as html. - public override IHtmlNode Render(RenderContext context) - { - var prologue = new ControlPanelFlexbox(Prologue) { Layout = TypeLayoutFlexbox.Default, Align = TypeAlignFlexbox.Center, Justify = TypeJustifiedFlexbox.Start }; - prologue.Content.Add(new ControlText() - { - Text = I18N(context.Culture, context.Page.Title), - TextColor = LayoutSchema.HeadlineTitle, - Format = TypeFormatText.H2, - Padding = new PropertySpacingPadding(PropertySpacing.Space.One), - Margin = new PropertySpacingMargin(PropertySpacing.Space.None, PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.Null) - }); - prologue.Content.AddRange(Preferences); - - var epilog = new ControlPanelFlexbox(Secondary) { Layout = TypeLayoutFlexbox.Default, Align = TypeAlignFlexbox.Center, Justify = TypeJustifiedFlexbox.End }; - if (MorePreferences.Count() > 0 || MorePrimary.Count() > 0 || MoreSecondary.Count() > 0) - { - var more = new ControlDropdown("more") - { - Title = I18N(context.Culture, "webexpress.webapp", "headline.more.title"), - Icon = new PropertyIcon(TypeIcon.EllipsisHorizontal), - TextColor = LayoutSchema.HeadlineTitle, - Padding = new PropertySpacingPadding(PropertySpacing.Space.One), - Margin = new PropertySpacingMargin(PropertySpacing.Space.None, PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.Null) - }; - - foreach (var v in MorePreferences) - { - more.Add(v); - } - - if (MorePreferences.Count > 0 && (MorePrimary.Count > 0 || MoreSecondary.Count > 0)) - { - more.AddSeperator(); - } - - foreach (var v in MorePrimary) - { - more.Add(v); - } - - if (MorePrimary.Count() > 0 && MoreSecondary.Count > 0) - { - more.AddSeperator(); - } - - foreach (var v in MoreSecondary) - { - more.Add(v); - } - - epilog.Content.Add(more); - } - - var content = new ControlPanelFlexbox - ( - prologue, - new ControlPanelFlexbox(Primary) { Layout = TypeLayoutFlexbox.Default, Align = TypeAlignFlexbox.Center, Justify = TypeJustifiedFlexbox.End }, - epilog - ) - { - Layout = TypeLayoutFlexbox.Default, - Align = TypeAlignFlexbox.Center, - Justify = TypeJustifiedFlexbox.Between - }; - - var metadata = new HtmlElementTextContentDiv - ( - Metadata.Select(x => x.Render(context)) - ) - { - Class = Css.Concatenate("ms-2 me-2 mb-3 text-secondary"), - Style = Style.Concatenate("font-size:0.75rem;") - }; - - return new HtmlElementSectionHeader - ( - content.Render(context), - Metadata.Count > 0 ? metadata : null - ) - { - Id = Id, - Class = Css.Concatenate("", GetClasses()), - Style = Style.Concatenate("display: block;", GetStyles()), - Role = Role - }; - } - } -} +//using System.Collections.Generic; +//using System.Linq; +//using WebExpress.WebCore.WebHtml; +//using WebExpress.WebCore.WebPage; +//using WebExpress.WebApp.WebPage; +//using WebExpress.WebUI.WebControl; +//using static WebExpress.WebCore.Internationalization.InternationalizationManager; + +//namespace WebExpress.WebApp.WebControl +//{ +// /// +// /// Headline for an web app. +// /// +// public class ControlWebAppHeadline : Control +// { +// /// +// /// Returns or sets the prologue area. +// /// +// public List Prologue { get; protected set; } = new List(); + +// /// +// /// Returns or sets the preferences area. +// /// +// public List Preferences { get; protected set; } = new List(); + +// /// +// /// Returns or sets the primary area. +// /// +// public List Primary { get; protected set; } = new List(); + +// /// +// /// Returns or sets the secondary area. +// /// +// public List Secondary { get; protected set; } = new List(); + +// /// +// /// Returns or sets the preferences area for the more control. +// /// +// public List MorePreferences { get; protected set; } = new List(); + +// /// +// /// Returns or sets the primary area for the more control. +// /// +// public List MorePrimary { get; protected set; } = new List(); + +// /// +// /// Returns or sets the secondary area for the more control. +// /// +// public List MoreSecondary { get; protected set; } = new List(); + +// /// +// /// Returns or sets the secondary area for the metadata. +// /// +// public List Metadata { get; protected set; } = new List(); + +// /// +// /// Initializes a new instance of the class. +// /// +// /// The control id. +// public ControlWebAppHeadline(string id = null) +// : base(id) +// { +// Init(); +// } + +// /// +// /// Initialization +// /// +// private void Init() +// { +// BackgroundColor = LayoutSchema.HeadlineBackground; +// } + +// /// +// /// Convert to html. +// /// +// /// The context in which the control is rendered. +// /// The control as html. +// public override IHtmlNode Render(RenderContext context) +// { +// var prologue = new ControlPanelFlexbox(Prologue) { Layout = TypeLayoutFlexbox.Default, Align = TypeAlignFlexbox.Center, Justify = TypeJustifiedFlexbox.Start }; +// prologue.Content.Add(new ControlText() +// { +// Text = I18N(context.Culture, context.Page.Title), +// TextColor = LayoutSchema.HeadlineTitle, +// Format = TypeFormatText.H2, +// Padding = new PropertySpacingPadding(PropertySpacing.Space.One), +// Margin = new PropertySpacingMargin(PropertySpacing.Space.None, PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.Null) +// }); +// prologue.Content.AddRange(Preferences); + +// var epilog = new ControlPanelFlexbox(Secondary) { Layout = TypeLayoutFlexbox.Default, Align = TypeAlignFlexbox.Center, Justify = TypeJustifiedFlexbox.End }; +// if (MorePreferences.Count() > 0 || MorePrimary.Count() > 0 || MoreSecondary.Count() > 0) +// { +// var more = new ControlDropdown("more") +// { +// Title = I18N(context.Culture, "webexpress.webapp", "headline.more.title"), +// Icon = new PropertyIcon(TypeIcon.EllipsisHorizontal), +// TextColor = LayoutSchema.HeadlineTitle, +// Padding = new PropertySpacingPadding(PropertySpacing.Space.One), +// Margin = new PropertySpacingMargin(PropertySpacing.Space.None, PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.Null) +// }; + +// foreach (var v in MorePreferences) +// { +// more.Add(v); +// } + +// if (MorePreferences.Count > 0 && (MorePrimary.Count > 0 || MoreSecondary.Count > 0)) +// { +// more.AddSeperator(); +// } + +// foreach (var v in MorePrimary) +// { +// more.Add(v); +// } + +// if (MorePrimary.Count() > 0 && MoreSecondary.Count > 0) +// { +// more.AddSeperator(); +// } + +// foreach (var v in MoreSecondary) +// { +// more.Add(v); +// } + +// epilog.Content.Add(more); +// } + +// var content = new ControlPanelFlexbox +// ( +// prologue, +// new ControlPanelFlexbox(Primary) { Layout = TypeLayoutFlexbox.Default, Align = TypeAlignFlexbox.Center, Justify = TypeJustifiedFlexbox.End }, +// epilog +// ) +// { +// Layout = TypeLayoutFlexbox.Default, +// Align = TypeAlignFlexbox.Center, +// Justify = TypeJustifiedFlexbox.Between +// }; + +// var metadata = new HtmlElementTextContentDiv +// ( +// Metadata.Select(x => x.Render(context)) +// ) +// { +// Class = Css.Concatenate("ms-2 me-2 mb-3 text-secondary"), +// Style = Style.Concatenate("font-size:0.75rem;") +// }; + +// return new HtmlElementSectionHeader +// ( +// content.Render(context), +// Metadata.Count > 0 ? metadata : null +// ) +// { +// Id = Id, +// Class = Css.Concatenate("", GetClasses()), +// Style = Style.Concatenate("display: block;", GetStyles()), +// Role = Role +// }; +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppProperty.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppProperty.cs index f904b75..19275f3 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppProperty.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppProperty.cs @@ -1,73 +1,73 @@ -using System.Collections.Generic; -using System.Linq; -using WebExpress.WebCore.WebHtml; -using WebExpress.WebCore.WebPage; -using WebExpress.WebApp.WebPage; -using WebExpress.WebUI.WebControl; +//using System.Collections.Generic; +//using System.Linq; +//using WebExpress.WebCore.WebHtml; +//using WebExpress.WebCore.WebPage; +//using WebExpress.WebApp.WebPage; +//using WebExpress.WebUI.WebControl; -namespace WebExpress.WebApp.WebControl -{ - /// - /// Properties for a web app. - /// - public class ControlWebAppProperty : Control - { - /// - /// Returns or sets the preferences area. - /// - public List Preferences { get; protected set; } = new List(); +//namespace WebExpress.WebApp.WebControl +//{ +// /// +// /// Properties for a web app. +// /// +// public class ControlWebAppProperty : Control +// { +// /// +// /// Returns or sets the preferences area. +// /// +// public List Preferences { get; protected set; } = new List(); - /// - /// Returns or sets the primary area. - /// - public List Primary { get; protected set; } = new List(); +// /// +// /// Returns or sets the primary area. +// /// +// public List Primary { get; protected set; } = new List(); - /// - /// Returns or sets the secondary area. - /// - public List Secondary { get; protected set; } = new List(); +// /// +// /// Returns or sets the secondary area. +// /// +// public List Secondary { get; protected set; } = new List(); - /// - /// Initializes a new instance of the class. - /// - /// The control id. - public ControlWebAppProperty(string id = null) - : base(id) - { - Init(); - } +// /// +// /// Initializes a new instance of the class. +// /// +// /// The control id. +// public ControlWebAppProperty(string id = null) +// : base(id) +// { +// Init(); +// } - /// - /// Initialization - /// - private void Init() - { - BackgroundColor = LayoutSchema.PropertyBackground; - } +// /// +// /// Initialization +// /// +// private void Init() +// { +// BackgroundColor = LayoutSchema.PropertyBackground; +// } - /// - /// Convert to html. - /// - /// The context in which the control is rendered. - /// The control as html. - public override IHtmlNode Render(RenderContext context) - { - if (Preferences.Count == 0 && Primary.Count == 0 && Secondary.Count == 0) - { - return null; - } +// /// +// /// Convert to html. +// /// +// /// The context in which the control is rendered. +// /// The control as html. +// public override IHtmlNode Render(RenderContext context) +// { +// if (Preferences.Count == 0 && Primary.Count == 0 && Secondary.Count == 0) +// { +// return null; +// } - var preferences = new HtmlElementTextContentDiv(Preferences.Select(x => x.Render(context))); - var primary = new HtmlElementTextContentDiv(Primary.Select(x => x.Render(context))); - var secondary = new HtmlElementTextContentDiv(Secondary.Select(x => x.Render(context))); +// var preferences = new HtmlElementTextContentDiv(Preferences.Select(x => x.Render(context))); +// var primary = new HtmlElementTextContentDiv(Primary.Select(x => x.Render(context))); +// var secondary = new HtmlElementTextContentDiv(Secondary.Select(x => x.Render(context))); - return new HtmlElementTextContentDiv(preferences, primary, secondary) - { - Id = Id, - Class = Css.Concatenate("proterty", GetClasses()), - Style = GetStyles(), - Role = Role - }; - } - } -} +// return new HtmlElementTextContentDiv(preferences, primary, secondary) +// { +// Id = Id, +// Class = Css.Concatenate("proterty", GetClasses()), +// Style = GetStyles(), +// Role = Role +// }; +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppSidebar.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppSidebar.cs index 208731b..8f1616e 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppSidebar.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppSidebar.cs @@ -1,86 +1,86 @@ -using System.Collections.Generic; -using System.Linq; -using WebExpress.WebCore.WebHtml; -using WebExpress.WebCore.WebPage; -using WebExpress.WebApp.WebPage; -using WebExpress.WebUI.WebControl; +//using System.Collections.Generic; +//using System.Linq; +//using WebExpress.WebCore.WebHtml; +//using WebExpress.WebCore.WebPage; +//using WebExpress.WebApp.WebPage; +//using WebExpress.WebUI.WebControl; -namespace WebExpress.WebApp.WebControl -{ - /// - /// Sidebar for a web app. - /// - public class ControlWebAppSidebar : Control - { - /// - /// Returns or sets the header area. - /// - public List Header { get; protected set; } = new List(); +//namespace WebExpress.WebApp.WebControl +//{ +// /// +// /// Sidebar for a web app. +// /// +// public class ControlWebAppSidebar : Control +// { +// /// +// /// Returns or sets the header area. +// /// +// public List Header { get; protected set; } = new List(); - /// - /// Returns or sets the preferences area. - /// - public List Preferences { get; protected set; } = new List(); +// /// +// /// Returns or sets the preferences area. +// /// +// public List Preferences { get; protected set; } = new List(); - /// - /// Returns or sets the primary area. - /// - public List Primary { get; protected set; } = new List(); +// /// +// /// Returns or sets the primary area. +// /// +// public List Primary { get; protected set; } = new List(); - /// - /// Returns or sets the secondary area. - /// - public List Secondary { get; protected set; } = new List(); +// /// +// /// Returns or sets the secondary area. +// /// +// public List Secondary { get; protected set; } = new List(); - /// - /// Determines whether content exists - /// - public bool HasContent => Header.Any() || Preferences.Any() || Primary.Any() || Secondary.Any(); +// /// +// /// Determines whether content exists +// /// +// public bool HasContent => Header.Any() || Preferences.Any() || Primary.Any() || Secondary.Any(); - /// - /// Initializes a new instance of the class. - /// - /// The control id. - public ControlWebAppSidebar(string id = null) - : base(id) - { - Init(); - } +// /// +// /// Initializes a new instance of the class. +// /// +// /// The control id. +// public ControlWebAppSidebar(string id = null) +// : base(id) +// { +// Init(); +// } - /// - /// Initialization - /// - private void Init() - { - BackgroundColor = LayoutSchema.SidebarBackground; - //Height = TypeHeight.OneHundred; - } +// /// +// /// Initialization +// /// +// private void Init() +// { +// BackgroundColor = LayoutSchema.SidebarBackground; +// //Height = TypeHeight.OneHundred; +// } - /// - /// Convert to html. - /// - /// The context in which the control is rendered. - /// The control as html. - public override IHtmlNode Render(RenderContext context) - { - if (!HasContent) - { - return null; - } +// /// +// /// Convert to html. +// /// +// /// The context in which the control is rendered. +// /// The control as html. +// public override IHtmlNode Render(RenderContext context) +// { +// if (!HasContent) +// { +// return null; +// } - var elements = new List(); - elements.AddRange(Header.Select(x => x.Render(context))); - elements.AddRange(Preferences.Select(x => x.Render(context))); - elements.AddRange(Primary.Select(x => x.Render(context))); - elements.AddRange(Secondary.Select(x => x.Render(context))); +// var elements = new List(); +// elements.AddRange(Header.Select(x => x.Render(context))); +// elements.AddRange(Preferences.Select(x => x.Render(context))); +// elements.AddRange(Primary.Select(x => x.Render(context))); +// elements.AddRange(Secondary.Select(x => x.Render(context))); - return new HtmlElementTextContentDiv(elements) - { - Id = Id, - Class = Css.Concatenate("sidebar", GetClasses()), - Style = Style.Concatenate("display: block;", GetStyles()), - Role = Role - }; - } - } -} +// return new HtmlElementTextContentDiv(elements) +// { +// Id = Id, +// Class = Css.Concatenate("sidebar", GetClasses()), +// Style = Style.Concatenate("display: block;", GetStyles()), +// Role = Role +// }; +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebControl/FormUploadEventArgs.cs b/src/WebExpress.WebApp/WebControl/FormUploadEventArgs.cs index d20240f..20087c4 100644 --- a/src/WebExpress.WebApp/WebControl/FormUploadEventArgs.cs +++ b/src/WebExpress.WebApp/WebControl/FormUploadEventArgs.cs @@ -1,22 +1,22 @@ -using WebExpress.WebCore.WebMessage; -using WebExpress.WebUI.WebControl; +//using WebExpress.WebCore.WebMessage; +//using WebExpress.WebUI.WebControl; -namespace WebExpress.WebApp.WebControl -{ - public class FormUploadEventArgs : FormEventArgs - { - /// - /// Returns or sets the file. - /// - public ParameterFile File { get; set; } +//namespace WebExpress.WebApp.WebControl +//{ +// public class FormUploadEventArgs : FormEventArgs +// { +// /// +// /// Returns or sets the file. +// /// +// public ParameterFile File { get; set; } - /// - /// Initializes a new instance of the class. - /// - /// The event argument. - public FormUploadEventArgs(FormEventArgs args) - { - Context = args.Context; - } - } -} +// /// +// /// Initializes a new instance of the class. +// /// +// /// The event argument. +// public FormUploadEventArgs(FormEventArgs args) +// { +// Context = args.Context; +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebExpress.WebApp.csproj b/src/WebExpress.WebApp/WebExpress.WebApp.csproj index ab3ec77..5960919 100644 --- a/src/WebExpress.WebApp/WebExpress.WebApp.csproj +++ b/src/WebExpress.WebApp/WebExpress.WebApp.csproj @@ -5,7 +5,7 @@ WebExpress.WebApp 0.0.8.0 0.0.8.0 - net8.0 + net9.0 any https://github.com/ReneSchwarzer/WebExpress.WebApp Rene_Schwarzer@hotmail.de diff --git a/src/WebExpress.WebApp/WebFragment/FragmentControlModalFormConfirmDelete.cs b/src/WebExpress.WebApp/WebFragment/FragmentControlModalFormConfirmDelete.cs index 3dca9a9..d9d4e2c 100644 --- a/src/WebExpress.WebApp/WebFragment/FragmentControlModalFormConfirmDelete.cs +++ b/src/WebExpress.WebApp/WebFragment/FragmentControlModalFormConfirmDelete.cs @@ -1,33 +1,33 @@ -using WebExpress.WebApp.WebControl; -using WebExpress.WebCore.WebPage; -using WebExpress.WebUI.WebFragment; +//using WebExpress.WebApp.WebControl; +//using WebExpress.WebCore.WebPage; +//using WebExpress.WebUI.WebFragment; -namespace WebExpress.WebApp.WebFragment -{ - public class FragmentControlModalFormConfirmDelete : ControlModalFormConfirmDelete, IFragment - { - /// - /// Returns the context. - /// - public IFragmentContext FragmentContext { get; private set; } +//namespace WebExpress.WebApp.WebFragment +//{ +// public class FragmentControlModalFormConfirmDelete : ControlModalFormConfirmDelete, IFragment +// { +// /// +// /// Returns the context. +// /// +// public IFragmentContext FragmentContext { get; private set; } - /// - /// Initializes a new instance of the class. - /// - /// The id of the fragment or null. - public FragmentControlModalFormConfirmDelete(string id = null) - : base(id) - { - } +// /// +// /// Initializes a new instance of the class. +// /// +// /// The id of the fragment or null. +// public FragmentControlModalFormConfirmDelete(string id = null) +// : base(id) +// { +// } - /// - /// Initialization - /// - /// The context. - /// The page where the fragment is active. - public virtual void Initialization(IFragmentContext context, IPage page) - { - FragmentContext = context; - } - } -} +// /// +// /// Initialization +// /// +// /// The context. +// /// The page where the fragment is active. +// public virtual void Initialization(IFragmentContext context, IPage page) +// { +// FragmentContext = context; +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebFragment/FragmentCrudTable.cs b/src/WebExpress.WebApp/WebFragment/FragmentCrudTable.cs index 4e01a21..0942749 100644 --- a/src/WebExpress.WebApp/WebFragment/FragmentCrudTable.cs +++ b/src/WebExpress.WebApp/WebFragment/FragmentCrudTable.cs @@ -1,79 +1,79 @@ -using System.Collections.Generic; -using System.Linq; -using WebExpress.WebCore.WebHtml; -using WebExpress.WebCore.WebPage; -using WebExpress.WebUI.WebFragment; -using static WebExpress.WebCore.Internationalization.InternationalizationManager; +//using System.Collections.Generic; +//using System.Linq; +//using WebExpress.WebCore.WebHtml; +//using WebExpress.WebCore.WebPage; +//using WebExpress.WebUI.WebFragment; +//using static WebExpress.WebCore.Internationalization.InternationalizationManager; -namespace WebExpress.WebApp.WebFragment -{ - public abstract class FragmentCrudTable : FragmentControlPanel - { - /// - /// Returns the uri to the REST API interface. - /// - public string RestApiUri { get; protected set; } +//namespace WebExpress.WebApp.WebFragment +//{ +// public abstract class FragmentCrudTable : FragmentControlPanel +// { +// /// +// /// Returns the uri to the REST API interface. +// /// +// public string RestApiUri { get; protected set; } - /// - /// Returns the editors to manipulate the data. - /// - public ICollection Editors { get; } = new List(); +// /// +// /// Returns the editors to manipulate the data. +// /// +// public ICollection Editors { get; } = new List(); - /// - /// Initializes a new instance of the class. - /// - /// The fragment id. - public FragmentCrudTable(string id = null) - : base(id) - { - } +// /// +// /// Initializes a new instance of the class. +// /// +// /// The fragment id. +// public FragmentCrudTable(string id = null) +// : base(id) +// { +// } - /// - /// Initialization - /// - /// The context. - /// The page where the fragment is active. - public override void Initialization(IFragmentContext context, IPage page) - { - base.Initialization(context, page); - } +// /// +// /// Initialization +// /// +// /// The context. +// /// The page where the fragment is active. +// public override void Initialization(IFragmentContext context, IPage page) +// { +// base.Initialization(context, page); +// } - /// - /// Convert to html. - /// - /// The context in which the control is rendered. - /// The control as html. - public override IHtmlNode Render(RenderContext context) - { - var search = $"Search: {{Placeholder: '{I18N(context.Culture, "webexpress.webapp:search.placeholder")}'}}"; - var table = $"Table: {{}}"; - var pagination = $"Pagination: {{ CSS: 'justify-content-end' }}"; - var editors = $"Editors: [" + string.Join(",", Editors.Select - ( - x => - { - if (x is FragmentCrudTableEditorLinkItem link) - { - return $"{{Label: '{I18N(context.Culture, link.Label)}', Icon: '{link.Icon.ToClass()}', Color: '{link.Color?.ToClass()}', CSS: 'dropdown-item' }}"; - } - else if (x is FragmentCrudTableEditorSeperatorItem seperator) - { - return $"{{ CSS: 'dropdown-divider' }}"; - } +// /// +// /// Convert to html. +// /// +// /// The context in which the control is rendered. +// /// The control as html. +// public override IHtmlNode Render(RenderContext context) +// { +// var search = $"Search: {{Placeholder: '{I18N(context.Culture, "webexpress.webapp:search.placeholder")}'}}"; +// var table = $"Table: {{}}"; +// var pagination = $"Pagination: {{ CSS: 'justify-content-end' }}"; +// var editors = $"Editors: [" + string.Join(",", Editors.Select +// ( +// x => +// { +// if (x is FragmentCrudTableEditorLinkItem link) +// { +// return $"{{Label: '{I18N(context.Culture, link.Label)}', Icon: '{link.Icon.ToClass()}', Color: '{link.Color?.ToClass()}', CSS: 'dropdown-item' }}"; +// } +// else if (x is FragmentCrudTableEditorSeperatorItem seperator) +// { +// return $"{{ CSS: 'dropdown-divider' }}"; +// } - return $"{{Label: '', Icon: '', Color: '' }}"; - } - )) + "]"; +// return $"{{Label: '', Icon: '', Color: '' }}"; +// } +// )) + "]"; - var settings = $"{{{search}, {table}, {pagination}, {editors}}}"; +// var settings = $"{{{search}, {table}, {pagination}, {editors}}}"; - context.VisualTree.AddScript - ( - "webexpress.webapp.usermanagement.user", - $"var crud = new crudTable('{RestApiUri}', {settings}); var container = $('#{Id}'); container.append(crud.getCtrl);" - ); +// context.VisualTree.AddScript +// ( +// "webexpress.webapp.usermanagement.user", +// $"var crud = new crudTable('{RestApiUri}', {settings}); var container = $('#{Id}'); container.append(crud.getCtrl);" +// ); - return base.Render(context); - } - } -} +// return base.Render(context); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebFragment/FragmentCrudTableEditorItem.cs b/src/WebExpress.WebApp/WebFragment/FragmentCrudTableEditorItem.cs index 49f685d..3e2a248 100644 --- a/src/WebExpress.WebApp/WebFragment/FragmentCrudTableEditorItem.cs +++ b/src/WebExpress.WebApp/WebFragment/FragmentCrudTableEditorItem.cs @@ -1,15 +1,15 @@ -namespace WebExpress.WebApp.WebFragment -{ - /// - /// Meta information of a CRUD table function. - /// - public abstract class FragmentCrudTableEditorItem - { - /// - /// Initializes a new instance of the class. - /// - public FragmentCrudTableEditorItem() - { - } - } -} +//namespace WebExpress.WebApp.WebFragment +//{ +// /// +// /// Meta information of a CRUD table function. +// /// +// public abstract class FragmentCrudTableEditorItem +// { +// /// +// /// Initializes a new instance of the class. +// /// +// public FragmentCrudTableEditorItem() +// { +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebFragment/FragmentCrudTableEditorLinkItem.cs b/src/WebExpress.WebApp/WebFragment/FragmentCrudTableEditorLinkItem.cs index 71a0ee8..5d23c59 100644 --- a/src/WebExpress.WebApp/WebFragment/FragmentCrudTableEditorLinkItem.cs +++ b/src/WebExpress.WebApp/WebFragment/FragmentCrudTableEditorLinkItem.cs @@ -1,34 +1,34 @@ -using WebExpress.WebUI.WebControl; +//using WebExpress.WebUI.WebControl; -namespace WebExpress.WebApp.WebFragment -{ - /// - /// Meta information of a CRUD table function. - /// - public class FragmentCrudTableEditorLinkItem : FragmentCrudTableEditorItem - { - /// - /// Returns or sets the label. - /// - public string Label { get; set; } +//namespace WebExpress.WebApp.WebFragment +//{ +// /// +// /// Meta information of a CRUD table function. +// /// +// public class FragmentCrudTableEditorLinkItem : FragmentCrudTableEditorItem +// { +// /// +// /// Returns or sets the label. +// /// +// public string Label { get; set; } - /// - /// Returns or sets the icon. - /// - public PropertyIcon Icon { get; set; } +// /// +// /// Returns or sets the icon. +// /// +// public PropertyIcon Icon { get; set; } - /// - /// Returns or sets the color. - /// - public PropertyColorText Color { get; set; } +// /// +// /// Returns or sets the color. +// /// +// public PropertyColorText Color { get; set; } - /// - /// Initializes a new instance of the class. - /// - /// The label of the column. - public FragmentCrudTableEditorLinkItem(string label) - { - Label = label; - } - } -} +// /// +// /// Initializes a new instance of the class. +// /// +// /// The label of the column. +// public FragmentCrudTableEditorLinkItem(string label) +// { +// Label = label; +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebFragment/FragmentCrudTableEditorSeperatorItem.cs b/src/WebExpress.WebApp/WebFragment/FragmentCrudTableEditorSeperatorItem.cs index a636af9..785cbb3 100644 --- a/src/WebExpress.WebApp/WebFragment/FragmentCrudTableEditorSeperatorItem.cs +++ b/src/WebExpress.WebApp/WebFragment/FragmentCrudTableEditorSeperatorItem.cs @@ -1,15 +1,15 @@ -namespace WebExpress.WebApp.WebFragment -{ - /// - /// Meta information of a CRUD table function. - /// - public class FragmentCrudTableEditorSeperatorItem : FragmentCrudTableEditorItem - { - /// - /// Initializes a new instance of the class. - /// - public FragmentCrudTableEditorSeperatorItem() - { - } - } -} +//namespace WebExpress.WebApp.WebFragment +//{ +// /// +// /// Meta information of a CRUD table function. +// /// +// public class FragmentCrudTableEditorSeperatorItem : FragmentCrudTableEditorItem +// { +// /// +// /// Initializes a new instance of the class. +// /// +// public FragmentCrudTableEditorSeperatorItem() +// { +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebFragment/FragmentHeaderSettingsSystemInformation.cs b/src/WebExpress.WebApp/WebFragment/FragmentHeaderSettingsSystemInformation.cs index 35d9ea5..0281683 100644 --- a/src/WebExpress.WebApp/WebFragment/FragmentHeaderSettingsSystemInformation.cs +++ b/src/WebExpress.WebApp/WebFragment/FragmentHeaderSettingsSystemInformation.cs @@ -1,46 +1,46 @@ -using WebExpress.WebCore.Internationalization; -using WebExpress.WebCore.WebHtml; -using WebExpress.WebCore.WebPage; -using WebExpress.WebUI.WebControl; -using WebExpress.WebUI.WebFragment; +//using WebExpress.WebCore.Internationalization; +//using WebExpress.WebCore.WebHtml; +//using WebExpress.WebCore.WebPage; +//using WebExpress.WebUI.WebControl; +//using WebExpress.WebUI.WebFragment; -namespace WebExpress.WebApp.WebFragment -{ - public abstract class FragmentHeaderSettingsSystemInformation : FragmentControlDropdownItemLink - { - /// - /// Initializes a new instance of the class. - /// - public FragmentHeaderSettingsSystemInformation() - : base() - { - } +//namespace WebExpress.WebApp.WebFragment +//{ +// public abstract class FragmentHeaderSettingsSystemInformation : FragmentControlDropdownItemLink +// { +// /// +// /// Initializes a new instance of the class. +// /// +// public FragmentHeaderSettingsSystemInformation() +// : base() +// { +// } - /// - /// Initialization - /// - /// The context. - /// The page where the fragment is active. - public override void Initialization(IFragmentContext context, IPage page) - { - base.Initialization(context, page); +// /// +// /// Initialization +// /// +// /// The context. +// /// The page where the fragment is active. +// public override void Initialization(IFragmentContext context, IPage page) +// { +// base.Initialization(context, page); - TextColor = new PropertyColorText(TypeColorText.Dark); - } +// TextColor = new PropertyColorText(TypeColorText.Dark); +// } - /// - /// Convert to html. - /// - /// The context in which the control is rendered. - /// The control as html. - public override IHtmlNode Render(RenderContext context) - { - Text = InternationalizationManager.I18N("webexpress.webapp:systeminformation.label"); - Uri = context.Request.Uri.ModuleRoot.Append("settings/systeminformation"); - //Active = context.Page is IPageSettings ? TypeActive.Active : TypeActive.None; - Icon = new PropertyIcon(TypeIcon.InfoCircle); +// /// +// /// Convert to html. +// /// +// /// The context in which the control is rendered. +// /// The control as html. +// public override IHtmlNode Render(RenderContext context) +// { +// Text = InternationalizationManager.I18N("webexpress.webapp:systeminformation.label"); +// Uri = context.Request.Uri.ModuleRoot.Append("settings/systeminformation"); +// //Active = context.Page is IPageSettings ? TypeActive.Active : TypeActive.None; +// Icon = new PropertyIcon(TypeIcon.InfoCircle); - return base.Render(context); - } - } -} +// return base.Render(context); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebFragment/FragmentPropertyReboot.cs b/src/WebExpress.WebApp/WebFragment/FragmentPropertyReboot.cs index 87bac16..c05b0c9 100644 --- a/src/WebExpress.WebApp/WebFragment/FragmentPropertyReboot.cs +++ b/src/WebExpress.WebApp/WebFragment/FragmentPropertyReboot.cs @@ -1,108 +1,106 @@ -using System; -using System.Diagnostics; -using System.Threading.Tasks; -using WebExpress.WebApp.WebCondition; -using WebExpress.WebApp.WebControl; -using WebExpress.WebApp.WebSection; -using WebExpress.WebApp.WebSettingPage; -using WebExpress.WebCore.WebAttribute; -using WebExpress.WebCore.WebHtml; -using WebExpress.WebCore.WebPage; -using WebExpress.WebUI.WebAttribute; -using WebExpress.WebUI.WebControl; -using WebExpress.WebUI.WebFragment; +//using System; +//using System.Diagnostics; +//using System.Threading.Tasks; +//using WebExpress.WebApp.WebCondition; +//using WebExpress.WebApp.WebControl; +//using WebExpress.WebApp.WebSection; +//using WebExpress.WebApp.WebSettingPage; +//using WebExpress.WebCore.WebAttribute; +//using WebExpress.WebCore.WebHtml; +//using WebExpress.WebCore.WebPage; +//using WebExpress.WebUI.WebControl; +//using WebExpress.WebUI.WebFragment; -namespace WebExpress.WebApp.WebFragment -{ - [Section(SectionWebApp.HeadlineSecondary)] - [Module] - [Scope] - [Condition] - public sealed class FragmentPropertyReboot : FragmentControlButtonLink - { - /// - /// Returns the modal dialog to confirm the delete action. - /// - private ControlModalFormConfirm ModalDlg = new ControlModalFormConfirm("archive_btn") - { - Header = "webexpress.webapp:setting.systeminformation.reboot.header", - Content = new ControlFormItemStaticText() { Text = "webexpress.webapp:setting.systeminformation.reboot.description" } - }; +//namespace WebExpress.WebApp.WebFragment +//{ +// [Section(SectionWebApp.HeadlineSecondary)] +// [Scope] +// [Condition] +// public sealed class FragmentPropertyReboot : FragmentControlButtonLink +// { +// /// +// /// Returns the modal dialog to confirm the delete action. +// /// +// private ControlModalFormConfirm ModalDlg = new ControlModalFormConfirm("archive_btn") +// { +// Header = "webexpress.webapp:setting.systeminformation.reboot.header", +// Content = new ControlFormItemStaticText() { Text = "webexpress.webapp:setting.systeminformation.reboot.description" } +// }; - /// - /// Initializes a new instance of the class. - /// - public FragmentPropertyReboot() - : base("archive_btn") - { - } +// /// +// /// Initializes a new instance of the class. +// /// +// public FragmentPropertyReboot() +// : base("archive_btn") +// { +// } - /// - /// Initialization - /// - /// The context. - /// The page where the fragment is active. - public override void Initialization(IFragmentContext context, IPage page) - { - base.Initialization(context, page); +// /// +// /// Initialization +// /// +// /// The context. +// /// The page where the fragment is active. +// public override void Initialization(IFragmentContext context, IPage page) +// { +// base.Initialization(context, page); - Text = "webexpress.webapp:setting.systeminformation.reboot.label"; - Margin = new PropertySpacingMargin(PropertySpacing.Space.Two); - BackgroundColor = new PropertyColorButton(TypeColorButton.Danger); - Icon = new PropertyIcon(TypeIcon.PowerOff); - TextColor = new PropertyColorText(TypeColorText.Light); +// Text = "webexpress.webapp:setting.systeminformation.reboot.label"; +// Margin = new PropertySpacingMargin(PropertySpacing.Space.Two); +// BackgroundColor = new PropertyColorButton(TypeColorButton.Danger); +// Icon = new PropertyIcon(TypeIcon.PowerOff); +// TextColor = new PropertyColorText(TypeColorText.Light); - ModalDlg.SubmitButtonIcon = Icon; - ModalDlg.SubmitButtonLabel = Text; - ModalDlg.SubmitButtonColor = new PropertyColorButton(TypeColorButton.Danger); - ModalDlg.Confirm += OnConfirm; +// ModalDlg.SubmitButtonIcon = Icon; +// ModalDlg.SubmitButtonLabel = Text; +// ModalDlg.SubmitButtonColor = new PropertyColorButton(TypeColorButton.Danger); +// ModalDlg.Confirm += OnConfirm; - Modal = new PropertyModal(TypeModal.Modal, ModalDlg); - } +// Modal = new PropertyModal(TypeModal.Modal, ModalDlg); +// } - /// - /// Called when the delete action has been confirmed. - /// - /// The trigger of the event. - /// The event argument. - private void OnConfirm(object sender, FormEventArgs e) - { - var process = new Process() - { - StartInfo = new ProcessStartInfo - { - FileName = "/bin/bash", - Arguments = $"-c \" sudo shutdown -r now \"", - RedirectStandardOutput = true, - UseShellExecute = false, - CreateNoWindow = true, - } - }; +// /// +// /// Called when the delete action has been confirmed. +// /// +// /// The trigger of the event. +// /// The event argument. +// private void OnConfirm(object sender, FormEventArgs e) +// { +// var process = new Process() +// { +// StartInfo = new ProcessStartInfo +// { +// FileName = "/bin/bash", +// Arguments = $"-c \" sudo shutdown -r now \"", +// RedirectStandardOutput = true, +// UseShellExecute = false, +// CreateNoWindow = true, +// } +// }; - Task.Run(() => - { - try - { - process.Start(); - var result = process.StandardOutput.ReadToEnd(); - process.WaitForExit(); +// Task.Run(() => +// { +// try +// { +// process.Start(); +// var result = process.StandardOutput.ReadToEnd(); +// process.WaitForExit(); - } - catch (Exception ex) - { - e.Context.ApplicationContext.PluginContext.Host.Log.Exception(ex); - } - }); - } +// } +// catch (Exception ex) +// { +// e.Context.ApplicationContext.PluginContext.Host.Log.Exception(ex); +// } +// }); +// } - /// - /// Convert to html. - /// - /// The context in which the control is rendered. - /// The control as html. - public override IHtmlNode Render(RenderContext context) - { - return base.Render(context); - } - } -} +// /// +// /// Convert to html. +// /// +// /// The context in which the control is rendered. +// /// The control as html. +// public override IHtmlNode Render(RenderContext context) +// { +// return base.Render(context); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebFragment/FragmentUserManagementAddGroup.cs b/src/WebExpress.WebApp/WebFragment/FragmentUserManagementAddGroup.cs index 4ea453d..63b6026 100644 --- a/src/WebExpress.WebApp/WebFragment/FragmentUserManagementAddGroup.cs +++ b/src/WebExpress.WebApp/WebFragment/FragmentUserManagementAddGroup.cs @@ -1,60 +1,60 @@ -using WebExpress.WebApp.WebControl; -using WebExpress.WebApp.WebSection; -using WebExpress.WebApp.WebSettingPage; -using WebExpress.WebCore.WebAttribute; -using WebExpress.WebCore.WebHtml; -using WebExpress.WebCore.WebPage; -using WebExpress.WebUI.WebAttribute; -using WebExpress.WebUI.WebControl; -using WebExpress.WebUI.WebFragment; +//using WebExpress.WebApp.WebControl; +//using WebExpress.WebApp.WebSection; +//using WebExpress.WebApp.WebSettingPage; +//using WebExpress.WebCore.WebAttribute; +//using WebExpress.WebCore.WebHtml; +//using WebExpress.WebCore.WebPage; +//using WebExpress.WebUI.WebAttribute; +//using WebExpress.WebUI.WebControl; +//using WebExpress.WebUI.WebFragment; -namespace WebExpress.WebApp.WebFragment -{ - [Section(SectionWebApp.HeadlineSecondary)] - [Module] - [Scope] - public sealed class FragmentUserManagementAddGroup : FragmentControlButtonLink - { - /// - /// Provides the modal dialog for adding a group. - /// - private ControlModalFormGoupNew ModalDlg = new ControlModalFormGoupNew("add_group") - { +//namespace WebExpress.WebApp.WebFragment +//{ +// [Section(SectionWebApp.HeadlineSecondary)] +// [Module] +// [Scope] +// public sealed class FragmentUserManagementAddGroup : FragmentControlButtonLink +// { +// /// +// /// Provides the modal dialog for adding a group. +// /// +// private ControlModalFormGoupNew ModalDlg = new ControlModalFormGoupNew("add_group") +// { - }; +// }; - /// - /// Initializes a new instance of the class. - /// - public FragmentUserManagementAddGroup() - : base("add_group") - { - } +// /// +// /// Initializes a new instance of the class. +// /// +// public FragmentUserManagementAddGroup() +// : base("add_group") +// { +// } - /// - /// Initialization - /// - /// The context. - /// The page where the fragment is active. - public override void Initialization(IFragmentContext context, IPage page) - { - base.Initialization(context, page); +// /// +// /// Initialization +// /// +// /// The context. +// /// The page where the fragment is active. +// public override void Initialization(IFragmentContext context, IPage page) +// { +// base.Initialization(context, page); - Text = "webexpress.webapp:setting.usermanager.group.add.label"; - Margin = new PropertySpacingMargin(PropertySpacing.Space.Two); - BackgroundColor = new PropertyColorButton(TypeColorButton.Primary); - Icon = new PropertyIcon(TypeIcon.Plus); - Modal = new PropertyModal(TypeModal.Modal, ModalDlg); - } +// Text = "webexpress.webapp:setting.usermanager.group.add.label"; +// Margin = new PropertySpacingMargin(PropertySpacing.Space.Two); +// BackgroundColor = new PropertyColorButton(TypeColorButton.Primary); +// Icon = new PropertyIcon(TypeIcon.Plus); +// Modal = new PropertyModal(TypeModal.Modal, ModalDlg); +// } - /// - /// Convert to html. - /// - /// The context in which the control is rendered. - /// The control as html. - public override IHtmlNode Render(RenderContext context) - { - return base.Render(context); - } - } -} +// /// +// /// Convert to html. +// /// +// /// The context in which the control is rendered. +// /// The control as html. +// public override IHtmlNode Render(RenderContext context) +// { +// return base.Render(context); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebFragment/FragmentUserManagementAddUser.cs b/src/WebExpress.WebApp/WebFragment/FragmentUserManagementAddUser.cs index 4a9c748..2fe5d4e 100644 --- a/src/WebExpress.WebApp/WebFragment/FragmentUserManagementAddUser.cs +++ b/src/WebExpress.WebApp/WebFragment/FragmentUserManagementAddUser.cs @@ -1,57 +1,57 @@ -using WebExpress.WebApp.WebControl; -using WebExpress.WebApp.WebSection; -using WebExpress.WebApp.WebSettingPage; -using WebExpress.WebCore.WebAttribute; -using WebExpress.WebCore.WebHtml; -using WebExpress.WebCore.WebPage; -using WebExpress.WebUI.WebAttribute; -using WebExpress.WebUI.WebControl; -using WebExpress.WebUI.WebFragment; +//using WebExpress.WebApp.WebControl; +//using WebExpress.WebApp.WebSection; +//using WebExpress.WebApp.WebSettingPage; +//using WebExpress.WebCore.WebAttribute; +//using WebExpress.WebCore.WebHtml; +//using WebExpress.WebCore.WebPage; +//using WebExpress.WebUI.WebAttribute; +//using WebExpress.WebUI.WebControl; +//using WebExpress.WebUI.WebFragment; -namespace WebExpress.WebApp.WebFragment -{ - [Section(SectionWebApp.HeadlineSecondary)] - [Module] - [Scope] - public sealed class FragmentUserManagementAddUser : FragmentControlButtonLink - { - /// - /// Returns the modal dialog for adding a user. - /// - private ControlModalFormUserNew ModalDlg = new ControlModalFormUserNew("add_user"); +//namespace WebExpress.WebApp.WebFragment +//{ +// [Section(SectionWebApp.HeadlineSecondary)] +// [Module] +// [Scope] +// public sealed class FragmentUserManagementAddUser : FragmentControlButtonLink +// { +// /// +// /// Returns the modal dialog for adding a user. +// /// +// private ControlModalFormUserNew ModalDlg = new ControlModalFormUserNew("add_user"); - /// - /// Initializes a new instance of the class. - /// - public FragmentUserManagementAddUser() - : base("add_user") - { - } +// /// +// /// Initializes a new instance of the class. +// /// +// public FragmentUserManagementAddUser() +// : base("add_user") +// { +// } - /// - /// Initialization - /// - /// The context. - /// The page where the fragment is active. - public override void Initialization(IFragmentContext context, IPage page) - { - base.Initialization(context, page); +// /// +// /// Initialization +// /// +// /// The context. +// /// The page where the fragment is active. +// public override void Initialization(IFragmentContext context, IPage page) +// { +// base.Initialization(context, page); - Text = "webexpress.webapp:setting.usermanager.user.add.label"; - Margin = new PropertySpacingMargin(PropertySpacing.Space.Two); - BackgroundColor = new PropertyColorButton(TypeColorButton.Primary); - Icon = new PropertyIcon(TypeIcon.Plus); - Modal = new PropertyModal(TypeModal.Modal, ModalDlg); - } +// Text = "webexpress.webapp:setting.usermanager.user.add.label"; +// Margin = new PropertySpacingMargin(PropertySpacing.Space.Two); +// BackgroundColor = new PropertyColorButton(TypeColorButton.Primary); +// Icon = new PropertyIcon(TypeIcon.Plus); +// Modal = new PropertyModal(TypeModal.Modal, ModalDlg); +// } - /// - /// Convert to html. - /// - /// The context in which the control is rendered. - /// The control as html. - public override IHtmlNode Render(RenderContext context) - { - return base.Render(context); - } - } -} +// /// +// /// Convert to html. +// /// +// /// The context in which the control is rendered. +// /// The control as html. +// public override IHtmlNode Render(RenderContext context) +// { +// return base.Render(context); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebFragment/FragmentUserManagementDescription.cs b/src/WebExpress.WebApp/WebFragment/FragmentUserManagementDescription.cs index f431208..b0611fe 100644 --- a/src/WebExpress.WebApp/WebFragment/FragmentUserManagementDescription.cs +++ b/src/WebExpress.WebApp/WebFragment/FragmentUserManagementDescription.cs @@ -1,67 +1,67 @@ -using WebExpress.WebApp.WebSection; -using WebExpress.WebApp.WebSettingPage; -using WebExpress.WebCore.WebAttribute; -using WebExpress.WebCore.WebHtml; -using WebExpress.WebCore.WebPage; -using WebExpress.WebUI.WebAttribute; -using WebExpress.WebUI.WebControl; -using WebExpress.WebUI.WebFragment; +//using WebExpress.WebApp.WebSection; +//using WebExpress.WebApp.WebSettingPage; +//using WebExpress.WebCore.WebAttribute; +//using WebExpress.WebCore.WebHtml; +//using WebExpress.WebCore.WebPage; +//using WebExpress.WebUI.WebAttribute; +//using WebExpress.WebUI.WebControl; +//using WebExpress.WebUI.WebFragment; -namespace WebExpress.WebApp.WebFragment -{ - [Section(SectionWebApp.ContentPreferences)] - [Module] - [Scope] - [Cache()] - public sealed class FragmentUserManagementDescription : FragmentControlPanel - { - /// - /// Returns the label. - /// - private ControlText Label { get; } = new ControlText() - { - Text = "webexpress.webapp:setting.usermanager.user.help", - Margin = new PropertySpacingMargin(PropertySpacing.Space.Two), - TextColor = new PropertyColorText(TypeColorText.Info) - }; +//namespace WebExpress.WebApp.WebFragment +//{ +// [Section(SectionWebApp.ContentPreferences)] +// [Module] +// [Scope] +// [Cache()] +// public sealed class FragmentUserManagementDescription : FragmentControlPanel +// { +// /// +// /// Returns the label. +// /// +// private ControlText Label { get; } = new ControlText() +// { +// Text = "webexpress.webapp:setting.usermanager.user.help", +// Margin = new PropertySpacingMargin(PropertySpacing.Space.Two), +// TextColor = new PropertyColorText(TypeColorText.Info) +// }; - /// - /// Returns the description. - /// - private ControlText Description { get; } = new ControlText() - { - Text = "webexpress.webapp:setting.usermanager.user.description", - Margin = new PropertySpacingMargin(PropertySpacing.Space.Two) - }; +// /// +// /// Returns the description. +// /// +// private ControlText Description { get; } = new ControlText() +// { +// Text = "webexpress.webapp:setting.usermanager.user.description", +// Margin = new PropertySpacingMargin(PropertySpacing.Space.Two) +// }; - /// - /// Initializes a new instance of the class. - /// - public FragmentUserManagementDescription() - { - } +// /// +// /// Initializes a new instance of the class. +// /// +// public FragmentUserManagementDescription() +// { +// } - /// - /// Initialization - /// - /// The context. - /// The page where the fragment is active. - public override void Initialization(IFragmentContext context, IPage page) - { - base.Initialization(context, page); +// /// +// /// Initialization +// /// +// /// The context. +// /// The page where the fragment is active. +// public override void Initialization(IFragmentContext context, IPage page) +// { +// base.Initialization(context, page); - Content.Add(Label); - Content.Add(Description); - } +// Content.Add(Label); +// Content.Add(Description); +// } - /// - /// Convert to html. - /// - /// The context in which the control is rendered. - /// The control as html. - public override IHtmlNode Render(RenderContext context) - { - return base.Render(context); - } - } -} +// /// +// /// Convert to html. +// /// +// /// The context in which the control is rendered. +// /// The control as html. +// public override IHtmlNode Render(RenderContext context) +// { +// return base.Render(context); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebFragment/FragmentUserManagementTable.cs b/src/WebExpress.WebApp/WebFragment/FragmentUserManagementTable.cs index a3d0436..e2e1a1f 100644 --- a/src/WebExpress.WebApp/WebFragment/FragmentUserManagementTable.cs +++ b/src/WebExpress.WebApp/WebFragment/FragmentUserManagementTable.cs @@ -1,55 +1,55 @@ -using WebExpress.WebApp.WebSection; -using WebExpress.WebApp.WebSettingPage; -using WebExpress.WebCore.WebAttribute; -using WebExpress.WebCore.WebComponent; -using WebExpress.WebCore.WebHtml; -using WebExpress.WebCore.WebPage; -using WebExpress.WebUI.WebAttribute; -using WebExpress.WebUI.WebControl; -using WebExpress.WebUI.WebFragment; +//using WebExpress.WebApp.WebSection; +//using WebExpress.WebApp.WebSettingPage; +//using WebExpress.WebCore.WebAttribute; +//using WebExpress.WebCore.WebComponent; +//using WebExpress.WebCore.WebHtml; +//using WebExpress.WebCore.WebPage; +//using WebExpress.WebUI.WebAttribute; +//using WebExpress.WebUI.WebControl; +//using WebExpress.WebUI.WebFragment; -namespace WebExpress.WebApp.WebFragment -{ - [Section(SectionWebApp.ContentPrimary)] - [Module] - [Scope] - [Cache()] - public sealed class FragmentUserManagementTable : FragmentCrudTable - { - /// - /// Initializes a new instance of the class. - /// - public FragmentUserManagementTable() - : base("4fd155dd-f6e2-4411-b6ed-14ee78713272") - { - } +//namespace WebExpress.WebApp.WebFragment +//{ +// [Section(SectionWebApp.ContentPrimary)] +// [Module] +// [Scope] +// [Cache()] +// public sealed class FragmentUserManagementTable : FragmentCrudTable +// { +// /// +// /// Initializes a new instance of the class. +// /// +// public FragmentUserManagementTable() +// : base("4fd155dd-f6e2-4411-b6ed-14ee78713272") +// { +// } - /// - /// Initialization - /// - /// The context of the component. - /// The page to display the component. - public override void Initialization(IFragmentContext context, IPage page) - { - base.Initialization(context, page); +// /// +// /// Initialization +// /// +// /// The context of the component. +// /// The page to display the component. +// public override void Initialization(IFragmentContext context, IPage page) +// { +// base.Initialization(context, page); - var module = ComponentManager.ModuleManager.GetModule(page?.ResourceContext.ApplicationContext, typeof(Module)); +// var module = ComponentManager.ModuleManager.GetModule(page?.ResourceContext.ApplicationContext, typeof(Module)); - RestApiUri = module.ContextPath.Append("/api/v1/user"); +// RestApiUri = module.ContextPath.Append("/api/v1/user"); - Editors.Add(new FragmentCrudTableEditorLinkItem("webexpress.webapp:setting.usermanager.group.edit.label") { Icon = new PropertyIcon(TypeIcon.Edit) }); - Editors.Add(new FragmentCrudTableEditorSeperatorItem()); - Editors.Add(new FragmentCrudTableEditorLinkItem("webexpress.webapp:setting.usermanager.group.delete.label") { Icon = new PropertyIcon(TypeIcon.TrashAlt), Color = new PropertyColorText(TypeColorText.Danger) }); - } +// Editors.Add(new FragmentCrudTableEditorLinkItem("webexpress.webapp:setting.usermanager.group.edit.label") { Icon = new PropertyIcon(TypeIcon.Edit) }); +// Editors.Add(new FragmentCrudTableEditorSeperatorItem()); +// Editors.Add(new FragmentCrudTableEditorLinkItem("webexpress.webapp:setting.usermanager.group.delete.label") { Icon = new PropertyIcon(TypeIcon.TrashAlt), Color = new PropertyColorText(TypeColorText.Danger) }); +// } - /// - /// Convert to HTML. - /// - /// The context in which the control is rendered. - /// The control as HTML. - public override IHtmlNode Render(RenderContext context) - { - return base.Render(context); - } - } -} +// /// +// /// Convert to HTML. +// /// +// /// The context in which the control is rendered. +// /// The control as HTML. +// public override IHtmlNode Render(RenderContext context) +// { +// return base.Render(context); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebIdentity/IIdentity.cs b/src/WebExpress.WebApp/WebIdentity/IIdentity.cs deleted file mode 100644 index 255d316..0000000 --- a/src/WebExpress.WebApp/WebIdentity/IIdentity.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace WebExpress.WebApp.WebIdentity -{ - public interface IIdentity - { - } -} diff --git a/src/WebExpress.WebApp/WebIdentity/IIdentityResource.cs b/src/WebExpress.WebApp/WebIdentity/IIdentityResource.cs deleted file mode 100644 index 4c8385b..0000000 --- a/src/WebExpress.WebApp/WebIdentity/IIdentityResource.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace WebExpress.WebApp.WebIdentity -{ - public interface IIdentityResource - { - } -} diff --git a/src/WebExpress.WebApp/WebIdentity/IIdentityRole.cs b/src/WebExpress.WebApp/WebIdentity/IIdentityRole.cs deleted file mode 100644 index 9a32dfe..0000000 --- a/src/WebExpress.WebApp/WebIdentity/IIdentityRole.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace WebExpress.WebApp.WebIdentity -{ - public interface IIdentityRole - { - } -} diff --git a/src/WebExpress.WebApp/WebIdentity/IdentityDictionary.cs b/src/WebExpress.WebApp/WebIdentity/IdentityDictionary.cs deleted file mode 100644 index 74494b4..0000000 --- a/src/WebExpress.WebApp/WebIdentity/IdentityDictionary.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Collections.Generic; -using WebExpress.WebCore.WebModule; - -namespace WebExpress.WebApp.WebIdentity -{ - /// - /// The identity directory. - /// - internal class IdentityDictionary - { - /// - /// The directory of identities. - /// module -> id -> identity - /// - public static Dictionary> Identities { get; } = new Dictionary>(); - - /// - /// The directory of roles. - /// module -> id -> role - /// - public static Dictionary> Roles { get; } = new Dictionary>(); - - /// - /// The directory of resources. - /// module -> id -> resource - /// - public static Dictionary> Resources { get; } = new Dictionary>(); - } -} diff --git a/src/WebExpress.WebApp/WebIdentity/IdentityItem.cs b/src/WebExpress.WebApp/WebIdentity/IdentityItem.cs deleted file mode 100644 index 74d4252..0000000 --- a/src/WebExpress.WebApp/WebIdentity/IdentityItem.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace WebExpress.WebApp.WebIdentity -{ - public class IdentityItem - { - } -} diff --git a/src/WebExpress.WebApp/WebIdentity/IdentityManager.cs b/src/WebExpress.WebApp/WebIdentity/IdentityManager.cs deleted file mode 100644 index d2b5ff4..0000000 --- a/src/WebExpress.WebApp/WebIdentity/IdentityManager.cs +++ /dev/null @@ -1,162 +0,0 @@ -using System.Linq; -using System.Security; -using WebExpress.WebCore; -using WebExpress.WebCore.Internationalization; -using WebExpress.WebCore.WebApplication; -using WebExpress.WebCore.WebAttribute; -using WebExpress.WebCore.WebModule; -using WebExpress.WebCore.WebPlugin; - -namespace WebExpress.WebApp.WebIdentity -{ - /// - /// Management of identities (users). - /// - public class IdentityManager - { - /// - /// Returns or sets the reference to the context of the host. - /// - public IHttpServerContext HttpServerContext { get; private set; } - - /// - /// Returns the current signed-in identity. - /// - public static IIdentity CurrentIdentity { get; set; } - - /// - /// Returns or sets the reference to the context of the plugin. - /// - private static IPluginContext Context { get; set; } - - /// - /// Returns the directory by listing the entities, roles, and resources. - /// - private static IdentityDictionary Dictionary { get; } = new IdentityDictionary(); - - /// - /// Initialization - /// - /// The reference to the context of the host. - public void Initialization(IHttpServerContext context) - { - HttpServerContext = context; - - HttpServerContext.Log.Debug(message: InternationalizationManager.I18N("webexpress:identitymanager.initialization")); - } - - /// - /// Adds identity entries. - /// - /// The context that applies to the execution of the plugin. - public void Register(IModuleContext context) - { - var assembly = context.PluginContext.Assembly; - - foreach (var type in assembly.GetExportedTypes().Where(x => x.IsClass && x.IsSealed && x.GetInterface(typeof(IIdentityResource).Name) != null)) - { - var id = type.FullName?.ToLower(); - var name = type.Name; - var description = string.Empty; - var moduleId = string.Empty; - - foreach (var customAttribute in type.CustomAttributes.Where(x => x.AttributeType.GetInterfaces().Contains(typeof(IModuleAttribute)))) - { - if (customAttribute.AttributeType == typeof(NameAttribute)) - { - name = customAttribute.ConstructorArguments.FirstOrDefault().Value?.ToString(); - } - else if (customAttribute.AttributeType == typeof(DescriptionAttribute)) - { - description = customAttribute.ConstructorArguments.FirstOrDefault().Value?.ToString(); - } - else if (customAttribute.AttributeType.Name == typeof(ModuleAttribute<>).Name && customAttribute.AttributeType.Namespace == typeof(ModuleAttribute<>).Namespace) - { - moduleId = customAttribute.AttributeType.GenericTypeArguments.FirstOrDefault()?.FullName?.ToLower(); - } - } - - if (string.IsNullOrWhiteSpace(moduleId)) - { - // no module has been specified - HttpServerContext.Log.Warning(message: InternationalizationManager.I18N("webexpress:identitymanager.moduleless"), args: id); - - continue; - } - - // identify the associated module - //var module = ModuleManager.GetModule(context.Application, moduleId); - - //if (module == null || !(module.ModuleId == context.ModuleId && module.Application.ApplicationId == context.Application.ApplicationId)) - //{ - // continue; - //} - } - } - - /// - /// Registers an identity. - /// - /// The identity. - public static void Register(IIdentity identity) - { - - } - - /// - /// Registers a role. - /// - /// The (identity) role. - public static void Register(IIdentityRole role) - { - - } - - /// - /// Registers a resource. - /// - /// The resource. - public static void Register(IIdentityResource resource) - { - - } - - /// - /// Removes all identities, roles, and resources of an application. - /// - /// Die Anwendung - public static void Unregister(IApplicationContext application) - { - - } - - /// - /// Login an identity. - /// - /// The login id. - /// The password. - /// True if successful, false otherwise. - public static bool Login(string login, SecureString password) - { - return false; - } - - /// - /// Logout an identity. - /// - public static void Logout() - { - - } - - /// - /// Checks for access rights. - /// - /// Returns or sets the id.entität - /// The access mode (read | write | execute). - public static void CheckAccess(IIdentity identiy, string mode) - { - - } - } -} diff --git a/src/WebExpress.WebApp/WebIdentity/IdentityResourceItem.cs b/src/WebExpress.WebApp/WebIdentity/IdentityResourceItem.cs deleted file mode 100644 index 63ecead..0000000 --- a/src/WebExpress.WebApp/WebIdentity/IdentityResourceItem.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace WebExpress.WebApp.WebIdentity -{ - public class IdentityResourceItem - { - } -} diff --git a/src/WebExpress.WebApp/WebIdentity/IdentityRoleItem.cs b/src/WebExpress.WebApp/WebIdentity/IdentityRoleItem.cs deleted file mode 100644 index 3906d19..0000000 --- a/src/WebExpress.WebApp/WebIdentity/IdentityRoleItem.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace WebExpress.WebApp.WebIdentity -{ - public class IdentityRoleItem - { - } -} diff --git a/src/WebExpress.WebApp/WebIndex/IndexManager.cs b/src/WebExpress.WebApp/WebIndex/IndexManager.cs index 295c9ab..bc3c6c2 100644 --- a/src/WebExpress.WebApp/WebIndex/IndexManager.cs +++ b/src/WebExpress.WebApp/WebIndex/IndexManager.cs @@ -1,91 +1,91 @@ -using System.Collections.Generic; -using System.IO; -using WebExpress.WebCore; -using WebExpress.WebCore.Internationalization; -using WebExpress.WebCore.WebComponent; -using WebExpress.WebCore.WebPlugin; -using WebExpress.WebIndex; +//using System.Collections.Generic; +//using System.IO; +//using WebExpress.WebCore; +//using WebExpress.WebCore.Internationalization; +//using WebExpress.WebCore.WebComponent; +//using WebExpress.WebCore.WebPlugin; +//using WebExpress.WebIndex; -namespace WebExpress.WebApp.WebIndex -{ - public sealed class IndexManager : WebExpress.WebIndex.IndexManager, IComponentPlugin - { - /// - /// Returns the reference to the context of the host. - /// - public IHttpServerContext HttpServerContext { get; private set; } +//namespace WebExpress.WebApp.WebIndex +//{ +// public sealed class IndexManager : WebExpress.WebIndex.IndexManager, IComponentPlugin +// { +// /// +// /// Returns the reference to the context of the host. +// /// +// public IHttpServerContext HttpServerContext { get; private set; } - /// - /// Initializes a new instance of the class. - /// - internal IndexManager() - { - ComponentManager.PluginManager.AddPlugin += (s, pluginContext) => - { - Register(pluginContext); - }; +// /// +// /// Initializes a new instance of the class. +// /// +// internal IndexManager() +// { +// ComponentManager.PluginManager.AddPlugin += (s, pluginContext) => +// { +// Register(pluginContext); +// }; - ComponentManager.PluginManager.RemovePlugin += (s, pluginContext) => - { - Remove(pluginContext); - }; - } +// ComponentManager.PluginManager.RemovePlugin += (s, pluginContext) => +// { +// Remove(pluginContext); +// }; +// } - /// - /// Initialization - /// - /// The reference to the context of the host. - public void Initialization(IHttpServerContext context) - { - HttpServerContext = context; +// /// +// /// Initialization +// /// +// /// The reference to the context of the host. +// public void Initialization(IHttpServerContext context) +// { +// HttpServerContext = context; - HttpServerContext.Log.Debug - ( - InternationalizationManager.I18N("webexpress.webapp:indexmanager.initialization") - ); +// HttpServerContext.Log.Debug +// ( +// InternationalizationManager.I18N("webexpress.webapp:indexmanager.initialization") +// ); - Initialization(new IndexContext() { IndexDirectory = Path.Combine(context.DataPath, "index") }); - } +// Initialization(new IndexContext() { IndexDirectory = Path.Combine(context.DataPath, "index") }); +// } - /// - /// Discovers and registers entries from the specified plugin. - /// - /// A context of a plugin whose elements are to be registered. - public void Register(IPluginContext pluginContext) - { +// /// +// /// Discovers and registers entries from the specified plugin. +// /// +// /// A context of a plugin whose elements are to be registered. +// public void Register(IPluginContext pluginContext) +// { - } +// } - /// - /// Discovers and registers entries from the specified plugin. - /// - /// A list with plugin contexts that contain the components. - public void Register(IEnumerable pluginContexts) - { - foreach (var pluginContext in pluginContexts) - { - Register(pluginContext); - } - } +// /// +// /// Discovers and registers entries from the specified plugin. +// /// +// /// A list with plugin contexts that contain the components. +// public void Register(IEnumerable pluginContexts) +// { +// foreach (var pluginContext in pluginContexts) +// { +// Register(pluginContext); +// } +// } - /// - /// Removes all components associated with the specified plugin context. - /// - /// The context of the plugin that contains the components to remove. - public void Remove(IPluginContext pluginContext) - { - //Dictionary.Remove(pluginContext); - } +// /// +// /// Removes all components associated with the specified plugin context. +// /// +// /// The context of the plugin that contains the components to remove. +// public void Remove(IPluginContext pluginContext) +// { +// //Dictionary.Remove(pluginContext); +// } - /// - /// Information about the component is collected and prepared for output in the log. - /// - /// The context of the plugin. - /// A list of log entries. - /// The shaft deep. - public void PrepareForLog(IPluginContext pluginContext, IList output, int deep) - { +// /// +// /// Information about the component is collected and prepared for output in the log. +// /// +// /// The context of the plugin. +// /// A list of log entries. +// /// The shaft deep. +// public void PrepareForLog(IPluginContext pluginContext, IList output, int deep) +// { - } - } -} +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebJob/JobSessionCleaning.cs b/src/WebExpress.WebApp/WebJob/JobSessionCleaning.cs index 93a4600..1a0e326 100644 --- a/src/WebExpress.WebApp/WebJob/JobSessionCleaning.cs +++ b/src/WebExpress.WebApp/WebJob/JobSessionCleaning.cs @@ -1,28 +1,28 @@ -using WebExpress.WebCore.WebJob; +//using WebExpress.WebCore.WebJob; -namespace WebExpress.WebApp.WebJob -{ - /// - /// Job for cyclic cleaning of the session. Sessions that are no longer in use will be removed. - /// The job starts at 0:30 a.m. on the first day of each month. - /// - internal sealed class JobSessionCleaning : Job - { - /// - /// Initialization - /// - /// The context in which the job is executed. - public override void Initialization(IJobContext context) - { - base.Initialization(context); - } +//namespace WebExpress.WebApp.WebJob +//{ +// /// +// /// Job for cyclic cleaning of the session. Sessions that are no longer in use will be removed. +// /// The job starts at 0:30 a.m. on the first day of each month. +// /// +// internal sealed class JobSessionCleaning : Job +// { +// /// +// /// Initialization +// /// +// /// The context in which the job is executed. +// public override void Initialization(IJobContext context) +// { +// base.Initialization(context); +// } - /// - /// Processing of the resource. - /// - public override void Process() - { - //Context.Log.Info(message: string.Format(this.I18N("job.sessioncleaning.process"), Context.JobId)); - } - } -} +// /// +// /// Processing of the resource. +// /// +// public override void Process() +// { +// //Context.Log.Info(message: string.Format(this.I18N("job.sessioncleaning.process"), Context.JobId)); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebNotificaation/Notification.cs b/src/WebExpress.WebApp/WebNotificaation/Notification.cs index 7742aac..cf3d7d7 100644 --- a/src/WebExpress.WebApp/WebNotificaation/Notification.cs +++ b/src/WebExpress.WebApp/WebNotificaation/Notification.cs @@ -1,63 +1,63 @@ -using System; -using System.Text.Json.Serialization; - -namespace WebExpress.WebApp.WebNotificaation -{ - public class Notification - { - /// - /// Returns or sets the notification id. - /// - [JsonPropertyName("id")] - public string Id { get; } = Guid.NewGuid().ToString(); - - /// - /// Returns or sets the heading. - /// - [JsonPropertyName("heading")] - public string Heading { get; set; } - - /// - /// Returns or sets the notification message. - /// - [JsonPropertyName("message")] - public string Message { get; set; } - - /// - /// Returns or sets the lifetime of the notification. - /// - [JsonPropertyName("durability")] - public int Durability { get; set; } - - /// - /// Returns the icon. Can be null. - /// - [JsonPropertyName("icon")] - public string Icon { get; set; } - - /// - /// Returns the creation time. - /// - [JsonPropertyName("created")] - public DateTime Created { get; } = DateTime.Now; - - /// - /// Progress as a percentage: 0-100%. <0 Without progress. - /// - [JsonPropertyName("progress")] - public int Progress { get; set; } = -1; - - /// - /// Returns or sets the notification type. - /// - [JsonPropertyName("type"), JsonConverter(typeof(TypeNotificationConverter))] - public TypeNotification Type { get; set; } - - /// - /// Initializes a new instance of the class. - /// - public Notification() - { - } - } -} +//using System; +//using System.Text.Json.Serialization; + +//namespace WebExpress.WebApp.WebNotificaation +//{ +// public class Notification +// { +// /// +// /// Returns or sets the notification id. +// /// +// [JsonPropertyName("id")] +// public string Id { get; } = Guid.NewGuid().ToString(); + +// /// +// /// Returns or sets the heading. +// /// +// [JsonPropertyName("heading")] +// public string Heading { get; set; } + +// /// +// /// Returns or sets the notification message. +// /// +// [JsonPropertyName("message")] +// public string Message { get; set; } + +// /// +// /// Returns or sets the lifetime of the notification. +// /// +// [JsonPropertyName("durability")] +// public int Durability { get; set; } + +// /// +// /// Returns the icon. Can be null. +// /// +// [JsonPropertyName("icon")] +// public string Icon { get; set; } + +// /// +// /// Returns the creation time. +// /// +// [JsonPropertyName("created")] +// public DateTime Created { get; } = DateTime.Now; + +// /// +// /// Progress as a percentage: 0-100%. <0 Without progress. +// /// +// [JsonPropertyName("progress")] +// public int Progress { get; set; } = -1; + +// /// +// /// Returns or sets the notification type. +// /// +// [JsonPropertyName("type"), JsonConverter(typeof(TypeNotificationConverter))] +// public TypeNotification Type { get; set; } + +// /// +// /// Initializes a new instance of the class. +// /// +// public Notification() +// { +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebNotificaation/NotificationManager.cs b/src/WebExpress.WebApp/WebNotificaation/NotificationManager.cs index bd4e7e8..47668d8 100644 --- a/src/WebExpress.WebApp/WebNotificaation/NotificationManager.cs +++ b/src/WebExpress.WebApp/WebNotificaation/NotificationManager.cs @@ -1,253 +1,253 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using WebExpress.WebCore; -using WebExpress.WebCore.Internationalization; -using WebExpress.WebCore.WebComponent; -using WebExpress.WebCore.WebMessage; -using WebExpress.WebCore.WebPlugin; - -namespace WebExpress.WebApp.WebNotificaation -{ - public sealed class NotificationManager : IComponent - { - /// - /// An event that fires when an notification is created. - /// - public event EventHandler CreateNotification; - - /// - /// An event that fires when an notification is destroyed. - /// - public event EventHandler DestroyNotification; - - /// - /// Returns the reference to the context of the host. - /// - public IHttpServerContext HttpServerContext { get; private set; } - - /// - /// Provides the notification store for global notifications. - /// - private static IDictionary GlobalNotifications { get; } = new Dictionary(); - - /// - /// Initializes a new instance of the class. - /// - internal NotificationManager() - { - } - - /// - /// Initialization - /// - /// The reference to the context of the host. - public void Initialization(IHttpServerContext context) - { - HttpServerContext = context; - - HttpServerContext.Log.Debug - ( - InternationalizationManager.I18N("webexpress.webapp:notificationmanager.initialization") - ); - } - - /// - /// Creates a new global notification. - /// - /// The notification message. - /// The lifetime of the notification. -1 for indefinite validity. - /// The headline. - /// An icon. - /// The notification type. - /// The created notification. - public Notification AddNotification(string message, int durability = -1, string heading = null, string icon = null, TypeNotification type = TypeNotification.Light) - { - var notification = new Notification() - { - Message = message, - Durability = durability, - Heading = heading, - Icon = icon, - Type = type - }; - - if (!GlobalNotifications.ContainsKey(notification.Id)) - { - // global notification - lock (GlobalNotifications) - { - GlobalNotifications.Add(notification.Id, notification); - } - } - - OnCreateNotification(notification); - - return notification; - } - - /// - /// Creates a new notification in the session. - /// - /// The request. - /// The notification message. - /// The lifetime of the notification. -1 for indefinite validity. - /// The headline. - /// An icon. - /// The notification type. - /// The created notification. - public Notification AddNotification(Request request, string message, int durability = -1, string heading = null, string icon = null, TypeNotification type = TypeNotification.Light) - { - var notification = new Notification() - { - Message = InternationalizationManager.I18N(request, message), - Durability = durability, - Heading = InternationalizationManager.I18N(request, heading), - Icon = icon?.ToString(), - Type = type - }; - - // user Notification - if (!request.Session.Properties.ContainsKey(typeof(SessionPropertyNotification))) - { - request.Session.Properties.Add(typeof(SessionPropertyNotification), new SessionPropertyNotification()); - } - - var notificationProperty = request.Session.Properties[typeof(SessionPropertyNotification)] as SessionPropertyNotification; - - if (!notificationProperty.ContainsKey(notification.Id)) - { - lock (notificationProperty) - { - notificationProperty.Add(notification.Id, notification); - } - } - - OnCreateNotification(notification); - - return notification; - } - - /// - /// Returns all notifications from the session. - /// - /// The request. - /// An enumeration of the notifications. - public IEnumerable GetNotifications(Request request) - { - var list = new List(); - - var scrapGlobal = GlobalNotifications.Values.Where(x => x.Durability >= 0 && x.Created.AddMilliseconds(x.Durability) < DateTime.Now).ToList(); - lock (GlobalNotifications) - { - // remove expired notifications - scrapGlobal.ForEach(x => GlobalNotifications.Remove(x.Id)); - } - - list.AddRange(GlobalNotifications.Values); - - if (request.Session.Properties.ContainsKey(typeof(SessionPropertyNotification)) && - request.Session.Properties[typeof(SessionPropertyNotification)] is SessionPropertyNotification notificationProperty) - { - var scrap = notificationProperty.Values.Where(x => x.Durability >= 0 && x.Created.AddMilliseconds(x.Durability) < DateTime.Now).ToList(); - - lock (notificationProperty) - { - // remove expired notifications - scrap.ForEach(x => notificationProperty.Remove(x.Id)); - } - - - list.AddRange(notificationProperty.Values); - } - - return list; - } - - /// - /// Returns all notifications from the session. - /// - /// The request. - /// The notification id. - public void RemoveNotification(Request request, string id) - { - if (GlobalNotifications.ContainsKey(id)) - { - lock (GlobalNotifications) - { - OnDestroyNotification(GlobalNotifications[id]); - - // remove notifications - GlobalNotifications.Remove(id); - } - } - - var scrapGlobal = GlobalNotifications.Values.Where(x => x.Durability >= 0 && x.Created.AddMilliseconds(x.Durability) < DateTime.Now).ToList(); - - lock (GlobalNotifications) - { - // remove expired notifications - scrapGlobal.ForEach(x => - { - OnDestroyNotification(GlobalNotifications[x.Id]); - - GlobalNotifications.Remove(x.Id); - }); - } - - if (request.Session.Properties.ContainsKey(typeof(SessionPropertyNotification)) && - request.Session.Properties[typeof(SessionPropertyNotification)] is SessionPropertyNotification notificationProperty) - { - if (notificationProperty.ContainsKey(id)) - { - lock (notificationProperty) - { - // remove notifications - notificationProperty.Remove(id); - } - } - - var scrap = notificationProperty.Values.Where(x => x.Created.AddMilliseconds(x.Durability) < DateTime.Now).ToList(); - - lock (notificationProperty) - { - // remove expired notifications - scrap.ForEach(x => - { - OnDestroyNotification(notificationProperty[x.Id]); - - notificationProperty.Remove(x.Id); - }); - } - } - } - - /// - /// Raises the CreateNotification event. - /// - /// The notification. - private void OnCreateNotification(Notification notification) - { - CreateNotification?.Invoke(this, notification); - } - - /// - /// Raises the DestroyNotification event. - /// - /// The notification. - private void OnDestroyNotification(Notification notification) - { - DestroyNotification?.Invoke(this, notification); - } - - /// - /// Information about the component is collected and prepared for output in the log. - /// - /// The context of the plugin. - /// A list of log entries. - /// The shaft deep. - public void PrepareForLog(IPluginContext pluginContext, IList output, int deep) - { - } - } -} +//using System; +//using System.Collections.Generic; +//using System.Linq; +//using WebExpress.WebCore; +//using WebExpress.WebCore.Internationalization; +//using WebExpress.WebCore.WebComponent; +//using WebExpress.WebCore.WebMessage; +//using WebExpress.WebCore.WebPlugin; + +//namespace WebExpress.WebApp.WebNotificaation +//{ +// public sealed class NotificationManager : IComponent +// { +// /// +// /// An event that fires when an notification is created. +// /// +// public event EventHandler CreateNotification; + +// /// +// /// An event that fires when an notification is destroyed. +// /// +// public event EventHandler DestroyNotification; + +// /// +// /// Returns the reference to the context of the host. +// /// +// public IHttpServerContext HttpServerContext { get; private set; } + +// /// +// /// Provides the notification store for global notifications. +// /// +// private static IDictionary GlobalNotifications { get; } = new Dictionary(); + +// /// +// /// Initializes a new instance of the class. +// /// +// internal NotificationManager() +// { +// } + +// /// +// /// Initialization +// /// +// /// The reference to the context of the host. +// public void Initialization(IHttpServerContext context) +// { +// HttpServerContext = context; + +// HttpServerContext.Log.Debug +// ( +// InternationalizationManager.I18N("webexpress.webapp:notificationmanager.initialization") +// ); +// } + +// /// +// /// Creates a new global notification. +// /// +// /// The notification message. +// /// The lifetime of the notification. -1 for indefinite validity. +// /// The headline. +// /// An icon. +// /// The notification type. +// /// The created notification. +// public Notification AddNotification(string message, int durability = -1, string heading = null, string icon = null, TypeNotification type = TypeNotification.Light) +// { +// var notification = new Notification() +// { +// Message = message, +// Durability = durability, +// Heading = heading, +// Icon = icon, +// Type = type +// }; + +// if (!GlobalNotifications.ContainsKey(notification.Id)) +// { +// // global notification +// lock (GlobalNotifications) +// { +// GlobalNotifications.Add(notification.Id, notification); +// } +// } + +// OnCreateNotification(notification); + +// return notification; +// } + +// /// +// /// Creates a new notification in the session. +// /// +// /// The request. +// /// The notification message. +// /// The lifetime of the notification. -1 for indefinite validity. +// /// The headline. +// /// An icon. +// /// The notification type. +// /// The created notification. +// public Notification AddNotification(Request request, string message, int durability = -1, string heading = null, string icon = null, TypeNotification type = TypeNotification.Light) +// { +// var notification = new Notification() +// { +// Message = InternationalizationManager.I18N(request, message), +// Durability = durability, +// Heading = InternationalizationManager.I18N(request, heading), +// Icon = icon?.ToString(), +// Type = type +// }; + +// // user Notification +// if (!request.Session.Properties.ContainsKey(typeof(SessionPropertyNotification))) +// { +// request.Session.Properties.Add(typeof(SessionPropertyNotification), new SessionPropertyNotification()); +// } + +// var notificationProperty = request.Session.Properties[typeof(SessionPropertyNotification)] as SessionPropertyNotification; + +// if (!notificationProperty.ContainsKey(notification.Id)) +// { +// lock (notificationProperty) +// { +// notificationProperty.Add(notification.Id, notification); +// } +// } + +// OnCreateNotification(notification); + +// return notification; +// } + +// /// +// /// Returns all notifications from the session. +// /// +// /// The request. +// /// An enumeration of the notifications. +// public IEnumerable GetNotifications(Request request) +// { +// var list = new List(); + +// var scrapGlobal = GlobalNotifications.Values.Where(x => x.Durability >= 0 && x.Created.AddMilliseconds(x.Durability) < DateTime.Now).ToList(); +// lock (GlobalNotifications) +// { +// // remove expired notifications +// scrapGlobal.ForEach(x => GlobalNotifications.Remove(x.Id)); +// } + +// list.AddRange(GlobalNotifications.Values); + +// if (request.Session.Properties.ContainsKey(typeof(SessionPropertyNotification)) && +// request.Session.Properties[typeof(SessionPropertyNotification)] is SessionPropertyNotification notificationProperty) +// { +// var scrap = notificationProperty.Values.Where(x => x.Durability >= 0 && x.Created.AddMilliseconds(x.Durability) < DateTime.Now).ToList(); + +// lock (notificationProperty) +// { +// // remove expired notifications +// scrap.ForEach(x => notificationProperty.Remove(x.Id)); +// } + + +// list.AddRange(notificationProperty.Values); +// } + +// return list; +// } + +// /// +// /// Returns all notifications from the session. +// /// +// /// The request. +// /// The notification id. +// public void RemoveNotification(Request request, string id) +// { +// if (GlobalNotifications.ContainsKey(id)) +// { +// lock (GlobalNotifications) +// { +// OnDestroyNotification(GlobalNotifications[id]); + +// // remove notifications +// GlobalNotifications.Remove(id); +// } +// } + +// var scrapGlobal = GlobalNotifications.Values.Where(x => x.Durability >= 0 && x.Created.AddMilliseconds(x.Durability) < DateTime.Now).ToList(); + +// lock (GlobalNotifications) +// { +// // remove expired notifications +// scrapGlobal.ForEach(x => +// { +// OnDestroyNotification(GlobalNotifications[x.Id]); + +// GlobalNotifications.Remove(x.Id); +// }); +// } + +// if (request.Session.Properties.ContainsKey(typeof(SessionPropertyNotification)) && +// request.Session.Properties[typeof(SessionPropertyNotification)] is SessionPropertyNotification notificationProperty) +// { +// if (notificationProperty.ContainsKey(id)) +// { +// lock (notificationProperty) +// { +// // remove notifications +// notificationProperty.Remove(id); +// } +// } + +// var scrap = notificationProperty.Values.Where(x => x.Created.AddMilliseconds(x.Durability) < DateTime.Now).ToList(); + +// lock (notificationProperty) +// { +// // remove expired notifications +// scrap.ForEach(x => +// { +// OnDestroyNotification(notificationProperty[x.Id]); + +// notificationProperty.Remove(x.Id); +// }); +// } +// } +// } + +// /// +// /// Raises the CreateNotification event. +// /// +// /// The notification. +// private void OnCreateNotification(Notification notification) +// { +// CreateNotification?.Invoke(this, notification); +// } + +// /// +// /// Raises the DestroyNotification event. +// /// +// /// The notification. +// private void OnDestroyNotification(Notification notification) +// { +// DestroyNotification?.Invoke(this, notification); +// } + +// /// +// /// Information about the component is collected and prepared for output in the log. +// /// +// /// The context of the plugin. +// /// A list of log entries. +// /// The shaft deep. +// public void PrepareForLog(IPluginContext pluginContext, IList output, int deep) +// { +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebNotificaation/SessionPropertyNotification.cs b/src/WebExpress.WebApp/WebNotificaation/SessionPropertyNotification.cs index f6c4a97..4e5369b 100644 --- a/src/WebExpress.WebApp/WebNotificaation/SessionPropertyNotification.cs +++ b/src/WebExpress.WebApp/WebNotificaation/SessionPropertyNotification.cs @@ -1,14 +1,14 @@ -using System.Collections.Generic; -using WebExpress.WebCore.WebSession; +//using System.Collections.Generic; +//using WebExpress.WebCore.WebSession; -namespace WebExpress.WebApp.WebNotificaation -{ - /// - /// Collection of notifications. - /// Key = The notification id. - /// Value = The notification. - /// - public class SessionPropertyNotification : Dictionary, ISessionProperty - { - } -} +//namespace WebExpress.WebApp.WebNotificaation +//{ +// /// +// /// Collection of notifications. +// /// Key = The notification id. +// /// Value = The notification. +// /// +// public class SessionPropertyNotification : Dictionary, ISessionProperty +// { +// } +//} diff --git a/src/WebExpress.WebApp/WebNotificaation/TypeNotification.cs b/src/WebExpress.WebApp/WebNotificaation/TypeNotification.cs index 6b106a2..4adbba4 100644 --- a/src/WebExpress.WebApp/WebNotificaation/TypeNotification.cs +++ b/src/WebExpress.WebApp/WebNotificaation/TypeNotification.cs @@ -1,46 +1,46 @@ -namespace WebExpress.WebApp.WebNotificaation -{ - /// - /// The layout options of the notification. - /// - public enum TypeNotification - { - Default = 0, - Primary = 1, - Secondary = 2, - Success = 3, - Info = 4, - Warning = 5, - Danger = 6, - Dark = 7, - Light = 8, - White = 9, - Transparent = 10 - } +//namespace WebExpress.WebApp.WebNotificaation +//{ +// /// +// /// The layout options of the notification. +// /// +// public enum TypeNotification +// { +// Default = 0, +// Primary = 1, +// Secondary = 2, +// Success = 3, +// Info = 4, +// Warning = 5, +// Danger = 6, +// Dark = 7, +// Light = 8, +// White = 9, +// Transparent = 10 +// } - public static class TypeLayoutTabExtensions - { - /// - /// Conversion to a string. - /// - /// The layout to be converted. - /// The converted layout. - public static string ToClass(this TypeNotification layout) - { - return layout switch - { - TypeNotification.Primary => "bg-primary", - TypeNotification.Secondary => "bg-secondary", - TypeNotification.Success => "alert-success", - TypeNotification.Info => "alert-info", - TypeNotification.Warning => "alert-warning", - TypeNotification.Danger => "alert-danger", - TypeNotification.Light => "alert-light", - TypeNotification.Dark => "alert-dark", - TypeNotification.White => "bg-white", - TypeNotification.Transparent => "bg-transparent", - _ => string.Empty, - }; - } - } -} +// public static class TypeLayoutTabExtensions +// { +// /// +// /// Conversion to a string. +// /// +// /// The layout to be converted. +// /// The converted layout. +// public static string ToClass(this TypeNotification layout) +// { +// return layout switch +// { +// TypeNotification.Primary => "bg-primary", +// TypeNotification.Secondary => "bg-secondary", +// TypeNotification.Success => "alert-success", +// TypeNotification.Info => "alert-info", +// TypeNotification.Warning => "alert-warning", +// TypeNotification.Danger => "alert-danger", +// TypeNotification.Light => "alert-light", +// TypeNotification.Dark => "alert-dark", +// TypeNotification.White => "bg-white", +// TypeNotification.Transparent => "bg-transparent", +// _ => string.Empty, +// }; +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebNotificaation/TypeNotificationConverter.cs b/src/WebExpress.WebApp/WebNotificaation/TypeNotificationConverter.cs index 7a7e3f6..c4f9019 100644 --- a/src/WebExpress.WebApp/WebNotificaation/TypeNotificationConverter.cs +++ b/src/WebExpress.WebApp/WebNotificaation/TypeNotificationConverter.cs @@ -1,35 +1,35 @@ -using System; -using System.Text.Json; -using System.Text.Json.Serialization; +//using System; +//using System.Text.Json; +//using System.Text.Json.Serialization; -namespace WebExpress.WebApp.WebNotificaation -{ - /// - /// Conversion of notification type from and to json. - /// - public class TypeNotificationConverter : JsonConverter - { - /// - /// Read and convert json to TypeNotification. - /// - /// The reader. - /// The type. - /// The options. - /// - public override TypeNotification Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - return (TypeNotification)Enum.Parse(typeof(TypeNotification), reader.GetString(), true); - } +//namespace WebExpress.WebApp.WebNotificaation +//{ +// /// +// /// Conversion of notification type from and to json. +// /// +// public class TypeNotificationConverter : JsonConverter +// { +// /// +// /// Read and convert json to TypeNotification. +// /// +// /// The reader. +// /// The type. +// /// The options. +// /// +// public override TypeNotification Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) +// { +// return (TypeNotification)Enum.Parse(typeof(TypeNotification), reader.GetString(), true); +// } - /// - /// Writes the value as json. - /// - /// Der writer. - /// The value. - /// The options. - public override void Write(Utf8JsonWriter writer, TypeNotification type, JsonSerializerOptions options) - { - writer.WriteStringValue(type.ToClass()); - } - } -} +// /// +// /// Writes the value as json. +// /// +// /// Der writer. +// /// The value. +// /// The options. +// public override void Write(Utf8JsonWriter writer, TypeNotification type, JsonSerializerOptions options) +// { +// writer.WriteStringValue(type.ToClass()); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebPage/LayoutSchema.cs b/src/WebExpress.WebApp/WebPage/LayoutSchema.cs index 5fc48cd..a909a86 100644 --- a/src/WebExpress.WebApp/WebPage/LayoutSchema.cs +++ b/src/WebExpress.WebApp/WebPage/LayoutSchema.cs @@ -1,197 +1,197 @@ -using WebExpress.WebUI.WebControl; - -namespace WebExpress.WebApp.WebPage -{ - public static class LayoutSchema - { - /// - /// The background color of the header. - /// - public static PropertyColorBackground HeaderBackground => new(TypeColorBackground.Dark); - - /// - /// The color of the header title. - /// - public static PropertyColorText HeaderTitle => new(TypeColorText.Light); - - /// - /// The color of the header link. - /// - public static PropertyColorText HeaderNavigationLink => new(TypeColorText.Light); - - /// - /// The color of the active background. - /// - public static PropertyColorBackground HeaderNavigationActiveBackground => new(); - - /// - /// The color of the active. - /// - public static PropertyColorText HeaderNavigationActive => new(TypeColorText.Info); - - /// - /// The background color of the quick button. - /// - public static PropertyColorButton HeaderQuickCreateButtonBackground => new(TypeColorButton.Success); - - /// - /// The size of the quick button. - /// - public static TypeSizeButton HeaderQuickCreateButtonSize => TypeSizeButton.Small; - - /// - /// The color of the navigation on the left. - /// - public static PropertyColorText NavigationLink => new(TypeColorText.Primary); - - /// - /// The color of the property background. - /// - public static PropertyColorBackground NavigationActiveBackground => new(TypeColorBackground.Primary); - - /// - /// The active color in the navigation pane. - /// - public static PropertyColorText NavigationActive => new(TypeColorText.Light); - - /// - /// The color of the property link. - /// - public static PropertyColorText Link => new(TypeColorText.Dark); - - /// - /// The background color of the sidebar area. - /// - public static PropertyColorBackground SidebarBackground => new(TypeColorBackground.Light); - - /// - /// The color of the active sidebar background. - /// - public static PropertyColorBackground SidebarNavigationActiveBackground => new(TypeColorBackground.Info); - - /// - /// The color of the active sidebar navigation. - /// - public static PropertyColorText SidebarNavigationActive => new(TypeColorText.Light); - - /// - /// The color of the active sidebar navigation link. - /// - public static PropertyColorText SidebarNavigationLink => new(TypeColorText.Dark); - - /// - /// The color of the splitter. - /// - public static PropertyColorBackground SplitterColor => new(TypeColorBackground.Light); - - /// - /// The background color of the headline area. - /// - public static PropertyColorBackground HeadlineBackground => new(); - - /// - /// The color of the headline title. - /// - public static PropertyColorText HeadlineTitle => new(TypeColorText.Dark); - - /// - /// The background color of the property area. - /// - public static PropertyColorBackground PropertyBackground => new("#C6E2FF"); - - /// - /// The color of the active property navigation background. - /// - public static PropertyColorBackground PropertyNavigationActiveBackground => new(TypeColorBackground.Info); - - /// - /// The color of the active property navigation. - /// - public static PropertyColorText PropertyNavigationActive => new(TypeColorText.Light); - - /// - /// The color of the active property navigation link. - /// - public static PropertyColorText PropertyNavigationLink => new(TypeColorText.Dark); - - /// - /// The background color of the breadcrumb area. - /// - public static PropertyColorBackground BreadcrumbBackground => new(); - - /// - /// The size of the breadcrumb area. - /// - public static TypeSizeButton BreadcrumbSize => TypeSizeButton.Small; - - /// - /// The Toolbar background color. - /// - public static PropertyColorBackground ToolbarBackground => new(); - - /// - /// The link color of the toolbar. - /// - public static PropertyColorText ToolbarLink => new(TypeColorText.Dark); - - /// - /// The background color of the content area. - /// - public static PropertyColorBackground ContentBackground => new(); - - /// - /// The background color of the form area. - /// - public static PropertyColorBackground FormBackground => new(TypeColorBackground.Light); - - /// - /// The background color of a button. - /// - public static PropertyColorButton ButtonBackground => new(TypeColorButton.Success); - - /// - /// The background color of the submit button. - /// - public static PropertyColorButton SubmitButtonBackground => new(TypeColorButton.Success); - - /// - /// The background color of the next button. - /// - public static PropertyColorButton NextButtonBackground => new(TypeColorButton.Success); - - /// - /// The background color of the cancel button. - /// - public static PropertyColorButton CancelButtonBackground => new(TypeColorButton.Secondary); - - /// - /// The background color of the close button. - /// - public static PropertyColorButton CloseButtonBackground => new(TypeColorButton.Primary); - - /// - /// The background color of a validation error message. - /// - public static PropertyColorBackground ValidationErrorBackground => new PropertyColorBackgroundAlert(TypeColorBackground.Danger); - - /// - /// The background color of a validation warning message. - /// - public static PropertyColorBackground ValidationWarningBackground => new PropertyColorBackgroundAlert(TypeColorBackground.Warning); - - /// - /// The background color of a validation success message. - /// - public static PropertyColorBackground ValidationSuccessBackground => new PropertyColorBackgroundAlert(TypeColorBackground.Success); - - /// - /// The background color of the footer. - /// - public static PropertyColorBackground FooterBackground => new(TypeColorBackground.Light); - - /// - /// The text color color of the footer. - /// - public static PropertyColorText FooterText => new(TypeColorText.Secondary); - } -} +//using WebExpress.WebUI.WebControl; + +//namespace WebExpress.WebApp.WebPage +//{ +// public static class LayoutSchema +// { +// /// +// /// The background color of the header. +// /// +// public static PropertyColorBackground HeaderBackground => new(TypeColorBackground.Dark); + +// /// +// /// The color of the header title. +// /// +// public static PropertyColorText HeaderTitle => new(TypeColorText.Light); + +// /// +// /// The color of the header link. +// /// +// public static PropertyColorText HeaderNavigationLink => new(TypeColorText.Light); + +// /// +// /// The color of the active background. +// /// +// public static PropertyColorBackground HeaderNavigationActiveBackground => new(); + +// /// +// /// The color of the active. +// /// +// public static PropertyColorText HeaderNavigationActive => new(TypeColorText.Info); + +// /// +// /// The background color of the quick button. +// /// +// public static PropertyColorButton HeaderQuickCreateButtonBackground => new(TypeColorButton.Success); + +// /// +// /// The size of the quick button. +// /// +// public static TypeSizeButton HeaderQuickCreateButtonSize => TypeSizeButton.Small; + +// /// +// /// The color of the navigation on the left. +// /// +// public static PropertyColorText NavigationLink => new(TypeColorText.Primary); + +// /// +// /// The color of the property background. +// /// +// public static PropertyColorBackground NavigationActiveBackground => new(TypeColorBackground.Primary); + +// /// +// /// The active color in the navigation pane. +// /// +// public static PropertyColorText NavigationActive => new(TypeColorText.Light); + +// /// +// /// The color of the property link. +// /// +// public static PropertyColorText Link => new(TypeColorText.Dark); + +// /// +// /// The background color of the sidebar area. +// /// +// public static PropertyColorBackground SidebarBackground => new(TypeColorBackground.Light); + +// /// +// /// The color of the active sidebar background. +// /// +// public static PropertyColorBackground SidebarNavigationActiveBackground => new(TypeColorBackground.Info); + +// /// +// /// The color of the active sidebar navigation. +// /// +// public static PropertyColorText SidebarNavigationActive => new(TypeColorText.Light); + +// /// +// /// The color of the active sidebar navigation link. +// /// +// public static PropertyColorText SidebarNavigationLink => new(TypeColorText.Dark); + +// /// +// /// The color of the splitter. +// /// +// public static PropertyColorBackground SplitterColor => new(TypeColorBackground.Light); + +// /// +// /// The background color of the headline area. +// /// +// public static PropertyColorBackground HeadlineBackground => new(); + +// /// +// /// The color of the headline title. +// /// +// public static PropertyColorText HeadlineTitle => new(TypeColorText.Dark); + +// /// +// /// The background color of the property area. +// /// +// public static PropertyColorBackground PropertyBackground => new("#C6E2FF"); + +// /// +// /// The color of the active property navigation background. +// /// +// public static PropertyColorBackground PropertyNavigationActiveBackground => new(TypeColorBackground.Info); + +// /// +// /// The color of the active property navigation. +// /// +// public static PropertyColorText PropertyNavigationActive => new(TypeColorText.Light); + +// /// +// /// The color of the active property navigation link. +// /// +// public static PropertyColorText PropertyNavigationLink => new(TypeColorText.Dark); + +// /// +// /// The background color of the breadcrumb area. +// /// +// public static PropertyColorBackground BreadcrumbBackground => new(); + +// /// +// /// The size of the breadcrumb area. +// /// +// public static TypeSizeButton BreadcrumbSize => TypeSizeButton.Small; + +// /// +// /// The Toolbar background color. +// /// +// public static PropertyColorBackground ToolbarBackground => new(); + +// /// +// /// The link color of the toolbar. +// /// +// public static PropertyColorText ToolbarLink => new(TypeColorText.Dark); + +// /// +// /// The background color of the content area. +// /// +// public static PropertyColorBackground ContentBackground => new(); + +// /// +// /// The background color of the form area. +// /// +// public static PropertyColorBackground FormBackground => new(TypeColorBackground.Light); + +// /// +// /// The background color of a button. +// /// +// public static PropertyColorButton ButtonBackground => new(TypeColorButton.Success); + +// /// +// /// The background color of the submit button. +// /// +// public static PropertyColorButton SubmitButtonBackground => new(TypeColorButton.Success); + +// /// +// /// The background color of the next button. +// /// +// public static PropertyColorButton NextButtonBackground => new(TypeColorButton.Success); + +// /// +// /// The background color of the cancel button. +// /// +// public static PropertyColorButton CancelButtonBackground => new(TypeColorButton.Secondary); + +// /// +// /// The background color of the close button. +// /// +// public static PropertyColorButton CloseButtonBackground => new(TypeColorButton.Primary); + +// /// +// /// The background color of a validation error message. +// /// +// public static PropertyColorBackground ValidationErrorBackground => new PropertyColorBackgroundAlert(TypeColorBackground.Danger); + +// /// +// /// The background color of a validation warning message. +// /// +// public static PropertyColorBackground ValidationWarningBackground => new PropertyColorBackgroundAlert(TypeColorBackground.Warning); + +// /// +// /// The background color of a validation success message. +// /// +// public static PropertyColorBackground ValidationSuccessBackground => new PropertyColorBackgroundAlert(TypeColorBackground.Success); + +// /// +// /// The background color of the footer. +// /// +// public static PropertyColorBackground FooterBackground => new(TypeColorBackground.Light); + +// /// +// /// The text color color of the footer. +// /// +// public static PropertyColorText FooterText => new(TypeColorText.Secondary); +// } +//} diff --git a/src/WebExpress.WebApp/WebPage/PageWebApp.cs b/src/WebExpress.WebApp/WebPage/PageWebApp.cs index dc7ac05..ec0a12b 100644 --- a/src/WebExpress.WebApp/WebPage/PageWebApp.cs +++ b/src/WebExpress.WebApp/WebPage/PageWebApp.cs @@ -1,234 +1,234 @@ -using System.Collections.Generic; -using System.Linq; -using WebExpress.WebApp.WebApiControl; -using WebExpress.WebApp.WebSection; -using WebExpress.WebCore.WebComponent; -using WebExpress.WebCore.WebHtml; -using WebExpress.WebCore.WebResource; -using WebExpress.WebCore.WebUri; -using WebExpress.WebUI.WebControl; -using WebExpress.WebUI.WebFragment; -using WebExpress.WebUI.WebPage; - -namespace WebExpress.WebApp.WebPage -{ - /// - /// Page consisting of a vertically arranged header, content and footer area. - /// - public abstract class PageWebApp : PageControl - { - // header - private List HeaderAppNavigatorPreferences { get; } = []; - private List HeaderAppNavigatorPrimary { get; } = []; - private List HeaderAppNavigatorSecondary { get; } = []; - private List HeaderNavigationPreferences { get; } = []; - private List HeaderNavigationPrimary { get; } = []; - private List HeaderNavigationSecondary { get; } = []; - private List HeaderQuickCreatePreferences { get; } = []; - private List HeaderQuickCreatePrimary { get; } = []; - private List HeaderQuickCreateSecondary { get; } = []; - private List HeaderHelpPreferences { get; } = []; - private List HeaderHelpPrimary { get; } = []; - private List HeaderHelpSecondary { get; } = []; - private List HeaderSettingsPreferences { get; } = []; - private List HeaderSettingsPrimary { get; } = []; - private List HeaderSettingsSecondary { get; } = []; - - // sidebar - private List SidebarHeader { get; } = []; - private List SidebarPreferences { get; } = []; - private List SidebarPrimary { get; } = []; - private List SidebarSecondary { get; } = []; - - // headline - private List ContentHeadlinePrologue { get; } = []; - private List ContentHeadlinePreferences { get; } = []; - private List ContentHeadlinePrimary { get; } = []; - private List ContentHeadlineSecondary { get; } = []; - private List ContentHeadlineMorePreferences { get; } = []; - private List ContentHeadlineMorePrimary { get; } = []; - private List ContentHeadlineMoreSecondary { get; } = []; - private List ContentHeadlineMetadata { get; } = []; - - // property - private List ContentPropertyPreferences { get; } = []; - private List ContentPropertyPrimary { get; } = []; - private List ContentPropertySecondary { get; } = []; - - // content - private List ContentPreferences { get; } = []; - private List ContentPrimary { get; } = []; - private List ContentSecondary { get; } = []; - - // footer - private List FooterPreferences { get; } = []; - private List FooterPrimary { get; } = []; - private List FooterSecondary { get; } = []; - - /// - /// Initializes a new instance of the class. - /// - public PageWebApp() - { - } - - /// - /// Initialization - /// - /// The context. - public override void Initialization(IResourceContext context) - { - base.Initialization(context); - - var fm = ComponentManager.GetComponent(); - var module = ComponentManager.ModuleManager.GetModule(ApplicationContext, typeof(Module)); - if (module != null) - { - CssLinks.Add(UriResource.Combine(module.ContextPath, "/assets/css/webexpress.webapp.css")); - CssLinks.Add(UriResource.Combine(module.ContextPath, "/assets/css/webexpress.webapp.popupnotification.css")); - CssLinks.Add(UriResource.Combine(module.ContextPath, "/assets/css/webexpress.webapp.taskprogressbar.css")); - HeaderScriptLinks.Add(UriResource.Combine(module.ContextPath, "assets/js/webexpress.webapp.js")); - HeaderScriptLinks.Add(UriResource.Combine(module.ContextPath, "assets/js/webexpress.webapp.popupnotification.js")); - HeaderScriptLinks.Add(UriResource.Combine(module.ContextPath, "assets/js/webexpress.webapp.selection.js")); - HeaderScriptLinks.Add(UriResource.Combine(module.ContextPath, "assets/js/webexpress.webapp.table.js")); - HeaderScriptLinks.Add(UriResource.Combine(module.ContextPath, "assets/js/webexpress.webapp.taskprogressbar.js")); - } - - // header - HeaderAppNavigatorPreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.AppPreferences, this, context.Scopes)); - HeaderAppNavigatorPrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppPrimary, this, context.Scopes)); - HeaderAppNavigatorSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppSecondary, this, context.Scopes)); - HeaderNavigationPreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.AppNavigationPreferences, this, context.Scopes)); - HeaderNavigationPrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppNavigationPrimary, this, context.Scopes)); - HeaderNavigationSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppNavigationSecondary, this, context.Scopes)); - HeaderQuickCreatePreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.AppQuickcreatePreferences, this, context.Scopes)); - HeaderQuickCreatePrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppQuickcreatePrimary, this, context.Scopes)); - HeaderQuickCreateSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppQuickcreateSecondary, this, context.Scopes)); - HeaderHelpPreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.AppHelpPreferences, this, context.Scopes)); - HeaderHelpPrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppHelpPrimary, this, context.Scopes)); - HeaderHelpSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppHelpSecondary, this, context.Scopes)); - HeaderSettingsPrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppSettingsPrimary, this, context.Scopes)); - HeaderSettingsSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppSettingsSecondary, this, context.Scopes)); - - // sidebar - SidebarHeader.AddRange(fm.GetCacheableFragments(SectionWebApp.SidebarHeader, this, context.Scopes)); - SidebarPreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.SidebarPreferences, this, context.Scopes)); - SidebarPrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.SidebarPrimary, this, context.Scopes)); - SidebarSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.SidebarSecondary, this, context.Scopes)); - - // headline - ContentHeadlinePrologue.AddRange(fm.GetCacheableFragments(SectionWebApp.HeadlinePrologue, this, context.Scopes)); - ContentHeadlinePreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.HeadlinePreferences, this, context.Scopes)); - ContentHeadlinePrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.HeadlinePrimary, this, context.Scopes)); - ContentHeadlineSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.HeadlineSecondary, this, context.Scopes)); - ContentHeadlineMorePreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.MorePreferences, this, context.Scopes)); - ContentHeadlineMorePrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.MorePrimary, this, context.Scopes)); - ContentHeadlineMoreSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.MoreSecondary, this, context.Scopes)); - ContentHeadlineMetadata.AddRange(fm.GetCacheableFragments(SectionWebApp.Metadata, this, context.Scopes)); - - // property - ContentPropertyPreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.PropertyPreferences, this, context.Scopes)); - ContentPropertyPrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.PropertyPrimary, this, context.Scopes)); - ContentPropertySecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.PropertySecondary, this, context.Scopes)); - - // content - ContentPreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.ContentPreferences, this, context.Scopes)); - ContentPrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.ContentPrimary, this, context.Scopes)); - ContentSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.ContentSecondary, this, context.Scopes)); - - // footer - FooterPreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.FooterPreferences, this, context.Scopes)); - FooterPrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.FooterPrimary, this, context.Scopes)); - FooterSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.FooterSecondary, this, context.Scopes)); - } - - /// - /// Processing of the resource. - /// - /// The context for rendering the page. - public override void Process(RenderContextWebApp context) - { - base.Process(context); - - context.VisualTree.Favicons.Add(new Favicon(context.ApplicationContext?.Icon)); - //context.VisualTree.Header.Logo = context.Application?.Icon; - //context.VisualTree.Header.AppTitle.Title = this.I18N(context.Application, context.Application?.ApplicationName); - - context.VisualTree.Breadcrumb.Uri = context.Uri; - - // header - context.VisualTree.Header.AppNavigator.Preferences.AddRange(HeaderAppNavigatorPreferences.SelectMany(x => x.CreateInstance(this, context.Request))); - context.VisualTree.Header.AppNavigator.Primary.AddRange(HeaderAppNavigatorPrimary.SelectMany(x => x.CreateInstance(this, context.Request))); - context.VisualTree.Header.AppNavigator.Secondary.AddRange(HeaderAppNavigatorSecondary.SelectMany(x => x.CreateInstance(this, context.Request))); - context.VisualTree.Header.AppNavigation.Preferences.AddRange(HeaderNavigationPreferences.SelectMany(x => x.CreateInstance(this, context.Request))); - context.VisualTree.Header.AppNavigation.Primary.AddRange(HeaderNavigationPrimary.SelectMany(x => x.CreateInstance(this, context.Request))); - context.VisualTree.Header.AppNavigation.Secondary.AddRange(HeaderNavigationSecondary.SelectMany(x => x.CreateInstance(this, context.Request))); - context.VisualTree.Header.QuickCreate.Preferences.AddRange(HeaderQuickCreatePreferences.SelectMany(x => x.CreateInstance(this, context.Request))); - context.VisualTree.Header.QuickCreate.Primary.AddRange(HeaderQuickCreatePrimary.SelectMany(x => x.CreateInstance(this, context.Request))); - context.VisualTree.Header.QuickCreate.Secondary.AddRange(HeaderQuickCreateSecondary.SelectMany(x => x.CreateInstance(this, context.Request))); - context.VisualTree.Header.Help.Preferences.AddRange(HeaderHelpPreferences.SelectMany(x => x.CreateInstance(this, context.Request))); - context.VisualTree.Header.Help.Primary.AddRange(HeaderHelpPrimary.SelectMany(x => x.CreateInstance(this, context.Request))); - context.VisualTree.Header.Help.Secondary.AddRange(HeaderHelpSecondary.SelectMany(x => x.CreateInstance(this, context.Request))); - context.VisualTree.Header.Settings.Preferences.AddRange(HeaderSettingsPreferences.SelectMany(x => x.CreateInstance(this, context.Request))); - context.VisualTree.Header.Settings.Primary.AddRange(HeaderSettingsPrimary.SelectMany(x => x.CreateInstance(this, context.Request))); - context.VisualTree.Header.Settings.Secondary.AddRange(HeaderSettingsSecondary.SelectMany(x => x.CreateInstance(this, context.Request))); - - // sidebar - context.VisualTree.Sidebar.Header.AddRange(SidebarHeader.SelectMany(x => x.CreateInstance(this, context.Request))); - context.VisualTree.Sidebar.Preferences.AddRange(SidebarPreferences.SelectMany(x => x.CreateInstance(this, context.Request))); - context.VisualTree.Sidebar.Primary.AddRange(SidebarPrimary.SelectMany(x => x.CreateInstance(this, context.Request))); - context.VisualTree.Sidebar.Secondary.AddRange(SidebarSecondary.SelectMany(x => x.CreateInstance(this, context.Request))); - - // headline - context.VisualTree.Content.Headline.Prologue.AddRange(ContentHeadlinePrologue.SelectMany(x => x.CreateInstance(this, context.Request))); - context.VisualTree.Content.Headline.Preferences.AddRange(ContentHeadlinePreferences.SelectMany(x => x.CreateInstance(this, context.Request))); - context.VisualTree.Content.Headline.Primary.AddRange(ContentHeadlinePrimary.SelectMany(x => x.CreateInstance(this, context.Request))); - context.VisualTree.Content.Headline.Secondary.AddRange(ContentHeadlineSecondary.SelectMany(x => x.CreateInstance(this, context.Request))); - context.VisualTree.Content.Headline.MorePreferences.AddRange(ContentHeadlineMorePreferences.SelectMany(x => x.CreateInstance(this, context.Request))); - context.VisualTree.Content.Headline.MorePrimary.AddRange(ContentHeadlineMorePrimary.SelectMany(x => x.CreateInstance(this, context.Request))); - context.VisualTree.Content.Headline.MoreSecondary.AddRange(ContentHeadlineMoreSecondary.SelectMany(x => x.CreateInstance(this, context.Request))); - context.VisualTree.Content.Headline.Metadata.AddRange(ContentHeadlineMetadata.SelectMany(x => x.CreateInstance(this, context.Request))); - - // property - context.VisualTree.Content.Property.Preferences.AddRange(ContentPropertyPreferences.SelectMany(x => x.CreateInstance(this, context.Request))); - context.VisualTree.Content.Property.Primary.AddRange(ContentPropertyPrimary.SelectMany(x => x.CreateInstance(this, context.Request))); - context.VisualTree.Content.Property.Secondary.AddRange(ContentPropertySecondary.SelectMany(x => x.CreateInstance(this, context.Request))); - - // content - context.VisualTree.Content.Preferences.AddRange(ContentPreferences.SelectMany(x => x.CreateInstance(this, context.Request))); - context.VisualTree.Content.Primary.AddRange(ContentPrimary.SelectMany(x => x.CreateInstance(this, context.Request))); - context.VisualTree.Content.Secondary.AddRange(ContentSecondary.SelectMany(x => x.CreateInstance(this, context.Request))); - - // footer - context.VisualTree.Footer.Preferences.AddRange(FooterPreferences.SelectMany(x => x.CreateInstance(this, context.Request))); - context.VisualTree.Footer.Primary.AddRange(FooterPrimary.SelectMany(x => x.CreateInstance(this, context.Request))); - context.VisualTree.Footer.Secondary.AddRange(FooterSecondary.SelectMany(x => x.CreateInstance(this, context.Request))); - - if (context.VisualTree is VisualTreeControl visualTreeControl) - { - var split = new ControlPanelSplit - ( - "split", - [context.VisualTree.Sidebar], - [context.VisualTree.Content] - ) - { - Orientation = TypeOrientationSplit.Horizontal, - SplitterColor = LayoutSchema.SplitterColor, - Panel1InitialSize = 20, - Panel1MinSize = 150, - Styles = ["min-height: 85%;"] - }; - - visualTreeControl.Content.Add(context.VisualTree.Header); - visualTreeControl.Content.Add(context.VisualTree.Toast); - visualTreeControl.Content.Add(context.VisualTree.Breadcrumb); - visualTreeControl.Content.Add(context.VisualTree.Prologue); - visualTreeControl.Content.Add(context.VisualTree.SearchOptions); - visualTreeControl.Content.Add(context.VisualTree.Sidebar.HasContent ? split : context.VisualTree.Content); - visualTreeControl.Content.Add(context.VisualTree.Footer); - visualTreeControl.Content.Add(new ControlApiNotificationPopup("popup_notification")); - } - } - } -} +//using System.Collections.Generic; +//using System.Linq; +//using WebExpress.WebApp.WebApiControl; +//using WebExpress.WebApp.WebSection; +//using WebExpress.WebCore.WebComponent; +//using WebExpress.WebCore.WebHtml; +//using WebExpress.WebCore.WebResource; +//using WebExpress.WebCore.WebUri; +//using WebExpress.WebUI.WebControl; +//using WebExpress.WebUI.WebFragment; +//using WebExpress.WebUI.WebPage; + +//namespace WebExpress.WebApp.WebPage +//{ +// /// +// /// Page consisting of a vertically arranged header, content and footer area. +// /// +// public abstract class PageWebApp : PageControl +// { +// // header +// private List HeaderAppNavigatorPreferences { get; } = []; +// private List HeaderAppNavigatorPrimary { get; } = []; +// private List HeaderAppNavigatorSecondary { get; } = []; +// private List HeaderNavigationPreferences { get; } = []; +// private List HeaderNavigationPrimary { get; } = []; +// private List HeaderNavigationSecondary { get; } = []; +// private List HeaderQuickCreatePreferences { get; } = []; +// private List HeaderQuickCreatePrimary { get; } = []; +// private List HeaderQuickCreateSecondary { get; } = []; +// private List HeaderHelpPreferences { get; } = []; +// private List HeaderHelpPrimary { get; } = []; +// private List HeaderHelpSecondary { get; } = []; +// private List HeaderSettingsPreferences { get; } = []; +// private List HeaderSettingsPrimary { get; } = []; +// private List HeaderSettingsSecondary { get; } = []; + +// // sidebar +// private List SidebarHeader { get; } = []; +// private List SidebarPreferences { get; } = []; +// private List SidebarPrimary { get; } = []; +// private List SidebarSecondary { get; } = []; + +// // headline +// private List ContentHeadlinePrologue { get; } = []; +// private List ContentHeadlinePreferences { get; } = []; +// private List ContentHeadlinePrimary { get; } = []; +// private List ContentHeadlineSecondary { get; } = []; +// private List ContentHeadlineMorePreferences { get; } = []; +// private List ContentHeadlineMorePrimary { get; } = []; +// private List ContentHeadlineMoreSecondary { get; } = []; +// private List ContentHeadlineMetadata { get; } = []; + +// // property +// private List ContentPropertyPreferences { get; } = []; +// private List ContentPropertyPrimary { get; } = []; +// private List ContentPropertySecondary { get; } = []; + +// // content +// private List ContentPreferences { get; } = []; +// private List ContentPrimary { get; } = []; +// private List ContentSecondary { get; } = []; + +// // footer +// private List FooterPreferences { get; } = []; +// private List FooterPrimary { get; } = []; +// private List FooterSecondary { get; } = []; + +// /// +// /// Initializes a new instance of the class. +// /// +// public PageWebApp() +// { +// } + +// /// +// /// Initialization +// /// +// /// The context. +// public override void Initialization(IResourceContext context) +// { +// base.Initialization(context); + +// var fm = ComponentManager.GetComponent(); +// var module = ComponentManager.ModuleManager.GetModule(ApplicationContext, typeof(Module)); +// if (module != null) +// { +// CssLinks.Add(UriResource.Combine(module.ContextPath, "/assets/css/webexpress.webapp.css")); +// CssLinks.Add(UriResource.Combine(module.ContextPath, "/assets/css/webexpress.webapp.popupnotification.css")); +// CssLinks.Add(UriResource.Combine(module.ContextPath, "/assets/css/webexpress.webapp.taskprogressbar.css")); +// HeaderScriptLinks.Add(UriResource.Combine(module.ContextPath, "assets/js/webexpress.webapp.js")); +// HeaderScriptLinks.Add(UriResource.Combine(module.ContextPath, "assets/js/webexpress.webapp.popupnotification.js")); +// HeaderScriptLinks.Add(UriResource.Combine(module.ContextPath, "assets/js/webexpress.webapp.selection.js")); +// HeaderScriptLinks.Add(UriResource.Combine(module.ContextPath, "assets/js/webexpress.webapp.table.js")); +// HeaderScriptLinks.Add(UriResource.Combine(module.ContextPath, "assets/js/webexpress.webapp.taskprogressbar.js")); +// } + +// // header +// HeaderAppNavigatorPreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.AppPreferences, this, context.Scopes)); +// HeaderAppNavigatorPrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppPrimary, this, context.Scopes)); +// HeaderAppNavigatorSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppSecondary, this, context.Scopes)); +// HeaderNavigationPreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.AppNavigationPreferences, this, context.Scopes)); +// HeaderNavigationPrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppNavigationPrimary, this, context.Scopes)); +// HeaderNavigationSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppNavigationSecondary, this, context.Scopes)); +// HeaderQuickCreatePreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.AppQuickcreatePreferences, this, context.Scopes)); +// HeaderQuickCreatePrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppQuickcreatePrimary, this, context.Scopes)); +// HeaderQuickCreateSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppQuickcreateSecondary, this, context.Scopes)); +// HeaderHelpPreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.AppHelpPreferences, this, context.Scopes)); +// HeaderHelpPrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppHelpPrimary, this, context.Scopes)); +// HeaderHelpSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppHelpSecondary, this, context.Scopes)); +// HeaderSettingsPrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppSettingsPrimary, this, context.Scopes)); +// HeaderSettingsSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppSettingsSecondary, this, context.Scopes)); + +// // sidebar +// SidebarHeader.AddRange(fm.GetCacheableFragments(SectionWebApp.SidebarHeader, this, context.Scopes)); +// SidebarPreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.SidebarPreferences, this, context.Scopes)); +// SidebarPrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.SidebarPrimary, this, context.Scopes)); +// SidebarSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.SidebarSecondary, this, context.Scopes)); + +// // headline +// ContentHeadlinePrologue.AddRange(fm.GetCacheableFragments(SectionWebApp.HeadlinePrologue, this, context.Scopes)); +// ContentHeadlinePreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.HeadlinePreferences, this, context.Scopes)); +// ContentHeadlinePrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.HeadlinePrimary, this, context.Scopes)); +// ContentHeadlineSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.HeadlineSecondary, this, context.Scopes)); +// ContentHeadlineMorePreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.MorePreferences, this, context.Scopes)); +// ContentHeadlineMorePrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.MorePrimary, this, context.Scopes)); +// ContentHeadlineMoreSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.MoreSecondary, this, context.Scopes)); +// ContentHeadlineMetadata.AddRange(fm.GetCacheableFragments(SectionWebApp.Metadata, this, context.Scopes)); + +// // property +// ContentPropertyPreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.PropertyPreferences, this, context.Scopes)); +// ContentPropertyPrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.PropertyPrimary, this, context.Scopes)); +// ContentPropertySecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.PropertySecondary, this, context.Scopes)); + +// // content +// ContentPreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.ContentPreferences, this, context.Scopes)); +// ContentPrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.ContentPrimary, this, context.Scopes)); +// ContentSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.ContentSecondary, this, context.Scopes)); + +// // footer +// FooterPreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.FooterPreferences, this, context.Scopes)); +// FooterPrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.FooterPrimary, this, context.Scopes)); +// FooterSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.FooterSecondary, this, context.Scopes)); +// } + +// /// +// /// Processing of the resource. +// /// +// /// The context for rendering the page. +// public override void Process(RenderContextWebApp context) +// { +// base.Process(context); + +// context.VisualTree.Favicons.Add(new Favicon(context.ApplicationContext?.Icon)); +// //context.VisualTree.Header.Logo = context.Application?.Icon; +// //context.VisualTree.Header.AppTitle.Title = this.I18N(context.Application, context.Application?.ApplicationName); + +// context.VisualTree.Breadcrumb.Uri = context.Uri; + +// // header +// context.VisualTree.Header.AppNavigator.Preferences.AddRange(HeaderAppNavigatorPreferences.SelectMany(x => x.CreateInstance(this, context.Request))); +// context.VisualTree.Header.AppNavigator.Primary.AddRange(HeaderAppNavigatorPrimary.SelectMany(x => x.CreateInstance(this, context.Request))); +// context.VisualTree.Header.AppNavigator.Secondary.AddRange(HeaderAppNavigatorSecondary.SelectMany(x => x.CreateInstance(this, context.Request))); +// context.VisualTree.Header.AppNavigation.Preferences.AddRange(HeaderNavigationPreferences.SelectMany(x => x.CreateInstance(this, context.Request))); +// context.VisualTree.Header.AppNavigation.Primary.AddRange(HeaderNavigationPrimary.SelectMany(x => x.CreateInstance(this, context.Request))); +// context.VisualTree.Header.AppNavigation.Secondary.AddRange(HeaderNavigationSecondary.SelectMany(x => x.CreateInstance(this, context.Request))); +// context.VisualTree.Header.QuickCreate.Preferences.AddRange(HeaderQuickCreatePreferences.SelectMany(x => x.CreateInstance(this, context.Request))); +// context.VisualTree.Header.QuickCreate.Primary.AddRange(HeaderQuickCreatePrimary.SelectMany(x => x.CreateInstance(this, context.Request))); +// context.VisualTree.Header.QuickCreate.Secondary.AddRange(HeaderQuickCreateSecondary.SelectMany(x => x.CreateInstance(this, context.Request))); +// context.VisualTree.Header.Help.Preferences.AddRange(HeaderHelpPreferences.SelectMany(x => x.CreateInstance(this, context.Request))); +// context.VisualTree.Header.Help.Primary.AddRange(HeaderHelpPrimary.SelectMany(x => x.CreateInstance(this, context.Request))); +// context.VisualTree.Header.Help.Secondary.AddRange(HeaderHelpSecondary.SelectMany(x => x.CreateInstance(this, context.Request))); +// context.VisualTree.Header.Settings.Preferences.AddRange(HeaderSettingsPreferences.SelectMany(x => x.CreateInstance(this, context.Request))); +// context.VisualTree.Header.Settings.Primary.AddRange(HeaderSettingsPrimary.SelectMany(x => x.CreateInstance(this, context.Request))); +// context.VisualTree.Header.Settings.Secondary.AddRange(HeaderSettingsSecondary.SelectMany(x => x.CreateInstance(this, context.Request))); + +// // sidebar +// context.VisualTree.Sidebar.Header.AddRange(SidebarHeader.SelectMany(x => x.CreateInstance(this, context.Request))); +// context.VisualTree.Sidebar.Preferences.AddRange(SidebarPreferences.SelectMany(x => x.CreateInstance(this, context.Request))); +// context.VisualTree.Sidebar.Primary.AddRange(SidebarPrimary.SelectMany(x => x.CreateInstance(this, context.Request))); +// context.VisualTree.Sidebar.Secondary.AddRange(SidebarSecondary.SelectMany(x => x.CreateInstance(this, context.Request))); + +// // headline +// context.VisualTree.Content.Headline.Prologue.AddRange(ContentHeadlinePrologue.SelectMany(x => x.CreateInstance(this, context.Request))); +// context.VisualTree.Content.Headline.Preferences.AddRange(ContentHeadlinePreferences.SelectMany(x => x.CreateInstance(this, context.Request))); +// context.VisualTree.Content.Headline.Primary.AddRange(ContentHeadlinePrimary.SelectMany(x => x.CreateInstance(this, context.Request))); +// context.VisualTree.Content.Headline.Secondary.AddRange(ContentHeadlineSecondary.SelectMany(x => x.CreateInstance(this, context.Request))); +// context.VisualTree.Content.Headline.MorePreferences.AddRange(ContentHeadlineMorePreferences.SelectMany(x => x.CreateInstance(this, context.Request))); +// context.VisualTree.Content.Headline.MorePrimary.AddRange(ContentHeadlineMorePrimary.SelectMany(x => x.CreateInstance(this, context.Request))); +// context.VisualTree.Content.Headline.MoreSecondary.AddRange(ContentHeadlineMoreSecondary.SelectMany(x => x.CreateInstance(this, context.Request))); +// context.VisualTree.Content.Headline.Metadata.AddRange(ContentHeadlineMetadata.SelectMany(x => x.CreateInstance(this, context.Request))); + +// // property +// context.VisualTree.Content.Property.Preferences.AddRange(ContentPropertyPreferences.SelectMany(x => x.CreateInstance(this, context.Request))); +// context.VisualTree.Content.Property.Primary.AddRange(ContentPropertyPrimary.SelectMany(x => x.CreateInstance(this, context.Request))); +// context.VisualTree.Content.Property.Secondary.AddRange(ContentPropertySecondary.SelectMany(x => x.CreateInstance(this, context.Request))); + +// // content +// context.VisualTree.Content.Preferences.AddRange(ContentPreferences.SelectMany(x => x.CreateInstance(this, context.Request))); +// context.VisualTree.Content.Primary.AddRange(ContentPrimary.SelectMany(x => x.CreateInstance(this, context.Request))); +// context.VisualTree.Content.Secondary.AddRange(ContentSecondary.SelectMany(x => x.CreateInstance(this, context.Request))); + +// // footer +// context.VisualTree.Footer.Preferences.AddRange(FooterPreferences.SelectMany(x => x.CreateInstance(this, context.Request))); +// context.VisualTree.Footer.Primary.AddRange(FooterPrimary.SelectMany(x => x.CreateInstance(this, context.Request))); +// context.VisualTree.Footer.Secondary.AddRange(FooterSecondary.SelectMany(x => x.CreateInstance(this, context.Request))); + +// if (context.VisualTree is VisualTreeControl visualTreeControl) +// { +// var split = new ControlPanelSplit +// ( +// "split", +// [context.VisualTree.Sidebar], +// [context.VisualTree.Content] +// ) +// { +// Orientation = TypeOrientationSplit.Horizontal, +// SplitterColor = LayoutSchema.SplitterColor, +// Panel1InitialSize = 20, +// Panel1MinSize = 150, +// Styles = ["min-height: 85%;"] +// }; + +// visualTreeControl.Content.Add(context.VisualTree.Header); +// visualTreeControl.Content.Add(context.VisualTree.Toast); +// visualTreeControl.Content.Add(context.VisualTree.Breadcrumb); +// visualTreeControl.Content.Add(context.VisualTree.Prologue); +// visualTreeControl.Content.Add(context.VisualTree.SearchOptions); +// visualTreeControl.Content.Add(context.VisualTree.Sidebar.HasContent ? split : context.VisualTree.Content); +// visualTreeControl.Content.Add(context.VisualTree.Footer); +// visualTreeControl.Content.Add(new ControlApiNotificationPopup("popup_notification")); +// } +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebPage/PageWebAppForm.cs b/src/WebExpress.WebApp/WebPage/PageWebAppForm.cs index 11a427d..c2f0fe5 100644 --- a/src/WebExpress.WebApp/WebPage/PageWebAppForm.cs +++ b/src/WebExpress.WebApp/WebPage/PageWebAppForm.cs @@ -1,134 +1,134 @@ -using System; -using WebExpress.WebApp.WebNotificaation; -using WebExpress.WebCore.Internationalization; -using WebExpress.WebCore.WebComponent; -using WebExpress.WebCore.WebResource; -using WebExpress.WebUI.WebControl; +//using System; +//using WebExpress.WebApp.WebNotificaation; +//using WebExpress.WebCore.Internationalization; +//using WebExpress.WebCore.WebComponent; +//using WebExpress.WebCore.WebResource; +//using WebExpress.WebUI.WebControl; -namespace WebExpress.WebApp.WebPage -{ - /// - /// A form based page. - /// - public abstract class PageWebAppForm : PageWebApp where T : ControlForm, new() - { - /// - /// Returns the form - /// - protected T Form { get; private set; } +//namespace WebExpress.WebApp.WebPage +//{ +// /// +// /// A form based page. +// /// +// public abstract class PageWebAppForm : PageWebApp where T : ControlForm, new() +// { +// /// +// /// Returns the form +// /// +// protected T Form { get; private set; } - /// - /// Initializes a new instance of the class. - /// - public PageWebAppForm() - { - Form = new T(); - } +// /// +// /// Initializes a new instance of the class. +// /// +// public PageWebAppForm() +// { +// Form = new T(); +// } - /// - /// Initializes a new instance of the class. - /// - /// The id. - public PageWebAppForm(string id) - { - Form = Activator.CreateInstance(typeof(T), id) as T; - } +// /// +// /// Initializes a new instance of the class. +// /// +// /// The id. +// public PageWebAppForm(string id) +// { +// Form = Activator.CreateInstance(typeof(T), id) as T; +// } - /// - /// Initialization - /// - /// The context. - public override void Initialization(IResourceContext context) - { - base.Initialization(context); +// /// +// /// Initialization +// /// +// /// The context. +// public override void Initialization(IResourceContext context) +// { +// base.Initialization(context); - Form.InitializeForm += OnInitializeForm; - Form.FillForm += OnFillForm; - Form.ProcessForm += OnProcessForm; - } +// Form.InitializeForm += OnInitializeForm; +// Form.FillForm += OnFillForm; +// Form.ProcessForm += OnProcessForm; +// } - /// - /// Invoked when the form is initialized. - /// - /// The trigger of the event. - /// The event argument. - protected virtual void OnInitializeForm(object sender, FormEventArgs e) - { - } +// /// +// /// Invoked when the form is initialized. +// /// +// /// The trigger of the event. +// /// The event argument. +// protected virtual void OnInitializeForm(object sender, FormEventArgs e) +// { +// } - /// - /// Invoked when the form is about to be populated. - /// - /// The trigger of the event. - /// The event argument. - protected virtual void OnFillForm(object sender, FormEventArgs e) - { - } +// /// +// /// Invoked when the form is about to be populated. +// /// +// /// The trigger of the event. +// /// The event argument. +// protected virtual void OnFillForm(object sender, FormEventArgs e) +// { +// } - /// - /// Fired when the form is about to be processed. - /// - /// The trigger of the event. - /// The event argument./param> - protected virtual void OnProcessForm(object sender, FormEventArgs e) - { - } +// /// +// /// Fired when the form is about to be processed. +// /// +// /// The trigger of the event. +// /// The event argument./param> +// protected virtual void OnProcessForm(object sender, FormEventArgs e) +// { +// } - /// - /// Returns the redirect uri. - /// - /// The redirect uri. - protected string SetRedirectUri() - { - return Form.RedirectUri; - } +// /// +// /// Returns the redirect uri. +// /// +// /// The redirect uri. +// protected string SetRedirectUri() +// { +// return Form.RedirectUri; +// } - /// - /// Sets the redirect uri. - /// - /// The redirect uri. - protected void SetRedirectUri(string redirectUri) - { - Form.RedirectUri = redirectUri; - } +// /// +// /// Sets the redirect uri. +// /// +// /// The redirect uri. +// protected void SetRedirectUri(string redirectUri) +// { +// Form.RedirectUri = redirectUri; +// } - /// - /// Creates an notification. - /// - /// The context. - /// The notification tiltle. - /// The notification message. - /// The notification color. - /// The image. - protected void AddNotification(RenderContextForm context, string title, string text, PropertyColorText color, string image) - { - ComponentManager.GetComponent()?.AddNotification - ( - request: context.Request, - message: string.Format - ( - InternationalizationManager.I18N(Culture, title), - new ControlText() - { - Text = text, - TextColor = color, - Format = TypeFormatText.Span - }.Render(context).ToString().Trim() - ), - icon: image, - durability: 10000 - ); - } +// /// +// /// Creates an notification. +// /// +// /// The context. +// /// The notification tiltle. +// /// The notification message. +// /// The notification color. +// /// The image. +// protected void AddNotification(RenderContextForm context, string title, string text, PropertyColorText color, string image) +// { +// ComponentManager.GetComponent()?.AddNotification +// ( +// request: context.Request, +// message: string.Format +// ( +// InternationalizationManager.I18N(Culture, title), +// new ControlText() +// { +// Text = text, +// TextColor = color, +// Format = TypeFormatText.Span +// }.Render(context).ToString().Trim() +// ), +// icon: image, +// durability: 10000 +// ); +// } - /// - /// Processing of the resource. - /// - /// The context for rendering the page. - public override void Process(RenderContextWebApp context) - { - base.Process(context); +// /// +// /// Processing of the resource. +// /// +// /// The context for rendering the page. +// public override void Process(RenderContextWebApp context) +// { +// base.Process(context); - context.VisualTree.Content.Primary.Add(Form); - } - } -} +// context.VisualTree.Content.Primary.Add(Form); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebPage/PageWebAppFormConfirm.cs b/src/WebExpress.WebApp/WebPage/PageWebAppFormConfirm.cs index 8385d38..a587682 100644 --- a/src/WebExpress.WebApp/WebPage/PageWebAppFormConfirm.cs +++ b/src/WebExpress.WebApp/WebPage/PageWebAppFormConfirm.cs @@ -1,77 +1,77 @@ -using WebExpress.WebApp.WebControl; -using WebExpress.WebCore.WebResource; -using WebExpress.WebUI.WebControl; +//using WebExpress.WebApp.WebControl; +//using WebExpress.WebCore.WebResource; +//using WebExpress.WebUI.WebControl; -namespace WebExpress.WebApp.WebPage -{ - /// - /// A form based page. - /// - public abstract class PageWebAppFormConfirm : PageWebAppForm where T : ControlFormConfirm, new() - { - /// - /// Initializes a new instance of the class. - /// - /// The id. - public PageWebAppFormConfirm() - { - } +//namespace WebExpress.WebApp.WebPage +//{ +// /// +// /// A form based page. +// /// +// public abstract class PageWebAppFormConfirm : PageWebAppForm where T : ControlFormConfirm, new() +// { +// /// +// /// Initializes a new instance of the class. +// /// +// /// The id. +// public PageWebAppFormConfirm() +// { +// } - /// - /// Initializes a new instance of the class. - /// - /// The id. - public PageWebAppFormConfirm(string id) - : base(id) - { - } +// /// +// /// Initializes a new instance of the class. +// /// +// /// The id. +// public PageWebAppFormConfirm(string id) +// : base(id) +// { +// } - /// - /// Initialization - /// - /// The context. - public override void Initialization(IResourceContext context) - { - base.Initialization(context); +// /// +// /// Initialization +// /// +// /// The context. +// public override void Initialization(IResourceContext context) +// { +// base.Initialization(context); - Form.Confirm += OnConfirmForm; - } +// Form.Confirm += OnConfirmForm; +// } - /// - /// Triggered when the form is confirmed. - /// - /// The trigger of the event. - /// The event argument./param> - protected virtual void OnConfirmForm(object sender, FormEventArgs e) - { - } +// /// +// /// Triggered when the form is confirmed. +// /// +// /// The trigger of the event. +// /// The event argument./param> +// protected virtual void OnConfirmForm(object sender, FormEventArgs e) +// { +// } - /// - /// Returns the description. - /// - /// The description. - protected string SetDescription() - { - return Form.Content.Text; - } +// /// +// /// Returns the description. +// /// +// /// The description. +// protected string SetDescription() +// { +// return Form.Content.Text; +// } - /// - /// Sets the description. - /// - /// The description. - protected void SetDescription(string description) - { - Form.Content.Text = description; - } +// /// +// /// Sets the description. +// /// +// /// The description. +// protected void SetDescription(string description) +// { +// Form.Content.Text = description; +// } - /// - /// Processing of the resource. - /// - /// The context for rendering the page. - public override void Process(RenderContextWebApp context) - { - base.Process(context); - } - } -} +// /// +// /// Processing of the resource. +// /// +// /// The context for rendering the page. +// public override void Process(RenderContextWebApp context) +// { +// base.Process(context); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebPage/RenderContextWebApp.cs b/src/WebExpress.WebApp/WebPage/RenderContextWebApp.cs index c93f50a..7acf7fb 100644 --- a/src/WebExpress.WebApp/WebPage/RenderContextWebApp.cs +++ b/src/WebExpress.WebApp/WebPage/RenderContextWebApp.cs @@ -1,46 +1,46 @@ -using WebExpress.WebCore.WebMessage; -using WebExpress.WebCore.WebPage; -using WebExpress.WebUI.WebPage; +//using WebExpress.WebCore.WebMessage; +//using WebExpress.WebCore.WebPage; +//using WebExpress.WebUI.WebPage; -namespace WebExpress.WebApp.WebPage -{ - public class RenderContextWebApp : RenderContextControl - { - /// - /// Returns or sets the visual representation of the page. - /// - public new VisualTreeWebApp VisualTree - { - get { return base.VisualTree as VisualTreeWebApp; } - set { base.VisualTree = value; } - } +//namespace WebExpress.WebApp.WebPage +//{ +// public class RenderContextWebApp : RenderContextControl +// { +// /// +// /// Returns or sets the visual representation of the page. +// /// +// public new VisualTreeWebApp VisualTree +// { +// get { return base.VisualTree as VisualTreeWebApp; } +// set { base.VisualTree = value; } +// } - /// - /// Initializes a new instance of the class. - /// - public RenderContextWebApp() - { - VisualTree = new VisualTreeWebApp(); - } +// /// +// /// Initializes a new instance of the class. +// /// +// public RenderContextWebApp() +// { +// VisualTree = new VisualTreeWebApp(); +// } - /// - /// Initializes a new instance of the class. - /// - /// The page where the control is rendered. - /// The request. - /// The visual tree. - public RenderContextWebApp(IPage page, Request request, VisualTreeWebApp visualTree) - : base(page, request, visualTree) - { - } +// /// +// /// Initializes a new instance of the class. +// /// +// /// The page where the control is rendered. +// /// The request. +// /// The visual tree. +// public RenderContextWebApp(IPage page, Request request, VisualTreeWebApp visualTree) +// : base(page, request, visualTree) +// { +// } - /// - /// Copy-Constructor - /// - /// The render context to copy./param> - public RenderContextWebApp(RenderContext context) - : this(context?.Page, context?.Request, context?.VisualTree as VisualTreeWebApp) - { - } - } -} +// /// +// /// Copy-Constructor +// /// +// /// The render context to copy./param> +// public RenderContextWebApp(RenderContext context) +// : this(context?.Page, context?.Request, context?.VisualTree as VisualTreeWebApp) +// { +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebPage/VisualTreeWebApp.cs b/src/WebExpress.WebApp/WebPage/VisualTreeWebApp.cs index b19b083..71639f8 100644 --- a/src/WebExpress.WebApp/WebPage/VisualTreeWebApp.cs +++ b/src/WebExpress.WebApp/WebPage/VisualTreeWebApp.cs @@ -1,74 +1,149 @@ using System.Collections.Generic; -using WebExpress.WebApp.WebControl; -using WebExpress.WebUI.WebControl; -using WebExpress.WebUI.WebPage; +using WebExpress.WebCore.WebFragment; +using WebExpress.WebCore.WebHtml; +using WebExpress.WebCore.WebPage; namespace WebExpress.WebApp.WebPage { - public class VisualTreeWebApp : VisualTreeControl + /// + /// Represents the visual tree of the web application. + /// + public class VisualTreeWebApp : IVisualTree { + // header + private readonly List _headerAppNavigatorPreferences = []; + private readonly List _headerAppNavigatorPrimary = []; + private readonly List _headerAppNavigatorSecondary = []; + private readonly List _headerNavigationPreferences = []; + private readonly List _headerNavigationPrimary = []; + private readonly List _headerNavigationSecondary = []; + private readonly List _headerQuickCreatePreferences = []; + private readonly List _headerQuickCreatePrimary = []; + private readonly List _headerQuickCreateSecondary = []; + private readonly List _headerHelpPreferences = []; + private readonly List _headerHelpPrimary = []; + private readonly List _headerHelpSecondary = []; + private readonly List _headerSettingsPreferences = []; + private readonly List _headerSettingsPrimary = []; + private readonly List _headerSettingsSecondary = []; + // sidebar + private readonly List _sidebarHeader = []; + private readonly List _sidebarPreferences = []; + private readonly List _sidebarPrimary = []; + private readonly List _sidebarSecondary = []; + // headline + private readonly List _contentHeadlinePrologue = []; + private readonly List _contentHeadlinePreferences = []; + private readonly List _contentHeadlinePrimary = []; + private readonly List _contentHeadlineSecondary = []; + private readonly List _contentHeadlineMorePreferences = []; + private readonly List _contentHeadlineMorePrimary = []; + private readonly List _contentHeadlineMoreSecondary = []; + private readonly List _contentHeadlineMetadata = []; + // property + private readonly List _contentPropertyPreferences = []; + private readonly List _contentPropertyPrimary = []; + private readonly List _contentPropertySecondary = []; + // content + private readonly List _contentPreferences = []; + private readonly List _contentPrimary = []; + private readonly List _contentSecondary = []; + // footer + private readonly List _footerPreferences = []; + private readonly List _footerPrimary = []; + private readonly List _footerSecondary = []; + /// /// Returns or sets the header. /// - public ControlWebAppHeader Header { get; protected set; } = new ControlWebAppHeader("webexpress.webapp.header"); + //public ControlWebAppHeader Header { get; protected set; } = new ControlWebAppHeader("webexpress.webapp.header"); - /// - /// Returns or sets the content. - /// - public new ControlWebAppContent Content { get; protected set; } = new ControlWebAppContent("webexpress.webapp.content"); + ///// + ///// Returns or sets the content. + ///// + //public new ControlWebAppContent Content { get; protected set; } = new ControlWebAppContent("webexpress.webapp.content"); - /// - /// Returns or sets the footer. - /// - public ControlWebAppFooter Footer { get; protected set; } = new ControlWebAppFooter("webexpress.webapp.footer"); + ///// + ///// Returns or sets the footer. + ///// + //public ControlWebAppFooter Footer { get; protected set; } = new ControlWebAppFooter("webexpress.webapp.footer"); - /// - /// Returns or sets the area for the toast messages. - /// - public ControlPanelToast Toast { get; protected set; } = new ControlPanelToast("webexpress.webapp.toast"); + ///// + ///// Returns or sets the area for the toast messages. + ///// + //public ControlPanelToast Toast { get; protected set; } = new ControlPanelToast("webexpress.webapp.toast"); - /// - /// Returns or sets the range for the path specification. - /// - public ControlBreadcrumb Breadcrumb { get; protected set; } = new ControlBreadcrumb("webexpress.webapp.breadcrumb"); + ///// + ///// Returns or sets the range for the path specification. + ///// + //public ControlBreadcrumb Breadcrumb { get; protected set; } = new ControlBreadcrumb("webexpress.webapp.breadcrumb"); - /// - /// Returns or sets the area for prologue. - /// - public ControlPanel Prologue { get; protected set; } = new ControlPanel("webexpress.webapp.prologue"); + ///// + ///// Returns or sets the area for prologue. + ///// + //public ControlPanel Prologue { get; protected set; } = new ControlPanel("webexpress.webapp.prologue"); - /// - /// Returns or sets the range for the search options. - /// - public ControlPanel SearchOptions { get; protected set; } = new ControlPanel("webexpress.webapp.searchoptions"); + ///// + ///// Returns or sets the range for the search options. + ///// + //public ControlPanel SearchOptions { get; protected set; } = new ControlPanel("webexpress.webapp.searchoptions"); + + ///// + ///// Returns or sets the sidebar. + ///// + //public ControlWebAppSidebar Sidebar { get; protected set; } = new ControlWebAppSidebar("webexpress.webapp.sidebar"); + + ///// + ///// Initializes a new instance of the class. + ///// + //public VisualTreeWebApp() + //{ + // Header.Fixed = TypeFixed.Top; + // Header.Styles = new List(new[] { "position: sticky; top: 0; z-index: 99;" }); + + // Breadcrumb.Margin = new PropertySpacingMargin(PropertySpacing.Space.Null); + // Breadcrumb.BackgroundColor = LayoutSchema.BreadcrumbBackground; + // Breadcrumb.Size = LayoutSchema.BreadcrumbSize; + + // Toast.BackgroundColor = LayoutSchema.ValidationWarningBackground; + + // Sidebar.BackgroundColor = LayoutSchema.SidebarBackground; + + // Content.BackgroundColor = LayoutSchema.ContentBackground; + // Content.Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.None, PropertySpacing.Space.None); + // //Content.Width = TypeWidth.OneHundred; + + // Footer.BackgroundColor = LayoutSchema.FooterBackground; + //} - /// - /// Returns or sets the sidebar. - /// - public ControlWebAppSidebar Sidebar { get; protected set; } = new ControlWebAppSidebar("webexpress.webapp.sidebar"); /// /// Initializes a new instance of the class. /// public VisualTreeWebApp() { - Header.Fixed = TypeFixed.Top; - Header.Styles = new List(new[] { "position: sticky; top: 0; z-index: 99;" }); - - Breadcrumb.Margin = new PropertySpacingMargin(PropertySpacing.Space.Null); - Breadcrumb.BackgroundColor = LayoutSchema.BreadcrumbBackground; - Breadcrumb.Size = LayoutSchema.BreadcrumbSize; - - Toast.BackgroundColor = LayoutSchema.ValidationWarningBackground; + } - Sidebar.BackgroundColor = LayoutSchema.SidebarBackground; + /// + /// Convert to html. + /// + /// The context for rendering the page. + /// The page as an html tree. + public virtual IHtmlNode Render(IVisualTreeContext context) + { + var html = new HtmlElementRootHtml(); + //html.Head.Title = I18N.Translate(context.Request, Title); + //html.Head.Favicons = Favicons?.Select(x => new Favicon(x.Url, x.Mediatype)); + //html.Head.Styles = Styles; + //html.Head.Meta = Meta; + //html.Head.Scripts = HeaderScripts; + ////html.Body.Elements.AddRange(Content?.Where(x => x.Enable).Select(x => x.Render(context))); + //html.Body.Scripts = [.. Scripts.Values]; - Content.BackgroundColor = LayoutSchema.ContentBackground; - Content.Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.None, PropertySpacing.Space.None); - //Content.Width = TypeWidth.OneHundred; + //html.Head.CssLinks = CssLinks.Where(x => x != null).Select(x => x.ToString()); + //html.Head.ScriptLinks = HeaderScriptLinks?.Where(x => x != null).Select(x => x.ToString()); - Footer.BackgroundColor = LayoutSchema.FooterBackground; + return html; } - } } diff --git a/src/WebExpress.WebApp/WebResource/Asset.cs b/src/WebExpress.WebApp/WebResource/Asset.cs index ca92562..a10a0fe 100644 --- a/src/WebExpress.WebApp/WebResource/Asset.cs +++ b/src/WebExpress.WebApp/WebResource/Asset.cs @@ -1,21 +1,21 @@ -using WebExpress.WebCore.WebAttribute; +//using WebExpress.WebCore.WebAttribute; -namespace WebExpress.WebApp.WebResource -{ - /// - /// Delivery of a resource embedded in the assamby. - /// - [Segment("assets")] - [ContextPath("/")] - [IncludeSubPaths(true)] - [Module] - public sealed class Asset : WebExpress.WebCore.WebResource.ResourceAsset - { - /// - /// Initializes a new instance of the class. - /// - public Asset() - { - } - } -} \ No newline at end of file +//namespace WebExpress.WebApp.WebResource +//{ +// /// +// /// Delivery of a resource embedded in the assamby. +// /// +// [Segment("assets")] +// [ContextPath("/")] +// [IncludeSubPaths(true)] +// [Module] +// public sealed class Asset : WebExpress.WebCore.WebResource.ResourceAsset +// { +// /// +// /// Initializes a new instance of the class. +// /// +// public Asset() +// { +// } +// } +//} \ No newline at end of file diff --git a/src/WebExpress.WebApp/WebResource/Pagination.cs b/src/WebExpress.WebApp/WebResource/Pagination.cs index 1e91184..00ace27 100644 --- a/src/WebExpress.WebApp/WebResource/Pagination.cs +++ b/src/WebExpress.WebApp/WebResource/Pagination.cs @@ -1,20 +1,20 @@ -namespace WebExpress.WebApp.WebResource -{ - public class Pagination - { - /// - /// Returns or sets the number of entries per page. - /// - public int Count { get; set; } = 50; +//namespace WebExpress.WebApp.WebResource +//{ +// public class Pagination +// { +// /// +// /// Returns or sets the number of entries per page. +// /// +// public int Count { get; set; } = 50; - /// - /// Returns or sets the total number of pages. - /// - public int Total { get; set; } = 1; +// /// +// /// Returns or sets the total number of pages. +// /// +// public int Total { get; set; } = 1; - /// - /// Returns or sets the page number of the current page. - /// - public int Current { get; set; } = 0; - } -} +// /// +// /// Returns or sets the page number of the current page. +// /// +// public int Current { get; set; } = 0; +// } +//} diff --git a/src/WebExpress.WebApp/WebResource/ResourceRestCrud.cs b/src/WebExpress.WebApp/WebResource/ResourceRestCrud.cs index e857f89..1039812 100644 --- a/src/WebExpress.WebApp/WebResource/ResourceRestCrud.cs +++ b/src/WebExpress.WebApp/WebResource/ResourceRestCrud.cs @@ -1,85 +1,85 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using WebExpress.WebCore.WebComponent; -using WebExpress.WebCore.WebMessage; -using WebExpress.WebCore.WebResource; -using WebExpress.WebIndex; -using WebExpress.WebIndex.WebAttribute; -using WebExpress.WebIndex.Wql; +//using System; +//using System.Collections.Generic; +//using System.Linq; +//using System.Reflection; +//using WebExpress.WebCore.WebComponent; +//using WebExpress.WebCore.WebMessage; +//using WebExpress.WebCore.WebResource; +//using WebExpress.WebIndex; +//using WebExpress.WebIndex.WebAttribute; +//using WebExpress.WebIndex.Wql; -namespace WebExpress.WebApp.WebResource -{ - public abstract class ResourceRestCrud : ResourceRest where T : IIndexItem - { - /// - /// Returns the lock object. - /// - protected object Guard { get; } = new object(); +//namespace WebExpress.WebApp.WebResource +//{ +// public abstract class ResourceRestCrud : ResourceRest where T : IIndexItem +// { +// /// +// /// Returns the lock object. +// /// +// protected object Guard { get; } = new object(); - /// - /// Processing of the resource that was called via the get request. - /// - /// The request. - /// An enumeration of which json serializer can be serialized. - public abstract IEnumerable GetColumns(Request request); +// /// +// /// Processing of the resource that was called via the get request. +// /// +// /// The request. +// /// An enumeration of which json serializer can be serialized. +// public abstract IEnumerable GetColumns(Request request); - /// - /// Processing of the resource that was called via the get request. - /// - /// The filtering and sorting options. - /// The request. - /// An enumeration of which json serializer can be serialized. - public abstract IEnumerable GetData(IWqlStatement wql, Request request); +// /// +// /// Processing of the resource that was called via the get request. +// /// +// /// The filtering and sorting options. +// /// The request. +// /// An enumeration of which json serializer can be serialized. +// public abstract IEnumerable GetData(IWqlStatement wql, Request request); - /// - /// Processing of the resource that was called via the get request. - /// - /// The request. - /// An enumeration of which json serializer can be serialized. - public override object GetData(Request request) - { - var itemCount = 50; - var search = request.HasParameter("search") ? request.GetParameter("search").Value : string.Empty; - var wql = request.HasParameter("wql") ? request.GetParameter("wql").Value : null; - var page = request.GetParameter("page"); - var columns = request.HasParameter("columns"); - var pagenumber = !string.IsNullOrWhiteSpace(page?.Value) ? Convert.ToInt32(page?.Value) : 0; +// /// +// /// Processing of the resource that was called via the get request. +// /// +// /// The request. +// /// An enumeration of which json serializer can be serialized. +// public override object GetData(Request request) +// { +// var itemCount = 50; +// var search = request.HasParameter("search") ? request.GetParameter("search").Value : string.Empty; +// var wql = request.HasParameter("wql") ? request.GetParameter("wql").Value : null; +// var page = request.GetParameter("page"); +// var columns = request.HasParameter("columns"); +// var pagenumber = !string.IsNullOrWhiteSpace(page?.Value) ? Convert.ToInt32(page?.Value) : 0; - if (columns) - { - return new { Columns = GetColumns(request) }; - } +// if (columns) +// { +// return new { Columns = GetColumns(request) }; +// } - lock (Guard) - { - var wqlStatement = ComponentManager.GetComponent().Retrieve(wql ?? $"{GetDefaultSearchAttribute()}='{search}'"); - var data = GetData(wqlStatement, request); +// lock (Guard) +// { +// var wqlStatement = ComponentManager.GetComponent().Retrieve(wql ?? $"{GetDefaultSearchAttribute()}='{search}'"); +// var data = GetData(wqlStatement, request); - var count = data.Count(); - var totalpage = Math.Round(count / (double)itemCount, MidpointRounding.ToEven); +// var count = data.Count(); +// var totalpage = Math.Round(count / (double)itemCount, MidpointRounding.ToEven); - if (page == null) - { - return new { Data = data }; - } +// if (page == null) +// { +// return new { Data = data }; +// } - return new { data = data.Skip(itemCount * pagenumber).Take(itemCount), pagination = new { pagenumber = pagenumber, totalpage = totalpage } }; - } - } +// return new { data = data.Skip(itemCount * pagenumber).Take(itemCount), pagination = new { pagenumber = pagenumber, totalpage = totalpage } }; +// } +// } - /// - /// Returns the attribute name that has been set as for search queries. - /// - /// The name of the default attribute. - protected virtual string GetDefaultSearchAttribute() - { - return typeof(T).GetProperties() - //.Where(x => x.GetCustomAttribute() != null) - .Where(x => x.GetCustomAttribute() == null) - .Select(x => x.Name) - .FirstOrDefault(); - } - } -} +// /// +// /// Returns the attribute name that has been set as for search queries. +// /// +// /// The name of the default attribute. +// protected virtual string GetDefaultSearchAttribute() +// { +// return typeof(T).GetProperties() +// //.Where(x => x.GetCustomAttribute() != null) +// .Where(x => x.GetCustomAttribute() == null) +// .Select(x => x.Name) +// .FirstOrDefault(); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebResource/ResourceRestCrudColumn.cs b/src/WebExpress.WebApp/WebResource/ResourceRestCrudColumn.cs index 75ff45c..5c13b5e 100644 --- a/src/WebExpress.WebApp/WebResource/ResourceRestCrudColumn.cs +++ b/src/WebExpress.WebApp/WebResource/ResourceRestCrudColumn.cs @@ -1,43 +1,43 @@ -using System.Text.Json.Serialization; +//using System.Text.Json.Serialization; -namespace WebExpress.WebApp.WebResource -{ - /// - /// Metainformationen einer CRUD-Tabellensplate - /// - public class ResourceRestCrudColumn - { - /// - /// Returns or sets the label. der Splalte - /// - [JsonPropertyName("label")] - public string Label { get; set; } +//namespace WebExpress.WebApp.WebResource +//{ +// /// +// /// Metainformationen einer CRUD-Tabellensplate +// /// +// public class ResourceRestCrudColumn +// { +// /// +// /// Returns or sets the label. der Splalte +// /// +// [JsonPropertyName("label")] +// public string Label { get; set; } - /// - /// Returns or sets the icon. der Spalte oder null - /// - [JsonPropertyName("icon")] - public string Icon { get; set; } +// /// +// /// Returns or sets the icon. der Spalte oder null +// /// +// [JsonPropertyName("icon")] +// public string Icon { get; set; } - /// - /// Returns or sets the width. der Tabellenspalte in %, null für auto - /// - [JsonPropertyName("width")] - public uint? Width { get; set; } +// /// +// /// Returns or sets the width. der Tabellenspalte in %, null für auto +// /// +// [JsonPropertyName("width")] +// public uint? Width { get; set; } - /// - /// Liefert oder setzt den Javascriptcode, welche die Daten der Zelle rendert - /// - [JsonPropertyName("render")] - public string Render { get; set; } +// /// +// /// Liefert oder setzt den Javascriptcode, welche die Daten der Zelle rendert +// /// +// [JsonPropertyName("render")] +// public string Render { get; set; } - /// - /// Initializes a new instance of the class. - /// - /// The label of the column. - public ResourceRestCrudColumn(string label) - { - Label = label; - } - } -} +// /// +// /// Initializes a new instance of the class. +// /// +// /// The label of the column. +// public ResourceRestCrudColumn(string label) +// { +// Label = label; +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSetting.cs b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSetting.cs index 7ac004c..d0cb25a 100644 --- a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSetting.cs +++ b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSetting.cs @@ -1,169 +1,169 @@ -using System.Collections.Generic; -using System.Linq; -using WebExpress.WebApp.WebPage; -using WebExpress.WebCore.WebComponent; -using WebExpress.WebCore.WebResource; -using WebExpress.WebUI.SettingPage; -using WebExpress.WebUI.WebAttribute; -using WebExpress.WebUI.WebControl; -using WebExpress.WebUI.WebSettingPage; - -namespace WebExpress.WebApp.WebSettingPage -{ - /// - /// Page that can be used for settings. - /// - public abstract class PageWebAppSetting : PageWebApp, IPageSetting - { - /// - /// The settings page icon. - /// - public PropertyIcon Icon { get; set; } - - /// - /// Returns the menu by listing settings pages. - /// - public ControlNavigation SettingMenu { get; } = new ControlNavigation("settingmenu") - { - Layout = TypeLayoutTab.Pill, - Orientation = TypeOrientationTab.Vertical, - GridColumn = new PropertyGrid(TypeDevice.Medium, 2) - }; - - /// - /// Returns the tab control by listing settings pages. - /// - public ControlNavigation SettingTab = new ControlNavigation("settingtab") - { - Layout = TypeLayoutTab.Tab, - Orientation = TypeOrientationTab.Horizontal - }; - - /// - /// Initialization - /// - /// The context of the resource. - public override void Initialization(IResourceContext context) - { - base.Initialization(context); - } - - /// - /// Processing of the setting page. - /// - /// The context for rendering the page. - public override void Process(RenderContextWebApp context) - { - SettingMenu.Items.Clear(); - SettingTab.Items.Clear(); - - var settinPageManager = ComponentManager.GetComponent(); - var searchResult = settinPageManager?.FindPage(ApplicationContext, ModuleContext, context.Page?.ResourceContext.ResourceId); - if (searchResult != null) - { - var contexts = settinPageManager.GetContexts(ApplicationContext); - var section = settinPageManager.GetSections(ApplicationContext, searchResult?.Context); - - // setting menu - AddSettingMenu(section, SettingSection.Preferences, SettingMenu, context); - AddSettingMenu(section, SettingSection.Primary, SettingMenu, context); - AddSettingMenu(section, SettingSection.Secondary, SettingMenu, context); - - // setting tab - foreach (var settingContext in contexts - .SelectMany(x => x) - .DistinctBy(x => x.Key) - .Select(x => new { Name = x.Key, ContextName = x.Key, Sections = x.Value }) - .Where(x => x.Name != "*").OrderBy(x => x.Name)) - { - var firstPage = settingContext.Sections.FindFirstPage(); - - if (firstPage != null) - { - SettingTab.Items.Add(new ControlNavigationItemLink() - { - Uri = GetResourceContext(firstPage?.Item)?.Uri, - Text = settingContext.Name, - Active = searchResult.Context == settingContext.ContextName ? TypeActive.Active : TypeActive.None, - }); - } - } - } - - if (SettingMenu.Items.Count > 1) - { - context.VisualTree.Sidebar.Primary.Add(SettingMenu); - } - - if (SettingTab.Items.Count > 1) - { - context.VisualTree.Prologue.Content.Add(SettingTab); - } - - context.VisualTree.Breadcrumb.Prefix = "webexpress.webapp:setting.label"; - context.VisualTree.Breadcrumb.TakeLast = 1; - - base.Process(context); - } - - /// - /// Inserts the links of the settings pages. - /// - /// The sections. - /// The selected section. - /// The section to be inserted. - /// The context for rendering the page. - private void AddSettingMenu(IEnumerable sections, SettingSection section, ControlNavigation control, RenderContextWebApp context) - { - var groups = sections - .Select(x => x.GetGroup(section)) - .Where(x => x != null) - .ToList(); - - if (groups == null) - { - return; - } - - foreach (var group in groups - .SelectMany(x => x) - .Select(x => new { Name = x.Key, Pages = x.Value }) - .OrderBy(x => x.Name)) - { - var pages = group.Pages - .Select(x => new { Item = x, ResourceContext = GetResourceContext(x) }) - .Where(x => x.ResourceContext != null) - .Where(x => !x.Item.Hide && (!x.ResourceContext.Conditions.Any() || x.ResourceContext.Conditions.All(y => y.Fulfillment(context.Request)))); - - if (pages.Any()) - { - control.Items.Add(new ControlNavigationItemHeader() { Text = group.Name }); - } - - foreach (var page in pages) - { - control.Items.Add(new ControlNavigationItemLink() - { - Text = page.ResourceContext?.ResourceTitle, - Icon = page.Item.Icon, - Uri = page?.ResourceContext.Uri, - Active = page.Item.Id.Equals(ResourceContext.ResourceId, System.StringComparison.OrdinalIgnoreCase) ? TypeActive.Active : TypeActive.None, - NoWrap = true - }); - } - } - } - - /// - /// Returns the resource context of a status page. - /// - /// The meta information of the status page. - /// The resource context or null. - private IResourceContext GetResourceContext(SettingPageDictionaryItem item) - { - var resourceManager = ComponentManager.ResourceManager; - - return resourceManager.GetResorces(ApplicationContext?.ApplicationId, item.ModuleId, item.ResourceId); - } - } -} +//using System.Collections.Generic; +//using System.Linq; +//using WebExpress.WebApp.WebPage; +//using WebExpress.WebCore.WebComponent; +//using WebExpress.WebCore.WebResource; +//using WebExpress.WebUI.SettingPage; +//using WebExpress.WebUI.WebAttribute; +//using WebExpress.WebUI.WebControl; +//using WebExpress.WebUI.WebSettingPage; + +//namespace WebExpress.WebApp.WebSettingPage +//{ +// /// +// /// Page that can be used for settings. +// /// +// public abstract class PageWebAppSetting : PageWebApp, IPageSetting +// { +// /// +// /// The settings page icon. +// /// +// public PropertyIcon Icon { get; set; } + +// /// +// /// Returns the menu by listing settings pages. +// /// +// public ControlNavigation SettingMenu { get; } = new ControlNavigation("settingmenu") +// { +// Layout = TypeLayoutTab.Pill, +// Orientation = TypeOrientationTab.Vertical, +// GridColumn = new PropertyGrid(TypeDevice.Medium, 2) +// }; + +// /// +// /// Returns the tab control by listing settings pages. +// /// +// public ControlNavigation SettingTab = new ControlNavigation("settingtab") +// { +// Layout = TypeLayoutTab.Tab, +// Orientation = TypeOrientationTab.Horizontal +// }; + +// /// +// /// Initialization +// /// +// /// The context of the resource. +// public override void Initialization(IResourceContext context) +// { +// base.Initialization(context); +// } + +// /// +// /// Processing of the setting page. +// /// +// /// The context for rendering the page. +// public override void Process(RenderContextWebApp context) +// { +// SettingMenu.Items.Clear(); +// SettingTab.Items.Clear(); + +// var settinPageManager = ComponentManager.GetComponent(); +// var searchResult = settinPageManager?.FindPage(ApplicationContext, ModuleContext, context.Page?.ResourceContext.ResourceId); +// if (searchResult != null) +// { +// var contexts = settinPageManager.GetContexts(ApplicationContext); +// var section = settinPageManager.GetSections(ApplicationContext, searchResult?.Context); + +// // setting menu +// AddSettingMenu(section, SettingSection.Preferences, SettingMenu, context); +// AddSettingMenu(section, SettingSection.Primary, SettingMenu, context); +// AddSettingMenu(section, SettingSection.Secondary, SettingMenu, context); + +// // setting tab +// foreach (var settingContext in contexts +// .SelectMany(x => x) +// .DistinctBy(x => x.Key) +// .Select(x => new { Name = x.Key, ContextName = x.Key, Sections = x.Value }) +// .Where(x => x.Name != "*").OrderBy(x => x.Name)) +// { +// var firstPage = settingContext.Sections.FindFirstPage(); + +// if (firstPage != null) +// { +// SettingTab.Items.Add(new ControlNavigationItemLink() +// { +// Uri = GetResourceContext(firstPage?.Item)?.Uri, +// Text = settingContext.Name, +// Active = searchResult.Context == settingContext.ContextName ? TypeActive.Active : TypeActive.None, +// }); +// } +// } +// } + +// if (SettingMenu.Items.Count > 1) +// { +// context.VisualTree.Sidebar.Primary.Add(SettingMenu); +// } + +// if (SettingTab.Items.Count > 1) +// { +// context.VisualTree.Prologue.Content.Add(SettingTab); +// } + +// context.VisualTree.Breadcrumb.Prefix = "webexpress.webapp:setting.label"; +// context.VisualTree.Breadcrumb.TakeLast = 1; + +// base.Process(context); +// } + +// /// +// /// Inserts the links of the settings pages. +// /// +// /// The sections. +// /// The selected section. +// /// The section to be inserted. +// /// The context for rendering the page. +// private void AddSettingMenu(IEnumerable sections, SettingSection section, ControlNavigation control, RenderContextWebApp context) +// { +// var groups = sections +// .Select(x => x.GetGroup(section)) +// .Where(x => x != null) +// .ToList(); + +// if (groups == null) +// { +// return; +// } + +// foreach (var group in groups +// .SelectMany(x => x) +// .Select(x => new { Name = x.Key, Pages = x.Value }) +// .OrderBy(x => x.Name)) +// { +// var pages = group.Pages +// .Select(x => new { Item = x, ResourceContext = GetResourceContext(x) }) +// .Where(x => x.ResourceContext != null) +// .Where(x => !x.Item.Hide && (!x.ResourceContext.Conditions.Any() || x.ResourceContext.Conditions.All(y => y.Fulfillment(context.Request)))); + +// if (pages.Any()) +// { +// control.Items.Add(new ControlNavigationItemHeader() { Text = group.Name }); +// } + +// foreach (var page in pages) +// { +// control.Items.Add(new ControlNavigationItemLink() +// { +// Text = page.ResourceContext?.ResourceTitle, +// Icon = page.Item.Icon, +// Uri = page?.ResourceContext.Uri, +// Active = page.Item.Id.Equals(ResourceContext.ResourceId, System.StringComparison.OrdinalIgnoreCase) ? TypeActive.Active : TypeActive.None, +// NoWrap = true +// }); +// } +// } +// } + +// /// +// /// Returns the resource context of a status page. +// /// +// /// The meta information of the status page. +// /// The resource context or null. +// private IResourceContext GetResourceContext(SettingPageDictionaryItem item) +// { +// var resourceManager = ComponentManager.ResourceManager; + +// return resourceManager.GetResorces(ApplicationContext?.ApplicationId, item.ModuleId, item.ResourceId); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingForm.cs b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingForm.cs index ab21498..a1a90b1 100644 --- a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingForm.cs +++ b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingForm.cs @@ -1,135 +1,135 @@ -using System; -using WebExpress.WebApp.WebNotificaation; -using WebExpress.WebApp.WebSettingPage; -using WebExpress.WebCore.Internationalization; -using WebExpress.WebCore.WebComponent; -using WebExpress.WebCore.WebResource; -using WebExpress.WebUI.WebControl; +//using System; +//using WebExpress.WebApp.WebNotificaation; +//using WebExpress.WebApp.WebSettingPage; +//using WebExpress.WebCore.Internationalization; +//using WebExpress.WebCore.WebComponent; +//using WebExpress.WebCore.WebResource; +//using WebExpress.WebUI.WebControl; -namespace WebExpress.WebApp.WebPage -{ - /// - /// A form based page. - /// - public abstract class PageWebAppSettingForm : PageWebAppSetting where T : ControlForm, new() - { - /// - /// Returns the form. - /// - protected T Form { get; private set; } +//namespace WebExpress.WebApp.WebPage +//{ +// /// +// /// A form based page. +// /// +// public abstract class PageWebAppSettingForm : PageWebAppSetting where T : ControlForm, new() +// { +// /// +// /// Returns the form. +// /// +// protected T Form { get; private set; } - /// - /// Initializes a new instance of the class. - /// - public PageWebAppSettingForm() - { - Form = new T(); - } +// /// +// /// Initializes a new instance of the class. +// /// +// public PageWebAppSettingForm() +// { +// Form = new T(); +// } - /// - /// Initializes a new instance of the class. - /// - /// The page id. - public PageWebAppSettingForm(string id) - { - Form = Activator.CreateInstance(typeof(T), id) as T; - } +// /// +// /// Initializes a new instance of the class. +// /// +// /// The page id. +// public PageWebAppSettingForm(string id) +// { +// Form = Activator.CreateInstance(typeof(T), id) as T; +// } - /// - /// Initialization - /// - /// The context. - public override void Initialization(IResourceContext context) - { - base.Initialization(context); +// /// +// /// Initialization +// /// +// /// The context. +// public override void Initialization(IResourceContext context) +// { +// base.Initialization(context); - Form.InitializeForm += OnInitializeForm; - Form.FillForm += OnFillForm; - Form.ProcessForm += OnProcessForm; - } +// Form.InitializeForm += OnInitializeForm; +// Form.FillForm += OnFillForm; +// Form.ProcessForm += OnProcessForm; +// } - /// - /// Invoked when the form is initialized. - /// - /// The trigger of the event. - /// The event argument. - protected virtual void OnInitializeForm(object sender, FormEventArgs e) - { - } +// /// +// /// Invoked when the form is initialized. +// /// +// /// The trigger of the event. +// /// The event argument. +// protected virtual void OnInitializeForm(object sender, FormEventArgs e) +// { +// } - /// - /// Invoked when the form is about to be populated. - /// - /// The trigger of the event. - /// The event argument. - protected virtual void OnFillForm(object sender, FormEventArgs e) - { - } +// /// +// /// Invoked when the form is about to be populated. +// /// +// /// The trigger of the event. +// /// The event argument. +// protected virtual void OnFillForm(object sender, FormEventArgs e) +// { +// } - /// - /// Fired when the form is about to be processed. - /// - /// The trigger of the event. - /// The event argument./param> - protected virtual void OnProcessForm(object sender, FormEventArgs e) - { - } +// /// +// /// Fired when the form is about to be processed. +// /// +// /// The trigger of the event. +// /// The event argument./param> +// protected virtual void OnProcessForm(object sender, FormEventArgs e) +// { +// } - /// - /// Returns the redirect uri. - /// - /// The redirect uri. - protected string SetRedirectUri() - { - return Form.RedirectUri; - } +// /// +// /// Returns the redirect uri. +// /// +// /// The redirect uri. +// protected string SetRedirectUri() +// { +// return Form.RedirectUri; +// } - /// - /// Sets the redirect uri. - /// - /// The redirect uri. - protected void SetRedirectUri(string redirectUri) - { - Form.RedirectUri = redirectUri; - } +// /// +// /// Sets the redirect uri. +// /// +// /// The redirect uri. +// protected void SetRedirectUri(string redirectUri) +// { +// Form.RedirectUri = redirectUri; +// } - /// - /// Creates an notification. - /// - /// The context. - /// The notification tiltle. - /// The notification message. - /// The notification color. - /// The image. - protected void AddNotification(RenderContextForm context, string title, string text, PropertyColorText color, string image) - { - ComponentManager.GetComponent()?.AddNotification - ( - request: context.Request, - message: string.Format - ( - InternationalizationManager.I18N(Culture, title), - new ControlText() - { - Text = text, - TextColor = color, - Format = TypeFormatText.Span - }.Render(context).ToString().Trim() - ), - icon: image, - durability: 10000 - ); - } +// /// +// /// Creates an notification. +// /// +// /// The context. +// /// The notification tiltle. +// /// The notification message. +// /// The notification color. +// /// The image. +// protected void AddNotification(RenderContextForm context, string title, string text, PropertyColorText color, string image) +// { +// ComponentManager.GetComponent()?.AddNotification +// ( +// request: context.Request, +// message: string.Format +// ( +// InternationalizationManager.I18N(Culture, title), +// new ControlText() +// { +// Text = text, +// TextColor = color, +// Format = TypeFormatText.Span +// }.Render(context).ToString().Trim() +// ), +// icon: image, +// durability: 10000 +// ); +// } - /// - /// Processing of the resource. - /// - /// The context for rendering the page. - public override void Process(RenderContextWebApp context) - { - base.Process(context); +// /// +// /// Processing of the resource. +// /// +// /// The context for rendering the page. +// public override void Process(RenderContextWebApp context) +// { +// base.Process(context); - context.VisualTree.Content.Primary.Add(Form); - } - } -} +// context.VisualTree.Content.Primary.Add(Form); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingFormConfirm.cs b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingFormConfirm.cs index 15adfe4..4011f48 100644 --- a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingFormConfirm.cs +++ b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingFormConfirm.cs @@ -1,77 +1,77 @@ -using WebExpress.WebApp.WebControl; -using WebExpress.WebCore.WebResource; -using WebExpress.WebUI.WebControl; +//using WebExpress.WebApp.WebControl; +//using WebExpress.WebCore.WebResource; +//using WebExpress.WebUI.WebControl; -namespace WebExpress.WebApp.WebPage -{ - /// - /// A form based page. - /// - public abstract class PageWebAppSettingFormConfirm : PageWebAppSettingForm where T : ControlFormConfirm, new() - { - /// - /// Initializes a new instance of the class. - /// - /// The page id. - public PageWebAppSettingFormConfirm() - { - } +//namespace WebExpress.WebApp.WebPage +//{ +// /// +// /// A form based page. +// /// +// public abstract class PageWebAppSettingFormConfirm : PageWebAppSettingForm where T : ControlFormConfirm, new() +// { +// /// +// /// Initializes a new instance of the class. +// /// +// /// The page id. +// public PageWebAppSettingFormConfirm() +// { +// } - /// - /// Initializes a new instance of the class. - /// - /// The page id. - public PageWebAppSettingFormConfirm(string id) - : base(id) - { - } +// /// +// /// Initializes a new instance of the class. +// /// +// /// The page id. +// public PageWebAppSettingFormConfirm(string id) +// : base(id) +// { +// } - /// - /// Initialization - /// - /// The context. - public override void Initialization(IResourceContext context) - { - base.Initialization(context); +// /// +// /// Initialization +// /// +// /// The context. +// public override void Initialization(IResourceContext context) +// { +// base.Initialization(context); - Form.Confirm += OnConfirmForm; - } +// Form.Confirm += OnConfirmForm; +// } - /// - /// Triggered when the form is confirmed. - /// - /// The trigger of the event. - /// The event argument./param> - protected virtual void OnConfirmForm(object sender, FormEventArgs e) - { - } +// /// +// /// Triggered when the form is confirmed. +// /// +// /// The trigger of the event. +// /// The event argument./param> +// protected virtual void OnConfirmForm(object sender, FormEventArgs e) +// { +// } - /// - /// Returns the description. - /// - /// The description. - protected string SetDescription() - { - return Form.Content.Text; - } +// /// +// /// Returns the description. +// /// +// /// The description. +// protected string SetDescription() +// { +// return Form.Content.Text; +// } - /// - /// Sets the description. - /// - /// The description. - protected void SetDescription(string description) - { - Form.Content.Text = description; - } +// /// +// /// Sets the description. +// /// +// /// The description. +// protected void SetDescription(string description) +// { +// Form.Content.Text = description; +// } - /// - /// Processing of the resource. - /// - /// The context for rendering the page. - public override void Process(RenderContextWebApp context) - { - base.Process(context); - } - } -} +// /// +// /// Processing of the resource. +// /// +// /// The context for rendering the page. +// public override void Process(RenderContextWebApp context) +// { +// base.Process(context); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingLog.cs b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingLog.cs index a935e80..0452c1b 100644 --- a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingLog.cs +++ b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingLog.cs @@ -1,177 +1,177 @@ -using System; -using System.IO; -using System.Linq; -using WebExpress.Internationalization; -using WebExpress.WebApp.WebControl; -using WebExpress.WebApp.WebPage; -using WebExpress.WebApp.WebScope; -using WebExpress.WebCore.Internationalization; -using WebExpress.WebCore.WebAttribute; -using WebExpress.WebCore.WebLog; -using WebExpress.WebCore.WebMessage; -using WebExpress.WebCore.WebScope; -using WebExpress.WebUI.WebAttribute; -using WebExpress.WebUI.WebControl; - -namespace WebExpress.WebApp.WebSettingPage -{ - /// - /// Logging settings page. - /// - [Title("webexpress.webapp:setting.titel.log.label")] - [Segment("log", "webexpress.webapp:setting.titel.log.label")] - [ContextPath("/setting")] - [SettingSection(SettingSection.Secondary)] - [SettingIcon(TypeIcon.FileMedicalAlt)] - [SettingGroup("webexpress.webapp:setting.group.system.label")] - [SettingContext("webexpress.webapp:setting.tab.general.label")] - [Module] - [Scope] - [Optional] - public sealed class PageWebAppSettingLog : PageWebAppSetting, IScope - { - /// - /// Returns or sets the Uri to download the lot file. Null if no log file downlod is to be performed. - /// - public string DownloadUri { get; set; } - - /// - /// Initializes a new instance of the class. - /// - public PageWebAppSettingLog() - { - Icon = new PropertyIcon(TypeIcon.FileMedicalAlt); - } - - /// - /// Pre processing of the request. - /// - /// The request. - public override void PreProcess(Request request) - { - DownloadUri = request.Uri.Append("download"); - - base.PreProcess(request); - } - - /// - /// Processing of the request. - /// - /// The context for rendering the page. - public override void Process(RenderContextWebApp context) - { - base.Process(context); - - var file = new FileInfo(context.PluginContext.Host.Log.Filename); - var fileSize = string.Format(new FileSizeFormatProvider() { Culture = Culture }, "{0:fs}", file.Exists ? file.Length : 0); - - var deleteForm = new ControlModalFormConfirmDelete("delte_log") - { - Header = this.I18N("webexpress.webapp", "setting.logfile.delete.header"), - Content = new ControlFormItemStaticText() { Text = this.I18N("webexpress.webapp", "setting.logfile.delete.description") } - }; - - deleteForm.Confirm += (s, e) => - { - File.Delete(context.PluginContext.Host.Log.Filename); - }; - - var switchOnForm = new ControlModalFormConfirm("swichon_log") - { - Header = this.I18N("webexpress.webapp", "setting.logfile.switchon.header"), - Content = new ControlFormItemStaticText() { Text = this.I18N("webexpress.webapp", "setting.logfile.switchon.description") }, - SubmitButtonIcon = new PropertyIcon(TypeIcon.PowerOff), - SubmitButtonColor = new PropertyColorButton(TypeColorButton.Success), - SubmitButtonLabel = this.I18N("webexpress.webapp", "setting.logfile.switchon.label") - }; - - switchOnForm.Confirm += (s, e) => - { - context.PluginContext.Host.Log.LogMode = LogMode.Override; - context.PluginContext.Host.Log.Info(this.I18N("webexpress.webapp", "setting.logfile.switchon.success")); - }; - - var info = new ControlTable() { Striped = false }; - info.AddRow - ( - new ControlText() - { - Text = this.I18N("webexpress.webapp", "setting.logfile.path") - }, - new ControlText() - { - Text = context.PluginContext.Host.Log.Filename, - Format = TypeFormatText.Code - }, - DownloadUri != null && file.Exists ? new ControlButtonLink() - { - Text = this.I18N("webexpress.webapp", "setting.logfile.download"), - Icon = new PropertyIcon(TypeIcon.Download), - BackgroundColor = new PropertyColorButton(TypeColorButton.Primary), - Uri = DownloadUri - } : new ControlPanel() - ); - - info.AddRow - ( - new ControlText() - { - Text = this.I18N("webexpress.webapp", "setting.logfile.size") - }, - new ControlText() - { - Text = file.Exists ? fileSize : "n.a.", - Format = TypeFormatText.Code - }, - file.Exists ? new ControlButton() - { - Text = this.I18N("webexpress.webapp", "setting.logfile.delete.label"), - Modal = new PropertyModal(TypeModal.Modal, deleteForm), - Icon = new PropertyIcon(TypeIcon.TrashAlt), - BackgroundColor = new PropertyColorButton(TypeColorButton.Danger) - } : new ControlPanel() - ); - - info.AddRow - ( - new ControlText() - { - Text = this.I18N("webexpress.webapp", "setting.logfile.modus") - }, - new ControlText() - { - Text = context.PluginContext.Host.Log.LogMode.ToString(), - Format = TypeFormatText.Code - }, - context.PluginContext.Host.Log.LogMode == LogMode.Off ? new ControlButton() - { - Text = this.I18N("webexpress.webapp", "setting.logfile.switchon.label"), - Modal = new PropertyModal(TypeModal.Modal, switchOnForm), - Icon = new PropertyIcon(TypeIcon.PowerOff), - BackgroundColor = new PropertyColorButton(TypeColorButton.Success) - } : new ControlPanel() - ); - - context.VisualTree.Content.Primary.Add(new ControlText() { Text = this.I18N("webexpress.webapp", "setting.logfile.label"), TextColor = new PropertyColorText(TypeColorText.Info), Margin = new PropertySpacingMargin(PropertySpacing.Space.Two) }); - context.VisualTree.Content.Primary.Add(info); - - if (file.Exists) - { - var content = File.ReadLines(context.PluginContext.Host.Log.Filename).TakeLast(100); - - context.VisualTree.Content.Primary.Add(new ControlText() - { - Text = this.I18N("webexpress.webapp", "setting.logfile.extract"), - Format = TypeFormatText.H3 - }); - - context.VisualTree.Content.Primary.Add(new ControlText() - { - Text = string.Join("
", content.Reverse()), - Format = TypeFormatText.Code - }); - } - } - } -} +//using System; +//using System.IO; +//using System.Linq; +//using WebExpress.Internationalization; +//using WebExpress.WebApp.WebControl; +//using WebExpress.WebApp.WebPage; +//using WebExpress.WebApp.WebScope; +//using WebExpress.WebCore.Internationalization; +//using WebExpress.WebCore.WebAttribute; +//using WebExpress.WebCore.WebLog; +//using WebExpress.WebCore.WebMessage; +//using WebExpress.WebCore.WebScope; +//using WebExpress.WebUI.WebAttribute; +//using WebExpress.WebUI.WebControl; + +//namespace WebExpress.WebApp.WebSettingPage +//{ +// /// +// /// Logging settings page. +// /// +// [Title("webexpress.webapp:setting.titel.log.label")] +// [Segment("log", "webexpress.webapp:setting.titel.log.label")] +// [ContextPath("/setting")] +// [SettingSection(SettingSection.Secondary)] +// [SettingIcon(TypeIcon.FileMedicalAlt)] +// [SettingGroup("webexpress.webapp:setting.group.system.label")] +// [SettingContext("webexpress.webapp:setting.tab.general.label")] +// [Module] +// [Scope] +// [Optional] +// public sealed class PageWebAppSettingLog : PageWebAppSetting, IScope +// { +// /// +// /// Returns or sets the Uri to download the lot file. Null if no log file downlod is to be performed. +// /// +// public string DownloadUri { get; set; } + +// /// +// /// Initializes a new instance of the class. +// /// +// public PageWebAppSettingLog() +// { +// Icon = new PropertyIcon(TypeIcon.FileMedicalAlt); +// } + +// /// +// /// Pre processing of the request. +// /// +// /// The request. +// public override void PreProcess(Request request) +// { +// DownloadUri = request.Uri.Append("download"); + +// base.PreProcess(request); +// } + +// /// +// /// Processing of the request. +// /// +// /// The context for rendering the page. +// public override void Process(RenderContextWebApp context) +// { +// base.Process(context); + +// var file = new FileInfo(context.PluginContext.Host.Log.Filename); +// var fileSize = string.Format(new FileSizeFormatProvider() { Culture = Culture }, "{0:fs}", file.Exists ? file.Length : 0); + +// var deleteForm = new ControlModalFormConfirmDelete("delte_log") +// { +// Header = this.I18N("webexpress.webapp", "setting.logfile.delete.header"), +// Content = new ControlFormItemStaticText() { Text = this.I18N("webexpress.webapp", "setting.logfile.delete.description") } +// }; + +// deleteForm.Confirm += (s, e) => +// { +// File.Delete(context.PluginContext.Host.Log.Filename); +// }; + +// var switchOnForm = new ControlModalFormConfirm("swichon_log") +// { +// Header = this.I18N("webexpress.webapp", "setting.logfile.switchon.header"), +// Content = new ControlFormItemStaticText() { Text = this.I18N("webexpress.webapp", "setting.logfile.switchon.description") }, +// SubmitButtonIcon = new PropertyIcon(TypeIcon.PowerOff), +// SubmitButtonColor = new PropertyColorButton(TypeColorButton.Success), +// SubmitButtonLabel = this.I18N("webexpress.webapp", "setting.logfile.switchon.label") +// }; + +// switchOnForm.Confirm += (s, e) => +// { +// context.PluginContext.Host.Log.LogMode = LogMode.Override; +// context.PluginContext.Host.Log.Info(this.I18N("webexpress.webapp", "setting.logfile.switchon.success")); +// }; + +// var info = new ControlTable() { Striped = false }; +// info.AddRow +// ( +// new ControlText() +// { +// Text = this.I18N("webexpress.webapp", "setting.logfile.path") +// }, +// new ControlText() +// { +// Text = context.PluginContext.Host.Log.Filename, +// Format = TypeFormatText.Code +// }, +// DownloadUri != null && file.Exists ? new ControlButtonLink() +// { +// Text = this.I18N("webexpress.webapp", "setting.logfile.download"), +// Icon = new PropertyIcon(TypeIcon.Download), +// BackgroundColor = new PropertyColorButton(TypeColorButton.Primary), +// Uri = DownloadUri +// } : new ControlPanel() +// ); + +// info.AddRow +// ( +// new ControlText() +// { +// Text = this.I18N("webexpress.webapp", "setting.logfile.size") +// }, +// new ControlText() +// { +// Text = file.Exists ? fileSize : "n.a.", +// Format = TypeFormatText.Code +// }, +// file.Exists ? new ControlButton() +// { +// Text = this.I18N("webexpress.webapp", "setting.logfile.delete.label"), +// Modal = new PropertyModal(TypeModal.Modal, deleteForm), +// Icon = new PropertyIcon(TypeIcon.TrashAlt), +// BackgroundColor = new PropertyColorButton(TypeColorButton.Danger) +// } : new ControlPanel() +// ); + +// info.AddRow +// ( +// new ControlText() +// { +// Text = this.I18N("webexpress.webapp", "setting.logfile.modus") +// }, +// new ControlText() +// { +// Text = context.PluginContext.Host.Log.LogMode.ToString(), +// Format = TypeFormatText.Code +// }, +// context.PluginContext.Host.Log.LogMode == LogMode.Off ? new ControlButton() +// { +// Text = this.I18N("webexpress.webapp", "setting.logfile.switchon.label"), +// Modal = new PropertyModal(TypeModal.Modal, switchOnForm), +// Icon = new PropertyIcon(TypeIcon.PowerOff), +// BackgroundColor = new PropertyColorButton(TypeColorButton.Success) +// } : new ControlPanel() +// ); + +// context.VisualTree.Content.Primary.Add(new ControlText() { Text = this.I18N("webexpress.webapp", "setting.logfile.label"), TextColor = new PropertyColorText(TypeColorText.Info), Margin = new PropertySpacingMargin(PropertySpacing.Space.Two) }); +// context.VisualTree.Content.Primary.Add(info); + +// if (file.Exists) +// { +// var content = File.ReadLines(context.PluginContext.Host.Log.Filename).TakeLast(100); + +// context.VisualTree.Content.Primary.Add(new ControlText() +// { +// Text = this.I18N("webexpress.webapp", "setting.logfile.extract"), +// Format = TypeFormatText.H3 +// }); + +// context.VisualTree.Content.Primary.Add(new ControlText() +// { +// Text = string.Join("
", content.Reverse()), +// Format = TypeFormatText.Code +// }); +// } +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingLogDownload.cs b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingLogDownload.cs index f6159e2..b770a86 100644 --- a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingLogDownload.cs +++ b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingLogDownload.cs @@ -1,49 +1,49 @@ -using System.IO; -using WebExpress.WebCore.WebAttribute; -using WebExpress.WebCore.WebMessage; -using WebExpress.WebCore.WebResource; -using WebExpress.WebApp.WebScope; +//using System.IO; +//using WebExpress.WebCore.WebAttribute; +//using WebExpress.WebCore.WebMessage; +//using WebExpress.WebCore.WebResource; +//using WebExpress.WebApp.WebScope; -namespace WebExpress.WebApp.WebSettingPage -{ - /// - /// Download the log file. - /// - [Segment("download", "")] - [ContextPath("/")] - [Parent] - [Module] - [Scope] - [Optional] - public sealed class PageWebAppSettingLogDownload : ResourceBinary - { - /// - /// Initializes a new instance of the class. - /// - public PageWebAppSettingLogDownload() - { - } +//namespace WebExpress.WebApp.WebSettingPage +//{ +// /// +// /// Download the log file. +// /// +// [Segment("download", "")] +// [ContextPath("/")] +// [Parent] +// [Module] +// [Scope] +// [Optional] +// public sealed class PageWebAppSettingLogDownload : ResourceBinary +// { +// /// +// /// Initializes a new instance of the class. +// /// +// public PageWebAppSettingLogDownload() +// { +// } - /// - /// Processing of the resource. - /// - /// The request. - /// The response. - public override Response Process(Request request) - { - if (!File.Exists(request.ServerContext.Log.Filename)) - { - return new ResponseNotFound(); - } +// /// +// /// Processing of the resource. +// /// +// /// The request. +// /// The response. +// public override Response Process(Request request) +// { +// if (!File.Exists(request.ServerContext.Log.Filename)) +// { +// return new ResponseNotFound(); +// } - Data = File.ReadAllBytes(request.ServerContext.Log.Filename); +// Data = File.ReadAllBytes(request.ServerContext.Log.Filename); - var response = base.Process(request); - response.Header.CacheControl = "no-cache"; - response.Header.ContentType = "text/plain"; +// var response = base.Process(request); +// response.Header.CacheControl = "no-cache"; +// response.Header.ContentType = "text/plain"; - return response; - } - } -} +// return response; +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingPlugin.cs b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingPlugin.cs index 8163902..056e9ae 100644 --- a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingPlugin.cs +++ b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingPlugin.cs @@ -1,268 +1,268 @@ -using System; -using System.Linq; -using WebExpress.WebCore.Internationalization; -using WebExpress.WebCore.WebAttribute; -using WebExpress.WebCore.WebComponent; -using WebExpress.WebCore.WebMessage; -using WebExpress.WebCore.WebPage; -using WebExpress.WebCore.WebResource; -using WebExpress.WebCore.WebScope; -using WebExpress.WebCore.WebTask; -using WebExpress.WebApp.WebApiControl; -using WebExpress.WebApp.WebControl; -using WebExpress.WebApp.WebPage; -using WebExpress.WebApp.WebScope; -using WebExpress.WebUI.WebAttribute; -using WebExpress.WebUI.WebControl; +//using System; +//using System.Linq; +//using WebExpress.WebCore.Internationalization; +//using WebExpress.WebCore.WebAttribute; +//using WebExpress.WebCore.WebComponent; +//using WebExpress.WebCore.WebMessage; +//using WebExpress.WebCore.WebPage; +//using WebExpress.WebCore.WebResource; +//using WebExpress.WebCore.WebScope; +//using WebExpress.WebCore.WebTask; +//using WebExpress.WebApp.WebApiControl; +//using WebExpress.WebApp.WebControl; +//using WebExpress.WebApp.WebPage; +//using WebExpress.WebApp.WebScope; +//using WebExpress.WebUI.WebAttribute; +//using WebExpress.WebUI.WebControl; -namespace WebExpress.WebApp.WebSettingPage -{ - /// - /// Settings page with information about the active plugins. - /// - [Title("webexpress.webapp:setting.titel.plugin.label")] - [Segment("plugin", "webexpress.webapp:setting.titel.plugin.label")] - [ContextPath("/Setting")] - [SettingSection(SettingSection.Secondary)] - [SettingIcon(TypeIcon.PuzzlePiece)] - [SettingGroup("webexpress.webapp:setting.group.system.label")] - [SettingContext("webexpress.webapp:setting.tab.general.label")] - [Module] - [Scope] - [Optional] - public sealed class PageWebAppSettingPlugin : PageWebAppSetting, IScope - { - /// - /// The id of the web task for importing a plugin. - /// - private const string TaskId = "webexpress-webapp-plugin-upload"; +//namespace WebExpress.WebApp.WebSettingPage +//{ +// /// +// /// Settings page with information about the active plugins. +// /// +// [Title("webexpress.webapp:setting.titel.plugin.label")] +// [Segment("plugin", "webexpress.webapp:setting.titel.plugin.label")] +// [ContextPath("/Setting")] +// [SettingSection(SettingSection.Secondary)] +// [SettingIcon(TypeIcon.PuzzlePiece)] +// [SettingGroup("webexpress.webapp:setting.group.system.label")] +// [SettingContext("webexpress.webapp:setting.tab.general.label")] +// [Module] +// [Scope] +// [Optional] +// public sealed class PageWebAppSettingPlugin : PageWebAppSetting, IScope +// { +// /// +// /// The id of the web task for importing a plugin. +// /// +// private const string TaskId = "webexpress-webapp-plugin-upload"; - /// - /// Returns the label control. - /// - private ControlText Label { get; } = new ControlText() - { - Text = "webexpress.webapp:setting.plugin.label", - Margin = new PropertySpacingMargin(PropertySpacing.Space.Two), - TextColor = new PropertyColorText(TypeColorText.Info) - }; +// /// +// /// Returns the label control. +// /// +// private ControlText Label { get; } = new ControlText() +// { +// Text = "webexpress.webapp:setting.plugin.label", +// Margin = new PropertySpacingMargin(PropertySpacing.Space.Two), +// TextColor = new PropertyColorText(TypeColorText.Info) +// }; - /// - /// Retruns the help text control. - /// - private ControlText Description { get; } = new ControlText() - { - Text = "webexpress.webapp:setting.plugin.description", - Margin = new PropertySpacingMargin(PropertySpacing.Space.Two) - }; +// /// +// /// Retruns the help text control. +// /// +// private ControlText Description { get; } = new ControlText() +// { +// Text = "webexpress.webapp:setting.plugin.description", +// Margin = new PropertySpacingMargin(PropertySpacing.Space.Two) +// }; - /// - /// Returns the upload button for uploading and initializing a plugin. - /// - private ControlButton DownloadButton { get; } = new ControlButton() - { - Text = "webexpress.webapp:setting.plugin.upload.label", - Margin = new PropertySpacingMargin(PropertySpacing.Space.Two), - BackgroundColor = new PropertyColorButton(TypeColorButton.Primary), - Icon = new PropertyIcon(TypeIcon.Upload), - OnClick = new PropertyOnClick("$('#modal_plugin_upload').modal('show');"), - Active = TypeActive.Disabled - }; +// /// +// /// Returns the upload button for uploading and initializing a plugin. +// /// +// private ControlButton DownloadButton { get; } = new ControlButton() +// { +// Text = "webexpress.webapp:setting.plugin.upload.label", +// Margin = new PropertySpacingMargin(PropertySpacing.Space.Two), +// BackgroundColor = new PropertyColorButton(TypeColorButton.Primary), +// Icon = new PropertyIcon(TypeIcon.Upload), +// OnClick = new PropertyOnClick("$('#modal_plugin_upload').modal('show');"), +// Active = TypeActive.Disabled +// }; - /// - /// Form for uploading a plugin. - /// - private ControlModalFormFileUpload ModalUploadForm { get; } = new ControlModalFormFileUpload("plugin_upload") - { - Header = "webexpress.webapp:setting.plugin.upload.header" - }; +// /// +// /// Form for uploading a plugin. +// /// +// private ControlModalFormFileUpload ModalUploadForm { get; } = new ControlModalFormFileUpload("plugin_upload") +// { +// Header = "webexpress.webapp:setting.plugin.upload.header" +// }; - /// - /// Progress control to monitor plugin initialization. - /// - private ControlApiModalProgressTaskState ModalTaskUpdate { get; } = new ControlApiModalProgressTaskState(TaskId) - { - Header = "webexpress.webapp:setting.plugin.upload.header" - }; +// /// +// /// Progress control to monitor plugin initialization. +// /// +// private ControlApiModalProgressTaskState ModalTaskUpdate { get; } = new ControlApiModalProgressTaskState(TaskId) +// { +// Header = "webexpress.webapp:setting.plugin.upload.header" +// }; - /// - /// Initializes a new instance of the class. - /// - public PageWebAppSettingPlugin() - { - Icon = new PropertyIcon(TypeIcon.PuzzlePiece); - } +// /// +// /// Initializes a new instance of the class. +// /// +// public PageWebAppSettingPlugin() +// { +// Icon = new PropertyIcon(TypeIcon.PuzzlePiece); +// } - /// - /// Initialization - /// - /// The context of the resource. - public override void Initialization(IResourceContext context) - { - base.Initialization(context); +// /// +// /// Initialization +// /// +// /// The context of the resource. +// public override void Initialization(IResourceContext context) +// { +// base.Initialization(context); - ModalUploadForm.File.Help = "webexpress.webapp:setting.plugin.upload.description"; - ModalUploadForm.Prologue = new ControlFormItemStaticText() { Text = "webexpress.webapp:setting.plugin.upload.help" }; - ModalUploadForm.File.AcceptFile = new string[] { ".dll" }; - ModalUploadForm.Upload += OnUpload; - } +// ModalUploadForm.File.Help = "webexpress.webapp:setting.plugin.upload.description"; +// ModalUploadForm.Prologue = new ControlFormItemStaticText() { Text = "webexpress.webapp:setting.plugin.upload.help" }; +// ModalUploadForm.File.AcceptFile = new string[] { ".dll" }; +// ModalUploadForm.Upload += OnUpload; +// } - /// - /// Called when an upload is to take place. - /// - /// The trigger. - /// The event argument. - private void OnUpload(object sender, FormUploadEventArgs e) - { - var task = ComponentManager.TaskManager.CreateTask(TaskId, OnTaskProcess, e); - task.Run(); - } +// /// +// /// Called when an upload is to take place. +// /// +// /// The trigger. +// /// The event argument. +// private void OnUpload(object sender, FormUploadEventArgs e) +// { +// var task = ComponentManager.TaskManager.CreateTask(TaskId, OnTaskProcess, e); +// task.Run(); +// } - /// - /// Execution of the WebTask. - /// - /// The trigger. - /// The event argument. - private void OnTaskProcess(object sender, EventArgs e) - { - var task = sender as Task; - var file = (task.Arguments.FirstOrDefault() as FormUploadEventArgs)?.File as ParameterFile; - var context = (task.Arguments.FirstOrDefault() as FormUploadEventArgs)?.Context as RenderContext; +// /// +// /// Execution of the WebTask. +// /// +// /// The trigger. +// /// The event argument. +// private void OnTaskProcess(object sender, EventArgs e) +// { +// var task = sender as Task; +// var file = (task.Arguments.FirstOrDefault() as FormUploadEventArgs)?.File as ParameterFile; +// var context = (task.Arguments.FirstOrDefault() as FormUploadEventArgs)?.Context as RenderContext; - // determine any installed package +// // determine any installed package - //var plugin = ComponentManager.PluginManager.GetPluginByFileName(file.Value); +// //var plugin = ComponentManager.PluginManager.GetPluginByFileName(file.Value); - //if (plugin == null) - //{ - // var host = context.Host; - //} - //else if (Directory.Exists(plugin.Assembly.Location)) - //{ - // // Datei entfernen - // Directory.Delete(plugin.Assembly.Location); - //} +// //if (plugin == null) +// //{ +// // var host = context.Host; +// //} +// //else if (Directory.Exists(plugin.Assembly.Location)) +// //{ +// // // Datei entfernen +// // Directory.Delete(plugin.Assembly.Location); +// //} - //// Plugin aus Rgistrierung entfernen - //PluginManager.Unsubscribe(file.Value); +// //// Plugin aus Rgistrierung entfernen +// //PluginManager.Unsubscribe(file.Value); - //for (int i = 0; i < 100; i++) - //{ - // Thread.Sleep(1000); - // task.Progress = i; - // task.Message = "ABC" + i; - //} - } +// //for (int i = 0; i < 100; i++) +// //{ +// // Thread.Sleep(1000); +// // task.Progress = i; +// // task.Message = "ABC" + i; +// //} +// } - /// - /// Processing of the page - /// - /// The context for rendering the page. - public override void Process(RenderContextWebApp context) - { - base.Process(context); +// /// +// /// Processing of the page +// /// +// /// The context for rendering the page. +// public override void Process(RenderContextWebApp context) +// { +// base.Process(context); - var plugins = new ControlTable() { Striped = false }; - plugins.AddColumn(""); - plugins.AddColumn(this.I18N("webexpress.webapp", "setting.plugin.name.label")); - plugins.AddColumn(this.I18N("webexpress.webapp", "setting.plugin.version.label")); +// var plugins = new ControlTable() { Striped = false }; +// plugins.AddColumn(""); +// plugins.AddColumn(this.I18N("webexpress.webapp", "setting.plugin.name.label")); +// plugins.AddColumn(this.I18N("webexpress.webapp", "setting.plugin.version.label")); - foreach (var application in ComponentManager.ApplicationManager.Applications.Where(x => !x.ApplicationId.StartsWith("webexpress", StringComparison.OrdinalIgnoreCase))) - { - var plugin = application.PluginContext; - var mudules = ComponentManager.ModuleManager.Modules - .Where(x => x.ApplicationContext.ApplicationId.Equals(application.ApplicationId, StringComparison.OrdinalIgnoreCase)) - .ToList(); +// foreach (var application in ComponentManager.ApplicationManager.Applications.Where(x => !x.ApplicationId.StartsWith("webexpress", StringComparison.OrdinalIgnoreCase))) +// { +// var plugin = application.PluginContext; +// var mudules = ComponentManager.ModuleManager.Modules +// .Where(x => x.ApplicationContext.ApplicationId.Equals(application.ApplicationId, StringComparison.OrdinalIgnoreCase)) +// .ToList(); - plugins.AddRow - ( - new ControlImage() { Uri = application.Icon ?? null, Width = 32 }, - new ControlPanel - ( - new ControlLink() - { - Text = this.I18N(plugin.PluginId, application.ApplicationName), - Uri = application.ContextPath - }, - new ControlText() - { - Text = string.Format(this.I18N("webexpress.webapp", "setting.plugin.manufacturer.label"), plugin.Manufacturer), - Format = TypeFormatText.Default, - TextColor = new PropertyColorText(TypeColorText.Secondary), - Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.Null), - Size = new PropertySizeText(TypeSizeText.Small) - }, - !string.IsNullOrWhiteSpace(plugin.Copyright) ? new ControlText() - { - Text = string.Format(this.I18N("webexpress.webapp", "setting.plugin.copyright.label"), plugin.Copyright), - Format = TypeFormatText.Default, - TextColor = new PropertyColorText(TypeColorText.Secondary), - Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.Null), - Size = new PropertySizeText(TypeSizeText.Small) - } : null, - !string.IsNullOrWhiteSpace(plugin.License) ? new ControlText() - { - Text = string.Format(this.I18N("webexpress.webapp", "setting.plugin.license.label"), plugin.License), - Format = TypeFormatText.Default, - TextColor = new PropertyColorText(TypeColorText.Secondary), - Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.Null), - Size = new PropertySizeText(TypeSizeText.Small) - } : null, - new ControlText() - { - Text = string.Format(this.I18N("webexpress.webapp:setting.plugin.description.label"), this.I18N(application.Description)), - Format = TypeFormatText.Default, - TextColor = new PropertyColorText(TypeColorText.Secondary), - Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.Null), - Size = new PropertySizeText(TypeSizeText.Small) - }, - new ControlText() - { - Text = string.Format(this.I18N("webexpress.webapp", "setting.plugin.modules.label"), plugin.Description), - Format = TypeFormatText.Default, - TextColor = new PropertyColorText(TypeColorText.Secondary), - Margin = new PropertySpacingMargin(PropertySpacing.Space.Null, PropertySpacing.Space.Null, PropertySpacing.Space.Two, PropertySpacing.Space.Null) - }, - new ControlPanel - ( - mudules.Select - ( - m => new ControlPanel - ( - new ControlText() - { - Text = $"{this.I18N(m.PluginContext.PluginId, this.I18N(m.ModuleName))} - {this.I18N(m.PluginContext.PluginId, this.I18N(m.Description))}", - Format = TypeFormatText.Default, - TextColor = new PropertyColorText(TypeColorText.Secondary), - Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.Null), - Size = new PropertySizeText(TypeSizeText.Small) - } - ) - ).ToArray() - ) - { - } - ) - { - }, - new ControlText() { Text = plugin.Version, Format = TypeFormatText.Code } - ); - } +// plugins.AddRow +// ( +// new ControlImage() { Uri = application.Icon ?? null, Width = 32 }, +// new ControlPanel +// ( +// new ControlLink() +// { +// Text = this.I18N(plugin.PluginId, application.ApplicationName), +// Uri = application.ContextPath +// }, +// new ControlText() +// { +// Text = string.Format(this.I18N("webexpress.webapp", "setting.plugin.manufacturer.label"), plugin.Manufacturer), +// Format = TypeFormatText.Default, +// TextColor = new PropertyColorText(TypeColorText.Secondary), +// Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.Null), +// Size = new PropertySizeText(TypeSizeText.Small) +// }, +// !string.IsNullOrWhiteSpace(plugin.Copyright) ? new ControlText() +// { +// Text = string.Format(this.I18N("webexpress.webapp", "setting.plugin.copyright.label"), plugin.Copyright), +// Format = TypeFormatText.Default, +// TextColor = new PropertyColorText(TypeColorText.Secondary), +// Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.Null), +// Size = new PropertySizeText(TypeSizeText.Small) +// } : null, +// !string.IsNullOrWhiteSpace(plugin.License) ? new ControlText() +// { +// Text = string.Format(this.I18N("webexpress.webapp", "setting.plugin.license.label"), plugin.License), +// Format = TypeFormatText.Default, +// TextColor = new PropertyColorText(TypeColorText.Secondary), +// Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.Null), +// Size = new PropertySizeText(TypeSizeText.Small) +// } : null, +// new ControlText() +// { +// Text = string.Format(this.I18N("webexpress.webapp:setting.plugin.description.label"), this.I18N(application.Description)), +// Format = TypeFormatText.Default, +// TextColor = new PropertyColorText(TypeColorText.Secondary), +// Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.Null), +// Size = new PropertySizeText(TypeSizeText.Small) +// }, +// new ControlText() +// { +// Text = string.Format(this.I18N("webexpress.webapp", "setting.plugin.modules.label"), plugin.Description), +// Format = TypeFormatText.Default, +// TextColor = new PropertyColorText(TypeColorText.Secondary), +// Margin = new PropertySpacingMargin(PropertySpacing.Space.Null, PropertySpacing.Space.Null, PropertySpacing.Space.Two, PropertySpacing.Space.Null) +// }, +// new ControlPanel +// ( +// mudules.Select +// ( +// m => new ControlPanel +// ( +// new ControlText() +// { +// Text = $"{this.I18N(m.PluginContext.PluginId, this.I18N(m.ModuleName))} - {this.I18N(m.PluginContext.PluginId, this.I18N(m.Description))}", +// Format = TypeFormatText.Default, +// TextColor = new PropertyColorText(TypeColorText.Secondary), +// Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.Null), +// Size = new PropertySizeText(TypeSizeText.Small) +// } +// ) +// ).ToArray() +// ) +// { +// } +// ) +// { +// }, +// new ControlText() { Text = plugin.Version, Format = TypeFormatText.Code } +// ); +// } - context.VisualTree.Content.Headline.Secondary.Add(DownloadButton); - context.VisualTree.Content.Primary.Add(Description); - context.VisualTree.Content.Primary.Add(Label); - context.VisualTree.Content.Primary.Add(plugins); - context.VisualTree.Content.Secondary.Add(ModalUploadForm); +// context.VisualTree.Content.Headline.Secondary.Add(DownloadButton); +// context.VisualTree.Content.Primary.Add(Description); +// context.VisualTree.Content.Primary.Add(Label); +// context.VisualTree.Content.Primary.Add(plugins); +// context.VisualTree.Content.Secondary.Add(ModalUploadForm); - if (ComponentManager.TaskManager.GetTask(TaskId) is Task task && task.State == TaskState.Run) - { - context.VisualTree.Content.Secondary.Add(ModalTaskUpdate); - } - } - } -} +// if (ComponentManager.TaskManager.GetTask(TaskId) is Task task && task.State == TaskState.Run) +// { +// context.VisualTree.Content.Secondary.Add(ModalTaskUpdate); +// } +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingSystemInformation.cs b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingSystemInformation.cs index ea9782b..6ec88fc 100644 --- a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingSystemInformation.cs +++ b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingSystemInformation.cs @@ -1,91 +1,91 @@ -using System; -using System.Reflection; -using WebExpress.WebCore; -using WebExpress.WebCore.Internationalization; -using WebExpress.WebCore.WebAttribute; -using WebExpress.WebCore.WebResource; -using WebExpress.WebCore.WebScope; -using WebExpress.WebApp.WebPage; -using WebExpress.WebApp.WebScope; -using WebExpress.WebUI.WebAttribute; -using WebExpress.WebUI.WebControl; -using WebExpress.WebUI.WebSettingPage; +//using System; +//using System.Reflection; +//using WebExpress.WebCore; +//using WebExpress.WebCore.Internationalization; +//using WebExpress.WebCore.WebAttribute; +//using WebExpress.WebCore.WebResource; +//using WebExpress.WebCore.WebScope; +//using WebExpress.WebApp.WebPage; +//using WebExpress.WebApp.WebScope; +//using WebExpress.WebUI.WebAttribute; +//using WebExpress.WebUI.WebControl; +//using WebExpress.WebUI.WebSettingPage; -namespace WebExpress.WebApp.WebSettingPage -{ - /// - /// Settings page with system information. - /// - [Title("webexpress.webapp:setting.titel.systeminformation.label")] - [Segment("systeminformation", "webexpress.webapp:setting.titel.systeminformation.label")] - [ContextPath("/setting")] - [SettingSection(SettingSection.Secondary)] - [SettingIcon(TypeIcon.InfoCircle)] - [SettingGroup("webexpress.webapp:setting.group.system.label")] - [SettingContext("webexpress.webapp:setting.tab.general.label")] - [Module] - [Scope] - [Optional] - public sealed class PageWebAppSettingSystemInformation : PageWebAppSetting, IScope - { - /// - /// Initializes a new instance of the class. - /// - public PageWebAppSettingSystemInformation() - { - Icon = new PropertyIcon(TypeIcon.InfoCircle); - } +//namespace WebExpress.WebApp.WebSettingPage +//{ +// /// +// /// Settings page with system information. +// /// +// [Title("webexpress.webapp:setting.titel.systeminformation.label")] +// [Segment("systeminformation", "webexpress.webapp:setting.titel.systeminformation.label")] +// [ContextPath("/setting")] +// [SettingSection(SettingSection.Secondary)] +// [SettingIcon(TypeIcon.InfoCircle)] +// [SettingGroup("webexpress.webapp:setting.group.system.label")] +// [SettingContext("webexpress.webapp:setting.tab.general.label")] +// [Module] +// [Scope] +// [Optional] +// public sealed class PageWebAppSettingSystemInformation : PageWebAppSetting, IScope +// { +// /// +// /// Initializes a new instance of the class. +// /// +// public PageWebAppSettingSystemInformation() +// { +// Icon = new PropertyIcon(TypeIcon.InfoCircle); +// } - /// - /// Initialization - /// - /// The context. - public override void Initialization(IResourceContext context) - { - base.Initialization(context); - } +// /// +// /// Initialization +// /// +// /// The context. +// public override void Initialization(IResourceContext context) +// { +// base.Initialization(context); +// } - /// - /// Processing of the resource. - /// - /// The context for rendering the page. - public override void Process(RenderContextWebApp context) - { - base.Process(context); +// /// +// /// Processing of the resource. +// /// +// /// The context for rendering the page. +// public override void Process(RenderContextWebApp context) +// { +// base.Process(context); - var visualTree = context.VisualTree; +// var visualTree = context.VisualTree; - var converter = new TimeSpanConverter(); - var version = typeof(HttpServer).Assembly.GetCustomAttribute()?.InformationalVersion; - var memory = 0.0; - using (var proc = System.Diagnostics.Process.GetCurrentProcess()) - { - memory = proc.PrivateMemorySize64 / (1024 * 1024); - } +// var converter = new TimeSpanConverter(); +// var version = typeof(HttpServer).Assembly.GetCustomAttribute()?.InformationalVersion; +// var memory = 0.0; +// using (var proc = System.Diagnostics.Process.GetCurrentProcess()) +// { +// memory = proc.PrivateMemorySize64 / (1024 * 1024); +// } - var server = new ControlTable() { Striped = false }; - server.AddRow(new ControlText() { Text = this.I18N("webexpress.webapp", "setting.systeminformation.group.server.version") }, new ControlText() { Text = version, Format = TypeFormatText.Code }); - server.AddRow(new ControlText() { Text = this.I18N("webexpress.webapp", "setting.systeminformation.group.server.systemdate") }, new ControlText() { Text = DateTime.Now.ToString(Culture.DateTimeFormat.LongDatePattern), Format = TypeFormatText.Code }); - server.AddRow(new ControlText() { Text = this.I18N("webexpress.webapp", "setting.systeminformation.group.server.systemtime") }, new ControlText() { Text = DateTime.Now.ToString(Culture.DateTimeFormat.LongTimePattern), Format = TypeFormatText.Code }); - server.AddRow(new ControlText() { Text = this.I18N("webexpress.webapp", "setting.systeminformation.group.server.basisurl") }, new ControlText() { Text = context?.ApplicationContext.ContextPath.ToString(), Format = TypeFormatText.Code }); - server.AddRow(new ControlText() { Text = this.I18N("webexpress.webapp", "setting.systeminformation.group.server.currentdirectory") }, new ControlText() { Text = Environment.CurrentDirectory, Format = TypeFormatText.Code }); - server.AddRow(new ControlText() { Text = this.I18N("webexpress.webapp", "setting.systeminformation.group.server.memory") }, new ControlText() { Text = memory.ToString(Culture) + " MB", Format = TypeFormatText.Code }); - server.AddRow(new ControlText() { Text = this.I18N("webexpress.webapp", "setting.systeminformation.group.server.executiontime") }, new ControlText() { Text = converter.Convert(DateTime.Now - HttpServer.ExecutionTime, typeof(string), null, null).ToString(), Format = TypeFormatText.Code }); +// var server = new ControlTable() { Striped = false }; +// server.AddRow(new ControlText() { Text = this.I18N("webexpress.webapp", "setting.systeminformation.group.server.version") }, new ControlText() { Text = version, Format = TypeFormatText.Code }); +// server.AddRow(new ControlText() { Text = this.I18N("webexpress.webapp", "setting.systeminformation.group.server.systemdate") }, new ControlText() { Text = DateTime.Now.ToString(Culture.DateTimeFormat.LongDatePattern), Format = TypeFormatText.Code }); +// server.AddRow(new ControlText() { Text = this.I18N("webexpress.webapp", "setting.systeminformation.group.server.systemtime") }, new ControlText() { Text = DateTime.Now.ToString(Culture.DateTimeFormat.LongTimePattern), Format = TypeFormatText.Code }); +// server.AddRow(new ControlText() { Text = this.I18N("webexpress.webapp", "setting.systeminformation.group.server.basisurl") }, new ControlText() { Text = context?.ApplicationContext.ContextPath.ToString(), Format = TypeFormatText.Code }); +// server.AddRow(new ControlText() { Text = this.I18N("webexpress.webapp", "setting.systeminformation.group.server.currentdirectory") }, new ControlText() { Text = Environment.CurrentDirectory, Format = TypeFormatText.Code }); +// server.AddRow(new ControlText() { Text = this.I18N("webexpress.webapp", "setting.systeminformation.group.server.memory") }, new ControlText() { Text = memory.ToString(Culture) + " MB", Format = TypeFormatText.Code }); +// server.AddRow(new ControlText() { Text = this.I18N("webexpress.webapp", "setting.systeminformation.group.server.executiontime") }, new ControlText() { Text = converter.Convert(DateTime.Now - HttpServer.ExecutionTime, typeof(string), null, null).ToString(), Format = TypeFormatText.Code }); - visualTree.Content.Primary.Add(new ControlText() { Text = this.I18N("webexpress.webapp", "setting.systeminformation.group.server.label"), TextColor = new PropertyColorText(TypeColorText.Info), Margin = new PropertySpacingMargin(PropertySpacing.Space.Two) }); - visualTree.Content.Primary.Add(server); +// visualTree.Content.Primary.Add(new ControlText() { Text = this.I18N("webexpress.webapp", "setting.systeminformation.group.server.label"), TextColor = new PropertyColorText(TypeColorText.Info), Margin = new PropertySpacingMargin(PropertySpacing.Space.Two) }); +// visualTree.Content.Primary.Add(server); - var environment = new ControlTable() { Striped = false }; - environment.AddRow(new ControlText() { Text = this.I18N("webexpress.webapp", "setting.systeminformation.group.environment.operatingsystem") }, new ControlText() { Text = Environment.OSVersion.ToString(), Format = TypeFormatText.Code }); - environment.AddRow(new ControlText() { Text = this.I18N("webexpress.webapp", "setting.systeminformation.group.environment.machinename") }, new ControlText() { Text = Environment.MachineName, Format = TypeFormatText.Code }); - environment.AddRow(new ControlText() { Text = this.I18N("webexpress.webapp", "setting.systeminformation.group.environment.processorcount") }, new ControlText() { Text = Environment.ProcessorCount.ToString(), Format = TypeFormatText.Code }); - environment.AddRow(new ControlText() { Text = this.I18N("webexpress.webapp", "setting.systeminformation.group.environment.64bit") }, new ControlText() { Text = Environment.Is64BitOperatingSystem.ToString(Culture), Format = TypeFormatText.Code }); - environment.AddRow(new ControlText() { Text = this.I18N("webexpress.webapp", "setting.systeminformation.group.environment.username") }, new ControlText() { Text = Environment.UserName, Format = TypeFormatText.Code }); - environment.AddRow(new ControlText() { Text = this.I18N("webexpress.webapp", "setting.systeminformation.group.environment.clr") }, new ControlText() { Text = Environment.Version.ToString(), Format = TypeFormatText.Code }); +// var environment = new ControlTable() { Striped = false }; +// environment.AddRow(new ControlText() { Text = this.I18N("webexpress.webapp", "setting.systeminformation.group.environment.operatingsystem") }, new ControlText() { Text = Environment.OSVersion.ToString(), Format = TypeFormatText.Code }); +// environment.AddRow(new ControlText() { Text = this.I18N("webexpress.webapp", "setting.systeminformation.group.environment.machinename") }, new ControlText() { Text = Environment.MachineName, Format = TypeFormatText.Code }); +// environment.AddRow(new ControlText() { Text = this.I18N("webexpress.webapp", "setting.systeminformation.group.environment.processorcount") }, new ControlText() { Text = Environment.ProcessorCount.ToString(), Format = TypeFormatText.Code }); +// environment.AddRow(new ControlText() { Text = this.I18N("webexpress.webapp", "setting.systeminformation.group.environment.64bit") }, new ControlText() { Text = Environment.Is64BitOperatingSystem.ToString(Culture), Format = TypeFormatText.Code }); +// environment.AddRow(new ControlText() { Text = this.I18N("webexpress.webapp", "setting.systeminformation.group.environment.username") }, new ControlText() { Text = Environment.UserName, Format = TypeFormatText.Code }); +// environment.AddRow(new ControlText() { Text = this.I18N("webexpress.webapp", "setting.systeminformation.group.environment.clr") }, new ControlText() { Text = Environment.Version.ToString(), Format = TypeFormatText.Code }); - visualTree.Content.Primary.Add(new ControlText() { Text = this.I18N("webexpress.webapp", "setting.systeminformation.group.environment.label"), TextColor = new PropertyColorText(TypeColorText.Info), Margin = new PropertySpacingMargin(PropertySpacing.Space.Two) }); - visualTree.Content.Primary.Add(environment); - } - } -} +// visualTree.Content.Primary.Add(new ControlText() { Text = this.I18N("webexpress.webapp", "setting.systeminformation.group.environment.label"), TextColor = new PropertyColorText(TypeColorText.Info), Margin = new PropertySpacingMargin(PropertySpacing.Space.Two) }); +// visualTree.Content.Primary.Add(environment); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingUserManagementGroup.cs b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingUserManagementGroup.cs index 3a962d3..2970486 100644 --- a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingUserManagementGroup.cs +++ b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingUserManagementGroup.cs @@ -1,123 +1,123 @@ -using System.Linq; -using WebExpress.WebCore.WebAttribute; -using WebExpress.WebCore.WebResource; -using WebExpress.WebCore.WebScope; -using WebExpress.WebCore.WebUri; -using WebExpress.WebApp.WebControl; -using WebExpress.WebApp.WebPage; -using WebExpress.WebApp.WebScope; -using WebExpress.WebApp.WebUser; -using WebExpress.WebUI.WebAttribute; -using WebExpress.WebUI.WebControl; +//using System.Linq; +//using WebExpress.WebCore.WebAttribute; +//using WebExpress.WebCore.WebResource; +//using WebExpress.WebCore.WebScope; +//using WebExpress.WebCore.WebUri; +//using WebExpress.WebApp.WebControl; +//using WebExpress.WebApp.WebPage; +//using WebExpress.WebApp.WebScope; +//using WebExpress.WebApp.WebUser; +//using WebExpress.WebUI.WebAttribute; +//using WebExpress.WebUI.WebControl; -namespace WebExpress.WebApp.WebSettingPage -{ - /// - /// Settings page of the groups. - /// - [Title("webexpress.webapp:setting.usermanager.group.label")] - [Segment("group", "webexpress.webapp:setting.usermanager.group.label")] - [ContextPath("/setting")] - [SettingSection(SettingSection.Primary)] - [SettingIcon(TypeIcon.Users)] - [SettingGroup("webexpress.webapp:setting.usermanager.group.usermanagement.label")] - [SettingContext("webexpress.webapp:setting.tab.general.label")] - [Module] - [Scope] - [Optional] - public sealed class PageWebAppSettingUserManagementGroup : PageWebAppSetting, IScope - { - /// - /// Returns the label. - /// - private ControlText Label { get; } = new ControlText() - { - Text = "webexpress.webapp:setting.usermanager.group.help", - Margin = new PropertySpacingMargin(PropertySpacing.Space.Two), - TextColor = new PropertyColorText(TypeColorText.Info) - }; +//namespace WebExpress.WebApp.WebSettingPage +//{ +// /// +// /// Settings page of the groups. +// /// +// [Title("webexpress.webapp:setting.usermanager.group.label")] +// [Segment("group", "webexpress.webapp:setting.usermanager.group.label")] +// [ContextPath("/setting")] +// [SettingSection(SettingSection.Primary)] +// [SettingIcon(TypeIcon.Users)] +// [SettingGroup("webexpress.webapp:setting.usermanager.group.usermanagement.label")] +// [SettingContext("webexpress.webapp:setting.tab.general.label")] +// [Module] +// [Scope] +// [Optional] +// public sealed class PageWebAppSettingUserManagementGroup : PageWebAppSetting, IScope +// { +// /// +// /// Returns the label. +// /// +// private ControlText Label { get; } = new ControlText() +// { +// Text = "webexpress.webapp:setting.usermanager.group.help", +// Margin = new PropertySpacingMargin(PropertySpacing.Space.Two), +// TextColor = new PropertyColorText(TypeColorText.Info) +// }; - /// - /// Returns the help text. - /// - private ControlText Description { get; } = new ControlText() - { - Text = "webexpress.webapp:setting.usermanager.group.description", - Margin = new PropertySpacingMargin(PropertySpacing.Space.Two) - }; +// /// +// /// Returns the help text. +// /// +// private ControlText Description { get; } = new ControlText() +// { +// Text = "webexpress.webapp:setting.usermanager.group.description", +// Margin = new PropertySpacingMargin(PropertySpacing.Space.Two) +// }; - /// - /// Initializes a new instance of the class. - /// - public PageWebAppSettingUserManagementGroup() - { - Icon = new PropertyIcon(TypeIcon.Users); - } +// /// +// /// Initializes a new instance of the class. +// /// +// public PageWebAppSettingUserManagementGroup() +// { +// Icon = new PropertyIcon(TypeIcon.Users); +// } - /// - /// Initialization - /// - /// The context. - public override void Initialization(IResourceContext context) - { - base.Initialization(context); - } +// /// +// /// Initialization +// /// +// /// The context. +// public override void Initialization(IResourceContext context) +// { +// base.Initialization(context); +// } - /// - /// The processing of the request. - /// - /// The context for rendering the page. - public override void Process(RenderContextWebApp context) - { - base.Process(context); +// /// +// /// The processing of the request. +// /// +// /// The context for rendering the page. +// public override void Process(RenderContextWebApp context) +// { +// base.Process(context); - var table = new ControlTable() { Striped = false }; - table.AddColumn("webexpress.webapp:setting.usermanager.group.name.label"); - table.AddColumn(""); +// var table = new ControlTable() { Striped = false }; +// table.AddColumn("webexpress.webapp:setting.usermanager.group.name.label"); +// table.AddColumn(""); - foreach (var group in UserManager.Groups.OrderBy(x => x.Name)) - { - table.AddRow - ( - new ControlText() - { - Text = group.Name - }, - new ControlPanelFlexbox - ( - new ControlLink() - { - Text = "webexpress.webapp:setting.usermanager.group.edit.label", - Uri = new UriFragment(), - Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.Null), - Modal = new PropertyModal(TypeModal.Modal, new ControlModalFormGoupEdit(group.Id) { Item = group }) - }, - new ControlText() - { - Text = "|", - TextColor = new PropertyColorText(TypeColorText.Muted) - }, - new ControlLink() - { - Text = "webexpress.webapp:setting.usermanager.group.delete.label", - TextColor = new PropertyColorText(TypeColorText.Danger), - Uri = new UriFragment(), - Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.Null), - Modal = new PropertyModal(TypeModal.Modal, new ControlModalFormGroupDelete(group.Id) { Item = group }) - } - ) - { - Align = TypeAlignFlexbox.Center, - Layout = TypeLayoutFlexbox.Default, - Justify = TypeJustifiedFlexbox.End - } - ); - } +// foreach (var group in UserManager.Groups.OrderBy(x => x.Name)) +// { +// table.AddRow +// ( +// new ControlText() +// { +// Text = group.Name +// }, +// new ControlPanelFlexbox +// ( +// new ControlLink() +// { +// Text = "webexpress.webapp:setting.usermanager.group.edit.label", +// Uri = new UriFragment(), +// Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.Null), +// Modal = new PropertyModal(TypeModal.Modal, new ControlModalFormGoupEdit(group.Id) { Item = group }) +// }, +// new ControlText() +// { +// Text = "|", +// TextColor = new PropertyColorText(TypeColorText.Muted) +// }, +// new ControlLink() +// { +// Text = "webexpress.webapp:setting.usermanager.group.delete.label", +// TextColor = new PropertyColorText(TypeColorText.Danger), +// Uri = new UriFragment(), +// Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.Null), +// Modal = new PropertyModal(TypeModal.Modal, new ControlModalFormGroupDelete(group.Id) { Item = group }) +// } +// ) +// { +// Align = TypeAlignFlexbox.Center, +// Layout = TypeLayoutFlexbox.Default, +// Justify = TypeJustifiedFlexbox.End +// } +// ); +// } - context.VisualTree.Content.Primary.Add(Description); - context.VisualTree.Content.Primary.Add(Label); - context.VisualTree.Content.Primary.Add(table); - } - } -} +// context.VisualTree.Content.Primary.Add(Description); +// context.VisualTree.Content.Primary.Add(Label); +// context.VisualTree.Content.Primary.Add(table); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingUserManagementUser.cs b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingUserManagementUser.cs index 97bddc5..4bcc2b5 100644 --- a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingUserManagementUser.cs +++ b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingUserManagementUser.cs @@ -1,53 +1,53 @@ -using WebExpress.WebCore.WebAttribute; -using WebExpress.WebCore.WebResource; -using WebExpress.WebCore.WebScope; -using WebExpress.WebApp.WebPage; -using WebExpress.WebApp.WebScope; -using WebExpress.WebUI.WebAttribute; -using WebExpress.WebUI.WebControl; +//using WebExpress.WebCore.WebAttribute; +//using WebExpress.WebCore.WebResource; +//using WebExpress.WebCore.WebScope; +//using WebExpress.WebApp.WebPage; +//using WebExpress.WebApp.WebScope; +//using WebExpress.WebUI.WebAttribute; +//using WebExpress.WebUI.WebControl; -namespace WebExpress.WebApp.WebSettingPage -{ - /// - /// Users settings page. - /// - [Title("webexpress.webapp:setting.usermanager.user.label")] - [Segment("user", "webexpress.webapp:setting.usermanager.user.label")] - [ContextPath("/setting")] - [SettingSection(SettingSection.Primary)] - [SettingIcon(TypeIcon.User)] - [SettingGroup("webexpress.webapp:setting.usermanager.group.usermanagement.label")] - [SettingContext("webexpress.webapp:setting.tab.general.label")] - [Module] - [Scope] - [Optional] - public sealed class PageWebAppSettingUserManagementUser : PageWebAppSetting, IScope - { - /// - /// Initializes a new instance of the class. - /// - public PageWebAppSettingUserManagementUser() - { - Icon = new PropertyIcon(TypeIcon.User); - } +//namespace WebExpress.WebApp.WebSettingPage +//{ +// /// +// /// Users settings page. +// /// +// [Title("webexpress.webapp:setting.usermanager.user.label")] +// [Segment("user", "webexpress.webapp:setting.usermanager.user.label")] +// [ContextPath("/setting")] +// [SettingSection(SettingSection.Primary)] +// [SettingIcon(TypeIcon.User)] +// [SettingGroup("webexpress.webapp:setting.usermanager.group.usermanagement.label")] +// [SettingContext("webexpress.webapp:setting.tab.general.label")] +// [Module] +// [Scope] +// [Optional] +// public sealed class PageWebAppSettingUserManagementUser : PageWebAppSetting, IScope +// { +// /// +// /// Initializes a new instance of the class. +// /// +// public PageWebAppSettingUserManagementUser() +// { +// Icon = new PropertyIcon(TypeIcon.User); +// } - /// - /// Initialization - /// - /// The context. - public override void Initialization(IResourceContext context) - { - base.Initialization(context); - } +// /// +// /// Initialization +// /// +// /// The context. +// public override void Initialization(IResourceContext context) +// { +// base.Initialization(context); +// } - /// - /// The processing of the request. - /// - /// The context for rendering the page. - public override void Process(RenderContextWebApp context) - { - base.Process(context); - } - } -} +// /// +// /// The processing of the request. +// /// +// /// The context for rendering the page. +// public override void Process(RenderContextWebApp context) +// { +// base.Process(context); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebStatusPage/PageStatusWebApp.cs b/src/WebExpress.WebApp/WebStatusPage/PageStatusWebApp.cs index 4edeac4..aae4be7 100644 --- a/src/WebExpress.WebApp/WebStatusPage/PageStatusWebApp.cs +++ b/src/WebExpress.WebApp/WebStatusPage/PageStatusWebApp.cs @@ -1,129 +1,129 @@ -using WebExpress.WebCore.WebMessage; -using WebExpress.WebCore.WebResource; -using WebExpress.WebCore.WebStatusPage; -using WebExpress.WebCore.WebUri; -using WebExpress.WebApp.WebControl; -using WebExpress.WebApp.WebPage; -using WebExpress.WebUI.WebControl; -using WebExpress.WebUI.WebPage; - -namespace WebExpress.WebApp.WebStatusPage -{ - /// - /// A status page. - /// - public abstract class PageStatusWebApp : PageControl, IStatusPage where T : Response, new() - { - /// - /// Returns or sets the status code. - /// - public int StatusCode { get; set; } - - /// - /// Returns or sets the status title. - /// - public string StatusTitle { get; set; } - - /// - /// Returns or sets the status message. - /// - public string StatusMessage { get; set; } - - /// - /// Returns or sets the status icon. - /// - public UriResource StatusIcon { get; set; } - - /// - /// Returns or sets the page header. - /// - public ControlWebAppHeader Header { get; protected set; } = new ControlWebAppHeader("header"); - - /// - /// Initializes a new instance of the class. - /// - public PageStatusWebApp() - { - } - - /// - /// Initialization - /// - /// The context. - public override void Initialization(IResourceContext context) - { - base.Initialization(context); - } - - /// - /// Processing of the resource. - /// - /// The context for rendering the page. - public override void Process(RenderContextWebApp context) - { - base.Process(context); - - var visualTree = context.VisualTree; - - var statusCode = new ControlText() - { - Text = StatusCode.ToString(), - Format = TypeFormatText.H2, - Margin = new PropertySpacingMargin(PropertySpacing.Space.One), - Padding = new PropertySpacingPadding(PropertySpacing.Space.Four) - }; - - var title = new ControlText() - { - Text = StatusTitle, - Format = TypeFormatText.H3, - Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.Three) - }; - - var message = new ControlPanelCard(new ControlText() - { - Text = StatusMessage, - Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.Three) - }) - { - BackgroundColor = new PropertyColorBackground(TypeColorBackground.Light) - }; - - var panel = new ControlPanel(title, message) { Margin = new PropertySpacingMargin(PropertySpacing.Space.Three) }; - var flex = new ControlPanelFlexbox(statusCode, panel) - { - Layout = TypeLayoutFlexbox.Inline, - Justify = TypeJustifiedFlexbox.Start, - Align = TypeAlignFlexbox.Stretch - }; - - if (visualTree is VisualTreeControl visualTreeControl) - { - visualTreeControl.Content.Add(Header); - visualTreeControl.Content.Add(flex); - } - } - - /// - /// Processing of the resource. - /// - /// The request. - /// The response. - public override Response Process(Request request) - { - var response = base.Process(request); - var content = response.Content; - - var newResponse = new T(); - - newResponse.Header.ContentDisposition = response.Header.ContentDisposition; - newResponse.Header.CacheControl = "no-cache"; - newResponse.Header.ContentLanguage = response.Header.ContentLanguage; - newResponse.Header.ContentType = response.Header.ContentType; - newResponse.Header.ContentLength = response.Header.ContentLength; - newResponse.Content = content; - - return newResponse; - } - } -} +//using WebExpress.WebCore.WebMessage; +//using WebExpress.WebCore.WebResource; +//using WebExpress.WebCore.WebStatusPage; +//using WebExpress.WebCore.WebUri; +//using WebExpress.WebApp.WebControl; +//using WebExpress.WebApp.WebPage; +//using WebExpress.WebUI.WebControl; +//using WebExpress.WebUI.WebPage; + +//namespace WebExpress.WebApp.WebStatusPage +//{ +// /// +// /// A status page. +// /// +// public abstract class PageStatusWebApp : PageControl, IStatusPage where T : Response, new() +// { +// /// +// /// Returns or sets the status code. +// /// +// public int StatusCode { get; set; } + +// /// +// /// Returns or sets the status title. +// /// +// public string StatusTitle { get; set; } + +// /// +// /// Returns or sets the status message. +// /// +// public string StatusMessage { get; set; } + +// /// +// /// Returns or sets the status icon. +// /// +// public UriResource StatusIcon { get; set; } + +// /// +// /// Returns or sets the page header. +// /// +// public ControlWebAppHeader Header { get; protected set; } = new ControlWebAppHeader("header"); + +// /// +// /// Initializes a new instance of the class. +// /// +// public PageStatusWebApp() +// { +// } + +// /// +// /// Initialization +// /// +// /// The context. +// public override void Initialization(IResourceContext context) +// { +// base.Initialization(context); +// } + +// /// +// /// Processing of the resource. +// /// +// /// The context for rendering the page. +// public override void Process(RenderContextWebApp context) +// { +// base.Process(context); + +// var visualTree = context.VisualTree; + +// var statusCode = new ControlText() +// { +// Text = StatusCode.ToString(), +// Format = TypeFormatText.H2, +// Margin = new PropertySpacingMargin(PropertySpacing.Space.One), +// Padding = new PropertySpacingPadding(PropertySpacing.Space.Four) +// }; + +// var title = new ControlText() +// { +// Text = StatusTitle, +// Format = TypeFormatText.H3, +// Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.Three) +// }; + +// var message = new ControlPanelCard(new ControlText() +// { +// Text = StatusMessage, +// Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.Three) +// }) +// { +// BackgroundColor = new PropertyColorBackground(TypeColorBackground.Light) +// }; + +// var panel = new ControlPanel(title, message) { Margin = new PropertySpacingMargin(PropertySpacing.Space.Three) }; +// var flex = new ControlPanelFlexbox(statusCode, panel) +// { +// Layout = TypeLayoutFlexbox.Inline, +// Justify = TypeJustifiedFlexbox.Start, +// Align = TypeAlignFlexbox.Stretch +// }; + +// if (visualTree is VisualTreeControl visualTreeControl) +// { +// visualTreeControl.Content.Add(Header); +// visualTreeControl.Content.Add(flex); +// } +// } + +// /// +// /// Processing of the resource. +// /// +// /// The request. +// /// The response. +// public override Response Process(Request request) +// { +// var response = base.Process(request); +// var content = response.Content; + +// var newResponse = new T(); + +// newResponse.Header.ContentDisposition = response.Header.ContentDisposition; +// newResponse.Header.CacheControl = "no-cache"; +// newResponse.Header.ContentLanguage = response.Header.ContentLanguage; +// newResponse.Header.ContentType = response.Header.ContentType; +// newResponse.Header.ContentLength = response.Header.ContentLength; +// newResponse.Content = content; + +// return newResponse; +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebStatusPage/PageStatusWebAppBadRequest.cs b/src/WebExpress.WebApp/WebStatusPage/PageStatusWebAppBadRequest.cs index 55c9b2d..9d8d0b1 100644 --- a/src/WebExpress.WebApp/WebStatusPage/PageStatusWebAppBadRequest.cs +++ b/src/WebExpress.WebApp/WebStatusPage/PageStatusWebAppBadRequest.cs @@ -1,36 +1,36 @@ -using WebExpress.WebCore.Internationalization; -using WebExpress.WebCore.WebAttribute; -using WebExpress.WebCore.WebMessage; -using WebExpress.WebCore.WebResource; +//using WebExpress.WebCore.Internationalization; +//using WebExpress.WebCore.WebAttribute; +//using WebExpress.WebCore.WebMessage; +//using WebExpress.WebCore.WebResource; -namespace WebExpress.WebApp.WebStatusPage -{ - /// - /// Statusseite - /// - [StatusCode(400)] - [Default] - public sealed class PageStatusWebAppBadRequest : PageStatusWebApp - { - /// - /// Initializes a new instance of the class. - /// - public PageStatusWebAppBadRequest() - { +//namespace WebExpress.WebApp.WebStatusPage +//{ +// /// +// /// Statusseite +// /// +// [StatusCode(400)] +// [Default] +// public sealed class PageStatusWebAppBadRequest : PageStatusWebApp +// { +// /// +// /// Initializes a new instance of the class. +// /// +// public PageStatusWebAppBadRequest() +// { - } +// } - /// - /// Initialization - /// - /// The context. - public override void Initialization(IResourceContext context) - { - base.Initialization(context); +// /// +// /// Initialization +// /// +// /// The context. +// public override void Initialization(IResourceContext context) +// { +// base.Initialization(context); - StatusTitle = this.I18N("webexpress.webapp", "status.400.title"); +// StatusTitle = this.I18N("webexpress.webapp", "status.400.title"); - Title = $"{StatusCode} - {StatusTitle}"; - } - } -} +// Title = $"{StatusCode} - {StatusTitle}"; +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebStatusPage/PageStatusWebAppInternalServerError.cs b/src/WebExpress.WebApp/WebStatusPage/PageStatusWebAppInternalServerError.cs index 30d217c..f2c0687 100644 --- a/src/WebExpress.WebApp/WebStatusPage/PageStatusWebAppInternalServerError.cs +++ b/src/WebExpress.WebApp/WebStatusPage/PageStatusWebAppInternalServerError.cs @@ -1,36 +1,36 @@ -using WebExpress.WebCore.Internationalization; -using WebExpress.WebCore.WebAttribute; -using WebExpress.WebCore.WebMessage; -using WebExpress.WebCore.WebResource; +//using WebExpress.WebCore.Internationalization; +//using WebExpress.WebCore.WebAttribute; +//using WebExpress.WebCore.WebMessage; +//using WebExpress.WebCore.WebResource; -namespace WebExpress.WebApp.WebStatusPage -{ - /// - /// The status page 500. - /// - [StatusCode(500)] - [Default] - public sealed class PageStatusWebAppInternalServerError : PageStatusWebApp - { - /// - /// Initializes a new instance of the class. - /// - public PageStatusWebAppInternalServerError() - { +//namespace WebExpress.WebApp.WebStatusPage +//{ +// /// +// /// The status page 500. +// /// +// [StatusCode(500)] +// [Default] +// public sealed class PageStatusWebAppInternalServerError : PageStatusWebApp +// { +// /// +// /// Initializes a new instance of the class. +// /// +// public PageStatusWebAppInternalServerError() +// { - } +// } - /// - /// Initialization - /// - /// The context. - public override void Initialization(IResourceContext context) - { - base.Initialization(context); +// /// +// /// Initialization +// /// +// /// The context. +// public override void Initialization(IResourceContext context) +// { +// base.Initialization(context); - StatusTitle = this.I18N("webexpress.webapp", "status.500.title"); +// StatusTitle = this.I18N("webexpress.webapp", "status.500.title"); - Title = $"{StatusCode} - {StatusTitle}"; - } - } -} +// Title = $"{StatusCode} - {StatusTitle}"; +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebStatusPage/PageStatusWebAppNotFound.cs b/src/WebExpress.WebApp/WebStatusPage/PageStatusWebAppNotFound.cs index 581070a..b1d7d26 100644 --- a/src/WebExpress.WebApp/WebStatusPage/PageStatusWebAppNotFound.cs +++ b/src/WebExpress.WebApp/WebStatusPage/PageStatusWebAppNotFound.cs @@ -1,38 +1,38 @@ -using WebExpress.WebCore.Internationalization; -using WebExpress.WebCore.WebAttribute; -using WebExpress.WebCore.WebMessage; -using WebExpress.WebCore.WebResource; +//using WebExpress.WebCore.Internationalization; +//using WebExpress.WebCore.WebAttribute; +//using WebExpress.WebCore.WebMessage; +//using WebExpress.WebCore.WebResource; -namespace WebExpress.WebApp.WebStatusPage -{ - /// - /// The status page 404. - /// - [StatusCode(404)] - [Default] - public sealed class PageStatusWebAppNotFound : PageStatusWebApp - { - /// - /// Initializes a new instance of the class. - /// - public PageStatusWebAppNotFound() - { +//namespace WebExpress.WebApp.WebStatusPage +//{ +// /// +// /// The status page 404. +// /// +// [StatusCode(404)] +// [Default] +// public sealed class PageStatusWebAppNotFound : PageStatusWebApp +// { +// /// +// /// Initializes a new instance of the class. +// /// +// public PageStatusWebAppNotFound() +// { - } +// } - /// - /// Initialization - /// - /// The context. - public override void Initialization(IResourceContext context) - { - base.Initialization(context); +// /// +// /// Initialization +// /// +// /// The context. +// public override void Initialization(IResourceContext context) +// { +// base.Initialization(context); - StatusTitle = this.I18N("webexpress.webapp", "status.404.title"); +// StatusTitle = this.I18N("webexpress.webapp", "status.404.title"); - Title = $"{StatusCode} - {StatusTitle}"; +// Title = $"{StatusCode} - {StatusTitle}"; - StatusMessage = this.I18N("webexpress.webapp", "status.404.description"); - } - } -} +// StatusMessage = this.I18N("webexpress.webapp", "status.404.description"); +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebUser/Group.cs b/src/WebExpress.WebApp/WebUser/Group.cs index 0a7f461..a5dfb54 100644 --- a/src/WebExpress.WebApp/WebUser/Group.cs +++ b/src/WebExpress.WebApp/WebUser/Group.cs @@ -1,32 +1,32 @@ -using System; -using System.Xml.Serialization; +//using System; +//using System.Xml.Serialization; -namespace WebExpress.WebApp.WebUser -{ - public class Group - { - /// - /// Returns or sets the id. - /// - [XmlAttribute("id")] - public string Id { get; set; } +//namespace WebExpress.WebApp.WebUser +//{ +// public class Group +// { +// /// +// /// Returns or sets the id. +// /// +// [XmlAttribute("id")] +// public string Id { get; set; } - /// - /// Returns or sets the name. - /// - [XmlAttribute("name")] - public string Name { get; set; } +// /// +// /// Returns or sets the name. +// /// +// [XmlAttribute("name")] +// public string Name { get; set; } - /// - /// Returns or sets the timestamp of the creation. - /// - [XmlAttribute("created")] - public DateTime Created { get; set; } +// /// +// /// Returns or sets the timestamp of the creation. +// /// +// [XmlAttribute("created")] +// public DateTime Created { get; set; } - /// - /// The timestamp of the last change. - /// - [XmlAttribute("updated")] - public DateTime Updated { get; set; } - } -} +// /// +// /// The timestamp of the last change. +// /// +// [XmlAttribute("updated")] +// public DateTime Updated { get; set; } +// } +//} diff --git a/src/WebExpress.WebApp/WebUser/Model/WebItem.cs b/src/WebExpress.WebApp/WebUser/Model/WebItem.cs new file mode 100644 index 0000000..2247c21 --- /dev/null +++ b/src/WebExpress.WebApp/WebUser/Model/WebItem.cs @@ -0,0 +1,65 @@ +//using System; +//using System.Text.Json.Serialization; +//using WebExpress.WebIndex; +//using WebExpress.WebIndex.WebAttribute; + +//namespace WebExpress.WebApp.WebUser.Model +//{ +// public class WebItem : IIndexItem +// { +// /// +// /// Returns or sets the id. +// /// +// [JsonPropertyName("id")] +// [IndexIgnore] +// public Guid Id { get; set; } = Guid.NewGuid(); + +// /// +// /// Returns or sets the name. +// /// +// [JsonPropertyName("name")] +// [IndexIgnore] +// public virtual string Name { get; set; } + +// /// +// /// Returns or sets the uri of the web item. +// /// +// [JsonPropertyName("uri")] +// public virtual string Uri { get; set; } + +// /// +// /// Returns or sets the label of the web item. +// /// +// [JsonPropertyName("label")] +// public virtual string Label { get; set; } + +// /// +// /// Initializes a new instance of the class. +// /// +// public WebItem() +// { +// } + +// /// +// /// Copy-Constructor +// /// Creates a deep copy. +// /// +// /// The web item to be copied. +// public WebItem(WebItem item) +// { +// Id = item.Id; +// Name = item.Name; +// Uri = item.Uri; +// Label = item.Label; +// } + +// /// +// /// Conversion to string. +// /// +// /// The object in its string representation. +// public override string ToString() +// { +// return $"{Label} ({Id})"; +// } +// } +//} diff --git a/src/WebExpress.WebApp/WebUser/Model/WebItemGroup.cs b/src/WebExpress.WebApp/WebUser/Model/WebItemGroup.cs new file mode 100644 index 0000000..91b4b96 --- /dev/null +++ b/src/WebExpress.WebApp/WebUser/Model/WebItemGroup.cs @@ -0,0 +1,7 @@ +//namespace WebExpress.WebApp.WebUser.Model +//{ +// public class WebItemGroup : WebItem +// { + +// } +//} diff --git a/src/WebExpress.WebApp/WebUser/Model/WebItemUser.cs b/src/WebExpress.WebApp/WebUser/Model/WebItemUser.cs new file mode 100644 index 0000000..3d9124e --- /dev/null +++ b/src/WebExpress.WebApp/WebUser/Model/WebItemUser.cs @@ -0,0 +1,45 @@ +//using System.Collections.Generic; + +//namespace WebExpress.WebApp.WebUser.Model +//{ +// /// +// /// Represents a user in the web item context. +// /// +// public class WebItemUser : WebItem +// { +// /// +// /// Returns the label of the object. +// /// +// public override string Label => !string.IsNullOrWhiteSpace(Firstname) ? $"{Lastname}, {Firstname}" : Lastname; + +// /// +// /// Returns the name of the object. +// /// +// public override string Name => Label; + +// /// +// /// Returns or sets the login name. +// /// +// public string Login { get; set; } + +// /// +// /// Returns or sets the first name. +// /// +// public string Firstname { get; set; } + +// /// +// /// Returns or sets the last name. +// /// +// public string Lastname { get; set; } + +// /// +// /// Returns or sets the email address. +// /// +// public string Email { get; set; } + +// /// +// /// Returns or sets the groups. +// /// +// public IEnumerable Groups { get; set; } +// } +//} diff --git a/src/WebExpress.WebApp/WebUser/User.cs b/src/WebExpress.WebApp/WebUser/User.cs index 579e550..786cb73 100644 --- a/src/WebExpress.WebApp/WebUser/User.cs +++ b/src/WebExpress.WebApp/WebUser/User.cs @@ -1,71 +1,71 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Xml.Serialization; -using WebExpress.WebIndex; +//using System; +//using System.Collections.Generic; +//using System.Linq; +//using System.Xml.Serialization; +//using WebExpress.WebIndex; -namespace WebExpress.WebApp.WebUser -{ - public class User : IIndexItem - { - /// - /// Returns or sets the id. - /// - [XmlAttribute("id")] - public Guid Id { get; set; } +//namespace WebExpress.WebApp.WebUser +//{ +// public class User : IIndexItem +// { +// /// +// /// Returns or sets the id. +// /// +// [XmlAttribute("id")] +// public Guid Id { get; set; } - /// - /// Returns or sets the login id. - /// - [XmlAttribute("login")] - public string Login { get; set; } +// /// +// /// Returns or sets the login id. +// /// +// [XmlAttribute("login")] +// public string Login { get; set; } - /// - /// Returns or sets the name. - /// - [XmlAttribute("firstname")] - public string Firstname { get; set; } +// /// +// /// Returns or sets the name. +// /// +// [XmlAttribute("firstname")] +// public string Firstname { get; set; } - /// - /// Returns or sets the name. - /// - [XmlAttribute("lastname")] - public string Lastname { get; set; } +// /// +// /// Returns or sets the name. +// /// +// [XmlAttribute("lastname")] +// public string Lastname { get; set; } - /// - /// Returns or sets the email address. - /// - [XmlAttribute("email")] - public string Email { get; set; } +// /// +// /// Returns or sets the email address. +// /// +// [XmlAttribute("email")] +// public string Email { get; set; } - /// - /// Returns or sets the password. - /// - [XmlAttribute("password")] - public string Password { get; set; } +// /// +// /// Returns or sets the password. +// /// +// [XmlAttribute("password")] +// public string Password { get; set; } - /// - /// Returns or sets the group ids - /// - [XmlElement("groups")] - public List GroupIds { get; set; } = new List(); +// /// +// /// Returns or sets the group ids +// /// +// [XmlElement("groups")] +// public List GroupIds { get; set; } = new List(); - /// - /// Returns the groups. - /// - [XmlIgnore] - public IEnumerable Groups => from group1 in UserManager.Groups join group2 in GroupIds on group1.Id equals group2 select group1; +// /// +// /// Returns the groups. +// /// +// [XmlIgnore] +// public IEnumerable Groups => from group1 in UserManager.Groups join group2 in GroupIds on group1.Id equals group2 select group1; - /// - /// Returns or sets the timestamp of the creation. - /// - [XmlAttribute("created")] - public DateTime Created { get; set; } +// /// +// /// Returns or sets the timestamp of the creation. +// /// +// [XmlAttribute("created")] +// public DateTime Created { get; set; } - /// - /// The timestamp of the last change. - /// - [XmlAttribute("updated")] - public DateTime Updated { get; set; } - } -} +// /// +// /// The timestamp of the last change. +// /// +// [XmlAttribute("updated")] +// public DateTime Updated { get; set; } +// } +//} diff --git a/src/WebExpress.WebApp/WebUser/UserManager.cs b/src/WebExpress.WebApp/WebUser/UserManager.cs index c901fa8..e47b812 100644 --- a/src/WebExpress.WebApp/WebUser/UserManager.cs +++ b/src/WebExpress.WebApp/WebUser/UserManager.cs @@ -1,233 +1,233 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; -using System.Threading.Tasks; -using System.Xml.Serialization; -using WebExpress.WebCore; -using static WebExpress.WebCore.Internationalization.InternationalizationManager; - -namespace WebExpress.WebApp.WebUser -{ - public static class UserManager - { - /// - /// Returns or sets the reference to the context of the host. - /// - private static IHttpServerContext Context { get; set; } - - /// - /// Returns or sets the root directory where the user data is located. - /// - private static string UserRootPath { get; set; } - - /// - /// Returns the registered users. - /// - public static ICollection Users { get; } = new List(); - - /// - /// Returns the registered groups. - /// - public static ICollection Groups { get; } = new List(); - - /// - /// Initialization - /// - /// The reference to the context of the host. - internal static void Initialization(IHttpServerContext context) - { - Context = context; - - UserRootPath = Path.Combine(context.DataPath, "usermanager"); - - LoadGroup(); - LoadUser(); - - Context.Log.Info(message: I18N("webexpress.webapp:usermanager.initialization")); - } - - /// - /// Load all users from the file system. - /// - private static void LoadUser() - { - var path = Path.Combine(UserRootPath, "users"); - - if (!Directory.Exists(path)) - { - Directory.CreateDirectory(path); - } - - var files = Directory.GetFiles(path, "*.xml"); - var serializer = new XmlSerializer(typeof(User)); - foreach (var file in files) - { - try - { - using var reader = File.OpenText(file); - Users.Add(serializer.Deserialize(reader) as User); - } - catch (Exception ex) - { - Context.Log.Exception(ex); - } - } - } - - /// - /// Adds a new user. - /// - /// The new user. - public static void AddUser(User user) - { - UpdateUser(user); - - Users.Add(user); - } - - /// - /// Updates an existing user. - /// - /// The existing user. - public static void UpdateUser(User user) - { - var serializer = new XmlSerializer(typeof(User)); - var xmlns = new XmlSerializerNamespaces(); - xmlns.Add(string.Empty, string.Empty); - - user.Updated = DateTime.Now; - - using (var memoryStream = new MemoryStream()) - { - serializer.Serialize(memoryStream, user, xmlns); - - var utf = new UTF8Encoding(); - var fileName = Path.Combine(UserRootPath, "users", string.Format("{0}.xml", user.Id)); - - if (!Directory.Exists(Path.GetDirectoryName(fileName))) - { - Directory.CreateDirectory(Path.GetDirectoryName(fileName)); - } - - File.WriteAllText - ( - fileName, - utf.GetString(memoryStream.ToArray()) - ); - - Context.Log.Info(message: I18N("webexpress.webapp:usermanager.user.save"), args: $"{user.Lastname}, {user.Firstname}"); - } - } - - /// - /// Deletes a user. - /// - /// The user to be deleted. - public static void RemoveUser(User user) - { - var fileName = Path.Combine(UserRootPath, "users", string.Format("{0}.xml", user.Id)); - - Users.Remove(user); - File.Delete(fileName); - - Context.Log.Info(message: I18N("webexpress.webapp:usermanager.user.delete"), args: user.Login); - } - - /// - /// Load all groups from file system. - /// - private static void LoadGroup() - { - var path = Path.Combine(UserRootPath, "groups"); - - if (!Directory.Exists(path)) - { - Directory.CreateDirectory(path); - } - - var files = Directory.GetFiles(path, "*.xml"); - var serializer = new XmlSerializer(typeof(Group)); - foreach (var file in files) - { - try - { - using var reader = File.OpenText(file); - Groups.Add(serializer.Deserialize(reader) as Group); - } - catch (Exception ex) - { - Context.Log.Exception(ex); - } - } - } - - /// - /// Adds a new group. - /// - /// The new group. - public static void AddGroup(Group group) - { - UpdateGroup(group); - - Groups.Add(group); - } - - /// - /// Updates an existing group. - /// - /// The existing group. - public static void UpdateGroup(Group group) - { - var serializer = new XmlSerializer(typeof(Group)); - var xmlns = new XmlSerializerNamespaces(); - xmlns.Add(string.Empty, string.Empty); - - group.Updated = DateTime.Now; - - using (var memoryStream = new MemoryStream()) - { - serializer.Serialize(memoryStream, group, xmlns); - - var utf = new UTF8Encoding(); - var fileName = Path.Combine(UserRootPath, "groups", string.Format("{0}.xml", group.Id)); - - if (!Directory.Exists(Path.GetDirectoryName(fileName))) - { - Directory.CreateDirectory(Path.GetDirectoryName(fileName)); - } - - File.WriteAllText - ( - fileName, - utf.GetString(memoryStream.ToArray()) - ); - - Context.Log.Info(message: I18N("webexpress.webapp:usermanager.group.save"), args: group.Name); - } - } - - /// - /// Deletes a group. - /// - /// The group to be deleted. - public static void RemoveGroup(Group group) - { - var fileName = Path.Combine(UserRootPath, "groups", string.Format("{0}.xml", group.Id)); - - Parallel.ForEach(Users, i => - { - if (i.GroupIds.Contains(group?.Id)) - { - i.GroupIds.Remove(group?.Id); - UpdateUser(i); - } - }); - - Groups.Remove(group); - File.Delete(fileName); - - Context.Log.Info(message: I18N("webexpress.webapp:usermanager.group.delete"), args: group.Name); - } - } -} +//using System; +//using System.Collections.Generic; +//using System.IO; +//using System.Text; +//using System.Threading.Tasks; +//using System.Xml.Serialization; +//using WebExpress.WebCore; +//using static WebExpress.WebCore.Internationalization.InternationalizationManager; + +//namespace WebExpress.WebApp.WebUser +//{ +// public static class UserManager +// { +// /// +// /// Returns or sets the reference to the context of the host. +// /// +// private static IHttpServerContext Context { get; set; } + +// /// +// /// Returns or sets the root directory where the user data is located. +// /// +// private static string UserRootPath { get; set; } + +// /// +// /// Returns the registered users. +// /// +// public static ICollection Users { get; } = new List(); + +// /// +// /// Returns the registered groups. +// /// +// public static ICollection Groups { get; } = new List(); + +// /// +// /// Initialization +// /// +// /// The reference to the context of the host. +// internal static void Initialization(IHttpServerContext context) +// { +// Context = context; + +// UserRootPath = Path.Combine(context.DataPath, "usermanager"); + +// LoadGroup(); +// LoadUser(); + +// Context.Log.Info(message: I18N("webexpress.webapp:usermanager.initialization")); +// } + +// /// +// /// Load all users from the file system. +// /// +// private static void LoadUser() +// { +// var path = Path.Combine(UserRootPath, "users"); + +// if (!Directory.Exists(path)) +// { +// Directory.CreateDirectory(path); +// } + +// var files = Directory.GetFiles(path, "*.xml"); +// var serializer = new XmlSerializer(typeof(User)); +// foreach (var file in files) +// { +// try +// { +// using var reader = File.OpenText(file); +// Users.Add(serializer.Deserialize(reader) as User); +// } +// catch (Exception ex) +// { +// Context.Log.Exception(ex); +// } +// } +// } + +// /// +// /// Adds a new user. +// /// +// /// The new user. +// public static void AddUser(User user) +// { +// UpdateUser(user); + +// Users.Add(user); +// } + +// /// +// /// Updates an existing user. +// /// +// /// The existing user. +// public static void UpdateUser(User user) +// { +// var serializer = new XmlSerializer(typeof(User)); +// var xmlns = new XmlSerializerNamespaces(); +// xmlns.Add(string.Empty, string.Empty); + +// user.Updated = DateTime.Now; + +// using (var memoryStream = new MemoryStream()) +// { +// serializer.Serialize(memoryStream, user, xmlns); + +// var utf = new UTF8Encoding(); +// var fileName = Path.Combine(UserRootPath, "users", string.Format("{0}.xml", user.Id)); + +// if (!Directory.Exists(Path.GetDirectoryName(fileName))) +// { +// Directory.CreateDirectory(Path.GetDirectoryName(fileName)); +// } + +// File.WriteAllText +// ( +// fileName, +// utf.GetString(memoryStream.ToArray()) +// ); + +// Context.Log.Info(message: I18N("webexpress.webapp:usermanager.user.save"), args: $"{user.Lastname}, {user.Firstname}"); +// } +// } + +// /// +// /// Deletes a user. +// /// +// /// The user to be deleted. +// public static void RemoveUser(User user) +// { +// var fileName = Path.Combine(UserRootPath, "users", string.Format("{0}.xml", user.Id)); + +// Users.Remove(user); +// File.Delete(fileName); + +// Context.Log.Info(message: I18N("webexpress.webapp:usermanager.user.delete"), args: user.Login); +// } + +// /// +// /// Load all groups from file system. +// /// +// private static void LoadGroup() +// { +// var path = Path.Combine(UserRootPath, "groups"); + +// if (!Directory.Exists(path)) +// { +// Directory.CreateDirectory(path); +// } + +// var files = Directory.GetFiles(path, "*.xml"); +// var serializer = new XmlSerializer(typeof(Group)); +// foreach (var file in files) +// { +// try +// { +// using var reader = File.OpenText(file); +// Groups.Add(serializer.Deserialize(reader) as Group); +// } +// catch (Exception ex) +// { +// Context.Log.Exception(ex); +// } +// } +// } + +// /// +// /// Adds a new group. +// /// +// /// The new group. +// public static void AddGroup(Group group) +// { +// UpdateGroup(group); + +// Groups.Add(group); +// } + +// /// +// /// Updates an existing group. +// /// +// /// The existing group. +// public static void UpdateGroup(Group group) +// { +// var serializer = new XmlSerializer(typeof(Group)); +// var xmlns = new XmlSerializerNamespaces(); +// xmlns.Add(string.Empty, string.Empty); + +// group.Updated = DateTime.Now; + +// using (var memoryStream = new MemoryStream()) +// { +// serializer.Serialize(memoryStream, group, xmlns); + +// var utf = new UTF8Encoding(); +// var fileName = Path.Combine(UserRootPath, "groups", string.Format("{0}.xml", group.Id)); + +// if (!Directory.Exists(Path.GetDirectoryName(fileName))) +// { +// Directory.CreateDirectory(Path.GetDirectoryName(fileName)); +// } + +// File.WriteAllText +// ( +// fileName, +// utf.GetString(memoryStream.ToArray()) +// ); + +// Context.Log.Info(message: I18N("webexpress.webapp:usermanager.group.save"), args: group.Name); +// } +// } + +// /// +// /// Deletes a group. +// /// +// /// The group to be deleted. +// public static void RemoveGroup(Group group) +// { +// var fileName = Path.Combine(UserRootPath, "groups", string.Format("{0}.xml", group.Id)); + +// Parallel.ForEach(Users, i => +// { +// if (i.GroupIds.Contains(group?.Id)) +// { +// i.GroupIds.Remove(group?.Id); +// UpdateUser(i); +// } +// }); + +// Groups.Remove(group); +// File.Delete(fileName); + +// Context.Log.Info(message: I18N("webexpress.webapp:usermanager.group.delete"), args: group.Name); +// } +// } +//} From 0341a5898a7daa8f62846f6259c2b02bb54d0b7d Mon Sep 17 00:00:00 2001 From: ReneSchwarzer Date: Fri, 20 Dec 2024 19:20:49 +0100 Subject: [PATCH 08/30] update xUnit package to latest version --- src/WebExpress.WebApp.Test/WebExpress.WebApp.Test.csproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/WebExpress.WebApp.Test/WebExpress.WebApp.Test.csproj b/src/WebExpress.WebApp.Test/WebExpress.WebApp.Test.csproj index 004ddce..76b6209 100644 --- a/src/WebExpress.WebApp.Test/WebExpress.WebApp.Test.csproj +++ b/src/WebExpress.WebApp.Test/WebExpress.WebApp.Test.csproj @@ -14,11 +14,11 @@ - + - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all From adb51fa94747843eb6f0c27d05a6eba2cf49a01b Mon Sep 17 00:00:00 2001 From: ReneSchwarzer Date: Fri, 20 Dec 2024 19:22:00 +0100 Subject: [PATCH 09/30] add new section classes for web app template --- .../WebSection/SectionAppHelpPreferences.cs | 11 + .../WebSection/SectionAppHelpPrimary.cs | 11 + .../WebSection/SectionAppHelpSecondary.cs | 11 + .../SectionAppNavigationPreferences.cs | 11 + .../WebSection/SectionAppNavigationPrimary.cs | 11 + .../SectionAppNavigationSecondary.cs | 11 + .../WebSection/SectionAppPreferences.cs | 11 + .../WebSection/SectionAppPrimary.cs | 11 + .../SectionAppQuickcreatePreferences.cs | 11 + .../SectionAppQuickcreatePrimary.cs | 11 + .../SectionAppQuickcreateSecondary.cs | 11 + .../WebSection/SectionAppSecondary.cs | 11 + .../SectionAppSettingsPreferences.cs | 11 + .../WebSection/SectionAppSettingsPrimary.cs | 11 + .../WebSection/SectionAppSettingsSecondary.cs | 11 + .../WebSection/SectionContentPreferences.cs | 11 + .../WebSection/SectionContentPrimary.cs | 11 + .../WebSection/SectionContentSecondary.cs | 11 + .../WebSection/SectionFooterPreferences.cs | 11 + .../WebSection/SectionFooterPrimary.cs | 11 + .../WebSection/SectionFooterSecondary.cs | 11 + .../WebSection/SectionHeadlinePreferences.cs | 11 + .../WebSection/SectionHeadlinePrimary.cs | 11 + .../WebSection/SectionHeadlinePrologue.cs | 11 + .../WebSection/SectionHeadlineSecondary.cs | 11 + .../WebSection/SectionMetadata.cs | 11 + .../WebSection/SectionMorePreferences.cs | 11 + .../WebSection/SectionMorePrimary.cs | 11 + .../WebSection/SectionMoreSecondary.cs | 11 + .../WebSection/SectionPropertyPreferences.cs | 11 + .../WebSection/SectionPropertyPrimary.cs | 11 + .../WebSection/SectionPropertySecondary.cs | 11 + .../WebSection/SectionSidebarHeader.cs | 11 + .../WebSection/SectionSidebarPreferences.cs | 11 + .../WebSection/SectionSidebarPrimary.cs | 11 + .../WebSection/SectionSidebarSecondary.cs | 11 + .../WebSection/SectionWebApp.cs | 189 ------------------ 37 files changed, 396 insertions(+), 189 deletions(-) create mode 100644 src/WebExpress.WebApp/WebSection/SectionAppHelpPreferences.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionAppHelpPrimary.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionAppHelpSecondary.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionAppNavigationPreferences.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionAppNavigationPrimary.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionAppNavigationSecondary.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionAppPreferences.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionAppPrimary.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionAppQuickcreatePreferences.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionAppQuickcreatePrimary.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionAppQuickcreateSecondary.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionAppSecondary.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionAppSettingsPreferences.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionAppSettingsPrimary.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionAppSettingsSecondary.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionContentPreferences.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionContentPrimary.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionContentSecondary.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionFooterPreferences.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionFooterPrimary.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionFooterSecondary.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionHeadlinePreferences.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionHeadlinePrimary.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionHeadlinePrologue.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionHeadlineSecondary.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionMetadata.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionMorePreferences.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionMorePrimary.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionMoreSecondary.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionPropertyPreferences.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionPropertyPrimary.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionPropertySecondary.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionSidebarHeader.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionSidebarPreferences.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionSidebarPrimary.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionSidebarSecondary.cs delete mode 100644 src/WebExpress.WebApp/WebSection/SectionWebApp.cs diff --git a/src/WebExpress.WebApp/WebSection/SectionAppHelpPreferences.cs b/src/WebExpress.WebApp/WebSection/SectionAppHelpPreferences.cs new file mode 100644 index 0000000..26e235a --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionAppHelpPreferences.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section app.help.preferences. + /// + public class SectionAppHelpPreferences : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionAppHelpPrimary.cs b/src/WebExpress.WebApp/WebSection/SectionAppHelpPrimary.cs new file mode 100644 index 0000000..5eb3bfe --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionAppHelpPrimary.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section app.help.primary. + /// + public class SectionAppHelpPrimary : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionAppHelpSecondary.cs b/src/WebExpress.WebApp/WebSection/SectionAppHelpSecondary.cs new file mode 100644 index 0000000..1f5d9b7 --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionAppHelpSecondary.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section app.help.secondary. + /// + public class SectionAppHelpSecondary : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionAppNavigationPreferences.cs b/src/WebExpress.WebApp/WebSection/SectionAppNavigationPreferences.cs new file mode 100644 index 0000000..6f634c6 --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionAppNavigationPreferences.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section app.navigation.preferences. + /// + public class SectionAppNavigationPreferences : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionAppNavigationPrimary.cs b/src/WebExpress.WebApp/WebSection/SectionAppNavigationPrimary.cs new file mode 100644 index 0000000..56d59b8 --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionAppNavigationPrimary.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section app.navigation.primary. + /// + public class SectionAppNavigationPrimary : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionAppNavigationSecondary.cs b/src/WebExpress.WebApp/WebSection/SectionAppNavigationSecondary.cs new file mode 100644 index 0000000..cb9a0d9 --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionAppNavigationSecondary.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section app.navigation.secondary. + /// + public class SectionAppNavigationSecondary : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionAppPreferences.cs b/src/WebExpress.WebApp/WebSection/SectionAppPreferences.cs new file mode 100644 index 0000000..8ff3cdd --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionAppPreferences.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section app.preferences. + /// + public class SectionAppPreferences : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionAppPrimary.cs b/src/WebExpress.WebApp/WebSection/SectionAppPrimary.cs new file mode 100644 index 0000000..e76398d --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionAppPrimary.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section app.primary. + /// + public class SectionAppPrimary : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionAppQuickcreatePreferences.cs b/src/WebExpress.WebApp/WebSection/SectionAppQuickcreatePreferences.cs new file mode 100644 index 0000000..cb7af28 --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionAppQuickcreatePreferences.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section app.quickcreate.preferences. + /// + public class SectionAppQuickcreatePreferences : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionAppQuickcreatePrimary.cs b/src/WebExpress.WebApp/WebSection/SectionAppQuickcreatePrimary.cs new file mode 100644 index 0000000..407e9eb --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionAppQuickcreatePrimary.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section app.quickcreate.primary. + /// + public class SectionAppQuickcreatePrimary : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionAppQuickcreateSecondary.cs b/src/WebExpress.WebApp/WebSection/SectionAppQuickcreateSecondary.cs new file mode 100644 index 0000000..6803358 --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionAppQuickcreateSecondary.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section app.quickcreate.secondary. + /// + public class SectionAppQuickcreateSecondary : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionAppSecondary.cs b/src/WebExpress.WebApp/WebSection/SectionAppSecondary.cs new file mode 100644 index 0000000..37c9689 --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionAppSecondary.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section app.secondary. + /// + public class SectionAppSecondary : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionAppSettingsPreferences.cs b/src/WebExpress.WebApp/WebSection/SectionAppSettingsPreferences.cs new file mode 100644 index 0000000..461b3fc --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionAppSettingsPreferences.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section app.settings.preferences. + /// + public class SectionAppSettingsPreferences : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionAppSettingsPrimary.cs b/src/WebExpress.WebApp/WebSection/SectionAppSettingsPrimary.cs new file mode 100644 index 0000000..8bbf549 --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionAppSettingsPrimary.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section app.settings.primary. + /// + public class SectionAppSettingsPrimary : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionAppSettingsSecondary.cs b/src/WebExpress.WebApp/WebSection/SectionAppSettingsSecondary.cs new file mode 100644 index 0000000..ed7a687 --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionAppSettingsSecondary.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section app.settings.secondary. + /// + public class SectionAppSettingsSecondary : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionContentPreferences.cs b/src/WebExpress.WebApp/WebSection/SectionContentPreferences.cs new file mode 100644 index 0000000..de2d1c5 --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionContentPreferences.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section content.preferences. + /// + public class SectionContentPreferences : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionContentPrimary.cs b/src/WebExpress.WebApp/WebSection/SectionContentPrimary.cs new file mode 100644 index 0000000..7b835b4 --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionContentPrimary.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section content.primary. + /// + public class SectionContentPrimary : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionContentSecondary.cs b/src/WebExpress.WebApp/WebSection/SectionContentSecondary.cs new file mode 100644 index 0000000..0db2074 --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionContentSecondary.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section content.secondary. + /// + public class SectionContentSecondary : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionFooterPreferences.cs b/src/WebExpress.WebApp/WebSection/SectionFooterPreferences.cs new file mode 100644 index 0000000..f879755 --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionFooterPreferences.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section footer.preferences. + /// + public class SectionFooterPreferences : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionFooterPrimary.cs b/src/WebExpress.WebApp/WebSection/SectionFooterPrimary.cs new file mode 100644 index 0000000..c2e6e85 --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionFooterPrimary.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section footer.primary. + /// + public class SectionFooterPrimary : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionFooterSecondary.cs b/src/WebExpress.WebApp/WebSection/SectionFooterSecondary.cs new file mode 100644 index 0000000..9b62de3 --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionFooterSecondary.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section footer.secondary. + /// + public class SectionFooterSecondary : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionHeadlinePreferences.cs b/src/WebExpress.WebApp/WebSection/SectionHeadlinePreferences.cs new file mode 100644 index 0000000..df2777f --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionHeadlinePreferences.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section headline.preferences. + /// + public class SectionHeadlinePreferences : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionHeadlinePrimary.cs b/src/WebExpress.WebApp/WebSection/SectionHeadlinePrimary.cs new file mode 100644 index 0000000..ac4f3b9 --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionHeadlinePrimary.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section headline.primary. + /// + public class SectionHeadlinePrimary : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionHeadlinePrologue.cs b/src/WebExpress.WebApp/WebSection/SectionHeadlinePrologue.cs new file mode 100644 index 0000000..c00a968 --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionHeadlinePrologue.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section headline.prologue. + /// + public class SectionHeadlinePrologue : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionHeadlineSecondary.cs b/src/WebExpress.WebApp/WebSection/SectionHeadlineSecondary.cs new file mode 100644 index 0000000..fbb4b7f --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionHeadlineSecondary.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section headline.secondary. + /// + public class SectionHeadlineSecondary : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionMetadata.cs b/src/WebExpress.WebApp/WebSection/SectionMetadata.cs new file mode 100644 index 0000000..16bde49 --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionMetadata.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section metadata. + /// + public class SectionMetadata : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionMorePreferences.cs b/src/WebExpress.WebApp/WebSection/SectionMorePreferences.cs new file mode 100644 index 0000000..6b212d8 --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionMorePreferences.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section more.preferences. + /// + public class SectionMorePreferences : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionMorePrimary.cs b/src/WebExpress.WebApp/WebSection/SectionMorePrimary.cs new file mode 100644 index 0000000..8ec75e0 --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionMorePrimary.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section more.primary. + /// + public class SectionMorePrimary : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionMoreSecondary.cs b/src/WebExpress.WebApp/WebSection/SectionMoreSecondary.cs new file mode 100644 index 0000000..cccfcc1 --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionMoreSecondary.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section more.secondary. + /// + public class SectionMoreSecondary : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionPropertyPreferences.cs b/src/WebExpress.WebApp/WebSection/SectionPropertyPreferences.cs new file mode 100644 index 0000000..dc466e3 --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionPropertyPreferences.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section property.preferences. + /// + public class SectionPropertyPreferences : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionPropertyPrimary.cs b/src/WebExpress.WebApp/WebSection/SectionPropertyPrimary.cs new file mode 100644 index 0000000..3ecef8b --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionPropertyPrimary.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section property.primary. + /// + public class SectionPropertyPrimary : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionPropertySecondary.cs b/src/WebExpress.WebApp/WebSection/SectionPropertySecondary.cs new file mode 100644 index 0000000..0774735 --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionPropertySecondary.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section property.secondary. + /// + public class SectionPropertySecondary : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionSidebarHeader.cs b/src/WebExpress.WebApp/WebSection/SectionSidebarHeader.cs new file mode 100644 index 0000000..caa1ac3 --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionSidebarHeader.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section sidebar.header. + /// + public class SectionSidebarHeader : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionSidebarPreferences.cs b/src/WebExpress.WebApp/WebSection/SectionSidebarPreferences.cs new file mode 100644 index 0000000..20709f4 --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionSidebarPreferences.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section sidebar.preferences. + /// + public class SectionSidebarPreferences : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionSidebarPrimary.cs b/src/WebExpress.WebApp/WebSection/SectionSidebarPrimary.cs new file mode 100644 index 0000000..f6f30cf --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionSidebarPrimary.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section sidebar.primary. + /// + public class SectionSidebarPrimary : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionSidebarSecondary.cs b/src/WebExpress.WebApp/WebSection/SectionSidebarSecondary.cs new file mode 100644 index 0000000..af88af1 --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionSidebarSecondary.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section sidebar.secondary. + /// + public class SectionSidebarSecondary : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionWebApp.cs b/src/WebExpress.WebApp/WebSection/SectionWebApp.cs deleted file mode 100644 index f775940..0000000 --- a/src/WebExpress.WebApp/WebSection/SectionWebApp.cs +++ /dev/null @@ -1,189 +0,0 @@ -namespace WebExpress.WebApp.WebSection -{ - /// - /// Definition of keys to identify sections in wen pages that can be occupied by components. - /// - public static class SectionWebApp - { - /// - /// Returns app.preferences section. - /// - public const string AppPreferences = "app.preferences"; - - /// - /// Returns the app.primary section. - /// - public const string AppPrimary = "app.primary"; - - /// - /// Returns the app.secondary section. - /// - public const string AppSecondary = "app.secondary"; - - /// - /// Returns the app.navigation.preferences section. - /// - public const string AppNavigationPreferences = "app.navigation.preferences"; - - /// - /// Returns the app.navigation.primary section. - /// - public const string AppNavigationPrimary = "app.navigation.primary"; - - /// - /// Returns the app.navigation.secondary section. - /// - public const string AppNavigationSecondary = "app.navigation.secondary"; - - /// - /// Returns the app.quickcreate.primary section. - /// - public const string AppQuickcreatePreferences = "app.quickcreate.preferences"; - - /// - /// Returns the app.quickcreate.primary section. - /// - public const string AppQuickcreatePrimary = "app.quickcreate.primary"; - - /// - /// Returns the app.quickcreate.secondary section. - /// - public const string AppQuickcreateSecondary = "app.quickcreate.secondary"; - - /// - /// Returns the app.help.preferences section. - /// - public const string AppHelpPreferences = "app.help.preferences"; - - /// - /// Returns the app.help.primary section. - /// - public const string AppHelpPrimary = "app.help.primary"; - - /// - /// Returns the app.help.secondary section. - /// - public const string AppHelpSecondary = "app.help.secondary"; - - /// - /// Returns the app.settings.primary section. - /// - public const string AppSettingsPreferences = "app.settings.preferences"; - - /// - /// Returns the app.settings.primary section. - /// - public const string AppSettingsPrimary = "app.settings.primary"; - - /// - /// Returns the app.settings.secondary section. - /// - public const string AppSettingsSecondary = "app.settings.secondary"; - - /// - /// Returns the sidebar.header section. - /// - public const string SidebarHeader = "sidebar.header"; - - /// - /// Returns the sidebar.preferences section. - /// - public const string SidebarPreferences = "sidebar.preferences"; - - /// - /// Returns the sidebar.primary section. - /// - public const string SidebarPrimary = "sidebar.primary"; - - /// - /// Returns the sidebar.secondary section. - /// - public const string SidebarSecondary = "sidebar.secondary"; - - /// - /// Returns the property.preferences section. - /// - public const string PropertyPreferences = "property.preferences"; - - /// - /// Returns the property.primary section. - /// - public const string PropertyPrimary = "property.primary"; - - /// - /// Returns the property.secondary section. - /// - public const string PropertySecondary = "property.secondary"; - - /// - /// Returns the headline.prologue section. - /// - public const string HeadlinePrologue = "headline.prologue"; - - /// - /// Returns the headline.preferences section. - /// - public const string HeadlinePreferences = "headline.preferences"; - - /// - /// Returns the headline.primary section. - /// - public const string HeadlinePrimary = "headline.primary"; - - /// - /// Returns the headline.secondary section. - /// - public const string HeadlineSecondary = "headline.secondary"; - - /// - /// Returns the more.preferences section. - /// - public const string MorePreferences = "more.preferences"; - - /// - /// Returns the more.primary section. - /// - public const string MorePrimary = "more.primary"; - - /// - /// Returns the more.secondary section. - /// - public const string MoreSecondary = "more.secondary"; - - /// - /// Returns the metadata section. - /// - public const string Metadata = "metadata"; - - /// - /// Returns the content.preferences section. - /// - public const string ContentPreferences = "content.preferences"; - - /// - /// Returns the content.primary section. - /// - public const string ContentPrimary = "content.primary"; - - /// - /// Returns the content.secondary section. - /// - public const string ContentSecondary = "content.secondary"; - - /// - /// Returns the footer.preferences section. - /// - public const string FooterPreferences = "footer.preferences"; - - /// - /// Returns the footer.primary section. - /// - public const string FooterPrimary = "footer.primary"; - - /// - /// Returns the footer.secondary section. - /// - public const string FooterSecondary = "footer.secondary"; - - } -} From 07761021c92b6604d1eaf07d2dfc5fdfa53811ea Mon Sep 17 00:00:00 2001 From: Rene Schwarzer Date: Sat, 28 Dec 2024 19:53:53 +0100 Subject: [PATCH 10/30] add system plugin functionality --- src/WebExpress.WebApp/WebExWebApp.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/WebExpress.WebApp/WebExWebApp.cs diff --git a/src/WebExpress.WebApp/WebExWebApp.cs b/src/WebExpress.WebApp/WebExWebApp.cs new file mode 100644 index 0000000..5a77588 --- /dev/null +++ b/src/WebExpress.WebApp/WebExWebApp.cs @@ -0,0 +1,16 @@ +using System.Runtime.CompilerServices; +using WebExpress.WebCore.WebAttribute; + +[assembly: SystemPlugin()] +[assembly: InternalsVisibleTo("WebExpress.WebUI.Test")] + +namespace WebExpress.WebApp +{ + /// + /// Represents the WebExWebApp class which is a part of the WebExpress.WebWebApp namespace. + /// This class is internal and is intended for use within the WebExpress.WebApp assembly. + /// + internal class WebExWebApp + { + } +} From 7059604f36e765b6809e5680c30486c02c21db48 Mon Sep 17 00:00:00 2001 From: Rene Schwarzer Date: Sat, 28 Dec 2024 22:32:59 +0100 Subject: [PATCH 11/30] refactoring and add tests --- .../Fixture/AssertExtensions.cs | 89 +++++ .../Fixture/UnitTestControlFixture.cs | 45 +-- src/WebExpress.WebApp.Test/TestPage.cs | 2 +- .../TestSectionAppPreferencesItem.cs | 23 ++ .../UnitTestControlWebAppContent.cs | 34 ++ .../WebControl/UnitTestControlWebAppFooter.cs | 34 ++ .../WebControl/UnitTestControlWebAppHeader.cs | 18 +- ...nitTestControlWebAppHeaderAppNavigation.cs | 34 ++ ...UnitTestControlWebAppHeaderAppNavigator.cs | 11 +- .../UnitTestControlWebAppHeaderAppTitle.cs | 2 +- .../UnitTestControlWebAppHeaderHelp.cs | 34 ++ .../UnitTestControlWebAppHeaderQuickCreate.cs | 34 ++ .../UnitTestControlWebAppHeaderSettings.cs | 34 ++ .../UnitTestControlWebAppHeadline.cs | 34 ++ .../UnitTestControlWebAppProperty.cs | 34 ++ .../WebPage/UnitTestPageManager.cs | 26 ++ .../WebControl/ControlWebAppContent.cs | 268 +++++++------ .../WebControl/ControlWebAppFooter.cs | 146 +++---- .../WebControl/ControlWebAppHeader.cs | 64 ++-- .../ControlWebAppHeaderAppNavigation.cs | 168 ++++---- .../ControlWebAppHeaderAppNavigator.cs | 102 ++++- .../WebControl/ControlWebAppHeaderHelp.cs | 168 ++++---- .../ControlWebAppHeaderQuickCreate.cs | 174 +++++---- .../WebControl/ControlWebAppHeaderSettings.cs | 168 ++++---- .../WebControl/ControlWebAppHeadline.cs | 360 ++++++++++-------- .../WebControl/ControlWebAppProperty.cs | 146 +++---- .../WebExpress.WebApp.csproj | 4 + .../WebPage/RenderContextWebApp.cs | 46 --- .../WebPage/VisualTreeWebApp.cs | 166 ++++---- 29 files changed, 1495 insertions(+), 973 deletions(-) create mode 100644 src/WebExpress.WebApp.Test/Fixture/AssertExtensions.cs create mode 100644 src/WebExpress.WebApp.Test/TestSectionAppPreferencesItem.cs create mode 100644 src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppContent.cs create mode 100644 src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppFooter.cs create mode 100644 src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderAppNavigation.cs create mode 100644 src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderHelp.cs create mode 100644 src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderQuickCreate.cs create mode 100644 src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderSettings.cs create mode 100644 src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeadline.cs create mode 100644 src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppProperty.cs delete mode 100644 src/WebExpress.WebApp/WebPage/RenderContextWebApp.cs diff --git a/src/WebExpress.WebApp.Test/Fixture/AssertExtensions.cs b/src/WebExpress.WebApp.Test/Fixture/AssertExtensions.cs new file mode 100644 index 0000000..c1cd13b --- /dev/null +++ b/src/WebExpress.WebApp.Test/Fixture/AssertExtensions.cs @@ -0,0 +1,89 @@ +using System.Text.RegularExpressions; +using WebExpress.WebCore.WebHtml; + +namespace WebExpress.WebApp.Test.Fixture +{ + /// + /// Provides extension methods for assertions. + /// + public static partial class AssertExtensions + { + /// + /// Gets a regular expression that matches whitespace between '>' and '<' characters. + /// + /// A object that matches whitespace between '>' and '<' characters. + [GeneratedRegex(@">\s+<")] + private static partial Regex WhitespaceRegex(); + + /// + /// Asserts that the actual string is equal to the expected string, allowing for placeholders. + /// + /// The Assert instance (not used, but required for extension method). + /// The expected string with placeholders. + /// The actual string to compare. + public static void EqualWithPlaceholders(string expected, string actual) + { + var str = RemoveLineBreaks(actual?.ToString()); + Assert.True(AreEqualWithPlaceholders(expected, str), $"Expected: {expected}{Environment.NewLine}Actual: {str}"); + } + + /// + /// Asserts that the actual node is equal to the expected string, allowing for placeholders. + /// + /// The Assert instance (not used, but required for extension method). + /// The expected string with placeholders. + /// The actual string to compare. + public static void EqualWithPlaceholders(string expected, IHtmlNode actual) + { + var str = RemoveLineBreaks(actual?.ToString()); + Assert.True(AreEqualWithPlaceholders(expected, str), $"Expected: {expected}{Environment.NewLine}Actual: {str}"); + } + + /// + /// Compares two strings, allowing for placeholders in the expected string. + /// + /// The expected string, which may contain '*' as a wildcard character. + /// The actual string to compare against the expected string. + /// True if the actual string matches the expected string with placeholders; otherwise, false. + private static bool AreEqualWithPlaceholders(string expected, string actual) + { + if (expected == null && actual == null) + { + return true; + } + else if (expected != null && actual == null) + { + return false; + } + else if (expected == null && actual != null) + { + return false; + } + + var pattern = "^" + Regex.Escape(expected).Replace(@"\*", ".*") + "$"; + + return Regex.IsMatch(actual, pattern); + } + + /// + /// Removes all line breaks from the input string. + /// + /// The input string from which to remove line breaks. + /// A string with all line breaks removed. + public static string RemoveLineBreaks(string input) + { + if (string.IsNullOrEmpty(input)) + { + return input; + } + + // remove all line breaks + string result = input.Replace("\r\n", "").Replace("\r", "").Replace("\n", ""); + + // remove whitespace of any length between '>' and '<' + result = WhitespaceRegex().Replace(result, "><"); + + return result; + } + } +} diff --git a/src/WebExpress.WebApp.Test/Fixture/UnitTestControlFixture.cs b/src/WebExpress.WebApp.Test/Fixture/UnitTestControlFixture.cs index e37905b..235873a 100644 --- a/src/WebExpress.WebApp.Test/Fixture/UnitTestControlFixture.cs +++ b/src/WebExpress.WebApp.Test/Fixture/UnitTestControlFixture.cs @@ -4,7 +4,6 @@ using System.Net; using System.Reflection; using System.Text; -using System.Text.RegularExpressions; using WebExpress.WebCore; using WebExpress.WebCore.WebApplication; using WebExpress.WebCore.WebComponent; @@ -14,7 +13,6 @@ using WebExpress.WebCore.WebPage; using WebExpress.WebCore.WebPlugin; using WebExpress.WebCore.WebUri; -using WebExpress.WebUI.WebComponent; using WebExpress.WebUI.WebPage; namespace WebExpress.WebApp.Test.Fixture @@ -26,9 +24,6 @@ public partial class UnitTestControlFixture : IDisposable { private static readonly string[] _separator = ["\r\n", "\r", "\n"]; - [GeneratedRegex(@">\s+<")] - private static partial Regex WhitespaceRegex(); - /// /// Initializes a new instance of the class and boot the component manager. /// @@ -63,7 +58,7 @@ public static IHttpServerContext CreateHttpServerContextMock() /// The component hub. public static ComponentHub CreateComponentHubMock() { - var ctorComponentHub = typeof(ComponentHubUI).GetConstructor + var ctorComponentHub = typeof(ComponentHub).GetConstructor ( BindingFlags.NonPublic | BindingFlags.Instance, null, @@ -74,7 +69,7 @@ public static ComponentHub CreateComponentHubMock() var componentHub = (ComponentHub)ctorComponentHub.Invoke([CreateHttpServerContextMock()]); // set static field in the webex class - var type = typeof(WebEx); + var type = typeof(WebEx); var field = type.GetField("_componentHub", BindingFlags.Static | BindingFlags.NonPublic); field.SetValue(null, componentHub); @@ -184,7 +179,6 @@ public static WebCore.WebMessage.HttpContext CreateHttpContextMock(string conten featureCollection.Set(requestIdentifierFeature); featureCollection.Set(connectionFeature); - var componentManager = CreateComponentHubMock(); var context = new WebCore.WebMessage.HttpContext(featureCollection, CreateHttpServerContextMock()); return context; @@ -200,7 +194,7 @@ public static IRenderControlContext CrerateRenderContextMock(IApplicationContext { var request = CrerateRequestMock(); - return new RenderControlContext(CreratePageContextMock(applicationContext, scopes), request); + return new RenderControlContext(null, CreratePageContextMock(applicationContext, scopes), request); } /// @@ -242,39 +236,6 @@ public static string GetEmbeddedResource(string fileName) return Encoding.UTF8.GetString(data); } - /// - /// Removes all line breaks from the input string. - /// - /// The input string from which to remove line breaks. - /// A string with all line breaks removed. - public static string RemoveLineBreaks(string input) - { - if (string.IsNullOrEmpty(input)) - { - return input; - } - - // remove all line breaks - string result = input.Replace("\r\n", "").Replace("\r", "").Replace("\n", ""); - - // remove whitespace of any length between '>' and '<' - result = WhitespaceRegex().Replace(result, "><"); - - return result; - } - - /// - /// Compares two strings, allowing for placeholders in the expected string. - /// - /// The expected string, which may contain '*' as a wildcard character. - /// The actual string to compare against the expected string. - /// True if the actual string matches the expected string with placeholders; otherwise, false. - public static bool AreEqualWithPlaceholders(string expected, string actual) - { - var pattern = "^" + Regex.Escape(expected).Replace(@"\*", ".*") + "$"; - return Regex.IsMatch(actual, pattern); - } - /// /// Release of unmanaged resources reserved during use. /// diff --git a/src/WebExpress.WebApp.Test/TestPage.cs b/src/WebExpress.WebApp.Test/TestPage.cs index 025fa74..07e701d 100644 --- a/src/WebExpress.WebApp.Test/TestPage.cs +++ b/src/WebExpress.WebApp.Test/TestPage.cs @@ -8,7 +8,7 @@ namespace WebExpress.WebApp.Test /// A dummy class for testing purposes. /// [Title("webindex:pagea.label")] - [Segment("pagea", "webindex:homepage.label")] + [Segment("page", "webindex:homepage.label")] [ContextPath(null)] public sealed class TestPage : IPage { diff --git a/src/WebExpress.WebApp.Test/TestSectionAppPreferencesItem.cs b/src/WebExpress.WebApp.Test/TestSectionAppPreferencesItem.cs new file mode 100644 index 0000000..6bcc909 --- /dev/null +++ b/src/WebExpress.WebApp.Test/TestSectionAppPreferencesItem.cs @@ -0,0 +1,23 @@ +using WebExpress.WebApp.WebSection; +using WebExpress.WebCore.WebAttribute; +using WebExpress.WebCore.WebFragment; +using WebExpress.WebUI.WebFragment; + +namespace WebExpress.WebApp.Test +{ + /// + /// A dummy fragment for testing purposes. + /// + [Section] + public sealed class TestFragmentSectionAppPreferencesItem : FragmentControlDropdownItemLink + { + /// + /// Initializes a new instance of the class. + /// + public TestFragmentSectionAppPreferencesItem(IFragmentContext fragmentContext) + : base(fragmentContext) + { + Text = "TestFragmentSectionAppPreferencesItem"; + } + } +} diff --git a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppContent.cs b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppContent.cs new file mode 100644 index 0000000..b1918fb --- /dev/null +++ b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppContent.cs @@ -0,0 +1,34 @@ +using WebExpress.WebApp.Test.Fixture; +using WebExpress.WebApp.WebControl; + +namespace WebExpress.WebApp.Test.WebControl +{ + /// + /// Tests the web app content control. + /// + [Collection("NonParallelTests")] + public class UnitTestControlWebAppContent + { + /// + /// Tests the id property of the web app content control. + /// + [Theory] + [InlineData(null, @"
*
")] + [InlineData("id", @"
*
")] + public void Id(string id, string expected) + { + // preconditions + var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); + var application = componentHub.ApplicationManager.GetApplications(typeof(TestApplication)).FirstOrDefault(); + var context = UnitTestControlFixture.CrerateRenderContextMock(application); + var control = new ControlWebAppContent(id) + { + }; + + // test execution + var html = control.Render(context); + + AssertExtensions.EqualWithPlaceholders(expected, html); + } + } +} diff --git a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppFooter.cs b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppFooter.cs new file mode 100644 index 0000000..5951b51 --- /dev/null +++ b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppFooter.cs @@ -0,0 +1,34 @@ +using WebExpress.WebApp.Test.Fixture; +using WebExpress.WebApp.WebControl; + +namespace WebExpress.WebApp.Test.WebControl +{ + /// + /// Tests the web app footer control. + /// + [Collection("NonParallelTests")] + public class UnitTestControlWebAppFooter + { + /// + /// Tests the id property of the web app footer control. + /// + [Theory] + [InlineData(null, @"
")] + [InlineData("id", @"
")] + public void Id(string id, string expected) + { + // preconditions + var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); + var application = componentHub.ApplicationManager.GetApplications(typeof(TestApplication)).FirstOrDefault(); + var context = UnitTestControlFixture.CrerateRenderContextMock(application); + var control = new ControlWebAppFooter(id) + { + }; + + // test execution + var html = control.Render(context); + + AssertExtensions.EqualWithPlaceholders(expected, html); + } + } +} diff --git a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeader.cs b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeader.cs index a19cb75..fb5b12d 100644 --- a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeader.cs +++ b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeader.cs @@ -28,7 +28,7 @@ public void Id(string id, string expected) // test execution var html = control.Render(context); - AssertEqualWithPlaceholders(expected, UnitTestControlFixture.RemoveLineBreaks(html.ToString())); + AssertExtensions.EqualWithPlaceholders(expected, html); } /// @@ -58,7 +58,7 @@ public void TextColor(TypeColorNavbar textColor, string expected) // test execution var html = control.Render(context); - AssertEqualWithPlaceholders(expected, UnitTestControlFixture.RemoveLineBreaks(html.ToString())); + AssertExtensions.EqualWithPlaceholders(expected, html); } /// @@ -81,7 +81,7 @@ public void Fixed(TypeFixed fixedProperty, string expected) // test execution var html = control.Render(context); - AssertEqualWithPlaceholders(expected, UnitTestControlFixture.RemoveLineBreaks(html.ToString())); + AssertExtensions.EqualWithPlaceholders(expected, html); } /// @@ -103,17 +103,7 @@ public void Sticky(TypeSticky sticky, string expected) // test execution var html = control.Render(context); - AssertEqualWithPlaceholders(expected, UnitTestControlFixture.RemoveLineBreaks(html.ToString())); - } - - /// - /// Asserts that the actual string is equal to the expected string, allowing for placeholders. - /// - /// The expected string with placeholders. - /// The actual string to compare. - private void AssertEqualWithPlaceholders(string expected, string actual) - { - Assert.True(UnitTestControlFixture.AreEqualWithPlaceholders(expected, actual), $"Expected: {expected}, Actual: {actual}"); + AssertExtensions.EqualWithPlaceholders(expected, html); } } } diff --git a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderAppNavigation.cs b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderAppNavigation.cs new file mode 100644 index 0000000..9e74763 --- /dev/null +++ b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderAppNavigation.cs @@ -0,0 +1,34 @@ +using WebExpress.WebApp.Test.Fixture; +using WebExpress.WebApp.WebControl; + +namespace WebExpress.WebApp.Test.WebControl +{ + /// + /// Tests the web app header navigation control. + /// + [Collection("NonParallelTests")] + public class UnitTestControlWebAppHeaderAppNavigation + { + /// + /// Tests the id property of the web app header navigation control. + /// + [Theory] + [InlineData(null, @"
*
")] + [InlineData("id", @"
*
")] + public void Id(string id, string expected) + { + // preconditions + var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); + var application = componentHub.ApplicationManager.GetApplications(typeof(TestApplication)).FirstOrDefault(); + var context = UnitTestControlFixture.CrerateRenderContextMock(application); + var control = new ControlWebAppHeaderAppNavigation(id) + { + }; + + // test execution + var html = control.Render(context); + + AssertExtensions.EqualWithPlaceholders(expected, html); + } + } +} diff --git a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderAppNavigator.cs b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderAppNavigator.cs index a4edf66..2bf295e 100644 --- a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderAppNavigator.cs +++ b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderAppNavigator.cs @@ -13,13 +13,14 @@ public class UnitTestControlWebAppHeaderAppNavigator /// Tests the id property of the web app header app navigator control. ///
[Theory] - [InlineData(null, @"")] - [InlineData("id", @"")] + [InlineData(null, @"
*
")] + [InlineData("id", @"
*
")] public void Id(string id, string expected) { // preconditions - UnitTestControlFixture.CreateAndRegisterComponentHubMock(); - var context = UnitTestControlFixture.CrerateRenderContextMock(); + var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); + var application = componentHub.ApplicationManager.GetApplications(typeof(TestApplication)).FirstOrDefault(); + var context = UnitTestControlFixture.CrerateRenderContextMock(application); var control = new ControlWebAppHeaderAppNavigator(id) { }; @@ -27,7 +28,7 @@ public void Id(string id, string expected) // test execution var html = control.Render(context); - Assert.Equal(expected, UnitTestControlFixture.RemoveLineBreaks(html.ToString())); + AssertExtensions.EqualWithPlaceholders(expected, html); } } } diff --git a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderAppTitle.cs b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderAppTitle.cs index d726547..0856ab2 100644 --- a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderAppTitle.cs +++ b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderAppTitle.cs @@ -27,7 +27,7 @@ public void Id(string id, string expected) // test execution var html = control.Render(context); - Assert.Equal(expected, UnitTestControlFixture.RemoveLineBreaks(html.ToString())); + AssertExtensions.EqualWithPlaceholders(expected, html); } } } diff --git a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderHelp.cs b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderHelp.cs new file mode 100644 index 0000000..6c0131b --- /dev/null +++ b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderHelp.cs @@ -0,0 +1,34 @@ +using WebExpress.WebApp.Test.Fixture; +using WebExpress.WebApp.WebControl; + +namespace WebExpress.WebApp.Test.WebControl +{ + /// + /// Tests the web app header help control. + /// + [Collection("NonParallelTests")] + public class UnitTestControlWebAppHeaderHelp + { + /// + /// Tests the id property of the web app header help control. + /// + [Theory] + [InlineData(null, null)] + [InlineData("id", null)] + public void Id(string id, string expected) + { + // preconditions + var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); + var application = componentHub.ApplicationManager.GetApplications(typeof(TestApplication)).FirstOrDefault(); + var context = UnitTestControlFixture.CrerateRenderContextMock(application); + var control = new ControlWebAppHeaderHelp(id) + { + }; + + // test execution + var html = control.Render(context); + + AssertExtensions.EqualWithPlaceholders(expected, html); + } + } +} diff --git a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderQuickCreate.cs b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderQuickCreate.cs new file mode 100644 index 0000000..2b7c41d --- /dev/null +++ b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderQuickCreate.cs @@ -0,0 +1,34 @@ +using WebExpress.WebApp.Test.Fixture; +using WebExpress.WebApp.WebControl; + +namespace WebExpress.WebApp.Test.WebControl +{ + /// + /// Tests the web app header quick create control. + /// + [Collection("NonParallelTests")] + public class UnitTestControlWebAppHeaderQuickCreate + { + /// + /// Tests the id property of the web app header quick create control. + /// + [Theory] + [InlineData(null, null)] + [InlineData("id", null)] + public void Id(string id, string expected) + { + // preconditions + var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); + var application = componentHub.ApplicationManager.GetApplications(typeof(TestApplication)).FirstOrDefault(); + var context = UnitTestControlFixture.CrerateRenderContextMock(application); + var control = new ControlWebAppHeaderQuickCreate(id) + { + }; + + // test execution + var html = control.Render(context); + + AssertExtensions.EqualWithPlaceholders(expected, html); + } + } +} diff --git a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderSettings.cs b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderSettings.cs new file mode 100644 index 0000000..892304c --- /dev/null +++ b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderSettings.cs @@ -0,0 +1,34 @@ +using WebExpress.WebApp.Test.Fixture; +using WebExpress.WebApp.WebControl; + +namespace WebExpress.WebApp.Test.WebControl +{ + /// + /// Tests the web app header settings control. + /// + [Collection("NonParallelTests")] + public class UnitTestControlWebAppHeaderSettings + { + /// + /// Tests the id property of the web app header settings control. + /// + [Theory] + [InlineData(null, null)] + [InlineData("id", null)] + public void Id(string id, string expected) + { + // preconditions + var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); + var application = componentHub.ApplicationManager.GetApplications(typeof(TestApplication)).FirstOrDefault(); + var context = UnitTestControlFixture.CrerateRenderContextMock(application); + var control = new ControlWebAppHeaderSettings(id) + { + }; + + // test execution + var html = control.Render(context); + + AssertExtensions.EqualWithPlaceholders(expected, html); + } + } +} diff --git a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeadline.cs b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeadline.cs new file mode 100644 index 0000000..cec3bc4 --- /dev/null +++ b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeadline.cs @@ -0,0 +1,34 @@ +using WebExpress.WebApp.Test.Fixture; +using WebExpress.WebApp.WebControl; + +namespace WebExpress.WebApp.Test.WebControl +{ + /// + /// Tests the web app headline control. + /// + [Collection("NonParallelTests")] + public class UnitTestControlWebAppHeadline + { + /// + /// Tests the id property of the web app headline control. + /// + [Theory] + [InlineData(null, @"
*
")] + [InlineData("id", @"
*
")] + public void Id(string id, string expected) + { + // preconditions + var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); + var application = componentHub.ApplicationManager.GetApplications(typeof(TestApplication)).FirstOrDefault(); + var context = UnitTestControlFixture.CrerateRenderContextMock(application); + var control = new ControlWebAppHeadline(id) + { + }; + + // test execution + var html = control.Render(context); + + AssertExtensions.EqualWithPlaceholders(expected, html); + } + } +} diff --git a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppProperty.cs b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppProperty.cs new file mode 100644 index 0000000..7280d9a --- /dev/null +++ b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppProperty.cs @@ -0,0 +1,34 @@ +using WebExpress.WebApp.Test.Fixture; +using WebExpress.WebApp.WebControl; + +namespace WebExpress.WebApp.Test.WebControl +{ + /// + /// Tests the web app property control. + /// + [Collection("NonParallelTests")] + public class UnitTestControlWebAppProperty + { + /// + /// Tests the id property of the web app property control. + /// + [Theory] + [InlineData(null, null)] + [InlineData("id", null)] + public void Id(string id, string expected) + { + // preconditions + var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); + var application = componentHub.ApplicationManager.GetApplications(typeof(TestApplication)).FirstOrDefault(); + var context = UnitTestControlFixture.CrerateRenderContextMock(application); + var control = new ControlWebAppProperty(id) + { + }; + + // test execution + var html = control.Render(context); + + AssertExtensions.EqualWithPlaceholders(expected, html); + } + } +} diff --git a/src/WebExpress.WebApp.Test/WebPage/UnitTestPageManager.cs b/src/WebExpress.WebApp.Test/WebPage/UnitTestPageManager.cs index 25a72db..57bd5c3 100644 --- a/src/WebExpress.WebApp.Test/WebPage/UnitTestPageManager.cs +++ b/src/WebExpress.WebApp.Test/WebPage/UnitTestPageManager.cs @@ -1,4 +1,5 @@ using WebExpress.WebApp.Test.Fixture; +using WebExpress.WebCore.WebSitemap; namespace WebExpress.WebApp.Test.WebPage { @@ -30,5 +31,30 @@ public void Id(Type applicationType, Type pageType, string id) Assert.Contains(id, page.Select(x => x.EndpointId?.ToString())); } + + /// + /// Test the process function of the page manager. + /// + [Theory] + [InlineData("http://localhost:8080/server/app/page", "webexpress.webapp.test.testpage")] + public void SearchResource(string uri, string id) + { + // preconditions + var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); + var context = UnitTestControlFixture.CreateHttpContextMock(); + var httpServerContext = UnitTestControlFixture.CreateHttpServerContextMock(); + var searchContext = Activator.CreateInstance(); + componentHub.SitemapManager.Refresh(); + typeof(SearchContext).GetProperty("HttpServerContext").SetValue(searchContext, httpServerContext); + typeof(SearchContext).GetProperty("Culture").SetValue(searchContext, httpServerContext.Culture); + typeof(SearchContext).GetProperty("HttpContext").SetValue(searchContext, context); + + // test execution + var searchResult = componentHub.SitemapManager.SearchResource(new Uri(uri), searchContext); + + var response = componentHub.EndpointManager.HandleRequest(UnitTestControlFixture.CrerateRequestMock(), searchResult.EndpointContext); + + Assert.Equal(id, searchResult?.EndpointContext?.EndpointId.ToString()); + } } } diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppContent.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppContent.cs index 1d5dc2e..11e3855 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppContent.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppContent.cs @@ -1,126 +1,142 @@ -//using System.Collections.Generic; -//using System.Linq; -//using WebExpress.WebCore.WebHtml; -//using WebExpress.WebCore.WebPage; -//using WebExpress.WebApp.WebPage; -//using WebExpress.WebUI.WebControl; - -//namespace WebExpress.WebApp.WebControl -//{ -// /// -// /// Content of a web app page. -// /// -// public class ControlWebAppContent : ControlPanel -// { -// /// -// /// Returns the main panel. -// /// -// private ControlPanelMain MainPanel { get; } = new ControlPanelMain("webexpress.webapp.content.main") -// { -// Padding = new PropertySpacingPadding(PropertySpacing.Space.Two, PropertySpacing.Space.Null), -// Margin = new PropertySpacingMargin(PropertySpacing.Space.Null, PropertySpacing.Space.Two, PropertySpacing.Space.Null, PropertySpacing.Space.Null), -// BackgroundColor = LayoutSchema.ContentBackground, -// Classes = new() { "flex-grow-1" } -// }; - -// /// -// /// Returns the flexbox. -// /// -// private ControlPanelFlexbox Flexbox { get; } = new ControlPanelFlexbox() -// { -// Layout = TypeLayoutFlexbox.Default, -// Align = TypeAlignFlexbox.Stretch -// }; - -// /// -// /// Returns the page properties. -// /// -// public ControlWebAppProperty Property { get; } = new ControlWebAppProperty("webexpress.webapp.content.property"); - -// /// -// /// Returns the toolbar. -// /// -// public ControlToolbar Toolbar { get; } = new ControlToolbar("webexpress.webapp.content.toolbar"); - -// /// -// /// Returns the headline control. -// /// -// public ControlWebAppHeadline Headline { get; } = new ControlWebAppHeadline("webexpress.webapp.content.main.headline"); - -// /// -// /// Returns the preferences area. -// /// -// public List Preferences { get; } = new List(); - -// /// -// /// Returns the primary area. -// /// -// public List Primary { get; } = new List(); - -// /// -// /// Returns the secondary area. -// /// -// public List Secondary { get; } = new List(); - -// /// -// /// Initializes a new instance of the class. -// /// -// /// The control id. -// public ControlWebAppContent(string id = null) -// : base(id) -// { -// Init(); - -// Classes.Add("content"); -// } - -// /// -// /// Initialization -// /// -// private void Init() -// { -// BackgroundColor = LayoutSchema.ContentBackground; -// Toolbar.BackgroundColor = LayoutSchema.ToolbarBackground; -// Margin = new PropertySpacingMargin(PropertySpacing.Space.Two); - -// Flexbox.Content.Add(MainPanel); -// Flexbox.Content.Add(Property); - -// Content.Add(Toolbar); -// Content.Add(Flexbox); -// } - -// /// -// /// Convert to html. -// /// -// /// The context in which the control is rendered. -// /// The control as html. -// public override IHtmlNode Render(RenderContext context) -// { -// MainPanel.Content.Clear(); - -// MainPanel.Content.Add(Headline); -// MainPanel.Content.Add(new ControlPanel("webexpress.webapp.content.main.preferences", Preferences)); -// MainPanel.Content.Add(new ControlPanel("webexpress.webapp.content.main.primary", Primary)); -// MainPanel.Content.Add(new ControlPanel("webexpress.webapp.content.main.secondary", Secondary)); - -// Content.Clear(); - -// if (Toolbar.Items.Any()) -// { -// Content.Add(Toolbar); -// } - -// if (Property.Preferences.Any() || Property.Primary.Any() || Property.Secondary.Any()) -// { -// Content.Add(Flexbox); -// } -// else -// { -// Content.Add(MainPanel); -// } - -// return base.Render(context); -// } -// } -//} +using System.Collections.Generic; +using System.Linq; +using WebExpress.WebApp.WebSection; +using WebExpress.WebCore; +using WebExpress.WebCore.WebHtml; +using WebExpress.WebUI.WebControl; +using WebExpress.WebUI.WebFragment; +using WebExpress.WebUI.WebPage; + +namespace WebExpress.WebApp.WebControl +{ + /// + /// Content of a web app page. + /// + public class ControlWebAppContent : ControlPanel + { + /// + /// Returns the preferences area. + /// + public List Preferences { get; } = []; + + /// + /// Returns the primary area. + /// + public List Primary { get; } = []; + + /// + /// Returns the secondary area. + /// + public List Secondary { get; } = []; + + /// + /// Returns the main panel. + /// + private ControlPanelMain MainPanel { get; } = new ControlPanelMain("webexpress.webapp.content.main") + { + Padding = new PropertySpacingPadding(PropertySpacing.Space.Two, PropertySpacing.Space.Null), + Margin = new PropertySpacingMargin(PropertySpacing.Space.Null, PropertySpacing.Space.Two, PropertySpacing.Space.Null, PropertySpacing.Space.Null), + //BackgroundColor = LayoutSchema.ContentBackground, + Classes = new() { "flex-grow-1" } + }; + + /// + /// Returns the flexbox. + /// + private ControlPanelFlexbox Flexbox { get; } = new ControlPanelFlexbox() + { + Layout = TypeLayoutFlexbox.Default, + Align = TypeAlignFlexbox.Stretch + }; + + /// + /// Returns the page properties. + /// + public ControlWebAppProperty Property { get; } = new ControlWebAppProperty("webexpress.webapp.content.property"); + + /// + /// Returns the toolbar. + /// + public ControlToolbar Toolbar { get; } = new ControlToolbar("webexpress.webapp.content.toolbar"); + + /// + /// Returns the headline control. + /// + public ControlWebAppHeadline Headline { get; } = new ControlWebAppHeadline("webexpress.webapp.content.main.headline"); + + /// + /// Initializes a new instance of the class. + /// + /// The control id. + public ControlWebAppContent(string id = null) + : base(id) + { + //BackgroundColor = LayoutSchema.ContentBackground; + //Toolbar.BackgroundColor = LayoutSchema.ToolbarBackground; + Margin = new PropertySpacingMargin(PropertySpacing.Space.Two); + + Flexbox.Add(MainPanel); + Flexbox.Add(Property); + + Add(Toolbar); + Add(Flexbox); + + Classes.Add("content"); + } + + /// + /// Convert the control to HTML. + /// + /// The context in which the control is rendered. + /// An HTML node representing the rendered control. + public override IHtmlNode Render(IRenderControlContext renderContext) + { + var preferences = WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ); + + var primary = WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ); + + var secondary = WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ); + + var preferencesList = Preferences.Union(preferences).ToList(); + var primaryList = Primary.Union(primary).ToList(); + var secondaryList = Secondary.Union(secondary).ToList(); + + //MainPanel.Content.Clear(); + + MainPanel.Add(Headline); + MainPanel.Add(new ControlPanel("webexpress.webapp.content.main.preferences", preferencesList.ToArray())); + MainPanel.Add(new ControlPanel("webexpress.webapp.content.main.primary", primaryList.ToArray())); + MainPanel.Add(new ControlPanel("webexpress.webapp.content.main.secondary", secondaryList.ToArray())); + + //Content.Clear(); + + if (Toolbar.Items.Any()) + { + Add(Toolbar); + } + + if (Property.Preferences.Any() || Property.Primary.Any() || Property.Secondary.Any()) + { + Add(Flexbox); + } + else + { + Add(MainPanel); + } + + return base.Render(renderContext); + } + } +} diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppFooter.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppFooter.cs index 27e1825..f602425 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppFooter.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppFooter.cs @@ -1,72 +1,88 @@ -//using System.Collections.Generic; -//using System.Linq; -//using WebExpress.WebApp.WebPage; -//using WebExpress.WebCore.WebHtml; -//using WebExpress.WebCore.WebPage; -//using WebExpress.WebUI.WebControl; +using System.Collections.Generic; +using System.Linq; +using WebExpress.WebApp.WebSection; +using WebExpress.WebCore; +using WebExpress.WebCore.WebHtml; +using WebExpress.WebUI.WebControl; +using WebExpress.WebUI.WebFragment; +using WebExpress.WebUI.WebPage; -//namespace WebExpress.WebApp.WebControl -//{ -// /// -// /// Footer for a web app. -// /// -// public class ControlWebAppFooter : Control -// { -// /// -// /// Returns or sets the preferences area. -// /// -// public List Preferences { get; protected set; } = new List(); +namespace WebExpress.WebApp.WebControl +{ + /// + /// Footer for a web app. + /// + public class ControlWebAppFooter : Control + { + /// + /// Returns or sets the preferences area. + /// + public List Preferences { get; protected set; } = []; -// /// -// /// Returns or sets the primary area. -// /// -// public List Primary { get; protected set; } = new List(); + /// + /// Returns or sets the primary area. + /// + public List Primary { get; protected set; } = []; -// /// -// /// Returns or sets the secondary area. -// /// -// public List Secondary { get; protected set; } = new List(); + /// + /// Returns or sets the secondary area. + /// + public List Secondary { get; protected set; } = []; -// /// -// /// Initializes a new instance of the class. -// /// -// /// The control id. -// public ControlWebAppFooter(string id = null) -// : base(id) -// { -// Init(); -// } + /// + /// Initializes a new instance of the class. + /// + /// The control id. + public ControlWebAppFooter(string id = null) + : base(id) + { + //BackgroundColor = LayoutSchema.FooterBackground; + //TextColor = LayoutSchema.FooterText; + } -// /// -// /// Initialization -// /// -// private void Init() -// { -// BackgroundColor = LayoutSchema.FooterBackground; -// TextColor = LayoutSchema.FooterText; -// } + /// + /// Convert the control to HTML. + /// + /// The context in which the control is rendered. + /// An HTML node representing the rendered control. + public override IHtmlNode Render(IRenderControlContext renderContext) + { + var preferences = WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ); -// /// -// /// Convert to html. -// /// -// /// The context in which the control is rendered. -// /// The control as html. -// public override IHtmlNode Render(RenderContext context) -// { -// var elements = new List -// { -// new HtmlElementTextContentDiv(Preferences.Select(x => x.Render(context))), -// new HtmlElementTextContentDiv(Primary.Select(x => x.Render(context))) { Class = "justify-content-center" }, -// new HtmlElementTextContentDiv(Secondary.Select(x => x.Render(context))) -// }; + var primary = WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ); -// return new HtmlElementTextContentDiv(elements) -// { -// Id = Id, -// Class = Css.Concatenate("footer", GetClasses()), -// Style = Style.Concatenate("", GetStyles()), -// Role = Role -// }; -// } -// } -//} + var secondary = WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ); + + var preferencesList = Preferences.Union(preferences).ToList(); + var primaryList = Primary.Union(primary).ToList(); + var secondaryList = Secondary.Union(secondary).ToList(); + + var elements = new List + { + new HtmlElementTextContentDiv(preferencesList.Select(x => x.Render(renderContext)).ToArray()), + new HtmlElementTextContentDiv(primaryList.Select(x => x.Render(renderContext)).ToArray()) { Class = "justify-content-center" }, + new HtmlElementTextContentDiv(secondaryList.Select(x => x.Render(renderContext)).ToArray()) + }; + + return new HtmlElementTextContentDiv(elements.ToArray()) + { + Id = Id, + Class = Css.Concatenate("footer", GetClasses()), + Style = Style.Concatenate("", GetStyles()), + Role = Role + }; + } + } +} diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeader.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeader.cs index 22d3dbd..050a7ee 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeader.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeader.cs @@ -51,35 +51,35 @@ public virtual TypeSticky Sticky { }; - ///// - ///// Returns or sets the navigation of the application. - ///// - //public ControlWebAppHeaderAppNavigation AppNavigation { get; } = new ControlWebAppHeaderAppNavigation("webexpress.webapp.header.appnavigation") - //{ - // Layout = TypeLayoutFlexbox.Inline, - // Justify = TypeJustifiedFlexbox.Start - //}; + /// + /// Returns or sets the navigation of the application. + /// + public ControlWebAppHeaderAppNavigation AppNavigation { get; } = new ControlWebAppHeaderAppNavigation("webexpress.webapp.header.appnavigation") + { + Layout = TypeLayoutFlexbox.Inline, + Justify = TypeJustifiedFlexbox.Start + }; - ///// - ///// Returns or sets the quick create. - ///// - //public ControlWebAppHeaderQuickCreate QuickCreate { get; } = new ControlWebAppHeaderQuickCreate("webexpress.webapp.header.quickcreate") - //{ - //}; + /// + /// Returns or sets the quick create. + /// + public ControlWebAppHeaderQuickCreate QuickCreate { get; } = new ControlWebAppHeaderQuickCreate("webexpress.webapp.header.quickcreate") + { + }; - ///// - ///// Returns or sets the navigation of the application helpers. - ///// - //public ControlWebAppHeaderHelp Help { get; } = new ControlWebAppHeaderHelp("webexpress.webapp.header.help") - //{ - //}; + /// + /// Returns or sets the navigation of the application helpers. + /// + public ControlWebAppHeaderHelp Help { get; } = new ControlWebAppHeaderHelp("webexpress.webapp.header.help") + { + }; - ///// - ///// Returns or sets the navigation of the application settings. - ///// - //public ControlWebAppHeaderSettings Settings { get; } = new ControlWebAppHeaderSettings("webexpress.webapp.header.settings") - //{ - //}; + /// + /// Returns or sets the navigation of the application settings. + /// + public ControlWebAppHeaderSettings Settings { get; } = new ControlWebAppHeaderSettings("webexpress.webapp.header.settings") + { + }; /// /// Initializes a new instance of the class. @@ -105,12 +105,12 @@ public override IHtmlNode Render(IRenderControlContext renderContext) ( null, AppNavigator, - AppTitle//, - //AppNavigation, - //QuickCreate, - //new ControlPanel() { Margin = new PropertySpacingMargin(PropertySpacing.Space.Auto, PropertySpacing.Space.None) }, - //Help, - //Settings + AppTitle, + AppNavigation, + QuickCreate, + new ControlPanel() { Margin = new PropertySpacingMargin(PropertySpacing.Space.Auto, PropertySpacing.Space.None) }, + Help, + Settings ) { Layout = TypeLayoutFlexbox.Default, diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigation.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigation.cs index c648a60..de311f0 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigation.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigation.cs @@ -1,88 +1,100 @@ -//using System.Collections.Generic; -//using WebExpress.WebCore.WebHtml; -//using WebExpress.WebCore.WebPage; -//using WebExpress.WebApp.WebPage; -//using WebExpress.WebUI.WebControl; +using System.Collections.Generic; +using System.Linq; +using WebExpress.WebApp.WebSection; +using WebExpress.WebCore; +using WebExpress.WebCore.WebHtml; +using WebExpress.WebUI.WebControl; +using WebExpress.WebUI.WebFragment; +using WebExpress.WebUI.WebPage; -//namespace WebExpress.WebApp.WebControl -//{ -// /// -// /// Header for a web app. -// /// -// public class ControlWebAppHeaderAppNavigation : ControlPanelFlexbox -// { -// /// -// /// Returns or sets the preferences area. -// /// -// public List Preferences { get; protected set; } = new List(); +namespace WebExpress.WebApp.WebControl +{ + /// + /// Header for a web app. + /// + public class ControlWebAppHeaderAppNavigation : ControlPanelFlexbox + { + /// + /// Returns or sets the preferences area. + /// + public IEnumerable Preferences { get; protected set; } = []; -// /// -// /// Returns or sets the primary area. -// /// -// public List Primary { get; protected set; } = new List(); + /// + /// Returns or sets the primary area. + /// + public IEnumerable Primary { get; protected set; } = []; -// /// -// /// Returns or sets the secondary area. -// /// -// public List Secondary { get; protected set; } = new List(); + /// + /// Returns or sets the secondary area. + /// + public IEnumerable Secondary { get; protected set; } = []; -// /// -// /// Initializes a new instance of the class. -// /// -// /// The control id. -// public ControlWebAppHeaderAppNavigation(string id = null) -// : base(id) -// { -// Init(); -// } + /// + /// Initializes a new instance of the class. + /// + /// The control id. + public ControlWebAppHeaderAppNavigation(string id = null) + : base(id) + { + Padding = new PropertySpacingPadding(PropertySpacing.Space.Null); + } -// /// -// /// Initialization -// /// -// private void Init() -// { -// Padding = new PropertySpacingPadding(PropertySpacing.Space.Null); -// } + /// + /// Convert the control to HTML. + /// + /// The context in which the control is rendered. + /// An HTML node representing the rendered control. + public override IHtmlNode Render(IRenderControlContext renderContext) + { + var preferences = WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ); -// /// -// /// Convert to html. -// /// -// /// The context in which the control is rendered. -// /// The control as html. -// public override IHtmlNode Render(RenderContext context) -// { + var preferencesCtrl = new ControlNavigation("webexpress.webapp.header.appnavigation.preferences", Preferences.Union(preferences).ToArray()) + { + Layout = TypeLayoutTab.Default, + //ActiveColor = LayoutSchema.HeaderNavigationActiveBackground, + //ActiveTextColor = LayoutSchema.HeaderNavigationActive, + //LinkColor = LayoutSchema.HeaderNavigationLink + }; -// var preferences = new ControlNavigation("webexpress.webapp.header.appnavigation.preferences", Preferences) -// { -// Layout = TypeLayoutTab.Default, -// ActiveColor = LayoutSchema.HeaderNavigationActiveBackground, -// ActiveTextColor = LayoutSchema.HeaderNavigationActive, -// LinkColor = LayoutSchema.HeaderNavigationLink -// }; + var primary = WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ); -// var primary = new ControlNavigation("webexpress.webapp.header.appnavigation.primary", Primary) -// { -// Layout = TypeLayoutTab.Default, -// ActiveColor = LayoutSchema.HeaderNavigationActiveBackground, -// ActiveTextColor = LayoutSchema.HeaderNavigationActive, -// LinkColor = LayoutSchema.HeaderNavigationLink -// }; + var primaryCtrl = new ControlNavigation("webexpress.webapp.header.appnavigation.primary", Primary.Union(primary).ToArray()) + { + Layout = TypeLayoutTab.Default, + //ActiveColor = LayoutSchema.HeaderNavigationActiveBackground, + //ActiveTextColor = LayoutSchema.HeaderNavigationActive, + //LinkColor = LayoutSchema.HeaderNavigationLink + }; -// var secondary = new ControlNavigation("webexpress.webapp.header.appnavigation.secondary", Secondary) -// { -// Layout = TypeLayoutTab.Default, -// ActiveColor = LayoutSchema.HeaderNavigationActiveBackground, -// ActiveTextColor = LayoutSchema.HeaderNavigationActive, -// LinkColor = LayoutSchema.HeaderNavigationLink -// }; + var secondary = WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ); -// return new HtmlElementTextContentDiv(preferences.Render(context), primary.Render(context), secondary.Render(context)) -// { -// Id = Id, -// Class = Css.Concatenate("", GetClasses()), -// Style = Style.Concatenate("", GetStyles()), -// Role = Role -// }; -// } -// } -//} + var secondaryCtrl = new ControlNavigation("webexpress.webapp.header.appnavigation.secondary", Secondary.Union(secondary).ToArray()) + { + Layout = TypeLayoutTab.Default, + //ActiveColor = LayoutSchema.HeaderNavigationActiveBackground, + //ActiveTextColor = LayoutSchema.HeaderNavigationActive, + //LinkColor = LayoutSchema.HeaderNavigationLink + }; + + return new HtmlElementTextContentDiv(preferencesCtrl.Render(renderContext), primaryCtrl.Render(renderContext), secondaryCtrl.Render(renderContext)) + { + Id = Id, + Class = Css.Concatenate("", GetClasses()), + Style = Style.Concatenate("", GetStyles()), + Role = Role + }; + } + } +} diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigator.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigator.cs index b63ca7c..9c1b5e0 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigator.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigator.cs @@ -1,8 +1,11 @@ using System.Collections.Generic; using System.Linq; +using WebExpress.WebApp.WebSection; +using WebExpress.WebCore; using WebExpress.WebCore.Internationalization; using WebExpress.WebCore.WebHtml; using WebExpress.WebUI.WebControl; +using WebExpress.WebUI.WebFragment; using WebExpress.WebUI.WebPage; namespace WebExpress.WebApp.WebControl @@ -12,20 +15,24 @@ namespace WebExpress.WebApp.WebControl /// public class ControlWebAppHeaderAppNavigator : Control { + private readonly List _preferences = []; + private readonly List _primary = []; + private readonly List _secondary = []; + /// /// Returns or sets the preferences area. /// - public IEnumerable Preferences { get; protected set; } = []; + public IEnumerable Preferences => _preferences; /// /// Returns or sets the primary area. /// - public IEnumerable Primary { get; protected set; } = []; + public IEnumerable Primary => _primary; /// /// Returns or sets the secondary area. /// - public IEnumerable Secondary { get; protected set; } = []; + public IEnumerable Secondary => _secondary; /// /// Initializes a new instance of the class. @@ -37,12 +44,88 @@ public ControlWebAppHeaderAppNavigator(string id = null) Padding = new PropertySpacingPadding(PropertySpacing.Space.Null); } + /// + /// Adds items to the preferences area. + /// + /// The items to add to the preferences area. + public void AddPreferences(params IControlDropdownItem[] items) + { + _preferences.AddRange(items); + } + + /// + /// Removes an item from the preferences area. + /// + /// The item to remove from the preferences area. + public void RemovePreference(IControlDropdownItem item) + { + _preferences.Remove(item); + } + + /// + /// Adds items to the primary area. + /// + /// The items to add to the primary area. + public void AddPrimary(params IControlDropdownItem[] items) + { + _primary.AddRange(items); + } + + /// + /// Removes an item from the primary area. + /// + /// The item to remove from the primary area. + public void RemovePrimary(IControlDropdownItem item) + { + _primary.Remove(item); + } + + /// + /// Adds items to the secondary area. + /// + /// The items to add to the secondary area. + public void AddSecondary(params IControlDropdownItem[] items) + { + _secondary.AddRange(items); + } + + /// + /// Removes an item from the secondary area. + /// + /// The item to remove from the secondary area. + public void RemoveSecondary(IControlDropdownItem item) + { + _secondary.Remove(item); + } + /// /// Convert the control to HTML. /// /// The context in which the control is rendered. /// An HTML node representing the rendered control. public override IHtmlNode Render(IRenderControlContext renderContext) + { + var preferences = WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ); + + return Render(renderContext, _preferences.Union(preferences), _primary, _secondary); + } + + /// + /// Convert the control to HTML. + /// + /// The context in which the control is rendered. + /// An HTML node representing the rendered control. + public virtual IHtmlNode Render + ( + IRenderControlContext renderContext, + IEnumerable preferences, + IEnumerable primary, + IEnumerable secondary + ) { var application = renderContext?.PageContext?.ApplicationContext; @@ -51,14 +134,21 @@ public override IHtmlNode Render(IRenderControlContext renderContext) new ControlDropdownItemHeader() { Text = I18N.Translate(renderContext.Request.Culture, application?.ApplicationName) } }; - hamburger.AddRange(Primary); + hamburger.AddRange(preferences); + + if (preferences.Any() && primary.Any()) + { + hamburger.Add(new ControlDropdownItemDivider()); + } + + hamburger.AddRange(primary); - if (Primary.Count() > 0 && Secondary.Count() > 0) + if (primary.Any() && secondary.Any()) { hamburger.Add(new ControlDropdownItemDivider()); } - hamburger.AddRange(Secondary); + hamburger.AddRange(secondary); var logo = (hamburger.Count > 1) ? (IControl)new ControlDropdown(Id, hamburger.ToArray()) diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderHelp.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderHelp.cs index 8c44091..3117198 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderHelp.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderHelp.cs @@ -1,86 +1,104 @@ -//using System.Collections.Generic; -//using WebExpress.WebCore.Internationalization; -//using WebExpress.WebCore.WebHtml; -//using WebExpress.WebCore.WebPage; -//using WebExpress.WebUI.WebControl; +using System.Collections.Generic; +using System.Linq; +using WebExpress.WebApp.WebSection; +using WebExpress.WebCore; +using WebExpress.WebCore.Internationalization; +using WebExpress.WebCore.WebHtml; +using WebExpress.WebUI.WebControl; +using WebExpress.WebUI.WebFragment; +using WebExpress.WebUI.WebPage; -//namespace WebExpress.WebApp.WebControl -//{ -// /// -// /// Help control for a WebApp. -// /// -// public class ControlWebAppHeaderHelp : Control -// { -// /// -// /// Returns or sets the preferences area. -// /// -// public List Preferences { get; protected set; } = new List(); +namespace WebExpress.WebApp.WebControl +{ + /// + /// Help control for a WebApp. + /// + public class ControlWebAppHeaderHelp : Control + { + /// + /// Returns or sets the preferences area. + /// + public List Preferences { get; protected set; } = []; -// /// -// /// Returns or sets the primary area. -// /// -// public List Primary { get; protected set; } = new List(); + /// + /// Returns or sets the primary area. + /// + public List Primary { get; protected set; } = []; -// /// -// /// Returns or sets the secondary area. -// /// -// public List Secondary { get; protected set; } = new List(); + /// + /// Returns or sets the secondary area. + /// + public List Secondary { get; protected set; } = []; -// /// -// /// Initializes a new instance of the class. -// /// -// /// The controls id. -// public ControlWebAppHeaderHelp(string id = null) -// : base(id) -// { -// Init(); -// } + /// + /// Initializes a new instance of the class. + /// + /// The controls id. + public ControlWebAppHeaderHelp(string id = null) + : base(id) + { + Padding = new PropertySpacingPadding(PropertySpacing.Space.Null); + } -// /// -// /// Initialization -// /// -// private void Init() -// { -// Padding = new PropertySpacingPadding(PropertySpacing.Space.Null); -// } + /// + /// Convert the control to HTML. + /// + /// The context in which the control is rendered. + /// An HTML node representing the rendered control. + public override IHtmlNode Render(IRenderControlContext renderContext) + { + var preferences = WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ); -// /// -// /// Convert to html. -// /// -// /// The context in which the control is rendered. -// /// The control as html. -// public override IHtmlNode Render(RenderContext context) -// { -// var helpList = new List -// { -// new ControlDropdownItemHeader() { Text = context.I18N("webexpress.webapp", "header.help.label") } -// }; + var primary = WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ); -// helpList.AddRange(Preferences); -// if (Preferences.Count > 0 && Primary.Count > 0) -// { -// helpList.Add(new ControlDropdownItemDivider()); -// } + var secondary = WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ); -// helpList.AddRange(Primary); -// if (Primary.Count > 0 && Secondary.Count > 0) -// { -// helpList.Add(new ControlDropdownItemDivider()); -// } + var helpList = new List + { + new ControlDropdownItemHeader() { Text = I18N.Translate(renderContext.Request?.Culture, "webexpress.webapp:header.help.label") } + }; -// helpList.AddRange(Secondary); + var preferencesList = Preferences.Union(preferences).ToList(); + var primaryList = Primary.Union(primary).ToList(); + var secondaryList = Secondary.Union(secondary).ToList(); -// var help = (helpList.Count > 1) ? -// new ControlDropdown(Id, helpList) -// { -// Icon = new PropertyIcon(TypeIcon.InfoCircle), -// AlignmentMenu = TypeAlignmentDropdownMenu.Right, -// BackgroundColor = new PropertyColorButton(TypeColorButton.Dark), -// Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.None, PropertySpacing.Space.None) -// } : -// null; + helpList.AddRange(preferencesList); + if (preferencesList.Count > 0 && primaryList.Count > 0) + { + helpList.Add(new ControlDropdownItemDivider()); + } -// return help?.Render(context); -// } -// } -//} + helpList.AddRange(primaryList); + if (primaryList.Count > 0 && secondaryList.Count > 0) + { + helpList.Add(new ControlDropdownItemDivider()); + } + + helpList.AddRange(secondaryList); + + var help = (helpList.Count > 1) ? + new ControlDropdown(Id, helpList.ToArray()) + { + Icon = new PropertyIcon(TypeIcon.InfoCircle), + AlignmentMenu = TypeAlignmentDropdownMenu.Right, + BackgroundColor = new PropertyColorButton(TypeColorButton.Dark), + Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.None, PropertySpacing.Space.None) + } : + null; + + return help?.Render(renderContext); + } + } +} diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderQuickCreate.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderQuickCreate.cs index 0834224..d9f61d6 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderQuickCreate.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderQuickCreate.cs @@ -1,90 +1,102 @@ -//using System.Collections.Generic; -//using System.Linq; -//using WebExpress.WebCore.Internationalization; -//using WebExpress.WebCore.WebHtml; -//using WebExpress.WebCore.WebPage; -//using WebExpress.WebApp.WebPage; -//using WebExpress.WebUI.WebControl; +using System.Collections.Generic; +using System.Linq; +using WebExpress.WebApp.WebSection; +using WebExpress.WebCore; +using WebExpress.WebCore.Internationalization; +using WebExpress.WebCore.WebHtml; +using WebExpress.WebUI.WebControl; +using WebExpress.WebUI.WebFragment; +using WebExpress.WebUI.WebPage; -//namespace WebExpress.WebApp.WebControl -//{ -// /// -// /// Quick create control element for a WebApp. -// /// -// public class ControlWebAppHeaderQuickCreate : Control -// { -// /// -// /// Returns or sets the preferences area. -// /// -// public List Preferences { get; protected set; } = new List(); +namespace WebExpress.WebApp.WebControl +{ + /// + /// Quick create control element for a WebApp. + /// + public class ControlWebAppHeaderQuickCreate : Control + { + /// + /// Returns or sets the preferences area. + /// + public List Preferences { get; protected set; } = new List(); -// /// -// /// Returns or sets the primary area. -// /// -// public List Primary { get; protected set; } = new List(); + /// + /// Returns or sets the primary area. + /// + public List Primary { get; protected set; } = new List(); -// /// -// /// Returns or sets the secondary area. -// /// -// public List Secondary { get; protected set; } = new List(); + /// + /// Returns or sets the secondary area. + /// + public List Secondary { get; protected set; } = new List(); -// /// -// /// Initializes a new instance of the class. -// /// -// /// The control id. -// public ControlWebAppHeaderQuickCreate(string id = null) -// : base(id) -// { -// Init(); -// } + /// + /// Initializes a new instance of the class. + /// + /// The control id. + public ControlWebAppHeaderQuickCreate(string id = null) + : base(id) + { + Padding = new PropertySpacingPadding(PropertySpacing.Space.Null); + } -// /// -// /// Initialization -// /// -// private void Init() -// { -// Padding = new PropertySpacingPadding(PropertySpacing.Space.Null); -// } + /// + /// Convert the control to HTML. + /// + /// The context in which the control is rendered. + /// An HTML node representing the rendered control. + public override IHtmlNode Render(IRenderControlContext renderContext) + { + var preferences = WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ); -// /// -// /// Convert to html. -// /// -// /// The context in which the control is rendered. -// /// The control as html. -// public override IHtmlNode Render(RenderContext context) -// { -// var quickcreateList = new List(Preferences); -// quickcreateList.AddRange(Primary); -// quickcreateList.AddRange(Secondary); + var primary = WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ); -// var firstQuickcreate = (quickcreateList.FirstOrDefault() as ControlLink); -// firstQuickcreate?.Render(context); + var secondary = WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ); -// var quickcreate = (quickcreateList.Count > 1) ? -// (IControl)new ControlSplitButtonLink(Id, quickcreateList.Skip(1)) -// { -// Text = context.I18N("webexpress.webapp", "header.quickcreate.label"), -// Uri = firstQuickcreate?.Uri, -// BackgroundColor = LayoutSchema.HeaderQuickCreateButtonBackground, -// Size = LayoutSchema.HeaderQuickCreateButtonSize, -// Margin = new PropertySpacingMargin(PropertySpacing.Space.Auto, PropertySpacing.Space.None), -// OnClick = firstQuickcreate?.OnClick, -// Modal = firstQuickcreate?.Modal -// } : -// (Preferences.Count > 0) ? -// new ControlButtonLink(Id) -// { -// Text = context.I18N("webexpress.webapp", "header.quickcreate.label"), -// Uri = firstQuickcreate?.Uri, -// BackgroundColor = LayoutSchema.HeaderQuickCreateButtonBackground, -// Size = LayoutSchema.HeaderQuickCreateButtonSize, -// Margin = new PropertySpacingMargin(PropertySpacing.Space.Auto, PropertySpacing.Space.None), -// OnClick = firstQuickcreate?.OnClick, -// Modal = firstQuickcreate?.Modal -// } : -// null; + var quickcreateList = new List(Preferences.Union(preferences)); + quickcreateList.AddRange(Primary.Union(primary)); + quickcreateList.AddRange(Secondary.Union(secondary)); -// return quickcreate?.Render(context); -// } -// } -//} + var firstQuickcreate = (quickcreateList.FirstOrDefault() as ControlLink); + firstQuickcreate?.Render(renderContext); + + var quickcreate = (quickcreateList.Count > 1) ? + (IControl)new ControlSplitButtonLink(Id, quickcreateList.Skip(1).ToArray()) + { + Text = I18N.Translate(renderContext.Request?.Culture, "webexpress.webapp:header.quickcreate.label"), + Uri = firstQuickcreate?.Uri, + //BackgroundColor = LayoutSchema.HeaderQuickCreateButtonBackground, + //Size = LayoutSchema.HeaderQuickCreateButtonSize, + Margin = new PropertySpacingMargin(PropertySpacing.Space.Auto, PropertySpacing.Space.None), + OnClick = firstQuickcreate?.OnClick, + Modal = firstQuickcreate?.Modal + } : + (Preferences.Count > 0) ? + new ControlButtonLink(Id) + { + Text = I18N.Translate(renderContext.Request?.Culture, "webexpress.webapp:header.quickcreate.label"), + Uri = firstQuickcreate?.Uri, + //BackgroundColor = LayoutSchema.HeaderQuickCreateButtonBackground, + //Size = LayoutSchema.HeaderQuickCreateButtonSize, + //Margin = new PropertySpacingMargin(PropertySpacing.Space.Auto, PropertySpacing.Space.None), + OnClick = firstQuickcreate?.OnClick, + Modal = firstQuickcreate?.Modal + } : + null; + + return quickcreate?.Render(renderContext); + } + } +} diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs index d0c3ca4..d5243fe 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs @@ -1,86 +1,104 @@ -//using System.Collections.Generic; -//using WebExpress.WebCore.Internationalization; -//using WebExpress.WebCore.WebHtml; -//using WebExpress.WebCore.WebPage; -//using WebExpress.WebUI.WebControl; +using System.Collections.Generic; +using System.Linq; +using WebExpress.WebApp.WebSection; +using WebExpress.WebCore; +using WebExpress.WebCore.Internationalization; +using WebExpress.WebCore.WebHtml; +using WebExpress.WebUI.WebControl; +using WebExpress.WebUI.WebFragment; +using WebExpress.WebUI.WebPage; -//namespace WebExpress.WebApp.WebControl -//{ -// /// -// /// Settings controls for a web app. -// /// -// public class ControlWebAppHeaderSettings : Control -// { -// /// -// /// Returns or sets the preferences area. -// /// -// public List Preferences { get; protected set; } = new List(); +namespace WebExpress.WebApp.WebControl +{ + /// + /// Settings controls for a web app. + /// + public class ControlWebAppHeaderSettings : Control + { + /// + /// Returns or sets the preferences area. + /// + public List Preferences { get; protected set; } = new List(); -// /// -// /// Returns or sets the primary area. -// /// -// public List Primary { get; protected set; } = new List(); + /// + /// Returns or sets the primary area. + /// + public List Primary { get; protected set; } = new List(); -// /// -// /// Returns or sets the secondary area. -// /// -// public List Secondary { get; protected set; } = new List(); + /// + /// Returns or sets the secondary area. + /// + public List Secondary { get; protected set; } = new List(); -// /// -// /// Initializes a new instance of the class. -// /// -// /// The control id. -// public ControlWebAppHeaderSettings(string id = null) -// : base(id) -// { -// Init(); -// } + /// + /// Initializes a new instance of the class. + /// + /// The control id. + public ControlWebAppHeaderSettings(string id = null) + : base(id) + { + Padding = new PropertySpacingPadding(PropertySpacing.Space.Null); + } -// /// -// /// Initialization -// /// -// private void Init() -// { -// Padding = new PropertySpacingPadding(PropertySpacing.Space.Null); -// } + /// + /// Convert the control to HTML. + /// + /// The context in which the control is rendered. + /// An HTML node representing the rendered control. + public override IHtmlNode Render(IRenderControlContext renderContext) + { + var preferences = WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ); -// /// -// /// Convert to html. -// /// -// /// The context in which the control is rendered. -// /// The control as html. -// public override IHtmlNode Render(RenderContext context) -// { -// var settingsList = new List -// { -// new ControlDropdownItemHeader() { Text = context.I18N("webexpress.webapp", "header.setting.label") } -// }; + var primary = WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ); -// settingsList.AddRange(Preferences); -// if (Preferences.Count > 0 && Primary.Count > 0) -// { -// settingsList.Add(new ControlDropdownItemDivider()); -// } + var secondary = WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ); -// settingsList.AddRange(Primary); -// if (Primary.Count > 0 && Secondary.Count > 0) -// { -// settingsList.Add(new ControlDropdownItemDivider()); -// } + var settingsList = new List + { + new ControlDropdownItemHeader() { Text = I18N.Translate(renderContext.Request?.Culture, "webexpress.webapp:header.setting.label") } + }; -// settingsList.AddRange(Secondary); + var preferencesList = Preferences.Union(preferences).ToList(); + var primaryList = Primary.Union(primary).ToList(); + var secondaryList = Secondary.Union(secondary).ToList(); -// var settings = (settingsList.Count > 1) ? -// new ControlDropdown(Id, settingsList) -// { -// Icon = new PropertyIcon(TypeIcon.Cog), -// AlignmentMenu = TypeAlignmentDropdownMenu.Right, -// BackgroundColor = new PropertyColorButton(TypeColorButton.Dark), -// Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.None, PropertySpacing.Space.None) -// } : -// null; + settingsList.AddRange(preferencesList); + if (preferencesList.Count > 0 && primaryList.Count > 0) + { + settingsList.Add(new ControlDropdownItemDivider()); + } -// return settings?.Render(context); -// } -// } -//} + settingsList.AddRange(primaryList); + if (primaryList.Count > 0 && secondaryList.Count > 0) + { + settingsList.Add(new ControlDropdownItemDivider()); + } + + settingsList.AddRange(secondaryList); + + var settings = (settingsList.Count > 1) ? + new ControlDropdown(Id, settingsList.ToArray()) + { + Icon = new PropertyIcon(TypeIcon.Cog), + AlignmentMenu = TypeAlignmentDropdownMenu.Right, + BackgroundColor = new PropertyColorButton(TypeColorButton.Dark), + Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.None, PropertySpacing.Space.None) + } : + null; + + return settings?.Render(renderContext); + } + } +} diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeadline.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeadline.cs index c0d2eaf..86cd758 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeadline.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeadline.cs @@ -1,166 +1,194 @@ -//using System.Collections.Generic; -//using System.Linq; -//using WebExpress.WebCore.WebHtml; -//using WebExpress.WebCore.WebPage; -//using WebExpress.WebApp.WebPage; -//using WebExpress.WebUI.WebControl; -//using static WebExpress.WebCore.Internationalization.InternationalizationManager; - -//namespace WebExpress.WebApp.WebControl -//{ -// /// -// /// Headline for an web app. -// /// -// public class ControlWebAppHeadline : Control -// { -// /// -// /// Returns or sets the prologue area. -// /// -// public List Prologue { get; protected set; } = new List(); - -// /// -// /// Returns or sets the preferences area. -// /// -// public List Preferences { get; protected set; } = new List(); - -// /// -// /// Returns or sets the primary area. -// /// -// public List Primary { get; protected set; } = new List(); - -// /// -// /// Returns or sets the secondary area. -// /// -// public List Secondary { get; protected set; } = new List(); - -// /// -// /// Returns or sets the preferences area for the more control. -// /// -// public List MorePreferences { get; protected set; } = new List(); - -// /// -// /// Returns or sets the primary area for the more control. -// /// -// public List MorePrimary { get; protected set; } = new List(); - -// /// -// /// Returns or sets the secondary area for the more control. -// /// -// public List MoreSecondary { get; protected set; } = new List(); - -// /// -// /// Returns or sets the secondary area for the metadata. -// /// -// public List Metadata { get; protected set; } = new List(); - -// /// -// /// Initializes a new instance of the class. -// /// -// /// The control id. -// public ControlWebAppHeadline(string id = null) -// : base(id) -// { -// Init(); -// } - -// /// -// /// Initialization -// /// -// private void Init() -// { -// BackgroundColor = LayoutSchema.HeadlineBackground; -// } - -// /// -// /// Convert to html. -// /// -// /// The context in which the control is rendered. -// /// The control as html. -// public override IHtmlNode Render(RenderContext context) -// { -// var prologue = new ControlPanelFlexbox(Prologue) { Layout = TypeLayoutFlexbox.Default, Align = TypeAlignFlexbox.Center, Justify = TypeJustifiedFlexbox.Start }; -// prologue.Content.Add(new ControlText() -// { -// Text = I18N(context.Culture, context.Page.Title), -// TextColor = LayoutSchema.HeadlineTitle, -// Format = TypeFormatText.H2, -// Padding = new PropertySpacingPadding(PropertySpacing.Space.One), -// Margin = new PropertySpacingMargin(PropertySpacing.Space.None, PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.Null) -// }); -// prologue.Content.AddRange(Preferences); - -// var epilog = new ControlPanelFlexbox(Secondary) { Layout = TypeLayoutFlexbox.Default, Align = TypeAlignFlexbox.Center, Justify = TypeJustifiedFlexbox.End }; -// if (MorePreferences.Count() > 0 || MorePrimary.Count() > 0 || MoreSecondary.Count() > 0) -// { -// var more = new ControlDropdown("more") -// { -// Title = I18N(context.Culture, "webexpress.webapp", "headline.more.title"), -// Icon = new PropertyIcon(TypeIcon.EllipsisHorizontal), -// TextColor = LayoutSchema.HeadlineTitle, -// Padding = new PropertySpacingPadding(PropertySpacing.Space.One), -// Margin = new PropertySpacingMargin(PropertySpacing.Space.None, PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.Null) -// }; - -// foreach (var v in MorePreferences) -// { -// more.Add(v); -// } - -// if (MorePreferences.Count > 0 && (MorePrimary.Count > 0 || MoreSecondary.Count > 0)) -// { -// more.AddSeperator(); -// } - -// foreach (var v in MorePrimary) -// { -// more.Add(v); -// } - -// if (MorePrimary.Count() > 0 && MoreSecondary.Count > 0) -// { -// more.AddSeperator(); -// } - -// foreach (var v in MoreSecondary) -// { -// more.Add(v); -// } - -// epilog.Content.Add(more); -// } - -// var content = new ControlPanelFlexbox -// ( -// prologue, -// new ControlPanelFlexbox(Primary) { Layout = TypeLayoutFlexbox.Default, Align = TypeAlignFlexbox.Center, Justify = TypeJustifiedFlexbox.End }, -// epilog -// ) -// { -// Layout = TypeLayoutFlexbox.Default, -// Align = TypeAlignFlexbox.Center, -// Justify = TypeJustifiedFlexbox.Between -// }; - -// var metadata = new HtmlElementTextContentDiv -// ( -// Metadata.Select(x => x.Render(context)) -// ) -// { -// Class = Css.Concatenate("ms-2 me-2 mb-3 text-secondary"), -// Style = Style.Concatenate("font-size:0.75rem;") -// }; - -// return new HtmlElementSectionHeader -// ( -// content.Render(context), -// Metadata.Count > 0 ? metadata : null -// ) -// { -// Id = Id, -// Class = Css.Concatenate("", GetClasses()), -// Style = Style.Concatenate("display: block;", GetStyles()), -// Role = Role -// }; -// } -// } -//} +using System.Collections.Generic; +using System.Linq; +using WebExpress.WebApp.WebSection; +using WebExpress.WebCore; +using WebExpress.WebCore.Internationalization; +using WebExpress.WebCore.WebHtml; +using WebExpress.WebUI.WebControl; +using WebExpress.WebUI.WebFragment; +using WebExpress.WebUI.WebPage; + +namespace WebExpress.WebApp.WebControl +{ + /// + /// Headline for an web app. + /// + public class ControlWebAppHeadline : Control + { + /// + /// Returns or sets the prologue area. + /// + public List Prologue { get; protected set; } = []; + + /// + /// Returns or sets the preferences area. + /// + public List Preferences { get; protected set; } = []; + + /// + /// Returns or sets the primary area. + /// + public List Primary { get; protected set; } = []; + + /// + /// Returns or sets the secondary area. + /// + public List Secondary { get; protected set; } = []; + + /// + /// Returns or sets the preferences area for the more control. + /// + public List MorePreferences { get; protected set; } = []; + + /// + /// Returns or sets the primary area for the more control. + /// + public List MorePrimary { get; protected set; } = []; + + /// + /// Returns or sets the secondary area for the more control. + /// + public List MoreSecondary { get; protected set; } = []; + + /// + /// Returns or sets the secondary area for the metadata. + /// + public List Metadata { get; protected set; } = []; + + /// + /// Initializes a new instance of the class. + /// + /// The control id. + public ControlWebAppHeadline(string id = null) + : base(id) + { + // BackgroundColor = LayoutSchema.HeadlineBackground; + } + + /// + /// Convert the control to HTML. + /// + /// The context in which the control is rendered. + /// An HTML node representing the rendered control. + public override IHtmlNode Render(IRenderControlContext renderContext) + { + var preferences = WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ); + + var primary = WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ); + + var secondary = WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ); + + var preferencesList = Preferences.Union(preferences).ToList(); + var primaryList = Primary.Union(primary).ToList(); + var secondaryList = Secondary.Union(secondary).ToList(); + + var prologue = new ControlPanelFlexbox(null, Prologue.ToArray()) { Layout = TypeLayoutFlexbox.Default, Align = TypeAlignFlexbox.Center, Justify = TypeJustifiedFlexbox.Start }; + prologue.Add(new ControlText() + { + Text = I18N.Translate(renderContext.Request?.Culture, renderContext.PageContext?.PageTitle), + //TextColor = LayoutSchema.HeadlineTitle, + Format = TypeFormatText.H2, + Padding = new PropertySpacingPadding(PropertySpacing.Space.One), + Margin = new PropertySpacingMargin(PropertySpacing.Space.None, PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.Null) + }); + prologue.Add(Preferences); + + var epilog = new ControlPanelFlexbox(null, secondaryList.ToArray()) + { + Layout = TypeLayoutFlexbox.Default, + Align = TypeAlignFlexbox.Center, + Justify = TypeJustifiedFlexbox.End + }; + + if (MorePreferences.Count() > 0 || MorePrimary.Count() > 0 || MoreSecondary.Count() > 0) + { + var more = new ControlDropdown("more") + { + Text = I18N.Translate(renderContext.Request?.Culture, "webexpress.webapp:headline.more.title"), + Icon = new PropertyIcon(TypeIcon.EllipsisHorizontal), + //TextColor = LayoutSchema.HeadlineTitle, + Padding = new PropertySpacingPadding(PropertySpacing.Space.One), + Margin = new PropertySpacingMargin(PropertySpacing.Space.None, PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.Null) + }; + + foreach (var v in MorePreferences) + { + more.Add(v); + } + + if (MorePreferences.Count > 0 && (MorePrimary.Count > 0 || MoreSecondary.Count > 0)) + { + more.AddSeperator(); + } + + foreach (var v in MorePrimary) + { + more.Add(v); + } + + if (MorePrimary.Count() > 0 && MoreSecondary.Count > 0) + { + more.AddSeperator(); + } + + foreach (var v in MoreSecondary) + { + more.Add(v); + } + + epilog.Add(more); + } + + var content = new ControlPanelFlexbox + ( + null, + prologue, + new ControlPanelFlexbox(null, primaryList.ToArray()) + { + Layout = TypeLayoutFlexbox.Default, + Align = TypeAlignFlexbox.Center, + Justify = TypeJustifiedFlexbox.End + }, + epilog + ) + { + Layout = TypeLayoutFlexbox.Default, + Align = TypeAlignFlexbox.Center, + Justify = TypeJustifiedFlexbox.Between + }; + + var metadata = new HtmlElementTextContentDiv + ( + Metadata.Select(x => x.Render(renderContext)).ToArray() + ) + { + Class = Css.Concatenate("ms-2 me-2 mb-3 text-secondary"), + Style = Style.Concatenate("font-size:0.75rem;") + }; + + return new HtmlElementSectionHeader + ( + content.Render(renderContext), + Metadata.Count > 0 ? metadata : null + ) + { + Id = Id, + Class = Css.Concatenate("", GetClasses()), + Style = Style.Concatenate("display: block;", GetStyles()), + Role = Role + }; + } + } +} diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppProperty.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppProperty.cs index 19275f3..0e44f0f 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppProperty.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppProperty.cs @@ -1,73 +1,89 @@ -//using System.Collections.Generic; -//using System.Linq; -//using WebExpress.WebCore.WebHtml; -//using WebExpress.WebCore.WebPage; -//using WebExpress.WebApp.WebPage; -//using WebExpress.WebUI.WebControl; +using System.Collections.Generic; +using System.Linq; +using WebExpress.WebApp.WebSection; +using WebExpress.WebCore; +using WebExpress.WebCore.WebHtml; +using WebExpress.WebUI.WebControl; +using WebExpress.WebUI.WebFragment; +using WebExpress.WebUI.WebPage; -//namespace WebExpress.WebApp.WebControl -//{ -// /// -// /// Properties for a web app. -// /// -// public class ControlWebAppProperty : Control -// { -// /// -// /// Returns or sets the preferences area. -// /// -// public List Preferences { get; protected set; } = new List(); +namespace WebExpress.WebApp.WebControl +{ + /// + /// Properties for a web app. + /// + public class ControlWebAppProperty : Control + { + /// + /// Returns or sets the preferences area. + /// + public List Preferences { get; protected set; } = []; -// /// -// /// Returns or sets the primary area. -// /// -// public List Primary { get; protected set; } = new List(); + /// + /// Returns or sets the primary area. + /// + public List Primary { get; protected set; } = []; -// /// -// /// Returns or sets the secondary area. -// /// -// public List Secondary { get; protected set; } = new List(); + /// + /// Returns or sets the secondary area. + /// + public List Secondary { get; protected set; } = []; -// /// -// /// Initializes a new instance of the class. -// /// -// /// The control id. -// public ControlWebAppProperty(string id = null) -// : base(id) -// { -// Init(); -// } + /// + /// Initializes a new instance of the class. + /// + /// The control id. + public ControlWebAppProperty(string id = null) + : base(id) + { + //BackgroundColor = LayoutSchema.PropertyBackground; + } -// /// -// /// Initialization -// /// -// private void Init() -// { -// BackgroundColor = LayoutSchema.PropertyBackground; -// } + /// + /// Convert the control to HTML. + /// + /// The context in which the control is rendered. + /// An HTML node representing the rendered control. + public override IHtmlNode Render(IRenderControlContext renderContext) + { + var preferences = WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ); -// /// -// /// Convert to html. -// /// -// /// The context in which the control is rendered. -// /// The control as html. -// public override IHtmlNode Render(RenderContext context) -// { -// if (Preferences.Count == 0 && Primary.Count == 0 && Secondary.Count == 0) -// { -// return null; -// } + var primary = WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ); -// var preferences = new HtmlElementTextContentDiv(Preferences.Select(x => x.Render(context))); -// var primary = new HtmlElementTextContentDiv(Primary.Select(x => x.Render(context))); -// var secondary = new HtmlElementTextContentDiv(Secondary.Select(x => x.Render(context))); + var secondary = WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ); -// return new HtmlElementTextContentDiv(preferences, primary, secondary) -// { -// Id = Id, -// Class = Css.Concatenate("proterty", GetClasses()), -// Style = GetStyles(), -// Role = Role -// }; -// } -// } -//} + var preferencesList = Preferences.Union(preferences).ToList(); + var primaryList = Primary.Union(primary).ToList(); + var secondaryList = Secondary.Union(secondary).ToList(); + + if (Preferences.Count == 0 && Primary.Count == 0 && Secondary.Count == 0) + { + return null; + } + + var preferencesCtrl = new HtmlElementTextContentDiv(preferencesList.Select(x => x.Render(renderContext)).ToArray()); + var primaryCtrl = new HtmlElementTextContentDiv(primaryList.Select(x => x.Render(renderContext)).ToArray()); + var secondaryCtrl = new HtmlElementTextContentDiv(secondaryList.Select(x => x.Render(renderContext)).ToArray()); + + return new HtmlElementTextContentDiv(preferencesCtrl, primaryCtrl, secondaryCtrl) + { + Id = Id, + Class = Css.Concatenate("proterty", GetClasses()), + Style = GetStyles(), + Role = Role + }; + } + } +} diff --git a/src/WebExpress.WebApp/WebExpress.WebApp.csproj b/src/WebExpress.WebApp/WebExpress.WebApp.csproj index 5960919..90afd70 100644 --- a/src/WebExpress.WebApp/WebExpress.WebApp.csproj +++ b/src/WebExpress.WebApp/WebExpress.WebApp.csproj @@ -64,4 +64,8 @@ + + + + diff --git a/src/WebExpress.WebApp/WebPage/RenderContextWebApp.cs b/src/WebExpress.WebApp/WebPage/RenderContextWebApp.cs deleted file mode 100644 index 7acf7fb..0000000 --- a/src/WebExpress.WebApp/WebPage/RenderContextWebApp.cs +++ /dev/null @@ -1,46 +0,0 @@ -//using WebExpress.WebCore.WebMessage; -//using WebExpress.WebCore.WebPage; -//using WebExpress.WebUI.WebPage; - -//namespace WebExpress.WebApp.WebPage -//{ -// public class RenderContextWebApp : RenderContextControl -// { -// /// -// /// Returns or sets the visual representation of the page. -// /// -// public new VisualTreeWebApp VisualTree -// { -// get { return base.VisualTree as VisualTreeWebApp; } -// set { base.VisualTree = value; } -// } - -// /// -// /// Initializes a new instance of the class. -// /// -// public RenderContextWebApp() -// { -// VisualTree = new VisualTreeWebApp(); -// } - -// /// -// /// Initializes a new instance of the class. -// /// -// /// The page where the control is rendered. -// /// The request. -// /// The visual tree. -// public RenderContextWebApp(IPage page, Request request, VisualTreeWebApp visualTree) -// : base(page, request, visualTree) -// { -// } - -// /// -// /// Copy-Constructor -// /// -// /// The render context to copy./param> -// public RenderContextWebApp(RenderContext context) -// : this(context?.Page, context?.Request, context?.VisualTree as VisualTreeWebApp) -// { -// } -// } -//} diff --git a/src/WebExpress.WebApp/WebPage/VisualTreeWebApp.cs b/src/WebExpress.WebApp/WebPage/VisualTreeWebApp.cs index 71639f8..b28490a 100644 --- a/src/WebExpress.WebApp/WebPage/VisualTreeWebApp.cs +++ b/src/WebExpress.WebApp/WebPage/VisualTreeWebApp.cs @@ -1,127 +1,96 @@ using System.Collections.Generic; -using WebExpress.WebCore.WebFragment; +using System.Linq; +using WebExpress.WebApp.WebControl; +using WebExpress.WebCore.Internationalization; +using WebExpress.WebCore.WebComponent; using WebExpress.WebCore.WebHtml; using WebExpress.WebCore.WebPage; +using WebExpress.WebCore.WebUri; +using WebExpress.WebUI.WebControl; +using WebExpress.WebUI.WebPage; namespace WebExpress.WebApp.WebPage { /// /// Represents the visual tree of the web application. /// - public class VisualTreeWebApp : IVisualTree + public class VisualTreeWebApp : VisualTreeControl { - // header - private readonly List _headerAppNavigatorPreferences = []; - private readonly List _headerAppNavigatorPrimary = []; - private readonly List _headerAppNavigatorSecondary = []; - private readonly List _headerNavigationPreferences = []; - private readonly List _headerNavigationPrimary = []; - private readonly List _headerNavigationSecondary = []; - private readonly List _headerQuickCreatePreferences = []; - private readonly List _headerQuickCreatePrimary = []; - private readonly List _headerQuickCreateSecondary = []; - private readonly List _headerHelpPreferences = []; - private readonly List _headerHelpPrimary = []; - private readonly List _headerHelpSecondary = []; - private readonly List _headerSettingsPreferences = []; - private readonly List _headerSettingsPrimary = []; - private readonly List _headerSettingsSecondary = []; - // sidebar - private readonly List _sidebarHeader = []; - private readonly List _sidebarPreferences = []; - private readonly List _sidebarPrimary = []; - private readonly List _sidebarSecondary = []; - // headline - private readonly List _contentHeadlinePrologue = []; - private readonly List _contentHeadlinePreferences = []; - private readonly List _contentHeadlinePrimary = []; - private readonly List _contentHeadlineSecondary = []; - private readonly List _contentHeadlineMorePreferences = []; - private readonly List _contentHeadlineMorePrimary = []; - private readonly List _contentHeadlineMoreSecondary = []; - private readonly List _contentHeadlineMetadata = []; - // property - private readonly List _contentPropertyPreferences = []; - private readonly List _contentPropertyPrimary = []; - private readonly List _contentPropertySecondary = []; - // content - private readonly List _contentPreferences = []; - private readonly List _contentPrimary = []; - private readonly List _contentSecondary = []; - // footer - private readonly List _footerPreferences = []; - private readonly List _footerPrimary = []; - private readonly List _footerSecondary = []; - /// - /// Returns or sets the header. + /// Returns header control. /// - //public ControlWebAppHeader Header { get; protected set; } = new ControlWebAppHeader("webexpress.webapp.header"); - - ///// - ///// Returns or sets the content. - ///// - //public new ControlWebAppContent Content { get; protected set; } = new ControlWebAppContent("webexpress.webapp.content"); - - ///// - ///// Returns or sets the footer. - ///// - //public ControlWebAppFooter Footer { get; protected set; } = new ControlWebAppFooter("webexpress.webapp.footer"); + public ControlWebAppHeader Header { get; } = new ControlWebAppHeader("webexpress.webapp.header"); ///// - ///// Returns or sets the area for the toast messages. + ///// Returns the area for the toast messages control. ///// //public ControlPanelToast Toast { get; protected set; } = new ControlPanelToast("webexpress.webapp.toast"); ///// - ///// Returns or sets the range for the path specification. + ///// Returns the range for the path specification. ///// //public ControlBreadcrumb Breadcrumb { get; protected set; } = new ControlBreadcrumb("webexpress.webapp.breadcrumb"); ///// - ///// Returns or sets the area for prologue. + ///// Returns the area for prologue. ///// //public ControlPanel Prologue { get; protected set; } = new ControlPanel("webexpress.webapp.prologue"); ///// - ///// Returns or sets the range for the search options. + ///// Returns the range for the search options control. ///// //public ControlPanel SearchOptions { get; protected set; } = new ControlPanel("webexpress.webapp.searchoptions"); ///// - ///// Returns or sets the sidebar. + ///// Returns the sidebar control. ///// //public ControlWebAppSidebar Sidebar { get; protected set; } = new ControlWebAppSidebar("webexpress.webapp.sidebar"); - ///// - ///// Initializes a new instance of the class. - ///// - //public VisualTreeWebApp() - //{ - // Header.Fixed = TypeFixed.Top; - // Header.Styles = new List(new[] { "position: sticky; top: 0; z-index: 99;" }); - - // Breadcrumb.Margin = new PropertySpacingMargin(PropertySpacing.Space.Null); - // Breadcrumb.BackgroundColor = LayoutSchema.BreadcrumbBackground; - // Breadcrumb.Size = LayoutSchema.BreadcrumbSize; - - // Toast.BackgroundColor = LayoutSchema.ValidationWarningBackground; - - // Sidebar.BackgroundColor = LayoutSchema.SidebarBackground; - // Content.BackgroundColor = LayoutSchema.ContentBackground; - // Content.Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.None, PropertySpacing.Space.None); - // //Content.Width = TypeWidth.OneHundred; - - // Footer.BackgroundColor = LayoutSchema.FooterBackground; - //} + /// + /// Returns the content control. + /// + public new ControlWebAppContent Content { get; protected set; } = new ControlWebAppContent("webexpress.webapp.content"); + /// + /// Returns the footer control. + /// + public ControlWebAppFooter Footer { get; protected set; } = new ControlWebAppFooter("webexpress.webapp.footer"); /// /// Initializes a new instance of the class. /// - public VisualTreeWebApp() + /// The component hub. + /// The page context. + public VisualTreeWebApp(IComponentHub componentHub, IPageContext pageContext) + : base(componentHub, pageContext) { + var applicationContext = pageContext?.ApplicationContext; + + Header.Fixed = TypeFixed.Top; + Header.Styles = new List(["position: sticky; top: 0; z-index: 99;"]); + + //Breadcrumb.Margin = new PropertySpacingMargin(PropertySpacing.Space.Null); + //Breadcrumb.BackgroundColor = LayoutSchema.BreadcrumbBackground; + //Breadcrumb.Size = LayoutSchema.BreadcrumbSize; + + //Toast.BackgroundColor = LayoutSchema.ValidationWarningBackground; + + //Sidebar.BackgroundColor = LayoutSchema.SidebarBackground; + + //Content.BackgroundColor = LayoutSchema.ContentBackground; + Content.Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.None, PropertySpacing.Space.None); + + //Footer.BackgroundColor = LayoutSchema.FooterBackground; + + AddCssLink(UriResource.Combine(applicationContext?.ContextPath, "/assets/css/webexpress.webapp.css")); + AddCssLink(UriResource.Combine(applicationContext?.ContextPath, "/assets/css/webexpress.webapp.popupnotification.css")); + AddCssLink(UriResource.Combine(applicationContext?.ContextPath, "/assets/css/webexpress.webapp.taskprogressbar.css")); + AddHeaderScript(UriResource.Combine(applicationContext?.ContextPath, "assets/js/webexpress.webapp.js")); + AddHeaderScript(UriResource.Combine(applicationContext?.ContextPath, "assets/js/webexpress.webapp.popupnotification.js")); + AddHeaderScript(UriResource.Combine(applicationContext?.ContextPath, "assets/js/webexpress.webapp.selection.js")); + AddHeaderScript(UriResource.Combine(applicationContext?.ContextPath, "assets/js/webexpress.webapp.table.js")); + AddHeaderScript(UriResource.Combine(applicationContext?.ContextPath, "assets/js/webexpress.webapp.taskprogressbar.js")); } /// @@ -129,19 +98,26 @@ public VisualTreeWebApp() /// /// The context for rendering the page. /// The page as an html tree. - public virtual IHtmlNode Render(IVisualTreeContext context) + public override IHtmlNode Render(IVisualTreeContext context) { var html = new HtmlElementRootHtml(); - //html.Head.Title = I18N.Translate(context.Request, Title); - //html.Head.Favicons = Favicons?.Select(x => new Favicon(x.Url, x.Mediatype)); - //html.Head.Styles = Styles; - //html.Head.Meta = Meta; - //html.Head.Scripts = HeaderScripts; - ////html.Body.Elements.AddRange(Content?.Where(x => x.Enable).Select(x => x.Render(context))); - //html.Body.Scripts = [.. Scripts.Values]; - - //html.Head.CssLinks = CssLinks.Where(x => x != null).Select(x => x.ToString()); - //html.Head.ScriptLinks = HeaderScriptLinks?.Where(x => x != null).Select(x => x.ToString()); + var body = new HtmlElementSectionBody(); + var renderContext = new RenderControlContext(context.RenderContext); + html.Head.Title = I18N.Translate(context.Request, Title); + html.Head.Favicons = Favicons; + html.Head.Styles = Styles; + html.Head.Meta = Meta; + html.Head.Scripts = HeaderScripts; + html.Head.CssLinks = CssLinks.Where(x => x != null).Select(x => x.ToString()); + html.Head.ScriptLinks = HeaderScriptLinks?.Where(x => x != null).Select(x => x.ToString()); + + // header + Header.AppTitle.Text = html.Head.Title; + html.Body.Add(Header.Render(renderContext)); + html.Body.Add(Content.Render(renderContext)); + html.Body.Add(Footer.Render(renderContext)); + + html.Body.Scripts = [.. Scripts.Values]; return html; } From c9326d2c8c3d1a9e6ae1286bfbf414cc707281cf Mon Sep 17 00:00:00 2001 From: Rene Schwarzer Date: Sun, 29 Dec 2024 21:33:34 +0100 Subject: [PATCH 12/30] refactoring and add tests --- .../Fixture/AssertExtensions.cs | 6 +- .../TestFragmentGeneral.cs | 26 +++ .../TestFragmentPageA.cs | 26 +++ .../TestFragmentPageB.cs | 25 +++ .../{TestPage.cs => TestPageA.cs} | 23 +-- src/WebExpress.WebApp.Test/TestPageB.cs | 50 +++++ src/WebExpress.WebApp.Test/TestPlugin.cs | 7 - .../UnitTestControlWebAppSidebar.cs | 34 ++++ .../WebFragment/UnitTestFragmentManager.cs | 122 ++++++++++++ .../WebPage/UnitTestPageManager.cs | 4 +- .../WebControl/ControlWebAppContent.cs | 4 +- .../WebControl/ControlWebAppHeaderSettings.cs | 6 +- .../WebControl/ControlWebAppSidebar.cs | 174 ++++++++++-------- .../WebIndex/IndexManager.cs | 146 +++++++-------- .../WebPage/VisualTreeWebApp.cs | 50 ++--- src/WebExpress.WebApp/WebScope/IScopeAdmin.cs | 9 + .../{ScopeGeneral.cs => IScopeGeneral.cs} | 2 +- .../WebScope/IScopeSetting.cs | 9 + src/WebExpress.WebApp/WebScope/ScopeAdmin.cs | 11 -- .../WebScope/ScopeSetting.cs | 11 -- 20 files changed, 507 insertions(+), 238 deletions(-) create mode 100644 src/WebExpress.WebApp.Test/TestFragmentGeneral.cs create mode 100644 src/WebExpress.WebApp.Test/TestFragmentPageA.cs create mode 100644 src/WebExpress.WebApp.Test/TestFragmentPageB.cs rename src/WebExpress.WebApp.Test/{TestPage.cs => TestPageA.cs} (72%) create mode 100644 src/WebExpress.WebApp.Test/TestPageB.cs create mode 100644 src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppSidebar.cs create mode 100644 src/WebExpress.WebApp.Test/WebFragment/UnitTestFragmentManager.cs create mode 100644 src/WebExpress.WebApp/WebScope/IScopeAdmin.cs rename src/WebExpress.WebApp/WebScope/{ScopeGeneral.cs => IScopeGeneral.cs} (77%) create mode 100644 src/WebExpress.WebApp/WebScope/IScopeSetting.cs delete mode 100644 src/WebExpress.WebApp/WebScope/ScopeAdmin.cs delete mode 100644 src/WebExpress.WebApp/WebScope/ScopeSetting.cs diff --git a/src/WebExpress.WebApp.Test/Fixture/AssertExtensions.cs b/src/WebExpress.WebApp.Test/Fixture/AssertExtensions.cs index c1cd13b..5139bb3 100644 --- a/src/WebExpress.WebApp.Test/Fixture/AssertExtensions.cs +++ b/src/WebExpress.WebApp.Test/Fixture/AssertExtensions.cs @@ -47,15 +47,15 @@ public static void EqualWithPlaceholders(string expected, IHtmlNode actual) /// True if the actual string matches the expected string with placeholders; otherwise, false. private static bool AreEqualWithPlaceholders(string expected, string actual) { - if (expected == null && actual == null) + if (string.IsNullOrWhiteSpace(expected) && string.IsNullOrWhiteSpace(actual)) { return true; } - else if (expected != null && actual == null) + else if (!string.IsNullOrWhiteSpace(expected) && string.IsNullOrWhiteSpace(actual)) { return false; } - else if (expected == null && actual != null) + else if (string.IsNullOrWhiteSpace(expected) && !string.IsNullOrWhiteSpace(actual)) { return false; } diff --git a/src/WebExpress.WebApp.Test/TestFragmentGeneral.cs b/src/WebExpress.WebApp.Test/TestFragmentGeneral.cs new file mode 100644 index 0000000..c05acea --- /dev/null +++ b/src/WebExpress.WebApp.Test/TestFragmentGeneral.cs @@ -0,0 +1,26 @@ +using WebExpress.WebApp.WebScope; +using WebExpress.WebApp.WebSection; +using WebExpress.WebCore.WebAttribute; +using WebExpress.WebCore.WebFragment; +using WebExpress.WebUI.WebControl; +using WebExpress.WebUI.WebFragment; + +namespace WebExpress.WebApp.Test +{ + /// + /// A dummy fragment for testing purposes. + /// + [Section()] + [Scope] + public sealed class TestFragmentGeneral : FragmentControlDropdownItemLink + { + /// + /// Initializes a new instance of the class. + /// + public TestFragmentGeneral(IFragmentContext fragmentContext) + : base(fragmentContext) + { + Add(new ControlText() { Text = "Hello World" }); + } + } +} diff --git a/src/WebExpress.WebApp.Test/TestFragmentPageA.cs b/src/WebExpress.WebApp.Test/TestFragmentPageA.cs new file mode 100644 index 0000000..917f40c --- /dev/null +++ b/src/WebExpress.WebApp.Test/TestFragmentPageA.cs @@ -0,0 +1,26 @@ +using WebExpress.WebApp.WebSection; +using WebExpress.WebCore.WebAttribute; +using WebExpress.WebCore.WebFragment; +using WebExpress.WebUI.WebControl; +using WebExpress.WebUI.WebFragment; + +namespace WebExpress.WebApp.Test +{ + /// + /// A dummy fragment for testing purposes. + /// + [Section()] + [Section()] + [Scope] + public sealed class TestFragmentPageA : FragmentControlPanel + { + /// + /// Initializes a new instance of the class. + /// + public TestFragmentPageA(IFragmentContext fragmentContext) + : base(fragmentContext) + { + Add(new ControlText() { Text = "Hello World" }); + } + } +} diff --git a/src/WebExpress.WebApp.Test/TestFragmentPageB.cs b/src/WebExpress.WebApp.Test/TestFragmentPageB.cs new file mode 100644 index 0000000..69bdafd --- /dev/null +++ b/src/WebExpress.WebApp.Test/TestFragmentPageB.cs @@ -0,0 +1,25 @@ +using WebExpress.WebApp.WebSection; +using WebExpress.WebCore.WebAttribute; +using WebExpress.WebCore.WebFragment; +using WebExpress.WebUI.WebControl; +using WebExpress.WebUI.WebFragment; + +namespace WebExpress.WebApp.Test +{ + /// + /// A dummy fragment for testing purposes. + /// + [Section()] + [Scope] + public sealed class TestFragmentPageB : FragmentControlPanel + { + /// + /// Initializes a new instance of the class. + /// + public TestFragmentPageB(IFragmentContext fragmentContext) + : base(fragmentContext) + { + Add(new ControlText() { Text = "Hello World" }); + } + } +} diff --git a/src/WebExpress.WebApp.Test/TestPage.cs b/src/WebExpress.WebApp.Test/TestPageA.cs similarity index 72% rename from src/WebExpress.WebApp.Test/TestPage.cs rename to src/WebExpress.WebApp.Test/TestPageA.cs index 07e701d..1e31546 100644 --- a/src/WebExpress.WebApp.Test/TestPage.cs +++ b/src/WebExpress.WebApp.Test/TestPageA.cs @@ -1,4 +1,5 @@ using WebExpress.WebApp.WebPage; +using WebExpress.WebApp.WebScope; using WebExpress.WebCore.WebAttribute; using WebExpress.WebCore.WebPage; @@ -8,15 +9,10 @@ namespace WebExpress.WebApp.Test /// A dummy class for testing purposes. /// [Title("webindex:pagea.label")] - [Segment("page", "webindex:homepage.label")] - [ContextPath(null)] - public sealed class TestPage : IPage + [Segment("pagea", "webindex:homepage.label")] + [Scope] + public sealed class TestPageA : IPage, IScopeGeneral { - /// - /// Returns or sets the title of the page. - /// - public string Title { get; set; } - /// /// Returns or sets the page context. /// @@ -26,7 +22,7 @@ public sealed class TestPage : IPage /// Initialization of the page. Here, for example, managed resources can be loaded. ///
/// The context of the page. - public TestPage(IPageContext pageContext) + public TestPageA(IPageContext pageContext) { PageContext = pageContext; @@ -49,15 +45,6 @@ public void Process(IRenderContext renderContext, VisualTreeWebApp visualTree) { throw new ArgumentNullException(nameof(renderContext), "Parameter cannot be null or empty."); } - - //visualTree.Content.Add(new ControlText() { Text = "Hello World" }); - } - - /// - /// Release of unmanaged resources reserved during use. - /// - public void Dispose() - { } } } diff --git a/src/WebExpress.WebApp.Test/TestPageB.cs b/src/WebExpress.WebApp.Test/TestPageB.cs new file mode 100644 index 0000000..e31eabe --- /dev/null +++ b/src/WebExpress.WebApp.Test/TestPageB.cs @@ -0,0 +1,50 @@ +using WebExpress.WebApp.WebPage; +using WebExpress.WebApp.WebScope; +using WebExpress.WebCore.WebAttribute; +using WebExpress.WebCore.WebPage; + +namespace WebExpress.WebApp.Test +{ + /// + /// A dummy class for testing purposes. + /// + [Title("webindex:pagea.label")] + [Segment("pageb", "webindex:homepage.label")] + [Scope] + public sealed class TestPageB : IPage, IScopeGeneral + { + /// + /// Returns or sets the page context. + /// + public IPageContext PageContext { get; private set; } + + /// + /// Initialization of the page. Here, for example, managed resources can be loaded. + /// + /// The context of the page. + public TestPageB(IPageContext pageContext) + { + PageContext = pageContext; + + // test the injection + if (pageContext == null) + { + throw new ArgumentNullException(nameof(pageContext), "Parameter cannot be null or empty."); + } + } + + /// + /// Processing of the page. + /// + /// The context for rendering the page. + /// The visual tree control to be processed. + public void Process(IRenderContext renderContext, VisualTreeWebApp visualTree) + { + // test the context + if (renderContext == null) + { + throw new ArgumentNullException(nameof(renderContext), "Parameter cannot be null or empty."); + } + } + } +} diff --git a/src/WebExpress.WebApp.Test/TestPlugin.cs b/src/WebExpress.WebApp.Test/TestPlugin.cs index 840a3be..fe75d50 100644 --- a/src/WebExpress.WebApp.Test/TestPlugin.cs +++ b/src/WebExpress.WebApp.Test/TestPlugin.cs @@ -27,12 +27,5 @@ private TestPlugin(IPluginContext pluginContext) public void Run() { } - - /// - /// Release of unmanaged resources reserved during use. - /// - public void Dispose() - { - } } } diff --git a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppSidebar.cs b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppSidebar.cs new file mode 100644 index 0000000..8a19fd0 --- /dev/null +++ b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppSidebar.cs @@ -0,0 +1,34 @@ +using WebExpress.WebApp.Test.Fixture; +using WebExpress.WebApp.WebControl; + +namespace WebExpress.WebApp.Test.WebControl +{ + /// + /// Tests the web app sidebar control. + /// + [Collection("NonParallelTests")] + public class UnitTestControlWebAppSidebar + { + /// + /// Tests the id property of the web app sidebar control. + /// + [Theory] + [InlineData(null, null)] + [InlineData("id", null)] + public void Id(string id, string expected) + { + // preconditions + var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); + var application = componentHub.ApplicationManager.GetApplications(typeof(TestApplication)).FirstOrDefault(); + var context = UnitTestControlFixture.CrerateRenderContextMock(application); + var control = new ControlWebAppHeaderQuickCreate(id) + { + }; + + // test execution + var html = control.Render(context); + + AssertExtensions.EqualWithPlaceholders(expected, html); + } + } +} diff --git a/src/WebExpress.WebApp.Test/WebFragment/UnitTestFragmentManager.cs b/src/WebExpress.WebApp.Test/WebFragment/UnitTestFragmentManager.cs new file mode 100644 index 0000000..751dd45 --- /dev/null +++ b/src/WebExpress.WebApp.Test/WebFragment/UnitTestFragmentManager.cs @@ -0,0 +1,122 @@ +using System.Reflection; +using WebExpress.WebApp.Test.Fixture; +using WebExpress.WebApp.WebScope; +using WebExpress.WebApp.WebSection; +using WebExpress.WebCore.WebApplication; +using WebExpress.WebCore.WebFragment; +using WebExpress.WebCore.WebScope; +using WebExpress.WebUI.WebControl; +using WebExpress.WebUI.WebFragment; + +namespace WebExpress.WebApp.Test.WebFragment +{ + /// + /// Test the fragment manager. + /// + [Collection("NonParallelTests")] + public class UnitTestFragmentManager + { + /// + /// Test the id property of the fragment manager. + /// + [Theory] + [InlineData(typeof(TestApplication), typeof(TestFragmentPageA), "webexpress.webapp.test.testfragmentpagea")] + public void Id(Type applicationType, Type fragmentType, string id) + { + // preconditions + var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); + var application = componentHub.ApplicationManager.GetApplications(applicationType).FirstOrDefault(); + + // test execution + var fragment = componentHub.FragmentManager.GetFragments(application, fragmentType); + + if (id == null) + { + Assert.Empty(fragment); + return; + } + + Assert.Contains(id, fragment.Select(x => x.FragmentId?.ToString())); + } + + /// + /// Test the get fragments function of the fragment manager. + /// + [Theory] + [InlineData(typeof(TestApplication), typeof(FragmentControlPanel), typeof(SectionContentPrimary), typeof(TestPageA), 1, @"
Hello World
")] + [InlineData(typeof(TestApplication), typeof(FragmentControlPanel), typeof(SectionContentPrimary), typeof(IScopeGeneral), 0, null)] + [InlineData(typeof(TestApplication), typeof(FragmentControlPanel), typeof(SectionContentPrimary), typeof(IScope), 0, null)] + [InlineData(typeof(TestApplication), typeof(IFragmentControl), typeof(SectionContentPrimary), typeof(TestPageA), 1, @"
Hello World
")] + [InlineData(typeof(TestApplication), typeof(IFragmentControl), typeof(SectionContentPrimary), typeof(IScopeGeneral), 0, null)] + [InlineData(typeof(TestApplication), typeof(IFragmentControl), typeof(SectionContentPrimary), typeof(IScope), 0, null)] + [InlineData(typeof(TestApplication), typeof(IFragmentBase), typeof(SectionContentPrimary), typeof(TestPageA), 1, @"
Hello World
")] + [InlineData(typeof(TestApplication), typeof(IFragmentBase), typeof(SectionContentPrimary), typeof(IScopeGeneral), 0, null)] + [InlineData(typeof(TestApplication), typeof(IFragmentBase), typeof(SectionContentPrimary), typeof(IScope), 0, null)] + [InlineData(typeof(TestApplication), typeof(IFragmentControl), typeof(SectionAppNavigationPrimary), typeof(TestPageA), 1, @"
Hello World
")] + [InlineData(typeof(TestApplication), typeof(IFragmentControl), typeof(SectionAppNavigationPrimary), typeof(IScopeGeneral), 1, @"
Hello World
")] + [InlineData(typeof(TestApplication), typeof(IFragmentControl), typeof(SectionAppNavigationPrimary), typeof(IScope), 0, null)] + [InlineData(typeof(TestApplication), typeof(FragmentControlPanel), typeof(SectionContentSecondary), typeof(TestPageB), 1, @"
Hello World
")] + [InlineData(typeof(TestApplication), typeof(FragmentControlPanel), typeof(SectionContentSecondary), typeof(IScopeGeneral), 0, null)] + [InlineData(typeof(TestApplication), typeof(FragmentControlPanel), typeof(SectionContentSecondary), typeof(IScope), 0, null)] + [InlineData(typeof(TestApplication), typeof(FragmentControlPanel), typeof(SectionContentPrimary), typeof(TestPageB), 0, null)] + + public void GetFragments(Type applicationType, Type fragmentType, Type sectionType, Type scopeType, int count, string expected) + { + // preconditions + var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); + var application = componentHub.ApplicationManager.GetApplications(applicationType).FirstOrDefault(); + var renderContext = UnitTestControlFixture.CrerateRenderContextMock(application, [scopeType]); + + // reflection to get GetFragments method + var fragmentManagerType = componentHub.FragmentManager.GetType(); + var getFragmentsMethod = fragmentManagerType.GetMethod + ( + "GetFragments", + BindingFlags.Instance | BindingFlags.Public, + [ + typeof(ApplicationContext), + typeof(IEnumerable) + ] + ); + + // prepare parameters for the method + var parameters = new object[] + { + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + }; + + // test execution + // invoke the method using reflection + var preferences = (IEnumerable)getFragmentsMethod.MakeGenericMethod(fragmentType, sectionType) + .Invoke(componentHub.FragmentManager, parameters); + var castPreferences = Enumerable.Cast(preferences); + + var html = castPreferences.Select(x => x.Render(renderContext)); + + Assert.Equal(count, html.Count()); + AssertExtensions.EqualWithPlaceholders(expected, string.Join("", html).Trim()); + } + + /// + /// Test the render function of the fragment manager. + /// + [Theory] + [InlineData(typeof(TestApplication), typeof(SectionContentPrimary), typeof(TestPageA), @"
Hello World
")] + [InlineData(typeof(TestApplication), typeof(SectionContentPrimary), typeof(IScopeGeneral), null)] + [InlineData(typeof(TestApplication), typeof(SectionContentPrimary), typeof(IScope), null)] + public void Render(Type applicationType, Type sectionType, Type scopeType, string expected) + { + // preconditions + var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); + var application = componentHub.ApplicationManager.GetApplications(applicationType).FirstOrDefault(); + var renderContext = UnitTestControlFixture.CrerateRenderContextMock(application, [scopeType]); + + // test execution + var html = componentHub.FragmentManager.Render(renderContext, sectionType); + + Assert.NotNull(html); + AssertExtensions.EqualWithPlaceholders(expected, html.FirstOrDefault()?.ToString()); + } + } +} diff --git a/src/WebExpress.WebApp.Test/WebPage/UnitTestPageManager.cs b/src/WebExpress.WebApp.Test/WebPage/UnitTestPageManager.cs index 57bd5c3..876485a 100644 --- a/src/WebExpress.WebApp.Test/WebPage/UnitTestPageManager.cs +++ b/src/WebExpress.WebApp.Test/WebPage/UnitTestPageManager.cs @@ -13,7 +13,7 @@ public class UnitTestPageManager /// Test the id property of the page manager. /// [Theory] - [InlineData(typeof(TestApplication), typeof(TestPage), "webexpress.webapp.test.testpage")] + [InlineData(typeof(TestApplication), typeof(TestPageA), "webexpress.webapp.test.testpagea")] public void Id(Type applicationType, Type pageType, string id) { // preconditions @@ -36,7 +36,7 @@ public void Id(Type applicationType, Type pageType, string id) /// Test the process function of the page manager. /// [Theory] - [InlineData("http://localhost:8080/server/app/page", "webexpress.webapp.test.testpage")] + [InlineData("http://localhost:8080/server/app/pagea", "webexpress.webapp.test.testpagea")] public void SearchResource(string uri, string id) { // preconditions diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppContent.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppContent.cs index 11e3855..988611b 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppContent.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppContent.cs @@ -113,14 +113,14 @@ public override IHtmlNode Render(IRenderControlContext renderContext) var primaryList = Primary.Union(primary).ToList(); var secondaryList = Secondary.Union(secondary).ToList(); - //MainPanel.Content.Clear(); + MainPanel.Clear(); MainPanel.Add(Headline); MainPanel.Add(new ControlPanel("webexpress.webapp.content.main.preferences", preferencesList.ToArray())); MainPanel.Add(new ControlPanel("webexpress.webapp.content.main.primary", primaryList.ToArray())); MainPanel.Add(new ControlPanel("webexpress.webapp.content.main.secondary", secondaryList.ToArray())); - //Content.Clear(); + Clear(); if (Toolbar.Items.Any()) { diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs index d5243fe..198176a 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs @@ -47,19 +47,19 @@ public ControlWebAppHeaderSettings(string id = null) /// An HTML node representing the rendered control. public override IHtmlNode Render(IRenderControlContext renderContext) { - var preferences = WebEx.ComponentHub.FragmentManager.GetFragments + var preferences = WebEx.ComponentHub.FragmentManager.GetFragments ( renderContext?.PageContext?.ApplicationContext, renderContext?.PageContext?.Scopes ); - var primary = WebEx.ComponentHub.FragmentManager.GetFragments + var primary = WebEx.ComponentHub.FragmentManager.GetFragments ( renderContext?.PageContext?.ApplicationContext, renderContext?.PageContext?.Scopes ); - var secondary = WebEx.ComponentHub.FragmentManager.GetFragments + var secondary = WebEx.ComponentHub.FragmentManager.GetFragments ( renderContext?.PageContext?.ApplicationContext, renderContext?.PageContext?.Scopes diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppSidebar.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppSidebar.cs index 8f1616e..3a38c5e 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppSidebar.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppSidebar.cs @@ -1,86 +1,108 @@ -//using System.Collections.Generic; -//using System.Linq; -//using WebExpress.WebCore.WebHtml; -//using WebExpress.WebCore.WebPage; -//using WebExpress.WebApp.WebPage; -//using WebExpress.WebUI.WebControl; +using System.Collections.Generic; +using System.Linq; +using WebExpress.WebApp.WebSection; +using WebExpress.WebCore; +using WebExpress.WebCore.Internationalization; +using WebExpress.WebCore.WebHtml; +using WebExpress.WebUI.WebControl; +using WebExpress.WebUI.WebFragment; +using WebExpress.WebUI.WebPage; -//namespace WebExpress.WebApp.WebControl -//{ -// /// -// /// Sidebar for a web app. -// /// -// public class ControlWebAppSidebar : Control -// { -// /// -// /// Returns or sets the header area. -// /// -// public List Header { get; protected set; } = new List(); +namespace WebExpress.WebApp.WebControl +{ + /// + /// Sidebar for a web app. + /// + public class ControlWebAppSidebar : Control + { + /// + /// Returns or sets the header area. + /// + public List Header { get; protected set; } = []; -// /// -// /// Returns or sets the preferences area. -// /// -// public List Preferences { get; protected set; } = new List(); + /// + /// Returns or sets the preferences area. + /// + public List Preferences { get; protected set; } = []; -// /// -// /// Returns or sets the primary area. -// /// -// public List Primary { get; protected set; } = new List(); + /// + /// Returns or sets the primary area. + /// + public List Primary { get; protected set; } = []; -// /// -// /// Returns or sets the secondary area. -// /// -// public List Secondary { get; protected set; } = new List(); + /// + /// Returns or sets the secondary area. + /// + public List Secondary { get; protected set; } = []; -// /// -// /// Determines whether content exists -// /// -// public bool HasContent => Header.Any() || Preferences.Any() || Primary.Any() || Secondary.Any(); + /// + /// Initializes a new instance of the class. + /// + /// The control id. + public ControlWebAppSidebar(string id = null) + : base(id) + { + } -// /// -// /// Initializes a new instance of the class. -// /// -// /// The control id. -// public ControlWebAppSidebar(string id = null) -// : base(id) -// { -// Init(); -// } + /// + /// Convert the control to HTML. + /// + /// The context in which the control is rendered. + /// An HTML node representing the rendered control. + public override IHtmlNode Render(IRenderControlContext renderContext) + { + var header = WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ); -// /// -// /// Initialization -// /// -// private void Init() -// { -// BackgroundColor = LayoutSchema.SidebarBackground; -// //Height = TypeHeight.OneHundred; -// } + var preferences = WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ); -// /// -// /// Convert to html. -// /// -// /// The context in which the control is rendered. -// /// The control as html. -// public override IHtmlNode Render(RenderContext context) -// { -// if (!HasContent) -// { -// return null; -// } + var primary = WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ); -// var elements = new List(); -// elements.AddRange(Header.Select(x => x.Render(context))); -// elements.AddRange(Preferences.Select(x => x.Render(context))); -// elements.AddRange(Primary.Select(x => x.Render(context))); -// elements.AddRange(Secondary.Select(x => x.Render(context))); + var secondary = WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ); -// return new HtmlElementTextContentDiv(elements) -// { -// Id = Id, -// Class = Css.Concatenate("sidebar", GetClasses()), -// Style = Style.Concatenate("display: block;", GetStyles()), -// Role = Role -// }; -// } -// } -//} + var settingsList = new List + { + new ControlDropdownItemHeader() { Text = I18N.Translate(renderContext.Request?.Culture, "webexpress.webapp:header.setting.label") } + }; + + var headerList = Header.Union(header).ToList(); + var preferencesList = Preferences.Union(preferences).ToList(); + var primaryList = Primary.Union(primary).ToList(); + var secondaryList = Secondary.Union(secondary).ToList(); + + if (!(headerList.Any() || preferencesList.Any() || primaryList.Any() || secondaryList.Any())) + { + return null; + } + + var elements = new List(); + elements.AddRange(headerList.Select(x => x.Render(renderContext))); + elements.AddRange(preferencesList.Select(x => x.Render(renderContext))); + elements.AddRange(primaryList.Select(x => x.Render(renderContext))); + elements.AddRange(secondaryList.Select(x => x.Render(renderContext))); + + return new HtmlElementTextContentDiv(elements.ToArray()) + { + Id = Id, + Class = Css.Concatenate("sidebar", GetClasses()), + Style = Style.Concatenate("display: block;", GetStyles()), + Role = Role + }; + } + } +} diff --git a/src/WebExpress.WebApp/WebIndex/IndexManager.cs b/src/WebExpress.WebApp/WebIndex/IndexManager.cs index bc3c6c2..3fcf7c0 100644 --- a/src/WebExpress.WebApp/WebIndex/IndexManager.cs +++ b/src/WebExpress.WebApp/WebIndex/IndexManager.cs @@ -1,91 +1,77 @@ -//using System.Collections.Generic; -//using System.IO; -//using WebExpress.WebCore; -//using WebExpress.WebCore.Internationalization; -//using WebExpress.WebCore.WebComponent; -//using WebExpress.WebCore.WebPlugin; -//using WebExpress.WebIndex; +using System.Collections.Generic; +using System.IO; +using WebExpress.WebCore; +using WebExpress.WebCore.Internationalization; +using WebExpress.WebCore.WebComponent; +using WebExpress.WebCore.WebPlugin; +using WebExpress.WebIndex; -//namespace WebExpress.WebApp.WebIndex -//{ -// public sealed class IndexManager : WebExpress.WebIndex.IndexManager, IComponentPlugin -// { -// /// -// /// Returns the reference to the context of the host. -// /// -// public IHttpServerContext HttpServerContext { get; private set; } +namespace WebExpress.WebApp.WebIndex +{ + /// + /// Manages the index for the web application and handles component registration and removal. + /// + public sealed class IndexManager : WebExpress.WebIndex.IndexManager, IComponentManager + { + private readonly IHttpServerContext _httpServerContext; + private readonly IComponentHub _componentHub; -// /// -// /// Initializes a new instance of the class. -// /// -// internal IndexManager() -// { -// ComponentManager.PluginManager.AddPlugin += (s, pluginContext) => -// { -// Register(pluginContext); -// }; + /// + /// Initializes a new instance of the class. + /// + /// The reference to the context of the host. + /// The component hub. + internal IndexManager(IHttpServerContext httpServerContext, IComponentHub componentHub) + { + _httpServerContext = httpServerContext; + _componentHub = componentHub; -// ComponentManager.PluginManager.RemovePlugin += (s, pluginContext) => -// { -// Remove(pluginContext); -// }; -// } + _componentHub.PluginManager.AddPlugin += (s, pluginContext) => + { + Register(pluginContext); + }; -// /// -// /// Initialization -// /// -// /// The reference to the context of the host. -// public void Initialization(IHttpServerContext context) -// { -// HttpServerContext = context; + _componentHub.PluginManager.RemovePlugin += (s, pluginContext) => + { + Remove(pluginContext); + }; -// HttpServerContext.Log.Debug -// ( -// InternationalizationManager.I18N("webexpress.webapp:indexmanager.initialization") -// ); + _httpServerContext.Log.Debug + ( + I18N.Translate("webexpress.webapp:indexmanager.initialization") + ); -// Initialization(new IndexContext() { IndexDirectory = Path.Combine(context.DataPath, "index") }); -// } + Initialization(new IndexContext() { IndexDirectory = Path.Combine(httpServerContext.DataPath, "index") }); + } -// /// -// /// Discovers and registers entries from the specified plugin. -// /// -// /// A context of a plugin whose elements are to be registered. -// public void Register(IPluginContext pluginContext) -// { + /// + /// Discovers and registers entries from the specified plugin. + /// + /// A context of a plugin whose elements are to be registered. + public void Register(IPluginContext pluginContext) + { -// } + } -// /// -// /// Discovers and registers entries from the specified plugin. -// /// -// /// A list with plugin contexts that contain the components. -// public void Register(IEnumerable pluginContexts) -// { -// foreach (var pluginContext in pluginContexts) -// { -// Register(pluginContext); -// } -// } + /// + /// Discovers and registers entries from the specified plugin. + /// + /// A list with plugin contexts that contain the components. + public void Register(IEnumerable pluginContexts) + { + foreach (var pluginContext in pluginContexts) + { + Register(pluginContext); + } + } -// /// -// /// Removes all components associated with the specified plugin context. -// /// -// /// The context of the plugin that contains the components to remove. -// public void Remove(IPluginContext pluginContext) -// { -// //Dictionary.Remove(pluginContext); -// } + /// + /// Removes all components associated with the specified plugin context. + /// + /// The context of the plugin that contains the components to remove. + public void Remove(IPluginContext pluginContext) + { -// /// -// /// Information about the component is collected and prepared for output in the log. -// /// -// /// The context of the plugin. -// /// A list of log entries. -// /// The shaft deep. -// public void PrepareForLog(IPluginContext pluginContext, IList output, int deep) -// { - -// } -// } -//} + } + } +} diff --git a/src/WebExpress.WebApp/WebPage/VisualTreeWebApp.cs b/src/WebExpress.WebApp/WebPage/VisualTreeWebApp.cs index b28490a..987cab9 100644 --- a/src/WebExpress.WebApp/WebPage/VisualTreeWebApp.cs +++ b/src/WebExpress.WebApp/WebPage/VisualTreeWebApp.cs @@ -21,30 +21,30 @@ public class VisualTreeWebApp : VisualTreeControl /// public ControlWebAppHeader Header { get; } = new ControlWebAppHeader("webexpress.webapp.header"); - ///// - ///// Returns the area for the toast messages control. - ///// - //public ControlPanelToast Toast { get; protected set; } = new ControlPanelToast("webexpress.webapp.toast"); + /// + /// Returns the area for the toast messages control. + /// + public ControlPanelToast Toast { get; protected set; } = new ControlPanelToast("webexpress.webapp.toast"); - ///// - ///// Returns the range for the path specification. - ///// - //public ControlBreadcrumb Breadcrumb { get; protected set; } = new ControlBreadcrumb("webexpress.webapp.breadcrumb"); + /// + /// Returns the range for the path specification. + /// + public ControlBreadcrumb Breadcrumb { get; protected set; } = new ControlBreadcrumb("webexpress.webapp.breadcrumb"); - ///// - ///// Returns the area for prologue. - ///// - //public ControlPanel Prologue { get; protected set; } = new ControlPanel("webexpress.webapp.prologue"); + /// + /// Returns the area for prologue. + /// + public ControlPanel Prologue { get; protected set; } = new ControlPanel("webexpress.webapp.prologue"); ///// ///// Returns the range for the search options control. ///// //public ControlPanel SearchOptions { get; protected set; } = new ControlPanel("webexpress.webapp.searchoptions"); - ///// - ///// Returns the sidebar control. - ///// - //public ControlWebAppSidebar Sidebar { get; protected set; } = new ControlWebAppSidebar("webexpress.webapp.sidebar"); + /// + /// Returns the sidebar control. + /// + public ControlWebAppSidebar Sidebar { get; protected set; } = new ControlWebAppSidebar("webexpress.webapp.sidebar"); /// @@ -70,12 +70,11 @@ public VisualTreeWebApp(IComponentHub componentHub, IPageContext pageContext) Header.Fixed = TypeFixed.Top; Header.Styles = new List(["position: sticky; top: 0; z-index: 99;"]); - //Breadcrumb.Margin = new PropertySpacingMargin(PropertySpacing.Space.Null); + //Toast.BackgroundColor = LayoutSchema.ValidationWarningBackground; + Breadcrumb.Margin = new PropertySpacingMargin(PropertySpacing.Space.Null); //Breadcrumb.BackgroundColor = LayoutSchema.BreadcrumbBackground; //Breadcrumb.Size = LayoutSchema.BreadcrumbSize; - //Toast.BackgroundColor = LayoutSchema.ValidationWarningBackground; - //Sidebar.BackgroundColor = LayoutSchema.SidebarBackground; //Content.BackgroundColor = LayoutSchema.ContentBackground; @@ -86,11 +85,11 @@ public VisualTreeWebApp(IComponentHub componentHub, IPageContext pageContext) AddCssLink(UriResource.Combine(applicationContext?.ContextPath, "/assets/css/webexpress.webapp.css")); AddCssLink(UriResource.Combine(applicationContext?.ContextPath, "/assets/css/webexpress.webapp.popupnotification.css")); AddCssLink(UriResource.Combine(applicationContext?.ContextPath, "/assets/css/webexpress.webapp.taskprogressbar.css")); - AddHeaderScript(UriResource.Combine(applicationContext?.ContextPath, "assets/js/webexpress.webapp.js")); - AddHeaderScript(UriResource.Combine(applicationContext?.ContextPath, "assets/js/webexpress.webapp.popupnotification.js")); - AddHeaderScript(UriResource.Combine(applicationContext?.ContextPath, "assets/js/webexpress.webapp.selection.js")); - AddHeaderScript(UriResource.Combine(applicationContext?.ContextPath, "assets/js/webexpress.webapp.table.js")); - AddHeaderScript(UriResource.Combine(applicationContext?.ContextPath, "assets/js/webexpress.webapp.taskprogressbar.js")); + AddHeaderScriptLink(UriResource.Combine(applicationContext?.ContextPath, "assets/js/webexpress.webapp.js")); + AddHeaderScriptLink(UriResource.Combine(applicationContext?.ContextPath, "assets/js/webexpress.webapp.popupnotification.js")); + AddHeaderScriptLink(UriResource.Combine(applicationContext?.ContextPath, "assets/js/webexpress.webapp.selection.js")); + AddHeaderScriptLink(UriResource.Combine(applicationContext?.ContextPath, "assets/js/webexpress.webapp.table.js")); + AddHeaderScriptLink(UriResource.Combine(applicationContext?.ContextPath, "assets/js/webexpress.webapp.taskprogressbar.js")); } /// @@ -114,6 +113,9 @@ public override IHtmlNode Render(IVisualTreeContext context) // header Header.AppTitle.Text = html.Head.Title; html.Body.Add(Header.Render(renderContext)); + html.Body.Add(Toast.Render(renderContext)); + html.Body.Add(Breadcrumb.Render(renderContext)); + html.Body.Add(Prologue.Render(renderContext)); html.Body.Add(Content.Render(renderContext)); html.Body.Add(Footer.Render(renderContext)); diff --git a/src/WebExpress.WebApp/WebScope/IScopeAdmin.cs b/src/WebExpress.WebApp/WebScope/IScopeAdmin.cs new file mode 100644 index 0000000..6ecb7ea --- /dev/null +++ b/src/WebExpress.WebApp/WebScope/IScopeAdmin.cs @@ -0,0 +1,9 @@ +namespace WebExpress.WebApp.WebScope +{ + /// + /// An area for administrative matters. + /// + public interface IScopeAdmin : IScopeGeneral + { + } +} diff --git a/src/WebExpress.WebApp/WebScope/ScopeGeneral.cs b/src/WebExpress.WebApp/WebScope/IScopeGeneral.cs similarity index 77% rename from src/WebExpress.WebApp/WebScope/ScopeGeneral.cs rename to src/WebExpress.WebApp/WebScope/IScopeGeneral.cs index efa90e4..797449f 100644 --- a/src/WebExpress.WebApp/WebScope/ScopeGeneral.cs +++ b/src/WebExpress.WebApp/WebScope/IScopeGeneral.cs @@ -5,7 +5,7 @@ namespace WebExpress.WebApp.WebScope /// /// A general scope. /// - public class ScopeGeneral : IScope + public interface IScopeGeneral : IScope { } } diff --git a/src/WebExpress.WebApp/WebScope/IScopeSetting.cs b/src/WebExpress.WebApp/WebScope/IScopeSetting.cs new file mode 100644 index 0000000..3172024 --- /dev/null +++ b/src/WebExpress.WebApp/WebScope/IScopeSetting.cs @@ -0,0 +1,9 @@ +namespace WebExpress.WebApp.WebScope +{ + /// + /// A scope for setting pages. + /// + public interface IScopeSetting : IScopeGeneral + { + } +} diff --git a/src/WebExpress.WebApp/WebScope/ScopeAdmin.cs b/src/WebExpress.WebApp/WebScope/ScopeAdmin.cs deleted file mode 100644 index e8242b8..0000000 --- a/src/WebExpress.WebApp/WebScope/ScopeAdmin.cs +++ /dev/null @@ -1,11 +0,0 @@ -using WebExpress.WebCore.WebScope; - -namespace WebExpress.WebApp.WebScope -{ - /// - /// An area for administrative matters. - /// - public class ScopeAdmin : IScope - { - } -} diff --git a/src/WebExpress.WebApp/WebScope/ScopeSetting.cs b/src/WebExpress.WebApp/WebScope/ScopeSetting.cs deleted file mode 100644 index b0ff3a3..0000000 --- a/src/WebExpress.WebApp/WebScope/ScopeSetting.cs +++ /dev/null @@ -1,11 +0,0 @@ -using WebExpress.WebCore.WebScope; - -namespace WebExpress.WebApp.WebScope -{ - /// - /// A scope for setting pages. - /// - public class ScopeSetting : IScope - { - } -} From f8fb3c0cca8598ffe09e427c013500f1db7cc478 Mon Sep 17 00:00:00 2001 From: Rene Schwarzer Date: Sat, 4 Jan 2025 16:13:04 +0100 Subject: [PATCH 13/30] changed render call parameters to support visualtree in controls --- .../WebApiControl/UnitTestControlApiTable.cs | 36 ++++ .../UnitTestControlWebAppContent.cs | 4 +- .../WebControl/UnitTestControlWebAppFooter.cs | 4 +- .../WebControl/UnitTestControlWebAppHeader.cs | 21 ++- ...nitTestControlWebAppHeaderAppNavigation.cs | 4 +- ...UnitTestControlWebAppHeaderAppNavigator.cs | 4 +- .../UnitTestControlWebAppHeaderAppTitle.cs | 4 +- .../UnitTestControlWebAppHeaderHelp.cs | 4 +- .../UnitTestControlWebAppHeaderQuickCreate.cs | 4 +- .../UnitTestControlWebAppHeaderSettings.cs | 4 +- .../UnitTestControlWebAppHeadline.cs | 4 +- .../UnitTestControlWebAppProperty.cs | 4 +- .../UnitTestControlWebAppSidebar.cs | 4 +- .../WebFragment/UnitTestFragmentManager.cs | 7 +- .../WebApiControl/ControlApiTable.cs | 160 +++++++++--------- .../WebApiControl/ControlApiTableOption.cs | 62 +++---- .../ControlApiTableOptionItem.cs | 150 ++++++++-------- .../WebControl/ControlWebAppContent.cs | 5 +- .../WebControl/ControlWebAppFooter.cs | 9 +- .../WebControl/ControlWebAppHeader.cs | 5 +- .../ControlWebAppHeaderAppNavigation.cs | 5 +- .../ControlWebAppHeaderAppNavigator.cs | 12 +- .../WebControl/ControlWebAppHeaderAppTitle.cs | 5 +- .../WebControl/ControlWebAppHeaderHelp.cs | 5 +- .../ControlWebAppHeaderQuickCreate.cs | 7 +- .../WebControl/ControlWebAppHeaderSettings.cs | 5 +- .../WebControl/ControlWebAppHeadline.cs | 7 +- .../WebControl/ControlWebAppProperty.cs | 9 +- .../WebControl/ControlWebAppSidebar.cs | 11 +- .../WebPage/VisualTreeWebApp.cs | 13 +- 30 files changed, 332 insertions(+), 246 deletions(-) create mode 100644 src/WebExpress.WebApp.Test/WebApiControl/UnitTestControlApiTable.cs diff --git a/src/WebExpress.WebApp.Test/WebApiControl/UnitTestControlApiTable.cs b/src/WebExpress.WebApp.Test/WebApiControl/UnitTestControlApiTable.cs new file mode 100644 index 0000000..e034585 --- /dev/null +++ b/src/WebExpress.WebApp.Test/WebApiControl/UnitTestControlApiTable.cs @@ -0,0 +1,36 @@ +using WebExpress.WebApp.Test.Fixture; +using WebExpress.WebApp.WebApiControl; +using WebExpress.WebUI.WebPage; + +namespace WebExpress.WebApp.Test.WebApiControl +{ + /// + /// Tests the api table control. + /// + [Collection("NonParallelTests")] + public class UnitTestControlApiTable + { + /// + /// Tests the id property of the api table control. + /// + [Theory] + [InlineData(null, @"
")] + [InlineData("id", @"
")] + public void Id(string id, string expected) + { + // preconditions + var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); + var application = componentHub.ApplicationManager.GetApplications(typeof(TestApplication)).FirstOrDefault(); + var context = UnitTestControlFixture.CrerateRenderContextMock(application); + var visualTree = new VisualTreeControl(componentHub, context.PageContext); + var control = new ControlApiTable(id) + { + }; + + // test execution + var html = control.Render(context, visualTree); + + AssertExtensions.EqualWithPlaceholders(expected, html); + } + } +} diff --git a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppContent.cs b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppContent.cs index b1918fb..32dd36e 100644 --- a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppContent.cs +++ b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppContent.cs @@ -1,5 +1,6 @@ using WebExpress.WebApp.Test.Fixture; using WebExpress.WebApp.WebControl; +using WebExpress.WebUI.WebPage; namespace WebExpress.WebApp.Test.WebControl { @@ -21,12 +22,13 @@ public void Id(string id, string expected) var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); var application = componentHub.ApplicationManager.GetApplications(typeof(TestApplication)).FirstOrDefault(); var context = UnitTestControlFixture.CrerateRenderContextMock(application); + var visualTree = new VisualTreeControl(componentHub, context.PageContext); var control = new ControlWebAppContent(id) { }; // test execution - var html = control.Render(context); + var html = control.Render(context, visualTree); AssertExtensions.EqualWithPlaceholders(expected, html); } diff --git a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppFooter.cs b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppFooter.cs index 5951b51..c61fe40 100644 --- a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppFooter.cs +++ b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppFooter.cs @@ -1,5 +1,6 @@ using WebExpress.WebApp.Test.Fixture; using WebExpress.WebApp.WebControl; +using WebExpress.WebUI.WebPage; namespace WebExpress.WebApp.Test.WebControl { @@ -21,12 +22,13 @@ public void Id(string id, string expected) var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); var application = componentHub.ApplicationManager.GetApplications(typeof(TestApplication)).FirstOrDefault(); var context = UnitTestControlFixture.CrerateRenderContextMock(application); + var visualTree = new VisualTreeControl(componentHub, context.PageContext); var control = new ControlWebAppFooter(id) { }; // test execution - var html = control.Render(context); + var html = control.Render(context, visualTree); AssertExtensions.EqualWithPlaceholders(expected, html); } diff --git a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeader.cs b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeader.cs index fb5b12d..3baaa37 100644 --- a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeader.cs +++ b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeader.cs @@ -1,6 +1,7 @@ using WebExpress.WebApp.Test.Fixture; using WebExpress.WebApp.WebControl; using WebExpress.WebUI.WebControl; +using WebExpress.WebUI.WebPage; namespace WebExpress.WebApp.Test.WebControl { @@ -19,14 +20,15 @@ public class UnitTestControlWebAppHeader public void Id(string id, string expected) { // preconditions - UnitTestControlFixture.CreateAndRegisterComponentHubMock(); + var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); var context = UnitTestControlFixture.CrerateRenderContextMock(); + var visualTree = new VisualTreeControl(componentHub, context.PageContext); var control = new ControlWebAppHeader(id) { }; // test execution - var html = control.Render(context); + var html = control.Render(context, visualTree); AssertExtensions.EqualWithPlaceholders(expected, html); } @@ -48,15 +50,16 @@ public void Id(string id, string expected) public void TextColor(TypeColorNavbar textColor, string expected) { // preconditions - UnitTestControlFixture.CreateAndRegisterComponentHubMock(); + var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); var context = UnitTestControlFixture.CrerateRenderContextMock(); + var visualTree = new VisualTreeControl(componentHub, context.PageContext); var control = new ControlWebAppHeader() { TextColor = new PropertyColorNavbar(textColor) }; // test execution - var html = control.Render(context); + var html = control.Render(context, visualTree); AssertExtensions.EqualWithPlaceholders(expected, html); } @@ -71,15 +74,16 @@ public void TextColor(TypeColorNavbar textColor, string expected) public void Fixed(TypeFixed fixedProperty, string expected) { // preconditions - UnitTestControlFixture.CreateAndRegisterComponentHubMock(); + var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); var context = UnitTestControlFixture.CrerateRenderContextMock(); + var visualTree = new VisualTreeControl(componentHub, context.PageContext); var control = new ControlWebAppHeader() { Fixed = fixedProperty }; // test execution - var html = control.Render(context); + var html = control.Render(context, visualTree); AssertExtensions.EqualWithPlaceholders(expected, html); } @@ -93,15 +97,16 @@ public void Fixed(TypeFixed fixedProperty, string expected) public void Sticky(TypeSticky sticky, string expected) { // preconditions - UnitTestControlFixture.CreateAndRegisterComponentHubMock(); + var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); var context = UnitTestControlFixture.CrerateRenderContextMock(); + var visualTree = new VisualTreeControl(componentHub, context.PageContext); var control = new ControlWebAppHeader() { Sticky = sticky }; // test execution - var html = control.Render(context); + var html = control.Render(context, visualTree); AssertExtensions.EqualWithPlaceholders(expected, html); } diff --git a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderAppNavigation.cs b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderAppNavigation.cs index 9e74763..e4e9dcc 100644 --- a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderAppNavigation.cs +++ b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderAppNavigation.cs @@ -1,5 +1,6 @@ using WebExpress.WebApp.Test.Fixture; using WebExpress.WebApp.WebControl; +using WebExpress.WebUI.WebPage; namespace WebExpress.WebApp.Test.WebControl { @@ -21,12 +22,13 @@ public void Id(string id, string expected) var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); var application = componentHub.ApplicationManager.GetApplications(typeof(TestApplication)).FirstOrDefault(); var context = UnitTestControlFixture.CrerateRenderContextMock(application); + var visualTree = new VisualTreeControl(componentHub, context.PageContext); var control = new ControlWebAppHeaderAppNavigation(id) { }; // test execution - var html = control.Render(context); + var html = control.Render(context, visualTree); AssertExtensions.EqualWithPlaceholders(expected, html); } diff --git a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderAppNavigator.cs b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderAppNavigator.cs index 2bf295e..7e97b7b 100644 --- a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderAppNavigator.cs +++ b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderAppNavigator.cs @@ -1,5 +1,6 @@ using WebExpress.WebApp.Test.Fixture; using WebExpress.WebApp.WebControl; +using WebExpress.WebUI.WebPage; namespace WebExpress.WebApp.Test.WebControl { @@ -21,12 +22,13 @@ public void Id(string id, string expected) var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); var application = componentHub.ApplicationManager.GetApplications(typeof(TestApplication)).FirstOrDefault(); var context = UnitTestControlFixture.CrerateRenderContextMock(application); + var visualTree = new VisualTreeControl(componentHub, context.PageContext); var control = new ControlWebAppHeaderAppNavigator(id) { }; // test execution - var html = control.Render(context); + var html = control.Render(context, visualTree); AssertExtensions.EqualWithPlaceholders(expected, html); } diff --git a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderAppTitle.cs b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderAppTitle.cs index 0856ab2..36f064e 100644 --- a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderAppTitle.cs +++ b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderAppTitle.cs @@ -1,5 +1,6 @@ using WebExpress.WebApp.Test.Fixture; using WebExpress.WebApp.WebControl; +using WebExpress.WebUI.WebPage; namespace WebExpress.WebApp.Test.WebControl { @@ -20,12 +21,13 @@ public void Id(string id, string expected) // preconditions var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); var context = UnitTestControlFixture.CrerateRenderContextMock(componentHub?.ApplicationManager.Applications.FirstOrDefault()); + var visualTree = new VisualTreeControl(componentHub, context.PageContext); var control = new ControlWebAppHeaderAppTitle(id) { }; // test execution - var html = control.Render(context); + var html = control.Render(context, visualTree); AssertExtensions.EqualWithPlaceholders(expected, html); } diff --git a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderHelp.cs b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderHelp.cs index 6c0131b..88452de 100644 --- a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderHelp.cs +++ b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderHelp.cs @@ -1,5 +1,6 @@ using WebExpress.WebApp.Test.Fixture; using WebExpress.WebApp.WebControl; +using WebExpress.WebUI.WebPage; namespace WebExpress.WebApp.Test.WebControl { @@ -21,12 +22,13 @@ public void Id(string id, string expected) var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); var application = componentHub.ApplicationManager.GetApplications(typeof(TestApplication)).FirstOrDefault(); var context = UnitTestControlFixture.CrerateRenderContextMock(application); + var visualTree = new VisualTreeControl(componentHub, context.PageContext); var control = new ControlWebAppHeaderHelp(id) { }; // test execution - var html = control.Render(context); + var html = control.Render(context, visualTree); AssertExtensions.EqualWithPlaceholders(expected, html); } diff --git a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderQuickCreate.cs b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderQuickCreate.cs index 2b7c41d..36b7a3b 100644 --- a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderQuickCreate.cs +++ b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderQuickCreate.cs @@ -1,5 +1,6 @@ using WebExpress.WebApp.Test.Fixture; using WebExpress.WebApp.WebControl; +using WebExpress.WebUI.WebPage; namespace WebExpress.WebApp.Test.WebControl { @@ -21,12 +22,13 @@ public void Id(string id, string expected) var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); var application = componentHub.ApplicationManager.GetApplications(typeof(TestApplication)).FirstOrDefault(); var context = UnitTestControlFixture.CrerateRenderContextMock(application); + var visualTree = new VisualTreeControl(componentHub, context.PageContext); var control = new ControlWebAppHeaderQuickCreate(id) { }; // test execution - var html = control.Render(context); + var html = control.Render(context, visualTree); AssertExtensions.EqualWithPlaceholders(expected, html); } diff --git a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderSettings.cs b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderSettings.cs index 892304c..14835ae 100644 --- a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderSettings.cs +++ b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderSettings.cs @@ -1,5 +1,6 @@ using WebExpress.WebApp.Test.Fixture; using WebExpress.WebApp.WebControl; +using WebExpress.WebUI.WebPage; namespace WebExpress.WebApp.Test.WebControl { @@ -21,12 +22,13 @@ public void Id(string id, string expected) var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); var application = componentHub.ApplicationManager.GetApplications(typeof(TestApplication)).FirstOrDefault(); var context = UnitTestControlFixture.CrerateRenderContextMock(application); + var visualTree = new VisualTreeControl(componentHub, context.PageContext); var control = new ControlWebAppHeaderSettings(id) { }; // test execution - var html = control.Render(context); + var html = control.Render(context, visualTree); AssertExtensions.EqualWithPlaceholders(expected, html); } diff --git a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeadline.cs b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeadline.cs index cec3bc4..b811564 100644 --- a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeadline.cs +++ b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeadline.cs @@ -1,5 +1,6 @@ using WebExpress.WebApp.Test.Fixture; using WebExpress.WebApp.WebControl; +using WebExpress.WebUI.WebPage; namespace WebExpress.WebApp.Test.WebControl { @@ -21,12 +22,13 @@ public void Id(string id, string expected) var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); var application = componentHub.ApplicationManager.GetApplications(typeof(TestApplication)).FirstOrDefault(); var context = UnitTestControlFixture.CrerateRenderContextMock(application); + var visualTree = new VisualTreeControl(componentHub, context.PageContext); var control = new ControlWebAppHeadline(id) { }; // test execution - var html = control.Render(context); + var html = control.Render(context, visualTree); AssertExtensions.EqualWithPlaceholders(expected, html); } diff --git a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppProperty.cs b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppProperty.cs index 7280d9a..9f1ffe9 100644 --- a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppProperty.cs +++ b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppProperty.cs @@ -1,5 +1,6 @@ using WebExpress.WebApp.Test.Fixture; using WebExpress.WebApp.WebControl; +using WebExpress.WebUI.WebPage; namespace WebExpress.WebApp.Test.WebControl { @@ -21,12 +22,13 @@ public void Id(string id, string expected) var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); var application = componentHub.ApplicationManager.GetApplications(typeof(TestApplication)).FirstOrDefault(); var context = UnitTestControlFixture.CrerateRenderContextMock(application); + var visualTree = new VisualTreeControl(componentHub, context.PageContext); var control = new ControlWebAppProperty(id) { }; // test execution - var html = control.Render(context); + var html = control.Render(context, visualTree); AssertExtensions.EqualWithPlaceholders(expected, html); } diff --git a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppSidebar.cs b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppSidebar.cs index 8a19fd0..a9f5b03 100644 --- a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppSidebar.cs +++ b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppSidebar.cs @@ -1,5 +1,6 @@ using WebExpress.WebApp.Test.Fixture; using WebExpress.WebApp.WebControl; +using WebExpress.WebUI.WebPage; namespace WebExpress.WebApp.Test.WebControl { @@ -21,12 +22,13 @@ public void Id(string id, string expected) var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); var application = componentHub.ApplicationManager.GetApplications(typeof(TestApplication)).FirstOrDefault(); var context = UnitTestControlFixture.CrerateRenderContextMock(application); + var visualTree = new VisualTreeControl(componentHub, context.PageContext); var control = new ControlWebAppHeaderQuickCreate(id) { }; // test execution - var html = control.Render(context); + var html = control.Render(context, visualTree); AssertExtensions.EqualWithPlaceholders(expected, html); } diff --git a/src/WebExpress.WebApp.Test/WebFragment/UnitTestFragmentManager.cs b/src/WebExpress.WebApp.Test/WebFragment/UnitTestFragmentManager.cs index 751dd45..86a761d 100644 --- a/src/WebExpress.WebApp.Test/WebFragment/UnitTestFragmentManager.cs +++ b/src/WebExpress.WebApp.Test/WebFragment/UnitTestFragmentManager.cs @@ -7,6 +7,7 @@ using WebExpress.WebCore.WebScope; using WebExpress.WebUI.WebControl; using WebExpress.WebUI.WebFragment; +using WebExpress.WebUI.WebPage; namespace WebExpress.WebApp.Test.WebFragment { @@ -66,6 +67,7 @@ public void GetFragments(Type applicationType, Type fragmentType, Type sectionTy var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); var application = componentHub.ApplicationManager.GetApplications(applicationType).FirstOrDefault(); var renderContext = UnitTestControlFixture.CrerateRenderContextMock(application, [scopeType]); + var visualTree = new VisualTreeControl(componentHub, renderContext.PageContext); // reflection to get GetFragments method var fragmentManagerType = componentHub.FragmentManager.GetType(); @@ -92,7 +94,7 @@ public void GetFragments(Type applicationType, Type fragmentType, Type sectionTy .Invoke(componentHub.FragmentManager, parameters); var castPreferences = Enumerable.Cast(preferences); - var html = castPreferences.Select(x => x.Render(renderContext)); + var html = castPreferences.Select(x => x.Render(renderContext, visualTree)); Assert.Equal(count, html.Count()); AssertExtensions.EqualWithPlaceholders(expected, string.Join("", html).Trim()); @@ -111,9 +113,10 @@ public void Render(Type applicationType, Type sectionType, Type scopeType, strin var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); var application = componentHub.ApplicationManager.GetApplications(applicationType).FirstOrDefault(); var renderContext = UnitTestControlFixture.CrerateRenderContextMock(application, [scopeType]); + var visualTree = new VisualTreeControl(componentHub, renderContext.PageContext); // test execution - var html = componentHub.FragmentManager.Render(renderContext, sectionType); + var html = componentHub.FragmentManager.Render(renderContext, visualTree, sectionType); Assert.NotNull(html); AssertExtensions.EqualWithPlaceholders(expected, html.FirstOrDefault()?.ToString()); diff --git a/src/WebExpress.WebApp/WebApiControl/ControlApiTable.cs b/src/WebExpress.WebApp/WebApiControl/ControlApiTable.cs index 7c21148..e099ad7 100644 --- a/src/WebExpress.WebApp/WebApiControl/ControlApiTable.cs +++ b/src/WebExpress.WebApp/WebApiControl/ControlApiTable.cs @@ -1,90 +1,92 @@ -//using System; -//using System.Collections.Generic; -//using System.Linq; -//using System.Text; -//using System.Text.Json; -//using WebExpress.WebCore.WebHtml; -//using WebExpress.WebCore.WebPage; -//using WebExpress.WebUI.WebControl; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using WebExpress.WebCore.WebHtml; +using WebExpress.WebUI.WebControl; +using WebExpress.WebUI.WebPage; -//namespace WebExpress.WebApp.WebApiControl -//{ -// public class ControlApiTable : ControlPanel, IControlApi -// { -// /// -// /// Returns or sets the uri that determines the data. -// /// -// public string RestUri { get; set; } +namespace WebExpress.WebApp.WebApiControl +{ + /// + /// Represents a control panel for API table interactions. + /// + public class ControlApiTable : ControlPanel, IControlApi + { + /// + /// Returns or sets the uri that determines the data. + /// + public string RestUri { get; set; } -// /// -// /// Returns or sets the settings for the editing options (e.g. Edit, Delete, ...). -// /// -// public ControlApiTableOption OptionSettings { get; private set; } = new ControlApiTableOption(); + /// + /// Returns or sets the settings for the editing options (e.g. Edit, Delete, ...). + /// + public ControlApiTableOption OptionSettings { get; private set; } = new ControlApiTableOption(); -// /// -// /// Returns or sets the editing options (e.g. Edit, Delete, ...). -// /// -// public ICollection OptionItems { get; private set; } = new List(); + /// + /// Returns or sets the editing options (e.g. Edit, Delete, ...). + /// + public ICollection OptionItems { get; private set; } = new List(); -// /// -// /// Initializes a new instance of the class. -// /// -// /// The control id. -// public ControlApiTable(string id = null) -// : base(id ?? Guid.NewGuid().ToString()) -// { -// } + /// + /// Initializes a new instance of the class. + /// + /// The control id. + public ControlApiTable(string id = null) + : base(id ?? Guid.NewGuid().ToString()) + { + } -// /// -// /// Generates the javascript to control the control. -// /// -// /// The context in which the control is rendered. -// /// The id of the control. -// /// The css classes that are assigned to the control. -// /// The javascript code. -// protected virtual string GetScript(RenderContext context, string id, string css) -// { -// var settings = new -// { -// id = id, -// css = css, -// resturi = RestUri?.ToString(), -// optionsettings = OptionSettings, -// optionitems = OptionItems -// }; + /// + /// Generates the javascript to control the control. + /// + /// The id of the control. + /// The css classes that are assigned to the control. + /// The javascript code. + protected virtual string GetScript(string id, string css) + { + var settings = new + { + id = id, + css = css, + resturi = RestUri?.ToString(), + optionsettings = OptionSettings, + optionitems = OptionItems + }; -// var jsonOptions = new JsonSerializerOptions { WriteIndented = false }; -// var settingsJson = JsonSerializer.Serialize(settings, jsonOptions); -// var builder = new StringBuilder(); -// builder.AppendLine($"$(document).ready(function () {{"); -// builder.AppendLine($"let settings = {settingsJson};"); -// builder.AppendLine($"let container = $('#{id}');"); -// builder.AppendLine($"let obj = new webexpress.webapp.tableCtrl(settings);"); -// builder.AppendLine($"obj.on('webexpress.webui.change.columns', function() {{ obj.receiveData(); }});"); -// builder.AppendLine($"container.replaceWith(obj.getCtrl);"); -// builder.AppendLine($"}});"); + var jsonOptions = new JsonSerializerOptions { WriteIndented = false }; + var settingsJson = JsonSerializer.Serialize(settings, jsonOptions); + var builder = new StringBuilder(); + builder.AppendLine($"$(document).ready(function () {{"); + builder.AppendLine($"let settings = {settingsJson};"); + builder.AppendLine($"let container = $('#{id}');"); + builder.AppendLine($"let obj = new webexpress.webapp.tableCtrl(settings);"); + builder.AppendLine($"obj.on('webexpress.webui.change.columns', function() {{ obj.receiveData(); }});"); + builder.AppendLine($"container.replaceWith(obj.getCtrl);"); + builder.AppendLine($"}});"); -// return builder.ToString(); -// } + return builder.ToString(); + } -// /// -// /// Convert to html. -// /// -// /// The context in which the control is rendered. -// /// The control as html. -// public override IHtmlNode Render(RenderContext context) -// { -// var classes = Classes.ToList(); + /// + /// Convert the control to HTML. + /// + /// The context in which the control is rendered. + /// An HTML node representing the rendered control. + public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTreeControl visualTree) + { + var classes = Classes.ToList(); -// var html = new HtmlElementTextContentDiv() -// { -// Id = Id, -// Style = GetStyles() -// }; + var html = new HtmlElementTextContentDiv() + { + Id = Id, + Style = GetStyles() + }; -// context.VisualTree.AddScript(Id, GetScript(context, Id, string.Join(" ", classes))); + renderContext.AddScript(Id, GetScript(Id, string.Join(" ", classes))); -// return html; -// } -// } -//} + return html; + } + } +} diff --git a/src/WebExpress.WebApp/WebApiControl/ControlApiTableOption.cs b/src/WebExpress.WebApp/WebApiControl/ControlApiTableOption.cs index ab9814c..0eac6ca 100644 --- a/src/WebExpress.WebApp/WebApiControl/ControlApiTableOption.cs +++ b/src/WebExpress.WebApp/WebApiControl/ControlApiTableOption.cs @@ -1,35 +1,35 @@ -//using System.Text.Json.Serialization; +using System.Text.Json.Serialization; -//namespace WebExpress.WebApp.WebApiControl -//{ -// /// -// /// Meta information of a CRUD option (e.g. Edit, Delete, ...). -// /// -// public class ControlApiTableOption -// { -// /// -// /// Returns or sets the label of the option entry. Null for separators. -// /// -// [JsonPropertyName("label")] -// public string Label { get; set; } +namespace WebExpress.WebApp.WebApiControl +{ + /// + /// Meta information of a CRUD option (e.g. Edit, Delete, ...). + /// + public class ControlApiTableOption + { + /// + /// Returns or sets the label of the option entry. Null for separators. + /// + [JsonPropertyName("label")] + public string Label { get; set; } -// /// -// /// Returns or sets the icon of the option entry. -// /// -// [JsonPropertyName("icon")] -// public string Icon { get; set; } + /// + /// Returns or sets the icon of the option entry. + /// + [JsonPropertyName("icon")] + public string Icon { get; set; } -// /// -// /// Returns or sets the color of the option entry. -// /// -// [JsonPropertyName("color")] -// public string Color { get; set; } + /// + /// Returns or sets the color of the option entry. + /// + [JsonPropertyName("color")] + public string Color { get; set; } -// /// -// /// Initializes a new instance of the class. -// /// -// public ControlApiTableOption() -// { -// } -// } -//} + /// + /// Initializes a new instance of the class. + /// + public ControlApiTableOption() + { + } + } +} diff --git a/src/WebExpress.WebApp/WebApiControl/ControlApiTableOptionItem.cs b/src/WebExpress.WebApp/WebApiControl/ControlApiTableOptionItem.cs index 86fc2f7..f37bb85 100644 --- a/src/WebExpress.WebApp/WebApiControl/ControlApiTableOptionItem.cs +++ b/src/WebExpress.WebApp/WebApiControl/ControlApiTableOptionItem.cs @@ -1,86 +1,86 @@ -//using System.Text.Json.Serialization; +using System.Text.Json.Serialization; -//namespace WebExpress.WebApp.WebApiControl -//{ -// /// -// /// Meta information of a CRUD option (e.g. Edit, Delete, ...). -// /// -// public class ControlApiTableOptionItem -// { -// /// -// /// The types of an option entry. -// /// -// public enum OptionType { Item, Header, Divider }; +namespace WebExpress.WebApp.WebApiControl +{ + /// + /// Meta information of a CRUD option (e.g. Edit, Delete, ...). + /// + public class ControlApiTableOptionItem + { + /// + /// The types of an option entry. + /// + public enum OptionType { Item, Header, Divider }; -// /// -// /// Returns or sets the type of an option entry. -// /// -// [JsonIgnore] -// public OptionType Type { get; private set; } + /// + /// Returns or sets the type of an option entry. + /// + [JsonIgnore] + public OptionType Type { get; private set; } -// /// -// /// Returns or sets the label of an option entry. Null for separators. -// /// -// [JsonPropertyName("label")] -// public string Label { get; set; } + /// + /// Returns or sets the label of an option entry. Null for separators. + /// + [JsonPropertyName("label")] + public string Label { get; set; } -// /// -// /// Returns or sets the icon of an option entry. -// /// -// [JsonPropertyName("icon")] -// public string Icon { get; set; } + /// + /// Returns or sets the icon of an option entry. + /// + [JsonPropertyName("icon")] + public string Icon { get; set; } -// /// -// /// Returns or sets the color of the option entry. -// /// -// [JsonPropertyName("color")] -// public string Color { get; set; } + /// + /// Returns or sets the color of the option entry. + /// + [JsonPropertyName("color")] + public string Color { get; set; } -// /// -// ///Returns or sets the uri. -// /// -// [JsonPropertyName("uri")] -// public string Uri { get; set; } + /// + ///Returns or sets the uri. + /// + [JsonPropertyName("uri")] + public string Uri { get; set; } -// /// -// /// Returns or sets the css. -// /// -// [JsonPropertyName("css")] -// public string CSS => Type switch { OptionType.Divider => "dropdown-divider", OptionType.Header => "dropdown-header", _ => "dropdown-item" }; + /// + /// Returns or sets the css. + /// + [JsonPropertyName("css")] + public string CSS => Type switch { OptionType.Divider => "dropdown-divider", OptionType.Header => "dropdown-header", _ => "dropdown-item" }; -// /// -// /// Returns or sets a function that determines whether the entry should be disabled. The value describes the -// /// body of a java script function that returns a bool value (e.g. return true;). The parameter is the -// /// item (data object). -// /// -// [JsonPropertyName("disabled")] -// public string Disabled { get; set; } + /// + /// Returns or sets a function that determines whether the entry should be disabled. The value describes the + /// body of a java script function that returns a bool value (e.g. return true;). The parameter is the + /// item (data object). + /// + [JsonPropertyName("disabled")] + public string Disabled { get; set; } -// /// -// /// Returns or sets an action to be called when the link is clicked. The value describes the body of a -// /// java script function, which is called when the link is clicked (e.g. older("hello");). The parameters -// /// are the item (data object) and the options (this object). -// /// -// [JsonPropertyName("onclick")] -// public string OnClick { get; set; } + /// + /// Returns or sets an action to be called when the link is clicked. The value describes the body of a + /// java script function, which is called when the link is clicked (e.g. older("hello");). The parameters + /// are the item (data object) and the options (this object). + /// + [JsonPropertyName("onclick")] + public string OnClick { get; set; } -// /// -// /// Initializes a new instance of the class. -// /// -// public ControlApiTableOptionItem() -// { -// Type = OptionType.Divider; -// } + /// + /// Initializes a new instance of the class. + /// + public ControlApiTableOptionItem() + { + Type = OptionType.Divider; + } -// /// -// /// Initializes a new instance of the class. -// /// -// /// The label of the column. -// /// The type of option entry. -// public ControlApiTableOptionItem(string label, OptionType type = OptionType.Item) -// { -// Label = label; -// Type = type; -// } -// } -//} + /// + /// Initializes a new instance of the class. + /// + /// The label of the column. + /// The type of option entry. + public ControlApiTableOptionItem(string label, OptionType type = OptionType.Item) + { + Label = label; + Type = type; + } + } +} diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppContent.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppContent.cs index 988611b..a317303 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppContent.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppContent.cs @@ -88,8 +88,9 @@ public ControlWebAppContent(string id = null) /// Convert the control to HTML. ///
/// The context in which the control is rendered. + /// The visual tree representing the control's structure. /// An HTML node representing the rendered control. - public override IHtmlNode Render(IRenderControlContext renderContext) + public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTreeControl visualTree) { var preferences = WebEx.ComponentHub.FragmentManager.GetFragments ( @@ -136,7 +137,7 @@ public override IHtmlNode Render(IRenderControlContext renderContext) Add(MainPanel); } - return base.Render(renderContext); + return base.Render(renderContext, visualTree); } } } diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppFooter.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppFooter.cs index f602425..216b136 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppFooter.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppFooter.cs @@ -44,8 +44,9 @@ public ControlWebAppFooter(string id = null) /// Convert the control to HTML. ///
/// The context in which the control is rendered. + /// The visual tree representing the control's structure. /// An HTML node representing the rendered control. - public override IHtmlNode Render(IRenderControlContext renderContext) + public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTreeControl visualTree) { var preferences = WebEx.ComponentHub.FragmentManager.GetFragments ( @@ -71,9 +72,9 @@ public override IHtmlNode Render(IRenderControlContext renderContext) var elements = new List { - new HtmlElementTextContentDiv(preferencesList.Select(x => x.Render(renderContext)).ToArray()), - new HtmlElementTextContentDiv(primaryList.Select(x => x.Render(renderContext)).ToArray()) { Class = "justify-content-center" }, - new HtmlElementTextContentDiv(secondaryList.Select(x => x.Render(renderContext)).ToArray()) + new HtmlElementTextContentDiv(preferencesList.Select(x => x.Render(renderContext, visualTree)).ToArray()), + new HtmlElementTextContentDiv(primaryList.Select(x => x.Render(renderContext, visualTree)).ToArray()) { Class = "justify-content-center" }, + new HtmlElementTextContentDiv(secondaryList.Select(x => x.Render(renderContext, visualTree)).ToArray()) }; return new HtmlElementTextContentDiv(elements.ToArray()) diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeader.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeader.cs index 050a7ee..ababb62 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeader.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeader.cs @@ -98,8 +98,9 @@ public ControlWebAppHeader(string id = null) /// Convert the control to HTML. /// /// The context in which the control is rendered. + /// The visual tree representing the control's structure. /// An HTML node representing the rendered control. - public override IHtmlNode Render(IRenderControlContext renderContext) + public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTreeControl visualTree) { var content = new ControlPanelFlexbox ( @@ -117,7 +118,7 @@ public override IHtmlNode Render(IRenderControlContext renderContext) Align = TypeAlignFlexbox.Center }; - return new HtmlElementSectionHeader(content.Render(renderContext)) + return new HtmlElementSectionHeader(content.Render(renderContext, visualTree)) { Id = Id, Class = Css.Concatenate("navbar", GetClasses()), diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigation.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigation.cs index de311f0..50d2b2f 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigation.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigation.cs @@ -43,8 +43,9 @@ public ControlWebAppHeaderAppNavigation(string id = null) /// Convert the control to HTML. /// /// The context in which the control is rendered. + /// The visual tree representing the control's structure. /// An HTML node representing the rendered control. - public override IHtmlNode Render(IRenderControlContext renderContext) + public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTreeControl visualTree) { var preferences = WebEx.ComponentHub.FragmentManager.GetFragments ( @@ -88,7 +89,7 @@ public override IHtmlNode Render(IRenderControlContext renderContext) //LinkColor = LayoutSchema.HeaderNavigationLink }; - return new HtmlElementTextContentDiv(preferencesCtrl.Render(renderContext), primaryCtrl.Render(renderContext), secondaryCtrl.Render(renderContext)) + return new HtmlElementTextContentDiv(preferencesCtrl.Render(renderContext, visualTree), primaryCtrl.Render(renderContext, visualTree), secondaryCtrl.Render(renderContext, visualTree)) { Id = Id, Class = Css.Concatenate("", GetClasses()), diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigator.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigator.cs index 9c1b5e0..ca3dab8 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigator.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigator.cs @@ -102,8 +102,9 @@ public void RemoveSecondary(IControlDropdownItem item) /// Convert the control to HTML. /// /// The context in which the control is rendered. + /// The visual tree representing the control's structure. /// An HTML node representing the rendered control. - public override IHtmlNode Render(IRenderControlContext renderContext) + public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTreeControl visualTree) { var preferences = WebEx.ComponentHub.FragmentManager.GetFragments ( @@ -111,17 +112,22 @@ public override IHtmlNode Render(IRenderControlContext renderContext) renderContext?.PageContext?.Scopes ); - return Render(renderContext, _preferences.Union(preferences), _primary, _secondary); + return Render(renderContext, visualTree, _preferences.Union(preferences), _primary, _secondary); } /// /// Convert the control to HTML. /// /// The context in which the control is rendered. + /// The visual tree representing the control's structure. + /// The preferences area items. + /// The primary area items. + /// The secondary area items. /// An HTML node representing the rendered control. public virtual IHtmlNode Render ( IRenderControlContext renderContext, + IVisualTreeControl visualTree, IEnumerable preferences, IEnumerable primary, IEnumerable secondary @@ -166,7 +172,7 @@ IEnumerable secondary Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None) }; - return logo?.Render(renderContext); + return logo?.Render(renderContext, visualTree); } } } diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppTitle.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppTitle.cs index 4c516f6..023ba86 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppTitle.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppTitle.cs @@ -24,8 +24,9 @@ public ControlWebAppHeaderAppTitle(string id = null) /// Convert the control to HTML. /// /// The context in which the control is rendered. + /// The visual tree representing the control's structure. /// An HTML node representing the rendered control. - public override IHtmlNode Render(IRenderControlContext renderContext) + public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTreeControl visualTree) { var apptitle = new ControlText() { @@ -36,7 +37,7 @@ public override IHtmlNode Render(IRenderControlContext renderContext) Margin = new PropertySpacingMargin(PropertySpacing.Space.None, PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.Null) }; - return new HtmlElementTextSemanticsA(apptitle.Render(renderContext)) + return new HtmlElementTextSemanticsA(apptitle.Render(renderContext, visualTree)) { Id = Id, Href = renderContext?.PageContext?.ApplicationContext?.ContextPath?.ToString(), diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderHelp.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderHelp.cs index 3117198..d3b22fe 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderHelp.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderHelp.cs @@ -44,8 +44,9 @@ public ControlWebAppHeaderHelp(string id = null) /// Convert the control to HTML. /// /// The context in which the control is rendered. + /// The visual tree representing the control's structure. /// An HTML node representing the rendered control. - public override IHtmlNode Render(IRenderControlContext renderContext) + public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTreeControl visualTree) { var preferences = WebEx.ComponentHub.FragmentManager.GetFragments ( @@ -98,7 +99,7 @@ public override IHtmlNode Render(IRenderControlContext renderContext) } : null; - return help?.Render(renderContext); + return help?.Render(renderContext, visualTree); } } } diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderQuickCreate.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderQuickCreate.cs index d9f61d6..31c3408 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderQuickCreate.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderQuickCreate.cs @@ -44,8 +44,9 @@ public ControlWebAppHeaderQuickCreate(string id = null) /// Convert the control to HTML. /// /// The context in which the control is rendered. + /// The visual tree representing the control's structure. /// An HTML node representing the rendered control. - public override IHtmlNode Render(IRenderControlContext renderContext) + public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTreeControl visualTree) { var preferences = WebEx.ComponentHub.FragmentManager.GetFragments ( @@ -70,7 +71,7 @@ public override IHtmlNode Render(IRenderControlContext renderContext) quickcreateList.AddRange(Secondary.Union(secondary)); var firstQuickcreate = (quickcreateList.FirstOrDefault() as ControlLink); - firstQuickcreate?.Render(renderContext); + firstQuickcreate?.Render(renderContext, visualTree); var quickcreate = (quickcreateList.Count > 1) ? (IControl)new ControlSplitButtonLink(Id, quickcreateList.Skip(1).ToArray()) @@ -96,7 +97,7 @@ public override IHtmlNode Render(IRenderControlContext renderContext) } : null; - return quickcreate?.Render(renderContext); + return quickcreate?.Render(renderContext, visualTree); } } } diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs index 198176a..785fe4b 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs @@ -44,8 +44,9 @@ public ControlWebAppHeaderSettings(string id = null) /// Convert the control to HTML. /// /// The context in which the control is rendered. + /// The visual tree representing the control's structure. /// An HTML node representing the rendered control. - public override IHtmlNode Render(IRenderControlContext renderContext) + public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTreeControl visualTree) { var preferences = WebEx.ComponentHub.FragmentManager.GetFragments ( @@ -98,7 +99,7 @@ public override IHtmlNode Render(IRenderControlContext renderContext) } : null; - return settings?.Render(renderContext); + return settings?.Render(renderContext, visualTree); } } } diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeadline.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeadline.cs index 86cd758..ff66e56 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeadline.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeadline.cs @@ -69,8 +69,9 @@ public ControlWebAppHeadline(string id = null) /// Convert the control to HTML. /// /// The context in which the control is rendered. + /// The visual tree representing the control's structure. /// An HTML node representing the rendered control. - public override IHtmlNode Render(IRenderControlContext renderContext) + public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTreeControl visualTree) { var preferences = WebEx.ComponentHub.FragmentManager.GetFragments ( @@ -171,7 +172,7 @@ public override IHtmlNode Render(IRenderControlContext renderContext) var metadata = new HtmlElementTextContentDiv ( - Metadata.Select(x => x.Render(renderContext)).ToArray() + Metadata.Select(x => x.Render(renderContext, visualTree)).ToArray() ) { Class = Css.Concatenate("ms-2 me-2 mb-3 text-secondary"), @@ -180,7 +181,7 @@ public override IHtmlNode Render(IRenderControlContext renderContext) return new HtmlElementSectionHeader ( - content.Render(renderContext), + content.Render(renderContext, visualTree), Metadata.Count > 0 ? metadata : null ) { diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppProperty.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppProperty.cs index 0e44f0f..8674c29 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppProperty.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppProperty.cs @@ -43,8 +43,9 @@ public ControlWebAppProperty(string id = null) /// Convert the control to HTML. /// /// The context in which the control is rendered. + /// The visual tree representing the control's structure. /// An HTML node representing the rendered control. - public override IHtmlNode Render(IRenderControlContext renderContext) + public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTreeControl visualTree) { var preferences = WebEx.ComponentHub.FragmentManager.GetFragments ( @@ -73,9 +74,9 @@ public override IHtmlNode Render(IRenderControlContext renderContext) return null; } - var preferencesCtrl = new HtmlElementTextContentDiv(preferencesList.Select(x => x.Render(renderContext)).ToArray()); - var primaryCtrl = new HtmlElementTextContentDiv(primaryList.Select(x => x.Render(renderContext)).ToArray()); - var secondaryCtrl = new HtmlElementTextContentDiv(secondaryList.Select(x => x.Render(renderContext)).ToArray()); + var preferencesCtrl = new HtmlElementTextContentDiv(preferencesList.Select(x => x.Render(renderContext, visualTree)).ToArray()); + var primaryCtrl = new HtmlElementTextContentDiv(primaryList.Select(x => x.Render(renderContext, visualTree)).ToArray()); + var secondaryCtrl = new HtmlElementTextContentDiv(secondaryList.Select(x => x.Render(renderContext, visualTree)).ToArray()); return new HtmlElementTextContentDiv(preferencesCtrl, primaryCtrl, secondaryCtrl) { diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppSidebar.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppSidebar.cs index 3a38c5e..9138a33 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppSidebar.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppSidebar.cs @@ -48,8 +48,9 @@ public ControlWebAppSidebar(string id = null) /// Convert the control to HTML. /// /// The context in which the control is rendered. + /// The visual tree representing the control's structure. /// An HTML node representing the rendered control. - public override IHtmlNode Render(IRenderControlContext renderContext) + public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTreeControl visualTree) { var header = WebEx.ComponentHub.FragmentManager.GetFragments ( @@ -91,10 +92,10 @@ public override IHtmlNode Render(IRenderControlContext renderContext) } var elements = new List(); - elements.AddRange(headerList.Select(x => x.Render(renderContext))); - elements.AddRange(preferencesList.Select(x => x.Render(renderContext))); - elements.AddRange(primaryList.Select(x => x.Render(renderContext))); - elements.AddRange(secondaryList.Select(x => x.Render(renderContext))); + elements.AddRange(headerList.Select(x => x.Render(renderContext, visualTree))); + elements.AddRange(preferencesList.Select(x => x.Render(renderContext, visualTree))); + elements.AddRange(primaryList.Select(x => x.Render(renderContext, visualTree))); + elements.AddRange(secondaryList.Select(x => x.Render(renderContext, visualTree))); return new HtmlElementTextContentDiv(elements.ToArray()) { diff --git a/src/WebExpress.WebApp/WebPage/VisualTreeWebApp.cs b/src/WebExpress.WebApp/WebPage/VisualTreeWebApp.cs index 987cab9..6648aed 100644 --- a/src/WebExpress.WebApp/WebPage/VisualTreeWebApp.cs +++ b/src/WebExpress.WebApp/WebPage/VisualTreeWebApp.cs @@ -71,6 +71,7 @@ public VisualTreeWebApp(IComponentHub componentHub, IPageContext pageContext) Header.Styles = new List(["position: sticky; top: 0; z-index: 99;"]); //Toast.BackgroundColor = LayoutSchema.ValidationWarningBackground; + Breadcrumb.Uri = pageContext?.Uri; Breadcrumb.Margin = new PropertySpacingMargin(PropertySpacing.Space.Null); //Breadcrumb.BackgroundColor = LayoutSchema.BreadcrumbBackground; //Breadcrumb.Size = LayoutSchema.BreadcrumbSize; @@ -112,12 +113,12 @@ public override IHtmlNode Render(IVisualTreeContext context) // header Header.AppTitle.Text = html.Head.Title; - html.Body.Add(Header.Render(renderContext)); - html.Body.Add(Toast.Render(renderContext)); - html.Body.Add(Breadcrumb.Render(renderContext)); - html.Body.Add(Prologue.Render(renderContext)); - html.Body.Add(Content.Render(renderContext)); - html.Body.Add(Footer.Render(renderContext)); + html.Body.Add(Header.Render(renderContext, this)); + html.Body.Add(Toast.Render(renderContext, this)); + html.Body.Add(Breadcrumb.Render(renderContext, this)); + html.Body.Add(Prologue.Render(renderContext, this)); + html.Body.Add(Content.Render(renderContext, this)); + html.Body.Add(Footer.Render(renderContext, this)); html.Body.Scripts = [.. Scripts.Values]; From e3186d3e746c411602fcee13c0f03b12594f47ee Mon Sep 17 00:00:00 2001 From: Rene Schwarzer Date: Sat, 4 Jan 2025 17:55:00 +0100 Subject: [PATCH 14/30] changed render call parameters to support visualtree in controls --- src/WebExpress.WebApp/WebApiControl/ControlApiTable.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WebExpress.WebApp/WebApiControl/ControlApiTable.cs b/src/WebExpress.WebApp/WebApiControl/ControlApiTable.cs index e099ad7..64b5dea 100644 --- a/src/WebExpress.WebApp/WebApiControl/ControlApiTable.cs +++ b/src/WebExpress.WebApp/WebApiControl/ControlApiTable.cs @@ -84,7 +84,7 @@ public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTre Style = GetStyles() }; - renderContext.AddScript(Id, GetScript(Id, string.Join(" ", classes))); + visualTree.AddScript(Id, GetScript(Id, string.Join(" ", classes))); return html; } From 1bbc3220da7e1bdac863d6ebe3396f41235f2d01 Mon Sep 17 00:00:00 2001 From: Rene Schwarzer Date: Tue, 7 Jan 2025 20:43:02 +0100 Subject: [PATCH 15/30] general improvements and bug fixes --- src/WebExpress.WebApp/WebApi/RestApiCrud.cs | 116 ++++++++++++++++++ .../WebApi/RestApiCrudColumn.cs | 43 +++++++ .../WebApiControl/ControlApiTable.cs | 2 +- .../WebControl/ControlWebAppContent.cs | 71 +++++------ .../WebControl/ControlWebAppFooter.cs | 2 +- .../WebControl/ControlWebAppHeader.cs | 2 +- .../ControlWebAppHeaderAppNavigation.cs | 2 +- .../ControlWebAppHeaderAppNavigator.cs | 4 +- .../WebControl/ControlWebAppHeaderAppTitle.cs | 2 +- .../WebControl/ControlWebAppHeaderHelp.cs | 2 +- .../ControlWebAppHeaderQuickCreate.cs | 2 +- .../WebControl/ControlWebAppHeaderSettings.cs | 2 +- .../WebControl/ControlWebAppHeadline.cs | 2 +- .../WebControl/ControlWebAppProperty.cs | 2 +- .../WebControl/ControlWebAppSidebar.cs | 2 +- src/WebExpress.WebApp/WebResource/Asset.cs | 21 ---- .../WebResource/ResourceRestCrud.cs | 85 ------------- .../WebResource/ResourceRestCrudColumn.cs | 43 ------- 18 files changed, 206 insertions(+), 199 deletions(-) create mode 100644 src/WebExpress.WebApp/WebApi/RestApiCrud.cs create mode 100644 src/WebExpress.WebApp/WebApi/RestApiCrudColumn.cs delete mode 100644 src/WebExpress.WebApp/WebResource/Asset.cs delete mode 100644 src/WebExpress.WebApp/WebResource/ResourceRestCrud.cs delete mode 100644 src/WebExpress.WebApp/WebResource/ResourceRestCrudColumn.cs diff --git a/src/WebExpress.WebApp/WebApi/RestApiCrud.cs b/src/WebExpress.WebApp/WebApi/RestApiCrud.cs new file mode 100644 index 0000000..4fd9f67 --- /dev/null +++ b/src/WebExpress.WebApp/WebApi/RestApiCrud.cs @@ -0,0 +1,116 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using WebExpress.WebCore; +using WebExpress.WebCore.WebMessage; +using WebExpress.WebCore.WebRestApi; +using WebExpress.WebIndex; +using WebExpress.WebIndex.WebAttribute; +using WebExpress.WebIndex.Wql; + +namespace WebExpress.WebApp.WebApi +{ + + /// + /// Abstract class providing CRUD operations for REST API. + /// + /// Type of the index item. + public abstract class RestApiCrud : IRestApi where T : IIndexItem + { + /// + /// Returns the lock object. + /// + protected object Guard { get; } = new object(); + + /// + /// Processing of the resource that was called via the get request. + /// + /// The request. + /// An enumeration of which json serializer can be serialized. + public abstract IEnumerable GetColumns(Request request); + + /// + /// Processing of the resource that was called via the get request. + /// + /// The filtering and sorting options. + /// The request. + /// An enumeration of which json serializer can be serialized. + public abstract IEnumerable GetData(IWqlStatement wql, Request request); + + /// + /// Processing of the resource that was called via the get request. + /// + /// The request. + /// An enumeration of which json serializer can be serialized. + public virtual object GetData(Request request) + { + var itemCount = 50; + var search = request.HasParameter("search") ? request.GetParameter("search").Value : string.Empty; + var wql = request.HasParameter("wql") ? request.GetParameter("wql").Value : null; + var page = request.GetParameter("page"); + var columns = request.HasParameter("columns"); + var pagenumber = !string.IsNullOrWhiteSpace(page?.Value) ? Convert.ToInt32(page?.Value) : 0; + + if (columns) + { + return new { Columns = GetColumns(request) }; + } + + lock (Guard) + { + var wqlStatement = WebEx.ComponentHub.GetComponentManager()?.Retrieve(wql ?? $"{GetDefaultSearchAttribute()}='{search}'"); + var data = GetData(wqlStatement, request); + + var count = data.Count(); + var totalpage = Math.Round(count / (double)itemCount, MidpointRounding.ToEven); + + if (page == null) + { + return new { Data = data }; + } + + return new { data = data.Skip(itemCount * pagenumber).Take(itemCount), pagination = new { pagenumber, totalpage } }; + } + } + + /// + /// Creates data. + /// + /// The request. + public void CreateData(Request request) + { + throw new NotImplementedException(); + } + + /// + /// Updates data. + /// + /// The request. + public void UpdateData(Request request) + { + } + /// + /// Deletes data. + /// + /// The id of the data to delete. + /// The request. + public void DeleteData(Request request) + { + throw new NotImplementedException(); + } + + /// + /// Returns the attribute name that has been set as for search queries. + /// + /// The name of the default attribute. + protected virtual string GetDefaultSearchAttribute() + { + return typeof(T).GetProperties() + //.Where(x => x.GetCustomAttribute() != null) + .Where(x => x.GetCustomAttribute() == null) + .Select(x => x.Name) + .FirstOrDefault(); + } + } +} diff --git a/src/WebExpress.WebApp/WebApi/RestApiCrudColumn.cs b/src/WebExpress.WebApp/WebApi/RestApiCrudColumn.cs new file mode 100644 index 0000000..7509327 --- /dev/null +++ b/src/WebExpress.WebApp/WebApi/RestApiCrudColumn.cs @@ -0,0 +1,43 @@ +using System.Text.Json.Serialization; + +namespace WebExpress.WebApp.WebApi +{ + /// + /// Represents a column in a REST CRUD resource. + /// + public class RestApiCrudColumn + { + /// + /// Returns or sets the label. der Splalte + /// + [JsonPropertyName("label")] + public string Label { get; set; } + + /// + /// Returns or sets the icon. + /// + [JsonPropertyName("icon")] + public string Icon { get; set; } + + /// + /// Returns or sets the width of the table column in percentage, null for auto. + /// + [JsonPropertyName("width")] + public uint? Width { get; set; } + + /// + /// Returns or sets the Javascript code that renders the data of the cell. + /// + [JsonPropertyName("render")] + public string Render { get; set; } + + /// + /// Initializes a new instance of the class. + /// + /// The label of the column. + public RestApiCrudColumn(string label) + { + Label = label; + } + } +} diff --git a/src/WebExpress.WebApp/WebApiControl/ControlApiTable.cs b/src/WebExpress.WebApp/WebApiControl/ControlApiTable.cs index 64b5dea..f6e3960 100644 --- a/src/WebExpress.WebApp/WebApiControl/ControlApiTable.cs +++ b/src/WebExpress.WebApp/WebApiControl/ControlApiTable.cs @@ -70,7 +70,7 @@ protected virtual string GetScript(string id, string css) } /// - /// Convert the control to HTML. + /// Converts the control to an HTML representation. /// /// The context in which the control is rendered. /// An HTML node representing the rendered control. diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppContent.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppContent.cs index a317303..ea7a7a1 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppContent.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppContent.cs @@ -37,7 +37,7 @@ public class ControlWebAppContent : ControlPanel Padding = new PropertySpacingPadding(PropertySpacing.Space.Two, PropertySpacing.Space.Null), Margin = new PropertySpacingMargin(PropertySpacing.Space.Null, PropertySpacing.Space.Two, PropertySpacing.Space.Null, PropertySpacing.Space.Null), //BackgroundColor = LayoutSchema.ContentBackground, - Classes = new() { "flex-grow-1" } + Classes = ["flex-grow-1"] }; /// @@ -81,61 +81,58 @@ public ControlWebAppContent(string id = null) Add(Toolbar); Add(Flexbox); - Classes.Add("content"); + MainPanel.Add(Headline); + MainPanel.RetrieveVirtualItem += OnRetrieveVirtualMainPanelItems; + + Classes = ["content"]; } /// - /// Convert the control to HTML. + /// Handles the retrieval of virtual items for the main panel. /// - /// The context in which the control is rendered. - /// The visual tree representing the control's structure. - /// An HTML node representing the rendered control. - public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTreeControl visualTree) + /// The source of the event. + /// The event data containing the context for rendering and scopes. + private void OnRetrieveVirtualMainPanelItems(object sender, RetrieveVirtualControlItemEventArgs e) { var preferences = WebEx.ComponentHub.FragmentManager.GetFragments ( - renderContext?.PageContext?.ApplicationContext, - renderContext?.PageContext?.Scopes + e.RenderContext?.PageContext?.ApplicationContext, + e.RenderContext?.PageContext?.Scopes ); var primary = WebEx.ComponentHub.FragmentManager.GetFragments ( - renderContext?.PageContext?.ApplicationContext, - renderContext?.PageContext?.Scopes + e.RenderContext?.PageContext?.ApplicationContext, + e.RenderContext?.PageContext?.Scopes ); var secondary = WebEx.ComponentHub.FragmentManager.GetFragments ( - renderContext?.PageContext?.ApplicationContext, - renderContext?.PageContext?.Scopes + e.RenderContext?.PageContext?.ApplicationContext, + e.RenderContext?.PageContext?.Scopes ); - var preferencesList = Preferences.Union(preferences).ToList(); - var primaryList = Primary.Union(primary).ToList(); - var secondaryList = Secondary.Union(secondary).ToList(); + var preferencesList = Preferences.Union(preferences); + var primaryList = Primary.Union(primary); + var secondaryList = Secondary.Union(secondary); - MainPanel.Clear(); + e.Items = + [ + new ControlPanel("webexpress.webapp.content.main.preferences", preferencesList.ToArray()), + new ControlPanel("webexpress.webapp.content.main.primary", primaryList.ToArray()), + new ControlPanel("webexpress.webapp.content.main.secondary", secondaryList.ToArray()) + ]; + } - MainPanel.Add(Headline); - MainPanel.Add(new ControlPanel("webexpress.webapp.content.main.preferences", preferencesList.ToArray())); - MainPanel.Add(new ControlPanel("webexpress.webapp.content.main.primary", primaryList.ToArray())); - MainPanel.Add(new ControlPanel("webexpress.webapp.content.main.secondary", secondaryList.ToArray())); - - Clear(); - - if (Toolbar.Items.Any()) - { - Add(Toolbar); - } - - if (Property.Preferences.Any() || Property.Primary.Any() || Property.Secondary.Any()) - { - Add(Flexbox); - } - else - { - Add(MainPanel); - } + /// + /// Converts the control to an HTML representation. + /// + /// The context in which the control is rendered. + /// The visual tree representing the control's structure. + /// An HTML node representing the rendered control. + public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTreeControl visualTree) + { + Toolbar.Enable = Toolbar.Items.Any(); return base.Render(renderContext, visualTree); } diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppFooter.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppFooter.cs index 216b136..2cdc608 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppFooter.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppFooter.cs @@ -41,7 +41,7 @@ public ControlWebAppFooter(string id = null) } /// - /// Convert the control to HTML. + /// Converts the control to an HTML representation. /// /// The context in which the control is rendered. /// The visual tree representing the control's structure. diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeader.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeader.cs index ababb62..60316ff 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeader.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeader.cs @@ -95,7 +95,7 @@ public ControlWebAppHeader(string id = null) } /// - /// Convert the control to HTML. + /// Converts the control to an HTML representation. /// /// The context in which the control is rendered. /// The visual tree representing the control's structure. diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigation.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigation.cs index 50d2b2f..9d07ac5 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigation.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigation.cs @@ -40,7 +40,7 @@ public ControlWebAppHeaderAppNavigation(string id = null) } /// - /// Convert the control to HTML. + /// Converts the control to an HTML representation. /// /// The context in which the control is rendered. /// The visual tree representing the control's structure. diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigator.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigator.cs index ca3dab8..efe2a1f 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigator.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigator.cs @@ -99,7 +99,7 @@ public void RemoveSecondary(IControlDropdownItem item) } /// - /// Convert the control to HTML. + /// Converts the control to an HTML representation. /// /// The context in which the control is rendered. /// The visual tree representing the control's structure. @@ -116,7 +116,7 @@ public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTre } /// - /// Convert the control to HTML. + /// Converts the control to an HTML representation. /// /// The context in which the control is rendered. /// The visual tree representing the control's structure. diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppTitle.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppTitle.cs index 023ba86..6fff847 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppTitle.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppTitle.cs @@ -21,7 +21,7 @@ public ControlWebAppHeaderAppTitle(string id = null) } /// - /// Convert the control to HTML. + /// Converts the control to an HTML representation. /// /// The context in which the control is rendered. /// The visual tree representing the control's structure. diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderHelp.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderHelp.cs index d3b22fe..ba2200e 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderHelp.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderHelp.cs @@ -41,7 +41,7 @@ public ControlWebAppHeaderHelp(string id = null) } /// - /// Convert the control to HTML. + /// Converts the control to an HTML representation. /// /// The context in which the control is rendered. /// The visual tree representing the control's structure. diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderQuickCreate.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderQuickCreate.cs index 31c3408..6a62738 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderQuickCreate.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderQuickCreate.cs @@ -41,7 +41,7 @@ public ControlWebAppHeaderQuickCreate(string id = null) } /// - /// Convert the control to HTML. + /// Converts the control to an HTML representation. /// /// The context in which the control is rendered. /// The visual tree representing the control's structure. diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs index 785fe4b..d2ae40c 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs @@ -41,7 +41,7 @@ public ControlWebAppHeaderSettings(string id = null) } /// - /// Convert the control to HTML. + /// Converts the control to an HTML representation. /// /// The context in which the control is rendered. /// The visual tree representing the control's structure. diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeadline.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeadline.cs index ff66e56..2a7eef8 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeadline.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeadline.cs @@ -66,7 +66,7 @@ public ControlWebAppHeadline(string id = null) } /// - /// Convert the control to HTML. + /// Converts the control to an HTML representation. /// /// The context in which the control is rendered. /// The visual tree representing the control's structure. diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppProperty.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppProperty.cs index 8674c29..ed682a3 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppProperty.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppProperty.cs @@ -40,7 +40,7 @@ public ControlWebAppProperty(string id = null) } /// - /// Convert the control to HTML. + /// Converts the control to an HTML representation. /// /// The context in which the control is rendered. /// The visual tree representing the control's structure. diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppSidebar.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppSidebar.cs index 9138a33..200efab 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppSidebar.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppSidebar.cs @@ -45,7 +45,7 @@ public ControlWebAppSidebar(string id = null) } /// - /// Convert the control to HTML. + /// Converts the control to an HTML representation. /// /// The context in which the control is rendered. /// The visual tree representing the control's structure. diff --git a/src/WebExpress.WebApp/WebResource/Asset.cs b/src/WebExpress.WebApp/WebResource/Asset.cs deleted file mode 100644 index a10a0fe..0000000 --- a/src/WebExpress.WebApp/WebResource/Asset.cs +++ /dev/null @@ -1,21 +0,0 @@ -//using WebExpress.WebCore.WebAttribute; - -//namespace WebExpress.WebApp.WebResource -//{ -// /// -// /// Delivery of a resource embedded in the assamby. -// /// -// [Segment("assets")] -// [ContextPath("/")] -// [IncludeSubPaths(true)] -// [Module] -// public sealed class Asset : WebExpress.WebCore.WebResource.ResourceAsset -// { -// /// -// /// Initializes a new instance of the class. -// /// -// public Asset() -// { -// } -// } -//} \ No newline at end of file diff --git a/src/WebExpress.WebApp/WebResource/ResourceRestCrud.cs b/src/WebExpress.WebApp/WebResource/ResourceRestCrud.cs deleted file mode 100644 index 1039812..0000000 --- a/src/WebExpress.WebApp/WebResource/ResourceRestCrud.cs +++ /dev/null @@ -1,85 +0,0 @@ -//using System; -//using System.Collections.Generic; -//using System.Linq; -//using System.Reflection; -//using WebExpress.WebCore.WebComponent; -//using WebExpress.WebCore.WebMessage; -//using WebExpress.WebCore.WebResource; -//using WebExpress.WebIndex; -//using WebExpress.WebIndex.WebAttribute; -//using WebExpress.WebIndex.Wql; - -//namespace WebExpress.WebApp.WebResource -//{ -// public abstract class ResourceRestCrud : ResourceRest where T : IIndexItem -// { -// /// -// /// Returns the lock object. -// /// -// protected object Guard { get; } = new object(); - -// /// -// /// Processing of the resource that was called via the get request. -// /// -// /// The request. -// /// An enumeration of which json serializer can be serialized. -// public abstract IEnumerable GetColumns(Request request); - -// /// -// /// Processing of the resource that was called via the get request. -// /// -// /// The filtering and sorting options. -// /// The request. -// /// An enumeration of which json serializer can be serialized. -// public abstract IEnumerable GetData(IWqlStatement wql, Request request); - -// /// -// /// Processing of the resource that was called via the get request. -// /// -// /// The request. -// /// An enumeration of which json serializer can be serialized. -// public override object GetData(Request request) -// { -// var itemCount = 50; -// var search = request.HasParameter("search") ? request.GetParameter("search").Value : string.Empty; -// var wql = request.HasParameter("wql") ? request.GetParameter("wql").Value : null; -// var page = request.GetParameter("page"); -// var columns = request.HasParameter("columns"); -// var pagenumber = !string.IsNullOrWhiteSpace(page?.Value) ? Convert.ToInt32(page?.Value) : 0; - -// if (columns) -// { -// return new { Columns = GetColumns(request) }; -// } - -// lock (Guard) -// { -// var wqlStatement = ComponentManager.GetComponent().Retrieve(wql ?? $"{GetDefaultSearchAttribute()}='{search}'"); -// var data = GetData(wqlStatement, request); - -// var count = data.Count(); -// var totalpage = Math.Round(count / (double)itemCount, MidpointRounding.ToEven); - -// if (page == null) -// { -// return new { Data = data }; -// } - -// return new { data = data.Skip(itemCount * pagenumber).Take(itemCount), pagination = new { pagenumber = pagenumber, totalpage = totalpage } }; -// } -// } - -// /// -// /// Returns the attribute name that has been set as for search queries. -// /// -// /// The name of the default attribute. -// protected virtual string GetDefaultSearchAttribute() -// { -// return typeof(T).GetProperties() -// //.Where(x => x.GetCustomAttribute() != null) -// .Where(x => x.GetCustomAttribute() == null) -// .Select(x => x.Name) -// .FirstOrDefault(); -// } -// } -//} diff --git a/src/WebExpress.WebApp/WebResource/ResourceRestCrudColumn.cs b/src/WebExpress.WebApp/WebResource/ResourceRestCrudColumn.cs deleted file mode 100644 index 5c13b5e..0000000 --- a/src/WebExpress.WebApp/WebResource/ResourceRestCrudColumn.cs +++ /dev/null @@ -1,43 +0,0 @@ -//using System.Text.Json.Serialization; - -//namespace WebExpress.WebApp.WebResource -//{ -// /// -// /// Metainformationen einer CRUD-Tabellensplate -// /// -// public class ResourceRestCrudColumn -// { -// /// -// /// Returns or sets the label. der Splalte -// /// -// [JsonPropertyName("label")] -// public string Label { get; set; } - -// /// -// /// Returns or sets the icon. der Spalte oder null -// /// -// [JsonPropertyName("icon")] -// public string Icon { get; set; } - -// /// -// /// Returns or sets the width. der Tabellenspalte in %, null für auto -// /// -// [JsonPropertyName("width")] -// public uint? Width { get; set; } - -// /// -// /// Liefert oder setzt den Javascriptcode, welche die Daten der Zelle rendert -// /// -// [JsonPropertyName("render")] -// public string Render { get; set; } - -// /// -// /// Initializes a new instance of the class. -// /// -// /// The label of the column. -// public ResourceRestCrudColumn(string label) -// { -// Label = label; -// } -// } -//} From 5ce1e8421d4ea335c395f9f0c898eec1b5fddaa2 Mon Sep 17 00:00:00 2001 From: Rene Schwarzer Date: Tue, 14 Jan 2025 22:43:57 +0100 Subject: [PATCH 16/30] add documentation --- .github/workflows/generate-docs.yml | 52 ++++++++++++++++++ README.md | 9 ++- doc/api/toc.yml | 2 + doc/assets/webexpress.ico | Bin 0 -> 70141 bytes doc/assets/webexpress.svg | 40 ++++++++++++++ doc/docfx.json | 61 +++++++++++++++++++++ doc/index.md | 28 ++++++++++ doc/template/dashboard.html.tmpl | 47 ++++++++++++++++ doc/template/public/main.css | 10 ++++ doc/template/public/main.js | 14 +++++ doc/template/schemas/Dashboard.schema.json | 45 +++++++++++++++ doc/toc.yml | 8 +++ doc/tutorials.md | 17 ++++++ doc/user-guide.md | 17 ++++++ 14 files changed, 348 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/generate-docs.yml create mode 100644 doc/api/toc.yml create mode 100644 doc/assets/webexpress.ico create mode 100644 doc/assets/webexpress.svg create mode 100644 doc/docfx.json create mode 100644 doc/index.md create mode 100644 doc/template/dashboard.html.tmpl create mode 100644 doc/template/public/main.css create mode 100644 doc/template/public/main.js create mode 100644 doc/template/schemas/Dashboard.schema.json create mode 100644 doc/toc.yml create mode 100644 doc/tutorials.md create mode 100644 doc/user-guide.md diff --git a/.github/workflows/generate-docs.yml b/.github/workflows/generate-docs.yml new file mode 100644 index 0000000..e427ab2 --- /dev/null +++ b/.github/workflows/generate-docs.yml @@ -0,0 +1,52 @@ +name: Generate and Deploy Documentation + +on: + push: + branches: + - main + +permissions: + actions: read + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + publish-docs: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup .NET SDK + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 9.x + + - name: Install DocFX + run: dotnet tool install -g docfx + + - name: Add DocFX to PATH + run: echo "$HOME/.dotnet/tools" >> $GITHUB_PATH + + - name: Generate documentation + run: | + cd docs + docfx metadata + docfx build + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: '_site' + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/README.md b/README.md index e3a9f30..a8d1939 100644 --- a/README.md +++ b/README.md @@ -27,14 +27,19 @@ The current binaries are available for download [here](https://github.com/ReneSc # Start If you're looking to get started with `WebExpress`, we would recommend using the following documentation. It can help you understand the platform. -- [installation guide](https://github.com/ReneSchwarzer/WebExpress/blob/main/doc/installation_guide.md) -- [development guide](https://github.com/ReneSchwarzer/WebExpress/blob/main/doc/development_guide.md) +- [Installation Guide](https://github.com/ReneSchwarzer/WebExpress/blob/main/doc/installation_guide.md) +- [Development Guide](https://github.com/ReneSchwarzer/WebExpress/blob/main/doc/development_guide.md) +- [WebExpress.WebCore API Documentation](https://reneschwarzer.github.io/WebExpress.WebCore/) +- [WebExpress.WebUI API Documentation](https://reneschwarzer.github.io/WebExpress.WebUI/) +- [WebExpress.WebApp API Documentation](https://reneschwarzer.github.io/WebExpress.WebApp/) +- [WebExpress.WebIndex API Documentation](https://reneschwarzer.github.io/WebExpress.WebIndex/) # Learning The following tutorials illustrate the essential techniques of `WebExpress`. These tutorials are designed to assist you, as a developer, in understanding the various aspects of `WebExpress`. Each tutorial provides a detailed, step-by-step guide that you can work through using an example. If you’re interested in beginning the development of `WebExpress` components, we would recommend you to complete some of these tutorials. - [HelloWorld](https://github.com/ReneSchwarzer/WebExpress.Tutorial.HelloWorld#readme) - [WebApp](https://github.com/ReneSchwarzer/WebExpress.Tutorial.WebApp#readme) +- [WebIndex](https://github.com/ReneSchwarzer/WebExpress.Tutorial.WebIndex#readme) # Tags #WebApp #WebExpress #BusinessApplication #DotNet #NETCore \ No newline at end of file diff --git a/doc/api/toc.yml b/doc/api/toc.yml new file mode 100644 index 0000000..20c32af --- /dev/null +++ b/doc/api/toc.yml @@ -0,0 +1,2 @@ +### YamlMime:TableOfContent +[] diff --git a/doc/assets/webexpress.ico b/doc/assets/webexpress.ico new file mode 100644 index 0000000000000000000000000000000000000000..c0909c98b13c6125b7254544eaa2a1d91238b006 GIT binary patch literal 70141 zcmeI52|QIz|G>vC;Zl(bA*G}!m84Kw5iPQ2i9#w;l8_}k*(ys#)+EZlMA_FQTgbjg zS;|hf`=4_?-S^SegLf*y6=Qzqqx;%6sY8G83sf z2$368aFl1QWaU_yZF^9Z`~UN_ta+o;BKWt9NZB zv3OzQT25k>a%US4AMv^a8g#A89rp{fQ}zv7ozR|e2rED2SW40wbyJO5z1XJt`}NmV zpQ%CTW~&r2zAfBjt>oG4n>JFFrUuXnIc(`q^z$85V%}0HDtiO6Rd(mekn6P64~X_= z*+>2%@E-lw<Kh=if`&N ztI4t0{Y;>3W3F|!+NDl$Ny@baxoW^Ii1OM%X2_lM@14M?c0U}U-f(0?b&oLj4sKR$7@PR;oU;~@2%bge{+#f*sfrTXx%an`-2>>8ym-57+DR-0g*+blaR1t6zg-VBfATQ zy>`kBr1Jx9dp+}R)hO0u>{iS=X`kxFSxw0;G$g3))8DRteB9VewX*VVtiW}*llm+b zEXQBTDw97AS#!V=d{tjbP2+MfPMY%Goj^W84*IP{_k^oQl#a)D18R`BbMIBUGEdz* zk&mC1)}9Kl*sbVo>08ZpHH2p+OPDJ5Mv9Ew!~k~u^>CKY=jhSf1(J7Zo#H=Fc_mgx zF9&pLVqu=|o7B=Krs#L4bYB=vUL!CXuee1x$(UBDOeE*#&YYA6mlJH+alM?EeN&0E z?r^+M#d3R45k>MGj18=B9w(L~GvwQ3d2++5iHesr-bv#MJbMQ3owQmDb|})6iKk`R zn+w~fJ!zovsCnc1IjoI_c>QT_q*DV=E1> zg*jGlVgfGgnVTu|SgW)LdChN~-qLP1L9FZ_dx8p&ahrrX!>izZ%1Gi;Twin$x$e=0GQ-@v?0n$VJ!j5}9R=fbIv0*(|EU zy&Se=Yq0V?li$iEa!A3?hgr2(Ds(p@JmUZ%VgBAm3eTaI;8xf`y5iRkUZ8t{t7%o#G zuHteRwIBIvR>leIi?+=?=ws7LDr=)_svO&q*`Wnj{0M@qpy;eOW3e(|fN$R*d)4h?3> zNvIxB7qu>mDbQsYZhx}N*t|^dQ*00)=)T^Yw(B;7?A<3*W`30N=honM~G7+H;Z|^vGlbeQd4Ejski+2P4QBH zkIM71$)UQ7^lzC~uQ)f@IM!40madDE-dWblr?UZj$M2QC15V@K#Jb*MLFtTR=f}8` zlZ>eoY{b6ty=|l#8q5ohI=AN?!_NAzLyfyt9=xR;P#t9zT}#>5YZIHlL|1*~?n^c$ zI&l`@>a}YJQu^(LzP>D=-O*`uaMunt=8F=$9`|VY+%SIeSisQYOM73QkzJF4f|Tn8 zDxCt8_?~t{!AR^Xz^HpRfU;FgW7{TECUsK^wewgeBZ<1Ej;~J##2zVgGw9T;4xk6s ziF%@y)s9Yy{qAz79k<_N@vmqZC0X-6Su;&Ec$~EK(B))?+sh7+6IJi?I;mqKaAq|8 zarM5fGVqu5!$k7y?`meu;cr!(eN7p@nT%8}bk#9_|=aqqEhs2Qx^(BW_8zr#I88)52xJ!ta#DC;$ z&a%DxbXX%ql9x*#f3>nqSn*v$*#_&JtTTDaX7H|QG*4ymRZdCEn!57k%tUK}zVD|H zYpy`Q@Ynlmg-!Pa{*`RVn%2g#jZu$G01e>uKIDk}3pzKF_ilgf#crwqjE4NteDjqxX_k zT&g0xj_YHwMyciTP=O}pNvBUA`G!-tN`fzcP}o&fPchKCfk|fMg(Go_F3+Cr4Wtuf z8VA&)Zf5K`IA*)sRH@MEv4v3@Ut3qSOM@2KmsbX_DQlmJ+<90U)YRVH@AN55admHJ zj+N1tE`Ecqq=rVnyhgp=HLkT=nM=9~Gu`zM!N(!XGRnTZZA+u{JGbu^a;Rn#8Jket z)6P<*U7|*1FpxVK+I*DyuJ!AKR30H~UOF23Y<`!O$nc#!#bae#yG@ttS8FdBY!|jb zbCr67v9}(!k6KhjWtl+tqj9b}79mgPKGm-dYwT?F??;JXeHySK2`Nin_or?@wlQsA zm%bIb2zX;Ur9o@fKvGhy=11qFFt(k-9Mj+(Pp)r9!ZUSKZo~U@pV2<@$;Sold%6pc zx9-;fpBcN`t@z(1un8LQnTTOb>-Xw6rFJy8swZ)=52)uhJ6GFAUXL2eBr-6(+2_9v z431yu`u3&xiND>ebj#gIqk6sfA7SG=Ojo zNvPM-SrsxwcE!7C=|z4=PU6T&gx%}d<}T*TW11q7ldHhkz||WXynH8urTMn*eZwN{ z@@Q#5x`Fb>l8U8%Jo2tL+l4E_carnUF}9E_uQNIicDoHr6)o$c5pY;htM&5mSiju1 zeH=NVY*!ft&)q2CIcq++kB4c`bGh0R;T7^G6UT)|1l+Pj$oI-VaIkSmJ1715X(@?@ zzIwH0+Zivl#){agn?pR@Z9~SsovvMLoyJ?a&go~a2zqup?csO9m@p?JQR=o{UgATy zDAr8|^k^z8zH`@(SA4KTmOVTMe0qOlO6x8_mecGs)D{6Lb4c)}p=eSY!{7V|M3t~Gav)H3O+;#qI(T^?n;{T4r?c>-C1 z%8UJ?)E2B_Y#v@Dvd3SZ)Og#xWutDGx&|L8yeXK@Pt+CH(rXy((VOf?q-M!)xu;=y z6n8BzbGDtFbS%51wJXt$qtgws_hU~)?E;q%Q3*!KdWeQ-AJVX6zTjN(Sth(>O9^pF zV6?JJt@91ap*}l1r!{YUf{#+KvUU$BJxb}gV?6KZiwvPvN1`|MtTnB5B~p9M&UWe2 zVcqw~+sYrXrKK{jEEv##{W2qT3D17r26-lP3QtbSoZhKY!&}r1@AkMHNo@;HrM3{h z*Rt?{(FK=%*cP-@sS8T3g6P8Z$r%f)ydaFKx-eB$W7_T zx&t@)UC-^L5Ftr7E+Wm;*ZCrWr6*qPO#UUYzwcbpCgx3r7B6CRxI1eavoI9j%vpoT zsiWT}G`RN(vL3I^$S4L;MRX?&!=v~+NQHR|MGcQToT;oh-hHQjz%S!XRo||PT%kyx z^a71YeOQSv?x%%wJz8<)b7knu)QBREZL|$oX3f02(GCgqM!LKzqsADDwDnt8R+FZz z>(Y*P$iM()9R^S4nmayW>fsU34hLmCT8GOizx}M1gjk;*OgM&FVQj zeIoOZ+)xT?Fb|4~US=*ByR=p_A|~wiH<=sf-uHd%%QzF!k!J#i%?j4jan$kCl?t%(zABu`-%hoQ}6iNz*eZ3h{I;2$&(b_%D0|l$+GC!oT-GPoSEYT zSbM|xWfV)d4$3EpJp07V!|kB<mwFC9dkJ77t7ntVgkTiA=^ zH-1ndnMc#v;Usc5Wo5DNq<`Kug$kP!2Ai5&c%tR&8PcDx$m2I$4^|S+j;(O#rqu9Cq~bTc!zduuF(%ar0G5uTA?%XCHu9}L|ZNM#9opp zWwA+$milUGweEDI@CdC?FOk4Ecdm-%J-StWMu4uTv9WvT`wr~hgbU2)Dbzt#M79N` zk3s^OulDmN>| zitclJj!QO(I)2QOo{5F=l9C7G=dJ3`ZxN}xFE?G!+I^H7)IOkFanZ!1vbCdLtVJhD zBGhf8AtyOd5cdkH4eR8u60)X%&Cth1Ubivv&V`fMV|L;Jc^NC^UkKBuQUh`eXYPv; zxt0?HhKZ_0jC&`Fx^<|5Qo``)n*1c?%lt!I+`l|wV+{Z*}nDZ=KyrTv#h6^uu+oX7-fppNrI6bf88t*QfLPM8>uh-& z8jo%^YB27_yE!la=Gv~O-`=BB?DXyHX(lL9dpU|5HH16nYJK_`hlea@Efq4f;QI37_^O^q?Bw;GLZl?=+rBN4{NA)G zR)j+)ykazP^j^`m`xG1G-_UH|ywtx`r)m}Ku|D6=p69FiMBFrj2NNSz&s$r!MxeB1 z+&qrY%GZJ@-GsQ^NBj-1^oX40D6V--dfy!56hTk62F)gnKhOiV{B}^ouqZEWEB`(J3=bC z*JISfpuVww=?HatdH#8)uUe;{G21zo-Aac766}1~<*m<_b<}Om&8bcHi{_OOkN-@} z2ClXl@2MG*f8xUgXiWs&;xytN!Eki=}0Y>=KY%Bgfy&m zkvF^Qoai>{y~ub**4W7-u#JcHq*(xCePkBdm;8uL%|x2OZR?QlOXMcF7EZHb#gw8`>uhjH$K`xpGLlxy!Aw4R3m2{(QLNtOm1a7fiv8KEqq@uEEZe-zhn zr9i51@-wgLpq3bEm0Q>aetBNGXi_3w6_K+eiTRSd!nc-+5OaCy9=5PceA_uT=%uG& z(yp~v`wc1EeP5c;2OBR%98$Rc^4PQT_5yMDWRrcJHIml_uLg9RyvgmDq6RT6u!nTC z{=&pQOP8%=tb)U0*WIp=t$_{53JPun3{Ag%%YLb~_m|s}p*?h#-8#^3a;**~PjktUkM_{e4vrm?Iv8<4 z?aoFRwm>4F6&^AB&$k^m2k0M4040DDKnb7(Py#3clmJQqC4dq@37`Z}0w@8L07?KQ zfD%9npaf6?C;^lJN&qE*5KY=4^4w42z8q~E9VrO9hp}ZOQ?v3=Ob`zt~(#kv#>6iQ1MaH4SdqV zfr-g+d8gHcx@dSd0r5LzZ>!@MAPF&^by>;#3u+P;1~{Es-jqYA_$%H5H*Q z8lENq;m>aE%tv)%V&atDGCVrtz@zg?&W^w8vj?w;27bUNTjZUO=V=orkEbVNzXCQd z@kt8@>|dP4E205N06uURf9K=bzQ}PVq}TDa5udbhz$+0oO8;x3A^5<3TeDDWXFix8 znlcIb=U2zgCpjbDH~AK!;_n=WoveT3&Y$M_ZSV^rx|g{wGdRz8i1MH22F(le^>F7y zM;H%(@ChxV-ii8zsSAWX6LbkH?zauUE)HCP(qfX%y0GEtS%u0jMg__^MyTSoe%pYG zEBoSGEc1cA@L)3@pvAKj^NG!fHx4|4*ZOS(YVMpfu>2c`7rprK0L`9CE;0vY7k0eX z?;Lnnle9=;^NDGBZp8y!R#y;cPp&7w9*{HL(Z87u+Ws-{g2(yaHzfYLDK)9=~P1ECFUmU_re%tU- zOVV3`M-mHtz72LRfDWJ3^ts}U0|Oq{Q48YE-d23-PXq8v2aCh2qX9etXob7{a93ce zMSfLWPk+bkHWD03&;1xJ>&S>#fq_N-_!HI(^b4|nE=QON8lFwyq%G#c1MZvt2X8-> zgpf^xB^B>7&k%$5su zF~?sobR8KQ?awR^HwhAl<_LWJA_Ee4D3Xi)XH)&FF)yHl=G8Gbu`gWaj6 zA<#Il;>NL7 z8t=j<|Nj~O^tTMQ2hQEwu<%vzJVaA8BUx#{j&d}7a@3VI?(A;7) zXIDY=TaU%){)1#Bt(W{ATfuC?3&;E=KdWaMGd&pL147A}d+eOD~dqUx(s@As^ExFKlOUdO=qcHG?=<_TOu83T>MPAfDOYHo8?(*iGzYlqV z9Ip8a6Ebm+(Vo%tfPUnj+i*SQ2zY2X~rf0M-Jf# z7t9~e>bkG+kMGR|%x+>6t}=kvc8fNesLc-{7%`u_-ad?v7kPspmE zCJ~=BBM_W+hfs3%t4yVh8H57=lVNDXH}pT4T;%`L!AICinIM>3UXI)lW&{G}l-$Cs+J zo9l#NQ%XY!sTS7G>u3~~?L;Wq__>@gpXu<7Uo%4a-!>eWYCanjKBnVq10flsfJ1ZE z7iz3lmX#L~(_XHbIQ0yxkN9lhGRYoYI!Hi7TxbZ+$>rSs)> z|9`p_Is??=58;sgd~c1xyWQ;R@x^BazaaC$hw-rmUW?D_w~~~$p)PI6m=hiBUR{2; zsF{~$cmmAMt*r4+?>hZfgnxRmQa03(&unNg1{xV4+XZrfT@TNAy*VGdgc*MA|GYpZ zXp)rmyj1`(!r2V2KM^6cNI+unrAz2dSJ9kH$a%gn{56xdp+Pw>Kmb-jLCvfA0K)jL z-nQJ2G12)RF>k#JYm<8iyA}|houqMZ;{v6lNss_+5kZUbjCSU1lK)=J41+2Pd_Dqq zLS+Vqzx{iV7tpeNc51#7(fAnzLNUj*AQ#TlibhYJ%hcp?HvyB4^m|5DQ3 zNVSEFLsRD@0PUsowN6p~a}xU%kvd-6;@&-kFW>zo=7hrN{r~st1vZf2Ko4w!{u?81 z@Ui~)PXNsUPe9F$(=kE?wpU9UQepRY;fFOGr-s&Pye=B}j}w6Ih}xcfCP5N+Bh()z zUiVEl4otI{{_~8#D(krNKVBl5AxZ!xfD%9npaf6?C;^lJN&qE*51d>t^@$!>(n5t;srQmM+ZVOtO1-L z3*>%`0@h)2;OpQQm`50Z3ts@Zlqcx!`vl-}833-t1mfR41aRVZP}flcuKDf*aGFv8 zXOjbM-8H~JFi%-{UT#45(Qa_og%zIDYXGMO0l8H% z0IpmK%tE99oYDsPB;N#|zcqo9hBR05;klwH_> zjQt8&-WmWGzyRe<+2C2GEr`r_2f^ugATL?~Cy4_Ig^xj6SqOk{$O9ek?T`a8fXm4P zn=pA$So;dV>9K&O#})wJ7Y1V!qrf&?5nS}z207P*@SM9ajR(M2RY7E)8;FJ104KEs z@r927TrCUq4RwR(*$x2Cz7F!MVgX#T81xT!131|?vT7v^_W-@eg0LPz_ZZje<$+`2WSt3{5u&01O`Dhs7^~8{PeG9 z;Oj&C1OPuootD=BFYCKHLA52|F;1PwEqc{ppiO6y3qSY5n=zkFzs&M9@udcY*VCz-6}ByfL;vv}tMW zfc^A=!@Sb76D;rGGq3{I(_x$0V)MtS8k?Bn)Ff{MvuS;Ei}}UpO1XA@oxu&mo4{!G zALnx5)?8w9$6Z;=_D6!?)j!nXhyL8cvt!i{&}wO4B-Xif`HJqp)M;t;W{b`hgZsu2 z>fythbBWK4gQd^jmYrJ$BQ?&?6rSVw>}+ji6+xh?wu6@T+#0EfB-T302l_z)5gzMD#Z;AU#LYN*1WYx)uO7c6jx0TQ`T$LQyN35Uo|K z*B~EoV_ryj&a@Q_)0)%&8RwK)Fp`cQx%vOtmML0fhW*(8BMH3N|kdl#8 zP%inIAexR6Knb7(Py)XPfsODo`QWYw_n+H|DWN@Z12FVI03IjZ0Iy2|L2*MWsQL6B z)IyuBYxD&mVMT$nPi9v}fcCHT050)`vlSQA#N+I_>Ci4b{JkG%Z$)f`>dm0X6q^(C*2Hvymb; z&vW ziGS*;1<$h_aCYxjXwyaPrig7_){zn9RmXrQZ;YYMmkioMB|&pnCA5*o!ZZeO`QZ*| zKmUfa4IeQlf;_U|wRYm{+S1StuHwc4@~h(@=R%+e?Z0r{X;4^~gtIXt_VRjYOGj+S zaA824{rND=L)D!VXJen7ngC&0jyPNMCGQatd5ORv3?|rF9?CxrQT(aGRplp8((kH2{ErDB`l-D4Lqzb=V;|(h z*YYRw_wFx8{xkV&OB=zqU$zDdTl$GP{VA$J{hp2#o3H^cJ{_G=2!;K9`@rpa~6RI+y0X1|>rIv&t$!QB`fjIrVwvrB5(%|4`wE zwj!A`vU2hYOXt6f_8(vnJ9y~u5vX)@4>*Rwh)YOfj!Vs3008_ucJ30`&49rO?g2s= z473knL_`;mpHAAii5s&SvEHoX+lIj`!gjNk4a3d>Z7iJYH()SaKg}Ni#+4W*XkB4u zftSL%2zfxiY&ong+{UmNd4My1;Nq);)Gz(0fl(obcByC~d$)=yP* zUIRQ5u7LFN=eT|;;?INlBO(1T#GeM~uOR+Qh#$@c=+}by*$jUlfPFW6*yp(dDq$a_ zq9q6R5jk=F55zwSu0aaiW3_R8N5q#Ysn`!FIkVvUqb|`JI6oewzl-$S5T6*tKj=}C z0g!iE1^scJ;reEXzYWsALi){!p9|uL6aDr+uK$JjIwAchq~ClR`YIv)z&p^-2QJ+V z`&QR+eIBHLiTD$FB7bX`X=>=T~B z`79y+NQ%zPus{3^*AGN|rw~6I%V#HXeW~JxH@JSZJ?!HmK1Si$PPo1*;@gAt*$`hY z#DB;F$|u0SEz<8s`nWA!A7QPa8%h8r@c)g#PUUU$o|1whP@A9|jh&!S=|X`a>ZZws9)199X!tXWSyxL1sl*oMVJ47LkQEXe{*W z#_diKYPh(C@__d7IOs2plP_z^jDx<&czqz!OMFlT*X5BZ`_aa zkx%GPKIb{4e|Y{UT|^cxE{lbWivLMJxj0}>eYlJxzT6+>L7OwSyRTj0$1(DmUlli} z{^aB&LqSbqoNKfu_VUAB*b5JMuqmZaXPrMBqrgJH@;@=P)r=(uxX~-&q$nY~N51E)VFN zKC6sB>j5lWlNbAKpfe6$rvmg%#~!mJ$GXR8<5+a|w#GsGKlZR0(VY3faSB{n(4QZR zTu*I#G48%V@_>H)xO0FE6xw?l;$V9g3;p_$dX78mvKE)$DZ6Db8LJ>|LyJ2`(w}A8 z;li;6-gDLmBH!HkF;2#T0VfB?7qI2cIdPGB_ps3BZw~#`aq;#q&d#a-;~t0OKye5k zgd0*nFLPb7aO?x8i!eg!`iJa%pU6FL_d*GK#NuD~_7A?QZk#{W|B)|p--PElV=dsl z3fucw=aOw1n!6d4B6pk0rye3Pr)527@H2j{{a?k BFy8 + + + + + + + + + template + + + Tabelle.2 + + + + Tabelle.35 + + + + diff --git a/doc/docfx.json b/doc/docfx.json new file mode 100644 index 0000000..4260351 --- /dev/null +++ b/doc/docfx.json @@ -0,0 +1,61 @@ +{ + "$schema": "https://raw.githubusercontent.com/dotnet/docfx/main/schemas/docfx.schema.json", + "metadata": [ + { + "src": [ + { + "files": [ + "src/WebExpress.WebApp/*.csproj" + ], + "src": "../" + } + ], + "dest": "api", + "outputFormat": "apiPage" + } + ], + "build": { + "content": [ + { + "files": [ "**/*.{md,yml}" ], + "exclude": [ "_site/**", "obj/**" ] + } + ], + "resource": [ + { + "files": [ "**/images/**", "**/media/**", "codesnippet/**" ], + "exclude": [ "_site/**", "obj/**" ] + }, + { + "files": [ "assets/webexpress.ico", "assets/webexpress.svg" ] + }, + { + "src": "../schemas", + "files": [ "**/*.json" ], + "dest": "schemas" + } + ], + "postProcessors": [ "ExtractSearchIndex" ], + "globalMetadata": { + "_appTitle": "WebExpress.WebApp", + "_appName": "WebExpress.WebApp", + "_appFaviconPath": "assets/webexpress.ico", + "_appLogoPath": "assets/webexpress.svg", + "pdf": false + }, + "markdownEngineProperties": { + "alerts": { + "TODO": "alert alert-secondary" + } + }, + "xref": [ + "../.xrefmap.json" + ], + "output": "../_site", + "template": [ + "default", + "modern", + "template" + ] + } +} diff --git a/doc/index.md b/doc/index.md new file mode 100644 index 0000000..51771b6 --- /dev/null +++ b/doc/index.md @@ -0,0 +1,28 @@ +![WebExpress](https://raw.githubusercontent.com/ReneSchwarzer/WebExpress/main/assets/banner.png) + +# WebExpress +WebExpress is a lightweight web server optimized for use in low-performance environments (e.g. Raspberry PI). By providing +a powerful plugin system and a comprehensive API, web applications can be easily and quickly integrated into a .NET +language (e.g. C#). Some advantages of WebExpress are: + +- It is easy to use. +- It offers a variety of features and tools that can help you build and manage your website. +- It is fast and efficient and can help you save time and money. +- It is flexible and can be customized to meet your specific requirements. + +The `WebExpress` family includes the following projects: + +- [WebExpress](https://github.com/ReneSchwarzer/WebExpress#readme) - The web server for `WebExpress` applications and the documentation. +- [WebExpress.WebCore](https://github.com/ReneSchwarzer/WebExpress.WebCore#readme) - The core for `WebExpress` applications. +- [WebExpress.WebUI](https://github.com/ReneSchwarzer/WebExpress.WebUI#readme) - Common templates and controls for `WebExpress` applications. +- [WebExpress.WebIndex](https://github.com/ReneSchwarzer/WebExpress.WebIndex#readme) - Reverse index for `WebExpress` applications. +- [WebExpress.WebApp](https://github.com/ReneSchwarzer/WebExpress.WebApp#readme) - Business application template for `WebExpress` applications. + +# WebExpress.WebApp +`WebExpress.WebApp` is part of the WebExpress family. Provides a business application template for `WebExpress` applications. + +# Download +The current binaries are available for download [here](https://github.com/ReneSchwarzer/WebExpress/releases). + +# Tags +#WebApp #WebExpress #BusinessApplication #DotNet #NETCore diff --git a/doc/template/dashboard.html.tmpl b/doc/template/dashboard.html.tmpl new file mode 100644 index 0000000..0288fe8 --- /dev/null +++ b/doc/template/dashboard.html.tmpl @@ -0,0 +1,47 @@ +{{!Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license.}} +{{!master(layout/_master.tmpl)}} +

{{title}}

+{{#items.Length}} +
+{{#items}} +
+ {{name}} +
+
{{name}}
+

{{{description}}}

+
+
+ {{#usage}} +
+ {{#config}}
docfx.json: {{config}}
{{/config}} + {{#command}}
docfx: {{command}}
{{/command}} + {{#init}}
docfx init: {{init}}
{{/init}} +
+ {{/usage}} +
+
+{{/items}} +
+{{/items.Length}} + + diff --git a/doc/template/public/main.css b/doc/template/public/main.css new file mode 100644 index 0000000..b0b8c1f --- /dev/null +++ b/doc/template/public/main.css @@ -0,0 +1,10 @@ +/** + * Licensed to the .NET Foundation under one or more agreements. + * The .NET Foundation licenses this file to you under the MIT license. + */ + +/* Checkout https://getbootstrap.com/docs/5.3/customize/color/ for more customization options */ +body { + --bs-link-color-rgb: 66, 184, 131 !important; + --bs-link-hover-color-rgb: 64, 180, 128 !important; +} diff --git a/doc/template/public/main.js b/doc/template/public/main.js new file mode 100644 index 0000000..d5c4867 --- /dev/null +++ b/doc/template/public/main.js @@ -0,0 +1,14 @@ +/** + * Licensed to the .NET Foundation under one or more agreements. + * The .NET Foundation licenses this file to you under the MIT license. + */ + +export default { + iconLinks: [ + { + icon: 'github', + href: 'https://github.com/dotnet/docfx', + title: 'GitHub' + } + ] +} diff --git a/doc/template/schemas/Dashboard.schema.json b/doc/template/schemas/Dashboard.schema.json new file mode 100644 index 0000000..a00ab75 --- /dev/null +++ b/doc/template/schemas/Dashboard.schema.json @@ -0,0 +1,45 @@ +{ + "title": "Dashboard", + "$schema": "https://dotnet.github.io/docfx/schemas/v1.0/schema.json#", + "version": "1.0.0", + "description": "Schema for dashboard", + "id": "https://github.com/dotnet/docfx/schemas/Dashboard.schema.json", + "type": "object", + "properties": { + "uid": { + "type": "string", + "contentType": "uid" + }, + "title": { + "type": "string", + "tags": [ + "localizable" + ] + }, + "description": { + "type": "string", + "contentType": "markdown", + "tags": [ + "localizable" + ] + }, + "items": { + "items": { + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string", + "contentType": "markdown", + "tags": [ + "localizable" + ] + } + }, + "type": "object" + }, + "type": "array" + } + } +} \ No newline at end of file diff --git a/doc/toc.yml b/doc/toc.yml new file mode 100644 index 0000000..650bed9 --- /dev/null +++ b/doc/toc.yml @@ -0,0 +1,8 @@ +- name: Home + href: index.md +- name: API Documentation + href: api/WebExpress.WebApp.html +- name: User Guide + href: user-guide.md +- name: Tutorials + href: tutorials.md diff --git a/doc/tutorials.md b/doc/tutorials.md new file mode 100644 index 0000000..77c2af0 --- /dev/null +++ b/doc/tutorials.md @@ -0,0 +1,17 @@ +![WebExpress](https://raw.githubusercontent.com/ReneSchwarzer/WebExpress/main/assets/banner.png) + +# Tutorials +Welcome to the `WebExpress` Tutorials! Here, you'll find step-by-step guides and helpful resources to get the most out +of `WebExpress`. Whether you're a beginner just starting out or an experienced developer looking to expand your skills, +our tutorials offer something for everyone. + +# Getting Started +Begin with our basic tutorial: +- [HelloWorld](https://github.com/ReneSchwarzer/WebExpress.Tutorial.HelloWorld#readme) +- [WebApp](https://github.com/ReneSchwarzer/WebExpress.Tutorial.WebApp#readme) +- [WebIndex](https://github.com/ReneSchwarzer/WebExpress.Tutorial.WebIndex#readme) + +This tutorial will guide you through the initial steps of creating and running your first `WebExpress` application. + +Stay tuned for more exciting and educational tutorials to help you unlock the full potential of `WebExpress`. Happy coding and +best of luck with your projects! diff --git a/doc/user-guide.md b/doc/user-guide.md new file mode 100644 index 0000000..e885c63 --- /dev/null +++ b/doc/user-guide.md @@ -0,0 +1,17 @@ +![WebExpress](https://raw.githubusercontent.com/ReneSchwarzer/WebExpress/main/assets/banner.png) + +# User guide +Welcome to the `WebExpress.WebApp` User Guide. This guide will help you get started with `WebExpress.WebApp` and make the most out of its +features. Follow the links below to begin your journey. + +# Getting started +To get started with `WebExpress.WebApp`, use the following guides: + +- [Installation Guide](https://github.com/ReneSchwarzer/WebExpress/blob/main/doc/installation_guide.md) +- [Development Guide](https://github.com/ReneSchwarzer/WebExpress/blob/main/doc/development_guide.md) +- [WebExpress.WebCore API Documentation](https://reneschwarzer.github.io/WebExpress.WebCore/) +- [WebExpress.WebUI API Documentation](https://reneschwarzer.github.io/WebExpress.WebUI/) +- [WebExpress.WebApp API Documentation](https://reneschwarzer.github.io/WebExpress.WebApp/) +- [WebExpress.WebIndex API Documentation](https://reneschwarzer.github.io/WebExpress.WebIndex/) + +We hope you enjoy using `WebExpress.WebApp` and find it valuable for your projects. Happy coding! From 668acbd1babd5f8dd4184742fccf5ad87aa68538 Mon Sep 17 00:00:00 2001 From: Rene Schwarzer Date: Wed, 15 Jan 2025 02:15:22 +0100 Subject: [PATCH 17/30] update documentation --- {doc => docs}/api/toc.yml | 0 {doc => docs}/assets/webexpress.ico | Bin {doc => docs}/assets/webexpress.svg | 0 {doc => docs}/docfx.json | 0 {doc => docs}/index.md | 0 {doc => docs}/template/dashboard.html.tmpl | 0 {doc => docs}/template/public/main.css | 0 {doc => docs}/template/public/main.js | 0 .../template/schemas/Dashboard.schema.json | 0 {doc => docs}/toc.yml | 0 {doc => docs}/tutorials.md | 0 {doc => docs}/user-guide.md | 0 12 files changed, 0 insertions(+), 0 deletions(-) rename {doc => docs}/api/toc.yml (100%) rename {doc => docs}/assets/webexpress.ico (100%) rename {doc => docs}/assets/webexpress.svg (100%) rename {doc => docs}/docfx.json (100%) rename {doc => docs}/index.md (100%) rename {doc => docs}/template/dashboard.html.tmpl (100%) rename {doc => docs}/template/public/main.css (100%) rename {doc => docs}/template/public/main.js (100%) rename {doc => docs}/template/schemas/Dashboard.schema.json (100%) rename {doc => docs}/toc.yml (100%) rename {doc => docs}/tutorials.md (100%) rename {doc => docs}/user-guide.md (100%) diff --git a/doc/api/toc.yml b/docs/api/toc.yml similarity index 100% rename from doc/api/toc.yml rename to docs/api/toc.yml diff --git a/doc/assets/webexpress.ico b/docs/assets/webexpress.ico similarity index 100% rename from doc/assets/webexpress.ico rename to docs/assets/webexpress.ico diff --git a/doc/assets/webexpress.svg b/docs/assets/webexpress.svg similarity index 100% rename from doc/assets/webexpress.svg rename to docs/assets/webexpress.svg diff --git a/doc/docfx.json b/docs/docfx.json similarity index 100% rename from doc/docfx.json rename to docs/docfx.json diff --git a/doc/index.md b/docs/index.md similarity index 100% rename from doc/index.md rename to docs/index.md diff --git a/doc/template/dashboard.html.tmpl b/docs/template/dashboard.html.tmpl similarity index 100% rename from doc/template/dashboard.html.tmpl rename to docs/template/dashboard.html.tmpl diff --git a/doc/template/public/main.css b/docs/template/public/main.css similarity index 100% rename from doc/template/public/main.css rename to docs/template/public/main.css diff --git a/doc/template/public/main.js b/docs/template/public/main.js similarity index 100% rename from doc/template/public/main.js rename to docs/template/public/main.js diff --git a/doc/template/schemas/Dashboard.schema.json b/docs/template/schemas/Dashboard.schema.json similarity index 100% rename from doc/template/schemas/Dashboard.schema.json rename to docs/template/schemas/Dashboard.schema.json diff --git a/doc/toc.yml b/docs/toc.yml similarity index 100% rename from doc/toc.yml rename to docs/toc.yml diff --git a/doc/tutorials.md b/docs/tutorials.md similarity index 100% rename from doc/tutorials.md rename to docs/tutorials.md diff --git a/doc/user-guide.md b/docs/user-guide.md similarity index 100% rename from doc/user-guide.md rename to docs/user-guide.md From c175eee633a16bfdd6f61c3268e3d6198e565dde Mon Sep 17 00:00:00 2001 From: Rene Schwarzer Date: Sat, 1 Feb 2025 17:52:17 +0100 Subject: [PATCH 18/30] add: toolbar sections --- src/WebExpress.WebApp/Internationalization/de | 2 -- src/WebExpress.WebApp/Internationalization/en | 2 -- ...references.cs => SectionToolbarMorePreferences.cs} | 2 +- ...ionMorePrimary.cs => SectionToolbarMorePrimary.cs} | 2 +- ...oreSecondary.cs => SectionToolbarMoreSecondary.cs} | 2 +- .../WebSection/SectionToolbarPreferences.cs | 11 +++++++++++ .../WebSection/SectionToolbarPrimary.cs | 11 +++++++++++ .../WebSection/SectionToolbarSecondary.cs | 11 +++++++++++ 8 files changed, 36 insertions(+), 7 deletions(-) rename src/WebExpress.WebApp/WebSection/{SectionMorePreferences.cs => SectionToolbarMorePreferences.cs} (75%) rename src/WebExpress.WebApp/WebSection/{SectionMorePrimary.cs => SectionToolbarMorePrimary.cs} (76%) rename src/WebExpress.WebApp/WebSection/{SectionMoreSecondary.cs => SectionToolbarMoreSecondary.cs} (76%) create mode 100644 src/WebExpress.WebApp/WebSection/SectionToolbarPreferences.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionToolbarPrimary.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionToolbarSecondary.cs diff --git a/src/WebExpress.WebApp/Internationalization/de b/src/WebExpress.WebApp/Internationalization/de index 683b71c..851cf38 100644 --- a/src/WebExpress.WebApp/Internationalization/de +++ b/src/WebExpress.WebApp/Internationalization/de @@ -22,8 +22,6 @@ status.404.title=Ressource nicht gefunden status.404.description=Der HTTP-Statuscode 404 bedeutet, dass die aufgerufene Ressource auf dem Webserver nicht zu finden ist. Entweder wurden Inhalte der Webseite entfernt oder auf eine andere URL verlegt. Folgende Ursachen können hierfür verantwortlich sein:
  • Die URL ist fehlerhaft angelegt oder falsch intern verlinkt.
  • Die URL wurde falsch eingegeben.
  • Der Webserver ist nicht in Betrieb.
  • Die URL oder die Inhalte wurden gelöscht oder ausgelagert.
status.500.title=Interner Serverfehler -notificationmanager.initialization=Der Benachrichtigungsmanager wurde initialisiert. - pagesettingmanager.initialization=Der Einstellungsseitenmanager wurde initialisiert. pagesettingmanager.register=Eine Einsteuungsseite wurde dem Einstellungsseitenmanager hinzugefügt. pagesettingmanager.idless=Eine Einstellungsseite aus dem Plugin '{0}' verfügt über keine Id. diff --git a/src/WebExpress.WebApp/Internationalization/en b/src/WebExpress.WebApp/Internationalization/en index f768920..35962b5 100644 --- a/src/WebExpress.WebApp/Internationalization/en +++ b/src/WebExpress.WebApp/Internationalization/en @@ -22,8 +22,6 @@ status.404.title=Resource not found status.404.description=The HTTP status code 404 means that the called resource cannot be found on the Web server. Either content has been removed or moved to a different URL. The following causes may be responsible for this:
  • The URL is created incorrectly or incorrectly linked internally.
  • The URL was entered incorrectly.
  • The web server is not in operation.
  • The URL or content has been deleted or paged out.
status.500.title=Internal Server Error -notificationmanager.initialization=The notification manager has been initialized. - pagesettingmanager.initialization=The settings page manager has been initialized. pagesettingmanager.register=A settings page has been added to the settings page manager. pagesettingmanager.idless=A settings page from the plugin '{0}' does not have an id. diff --git a/src/WebExpress.WebApp/WebSection/SectionMorePreferences.cs b/src/WebExpress.WebApp/WebSection/SectionToolbarMorePreferences.cs similarity index 75% rename from src/WebExpress.WebApp/WebSection/SectionMorePreferences.cs rename to src/WebExpress.WebApp/WebSection/SectionToolbarMorePreferences.cs index 6b212d8..1346dea 100644 --- a/src/WebExpress.WebApp/WebSection/SectionMorePreferences.cs +++ b/src/WebExpress.WebApp/WebSection/SectionToolbarMorePreferences.cs @@ -5,7 +5,7 @@ namespace WebExpress.WebApp.WebSection /// /// Represents the section more.preferences. /// - public class SectionMorePreferences : ISection + public class SectionToolbarMorePreferences : ISection { } } diff --git a/src/WebExpress.WebApp/WebSection/SectionMorePrimary.cs b/src/WebExpress.WebApp/WebSection/SectionToolbarMorePrimary.cs similarity index 76% rename from src/WebExpress.WebApp/WebSection/SectionMorePrimary.cs rename to src/WebExpress.WebApp/WebSection/SectionToolbarMorePrimary.cs index 8ec75e0..06bba52 100644 --- a/src/WebExpress.WebApp/WebSection/SectionMorePrimary.cs +++ b/src/WebExpress.WebApp/WebSection/SectionToolbarMorePrimary.cs @@ -5,7 +5,7 @@ namespace WebExpress.WebApp.WebSection /// /// Represents the section more.primary. /// - public class SectionMorePrimary : ISection + public class SectionToolbarMorePrimary : ISection { } } diff --git a/src/WebExpress.WebApp/WebSection/SectionMoreSecondary.cs b/src/WebExpress.WebApp/WebSection/SectionToolbarMoreSecondary.cs similarity index 76% rename from src/WebExpress.WebApp/WebSection/SectionMoreSecondary.cs rename to src/WebExpress.WebApp/WebSection/SectionToolbarMoreSecondary.cs index cccfcc1..e02b7b5 100644 --- a/src/WebExpress.WebApp/WebSection/SectionMoreSecondary.cs +++ b/src/WebExpress.WebApp/WebSection/SectionToolbarMoreSecondary.cs @@ -5,7 +5,7 @@ namespace WebExpress.WebApp.WebSection /// /// Represents the section more.secondary. /// - public class SectionMoreSecondary : ISection + public class SectionToolbarMoreSecondary : ISection { } } diff --git a/src/WebExpress.WebApp/WebSection/SectionToolbarPreferences.cs b/src/WebExpress.WebApp/WebSection/SectionToolbarPreferences.cs new file mode 100644 index 0000000..536fb02 --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionToolbarPreferences.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section toolbar.preferences. + /// + public class SectionToolbarPreferences : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionToolbarPrimary.cs b/src/WebExpress.WebApp/WebSection/SectionToolbarPrimary.cs new file mode 100644 index 0000000..31f2282 --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionToolbarPrimary.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section toolbar.primary. + /// + public class SectionToolbarPrimary : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionToolbarSecondary.cs b/src/WebExpress.WebApp/WebSection/SectionToolbarSecondary.cs new file mode 100644 index 0000000..9eae7ff --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionToolbarSecondary.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section toolbar.secondary. + /// + public class SectionToolbarSecondary : ISection + { + } +} From 4b4a2f06392754709e3c9dc308d1b1d37c18375c Mon Sep 17 00:00:00 2001 From: Rene Schwarzer Date: Sun, 2 Feb 2025 21:54:22 +0100 Subject: [PATCH 19/30] general improvements and bug fixes --- .../WebControl/UnitTestControlWebAppFooter.cs | 4 +- .../WebFragment/UnitTestFragmentManager.cs | 14 +- .../Assets/css/webexpress.webapp.css | 19 +- src/WebExpress.WebApp/Internationalization/de | 1 + src/WebExpress.WebApp/Internationalization/en | 1 + .../WebApi/V1/RestPopupNotification.cs | 121 ++++---- .../ControlApiNotificationPopup.cs | 120 ++++---- .../WebControl/ControlModalFormConfirm.cs | 249 +++++++-------- .../WebControl/ControlModalFormGoupEdit.cs | 93 ------ .../WebControl/ControlModalFormGoupNew.cs | 83 ----- .../WebControl/ControlModalFormGroupDelete.cs | 60 ---- .../WebControl/ControlModalFormUserDelete.cs | 58 ---- .../WebControl/ControlModalFormUserEdit.cs | 203 ------------- .../WebControl/ControlModalFormUserNew.cs | 191 ------------ .../WebControl/ControlWebAppContent.cs | 123 ++------ .../WebControl/ControlWebAppFooter.cs | 107 +++++-- .../WebControl/ControlWebAppHeader.cs | 20 +- .../ControlWebAppHeaderAppNavigation.cs | 129 +++++--- .../ControlWebAppHeaderAppNavigator.cs | 109 ++++--- .../WebControl/ControlWebAppHeaderHelp.cs | 145 ++++++--- .../ControlWebAppHeaderNotification.cs | 180 +++++++++++ .../ControlWebAppHeaderQuickCreate.cs | 98 ++++-- .../WebControl/ControlWebAppHeaderSettings.cs | 145 ++++++--- .../WebControl/ControlWebAppHeadline.cs | 286 +++++++++++------- .../WebControl/ControlWebAppHeadlineMore.cs | 180 +++++++++++ .../WebControl/ControlWebAppMain.cs | 164 ++++++++++ .../WebControl/ControlWebAppProperty.cs | 115 +++++-- .../WebControl/ControlWebAppSidebar.cs | 166 +++++++--- .../WebControl/ControlWebAppToolbar.cs | 174 +++++++++++ .../WebControl/ControlWebAppToolbarMore.cs | 177 +++++++++++ .../WebPage/VisualTreeWebApp.cs | 39 ++- .../SectionAppNotificationPreferences.cs | 11 + .../SectionAppNotificationPrimary.cs | 11 + .../SectionAppNotificationSecondary.cs | 11 + .../WebSection/SectionHeadlineMetadata.cs | 11 + .../SectionHeadlineMorePreferences.cs | 11 + .../WebSection/SectionHeadlineMorePrimary.cs | 11 + .../SectionHeadlineMoreSecondary.cs | 11 + 38 files changed, 2209 insertions(+), 1442 deletions(-) delete mode 100644 src/WebExpress.WebApp/WebControl/ControlModalFormGoupEdit.cs delete mode 100644 src/WebExpress.WebApp/WebControl/ControlModalFormGoupNew.cs delete mode 100644 src/WebExpress.WebApp/WebControl/ControlModalFormGroupDelete.cs delete mode 100644 src/WebExpress.WebApp/WebControl/ControlModalFormUserDelete.cs delete mode 100644 src/WebExpress.WebApp/WebControl/ControlModalFormUserEdit.cs delete mode 100644 src/WebExpress.WebApp/WebControl/ControlModalFormUserNew.cs create mode 100644 src/WebExpress.WebApp/WebControl/ControlWebAppHeaderNotification.cs create mode 100644 src/WebExpress.WebApp/WebControl/ControlWebAppHeadlineMore.cs create mode 100644 src/WebExpress.WebApp/WebControl/ControlWebAppMain.cs create mode 100644 src/WebExpress.WebApp/WebControl/ControlWebAppToolbar.cs create mode 100644 src/WebExpress.WebApp/WebControl/ControlWebAppToolbarMore.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionAppNotificationPreferences.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionAppNotificationPrimary.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionAppNotificationSecondary.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionHeadlineMetadata.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionHeadlineMorePreferences.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionHeadlineMorePrimary.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionHeadlineMoreSecondary.cs diff --git a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppFooter.cs b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppFooter.cs index c61fe40..0b79c16 100644 --- a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppFooter.cs +++ b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppFooter.cs @@ -14,8 +14,8 @@ public class UnitTestControlWebAppFooter /// Tests the id property of the web app footer control. /// [Theory] - [InlineData(null, @"
")] - [InlineData("id", @"
")] + [InlineData(null, null)] + [InlineData("id", null)] public void Id(string id, string expected) { // preconditions diff --git a/src/WebExpress.WebApp.Test/WebFragment/UnitTestFragmentManager.cs b/src/WebExpress.WebApp.Test/WebFragment/UnitTestFragmentManager.cs index 86a761d..47a6e84 100644 --- a/src/WebExpress.WebApp.Test/WebFragment/UnitTestFragmentManager.cs +++ b/src/WebExpress.WebApp.Test/WebFragment/UnitTestFragmentManager.cs @@ -44,19 +44,19 @@ public void Id(Type applicationType, Type fragmentType, string id) /// Test the get fragments function of the fragment manager. /// [Theory] - [InlineData(typeof(TestApplication), typeof(FragmentControlPanel), typeof(SectionContentPrimary), typeof(TestPageA), 1, @"
Hello World
")] + [InlineData(typeof(TestApplication), typeof(FragmentControlPanel), typeof(SectionContentPrimary), typeof(TestPageA), 1, @"
Hello World
")] [InlineData(typeof(TestApplication), typeof(FragmentControlPanel), typeof(SectionContentPrimary), typeof(IScopeGeneral), 0, null)] [InlineData(typeof(TestApplication), typeof(FragmentControlPanel), typeof(SectionContentPrimary), typeof(IScope), 0, null)] - [InlineData(typeof(TestApplication), typeof(IFragmentControl), typeof(SectionContentPrimary), typeof(TestPageA), 1, @"
Hello World
")] + [InlineData(typeof(TestApplication), typeof(IFragmentControl), typeof(SectionContentPrimary), typeof(TestPageA), 1, @"
Hello World
")] [InlineData(typeof(TestApplication), typeof(IFragmentControl), typeof(SectionContentPrimary), typeof(IScopeGeneral), 0, null)] [InlineData(typeof(TestApplication), typeof(IFragmentControl), typeof(SectionContentPrimary), typeof(IScope), 0, null)] - [InlineData(typeof(TestApplication), typeof(IFragmentBase), typeof(SectionContentPrimary), typeof(TestPageA), 1, @"
Hello World
")] + [InlineData(typeof(TestApplication), typeof(IFragmentBase), typeof(SectionContentPrimary), typeof(TestPageA), 1, @"
Hello World
")] [InlineData(typeof(TestApplication), typeof(IFragmentBase), typeof(SectionContentPrimary), typeof(IScopeGeneral), 0, null)] [InlineData(typeof(TestApplication), typeof(IFragmentBase), typeof(SectionContentPrimary), typeof(IScope), 0, null)] - [InlineData(typeof(TestApplication), typeof(IFragmentControl), typeof(SectionAppNavigationPrimary), typeof(TestPageA), 1, @"
Hello World
")] - [InlineData(typeof(TestApplication), typeof(IFragmentControl), typeof(SectionAppNavigationPrimary), typeof(IScopeGeneral), 1, @"
Hello World
")] + [InlineData(typeof(TestApplication), typeof(IFragmentControl), typeof(SectionAppNavigationPrimary), typeof(TestPageA), 1, @"
Hello World
")] + [InlineData(typeof(TestApplication), typeof(IFragmentControl), typeof(SectionAppNavigationPrimary), typeof(IScopeGeneral), 1, @"
Hello World
")] [InlineData(typeof(TestApplication), typeof(IFragmentControl), typeof(SectionAppNavigationPrimary), typeof(IScope), 0, null)] - [InlineData(typeof(TestApplication), typeof(FragmentControlPanel), typeof(SectionContentSecondary), typeof(TestPageB), 1, @"
Hello World
")] + [InlineData(typeof(TestApplication), typeof(FragmentControlPanel), typeof(SectionContentSecondary), typeof(TestPageB), 1, @"
Hello World
")] [InlineData(typeof(TestApplication), typeof(FragmentControlPanel), typeof(SectionContentSecondary), typeof(IScopeGeneral), 0, null)] [InlineData(typeof(TestApplication), typeof(FragmentControlPanel), typeof(SectionContentSecondary), typeof(IScope), 0, null)] [InlineData(typeof(TestApplication), typeof(FragmentControlPanel), typeof(SectionContentPrimary), typeof(TestPageB), 0, null)] @@ -104,7 +104,7 @@ public void GetFragments(Type applicationType, Type fragmentType, Type sectionTy /// Test the render function of the fragment manager. /// [Theory] - [InlineData(typeof(TestApplication), typeof(SectionContentPrimary), typeof(TestPageA), @"
Hello World
")] + [InlineData(typeof(TestApplication), typeof(SectionContentPrimary), typeof(TestPageA), @"
Hello World
")] [InlineData(typeof(TestApplication), typeof(SectionContentPrimary), typeof(IScopeGeneral), null)] [InlineData(typeof(TestApplication), typeof(SectionContentPrimary), typeof(IScope), null)] public void Render(Type applicationType, Type sectionType, Type scopeType, string expected) diff --git a/src/WebExpress.WebApp/Assets/css/webexpress.webapp.css b/src/WebExpress.WebApp/Assets/css/webexpress.webapp.css index 44112f8..8538e09 100644 --- a/src/WebExpress.WebApp/Assets/css/webexpress.webapp.css +++ b/src/WebExpress.WebApp/Assets/css/webexpress.webapp.css @@ -1,3 +1,15 @@ +body { + height: 100%; + display: flex; + flex-direction: column; +} + +main { + flex: auto; + display: flex; + flex-direction: column; +} + .sidebar { overflow: auto; min-height: 100%; @@ -12,10 +24,9 @@ } .content { - min-height: 100%; - display: grid; - grid-template-columns: auto; - /*grid-template-rows: 1em auto;*/ + flex: auto; + display: flex; + flex-direction: column; } .footer { diff --git a/src/WebExpress.WebApp/Internationalization/de b/src/WebExpress.WebApp/Internationalization/de index 851cf38..838ae79 100644 --- a/src/WebExpress.WebApp/Internationalization/de +++ b/src/WebExpress.WebApp/Internationalization/de @@ -16,6 +16,7 @@ header.setting.label=Einstellungen header.setting.systeminformation.label=System Informationen headline.more.title=Weitere Optionen +toolbar.more.title=Weitere Optionen status.400.title=Fehlerhafte Anfrage status.404.title=Ressource nicht gefunden diff --git a/src/WebExpress.WebApp/Internationalization/en b/src/WebExpress.WebApp/Internationalization/en index 35962b5..3f29143 100644 --- a/src/WebExpress.WebApp/Internationalization/en +++ b/src/WebExpress.WebApp/Internationalization/en @@ -16,6 +16,7 @@ header.setting.label=Settings header.setting.systeminformation.label=System information headline.more.title=More options +toolbar.more.title=More options status.400.title=Bad Request status.404.title=Resource not found diff --git a/src/WebExpress.WebApp/WebApi/V1/RestPopupNotification.cs b/src/WebExpress.WebApp/WebApi/V1/RestPopupNotification.cs index b0dd2e2..4730ec3 100644 --- a/src/WebExpress.WebApp/WebApi/V1/RestPopupNotification.cs +++ b/src/WebExpress.WebApp/WebApi/V1/RestPopupNotification.cs @@ -1,59 +1,72 @@ -//using System.Collections; -//using WebExpress.WebCore.WebAttribute; -//using WebExpress.WebCore.WebComponent; -//using WebExpress.WebCore.WebMessage; -//using WebExpress.WebCore.WebResource; -//using WebExpress.WebApp.WebNotificaation; +using System; +using System.Linq; +using WebExpress.WebCore.WebApplication; +using WebExpress.WebCore.WebAttribute; +using WebExpress.WebCore.WebComponent; +using WebExpress.WebCore.WebMessage; +using WebExpress.WebCore.WebRestApi; +using WebExpress.WebUI.WebNotification; -//namespace WebExpress.WebApp.WebAPI.V1 -//{ -// /// -// /// Returns the status and progress of a task (WebTask). -// /// -// [Segment("popupnotifications", "")] -// [ContextPath("/api/v1")] -// [Module] -// [IncludeSubPaths(true)] -// [Optional] -// public sealed class RestPopupNotification : ResourceRest -// { -// /// -// /// Initializes a new instance of the class. -// /// -// public RestPopupNotification() -// { -// } +namespace WebExpress.WebApp.WebAPI.V1 +{ + /// + /// Returns the status and progress of a task (WebTask). + /// + [Segment("popupnotifications", "")] + [ContextPath("/api")] + [Method(CrudMethod.GET)] + [Method(CrudMethod.DELETE)] + public sealed class RestPopupNotification : IRestApi + { + private readonly IComponentHub _componentHub; + private readonly IApplicationContext _applicationContext; -// /// -// /// Initialization -// /// -// /// The context. -// public override void Initialization(IResourceContext context) -// { -// base.Initialization(context); -// } + /// + /// Initializes a new instance of the class. + /// + public RestPopupNotification(IComponentHub componentHub, IApplicationContext applicationContext) + { + _componentHub = componentHub; + _applicationContext = applicationContext; + } -// /// -// /// Processing of the resource that was called via the get request. -// /// -// /// The request. -// /// An enumeration that can be serialized using the JsonSerializer. -// public override ICollection GetData(Request request) -// { -// return (ICollection)ComponentManager.GetComponent()?.GetNotifications(request); -// } + /// + /// Creates data based on the provided request. + /// + /// The request containing the data to create. + public void CreateData(Request request) + { + } -// /// -// /// Processing of the resource that was called via the delete request. -// /// -// /// The id to delete. -// /// The request. -// /// The result of the deletion. -// public override bool DeleteData(string id, Request request) -// { -// ComponentManager.GetComponent()?.RemoveNotification(request, id); + /// + /// Retrieves data based on the provided request. + /// + /// The request containing the criteria for data retrieval. + /// A collection of notifications. + public object GetData(Request request) + { -// return true; -// } -// } -//} + return _componentHub.GetComponentManager()?.GetNotifications(_applicationContext, request); + } + + /// + /// Updates data based on the provided request. + /// + /// The request containing the data to update. + public void UpdateData(Request request) + { + } + + /// + /// Deletes data based on the provided request. + /// + /// The request containing the data to delete. + public void DeleteData(Request request) + { + if (Guid.TryParse(request.Uri.PathSegments.Last()?.ToString(), out Guid id)) + { + _componentHub.GetComponentManager()?.RemoveNotifications(id); + } + } + } +} diff --git a/src/WebExpress.WebApp/WebApiControl/ControlApiNotificationPopup.cs b/src/WebExpress.WebApp/WebApiControl/ControlApiNotificationPopup.cs index fe4d384..1243a15 100644 --- a/src/WebExpress.WebApp/WebApiControl/ControlApiNotificationPopup.cs +++ b/src/WebExpress.WebApp/WebApiControl/ControlApiNotificationPopup.cs @@ -1,58 +1,62 @@ -//using System; -//using System.Text; -//using System.Text.Json; -//using WebExpress.WebCore.WebComponent; -//using WebExpress.WebCore.WebHtml; -//using WebExpress.WebCore.WebPage; -//using WebExpress.WebUI.WebControl; - -//namespace WebExpress.WebApp.WebApiControl -//{ -// /// -// /// Popup-Benachrichtigungen -// /// -// public class ControlApiNotificationPopup : ControlPanel -// { -// /// -// /// Initializes a new instance of the class. -// /// -// /// Die Steuerelement-Id -// public ControlApiNotificationPopup(string id = null) -// : base(id ?? Guid.NewGuid().ToString()) -// { -// Classes.Add("popupnotification"); -// } - -// /// -// /// Convert to html. -// /// -// /// The context in which the control is rendered. -// /// The control as html. -// public override IHtmlNode Render(RenderContext context) -// { -// var module = ComponentManager.ModuleManager.GetModule(context.ApplicationContext, typeof(Module)); - -// var settings = new -// { -// id = "26E517F5-56F7-485E-A212-6033618708F3", -// resturi = module?.ContextPath.Append("api/v1/popupnotifications")?.ToString(), -// intervall = 15000 -// }; - -// var jsonOptions = new JsonSerializerOptions { WriteIndented = false }; -// var settingsJson = JsonSerializer.Serialize(settings, jsonOptions); -// var builder = new StringBuilder(); - -// builder.AppendLine($"$(document).ready(function () {{"); -// builder.AppendLine($"let settings = {settingsJson};"); -// builder.AppendLine($"let container = $('#{Id}');"); -// builder.AppendLine($"let obj = new webexpress.webapp.popupNotificationCtrl(settings);"); -// builder.AppendLine($"container.replaceWith(obj.getCtrl);"); -// builder.AppendLine($"}});"); - -// context.VisualTree.AddScript("webexpress.webapp:controlapinotificationpopup", builder.ToString()); - -// return base.Render(context); -// } -// } -//} +using System; +using System.Text; +using System.Text.Json; +using WebExpress.WebCore.WebHtml; +using WebExpress.WebUI.WebControl; +using WebExpress.WebUI.WebPage; + +namespace WebExpress.WebApp.WebApiControl +{ + /// + /// Represents a control for displaying notification popups via API. + /// + public class ControlApiNotificationPopup : Control + { + private static readonly JsonSerializerOptions _jsonOptions = new() { WriteIndented = false }; + + /// + /// Initializes a new instance of the class. + /// + /// The optional identifier for the control. If not provided, a new GUID will be generated. + public ControlApiNotificationPopup(string id = null) + : base(id ?? Guid.NewGuid().ToString()) + { + } + + /// + /// Converts the control to an HTML representation. + /// + /// The context in which the control is rendered. + /// The visual tree representing the control's structure. + /// An HTML node representing the rendered control. + public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTreeControl visualTree) + { + var applicationContext = renderContext?.PageContext?.ApplicationContext; + var settings = new + { + id = "26E517F5-56F7-485E-A212-6033618708F3", + resturi = applicationContext?.ContextPath.Append("api/1/popupnotifications")?.ToString(), + intervall = 15000 + }; + + var settingsJson = JsonSerializer.Serialize(settings, _jsonOptions); + var builder = new StringBuilder(); + + builder.AppendLine($"$(document).ready(function () {{"); + builder.AppendLine($"let settings = {settingsJson};"); + builder.AppendLine($"let container = $('#{settings.id}');"); + builder.AppendLine($"let obj = new webexpress.webapp.popupNotificationCtrl(settings);"); + builder.AppendLine($"container.replaceWith(obj.getCtrl);"); + builder.AppendLine($"}});"); + + visualTree.AddScript("webexpress.webapp:controlapinotificationpopup", builder.ToString()); + + var ctrl = new ControlPanel(settings.id) + { + Classes = ["popupnotification"] + }; + + return ctrl.Render(renderContext, visualTree); + } + } +} diff --git a/src/WebExpress.WebApp/WebControl/ControlModalFormConfirm.cs b/src/WebExpress.WebApp/WebControl/ControlModalFormConfirm.cs index db0367e..13bfece 100644 --- a/src/WebExpress.WebApp/WebControl/ControlModalFormConfirm.cs +++ b/src/WebExpress.WebApp/WebControl/ControlModalFormConfirm.cs @@ -1,133 +1,116 @@ -//using System; -//using System.Collections.Generic; -//using WebExpress.WebCore.Internationalization; -//using WebExpress.WebCore.WebHtml; -//using WebExpress.WebCore.WebPage; -//using WebExpress.WebUI.WebControl; - -//namespace WebExpress.WebApp.WebControl -//{ -// /// -// /// Represents a modal confirmation form. -// /// -// public class ControlModalFormConfirm : ControlModalForm -// { -// /// -// /// Event is triggered when deletion is confirmed. -// /// -// public event EventHandler Confirm; - -// /// -// /// Returns or sets the submit button icon. -// /// -// public PropertyIcon SubmitButtonIcon { get { return SubmitButton?.Icon; } set { SubmitButton.Icon = value; } } - -// /// -// /// Returns or sets the submit button color. -// /// -// public PropertyColorButton SubmitButtonColor { get { return SubmitButton?.Color; } set { SubmitButton.Color = value; } } - -// /// -// /// Returns or sets the submit button label. -// /// -// public string SubmitButtonLabel { get; set; } - -// /// -// /// Returns or sets the content. -// /// -// public new ControlFormItem Content { get; set; } - -// /// -// /// Returns or sets the submit button. -// /// -// private ControlFormItemButtonSubmit SubmitButton { get; set; } - -// /// -// /// Returns or sets the redirect uri. -// /// -// public string RedirectUri { get { return Form?.RedirectUri; } set { Form.RedirectUri = value; } } - -// /// -// /// Initializes a new instance of the class. -// /// -// /// The id. -// public ControlModalFormConfirm(string id = null) -// : this(id, null) -// { - -// } - -// /// -// /// Initializes a new instance of the class. -// /// -// /// The id. -// /// The form controls. -// public ControlModalFormConfirm(string id, params ControlFormItem[] content) -// : base(id, string.Empty, content) -// { -// Init(); -// } - -// /// -// /// Initialization -// /// -// private void Init() -// { -// SubmitButton = new ControlFormItemButtonSubmit("submit"); - -// Form.ProcessForm += (s, e) => -// { -// OnConfirm(e.Context); -// }; - -// Form.AddPrimaryButton(SubmitButton); -// } - -// /// -// /// Triggers the Confirm event. -// /// -// /// The context in which the control is rendered. -// protected virtual void OnConfirm(RenderContextForm context) -// { -// Confirm?.Invoke(this, new FormEventArgs() { Context = context }); -// } - -// /// -// /// Convert to html. -// /// -// /// The context in which the control is rendered. -// /// The control as html. -// public override IHtmlNode Render(RenderContext context) -// { -// var content = Content ?? new ControlFormItemStaticText() -// { -// Text = context.Page.I18N("webexpress.webapp", "confirm.description") -// }; - -// return Render(context, [content]); -// } - -// /// -// /// Convert to html. -// /// -// /// The context in which the control is rendered. -// /// The form items. -// /// The control as html. -// public override IHtmlNode Render(RenderContext context, IEnumerable items) -// { -// if (string.IsNullOrWhiteSpace(Header)) -// { -// Header = context.Page.I18N("webexpress.webapp", "confirm.header"); -// } - -// if (string.IsNullOrWhiteSpace(SubmitButtonLabel)) -// { -// SubmitButtonLabel = context.Page.I18N("webexpress.webapp", "confirm.label"); -// } - -// Form.RedirectUri = RedirectUri ?? context.Uri; - -// return base.Render(context, items); -// } -// } -//} +using System; +using System.Collections.Generic; +using WebExpress.WebCore.Internationalization; +using WebExpress.WebCore.WebHtml; +using WebExpress.WebUI.WebControl; +using WebExpress.WebUI.WebPage; + +namespace WebExpress.WebApp.WebControl +{ + /// + /// Represents a modal confirmation form. + /// + public class ControlModalFormConfirm : ControlModalForm + { + /// + /// Event is triggered when deletion is confirmed. + /// + public event EventHandler Confirm; + + /// + /// Returns or sets the submit button icon. + /// + public PropertyIcon SubmitButtonIcon { get { return SubmitButton?.Icon; } set { SubmitButton.Icon = value; } } + + /// + /// Returns or sets the submit button color. + /// + public PropertyColorButton SubmitButtonColor { get { return SubmitButton?.Color; } set { SubmitButton.Color = value; } } + + /// + /// Returns or sets the submit button label. + /// + public string SubmitButtonLabel { get; set; } + + /// + /// Returns or sets the content. + /// + public new ControlFormItem Content { get; set; } + + /// + /// Returns or sets the submit button. + /// + private ControlFormItemButtonSubmit SubmitButton { get; set; } + + /// + /// Returns or sets the redirect uri. + /// + public string RedirectUri { get { return Form?.RedirectUri; } set { Form.RedirectUri = value; } } + + /// + /// Initializes a new instance of the class. + /// + /// The id. + public ControlModalFormConfirm(string id = null, params ControlFormItem[] content) + : base(id, content) + { + SubmitButton = new ControlFormItemButtonSubmit("submit"); + + Form.ProcessForm += (s, e) => + { + OnConfirm(e.Context); + }; + + Form.AddPrimaryButton(SubmitButton); + } + + /// + /// Triggers the confirm event. + /// + /// The context in which the control is rendered. + protected virtual void OnConfirm(IRenderControlFormContext context) + { + Confirm?.Invoke(this, new FormEventArgs() { Context = context }); + } + + /// + /// Converts the control to an HTML representation. + /// + /// The context in which the control is rendered. + /// The visual tree representing the control's structure. + /// An HTML node representing the rendered control. + public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTreeControl visualTree) + { + var content = Content ?? new ControlFormItemStaticText() + { + Text = I18N.Translate(renderContext.Request, "webexpress.webapp:confirm.description") + }; + + return Render(renderContext, visualTree, [content]); + } + + /// + /// Converts the control to an HTML representation. + /// + /// The context in which the control is rendered. + /// The visual tree representing the control's structure. + /// The form items. + /// An HTML node representing the rendered control. + public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTreeControl visualTree, IEnumerable items) + { + if (string.IsNullOrWhiteSpace(Header)) + { + Header = I18N.Translate(renderContext.Request, "webexpress.webapp:confirm.header"); + } + + if (string.IsNullOrWhiteSpace(SubmitButtonLabel)) + { + SubmitButtonLabel = I18N.Translate(renderContext.Request, "webexpress.webapp:confirm.label"); + } + + Form.RedirectUri = RedirectUri ?? renderContext.Request.Uri; + + return base.Render(renderContext, visualTree, items); + } + } +} diff --git a/src/WebExpress.WebApp/WebControl/ControlModalFormGoupEdit.cs b/src/WebExpress.WebApp/WebControl/ControlModalFormGoupEdit.cs deleted file mode 100644 index 49ff50a..0000000 --- a/src/WebExpress.WebApp/WebControl/ControlModalFormGoupEdit.cs +++ /dev/null @@ -1,93 +0,0 @@ -//using System; -//using System.Linq; -//using WebExpress.WebApp.WebUser; -//using WebExpress.WebUI.WebControl; - -//namespace WebExpress.WebApp.WebControl -//{ -// internal sealed class ControlModalFormGoupEdit : ControlModalForm -// { -// /// -// /// Returns or sets the group to be deleted. -// /// -// public Group Item { get; set; } - -// /// -// /// Returns the description of the form. -// /// -// private ControlFormItemStaticText Description { get; } = new ControlFormItemStaticText() -// { -// Text = "webexpress.webapp:setting.usermanager.group.edit.description", -// TextColor = new PropertyColorText(TypeColorText.Secondary) -// }; - -// /// -// /// Returns the control element for entering the group name. -// /// -// private ControlFormItemInputTextBox GroupName { get; } = new ControlFormItemInputTextBox() -// { -// Label = "webexpress.webapp:setting.usermanager.group.edit.name.label", -// Name = "groupname" -// }; - -// /// -// /// Initializes a new instance of the class. -// /// -// /// The control id. -// public ControlModalFormGoupEdit(string id = null) -// : base(id) -// { -// Add(Description); -// Add(GroupName); - -// Header = "webexpress.webapp:setting.usermanager.group.edit.header"; - -// GroupName.Validation += OnGroupNameValidation; -// //Form.SubmitButton.Text = "webexpress.webapp:setting.usermanager.group.edit.confirm"; -// Form.FillForm += OnFillForm; -// Form.ProcessForm += OnConfirm; -// } - -// /// -// /// Invoked when the form is to be filled with initial values. -// /// -// /// The trigger of the event. -// /// The event argument. -// private void OnFillForm(object sender, FormEventArgs e) -// { -// GroupName.Value = Item?.Name; -// } - -// /// -// /// Invoked when you want to check the group name you entered. -// /// -// /// The trigger of the event. -// /// The event argument. -// private void OnGroupNameValidation(object sender, ValidationEventArgs e) -// { -// if (string.IsNullOrWhiteSpace(GroupName.Value)) -// { -// e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.group.edit.name.error.empty")); -// } - -// if (UserManager.Groups.Where(x => x != Item && x.Name.Equals(GroupName.Value, StringComparison.OrdinalIgnoreCase)).Any()) -// { -// e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.group.edit.name.error.duplicate")); -// } -// } - -// /// -// /// Called when the delete action has been confirmed. -// /// -// /// The trigger of the event. -// /// The event argument. -// private void OnConfirm(object sender, FormEventArgs e) -// { -// Item.Name = GroupName.Value; - -// UserManager.UpdateGroup(Item); - -// e.Context.Page.Redirecting(e.Context.Uri); -// } -// } -//} diff --git a/src/WebExpress.WebApp/WebControl/ControlModalFormGoupNew.cs b/src/WebExpress.WebApp/WebControl/ControlModalFormGoupNew.cs deleted file mode 100644 index 66dd1d0..0000000 --- a/src/WebExpress.WebApp/WebControl/ControlModalFormGoupNew.cs +++ /dev/null @@ -1,83 +0,0 @@ -//using System; -//using System.Linq; -//using WebExpress.WebApp.WebUser; -//using WebExpress.WebUI.WebControl; - -//namespace WebExpress.WebApp.WebControl -//{ -// internal sealed class ControlModalFormGoupNew : ControlModalForm -// { -// /// -// /// Returns the description of the form. -// /// -// private ControlFormItemStaticText Description { get; } = new ControlFormItemStaticText() -// { -// Text = "webexpress.webapp:setting.usermanager.group.add.description", -// TextColor = new PropertyColorText(TypeColorText.Secondary) -// }; - -// /// -// /// Returns the control element for entering the group name. -// /// -// private ControlFormItemInputTextBox GroupName { get; } = new ControlFormItemInputTextBox() -// { -// Label = "webexpress.webapp:setting.usermanager.group.add.name.label", -// Name = "groupname" -// }; - -// /// -// /// Initializes a new instance of the class. -// /// -// /// The control id. -// public ControlModalFormGoupNew(string id = null) -// : base(id) -// { -// Add(Description); -// Add(GroupName); - -// Header = "webexpress.webapp:setting.usermanager.group.add.header"; - -// GroupName.Validation += OnGroupNameValidation; -// //Form.SubmitButton.Text = "webexpress.webapp:setting.usermanager.group.add.confirm"; -// Form.ProcessForm += OnConfirm; -// } - -// /// -// /// Invoked when you want to check the group name you entered. -// /// -// /// The trigger of the event. -// /// The event argument. -// private void OnGroupNameValidation(object sender, ValidationEventArgs e) -// { -// if (string.IsNullOrWhiteSpace(GroupName.Value)) -// { -// e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.group.add.name.error.empty")); -// } - -// if (UserManager.Groups.Where(x => x.Name.Equals(GroupName.Value, StringComparison.OrdinalIgnoreCase)).Any()) -// { -// e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.group.add.name.error.duplicate")); -// } -// } - -// /// -// /// Called when the delete action has been confirmed. -// /// -// /// The trigger of the event. -// /// The event argument. -// private void OnConfirm(object sender, FormEventArgs e) -// { -// var group = new Group() -// { -// Id = Guid.NewGuid().ToString(), -// Name = GroupName.Value, -// Created = DateTime.Now, -// Updated = DateTime.Now -// }; - -// UserManager.AddGroup(group); - -// e.Context.Page.Redirecting(e.Context.Uri); -// } -// } -//} diff --git a/src/WebExpress.WebApp/WebControl/ControlModalFormGroupDelete.cs b/src/WebExpress.WebApp/WebControl/ControlModalFormGroupDelete.cs deleted file mode 100644 index 1051f73..0000000 --- a/src/WebExpress.WebApp/WebControl/ControlModalFormGroupDelete.cs +++ /dev/null @@ -1,60 +0,0 @@ -//using System; -//using WebExpress.WebApp.WebUser; -//using WebExpress.WebCore.WebHtml; -//using WebExpress.WebCore.WebPage; -//using WebExpress.WebUI.WebControl; -//using static WebExpress.WebCore.Internationalization.InternationalizationManager; - -//namespace WebExpress.WebApp.WebControl -//{ -// internal sealed class ControlModalFormGroupDelete : ControlModalFormConfirmDelete -// { -// /// -// /// Returns or sets the group to be edited. -// /// -// public Group Item { get; set; } - -// /// -// /// Returns the description. -// /// -// private ControlFormItemStaticText Description { get; } = new ControlFormItemStaticText(); - -// /// -// /// Initializes a new instance of the class. -// /// -// /// The control id. -// public ControlModalFormGroupDelete(string id = null) -// : base("delete_" + id) -// { -// Confirm += OnConfirm; - -// Header = "webexpress.webapp:setting.usermanager.group.delete.header"; -// Content = Description; -// } - -// /// -// /// Invoked when the deletion is confirmed. -// /// -// /// The trigger of the event. -// /// The event argument. -// /// -// private void OnConfirm(object sender, FormEventArgs e) -// { -// UserManager.RemoveGroup(Item); - -// e.Context.Page.Redirecting(e.Context.Uri); -// } - -// /// -// /// Convert to html. -// /// -// /// The context in which the control is rendered. -// /// The control as html. -// public override IHtmlNode Render(RenderContext context) -// { -// Description.Text = string.Format(I18N(context.Culture, "webexpress.webapp:setting.usermanager.group.delete.description"), Item.Name); - -// return base.Render(context); -// } -// } -//} diff --git a/src/WebExpress.WebApp/WebControl/ControlModalFormUserDelete.cs b/src/WebExpress.WebApp/WebControl/ControlModalFormUserDelete.cs deleted file mode 100644 index e0fd951..0000000 --- a/src/WebExpress.WebApp/WebControl/ControlModalFormUserDelete.cs +++ /dev/null @@ -1,58 +0,0 @@ -//using WebExpress.WebApp.WebUser; -//using WebExpress.WebCore.WebHtml; -//using WebExpress.WebCore.WebPage; -//using WebExpress.WebUI.WebControl; -//using static WebExpress.WebCore.Internationalization.InternationalizationManager; - -//namespace WebExpress.WebApp.WebControl -//{ -// internal sealed class ControlModalFormUserDelete : ControlModalFormConfirmDelete -// { -// /// -// /// Returns or sets the user to be deleted. -// /// -// public User Item { get; set; } - -// /// -// /// Returns the description. -// /// -// private ControlFormItemStaticText Description { get; } = new ControlFormItemStaticText(); - -// /// -// /// Initializes a new instance of the class. -// /// -// /// The control id. -// public ControlModalFormUserDelete(string id = null) -// : base("delete_" + id) -// { -// Confirm += OnConfirm; - -// Header = "webexpress.webapp:setting.usermanager.user.delete.header"; -// Content = Description; -// } - -// /// -// /// Invoked when the deletion is confirmed. -// /// -// /// The trigger of the event. -// /// The event argument. -// private void OnConfirm(object sender, FormEventArgs e) -// { -// UserManager.RemoveUser(Item); - -// e.Context.Page.Redirecting(e.Context.Uri); -// } - -// /// -// /// Convert to html. -// /// -// /// The context in which the control is rendered. -// /// The control as html. -// public override IHtmlNode Render(RenderContext context) -// { -// Description.Text = string.Format(I18N(context.Culture, "webexpress.webapp:setting.usermanager.user.delete.description"), Item.Login); - -// return base.Render(context); -// } -// } -//} diff --git a/src/WebExpress.WebApp/WebControl/ControlModalFormUserEdit.cs b/src/WebExpress.WebApp/WebControl/ControlModalFormUserEdit.cs deleted file mode 100644 index 21b7c02..0000000 --- a/src/WebExpress.WebApp/WebControl/ControlModalFormUserEdit.cs +++ /dev/null @@ -1,203 +0,0 @@ -//using System; -//using System.Collections.Generic; -//using System.Linq; -//using WebExpress.WebApp.WebUser; -//using WebExpress.WebUI.WebControl; - -//namespace WebExpress.WebApp.WebControl -//{ -// internal sealed class ControlModalFormUserEdit : ControlModalForm -// { -// /// -// /// Returns or sets the user to edit. -// /// -// public User Item { get; set; } - -// /// -// /// Returns the description of the form. -// /// -// private ControlFormItemStaticText Description { get; } = new ControlFormItemStaticText() -// { -// Text = "webexpress.webapp:setting.usermanager.user.edit.description", -// TextColor = new PropertyColorText(TypeColorText.Secondary) -// }; - -// /// -// /// Returns the control for entering the login id. -// /// -// private ControlFormItemInputTextBox Login { get; } = new ControlFormItemInputTextBox() -// { -// Label = "webexpress.webapp:setting.usermanager.user.edit.login.label", -// Name = "login" -// }; - -// /// -// /// Returns the control for entering the first name. -// /// -// private ControlFormItemInputTextBox Firstname { get; } = new ControlFormItemInputTextBox() -// { -// Label = "webexpress.webapp:setting.usermanager.user.edit.firstname.label", -// Name = "firstname" -// }; - -// /// -// /// Returns the control for entering the last name. -// /// -// private ControlFormItemInputTextBox Lastname { get; } = new ControlFormItemInputTextBox() -// { -// Label = "webexpress.webapp:setting.usermanager.user.edit.lastname.label", -// Name = "lastname" -// }; - -// /// -// /// Returns the control for entering the email address. -// /// -// private ControlFormItemInputTextBox Email { get; } = new ControlFormItemInputTextBox() -// { -// Label = "webexpress.webapp:setting.usermanager.user.edit.email.label", -// Name = "email", -// Placeholder = "user@example.com" -// }; - -// /// -// /// Returns or sets the groups. -// /// -// private ControlFormItemInputMove Groups { get; set; } - -// /// -// /// Initializes a new instance of the class. -// /// -// /// The id. -// public ControlModalFormUserEdit(string id = null) -// : base(id) -// { -// Groups = new ControlFormItemInputMove(id) -// { -// Name = "groups", -// Label = "webexpress.webapp:setting.usermanager.user.edit.groups.label", -// Help = "webexpress.webapp:setting.usermanager.user.edit.groups.description", -// SelectedHeader = "webexpress.webapp:setting.usermanager.user.edit.groups.selected", -// AvailableHeader = "webexpress.webapp:setting.usermanager.user.edit.groups.available", -// Icon = new PropertyIcon(TypeIcon.Users) -// }; - -// Login.Validation += OnLoginValidation; -// Firstname.Validation += OnFirstnameValidation; -// Lastname.Validation += OnLastnameValidation; -// Email.Validation += OnEmailValidation; - -// Add(Description); -// Add(Login); -// Add(new ControlFormItemGroupColumnVertical(Firstname, Lastname) { Distribution = new int[] { 50 } }); -// Add(Email); -// Add(Groups); -// //Form.SubmitButton.Text = "webexpress.webapp:setting.usermanager.user.edit.confirm"; -// Form.FillForm += OnFillForm; -// Form.ProcessForm += OnConfirm; - -// Header = "webexpress.webapp:setting.usermanager.user.edit.header"; -// } - -// /// -// /// Invoked when the form is to be filled with initial values. -// /// -// /// The trigger of the event. -// /// The event argument. -// private void OnFillForm(object sender, FormEventArgs e) -// { -// Login.Value = Item?.Login; -// Firstname.Value = Item?.Firstname; -// Lastname.Value = Item?.Lastname; -// Email.Value = Item?.Email; - -// foreach (var v in UserManager.Groups.OrderBy(x => x.Name)) -// { -// Groups.Options.Add(new ControlFormItemInputSelectionItem() -// { -// Id = v.Id, -// Label = v.Name -// }); -// } - -// Groups.Value = string.Join(";", Item.GroupIds); -// } - -// /// -// /// Called when the entered login id is to be checked. -// /// -// /// The trigger of the event. -// /// The event argument. -// private void OnLoginValidation(object sender, ValidationEventArgs e) -// { -// if (string.IsNullOrWhiteSpace(Login.Value)) -// { -// e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.user.edit.login.error.empty")); -// } - -// if (UserManager.Users.Where(x => x != Item && x.Login.Equals(Login.Value, StringComparison.OrdinalIgnoreCase)).Any()) -// { -// e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.user.edit.login.error.duplicate")); -// } -// } - -// /// -// /// Called when the entered first name is to be checked. -// /// -// /// The trigger of the event. -// /// The event argument. -// private void OnFirstnameValidation(object sender, ValidationEventArgs e) -// { -// if (string.IsNullOrWhiteSpace(Firstname.Value)) -// { -// e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.user.edit.firstname.error.empty")); -// } -// } - -// /// -// /// Called when the entered last name is to be checked. -// /// -// /// The trigger of the event. -// /// The event argument. -// private void OnLastnameValidation(object sender, ValidationEventArgs e) -// { -// if (string.IsNullOrWhiteSpace(Lastname.Value)) -// { -// e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.user.edit.lastname.error.empty")); -// } -// } - -// /// -// /// Invoked when the entered email address is to be verified. -// /// -// /// The trigger of the event. -// /// The event argument. -// private void OnEmailValidation(object sender, ValidationEventArgs e) -// { -// if (string.IsNullOrWhiteSpace(Email.Value)) -// { -// e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.user.edit.email.error.empty")); -// } -// } - -// /// -// /// Called when the delete action has been confirmed. -// /// -// /// The trigger of the event. -// /// The event argument. -// private void OnConfirm(object sender, FormEventArgs e) -// { -// Item.Login = Login.Value; -// Item.Firstname = Firstname.Value; -// Item.Lastname = Lastname.Value; -// Item.Email = Email.Value; - -// var groups = Groups.Value?.Split(";", StringSplitOptions.RemoveEmptyEntries); -// Item.GroupIds = new List(); -// Item.GroupIds.AddRange(groups); - -// UserManager.UpdateUser(Item); - -// e.Context.Page.Redirecting(e.Context.Uri); -// } -// } -//} diff --git a/src/WebExpress.WebApp/WebControl/ControlModalFormUserNew.cs b/src/WebExpress.WebApp/WebControl/ControlModalFormUserNew.cs deleted file mode 100644 index f08a179..0000000 --- a/src/WebExpress.WebApp/WebControl/ControlModalFormUserNew.cs +++ /dev/null @@ -1,191 +0,0 @@ -//using System; -//using System.Linq; -//using WebExpress.WebApp.WebUser; -//using WebExpress.WebUI.WebControl; - - -//namespace WebExpress.WebApp.WebControl -//{ -// internal sealed class ControlModalFormUserNew : ControlModalForm -// { -// /// -// /// Returns the description of the form. -// /// -// private ControlFormItemStaticText Description { get; } = new ControlFormItemStaticText() -// { -// Text = "webexpress.webapp:setting.usermanager.user.add.description", -// TextColor = new PropertyColorText(TypeColorText.Secondary) -// }; - -// /// -// /// Returns the control for entering the login id. -// /// -// private ControlFormItemInputTextBox Login { get; } = new ControlFormItemInputTextBox() -// { -// Label = "webexpress.webapp:setting.usermanager.user.add.login.label", -// Name = "login" -// }; - -// /// -// /// Returns the control for entering the first name. -// /// -// private ControlFormItemInputTextBox Firstname { get; } = new ControlFormItemInputTextBox() -// { -// Label = "webexpress.webapp:setting.usermanager.user.add.firstname.label", -// Name = "firstname" -// }; - -// /// -// /// Returns the control for entering the last name. -// /// -// private ControlFormItemInputTextBox Lastname { get; } = new ControlFormItemInputTextBox() -// { -// Label = "webexpress.webapp:setting.usermanager.user.add.lastname.label", -// Name = "lastname" -// }; - -// /// -// /// Returns the control for entering the email address. -// /// -// private ControlFormItemInputTextBox Email { get; } = new ControlFormItemInputTextBox() -// { -// Label = "webexpress.webapp:setting.usermanager.user.add.email.label", -// Name = "email", -// Placeholder = "user@example.com" -// }; - -// /// -// /// Returns the groups. -// /// -// private ControlFormItemInputMove Groups { get; } = new ControlFormItemInputMove("group") -// { -// Name = "groups", -// Label = "webexpress.webapp:setting.usermanager.user.edit.groups.label", -// Help = "webexpress.webapp:setting.usermanager.user.edit.groups.description", -// SelectedHeader = "webexpress.webapp:setting.usermanager.user.edit.groups.selected", -// AvailableHeader = "webexpress.webapp:setting.usermanager.user.edit.groups.available", -// Icon = new PropertyIcon(TypeIcon.Users) -// }; - -// /// -// /// Initializes a new instance of the class. -// /// -// /// The id. -// public ControlModalFormUserNew(string id = null) -// : base(id) -// { -// Login.Validation += OnLoginValidation; -// Firstname.Validation += OnFirstnameValidation; -// Lastname.Validation += OnLastnameValidation; -// Email.Validation += OnEmailValidation; - -// Add(Description); -// Add(Login); -// Add(new ControlFormItemGroupColumnVertical(Firstname, Lastname) { Distribution = new int[] { 50 } }); -// Add(Email); -// Add(Groups); -// //Form.SubmitButton.Text = "webexpress.webapp:setting.usermanager.user.add.confirm"; -// Form.FillForm += OnFillForm; -// Form.ProcessForm += OnConfirm; - -// Header = "webexpress.webapp:setting.usermanager.user.add.header"; -// } - -// /// -// /// Invoked when the form is to be filled with initial values. -// /// -// /// The trigger of the event. -// /// The event argument. -// private void OnFillForm(object sender, FormEventArgs e) -// { -// foreach (var v in UserManager.Groups.OrderBy(x => x.Name)) -// { -// Groups.Options.Add(new ControlFormItemInputSelectionItem() -// { -// Id = v.Id, -// Label = v.Name -// }); -// } -// } - -// /// -// /// Called when the entered login id is to be checked. -// /// -// /// The trigger of the event. -// /// The event argument. -// private void OnLoginValidation(object sender, ValidationEventArgs e) -// { -// if (string.IsNullOrWhiteSpace(Login.Value)) -// { -// e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.user.add.login.error.empty")); -// } - -// if (UserManager.Users.Where(x => x.Login.Equals(Login.Value, StringComparison.OrdinalIgnoreCase)).Any()) -// { -// e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.user.add.login.error.duplicate")); -// } -// } - -// /// -// /// Called when the entered first name is to be checked. -// /// -// /// The trigger of the event. -// /// The event argument. -// private void OnFirstnameValidation(object sender, ValidationEventArgs e) -// { -// if (string.IsNullOrWhiteSpace(Firstname.Value)) -// { -// e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.user.add.firstname.error.empty")); -// } -// } - -// /// -// /// Called when the entered last name is to be checked. -// /// -// /// The trigger of the event. -// /// The event argument. -// private void OnLastnameValidation(object sender, ValidationEventArgs e) -// { -// if (string.IsNullOrWhiteSpace(Lastname.Value)) -// { -// e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.user.add.lastname.error.empty")); -// } -// } - -// /// -// /// Invoked when the entered email address is to be verified. -// /// -// /// The trigger of the event. -// /// The event argument. -// private void OnEmailValidation(object sender, ValidationEventArgs e) -// { -// if (string.IsNullOrWhiteSpace(Email.Value)) -// { -// e.Results.Add(new ValidationResult(TypesInputValidity.Error, "webexpress.webapp:setting.usermanager.user.add.email.error.empty")); -// } -// } - -// /// -// /// Called when the delete action has been confirmed. -// /// -// /// The trigger of the event. -// /// The event argument. -// private void OnConfirm(object sender, FormEventArgs e) -// { -// var user = new User() -// { -// Id = Guid.NewGuid(), -// Login = Login.Value, -// Firstname = Firstname.Value, -// Lastname = Lastname.Value, -// Email = Email.Value, -// Created = DateTime.Now, -// Updated = DateTime.Now -// }; - -// UserManager.AddUser(user); - -// e.Context.Page.Redirecting(e.Context.Uri); -// } -// } -//} diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppContent.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppContent.cs index ea7a7a1..857d491 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppContent.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppContent.cs @@ -1,68 +1,31 @@ -using System.Collections.Generic; -using System.Linq; -using WebExpress.WebApp.WebSection; -using WebExpress.WebCore; -using WebExpress.WebCore.WebHtml; +using WebExpress.WebCore.WebHtml; using WebExpress.WebUI.WebControl; -using WebExpress.WebUI.WebFragment; using WebExpress.WebUI.WebPage; namespace WebExpress.WebApp.WebControl { /// - /// Content of a web app page. + /// Represents the content control for a web application. /// - public class ControlWebAppContent : ControlPanel + public class ControlWebAppContent : Control { /// - /// Returns the preferences area. - /// - public List Preferences { get; } = []; - - /// - /// Returns the primary area. - /// - public List Primary { get; } = []; - - /// - /// Returns the secondary area. + /// Returns the toolbar. /// - public List Secondary { get; } = []; + public ControlWebAppToolbar Toolbar { get; } = new ControlWebAppToolbar("webexpress-webapp-content-toolbar"); /// /// Returns the main panel. /// - private ControlPanelMain MainPanel { get; } = new ControlPanelMain("webexpress.webapp.content.main") + public ControlWebAppMain MainPanel { get; } = new ControlWebAppMain("webexpress-webapp-content-main") { - Padding = new PropertySpacingPadding(PropertySpacing.Space.Two, PropertySpacing.Space.Null), - Margin = new PropertySpacingMargin(PropertySpacing.Space.Null, PropertySpacing.Space.Two, PropertySpacing.Space.Null, PropertySpacing.Space.Null), - //BackgroundColor = LayoutSchema.ContentBackground, - Classes = ["flex-grow-1"] - }; - - /// - /// Returns the flexbox. - /// - private ControlPanelFlexbox Flexbox { get; } = new ControlPanelFlexbox() - { - Layout = TypeLayoutFlexbox.Default, - Align = TypeAlignFlexbox.Stretch + //BackgroundColor = new PropertyColorBackground(TypeColorBackground.Danger), }; /// /// Returns the page properties. /// - public ControlWebAppProperty Property { get; } = new ControlWebAppProperty("webexpress.webapp.content.property"); - - /// - /// Returns the toolbar. - /// - public ControlToolbar Toolbar { get; } = new ControlToolbar("webexpress.webapp.content.toolbar"); - - /// - /// Returns the headline control. - /// - public ControlWebAppHeadline Headline { get; } = new ControlWebAppHeadline("webexpress.webapp.content.main.headline"); + public ControlWebAppProperty Property { get; } = new ControlWebAppProperty("webexpress-webapp-content-property"); /// /// Initializes a new instance of the class. @@ -71,57 +34,6 @@ public class ControlWebAppContent : ControlPanel public ControlWebAppContent(string id = null) : base(id) { - //BackgroundColor = LayoutSchema.ContentBackground; - //Toolbar.BackgroundColor = LayoutSchema.ToolbarBackground; - Margin = new PropertySpacingMargin(PropertySpacing.Space.Two); - - Flexbox.Add(MainPanel); - Flexbox.Add(Property); - - Add(Toolbar); - Add(Flexbox); - - MainPanel.Add(Headline); - MainPanel.RetrieveVirtualItem += OnRetrieveVirtualMainPanelItems; - - Classes = ["content"]; - } - - /// - /// Handles the retrieval of virtual items for the main panel. - /// - /// The source of the event. - /// The event data containing the context for rendering and scopes. - private void OnRetrieveVirtualMainPanelItems(object sender, RetrieveVirtualControlItemEventArgs e) - { - var preferences = WebEx.ComponentHub.FragmentManager.GetFragments - ( - e.RenderContext?.PageContext?.ApplicationContext, - e.RenderContext?.PageContext?.Scopes - ); - - var primary = WebEx.ComponentHub.FragmentManager.GetFragments - ( - e.RenderContext?.PageContext?.ApplicationContext, - e.RenderContext?.PageContext?.Scopes - ); - - var secondary = WebEx.ComponentHub.FragmentManager.GetFragments - ( - e.RenderContext?.PageContext?.ApplicationContext, - e.RenderContext?.PageContext?.Scopes - ); - - var preferencesList = Preferences.Union(preferences); - var primaryList = Primary.Union(primary); - var secondaryList = Secondary.Union(secondary); - - e.Items = - [ - new ControlPanel("webexpress.webapp.content.main.preferences", preferencesList.ToArray()), - new ControlPanel("webexpress.webapp.content.main.primary", primaryList.ToArray()), - new ControlPanel("webexpress.webapp.content.main.secondary", secondaryList.ToArray()) - ]; } /// @@ -132,9 +44,22 @@ private void OnRetrieveVirtualMainPanelItems(object sender, RetrieveVirtualContr /// An HTML node representing the rendered control. public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTreeControl visualTree) { - Toolbar.Enable = Toolbar.Items.Any(); - - return base.Render(renderContext, visualTree); + var contentCtlr = new ControlPanel + ( + Id, + Toolbar, + new ControlPanelFlexbox(null, MainPanel, Property) + { + Layout = TypeLayoutFlexbox.Default, + Align = TypeAlignFlexbox.Stretch + } + ) + { + Classes = ["content"], + Margin = new PropertySpacingMargin(PropertySpacing.Space.Two) + }; + + return contentCtlr?.Render(renderContext, visualTree); } } } diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppFooter.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppFooter.cs index 2cdc608..f3f2051 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppFooter.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppFooter.cs @@ -14,20 +14,24 @@ namespace WebExpress.WebApp.WebControl /// public class ControlWebAppFooter : Control { + private readonly List _preferences = []; + private readonly List _primary = []; + private readonly List _secondary = []; + /// - /// Returns or sets the preferences area. + /// Returns the preferences area. /// - public List Preferences { get; protected set; } = []; + public IEnumerable Preferences => _preferences; /// - /// Returns or sets the primary area. + /// Returns the primary area. /// - public List Primary { get; protected set; } = []; + public IEnumerable Primary => _primary; /// - /// Returns or sets the secondary area. + /// Returns the secondary area. /// - public List Secondary { get; protected set; } = []; + public IEnumerable Secondary => _secondary; /// /// Initializes a new instance of the class. @@ -40,6 +44,60 @@ public ControlWebAppFooter(string id = null) //TextColor = LayoutSchema.FooterText; } + /// + /// Adds items to the preferences area. + /// + /// The items to add to the preferences area. + public void AddPreferences(params IControl[] items) + { + _preferences.AddRange(items); + } + + /// + /// Removes an item from the preferences area. + /// + /// The item to remove from the preferences area. + public void RemovePreference(IControl item) + { + _preferences.Remove(item); + } + + /// + /// Adds items to the primary area. + /// + /// The items to add to the primary area. + public void AddPrimary(params IControl[] items) + { + _primary.AddRange(items); + } + + /// + /// Removes an item from the primary area. + /// + /// The item to remove from the primary area. + public void RemovePrimary(IControl item) + { + _primary.Remove(item); + } + + /// + /// Adds items to the secondary area. + /// + /// The items to add to the secondary area. + public void AddSecondary(params IControl[] items) + { + _secondary.AddRange(items); + } + + /// + /// Removes an item from the secondary area. + /// + /// The item to remove from the secondary area. + public void RemoveSecondary(IControl item) + { + _secondary.Remove(item); + } + /// /// Converts the control to an HTML representation. /// @@ -48,42 +106,35 @@ public ControlWebAppFooter(string id = null) /// An HTML node representing the rendered control. public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTreeControl visualTree) { - var preferences = WebEx.ComponentHub.FragmentManager.GetFragments + var preferences = Preferences.Union(WebEx.ComponentHub.FragmentManager.GetFragments ( renderContext?.PageContext?.ApplicationContext, renderContext?.PageContext?.Scopes - ); + )); - var primary = WebEx.ComponentHub.FragmentManager.GetFragments + var primary = Primary.Union(WebEx.ComponentHub.FragmentManager.GetFragments ( renderContext?.PageContext?.ApplicationContext, renderContext?.PageContext?.Scopes - ); + )); - var secondary = WebEx.ComponentHub.FragmentManager.GetFragments + var secondary = Secondary.Union(WebEx.ComponentHub.FragmentManager.GetFragments ( renderContext?.PageContext?.ApplicationContext, renderContext?.PageContext?.Scopes - ); - - var preferencesList = Preferences.Union(preferences).ToList(); - var primaryList = Primary.Union(primary).ToList(); - var secondaryList = Secondary.Union(secondary).ToList(); + )); - var elements = new List + var footerCtrl = (preferences.Any() || primary.Any() || secondary.Any()) ? new ControlPanelFooter + ( + Id, + new ControlPanel(null, [.. preferences]), + new ControlPanel(null, [.. primary]), + new ControlPanel(null, [.. secondary]) + ) { - new HtmlElementTextContentDiv(preferencesList.Select(x => x.Render(renderContext, visualTree)).ToArray()), - new HtmlElementTextContentDiv(primaryList.Select(x => x.Render(renderContext, visualTree)).ToArray()) { Class = "justify-content-center" }, - new HtmlElementTextContentDiv(secondaryList.Select(x => x.Render(renderContext, visualTree)).ToArray()) - }; + } : null; - return new HtmlElementTextContentDiv(elements.ToArray()) - { - Id = Id, - Class = Css.Concatenate("footer", GetClasses()), - Style = Style.Concatenate("", GetStyles()), - Role = Role - }; + return footerCtrl?.Render(renderContext, visualTree); } } } diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeader.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeader.cs index 60316ff..e62d80a 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeader.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeader.cs @@ -40,21 +40,21 @@ public virtual TypeSticky Sticky /// /// Returns or sets the application navigator. /// - public ControlWebAppHeaderAppNavigator AppNavigator { get; } = new ControlWebAppHeaderAppNavigator("webexpress.webapp.header.appnavigator") + public ControlWebAppHeaderAppNavigator AppNavigator { get; } = new ControlWebAppHeaderAppNavigator("webexpress-webapp-header-appnavigator") { }; /// /// Returns or setss the name of the application. /// - public ControlWebAppHeaderAppTitle AppTitle { get; } = new ControlWebAppHeaderAppTitle("webexpress.webapp.header.apptitle") + public ControlWebAppHeaderAppTitle AppTitle { get; } = new ControlWebAppHeaderAppTitle("webexpress-webapp-header-apptitle") { }; /// /// Returns or sets the navigation of the application. /// - public ControlWebAppHeaderAppNavigation AppNavigation { get; } = new ControlWebAppHeaderAppNavigation("webexpress.webapp.header.appnavigation") + public ControlWebAppHeaderAppNavigation AppNavigation { get; } = new ControlWebAppHeaderAppNavigation("webexpress-webapp-header-appnavigation") { Layout = TypeLayoutFlexbox.Inline, Justify = TypeJustifiedFlexbox.Start @@ -63,21 +63,28 @@ public virtual TypeSticky Sticky /// /// Returns or sets the quick create. /// - public ControlWebAppHeaderQuickCreate QuickCreate { get; } = new ControlWebAppHeaderQuickCreate("webexpress.webapp.header.quickcreate") + public ControlWebAppHeaderQuickCreate QuickCreate { get; } = new ControlWebAppHeaderQuickCreate("webexpress-webapp-header-quickcreate") { }; /// /// Returns or sets the navigation of the application helpers. /// - public ControlWebAppHeaderHelp Help { get; } = new ControlWebAppHeaderHelp("webexpress.webapp.header.help") + public ControlWebAppHeaderHelp Help { get; } = new ControlWebAppHeaderHelp("webexpress-webapp-header-help") + { + }; + + /// + /// Returns or sets the navigation of the application helpers. + /// + public ControlWebAppHeaderNotification Notifications { get; } = new ControlWebAppHeaderNotification("webexpress-webapp-header-notifications") { }; /// /// Returns or sets the navigation of the application settings. /// - public ControlWebAppHeaderSettings Settings { get; } = new ControlWebAppHeaderSettings("webexpress.webapp.header.settings") + public ControlWebAppHeaderSettings Settings { get; } = new ControlWebAppHeaderSettings("webexpress-webapp-header-settings") { }; @@ -111,6 +118,7 @@ public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTre QuickCreate, new ControlPanel() { Margin = new PropertySpacingMargin(PropertySpacing.Space.Auto, PropertySpacing.Space.None) }, Help, + Notifications, Settings ) { diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigation.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigation.cs index 9d07ac5..eb32a90 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigation.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigation.cs @@ -10,24 +10,28 @@ namespace WebExpress.WebApp.WebControl { /// - /// Header for a web app. + /// Represents the header navigation control for the web application. /// public class ControlWebAppHeaderAppNavigation : ControlPanelFlexbox { + private readonly List _preferences = []; + private readonly List _primary = []; + private readonly List _secondary = []; + /// - /// Returns or sets the preferences area. + /// Returns the preferences area. /// - public IEnumerable Preferences { get; protected set; } = []; + public IEnumerable Preferences => _preferences; /// - /// Returns or sets the primary area. + /// Returns the primary area. /// - public IEnumerable Primary { get; protected set; } = []; + public IEnumerable Primary => _primary; /// - /// Returns or sets the secondary area. + /// Returns the secondary area. /// - public IEnumerable Secondary { get; protected set; } = []; + public IEnumerable Secondary => _secondary; /// /// Initializes a new instance of the class. @@ -39,6 +43,60 @@ public ControlWebAppHeaderAppNavigation(string id = null) Padding = new PropertySpacingPadding(PropertySpacing.Space.Null); } + /// + /// Adds items to the preferences area. + /// + /// The items to add to the preferences area. + public void AddPreferences(params IControlNavigationItem[] items) + { + _preferences.AddRange(items); + } + + /// + /// Removes an item from the preferences area. + /// + /// The item to remove from the preferences area. + public void RemovePreference(IControlNavigationItem item) + { + _preferences.Remove(item); + } + + /// + /// Adds items to the primary area. + /// + /// The items to add to the primary area. + public void AddPrimary(params IControlNavigationItem[] items) + { + _primary.AddRange(items); + } + + /// + /// Removes an item from the primary area. + /// + /// The item to remove from the primary area. + public void RemovePrimary(IControlNavigationItem item) + { + _primary.Remove(item); + } + + /// + /// Adds items to the secondary area. + /// + /// The items to add to the secondary area. + public void AddSecondary(params IControlNavigationItem[] items) + { + _secondary.AddRange(items); + } + + /// + /// Removes an item from the secondary area. + /// + /// The item to remove from the secondary area. + public void RemoveSecondary(IControlNavigationItem item) + { + _secondary.Remove(item); + } + /// /// Converts the control to an HTML representation. /// @@ -47,33 +105,17 @@ public ControlWebAppHeaderAppNavigation(string id = null) /// An HTML node representing the rendered control. public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTreeControl visualTree) { - var preferences = WebEx.ComponentHub.FragmentManager.GetFragments + var preferences = Preferences.Union(WebEx.ComponentHub.FragmentManager.GetFragments ( renderContext?.PageContext?.ApplicationContext, renderContext?.PageContext?.Scopes - ); + )); - var preferencesCtrl = new ControlNavigation("webexpress.webapp.header.appnavigation.preferences", Preferences.Union(preferences).ToArray()) - { - Layout = TypeLayoutTab.Default, - //ActiveColor = LayoutSchema.HeaderNavigationActiveBackground, - //ActiveTextColor = LayoutSchema.HeaderNavigationActive, - //LinkColor = LayoutSchema.HeaderNavigationLink - }; - - var primary = WebEx.ComponentHub.FragmentManager.GetFragments + var primary = Primary.Union(WebEx.ComponentHub.FragmentManager.GetFragments ( renderContext?.PageContext?.ApplicationContext, renderContext?.PageContext?.Scopes - ); - - var primaryCtrl = new ControlNavigation("webexpress.webapp.header.appnavigation.primary", Primary.Union(primary).ToArray()) - { - Layout = TypeLayoutTab.Default, - //ActiveColor = LayoutSchema.HeaderNavigationActiveBackground, - //ActiveTextColor = LayoutSchema.HeaderNavigationActive, - //LinkColor = LayoutSchema.HeaderNavigationLink - }; + )); var secondary = WebEx.ComponentHub.FragmentManager.GetFragments ( @@ -81,15 +123,30 @@ public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTre renderContext?.PageContext?.Scopes ); - var secondaryCtrl = new ControlNavigation("webexpress.webapp.header.appnavigation.secondary", Secondary.Union(secondary).ToArray()) - { - Layout = TypeLayoutTab.Default, - //ActiveColor = LayoutSchema.HeaderNavigationActiveBackground, - //ActiveTextColor = LayoutSchema.HeaderNavigationActive, - //LinkColor = LayoutSchema.HeaderNavigationLink - }; - - return new HtmlElementTextContentDiv(preferencesCtrl.Render(renderContext, visualTree), primaryCtrl.Render(renderContext, visualTree), secondaryCtrl.Render(renderContext, visualTree)) + return new HtmlElementTextContentDiv + ( + preferences.Any() ? new ControlNavigation("webexpress.webapp.header.appnavigation.preferences", [.. preferences]) + { + Layout = TypeLayoutTab.Default, + //ActiveColor = LayoutSchema.HeaderNavigationActiveBackground, + //ActiveTextColor = LayoutSchema.HeaderNavigationActive, + //LinkColor = LayoutSchema.HeaderNavigationLink + }.Render(renderContext, visualTree) : null, + primary.Any() ? new ControlNavigation("webexpress.webapp.header.appnavigation.primary", [.. primary]) + { + Layout = TypeLayoutTab.Default, + //ActiveColor = LayoutSchema.HeaderNavigationActiveBackground, + //ActiveTextColor = LayoutSchema.HeaderNavigationActive, + //LinkColor = LayoutSchema.HeaderNavigationLink + }.Render(renderContext, visualTree) : null, + secondary.Any() ? new ControlNavigation("webexpress.webapp.header.appnavigation.secondary", Secondary.Union(secondary).ToArray()) + { + Layout = TypeLayoutTab.Default, + //ActiveColor = LayoutSchema.HeaderNavigationActiveBackground, + //ActiveTextColor = LayoutSchema.HeaderNavigationActive, + //LinkColor = LayoutSchema.HeaderNavigationLink + }.Render(renderContext, visualTree) : null + ) { Id = Id, Class = Css.Concatenate("", GetClasses()), diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigator.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigator.cs index efe2a1f..b3189a2 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigator.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigator.cs @@ -20,17 +20,17 @@ public class ControlWebAppHeaderAppNavigator : Control private readonly List _secondary = []; /// - /// Returns or sets the preferences area. + /// Returns the preferences area. /// public IEnumerable Preferences => _preferences; /// - /// Returns or sets the primary area. + /// Returns the primary area. /// public IEnumerable Primary => _primary; /// - /// Returns or sets the secondary area. + /// Returns the secondary area. /// public IEnumerable Secondary => _secondary; @@ -106,73 +106,84 @@ public void RemoveSecondary(IControlDropdownItem item) /// An HTML node representing the rendered control. public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTreeControl visualTree) { - var preferences = WebEx.ComponentHub.FragmentManager.GetFragments - ( - renderContext?.PageContext?.ApplicationContext, - renderContext?.PageContext?.Scopes - ); + var application = renderContext?.PageContext?.ApplicationContext; + var items = GetItems(renderContext); - return Render(renderContext, visualTree, _preferences.Union(preferences), _primary, _secondary); + var navigatorCtrl = items.Any() ? + (IControl)new ControlDropdown(Id, [.. items]) + { + Image = application?.Icon, + Height = 50, + Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None), + Styles = ["padding: 0.5em;"] + } : + new ControlImage(Id) + { + Uri = application?.Icon, + Height = 50, + Padding = new PropertySpacingPadding(PropertySpacing.Space.Two), + Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None) + }; + + return navigatorCtrl?.Render(renderContext, visualTree); } /// - /// Converts the control to an HTML representation. + /// Retrieves the items to be displayed in the dropdown. /// /// The context in which the control is rendered. - /// The visual tree representing the control's structure. - /// The preferences area items. - /// The primary area items. - /// The secondary area items. - /// An HTML node representing the rendered control. - public virtual IHtmlNode Render - ( - IRenderControlContext renderContext, - IVisualTreeControl visualTree, - IEnumerable preferences, - IEnumerable primary, - IEnumerable secondary - ) + /// A collection of dropdown items. + private IEnumerable GetItems(IRenderControlContext renderContext) { var application = renderContext?.PageContext?.ApplicationContext; - var hamburger = new List - { - new ControlDropdownItemHeader() { Text = I18N.Translate(renderContext.Request.Culture, application?.ApplicationName) } - }; + var preferences = Preferences.Union(WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + )); + + var primary = Primary.Union(WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + )); - hamburger.AddRange(preferences); + var secondary = Secondary.Union(WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + )); - if (preferences.Any() && primary.Any()) + if (preferences.Any() && primary.Any() && secondary.Any()) { - hamburger.Add(new ControlDropdownItemDivider()); + yield return new ControlDropdownItemHeader(I18N.Translate(renderContext.Request, application?.ApplicationName)); } - hamburger.AddRange(primary); - - if (primary.Any() && secondary.Any()) + foreach (var item in preferences) { - hamburger.Add(new ControlDropdownItemDivider()); + yield return item; } - hamburger.AddRange(secondary); + if (preferences.Any() && (primary.Any() || secondary.Any())) + { + yield return new ControlDropdownItemDivider(); + } - var logo = (hamburger.Count > 1) ? - (IControl)new ControlDropdown(Id, hamburger.ToArray()) + foreach (var item in primary) { - Image = application?.Icon, - Height = 50, - Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None), - Styles = ["padding: 0.5em;"] - } : - new ControlImage(Id) + yield return item; + } + + if (primary.Any() && secondary.Any()) { - Uri = application?.Icon, - Height = 50, - Padding = new PropertySpacingPadding(PropertySpacing.Space.Two), - Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None) - }; + yield return new ControlDropdownItemDivider(); + } - return logo?.Render(renderContext, visualTree); + foreach (var item in secondary) + { + yield return item; + } } } } diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderHelp.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderHelp.cs index ba2200e..53e76c7 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderHelp.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderHelp.cs @@ -15,20 +15,24 @@ namespace WebExpress.WebApp.WebControl /// public class ControlWebAppHeaderHelp : Control { + private readonly List _preferences = []; + private readonly List _primary = []; + private readonly List _secondary = []; + /// - /// Returns or sets the preferences area. + /// Returns the preferences area. /// - public List Preferences { get; protected set; } = []; + public IEnumerable Preferences => _preferences; /// - /// Returns or sets the primary area. + /// Returns the primary area. /// - public List Primary { get; protected set; } = []; + public IEnumerable Primary => _primary; /// - /// Returns or sets the secondary area. + /// Returns the secondary area. /// - public List Secondary { get; protected set; } = []; + public IEnumerable Secondary => _secondary; /// /// Initializes a new instance of the class. @@ -40,6 +44,60 @@ public ControlWebAppHeaderHelp(string id = null) Padding = new PropertySpacingPadding(PropertySpacing.Space.Null); } + /// + /// Adds items to the preferences area. + /// + /// The items to add to the preferences area. + public void AddPreferences(params IControlDropdownItem[] items) + { + _preferences.AddRange(items); + } + + /// + /// Removes an item from the preferences area. + /// + /// The item to remove from the preferences area. + public void RemovePreference(IControlDropdownItem item) + { + _preferences.Remove(item); + } + + /// + /// Adds items to the primary area. + /// + /// The items to add to the primary area. + public void AddPrimary(params IControlDropdownItem[] items) + { + _primary.AddRange(items); + } + + /// + /// Removes an item from the primary area. + /// + /// The item to remove from the primary area. + public void RemovePrimary(IControlDropdownItem item) + { + _primary.Remove(item); + } + + /// + /// Adds items to the secondary area. + /// + /// The items to add to the secondary area. + public void AddSecondary(params IControlDropdownItem[] items) + { + _secondary.AddRange(items); + } + + /// + /// Removes an item from the secondary area. + /// + /// The item to remove from the secondary area. + public void RemoveSecondary(IControlDropdownItem item) + { + _secondary.Remove(item); + } + /// /// Converts the control to an HTML representation. /// @@ -48,58 +106,75 @@ public ControlWebAppHeaderHelp(string id = null) /// An HTML node representing the rendered control. public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTreeControl visualTree) { - var preferences = WebEx.ComponentHub.FragmentManager.GetFragments + var items = GetItems(renderContext); + + var helpCtlr = items.Any() ? + new ControlDropdown(Id, [.. items]) + { + Icon = new PropertyIcon(TypeIcon.InfoCircle), + AlignmentMenu = TypeAlignmentDropdownMenu.Right, + //BackgroundColor = new PropertyColorButton(TypeColorButton.Dark), + Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.None, PropertySpacing.Space.None) + } : + null; + + return helpCtlr?.Render(renderContext, visualTree); + } + + /// + /// Retrieves the items to be displayed in the dropdown. + /// + /// The context in which the control is rendered. + /// A collection of dropdown items. + private IEnumerable GetItems(IRenderControlContext renderContext) + { + var preferences = Preferences.Union(WebEx.ComponentHub.FragmentManager.GetFragments ( renderContext?.PageContext?.ApplicationContext, renderContext?.PageContext?.Scopes - ); + )); - var primary = WebEx.ComponentHub.FragmentManager.GetFragments + var primary = Primary.Union(WebEx.ComponentHub.FragmentManager.GetFragments ( renderContext?.PageContext?.ApplicationContext, renderContext?.PageContext?.Scopes - ); + )); - var secondary = WebEx.ComponentHub.FragmentManager.GetFragments + var secondary = Secondary.Union(WebEx.ComponentHub.FragmentManager.GetFragments ( renderContext?.PageContext?.ApplicationContext, renderContext?.PageContext?.Scopes - ); + )); - var helpList = new List + if (preferences.Any() && primary.Any() && secondary.Any()) { - new ControlDropdownItemHeader() { Text = I18N.Translate(renderContext.Request?.Culture, "webexpress.webapp:header.help.label") } - }; - - var preferencesList = Preferences.Union(preferences).ToList(); - var primaryList = Primary.Union(primary).ToList(); - var secondaryList = Secondary.Union(secondary).ToList(); + yield return new ControlDropdownItemHeader(I18N.Translate(renderContext.Request, "webexpress.webapp:header.help.label")); + } - helpList.AddRange(preferencesList); - if (preferencesList.Count > 0 && primaryList.Count > 0) + foreach (var item in preferences) { - helpList.Add(new ControlDropdownItemDivider()); + yield return item; } - helpList.AddRange(primaryList); - if (primaryList.Count > 0 && secondaryList.Count > 0) + if (preferences.Any() && (primary.Any() || secondary.Any())) { - helpList.Add(new ControlDropdownItemDivider()); + yield return new ControlDropdownItemDivider(); } - helpList.AddRange(secondaryList); + foreach (var item in primary) + { + yield return item; + } - var help = (helpList.Count > 1) ? - new ControlDropdown(Id, helpList.ToArray()) + if (primary.Any() && secondary.Any()) { - Icon = new PropertyIcon(TypeIcon.InfoCircle), - AlignmentMenu = TypeAlignmentDropdownMenu.Right, - BackgroundColor = new PropertyColorButton(TypeColorButton.Dark), - Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.None, PropertySpacing.Space.None) - } : - null; + yield return new ControlDropdownItemDivider(); + } - return help?.Render(renderContext, visualTree); + foreach (var item in secondary) + { + yield return item; + } } } } diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderNotification.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderNotification.cs new file mode 100644 index 0000000..b482d00 --- /dev/null +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderNotification.cs @@ -0,0 +1,180 @@ +using System.Collections.Generic; +using System.Linq; +using WebExpress.WebApp.WebSection; +using WebExpress.WebCore; +using WebExpress.WebCore.Internationalization; +using WebExpress.WebCore.WebHtml; +using WebExpress.WebUI.WebControl; +using WebExpress.WebUI.WebFragment; +using WebExpress.WebUI.WebPage; + +namespace WebExpress.WebApp.WebControl +{ + /// + /// Represents a control for displaying header notifications in the web application. + /// + public class ControlWebAppHeaderNotification : Control + { + private readonly List _preferences = []; + private readonly List _primary = []; + private readonly List _secondary = []; + + /// + /// Returns the preferences area. + /// + public IEnumerable Preferences => _preferences; + + /// + /// Returns the primary area. + /// + public IEnumerable Primary => _primary; + + /// + /// Returns the secondary area. + /// + public IEnumerable Secondary => _secondary; + + /// + /// Initializes a new instance of the class. + /// + /// The controls id. + public ControlWebAppHeaderNotification(string id = null) + : base(id) + { + Padding = new PropertySpacingPadding(PropertySpacing.Space.Null); + } + + /// + /// Adds items to the preferences area. + /// + /// The items to add to the preferences area. + public void AddPreferences(params IControlDropdownItem[] items) + { + _preferences.AddRange(items); + } + + /// + /// Removes an item from the preferences area. + /// + /// The item to remove from the preferences area. + public void RemovePreference(IControlDropdownItem item) + { + _preferences.Remove(item); + } + + /// + /// Adds items to the primary area. + /// + /// The items to add to the primary area. + public void AddPrimary(params IControlDropdownItem[] items) + { + _primary.AddRange(items); + } + + /// + /// Removes an item from the primary area. + /// + /// The item to remove from the primary area. + public void RemovePrimary(IControlDropdownItem item) + { + _primary.Remove(item); + } + + /// + /// Adds items to the secondary area. + /// + /// The items to add to the secondary area. + public void AddSecondary(params IControlDropdownItem[] items) + { + _secondary.AddRange(items); + } + + /// + /// Removes an item from the secondary area. + /// + /// The item to remove from the secondary area. + public void RemoveSecondary(IControlDropdownItem item) + { + _secondary.Remove(item); + } + + /// + /// Converts the control to an HTML representation. + /// + /// The context in which the control is rendered. + /// The visual tree representing the control's structure. + /// An HTML node representing the rendered control. + public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTreeControl visualTree) + { + var items = GetItems(renderContext); + + var helpCtlr = items.Any() ? + new ControlDropdown(Id, [.. items]) + { + Icon = new PropertyIcon(TypeIcon.InfoCircle), + AlignmentMenu = TypeAlignmentDropdownMenu.Right, + //BackgroundColor = new PropertyColorButton(TypeColorButton.Dark), + Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.None, PropertySpacing.Space.None) + } : + null; + + return helpCtlr?.Render(renderContext, visualTree); + } + + /// + /// Retrieves the items to be displayed in the dropdown. + /// + /// The context in which the control is rendered. + /// A collection of dropdown items. + private IEnumerable GetItems(IRenderControlContext renderContext) + { + var preferences = Preferences.Union(WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + )); + + var primary = Primary.Union(WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + )); + + var secondary = Secondary.Union(WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + )); + + if (preferences.Any() && primary.Any() && secondary.Any()) + { + yield return new ControlDropdownItemHeader(I18N.Translate(renderContext.Request, "webexpress.webapp:header.notification.label")); + } + + foreach (var item in preferences) + { + yield return item; + } + + if (preferences.Any() && (primary.Any() || secondary.Any())) + { + yield return new ControlDropdownItemDivider(); + } + + foreach (var item in primary) + { + yield return item; + } + + if (primary.Any() && secondary.Any()) + { + yield return new ControlDropdownItemDivider(); + } + + foreach (var item in secondary) + { + yield return item; + } + } + } +} diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderQuickCreate.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderQuickCreate.cs index 6a62738..49f6f0b 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderQuickCreate.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderQuickCreate.cs @@ -15,20 +15,24 @@ namespace WebExpress.WebApp.WebControl /// public class ControlWebAppHeaderQuickCreate : Control { + private readonly List _preferences = []; + private readonly List _primary = []; + private readonly List _secondary = []; + /// - /// Returns or sets the preferences area. + /// Returns the preferences area. /// - public List Preferences { get; protected set; } = new List(); + public IEnumerable Preferences => _preferences; /// - /// Returns or sets the primary area. + /// Returns the primary area. /// - public List Primary { get; protected set; } = new List(); + public IEnumerable Primary => _primary; /// - /// Returns or sets the secondary area. + /// Returns the secondary area. /// - public List Secondary { get; protected set; } = new List(); + public IEnumerable Secondary => _secondary; /// /// Initializes a new instance of the class. @@ -40,6 +44,60 @@ public ControlWebAppHeaderQuickCreate(string id = null) Padding = new PropertySpacingPadding(PropertySpacing.Space.Null); } + /// + /// Adds items to the preferences area. + /// + /// The items to add to the preferences area. + public void AddPreferences(params IControlSplitButtonItem[] items) + { + _preferences.AddRange(items); + } + + /// + /// Removes an item from the preferences area. + /// + /// The item to remove from the preferences area. + public void RemovePreference(IControlSplitButtonItem item) + { + _preferences.Remove(item); + } + + /// + /// Adds items to the primary area. + /// + /// The items to add to the primary area. + public void AddPrimary(params IControlSplitButtonItem[] items) + { + _primary.AddRange(items); + } + + /// + /// Removes an item from the primary area. + /// + /// The item to remove from the primary area. + public void RemovePrimary(IControlSplitButtonItem item) + { + _primary.Remove(item); + } + + /// + /// Adds items to the secondary area. + /// + /// The items to add to the secondary area. + public void AddSecondary(params IControlSplitButtonItem[] items) + { + _secondary.AddRange(items); + } + + /// + /// Removes an item from the secondary area. + /// + /// The item to remove from the secondary area. + public void RemoveSecondary(IControlSplitButtonItem item) + { + _secondary.Remove(item); + } + /// /// Converts the control to an HTML representation. /// @@ -48,33 +106,33 @@ public ControlWebAppHeaderQuickCreate(string id = null) /// An HTML node representing the rendered control. public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTreeControl visualTree) { - var preferences = WebEx.ComponentHub.FragmentManager.GetFragments + var preferences = Preferences.Union(WebEx.ComponentHub.FragmentManager.GetFragments ( renderContext?.PageContext?.ApplicationContext, renderContext?.PageContext?.Scopes - ); + )); - var primary = WebEx.ComponentHub.FragmentManager.GetFragments + var primary = Primary.Union(WebEx.ComponentHub.FragmentManager.GetFragments ( renderContext?.PageContext?.ApplicationContext, renderContext?.PageContext?.Scopes - ); + )); - var secondary = WebEx.ComponentHub.FragmentManager.GetFragments + var secondary = Secondary.Union(WebEx.ComponentHub.FragmentManager.GetFragments ( renderContext?.PageContext?.ApplicationContext, renderContext?.PageContext?.Scopes - ); + )); - var quickcreateList = new List(Preferences.Union(preferences)); - quickcreateList.AddRange(Primary.Union(primary)); - quickcreateList.AddRange(Secondary.Union(secondary)); + var quickcreateList = preferences + .Union(primary) + .Union(secondary); - var firstQuickcreate = (quickcreateList.FirstOrDefault() as ControlLink); - firstQuickcreate?.Render(renderContext, visualTree); + var firstQuickcreate = quickcreateList.FirstOrDefault() as ControlSplitButtonItemLink; + var nextQuickcreate = quickcreateList.Skip(1); - var quickcreate = (quickcreateList.Count > 1) ? - (IControl)new ControlSplitButtonLink(Id, quickcreateList.Skip(1).ToArray()) + var quickcreate = nextQuickcreate.Any() ? + (IControl)new ControlSplitButtonLink(Id, nextQuickcreate.Skip(1).ToArray()) { Text = I18N.Translate(renderContext.Request?.Culture, "webexpress.webapp:header.quickcreate.label"), Uri = firstQuickcreate?.Uri, @@ -84,7 +142,7 @@ public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTre OnClick = firstQuickcreate?.OnClick, Modal = firstQuickcreate?.Modal } : - (Preferences.Count > 0) ? + Preferences.Any() ? new ControlButtonLink(Id) { Text = I18N.Translate(renderContext.Request?.Culture, "webexpress.webapp:header.quickcreate.label"), diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs index d2ae40c..6ffb694 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs @@ -15,20 +15,24 @@ namespace WebExpress.WebApp.WebControl /// public class ControlWebAppHeaderSettings : Control { + private readonly List _preferences = []; + private readonly List _primary = []; + private readonly List _secondary = []; + /// - /// Returns or sets the preferences area. + /// Returns the preferences area. /// - public List Preferences { get; protected set; } = new List(); + public IEnumerable Preferences => _preferences; /// - /// Returns or sets the primary area. + /// Returns the primary area. /// - public List Primary { get; protected set; } = new List(); + public IEnumerable Primary => _primary; /// - /// Returns or sets the secondary area. + /// Returns the secondary area. /// - public List Secondary { get; protected set; } = new List(); + public IEnumerable Secondary => _secondary; /// /// Initializes a new instance of the class. @@ -40,6 +44,60 @@ public ControlWebAppHeaderSettings(string id = null) Padding = new PropertySpacingPadding(PropertySpacing.Space.Null); } + /// + /// Adds items to the preferences area. + /// + /// The items to add to the preferences area. + public void AddPreferences(params IControlDropdownItem[] items) + { + _preferences.AddRange(items); + } + + /// + /// Removes an item from the preferences area. + /// + /// The item to remove from the preferences area. + public void RemovePreference(IControlDropdownItem item) + { + _preferences.Remove(item); + } + + /// + /// Adds items to the primary area. + /// + /// The items to add to the primary area. + public void AddPrimary(params IControlDropdownItem[] items) + { + _primary.AddRange(items); + } + + /// + /// Removes an item from the primary area. + /// + /// The item to remove from the primary area. + public void RemovePrimary(IControlDropdownItem item) + { + _primary.Remove(item); + } + + /// + /// Adds items to the secondary area. + /// + /// The items to add to the secondary area. + public void AddSecondary(params IControlDropdownItem[] items) + { + _secondary.AddRange(items); + } + + /// + /// Removes an item from the secondary area. + /// + /// The item to remove from the secondary area. + public void RemoveSecondary(IControlDropdownItem item) + { + _secondary.Remove(item); + } + /// /// Converts the control to an HTML representation. /// @@ -48,58 +106,75 @@ public ControlWebAppHeaderSettings(string id = null) /// An HTML node representing the rendered control. public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTreeControl visualTree) { - var preferences = WebEx.ComponentHub.FragmentManager.GetFragments + var items = GetItems(renderContext); + + var settingCtlr = items.Any() ? + new ControlDropdown(Id, [.. items]) + { + Icon = new PropertyIcon(TypeIcon.Cog), + AlignmentMenu = TypeAlignmentDropdownMenu.Right, + BackgroundColor = new PropertyColorButton(TypeColorButton.Dark), + Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.None, PropertySpacing.Space.None) + } : + null; + + return settingCtlr?.Render(renderContext, visualTree); + } + + /// + /// Retrieves the items to be displayed in the dropdown. + /// + /// The context in which the control is rendered. + /// A collection of dropdown items. + private IEnumerable GetItems(IRenderControlContext renderContext) + { + var preferences = Preferences.Union(WebEx.ComponentHub.FragmentManager.GetFragments ( renderContext?.PageContext?.ApplicationContext, renderContext?.PageContext?.Scopes - ); + )); - var primary = WebEx.ComponentHub.FragmentManager.GetFragments + var primary = Primary.Union(WebEx.ComponentHub.FragmentManager.GetFragments ( renderContext?.PageContext?.ApplicationContext, renderContext?.PageContext?.Scopes - ); + )); - var secondary = WebEx.ComponentHub.FragmentManager.GetFragments + var secondary = Secondary.Union(WebEx.ComponentHub.FragmentManager.GetFragments ( renderContext?.PageContext?.ApplicationContext, renderContext?.PageContext?.Scopes - ); + )); - var settingsList = new List + if (preferences.Any() || primary.Any() || secondary.Any()) { - new ControlDropdownItemHeader() { Text = I18N.Translate(renderContext.Request?.Culture, "webexpress.webapp:header.setting.label") } - }; - - var preferencesList = Preferences.Union(preferences).ToList(); - var primaryList = Primary.Union(primary).ToList(); - var secondaryList = Secondary.Union(secondary).ToList(); + yield return new ControlDropdownItemHeader(I18N.Translate(renderContext.Request, "webexpress.webapp:header.setting.label")); + } - settingsList.AddRange(preferencesList); - if (preferencesList.Count > 0 && primaryList.Count > 0) + foreach (var item in preferences) { - settingsList.Add(new ControlDropdownItemDivider()); + yield return item; } - settingsList.AddRange(primaryList); - if (primaryList.Count > 0 && secondaryList.Count > 0) + if (preferences.Any() && (primary.Any() || secondary.Any())) { - settingsList.Add(new ControlDropdownItemDivider()); + yield return new ControlDropdownItemDivider(); } - settingsList.AddRange(secondaryList); + foreach (var item in primary) + { + yield return item; + } - var settings = (settingsList.Count > 1) ? - new ControlDropdown(Id, settingsList.ToArray()) + if (primary.Any() && secondary.Any()) { - Icon = new PropertyIcon(TypeIcon.Cog), - AlignmentMenu = TypeAlignmentDropdownMenu.Right, - BackgroundColor = new PropertyColorButton(TypeColorButton.Dark), - Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.None, PropertySpacing.Space.None) - } : - null; + yield return new ControlDropdownItemDivider(); + } - return settings?.Render(renderContext, visualTree); + foreach (var item in secondary) + { + yield return item; + } } } } diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeadline.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeadline.cs index 2a7eef8..920ccdb 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeadline.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeadline.cs @@ -15,45 +15,43 @@ namespace WebExpress.WebApp.WebControl /// public class ControlWebAppHeadline : Control { - /// - /// Returns or sets the prologue area. - /// - public List Prologue { get; protected set; } = []; - - /// - /// Returns or sets the preferences area. - /// - public List Preferences { get; protected set; } = []; + private readonly List _prologue = []; + private readonly List _preferences = []; + private readonly List _primary = []; + private readonly List _secondary = []; + private readonly List _metadata = []; /// - /// Returns or sets the primary area. + /// Returns the prologue area. /// - public List Primary { get; protected set; } = []; + public IEnumerable Prologue => _prologue; /// - /// Returns or sets the secondary area. + /// Returns the preferences area. /// - public List Secondary { get; protected set; } = []; + public IEnumerable Preferences => _preferences; /// - /// Returns or sets the preferences area for the more control. + /// Returns the primary area. /// - public List MorePreferences { get; protected set; } = []; + public IEnumerable Primary => _primary; /// - /// Returns or sets the primary area for the more control. + /// Returns the secondary area. /// - public List MorePrimary { get; protected set; } = []; + public IEnumerable Secondary => _secondary; /// - /// Returns or sets the secondary area for the more control. + /// Returns the secondary area for the metadata. /// - public List MoreSecondary { get; protected set; } = []; + public IEnumerable Metadata => _metadata; /// - /// Returns or sets the secondary area for the metadata. + /// Returns the more control. /// - public List Metadata { get; protected set; } = []; + public ControlWebAppHeadlineMore More { get; } = new ControlWebAppHeadlineMore("webexpress-webapp-headline-more") + { + }; /// /// Initializes a new instance of the class. @@ -65,6 +63,96 @@ public ControlWebAppHeadline(string id = null) // BackgroundColor = LayoutSchema.HeadlineBackground; } + /// + /// Adds items to the prologue area. + /// + /// The items to add to the prologue area. + public void AddPrologue(params IControlToolbarItem[] items) + { + _prologue.AddRange(items); + } + + /// + /// Removes an item from the prologue area. + /// + /// The item to remove from the prologue area. + public void RemovePrologue(IControlToolbarItem item) + { + _prologue.Remove(item); + } + + /// + /// Adds items to the preferences area. + /// + /// The items to add to the preferences area. + public void AddPreferences(params IControlToolbarItem[] items) + { + _preferences.AddRange(items); + } + + /// + /// Removes an item from the preferences area. + /// + /// The item to remove from the preferences area. + public void RemovePreference(IControlToolbarItem item) + { + _preferences.Remove(item); + } + + /// + /// Adds items to the primary area. + /// + /// The items to add to the primary area. + public void AddPrimary(params IControlToolbarItem[] items) + { + _primary.AddRange(items); + } + + /// + /// Removes an item from the primary area. + /// + /// The item to remove from the primary area. + public void RemovePrimary(IControlToolbarItem item) + { + _primary.Remove(item); + } + + /// + /// Adds items to the secondary area. + /// + /// The items to add to the secondary area. + public void AddSecondary(params IControlToolbarItem[] items) + { + _secondary.AddRange(items); + } + + /// + /// Removes an item from the secondary area. + /// + /// The item to remove from the secondary area. + public void RemoveSecondary(IControlToolbarItem item) + { + _secondary.Remove(item); + } + + /// + /// Adds items to the metadata area. + /// + /// The items to add to the metadata area. + public void AddMetadata(params IControlToolbarItem[] items) + { + _metadata.AddRange(items); + } + + /// + /// Removes an item from the metadata area. + /// + /// The item to remove from the metadata area. + public void RemoveMetadata(IControlToolbarItem item) + { + _metadata.Remove(item); + } + /// /// Converts the control to an HTML representation. /// @@ -73,116 +161,88 @@ public ControlWebAppHeadline(string id = null) /// An HTML node representing the rendered control. public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTreeControl visualTree) { - var preferences = WebEx.ComponentHub.FragmentManager.GetFragments + var prologue = Prologue.Union(WebEx.ComponentHub.FragmentManager.GetFragments ( renderContext?.PageContext?.ApplicationContext, renderContext?.PageContext?.Scopes - ); + )); - var primary = WebEx.ComponentHub.FragmentManager.GetFragments + var preferences = Preferences.Union(WebEx.ComponentHub.FragmentManager.GetFragments ( renderContext?.PageContext?.ApplicationContext, renderContext?.PageContext?.Scopes - ); + )); - var secondary = WebEx.ComponentHub.FragmentManager.GetFragments + var primary = Primary.Union(WebEx.ComponentHub.FragmentManager.GetFragments ( renderContext?.PageContext?.ApplicationContext, renderContext?.PageContext?.Scopes - ); - - var preferencesList = Preferences.Union(preferences).ToList(); - var primaryList = Primary.Union(primary).ToList(); - var secondaryList = Secondary.Union(secondary).ToList(); - - var prologue = new ControlPanelFlexbox(null, Prologue.ToArray()) { Layout = TypeLayoutFlexbox.Default, Align = TypeAlignFlexbox.Center, Justify = TypeJustifiedFlexbox.Start }; - prologue.Add(new ControlText() - { - Text = I18N.Translate(renderContext.Request?.Culture, renderContext.PageContext?.PageTitle), - //TextColor = LayoutSchema.HeadlineTitle, - Format = TypeFormatText.H2, - Padding = new PropertySpacingPadding(PropertySpacing.Space.One), - Margin = new PropertySpacingMargin(PropertySpacing.Space.None, PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.Null) - }); - prologue.Add(Preferences); - - var epilog = new ControlPanelFlexbox(null, secondaryList.ToArray()) - { - Layout = TypeLayoutFlexbox.Default, - Align = TypeAlignFlexbox.Center, - Justify = TypeJustifiedFlexbox.End - }; - - if (MorePreferences.Count() > 0 || MorePrimary.Count() > 0 || MoreSecondary.Count() > 0) - { - var more = new ControlDropdown("more") - { - Text = I18N.Translate(renderContext.Request?.Culture, "webexpress.webapp:headline.more.title"), - Icon = new PropertyIcon(TypeIcon.EllipsisHorizontal), - //TextColor = LayoutSchema.HeadlineTitle, - Padding = new PropertySpacingPadding(PropertySpacing.Space.One), - Margin = new PropertySpacingMargin(PropertySpacing.Space.None, PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.Null) - }; - - foreach (var v in MorePreferences) - { - more.Add(v); - } - - if (MorePreferences.Count > 0 && (MorePrimary.Count > 0 || MoreSecondary.Count > 0)) - { - more.AddSeperator(); - } - - foreach (var v in MorePrimary) - { - more.Add(v); - } + )); - if (MorePrimary.Count() > 0 && MoreSecondary.Count > 0) - { - more.AddSeperator(); - } - - foreach (var v in MoreSecondary) - { - more.Add(v); - } - - epilog.Add(more); - } - - var content = new ControlPanelFlexbox + var secondary = Secondary.Union(WebEx.ComponentHub.FragmentManager.GetFragments ( - null, - prologue, - new ControlPanelFlexbox(null, primaryList.ToArray()) - { - Layout = TypeLayoutFlexbox.Default, - Align = TypeAlignFlexbox.Center, - Justify = TypeJustifiedFlexbox.End - }, - epilog - ) - { - Layout = TypeLayoutFlexbox.Default, - Align = TypeAlignFlexbox.Center, - Justify = TypeJustifiedFlexbox.Between - }; + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + )); - var metadata = new HtmlElementTextContentDiv + var metadata = Metadata.Union(WebEx.ComponentHub.FragmentManager.GetFragments ( - Metadata.Select(x => x.Render(renderContext, visualTree)).ToArray() - ) - { - Class = Css.Concatenate("ms-2 me-2 mb-3 text-secondary"), - Style = Style.Concatenate("font-size:0.75rem;") - }; + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + )); return new HtmlElementSectionHeader ( - content.Render(renderContext, visualTree), - Metadata.Count > 0 ? metadata : null + new ControlPanelFlexbox + ( + null, + prologue.Any() ? new ControlPanelFlexbox(null, [.. prologue]) + { + Layout = TypeLayoutFlexbox.Default, + Align = TypeAlignFlexbox.Center, + Justify = TypeJustifiedFlexbox.Start + } : null, + new ControlText() + { + Text = I18N.Translate(renderContext.Request?.Culture, renderContext.PageContext?.PageTitle), + //TextColor = LayoutSchema.HeadlineTitle, + Format = TypeFormatText.H2, + Padding = new PropertySpacingPadding(PropertySpacing.Space.One), + Margin = new PropertySpacingMargin(PropertySpacing.Space.None, PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.Null) + }, + preferences.Any() ? new ControlPanelFlexbox(null, [.. preferences]) + { + Layout = TypeLayoutFlexbox.Default, + Align = TypeAlignFlexbox.Center, + Justify = TypeJustifiedFlexbox.Start + } : null, + primary.Any() ? new ControlPanelFlexbox(null, [.. primary]) + { + Layout = TypeLayoutFlexbox.Default, + Align = TypeAlignFlexbox.Center, + Justify = TypeJustifiedFlexbox.Start + } : null, + secondary.Any() ? new ControlPanelFlexbox(null, [.. secondary]) + { + Layout = TypeLayoutFlexbox.Default, + Align = TypeAlignFlexbox.Center, + Justify = TypeJustifiedFlexbox.End + } : null, + More + ) + { + Layout = TypeLayoutFlexbox.Default, + Align = TypeAlignFlexbox.Center, + Justify = TypeJustifiedFlexbox.Between + }.Render(renderContext, visualTree), + metadata.Any() ? new HtmlElementTextContentDiv + ( + metadata.Select(x => x.Render(renderContext, visualTree)).ToArray() + ) + { + Class = Css.Concatenate("ms-2 me-2 mb-3 text-secondary"), + Style = Style.Concatenate("font-size:0.75rem;") + } : null ) { Id = Id, diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeadlineMore.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeadlineMore.cs new file mode 100644 index 0000000..4a71b6e --- /dev/null +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeadlineMore.cs @@ -0,0 +1,180 @@ +using System.Collections.Generic; +using System.Linq; +using WebExpress.WebApp.WebSection; +using WebExpress.WebCore; +using WebExpress.WebCore.Internationalization; +using WebExpress.WebCore.WebHtml; +using WebExpress.WebUI.WebControl; +using WebExpress.WebUI.WebFragment; +using WebExpress.WebUI.WebPage; + +namespace WebExpress.WebApp.WebControl +{ + /// + /// Represents a headline control with more options in the web application. + /// + public class ControlWebAppHeadlineMore : Control + { + private readonly List _preferences = []; + private readonly List _primary = []; + private readonly List _secondary = []; + + /// + /// Returns the preferences area. + /// + public IEnumerable Preferences => _preferences; + + /// + /// Returns the primary area. + /// + public IEnumerable Primary => _primary; + + /// + /// Returns the secondary area. + /// + public IEnumerable Secondary => _secondary; + + /// + /// Initializes a new instance of the class. + /// + /// The control id. + public ControlWebAppHeadlineMore(string id = null) + : base(id) + { + Padding = new PropertySpacingPadding(PropertySpacing.Space.Null); + } + + /// + /// Adds items to the preferences area. + /// + /// The items to add to the preferences area. + public void AddPreferences(params IControlDropdownItem[] items) + { + _preferences.AddRange(items); + } + + /// + /// Removes an item from the preferences area. + /// + /// The item to remove from the preferences area. + public void RemovePreference(IControlDropdownItem item) + { + _preferences.Remove(item); + } + + /// + /// Adds items to the primary area. + /// + /// The items to add to the primary area. + public void AddPrimary(params IControlDropdownItem[] items) + { + _primary.AddRange(items); + } + + /// + /// Removes an item from the primary area. + /// + /// The item to remove from the primary area. + public void RemovePrimary(IControlDropdownItem item) + { + _primary.Remove(item); + } + + /// + /// Adds items to the secondary area. + /// + /// The items to add to the secondary area. + public void AddSecondary(params IControlDropdownItem[] items) + { + _secondary.AddRange(items); + } + + /// + /// Removes an item from the secondary area. + /// + /// The item to remove from the secondary area. + public void RemoveSecondary(IControlDropdownItem item) + { + _secondary.Remove(item); + } + + /// + /// Converts the control to an HTML representation. + /// + /// The context in which the control is rendered. + /// The visual tree representing the control's structure. + /// An HTML node representing the rendered control. + public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTreeControl visualTree) + { + var items = GetItems(renderContext); + + var settingsCtlr = items.Any() ? + new ControlDropdown(Id, [.. items]) + { + Icon = new PropertyIcon(TypeIcon.EllipsisHorizontal), + AlignmentMenu = TypeAlignmentDropdownMenu.Right, + //BackgroundColor = new PropertyColorButton(TypeColorButton.Dark), + Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.None, PropertySpacing.Space.None) + } : + null; + + return settingsCtlr?.Render(renderContext, visualTree); + } + + /// + /// Retrieves the items to be displayed in the dropdown. + /// + /// The context in which the control is rendered. + /// A collection of dropdown items. + private IEnumerable GetItems(IRenderControlContext renderContext) + { + var preferences = Preferences.Union(WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + )); + + var primary = Primary.Union(WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + )); + + var secondary = Secondary.Union(WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + )); + + if (preferences.Any() && primary.Any() && secondary.Any()) + { + yield return new ControlDropdownItemHeader(I18N.Translate(renderContext.Request, "webexpress.webapp:headline.more.title")); + } + + foreach (var item in preferences) + { + yield return item; + } + + if (preferences.Any() && (primary.Any() || secondary.Any())) + { + yield return new ControlDropdownItemDivider(); + } + + foreach (var item in primary) + { + yield return item; + } + + if (primary.Any() && secondary.Any()) + { + yield return new ControlDropdownItemDivider(); + } + + foreach (var item in secondary) + { + yield return item; + } + } + } +} diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppMain.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppMain.cs new file mode 100644 index 0000000..d34338f --- /dev/null +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppMain.cs @@ -0,0 +1,164 @@ +using System.Collections.Generic; +using System.Linq; +using WebExpress.WebApp.WebSection; +using WebExpress.WebCore; +using WebExpress.WebCore.WebHtml; +using WebExpress.WebUI.WebControl; +using WebExpress.WebUI.WebFragment; +using WebExpress.WebUI.WebPage; + +namespace WebExpress.WebApp.WebControl +{ + /// + /// Represents the main control panel for the web application. + /// + public class ControlWebAppMain : Control + { + private readonly List _preferences = []; + private readonly List _primary = []; + private readonly List _secondary = []; + + /// + /// Returns the preferences area. + /// + public IEnumerable Preferences => _preferences; + + /// + /// Returns the primary area. + /// + public IEnumerable Primary => _primary; + + /// + /// Returns the secondary area. + /// + public IEnumerable Secondary => _secondary; + + /// + /// Returns the page properties. + /// + public ControlWebAppProperty Property { get; } = new ControlWebAppProperty("webexpress-webapp-content-property"); + + /// + /// Returns the headline control. + /// + public ControlWebAppHeadline Headline { get; } = new ControlWebAppHeadline("webexpress-webapp-content-main-headline"); + + /// + /// Initializes a new instance of the class. + /// + /// The control id. + public ControlWebAppMain(string id = null) + : base(id) + { + } + + /// + /// Adds items to the preferences area. + /// + /// The items to add to the preferences area. + public void AddPreferences(params IControl[] items) + { + _preferences.AddRange(items); + } + + /// + /// Removes an item from the preferences area. + /// + /// The item to remove from the preferences area. + public void RemovePreference(IControl item) + { + _preferences.Remove(item); + } + + /// + /// Adds items to the primary area. + /// + /// The items to add to the primary area. + public void AddPrimary(params IControl[] items) + { + _primary.AddRange(items); + } + + /// + /// Removes an item from the primary area. + /// + /// The item to remove from the primary area. + public void RemovePrimary(IControl item) + { + _primary.Remove(item); + } + + /// + /// Adds items to the secondary area. + /// + /// The items to add to the secondary area. + public void AddSecondary(params IControl[] items) + { + _secondary.AddRange(items); + } + + /// + /// Removes an item from the secondary area. + /// + /// The item to remove from the secondary area. + public void RemoveSecondary(IControl item) + { + _secondary.Remove(item); + } + + /// + /// Converts the control to an HTML representation. + /// + /// The context in which the control is rendered. + /// The visual tree representing the control's structure. + /// An HTML node representing the rendered control. + public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTreeControl visualTree) + { + var preferences = Preferences.Union(WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + )); + + var primary = Primary.Union(WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + )); + + var secondary = Secondary.Union(WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + )); + + var mainCtlr = new ControlPanelMain + ( + Id, + new ControlPanel + ( + null, + new ControlPanel + ( + null, + Headline, + new ControlPanel(null, [.. preferences]), + new ControlPanel(null, [.. primary]), + new ControlPanel(null, [.. secondary]) + ) + { + }, + Property + ) + { + } + ) + { + BackgroundColor = BackgroundColor, + Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.None, PropertySpacing.Space.None) + }; + + return mainCtlr?.Render(renderContext, visualTree); + } + } +} diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppProperty.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppProperty.cs index ed682a3..3d96204 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppProperty.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppProperty.cs @@ -10,24 +10,28 @@ namespace WebExpress.WebApp.WebControl { /// - /// Properties for a web app. + /// Represents a control for managing web application properties, including preferences, primary, and secondary areas. /// public class ControlWebAppProperty : Control { + private readonly List _preferences = []; + private readonly List _primary = []; + private readonly List _secondary = []; + /// - /// Returns or sets the preferences area. + /// Returns the preferences area. /// - public List Preferences { get; protected set; } = []; + public IEnumerable Preferences => _preferences; /// - /// Returns or sets the primary area. + /// Returns the primary area. /// - public List Primary { get; protected set; } = []; + public IEnumerable Primary => _primary; /// - /// Returns or sets the secondary area. + /// Returns the secondary area. /// - public List Secondary { get; protected set; } = []; + public IEnumerable Secondary => _secondary; /// /// Initializes a new instance of the class. @@ -39,6 +43,60 @@ public ControlWebAppProperty(string id = null) //BackgroundColor = LayoutSchema.PropertyBackground; } + /// + /// Adds items to the preferences area. + /// + /// The items to add to the preferences area. + public void AddPreferences(params IControl[] items) + { + _preferences.AddRange(items); + } + + /// + /// Removes an item from the preferences area. + /// + /// The item to remove from the preferences area. + public void RemovePreference(IControl item) + { + _preferences.Remove(item); + } + + /// + /// Adds items to the primary area. + /// + /// The items to add to the primary area. + public void AddPrimary(params IControl[] items) + { + _primary.AddRange(items); + } + + /// + /// Removes an item from the primary area. + /// + /// The item to remove from the primary area. + public void RemovePrimary(IControl item) + { + _primary.Remove(item); + } + + /// + /// Adds items to the secondary area. + /// + /// The items to add to the secondary area. + public void AddSecondary(params IControl[] items) + { + _secondary.AddRange(items); + } + + /// + /// Removes an item from the secondary area. + /// + /// The item to remove from the secondary area. + public void RemoveSecondary(IControl item) + { + _secondary.Remove(item); + } + /// /// Converts the control to an HTML representation. /// @@ -47,44 +105,45 @@ public ControlWebAppProperty(string id = null) /// An HTML node representing the rendered control. public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTreeControl visualTree) { - var preferences = WebEx.ComponentHub.FragmentManager.GetFragments + var preferences = Preferences.Union(WebEx.ComponentHub.FragmentManager.GetFragments ( renderContext?.PageContext?.ApplicationContext, renderContext?.PageContext?.Scopes - ); + )); - var primary = WebEx.ComponentHub.FragmentManager.GetFragments + var primary = Primary.Union(WebEx.ComponentHub.FragmentManager.GetFragments ( renderContext?.PageContext?.ApplicationContext, renderContext?.PageContext?.Scopes - ); + )); - var secondary = WebEx.ComponentHub.FragmentManager.GetFragments + var secondary = Secondary.Union(WebEx.ComponentHub.FragmentManager.GetFragments ( renderContext?.PageContext?.ApplicationContext, renderContext?.PageContext?.Scopes - ); + )); - var preferencesList = Preferences.Union(preferences).ToList(); - var primaryList = Primary.Union(primary).ToList(); - var secondaryList = Secondary.Union(secondary).ToList(); - - if (Preferences.Count == 0 && Primary.Count == 0 && Secondary.Count == 0) + if (!preferences.Any() && !primary.Any() && !secondary.Any()) { return null; } - var preferencesCtrl = new HtmlElementTextContentDiv(preferencesList.Select(x => x.Render(renderContext, visualTree)).ToArray()); - var primaryCtrl = new HtmlElementTextContentDiv(primaryList.Select(x => x.Render(renderContext, visualTree)).ToArray()); - var secondaryCtrl = new HtmlElementTextContentDiv(secondaryList.Select(x => x.Render(renderContext, visualTree)).ToArray()); - - return new HtmlElementTextContentDiv(preferencesCtrl, primaryCtrl, secondaryCtrl) + var propertyCtlr = (preferences.Any() || primary.Any() || secondary.Any()) ? + new ControlPanelFlexbox + ( + Id, + new ControlPanel(null, [.. preferences]), + new ControlPanel(null, [.. primary]), + new ControlPanel(null, [.. secondary]) + ) { - Id = Id, - Class = Css.Concatenate("proterty", GetClasses()), - Style = GetStyles(), - Role = Role - }; + Classes = ["proterty"], + //BackgroundColor = new PropertyColorButton(TypeColorButton.Dark), + Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.None, PropertySpacing.Space.None) + } : + null; + + return propertyCtlr?.Render(renderContext, visualTree); } } } diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppSidebar.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppSidebar.cs index 200efab..090613e 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppSidebar.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppSidebar.cs @@ -2,7 +2,6 @@ using System.Linq; using WebExpress.WebApp.WebSection; using WebExpress.WebCore; -using WebExpress.WebCore.Internationalization; using WebExpress.WebCore.WebHtml; using WebExpress.WebUI.WebControl; using WebExpress.WebUI.WebFragment; @@ -11,29 +10,34 @@ namespace WebExpress.WebApp.WebControl { /// - /// Sidebar for a web app. + /// Represents a sidebar control for the web application. /// public class ControlWebAppSidebar : Control { + private readonly List _header = []; + private readonly List _preferences = []; + private readonly List _primary = []; + private readonly List _secondary = []; + /// - /// Returns or sets the header area. + /// Returns the header area. /// - public List Header { get; protected set; } = []; + public IEnumerable Header => _header; /// - /// Returns or sets the preferences area. + /// Returns the preferences area. /// - public List Preferences { get; protected set; } = []; + public IEnumerable Preferences => _preferences; /// - /// Returns or sets the primary area. + /// Returns the primary area. /// - public List Primary { get; protected set; } = []; + public IEnumerable Primary => _primary; /// - /// Returns or sets the secondary area. + /// Returns the secondary area. /// - public List Secondary { get; protected set; } = []; + public IEnumerable Secondary => _secondary; /// /// Initializes a new instance of the class. @@ -44,6 +48,78 @@ public ControlWebAppSidebar(string id = null) { } + /// + /// Adds items to the header area. + /// + /// The items to add to the header area. + public void AddHeader(params IControlToolbarItem[] items) + { + _header.AddRange(items); + } + + /// + /// Removes an item from the header area. + /// + /// The item to remove from the header area. + public void RemoveHeader(IControlToolbarItem item) + { + _header.Remove(item); + } + + /// + /// Adds items to the preferences area. + /// + /// The items to add to the preferences area. + public void AddPreferences(params IControlToolbarItem[] items) + { + _preferences.AddRange(items); + } + + /// + /// Removes an item from the preferences area. + /// + /// The item to remove from the preferences area. + public void RemovePreference(IControlToolbarItem item) + { + _preferences.Remove(item); + } + + /// + /// Adds items to the primary area. + /// + /// The items to add to the primary area. + public void AddPrimary(params IControlToolbarItem[] items) + { + _primary.AddRange(items); + } + + /// + /// Removes an item from the primary area. + /// + /// The item to remove from the primary area. + public void RemovePrimary(IControlToolbarItem item) + { + _primary.Remove(item); + } + + /// + /// Adds items to the secondary area. + /// + /// The items to add to the secondary area. + public void AddSecondary(params IControlToolbarItem[] items) + { + _secondary.AddRange(items); + } + + /// + /// Removes an item from the secondary area. + /// + /// The item to remove from the secondary area. + public void RemoveSecondary(IControlToolbarItem item) + { + _secondary.Remove(item); + } + /// /// Converts the control to an HTML representation. /// @@ -52,58 +128,70 @@ public ControlWebAppSidebar(string id = null) /// An HTML node representing the rendered control. public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTreeControl visualTree) { - var header = WebEx.ComponentHub.FragmentManager.GetFragments + var items = GetItems(renderContext); + + var sidebarCtlr = items.Any() ? + new ControlPanelFlexbox(Id, [.. items]) + { + Classes = ["sidebar"], + //BackgroundColor = new PropertyColorButton(TypeColorButton.Dark), + Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.None, PropertySpacing.Space.None) + } : + null; + + return sidebarCtlr?.Render(renderContext, visualTree); + } + + /// + /// Retrieves the items to be displayed in the control. + /// + /// The context in which the control is rendered. + /// A collection of dropdown items. + private IEnumerable GetItems(IRenderControlContext renderContext) + { + var header = Header.Union(WebEx.ComponentHub.FragmentManager.GetFragments ( renderContext?.PageContext?.ApplicationContext, renderContext?.PageContext?.Scopes - ); + )); - var preferences = WebEx.ComponentHub.FragmentManager.GetFragments + var preferences = Preferences.Union(WebEx.ComponentHub.FragmentManager.GetFragments ( renderContext?.PageContext?.ApplicationContext, renderContext?.PageContext?.Scopes - ); + )); - var primary = WebEx.ComponentHub.FragmentManager.GetFragments + var primary = Primary.Union(WebEx.ComponentHub.FragmentManager.GetFragments ( renderContext?.PageContext?.ApplicationContext, renderContext?.PageContext?.Scopes - ); + )); - var secondary = WebEx.ComponentHub.FragmentManager.GetFragments + var secondary = Secondary.Union(WebEx.ComponentHub.FragmentManager.GetFragments ( renderContext?.PageContext?.ApplicationContext, renderContext?.PageContext?.Scopes - ); + )); - var settingsList = new List + foreach (var item in header) { - new ControlDropdownItemHeader() { Text = I18N.Translate(renderContext.Request?.Culture, "webexpress.webapp:header.setting.label") } - }; - - var headerList = Header.Union(header).ToList(); - var preferencesList = Preferences.Union(preferences).ToList(); - var primaryList = Primary.Union(primary).ToList(); - var secondaryList = Secondary.Union(secondary).ToList(); + yield return item; + } - if (!(headerList.Any() || preferencesList.Any() || primaryList.Any() || secondaryList.Any())) + foreach (var item in preferences) { - return null; + yield return item; } - var elements = new List(); - elements.AddRange(headerList.Select(x => x.Render(renderContext, visualTree))); - elements.AddRange(preferencesList.Select(x => x.Render(renderContext, visualTree))); - elements.AddRange(primaryList.Select(x => x.Render(renderContext, visualTree))); - elements.AddRange(secondaryList.Select(x => x.Render(renderContext, visualTree))); + foreach (var item in primary) + { + yield return item; + } - return new HtmlElementTextContentDiv(elements.ToArray()) + foreach (var item in secondary) { - Id = Id, - Class = Css.Concatenate("sidebar", GetClasses()), - Style = Style.Concatenate("display: block;", GetStyles()), - Role = Role - }; + yield return item; + } } } } diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppToolbar.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppToolbar.cs new file mode 100644 index 0000000..993d1e7 --- /dev/null +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppToolbar.cs @@ -0,0 +1,174 @@ +using System.Collections.Generic; +using System.Linq; +using WebExpress.WebApp.WebSection; +using WebExpress.WebCore; +using WebExpress.WebCore.WebHtml; +using WebExpress.WebUI.WebControl; +using WebExpress.WebUI.WebFragment; +using WebExpress.WebUI.WebPage; + +namespace WebExpress.WebApp.WebControl +{ + /// + /// Represents a toolbar control for a web application. + /// + public class ControlWebAppToolbar : ControlToolbar + { + private readonly List _preferences = []; + private readonly List _primary = []; + private readonly List _secondary = []; + + /// + /// Returns the preferences area. + /// + public IEnumerable Preferences => _preferences; + + /// + /// Returns the primary area. + /// + public IEnumerable Primary => _primary; + + /// + /// Returns the secondary area. + /// + public IEnumerable Secondary => _secondary; + + /// + /// Returns the quick create. + /// + public ControlWebAppToolbarMore More { get; } = new ControlWebAppToolbarMore("webexpress-webapp-toolbar-more") + { + }; + + /// + /// Initializes a new instance of the class. + /// + /// The control id. + public ControlWebAppToolbar(string id = null) + : base(id) + { + Padding = new PropertySpacingPadding(PropertySpacing.Space.Null); + //BackgroundColor = LayoutSchema.HeaderBackground; + } + + /// + /// Adds items to the preferences area. + /// + /// The items to add to the preferences area. + public void AddPreferences(params IControlToolbarItem[] items) + { + _preferences.AddRange(items); + } + + /// + /// Removes an item from the preferences area. + /// + /// The item to remove from the preferences area. + public void RemovePreference(IControlToolbarItem item) + { + _preferences.Remove(item); + } + + /// + /// Adds items to the primary area. + /// + /// The items to add to the primary area. + public void AddPrimary(params IControlToolbarItem[] items) + { + _primary.AddRange(items); + } + + /// + /// Removes an item from the primary area. + /// + /// The item to remove from the primary area. + public void RemovePrimary(IControlToolbarItem item) + { + _primary.Remove(item); + } + + /// + /// Adds items to the secondary area. + /// + /// The items to add to the secondary area. + public void AddSecondary(params IControlToolbarItem[] items) + { + _secondary.AddRange(items); + } + + /// + /// Removes an item from the secondary area. + /// + /// The item to remove from the secondary area. + public void RemoveSecondary(IControlToolbarItem item) + { + _secondary.Remove(item); + } + + /// + /// Converts the control to an HTML representation. + /// + /// The context in which the control is rendered. + /// The visual tree representing the control's structure. + /// An HTML node representing the rendered control. + public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTreeControl visualTree) + { + var items = GetItems(renderContext); + + Enable = items.Any(); + + return base.Render(renderContext, visualTree, items); + } + + /// + /// Retrieves the toolbar items from the preferences, primary, and secondary areas. + /// + /// The context in which the control is rendered. + /// A list of toolbar items. + private IEnumerable GetItems(IRenderControlContext renderContext) + { + var preferences = Preferences.Union(WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ).Cast()); + + var primary = Primary.Union(WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ).Union(Items).Cast()); + + var secondary = Secondary.Union(WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ).Cast()); + + foreach (var item in preferences) + { + yield return item; + } + + if (preferences.Any() && (primary.Any() || secondary.Any())) + { + yield return new ControlToolbarItemDivider(); + } + + foreach (var item in primary) + { + yield return item; + } + + if (primary.Any() && secondary.Any()) + { + yield return new ControlToolbarItemDivider(); + } + + foreach (var item in secondary) + { + yield return item; + } + } + } +} diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppToolbarMore.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppToolbarMore.cs new file mode 100644 index 0000000..9f1b064 --- /dev/null +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppToolbarMore.cs @@ -0,0 +1,177 @@ +using System.Collections.Generic; +using System.Linq; +using WebExpress.WebApp.WebSection; +using WebExpress.WebCore; +using WebExpress.WebCore.Internationalization; +using WebExpress.WebCore.WebHtml; +using WebExpress.WebUI.WebControl; +using WebExpress.WebUI.WebFragment; +using WebExpress.WebUI.WebPage; + +namespace WebExpress.WebApp.WebControl +{ + /// + /// Represents a toolbar control with more options in the web application. + /// + public class ControlWebAppToolbarMore : Control + { + private readonly List _preferences = []; + private readonly List _primary = []; + private readonly List _secondary = []; + + /// + /// Returns the preferences area. + /// + public IEnumerable Preferences => _preferences; + + /// + /// Returns the primary area. + /// + public IEnumerable Primary => _primary; + + /// + /// Returns the secondary area. + /// + public IEnumerable Secondary => _secondary; + + /// + /// Initializes a new instance of the class. + /// + /// The control id. + public ControlWebAppToolbarMore(string id = null) + : base(id) + { + Padding = new PropertySpacingPadding(PropertySpacing.Space.Null); + } + + /// + /// Adds items to the preferences area. + /// + /// The items to add to the preferences area. + public void AddPreferences(params IControlDropdownItem[] items) + { + _preferences.AddRange(items); + } + + /// + /// Removes an item from the preferences area. + /// + /// The item to remove from the preferences area. + public void RemovePreference(IControlDropdownItem item) + { + _preferences.Remove(item); + } + + /// + /// Adds items to the primary area. + /// + /// The items to add to the primary area. + public void AddPrimary(params IControlDropdownItem[] items) + { + _primary.AddRange(items); + } + + /// + /// Removes an item from the primary area. + /// + /// The item to remove from the primary area. + public void RemovePrimary(IControlDropdownItem item) + { + _primary.Remove(item); + } + + /// + /// Adds items to the secondary area. + /// + /// The items to add to the secondary area. + public void AddSecondary(params IControlDropdownItem[] items) + { + _secondary.AddRange(items); + } + + /// + /// Removes an item from the secondary area. + /// + /// The item to remove from the secondary area. + public void RemoveSecondary(IControlDropdownItem item) + { + _secondary.Remove(item); + } + + /// + /// Converts the control to an HTML representation. + /// + /// The context in which the control is rendered. + /// The visual tree representing the control's structure. + /// An HTML node representing the rendered control. + public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTreeControl visualTree) + { + var items = GetItems(renderContext); + + var settingsCtlr = items.Any() ? + new ControlDropdown(Id, [.. items]) + { + Icon = new PropertyIcon(TypeIcon.EllipsisHorizontal), + AlignmentMenu = TypeAlignmentDropdownMenu.Right, + //BackgroundColor = new PropertyColorButton(TypeColorButton.Dark), + Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.None, PropertySpacing.Space.None) + } : + null; + + return settingsCtlr?.Render(renderContext, visualTree); + } + + /// + /// Retrieves the items to be displayed in the dropdown. + /// + /// The context in which the control is rendered. + /// A collection of dropdown items. + private IEnumerable GetItems(IRenderControlContext renderContext) + { + var preferences = Preferences.Union(WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + )); + + var primary = Primary.Union(WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + )); + + var secondary = Secondary.Union(WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + )); + + yield return new ControlDropdownItemHeader(I18N.Translate(renderContext.Request, "webexpress.webapp:toolbar.more.title")); + + foreach (var item in preferences) + { + yield return item; + } + + if (preferences.Any() && (primary.Any() || secondary.Any())) + { + yield return new ControlDropdownItemDivider(); + } + + foreach (var item in primary) + { + yield return item; + } + + if (primary.Any() && secondary.Any()) + { + yield return new ControlDropdownItemDivider(); + } + + foreach (var item in secondary) + { + yield return item; + } + } + } +} diff --git a/src/WebExpress.WebApp/WebPage/VisualTreeWebApp.cs b/src/WebExpress.WebApp/WebPage/VisualTreeWebApp.cs index 6648aed..10e0be0 100644 --- a/src/WebExpress.WebApp/WebPage/VisualTreeWebApp.cs +++ b/src/WebExpress.WebApp/WebPage/VisualTreeWebApp.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using WebExpress.WebApp.WebApiControl; using WebExpress.WebApp.WebControl; using WebExpress.WebCore.Internationalization; using WebExpress.WebCore.WebComponent; @@ -19,22 +20,22 @@ public class VisualTreeWebApp : VisualTreeControl /// /// Returns header control. /// - public ControlWebAppHeader Header { get; } = new ControlWebAppHeader("webexpress.webapp.header"); + public ControlWebAppHeader Header { get; } = new ControlWebAppHeader("webexpress-webapp-header"); /// /// Returns the area for the toast messages control. /// - public ControlPanelToast Toast { get; protected set; } = new ControlPanelToast("webexpress.webapp.toast"); + public ControlPanelToast Toast { get; protected set; } = new ControlPanelToast("webexpress-webapp-toast"); /// /// Returns the range for the path specification. /// - public ControlBreadcrumb Breadcrumb { get; protected set; } = new ControlBreadcrumb("webexpress.webapp.breadcrumb"); + public ControlBreadcrumb Breadcrumb { get; protected set; } = new ControlBreadcrumb("webexpress-webapp-breadcrumb"); /// /// Returns the area for prologue. /// - public ControlPanel Prologue { get; protected set; } = new ControlPanel("webexpress.webapp.prologue"); + public ControlPanel Prologue { get; protected set; } = new ControlPanel("webexpress-webapp-prologue"); ///// ///// Returns the range for the search options control. @@ -44,18 +45,23 @@ public class VisualTreeWebApp : VisualTreeControl /// /// Returns the sidebar control. /// - public ControlWebAppSidebar Sidebar { get; protected set; } = new ControlWebAppSidebar("webexpress.webapp.sidebar"); + public ControlWebAppSidebar Sidebar { get; protected set; } = new ControlWebAppSidebar("webexpress-webapp-sidebar"); /// /// Returns the content control. /// - public new ControlWebAppContent Content { get; protected set; } = new ControlWebAppContent("webexpress.webapp.content"); + public new ControlWebAppContent Content { get; protected set; } = new ControlWebAppContent("webexpress-webapp-content"); /// /// Returns the footer control. /// - public ControlWebAppFooter Footer { get; protected set; } = new ControlWebAppFooter("webexpress.webapp.footer"); + public ControlWebAppFooter Footer { get; protected set; } = new ControlWebAppFooter("webexpress-webapp-footer"); + + /// + /// Returns the control for displaying notification popups via API. + /// + public ControlApiNotificationPopup NotificationPopup { get; protected set; } = new ControlApiNotificationPopup("webexpress-webapp-notificationpopup"); /// /// Initializes a new instance of the class. @@ -117,8 +123,25 @@ public override IHtmlNode Render(IVisualTreeContext context) html.Body.Add(Toast.Render(renderContext, this)); html.Body.Add(Breadcrumb.Render(renderContext, this)); html.Body.Add(Prologue.Render(renderContext, this)); - html.Body.Add(Content.Render(renderContext, this)); + + var split = new ControlPanelSplit + ( + "webexpress-webapp-split", + [Sidebar], + [Content] + ) + { + Border = new PropertyBorder(true), + Orientation = TypeOrientationSplit.Horizontal, + //SplitterColor = LayoutSchema.SplitterColor, + Panel1InitialSize = 20, + Panel1MinSize = 150, + Styles = ["min-height: 85%;"] + }; + + html.Body.Add(split.Render(renderContext, this)); html.Body.Add(Footer.Render(renderContext, this)); + html.Body.Add(NotificationPopup.Render(renderContext, this)); html.Body.Scripts = [.. Scripts.Values]; diff --git a/src/WebExpress.WebApp/WebSection/SectionAppNotificationPreferences.cs b/src/WebExpress.WebApp/WebSection/SectionAppNotificationPreferences.cs new file mode 100644 index 0000000..7e5d53c --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionAppNotificationPreferences.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section app.notification.preferences. + /// + public class SectionAppNotificationPreferences : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionAppNotificationPrimary.cs b/src/WebExpress.WebApp/WebSection/SectionAppNotificationPrimary.cs new file mode 100644 index 0000000..10403fa --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionAppNotificationPrimary.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section app.notification.primary. + /// + public class SectionAppNotificationPrimary : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionAppNotificationSecondary.cs b/src/WebExpress.WebApp/WebSection/SectionAppNotificationSecondary.cs new file mode 100644 index 0000000..475135e --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionAppNotificationSecondary.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section app.notification.secondary. + /// + public class SectionAppNotificationSecondary : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionHeadlineMetadata.cs b/src/WebExpress.WebApp/WebSection/SectionHeadlineMetadata.cs new file mode 100644 index 0000000..26c73cf --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionHeadlineMetadata.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section headline.metadata. + /// + public class SectionHeadlineMetadata : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionHeadlineMorePreferences.cs b/src/WebExpress.WebApp/WebSection/SectionHeadlineMorePreferences.cs new file mode 100644 index 0000000..0b8fd65 --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionHeadlineMorePreferences.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section headline.more.preferences. + /// + public class SectionHeadlineMorePreferences : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionHeadlineMorePrimary.cs b/src/WebExpress.WebApp/WebSection/SectionHeadlineMorePrimary.cs new file mode 100644 index 0000000..5adda8c --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionHeadlineMorePrimary.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section headline.more.primary. + /// + public class SectionHeadlineMorePrimary : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionHeadlineMoreSecondary.cs b/src/WebExpress.WebApp/WebSection/SectionHeadlineMoreSecondary.cs new file mode 100644 index 0000000..0dd0410 --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionHeadlineMoreSecondary.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section headline.more.secondary. + /// + public class SectionHeadlineMoreSecondary : ISection + { + } +} From 8146a2f053774f3e73c2535e839c2cbe13080f9b Mon Sep 17 00:00:00 2001 From: Rene Schwarzer Date: Sun, 9 Mar 2025 10:11:59 +0100 Subject: [PATCH 20/30] feat: improved layout and design of settings pages --- src/WebExpress.WebApp/Internationalization/de | 7 +- src/WebExpress.WebApp/Internationalization/en | 7 +- .../WebControl/ControlWebAppSettingMenu.cs | 140 ++++++++++++++ .../WebControl/ControlWebAppSettingTab.cs | 181 ++++++++++++++++++ .../WebControl/ControlWebAppSidebar.cs | 44 ++--- .../SectionSettingTabPreferences.cs | 11 ++ .../WebSection/SectionSettingTabPrimary.cs | 11 ++ .../WebSection/SectionSettingTabSecondary.cs | 11 ++ .../WebSettingPage/SettingCategoryGeneral.cs | 18 ++ .../WebSettingPage/SettingCategoryGroup.cs | 19 ++ .../WebSettingPage/VisualTreeWebAppSetting.cs | 91 +++++++++ 11 files changed, 510 insertions(+), 30 deletions(-) create mode 100644 src/WebExpress.WebApp/WebControl/ControlWebAppSettingMenu.cs create mode 100644 src/WebExpress.WebApp/WebControl/ControlWebAppSettingTab.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionSettingTabPreferences.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionSettingTabPrimary.cs create mode 100644 src/WebExpress.WebApp/WebSection/SectionSettingTabSecondary.cs create mode 100644 src/WebExpress.WebApp/WebSettingPage/SettingCategoryGeneral.cs create mode 100644 src/WebExpress.WebApp/WebSettingPage/SettingCategoryGroup.cs create mode 100644 src/WebExpress.WebApp/WebSettingPage/VisualTreeWebAppSetting.cs diff --git a/src/WebExpress.WebApp/Internationalization/de b/src/WebExpress.WebApp/Internationalization/de index 838ae79..91bf835 100644 --- a/src/WebExpress.WebApp/Internationalization/de +++ b/src/WebExpress.WebApp/Internationalization/de @@ -66,10 +66,13 @@ setting.systeminformation.reboot.label=Neustart setting.systeminformation.reboot.header=Neustart setting.systeminformation.reboot.description=Starten Sie den Server neu. Achtung! Der Server ist in der Zeit nicht erreichbar und kann keine Anfragen entgegennehmen. -setting.tab.general.label=Allgemein +setting.category.general.name=Allgemeine Einstellungen +setting.category.general.description=Allgemeine Einstellungen für die Webanwendung. +setting.group.general.name=Allgemein +setting.group.general.description=Allgemeine Einstellungen für die Webanwendung. +setting.tab.general.label=Allgemein setting.group.system.label=System - setting.titel.plugin.label=Plugins setting.titel.systeminformation.label=Systeminformationen setting.titel.log.label=Log diff --git a/src/WebExpress.WebApp/Internationalization/en b/src/WebExpress.WebApp/Internationalization/en index 3f29143..f37ce86 100644 --- a/src/WebExpress.WebApp/Internationalization/en +++ b/src/WebExpress.WebApp/Internationalization/en @@ -81,10 +81,13 @@ setting.logfile.switchon.header=Enable logging setting.logfile.switchon.description=Activation is only valid until the next restart. To enable it permanently, change the settings in the configuration file. setting.logfile.switchon.success=Logging has been enabled. -setting.tab.general.label=General +setting.category.general.name=General settings +setting.category.general.description=General settings for the web application. +setting.group.general.name=General +setting.group.general.description=General settings for the web application. +setting.tab.general.label=General setting.group.system.label=System - setting.titel.plugin.label=Plugins setting.titel.systeminformation.label=System information setting.titel.log.label=Log diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppSettingMenu.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppSettingMenu.cs new file mode 100644 index 0000000..a0240c5 --- /dev/null +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppSettingMenu.cs @@ -0,0 +1,140 @@ +using System.Collections.Generic; +using System.Linq; +using WebExpress.WebApp.WebSection; +using WebExpress.WebCore; +using WebExpress.WebCore.Internationalization; +using WebExpress.WebCore.WebSettingPage; +using WebExpress.WebUI.WebControl; +using WebExpress.WebUI.WebFragment; +using WebExpress.WebUI.WebPage; + +namespace WebExpress.WebApp.WebControl +{ + /// + /// Represents a control for the settings menu in the web application. + /// + public class ControlWebAppSettingMenu : ControlWebAppSidebar + { + /// + /// Initializes a new instance of the class. + /// + /// The control id. + public ControlWebAppSettingMenu(string id = null) + : base(id) + { + } + + /// + /// Retrieves the items to be displayed in the control. + /// + /// The context in which the control is rendered. + /// A collection of dropdown items. + protected override IEnumerable GetItems(IRenderControlContext renderContext) + { + var settinPageManager = WebEx.ComponentHub.SettingPageManager; + var appicationContext = renderContext.PageContext?.ApplicationContext; + var settingPageContext = renderContext.PageContext as ISettingPageContext; + var currentCategory = settingPageContext?.SettingGroup?.SettingCategory; + var groups = settinPageManager.GetSettingGroups(renderContext.PageContext?.ApplicationContext, currentCategory); + var controls = new List(); + + foreach (var group in groups.OrderBy(x => x)) + { + var settingPages = settinPageManager.GetSettingPages(appicationContext, group); + var listCtrl = new ControlList(null) { Layout = TypeLayoutList.Flush }; + + controls.Add(new ControlText() { Text = group?.Name }); + controls.Add(listCtrl); + + foreach (var page in settingPages + .Where(x => x.Section == WebCore.WebSettingPage.Model.SettingSection.Preferences) + .OrderBy(x => I18N.Translate(renderContext, x.PageTitle))) + { + if (!page.Hide && (!page.Conditions.Any() || page.Conditions.All(x => x.Fulfillment(renderContext.Request)))) + { + listCtrl.Add(new ControlListItemLink() + { + Text = page.PageTitle, + Icon = new PropertyIcon(page.Icon), + Uri = page?.Uri, + Active = page == renderContext.PageContext ? TypeActive.Active : TypeActive.None + }); + } + } + + foreach (var page in settingPages + .Where(x => x.Section == WebCore.WebSettingPage.Model.SettingSection.Primary) + .OrderBy(x => I18N.Translate(renderContext, x.PageTitle))) + { + if (!page.Hide && (!page.Conditions.Any() || page.Conditions.All(x => x.Fulfillment(renderContext.Request)))) + { + listCtrl.Add(new ControlListItemLink() + { + Text = page.PageTitle, + Icon = new PropertyIcon(page.Icon), + Uri = page?.Uri, + Active = page == renderContext.PageContext ? TypeActive.Active : TypeActive.None + }); + } + } + + foreach (var page in settingPages + .Where(x => x.Section == WebCore.WebSettingPage.Model.SettingSection.Secondary) + .OrderBy(x => I18N.Translate(renderContext, x.PageTitle))) + { + if (!page.Hide && (!page.Conditions.Any() || page.Conditions.All(x => x.Fulfillment(renderContext.Request)))) + { + listCtrl.Add(new ControlListItemLink() + { + Text = page.PageTitle, + Icon = new PropertyIcon(page.Icon), + Uri = page?.Uri, + Active = page == renderContext.PageContext ? TypeActive.Active : TypeActive.None + }); + } + } + } + + foreach (var item in Header.Union(WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ))) + { + yield return item; + } + + foreach (var item in Preferences.Union(WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ))) + { + yield return item; + } + + foreach (var control in controls) + { + yield return control; + } + + foreach (var item in Primary.Union(WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ))) + { + yield return item; + } + + foreach (var item in Secondary.Union(WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ))) + { + yield return item; + } + } + } +} diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppSettingTab.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppSettingTab.cs new file mode 100644 index 0000000..2f376f4 --- /dev/null +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppSettingTab.cs @@ -0,0 +1,181 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using WebExpress.WebApp.WebSection; +using WebExpress.WebCore; +using WebExpress.WebCore.Internationalization; +using WebExpress.WebCore.WebHtml; +using WebExpress.WebCore.WebSettingPage; +using WebExpress.WebUI.WebControl; +using WebExpress.WebUI.WebFragment; +using WebExpress.WebUI.WebPage; + +namespace WebExpress.WebApp.WebControl +{ + /// + /// Represents a settings tab control in the web application. + /// + public class ControlWebAppSettingTab : Control + { + private readonly List _preferences = []; + private readonly List _primary = []; + private readonly List _secondary = []; + + /// + /// Returns the preferences area. + /// + public IEnumerable Preferences => _preferences; + + /// + /// Returns the primary area. + /// + public IEnumerable Primary => _primary; + + /// + /// Returns the secondary area. + /// + public IEnumerable Secondary => _secondary; + + /// + /// Initializes a new instance of the class. + /// + /// The control id. + public ControlWebAppSettingTab(string id = null) + : base(id) + { + Padding = new PropertySpacingPadding(PropertySpacing.Space.Null); + //BackgroundColor = LayoutSchema.HeaderBackground; + } + + /// + /// Adds items to the preferences area. + /// + /// The items to add to the preferences area. + public void AddPreferences(params IControlNavigationItem[] items) + { + _preferences.AddRange(items); + } + + /// + /// Removes an item from the preferences area. + /// + /// The item to remove from the preferences area. + public void RemovePreference(IControlNavigationItem item) + { + _preferences.Remove(item); + } + + /// + /// Adds items to the primary area. + /// + /// The items to add to the primary area. + public void AddPrimary(params IControlNavigationItem[] items) + { + _primary.AddRange(items); + } + + /// + /// Removes an item from the primary area. + /// + /// The item to remove from the primary area. + public void RemovePrimary(IControlNavigationItem item) + { + _primary.Remove(item); + } + + /// + /// Adds items to the secondary area. + /// + /// The items to add to the secondary area. + public void AddSecondary(params IControlNavigationItem[] items) + { + _secondary.AddRange(items); + } + + /// + /// Removes an item from the secondary area. + /// + /// The item to remove from the secondary area. + public void RemoveSecondary(IControlNavigationItem item) + { + _secondary.Remove(item); + } + + /// + /// Converts the control to an HTML representation. + /// + /// The context in which the control is rendered. + /// The visual tree representing the control's structure. + /// An HTML node representing the rendered control. + public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTreeControl visualTree) + { + var items = GetItems(renderContext); + + Enable = items.Count() > 1; + + if (!Enable) + { + return null; + } + + return new ControlNavigation(Id, [.. items]) + { + Layout = TypeLayoutTab.Tab + }.Render(renderContext, visualTree); + } + + /// + /// Retrieves the items from the preferences, primary, and secondary areas. + /// + /// The context in which the control is rendered. + /// A list of tab items. + private IEnumerable GetItems(IRenderControlContext renderContext) + { + var settinPageManager = WebEx.ComponentHub.SettingPageManager; + var appicationContext = renderContext.PageContext?.ApplicationContext; + var settingPageContext = renderContext.PageContext as ISettingPageContext; + var categories = settinPageManager?.GetSettingCategories(appicationContext) + .Select + ( + x => new ControlNavigationItemLink() + { + Text = I18N.Translate(renderContext, x?.Name), + Uri = settinPageManager.GetFirstSettingPage(appicationContext, x).Uri, + Active = settingPageContext.SettingCategory == x ? TypeActive.Active : TypeActive.None + } + ); + + foreach (var item in Preferences.Union(WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ))) + { + yield return item; + } + + foreach (var category in categories) + { + yield return category; + } + + foreach (var item in Primary.Union(WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ))) + { + yield return item; + } + + foreach (var item in Secondary.Union(WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ))) + { + yield return item; + } + } + } +} diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppSidebar.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppSidebar.cs index 090613e..4106932 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppSidebar.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppSidebar.cs @@ -147,48 +147,40 @@ public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTre /// /// The context in which the control is rendered. /// A collection of dropdown items. - private IEnumerable GetItems(IRenderControlContext renderContext) + protected virtual IEnumerable GetItems(IRenderControlContext renderContext) { - var header = Header.Union(WebEx.ComponentHub.FragmentManager.GetFragments + foreach (var item in Header.Union(WebEx.ComponentHub.FragmentManager.GetFragments ( renderContext?.PageContext?.ApplicationContext, renderContext?.PageContext?.Scopes - )); - - var preferences = Preferences.Union(WebEx.ComponentHub.FragmentManager.GetFragments - ( - renderContext?.PageContext?.ApplicationContext, - renderContext?.PageContext?.Scopes - )); - - var primary = Primary.Union(WebEx.ComponentHub.FragmentManager.GetFragments - ( - renderContext?.PageContext?.ApplicationContext, - renderContext?.PageContext?.Scopes - )); - - var secondary = Secondary.Union(WebEx.ComponentHub.FragmentManager.GetFragments - ( - renderContext?.PageContext?.ApplicationContext, - renderContext?.PageContext?.Scopes - )); - - foreach (var item in header) + ))) { yield return item; } - foreach (var item in preferences) + foreach (var item in Preferences.Union(WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ))) { yield return item; } - foreach (var item in primary) + foreach (var item in Primary.Union(WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ))) { yield return item; } - foreach (var item in secondary) + foreach (var item in Secondary.Union(WebEx.ComponentHub.FragmentManager.GetFragments + ( + renderContext?.PageContext?.ApplicationContext, + renderContext?.PageContext?.Scopes + ))) { yield return item; } diff --git a/src/WebExpress.WebApp/WebSection/SectionSettingTabPreferences.cs b/src/WebExpress.WebApp/WebSection/SectionSettingTabPreferences.cs new file mode 100644 index 0000000..14722a9 --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionSettingTabPreferences.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section settingtab.preferences. + /// + public class SectionSettingTabPreferences : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionSettingTabPrimary.cs b/src/WebExpress.WebApp/WebSection/SectionSettingTabPrimary.cs new file mode 100644 index 0000000..b47188d --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionSettingTabPrimary.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section settingtab.primary. + /// + public class SectionSettingTabPrimary : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSection/SectionSettingTabSecondary.cs b/src/WebExpress.WebApp/WebSection/SectionSettingTabSecondary.cs new file mode 100644 index 0000000..4914ed6 --- /dev/null +++ b/src/WebExpress.WebApp/WebSection/SectionSettingTabSecondary.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebSection; + +namespace WebExpress.WebApp.WebSection +{ + /// + /// Represents the section settingtab.secondary. + /// + public class SectionSettingTabSecondary : ISection + { + } +} diff --git a/src/WebExpress.WebApp/WebSettingPage/SettingCategoryGeneral.cs b/src/WebExpress.WebApp/WebSettingPage/SettingCategoryGeneral.cs new file mode 100644 index 0000000..79ff19b --- /dev/null +++ b/src/WebExpress.WebApp/WebSettingPage/SettingCategoryGeneral.cs @@ -0,0 +1,18 @@ +using WebExpress.WebCore.WebAttribute; +using WebExpress.WebCore.WebSettingPage; +using WebExpress.WebCore.WebSettingPage.Model; + +namespace WebExpress.WebApp.WebSettingPage +{ + /// + /// Represents the general settings category for the web application. + /// + //[Icon(TypeIcon.Globe)] + [Name("webexpress.webapp:setting.category.general.name")] + [Description("webexpress.webapp:setting.category.general.description")] + [SettingSection(SettingSection.Primary)] + public sealed class SettingCategoryGeneral : ISettingCategory + { + + } +} diff --git a/src/WebExpress.WebApp/WebSettingPage/SettingCategoryGroup.cs b/src/WebExpress.WebApp/WebSettingPage/SettingCategoryGroup.cs new file mode 100644 index 0000000..e90bf60 --- /dev/null +++ b/src/WebExpress.WebApp/WebSettingPage/SettingCategoryGroup.cs @@ -0,0 +1,19 @@ +using WebExpress.WebCore.WebAttribute; +using WebExpress.WebCore.WebSettingPage; +using WebExpress.WebCore.WebSettingPage.Model; + +namespace WebExpress.WebApp.WebSettingPage +{ + /// + /// Represents the general settings group for the web application. + /// + //[Icon(TypeIcon.Globe)] + [Name("webexpress.webapp:setting.group.general.name")] + [Description("webexpress.webapp:setting.group.general.description")] + [SettingSection(SettingSection.Primary)] + [SettingCategory] + public sealed class SettingGroupGeneral : ISettingGroup + { + + } +} diff --git a/src/WebExpress.WebApp/WebSettingPage/VisualTreeWebAppSetting.cs b/src/WebExpress.WebApp/WebSettingPage/VisualTreeWebAppSetting.cs new file mode 100644 index 0000000..0e47ad5 --- /dev/null +++ b/src/WebExpress.WebApp/WebSettingPage/VisualTreeWebAppSetting.cs @@ -0,0 +1,91 @@ +using System.Linq; +using WebExpress.WebApp.WebControl; +using WebExpress.WebApp.WebPage; +using WebExpress.WebCore.Internationalization; +using WebExpress.WebCore.WebComponent; +using WebExpress.WebCore.WebHtml; +using WebExpress.WebCore.WebPage; +using WebExpress.WebUI.WebControl; +using WebExpress.WebUI.WebPage; + +namespace WebExpress.WebApp.WebSettingPage +{ + /// + /// Represents the visual tree of the web application for setting pages. + /// + public class VisualTreeWebAppSetting : VisualTreeWebApp + { + /// + /// Returns the area for setting tab. + /// + public ControlWebAppSettingTab SettingTab { get; protected set; } = new ControlWebAppSettingTab("webexpress-webapp-settingtab"); + + /// + /// Returns the sidebar control. + /// + public new ControlWebAppSettingMenu Sidebar { get; protected set; } = new ControlWebAppSettingMenu("webexpress-webapp-settingmenu"); + + /// + /// Initializes a new instance of the class. + /// + /// The component hub. + /// The page context. + public VisualTreeWebAppSetting(IComponentHub componentHub, IPageContext pageContext) + : base(componentHub, pageContext) + { + } + + /// + /// Convert to html. + /// + /// The context for rendering the page. + /// The page as an html tree. + public override IHtmlNode Render(IVisualTreeContext context) + { + var html = new HtmlElementRootHtml(); + var body = new HtmlElementSectionBody(); + var renderContext = new RenderControlContext(context.RenderContext); + + Breadcrumb.Prefix = "webexpress.webapp:setting.label"; + + html.Head.Title = I18N.Translate(context.Request, Title); + html.Head.Favicons = Favicons; + html.Head.Styles = Styles; + html.Head.Meta = Meta; + html.Head.Scripts = HeaderScripts; + html.Head.CssLinks = CssLinks.Where(x => x != null).Select(x => x.ToString()); + html.Head.ScriptLinks = HeaderScriptLinks?.Where(x => x != null).Select(x => x.ToString()); + + // header + Header.AppTitle.Text = html.Head.Title; + html.Body.Add(Header.Render(renderContext, this)); + html.Body.Add(Toast.Render(renderContext, this)); + html.Body.Add(Breadcrumb.Render(renderContext, this)); + html.Body.Add(Prologue.Render(renderContext, this)); + html.Body.Add(SettingTab.Render(renderContext, this)); + + var split = new ControlPanelSplit + ( + "webexpress-webapp-split", + [Sidebar], + [Content] + ) + { + Border = new PropertyBorder(true), + Orientation = TypeOrientationSplit.Horizontal, + //SplitterColor = LayoutSchema.SplitterColor, + Panel1InitialSize = 20, + Panel1MinSize = 150, + Styles = ["min-height: 85%;"] + }; + + html.Body.Add(split.Render(renderContext, this)); + html.Body.Add(Footer.Render(renderContext, this)); + html.Body.Add(NotificationPopup.Render(renderContext, this)); + + html.Body.Scripts = [.. Scripts.Values]; + + return html; + } + } +} From 03c728815b84a4bdba8e6f1269163caba28cfdc9 Mon Sep 17 00:00:00 2001 From: Rene Schwarzer Date: Sat, 15 Mar 2025 17:44:02 +0100 Subject: [PATCH 21/30] bug fixes --- src/WebExpress.WebApp.Test/Fixture/UnitTestControlFixture.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/WebExpress.WebApp.Test/Fixture/UnitTestControlFixture.cs b/src/WebExpress.WebApp.Test/Fixture/UnitTestControlFixture.cs index 235873a..e91db58 100644 --- a/src/WebExpress.WebApp.Test/Fixture/UnitTestControlFixture.cs +++ b/src/WebExpress.WebApp.Test/Fixture/UnitTestControlFixture.cs @@ -7,7 +7,6 @@ using WebExpress.WebCore; using WebExpress.WebCore.WebApplication; using WebExpress.WebCore.WebComponent; -using WebExpress.WebCore.WebEndpoint; using WebExpress.WebCore.WebLog; using WebExpress.WebCore.WebMessage; using WebExpress.WebCore.WebPage; @@ -205,9 +204,9 @@ public static IRenderControlContext CrerateRenderContextMock(IApplicationContext /// A fake context for testing. public static PageContext CreratePageContextMock(IApplicationContext applicationContext = null, IEnumerable scopes = null) { - var ctorPageContext = typeof(PageContext).GetConstructor(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance, null, [typeof(IEndpointManager), typeof(Type), typeof(UriResource), typeof(IUriPathSegment)], null); + var ctorPageContext = typeof(PageContext).GetConstructor(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance, null, [], null); - var pageContext = (PageContext)ctorPageContext.Invoke([WebEx.ComponentHub.EndpointManager, null, new UriResource(), null]); + var pageContext = (PageContext)ctorPageContext.Invoke([]); var applicationContextProperty = typeof(PageContext).GetProperty("ApplicationContext", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); applicationContextProperty.SetValue(pageContext, applicationContext); From 660e520d7454705278504887137ccd8dc3eaecba Mon Sep 17 00:00:00 2001 From: Rene Schwarzer Date: Sun, 16 Mar 2025 12:28:36 +0100 Subject: [PATCH 22/30] add: support for embedding icons in html --- src/WebExpress.WebApp/WebControl/ControlModalFormConfirm.cs | 3 ++- src/WebExpress.WebApp/WebControl/ControlWebAppHeaderHelp.cs | 3 ++- .../WebControl/ControlWebAppHeaderNotification.cs | 3 ++- .../WebControl/ControlWebAppHeaderSettings.cs | 3 ++- .../WebControl/ControlWebAppHeadlineMore.cs | 3 ++- .../WebControl/ControlWebAppSettingMenu.cs | 6 +++--- .../WebControl/ControlWebAppToolbarMore.cs | 3 ++- 7 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/WebExpress.WebApp/WebControl/ControlModalFormConfirm.cs b/src/WebExpress.WebApp/WebControl/ControlModalFormConfirm.cs index 13bfece..319ca2d 100644 --- a/src/WebExpress.WebApp/WebControl/ControlModalFormConfirm.cs +++ b/src/WebExpress.WebApp/WebControl/ControlModalFormConfirm.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using WebExpress.WebCore.Internationalization; using WebExpress.WebCore.WebHtml; +using WebExpress.WebCore.WebIcon; using WebExpress.WebUI.WebControl; using WebExpress.WebUI.WebPage; @@ -20,7 +21,7 @@ public class ControlModalFormConfirm : ControlModalForm /// /// Returns or sets the submit button icon. /// - public PropertyIcon SubmitButtonIcon { get { return SubmitButton?.Icon; } set { SubmitButton.Icon = value; } } + public IIcon SubmitButtonIcon { get { return SubmitButton?.Icon; } set { SubmitButton.Icon = value; } } /// /// Returns or sets the submit button color. diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderHelp.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderHelp.cs index 53e76c7..896dcb2 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderHelp.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderHelp.cs @@ -6,6 +6,7 @@ using WebExpress.WebCore.WebHtml; using WebExpress.WebUI.WebControl; using WebExpress.WebUI.WebFragment; +using WebExpress.WebUI.WebIcon; using WebExpress.WebUI.WebPage; namespace WebExpress.WebApp.WebControl @@ -111,7 +112,7 @@ public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTre var helpCtlr = items.Any() ? new ControlDropdown(Id, [.. items]) { - Icon = new PropertyIcon(TypeIcon.InfoCircle), + Icon = new IconInfoCircle(), AlignmentMenu = TypeAlignmentDropdownMenu.Right, //BackgroundColor = new PropertyColorButton(TypeColorButton.Dark), Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.None, PropertySpacing.Space.None) diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderNotification.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderNotification.cs index b482d00..01e4e78 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderNotification.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderNotification.cs @@ -6,6 +6,7 @@ using WebExpress.WebCore.WebHtml; using WebExpress.WebUI.WebControl; using WebExpress.WebUI.WebFragment; +using WebExpress.WebUI.WebIcon; using WebExpress.WebUI.WebPage; namespace WebExpress.WebApp.WebControl @@ -111,7 +112,7 @@ public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTre var helpCtlr = items.Any() ? new ControlDropdown(Id, [.. items]) { - Icon = new PropertyIcon(TypeIcon.InfoCircle), + Icon = new IconInfoCircle(), AlignmentMenu = TypeAlignmentDropdownMenu.Right, //BackgroundColor = new PropertyColorButton(TypeColorButton.Dark), Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.None, PropertySpacing.Space.None) diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs index 6ffb694..0f9837e 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs @@ -6,6 +6,7 @@ using WebExpress.WebCore.WebHtml; using WebExpress.WebUI.WebControl; using WebExpress.WebUI.WebFragment; +using WebExpress.WebUI.WebIcon; using WebExpress.WebUI.WebPage; namespace WebExpress.WebApp.WebControl @@ -111,7 +112,7 @@ public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTre var settingCtlr = items.Any() ? new ControlDropdown(Id, [.. items]) { - Icon = new PropertyIcon(TypeIcon.Cog), + Icon = new IconCog(), AlignmentMenu = TypeAlignmentDropdownMenu.Right, BackgroundColor = new PropertyColorButton(TypeColorButton.Dark), Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.None, PropertySpacing.Space.None) diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeadlineMore.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeadlineMore.cs index 4a71b6e..647b367 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeadlineMore.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeadlineMore.cs @@ -6,6 +6,7 @@ using WebExpress.WebCore.WebHtml; using WebExpress.WebUI.WebControl; using WebExpress.WebUI.WebFragment; +using WebExpress.WebUI.WebIcon; using WebExpress.WebUI.WebPage; namespace WebExpress.WebApp.WebControl @@ -111,7 +112,7 @@ public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTre var settingsCtlr = items.Any() ? new ControlDropdown(Id, [.. items]) { - Icon = new PropertyIcon(TypeIcon.EllipsisHorizontal), + Icon = new IconEllipsisHorizontal(), AlignmentMenu = TypeAlignmentDropdownMenu.Right, //BackgroundColor = new PropertyColorButton(TypeColorButton.Dark), Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.None, PropertySpacing.Space.None) diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppSettingMenu.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppSettingMenu.cs index a0240c5..2798156 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppSettingMenu.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppSettingMenu.cs @@ -55,7 +55,7 @@ protected override IEnumerable GetItems(IRenderControlContext renderCo listCtrl.Add(new ControlListItemLink() { Text = page.PageTitle, - Icon = new PropertyIcon(page.Icon), + Icon = page.Icon, Uri = page?.Uri, Active = page == renderContext.PageContext ? TypeActive.Active : TypeActive.None }); @@ -71,7 +71,7 @@ protected override IEnumerable GetItems(IRenderControlContext renderCo listCtrl.Add(new ControlListItemLink() { Text = page.PageTitle, - Icon = new PropertyIcon(page.Icon), + Icon = page.Icon, Uri = page?.Uri, Active = page == renderContext.PageContext ? TypeActive.Active : TypeActive.None }); @@ -87,7 +87,7 @@ protected override IEnumerable GetItems(IRenderControlContext renderCo listCtrl.Add(new ControlListItemLink() { Text = page.PageTitle, - Icon = new PropertyIcon(page.Icon), + Icon = page.Icon, Uri = page?.Uri, Active = page == renderContext.PageContext ? TypeActive.Active : TypeActive.None }); diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppToolbarMore.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppToolbarMore.cs index 9f1b064..739e5af 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppToolbarMore.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppToolbarMore.cs @@ -6,6 +6,7 @@ using WebExpress.WebCore.WebHtml; using WebExpress.WebUI.WebControl; using WebExpress.WebUI.WebFragment; +using WebExpress.WebUI.WebIcon; using WebExpress.WebUI.WebPage; namespace WebExpress.WebApp.WebControl @@ -111,7 +112,7 @@ public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTre var settingsCtlr = items.Any() ? new ControlDropdown(Id, [.. items]) { - Icon = new PropertyIcon(TypeIcon.EllipsisHorizontal), + Icon = new IconEllipsisHorizontal(), AlignmentMenu = TypeAlignmentDropdownMenu.Right, //BackgroundColor = new PropertyColorButton(TypeColorButton.Dark), Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.None, PropertySpacing.Space.None) From ce5f46356eec9dfbb2956a774c0f953286404e0b Mon Sep 17 00:00:00 2001 From: Rene Schwarzer Date: Sat, 22 Mar 2025 02:03:51 +0100 Subject: [PATCH 23/30] fix: adjustment of the layout --- src/WebExpress.WebApp.Test/TestThemeA.cs | 22 +++++++ src/WebExpress.WebApp.Test/TestThemeB.cs | 20 +++++++ .../UnitTestControlWebAppHeaderSettings.cs | 4 +- .../WebTheme/UnitTestThemeManager.cs | 54 +++++++++++++++++ .../Assets/css/webexpress.webapp.theme.css | 51 ++++++++++++++++ .../WebControl/ControlWebAppHeaderSettings.cs | 58 ++++++++++++++++++- .../WebControl/ControlWebAppSettingMenu.cs | 6 +- .../WebExpress.WebApp.csproj | 5 ++ .../WebPage/VisualTreeWebApp.cs | 14 ++++- .../WebSettingPage/SettingCategoryGeneral.cs | 4 +- ...ategoryGroup.cs => SettingGroupGeneral.cs} | 4 +- .../WebSettingPage/VisualTreeWebAppSetting.cs | 3 +- .../WebTheme/IThemeWebApp.cs | 11 ++++ .../WebTheme/ThemeManagerExtensions.cs | 21 +++++++ src/WebExpress.WebApp/WebTheme/ThemeWebApp.cs | 9 +++ 15 files changed, 270 insertions(+), 16 deletions(-) create mode 100644 src/WebExpress.WebApp.Test/TestThemeA.cs create mode 100644 src/WebExpress.WebApp.Test/TestThemeB.cs create mode 100644 src/WebExpress.WebApp.Test/WebTheme/UnitTestThemeManager.cs create mode 100644 src/WebExpress.WebApp/Assets/css/webexpress.webapp.theme.css rename src/WebExpress.WebApp/WebSettingPage/{SettingCategoryGroup.cs => SettingGroupGeneral.cs} (87%) create mode 100644 src/WebExpress.WebApp/WebTheme/IThemeWebApp.cs create mode 100644 src/WebExpress.WebApp/WebTheme/ThemeManagerExtensions.cs create mode 100644 src/WebExpress.WebApp/WebTheme/ThemeWebApp.cs diff --git a/src/WebExpress.WebApp.Test/TestThemeA.cs b/src/WebExpress.WebApp.Test/TestThemeA.cs new file mode 100644 index 0000000..aafc1d6 --- /dev/null +++ b/src/WebExpress.WebApp.Test/TestThemeA.cs @@ -0,0 +1,22 @@ +using WebExpress.WebApp.WebTheme; +using WebExpress.WebCore.WebAttribute; + +namespace WebExpress.WebApp.Test +{ + /// + /// A dummy theme for testing. + /// + [Name("TestThemeA")] + [Description("A dummy theme for testing.")] + [Image("webexpress.webcore.test.testthemea.png")] + public sealed class TestThemeA : IThemeWebApp + { + /// + /// Returns the text color for the theme. + /// + /// + /// A string representing the text color in hexadecimal format. + /// + public static string TextColor => "000000"; + } +} diff --git a/src/WebExpress.WebApp.Test/TestThemeB.cs b/src/WebExpress.WebApp.Test/TestThemeB.cs new file mode 100644 index 0000000..513a805 --- /dev/null +++ b/src/WebExpress.WebApp.Test/TestThemeB.cs @@ -0,0 +1,20 @@ +using WebExpress.WebApp.WebTheme; +using WebExpress.WebCore.WebAttribute; + +namespace WebExpress.WebApp.Test +{ + /// + /// A dummy theme for testing. + /// + [Name("TestThemeB")] + public sealed class TestThemeB : IThemeWebApp + { + /// + /// Returns the text color for the theme. + /// + /// + /// A string representing the text color in hexadecimal format. + /// + public static string TextColor => "FFFFFF"; + } +} diff --git a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderSettings.cs b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderSettings.cs index 14835ae..ca8269c 100644 --- a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderSettings.cs +++ b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderSettings.cs @@ -14,8 +14,8 @@ public class UnitTestControlWebAppHeaderSettings /// Tests the id property of the web app header settings control. /// [Theory] - [InlineData(null, null)] - [InlineData("id", null)] + [InlineData(null, "
*
")] + [InlineData("id", "
*
")] public void Id(string id, string expected) { // preconditions diff --git a/src/WebExpress.WebApp.Test/WebTheme/UnitTestThemeManager.cs b/src/WebExpress.WebApp.Test/WebTheme/UnitTestThemeManager.cs new file mode 100644 index 0000000..97a44d3 --- /dev/null +++ b/src/WebExpress.WebApp.Test/WebTheme/UnitTestThemeManager.cs @@ -0,0 +1,54 @@ +using WebExpress.WebApp.Test.Fixture; +using WebExpress.WebApp.WebTheme; + +namespace WebExpress.WebApp.Test.WebTheme +{ + /// + /// Test the theme manager. + /// + [Collection("NonParallelTests")] + public class UnitTestThemeManager + { + /// + /// Test the id property of the theme. + /// + [Theory] + [InlineData(typeof(TestApplication), typeof(TestThemeA), "webexpress.webapp.test.testthemea")] + public void Id(Type applicationType, Type themeType, string id) + { + // preconditions + var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); + var application = componentHub.ApplicationManager.GetApplications(applicationType).FirstOrDefault(); + + // test execution + var themeContexts = componentHub.ThemeManager.GetThemes(application, themeType); + + if (id == null) + { + Assert.Empty(themeContexts); + return; + } + + Assert.Contains(id, themeContexts.Select(x => x.ThemeId?.ToString())); + } + + /// + /// Test the GetWebAppTheme function of the theme manager. + /// + [Theory] + [InlineData(typeof(TestApplication), typeof(TestThemeA), "webexpress.webapp.test.testthemea")] + public void GetWebAppTheme(Type applicationType, Type themeType, string id) + { + // preconditions + var componentHub = UnitTestControlFixture.CreateAndRegisterComponentHubMock(); + var application = componentHub.ApplicationManager.GetApplications(applicationType).FirstOrDefault(); + + // test execution + var themeContext = componentHub.ThemeManager.GetThemes(application, themeType).FirstOrDefault(); + var theme = componentHub.ThemeManager.GetWebAppTheme(themeContext); + + Assert.NotNull(theme); + Assert.Equal(id, theme.GetType().FullName.ToLower()); + } + } +} diff --git a/src/WebExpress.WebApp/Assets/css/webexpress.webapp.theme.css b/src/WebExpress.WebApp/Assets/css/webexpress.webapp.theme.css new file mode 100644 index 0000000..ea1db67 --- /dev/null +++ b/src/WebExpress.WebApp/Assets/css/webexpress.webapp.theme.css @@ -0,0 +1,51 @@ +#webexpress-webapp-header { + background: var(--bs-gray-800); +} + +#webexpress-webapp-header-apptitle { + color: var(--bs-white); +} + +#webexpress-webapp-header-appnavigation { + color: var(--bs-white); +} + +#webexpress-webapp-header-appnavigation .nav-link { + color: var(--bs-white); +} + +#webexpress-webapp-header-appnavigation .active { + color: var(--bs-info); +} + +#webexpress-webapp-breadcrumb { + background: var(--bs-light); +} + +#webexpress-webapp-sidebar { + background: var(--bs-light); +} + +#webexpress-webapp-settingtab { + background: var(--bs-light); +} + +#webexpress-webapp-settingmenu { + background: var(--bs-light); +} + +#webexpress-webapp-split-gutter { + background-color: rgba(var(--bs-light-rgb), var(--bs-bg-opacity)) !important; +} + +#webexpress-webapp-content-main-headline { + background: var(--bs-white); +} + +#webexpress-webapp-headline-more { + background: var(--bs-white); +} + +#webindex-webfragment-footerprimaryfragment { + background: var(--bs-light); +} \ No newline at end of file diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs index 0f9837e..506953f 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs @@ -4,6 +4,7 @@ using WebExpress.WebCore; using WebExpress.WebCore.Internationalization; using WebExpress.WebCore.WebHtml; +using WebExpress.WebCore.WebSettingPage; using WebExpress.WebUI.WebControl; using WebExpress.WebUI.WebFragment; using WebExpress.WebUI.WebIcon; @@ -129,6 +130,42 @@ public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTre /// A collection of dropdown items. private IEnumerable GetItems(IRenderControlContext renderContext) { + var settinPageManager = WebEx.ComponentHub.SettingPageManager; + var appicationContext = renderContext.PageContext?.ApplicationContext; + var preferenceCategories = settinPageManager?.GetSettingCategories(appicationContext) + .Where(x => x.Section == SettingSection.Preferences) + .Select + ( + x => new ControlDropdownItemLink() + { + Text = I18N.Translate(renderContext, x?.Name), + Uri = settinPageManager.GetFirstSettingPage(appicationContext, x)?.Uri, + Icon = x.Icon + } + ); + var primaryCategories = settinPageManager?.GetSettingCategories(appicationContext) + .Where(x => x.Section == SettingSection.Primary) + .Select + ( + x => new ControlDropdownItemLink() + { + Text = I18N.Translate(renderContext, x?.Name), + Uri = settinPageManager.GetFirstSettingPage(appicationContext, x)?.Uri, + Icon = x.Icon + } + ); + var secondaryCategories = settinPageManager?.GetSettingCategories(appicationContext) + .Where(x => x.Section == SettingSection.Secondary) + .Select + ( + x => new ControlDropdownItemLink() + { + Text = I18N.Translate(renderContext, x?.Name), + Uri = settinPageManager.GetFirstSettingPage(appicationContext, x)?.Uri, + Icon = x.Icon + } + ); + var preferences = Preferences.Union(WebEx.ComponentHub.FragmentManager.GetFragments ( renderContext?.PageContext?.ApplicationContext, @@ -147,31 +184,46 @@ private IEnumerable GetItems(IRenderControlContext renderC renderContext?.PageContext?.Scopes )); - if (preferences.Any() || primary.Any() || secondary.Any()) + if (preferences.Any() || primary.Any() || secondary.Any() || preferenceCategories.Any()) { yield return new ControlDropdownItemHeader(I18N.Translate(renderContext.Request, "webexpress.webapp:header.setting.label")); } + foreach (var item in preferenceCategories) + { + yield return item; + } + foreach (var item in preferences) { yield return item; } - if (preferences.Any() && (primary.Any() || secondary.Any())) + if ((preferenceCategories.Any() || preferences.Any()) && (primary.Any() || secondary.Any())) { yield return new ControlDropdownItemDivider(); } + foreach (var item in primaryCategories) + { + yield return item; + } + foreach (var item in primary) { yield return item; } - if (primary.Any() && secondary.Any()) + if ((primaryCategories.Any() || primary.Any()) && secondary.Any()) { yield return new ControlDropdownItemDivider(); } + foreach (var item in secondaryCategories) + { + yield return item; + } + foreach (var item in secondary) { yield return item; diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppSettingMenu.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppSettingMenu.cs index 2798156..d39c9a7 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppSettingMenu.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppSettingMenu.cs @@ -47,7 +47,7 @@ protected override IEnumerable GetItems(IRenderControlContext renderCo controls.Add(listCtrl); foreach (var page in settingPages - .Where(x => x.Section == WebCore.WebSettingPage.Model.SettingSection.Preferences) + .Where(x => x.Section == SettingSection.Preferences) .OrderBy(x => I18N.Translate(renderContext, x.PageTitle))) { if (!page.Hide && (!page.Conditions.Any() || page.Conditions.All(x => x.Fulfillment(renderContext.Request)))) @@ -63,7 +63,7 @@ protected override IEnumerable GetItems(IRenderControlContext renderCo } foreach (var page in settingPages - .Where(x => x.Section == WebCore.WebSettingPage.Model.SettingSection.Primary) + .Where(x => x.Section == SettingSection.Primary) .OrderBy(x => I18N.Translate(renderContext, x.PageTitle))) { if (!page.Hide && (!page.Conditions.Any() || page.Conditions.All(x => x.Fulfillment(renderContext.Request)))) @@ -79,7 +79,7 @@ protected override IEnumerable GetItems(IRenderControlContext renderCo } foreach (var page in settingPages - .Where(x => x.Section == WebCore.WebSettingPage.Model.SettingSection.Secondary) + .Where(x => x.Section == SettingSection.Secondary) .OrderBy(x => I18N.Translate(renderContext, x.PageTitle))) { if (!page.Hide && (!page.Conditions.Any() || page.Conditions.All(x => x.Fulfillment(renderContext.Request)))) diff --git a/src/WebExpress.WebApp/WebExpress.WebApp.csproj b/src/WebExpress.WebApp/WebExpress.WebApp.csproj index 90afd70..083410f 100644 --- a/src/WebExpress.WebApp/WebExpress.WebApp.csproj +++ b/src/WebExpress.WebApp/WebExpress.WebApp.csproj @@ -30,10 +30,15 @@ + + + + + diff --git a/src/WebExpress.WebApp/WebPage/VisualTreeWebApp.cs b/src/WebExpress.WebApp/WebPage/VisualTreeWebApp.cs index 10e0be0..5679abf 100644 --- a/src/WebExpress.WebApp/WebPage/VisualTreeWebApp.cs +++ b/src/WebExpress.WebApp/WebPage/VisualTreeWebApp.cs @@ -6,6 +6,7 @@ using WebExpress.WebCore.WebComponent; using WebExpress.WebCore.WebHtml; using WebExpress.WebCore.WebPage; +using WebExpress.WebCore.WebTheme; using WebExpress.WebCore.WebUri; using WebExpress.WebUI.WebControl; using WebExpress.WebUI.WebPage; @@ -17,6 +18,11 @@ namespace WebExpress.WebApp.WebPage ///
public class VisualTreeWebApp : VisualTreeControl { + /// + /// Returns or sets the theme of the web application. + /// + public IThemeContext Theme { get; set; } + /// /// Returns header control. /// @@ -92,6 +98,7 @@ public VisualTreeWebApp(IComponentHub componentHub, IPageContext pageContext) AddCssLink(UriResource.Combine(applicationContext?.ContextPath, "/assets/css/webexpress.webapp.css")); AddCssLink(UriResource.Combine(applicationContext?.ContextPath, "/assets/css/webexpress.webapp.popupnotification.css")); AddCssLink(UriResource.Combine(applicationContext?.ContextPath, "/assets/css/webexpress.webapp.taskprogressbar.css")); + AddCssLink(Theme?.ThemeStyle ?? UriResource.Combine(applicationContext?.ContextPath, "/assets/css/webexpress.webapp.theme.css")); AddHeaderScriptLink(UriResource.Combine(applicationContext?.ContextPath, "assets/js/webexpress.webapp.js")); AddHeaderScriptLink(UriResource.Combine(applicationContext?.ContextPath, "assets/js/webexpress.webapp.popupnotification.js")); AddHeaderScriptLink(UriResource.Combine(applicationContext?.ContextPath, "assets/js/webexpress.webapp.selection.js")); @@ -119,6 +126,10 @@ public override IHtmlNode Render(IVisualTreeContext context) // header Header.AppTitle.Text = html.Head.Title; + if (Theme?.ThemeMode == ThemeMode.Dark) + { + html.Body.AddUserAttribute("data-bs-theme", "dark"); + } html.Body.Add(Header.Render(renderContext, this)); html.Body.Add(Toast.Render(renderContext, this)); html.Body.Add(Breadcrumb.Render(renderContext, this)); @@ -135,8 +146,7 @@ public override IHtmlNode Render(IVisualTreeContext context) Orientation = TypeOrientationSplit.Horizontal, //SplitterColor = LayoutSchema.SplitterColor, Panel1InitialSize = 20, - Panel1MinSize = 150, - Styles = ["min-height: 85%;"] + Panel1MinSize = 150 }; html.Body.Add(split.Render(renderContext, this)); diff --git a/src/WebExpress.WebApp/WebSettingPage/SettingCategoryGeneral.cs b/src/WebExpress.WebApp/WebSettingPage/SettingCategoryGeneral.cs index 79ff19b..c10e42e 100644 --- a/src/WebExpress.WebApp/WebSettingPage/SettingCategoryGeneral.cs +++ b/src/WebExpress.WebApp/WebSettingPage/SettingCategoryGeneral.cs @@ -1,13 +1,13 @@ using WebExpress.WebCore.WebAttribute; using WebExpress.WebCore.WebSettingPage; -using WebExpress.WebCore.WebSettingPage.Model; +using WebExpress.WebUI.WebIcon; namespace WebExpress.WebApp.WebSettingPage { /// /// Represents the general settings category for the web application. /// - //[Icon(TypeIcon.Globe)] + [WebIcon] [Name("webexpress.webapp:setting.category.general.name")] [Description("webexpress.webapp:setting.category.general.description")] [SettingSection(SettingSection.Primary)] diff --git a/src/WebExpress.WebApp/WebSettingPage/SettingCategoryGroup.cs b/src/WebExpress.WebApp/WebSettingPage/SettingGroupGeneral.cs similarity index 87% rename from src/WebExpress.WebApp/WebSettingPage/SettingCategoryGroup.cs rename to src/WebExpress.WebApp/WebSettingPage/SettingGroupGeneral.cs index e90bf60..98b56b0 100644 --- a/src/WebExpress.WebApp/WebSettingPage/SettingCategoryGroup.cs +++ b/src/WebExpress.WebApp/WebSettingPage/SettingGroupGeneral.cs @@ -1,13 +1,13 @@ using WebExpress.WebCore.WebAttribute; using WebExpress.WebCore.WebSettingPage; -using WebExpress.WebCore.WebSettingPage.Model; +using WebExpress.WebUI.WebIcon; namespace WebExpress.WebApp.WebSettingPage { /// /// Represents the general settings group for the web application. /// - //[Icon(TypeIcon.Globe)] + [WebIcon] [Name("webexpress.webapp:setting.group.general.name")] [Description("webexpress.webapp:setting.group.general.description")] [SettingSection(SettingSection.Primary)] diff --git a/src/WebExpress.WebApp/WebSettingPage/VisualTreeWebAppSetting.cs b/src/WebExpress.WebApp/WebSettingPage/VisualTreeWebAppSetting.cs index 0e47ad5..5a3b1c8 100644 --- a/src/WebExpress.WebApp/WebSettingPage/VisualTreeWebAppSetting.cs +++ b/src/WebExpress.WebApp/WebSettingPage/VisualTreeWebAppSetting.cs @@ -75,8 +75,7 @@ public override IHtmlNode Render(IVisualTreeContext context) Orientation = TypeOrientationSplit.Horizontal, //SplitterColor = LayoutSchema.SplitterColor, Panel1InitialSize = 20, - Panel1MinSize = 150, - Styles = ["min-height: 85%;"] + Panel1MinSize = 150 }; html.Body.Add(split.Render(renderContext, this)); diff --git a/src/WebExpress.WebApp/WebTheme/IThemeWebApp.cs b/src/WebExpress.WebApp/WebTheme/IThemeWebApp.cs new file mode 100644 index 0000000..8f0d593 --- /dev/null +++ b/src/WebExpress.WebApp/WebTheme/IThemeWebApp.cs @@ -0,0 +1,11 @@ +using WebExpress.WebCore.WebTheme; + +namespace WebExpress.WebApp.WebTheme +{ + /// + /// Represents a theme for a web application. + /// + public interface IThemeWebApp : ITheme + { + } +} diff --git a/src/WebExpress.WebApp/WebTheme/ThemeManagerExtensions.cs b/src/WebExpress.WebApp/WebTheme/ThemeManagerExtensions.cs new file mode 100644 index 0000000..9c50570 --- /dev/null +++ b/src/WebExpress.WebApp/WebTheme/ThemeManagerExtensions.cs @@ -0,0 +1,21 @@ +using WebExpress.WebCore.WebTheme; + +namespace WebExpress.WebApp.WebTheme +{ + /// + /// Provides extension methods for the interface. + /// + public static class ThemeManagerExtensions + { + /// + /// Retrieves the web application theme based on the provided theme context. + /// + /// The theme manager instance. + /// The context of the theme. + /// Returns an instance of if found; otherwise, null. + public static IThemeWebApp GetWebAppTheme(this IThemeManager themeManager, IThemeContext themeContext) + { + return themeManager.GetTheme(themeContext) as IThemeWebApp; + } + } +} diff --git a/src/WebExpress.WebApp/WebTheme/ThemeWebApp.cs b/src/WebExpress.WebApp/WebTheme/ThemeWebApp.cs new file mode 100644 index 0000000..17d66ca --- /dev/null +++ b/src/WebExpress.WebApp/WebTheme/ThemeWebApp.cs @@ -0,0 +1,9 @@ +namespace WebExpress.WebApp.WebTheme +{ + /// + /// Represents the theme web application. + /// + public class ThemeWebApp : IThemeWebApp + { + } +} From 65004556b8e37c00e7fdf1fb66bc2d53661f434b Mon Sep 17 00:00:00 2001 From: Rene Schwarzer Date: Sat, 22 Mar 2025 20:03:03 +0100 Subject: [PATCH 24/30] feat: add wx- prefix for css --- .../Assets/css/webexpress.webapp.css | 10 +- .../Assets/css/webexpress.webapp.theme.css | 52 +++- .../WebControl/ControlWebAppContent.cs | 11 +- .../WebControl/ControlWebAppFooter.cs | 3 +- .../WebControl/ControlWebAppHeader.cs | 15 +- .../ControlWebAppHeaderAppNavigation.cs | 9 - .../WebControl/ControlWebAppHeaderAppTitle.cs | 1 - .../ControlWebAppHeaderQuickCreate.cs | 5 - .../WebControl/ControlWebAppHeadline.cs | 4 +- .../WebControl/ControlWebAppMain.cs | 4 +- .../WebControl/ControlWebAppProperty.cs | 1 - .../WebControl/ControlWebAppSettingTab.cs | 1 - .../WebControl/ControlWebAppSidebar.cs | 2 +- .../WebControl/ControlWebAppToolbar.cs | 3 +- src/WebExpress.WebApp/WebPage/LayoutSchema.cs | 197 ------------- src/WebExpress.WebApp/WebPage/PageWebApp.cs | 260 ++---------------- .../WebPage/VisualTreeWebApp.cs | 30 +- .../WebSettingPage/PageWebAppSettingPlugin.cs | 2 +- .../WebSettingPage/VisualTreeWebAppSetting.cs | 7 +- 19 files changed, 103 insertions(+), 514 deletions(-) delete mode 100644 src/WebExpress.WebApp/WebPage/LayoutSchema.cs diff --git a/src/WebExpress.WebApp/Assets/css/webexpress.webapp.css b/src/WebExpress.WebApp/Assets/css/webexpress.webapp.css index 8538e09..bd2b678 100644 --- a/src/WebExpress.WebApp/Assets/css/webexpress.webapp.css +++ b/src/WebExpress.WebApp/Assets/css/webexpress.webapp.css @@ -8,14 +8,15 @@ main { flex: auto; display: flex; flex-direction: column; + flex-grow: 1; } -.sidebar { +.wx-sidebar { overflow: auto; min-height: 100%; } -.proterty { +.wx-proterty { overflow: auto; display: block; background: #C6E2FF; @@ -23,11 +24,12 @@ main { min-width: 15%; } -.content { +.wx-content { flex: auto; display: flex; flex-direction: column; + flex-grow: 1; } -.footer { +.wx-footer { } diff --git a/src/WebExpress.WebApp/Assets/css/webexpress.webapp.theme.css b/src/WebExpress.WebApp/Assets/css/webexpress.webapp.theme.css index ea1db67..4034cc9 100644 --- a/src/WebExpress.WebApp/Assets/css/webexpress.webapp.theme.css +++ b/src/WebExpress.WebApp/Assets/css/webexpress.webapp.theme.css @@ -1,51 +1,75 @@ -#webexpress-webapp-header { - background: var(--bs-gray-800); +#wx-header { + background: var(--bs-dark); } -#webexpress-webapp-header-apptitle { +#wx-header-apptitle { color: var(--bs-white); } -#webexpress-webapp-header-appnavigation { +#wx-header-appnavigation { color: var(--bs-white); } -#webexpress-webapp-header-appnavigation .nav-link { +#wx-header-appnavigation .nav-link { color: var(--bs-white); } -#webexpress-webapp-header-appnavigation .active { +#wx-header-appnavigation .active { color: var(--bs-info); } -#webexpress-webapp-breadcrumb { +#wx-breadcrumb { background: var(--bs-light); } -#webexpress-webapp-sidebar { +#wx-prologue { background: var(--bs-light); } -#webexpress-webapp-settingtab { +#wx-searchoptions { background: var(--bs-light); } -#webexpress-webapp-settingmenu { +#wx-sidebar { background: var(--bs-light); } -#webexpress-webapp-split-gutter { +#wx-settingtab { + background: var(--bs-light); +} + +#wx-settingmenu { + background: var(--bs-light); +} + +#wx-split-gutter { background-color: rgba(var(--bs-light-rgb), var(--bs-bg-opacity)) !important; } -#webexpress-webapp-content-main-headline { +#wx-content { +} + +#wx-content-toolbar { +} + +#wx-content-toolbar-more { +} + +#wx-content-main { +} + +#wx-content-main-headline { background: var(--bs-white); } -#webexpress-webapp-headline-more { +#wx-content-main-headline-more { background: var(--bs-white); } -#webindex-webfragment-footerprimaryfragment { +#wx-content-main-property { + background: var(--bs-blue200); +} + +#wx-footer { background: var(--bs-light); } \ No newline at end of file diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppContent.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppContent.cs index 857d491..06aef0d 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppContent.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppContent.cs @@ -12,12 +12,12 @@ public class ControlWebAppContent : Control /// /// Returns the toolbar. /// - public ControlWebAppToolbar Toolbar { get; } = new ControlWebAppToolbar("webexpress-webapp-content-toolbar"); + public ControlWebAppToolbar Toolbar { get; } = new ControlWebAppToolbar("wx-content-toolbar"); /// /// Returns the main panel. /// - public ControlWebAppMain MainPanel { get; } = new ControlWebAppMain("webexpress-webapp-content-main") + public ControlWebAppMain MainPanel { get; } = new ControlWebAppMain("wx-content-main") { //BackgroundColor = new PropertyColorBackground(TypeColorBackground.Danger), }; @@ -25,7 +25,7 @@ public class ControlWebAppContent : Control /// /// Returns the page properties. /// - public ControlWebAppProperty Property { get; } = new ControlWebAppProperty("webexpress-webapp-content-property"); + public ControlWebAppProperty Property { get; } = new ControlWebAppProperty("wx-content-property"); /// /// Initializes a new instance of the class. @@ -51,11 +51,12 @@ public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTre new ControlPanelFlexbox(null, MainPanel, Property) { Layout = TypeLayoutFlexbox.Default, - Align = TypeAlignFlexbox.Stretch + Align = TypeAlignFlexbox.Stretch, + FlexGrow = TypeFlexGrow.Grow } ) { - Classes = ["content"], + Classes = ["wx-content"], Margin = new PropertySpacingMargin(PropertySpacing.Space.Two) }; diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppFooter.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppFooter.cs index f3f2051..fc32265 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppFooter.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppFooter.cs @@ -40,8 +40,6 @@ public class ControlWebAppFooter : Control public ControlWebAppFooter(string id = null) : base(id) { - //BackgroundColor = LayoutSchema.FooterBackground; - //TextColor = LayoutSchema.FooterText; } /// @@ -132,6 +130,7 @@ public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTre new ControlPanel(null, [.. secondary]) ) { + Classes = ["wx-footer"], } : null; return footerCtrl?.Render(renderContext, visualTree); diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeader.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeader.cs index e62d80a..354c807 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeader.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeader.cs @@ -40,21 +40,21 @@ public virtual TypeSticky Sticky /// /// Returns or sets the application navigator. /// - public ControlWebAppHeaderAppNavigator AppNavigator { get; } = new ControlWebAppHeaderAppNavigator("webexpress-webapp-header-appnavigator") + public ControlWebAppHeaderAppNavigator AppNavigator { get; } = new ControlWebAppHeaderAppNavigator("wx-header-appnavigator") { }; /// /// Returns or setss the name of the application. /// - public ControlWebAppHeaderAppTitle AppTitle { get; } = new ControlWebAppHeaderAppTitle("webexpress-webapp-header-apptitle") + public ControlWebAppHeaderAppTitle AppTitle { get; } = new ControlWebAppHeaderAppTitle("wx-header-apptitle") { }; /// /// Returns or sets the navigation of the application. /// - public ControlWebAppHeaderAppNavigation AppNavigation { get; } = new ControlWebAppHeaderAppNavigation("webexpress-webapp-header-appnavigation") + public ControlWebAppHeaderAppNavigation AppNavigation { get; } = new ControlWebAppHeaderAppNavigation("wx-header-appnavigation") { Layout = TypeLayoutFlexbox.Inline, Justify = TypeJustifiedFlexbox.Start @@ -63,28 +63,28 @@ public virtual TypeSticky Sticky /// /// Returns or sets the quick create. /// - public ControlWebAppHeaderQuickCreate QuickCreate { get; } = new ControlWebAppHeaderQuickCreate("webexpress-webapp-header-quickcreate") + public ControlWebAppHeaderQuickCreate QuickCreate { get; } = new ControlWebAppHeaderQuickCreate("wx-header-quickcreate") { }; /// /// Returns or sets the navigation of the application helpers. /// - public ControlWebAppHeaderHelp Help { get; } = new ControlWebAppHeaderHelp("webexpress-webapp-header-help") + public ControlWebAppHeaderHelp Help { get; } = new ControlWebAppHeaderHelp("wx-header-help") { }; /// /// Returns or sets the navigation of the application helpers. /// - public ControlWebAppHeaderNotification Notifications { get; } = new ControlWebAppHeaderNotification("webexpress-webapp-header-notifications") + public ControlWebAppHeaderNotification Notifications { get; } = new ControlWebAppHeaderNotification("wx-header-notifications") { }; /// /// Returns or sets the navigation of the application settings. /// - public ControlWebAppHeaderSettings Settings { get; } = new ControlWebAppHeaderSettings("webexpress-webapp-header-settings") + public ControlWebAppHeaderSettings Settings { get; } = new ControlWebAppHeaderSettings("wx-header-settings") { }; @@ -98,7 +98,6 @@ public ControlWebAppHeader(string id = null) Fixed = TypeFixed.Top; Styles = new List(["position: sticky; top: 0; z-index: 99;"]); Padding = new PropertySpacingPadding(PropertySpacing.Space.Null); - //BackgroundColor = LayoutSchema.HeaderBackground; } /// diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigation.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigation.cs index eb32a90..e8a97fb 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigation.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigation.cs @@ -128,23 +128,14 @@ public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTre preferences.Any() ? new ControlNavigation("webexpress.webapp.header.appnavigation.preferences", [.. preferences]) { Layout = TypeLayoutTab.Default, - //ActiveColor = LayoutSchema.HeaderNavigationActiveBackground, - //ActiveTextColor = LayoutSchema.HeaderNavigationActive, - //LinkColor = LayoutSchema.HeaderNavigationLink }.Render(renderContext, visualTree) : null, primary.Any() ? new ControlNavigation("webexpress.webapp.header.appnavigation.primary", [.. primary]) { Layout = TypeLayoutTab.Default, - //ActiveColor = LayoutSchema.HeaderNavigationActiveBackground, - //ActiveTextColor = LayoutSchema.HeaderNavigationActive, - //LinkColor = LayoutSchema.HeaderNavigationLink }.Render(renderContext, visualTree) : null, secondary.Any() ? new ControlNavigation("webexpress.webapp.header.appnavigation.secondary", Secondary.Union(secondary).ToArray()) { Layout = TypeLayoutTab.Default, - //ActiveColor = LayoutSchema.HeaderNavigationActiveBackground, - //ActiveTextColor = LayoutSchema.HeaderNavigationActive, - //LinkColor = LayoutSchema.HeaderNavigationLink }.Render(renderContext, visualTree) : null ) { diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppTitle.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppTitle.cs index 6fff847..790662e 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppTitle.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppTitle.cs @@ -31,7 +31,6 @@ public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTre var apptitle = new ControlText() { Text = I18N.Translate(renderContext.Request.Culture, renderContext.PageContext?.ApplicationContext?.ApplicationName), - //TextColor = LayoutSchema.HeaderTitle, Format = TypeFormatText.H1, Padding = new PropertySpacingPadding(PropertySpacing.Space.One), Margin = new PropertySpacingMargin(PropertySpacing.Space.None, PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.Null) diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderQuickCreate.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderQuickCreate.cs index 49f6f0b..b63157d 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderQuickCreate.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderQuickCreate.cs @@ -136,8 +136,6 @@ public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTre { Text = I18N.Translate(renderContext.Request?.Culture, "webexpress.webapp:header.quickcreate.label"), Uri = firstQuickcreate?.Uri, - //BackgroundColor = LayoutSchema.HeaderQuickCreateButtonBackground, - //Size = LayoutSchema.HeaderQuickCreateButtonSize, Margin = new PropertySpacingMargin(PropertySpacing.Space.Auto, PropertySpacing.Space.None), OnClick = firstQuickcreate?.OnClick, Modal = firstQuickcreate?.Modal @@ -147,9 +145,6 @@ public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTre { Text = I18N.Translate(renderContext.Request?.Culture, "webexpress.webapp:header.quickcreate.label"), Uri = firstQuickcreate?.Uri, - //BackgroundColor = LayoutSchema.HeaderQuickCreateButtonBackground, - //Size = LayoutSchema.HeaderQuickCreateButtonSize, - //Margin = new PropertySpacingMargin(PropertySpacing.Space.Auto, PropertySpacing.Space.None), OnClick = firstQuickcreate?.OnClick, Modal = firstQuickcreate?.Modal } : diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeadline.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeadline.cs index 920ccdb..cd651b5 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeadline.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeadline.cs @@ -49,7 +49,7 @@ public class ControlWebAppHeadline : Control /// /// Returns the more control. /// - public ControlWebAppHeadlineMore More { get; } = new ControlWebAppHeadlineMore("webexpress-webapp-headline-more") + public ControlWebAppHeadlineMore More { get; } = new ControlWebAppHeadlineMore("wx-content-main-headline-more") { }; @@ -60,7 +60,6 @@ public class ControlWebAppHeadline : Control public ControlWebAppHeadline(string id = null) : base(id) { - // BackgroundColor = LayoutSchema.HeadlineBackground; } /// @@ -205,7 +204,6 @@ public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTre new ControlText() { Text = I18N.Translate(renderContext.Request?.Culture, renderContext.PageContext?.PageTitle), - //TextColor = LayoutSchema.HeadlineTitle, Format = TypeFormatText.H2, Padding = new PropertySpacingPadding(PropertySpacing.Space.One), Margin = new PropertySpacingMargin(PropertySpacing.Space.None, PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.Null) diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppMain.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppMain.cs index d34338f..4760120 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppMain.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppMain.cs @@ -36,12 +36,12 @@ public class ControlWebAppMain : Control /// /// Returns the page properties. /// - public ControlWebAppProperty Property { get; } = new ControlWebAppProperty("webexpress-webapp-content-property"); + public ControlWebAppProperty Property { get; } = new ControlWebAppProperty("wx-content-main-property"); /// /// Returns the headline control. /// - public ControlWebAppHeadline Headline { get; } = new ControlWebAppHeadline("webexpress-webapp-content-main-headline"); + public ControlWebAppHeadline Headline { get; } = new ControlWebAppHeadline("wx-content-main-headline"); /// /// Initializes a new instance of the class. diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppProperty.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppProperty.cs index 3d96204..5049e6e 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppProperty.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppProperty.cs @@ -40,7 +40,6 @@ public class ControlWebAppProperty : Control public ControlWebAppProperty(string id = null) : base(id) { - //BackgroundColor = LayoutSchema.PropertyBackground; } /// diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppSettingTab.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppSettingTab.cs index 2f376f4..ea04583 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppSettingTab.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppSettingTab.cs @@ -44,7 +44,6 @@ public ControlWebAppSettingTab(string id = null) : base(id) { Padding = new PropertySpacingPadding(PropertySpacing.Space.Null); - //BackgroundColor = LayoutSchema.HeaderBackground; } /// diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppSidebar.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppSidebar.cs index 4106932..0d02a96 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppSidebar.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppSidebar.cs @@ -133,7 +133,7 @@ public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTre var sidebarCtlr = items.Any() ? new ControlPanelFlexbox(Id, [.. items]) { - Classes = ["sidebar"], + Classes = ["wx-sidebar"], //BackgroundColor = new PropertyColorButton(TypeColorButton.Dark), Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.None, PropertySpacing.Space.None) } : diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppToolbar.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppToolbar.cs index 993d1e7..5e3c966 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppToolbar.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppToolbar.cs @@ -36,7 +36,7 @@ public class ControlWebAppToolbar : ControlToolbar /// /// Returns the quick create. /// - public ControlWebAppToolbarMore More { get; } = new ControlWebAppToolbarMore("webexpress-webapp-toolbar-more") + public ControlWebAppToolbarMore More { get; } = new ControlWebAppToolbarMore("wx-content-toolbar-more") { }; @@ -48,7 +48,6 @@ public ControlWebAppToolbar(string id = null) : base(id) { Padding = new PropertySpacingPadding(PropertySpacing.Space.Null); - //BackgroundColor = LayoutSchema.HeaderBackground; } /// diff --git a/src/WebExpress.WebApp/WebPage/LayoutSchema.cs b/src/WebExpress.WebApp/WebPage/LayoutSchema.cs deleted file mode 100644 index a909a86..0000000 --- a/src/WebExpress.WebApp/WebPage/LayoutSchema.cs +++ /dev/null @@ -1,197 +0,0 @@ -//using WebExpress.WebUI.WebControl; - -//namespace WebExpress.WebApp.WebPage -//{ -// public static class LayoutSchema -// { -// /// -// /// The background color of the header. -// /// -// public static PropertyColorBackground HeaderBackground => new(TypeColorBackground.Dark); - -// /// -// /// The color of the header title. -// /// -// public static PropertyColorText HeaderTitle => new(TypeColorText.Light); - -// /// -// /// The color of the header link. -// /// -// public static PropertyColorText HeaderNavigationLink => new(TypeColorText.Light); - -// /// -// /// The color of the active background. -// /// -// public static PropertyColorBackground HeaderNavigationActiveBackground => new(); - -// /// -// /// The color of the active. -// /// -// public static PropertyColorText HeaderNavigationActive => new(TypeColorText.Info); - -// /// -// /// The background color of the quick button. -// /// -// public static PropertyColorButton HeaderQuickCreateButtonBackground => new(TypeColorButton.Success); - -// /// -// /// The size of the quick button. -// /// -// public static TypeSizeButton HeaderQuickCreateButtonSize => TypeSizeButton.Small; - -// /// -// /// The color of the navigation on the left. -// /// -// public static PropertyColorText NavigationLink => new(TypeColorText.Primary); - -// /// -// /// The color of the property background. -// /// -// public static PropertyColorBackground NavigationActiveBackground => new(TypeColorBackground.Primary); - -// /// -// /// The active color in the navigation pane. -// /// -// public static PropertyColorText NavigationActive => new(TypeColorText.Light); - -// /// -// /// The color of the property link. -// /// -// public static PropertyColorText Link => new(TypeColorText.Dark); - -// /// -// /// The background color of the sidebar area. -// /// -// public static PropertyColorBackground SidebarBackground => new(TypeColorBackground.Light); - -// /// -// /// The color of the active sidebar background. -// /// -// public static PropertyColorBackground SidebarNavigationActiveBackground => new(TypeColorBackground.Info); - -// /// -// /// The color of the active sidebar navigation. -// /// -// public static PropertyColorText SidebarNavigationActive => new(TypeColorText.Light); - -// /// -// /// The color of the active sidebar navigation link. -// /// -// public static PropertyColorText SidebarNavigationLink => new(TypeColorText.Dark); - -// /// -// /// The color of the splitter. -// /// -// public static PropertyColorBackground SplitterColor => new(TypeColorBackground.Light); - -// /// -// /// The background color of the headline area. -// /// -// public static PropertyColorBackground HeadlineBackground => new(); - -// /// -// /// The color of the headline title. -// /// -// public static PropertyColorText HeadlineTitle => new(TypeColorText.Dark); - -// /// -// /// The background color of the property area. -// /// -// public static PropertyColorBackground PropertyBackground => new("#C6E2FF"); - -// /// -// /// The color of the active property navigation background. -// /// -// public static PropertyColorBackground PropertyNavigationActiveBackground => new(TypeColorBackground.Info); - -// /// -// /// The color of the active property navigation. -// /// -// public static PropertyColorText PropertyNavigationActive => new(TypeColorText.Light); - -// /// -// /// The color of the active property navigation link. -// /// -// public static PropertyColorText PropertyNavigationLink => new(TypeColorText.Dark); - -// /// -// /// The background color of the breadcrumb area. -// /// -// public static PropertyColorBackground BreadcrumbBackground => new(); - -// /// -// /// The size of the breadcrumb area. -// /// -// public static TypeSizeButton BreadcrumbSize => TypeSizeButton.Small; - -// /// -// /// The Toolbar background color. -// /// -// public static PropertyColorBackground ToolbarBackground => new(); - -// /// -// /// The link color of the toolbar. -// /// -// public static PropertyColorText ToolbarLink => new(TypeColorText.Dark); - -// /// -// /// The background color of the content area. -// /// -// public static PropertyColorBackground ContentBackground => new(); - -// /// -// /// The background color of the form area. -// /// -// public static PropertyColorBackground FormBackground => new(TypeColorBackground.Light); - -// /// -// /// The background color of a button. -// /// -// public static PropertyColorButton ButtonBackground => new(TypeColorButton.Success); - -// /// -// /// The background color of the submit button. -// /// -// public static PropertyColorButton SubmitButtonBackground => new(TypeColorButton.Success); - -// /// -// /// The background color of the next button. -// /// -// public static PropertyColorButton NextButtonBackground => new(TypeColorButton.Success); - -// /// -// /// The background color of the cancel button. -// /// -// public static PropertyColorButton CancelButtonBackground => new(TypeColorButton.Secondary); - -// /// -// /// The background color of the close button. -// /// -// public static PropertyColorButton CloseButtonBackground => new(TypeColorButton.Primary); - -// /// -// /// The background color of a validation error message. -// /// -// public static PropertyColorBackground ValidationErrorBackground => new PropertyColorBackgroundAlert(TypeColorBackground.Danger); - -// /// -// /// The background color of a validation warning message. -// /// -// public static PropertyColorBackground ValidationWarningBackground => new PropertyColorBackgroundAlert(TypeColorBackground.Warning); - -// /// -// /// The background color of a validation success message. -// /// -// public static PropertyColorBackground ValidationSuccessBackground => new PropertyColorBackgroundAlert(TypeColorBackground.Success); - -// /// -// /// The background color of the footer. -// /// -// public static PropertyColorBackground FooterBackground => new(TypeColorBackground.Light); - -// /// -// /// The text color color of the footer. -// /// -// public static PropertyColorText FooterText => new(TypeColorText.Secondary); -// } -//} diff --git a/src/WebExpress.WebApp/WebPage/PageWebApp.cs b/src/WebExpress.WebApp/WebPage/PageWebApp.cs index ec0a12b..eb581f6 100644 --- a/src/WebExpress.WebApp/WebPage/PageWebApp.cs +++ b/src/WebExpress.WebApp/WebPage/PageWebApp.cs @@ -1,234 +1,26 @@ -//using System.Collections.Generic; -//using System.Linq; -//using WebExpress.WebApp.WebApiControl; -//using WebExpress.WebApp.WebSection; -//using WebExpress.WebCore.WebComponent; -//using WebExpress.WebCore.WebHtml; -//using WebExpress.WebCore.WebResource; -//using WebExpress.WebCore.WebUri; -//using WebExpress.WebUI.WebControl; -//using WebExpress.WebUI.WebFragment; -//using WebExpress.WebUI.WebPage; - -//namespace WebExpress.WebApp.WebPage -//{ -// /// -// /// Page consisting of a vertically arranged header, content and footer area. -// /// -// public abstract class PageWebApp : PageControl -// { -// // header -// private List HeaderAppNavigatorPreferences { get; } = []; -// private List HeaderAppNavigatorPrimary { get; } = []; -// private List HeaderAppNavigatorSecondary { get; } = []; -// private List HeaderNavigationPreferences { get; } = []; -// private List HeaderNavigationPrimary { get; } = []; -// private List HeaderNavigationSecondary { get; } = []; -// private List HeaderQuickCreatePreferences { get; } = []; -// private List HeaderQuickCreatePrimary { get; } = []; -// private List HeaderQuickCreateSecondary { get; } = []; -// private List HeaderHelpPreferences { get; } = []; -// private List HeaderHelpPrimary { get; } = []; -// private List HeaderHelpSecondary { get; } = []; -// private List HeaderSettingsPreferences { get; } = []; -// private List HeaderSettingsPrimary { get; } = []; -// private List HeaderSettingsSecondary { get; } = []; - -// // sidebar -// private List SidebarHeader { get; } = []; -// private List SidebarPreferences { get; } = []; -// private List SidebarPrimary { get; } = []; -// private List SidebarSecondary { get; } = []; - -// // headline -// private List ContentHeadlinePrologue { get; } = []; -// private List ContentHeadlinePreferences { get; } = []; -// private List ContentHeadlinePrimary { get; } = []; -// private List ContentHeadlineSecondary { get; } = []; -// private List ContentHeadlineMorePreferences { get; } = []; -// private List ContentHeadlineMorePrimary { get; } = []; -// private List ContentHeadlineMoreSecondary { get; } = []; -// private List ContentHeadlineMetadata { get; } = []; - -// // property -// private List ContentPropertyPreferences { get; } = []; -// private List ContentPropertyPrimary { get; } = []; -// private List ContentPropertySecondary { get; } = []; - -// // content -// private List ContentPreferences { get; } = []; -// private List ContentPrimary { get; } = []; -// private List ContentSecondary { get; } = []; - -// // footer -// private List FooterPreferences { get; } = []; -// private List FooterPrimary { get; } = []; -// private List FooterSecondary { get; } = []; - -// /// -// /// Initializes a new instance of the class. -// /// -// public PageWebApp() -// { -// } - -// /// -// /// Initialization -// /// -// /// The context. -// public override void Initialization(IResourceContext context) -// { -// base.Initialization(context); - -// var fm = ComponentManager.GetComponent(); -// var module = ComponentManager.ModuleManager.GetModule(ApplicationContext, typeof(Module)); -// if (module != null) -// { -// CssLinks.Add(UriResource.Combine(module.ContextPath, "/assets/css/webexpress.webapp.css")); -// CssLinks.Add(UriResource.Combine(module.ContextPath, "/assets/css/webexpress.webapp.popupnotification.css")); -// CssLinks.Add(UriResource.Combine(module.ContextPath, "/assets/css/webexpress.webapp.taskprogressbar.css")); -// HeaderScriptLinks.Add(UriResource.Combine(module.ContextPath, "assets/js/webexpress.webapp.js")); -// HeaderScriptLinks.Add(UriResource.Combine(module.ContextPath, "assets/js/webexpress.webapp.popupnotification.js")); -// HeaderScriptLinks.Add(UriResource.Combine(module.ContextPath, "assets/js/webexpress.webapp.selection.js")); -// HeaderScriptLinks.Add(UriResource.Combine(module.ContextPath, "assets/js/webexpress.webapp.table.js")); -// HeaderScriptLinks.Add(UriResource.Combine(module.ContextPath, "assets/js/webexpress.webapp.taskprogressbar.js")); -// } - -// // header -// HeaderAppNavigatorPreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.AppPreferences, this, context.Scopes)); -// HeaderAppNavigatorPrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppPrimary, this, context.Scopes)); -// HeaderAppNavigatorSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppSecondary, this, context.Scopes)); -// HeaderNavigationPreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.AppNavigationPreferences, this, context.Scopes)); -// HeaderNavigationPrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppNavigationPrimary, this, context.Scopes)); -// HeaderNavigationSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppNavigationSecondary, this, context.Scopes)); -// HeaderQuickCreatePreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.AppQuickcreatePreferences, this, context.Scopes)); -// HeaderQuickCreatePrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppQuickcreatePrimary, this, context.Scopes)); -// HeaderQuickCreateSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppQuickcreateSecondary, this, context.Scopes)); -// HeaderHelpPreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.AppHelpPreferences, this, context.Scopes)); -// HeaderHelpPrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppHelpPrimary, this, context.Scopes)); -// HeaderHelpSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppHelpSecondary, this, context.Scopes)); -// HeaderSettingsPrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppSettingsPrimary, this, context.Scopes)); -// HeaderSettingsSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.AppSettingsSecondary, this, context.Scopes)); - -// // sidebar -// SidebarHeader.AddRange(fm.GetCacheableFragments(SectionWebApp.SidebarHeader, this, context.Scopes)); -// SidebarPreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.SidebarPreferences, this, context.Scopes)); -// SidebarPrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.SidebarPrimary, this, context.Scopes)); -// SidebarSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.SidebarSecondary, this, context.Scopes)); - -// // headline -// ContentHeadlinePrologue.AddRange(fm.GetCacheableFragments(SectionWebApp.HeadlinePrologue, this, context.Scopes)); -// ContentHeadlinePreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.HeadlinePreferences, this, context.Scopes)); -// ContentHeadlinePrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.HeadlinePrimary, this, context.Scopes)); -// ContentHeadlineSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.HeadlineSecondary, this, context.Scopes)); -// ContentHeadlineMorePreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.MorePreferences, this, context.Scopes)); -// ContentHeadlineMorePrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.MorePrimary, this, context.Scopes)); -// ContentHeadlineMoreSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.MoreSecondary, this, context.Scopes)); -// ContentHeadlineMetadata.AddRange(fm.GetCacheableFragments(SectionWebApp.Metadata, this, context.Scopes)); - -// // property -// ContentPropertyPreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.PropertyPreferences, this, context.Scopes)); -// ContentPropertyPrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.PropertyPrimary, this, context.Scopes)); -// ContentPropertySecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.PropertySecondary, this, context.Scopes)); - -// // content -// ContentPreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.ContentPreferences, this, context.Scopes)); -// ContentPrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.ContentPrimary, this, context.Scopes)); -// ContentSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.ContentSecondary, this, context.Scopes)); - -// // footer -// FooterPreferences.AddRange(fm.GetCacheableFragments(SectionWebApp.FooterPreferences, this, context.Scopes)); -// FooterPrimary.AddRange(fm.GetCacheableFragments(SectionWebApp.FooterPrimary, this, context.Scopes)); -// FooterSecondary.AddRange(fm.GetCacheableFragments(SectionWebApp.FooterSecondary, this, context.Scopes)); -// } - -// /// -// /// Processing of the resource. -// /// -// /// The context for rendering the page. -// public override void Process(RenderContextWebApp context) -// { -// base.Process(context); - -// context.VisualTree.Favicons.Add(new Favicon(context.ApplicationContext?.Icon)); -// //context.VisualTree.Header.Logo = context.Application?.Icon; -// //context.VisualTree.Header.AppTitle.Title = this.I18N(context.Application, context.Application?.ApplicationName); - -// context.VisualTree.Breadcrumb.Uri = context.Uri; - -// // header -// context.VisualTree.Header.AppNavigator.Preferences.AddRange(HeaderAppNavigatorPreferences.SelectMany(x => x.CreateInstance(this, context.Request))); -// context.VisualTree.Header.AppNavigator.Primary.AddRange(HeaderAppNavigatorPrimary.SelectMany(x => x.CreateInstance(this, context.Request))); -// context.VisualTree.Header.AppNavigator.Secondary.AddRange(HeaderAppNavigatorSecondary.SelectMany(x => x.CreateInstance(this, context.Request))); -// context.VisualTree.Header.AppNavigation.Preferences.AddRange(HeaderNavigationPreferences.SelectMany(x => x.CreateInstance(this, context.Request))); -// context.VisualTree.Header.AppNavigation.Primary.AddRange(HeaderNavigationPrimary.SelectMany(x => x.CreateInstance(this, context.Request))); -// context.VisualTree.Header.AppNavigation.Secondary.AddRange(HeaderNavigationSecondary.SelectMany(x => x.CreateInstance(this, context.Request))); -// context.VisualTree.Header.QuickCreate.Preferences.AddRange(HeaderQuickCreatePreferences.SelectMany(x => x.CreateInstance(this, context.Request))); -// context.VisualTree.Header.QuickCreate.Primary.AddRange(HeaderQuickCreatePrimary.SelectMany(x => x.CreateInstance(this, context.Request))); -// context.VisualTree.Header.QuickCreate.Secondary.AddRange(HeaderQuickCreateSecondary.SelectMany(x => x.CreateInstance(this, context.Request))); -// context.VisualTree.Header.Help.Preferences.AddRange(HeaderHelpPreferences.SelectMany(x => x.CreateInstance(this, context.Request))); -// context.VisualTree.Header.Help.Primary.AddRange(HeaderHelpPrimary.SelectMany(x => x.CreateInstance(this, context.Request))); -// context.VisualTree.Header.Help.Secondary.AddRange(HeaderHelpSecondary.SelectMany(x => x.CreateInstance(this, context.Request))); -// context.VisualTree.Header.Settings.Preferences.AddRange(HeaderSettingsPreferences.SelectMany(x => x.CreateInstance(this, context.Request))); -// context.VisualTree.Header.Settings.Primary.AddRange(HeaderSettingsPrimary.SelectMany(x => x.CreateInstance(this, context.Request))); -// context.VisualTree.Header.Settings.Secondary.AddRange(HeaderSettingsSecondary.SelectMany(x => x.CreateInstance(this, context.Request))); - -// // sidebar -// context.VisualTree.Sidebar.Header.AddRange(SidebarHeader.SelectMany(x => x.CreateInstance(this, context.Request))); -// context.VisualTree.Sidebar.Preferences.AddRange(SidebarPreferences.SelectMany(x => x.CreateInstance(this, context.Request))); -// context.VisualTree.Sidebar.Primary.AddRange(SidebarPrimary.SelectMany(x => x.CreateInstance(this, context.Request))); -// context.VisualTree.Sidebar.Secondary.AddRange(SidebarSecondary.SelectMany(x => x.CreateInstance(this, context.Request))); - -// // headline -// context.VisualTree.Content.Headline.Prologue.AddRange(ContentHeadlinePrologue.SelectMany(x => x.CreateInstance(this, context.Request))); -// context.VisualTree.Content.Headline.Preferences.AddRange(ContentHeadlinePreferences.SelectMany(x => x.CreateInstance(this, context.Request))); -// context.VisualTree.Content.Headline.Primary.AddRange(ContentHeadlinePrimary.SelectMany(x => x.CreateInstance(this, context.Request))); -// context.VisualTree.Content.Headline.Secondary.AddRange(ContentHeadlineSecondary.SelectMany(x => x.CreateInstance(this, context.Request))); -// context.VisualTree.Content.Headline.MorePreferences.AddRange(ContentHeadlineMorePreferences.SelectMany(x => x.CreateInstance(this, context.Request))); -// context.VisualTree.Content.Headline.MorePrimary.AddRange(ContentHeadlineMorePrimary.SelectMany(x => x.CreateInstance(this, context.Request))); -// context.VisualTree.Content.Headline.MoreSecondary.AddRange(ContentHeadlineMoreSecondary.SelectMany(x => x.CreateInstance(this, context.Request))); -// context.VisualTree.Content.Headline.Metadata.AddRange(ContentHeadlineMetadata.SelectMany(x => x.CreateInstance(this, context.Request))); - -// // property -// context.VisualTree.Content.Property.Preferences.AddRange(ContentPropertyPreferences.SelectMany(x => x.CreateInstance(this, context.Request))); -// context.VisualTree.Content.Property.Primary.AddRange(ContentPropertyPrimary.SelectMany(x => x.CreateInstance(this, context.Request))); -// context.VisualTree.Content.Property.Secondary.AddRange(ContentPropertySecondary.SelectMany(x => x.CreateInstance(this, context.Request))); - -// // content -// context.VisualTree.Content.Preferences.AddRange(ContentPreferences.SelectMany(x => x.CreateInstance(this, context.Request))); -// context.VisualTree.Content.Primary.AddRange(ContentPrimary.SelectMany(x => x.CreateInstance(this, context.Request))); -// context.VisualTree.Content.Secondary.AddRange(ContentSecondary.SelectMany(x => x.CreateInstance(this, context.Request))); - -// // footer -// context.VisualTree.Footer.Preferences.AddRange(FooterPreferences.SelectMany(x => x.CreateInstance(this, context.Request))); -// context.VisualTree.Footer.Primary.AddRange(FooterPrimary.SelectMany(x => x.CreateInstance(this, context.Request))); -// context.VisualTree.Footer.Secondary.AddRange(FooterSecondary.SelectMany(x => x.CreateInstance(this, context.Request))); - -// if (context.VisualTree is VisualTreeControl visualTreeControl) -// { -// var split = new ControlPanelSplit -// ( -// "split", -// [context.VisualTree.Sidebar], -// [context.VisualTree.Content] -// ) -// { -// Orientation = TypeOrientationSplit.Horizontal, -// SplitterColor = LayoutSchema.SplitterColor, -// Panel1InitialSize = 20, -// Panel1MinSize = 150, -// Styles = ["min-height: 85%;"] -// }; - -// visualTreeControl.Content.Add(context.VisualTree.Header); -// visualTreeControl.Content.Add(context.VisualTree.Toast); -// visualTreeControl.Content.Add(context.VisualTree.Breadcrumb); -// visualTreeControl.Content.Add(context.VisualTree.Prologue); -// visualTreeControl.Content.Add(context.VisualTree.SearchOptions); -// visualTreeControl.Content.Add(context.VisualTree.Sidebar.HasContent ? split : context.VisualTree.Content); -// visualTreeControl.Content.Add(context.VisualTree.Footer); -// visualTreeControl.Content.Add(new ControlApiNotificationPopup("popup_notification")); -// } -// } -// } -//} +using WebExpress.WebCore.WebPage; + +namespace WebExpress.WebApp.WebPage +{ + /// + /// Represents an abstract base class for a web application page. + /// + public abstract class PageWebApp : IPage + { + /// + /// Initializes a new instance of the class. + /// + public PageWebApp() + { + } + + /// + /// Processing of the page. + /// + /// The context for rendering the page. + /// The visual tree control to be processed. + public virtual void Process(IRenderContext renderContext, VisualTreeWebApp visualTree) + { + } + } +} diff --git a/src/WebExpress.WebApp/WebPage/VisualTreeWebApp.cs b/src/WebExpress.WebApp/WebPage/VisualTreeWebApp.cs index 5679abf..0891866 100644 --- a/src/WebExpress.WebApp/WebPage/VisualTreeWebApp.cs +++ b/src/WebExpress.WebApp/WebPage/VisualTreeWebApp.cs @@ -26,48 +26,48 @@ public class VisualTreeWebApp : VisualTreeControl /// /// Returns header control. /// - public ControlWebAppHeader Header { get; } = new ControlWebAppHeader("webexpress-webapp-header"); + public ControlWebAppHeader Header { get; } = new ControlWebAppHeader("wx-header"); /// /// Returns the area for the toast messages control. /// - public ControlPanelToast Toast { get; protected set; } = new ControlPanelToast("webexpress-webapp-toast"); + public ControlPanelToast Toast { get; protected set; } = new ControlPanelToast("wx-toast"); /// /// Returns the range for the path specification. /// - public ControlBreadcrumb Breadcrumb { get; protected set; } = new ControlBreadcrumb("webexpress-webapp-breadcrumb"); + public ControlBreadcrumb Breadcrumb { get; protected set; } = new ControlBreadcrumb("wx-breadcrumb"); /// /// Returns the area for prologue. /// - public ControlPanel Prologue { get; protected set; } = new ControlPanel("webexpress-webapp-prologue"); + public ControlPanel Prologue { get; protected set; } = new ControlPanel("wx-prologue"); ///// ///// Returns the range for the search options control. ///// - //public ControlPanel SearchOptions { get; protected set; } = new ControlPanel("webexpress.webapp.searchoptions"); + //public ControlPanel SearchOptions { get; protected set; } = new ControlPanel("wx-searchoptions"); /// /// Returns the sidebar control. /// - public ControlWebAppSidebar Sidebar { get; protected set; } = new ControlWebAppSidebar("webexpress-webapp-sidebar"); + public ControlWebAppSidebar Sidebar { get; protected set; } = new ControlWebAppSidebar("wx-sidebar"); /// /// Returns the content control. /// - public new ControlWebAppContent Content { get; protected set; } = new ControlWebAppContent("webexpress-webapp-content"); + public new ControlWebAppContent Content { get; protected set; } = new ControlWebAppContent("wx-content"); /// /// Returns the footer control. /// - public ControlWebAppFooter Footer { get; protected set; } = new ControlWebAppFooter("webexpress-webapp-footer"); + public ControlWebAppFooter Footer { get; protected set; } = new ControlWebAppFooter("wx-footer"); /// /// Returns the control for displaying notification popups via API. /// - public ControlApiNotificationPopup NotificationPopup { get; protected set; } = new ControlApiNotificationPopup("webexpress-webapp-notificationpopup"); + public ControlApiNotificationPopup NotificationPopup { get; protected set; } = new ControlApiNotificationPopup("wx-notificationpopup"); /// /// Initializes a new instance of the class. @@ -82,19 +82,10 @@ public VisualTreeWebApp(IComponentHub componentHub, IPageContext pageContext) Header.Fixed = TypeFixed.Top; Header.Styles = new List(["position: sticky; top: 0; z-index: 99;"]); - //Toast.BackgroundColor = LayoutSchema.ValidationWarningBackground; Breadcrumb.Uri = pageContext?.Uri; Breadcrumb.Margin = new PropertySpacingMargin(PropertySpacing.Space.Null); - //Breadcrumb.BackgroundColor = LayoutSchema.BreadcrumbBackground; - //Breadcrumb.Size = LayoutSchema.BreadcrumbSize; - - //Sidebar.BackgroundColor = LayoutSchema.SidebarBackground; - - //Content.BackgroundColor = LayoutSchema.ContentBackground; Content.Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.None, PropertySpacing.Space.None); - //Footer.BackgroundColor = LayoutSchema.FooterBackground; - AddCssLink(UriResource.Combine(applicationContext?.ContextPath, "/assets/css/webexpress.webapp.css")); AddCssLink(UriResource.Combine(applicationContext?.ContextPath, "/assets/css/webexpress.webapp.popupnotification.css")); AddCssLink(UriResource.Combine(applicationContext?.ContextPath, "/assets/css/webexpress.webapp.taskprogressbar.css")); @@ -137,14 +128,13 @@ public override IHtmlNode Render(IVisualTreeContext context) var split = new ControlPanelSplit ( - "webexpress-webapp-split", + "wx-split", [Sidebar], [Content] ) { Border = new PropertyBorder(true), Orientation = TypeOrientationSplit.Horizontal, - //SplitterColor = LayoutSchema.SplitterColor, Panel1InitialSize = 20, Panel1MinSize = 150 }; diff --git a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingPlugin.cs b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingPlugin.cs index 056e9ae..562407e 100644 --- a/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingPlugin.cs +++ b/src/WebExpress.WebApp/WebSettingPage/PageWebAppSettingPlugin.cs @@ -35,7 +35,7 @@ // /// // /// The id of the web task for importing a plugin. // /// -// private const string TaskId = "webexpress-webapp-plugin-upload"; +// private const string TaskId = "wx-plugin-upload"; // /// // /// Returns the label control. diff --git a/src/WebExpress.WebApp/WebSettingPage/VisualTreeWebAppSetting.cs b/src/WebExpress.WebApp/WebSettingPage/VisualTreeWebAppSetting.cs index 5a3b1c8..1745ad2 100644 --- a/src/WebExpress.WebApp/WebSettingPage/VisualTreeWebAppSetting.cs +++ b/src/WebExpress.WebApp/WebSettingPage/VisualTreeWebAppSetting.cs @@ -18,12 +18,12 @@ public class VisualTreeWebAppSetting : VisualTreeWebApp /// /// Returns the area for setting tab. /// - public ControlWebAppSettingTab SettingTab { get; protected set; } = new ControlWebAppSettingTab("webexpress-webapp-settingtab"); + public ControlWebAppSettingTab SettingTab { get; protected set; } = new ControlWebAppSettingTab("wx-settingtab"); /// /// Returns the sidebar control. /// - public new ControlWebAppSettingMenu Sidebar { get; protected set; } = new ControlWebAppSettingMenu("webexpress-webapp-settingmenu"); + public new ControlWebAppSettingMenu Sidebar { get; protected set; } = new ControlWebAppSettingMenu("wx-settingmenu"); /// /// Initializes a new instance of the class. @@ -66,14 +66,13 @@ public override IHtmlNode Render(IVisualTreeContext context) var split = new ControlPanelSplit ( - "webexpress-webapp-split", + "wx-split", [Sidebar], [Content] ) { Border = new PropertyBorder(true), Orientation = TypeOrientationSplit.Horizontal, - //SplitterColor = LayoutSchema.SplitterColor, Panel1InitialSize = 20, Panel1MinSize = 150 }; From 4d6b40e283a03b323df3bfdb68227f847db23411 Mon Sep 17 00:00:00 2001 From: Rene Schwarzer Date: Sat, 29 Mar 2025 21:25:41 +0100 Subject: [PATCH 25/30] feat: update resources to use IUri references --- .../Fixture/UnitTestControlFixture.cs | 7 ++++--- .../UnitTestControlWebAppContent.cs | 4 ++-- .../UnitTestControlWebAppHeaderAppTitle.cs | 4 ++-- .../ControlApiNotificationPopup.cs | 2 +- .../ControlWebAppHeaderAppNavigator.cs | 4 ++-- .../WebControl/ControlWebAppHeaderSettings.cs | 6 +++--- .../WebControl/ControlWebAppSettingMenu.cs | 6 +++--- .../WebControl/ControlWebAppSettingTab.cs | 2 +- .../WebPage/VisualTreeWebApp.cs | 21 ++++++++++--------- 9 files changed, 29 insertions(+), 27 deletions(-) diff --git a/src/WebExpress.WebApp.Test/Fixture/UnitTestControlFixture.cs b/src/WebExpress.WebApp.Test/Fixture/UnitTestControlFixture.cs index e91db58..8ee0558 100644 --- a/src/WebExpress.WebApp.Test/Fixture/UnitTestControlFixture.cs +++ b/src/WebExpress.WebApp.Test/Fixture/UnitTestControlFixture.cs @@ -7,6 +7,7 @@ using WebExpress.WebCore; using WebExpress.WebCore.WebApplication; using WebExpress.WebCore.WebComponent; +using WebExpress.WebCore.WebEndpoint; using WebExpress.WebCore.WebLog; using WebExpress.WebCore.WebMessage; using WebExpress.WebCore.WebPage; @@ -38,13 +39,13 @@ public static IHttpServerContext CreateHttpServerContextMock() { return new HttpServerContext ( - "localhost", + new RouteEndpoint("localhost"), [], "", Environment.CurrentDirectory, Environment.CurrentDirectory, Environment.CurrentDirectory, - new UriResource("/server"), + new RouteEndpoint("/server"), CultureInfo.GetCultureInfo("en"), new Log() { LogMode = LogMode.Off }, null @@ -106,7 +107,7 @@ public static Request CrerateRequestMock(string content = "", string uri = "") if (!string.IsNullOrEmpty(uri)) { var uriProperty = typeof(Request).GetProperty("Uri", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); - uriProperty.SetValue(request, new UriResource(uri)); + uriProperty.SetValue(request, new UriEndpoint(uri)); } return request; diff --git a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppContent.cs b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppContent.cs index 32dd36e..00cc8b3 100644 --- a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppContent.cs +++ b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppContent.cs @@ -14,8 +14,8 @@ public class UnitTestControlWebAppContent /// Tests the id property of the web app content control. /// [Theory] - [InlineData(null, @"
*
")] - [InlineData("id", @"
*
")] + [InlineData(null, @"
*
")] + [InlineData("id", @"
*
")] public void Id(string id, string expected) { // preconditions diff --git a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderAppTitle.cs b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderAppTitle.cs index 36f064e..38bcc29 100644 --- a/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderAppTitle.cs +++ b/src/WebExpress.WebApp.Test/WebControl/UnitTestControlWebAppHeaderAppTitle.cs @@ -14,8 +14,8 @@ public class UnitTestControlWebAppHeaderAppTitle /// Tests the id property of the web app header app title control. ///
[Theory] - [InlineData(null, @"

TestApplication

")] - [InlineData("id", @"

TestApplication

")] + [InlineData(null, @"

TestApplication

")] + [InlineData("id", @"

TestApplication

")] public void Id(string id, string expected) { // preconditions diff --git a/src/WebExpress.WebApp/WebApiControl/ControlApiNotificationPopup.cs b/src/WebExpress.WebApp/WebApiControl/ControlApiNotificationPopup.cs index 1243a15..3e87bd6 100644 --- a/src/WebExpress.WebApp/WebApiControl/ControlApiNotificationPopup.cs +++ b/src/WebExpress.WebApp/WebApiControl/ControlApiNotificationPopup.cs @@ -35,7 +35,7 @@ public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTre var settings = new { id = "26E517F5-56F7-485E-A212-6033618708F3", - resturi = applicationContext?.ContextPath.Append("api/1/popupnotifications")?.ToString(), + resturi = applicationContext?.ContextPath.Concat("api/1/popupnotifications")?.ToString(), intervall = 15000 }; diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigator.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigator.cs index b3189a2..bd3a218 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigator.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderAppNavigator.cs @@ -112,14 +112,14 @@ public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTre var navigatorCtrl = items.Any() ? (IControl)new ControlDropdown(Id, [.. items]) { - Image = application?.Icon, + Image = application?.Icon.ToString(), Height = 50, Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None), Styles = ["padding: 0.5em;"] } : new ControlImage(Id) { - Uri = application?.Icon, + Uri = application?.Icon.ToUri(), Height = 50, Padding = new PropertySpacingPadding(PropertySpacing.Space.Two), Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None) diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs index 506953f..1b646a2 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppHeaderSettings.cs @@ -139,7 +139,7 @@ private IEnumerable GetItems(IRenderControlContext renderC x => new ControlDropdownItemLink() { Text = I18N.Translate(renderContext, x?.Name), - Uri = settinPageManager.GetFirstSettingPage(appicationContext, x)?.Uri, + Uri = settinPageManager.GetFirstSettingPage(appicationContext, x)?.Route.ToUri(), Icon = x.Icon } ); @@ -150,7 +150,7 @@ private IEnumerable GetItems(IRenderControlContext renderC x => new ControlDropdownItemLink() { Text = I18N.Translate(renderContext, x?.Name), - Uri = settinPageManager.GetFirstSettingPage(appicationContext, x)?.Uri, + Uri = settinPageManager.GetFirstSettingPage(appicationContext, x)?.Route.ToUri(), Icon = x.Icon } ); @@ -161,7 +161,7 @@ private IEnumerable GetItems(IRenderControlContext renderC x => new ControlDropdownItemLink() { Text = I18N.Translate(renderContext, x?.Name), - Uri = settinPageManager.GetFirstSettingPage(appicationContext, x)?.Uri, + Uri = settinPageManager.GetFirstSettingPage(appicationContext, x)?.Route.ToUri(), Icon = x.Icon } ); diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppSettingMenu.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppSettingMenu.cs index d39c9a7..c795fff 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppSettingMenu.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppSettingMenu.cs @@ -56,7 +56,7 @@ protected override IEnumerable GetItems(IRenderControlContext renderCo { Text = page.PageTitle, Icon = page.Icon, - Uri = page?.Uri, + Uri = page?.Route.ToUri(), Active = page == renderContext.PageContext ? TypeActive.Active : TypeActive.None }); } @@ -72,7 +72,7 @@ protected override IEnumerable GetItems(IRenderControlContext renderCo { Text = page.PageTitle, Icon = page.Icon, - Uri = page?.Uri, + Uri = page?.Route.ToUri(), Active = page == renderContext.PageContext ? TypeActive.Active : TypeActive.None }); } @@ -88,7 +88,7 @@ protected override IEnumerable GetItems(IRenderControlContext renderCo { Text = page.PageTitle, Icon = page.Icon, - Uri = page?.Uri, + Uri = page?.Route.ToUri(), Active = page == renderContext.PageContext ? TypeActive.Active : TypeActive.None }); } diff --git a/src/WebExpress.WebApp/WebControl/ControlWebAppSettingTab.cs b/src/WebExpress.WebApp/WebControl/ControlWebAppSettingTab.cs index ea04583..ef263aa 100644 --- a/src/WebExpress.WebApp/WebControl/ControlWebAppSettingTab.cs +++ b/src/WebExpress.WebApp/WebControl/ControlWebAppSettingTab.cs @@ -139,7 +139,7 @@ private IEnumerable GetItems(IRenderControlContext rende x => new ControlNavigationItemLink() { Text = I18N.Translate(renderContext, x?.Name), - Uri = settinPageManager.GetFirstSettingPage(appicationContext, x).Uri, + Uri = settinPageManager.GetFirstSettingPage(appicationContext, x).Route.ToUri(), Active = settingPageContext.SettingCategory == x ? TypeActive.Active : TypeActive.None } ); diff --git a/src/WebExpress.WebApp/WebPage/VisualTreeWebApp.cs b/src/WebExpress.WebApp/WebPage/VisualTreeWebApp.cs index 0891866..2919f40 100644 --- a/src/WebExpress.WebApp/WebPage/VisualTreeWebApp.cs +++ b/src/WebExpress.WebApp/WebPage/VisualTreeWebApp.cs @@ -4,6 +4,7 @@ using WebExpress.WebApp.WebControl; using WebExpress.WebCore.Internationalization; using WebExpress.WebCore.WebComponent; +using WebExpress.WebCore.WebEndpoint; using WebExpress.WebCore.WebHtml; using WebExpress.WebCore.WebPage; using WebExpress.WebCore.WebTheme; @@ -82,19 +83,19 @@ public VisualTreeWebApp(IComponentHub componentHub, IPageContext pageContext) Header.Fixed = TypeFixed.Top; Header.Styles = new List(["position: sticky; top: 0; z-index: 99;"]); - Breadcrumb.Uri = pageContext?.Uri; + Breadcrumb.Uri = pageContext?.Route.ToUri(); Breadcrumb.Margin = new PropertySpacingMargin(PropertySpacing.Space.Null); Content.Margin = new PropertySpacingMargin(PropertySpacing.Space.Two, PropertySpacing.Space.None, PropertySpacing.Space.None, PropertySpacing.Space.None); - AddCssLink(UriResource.Combine(applicationContext?.ContextPath, "/assets/css/webexpress.webapp.css")); - AddCssLink(UriResource.Combine(applicationContext?.ContextPath, "/assets/css/webexpress.webapp.popupnotification.css")); - AddCssLink(UriResource.Combine(applicationContext?.ContextPath, "/assets/css/webexpress.webapp.taskprogressbar.css")); - AddCssLink(Theme?.ThemeStyle ?? UriResource.Combine(applicationContext?.ContextPath, "/assets/css/webexpress.webapp.theme.css")); - AddHeaderScriptLink(UriResource.Combine(applicationContext?.ContextPath, "assets/js/webexpress.webapp.js")); - AddHeaderScriptLink(UriResource.Combine(applicationContext?.ContextPath, "assets/js/webexpress.webapp.popupnotification.js")); - AddHeaderScriptLink(UriResource.Combine(applicationContext?.ContextPath, "assets/js/webexpress.webapp.selection.js")); - AddHeaderScriptLink(UriResource.Combine(applicationContext?.ContextPath, "assets/js/webexpress.webapp.table.js")); - AddHeaderScriptLink(UriResource.Combine(applicationContext?.ContextPath, "assets/js/webexpress.webapp.taskprogressbar.js")); + AddCssLink(RouteEndpoint.Combine(applicationContext?.ContextPath, "/assets/css/webexpress.webapp.css")); + AddCssLink(RouteEndpoint.Combine(applicationContext?.ContextPath, "/assets/css/webexpress.webapp.popupnotification.css")); + AddCssLink(RouteEndpoint.Combine(applicationContext?.ContextPath, "/assets/css/webexpress.webapp.taskprogressbar.css")); + AddCssLink(Theme?.ThemeStyle.ToString() ?? RouteEndpoint.Combine(applicationContext?.ContextPath, "/assets/css/webexpress.webapp.theme.css")); + AddHeaderScriptLink(RouteEndpoint.Combine(applicationContext?.ContextPath, "assets/js/webexpress.webapp.js")); + AddHeaderScriptLink(RouteEndpoint.Combine(applicationContext?.ContextPath, "assets/js/webexpress.webapp.popupnotification.js")); + AddHeaderScriptLink(RouteEndpoint.Combine(applicationContext?.ContextPath, "assets/js/webexpress.webapp.selection.js")); + AddHeaderScriptLink(RouteEndpoint.Combine(applicationContext?.ContextPath, "assets/js/webexpress.webapp.table.js")); + AddHeaderScriptLink(RouteEndpoint.Combine(applicationContext?.ContextPath, "assets/js/webexpress.webapp.taskprogressbar.js")); } /// From b9b3cf56429d721ea3bf2980f89fa29feec58d8f Mon Sep 17 00:00:00 2001 From: Rene Schwarzer Date: Tue, 1 Apr 2025 22:28:54 +0200 Subject: [PATCH 26/30] feat: bug fixes and general improvements --- .../V1 => WWW/Api/1}/RestPopupNotification.cs | 5 +- .../V1 => WWW/Api/1}/RestTaskStatus.cs | 2 +- .../V1 => WWW/Api/1}/RestUserManagement.cs | 2 +- .../ControlApiNotificationPopup.cs | 4 +- .../WebApiControl/ControlApiTable.cs | 3 +- .../WebApiControl/IControlApi.cs | 6 +- .../WebNotificaation/Notification.cs | 63 ----- .../WebNotificaation/NotificationManager.cs | 253 ------------------ .../SessionPropertyNotification.cs | 14 - .../WebNotificaation/TypeNotification.cs | 46 ---- .../TypeNotificationConverter.cs | 35 --- 11 files changed, 13 insertions(+), 420 deletions(-) rename src/WebExpress.WebApp/{WebApi/V1 => WWW/Api/1}/RestPopupNotification.cs (95%) rename src/WebExpress.WebApp/{WebApi/V1 => WWW/Api/1}/RestTaskStatus.cs (98%) rename src/WebExpress.WebApp/{WebApi/V1 => WWW/Api/1}/RestUserManagement.cs (98%) delete mode 100644 src/WebExpress.WebApp/WebNotificaation/Notification.cs delete mode 100644 src/WebExpress.WebApp/WebNotificaation/NotificationManager.cs delete mode 100644 src/WebExpress.WebApp/WebNotificaation/SessionPropertyNotification.cs delete mode 100644 src/WebExpress.WebApp/WebNotificaation/TypeNotification.cs delete mode 100644 src/WebExpress.WebApp/WebNotificaation/TypeNotificationConverter.cs diff --git a/src/WebExpress.WebApp/WebApi/V1/RestPopupNotification.cs b/src/WebExpress.WebApp/WWW/Api/1/RestPopupNotification.cs similarity index 95% rename from src/WebExpress.WebApp/WebApi/V1/RestPopupNotification.cs rename to src/WebExpress.WebApp/WWW/Api/1/RestPopupNotification.cs index 4730ec3..6fd18f3 100644 --- a/src/WebExpress.WebApp/WebApi/V1/RestPopupNotification.cs +++ b/src/WebExpress.WebApp/WWW/Api/1/RestPopupNotification.cs @@ -7,15 +7,14 @@ using WebExpress.WebCore.WebRestApi; using WebExpress.WebUI.WebNotification; -namespace WebExpress.WebApp.WebAPI.V1 +namespace WebExpress.WebApp.WWW.Api._1 { /// /// Returns the status and progress of a task (WebTask). /// - [Segment("popupnotifications", "")] - [ContextPath("/api")] [Method(CrudMethod.GET)] [Method(CrudMethod.DELETE)] + [IncludeSubPaths(true)] public sealed class RestPopupNotification : IRestApi { private readonly IComponentHub _componentHub; diff --git a/src/WebExpress.WebApp/WebApi/V1/RestTaskStatus.cs b/src/WebExpress.WebApp/WWW/Api/1/RestTaskStatus.cs similarity index 98% rename from src/WebExpress.WebApp/WebApi/V1/RestTaskStatus.cs rename to src/WebExpress.WebApp/WWW/Api/1/RestTaskStatus.cs index 8b4bf77..ddc5b6c 100644 --- a/src/WebExpress.WebApp/WebApi/V1/RestTaskStatus.cs +++ b/src/WebExpress.WebApp/WWW/Api/1/RestTaskStatus.cs @@ -5,7 +5,7 @@ //using WebExpress.WebCore.WebMessage; //using WebExpress.WebCore.WebResource; -//namespace WebExpress.WebApp.WebAPI.V1 +//namespace WebExpress.WebApp.WWW.Api.V1 //{ // /// // /// Determines the status and progress of a task (WebTask). diff --git a/src/WebExpress.WebApp/WebApi/V1/RestUserManagement.cs b/src/WebExpress.WebApp/WWW/Api/1/RestUserManagement.cs similarity index 98% rename from src/WebExpress.WebApp/WebApi/V1/RestUserManagement.cs rename to src/WebExpress.WebApp/WWW/Api/1/RestUserManagement.cs index 78dccd4..dc7bf93 100644 --- a/src/WebExpress.WebApp/WebApi/V1/RestUserManagement.cs +++ b/src/WebExpress.WebApp/WWW/Api/1/RestUserManagement.cs @@ -9,7 +9,7 @@ //using static WebExpress.WebCore.Internationalization.InternationalizationManager; //using WebExpress.WebApp.WebUser.Model; -//namespace WebExpress.WebAPI.V1 +//namespace WebExpress.WebApp.WWW.Api.V1 //{ // /// // /// REST API for user management. diff --git a/src/WebExpress.WebApp/WebApiControl/ControlApiNotificationPopup.cs b/src/WebExpress.WebApp/WebApiControl/ControlApiNotificationPopup.cs index 3e87bd6..ee13e7a 100644 --- a/src/WebExpress.WebApp/WebApiControl/ControlApiNotificationPopup.cs +++ b/src/WebExpress.WebApp/WebApiControl/ControlApiNotificationPopup.cs @@ -1,6 +1,8 @@ using System; using System.Text; using System.Text.Json; +using WebExpress.WebApp.WWW.Api._1; +using WebExpress.WebCore; using WebExpress.WebCore.WebHtml; using WebExpress.WebUI.WebControl; using WebExpress.WebUI.WebPage; @@ -35,7 +37,7 @@ public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTre var settings = new { id = "26E517F5-56F7-485E-A212-6033618708F3", - resturi = applicationContext?.ContextPath.Concat("api/1/popupnotifications")?.ToString(), + resturi = WebEx.ComponentHub.SitemapManager.GetUri(applicationContext).ToString(), intervall = 15000 }; diff --git a/src/WebExpress.WebApp/WebApiControl/ControlApiTable.cs b/src/WebExpress.WebApp/WebApiControl/ControlApiTable.cs index f6e3960..8103ea8 100644 --- a/src/WebExpress.WebApp/WebApiControl/ControlApiTable.cs +++ b/src/WebExpress.WebApp/WebApiControl/ControlApiTable.cs @@ -4,6 +4,7 @@ using System.Text; using System.Text.Json; using WebExpress.WebCore.WebHtml; +using WebExpress.WebCore.WebUri; using WebExpress.WebUI.WebControl; using WebExpress.WebUI.WebPage; @@ -17,7 +18,7 @@ public class ControlApiTable : ControlPanel, IControlApi /// /// Returns or sets the uri that determines the data. /// - public string RestUri { get; set; } + public IUri RestUri { get; set; } /// /// Returns or sets the settings for the editing options (e.g. Edit, Delete, ...). diff --git a/src/WebExpress.WebApp/WebApiControl/IControlApi.cs b/src/WebExpress.WebApp/WebApiControl/IControlApi.cs index df9ff3c..758ba3c 100644 --- a/src/WebExpress.WebApp/WebApiControl/IControlApi.cs +++ b/src/WebExpress.WebApp/WebApiControl/IControlApi.cs @@ -1,4 +1,6 @@ -namespace WebExpress.WebApp.WebApiControl +using WebExpress.WebCore.WebUri; + +namespace WebExpress.WebApp.WebApiControl { /// /// Interface for controlling API interactions. @@ -8,6 +10,6 @@ public interface IControlApi /// /// Returns or sets the uri that determines the data. /// - public string RestUri { get; set; } + public IUri RestUri { get; set; } } } diff --git a/src/WebExpress.WebApp/WebNotificaation/Notification.cs b/src/WebExpress.WebApp/WebNotificaation/Notification.cs deleted file mode 100644 index cf3d7d7..0000000 --- a/src/WebExpress.WebApp/WebNotificaation/Notification.cs +++ /dev/null @@ -1,63 +0,0 @@ -//using System; -//using System.Text.Json.Serialization; - -//namespace WebExpress.WebApp.WebNotificaation -//{ -// public class Notification -// { -// /// -// /// Returns or sets the notification id. -// /// -// [JsonPropertyName("id")] -// public string Id { get; } = Guid.NewGuid().ToString(); - -// /// -// /// Returns or sets the heading. -// /// -// [JsonPropertyName("heading")] -// public string Heading { get; set; } - -// /// -// /// Returns or sets the notification message. -// /// -// [JsonPropertyName("message")] -// public string Message { get; set; } - -// /// -// /// Returns or sets the lifetime of the notification. -// /// -// [JsonPropertyName("durability")] -// public int Durability { get; set; } - -// /// -// /// Returns the icon. Can be null. -// /// -// [JsonPropertyName("icon")] -// public string Icon { get; set; } - -// /// -// /// Returns the creation time. -// /// -// [JsonPropertyName("created")] -// public DateTime Created { get; } = DateTime.Now; - -// /// -// /// Progress as a percentage: 0-100%. <0 Without progress. -// /// -// [JsonPropertyName("progress")] -// public int Progress { get; set; } = -1; - -// /// -// /// Returns or sets the notification type. -// /// -// [JsonPropertyName("type"), JsonConverter(typeof(TypeNotificationConverter))] -// public TypeNotification Type { get; set; } - -// /// -// /// Initializes a new instance of the class. -// /// -// public Notification() -// { -// } -// } -//} diff --git a/src/WebExpress.WebApp/WebNotificaation/NotificationManager.cs b/src/WebExpress.WebApp/WebNotificaation/NotificationManager.cs deleted file mode 100644 index 47668d8..0000000 --- a/src/WebExpress.WebApp/WebNotificaation/NotificationManager.cs +++ /dev/null @@ -1,253 +0,0 @@ -//using System; -//using System.Collections.Generic; -//using System.Linq; -//using WebExpress.WebCore; -//using WebExpress.WebCore.Internationalization; -//using WebExpress.WebCore.WebComponent; -//using WebExpress.WebCore.WebMessage; -//using WebExpress.WebCore.WebPlugin; - -//namespace WebExpress.WebApp.WebNotificaation -//{ -// public sealed class NotificationManager : IComponent -// { -// /// -// /// An event that fires when an notification is created. -// /// -// public event EventHandler CreateNotification; - -// /// -// /// An event that fires when an notification is destroyed. -// /// -// public event EventHandler DestroyNotification; - -// /// -// /// Returns the reference to the context of the host. -// /// -// public IHttpServerContext HttpServerContext { get; private set; } - -// /// -// /// Provides the notification store for global notifications. -// /// -// private static IDictionary GlobalNotifications { get; } = new Dictionary(); - -// /// -// /// Initializes a new instance of the class. -// /// -// internal NotificationManager() -// { -// } - -// /// -// /// Initialization -// /// -// /// The reference to the context of the host. -// public void Initialization(IHttpServerContext context) -// { -// HttpServerContext = context; - -// HttpServerContext.Log.Debug -// ( -// InternationalizationManager.I18N("webexpress.webapp:notificationmanager.initialization") -// ); -// } - -// /// -// /// Creates a new global notification. -// /// -// /// The notification message. -// /// The lifetime of the notification. -1 for indefinite validity. -// /// The headline. -// /// An icon. -// /// The notification type. -// /// The created notification. -// public Notification AddNotification(string message, int durability = -1, string heading = null, string icon = null, TypeNotification type = TypeNotification.Light) -// { -// var notification = new Notification() -// { -// Message = message, -// Durability = durability, -// Heading = heading, -// Icon = icon, -// Type = type -// }; - -// if (!GlobalNotifications.ContainsKey(notification.Id)) -// { -// // global notification -// lock (GlobalNotifications) -// { -// GlobalNotifications.Add(notification.Id, notification); -// } -// } - -// OnCreateNotification(notification); - -// return notification; -// } - -// /// -// /// Creates a new notification in the session. -// /// -// /// The request. -// /// The notification message. -// /// The lifetime of the notification. -1 for indefinite validity. -// /// The headline. -// /// An icon. -// /// The notification type. -// /// The created notification. -// public Notification AddNotification(Request request, string message, int durability = -1, string heading = null, string icon = null, TypeNotification type = TypeNotification.Light) -// { -// var notification = new Notification() -// { -// Message = InternationalizationManager.I18N(request, message), -// Durability = durability, -// Heading = InternationalizationManager.I18N(request, heading), -// Icon = icon?.ToString(), -// Type = type -// }; - -// // user Notification -// if (!request.Session.Properties.ContainsKey(typeof(SessionPropertyNotification))) -// { -// request.Session.Properties.Add(typeof(SessionPropertyNotification), new SessionPropertyNotification()); -// } - -// var notificationProperty = request.Session.Properties[typeof(SessionPropertyNotification)] as SessionPropertyNotification; - -// if (!notificationProperty.ContainsKey(notification.Id)) -// { -// lock (notificationProperty) -// { -// notificationProperty.Add(notification.Id, notification); -// } -// } - -// OnCreateNotification(notification); - -// return notification; -// } - -// /// -// /// Returns all notifications from the session. -// /// -// /// The request. -// /// An enumeration of the notifications. -// public IEnumerable GetNotifications(Request request) -// { -// var list = new List(); - -// var scrapGlobal = GlobalNotifications.Values.Where(x => x.Durability >= 0 && x.Created.AddMilliseconds(x.Durability) < DateTime.Now).ToList(); -// lock (GlobalNotifications) -// { -// // remove expired notifications -// scrapGlobal.ForEach(x => GlobalNotifications.Remove(x.Id)); -// } - -// list.AddRange(GlobalNotifications.Values); - -// if (request.Session.Properties.ContainsKey(typeof(SessionPropertyNotification)) && -// request.Session.Properties[typeof(SessionPropertyNotification)] is SessionPropertyNotification notificationProperty) -// { -// var scrap = notificationProperty.Values.Where(x => x.Durability >= 0 && x.Created.AddMilliseconds(x.Durability) < DateTime.Now).ToList(); - -// lock (notificationProperty) -// { -// // remove expired notifications -// scrap.ForEach(x => notificationProperty.Remove(x.Id)); -// } - - -// list.AddRange(notificationProperty.Values); -// } - -// return list; -// } - -// /// -// /// Returns all notifications from the session. -// /// -// /// The request. -// /// The notification id. -// public void RemoveNotification(Request request, string id) -// { -// if (GlobalNotifications.ContainsKey(id)) -// { -// lock (GlobalNotifications) -// { -// OnDestroyNotification(GlobalNotifications[id]); - -// // remove notifications -// GlobalNotifications.Remove(id); -// } -// } - -// var scrapGlobal = GlobalNotifications.Values.Where(x => x.Durability >= 0 && x.Created.AddMilliseconds(x.Durability) < DateTime.Now).ToList(); - -// lock (GlobalNotifications) -// { -// // remove expired notifications -// scrapGlobal.ForEach(x => -// { -// OnDestroyNotification(GlobalNotifications[x.Id]); - -// GlobalNotifications.Remove(x.Id); -// }); -// } - -// if (request.Session.Properties.ContainsKey(typeof(SessionPropertyNotification)) && -// request.Session.Properties[typeof(SessionPropertyNotification)] is SessionPropertyNotification notificationProperty) -// { -// if (notificationProperty.ContainsKey(id)) -// { -// lock (notificationProperty) -// { -// // remove notifications -// notificationProperty.Remove(id); -// } -// } - -// var scrap = notificationProperty.Values.Where(x => x.Created.AddMilliseconds(x.Durability) < DateTime.Now).ToList(); - -// lock (notificationProperty) -// { -// // remove expired notifications -// scrap.ForEach(x => -// { -// OnDestroyNotification(notificationProperty[x.Id]); - -// notificationProperty.Remove(x.Id); -// }); -// } -// } -// } - -// /// -// /// Raises the CreateNotification event. -// /// -// /// The notification. -// private void OnCreateNotification(Notification notification) -// { -// CreateNotification?.Invoke(this, notification); -// } - -// /// -// /// Raises the DestroyNotification event. -// /// -// /// The notification. -// private void OnDestroyNotification(Notification notification) -// { -// DestroyNotification?.Invoke(this, notification); -// } - -// /// -// /// Information about the component is collected and prepared for output in the log. -// /// -// /// The context of the plugin. -// /// A list of log entries. -// /// The shaft deep. -// public void PrepareForLog(IPluginContext pluginContext, IList output, int deep) -// { -// } -// } -//} diff --git a/src/WebExpress.WebApp/WebNotificaation/SessionPropertyNotification.cs b/src/WebExpress.WebApp/WebNotificaation/SessionPropertyNotification.cs deleted file mode 100644 index 4e5369b..0000000 --- a/src/WebExpress.WebApp/WebNotificaation/SessionPropertyNotification.cs +++ /dev/null @@ -1,14 +0,0 @@ -//using System.Collections.Generic; -//using WebExpress.WebCore.WebSession; - -//namespace WebExpress.WebApp.WebNotificaation -//{ -// /// -// /// Collection of notifications. -// /// Key = The notification id. -// /// Value = The notification. -// /// -// public class SessionPropertyNotification : Dictionary, ISessionProperty -// { -// } -//} diff --git a/src/WebExpress.WebApp/WebNotificaation/TypeNotification.cs b/src/WebExpress.WebApp/WebNotificaation/TypeNotification.cs deleted file mode 100644 index 4adbba4..0000000 --- a/src/WebExpress.WebApp/WebNotificaation/TypeNotification.cs +++ /dev/null @@ -1,46 +0,0 @@ -//namespace WebExpress.WebApp.WebNotificaation -//{ -// /// -// /// The layout options of the notification. -// /// -// public enum TypeNotification -// { -// Default = 0, -// Primary = 1, -// Secondary = 2, -// Success = 3, -// Info = 4, -// Warning = 5, -// Danger = 6, -// Dark = 7, -// Light = 8, -// White = 9, -// Transparent = 10 -// } - -// public static class TypeLayoutTabExtensions -// { -// /// -// /// Conversion to a string. -// /// -// /// The layout to be converted. -// /// The converted layout. -// public static string ToClass(this TypeNotification layout) -// { -// return layout switch -// { -// TypeNotification.Primary => "bg-primary", -// TypeNotification.Secondary => "bg-secondary", -// TypeNotification.Success => "alert-success", -// TypeNotification.Info => "alert-info", -// TypeNotification.Warning => "alert-warning", -// TypeNotification.Danger => "alert-danger", -// TypeNotification.Light => "alert-light", -// TypeNotification.Dark => "alert-dark", -// TypeNotification.White => "bg-white", -// TypeNotification.Transparent => "bg-transparent", -// _ => string.Empty, -// }; -// } -// } -//} diff --git a/src/WebExpress.WebApp/WebNotificaation/TypeNotificationConverter.cs b/src/WebExpress.WebApp/WebNotificaation/TypeNotificationConverter.cs deleted file mode 100644 index c4f9019..0000000 --- a/src/WebExpress.WebApp/WebNotificaation/TypeNotificationConverter.cs +++ /dev/null @@ -1,35 +0,0 @@ -//using System; -//using System.Text.Json; -//using System.Text.Json.Serialization; - -//namespace WebExpress.WebApp.WebNotificaation -//{ -// /// -// /// Conversion of notification type from and to json. -// /// -// public class TypeNotificationConverter : JsonConverter -// { -// /// -// /// Read and convert json to TypeNotification. -// /// -// /// The reader. -// /// The type. -// /// The options. -// /// -// public override TypeNotification Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) -// { -// return (TypeNotification)Enum.Parse(typeof(TypeNotification), reader.GetString(), true); -// } - -// /// -// /// Writes the value as json. -// /// -// /// Der writer. -// /// The value. -// /// The options. -// public override void Write(Utf8JsonWriter writer, TypeNotification type, JsonSerializerOptions options) -// { -// writer.WriteStringValue(type.ToClass()); -// } -// } -//} From 22b52785aa369e860e99026a0762ee6f3a682016 Mon Sep 17 00:00:00 2001 From: Rene Schwarzer Date: Fri, 18 Apr 2025 10:24:29 +0200 Subject: [PATCH 27/30] feat: bug fixes and general improvements --- .../WebExpress.WebApp.Test.csproj | 6 +- .../Assets/js/webexpress.webapp.table.js | 2 +- .../WWW/Api/1/RestUserManagement.cs | 100 -------- src/WebExpress.WebApp/WebApi/RestApiCrud.cs | 6 +- .../WebControl/ControlModalFormConfirm.cs | 5 +- .../ControlModalFormConfirmDelete.cs | 120 +++++---- src/WebExpress.WebApp/WebUser/Group.cs | 32 --- .../WebUser/Model/WebItem.cs | 65 ----- .../WebUser/Model/WebItemGroup.cs | 7 - .../WebUser/Model/WebItemUser.cs | 45 ---- src/WebExpress.WebApp/WebUser/User.cs | 71 ------ src/WebExpress.WebApp/WebUser/UserManager.cs | 233 ------------------ 12 files changed, 65 insertions(+), 627 deletions(-) delete mode 100644 src/WebExpress.WebApp/WWW/Api/1/RestUserManagement.cs delete mode 100644 src/WebExpress.WebApp/WebUser/Group.cs delete mode 100644 src/WebExpress.WebApp/WebUser/Model/WebItem.cs delete mode 100644 src/WebExpress.WebApp/WebUser/Model/WebItemGroup.cs delete mode 100644 src/WebExpress.WebApp/WebUser/Model/WebItemUser.cs delete mode 100644 src/WebExpress.WebApp/WebUser/User.cs delete mode 100644 src/WebExpress.WebApp/WebUser/UserManager.cs diff --git a/src/WebExpress.WebApp.Test/WebExpress.WebApp.Test.csproj b/src/WebExpress.WebApp.Test/WebExpress.WebApp.Test.csproj index 76b6209..270a849 100644 --- a/src/WebExpress.WebApp.Test/WebExpress.WebApp.Test.csproj +++ b/src/WebExpress.WebApp.Test/WebExpress.WebApp.Test.csproj @@ -14,11 +14,11 @@ - + - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/WebExpress.WebApp/Assets/js/webexpress.webapp.table.js b/src/WebExpress.WebApp/Assets/js/webexpress.webapp.table.js index e0677ea..fca7d1c 100644 --- a/src/WebExpress.WebApp/Assets/js/webexpress.webapp.table.js +++ b/src/WebExpress.WebApp/Assets/js/webexpress.webapp.table.js @@ -38,7 +38,7 @@ webexpress.webapp.tableCtrl = class extends webexpress.webui.tableCtrl { receiveData() { if (this._filter === undefined || this._filter == null) { this._filter = ""; } if (this._page === undefined || this._page == null) { this._page = 0; } - $.ajax({ type: "GET", url: this._restUri + "?wql=" + this._filter + "&page=" + this._page, dataType: 'json', }).then(function (response) { + $.ajax({ type: "GET", url: this._restUri + "?search=" + this._filter + "&page=" + this._page, dataType: 'json', }).then(function (response) { var data = response.data; this.clear(); this.addRange(data); diff --git a/src/WebExpress.WebApp/WWW/Api/1/RestUserManagement.cs b/src/WebExpress.WebApp/WWW/Api/1/RestUserManagement.cs deleted file mode 100644 index dc7bf93..0000000 --- a/src/WebExpress.WebApp/WWW/Api/1/RestUserManagement.cs +++ /dev/null @@ -1,100 +0,0 @@ -//using System.Collections.Generic; -//using System.Linq; -//using WebExpress.WebCore.WebAttribute; -//using WebExpress.WebCore.WebMessage; -//using WebExpress.WebCore.WebResource; -//using WebExpress.WebApp.WebResource; -//using WebExpress.WebIndex.Wql; -//using WebExpress.WebUI; -//using static WebExpress.WebCore.Internationalization.InternationalizationManager; -//using WebExpress.WebApp.WebUser.Model; - -//namespace WebExpress.WebApp.WWW.Api.V1 -//{ -// /// -// /// REST API for user management. -// /// -// [Segment("user", "")] -// [ContextPath("/api/v1")] -// [Module] -// [Optional] -// public sealed class RestUserManagement : ResourceRestCrud -// { -// /// -// /// Initializes a new instance of the class. -// /// -// public RestUserManagement() -// { -// } - -// /// -// /// Initialization -// /// -// /// The context. -// public override void Initialization(IResourceContext context) -// { -// base.Initialization(context); -// } - -// /// -// /// Processing of the resource that was called via the get request. -// /// -// /// The request. -// /// An enumeration of which json serializer can be serialized. -// public override IEnumerable GetColumns(Request request) -// { -// return new ResourceRestCrudColumn[] -// { -// new ResourceRestCrudColumn(I18N(request, "webexpress.webapp:setting.usermanager.user.login.label")) -// { -// Render = "return item.Login;", -// Width = 5 -// }, -// new ResourceRestCrudColumn(I18N(request, "webexpress.webapp:setting.usermanager.user.name.label")) -// { -// Render = "return item.Lastname + ', ' + item.Firstname;" -// }, -// new ResourceRestCrudColumn(I18N(request, "webexpress.webapp:setting.usermanager.user.groups.label")) -// { -// Render = "var html = '
    ' + item.Groups.map(function(group) { return '
  • ' + group.Name + '
  • '; }).join('') + '
'; return html;" -// }, -// new ResourceRestCrudColumn(I18N(request, "webexpress.webapp:setting.usermanager.user.email.label")) -// { -// Render = "return item.Email;" -// } -// }; -// } - -// /// -// /// Processing of the resource that was called via the get request. -// /// -// /// The filtering and sorting options. -// /// The request. -// /// An enumeration of which json serializer can be serialized. -// public override IEnumerable GetData(IWqlStatement wql, Request request) -// { -// var users = wql.Apply(); - -// return users.Select(x => new WebItemUser() -// { -// Id = x.Id, -// Login = x.Login, -// Firstname = x.Firstname, -// Lastname = x.Lastname, -// Email = x.Email, -// Groups = x.Groups.Select(y => new WebItemGroup() { Id = y.Id, Name = y.Name }) -// }); -// } - -// /// -// /// Processing of the resource that was called via the delete request. -// /// -// /// The id to delete. -// /// The request. -// /// The result of the deletion. -// public override bool DeleteData(string id, Request request) -// { -// return true; -// } -// } -//} diff --git a/src/WebExpress.WebApp/WebApi/RestApiCrud.cs b/src/WebExpress.WebApp/WebApi/RestApiCrud.cs index 4fd9f67..5a5deb7 100644 --- a/src/WebExpress.WebApp/WebApi/RestApiCrud.cs +++ b/src/WebExpress.WebApp/WebApi/RestApiCrud.cs @@ -59,7 +59,9 @@ public virtual object GetData(Request request) lock (Guard) { - var wqlStatement = WebEx.ComponentHub.GetComponentManager()?.Retrieve(wql ?? $"{GetDefaultSearchAttribute()}='{search}'"); + var wqlStatement = !string.IsNullOrWhiteSpace(search) || !string.IsNullOrWhiteSpace(wql) + ? WebEx.ComponentHub.GetComponentManager()?.Retrieve(wql ?? $"{GetDefaultSearchAttribute()}='{search}*'") + : WebEx.ComponentHub.GetComponentManager()?.Retrieve(""); var data = GetData(wqlStatement, request); var count = data.Count(); @@ -107,7 +109,7 @@ public void DeleteData(Request request) protected virtual string GetDefaultSearchAttribute() { return typeof(T).GetProperties() - //.Where(x => x.GetCustomAttribute() != null) + .Where(x => x.GetCustomAttribute() != null) .Where(x => x.GetCustomAttribute() == null) .Select(x => x.Name) .FirstOrDefault(); diff --git a/src/WebExpress.WebApp/WebControl/ControlModalFormConfirm.cs b/src/WebExpress.WebApp/WebControl/ControlModalFormConfirm.cs index 319ca2d..9be4871 100644 --- a/src/WebExpress.WebApp/WebControl/ControlModalFormConfirm.cs +++ b/src/WebExpress.WebApp/WebControl/ControlModalFormConfirm.cs @@ -41,7 +41,7 @@ public class ControlModalFormConfirm : ControlModalForm /// /// Returns or sets the submit button. /// - private ControlFormItemButtonSubmit SubmitButton { get; set; } + private ControlFormItemButtonSubmit SubmitButton { get; } = new ControlFormItemButtonSubmit("submit"); /// /// Returns or sets the redirect uri. @@ -55,8 +55,6 @@ public class ControlModalFormConfirm : ControlModalForm public ControlModalFormConfirm(string id = null, params ControlFormItem[] content) : base(id, content) { - SubmitButton = new ControlFormItemButtonSubmit("submit"); - Form.ProcessForm += (s, e) => { OnConfirm(e.Context); @@ -110,6 +108,7 @@ public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTre } Form.RedirectUri = RedirectUri ?? renderContext.Request.Uri; + SubmitButton.Text = SubmitButtonLabel; return base.Render(renderContext, visualTree, items); } diff --git a/src/WebExpress.WebApp/WebControl/ControlModalFormConfirmDelete.cs b/src/WebExpress.WebApp/WebControl/ControlModalFormConfirmDelete.cs index 3693fd0..3f99996 100644 --- a/src/WebExpress.WebApp/WebControl/ControlModalFormConfirmDelete.cs +++ b/src/WebExpress.WebApp/WebControl/ControlModalFormConfirmDelete.cs @@ -1,65 +1,55 @@ -//using WebExpress.WebCore.Internationalization; -//using WebExpress.WebCore.WebHtml; -//using WebExpress.WebCore.WebPage; -//using WebExpress.WebUI.WebControl; - -//namespace WebExpress.WebApp.WebControl -//{ -// public class ControlModalFormConfirmDelete : ControlModalFormConfirm -// { -// /// -// /// Initializes a new instance of the class. -// /// -// /// The control id. -// public ControlModalFormConfirmDelete(string id = null) -// : this(id, null) -// { - -// } - -// /// -// /// Initializes a new instance of the class. -// /// -// /// The control id. -// /// The form controls. -// public ControlModalFormConfirmDelete(string id, params ControlFormItem[] content) -// : base(id, content) -// { -// } - -// /// -// /// Convert to html. -// /// -// /// The context in which the control is rendered. -// /// The control as html. -// public override IHtmlNode Render(RenderContext context) -// { -// if (string.IsNullOrWhiteSpace(Header)) -// { -// Header = context.Page.I18N("webexpress.webapp", "delete.header"); -// } - -// if (string.IsNullOrWhiteSpace(SubmitButtonLabel)) -// { -// SubmitButtonLabel = context.Page.I18N("webexpress.webapp", "delete.label"); -// } - -// if (Content == null) -// { -// Content = new ControlFormItemStaticText() { Text = context.Page.I18N("webexpress.webapp", "delete.description") }; -// } - -// if (SubmitButtonIcon == null) -// { -// SubmitButtonIcon = new PropertyIcon(TypeIcon.TrashAlt); -// } - -// if (SubmitButtonColor == null) -// { -// SubmitButtonColor = new PropertyColorButton(TypeColorButton.Danger); -// } - -// return base.Render(context); -// } -// } -//} +using WebExpress.WebCore.Internationalization; +using WebExpress.WebCore.WebHtml; +using WebExpress.WebUI.WebControl; +using WebExpress.WebUI.WebIcon; +using WebExpress.WebUI.WebPage; + +namespace WebExpress.WebApp.WebControl +{ + /// + /// Represents a modal confirmation form specifically for delete actions. + /// + public class ControlModalFormConfirmDelete : ControlModalFormConfirm + { + /// + /// Initializes a new instance of the class. + /// + /// The control id. + public ControlModalFormConfirmDelete(string id = null) + : this(id, null) + { + + } + + /// + /// Initializes a new instance of the class. + /// + /// The control id. + /// The form controls. + public ControlModalFormConfirmDelete(string id, params ControlFormItem[] content) + : base(id, content) + { + SubmitButtonIcon = new IconTrash(); + SubmitButtonColor = new PropertyColorButton(TypeColorButton.Danger); + } + + /// + /// Converts the control to an HTML representation. + /// + /// The context in which the control is rendered. + /// The visual tree representing the control's structure. + /// An HTML node representing the rendered control. + public override IHtmlNode Render(IRenderControlContext renderContext, IVisualTreeControl visualTree) + { + if (string.IsNullOrWhiteSpace(Header)) + { + Header = I18N.Translate(renderContext, "webexpress.webapp:delete.header"); + } + + SubmitButtonLabel ??= I18N.Translate(renderContext, "webexpress.webapp:delete.label"); + Content ??= new ControlFormItemStaticText() { Text = I18N.Translate(renderContext, "webexpress.webapp:delete.description") }; + + return base.Render(renderContext, visualTree); + } + } +} diff --git a/src/WebExpress.WebApp/WebUser/Group.cs b/src/WebExpress.WebApp/WebUser/Group.cs deleted file mode 100644 index a5dfb54..0000000 --- a/src/WebExpress.WebApp/WebUser/Group.cs +++ /dev/null @@ -1,32 +0,0 @@ -//using System; -//using System.Xml.Serialization; - -//namespace WebExpress.WebApp.WebUser -//{ -// public class Group -// { -// /// -// /// Returns or sets the id. -// /// -// [XmlAttribute("id")] -// public string Id { get; set; } - -// /// -// /// Returns or sets the name. -// /// -// [XmlAttribute("name")] -// public string Name { get; set; } - -// /// -// /// Returns or sets the timestamp of the creation. -// /// -// [XmlAttribute("created")] -// public DateTime Created { get; set; } - -// /// -// /// The timestamp of the last change. -// /// -// [XmlAttribute("updated")] -// public DateTime Updated { get; set; } -// } -//} diff --git a/src/WebExpress.WebApp/WebUser/Model/WebItem.cs b/src/WebExpress.WebApp/WebUser/Model/WebItem.cs deleted file mode 100644 index 2247c21..0000000 --- a/src/WebExpress.WebApp/WebUser/Model/WebItem.cs +++ /dev/null @@ -1,65 +0,0 @@ -//using System; -//using System.Text.Json.Serialization; -//using WebExpress.WebIndex; -//using WebExpress.WebIndex.WebAttribute; - -//namespace WebExpress.WebApp.WebUser.Model -//{ -// public class WebItem : IIndexItem -// { -// /// -// /// Returns or sets the id. -// /// -// [JsonPropertyName("id")] -// [IndexIgnore] -// public Guid Id { get; set; } = Guid.NewGuid(); - -// /// -// /// Returns or sets the name. -// /// -// [JsonPropertyName("name")] -// [IndexIgnore] -// public virtual string Name { get; set; } - -// /// -// /// Returns or sets the uri of the web item. -// /// -// [JsonPropertyName("uri")] -// public virtual string Uri { get; set; } - -// /// -// /// Returns or sets the label of the web item. -// /// -// [JsonPropertyName("label")] -// public virtual string Label { get; set; } - -// /// -// /// Initializes a new instance of the class. -// /// -// public WebItem() -// { -// } - -// /// -// /// Copy-Constructor -// /// Creates a deep copy. -// /// -// /// The web item to be copied. -// public WebItem(WebItem item) -// { -// Id = item.Id; -// Name = item.Name; -// Uri = item.Uri; -// Label = item.Label; -// } - -// /// -// /// Conversion to string. -// /// -// /// The object in its string representation. -// public override string ToString() -// { -// return $"{Label} ({Id})"; -// } -// } -//} diff --git a/src/WebExpress.WebApp/WebUser/Model/WebItemGroup.cs b/src/WebExpress.WebApp/WebUser/Model/WebItemGroup.cs deleted file mode 100644 index 91b4b96..0000000 --- a/src/WebExpress.WebApp/WebUser/Model/WebItemGroup.cs +++ /dev/null @@ -1,7 +0,0 @@ -//namespace WebExpress.WebApp.WebUser.Model -//{ -// public class WebItemGroup : WebItem -// { - -// } -//} diff --git a/src/WebExpress.WebApp/WebUser/Model/WebItemUser.cs b/src/WebExpress.WebApp/WebUser/Model/WebItemUser.cs deleted file mode 100644 index 3d9124e..0000000 --- a/src/WebExpress.WebApp/WebUser/Model/WebItemUser.cs +++ /dev/null @@ -1,45 +0,0 @@ -//using System.Collections.Generic; - -//namespace WebExpress.WebApp.WebUser.Model -//{ -// /// -// /// Represents a user in the web item context. -// /// -// public class WebItemUser : WebItem -// { -// /// -// /// Returns the label of the object. -// /// -// public override string Label => !string.IsNullOrWhiteSpace(Firstname) ? $"{Lastname}, {Firstname}" : Lastname; - -// /// -// /// Returns the name of the object. -// /// -// public override string Name => Label; - -// /// -// /// Returns or sets the login name. -// /// -// public string Login { get; set; } - -// /// -// /// Returns or sets the first name. -// /// -// public string Firstname { get; set; } - -// /// -// /// Returns or sets the last name. -// /// -// public string Lastname { get; set; } - -// /// -// /// Returns or sets the email address. -// /// -// public string Email { get; set; } - -// /// -// /// Returns or sets the groups. -// /// -// public IEnumerable Groups { get; set; } -// } -//} diff --git a/src/WebExpress.WebApp/WebUser/User.cs b/src/WebExpress.WebApp/WebUser/User.cs deleted file mode 100644 index 786cb73..0000000 --- a/src/WebExpress.WebApp/WebUser/User.cs +++ /dev/null @@ -1,71 +0,0 @@ -//using System; -//using System.Collections.Generic; -//using System.Linq; -//using System.Xml.Serialization; -//using WebExpress.WebIndex; - -//namespace WebExpress.WebApp.WebUser -//{ -// public class User : IIndexItem -// { -// /// -// /// Returns or sets the id. -// /// -// [XmlAttribute("id")] -// public Guid Id { get; set; } - -// /// -// /// Returns or sets the login id. -// /// -// [XmlAttribute("login")] -// public string Login { get; set; } - -// /// -// /// Returns or sets the name. -// /// -// [XmlAttribute("firstname")] -// public string Firstname { get; set; } - -// /// -// /// Returns or sets the name. -// /// -// [XmlAttribute("lastname")] -// public string Lastname { get; set; } - -// /// -// /// Returns or sets the email address. -// /// -// [XmlAttribute("email")] -// public string Email { get; set; } - -// /// -// /// Returns or sets the password. -// /// -// [XmlAttribute("password")] -// public string Password { get; set; } - -// /// -// /// Returns or sets the group ids -// /// -// [XmlElement("groups")] -// public List GroupIds { get; set; } = new List(); - -// /// -// /// Returns the groups. -// /// -// [XmlIgnore] -// public IEnumerable Groups => from group1 in UserManager.Groups join group2 in GroupIds on group1.Id equals group2 select group1; - -// /// -// /// Returns or sets the timestamp of the creation. -// /// -// [XmlAttribute("created")] -// public DateTime Created { get; set; } - -// /// -// /// The timestamp of the last change. -// /// -// [XmlAttribute("updated")] -// public DateTime Updated { get; set; } -// } -//} diff --git a/src/WebExpress.WebApp/WebUser/UserManager.cs b/src/WebExpress.WebApp/WebUser/UserManager.cs deleted file mode 100644 index e47b812..0000000 --- a/src/WebExpress.WebApp/WebUser/UserManager.cs +++ /dev/null @@ -1,233 +0,0 @@ -//using System; -//using System.Collections.Generic; -//using System.IO; -//using System.Text; -//using System.Threading.Tasks; -//using System.Xml.Serialization; -//using WebExpress.WebCore; -//using static WebExpress.WebCore.Internationalization.InternationalizationManager; - -//namespace WebExpress.WebApp.WebUser -//{ -// public static class UserManager -// { -// /// -// /// Returns or sets the reference to the context of the host. -// /// -// private static IHttpServerContext Context { get; set; } - -// /// -// /// Returns or sets the root directory where the user data is located. -// /// -// private static string UserRootPath { get; set; } - -// /// -// /// Returns the registered users. -// /// -// public static ICollection Users { get; } = new List(); - -// /// -// /// Returns the registered groups. -// /// -// public static ICollection Groups { get; } = new List(); - -// /// -// /// Initialization -// /// -// /// The reference to the context of the host. -// internal static void Initialization(IHttpServerContext context) -// { -// Context = context; - -// UserRootPath = Path.Combine(context.DataPath, "usermanager"); - -// LoadGroup(); -// LoadUser(); - -// Context.Log.Info(message: I18N("webexpress.webapp:usermanager.initialization")); -// } - -// /// -// /// Load all users from the file system. -// /// -// private static void LoadUser() -// { -// var path = Path.Combine(UserRootPath, "users"); - -// if (!Directory.Exists(path)) -// { -// Directory.CreateDirectory(path); -// } - -// var files = Directory.GetFiles(path, "*.xml"); -// var serializer = new XmlSerializer(typeof(User)); -// foreach (var file in files) -// { -// try -// { -// using var reader = File.OpenText(file); -// Users.Add(serializer.Deserialize(reader) as User); -// } -// catch (Exception ex) -// { -// Context.Log.Exception(ex); -// } -// } -// } - -// /// -// /// Adds a new user. -// /// -// /// The new user. -// public static void AddUser(User user) -// { -// UpdateUser(user); - -// Users.Add(user); -// } - -// /// -// /// Updates an existing user. -// /// -// /// The existing user. -// public static void UpdateUser(User user) -// { -// var serializer = new XmlSerializer(typeof(User)); -// var xmlns = new XmlSerializerNamespaces(); -// xmlns.Add(string.Empty, string.Empty); - -// user.Updated = DateTime.Now; - -// using (var memoryStream = new MemoryStream()) -// { -// serializer.Serialize(memoryStream, user, xmlns); - -// var utf = new UTF8Encoding(); -// var fileName = Path.Combine(UserRootPath, "users", string.Format("{0}.xml", user.Id)); - -// if (!Directory.Exists(Path.GetDirectoryName(fileName))) -// { -// Directory.CreateDirectory(Path.GetDirectoryName(fileName)); -// } - -// File.WriteAllText -// ( -// fileName, -// utf.GetString(memoryStream.ToArray()) -// ); - -// Context.Log.Info(message: I18N("webexpress.webapp:usermanager.user.save"), args: $"{user.Lastname}, {user.Firstname}"); -// } -// } - -// /// -// /// Deletes a user. -// /// -// /// The user to be deleted. -// public static void RemoveUser(User user) -// { -// var fileName = Path.Combine(UserRootPath, "users", string.Format("{0}.xml", user.Id)); - -// Users.Remove(user); -// File.Delete(fileName); - -// Context.Log.Info(message: I18N("webexpress.webapp:usermanager.user.delete"), args: user.Login); -// } - -// /// -// /// Load all groups from file system. -// /// -// private static void LoadGroup() -// { -// var path = Path.Combine(UserRootPath, "groups"); - -// if (!Directory.Exists(path)) -// { -// Directory.CreateDirectory(path); -// } - -// var files = Directory.GetFiles(path, "*.xml"); -// var serializer = new XmlSerializer(typeof(Group)); -// foreach (var file in files) -// { -// try -// { -// using var reader = File.OpenText(file); -// Groups.Add(serializer.Deserialize(reader) as Group); -// } -// catch (Exception ex) -// { -// Context.Log.Exception(ex); -// } -// } -// } - -// /// -// /// Adds a new group. -// /// -// /// The new group. -// public static void AddGroup(Group group) -// { -// UpdateGroup(group); - -// Groups.Add(group); -// } - -// /// -// /// Updates an existing group. -// /// -// /// The existing group. -// public static void UpdateGroup(Group group) -// { -// var serializer = new XmlSerializer(typeof(Group)); -// var xmlns = new XmlSerializerNamespaces(); -// xmlns.Add(string.Empty, string.Empty); - -// group.Updated = DateTime.Now; - -// using (var memoryStream = new MemoryStream()) -// { -// serializer.Serialize(memoryStream, group, xmlns); - -// var utf = new UTF8Encoding(); -// var fileName = Path.Combine(UserRootPath, "groups", string.Format("{0}.xml", group.Id)); - -// if (!Directory.Exists(Path.GetDirectoryName(fileName))) -// { -// Directory.CreateDirectory(Path.GetDirectoryName(fileName)); -// } - -// File.WriteAllText -// ( -// fileName, -// utf.GetString(memoryStream.ToArray()) -// ); - -// Context.Log.Info(message: I18N("webexpress.webapp:usermanager.group.save"), args: group.Name); -// } -// } - -// /// -// /// Deletes a group. -// /// -// /// The group to be deleted. -// public static void RemoveGroup(Group group) -// { -// var fileName = Path.Combine(UserRootPath, "groups", string.Format("{0}.xml", group.Id)); - -// Parallel.ForEach(Users, i => -// { -// if (i.GroupIds.Contains(group?.Id)) -// { -// i.GroupIds.Remove(group?.Id); -// UpdateUser(i); -// } -// }); - -// Groups.Remove(group); -// File.Delete(fileName); - -// Context.Log.Info(message: I18N("webexpress.webapp:usermanager.group.delete"), args: group.Name); -// } -// } -//} From 91b3f5d33d877fec8b5043b03232f584e7c172e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Schwarzer?= <31061438+ReneSchwarzer@users.noreply.github.com> Date: Fri, 18 Apr 2025 13:58:13 +0200 Subject: [PATCH 28/30] Update src/WebExpress.WebApp.Test/Fixture/UnitTestControlFixture.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/WebExpress.WebApp.Test/Fixture/UnitTestControlFixture.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/WebExpress.WebApp.Test/Fixture/UnitTestControlFixture.cs b/src/WebExpress.WebApp.Test/Fixture/UnitTestControlFixture.cs index 8ee0558..201faab 100644 --- a/src/WebExpress.WebApp.Test/Fixture/UnitTestControlFixture.cs +++ b/src/WebExpress.WebApp.Test/Fixture/UnitTestControlFixture.cs @@ -98,8 +98,7 @@ public static ComponentHub CreateAndRegisterComponentHubMock() /// The content of the request. /// The URI of the request. /// A fake request for testing. - public static Request CrerateRequestMock(string content = "", string uri = "") - { + public static Request CreateRequestMock(string content = "", string uri = "") var context = CreateHttpContextMock(content); var request = context.Request; From 1c8c459b09fbd5c97cf9e1018cf9cc72ab91e1b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Schwarzer?= <31061438+ReneSchwarzer@users.noreply.github.com> Date: Fri, 18 Apr 2025 13:58:33 +0200 Subject: [PATCH 29/30] Update src/WebExpress.WebApp.Test/Fixture/UnitTestControlFixture.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .../Fixture/UnitTestControlFixture.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/WebExpress.WebApp.Test/Fixture/UnitTestControlFixture.cs b/src/WebExpress.WebApp.Test/Fixture/UnitTestControlFixture.cs index 201faab..0565562 100644 --- a/src/WebExpress.WebApp.Test/Fixture/UnitTestControlFixture.cs +++ b/src/WebExpress.WebApp.Test/Fixture/UnitTestControlFixture.cs @@ -189,11 +189,11 @@ public static WebCore.WebMessage.HttpContext CreateHttpContextMock(string conten /// The application context. If null, defaults to null. /// The scopes of the page. If null, defaults to null. /// A mock render context for testing. - public static IRenderControlContext CrerateRenderContextMock(IApplicationContext applicationContext = null, IEnumerable scopes = null) + public static IRenderControlContext CreateRenderContextMock(IApplicationContext applicationContext = null, IEnumerable scopes = null) { - var request = CrerateRequestMock(); + var request = CreateRequestMock(); - return new RenderControlContext(null, CreratePageContextMock(applicationContext, scopes), request); + return new RenderControlContext(null, CreatePageContextMock(applicationContext, scopes), request); } /// From 87bd4051e7d2ceb2b93b2300afea54b4858021b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Schwarzer?= <31061438+ReneSchwarzer@users.noreply.github.com> Date: Fri, 18 Apr 2025 13:58:55 +0200 Subject: [PATCH 30/30] Update src/WebExpress.WebApp.Test/Fixture/UnitTestControlFixture.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/WebExpress.WebApp.Test/Fixture/UnitTestControlFixture.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/WebExpress.WebApp.Test/Fixture/UnitTestControlFixture.cs b/src/WebExpress.WebApp.Test/Fixture/UnitTestControlFixture.cs index 0565562..5e16f32 100644 --- a/src/WebExpress.WebApp.Test/Fixture/UnitTestControlFixture.cs +++ b/src/WebExpress.WebApp.Test/Fixture/UnitTestControlFixture.cs @@ -202,8 +202,7 @@ public static IRenderControlContext CreateRenderContextMock(IApplicationContext /// The application context. If null, defaults to null. /// The scopes of the page. /// A fake context for testing. - public static PageContext CreratePageContextMock(IApplicationContext applicationContext = null, IEnumerable scopes = null) - { + public static PageContext CreatePageContextMock(IApplicationContext applicationContext = null, IEnumerable scopes = null) var ctorPageContext = typeof(PageContext).GetConstructor(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance, null, [], null); var pageContext = (PageContext)ctorPageContext.Invoke([]);