Moving PublishLater back in.

--HG--
branch : dev
This commit is contained in:
BertrandLeRoy
2010-09-16 15:43:51 -07:00
parent edb1d9aebe
commit adc891d2f0
8 changed files with 84 additions and 83 deletions

View File

@@ -266,8 +266,8 @@
<Content Include="PublishLater\Content\Admin\images\online.gif" />
<Content Include="PublishLater\Content\Admin\images\published.gif" />
<Content Include="PublishLater\Content\Admin\images\scheduled.gif" />
<Content Include="PublishLater\Views\DisplayTemplates\Parts\PublishLater.Metadata.ascx" />
<Content Include="PublishLater\Views\DisplayTemplates\Parts\PublishLater.Metadata.SummaryAdmin.ascx" />
<None Include="PublishLater\Views\DisplayTemplates\Parts\PublishLater.Metadata.cshtml" />
<None Include="PublishLater\Views\DisplayTemplates\Parts\PublishLater.Metadata.SummaryAdmin.cshtml" />
<None Include="Common\Views\EditorTemplates\Fields\Common.TextField.cshtml" />
<None Include="Common\Views\EditorTemplates\Parts\Common.Container.cshtml" />
<None Include="Common\Views\EditorTemplates\PlainTextEditor.cshtml" />
@@ -300,7 +300,7 @@
<Content Include="PublishLater\Styles\jquery-ui-1.7.2.custom.css" />
<Content Include="PublishLater\Styles\ui.datepicker.css" />
<Content Include="PublishLater\Styles\ui.timepickr.css" />
<Content Include="PublishLater\Views\EditorTemplates\Parts\PublishLater.ascx" />
<None Include="PublishLater\Views\EditorTemplates\Parts\PublishLater.cshtml" />
<Content Include="Reports\Module.txt" />
<None Include="Contents\Views\Items\Content-HomePage.cshtml" />
<None Include="Reports\Views\Admin\Display.cshtml" />

View File

@@ -9,4 +9,4 @@ features:
PublishLater:
Description: Draft creation and scheduled publishing.
Category: Content
Dependencies: Common, Settings
Dependencies: Common, Settings, Scheduling

View File

@@ -1,31 +0,0 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Core.PublishLater.ViewModels.PublishLaterViewModel>" %>
<ul class="pageStatus">
<li><%
// Published or not
if (Model.HasPublished) { %>
<img class="icon" src="<%=ResolveUrl("~/Core/PublishLater/Content/Admin/images/online.gif") %>" alt="<%:T("Online") %>" title="<%:T("The page is currently online") %>" /> <%:T("Published") %>&nbsp;&#124;&nbsp;<%
}
else { %>
<img class="icon" src="<%=ResolveUrl("~/Core/PublishLater/Content/Admin/images/offline.gif") %>" alt="<%:T("Offline") %>" title="<%:T("The page is currently offline") %>" /> <%:T("Not Published") %>&nbsp;&#124;&nbsp;<%
} %>
</li>
<li><%
// Does the page have a draft
if (Model.HasDraft) { %>
<img class="icon" src="<%=ResolveUrl("~/Core/PublishLater/Content/Admin/images/draft.gif") %>" alt="<%:T("Draft") %>" title="<%:T("The page has a draft") %>" /><%:T("Draft") %>&nbsp;&#124;&nbsp;<%
}
else { %>
<%:T("No Draft") %>&nbsp;&#124;&nbsp;<%
} %>
</li>
<li><%
if ((Model.ScheduledPublishUtc.HasValue && Model.ScheduledPublishUtc.Value > DateTime.UtcNow) || (Model.IsPublished && Model.VersionPublishedUtc.HasValue)) {
if (Model.IsPublished && Model.VersionPublishedUtc.HasValue) { %>
<%:T("Published: {0}", Html.DateTimeRelative(Model.VersionPublishedUtc.Value, T)) %><%
}
else { %>
<img class="icon" src="<%=ResolveUrl("~/Core/PublishLater/Content/Admin/images/scheduled.gif") %>" alt="<%:T("Scheduled") %>" title="<%:T("The page is scheduled for publishing") %>" /><%:T("Scheduled") %>
<%:Html.DateTime(Model.ScheduledPublishUtc.Value, T("M/d/yyyy h:mm tt")) %><%
} %>&nbsp;&#124;&nbsp;</li><%
} %>
</ul>

View File

