mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-24 05:23:33 +08:00
Making sure changes to the (CommonPart) Owner field are applied.
work item: 17143 --HG-- branch : 1.x
This commit is contained in:
@@ -10,7 +10,6 @@ using Orchard.Services;
|
|||||||
|
|
||||||
namespace Orchard.Core.Common.Drivers {
|
namespace Orchard.Core.Common.Drivers {
|
||||||
public class CommonPartDriver : ContentPartDriver<CommonPart> {
|
public class CommonPartDriver : ContentPartDriver<CommonPart> {
|
||||||
private const string TemplatePrefix = "CommonPart";
|
|
||||||
private readonly IContentManager _contentManager;
|
private readonly IContentManager _contentManager;
|
||||||
private readonly IAuthenticationService _authenticationService;
|
private readonly IAuthenticationService _authenticationService;
|
||||||
private readonly IAuthorizationService _authorizationService;
|
private readonly IAuthorizationService _authorizationService;
|
||||||
@@ -36,6 +35,10 @@ namespace Orchard.Core.Common.Drivers {
|
|||||||
public Localizer T { get; set; }
|
public Localizer T { get; set; }
|
||||||
public IOrchardServices Services { get; set; }
|
public IOrchardServices Services { get; set; }
|
||||||
|
|
||||||
|
protected override string Prefix {
|
||||||
|
get { return "CommonPart"; }
|
||||||
|
}
|
||||||
|
|
||||||
protected override DriverResult Display(CommonPart part, string displayType, dynamic shapeHelper) {
|
protected override DriverResult Display(CommonPart part, string displayType, dynamic shapeHelper) {
|
||||||
return Combined(
|
return Combined(
|
||||||
ContentShape("Parts_Common_Metadata",
|
ContentShape("Parts_Common_Metadata",
|
||||||
@@ -75,7 +78,7 @@ namespace Orchard.Core.Common.Drivers {
|
|||||||
|
|
||||||
if (updater != null) {
|
if (updater != null) {
|
||||||
var priorOwner = model.Owner;
|
var priorOwner = model.Owner;
|
||||||
updater.TryUpdateModel(model, TemplatePrefix, null, null);
|
updater.TryUpdateModel(model, Prefix, null, null);
|
||||||
|
|
||||||
if (model.Owner != null && model.Owner != priorOwner) {
|
if (model.Owner != null && model.Owner != priorOwner) {
|
||||||
var newOwner = _membershipService.GetUser(model.Owner);
|
var newOwner = _membershipService.GetUser(model.Owner);
|
||||||
@@ -104,7 +107,7 @@ namespace Orchard.Core.Common.Drivers {
|
|||||||
|
|
||||||
if (updater != null) {
|
if (updater != null) {
|
||||||
var priorContainerId = model.ContainerId;
|
var priorContainerId = model.ContainerId;
|
||||||
updater.TryUpdateModel(model, TemplatePrefix, null, null);
|
updater.TryUpdateModel(model, Prefix, null, null);
|
||||||
|
|
||||||
if (model.ContainerId != null && model.ContainerId != priorContainerId) {
|
if (model.ContainerId != null && model.ContainerId != priorContainerId) {
|
||||||
var newContainer = _contentManager.Get((int)model.ContainerId, VersionOptions.Latest);
|
var newContainer = _contentManager.Get((int)model.ContainerId, VersionOptions.Latest);
|
||||||
|
Reference in New Issue
Block a user