diff --git a/src/Orchard.Web/Core/Common/Drivers/CommonPartDriver.cs b/src/Orchard.Web/Core/Common/Drivers/CommonPartDriver.cs index 0d2ee80ea..f0edec011 100644 --- a/src/Orchard.Web/Core/Common/Drivers/CommonPartDriver.cs +++ b/src/Orchard.Web/Core/Common/Drivers/CommonPartDriver.cs @@ -73,7 +73,9 @@ namespace Orchard.Core.Common.Drivers { List parts = new List(); CommonTypePartSettings commonTypePartSettings = GetTypeSettings(part); - parts.Add(OwnerEditor(part, updater, shapeHelper)); + if (commonTypePartSettings.ShowOwnerEditor) { + parts.Add(OwnerEditor(part, updater, shapeHelper)); + } if (commonTypePartSettings.ShowCreatedUtcEditor) { parts.Add(CreatedUtcEditor(part, updater, shapeHelper)); @@ -114,12 +116,7 @@ namespace Orchard.Core.Common.Drivers { } DriverResult CreatedUtcEditor(CommonPart part, IUpdateModel updater, dynamic shapeHelper) { - var currentUser = _authenticationService.GetAuthenticatedUser(); - if (!_authorizationService.TryCheckAccess(StandardPermissions.SiteOwner, currentUser, part)) { - return null; - } - - var model = new CreatedUtcEditorViewModel(); + CreatedUtcEditorViewModel model = new CreatedUtcEditorViewModel(); if (part.CreatedUtc != null) { model.CreatedDate = part.CreatedUtc.Value.ToLocalTime().ToString(DatePattern, CultureInfo.InvariantCulture); model.CreatedTime = part.CreatedUtc.Value.ToLocalTime().ToString(TimePattern, CultureInfo.InvariantCulture); @@ -134,7 +131,7 @@ namespace Orchard.Core.Common.Drivers { // use an english culture as it is the one used by jQuery.datepicker by default if (DateTime.TryParse(parseDateTime, CultureInfo.GetCultureInfo("en-US"), DateTimeStyles.AssumeLocal, out createdUtc)) { - part.CreatedUtc = createdUtc; + part.CreatedUtc = createdUtc.ToUniversalTime(); } else { updater.AddModelError(Prefix, T("{0} is an invalid date and time", parseDateTime)); diff --git a/src/Orchard.Web/Core/Common/Settings/CommonSettings.cs b/src/Orchard.Web/Core/Common/Settings/CommonSettings.cs index 410aca381..20c3a334d 100644 --- a/src/Orchard.Web/Core/Common/Settings/CommonSettings.cs +++ b/src/Orchard.Web/Core/Common/Settings/CommonSettings.cs @@ -7,7 +7,12 @@ using Orchard.ContentManagement.ViewModels; namespace Orchard.Core.Common.Settings { public class CommonTypePartSettings { + public CommonTypePartSettings() { + ShowOwnerEditor = true; + } + public bool ShowCreatedUtcEditor { get; set; } + public bool ShowOwnerEditor { get; set; } } public class CommonSettingsHooks : ContentDefinitionEditorEventsBase { @@ -26,6 +31,7 @@ namespace Orchard.Core.Common.Settings { var model = new CommonTypePartSettings(); updateModel.TryUpdateModel(model, "CommonTypePartSettings", null, null); builder.WithSetting("CommonTypePartSettings.ShowCreatedUtcEditor", model.ShowCreatedUtcEditor.ToString()); + builder.WithSetting("CommonTypePartSettings.ShowOwnerEditor", model.ShowOwnerEditor.ToString()); yield return DefinitionTemplate(model); } } diff --git a/src/Orchard.Web/Core/Common/Views/DefinitionTemplates/CommonTypePartSettings.cshtml b/src/Orchard.Web/Core/Common/Views/DefinitionTemplates/CommonTypePartSettings.cshtml index 467f326bc..b4d3ea916 100644 --- a/src/Orchard.Web/Core/Common/Views/DefinitionTemplates/CommonTypePartSettings.cshtml +++ b/src/Orchard.Web/Core/Common/Views/DefinitionTemplates/CommonTypePartSettings.cshtml @@ -1,6 +1,12 @@ @model Orchard.Core.Common.Settings.CommonTypePartSettings
@Html.CheckBoxFor(m => m.ShowCreatedUtcEditor) - + @Html.ValidationMessageFor(m => m.ShowCreatedUtcEditor) +
+ +
+ @Html.CheckBoxFor(m => m.ShowOwnerEditor) + + @Html.ValidationMessageFor(m => m.ShowOwnerEditor)
\ No newline at end of file diff --git a/src/Orchard.Web/Core/Common/Views/EditorTemplates/Parts.Common.CreatedUtc.cshtml b/src/Orchard.Web/Core/Common/Views/EditorTemplates/Parts.Common.CreatedUtc.cshtml index a86438bf3..ba23bbd54 100644 --- a/src/Orchard.Web/Core/Common/Views/EditorTemplates/Parts.Common.CreatedUtc.cshtml +++ b/src/Orchard.Web/Core/Common/Views/EditorTemplates/Parts.Common.CreatedUtc.cshtml @@ -34,7 +34,7 @@ } }); $('#@ViewData.TemplateInfo.GetFullHtmlFieldId("CreatedDate")').datepicker({ showAnim: "" }).focus(function () { $('#@ViewData.TemplateInfo.GetFullHtmlFieldId("Command_Created")').attr("checked", "checked") }); - $('#@ViewData.TemplateInfo.GetFullHtmlFieldId("CreatedTime")').timepickr().focus(function () { $('#@ViewData.TemplateInfo.GetFullHtmlFieldId("Command_Created")').attr("checked", "checked") }); + $('#@ViewData.TemplateInfo.GetFullHtmlFieldId("CreatedTime")').timepickr({ showAnim: "" }).focus(function () { $('#@ViewData.TemplateInfo.GetFullHtmlFieldId("Command_Created")').attr("checked", "checked") }); }) //]]>