Compare commits

..

5 Commits

Author SHA1 Message Date
Steve Megson 88349c6b66 Sorting of images in multiple media picker
(cherry picked from commit ed5effd190)
2019-08-08 16:02:35 +02:00
Sebastiaan Janssen 046ed8ec85 Bump version to 8.1.2 2019-08-08 12:23:57 +02:00
Steve Megson aabe6defb2 Fixes #5864 - migrate prevalues for Umbraco.DropDown.Flexible
(cherry picked from commit 4e0dd728a8)
2019-08-08 10:56:02 +02:00
Bjarke Berg 3245c82ea6 Missing file in project file
(cherry picked from commit 3062f40ef5)
2019-08-08 10:45:34 +02:00
Kenn Jacobsen beacc5bba8 Fix broken button to open content type from create dialog
(cherry picked from commit 57e58c6cf7)
2019-08-08 10:05:33 +02:00
13 changed files with 64 additions and 59 deletions
+2 -2
View File
@@ -18,5 +18,5 @@ using System.Resources;
[assembly: AssemblyVersion("8.0.0")]
// these are FYI and changed automatically
[assembly: AssemblyFileVersion("8.1.1")]
[assembly: AssemblyInformationalVersion("8.1.1")]
[assembly: AssemblyFileVersion("8.1.2")]
[assembly: AssemblyInformationalVersion("8.1.2")]
+9 -6
View File
@@ -1,6 +1,4 @@
using System;
namespace Umbraco.Core.Composing
namespace Umbraco.Core.Composing
{
/// <summary>
/// Specifies the lifetime of a registered instance.
@@ -14,6 +12,13 @@ namespace Umbraco.Core.Composing
/// or MS.DI, PerDependency in Autofac.</remarks>
Transient,
// TODO: We need to fix this up, currently LightInject is the only one that behaves differently from all other containers.
// ... the simple fix would be to map this to PerScopeLifetime in LI but need to wait on a response here https://github.com/seesharper/LightInject/issues/494#issuecomment-518942625
//
// we use it for controllers, httpContextBase and other request scoped objects: MembershpHelper, TagQuery, UmbracoTreeSearcher and ISearchableTree
// - so that they are automatically disposed at the end of the scope (ie request)
// - not sure they should not be simply 'scoped'?
/// <summary>
/// One unique instance per request.
/// </summary>
@@ -23,9 +28,7 @@ namespace Umbraco.Core.Composing
/// </para>
/// Corresponds to
/// <para>
/// PerScopeLifetime in LightInject.
/// Although it would seem that this should map to PerRequestLifeTime in LightInject,
/// that is actually misleading since PerRequestLifeTime in LightInject means transient but disposed at the end of the current web request.
/// PerRequestLifeTime in LightInject - means transient but disposed at the end of the current web request.
/// see: https://github.com/seesharper/LightInject/issues/494#issuecomment-518493262
/// </para>
/// <para>
@@ -145,7 +145,7 @@ namespace Umbraco.Core.Composing.LightInject
/// <inheritdoc />
public void Register(Type serviceType, Lifetime lifetime = Lifetime.Transient)
=> Container.Register(serviceType, GetLifetime(lifetime, serviceType));
=> Container.Register(serviceType, GetLifetime(lifetime));
/// <inheritdoc />
public void Register(Type serviceType, Type implementingType, Lifetime lifetime = Lifetime.Transient)
@@ -158,7 +158,7 @@ namespace Umbraco.Core.Composing.LightInject
case Lifetime.Request:
case Lifetime.Scope:
case Lifetime.Singleton:
Container.Register(serviceType, implementingType, GetLifetime(lifetime, serviceType));
Container.Register(serviceType, implementingType, GetLifetime(lifetime));
break;
default:
throw new NotSupportedException($"Lifetime {lifetime} is not supported.");
@@ -169,7 +169,7 @@ namespace Umbraco.Core.Composing.LightInject
public void Register<TService>(Func<IFactory, TService> factory, Lifetime lifetime = Lifetime.Transient)
where TService : class
{
Container.Register(f => factory(this), GetLifetime(lifetime, typeof(TService)));
Container.Register(f => factory(this), GetLifetime(lifetime));
}
/// <inheritdoc />
@@ -186,7 +186,7 @@ namespace Umbraco.Core.Composing.LightInject
where TService : class
{
// note that there can only be one implementation or instance registered "for" a service
Container.Register(typeof(TService), implementingType, GetTargetedServiceName<TTarget>(), GetLifetime(lifetime, typeof(TService)));
Container.Register(typeof(TService), implementingType, GetTargetedServiceName<TTarget>(), GetLifetime(lifetime));
}
/// <inheritdoc />
@@ -194,7 +194,7 @@ namespace Umbraco.Core.Composing.LightInject
where TService : class
{
// note that there can only be one implementation or instance registered "for" a service
Container.Register(f => factory(this), GetTargetedServiceName<TTarget>(), GetLifetime(lifetime, typeof(TService)));
Container.Register(f => factory(this), GetTargetedServiceName<TTarget>(), GetLifetime(lifetime));
}
/// <inheritdoc />
@@ -202,20 +202,14 @@ namespace Umbraco.Core.Composing.LightInject
where TService : class
=> Container.RegisterInstance(typeof(TService), instance, GetTargetedServiceName<TTarget>());
protected virtual ILifetime GetLifetime(Lifetime lifetime, Type type)
private ILifetime GetLifetime(Lifetime lifetime)
{
switch (lifetime)
{
case Lifetime.Transient:
return null;
case Lifetime.Request:
//LightInject behaves slightly differently than all containers and although it would seem that we should be using
//PerRequestLifeTime here, it actually does not mean "one per request", it
//just means transient per request and will be disposed at the end of the request.
//LightInject's PerScopeLifetime is equivalent to "one per request" which is what we'd expect when using the Lifetime.Request since
//that would be consistent with other containers.
//See: https://github.com/umbraco/Umbraco-CMS/issues/6044#issuecomment-518949758
return new PerScopeLifetime();
return new PerRequestLifeTime();
case Lifetime.Scope:
return new PerScopeLifetime();
case Lifetime.Singleton:
@@ -0,0 +1,32 @@
using System.Collections.Generic;
using System.Linq;
using Umbraco.Core.PropertyEditors;
namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0.DataTypes
{
class DropDownFlexiblePreValueMigrator : IPreValueMigrator
{
public bool CanMigrate(string editorAlias)
=> editorAlias == "Umbraco.DropDown.Flexible";
public virtual string GetNewAlias(string editorAlias)
=> null;
public object GetConfiguration(int dataTypeId, string editorAlias, Dictionary<string, PreValueDto> preValues)
{
var config = new DropDownFlexibleConfiguration();
foreach (var preValue in preValues.Values)
{
if (preValue.Alias == "multiple")
{
config.Multiple = (preValue.Value == "1");
}
else
{
config.Items.Add(new ValueListConfiguration.ValueListItem { Id = preValue.Id, Value = preValue.Value });
}
}
return config;
}
}
}
@@ -19,6 +19,7 @@ public class PreValueMigratorComposer : ICoreComposer
.Append<NestedContentPreValueMigrator>()
.Append<DecimalPreValueMigrator>()
.Append<ListViewPreValueMigrator>()
.Append<DropDownFlexiblePreValueMigrator>()
.Append<ValueListPreValueMigrator>();
}
}
+2 -1
View File
@@ -71,7 +71,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="LightInject" Version="5.5.0" />
<PackageReference Include="LightInject" Version="5.4.0" />
<PackageReference Include="LightInject.Annotation" Version="1.1.0" />
<PackageReference Include="LightInject.Web" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNet.Identity.Core">
@@ -242,6 +242,7 @@
<Compile Include="Migrations\Upgrade\V_8_0_0\DataTypes\DefaultPreValueMigrator.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\DataTypes\RenamingPreValueMigrator.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\DataTypes\RichTextPreValueMigrator.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\DataTypes\DropDownFlexiblePreValueMigrator.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\MergeDateAndDateTimePropertyEditor.cs" />
<Compile Include="Models\Entities\EntityExtensions.cs" />
<Compile Include="Migrations\Upgrade\V_8_0_0\DataTypes\PreValueMigratorBase.cs" />
+1 -1
View File
@@ -83,7 +83,7 @@
<PackageReference Include="HtmlAgilityPack">
<Version>1.8.14</Version>
</PackageReference>
<PackageReference Include="LightInject" Version="5.5.0" />
<PackageReference Include="LightInject" Version="5.4.0" />
<PackageReference Include="LightInject.Annotation" Version="1.1.0" />
<PackageReference Include="Lucene.Net" Version="3.0.3" />
<PackageReference Include="Lucene.Net.Contrib" Version="3.0.3" />
@@ -94,6 +94,11 @@ function contentCreateController($scope,
navigationService.hideDialog(showMenu);
};
$scope.editContentType = function() {
$location.path("/settings/documenttypes/edit/" + $scope.contentTypeId).search("view", "permissions");
close();
}
$scope.createBlank = createBlank;
$scope.createOrSelectBlueprintIfAny = createOrSelectBlueprintIfAny;
$scope.createFromBlueprint = createFromBlueprint;
@@ -10,7 +10,7 @@
<p class="abstract" ng-if="!hasSettingsAccess"><localize key="create_noDocumentTypesWithNoSettingsAccess"/></p>
<div ng-if="hasSettingsAccess">
<p class="abstract"><localize key="create_noDocumentTypes" /></p>
<button class="btn umb-outline" href="#settings/documentTypes/edit/{{contentTypeId}}?view=permissions" ng-click="close()">
<button class="btn umb-outline" ng-click="editContentType()">
<localize key="create_noDocumentTypesEditPermissions"/>
</button>
</div>
@@ -229,7 +229,7 @@ angular.module('umbraco').controller("Umbraco.PropertyEditors.MediaPickerControl
$scope.sortableOptions = {
disabled: !$scope.isMultiPicker,
disabled: !multiPicker,
items: "li:not(.add-wrapper)",
cancel: ".unsortable",
update: function (e, ui) {
+2 -2
View File
@@ -345,9 +345,9 @@
<WebProjectProperties>
<UseIIS>False</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>8110</DevelopmentServerPort>
<DevelopmentServerPort>8120</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:8110</IISUrl>
<IISUrl>http://localhost:8120</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
@@ -1,10 +1,6 @@
using System;
using System.Web.Http;
using System.Web.Http.Controllers;
using System.Web.Mvc;
using LightInject;
using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Core.Composing.LightInject;
namespace Umbraco.Web.Composing.LightInject
@@ -38,32 +34,5 @@ namespace Umbraco.Web.Composing.LightInject
Container.ScopeManagerProvider = smp; // reverts - we will do it last (in WebRuntime)
Container.EnableWebApi(GlobalConfiguration.Configuration);
}
protected override ILifetime GetLifetime(Lifetime lifetime, Type type)
{
switch (lifetime)
{
case Lifetime.Transient:
return null;
case Lifetime.Request:
//LightInject behaves slightly differently than all containers and based on feedback from the LightInject authors
//it seems best to use PerRequestLifeTime for controllers even though controllers will work
//just fine with PerScopeLifetime but this is just being 'safe'.
//See: https://github.com/seesharper/LightInject/issues/494#issuecomment-519273614
//Normally this will return PerScopeLifetime because in LightInject that means "one per request".
//See: base class comments
//See: https://github.com/umbraco/Umbraco-CMS/issues/6044#issuecomment-518949758
return type.Inherits<IController>() || type.Inherits<IHttpController>()
? (ILifetime)new PerRequestLifeTime()
: new PerScopeLifetime();
case Lifetime.Scope:
return new PerScopeLifetime();
case Lifetime.Singleton:
return new PerContainerLifetime();
default:
throw new NotSupportedException($"Lifetime {lifetime} is not supported.");
}
}
}
}
+1 -1
View File
@@ -67,7 +67,7 @@
<PackageReference Include="ImageProcessor">
<Version>2.7.0.100</Version>
</PackageReference>
<PackageReference Include="LightInject" Version="5.5.0" />
<PackageReference Include="LightInject" Version="5.4.0" />
<PackageReference Include="LightInject.Annotation" Version="1.1.0" />
<PackageReference Include="LightInject.Mvc" Version="2.0.0" />
<PackageReference Include="LightInject.WebApi" Version="2.0.0" />