mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 10:54:50 +08:00
Merge
--HG-- branch : dev
This commit is contained in:
@@ -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<IHttpContextAccessor>().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));
|
||||
|
@@ -7,7 +7,7 @@
|
||||
-->
|
||||
<!-- edit shape just get default placement -->
|
||||
<!-- edit "shape" -->
|
||||
<Place Parts_PublishLater_Edit="Sidebar:22"/><!-- immediately following the contents module's save button -->
|
||||
<Place Parts_PublishLater_Edit="Sidebar:25"/><!-- immediately following the contents module's Publish Now button -->
|
||||
<!-- default positioning -->
|
||||
<Match DisplayType="SummaryAdmin">
|
||||
<Place Parts_PublishLater_Metadata_SummaryAdmin="Meta:1"/>
|
||||
|
@@ -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%;
|
||||
}
|
||||
width:33%;
|
||||
}
|
||||
|
@@ -12,6 +12,7 @@
|
||||
@Html.EditorFor(m => m.ScheduledPublishDate)
|
||||
<label class="forpicker" for="@ViewData.TemplateInfo.GetFullHtmlFieldId("ScheduledPublishTime")">@T("Time")</label>
|
||||
@Html.EditorFor(m => m.ScheduledPublishTime)
|
||||
<button type="submit" name="submit.Save" value="submit.PublishLater">@T("Publish Later")</button>
|
||||
</fieldset>
|
||||
@using(Script.Foot()) {
|
||||
<script type="text/javascript">
|
||||
|
@@ -868,6 +868,9 @@ fieldset.publish-button, fieldset.delete-button, fieldset.save-button {
|
||||
clear:none;
|
||||
float:left;
|
||||
}
|
||||
fieldset.save-button {
|
||||
clear:left;
|
||||
}
|
||||
fieldset.publish-button {
|
||||
margin: 0 12px;
|
||||
padding: 0 12px;
|
||||
@@ -876,17 +879,7 @@ fieldset.publish-button {
|
||||
fieldset.delete-button {
|
||||
margin: 0 0 0 12px;
|
||||
}
|
||||
fieldset.publish-later-datetime {
|
||||
float:left;
|
||||
}
|
||||
fieldset.publish-later-datetime legend {
|
||||
display:none;
|
||||
}
|
||||
fieldset.publish-later-datetime input {
|
||||
padding:1px;
|
||||
text-align:center;
|
||||
color:#666;
|
||||
}
|
||||
|
||||
|
||||
/* Fields
|
||||
***************************************************************/
|
||||
|
Reference in New Issue
Block a user