@@ -0,0 +1,30 @@
@model Orchard.Core.PublishLater.ViewModels.PublishLaterViewModel
<ul class="pageStatus">
<li>@// Published or not
@if (Model.HasPublished) {
<img class="icon" src="@Href("~/Core/PublishLater/Content/Admin/images/online.gif")" alt="@T("Online")" title="@T("The page is currently online")" /> <text>@T("Published")&nbsp;&#124;&nbsp;</text>
}
else {
<img class="icon" src="@Href("~/Core/PublishLater/Content/Admin/images/offline.gif")" alt="@T("Offline")" title="@T("The page is currently offline")" /> <text>@T("Not Published")&nbsp;&#124;&nbsp;</text>
}
</li>
<li>
@// Does the page have a draft
@if (Model.HasDraft) {
<img class="icon" src="@Href("~/Core/PublishLater/Content/Admin/images/draft.gif")" alt="@T("Draft")" title="@T("The page has a draft")" /><text> @T("Draft")&nbsp;&#124;&nbsp;</text>
}
else {
<text>@T("No Draft")&nbsp;&#124;&nbsp;</text>
}
</li>
@if ((Model.ScheduledPublishUtc.HasValue && Model.ScheduledPublishUtc.Value > DateTime.UtcNow) || (Model.IsPublished && Model.VersionPublishedUtc.HasValue)) {
<li>
@if (Model.IsPublished && Model.VersionPublishedUtc.HasValue) {
@T("Published: {0}", Html.DateTimeRelative(Model.VersionPublishedUtc.Value, T))
}
else {
<img class="icon" src="@Href("~/Core/PublishLater/Content/Admin/images/scheduled.gif")" alt="@T("Scheduled")" title="@T("The page is scheduled for publishing")" /><text> @T("Scheduled") </text>
@Html.DateTime(Model.ScheduledPublishUtc.Value, T("M/d/yyyy h:mm tt"))
}&nbsp;&#124;&nbsp;</li>
}
</ul>

View File

@@ -1 +0,0 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Core.PublishLater.ViewModels.PublishLaterViewModel>" %>

View File

@@ -0,0 +1 @@
@model Orchard.Core.PublishLater.ViewModels.PublishLaterViewModel

View File

@@ -1,47 +0,0 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Core.PublishLater.ViewModels.PublishLaterViewModel>" %>
<% Html.RegisterStyle("datetime.css"); %>
<% Html.RegisterStyle("jquery-ui-1.7.2.custom.css"); %>
<% Html.RegisterStyle("ui.datepicker.css"); %>
<% Html.RegisterStyle("ui.timepickr.css"); %>
<% Html.RegisterFootScript("jquery.ui.core.js"); %>
<% Html.RegisterFootScript("jquery.ui.widget.js"); %>
<% Html.RegisterFootScript("jquery.ui.datepicker.js"); %>
<% Html.RegisterFootScript("jquery.utils.js"); %>
<% Html.RegisterFootScript("ui.timepickr.js"); %>
<fieldset>
<legend><%: T("Publish Settings")%></legend>
<div>
<%: Html.RadioButton("Command", "SaveDraft", Model.ContentItem.VersionRecord == null || !Model.ContentItem.VersionRecord.Published, new { id = ViewData.TemplateInfo.GetFullHtmlFieldId("Command_SaveDraft") })%>
<label class="forcheckbox" for="<%:ViewData.TemplateInfo.GetFullHtmlFieldId("Command_SaveDraft") %>"><%: T("Save Draft")%></label>
</div>
<div>
<%: Html.RadioButton("Command", "PublishNow", Model.ContentItem.VersionRecord != null && Model.ContentItem.VersionRecord.Published, new { id = ViewData.TemplateInfo.GetFullHtmlFieldId("Command_PublishNow") })%>
<label class="forcheckbox" for="<%:ViewData.TemplateInfo.GetFullHtmlFieldId("Command_PublishNow") %>"><%: T("Publish Now")%></label>
</div>
<div>
<%: Html.RadioButton("Command", "PublishLater", Model.ScheduledPublishUtc != null, new { id = ViewData.TemplateInfo.GetFullHtmlFieldId("Command_PublishLater") }) %>
<label class="forcheckbox" for="<%:ViewData.TemplateInfo.GetFullHtmlFieldId("Command_PublishLater") %>"><%: T("Publish Later")%></label>
</div>
<div>
<label class="forpicker" for="<%:ViewData.TemplateInfo.GetFullHtmlFieldId("ScheduledPublishUtcDate") %>"><%: T("Date")%></label>
<%: Html.EditorFor(m => m.ScheduledPublishUtcDate)%>
<label class="forpicker" for="<%:ViewData.TemplateInfo.GetFullHtmlFieldId("ScheduledPublishUtcTime") %>"><%: T("Time")%></label>
<%: Html.EditorFor(m => m.ScheduledPublishUtcTime)%>
</div>
</fieldset>
<script type="text/javascript"> $(function () {
//todo: (heskew) make a plugin
$("label.forpicker").each(function () {
var $this = $(this);
var pickerInput = $("#" + $this.attr("for"));
pickerInput.data("hint", $this.text());
if (!pickerInput.val()) {
pickerInput.addClass("hinted")
.val(pickerInput.data("hint"))
.focus(function () { var $this = $(this); if ($this.val() == $this.data("hint")) { $this.removeClass("hinted").val("") } })
.blur(function () { var $this = $(this); setTimeout(function () { if (!$this.val()) { $this.addClass("hinted").val($this.data("hint")) } }, 300) });
}
});
$(<%=string.Format("\"#{0}\"", ViewData.TemplateInfo.GetFullHtmlFieldId("ScheduledPublishUtcDate")) %>).datepicker({ showAnim: "" }).focus(function () { $(<%=string.Format("\"#{0}\"", ViewData.TemplateInfo.GetFullHtmlFieldId("Command_PublishLater")) %>).attr("checked", "checked") });
$(<%=string.Format("\"#{0}\"", ViewData.TemplateInfo.GetFullHtmlFieldId("ScheduledPublishUtcTime")) %>).timepickr().focus(function () { $(<%=string.Format("\"#{0}\"", ViewData.TemplateInfo.GetFullHtmlFieldId("Command_PublishLater")) %>).attr("checked", "checked") });
})</script>

