diff --git a/src/Orchard.Web/Core/Shapes/CoreShapes.cs b/src/Orchard.Web/Core/Shapes/CoreShapes.cs index 620905093..fefbaec10 100644 --- a/src/Orchard.Web/Core/Shapes/CoreShapes.cs +++ b/src/Orchard.Web/Core/Shapes/CoreShapes.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; @@ -10,7 +9,6 @@ using System.Web.Mvc.Html; using Orchard.DisplayManagement; using Orchard.DisplayManagement.Descriptors; using Orchard.DisplayManagement.Implementation; -using Orchard.DisplayManagement.Shapes; using Orchard.Settings; using Orchard.UI; using Orchard.UI.Resources; @@ -158,57 +156,6 @@ namespace Orchard.Core.Shapes { return ordering.Select(ordered => ordered.item).ToList(); } - private class FlatPositionComparer : IComparer { - public int Compare(string x, string y) { - if (x == y) - return 0; - - // "" == "5" - x = string.IsNullOrWhiteSpace(x) ? "5" : x.TrimStart(':'); // ':' is _sometimes_ used as a partition identifier - y = string.IsNullOrWhiteSpace(y) ? "5" : y.TrimStart(':'); - - var xParts = x.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries); - var yParts = y.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries); - for (var i = 0; i < xParts.Count(); i++) { - if (yParts.Length < i - 1) // x is further defined meaning it comes after y (e.g. x == 1.2.3 and y == 1.2) - return 1; - - int xPos; - int yPos; - - xParts[i] = normalizeKnownPartitions(xParts[i]); - yParts[i] = normalizeKnownPartitions(yParts[i]); - - var xIsInt = int.TryParse(xParts[i], out xPos); - var yIsInt = int.TryParse(yParts[i], out yPos); - - if (!xIsInt && !yIsInt) - return string.Compare(x, y, StringComparison.OrdinalIgnoreCase); - if (!xIsInt || (yIsInt && xPos > yPos)) // non-int after int or greater x pos than y pos (which is an int) - return 1; - if (!yIsInt || xPos < yPos) - return -1; - } - - if (xParts.Length < yParts.Length) // all things being equal y might be further defined than x (e.g. x == 1.2 and y == 1.2.3) - return -1; - - return 0; - } - - private static string normalizeKnownPartitions(string partition) { - if (partition.Length < 5) // known partitions are long - return partition; - - if (string.Compare(partition, "before", StringComparison.OrdinalIgnoreCase) == 0) - return "-9999"; - if (string.Compare(partition, "after", StringComparison.OrdinalIgnoreCase) == 0) - return "9999"; - - return partition; - } - } - #endregion [Shape] diff --git a/src/Orchard.Web/Modules/Orchard.Widgets/Views/Admin/Index.cshtml b/src/Orchard.Web/Modules/Orchard.Widgets/Views/Admin/Index.cshtml index 717f6bf25..cd53940cf 100644 --- a/src/Orchard.Web/Modules/Orchard.Widgets/Views/Admin/Index.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Widgets/Views/Admin/Index.cshtml @@ -48,7 +48,7 @@
  • @zone