diff --git a/build/NuSpecs/UmbracoCms.Core.nuspec b/build/NuSpecs/UmbracoCms.Core.nuspec index a637428b94..555c8f6b7a 100644 --- a/build/NuSpecs/UmbracoCms.Core.nuspec +++ b/build/NuSpecs/UmbracoCms.Core.nuspec @@ -32,11 +32,11 @@ - + - - - + + + @@ -44,37 +44,37 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -105,4 +105,4 @@ - + diff --git a/build/NuSpecs/UmbracoCms.nuspec b/build/NuSpecs/UmbracoCms.nuspec index c5b1b98a5f..64ca9c2e4e 100644 --- a/build/NuSpecs/UmbracoCms.nuspec +++ b/build/NuSpecs/UmbracoCms.nuspec @@ -16,7 +16,7 @@ umbraco - + diff --git a/src/SQLCE4Umbraco/SqlCE4Umbraco.csproj b/src/SQLCE4Umbraco/SqlCE4Umbraco.csproj index 0689a7a7d4..2904410748 100644 --- a/src/SQLCE4Umbraco/SqlCE4Umbraco.csproj +++ b/src/SQLCE4Umbraco/SqlCE4Umbraco.csproj @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -10,7 +10,7 @@ Properties SQLCE4Umbraco SQLCE4Umbraco - v4.5 + v4.6.2 512 diff --git a/src/SQLCE4Umbraco/app.config b/src/SQLCE4Umbraco/app.config index 1f5a6442ad..6d9f461c6f 100644 --- a/src/SQLCE4Umbraco/app.config +++ b/src/SQLCE4Umbraco/app.config @@ -4,7 +4,7 @@ - + @@ -32,4 +32,4 @@ - \ No newline at end of file + diff --git a/src/Umbraco.Core/DatabaseContext.cs b/src/Umbraco.Core/DatabaseContext.cs index 837e59ca12..b48ab1bca4 100644 --- a/src/Umbraco.Core/DatabaseContext.cs +++ b/src/Umbraco.Core/DatabaseContext.cs @@ -110,7 +110,14 @@ namespace Umbraco.Core /// public virtual UmbracoDatabase Database { - get { return _factory.CreateDatabase(); } + get + { + if (IsDatabaseConfigured == false) + { + throw new InvalidOperationException("Cannot create a database instance, there is no available connection string"); + } + return _factory.CreateDatabase(); + } } /// @@ -202,7 +209,7 @@ namespace Umbraco.Core } else { - throw new InvalidOperationException("Can't find a connection string with the name '" + Constants.System.UmbracoConnectionName + "'"); + throw new NullReferenceException("Can't find a connection string with the name '" + Constants.System.UmbracoConnectionName + "'"); } return _providerName; } diff --git a/src/Umbraco.Core/FileResources/Files.Designer.cs b/src/Umbraco.Core/FileResources/Files.Designer.cs index 456dae221f..500f9bf36c 100644 --- a/src/Umbraco.Core/FileResources/Files.Designer.cs +++ b/src/Umbraco.Core/FileResources/Files.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.0 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. diff --git a/src/Umbraco.Core/Persistence/PetaPoco.cs b/src/Umbraco.Core/Persistence/PetaPoco.cs index b569b1c45d..ba44af2c28 100644 --- a/src/Umbraco.Core/Persistence/PetaPoco.cs +++ b/src/Umbraco.Core/Persistence/PetaPoco.cs @@ -167,12 +167,12 @@ namespace Umbraco.Core.Persistence var providerName = Constants.DatabaseProviders.SqlServer; if (ConfigurationManager.ConnectionStrings[connectionStringName] != null) { - if (!string.IsNullOrEmpty(ConfigurationManager.ConnectionStrings[connectionStringName].ProviderName)) + if (string.IsNullOrEmpty(ConfigurationManager.ConnectionStrings[connectionStringName].ProviderName) == false) providerName = ConfigurationManager.ConnectionStrings[connectionStringName].ProviderName; } else { - throw new InvalidOperationException("Can't find a connection string with the name '" + connectionStringName + "'"); + throw new NullReferenceException("Can't find a connection string with the name '" + connectionStringName + "'"); } // Store factory and connection string diff --git a/src/Umbraco.Core/Services/FileService.cs b/src/Umbraco.Core/Services/FileService.cs index 6360ad8988..2105f7af2c 100644 --- a/src/Umbraco.Core/Services/FileService.cs +++ b/src/Umbraco.Core/Services/FileService.cs @@ -744,40 +744,9 @@ namespace Umbraco.Core.Services if (CreatingPartialView.IsRaisedEventCancelled(new NewEventArgs(partialView, true, partialView.Alias, -1), this)) return Attempt.Fail(); - string partialViewHeader; - switch (partialViewType) - { - case PartialViewType.PartialView: - partialViewHeader = PartialViewHeader; - break; - case PartialViewType.PartialViewMacro: - partialViewHeader = PartialViewMacroHeader; - break; - default: - throw new ArgumentOutOfRangeException("partialViewType"); - } - if (snippetName.IsNullOrWhiteSpace() == false) { - //create the file - var snippetPathAttempt = TryGetSnippetPath(snippetName); - if (snippetPathAttempt.Success == false) - { - throw new InvalidOperationException("Could not load snippet with name " + snippetName); - } - - using (var snippetFile = new StreamReader(System.IO.File.OpenRead(snippetPathAttempt.Result))) - { - var snippetContent = snippetFile.ReadToEnd().Trim(); - - //strip the @inherits if it's there - snippetContent = StripPartialViewHeader(snippetContent); - - var content = string.Format("{0}{1}{2}", - partialViewHeader, - Environment.NewLine, snippetContent); - partialView.Content = content; - } + partialView.Content = GetPartialViewMacroSnippetContent(snippetName, partialViewType); } var uow = _fileUowProvider.GetUnitOfWork(); @@ -914,6 +883,55 @@ namespace Umbraco.Core.Services } } + public string GetPartialViewSnippetContent(string snippetName) + { + return GetPartialViewMacroSnippetContent(snippetName, PartialViewType.PartialView); + } + + public string GetPartialViewMacroSnippetContent(string snippetName) + { + return GetPartialViewMacroSnippetContent(snippetName, PartialViewType.PartialViewMacro); + } + + private string GetPartialViewMacroSnippetContent(string snippetName, PartialViewType partialViewType) + { + if (snippetName.IsNullOrWhiteSpace()) + throw new ArgumentNullException("snippetName"); + + string partialViewHeader; + switch (partialViewType) + { + case PartialViewType.PartialView: + partialViewHeader = PartialViewHeader; + break; + case PartialViewType.PartialViewMacro: + partialViewHeader = PartialViewMacroHeader; + break; + default: + throw new ArgumentOutOfRangeException("partialViewType"); + } + + // Try and get the snippet path + var snippetPathAttempt = TryGetSnippetPath(snippetName); + if (snippetPathAttempt.Success == false) + { + throw new InvalidOperationException("Could not load snippet with name " + snippetName); + } + + using (var snippetFile = new StreamReader(System.IO.File.OpenRead(snippetPathAttempt.Result))) + { + var snippetContent = snippetFile.ReadToEnd().Trim(); + + //strip the @inherits if it's there + snippetContent = StripPartialViewHeader(snippetContent); + + var content = string.Format("{0}{1}{2}", + partialViewHeader, + Environment.NewLine, snippetContent); + return content; + } + } + public void SetPartialViewMacroFileContent(string filepath, Stream content) { using (var repository = GetPartialViewRepository(PartialViewType.PartialViewMacro, UowProvider.GetUnitOfWork())) diff --git a/src/Umbraco.Core/Services/IFileService.cs b/src/Umbraco.Core/Services/IFileService.cs index 5115a25087..453d199bfe 100644 --- a/src/Umbraco.Core/Services/IFileService.cs +++ b/src/Umbraco.Core/Services/IFileService.cs @@ -331,6 +331,13 @@ namespace Umbraco.Core.Services /// The content of the macro partial view. Stream GetPartialViewMacroFileContentStream(string filepath); + /// + /// Gets the content of a macro partial view snippet as a string + /// + /// The name of the snippet + /// + string GetPartialViewMacroSnippetContent(string snippetName); + /// /// Sets the content of a macro partial view. /// @@ -352,6 +359,13 @@ namespace Umbraco.Core.Services /// The content of the partial view. Stream GetPartialViewFileContentStream(string filepath); + /// + /// Gets the content of a partial view snippet as a string. + /// + /// The name of the snippet + /// The content of the partial view. + string GetPartialViewSnippetContent(string snippetName); + /// /// Sets the content of a partial view. /// diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index dab5da81d3..e1143ebfba 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -10,7 +10,7 @@ Properties Umbraco.Core Umbraco.Core - v4.5 + v4.6.2 512 ..\ true @@ -49,8 +49,9 @@ ..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll - - ..\packages\ImageProcessor.2.5.1\lib\net45\ImageProcessor.dll + + ..\packages\ImageProcessor.2.5.2\lib\net45\ImageProcessor.dll + True ..\packages\log4net.2.0.5\lib\net45-full\log4net.dll @@ -79,15 +80,14 @@ ..\packages\MySql.Data.6.9.8\lib\net45\MySql.Data.dll - - ..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll - True + + ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll ..\packages\Owin.1.0\lib\net40\Owin.dll - - ..\packages\semver.1.1.2\lib\net45\Semver.dll + + ..\packages\Semver.2.0.4\lib\net452\Semver.dll diff --git a/src/Umbraco.Core/UmbracoApplicationBase.cs b/src/Umbraco.Core/UmbracoApplicationBase.cs index b221dff2fe..a17dc02a52 100644 --- a/src/Umbraco.Core/UmbracoApplicationBase.cs +++ b/src/Umbraco.Core/UmbracoApplicationBase.cs @@ -62,9 +62,12 @@ namespace Umbraco.Core // after Umbraco has started there is a database in "context" and that context is // going to stay there and never get destroyed nor reused, so we have to ensure that // the database is disposed (which will auto-remove it from context). - var database = ApplicationContext.Current.DatabaseContext.Database; - if (database != null) // never to happen... unless in weird tests - ApplicationContext.Current.DatabaseContext.Database.Dispose(); + if (ApplicationContext.Current.DatabaseContext.IsDatabaseConfigured) + { + var database = ApplicationContext.Current.DatabaseContext.Database; + if (database != null) // never to happen... unless in weird tests + ApplicationContext.Current.DatabaseContext.Database.Dispose(); + } } /// diff --git a/src/Umbraco.Core/app.config b/src/Umbraco.Core/app.config index 1f5a6442ad..6d9f461c6f 100644 --- a/src/Umbraco.Core/app.config +++ b/src/Umbraco.Core/app.config @@ -4,7 +4,7 @@ - + @@ -32,4 +32,4 @@ - \ No newline at end of file + diff --git a/src/Umbraco.Core/packages.config b/src/Umbraco.Core/packages.config index 451597ef66..702330dbbd 100644 --- a/src/Umbraco.Core/packages.config +++ b/src/Umbraco.Core/packages.config @@ -2,7 +2,7 @@ - + @@ -12,9 +12,9 @@ - + - + \ No newline at end of file diff --git a/src/Umbraco.Tests.Benchmarks/App.config b/src/Umbraco.Tests.Benchmarks/App.config index a988966f23..4fecf67bbd 100644 --- a/src/Umbraco.Tests.Benchmarks/App.config +++ b/src/Umbraco.Tests.Benchmarks/App.config @@ -1,7 +1,7 @@  - + @@ -43,6 +43,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + diff --git a/src/Umbraco.Tests.Benchmarks/Umbraco.Tests.Benchmarks.csproj b/src/Umbraco.Tests.Benchmarks/Umbraco.Tests.Benchmarks.csproj index 39d77bbc26..0b0da403fb 100644 --- a/src/Umbraco.Tests.Benchmarks/Umbraco.Tests.Benchmarks.csproj +++ b/src/Umbraco.Tests.Benchmarks/Umbraco.Tests.Benchmarks.csproj @@ -9,10 +9,11 @@ Properties Umbraco.Tests.Benchmarks Umbraco.Tests.Benchmarks - v4.5 + v4.6.2 512 + AnyCPU @@ -59,8 +60,17 @@ ..\packages\Microsoft.Diagnostics.Tracing.TraceEvent.1.0.41\lib\net40\Microsoft.Diagnostics.Tracing.TraceEvent.dll - - ..\packages\System.Collections.Immutable.1.1.37\lib\dotnet\System.Collections.Immutable.dll + + ..\packages\System.AppContext.4.1.0\lib\net46\System.AppContext.dll + True + + + ..\packages\System.Collections.Immutable.1.2.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll + True + + + + ..\packages\System.Console.4.0.0\lib\net46\System.Console.dll True @@ -70,19 +80,81 @@ ..\packages\SqlServerCE.4.0.0.1\lib\System.Data.SqlServerCe.Entity.dll + + ..\packages\System.Diagnostics.FileVersionInfo.4.0.0\lib\net46\System.Diagnostics.FileVersionInfo.dll + True + + + ..\packages\System.Diagnostics.StackTrace.4.0.1\lib\net46\System.Diagnostics.StackTrace.dll + + + ..\packages\System.IO.FileSystem.4.0.1\lib\net46\System.IO.FileSystem.dll + True + + + ..\packages\System.IO.FileSystem.Primitives.4.0.1\lib\net46\System.IO.FileSystem.Primitives.dll + True + - - ..\packages\System.Reflection.Metadata.1.2.0\lib\portable-net45+win8\System.Reflection.Metadata.dll + + + ..\packages\System.Reflection.4.1.0\lib\net462\System.Reflection.dll + + + ..\packages\System.Reflection.Metadata.1.3.0\lib\portable-net45+win8\System.Reflection.Metadata.dll + + + ..\packages\System.Runtime.4.1.0\lib\net462\System.Runtime.dll + + + ..\packages\System.Runtime.Extensions.4.1.0\lib\net462\System.Runtime.Extensions.dll + + + ..\packages\System.Runtime.InteropServices.4.1.0\lib\net462\System.Runtime.InteropServices.dll + + + ..\packages\System.Security.Cryptography.Algorithms.4.2.0\lib\net461\System.Security.Cryptography.Algorithms.dll + + + ..\packages\System.Security.Cryptography.Encoding.4.0.0\lib\net46\System.Security.Cryptography.Encoding.dll + True + + + ..\packages\System.Security.Cryptography.Primitives.4.0.0\lib\net46\System.Security.Cryptography.Primitives.dll + True + + + ..\packages\System.Security.Cryptography.X509Certificates.4.1.0\lib\net461\System.Security.Cryptography.X509Certificates.dll + + + ..\packages\System.Text.Encoding.CodePages.4.0.1\lib\net46\System.Text.Encoding.CodePages.dll + True ..\packages\System.Threading.Tasks.Extensions.4.0.0\lib\portable-net45+win8+wp8+wpa81\System.Threading.Tasks.Extensions.dll + + ..\packages\System.Threading.Thread.4.0.0\lib\net46\System.Threading.Thread.dll + True + + + ..\packages\System.Xml.XmlDocument.4.0.1\lib\net46\System.Xml.XmlDocument.dll + True + + + ..\packages\System.Xml.XPath.4.0.1\lib\net46\System.Xml.XPath.dll + True + + + ..\packages\System.Xml.XPath.XDocument.4.0.1\lib\net46\System.Xml.XPath.XDocument.dll + True + diff --git a/src/Umbraco.Tests.Benchmarks/packages.config b/src/Umbraco.Tests.Benchmarks/packages.config index c4d2ba1df2..7a8b84c7d4 100644 --- a/src/Umbraco.Tests.Benchmarks/packages.config +++ b/src/Umbraco.Tests.Benchmarks/packages.config @@ -10,16 +10,45 @@ - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Umbraco.Tests/App.config b/src/Umbraco.Tests/App.config index 1684b8d504..0f8fa70862 100644 --- a/src/Umbraco.Tests/App.config +++ b/src/Umbraco.Tests/App.config @@ -91,7 +91,7 @@ - + @@ -124,7 +124,7 @@ - + diff --git a/src/Umbraco.Tests/Migrations/SqlScripts/SqlResources.Designer.cs b/src/Umbraco.Tests/Migrations/SqlScripts/SqlResources.Designer.cs index d42cac22b3..55eec4b23e 100644 --- a/src/Umbraco.Tests/Migrations/SqlScripts/SqlResources.Designer.cs +++ b/src/Umbraco.Tests/Migrations/SqlScripts/SqlResources.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18034 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -93,19 +93,20 @@ namespace Umbraco.Tests.Migrations.SqlScripts { ///, [userTypeDefaultPermissions] nvarchar(50) NULL ///); ///GO - ///CREATE TABLE [umbracoUserLogins] ( - /// [contextID] uniqueidentifier NOT NULL - ///, [userID] int NOT NULL - ///, [timeout] bigint NOT NULL - ///); - ///GO ///CREATE TABLE [umbracoUser2NodePermission] ( /// [userId] int NOT NULL ///, [nodeId] int NOT NULL ///, [permission] nchar(1) NOT NULL ///); ///GO - ///CREATE TABLE [umbracoUser2Nod [rest of string was truncated]";. + ///CREATE TABLE [umbracoUser2NodeNotify] ( + /// [userId] int NOT NULL + ///, [nodeId] int NOT NULL + ///, [action] nchar(1) NOT NULL + ///); + ///GO + ///CREATE TABLE [umbracoUser] ( + /// [id] in [rest of string was truncated]";. /// internal static string SqlCe_SchemaAndData_4110 { get { diff --git a/src/Umbraco.Tests/Services/Importing/ImportResources.Designer.cs b/src/Umbraco.Tests/Services/Importing/ImportResources.Designer.cs index bcc287e2ae..c640d21aa7 100644 --- a/src/Umbraco.Tests/Services/Importing/ImportResources.Designer.cs +++ b/src/Umbraco.Tests/Services/Importing/ImportResources.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.34209 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. diff --git a/src/Umbraco.Tests/TreesAndSections/ResourceFiles.Designer.cs b/src/Umbraco.Tests/TreesAndSections/ResourceFiles.Designer.cs index a37e2cf266..c09ce53b04 100644 --- a/src/Umbraco.Tests/TreesAndSections/ResourceFiles.Designer.cs +++ b/src/Umbraco.Tests/TreesAndSections/ResourceFiles.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.34011 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. diff --git a/src/Umbraco.Tests/Umbraco.Tests.csproj b/src/Umbraco.Tests/Umbraco.Tests.csproj index 93c4524801..ffd5f18292 100644 --- a/src/Umbraco.Tests/Umbraco.Tests.csproj +++ b/src/Umbraco.Tests/Umbraco.Tests.csproj @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -10,7 +10,7 @@ Properties Umbraco.Tests Umbraco.Tests - v4.5 + v4.6.2 512 ..\ true @@ -58,9 +58,8 @@ ..\packages\AutoMapper.3.3.1\lib\net40\AutoMapper.Net4.dll - - ..\packages\Examine.0.1.80\lib\net45\Examine.dll - True + + ..\packages\Examine.0.1.81\lib\net45\Examine.dll ..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll @@ -83,9 +82,8 @@ ..\packages\Moq.4.1.1309.0919\lib\net40\Moq.dll - - ..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll - True + + ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll ..\packages\NUnit.2.6.2\lib\nunit.framework.dll @@ -93,8 +91,8 @@ ..\packages\Owin.1.0\lib\net40\Owin.dll - - ..\packages\semver.1.1.2\lib\net45\Semver.dll + + ..\packages\Semver.2.0.4\lib\net452\Semver.dll diff --git a/src/Umbraco.Tests/UmbracoExamine/TestFiles.Designer.cs b/src/Umbraco.Tests/UmbracoExamine/TestFiles.Designer.cs index ce86c80041..d79535420a 100644 --- a/src/Umbraco.Tests/UmbracoExamine/TestFiles.Designer.cs +++ b/src/Umbraco.Tests/UmbracoExamine/TestFiles.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.0 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. diff --git a/src/Umbraco.Tests/packages.config b/src/Umbraco.Tests/packages.config index 733d653401..383854f5fd 100644 --- a/src/Umbraco.Tests/packages.config +++ b/src/Umbraco.Tests/packages.config @@ -2,7 +2,7 @@ - + @@ -17,11 +17,11 @@ - + - + \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbstickybar.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbstickybar.directive.js index cee705b8e8..91a0a41a10 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbstickybar.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbstickybar.directive.js @@ -36,119 +36,119 @@ Use this directive make an element sticky and follow the page when scrolling. @param {string} scrollableContainer Set the class (".element") or the id ("#element") of the scrollable container element. **/ -(function() { - 'use strict'; +(function () { + 'use strict'; - function StickyBarDirective($rootScope) { + function StickyBarDirective($rootScope) { - function link(scope, el, attr, ctrl) { + function link(scope, el, attr, ctrl) { - var bar = $(el); - var scrollableContainer = null; - var clonedBar = null; - var cloneIsMade = false; - var barTop = bar.context.offsetTop; + var bar = $(el); + var scrollableContainer = null; + var clonedBar = null; + var cloneIsMade = false; - function activate() { + function activate() { - if (attr.scrollableContainer) { - scrollableContainer = $(attr.scrollableContainer); - } else { - scrollableContainer = $(window); - } + if (attr.scrollableContainer) { + scrollableContainer = $(attr.scrollableContainer); + } else { + scrollableContainer = $(window); + } - scrollableContainer.on('scroll.umbStickyBar', determineVisibility).trigger("scroll"); - $(window).on('resize.umbStickyBar', determineVisibility); + scrollableContainer.on('scroll.umbStickyBar', determineVisibility).trigger("scroll"); + $(window).on('resize.umbStickyBar', determineVisibility); - scope.$on('$destroy', function() { - scrollableContainer.off('.umbStickyBar'); - $(window).off('.umbStickyBar'); - }); - - } - - function determineVisibility() { - - var scrollTop = scrollableContainer.scrollTop(); - - if (scrollTop > barTop) { - - if (!cloneIsMade) { - - createClone(); - - clonedBar.css({ - 'visibility': 'visible' - }); - - } else { - - calculateSize(); - - } - - } else { - - if (cloneIsMade) { - - //remove cloned element (switched places with original on creation) - bar.remove(); - bar = clonedBar; - clonedBar = null; - - bar.removeClass('-umb-sticky-bar'); - bar.css({ - position: 'relative', - 'width': 'auto', - 'height': 'auto', - 'z-index': 'auto', - 'visibility': 'visible' - }); - - cloneIsMade = false; - - } + scope.$on('$destroy', function () { + scrollableContainer.off('.umbStickyBar'); + $(window).off('.umbStickyBar'); + }); } - } + function determineVisibility() { - function calculateSize() { - clonedBar.css({ - width: bar.outerWidth(), - height: bar.height() - }); - } + var barTop = bar[0].offsetTop; + var scrollTop = scrollableContainer.scrollTop(); - function createClone() { - //switch place with cloned element, to keep binding intact - clonedBar = bar; - bar = clonedBar.clone(); - clonedBar.after(bar); - clonedBar.addClass('-umb-sticky-bar'); - clonedBar.css({ - 'position': 'fixed', - 'z-index': 500, - 'visibility': 'hidden' - }); + if (scrollTop > barTop) { - cloneIsMade = true; - calculateSize(); + if (!cloneIsMade) { - } + createClone(); - activate(); + clonedBar.css({ + 'visibility': 'visible' + }); - } + } else { - var directive = { - restrict: 'A', - link: link - }; + calculateSize(); - return directive; - } + } - angular.module('umbraco.directives').directive('umbStickyBar', StickyBarDirective); + } else { + + if (cloneIsMade) { + + //remove cloned element (switched places with original on creation) + bar.remove(); + bar = clonedBar; + clonedBar = null; + + bar.removeClass('-umb-sticky-bar'); + bar.css({ + position: 'relative', + 'width': 'auto', + 'height': 'auto', + 'z-index': 'auto', + 'visibility': 'visible' + }); + + cloneIsMade = false; + + } + + } + + } + + function calculateSize() { + clonedBar.css({ + width: bar.outerWidth(), + height: bar.height() + }); + } + + function createClone() { + //switch place with cloned element, to keep binding intact + clonedBar = bar; + bar = clonedBar.clone(); + clonedBar.after(bar); + clonedBar.addClass('-umb-sticky-bar'); + clonedBar.css({ + 'position': 'fixed', + 'z-index': 500, + 'visibility': 'hidden' + }); + + cloneIsMade = true; + calculateSize(); + + } + + activate(); + + } + + var directive = { + restrict: 'A', + link: link + }; + + return directive; + } + + angular.module('umbraco.directives').directive('umbStickyBar', StickyBarDirective); })(); diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/codefile.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/codefile.resource.js index b6e35d9d7b..e83bb4f14e 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/codefile.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/codefile.resource.js @@ -77,39 +77,6 @@ function codefileResource($q, $http, umbDataFormatter, umbRequestHelper) { "Failed to retrieve data for template with alias: " + alias); }, - - /** - * @ngdoc method - * @name umbraco.resources.codefileResource#getScaffold - * @methodOf umbraco.resources.codefileResource - * - * @description - * Returns a scaffold of an empty codefile item - * - * The scaffold is used to build editors for code file editors that has not yet been populated with data. - * - * ##usage - *
-         * codefileResource.getScaffold()
-         *    .then(function(template) {
-         *        alert('its here!');
-         *    });
-         * 
- * - * @returns {Promise} resourcePromise object containing the codefile scaffold. - * - */ - getScaffold: function (id) { - - return umbRequestHelper.resourcePromise( - $http.get( - umbRequestHelper.getApiUrl( - "templateApiBaseUrl", - "GetScaffold", - [{ id: id }])), - "Failed to retrieve data for empty template"); - }, - /** * @ngdoc method * @name umbraco.resources.codefileResource#deleteByPath @@ -176,7 +143,70 @@ function codefileResource($q, $http, umbDataFormatter, umbRequestHelper) { "PostSave"), codeFile), "Failed to save data for code file " + codeFile.virtualPath); + }, + + /** + * @ngdoc method + * @name umbraco.resources.codefileResource#getSnippets + * @methodOf umbraco.resources.codefileResource + * + * @description + * Gets code snippets for a given file type + * + * ##usage + *
+         * codefileResource.getSnippets("partialViews")
+         *    .then(function(snippets) {
+         *        alert('its here!');
+         *    });
+         * 
+ * + * @param {string} file type: (partialViews, partialViewMacros) + * @returns {Promise} resourcePromise object. + * + */ + getSnippets: function (fileType) { + return umbRequestHelper.resourcePromise( + $http.get( + umbRequestHelper.getApiUrl( + "codeFileApiBaseUrl", + "GetSnippets?type=" + fileType )), + "Failed to get snippet for" + fileType); + }, + + /** + * @ngdoc method + * @name umbraco.resources.codefileResource#getScaffold + * @methodOf umbraco.resources.codefileResource + * + * @description + * Returns a scaffold of an empty codefile item. + * + * The scaffold is used to build editors for code file editors that has not yet been populated with data. + * + * ##usage + *
+         * codefileResource.getScaffold("partialViews", "Breadcrumb")
+         *    .then(function(data) {
+         *        alert('its here!');
+         *    });
+         * 
+ * + * @param {string} File type: (scripts, partialViews, partialViewMacros). + * @param {string} Snippet name (Ex. Breadcrumb). + * @returns {Promise} resourcePromise object. + * + */ + + getScaffold: function (type, id, snippetName) { + return umbRequestHelper.resourcePromise( + $http.get( + umbRequestHelper.getApiUrl( + "codeFileApiBaseUrl", + "GetScaffold?type=" + type + "&id=" + id + "&snippetName=" + snippetName)), + "Failed to get scaffold for" + type); } + }; } diff --git a/src/Umbraco.Web.UI.Client/src/views/partialviewmacros/create.controller.js b/src/Umbraco.Web.UI.Client/src/views/partialviewmacros/create.controller.js new file mode 100644 index 0000000000..3b3fb0f9f5 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/views/partialviewmacros/create.controller.js @@ -0,0 +1,55 @@ +(function () { + "use strict"; + + function PartialViewMacrosCreateController($scope, codefileResource, $location, navigationService) { + + var vm = this; + var node = $scope.dialogOptions.currentNode; + + vm.snippets = []; + vm.showSnippets = false; + vm.creatingFolder = false; + + vm.createPartialViewMacro = createPartialViewMacro; + vm.showCreateFolder = showCreateFolder; + vm.createFolder = createFolder; + vm.showCreateFromSnippet = showCreateFromSnippet; + + function onInit() { + codefileResource.getSnippets('partialViewMacros') + .then(function(snippets) { + vm.snippets = snippets; + }); + } + + function createPartialViewMacro(selectedSnippet) { + + var snippet = null; + + if(selectedSnippet && selectedSnippet.fileName) { + snippet = selectedSnippet.fileName; + } + + $location.path("/developer/partialviewmacros/edit/" + node.id).search("create", "true").search("snippet", snippet); + navigationService.hideMenu(); + + } + + function showCreateFolder() { + vm.creatingFolder = true; + } + + function createFolder() { + + } + + function showCreateFromSnippet() { + vm.showSnippets = true; + } + + onInit(); + + } + + angular.module("umbraco").controller("Umbraco.Editors.PartialViewMacros.CreateController", PartialViewMacrosCreateController); +})(); diff --git a/src/Umbraco.Web.UI.Client/src/views/partialviewmacros/create.html b/src/Umbraco.Web.UI.Client/src/views/partialviewmacros/create.html new file mode 100644 index 0000000000..aa8796ae7a --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/views/partialviewmacros/create.html @@ -0,0 +1,75 @@ +
+ + + + + + +
diff --git a/src/Umbraco.Web.UI.Client/src/views/partialviewmacros/edit.controller.js b/src/Umbraco.Web.UI.Client/src/views/partialviewmacros/edit.controller.js index c402f42ee7..4860773b02 100644 --- a/src/Umbraco.Web.UI.Client/src/views/partialviewmacros/edit.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/partialviewmacros/edit.controller.js @@ -227,10 +227,19 @@ function init() { //we need to load this somewhere, for now its here. assetsService.loadCss("lib/ace-razor-mode/theme/razor_chrome.css"); + if ($routeParams.create) { - codefileResource.getScaffold().then(function (partialViewMacro) { + + var snippet = "Empty"; + + if($routeParams.snippet) { + snippet = $routeParams.snippet; + } + + codefileResource.getScaffold("partialViewMacros", $routeParams.id, snippet).then(function (partialViewMacro) { ready(partialViewMacro); }); + } else { codefileResource.getByPath('partialViewMacros', $routeParams.id).then(function (partialViewMacro) { ready(partialViewMacro); diff --git a/src/Umbraco.Web.UI.Client/src/views/partialviews/create.controller.js b/src/Umbraco.Web.UI.Client/src/views/partialviews/create.controller.js new file mode 100644 index 0000000000..5aeaa28935 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/views/partialviews/create.controller.js @@ -0,0 +1,55 @@ +(function () { + "use strict"; + + function PartialViewsCreateController($scope, codefileResource, $location, navigationService) { + + var vm = this; + var node = $scope.dialogOptions.currentNode; + + vm.snippets = []; + vm.showSnippets = false; + vm.creatingFolder = false; + + vm.createPartialView = createPartialView; + vm.showCreateFolder = showCreateFolder; + vm.createFolder = createFolder; + vm.showCreateFromSnippet = showCreateFromSnippet; + + function onInit() { + codefileResource.getSnippets('partialViews') + .then(function(snippets) { + vm.snippets = snippets; + }); + } + + function createPartialView(selectedSnippet) { + + var snippet = null; + + if(selectedSnippet && selectedSnippet.fileName) { + snippet = selectedSnippet.fileName; + } + + $location.path("/settings/partialviews/edit/" + node.id).search("create", "true").search("snippet", snippet); + navigationService.hideMenu(); + + } + + function showCreateFolder() { + vm.creatingFolder = true; + } + + function createFolder() { + + } + + function showCreateFromSnippet() { + vm.showSnippets = true; + } + + onInit(); + + } + + angular.module("umbraco").controller("Umbraco.Editors.PartialViews.CreateController", PartialViewsCreateController); +})(); diff --git a/src/Umbraco.Web.UI.Client/src/views/partialviews/create.html b/src/Umbraco.Web.UI.Client/src/views/partialviews/create.html new file mode 100644 index 0000000000..fc9bf98c4f --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/views/partialviews/create.html @@ -0,0 +1,75 @@ +
+ + + + + + +
diff --git a/src/Umbraco.Web.UI.Client/src/views/partialviews/edit.controller.js b/src/Umbraco.Web.UI.Client/src/views/partialviews/edit.controller.js index dc388a906b..a493ed30c1 100644 --- a/src/Umbraco.Web.UI.Client/src/views/partialviews/edit.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/partialviews/edit.controller.js @@ -227,15 +227,25 @@ function init() { //we need to load this somewhere, for now its here. assetsService.loadCss("lib/ace-razor-mode/theme/razor_chrome.css"); + if ($routeParams.create) { - codefileResource.getScaffold().then(function (partialView) { + + var snippet = "Empty"; + + if($routeParams.snippet) { + snippet = $routeParams.snippet; + } + + codefileResource.getScaffold("partialViews", $routeParams.id, snippet).then(function (partialView) { ready(partialView); }); + } else { codefileResource.getByPath('partialViews', $routeParams.id).then(function (partialView) { ready(partialView); }); } + } function ready(partialView) { diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/macrocontainer/macrocontainer.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/macrocontainer/macrocontainer.controller.js index b74e30004e..f0fe89b14f 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/macrocontainer/macrocontainer.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/macrocontainer/macrocontainer.controller.js @@ -3,7 +3,11 @@ angular.module('umbraco') .controller("Umbraco.PropertyEditors.MacroContainerController", function($scope, dialogService, entityResource, macroService){ + $scope.renderModel = []; + $scope.allowOpenButton = true; + $scope.allowRemoveButton = true; + $scope.sortableOptions = {}; if($scope.model.value){ var macros = $scope.model.value.split('>'); @@ -20,6 +24,7 @@ angular.module('umbraco') parsed.syntax = syntax; collectDetails(parsed); $scope.renderModel.push(parsed); + setSortingState($scope.renderModel); } }); } @@ -27,11 +32,12 @@ angular.module('umbraco') function collectDetails(macro){ macro.details = ""; + macro.icon = "icon-settings-alt"; if(macro.macroParamsDictionary){ angular.forEach((macro.macroParamsDictionary), function(value, key){ macro.details += key + ": " + value + " "; }); - } + } } function openDialog(index){ @@ -61,6 +67,8 @@ angular.module('umbraco') $scope.renderModel.push(macroObject); } + setSortingState($scope.renderModel); + $scope.macroPickerOverlay.show = false; $scope.macroPickerOverlay = null; }; @@ -90,6 +98,7 @@ angular.module('umbraco') $scope.remove =function(index){ $scope.renderModel.splice(index, 1); + setSortingState($scope.renderModel); }; $scope.clear = function() { @@ -117,4 +126,13 @@ angular.module('umbraco') return str.replace(rgxtrim, ''); } + function setSortingState(items) { + // disable sorting if the list only consist of one item + if(items.length > 1) { + $scope.sortableOptions.disabled = false; + } else { + $scope.sortableOptions.disabled = true; + } + } + }); diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/macrocontainer/macrocontainer.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/macrocontainer/macrocontainer.html index 96c74c9c55..1dec2788e2 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/macrocontainer/macrocontainer.html +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/macrocontainer/macrocontainer.html @@ -1,30 +1,27 @@
- - - + + Add + + +
+
Create an item under {{currentNode.name}}
+ + + +
+ +
+
+ +
+
{{error.errorMsg}}
+

{{error.data.message}}

+
+ + + + + + +
+
+ +
+ + diff --git a/src/Umbraco.Web.UI.Client/src/views/scripts/edit.controller.js b/src/Umbraco.Web.UI.Client/src/views/scripts/edit.controller.js index cd10ae75d5..d2a5fcbc0e 100644 --- a/src/Umbraco.Web.UI.Client/src/views/scripts/edit.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/scripts/edit.controller.js @@ -79,7 +79,7 @@ assetsService.loadCss("lib/ace-razor-mode/theme/razor_chrome.css"); if ($routeParams.create) { - codefileResource.getScaffold().then(function (script) { + codefileResource.getScaffold("scripts", $routeParams.id).then(function (script) { ready(script); }); } else { diff --git a/src/Umbraco.Web.UI/Properties/Settings.Designer.cs b/src/Umbraco.Web.UI/Properties/Settings.Designer.cs index 962354c575..27ed7eb256 100644 --- a/src/Umbraco.Web.UI/Properties/Settings.Designer.cs +++ b/src/Umbraco.Web.UI/Properties/Settings.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18408 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -12,7 +12,7 @@ namespace Umbraco.Web.UI.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.0.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index db2c91b0ee..f580b3c5df 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -1,5 +1,5 @@  - + 9.0.30729 @@ -37,7 +37,7 @@ 4.0 - v4.5 + v4.6.2 true 44319 @@ -127,19 +127,19 @@ False ..\packages\dotless.1.4.1.0\lib\dotless.Core.dll
- - ..\packages\Examine.0.1.80\lib\net45\Examine.dll - True + + ..\packages\Examine.0.1.81\lib\net45\Examine.dll False ..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll - - ..\packages\ImageProcessor.2.5.1\lib\net45\ImageProcessor.dll + + ..\packages\ImageProcessor.2.5.2\lib\net45\ImageProcessor.dll + True - - ..\packages\ImageProcessor.Web.4.8.0\lib\net45\ImageProcessor.Web.dll + + ..\packages\ImageProcessor.Web.4.8.2\lib\net45\ImageProcessor.Web.dll True @@ -167,7 +167,8 @@ - ..\packages\Microsoft.IO.RecyclableMemoryStream.1.2.0\lib\net45\Microsoft.IO.RecyclableMemoryStream.dll + ..\packages\Microsoft.IO.RecyclableMemoryStream.1.2.1\lib\net45\Microsoft.IO.RecyclableMemoryStream.dll + True ..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll @@ -201,9 +202,8 @@ False ..\packages\MySql.Data.6.9.8\lib\net45\MySql.Data.dll - - ..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll - True + + ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll ..\packages\Owin.1.0\lib\net40\Owin.dll diff --git a/src/Umbraco.Web.UI/packages.config b/src/Umbraco.Web.UI/packages.config index 41cdd7bfb3..e113042d59 100644 --- a/src/Umbraco.Web.UI/packages.config +++ b/src/Umbraco.Web.UI/packages.config @@ -4,9 +4,9 @@ - - - + + + @@ -22,7 +22,7 @@ - + @@ -31,7 +31,7 @@ - + diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml index 444ecc2e3d..f6823e766f 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml @@ -197,6 +197,11 @@ Document Type without a template New folder New data type + New javascript file + New empty partial view + New partial view from snippet + New empty partial view macro + New partial view macro from snippet Browse your website diff --git a/src/Umbraco.Web.UI/web.Template.Debug.config b/src/Umbraco.Web.UI/web.Template.Debug.config index 68a45ff299..2ca0b6003a 100644 --- a/src/Umbraco.Web.UI/web.Template.Debug.config +++ b/src/Umbraco.Web.UI/web.Template.Debug.config @@ -382,7 +382,7 @@ xdt:Locator="Condition(_defaultNamespace:assemblyIdentity[@name='Newtonsoft.Json']])"/> - + - + diff --git a/src/Umbraco.Web/Cache/PageCacheRefresher.cs b/src/Umbraco.Web/Cache/PageCacheRefresher.cs index 75118a6748..fc6e0c8d20 100644 --- a/src/Umbraco.Web/Cache/PageCacheRefresher.cs +++ b/src/Umbraco.Web/Cache/PageCacheRefresher.cs @@ -74,7 +74,7 @@ namespace Umbraco.Web.Cache public override void Remove(int id) { ApplicationContext.Current.ApplicationCache.ClearPartialViewCache(); - content.Instance.ClearDocumentCache(id); + content.Instance.ClearDocumentCache(id, false); DistributedCache.Instance.ClearAllMacroCacheOnCurrentServer(); DistributedCache.Instance.ClearXsltCacheOnCurrentServer(); ClearAllIsolatedCacheByEntityType(); @@ -95,7 +95,7 @@ namespace Umbraco.Web.Cache public override void Remove(IContent instance) { ApplicationContext.Current.ApplicationCache.ClearPartialViewCache(); - content.Instance.ClearDocumentCache(new Document(instance)); + content.Instance.ClearDocumentCache(new Document(instance), false); XmlPublishedContent.ClearRequest(); DistributedCache.Instance.ClearAllMacroCacheOnCurrentServer(); DistributedCache.Instance.ClearXsltCacheOnCurrentServer(); diff --git a/src/Umbraco.Web/Editors/CodeFileController.cs b/src/Umbraco.Web/Editors/CodeFileController.cs index 58dd28a15e..bcb6630c0a 100644 --- a/src/Umbraco.Web/Editors/CodeFileController.cs +++ b/src/Umbraco.Web/Editors/CodeFileController.cs @@ -1,7 +1,12 @@ using AutoMapper; +using System.Collections.Generic; +using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; +using ClientDependency.Core; +using Umbraco.Core; +using Umbraco.Core.IO; using Umbraco.Core.Models; using Umbraco.Core.Services; using Umbraco.Web.Models.ContentEditing; @@ -9,7 +14,6 @@ using Umbraco.Web.Mvc; using Umbraco.Web.WebApi; using Umbraco.Web.WebApi.Filters; using Umbraco.Web.Trees; -using Umbraco.Core.IO; namespace Umbraco.Web.Editors { @@ -32,11 +36,13 @@ namespace Umbraco.Web.Editors { case Core.Constants.Trees.PartialViews: var view = new PartialView(display.VirtualPath); + view.Content = display.Content; var result = Services.FileService.CreatePartialView(view, display.Snippet, Security.CurrentUser.Id); return result.Success == true ? Request.CreateResponse(HttpStatusCode.OK) : Request.CreateNotificationValidationErrorResponse(result.Exception.Message); case Core.Constants.Trees.PartialViewMacros: var viewMacro = new PartialView(display.VirtualPath); + viewMacro.Content = display.Content; var resultMacro = Services.FileService.CreatePartialViewMacro(viewMacro, display.Snippet, Security.CurrentUser.Id); return resultMacro.Success == true ? Request.CreateResponse(HttpStatusCode.OK) : Request.CreateNotificationValidationErrorResponse(resultMacro.Exception.Message); @@ -105,6 +111,95 @@ namespace Umbraco.Web.Editors throw new HttpResponseException(HttpStatusCode.NotFound); } + /// + /// Used to get a list of available templates/snippets to base a new Partial View og Partial View Macro from + /// + /// This is a string but will be 'partialViews', 'partialViewMacros' + /// Returns a list of if a correct type is sent + public IEnumerable GetSnippets(string type) + { + if (string.IsNullOrWhiteSpace(type)) + { + throw new HttpResponseException(HttpStatusCode.BadRequest); + } + + IEnumerable snippets; + switch (type) + { + case Core.Constants.Trees.PartialViews: + snippets = Services.FileService.GetPartialViewSnippetNames( + //ignore these - (this is taken from the logic in "PartialView.ascx.cs") + "Gallery", + "ListChildPagesFromChangeableSource", + "ListChildPagesOrderedByProperty", + "ListImagesFromMediaFolder"); + break; + case Core.Constants.Trees.PartialViewMacros: + snippets = Services.FileService.GetPartialViewSnippetNames(); + break; + default: + throw new HttpResponseException(HttpStatusCode.NotFound); + } + + return snippets.Select(snippet => new SnippetDisplay() {Name = snippet.SplitPascalCasing().ToFirstUpperInvariant(), FileName = snippet}); + } + + /// + /// Used to scaffold the json object for the editors for 'scripts', 'partialViews', 'partialViewMacros' + /// + /// This is a string but will be 'scripts' 'partialViews', 'partialViewMacros' + /// + /// + /// + public CodeFileDisplay GetScaffold(string type, string id = null, string snippetName = null) + { + if (string.IsNullOrWhiteSpace(type)) + { + throw new HttpResponseException(HttpStatusCode.BadRequest); + } + + if (id.IsNullOrWhiteSpace()) + id = string.Empty; + + CodeFileDisplay codeFileDisplay; + + switch (type) + { + case Core.Constants.Trees.PartialViews: + codeFileDisplay = Mapper.Map(new PartialView(string.Empty)); + codeFileDisplay.VirtualPath = SystemDirectories.PartialViews; + if (snippetName.IsNullOrWhiteSpace() == false) + codeFileDisplay.Content = Services.FileService.GetPartialViewSnippetContent(snippetName); + break; + case Core.Constants.Trees.PartialViewMacros: + codeFileDisplay = Mapper.Map(new PartialView(string.Empty)); + codeFileDisplay.VirtualPath = SystemDirectories.MacroPartials; + if (snippetName.IsNullOrWhiteSpace() == false) + codeFileDisplay.Content = Services.FileService.GetPartialViewMacroSnippetContent(snippetName); + break; + case Core.Constants.Trees.Scripts: + codeFileDisplay = Mapper.Map(new Script(string.Empty)); + codeFileDisplay.VirtualPath = SystemDirectories.Scripts; + break; + default: + throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Unsupported editortype")); + } + + // Make sure that the root virtual path ends with '/' + codeFileDisplay.VirtualPath = codeFileDisplay.VirtualPath.EnsureEndsWith("/"); + + if (id.IsNullOrWhiteSpace() == false && id != Core.Constants.System.Root.ToInvariantString()) + { + codeFileDisplay.VirtualPath += id.TrimStart("/").EnsureEndsWith("/"); + } + + codeFileDisplay.VirtualPath = codeFileDisplay.VirtualPath.TrimStart("~"); + codeFileDisplay.Path = Url.GetTreePathFromFilePath(id); + codeFileDisplay.FileType = type; + + return codeFileDisplay; + } + /// /// Used to delete a specific file from disk via the FileService /// @@ -150,7 +245,7 @@ namespace Umbraco.Web.Editors } /// - /// Used to save/update an existing file after its initial creation + /// Used to create or update a 'partialview', 'partialviewmacro' or 'script' file /// /// /// The updated CodeFileDisplay model @@ -166,81 +261,56 @@ namespace Umbraco.Web.Editors throw new HttpResponseException(HttpStatusCode.NotFound); } - switch (display.FileType) { case Core.Constants.Trees.PartialViews: - var view = Services.FileService.GetPartialView(display.VirtualPath); - if (view != null) + var partialViewResult = CreateOrUpdatePartialView(display); + if (partialViewResult.Success) { - // might need to find the path - var orgPath = view.OriginalPath.Substring(0, view.OriginalPath.IndexOf(view.Name)); - view.Path = orgPath + display.Name; - view.Content = display.Content; - - //Save the file and update the response to reflect any name and path changes - var result = Services.FileService.SavePartialView(view, Security.CurrentUser.Id); - if (result.Success == true) - { - display = Mapper.Map(result.Result, display); - display.Path = Url.GetTreePathFromFilePath(view.Path); - return display; - } - - display.AddErrorNotification( - Services.TextService.Localize("speechBubbles/partialViewErrorHeader"), - Services.TextService.Localize("speechBubbles/partialViewErrorText")); - } - else - { - throw new HttpResponseException(HttpStatusCode.NotFound); + display = Mapper.Map(partialViewResult.Result, display); + display.Path = Url.GetTreePathFromFilePath(partialViewResult.Result.Path); + return display; } + + display.AddErrorNotification( + Services.TextService.Localize("speechBubbles/partialViewErrorHeader"), + Services.TextService.Localize("speechBubbles/partialViewErrorText")); break; case Core.Constants.Trees.PartialViewMacros: - var viewMacro = Services.FileService.GetPartialViewMacro(display.VirtualPath); - if (viewMacro != null) + var partialViewMacroResult = CreateOrUpdatePartialViewMacro(display); + if (partialViewMacroResult.Success) { - viewMacro.Content = display.Content; - viewMacro.Path = display.Name; - - //save the file and update the display to reflect any path and name changes - var result = Services.FileService.SavePartialViewMacro(viewMacro, Security.CurrentUser.Id); - if (result.Success == true) - { - display = Mapper.Map(result.Result, display); - display.Path = Url.GetTreePathFromFilePath(result.Result.Path); - return display; - } - - display.AddErrorNotification( - Services.TextService.Localize("speechBubbles/partialViewErrorHeader"), - Services.TextService.Localize("speechBubbles/partialViewErrorText")); - } - else - { - throw new HttpResponseException(HttpStatusCode.NotFound); + display = Mapper.Map(partialViewMacroResult.Result, display); + display.Path = Url.GetTreePathFromFilePath(partialViewMacroResult.Result.Path); + return display; } + + display.AddErrorNotification( + Services.TextService.Localize("speechBubbles/partialViewErrorHeader"), + Services.TextService.Localize("speechBubbles/partialViewErrorText")); break; case Core.Constants.Trees.Scripts: + var virtualPath = display.VirtualPath; var script = Services.FileService.GetScriptByName(display.VirtualPath); if (script != null) { - script.Content = display.Content; script.Path = display.Name; - - Services.FileService.SaveScript(script, Security.CurrentUser.Id); display = Mapper.Map(script, display); display.Path = Url.GetTreePathFromFilePath(script.Path); return display; - } else { - throw new HttpResponseException(HttpStatusCode.NotFound); + var fileName = EnsurePartialViewExtension(display.Name, ".js"); + script = new Script(virtualPath + fileName); } + + script.Content = display.Content; + + Services.FileService.SaveScript(script, Security.CurrentUser.Id); break; default: @@ -249,5 +319,74 @@ namespace Umbraco.Web.Editors return display; } + + private Attempt CreateOrUpdatePartialView(CodeFileDisplay display) + { + Attempt partialViewResult; + string virtualPath = NormalizeVirtualPath(display.VirtualPath, SystemDirectories.PartialViews); + var view = Services.FileService.GetPartialView(virtualPath); + if (view != null) + { + // might need to find the path + var orgPath = view.OriginalPath.Substring(0, view.OriginalPath.IndexOf(view.Name)); + view.Path = orgPath + display.Name; + + view.Content = display.Content; + partialViewResult = Services.FileService.SavePartialView(view, Security.CurrentUser.Id); + } + else + { + var fileName = EnsurePartialViewExtension(display.Name, ".cshtml"); + view = new PartialView(virtualPath + fileName); + view.Content = display.Content; + partialViewResult = Services.FileService.CreatePartialView(view, display.Snippet, Security.CurrentUser.Id); + } + + return partialViewResult; + } + + private string NormalizeVirtualPath(string virtualPath, string systemDirectory) + { + if (virtualPath.IsNullOrWhiteSpace()) + return string.Empty; + + systemDirectory = systemDirectory.TrimStart("~"); + systemDirectory = systemDirectory.Replace('\\', '/'); + virtualPath = virtualPath.TrimStart("~"); + virtualPath = virtualPath.Replace('\\', '/'); + virtualPath = virtualPath.ReplaceFirst(systemDirectory, string.Empty); + + return virtualPath; + } + + private Attempt CreateOrUpdatePartialViewMacro(CodeFileDisplay display) + { + Attempt partialViewMacroResult; + var virtualPath = display.VirtualPath ?? string.Empty; + var viewMacro = Services.FileService.GetPartialViewMacro(virtualPath); + if (viewMacro != null) + { + viewMacro.Content = display.Content; + viewMacro.Path = display.Name; + partialViewMacroResult = Services.FileService.SavePartialViewMacro(viewMacro, Security.CurrentUser.Id); + } + else + { + var fileName = EnsurePartialViewExtension(display.Name, ".cshtml"); + viewMacro = new PartialView(virtualPath + fileName); + viewMacro.Content = display.Content; + partialViewMacroResult = Services.FileService.CreatePartialViewMacro(viewMacro, display.Snippet, Security.CurrentUser.Id); + } + + return partialViewMacroResult; + } + + private string EnsurePartialViewExtension(string value, string extension) + { + if (value.EndsWith(extension) == false) + value += extension; + + return value; + } } } diff --git a/src/Umbraco.Web/Editors/ContentControllerBase.cs b/src/Umbraco.Web/Editors/ContentControllerBase.cs index fc112693e4..6b8d570e5f 100644 --- a/src/Umbraco.Web/Editors/ContentControllerBase.cs +++ b/src/Umbraco.Web/Editors/ContentControllerBase.cs @@ -99,23 +99,15 @@ namespace Umbraco.Web.Editors var files = contentItem.UploadedFiles.Where(x => x.PropertyAlias == property.Alias).ToArray(); if (files.Length > 0) { - dictionary.Add("files", files); - // add extra things needed to figure out where to put the files - dictionary.Add("cuid", contentItem.PersistedContent.Key); - dictionary.Add("puid", dboProperty.PropertyType.Key); + dictionary.Add("files", files); } - foreach (var file in files) file.FileName = file.FileName.ToSafeFileName(); - if (files.Length > 0) - { - dictionary.Add("files", files); - // add extra things needed to figure out where to put the files - dictionary.Add("cuid", contentItem.PersistedContent.Key); - dictionary.Add("puid", dboProperty.PropertyType.Key); - } - + // add extra things needed to figure out where to put the files + dictionary.Add("cuid", contentItem.PersistedContent.Key); + dictionary.Add("puid", dboProperty.PropertyType.Key); + var data = new ContentPropertyData(property.Value, property.PreValues, dictionary); //get the deserialized value from the property editor diff --git a/src/Umbraco.Web/Install/InstallSteps/NewInstallStep.cs b/src/Umbraco.Web/Install/InstallSteps/NewInstallStep.cs index 775fcaaf9c..7a6a54f9e7 100644 --- a/src/Umbraco.Web/Install/InstallSteps/NewInstallStep.cs +++ b/src/Umbraco.Web/Install/InstallSteps/NewInstallStep.cs @@ -81,7 +81,7 @@ namespace Umbraco.Web.Install.InstallSteps { var client = new System.Net.WebClient(); var values = new NameValueCollection { { "name", admin.Name }, { "email", admin.Email} }; - client.UploadValues("https://umbraco.com/base/Ecom/SubmitEmail/installer.aspx", values); + client.UploadValues("https://shop.umbraco.com/base/Ecom/SubmitEmail/installer.aspx", values); } catch { /* fail in silence */ } } @@ -147,4 +147,4 @@ namespace Umbraco.Web.Install.InstallSteps } } } -} \ No newline at end of file +} diff --git a/src/Umbraco.Web/Models/ContentEditing/SnippetDisplay.cs b/src/Umbraco.Web/Models/ContentEditing/SnippetDisplay.cs new file mode 100644 index 0000000000..e05f8c5c89 --- /dev/null +++ b/src/Umbraco.Web/Models/ContentEditing/SnippetDisplay.cs @@ -0,0 +1,14 @@ +using System.Runtime.Serialization; + +namespace Umbraco.Web.Models.ContentEditing +{ + [DataContract(Name = "scriptFile", Namespace = "")] + public class SnippetDisplay + { + [DataMember(Name = "name", IsRequired = true)] + public string Name { get; set; } + + [DataMember(Name = "fileName", IsRequired = true)] + public string FileName { get; set; } + } +} diff --git a/src/Umbraco.Web/Mvc/Strings.Designer.cs b/src/Umbraco.Web/Mvc/Strings.Designer.cs index 02a44fbbd7..243a7f7dd9 100644 --- a/src/Umbraco.Web/Mvc/Strings.Designer.cs +++ b/src/Umbraco.Web/Mvc/Strings.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.34014 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -65,8 +65,8 @@ namespace Umbraco.Web.Mvc { ///<configuration> /// /// <configSections> - /// <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> - /// <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /> + /// <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> + /// <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /> /// <section name="page [rest of string was truncated]";. ///
internal static string WebConfigTemplate { diff --git a/src/Umbraco.Web/Properties/Settings1.Designer.cs b/src/Umbraco.Web/Properties/Settings1.Designer.cs index 3f63c8d5cd..55e957a383 100644 --- a/src/Umbraco.Web/Properties/Settings1.Designer.cs +++ b/src/Umbraco.Web/Properties/Settings1.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.34003 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -12,7 +12,7 @@ namespace Umbraco.Web.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.0.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); diff --git a/src/Umbraco.Web/PropertyEditors/MacroContainerPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/MacroContainerPropertyEditor.cs index 3ac5788dd2..6bb2cda0b0 100644 --- a/src/Umbraco.Web/PropertyEditors/MacroContainerPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/MacroContainerPropertyEditor.cs @@ -9,7 +9,7 @@ using Umbraco.Core.PropertyEditors; namespace Umbraco.Web.PropertyEditors { - [PropertyEditor(Constants.PropertyEditors.MacroContainerAlias, "Macro container", "macrocontainer", ValueType = PropertyEditorValueTypes.Text, Group="rich content", Icon="icon-settings-alt")] + [PropertyEditor(Constants.PropertyEditors.MacroContainerAlias, "Macro Picker", "macrocontainer", ValueType = PropertyEditorValueTypes.Text, Group="rich content", Icon="icon-settings-alt")] public class MacroContainerPropertyEditor : PropertyEditor { /// diff --git a/src/Umbraco.Web/Trees/PartialViewMacrosTreeController.cs b/src/Umbraco.Web/Trees/PartialViewMacrosTreeController.cs index 10daa56dbe..61d9c17cef 100644 --- a/src/Umbraco.Web/Trees/PartialViewMacrosTreeController.cs +++ b/src/Umbraco.Web/Trees/PartialViewMacrosTreeController.cs @@ -34,13 +34,26 @@ namespace Umbraco.Web.Trees if (id == Constants.System.Root.ToInvariantString()) { - + //set the default to create + menu.DefaultMenuAlias = ActionNew.Instance.Alias; + //create action + menu.Items.Add(Services.TextService.Localize(string.Format("actions/{0}", ActionNew.Instance.Alias))); //refresh action menu.Items.Add(Services.TextService.Localize(string.Format("actions/{0}", ActionRefresh.Instance.Alias)), true); return menu; } + if (id.EndsWith(FileSearchPattern.TrimStart("*")) == false) + { + //set the default to create + menu.DefaultMenuAlias = ActionNew.Instance.Alias; + //create action + menu.Items.Add(Services.TextService.Localize(string.Format("actions/{0}", ActionNew.Instance.Alias))); + //refresh action + menu.Items.Add(Services.TextService.Localize(string.Format("actions/{0}", ActionRefresh.Instance.Alias)), true); + } + // TODO: Wire up new delete dialog menu.Items.Add(Services.TextService.Localize(string.Format("actions/{0}", ActionDelete.Instance.Alias))); return menu; diff --git a/src/Umbraco.Web/Trees/PartialViewsTreeController.cs b/src/Umbraco.Web/Trees/PartialViewsTreeController.cs index 7a88def826..96da9a2e33 100644 --- a/src/Umbraco.Web/Trees/PartialViewsTreeController.cs +++ b/src/Umbraco.Web/Trees/PartialViewsTreeController.cs @@ -33,13 +33,26 @@ namespace Umbraco.Web.Trees if (id == Constants.System.Root.ToInvariantString()) { - + //set the default to create + menu.DefaultMenuAlias = ActionNew.Instance.Alias; + //create action + menu.Items.Add(Services.TextService.Localize(string.Format("actions/{0}", ActionNew.Instance.Alias))); //refresh action menu.Items.Add(Services.TextService.Localize(string.Format("actions/{0}", ActionRefresh.Instance.Alias)), true); return menu; } + if (id.EndsWith(FileSearchPattern.TrimStart("*")) == false) + { + //set the default to create + menu.DefaultMenuAlias = ActionNew.Instance.Alias; + //create action + menu.Items.Add(Services.TextService.Localize(string.Format("actions/{0}", ActionNew.Instance.Alias))); + //refresh action + menu.Items.Add(Services.TextService.Localize(string.Format("actions/{0}", ActionRefresh.Instance.Alias)), true); + } + // TODO: Wire up new delete dialog menu.Items.Add(Services.TextService.Localize(string.Format("actions/{0}", ActionDelete.Instance.Alias))); return menu; diff --git a/src/Umbraco.Web/Trees/ScriptTreeController.cs b/src/Umbraco.Web/Trees/ScriptTreeController.cs index ae19dbcf48..c7d4e728aa 100644 --- a/src/Umbraco.Web/Trees/ScriptTreeController.cs +++ b/src/Umbraco.Web/Trees/ScriptTreeController.cs @@ -1,4 +1,5 @@ -using Umbraco.Core; +using System.Linq; +using Umbraco.Core; using Umbraco.Core.IO; using umbraco.BusinessLogic.Actions; using Umbraco.Web.Models.Trees; @@ -30,13 +31,26 @@ namespace Umbraco.Web.Trees if (id == Constants.System.Root.ToInvariantString()) { - + //set the default to create + menu.DefaultMenuAlias = ActionNew.Instance.Alias; + //create action + menu.Items.Add(Services.TextService.Localize(string.Format("actions/{0}", ActionNew.Instance.Alias))); //refresh action menu.Items.Add(Services.TextService.Localize(string.Format("actions/{0}", ActionRefresh.Instance.Alias)), true); return menu; } + if (id.EndsWith(FileSearchPattern.TrimStart("*")) == false) + { + //set the default to create + menu.DefaultMenuAlias = ActionNew.Instance.Alias; + //create action + menu.Items.Add(Services.TextService.Localize(string.Format("actions/{0}", ActionNew.Instance.Alias))); + //refresh action + menu.Items.Add(Services.TextService.Localize(string.Format("actions/{0}", ActionRefresh.Instance.Alias)), true); + } + // TODO: Wire up new delete dialog menu.Items.Add(Services.TextService.Localize(string.Format("actions/{0}", ActionDelete.Instance.Alias))); return menu; diff --git a/src/Umbraco.Web/UI/JavaScript/Resources.Designer.cs b/src/Umbraco.Web/UI/JavaScript/Resources.Designer.cs index 3b8bfd9385..8c7087939d 100644 --- a/src/Umbraco.Web/UI/JavaScript/Resources.Designer.cs +++ b/src/Umbraco.Web/UI/JavaScript/Resources.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18444 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -62,21 +62,21 @@ namespace Umbraco.Web.UI.JavaScript { /// /// Looks up a localized string similar to [ - /// 'lib/jquery/jquery-2.0.3.min.js', + /// 'lib/jquery/jquery.min.js', /// 'lib/angular/1.1.5/angular.min.js', - /// 'lib/underscore/underscore.js', + /// 'lib/underscore/underscore-min.js', /// - /// 'lib/jquery/jquery-ui-1.10.3.custom.min.js', + /// 'lib/jquery-ui/jquery-ui.min.js', + /// 'lib/jquery-ui-touch-punch/jquery.ui.touch-punch.js', /// /// 'lib/angular/1.1.5/angular-cookies.min.js', /// 'lib/angular/1.1.5/angular-mobile.js', /// 'lib/angular/1.1.5/angular-sanitize.min.js', /// /// 'lib/angular/angular-ui-sortable.js', - /// - /// 'lib/jquery/jquery.upload/js/jquery.fileupload.js', - /// 'lib/jquery/jquery.upload/js/load-image.min.js', - /// 'lib/jquery/jquery.upload/js/ [rest of string was truncated]";. + /// + /// 'lib/angular-dynamic-locale/tmhDynamicLocale.min.js', + /// 'lib/ng-file-upload/ng-file-upload.min. [rest of string was truncated]";. /// internal static string JsInitialize { get { @@ -90,7 +90,9 @@ namespace Umbraco.Web.UI.JavaScript { /// UmbClientMgr.setUmbracoPath('"##UmbracoPath##"'); /// /// jQuery(document).ready(function () { + /// /// angular.bootstrap(document, ['umbraco']); + /// /// }); ///});. /// diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index ce16abaf5f..f005d24332 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -1,5 +1,5 @@  - + 9.0.30729 @@ -36,7 +36,7 @@ 4.0 - v4.5 + v4.6.2 ..\ true @@ -112,9 +112,8 @@ ..\packages\dotless.1.4.1.0\lib\dotless.Core.dll - - ..\packages\Examine.0.1.80\lib\net45\Examine.dll - True + + ..\packages\Examine.0.1.81\lib\net45\Examine.dll ..\packages\HtmlAgilityPack.1.4.9\lib\Net45\HtmlAgilityPack.dll @@ -160,15 +159,14 @@ ..\packages\MiniProfiler.2.1.0\lib\net40\MiniProfiler.dll - - ..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll - True + + ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll ..\packages\Owin.1.0\lib\net40\Owin.dll - - ..\packages\semver.1.1.2\lib\net45\Semver.dll + + ..\packages\Semver.2.0.4\lib\net452\Semver.dll System @@ -339,6 +337,7 @@ + diff --git a/src/Umbraco.Web/Web References/org.umbraco.our/Reference.cs b/src/Umbraco.Web/Web References/org.umbraco.our/Reference.cs index ad6323da86..5e753fa7f8 100644 --- a/src/Umbraco.Web/Web References/org.umbraco.our/Reference.cs +++ b/src/Umbraco.Web/Web References/org.umbraco.our/Reference.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.34003 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -9,7 +9,7 @@ //------------------------------------------------------------------------------ // -// This source code was auto-generated by Microsoft.VSDesigner, Version 4.0.30319.34003. +// This source code was auto-generated by Microsoft.VSDesigner, Version 4.0.30319.42000. // #pragma warning disable 1591 @@ -23,7 +23,7 @@ namespace Umbraco.Web.org.umbraco.our { /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.33440")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1586.0")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Web.Services.WebServiceBindingAttribute(Name="RepositorySoap", Namespace="http://packages.umbraco.org/webservices/")] @@ -480,7 +480,7 @@ namespace Umbraco.Web.org.umbraco.our { } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.33440")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.6.1586.0")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -549,7 +549,7 @@ namespace Umbraco.Web.org.umbraco.our { } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.33440")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.6.1586.0")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -738,7 +738,7 @@ namespace Umbraco.Web.org.umbraco.our { } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.33440")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.6.1586.0")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://packages.umbraco.org/webservices/")] public enum SubmitStatus { @@ -757,11 +757,11 @@ namespace Umbraco.Web.org.umbraco.our { } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.33440")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1586.0")] public delegate void CategoriesCompletedEventHandler(object sender, CategoriesCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.33440")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1586.0")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class CategoriesCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { @@ -783,11 +783,11 @@ namespace Umbraco.Web.org.umbraco.our { } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.33440")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1586.0")] public delegate void ModulesCompletedEventHandler(object sender, ModulesCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.33440")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1586.0")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class ModulesCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { @@ -809,11 +809,11 @@ namespace Umbraco.Web.org.umbraco.our { } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.33440")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1586.0")] public delegate void ModulesCategorizedCompletedEventHandler(object sender, ModulesCategorizedCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.33440")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1586.0")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class ModulesCategorizedCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { @@ -835,11 +835,11 @@ namespace Umbraco.Web.org.umbraco.our { } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.33440")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1586.0")] public delegate void NitrosCompletedEventHandler(object sender, NitrosCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.33440")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1586.0")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class NitrosCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { @@ -861,11 +861,11 @@ namespace Umbraco.Web.org.umbraco.our { } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.33440")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1586.0")] public delegate void NitrosCategorizedCompletedEventHandler(object sender, NitrosCategorizedCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.33440")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1586.0")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class NitrosCategorizedCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { @@ -887,11 +887,11 @@ namespace Umbraco.Web.org.umbraco.our { } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.33440")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1586.0")] public delegate void authenticateCompletedEventHandler(object sender, authenticateCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.33440")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1586.0")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class authenticateCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { @@ -913,11 +913,11 @@ namespace Umbraco.Web.org.umbraco.our { } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.33440")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1586.0")] public delegate void fetchPackageCompletedEventHandler(object sender, fetchPackageCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.33440")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1586.0")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class fetchPackageCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { @@ -939,11 +939,11 @@ namespace Umbraco.Web.org.umbraco.our { } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.33440")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1586.0")] public delegate void fetchPackageByVersionCompletedEventHandler(object sender, fetchPackageByVersionCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.33440")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1586.0")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class fetchPackageByVersionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { @@ -965,11 +965,11 @@ namespace Umbraco.Web.org.umbraco.our { } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.33440")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1586.0")] public delegate void fetchProtectedPackageCompletedEventHandler(object sender, fetchProtectedPackageCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.33440")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1586.0")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class fetchProtectedPackageCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { @@ -991,11 +991,11 @@ namespace Umbraco.Web.org.umbraco.our { } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.33440")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1586.0")] public delegate void SubmitPackageCompletedEventHandler(object sender, SubmitPackageCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.33440")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1586.0")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class SubmitPackageCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { @@ -1017,11 +1017,11 @@ namespace Umbraco.Web.org.umbraco.our { } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.33440")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1586.0")] public delegate void PackageByGuidCompletedEventHandler(object sender, PackageByGuidCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.33440")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1586.0")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class PackageByGuidCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { diff --git a/src/Umbraco.Web/Web References/org.umbraco.update/Reference.cs b/src/Umbraco.Web/Web References/org.umbraco.update/Reference.cs index e68ae400f5..9e35deb713 100644 --- a/src/Umbraco.Web/Web References/org.umbraco.update/Reference.cs +++ b/src/Umbraco.Web/Web References/org.umbraco.update/Reference.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18444 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -9,7 +9,7 @@ //------------------------------------------------------------------------------ // -// This source code was auto-generated by Microsoft.VSDesigner, Version 4.0.30319.18444. +// This source code was auto-generated by Microsoft.VSDesigner, Version 4.0.30319.42000. // #pragma warning disable 1591 @@ -23,7 +23,7 @@ namespace Umbraco.Web.org.umbraco.update { /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.18408")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1586.0")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Web.Services.WebServiceBindingAttribute(Name="CheckForUpgradeSoap", Namespace="http://update.umbraco.org/")] @@ -180,7 +180,7 @@ namespace Umbraco.Web.org.umbraco.update { } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.18408")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.6.1586.0")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -225,7 +225,7 @@ namespace Umbraco.Web.org.umbraco.update { } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.18408")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.6.1586.0")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://update.umbraco.org/")] public enum UpgradeType { @@ -253,15 +253,15 @@ namespace Umbraco.Web.org.umbraco.update { } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.18408")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1586.0")] public delegate void InstallCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.18408")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1586.0")] public delegate void CheckUpgradeCompletedEventHandler(object sender, CheckUpgradeCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.18408")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.1586.0")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class CheckUpgradeCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { diff --git a/src/Umbraco.Web/app.config b/src/Umbraco.Web/app.config index 2b15194775..0e2734a4bb 100644 --- a/src/Umbraco.Web/app.config +++ b/src/Umbraco.Web/app.config @@ -41,7 +41,7 @@ - + @@ -69,4 +69,4 @@ - \ No newline at end of file + diff --git a/src/Umbraco.Web/packages.config b/src/Umbraco.Web/packages.config index 1382e9ceea..84e8a07098 100644 --- a/src/Umbraco.Web/packages.config +++ b/src/Umbraco.Web/packages.config @@ -3,7 +3,7 @@ - + @@ -24,9 +24,9 @@ - + - + diff --git a/src/Umbraco.Web/umbraco.presentation/content.cs b/src/Umbraco.Web/umbraco.presentation/content.cs index 00d1984d12..a7c5a75337 100644 --- a/src/Umbraco.Web/umbraco.presentation/content.cs +++ b/src/Umbraco.Web/umbraco.presentation/content.cs @@ -394,6 +394,11 @@ namespace umbraco } public virtual void ClearDocumentCache(int documentId) + { + ClearDocumentCache(documentId, true); + } + + internal virtual void ClearDocumentCache(int documentId, bool removeDbXmlEntry) { // Get the document Document d; @@ -408,7 +413,7 @@ namespace umbraco ClearDocumentXmlCache(documentId); return; } - ClearDocumentCache(d); + ClearDocumentCache(d, removeDbXmlEntry); } /// @@ -416,7 +421,8 @@ namespace umbraco /// This means the node gets unpublished from the website. /// /// The document - internal void ClearDocumentCache(Document doc) + /// + internal void ClearDocumentCache(Document doc, bool removeDbXmlEntry) { var e = new DocumentCacheEventArgs(); FireBeforeClearDocumentCache(doc, e); @@ -425,8 +431,13 @@ namespace umbraco { XmlNode x; - // remove from xml db cache - doc.XmlRemoveFromDB(); + //Hack: this is here purely for backwards compat if someone for some reason is using the + // ClearDocumentCache(int documentId) method and expecting it to remove the xml + if (removeDbXmlEntry) + { + // remove from xml db cache + doc.XmlRemoveFromDB(); + } // clear xml cache ClearDocumentXmlCache(doc.Id); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/templateControls/Resources.Designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/templateControls/Resources.Designer.cs index 9aa180110b..3adaf973ca 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/templateControls/Resources.Designer.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/templateControls/Resources.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18034 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. diff --git a/src/UmbracoExamine/Config/IndexSetExtensions.cs b/src/UmbracoExamine/Config/IndexSetExtensions.cs index 1255f50a3c..f4bd2e24b2 100644 --- a/src/UmbracoExamine/Config/IndexSetExtensions.cs +++ b/src/UmbracoExamine/Config/IndexSetExtensions.cs @@ -14,7 +14,7 @@ namespace UmbracoExamine.Config public static class IndexSetExtensions { internal static IIndexCriteria ToIndexCriteria(this IndexSet set, IDataService svc, - IEnumerable indexFieldPolicies) + StaticFieldCollection indexFieldPolicies) { return new LazyIndexCriteria(set, svc, indexFieldPolicies); } @@ -29,7 +29,7 @@ namespace UmbracoExamine.Config /// public static IIndexCriteria ToIndexCriteria(this IndexSet set, IDataService svc) { - return set.ToIndexCriteria(svc, Enumerable.Empty()); + return set.ToIndexCriteria(svc, new StaticFieldCollection()); } } diff --git a/src/UmbracoExamine/Config/LazyIndexCriteria.cs b/src/UmbracoExamine/Config/LazyIndexCriteria.cs index 72ab3f31ba..ee58431930 100644 --- a/src/UmbracoExamine/Config/LazyIndexCriteria.cs +++ b/src/UmbracoExamine/Config/LazyIndexCriteria.cs @@ -12,7 +12,7 @@ namespace UmbracoExamine.Config public LazyIndexCriteria( IndexSet set, IDataService svc, - IEnumerable indexFieldPolicies) + StaticFieldCollection indexFieldPolicies) { if (set == null) throw new ArgumentNullException("set"); if (indexFieldPolicies == null) throw new ArgumentNullException("indexFieldPolicies"); @@ -35,8 +35,9 @@ namespace UmbracoExamine.Config foreach (var u in userProps) { var field = new IndexField() { Name = u }; - var policy = indexFieldPolicies.FirstOrDefault(x => x.Name == u); - if (policy != null) + + StaticField policy; + if (indexFieldPolicies.TryGetValue(u, out policy)) { field.Type = policy.Type; field.EnableSorting = policy.EnableSorting; @@ -55,8 +56,9 @@ namespace UmbracoExamine.Config foreach (var s in sysProps) { var field = new IndexField() { Name = s }; - var policy = indexFieldPolicies.FirstOrDefault(x => x.Name == s); - if (policy != null) + + StaticField policy; + if (indexFieldPolicies.TryGetValue(s, out policy)) { field.Type = policy.Type; field.EnableSorting = policy.EnableSorting; diff --git a/src/UmbracoExamine/StaticFieldCollection.cs b/src/UmbracoExamine/StaticFieldCollection.cs new file mode 100644 index 0000000000..909271e0b5 --- /dev/null +++ b/src/UmbracoExamine/StaticFieldCollection.cs @@ -0,0 +1,28 @@ +using System.Collections.ObjectModel; + +namespace UmbracoExamine +{ + internal class StaticFieldCollection : KeyedCollection + { + protected override string GetKeyForItem(StaticField item) + { + return item.Name; + } + + /// + /// Implements TryGetValue using the underlying dictionary + /// + /// + /// + /// + public bool TryGetValue(string key, out StaticField field) + { + if (Dictionary == null) + { + field = null; + return false; + } + return Dictionary.TryGetValue(key, out field); + } + } +} \ No newline at end of file diff --git a/src/UmbracoExamine/UmbracoContentIndexer.cs b/src/UmbracoExamine/UmbracoContentIndexer.cs index 0f3779034c..37382d2647 100644 --- a/src/UmbracoExamine/UmbracoContentIndexer.cs +++ b/src/UmbracoExamine/UmbracoContentIndexer.cs @@ -196,27 +196,27 @@ namespace UmbracoExamine /// Alot of standard umbraco fields shouldn't be tokenized or even indexed, just stored into lucene /// for retreival after searching. /// - internal static readonly List IndexFieldPolicies - = new List + internal static readonly StaticFieldCollection IndexFieldPolicies + = new StaticFieldCollection { new StaticField("id", FieldIndexTypes.NOT_ANALYZED, false, string.Empty), new StaticField("key", FieldIndexTypes.NOT_ANALYZED, false, string.Empty), - new StaticField( "version", FieldIndexTypes.NOT_ANALYZED, false, string.Empty), - new StaticField( "parentID", FieldIndexTypes.NOT_ANALYZED, false, string.Empty), - new StaticField( "level", FieldIndexTypes.NOT_ANALYZED, true, "NUMBER"), - new StaticField( "writerID", FieldIndexTypes.NOT_ANALYZED, false, string.Empty), - new StaticField( "creatorID", FieldIndexTypes.NOT_ANALYZED, false, string.Empty), - new StaticField( "nodeType", FieldIndexTypes.NOT_ANALYZED, false, string.Empty), - new StaticField( "template", FieldIndexTypes.NOT_ANALYZED, false, string.Empty), - new StaticField( "sortOrder", FieldIndexTypes.NOT_ANALYZED, true, "NUMBER"), - new StaticField( "createDate", FieldIndexTypes.NOT_ANALYZED, false, "DATETIME"), - new StaticField( "updateDate", FieldIndexTypes.NOT_ANALYZED, false, "DATETIME"), - new StaticField( "nodeName", FieldIndexTypes.ANALYZED, false, string.Empty), - new StaticField( "urlName", FieldIndexTypes.NOT_ANALYZED, false, string.Empty), - new StaticField( "writerName", FieldIndexTypes.ANALYZED, false, string.Empty), - new StaticField( "creatorName", FieldIndexTypes.ANALYZED, false, string.Empty), - new StaticField( "nodeTypeAlias", FieldIndexTypes.ANALYZED, false, string.Empty), - new StaticField( "path", FieldIndexTypes.NOT_ANALYZED, false, string.Empty) + new StaticField("version", FieldIndexTypes.NOT_ANALYZED, false, string.Empty), + new StaticField("parentID", FieldIndexTypes.NOT_ANALYZED, false, string.Empty), + new StaticField("level", FieldIndexTypes.NOT_ANALYZED, true, "NUMBER"), + new StaticField("writerID", FieldIndexTypes.NOT_ANALYZED, false, string.Empty), + new StaticField("creatorID", FieldIndexTypes.NOT_ANALYZED, false, string.Empty), + new StaticField("nodeType", FieldIndexTypes.NOT_ANALYZED, false, string.Empty), + new StaticField("template", FieldIndexTypes.NOT_ANALYZED, false, string.Empty), + new StaticField("sortOrder", FieldIndexTypes.NOT_ANALYZED, true, "NUMBER"), + new StaticField("createDate", FieldIndexTypes.NOT_ANALYZED, false, "DATETIME"), + new StaticField("updateDate", FieldIndexTypes.NOT_ANALYZED, false, "DATETIME"), + new StaticField("nodeName", FieldIndexTypes.ANALYZED, false, string.Empty), + new StaticField("urlName", FieldIndexTypes.NOT_ANALYZED, false, string.Empty), + new StaticField("writerName", FieldIndexTypes.ANALYZED, false, string.Empty), + new StaticField("creatorName", FieldIndexTypes.ANALYZED, false, string.Empty), + new StaticField("nodeTypeAlias", FieldIndexTypes.ANALYZED, false, string.Empty), + new StaticField("path", FieldIndexTypes.NOT_ANALYZED, false, string.Empty) }; #endregion @@ -804,9 +804,13 @@ namespace UmbracoExamine /// /// protected override FieldIndexTypes GetPolicy(string fieldName) - { - var def = IndexFieldPolicies.Where(x => x.Name == fieldName).ToArray(); - return (def.Any() == false ? FieldIndexTypes.ANALYZED : def.Single().IndexType); + { + StaticField def; + if (IndexFieldPolicies.TryGetValue(fieldName, out def)) + { + return def.IndexType; + } + return FieldIndexTypes.ANALYZED; } /// @@ -816,14 +820,18 @@ namespace UmbracoExamine /// protected override bool ValidateDocument(XElement node) { - var nodeId = int.Parse(node.Attribute("id").Value); // Test for access if we're only indexing published content // return nothing if we're not supporting protected content and it is protected, and we're not supporting unpublished content - if (!SupportUnpublishedContent - && (!SupportProtectedContent - && DataService.ContentService.IsProtected(nodeId, node.Attribute("path").Value))) + if (SupportUnpublishedContent == false + && SupportProtectedContent == false) { - return false; + + var nodeId = int.Parse(node.Attribute("id").Value); + + if (DataService.ContentService.IsProtected(nodeId, node.Attribute("path").Value)) + { + return false; + } } return base.ValidateDocument(node); } diff --git a/src/UmbracoExamine/UmbracoExamine.csproj b/src/UmbracoExamine/UmbracoExamine.csproj index 8720849744..efa5eeed41 100644 --- a/src/UmbracoExamine/UmbracoExamine.csproj +++ b/src/UmbracoExamine/UmbracoExamine.csproj @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -10,7 +10,7 @@ Properties UmbracoExamine UmbracoExamine - v4.5 + v4.6.2 512 @@ -82,9 +82,8 @@ ..\Solution Items\TheFARM-Public.snk - - ..\packages\Examine.0.1.80\lib\net45\Examine.dll - True + + ..\packages\Examine.0.1.81\lib\net45\Examine.dll ..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll @@ -134,6 +133,7 @@ + diff --git a/src/UmbracoExamine/UmbracoMemberIndexer.cs b/src/UmbracoExamine/UmbracoMemberIndexer.cs index 2e48dff64e..ad393932be 100644 --- a/src/UmbracoExamine/UmbracoMemberIndexer.cs +++ b/src/UmbracoExamine/UmbracoMemberIndexer.cs @@ -117,8 +117,9 @@ namespace UmbracoExamine if (indexerData.UserFields.Any(x => x.Name == "_searchEmail") == false) { var field = new IndexField { Name = "_searchEmail" }; - var policy = IndexFieldPolicies.FirstOrDefault(x => x.Name == "_searchEmail"); - if (policy != null) + + StaticField policy; + if (IndexFieldPolicies.TryGetValue("_searchEmail", out policy)) { field.Type = policy.Type; field.EnableSorting = policy.EnableSorting; @@ -237,10 +238,16 @@ namespace UmbracoExamine { var fields = base.GetSpecialFieldsToIndex(allValuesForIndexing); - //adds the special path property to the index + //adds the special key property to the index string valuesForIndexing; if (allValuesForIndexing.TryGetValue("__key", out valuesForIndexing)) - fields.Add("__key", valuesForIndexing); + { + if (fields.ContainsKey("__key") == false) + { + fields.Add("__key", valuesForIndexing); + } + } + return fields; diff --git a/src/UmbracoExamine/app.config b/src/UmbracoExamine/app.config index a0794caa99..c79842ade3 100644 --- a/src/UmbracoExamine/app.config +++ b/src/UmbracoExamine/app.config @@ -12,7 +12,7 @@ - + @@ -32,4 +32,4 @@ - \ No newline at end of file + diff --git a/src/UmbracoExamine/packages.config b/src/UmbracoExamine/packages.config index 0c85a9c3ca..81a5d495c4 100644 --- a/src/UmbracoExamine/packages.config +++ b/src/UmbracoExamine/packages.config @@ -1,6 +1,6 @@  - + \ No newline at end of file diff --git a/src/umbraco.MacroEngines/Resources/Strings.Designer.cs b/src/umbraco.MacroEngines/Resources/Strings.Designer.cs index 236db870a0..1acc353daf 100644 --- a/src/umbraco.MacroEngines/Resources/Strings.Designer.cs +++ b/src/umbraco.MacroEngines/Resources/Strings.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.34014 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. diff --git a/src/umbraco.MacroEngines/app.config b/src/umbraco.MacroEngines/app.config index cc98223bd1..6863fed4c8 100644 --- a/src/umbraco.MacroEngines/app.config +++ b/src/umbraco.MacroEngines/app.config @@ -4,7 +4,7 @@ - + @@ -44,4 +44,4 @@ - \ No newline at end of file + diff --git a/src/umbraco.MacroEngines/packages.config b/src/umbraco.MacroEngines/packages.config index 930b7adbb0..bc7e6fe4c1 100644 --- a/src/umbraco.MacroEngines/packages.config +++ b/src/umbraco.MacroEngines/packages.config @@ -1,6 +1,6 @@  - + @@ -11,6 +11,6 @@ - + \ No newline at end of file diff --git a/src/umbraco.MacroEngines/umbraco.MacroEngines.csproj b/src/umbraco.MacroEngines/umbraco.MacroEngines.csproj index 198867a5d6..bdc6f91e0b 100644 --- a/src/umbraco.MacroEngines/umbraco.MacroEngines.csproj +++ b/src/umbraco.MacroEngines/umbraco.MacroEngines.csproj @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -10,7 +10,7 @@ Properties umbraco.MacroEngines umbraco.MacroEngines - v4.5 + v4.6.2 512 @@ -45,9 +45,8 @@ false - - ..\packages\Examine.0.1.80\lib\net45\Examine.dll - True + + ..\packages\Examine.0.1.81\lib\net45\Examine.dll ..\packages\HtmlAgilityPack.1.4.9\lib\Net45\HtmlAgilityPack.dll @@ -61,9 +60,8 @@ ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll - - ..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll - True + + ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll diff --git a/src/umbraco.businesslogic/app.config b/src/umbraco.businesslogic/app.config index a0794caa99..c79842ade3 100644 --- a/src/umbraco.businesslogic/app.config +++ b/src/umbraco.businesslogic/app.config @@ -12,7 +12,7 @@ - + @@ -32,4 +32,4 @@ - \ No newline at end of file + diff --git a/src/umbraco.businesslogic/umbraco.businesslogic.csproj b/src/umbraco.businesslogic/umbraco.businesslogic.csproj index 851a6a3c8c..e8b090e26f 100644 --- a/src/umbraco.businesslogic/umbraco.businesslogic.csproj +++ b/src/umbraco.businesslogic/umbraco.businesslogic.csproj @@ -1,5 +1,5 @@  - + Local 9.0.30729 @@ -37,7 +37,7 @@ 3.5 true - v4.5 + v4.6.2 http://localhost/businesslogic/ true Web diff --git a/src/umbraco.cms/app.config b/src/umbraco.cms/app.config index a0794caa99..c79842ade3 100644 --- a/src/umbraco.cms/app.config +++ b/src/umbraco.cms/app.config @@ -12,7 +12,7 @@ - + @@ -32,4 +32,4 @@ - \ No newline at end of file + diff --git a/src/umbraco.cms/businesslogic/Packager/FileResources/PackageFiles.Designer.cs b/src/umbraco.cms/businesslogic/Packager/FileResources/PackageFiles.Designer.cs index 81909bb6a5..0d0b9c03e2 100644 --- a/src/umbraco.cms/businesslogic/Packager/FileResources/PackageFiles.Designer.cs +++ b/src/umbraco.cms/businesslogic/Packager/FileResources/PackageFiles.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18034 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. diff --git a/src/umbraco.cms/packages.config b/src/umbraco.cms/packages.config index 46e6d733a1..400a4dea20 100644 --- a/src/umbraco.cms/packages.config +++ b/src/umbraco.cms/packages.config @@ -2,7 +2,7 @@ - + \ No newline at end of file diff --git a/src/umbraco.cms/umbraco.cms.csproj b/src/umbraco.cms/umbraco.cms.csproj index 89c2db4032..aefb57e24a 100644 --- a/src/umbraco.cms/umbraco.cms.csproj +++ b/src/umbraco.cms/umbraco.cms.csproj @@ -1,5 +1,5 @@  - + Local 9.0.30729 @@ -36,7 +36,7 @@ 3.5 - v4.5 + v4.6.2 publish\ true Disk @@ -116,9 +116,8 @@ ..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll - - ..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll - True + + ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll System diff --git a/src/umbraco.controls/TreePicker/BaseTreePickerScripts.Designer.cs b/src/umbraco.controls/TreePicker/BaseTreePickerScripts.Designer.cs index 75268145d4..cf53229e77 100644 --- a/src/umbraco.controls/TreePicker/BaseTreePickerScripts.Designer.cs +++ b/src/umbraco.controls/TreePicker/BaseTreePickerScripts.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18034 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -62,16 +62,17 @@ namespace umbraco.uicontrols.TreePicker { /// /// Looks up a localized string similar to /// <reference path="/umbraco_client/Application/NamespaceManager.js" /> - /// - ///Umbraco.Sys.registerNamespace("Umbraco.Controls"); - /// - ///(function($) { - /// Umbraco.Controls.TreePicker = function(clientId, label, itemIdValueClientID, itemTitleClientID, itemPickerUrl, width, height, showHeader, umbracoPath) { - /// var obj = { - /// _itemPickerUrl: itemPickerUrl, - /// _webServiceUrl: umbracoPath + "/webservices/legacyAjaxCalls.asmx/GetNodeBreadcrumbs", - /// _label: label, - /// _wid [rest of string was truncated]";. + ///(function ($) { + /// $(document).ready(function () { + /// // Tooltip only Text + /// $('.umb-tree-picker a.choose').click(function () { + /// var that = this; + /// var s = $(that).data("section"); + /// UmbClientMgr.openAngularModalWindow({ + /// template: 'views/common/dialogs/treepicker.html', + /// section: s, + /// callback: function (data) { + /// //this [rest of string was truncated]";. /// internal static string BaseTreePicker { get { diff --git a/src/umbraco.controls/app.config b/src/umbraco.controls/app.config index a0794caa99..c79842ade3 100644 --- a/src/umbraco.controls/app.config +++ b/src/umbraco.controls/app.config @@ -12,7 +12,7 @@ - + @@ -32,4 +32,4 @@ - \ No newline at end of file + diff --git a/src/umbraco.controls/umbraco.controls.csproj b/src/umbraco.controls/umbraco.controls.csproj index 9c2d016b93..3cff539619 100644 --- a/src/umbraco.controls/umbraco.controls.csproj +++ b/src/umbraco.controls/umbraco.controls.csproj @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -23,7 +23,7 @@ 3.5 - v4.5 + v4.6.2 publish\ true Disk diff --git a/src/umbraco.datalayer/app.config b/src/umbraco.datalayer/app.config index 1f5a6442ad..6d9f461c6f 100644 --- a/src/umbraco.datalayer/app.config +++ b/src/umbraco.datalayer/app.config @@ -4,7 +4,7 @@ - + @@ -32,4 +32,4 @@ - \ No newline at end of file + diff --git a/src/umbraco.datalayer/umbraco.datalayer.csproj b/src/umbraco.datalayer/umbraco.datalayer.csproj index 479d1cafe7..9452e2f39d 100644 --- a/src/umbraco.datalayer/umbraco.datalayer.csproj +++ b/src/umbraco.datalayer/umbraco.datalayer.csproj @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -23,7 +23,7 @@ 3.5 - v4.5 + v4.6.2 publish\ true Disk diff --git a/src/umbraco.editorControls/app.config b/src/umbraco.editorControls/app.config index 1d7a37c980..554506d233 100644 --- a/src/umbraco.editorControls/app.config +++ b/src/umbraco.editorControls/app.config @@ -16,7 +16,7 @@ - + @@ -53,4 +53,4 @@ - \ No newline at end of file + diff --git a/src/umbraco.editorControls/mediapicker/MediaChooserScripts.Designer.cs b/src/umbraco.editorControls/mediapicker/MediaChooserScripts.Designer.cs index a7743a55be..30cc94f1de 100644 --- a/src/umbraco.editorControls/mediapicker/MediaChooserScripts.Designer.cs +++ b/src/umbraco.editorControls/mediapicker/MediaChooserScripts.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18034 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. diff --git a/src/umbraco.editorControls/umbraco.editorControls.csproj b/src/umbraco.editorControls/umbraco.editorControls.csproj index b837daf06e..56d7e7ea86 100644 --- a/src/umbraco.editorControls/umbraco.editorControls.csproj +++ b/src/umbraco.editorControls/umbraco.editorControls.csproj @@ -1,5 +1,5 @@  - + Local 9.0.30729 @@ -37,7 +37,7 @@ 3.5 true - v4.5 + v4.6.2 http://localhost/umbraco.editorControls/ true Web diff --git a/src/umbraco.interfaces/umbraco.interfaces.csproj b/src/umbraco.interfaces/umbraco.interfaces.csproj index 28bd27603f..85070859f7 100644 --- a/src/umbraco.interfaces/umbraco.interfaces.csproj +++ b/src/umbraco.interfaces/umbraco.interfaces.csproj @@ -1,5 +1,5 @@  - + Local 9.0.30729 @@ -36,7 +36,7 @@ 3.5 - v4.0 + v4.6.2 publish\ true Disk @@ -77,6 +77,7 @@ full prompt AllRules.ruleset + false bin\Release\ @@ -100,6 +101,7 @@ pdbonly prompt AllRules.ruleset + false diff --git a/src/umbraco.providers/app.config b/src/umbraco.providers/app.config index a0794caa99..c79842ade3 100644 --- a/src/umbraco.providers/app.config +++ b/src/umbraco.providers/app.config @@ -12,7 +12,7 @@ - + @@ -32,4 +32,4 @@ - \ No newline at end of file + diff --git a/src/umbraco.providers/umbraco.providers.csproj b/src/umbraco.providers/umbraco.providers.csproj index 102e9098da..0e07ce6328 100644 --- a/src/umbraco.providers/umbraco.providers.csproj +++ b/src/umbraco.providers/umbraco.providers.csproj @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -23,7 +23,7 @@ 3.5 - v4.5 + v4.6.2 publish\ true Disk