View File

@@ -0,0 +1,49 @@
@model Orchard.Core.PublishLater.ViewModels.PublishLaterViewModel
@{
Html.RegisterStyle("datetime.css");
Html.RegisterStyle("jquery-ui-1.7.2.custom.css");
Html.RegisterStyle("ui.datepicker.css");
Html.RegisterStyle("ui.timepickr.css");
Html.RegisterFootScript("jquery.ui.core.js");
Html.RegisterFootScript("jquery.ui.widget.js");
Html.RegisterFootScript("jquery.ui.datepicker.js");
Html.RegisterFootScript("jquery.utils.js");
Html.RegisterFootScript("ui.timepickr.js");
}
<fieldset>
<legend>@T("Publish Settings")</legend>
<div>
@Html.RadioButton("Command", "SaveDraft", Model.ContentItem.VersionRecord == null || !Model.ContentItem.VersionRecord.Published, new { id = ViewData.TemplateInfo.GetFullHtmlFieldId("Command_SaveDraft") })
<label class="forcheckbox" for="@ViewData.TemplateInfo.GetFullHtmlFieldId("Command_SaveDraft")">@T("Save Draft")</label>
</div>
<div>
@Html.RadioButton("Command", "PublishNow", Model.ContentItem.VersionRecord != null && Model.ContentItem.VersionRecord.Published, new { id = ViewData.TemplateInfo.GetFullHtmlFieldId("Command_PublishNow") })
<label class="forcheckbox" for="@ViewData.TemplateInfo.GetFullHtmlFieldId("Command_PublishNow")">@T("Publish Now")</label>
</div>
<div>
@Html.RadioButton("Command", "PublishLater", Model.ScheduledPublishUtc != null, new { id = ViewData.TemplateInfo.GetFullHtmlFieldId("Command_PublishLater") })
<label class="forcheckbox" for="@ViewData.TemplateInfo.GetFullHtmlFieldId("Command_PublishLater")">@T("Publish Later")</label>
</div>
<div>
<label class="forpicker" for="@ViewData.TemplateInfo.GetFullHtmlFieldId("ScheduledPublishUtcDate")">@T("Date")</label>
@Html.EditorFor(m => m.ScheduledPublishUtcDate)
<label class="forpicker" for="@ViewData.TemplateInfo.GetFullHtmlFieldId("ScheduledPublishUtcTime")">@T("Time")</label>
@Html.EditorFor(m => m.ScheduledPublishUtcTime)
</div>
</fieldset>
<script type="text/javascript"> $(function () {
@//todo: (heskew) make a plugin
$("label.forpicker").each(function () {
var $this = $(this);
var pickerInput = $("#" + $this.attr("for"));
pickerInput.data("hint", $this.text());
if (!pickerInput.val()) {
pickerInput.addClass("hinted")
.val(pickerInput.data("hint"))
.focus(function () { var $this = $(this); if ($this.val() == $this.data("hint")) { $this.removeClass("hinted").val("") } })
.blur(function () { var $this = $(this); setTimeout(function () { if (!$this.val()) { $this.addClass("hinted").val($this.data("hint")) } }, 300) });
}
});
$(@(new HtmlString(string.Format("\"#{0}\"", ViewData.TemplateInfo.GetFullHtmlFieldId("ScheduledPublishUtcDate"))))).datepicker({ showAnim: "" }).focus(function () { $(@(new HtmlString(string.Format("\"#{0}\"", ViewData.TemplateInfo.GetFullHtmlFieldId("Command_PublishLater"))))).attr("checked", "checked") });
$(@(new HtmlString(string.Format("\"#{0}\"", ViewData.TemplateInfo.GetFullHtmlFieldId("ScheduledPublishUtcTime"))))).timepickr().focus(function () { $(@(new HtmlString(string.Format("\"#{0}\"", ViewData.TemplateInfo.GetFullHtmlFieldId("Command_PublishLater"))))).attr("checked", "checked") });
})</script>