mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-04-05 21:01:35 +08:00
Fixing the content publish/unpublish links in the Contents.Publish.SummaryAdmin part template
--HG-- branch : dev
This commit is contained in:
parent
92c6460e57
commit
55ddbcb427
@ -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");
|
||||
}
|
||||
|
||||
|
@ -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(" | ") %><%
|
||||
} %>
|
@ -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" });
|
||||
|
Loading…
Reference in New Issue
Block a user