diff --git a/build/NuSpecs/UmbracoCms.Core.nuspec b/build/NuSpecs/UmbracoCms.Core.nuspec
index 82826c3d03..8610aeb9a6 100644
--- a/build/NuSpecs/UmbracoCms.Core.nuspec
+++ b/build/NuSpecs/UmbracoCms.Core.nuspec
@@ -32,13 +32,13 @@
-
+
-
+
diff --git a/src/Umbraco.Core/Persistence/Repositories/UserRepository.cs b/src/Umbraco.Core/Persistence/Repositories/UserRepository.cs
index bbb3d548f0..5701cd1008 100644
--- a/src/Umbraco.Core/Persistence/Repositories/UserRepository.cs
+++ b/src/Umbraco.Core/Persistence/Repositories/UserRepository.cs
@@ -192,11 +192,11 @@ ORDER BY colName";
return new Dictionary
{
- {UserState.All, result[0].num},
- {UserState.Active, result[1].num},
- {UserState.Disabled, result[2].num},
- {UserState.LockedOut, result[3].num},
- {UserState.Invited, result[4].num}
+ {UserState.All, (int)result[0].num},
+ {UserState.Active, (int)result[1].num},
+ {UserState.Disabled, (int)result[2].num},
+ {UserState.LockedOut, (int)result[3].num},
+ {UserState.Invited, (int)result[4].num}
};
}
diff --git a/src/Umbraco.Core/Services/ContentService.cs b/src/Umbraco.Core/Services/ContentService.cs
index 6e8a8904ab..ae2f7a3dc6 100644
--- a/src/Umbraco.Core/Services/ContentService.cs
+++ b/src/Umbraco.Core/Services/ContentService.cs
@@ -2006,6 +2006,96 @@ namespace Umbraco.Core.Services
}
}
+ return true;
+ }
+
+ ///
+ /// Sorts a collection of objects by updating the SortOrder according
+ /// to the ordering of node Ids passed in.
+ ///
+ ///
+ /// Using this method will ensure that the Published-state is maintained upon sorting
+ /// so the cache is updated accordingly - as needed.
+ ///
+ ///
+ ///
+ ///
+ /// True if sorting succeeded, otherwise False
+ public bool Sort(int[] ids, int userId = 0, bool raiseEvents = true)
+ {
+ var shouldBePublished = new List();
+ var shouldBeSaved = new List();
+
+ using (new WriteLock(Locker))
+ {
+ var allContent = GetByIds(ids).ToDictionary(x => x.Id, x => x);
+ var items = ids.Select(x => allContent[x]);
+
+ using (var uow = UowProvider.GetUnitOfWork())
+ {
+ var asArray = items.ToArray();
+ var saveEventArgs = new SaveEventArgs(asArray);
+ if (raiseEvents && uow.Events.DispatchCancelable(Saving, this, saveEventArgs, "Saving"))
+ {
+ uow.Commit();
+ return false;
+ }
+
+ var repository = RepositoryFactory.CreateContentRepository(uow);
+
+ var i = 0;
+ foreach (var content in asArray)
+ {
+ //If the current sort order equals that of the content
+ //we don't need to update it, so just increment the sort order
+ //and continue.
+ if (content.SortOrder == i)
+ {
+ i++;
+ continue;
+ }
+
+ content.SortOrder = i;
+ content.WriterId = userId;
+ i++;
+
+ if (content.Published)
+ {
+ //TODO: This should not be an inner operation, but if we do this, it cannot raise events and cannot be cancellable!
+ var published = _publishingStrategy.Publish(uow, content, userId).Success;
+ shouldBePublished.Add(content);
+ }
+ else
+ shouldBeSaved.Add(content);
+
+ repository.AddOrUpdate(content);
+ //add or update a preview
+ repository.AddOrUpdatePreviewXml(content, c => _entitySerializer.Serialize(this, _dataTypeService, _userService, c));
+ }
+
+ foreach (var content in shouldBePublished)
+ {
+ //Create and Save ContentXml DTO
+ repository.AddOrUpdateContentXml(content, c => _entitySerializer.Serialize(this, _dataTypeService, _userService, c));
+ }
+
+ if (raiseEvents)
+ {
+ saveEventArgs.CanCancel = false;
+ uow.Events.Dispatch(Saved, this, saveEventArgs, "Saved");
+ }
+
+ if (shouldBePublished.Any())
+ {
+ //TODO: This should not be an inner operation, but if we do this, it cannot raise events and cannot be cancellable!
+ _publishingStrategy.PublishingFinalized(uow, shouldBePublished, false);
+ }
+
+ Audit(uow, AuditType.Sort, "Sorting content performed by user", userId, 0);
+ uow.Commit();
+ }
+ }
+
return true;
}
diff --git a/src/Umbraco.Core/Services/IContentService.cs b/src/Umbraco.Core/Services/IContentService.cs
index 7a5c64c0c0..14ef94bd7a 100644
--- a/src/Umbraco.Core/Services/IContentService.cs
+++ b/src/Umbraco.Core/Services/IContentService.cs
@@ -642,7 +642,21 @@ namespace Umbraco.Core.Services
///
///
/// True if sorting succeeded, otherwise False
- bool Sort(IEnumerable items, int userId = 0, bool raiseEvents = true);
+ bool Sort(IEnumerable items, int userId = 0, bool raiseEvents = true);
+
+ ///
+ /// Sorts a collection of objects by updating the SortOrder according
+ /// to the ordering of node Ids passed in.
+ ///
+ ///
+ /// Using this method will ensure that the Published-state is maintained upon sorting
+ /// so the cache is updated accordingly - as needed.
+ ///
+ ///
+ ///
+ ///
+ /// True if sorting succeeded, otherwise False
+ bool Sort(int[] ids, int userId = 0, bool raiseEvents = true);
///
/// Gets the parent of the current content as an item.
diff --git a/src/Umbraco.Tests/Umbraco.Tests.csproj b/src/Umbraco.Tests/Umbraco.Tests.csproj
index 9828575900..f669416643 100644
--- a/src/Umbraco.Tests/Umbraco.Tests.csproj
+++ b/src/Umbraco.Tests/Umbraco.Tests.csproj
@@ -62,8 +62,8 @@
..\packages\Castle.Core.4.0.0\lib\net45\Castle.Core.dll
-
- ..\packages\Examine.0.1.85\lib\net45\Examine.dll
+
+ ..\packages\Examine.0.1.88\lib\net45\Examine.dll
..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll
diff --git a/src/Umbraco.Tests/packages.config b/src/Umbraco.Tests/packages.config
index 6972dbc12e..921ac155c7 100644
--- a/src/Umbraco.Tests/packages.config
+++ b/src/Umbraco.Tests/packages.config
@@ -2,7 +2,7 @@
-
+
diff --git a/src/Umbraco.Web.UI.Client/src/views/documenttypes/views/permissions/permissions.html b/src/Umbraco.Web.UI.Client/src/views/documenttypes/views/permissions/permissions.html
index 0871f2c555..d9c7d185da 100644
--- a/src/Umbraco.Web.UI.Client/src/views/documenttypes/views/permissions/permissions.html
+++ b/src/Umbraco.Web.UI.Client/src/views/documenttypes/views/permissions/permissions.html
@@ -36,7 +36,7 @@
diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/grid.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/grid.html
index c15ec7cf23..c2513b9760 100644
--- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/grid.html
+++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/grid.html
@@ -299,7 +299,7 @@
ng-if="editorOverlay.show"
model="editorOverlay"
view="editorOverlay.view"
- position="center">
+ position="target">
..\packages\dotless.1.5.2\lib\dotless.Core.dll
-
- ..\packages\Examine.0.1.85\lib\net45\Examine.dll
+
+ ..\packages\Examine.0.1.88\lib\net45\Examine.dll
False
diff --git a/src/Umbraco.Web.UI/packages.config b/src/Umbraco.Web.UI/packages.config
index a8ed429c04..13b0d501eb 100644
--- a/src/Umbraco.Web.UI/packages.config
+++ b/src/Umbraco.Web.UI/packages.config
@@ -4,7 +4,7 @@
-
+
diff --git a/src/Umbraco.Web/Editors/ContentController.cs b/src/Umbraco.Web/Editors/ContentController.cs
index d53ee84e7c..6b3a73f5df 100644
--- a/src/Umbraco.Web/Editors/ContentController.cs
+++ b/src/Umbraco.Web/Editors/ContentController.cs
@@ -792,11 +792,8 @@ namespace Umbraco.Web.Editors
{
var contentService = Services.ContentService;
- // content service GetByIds does order the content items based on the order of Ids passed in
- var content = contentService.GetByIds(sorted.IdSortOrder);
-
// Save content with new sort order and update content xml in db accordingly
- if (contentService.Sort(content) == false)
+ if (contentService.Sort(sorted.IdSortOrder) == false)
{
LogHelper.Warn("Content sorting failed, this was probably caused by an event being cancelled");
return Request.CreateValidationErrorResponse("Content sorting failed, this was probably caused by an event being cancelled");
diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj
index 4abbdac89e..82bc790eb0 100644
--- a/src/Umbraco.Web/Umbraco.Web.csproj
+++ b/src/Umbraco.Web/Umbraco.Web.csproj
@@ -112,8 +112,8 @@
..\packages\dotless.1.5.2\lib\dotless.Core.dll
-
- ..\packages\Examine.0.1.85\lib\net45\Examine.dll
+
+ ..\packages\Examine.0.1.88\lib\net45\Examine.dll
..\packages\HtmlAgilityPack.1.4.9.5\lib\Net45\HtmlAgilityPack.dll
diff --git a/src/Umbraco.Web/packages.config b/src/Umbraco.Web/packages.config
index 9e9734f631..88482b4022 100644
--- a/src/Umbraco.Web/packages.config
+++ b/src/Umbraco.Web/packages.config
@@ -3,7 +3,7 @@
-
+
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/nodeSorter.asmx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/nodeSorter.asmx.cs
index 505d715c3e..e7603abe2e 100644
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/nodeSorter.asmx.cs
+++ b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/nodeSorter.asmx.cs
@@ -175,13 +175,16 @@ namespace umbraco.presentation.webservices
{
var contentService = ApplicationContext.Services.ContentService;
try
- {
- var intIds = ids.Select(int.Parse).ToArray();
- var allContent = contentService.GetByIds(intIds).ToDictionary(x => x.Id, x => x);
- var sortedContent = intIds.Select(x => allContent[x]);
-
+ {
// Save content with new sort order and update db+cache accordingly
- var sorted = contentService.Sort(sortedContent);
+ var intIds = new List();
+ foreach (var stringId in ids)
+ {
+ int intId;
+ if (int.TryParse(stringId, out intId))
+ intIds.Add(intId);
+ }
+ var sorted = contentService.Sort(intIds.ToArray());
// refresh sort order on cached xml
// but no... this is not distributed - solely relying on content service & events should be enough
diff --git a/src/UmbracoExamine/UmbracoExamine.csproj b/src/UmbracoExamine/UmbracoExamine.csproj
index eb83b5c813..f3dd301a8c 100644
--- a/src/UmbracoExamine/UmbracoExamine.csproj
+++ b/src/UmbracoExamine/UmbracoExamine.csproj
@@ -82,8 +82,8 @@
..\Solution Items\TheFARM-Public.snk
-
- ..\packages\Examine.0.1.85\lib\net45\Examine.dll
+
+ ..\packages\Examine.0.1.88\lib\net45\Examine.dll
..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll
diff --git a/src/UmbracoExamine/packages.config b/src/UmbracoExamine/packages.config
index 36a8eb3060..40bdd28e84 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/packages.config b/src/umbraco.MacroEngines/packages.config
index a46f0572ef..6aadcba8d4 100644
--- a/src/umbraco.MacroEngines/packages.config
+++ b/src/umbraco.MacroEngines/packages.config
@@ -1,6 +1,6 @@
-
+
diff --git a/src/umbraco.MacroEngines/umbraco.MacroEngines.csproj b/src/umbraco.MacroEngines/umbraco.MacroEngines.csproj
index 63d8314084..46c2b1ed2c 100644
--- a/src/umbraco.MacroEngines/umbraco.MacroEngines.csproj
+++ b/src/umbraco.MacroEngines/umbraco.MacroEngines.csproj
@@ -45,8 +45,8 @@
false
-
- ..\packages\Examine.0.1.85\lib\net45\Examine.dll
+
+ ..\packages\Examine.0.1.88\lib\net45\Examine.dll
..\packages\HtmlAgilityPack.1.4.9.5\lib\Net45\HtmlAgilityPack.dll