--HG--
branch : dev
This commit is contained in:
Renaud Paquay 2010-07-18 15:33:17 -07:00
commit cb1b29ff8f
6 changed files with 13 additions and 21 deletions

View File

@ -232,7 +232,7 @@ namespace Orchard.Core.Contents.Controllers {
}
[HttpPost]
public ActionResult Publish(int id) {
public ActionResult Publish(int id, string returnUrl) {
if (!Services.Authorizer.Authorize(Permissions.PublishContent, T("Couldn't publish content")))
return new HttpUnauthorizedResult();
@ -244,11 +244,14 @@ namespace Orchard.Core.Contents.Controllers {
Services.ContentManager.Flush();
Services.Notifier.Information(T("{0} successfully published.", contentItem.TypeDefinition.DisplayName));
if (!String.IsNullOrEmpty(returnUrl))
return Redirect(returnUrl);
return RedirectToAction("List");
}
[HttpPost]
public ActionResult Unpublish(int id) {
public ActionResult Unpublish(int id, string returnUrl) {
if (!Services.Authorizer.Authorize(Permissions.PublishContent, T("Couldn't unpublish content")))
return new HttpUnauthorizedResult();
@ -260,6 +263,9 @@ namespace Orchard.Core.Contents.Controllers {
Services.ContentManager.Flush();
Services.Notifier.Information(T("{0} successfully unpublished.", contentItem.TypeDefinition.DisplayName));
if (!String.IsNullOrEmpty(returnUrl))
return Redirect(returnUrl);
return RedirectToAction("List");
}

View File

@ -1,12 +1,13 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Core.Contents.ViewModels.PublishContentViewModel>" %>
<%@ Import Namespace="Orchard.Utility.Extensions" %>
<% // todo: make this all work
if (Model.HasPublished) { %>
<%:Html.ItemDisplayLink(T("View").Text, Model.ContentItem) %><%:T(" | ") %><%
if (Model.HasDraft) { %>
<%:Html.Link(T("Publish Draft").Text, Url.Action("Publish", new { area = "Contents", id = Model.ContentItem.Id }), new { itemprop = "PublishUrl UnsafeUrl" })%><%:T(" | ") %><%
<%:Html.Link(T("Publish Draft").Text, Url.Action("Publish", "Admin", new { area = "Contents", id = Model.ContentItem.Id, returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString() }), new { itemprop = "PublishUrl UnsafeUrl" })%><%:T(" | ") %><%
} %>
<%:Html.Link(T("Unpublish").Text, Url.Action("Unpublish", new { area = "Contents", id = Model.ContentItem.Id }), new { itemprop = "UnpublishUrl UnsafeUrl" })%><%:T(" | ") %><%
<%:Html.Link(T("Unpublish").Text, Url.Action("Unpublish", "Admin", new { area = "Contents", id = Model.ContentItem.Id, returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString() }), new { itemprop = "UnpublishUrl UnsafeUrl" })%><%:T(" | ") %><%
}
else { %>
<%:Html.Link(T("Publish").Text, Url.Action("Publish", new { area = "Contents", id = Model.ContentItem.Id }), new { itemprop = "PublishUrl UnsafeUrl" })%><%:T(" | ") %><%
<%:Html.Link(T("Publish").Text, Url.Action("Publish", "Admin", new { area = "Contents", id = Model.ContentItem.Id, returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString() }), new { itemprop = "PublishUrl UnsafeUrl" })%><%:T(" | ") %><%
} %>

View File

@ -235,8 +235,6 @@
<Content Include="Contents\Views\DisplayTemplates\Parts\Contents.Publish.ascx" />
<Content Include="PublishLater\Views\DisplayTemplates\Parts\PublishLater.Metadata.ascx" />
<Content Include="PublishLater\Views\DisplayTemplates\Parts\PublishLater.Metadata.SummaryAdmin.ascx" />
<Content Include="PublishLater\Views\DisplayTemplates\Parts\PublishLater.SummaryAdmin.ascx" />
<Content Include="PublishLater\Views\DisplayTemplates\Parts\PublishLater.ascx" />
<Content Include="Common\Views\EditorTemplates\Fields\Common.TextField.ascx" />
<Content Include="Common\Views\EditorTemplates\Parts\Common.Container.ascx" />
<Content Include="Common\Views\EditorTemplates\PlainTextEditor.ascx" />

View File

@ -1,12 +0,0 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Core.PublishLater.ViewModels.PublishLaterViewModel>" %>
<% // todo: make this all work
if (Model.HasPublished) { %>
<%:Html.ItemDisplayLink(T("View").Text, Model.ContentItem) %><%:T(" | ") %><%
if (Model.HasDraft) { %>
<a href="<%:Html.AntiForgeryTokenGetUrl(Url.Action("Publish", new {id = Model.ContentItem.Id})) %>" title="<%:T("Publish Draft") %>"><%:T("Publish Draft") %></a><%:T(" | ") %><%
} %>
<a href="<%:Html.AntiForgeryTokenGetUrl(Url.Action("Unpublish", new {id = Model.ContentItem.Id})) %>" title="<%:T("Unpublish") %>"><%:T("Unpublish") %></a><%:T(" | ") %><%
}
else { %>
<a href="<%:Html.AntiForgeryTokenGetUrl(Url.Action("Publish", new {id = Model.ContentItem.Id})) %>" title="<%:T("Publish")%>"><%:T("Publish") %></a><%:T(" | ") %><%
} %>

View File

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

View File

@ -81,7 +81,7 @@
for (var i = 0; i < queryParts.length; i++) {
var queryPartKVP = queryParts[i].split("=");
//trusting hrefs in the page here
form.append($("<input type=\"hidden\" name=\"" + queryPartKVP[0] + "\" value=\"" + queryPartKVP[1] + "\" />"));
form.append($("<input type=\"hidden\" name=\"" + decodeURIComponent(queryPartKVP[0]) + "\" value=\"" + decodeURIComponent(queryPartKVP[1]) + "\" />"));
}
}
form.css({ "position": "absolute", "left": "-9999em" });