Compare commits

...

56 Commits

Author SHA1 Message Date
Sebastiaan Jansssen 858156bab2 Merge branch 'dev-v7' into master-v7 2018-02-23 22:23:43 +01:00
mikkelhm cf5dac0ddd fix xml in spanish lang file
(cherry picked from commit 2281cd8291)
2018-02-23 22:23:07 +01:00
Robert fa68f7fafe Merge pull request #2445 from bjarnef/dev-v7-U4-10966
U4-10966 -  Single/Multiple Media Picker is messed up when dragging images
2018-02-23 15:15:36 +01:00
Sebastiaan Jansssen 2ae96f3810 Merge branch 'dev-v7' into master-v7 2018-02-23 14:23:49 +01:00
Sebastiaan Jansssen f6045a49b5 Bump version to 7.7.13 2018-02-23 14:22:53 +01:00
Sebastiaan Janssen 1f66ebff1f Merge pull request #2470 from MMasey/dev-v7
U4-11005 Examine Search tools form does not submit when pressing Enter key
2018-02-22 18:49:17 +01:00
Migaroez c4850199f7 U4-10999 Fixed wrong description on mediaresource.search
(cherry picked from commit af476e1536)
2018-02-22 17:36:39 +01:00
Sebastiaan Janssen 02c609747d Merge pull request #2455 from GertyEngrie/dev-v7
Typo fix for nullreference in RenderRouteHandler
2018-02-22 17:32:25 +01:00
Sebastiaan Janssen 413e70db7d Merge pull request #2450 from richarth/patch-1
Grammar improvement
2018-02-22 17:31:29 +01:00
Sebastiaan Janssen c2cbac7ef9 Merge pull request #2448 from madsoulswe/temp-U4-10969
U4-10969 - Removed legacy file MediaUploader.ashx
2018-02-22 17:30:14 +01:00
Mike Masey a4a079cd1b Merge remote-tracking branch 'upstream/dev-v7' into dev-v7 2018-02-22 16:24:15 +00:00
Mike Masey 22fc9c617c Upate search button in examin search tools to use type="submit" 2018-02-22 16:18:59 +00:00
Sebastiaan Jansssen 0bcdfc8820 Merge branch 'skartknet-spanish_translations' into dev-v7 2018-02-22 17:11:38 +01:00
Sebastiaan Jansssen b868c06e79 Merge branch 'spanish_translations' of https://github.com/skartknet/Umbraco-CMS into skartknet-spanish_translations
# Conflicts:
#	src/Umbraco.Web.UI/umbraco/config/lang/es.xml
2018-02-22 17:11:09 +01:00
Gerty Engrie fcfb9afc22 typo fix 2018-02-20 14:24:51 +01:00
Claus 05818f6262 Merge branch 'temp-U4-10915' into dev-v7 2018-02-20 13:39:03 +01:00
Shannon 1788682af9 U4-10915 Umbraco automapper configuration is not valid 2018-02-20 19:16:53 +11:00
Sebastiaan Jansssen a5f689385a Merge branch 'dev-v7' into master-v7 2018-02-19 17:13:35 +01:00
Sebastiaan Jansssen a551881ce2 TypedMember(object id) didn't know how to deal with UDI values coming in, breaking MNTP pickers 2018-02-19 17:13:03 +01:00
Sebastiaan Jansssen 1607e51270 Merge branch 'dev-v7' into master-v7 2018-02-19 14:21:16 +01:00
Sebastiaan Jansssen 2f31175db5 Bump version to 7.7.12 2018-02-19 14:20:47 +01:00
Sebastiaan Jansssen 044b43f6e1 Merge branch 'dev-v7' into master-v7 2018-02-19 14:10:09 +01:00
Richard Thompson c2722d8120 Grammar improvement
Improved the grammar of an error message
2018-02-16 15:19:16 +00:00
Dennis Öhman 76725aa0d8 U4-10969 - Removed legacy file MediaUploader.ashx 2018-02-15 16:12:49 +01:00
Sebastiaan Jansssen 9178e7afcf Whoops, no need to introduce a new method here, old method was still available 2018-02-14 12:13:01 +01:00
Sebastiaan Janssen b18945e630 Merge pull request #2447 from umbraco/temp-Fix-CDF-Version-Change
Updates the CDF version changer to to use a hash of the current versi…
2018-02-14 10:25:27 +01:00
Sebastiaan Jansssen 4640cf56d1 Make change non-breaking 2018-02-14 10:23:58 +01:00
Shannon eae1ce7012 fixes build 2018-02-14 12:05:05 +11:00
Shannon e900711180 Updates the CDF version changer to to use a hash of the current version and the date time so that it's not constantly updated if it's not changed. 2018-02-14 11:53:49 +11:00
Bjarne Fyrstenborg 040e45ca70 Ensure move cursor is added the multiple media picker (sortable), but not on imagepicker prevalue editor, which not has ui-sortable 2018-02-12 22:27:23 +01:00
Bjarne Fyrstenborg bd3d626147 Add move cursor when media picker is multiple picker and thumbnails are sortable 2018-02-12 21:58:39 +01:00
Bjarne Fyrstenborg 47d08e69a4 Update comment 2018-02-12 21:56:48 +01:00
Bjarne Fyrstenborg df182674b4 Make thumbnail same size as add button 2018-02-12 21:37:22 +01:00
Bjarne Fyrstenborg 6ec9a2ae45 Add specific class for "add" list item 2018-02-12 21:01:08 +01:00
Bjarne Fyrstenborg bf00f7a663 Enable sortable option based on single or multiple media picker 2018-02-12 20:54:49 +01:00
Bjarne Fyrstenborg 74d8341620 Add bottom margin for multiple media picker 2018-02-12 20:46:48 +01:00
Bjarne Fyrstenborg 70207e5374 Fix issues with "add"-button in single and multiple media picker 2018-02-12 20:46:02 +01:00
Claus 93f4d65227 Merge pull request #2438 from umbraco/temp-U4-10958
Fixes broken MNTP by switching convert cases to the correct DataType
2018-02-09 14:42:08 +01:00
Robert a4c0342bda Fixes broken MNTP by switching convert cases to the correct DataType 2018-02-09 14:09:03 +01:00
Sebastiaan Jansssen 095633ba27 Test names were inverted 2018-02-09 13:27:25 +01:00
Sebastiaan Jansssen c63156fcd8 Bump version to 7.7.11
(cherry picked from commit 0c25c36af0)
2018-02-09 09:53:52 +01:00
Sebastiaan Jansssen c59a226d56 Merge remote-tracking branch 'origin/dev-v7' into master-v7 2018-02-09 09:51:39 +01:00
Sebastiaan Jansssen 0c25c36af0 Bump version to 7.7.11 2018-02-09 09:46:05 +01:00
Stephan 84a90884e3 Merge pull request #2433 from umbraco/temp-U4-10947
Fix for not being able to save decimal value
2018-02-09 08:14:51 +01:00
Shannon d29b7311fa reverts the convertible2 back to what it was before 2018-02-09 10:08:25 +11:00
Shannon 17b59cc20f Updates the ObjectExtensions TryConvertTo code and moved all unit tests to ObjectExtensionsTests which now all pass 2018-02-09 10:02:51 +11:00
Robert 4423571eaa Added ConvertToNullableDecimalTest and check that fixes the decimal save issue 2018-02-08 16:21:09 +01:00
Stephan e76c42f874 Merge pull request #2434 from umbraco/temp-U4-U4-10950
Fix checkbox in nested content
2018-02-08 13:42:42 +01:00
Robert 151c35bc47 Moving check to TryToConvertValueToCrlType 2018-02-08 13:15:43 +01:00
Robert 84265a9716 Fix checkbox in nested content 2018-02-08 12:18:51 +01:00
Robert 6618388973 Fix for not being able to save decimal value 2018-02-08 12:10:57 +01:00
Mario Lopez 1f22191bbc fixed formatting 2018-02-07 11:35:39 +11:00
Mario Lopez 25088042a9 spanish translations 2018-02-07 11:28:11 +11:00
Mario Lopez 1e8bdc8f0c no message 2018-01-25 10:18:06 +11:00
Mario Lopez 5678be0db9 Merge remote-tracking branch 'Umbraco/dev-v7' into dev-v7 2017-11-10 09:37:00 +11:00
Mario Lopez 464a227af1 Merge pull request #1 from umbraco/dev-v7
Update from  original
2017-10-08 15:45:13 +11:00
23 changed files with 2164 additions and 1074 deletions
+2 -2
View File
@@ -11,5 +11,5 @@ using System.Resources;
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("7.7.10")]
[assembly: AssemblyInformationalVersion("7.7.10")]
[assembly: AssemblyFileVersion("7.7.13")]
[assembly: AssemblyInformationalVersion("7.7.13")]
@@ -1,10 +1,14 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Web;
using System.Xml.Linq;
using ClientDependency.Core.CompositeFiles.Providers;
using ClientDependency.Core.Config;
using Semver;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
@@ -24,10 +28,74 @@ namespace Umbraco.Core.Configuration
_logger = logger;
_fileName = IOHelper.MapPath(string.Format("{0}/ClientDependency.config", SystemDirectories.Config));
}
/// <summary>
/// Changes the version number in ClientDependency.config to a hashed value for the version and the DateTime.Day
/// </summary>
/// <param name="version">The <see cref="SemVersion">version</see> of Umbraco we're upgrading to</param>
/// <param name="date">A <see cref="DateTime">date</see> value to use in the hash to prevent this method from updating the version on each startup</param>
/// <param name="dateFormat">Allows the developer to specify the <see cref="string">date precision</see> for the hash (i.e. "yyyyMMdd" would be a precision for the day)</param>
/// <returns>Boolean to indicate succesful update of the ClientDependency.config file</returns>
public bool UpdateVersionNumber(SemVersion version, DateTime date, string dateFormat)
{
var byteContents = Encoding.Unicode.GetBytes(version + date.ToString(dateFormat));
//This is a way to convert a string to a long
//see https://www.codeproject.com/Articles/34309/Convert-String-to-bit-Integer
//We could much more easily use MD5 which would create us an INT but since that is not compliant with
//hashing standards we have to use SHA
int intHash;
using (var hash = SHA256.Create())
{
var bytes = hash.ComputeHash(byteContents);
var longResult = new[] { 0, 8, 16, 24 }
.Select(i => BitConverter.ToInt64(bytes, i))
.Aggregate((x, y) => x ^ y);
//CDF requires an INT, and although this isn't fail safe, it will work for our purposes. We are not hashing for crypto purposes
//so there could be some collisions with this conversion but it's not a problem for our purposes
//It's also important to note that the long.GetHashCode() implementation in .NET is this: return (int) this ^ (int) (this >> 32);
//which means that this value will not change per appdomain like some GetHashCode implementations.
intHash = longResult.GetHashCode();
}
try
{
var clientDependencyConfigXml = XDocument.Load(_fileName, LoadOptions.PreserveWhitespace);
if (clientDependencyConfigXml.Root != null)
{
var versionAttribute = clientDependencyConfigXml.Root.Attribute("version");
//Set the new version to the hashcode of now
var oldVersion = versionAttribute.Value;
var newVersion = Math.Abs(intHash).ToString();
//don't update if it's the same version
if (oldVersion == newVersion)
return false;
versionAttribute.SetValue(newVersion);
clientDependencyConfigXml.Save(_fileName, SaveOptions.DisableFormatting);
_logger.Info<ClientDependencyConfiguration>(string.Format("Updated version number from {0} to {1}", oldVersion, newVersion));
return true;
}
}
catch (Exception ex)
{
_logger.Error<ClientDependencyConfiguration>("Couldn't update ClientDependency version number", ex);
}
return false;
}
/// <summary>
/// Changes the version number in ClientDependency.config to a random value to avoid stale caches
/// </summary>
/// <seealso cref="UpdateVersionNumber(SemVersion, DateTime, string)" />
[Obsolete("Use the UpdateVersionNumber method specifying the version, date and dateFormat instead")]
public bool IncreaseVersionNumber()
{
try
@@ -107,4 +175,4 @@ namespace Umbraco.Core.Configuration
return success;
}
}
}
}
@@ -6,7 +6,7 @@ namespace Umbraco.Core.Configuration
{
public class UmbracoVersion
{
private static readonly Version Version = new Version("7.7.10");
private static readonly Version Version = new Version("7.7.13");
/// <summary>
/// Gets the current version of Umbraco.
@@ -34,6 +34,15 @@ namespace Umbraco.Core.Models.Identity
.ForMember(user => user.CalculatedContentStartNodeIds, expression => expression.MapFrom(user => user.CalculateContentStartNodeIds(applicationContext.Services.EntityService)))
.ForMember(user => user.CalculatedMediaStartNodeIds, expression => expression.MapFrom(user => user.CalculateMediaStartNodeIds(applicationContext.Services.EntityService)))
.ForMember(user => user.AllowedSections, expression => expression.MapFrom(user => user.AllowedSections.ToArray()))
.ForMember(user => user.LockoutEnabled, expression => expression.Ignore())
.ForMember(user => user.Logins, expression => expression.Ignore())
.ForMember(user => user.Roles, expression => expression.Ignore())
.ForMember(user => user.PhoneNumber, expression => expression.Ignore())
.ForMember(user => user.PhoneNumberConfirmed, expression => expression.Ignore())
.ForMember(user => user.TwoFactorEnabled, expression => expression.Ignore())
.ForMember(user => user.Claims, expression => expression.Ignore())
.AfterMap((user, identityUser) =>
{
identityUser.ResetDirtyProperties(true);
@@ -60,4 +69,4 @@ namespace Umbraco.Core.Models.Identity
return storedPass.StartsWith(Constants.Security.EmptyPasswordPrefix) ? null : storedPass;
}
}
}
}
@@ -42,7 +42,7 @@ namespace Umbraco.Core.Models.PublishedContent
var typeName = attribute == null ? type.Name : attribute.ContentTypeAlias;
if (constructors.ContainsKey(typeName))
throw new InvalidOperationException(string.Format("More that one type want to be a model for content type {0}.", typeName));
throw new InvalidOperationException(string.Format("More than one type wants to be a model for content type {0}.", typeName));
// should work everywhere, but slow
//_constructors[typeName] = constructor;
+12 -3
View File
@@ -143,6 +143,7 @@ namespace Umbraco.Core
var inputString = input as string;
if (inputString != null)
{
//TODO: Why the check against only bool/date when a string is null/empty? In what scenario can we convert to another type when the string is null or empty other than just being null?
if (string.IsNullOrEmpty(inputString) && (underlying == typeof(DateTime) || underlying == typeof(bool)))
{
return Attempt<object>.Succeed(null);
@@ -208,6 +209,14 @@ namespace Umbraco.Core
return Attempt.Succeed(outputConverter.ConvertFrom(input));
}
if (target.IsGenericType && GetCachedGenericNullableType(target) != null)
{
// cannot Convert.ChangeType as that does not work with nullable
// input has already been converted to the underlying type - just
// return input, there's an implicit conversion from T to T? anyways
return Attempt.Succeed(input);
}
// Re-check convertables since we altered the input through recursion
var convertible2 = input as IConvertible;
if (convertible2 != null)
@@ -745,9 +754,9 @@ namespace Umbraco.Core
if (AssignableTypeCache.TryGetValue(key, out canConvert))
{
return canConvert;
}
// "object is" is faster than "Type.IsAssignableFrom.
}
// "object is" is faster than "Type.IsAssignableFrom.
// We can use it to very quickly determine whether true/false
if (input is IConvertible && target.IsAssignableFrom(source))
{
@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Xml.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Umbraco.Core.Logging;
using Umbraco.Core.Manifest;
using Umbraco.Core.Models;
@@ -176,6 +176,12 @@ namespace Umbraco.Core.PropertyEditors
/// <returns></returns>
internal Attempt<object> TryConvertValueToCrlType(object value)
{
var jv = value as JValue;
if (jv != null)
{
value = value.ToString();
}
//this is a custom check to avoid any errors, if it's a string and it's empty just make it null
var s = value as string;
if (s != null)
@@ -391,4 +397,4 @@ namespace Umbraco.Core.PropertyEditors
}
}
}
}
}
+151 -9
View File
@@ -6,6 +6,10 @@ using System.Threading;
using System.Web.UI.WebControls;
using NUnit.Framework;
using Umbraco.Core;
using Umbraco.Core.ObjectResolution;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Strings;
using Umbraco.Tests.TestHelpers;
namespace Umbraco.Tests
{
@@ -155,7 +159,7 @@ namespace Umbraco.Tests
Assert.AreEqual("Hello world", result.Result);
}
[Test]
[Test]
public virtual void CanConvertObjectToSameObject()
{
var obj = new MyTestObject();
@@ -164,7 +168,142 @@ namespace Umbraco.Tests
Assert.AreEqual(obj, result.Result);
}
private CultureInfo savedCulture;
[Test]
public void ConvertToIntegerTest()
{
var conv = "100".TryConvertTo<int>();
Assert.IsTrue(conv);
Assert.AreEqual(100, conv.Result);
conv = "100.000".TryConvertTo<int>();
Assert.IsTrue(conv);
Assert.AreEqual(100, conv.Result);
conv = "100,000".TryConvertTo<int>();
Assert.IsTrue(conv);
Assert.AreEqual(100, conv.Result);
// oops
conv = "100.001".TryConvertTo<int>();
Assert.IsTrue(conv);
Assert.AreEqual(100, conv.Result);
conv = 100m.TryConvertTo<int>();
Assert.IsTrue(conv);
Assert.AreEqual(100, conv.Result);
conv = 100.000m.TryConvertTo<int>();
Assert.IsTrue(conv);
Assert.AreEqual(100, conv.Result);
// oops
conv = 100.001m.TryConvertTo<int>();
Assert.IsTrue(conv);
Assert.AreEqual(100, conv.Result);
}
[Test]
public void ConvertToDecimalTest()
{
var conv = "100".TryConvertTo<decimal>();
Assert.IsTrue(conv);
Assert.AreEqual(100m, conv.Result);
conv = "100.000".TryConvertTo<decimal>();
Assert.IsTrue(conv);
Assert.AreEqual(100m, conv.Result);
conv = "100,000".TryConvertTo<decimal>();
Assert.IsTrue(conv);
Assert.AreEqual(100m, conv.Result);
conv = "100.001".TryConvertTo<decimal>();
Assert.IsTrue(conv);
Assert.AreEqual(100.001m, conv.Result);
conv = 100m.TryConvertTo<decimal>();
Assert.IsTrue(conv);
Assert.AreEqual(100m, conv.Result);
conv = 100.000m.TryConvertTo<decimal>();
Assert.IsTrue(conv);
Assert.AreEqual(100m, conv.Result);
conv = 100.001m.TryConvertTo<decimal>();
Assert.IsTrue(conv);
Assert.AreEqual(100.001m, conv.Result);
conv = 100.TryConvertTo<decimal>();
Assert.IsTrue(conv);
Assert.AreEqual(100m, conv.Result);
}
[Test]
public void ConvertToNullableDecimalTest()
{
var conv = "100".TryConvertTo<decimal?>();
Assert.IsTrue(conv);
Assert.AreEqual(100m, conv.Result);
conv = "100.000".TryConvertTo<decimal?>();
Assert.IsTrue(conv);
Assert.AreEqual(100m, conv.Result);
conv = "100,000".TryConvertTo<decimal?>();
Assert.IsTrue(conv);
Assert.AreEqual(100m, conv.Result);
conv = "100.001".TryConvertTo<decimal?>();
Assert.IsTrue(conv);
Assert.AreEqual(100.001m, conv.Result);
conv = 100m.TryConvertTo<decimal?>();
Assert.IsTrue(conv);
Assert.AreEqual(100m, conv.Result);
conv = 100.000m.TryConvertTo<decimal?>();
Assert.IsTrue(conv);
Assert.AreEqual(100m, conv.Result);
conv = 100.001m.TryConvertTo<decimal?>();
Assert.IsTrue(conv);
Assert.AreEqual(100.001m, conv.Result);
conv = 100.TryConvertTo<decimal?>();
Assert.IsTrue(conv);
Assert.AreEqual(100m, conv.Result);
}
[Test]
public void ConvertToDateTimeTest()
{
var conv = "2016-06-07".TryConvertTo<DateTime>();
Assert.IsTrue(conv);
Assert.AreEqual(new DateTime(2016, 6, 7), conv.Result);
}
[Test]
public void ConvertToNullableDateTimeTest()
{
var conv = "2016-06-07".TryConvertTo<DateTime?>();
Assert.IsTrue(conv);
Assert.AreEqual(new DateTime(2016, 6, 7), conv.Result);
}
[Test]
public void Value_Editor_Can_Convert_Decimal_To_Decimal_Clr_Type()
{
var valueEditor = new PropertyValueEditor
{
ValueType = PropertyEditorValueTypes.Decimal
};
var result = valueEditor.TryConvertValueToCrlType(12.34d);
Assert.IsTrue(result.Success);
Assert.AreEqual(12.34d, result.Result);
}
private CultureInfo _savedCulture;
/// <summary>
/// Run once before each test in derived test fixtures.
@@ -172,10 +311,13 @@ namespace Umbraco.Tests
[SetUp]
public void TestSetup()
{
savedCulture = Thread.CurrentThread.CurrentCulture;
_savedCulture = Thread.CurrentThread.CurrentCulture;
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB"); // make sure the dates parse correctly
return;
}
var settings = SettingsForTests.GetDefault();
ShortStringHelperResolver.Current = new ShortStringHelperResolver(new DefaultShortStringHelper(settings).WithDefaultConfig());
Resolution.Freeze();
}
/// <summary>
/// Run once after each test in derived test fixtures.
@@ -183,9 +325,9 @@ namespace Umbraco.Tests
[TearDown]
public void TestTearDown()
{
Thread.CurrentThread.CurrentCulture = savedCulture;
return;
}
Thread.CurrentThread.CurrentCulture = _savedCulture;
ShortStringHelperResolver.Reset();
}
private class MyTestObject
{
@@ -195,4 +337,4 @@ namespace Umbraco.Tests
}
}
}
}
}
@@ -108,8 +108,9 @@ namespace Umbraco.Tests.TestHelpers
var mappers = PluginManager.Current.FindAndCreateInstances<IMapperConfiguration>(
specificAssemblies: new[]
{
typeof(ContentModelMapper).Assembly,
typeof(ApplicationRegistrar).Assembly
typeof(ApplicationContext).Assembly, //Umbraco.Core
typeof(ContentModelMapper).Assembly, //Umbraco.Web
typeof(ApplicationRegistrar).Assembly //umbraco.businesslogic
});
foreach (var mapper in mappers)
{
@@ -218,4 +219,4 @@ namespace Umbraco.Tests.TestHelpers
protected CacheHelper CacheHelper { get; private set; }
}
}
}
-105
View File
@@ -1,105 +0,0 @@
using System;
using NUnit.Framework;
using Umbraco.Core;
using Umbraco.Core.ObjectResolution;
using Umbraco.Core.Strings;
using Umbraco.Tests.TestHelpers;
namespace Umbraco.Tests
{
[TestFixture]
public class TryConvertToTests
{
[SetUp]
public void SetUp()
{
var settings = SettingsForTests.GetDefault();
ShortStringHelperResolver.Current = new ShortStringHelperResolver(new DefaultShortStringHelper(settings).WithDefaultConfig());
Resolution.Freeze();
}
[TearDown]
public void TearDown()
{
ShortStringHelperResolver.Reset();
}
[Test]
public void ConvertToIntegerTest()
{
var conv = "100".TryConvertTo<int>();
Assert.IsTrue(conv);
Assert.AreEqual(100, conv.Result);
conv = "100.000".TryConvertTo<int>();
Assert.IsTrue(conv);
Assert.AreEqual(100, conv.Result);
conv = "100,000".TryConvertTo<int>();
Assert.IsTrue(conv);
Assert.AreEqual(100, conv.Result);
// oops
conv = "100.001".TryConvertTo<int>();
Assert.IsTrue(conv);
Assert.AreEqual(100, conv.Result);
conv = 100m.TryConvertTo<int>();
Assert.IsTrue(conv);
Assert.AreEqual(100, conv.Result);
conv = 100.000m.TryConvertTo<int>();
Assert.IsTrue(conv);
Assert.AreEqual(100, conv.Result);
// oops
conv = 100.001m.TryConvertTo<int>();
Assert.IsTrue(conv);
Assert.AreEqual(100, conv.Result);
}
[Test]
public void ConvertToDecimalTest()
{
var conv = "100".TryConvertTo<decimal>();
Assert.IsTrue(conv);
Assert.AreEqual(100m, conv.Result);
conv = "100.000".TryConvertTo<decimal>();
Assert.IsTrue(conv);
Assert.AreEqual(100m, conv.Result);
conv = "100,000".TryConvertTo<decimal>();
Assert.IsTrue(conv);
Assert.AreEqual(100m, conv.Result);
conv = "100.001".TryConvertTo<decimal>();
Assert.IsTrue(conv);
Assert.AreEqual(100.001m, conv.Result);
conv = 100m.TryConvertTo<decimal>();
Assert.IsTrue(conv);
Assert.AreEqual(100m, conv.Result);
conv = 100.000m.TryConvertTo<decimal>();
Assert.IsTrue(conv);
Assert.AreEqual(100m, conv.Result);
conv = 100.001m.TryConvertTo<decimal>();
Assert.IsTrue(conv);
Assert.AreEqual(100.001m, conv.Result);
conv = 100.TryConvertTo<decimal>();
Assert.IsTrue(conv);
Assert.AreEqual(100m, conv.Result);
}
[Test]
public void ConvertToDateTimeTest()
{
var conv = "2016-06-07".TryConvertTo<DateTime>();
Assert.IsTrue(conv);
Assert.AreEqual(new DateTime(2016, 6, 7), conv.Result);
}
}
}
-1
View File
@@ -231,7 +231,6 @@
<Compile Include="Services\CachedDataTypeServiceTests.cs" />
<Compile Include="TestHelpers\Entities\MockedPropertyTypes.cs" />
<Compile Include="TestHelpers\Entities\MockedUserGroup.cs" />
<Compile Include="TryConvertToTests.cs" />
<Compile Include="UdiTests.cs" />
<Compile Include="UmbracoExamine\RandomIdRAMDirectory.cs" />
<Compile Include="UmbracoExamine\UmbracoContentIndexerTests.cs" />
@@ -493,7 +493,7 @@ function mediaResource($q, $http, umbDataFormatter, umbRequestHelper) {
* @methodOf umbraco.resources.mediaResource
*
* @description
* Empties the media recycle bin
* Paginated search for media items starting on the supplied nodeId
*
* ##usage
* <pre>
@@ -506,7 +506,7 @@ function mediaResource($q, $http, umbDataFormatter, umbRequestHelper) {
* @param {string} query The search query
* @param {int} pageNumber The page number
* @param {int} pageSize The number of media items on a page
* @param {int} searchFrom Id to search from
* @param {int} searchFrom NodeId to search from (-1 for root)
* @returns {Promise} resourcePromise object.
*
*/
@@ -243,7 +243,7 @@ ul.color-picker li a {
.umb-mediapicker .umb-sortable-thumbnails li {
flex-direction: column;
margin: 0 5px 0 0;
margin: 0 5px 5px 0;
padding: 5px;
}
@@ -282,8 +282,8 @@ ul.color-picker li a {
}
.umb-sortable-thumbnails .umb-sortable-thumbnails__wrapper {
width: 120px;
height: 114px;
width: 124px;
height: 124px;
overflow: hidden;
}
@@ -298,6 +298,12 @@ ul.color-picker li a {
visibility: hidden;
}
.umb-sortable-thumbnails.ui-sortable:not(.ui-sortable-disabled) {
> li:not(.unsortable) {
cursor: move;
}
}
.umb-sortable-thumbnails li:hover .umb-sortable-thumbnails__actions {
opacity: 1;
visibility: visible;
@@ -215,7 +215,7 @@
<div class="row form-search">
<div class="span8 input-append">
<input type="text" class="search-query" ng-model="searcher.searchText" no-dirty-check />
<button type="button" class="btn btn-info" ng-click="search(searcher)" ng-disabled="searcher.isProcessing">Search</button>
<button type="submit" class="btn btn-info" ng-click="search(searcher)" ng-disabled="searcher.isProcessing">Search</button>
</div>
</div>
<div class="row">
@@ -136,10 +136,13 @@ angular.module('umbraco').controller("Umbraco.PropertyEditors.MediaPickerControl
};
$scope.sortableOptions = {
disabled: !$scope.isMultiPicker,
items: "li:not(.add-wrapper)",
cancel: ".unsortable",
update: function(e, ui) {
var r = [];
//TODO: Instead of doing this with a half second delay would be better to use a watch like we do in the
// content picker. THen we don't have to worry about setting ids, render models, models, we just set one and let the
// TODO: Instead of doing this with a half second delay would be better to use a watch like we do in the
// content picker. Then we don't have to worry about setting ids, render models, models, we just set one and let the
// watch do all the rest.
$timeout(function(){
angular.forEach($scope.images, function(value, key) {
@@ -3,7 +3,7 @@
<p ng-if="(images|filter:{trashed:true}).length == 1"><localize key="mediaPicker_pickedTrashedItem"></localize></p>
<p ng-if="(images|filter:{trashed:true}).length > 1"><localize key="mediaPicker_pickedTrashedItems"></localize></p>
<div class="flex error">
<div class="flex flex-wrap error">
<ul ui-sortable="sortableOptions" ng-model="images" class="umb-sortable-thumbnails">
<li class="umb-sortable-thumbnails__wrapper" ng-repeat="image in images track by $index">
@@ -30,8 +30,8 @@
</div>
</li>
<li style="border: none;">
<a href="#" class="add-link" ng-click="add()" ng-class="{'add-link-square': (images.length === 0 || isMultiPicker)}" ng-if="showAdd()" prevent-default>
<li class="add-wrapper unsortable" ng-if="showAdd()">
<a href="#" class="add-link" ng-click="add()" ng-class="{'add-link-square': (images.length === 0 || isMultiPicker)}" prevent-default>
<i class="icon icon-add large"></i>
</a>
</li>
+2 -3
View File
@@ -973,7 +973,6 @@
<Content Include="Umbraco\Masterpages\default.Master" />
<Content Include="Umbraco\Webservices\TreeDataService.ashx" />
<Content Include="Umbraco\Webservices\TagsAutoCompleteHandler.ashx" />
<Content Include="Umbraco\Webservices\MediaUploader.ashx" />
<None Include="web.Template.config">
<SubType>Designer</SubType>
</None>
@@ -1023,9 +1022,9 @@ xcopy "$(ProjectDir)"..\packages\SqlServerCE.4.0.0.1\x86\*.* "$(TargetDir)x86\"
<WebProjectProperties>
<UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>7710</DevelopmentServerPort>
<DevelopmentServerPort>7713</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:7710</IISUrl>
<IISUrl>http://localhost:7713</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
File diff suppressed because it is too large Load Diff
@@ -1 +0,0 @@
<%@ WebHandler Language="C#" CodeBehind="MediaUploader.ashx.cs" Class="umbraco.presentation.umbraco.webservices.MediaUploader" %>
@@ -45,8 +45,9 @@ namespace Umbraco.Web.Install.Controllers
if (ApplicationContext.Current.IsUpgrading)
{
// Update ClientDependency version
var clientDependencyConfig = new ClientDependencyConfiguration(ApplicationContext.Current.ProfilingLogger.Logger);
var clientDependencyUpdated = clientDependencyConfig.IncreaseVersionNumber();
var clientDependencyConfig = new ClientDependencyConfiguration(_umbracoContext.Application.ProfilingLogger.Logger);
var clientDependencyUpdated = clientDependencyConfig.UpdateVersionNumber(
UmbracoVersion.GetSemanticVersion(), DateTime.UtcNow, "yyyyMMdd");
// Delete ClientDependency temp directories to make sure we get fresh caches
var clientDependencyTempFilesDeleted = clientDependencyConfig.ClearTempFiles(HttpContext);
+12 -12
View File
@@ -69,12 +69,12 @@ namespace Umbraco.Web.Mvc
{
if (UmbracoContext == null)
{
throw new NullReferenceException("There is not current UmbracoContext, it must be initialized before the RenderRouteHandler executes");
throw new NullReferenceException("There is no current UmbracoContext, it must be initialized before the RenderRouteHandler executes");
}
var docRequest = UmbracoContext.PublishedContentRequest;
if (docRequest == null)
{
throw new NullReferenceException("There is not current PublishedContentRequest, it must be initialized before the RenderRouteHandler executes");
throw new NullReferenceException("There is no current PublishedContentRequest, it must be initialized before the RenderRouteHandler executes");
}
SetupRouteDataForRequest(
@@ -177,9 +177,9 @@ namespace Umbraco.Web.Mvc
if (decodedParts.All(x => x.Key != ReservedAdditionalKeys.Area))
return null;
foreach (var item in decodedParts.Where(x => new[] {
ReservedAdditionalKeys.Controller,
ReservedAdditionalKeys.Action,
foreach (var item in decodedParts.Where(x => new[] {
ReservedAdditionalKeys.Controller,
ReservedAdditionalKeys.Action,
ReservedAdditionalKeys.Area }.Contains(x.Key) == false))
{
// Populate route with additional values which aren't reserved values so they eventually to action parameters
@@ -360,9 +360,9 @@ namespace Umbraco.Web.Mvc
return new PublishedContentNotFoundHandler("In addition, no template exists to render the custom 404.");
// so we have a template, so we should have a rendering engine
if (pcr.RenderingEngine == RenderingEngine.WebForms) // back to webforms ?
if (pcr.RenderingEngine == RenderingEngine.WebForms) // back to webforms ?
return GetWebFormsHandler();
if (pcr.RenderingEngine != RenderingEngine.Mvc) // else ?
return new PublishedContentNotFoundHandler("In addition, no rendering engine exists to render the custom 404.");
@@ -389,8 +389,8 @@ namespace Umbraco.Web.Mvc
}
//Now we can check if we are supposed to render WebForms when the route has not been hijacked
if (publishedContentRequest.RenderingEngine == RenderingEngine.WebForms
&& publishedContentRequest.HasTemplate
if (publishedContentRequest.RenderingEngine == RenderingEngine.WebForms
&& publishedContentRequest.HasTemplate
&& routeDef.HasHijackedRoute == false)
{
return GetWebFormsHandler();
@@ -410,7 +410,7 @@ namespace Umbraco.Web.Mvc
var handler = GetHandlerOnMissingTemplate(publishedContentRequest);
// if it's not null it can be either the PublishedContentNotFoundHandler (no document was
// found to handle 404, or document with no template was found) or the WebForms handler
// found to handle 404, or document with no template was found) or the WebForms handler
// (a document was found and its template is WebForms)
// if it's null it means that a document was found and its template is Mvc
@@ -460,6 +460,6 @@ namespace Umbraco.Web.Mvc
return _controllerFactory.GetControllerSessionBehavior(requestContext, controllerName);
}
}
}
}
@@ -146,11 +146,11 @@ namespace Umbraco.Web.PropertyEditors.ValueConverters
switch (GetPublishedContentType(propertyType.DataTypeId))
{
case PublishedItemType.Media:
contentFetcher = umbHelper.TypedMember;
contentFetcher = umbHelper.TypedMedia;
break;
case PublishedItemType.Member:
contentFetcher = umbHelper.TypedMedia;
contentFetcher = umbHelper.TypedMember;
break;
case PublishedItemType.Content:
+10 -2
View File
@@ -537,8 +537,16 @@ namespace Umbraco.Web
public IPublishedContent TypedMember(object id)
{
var asInt = id.TryConvertTo<int>();
return asInt ? MembershipHelper.GetById(asInt.Result) : MembershipHelper.GetByProviderKey(id);
int intId;
if (ConvertIdObjectToInt(id, out intId))
return MembershipHelper.GetById(intId);
Guid guidId;
if (ConvertIdObjectToGuid(id, out guidId))
return TypedMember(guidId);
Udi udiId;
if (ConvertIdObjectToUdi(id, out udiId))
return TypedMember(udiId);
return null;
}
public IPublishedContent TypedMember(int id)