Newly translated content w/out a PublishLaterPart is now published if the master content item is published

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2010-07-23 00:59:12 -07:00
parent 272300f5ef
commit 2e9eff17e0

View File

@@ -2,6 +2,7 @@
using System.Linq;
using System.Web.Mvc;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Aspects;
using Orchard.Core.Localization.Models;
using Orchard.Core.Localization.Services;
using Orchard.Core.Localization.ViewModels;
@@ -9,6 +10,7 @@ using Orchard.Localization;
using Orchard.Localization.Services;
using Orchard.Mvc.Results;
using Orchard.Mvc.ViewModels;
using Orchard.UI.Notify;
namespace Orchard.Core.Localization.Controllers {
[ValidateInput(false)]
@@ -75,6 +77,10 @@ namespace Orchard.Core.Localization.Controllers {
localized.MasterContentItem = contentItem;
localized.Culture = _cultureManager.GetCultureByName(viewModel.SelectedCulture);
_contentManager.Create(contentItemTranslation, VersionOptions.Draft);
if (!contentItem.Has<IPublishingControlAspect>() && contentItem.VersionRecord != null && contentItem.VersionRecord.Published) {
_contentManager.Publish(contentItemTranslation);
}
}
if (ModelState.IsValid)
@@ -87,6 +93,8 @@ namespace Orchard.Core.Localization.Controllers {
return View(viewModel);
}
Services.Notifier.Information(T("Created content item translation"));
var metadata = _contentManager.GetItemMetadata(viewModel.Content.Item);
if (metadata.EditorRouteValues == null)
return null; //todo: (heskew) redirect to somewhere better than nowhere