From 625880f9e12de5bcdc6fae831297a478e58a18d5 Mon Sep 17 00:00:00 2001 From: Dave Reed Date: Fri, 10 Dec 2010 11:12:29 -0800 Subject: [PATCH] #16998: Publish Later UI now much less confusing with 3 buttons: Save, Publish Now, and Publish Later. This also moves some publish-later specific css from the admin css to the publish later css, and makes the _Archive_ Later UI look better when active. --HG-- branch : dev --- .../Drivers/PublishLaterPartDriver.cs | 27 ++++++++++--------- .../Orchard.PublishLater/Placement.info | 2 +- .../Styles/orchard-publishlater-datetime.css | 22 ++++++++++++--- .../EditorTemplates/Parts/PublishLater.cshtml | 1 + .../Themes/TheAdmin/Styles/site.css | 15 +++-------- 5 files changed, 40 insertions(+), 27 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.PublishLater/Drivers/PublishLaterPartDriver.cs b/src/Orchard.Web/Modules/Orchard.PublishLater/Drivers/PublishLaterPartDriver.cs index 492f0b1b0..78a3d8789 100644 --- a/src/Orchard.Web/Modules/Orchard.PublishLater/Drivers/PublishLaterPartDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.PublishLater/Drivers/PublishLaterPartDriver.cs @@ -2,6 +2,7 @@ using Orchard.ContentManagement; using Orchard.ContentManagement.Drivers; using Orchard.Core.Common.Services; +using Orchard.Mvc; using Orchard.PublishLater.Models; using Orchard.PublishLater.Services; using Orchard.PublishLater.ViewModels; @@ -58,22 +59,24 @@ namespace Orchard.PublishLater.Drivers { updater.TryUpdateModel(model, Prefix, null, null); - if (!string.IsNullOrWhiteSpace(model.ScheduledPublishDate) && !string.IsNullOrWhiteSpace(model.ScheduledPublishTime)) { - DateTime scheduled; - string parseDateTime = String.Concat(model.ScheduledPublishDate, " ", model.ScheduledPublishTime); + if (Services.WorkContext.Resolve().Current().Request.Form["submit.Save"] == "submit.PublishLater") { + if (!string.IsNullOrWhiteSpace(model.ScheduledPublishDate) && !string.IsNullOrWhiteSpace(model.ScheduledPublishTime)) { + DateTime scheduled; + string parseDateTime = String.Concat(model.ScheduledPublishDate, " ", model.ScheduledPublishTime); - // 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 scheduled)) { - model.ScheduledPublishUtc = part.ScheduledPublishUtc.Value = scheduled.ToUniversalTime(); - _publishLaterService.Publish(model.ContentItem, model.ScheduledPublishUtc.Value); + // 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 scheduled)) { + model.ScheduledPublishUtc = part.ScheduledPublishUtc.Value = scheduled.ToUniversalTime(); + _publishLaterService.Publish(model.ContentItem, model.ScheduledPublishUtc.Value); + } + else { + updater.AddModelError(Prefix, T("{0} is an invalid date and time", parseDateTime)); + } } - else { - updater.AddModelError(Prefix, T("{0} is an invalid date and time", parseDateTime)); + else if (!string.IsNullOrWhiteSpace(model.ScheduledPublishDate) || !string.IsNullOrWhiteSpace(model.ScheduledPublishTime)) { + updater.AddModelError(Prefix, T("Both the date and time need to be specified for when this is to be published. If you don't want to schedule publishing then click Save or Publish Now.")); } } - else if (!string.IsNullOrWhiteSpace(model.ScheduledPublishDate) || !string.IsNullOrWhiteSpace(model.ScheduledPublishTime)) { - updater.AddModelError(Prefix, T("Both the date and time need to be specified for when this is to be published. If you don't want to schedule publishing then clear both the date and time fields.")); - } return ContentShape("Parts_PublishLater_Edit", () => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: model, Prefix: Prefix)); diff --git a/src/Orchard.Web/Modules/Orchard.PublishLater/Placement.info b/src/Orchard.Web/Modules/Orchard.PublishLater/Placement.info index 540beb062..44407210b 100644 --- a/src/Orchard.Web/Modules/Orchard.PublishLater/Placement.info +++ b/src/Orchard.Web/Modules/Orchard.PublishLater/Placement.info @@ -7,7 +7,7 @@ --> - + diff --git a/src/Orchard.Web/Modules/Orchard.PublishLater/Styles/orchard-publishlater-datetime.css b/src/Orchard.Web/Modules/Orchard.PublishLater/Styles/orchard-publishlater-datetime.css index af6b87158..3ada88ce5 100644 --- a/src/Orchard.Web/Modules/Orchard.PublishLater/Styles/orchard-publishlater-datetime.css +++ b/src/Orchard.Web/Modules/Orchard.PublishLater/Styles/orchard-publishlater-datetime.css @@ -6,9 +6,25 @@ html.dyn input.hinted { color:#ccc; font-style:italic; } + +fieldset.publish-later-datetime { + float:left; + clear:none; + white-space: nowrap; + vertical-align: middle; +} +fieldset.publish-later-datetime legend { + display:none; +} +fieldset.publish-later-datetime input { + padding:1px; + text-align:center; + color:#666; +} + input#PublishLater_ScheduledPublishDate { - width:49%; + width:39%; } input#PublishLater_ScheduledPublishTime { - width:43%; -} \ No newline at end of file + width:33%; +} diff --git a/src/Orchard.Web/Modules/Orchard.PublishLater/Views/EditorTemplates/Parts/PublishLater.cshtml b/src/Orchard.Web/Modules/Orchard.PublishLater/Views/EditorTemplates/Parts/PublishLater.cshtml index d0678e18b..ab6ad2dfa 100644 --- a/src/Orchard.Web/Modules/Orchard.PublishLater/Views/EditorTemplates/Parts/PublishLater.cshtml +++ b/src/Orchard.Web/Modules/Orchard.PublishLater/Views/EditorTemplates/Parts/PublishLater.cshtml @@ -12,6 +12,7 @@ @Html.EditorFor(m => m.ScheduledPublishDate) @Html.EditorFor(m => m.ScheduledPublishTime) + @using(Script.Foot()) {