From c49f50e6d4ef7cb4d40d263db76904f1ceab77a9 Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Sat, 4 Jul 2020 19:04:04 +0200 Subject: [PATCH] Clean up Signed-off-by: Bjarke Berg --- .../WebAssets/BackOfficeWebAssets.cs | 4 +- .../WebAssets/Resources.Designer.cs | 144 +++++++++++++++--- src/Umbraco.Tests.AcceptanceTest/cypress.json | 2 +- .../Builders/StylesheetBuilderTests.cs | 2 +- ...oBackOfficeApplicationBuilderExtensions.cs | 6 +- .../gulp/tasks/dependencies.js | 2 - .../Umbraco.Web.UI.NetCore.csproj | 6 - src/Umbraco.Web.UI.NetCore/appsettings.json | 2 +- .../config/serilog.config | 2 +- .../Umbraco/js/UmbracoSpeechBubbleBackEnd.js | 68 +++++++++ .../Umbraco/js/dualSelectBox.js | 48 ++++++ src/Umbraco.Web.UI/Umbraco/js/guiFunctions.js | 88 +++++++++++ .../Umbraco/js/installer.app.js | 7 + .../Umbraco/js/umbracoCheckKeys.js | 102 +++++++++++++ src/Umbraco.Web.UI/Umbraco/js/web.config | 8 + 15 files changed, 446 insertions(+), 45 deletions(-) create mode 100644 src/Umbraco.Web.UI/Umbraco/js/UmbracoSpeechBubbleBackEnd.js create mode 100644 src/Umbraco.Web.UI/Umbraco/js/dualSelectBox.js create mode 100644 src/Umbraco.Web.UI/Umbraco/js/guiFunctions.js create mode 100644 src/Umbraco.Web.UI/Umbraco/js/installer.app.js create mode 100644 src/Umbraco.Web.UI/Umbraco/js/umbracoCheckKeys.js create mode 100644 src/Umbraco.Web.UI/Umbraco/js/web.config diff --git a/src/Umbraco.Infrastructure/WebAssets/BackOfficeWebAssets.cs b/src/Umbraco.Infrastructure/WebAssets/BackOfficeWebAssets.cs index 6ceac5ecc6..fcb27f7189 100644 --- a/src/Umbraco.Infrastructure/WebAssets/BackOfficeWebAssets.cs +++ b/src/Umbraco.Infrastructure/WebAssets/BackOfficeWebAssets.cs @@ -107,9 +107,7 @@ namespace Umbraco.Web.WebAssets /// private IEnumerable GetInitBackOfficeScripts() { - - var fileContent = Resources.JsInitialize; - var resources = JsonConvert.DeserializeObject(fileContent); + var resources = JsonConvert.DeserializeObject(Resources.JsInitialize); return resources.Where(x => x.Type == JTokenType.String).Select(x => x.ToString()); } diff --git a/src/Umbraco.Infrastructure/WebAssets/Resources.Designer.cs b/src/Umbraco.Infrastructure/WebAssets/Resources.Designer.cs index 945082323f..5e29355948 100644 --- a/src/Umbraco.Infrastructure/WebAssets/Resources.Designer.cs +++ b/src/Umbraco.Infrastructure/WebAssets/Resources.Designer.cs @@ -1,42 +1,58 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ -namespace Umbraco.Web.WebAssets { +namespace Umbraco.Web.WebAssets +{ using System; - - - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [System.Diagnostics.DebuggerNonUserCodeAttribute()] - [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { - - private static System.Resources.ResourceManager resourceMan; - - private static System.Globalization.CultureInfo resourceCulture; - - [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } - - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] - internal static System.Resources.ResourceManager ResourceManager { + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { get { - if (object.Equals(null, resourceMan)) { - System.Resources.ResourceManager temp = new System.Resources.ResourceManager("Umbraco.Infrastructure.WebAssets.Resources", typeof(Resources).Assembly); + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Umbraco.Infrastructure.WebAssets.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } - - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] - internal static System.Globalization.CultureInfo Culture { + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } @@ -44,31 +60,109 @@ namespace Umbraco.Web.WebAssets { resourceCulture = value; } } - + + /// + /// Looks up a localized string similar to [ + /// 'lib/jquery/jquery.min.js', + /// 'lib/jquery-ui/jquery-ui.min.js', + /// 'lib/jquery-ui-touch-punch/jquery.ui.touch-punch.min.js', + /// + /// 'lib/angular/angular.js', + /// 'lib/underscore/underscore-min.js', + /// + /// 'lib/moment/moment.min.js', + /// 'lib/flatpickr/flatpickr.js', + /// + /// 'lib/animejs/anime.min.js', + /// + /// 'lib/angular-route/angular-route.js', + /// 'lib/angular-cookies/angular-cookies.js', + /// 'lib/angular-aria/angular-aria.min.js', + /// 'lib/angular-touch/angular-touch.js', + /// 'lib/angula [rest of string was truncated]";. + /// internal static string JsInitialize { get { return ResourceManager.GetString("JsInitialize", resourceCulture); } } - + + /// + /// Looks up a localized string similar to LazyLoad.js("##JsInitialize##", function () { + /// //we need to set the legacy UmbClientMgr path + /// if ((typeof UmbClientMgr) !== "undefined") { + /// UmbClientMgr.setUmbracoPath('"##UmbracoPath##"'); + /// } + /// + /// jQuery(document).ready(function () { + /// + /// angular.bootstrap(document, ['"##AngularModule##"']); + /// + /// }); + ///}); + ///. + /// internal static string Main { get { return ResourceManager.GetString("Main", resourceCulture); } } - + + /// + /// Looks up a localized string similar to [ + /// '../lib/jquery/jquery.min.js', + /// '../lib/angular/angular.js', + /// '../lib/underscore/underscore-min.js', + /// '../lib/umbraco/Extensions.js', + /// '../js/app.js', + /// '../js/umbraco.resources.js', + /// '../js/umbraco.services.js', + /// '../js/umbraco.interceptors.js', + /// '../ServerVariables', + /// '../lib/signalr/jquery.signalR.js', + /// '../BackOffice/signalr/hubs', + /// '../js/umbraco.preview.js' + ///] + ///. + /// internal static string PreviewInitialize { get { return ResourceManager.GetString("PreviewInitialize", resourceCulture); } } - + + /// + /// Looks up a localized string similar to // TODO: This would be nicer as an angular module so it can be injected into stuff... that'd be heaps nicer, but + ///// how to do that when this is not a regular JS file, it is a server side JS file and RequireJS seems to only want + ///// to force load JS files ? + /// + /////create the namespace (NOTE: This loads before any dependencies so we don't have a namespace mgr so we just create it manually) + ///var Umbraco = {}; + ///Umbraco.Sys = {}; + /////define a global static object + ///Umbraco.Sys.ServerVariables = ##Variables## ;. + /// internal static string ServerVariables { get { return ResourceManager.GetString("ServerVariables", resourceCulture); } } - + + /// + /// Looks up a localized string similar to [ + /// 'lib/tinymce/tinymce.min.js', + /// + /// 'lib/tinymce/plugins/paste/plugin.min.js', + /// 'lib/tinymce/plugins/anchor/plugin.min.js', + /// 'lib/tinymce/plugins/charmap/plugin.min.js', + /// 'lib/tinymce/plugins/table/plugin.min.js', + /// 'lib/tinymce/plugins/lists/plugin.min.js', + /// 'lib/tinymce/plugins/advlist/plugin.min.js', + /// 'lib/tinymce/plugins/hr/plugin.min.js', + /// 'lib/tinymce/plugins/autolink/plugin.min.js', + /// 'lib/tinymce/plugins/directionality/plugin.min.js', + /// 'lib/tinymce/plugins/t [rest of string was truncated]";. + /// internal static string TinyMceInitialize { get { return ResourceManager.GetString("TinyMceInitialize", resourceCulture); diff --git a/src/Umbraco.Tests.AcceptanceTest/cypress.json b/src/Umbraco.Tests.AcceptanceTest/cypress.json index 5f081400b5..33978211ed 100644 --- a/src/Umbraco.Tests.AcceptanceTest/cypress.json +++ b/src/Umbraco.Tests.AcceptanceTest/cypress.json @@ -1,5 +1,5 @@ { - "baseUrl": "http://localhost:9000", + "baseUrl": "https://localhost:44331", "viewportHeight": 1024, "viewportWidth": 1200, "env": { diff --git a/src/Umbraco.Tests.UnitTests/Umbraco.Tests.Common/Builders/StylesheetBuilderTests.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Tests.Common/Builders/StylesheetBuilderTests.cs index a1ad2e10c7..65f4a0fa88 100644 --- a/src/Umbraco.Tests.UnitTests/Umbraco.Tests.Common/Builders/StylesheetBuilderTests.cs +++ b/src/Umbraco.Tests.UnitTests/Umbraco.Tests.Common/Builders/StylesheetBuilderTests.cs @@ -23,7 +23,7 @@ namespace Umbraco.Tests.UnitTests.Umbraco.Tests.Common.Builders .Build(); // Assert - Assert.AreEqual(Path.Combine("css", "styles.css"), stylesheet.Path); + Assert.AreEqual(testPath, stylesheet.Path); Assert.AreEqual(testContent, stylesheet.Content); } } diff --git a/src/Umbraco.Web.BackOffice/Extensions/UmbracoBackOfficeApplicationBuilderExtensions.cs b/src/Umbraco.Web.BackOffice/Extensions/UmbracoBackOfficeApplicationBuilderExtensions.cs index 53acd6d915..c316f10ea2 100644 --- a/src/Umbraco.Web.BackOffice/Extensions/UmbracoBackOfficeApplicationBuilderExtensions.cs +++ b/src/Umbraco.Web.BackOffice/Extensions/UmbracoBackOfficeApplicationBuilderExtensions.cs @@ -25,14 +25,10 @@ namespace Umbraco.Extensions // Important we handle image manipulations before the static files, otherwise the querystring is just ignored. // TODO: Since we are dependent on these we need to register them but what happens when we call this multiple times since we are dependent on this for UseUmbracoWebsite too? app.UseImageSharp(); - app.UseStaticFiles(new StaticFileOptions() - { - - }); + app.UseStaticFiles(); return app; } - } } diff --git a/src/Umbraco.Web.UI.Client/gulp/tasks/dependencies.js b/src/Umbraco.Web.UI.Client/gulp/tasks/dependencies.js index 3e16900455..dbc0b7fc57 100644 --- a/src/Umbraco.Web.UI.Client/gulp/tasks/dependencies.js +++ b/src/Umbraco.Web.UI.Client/gulp/tasks/dependencies.js @@ -243,7 +243,6 @@ function dependencies() { // add streams for node modules nodeModules.forEach(module => { - debugger; var task = gulp.src(module.src, { base: module.base, allowEmpty: true }); _.forEach(config.roots, function(root){ @@ -257,7 +256,6 @@ function dependencies() { var libTask = gulp.src(config.sources.globs.lib, { allowEmpty: true }); _.forEach(config.roots, function(root){ - debugger; libTask = libTask.pipe(gulp.dest(root + config.targets.lib)) }); diff --git a/src/Umbraco.Web.UI.NetCore/Umbraco.Web.UI.NetCore.csproj b/src/Umbraco.Web.UI.NetCore/Umbraco.Web.UI.NetCore.csproj index b9fcdb3e07..a8914b00db 100644 --- a/src/Umbraco.Web.UI.NetCore/Umbraco.Web.UI.NetCore.csproj +++ b/src/Umbraco.Web.UI.NetCore/Umbraco.Web.UI.NetCore.csproj @@ -119,10 +119,4 @@ - - <_ContentIncludedByDefault Remove="~\App_Data\packages\createdPackages.config" /> - <_ContentIncludedByDefault Remove="~\App_Data\packages\installedPackages.config" /> - <_ContentIncludedByDefault Remove="~\Web.config" /> - - diff --git a/src/Umbraco.Web.UI.NetCore/appsettings.json b/src/Umbraco.Web.UI.NetCore/appsettings.json index 0dd45e6cb0..8a1ccba072 100644 --- a/src/Umbraco.Web.UI.NetCore/appsettings.json +++ b/src/Umbraco.Web.UI.NetCore/appsettings.json @@ -1,6 +1,6 @@ { "ConnectionStrings": { - "umbracoDbDSN": "server=localhost;database=NetCore;user id=sa;password='1vupRebv'" + "umbracoDbDSN": "" }, "Logging": { "LogLevel": { diff --git a/src/Umbraco.Web.UI.NetCore/config/serilog.config b/src/Umbraco.Web.UI.NetCore/config/serilog.config index 57b0de6fb3..1b357696b9 100644 --- a/src/Umbraco.Web.UI.NetCore/config/serilog.config +++ b/src/Umbraco.Web.UI.NetCore/config/serilog.config @@ -19,7 +19,7 @@ - + diff --git a/src/Umbraco.Web.UI/Umbraco/js/UmbracoSpeechBubbleBackEnd.js b/src/Umbraco.Web.UI/Umbraco/js/UmbracoSpeechBubbleBackEnd.js new file mode 100644 index 0000000000..f738538f90 --- /dev/null +++ b/src/Umbraco.Web.UI/Umbraco/js/UmbracoSpeechBubbleBackEnd.js @@ -0,0 +1,68 @@ +// Umbraco SpeechBubble Javascript + +// Dependency Loader Constructor +function UmbracoSpeechBubble(id) { + this.id = id; + this.ie = document.all ? true : false; + + this.GenerateSpeechBubble(); +} + +UmbracoSpeechBubble.prototype.GenerateSpeechBubble = function () { + + var sbHtml = document.getElementById(this.id); + + sbHtml.innerHTML = '' + + '
' + + '
' + + '' + + ' Close' + + '

The header!

' + + '

Default Text Container!


' + + '
' + + '
'; +}; + +UmbracoSpeechBubble.prototype.ShowMessage = function (icon, header, message, dontAutoHide) { + var speechBubble = jQuery("#" + this.id); + jQuery("#" + this.id + "Header").html(header); + jQuery("#" + this.id + "Message").html(message); + jQuery("#" + this.id + "Icon").attr('src', 'images/speechBubble/' + icon + '.png'); + + if (!this.ie) { + if (!dontAutoHide) { + jQuery("#" + this.id).fadeIn("slow").animate({ opacity: 1.0 }, 5000).fadeOut("fast"); + } else { + jQuery(".speechClose").show(); + jQuery("#" + this.id).fadeIn("slow"); + } + } else { + // this is special for IE as it handles fades with pngs very ugly + jQuery("#" + this.id).show(); + if (!dontAutoHide) { + setTimeout('UmbSpeechBubble.Hide();', 5000); + } else { + jQuery(".speechClose").show(); + } + } +}; + +UmbracoSpeechBubble.prototype.Hide = function () { + if (!this.ie) { + jQuery("#" + this.id).fadeOut("slow"); + } else { + jQuery("#" + this.id).hide(); + } +}; + +// Initialize +var UmbSpeechBubble = null +function InitUmbracoSpeechBubble() { + if (UmbSpeechBubble == null) + UmbSpeechBubble = new UmbracoSpeechBubble("defaultSpeechbubble"); +} + +jQuery(document).ready(function() { + InitUmbracoSpeechBubble(); +}); diff --git a/src/Umbraco.Web.UI/Umbraco/js/dualSelectBox.js b/src/Umbraco.Web.UI/Umbraco/js/dualSelectBox.js new file mode 100644 index 0000000000..5409e662e2 --- /dev/null +++ b/src/Umbraco.Web.UI/Umbraco/js/dualSelectBox.js @@ -0,0 +1,48 @@ + +function dualSelectBoxShift(id) { + var posVal = document.getElementById(id + "_posVals"); + var selVal = document.getElementById(id + "_selVals"); + + // First check the possible items + for (var i=0;i