mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-18 17:47:54 +08:00
Fixing the content publish/unpublish links in the Contents.Publish.SummaryAdmin part template
--HG-- branch : dev
This commit is contained in:
@@ -232,7 +232,7 @@ namespace Orchard.Core.Contents.Controllers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult Publish(int id) {
|
public ActionResult Publish(int id, string returnUrl) {
|
||||||
if (!Services.Authorizer.Authorize(Permissions.PublishContent, T("Couldn't publish content")))
|
if (!Services.Authorizer.Authorize(Permissions.PublishContent, T("Couldn't publish content")))
|
||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
@@ -244,11 +244,14 @@ namespace Orchard.Core.Contents.Controllers {
|
|||||||
Services.ContentManager.Flush();
|
Services.ContentManager.Flush();
|
||||||
Services.Notifier.Information(T("{0} successfully published.", contentItem.TypeDefinition.DisplayName));
|
Services.Notifier.Information(T("{0} successfully published.", contentItem.TypeDefinition.DisplayName));
|
||||||
|
|
||||||
|
if (!String.IsNullOrEmpty(returnUrl))
|
||||||
|
return Redirect(returnUrl);
|
||||||
|
|
||||||
return RedirectToAction("List");
|
return RedirectToAction("List");
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult Unpublish(int id) {
|
public ActionResult Unpublish(int id, string returnUrl) {
|
||||||
if (!Services.Authorizer.Authorize(Permissions.PublishContent, T("Couldn't unpublish content")))
|
if (!Services.Authorizer.Authorize(Permissions.PublishContent, T("Couldn't unpublish content")))
|
||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
@@ -260,6 +263,9 @@ namespace Orchard.Core.Contents.Controllers {
|
|||||||
Services.ContentManager.Flush();
|
Services.ContentManager.Flush();
|
||||||
Services.Notifier.Information(T("{0} successfully unpublished.", contentItem.TypeDefinition.DisplayName));
|
Services.Notifier.Information(T("{0} successfully unpublished.", contentItem.TypeDefinition.DisplayName));
|
||||||
|
|
||||||
|
if (!String.IsNullOrEmpty(returnUrl))
|
||||||
|
return Redirect(returnUrl);
|
||||||
|
|
||||||
return RedirectToAction("List");
|
return RedirectToAction("List");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,12 +1,13 @@
|
|||||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Core.Contents.ViewModels.PublishContentViewModel>" %>
|
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Core.Contents.ViewModels.PublishContentViewModel>" %>
|
||||||
|
<%@ Import Namespace="Orchard.Utility.Extensions" %>
|
||||||
<% // todo: make this all work
|
<% // todo: make this all work
|
||||||
if (Model.HasPublished) { %>
|
if (Model.HasPublished) { %>
|
||||||
<%:Html.ItemDisplayLink(T("View").Text, Model.ContentItem) %><%:T(" | ") %><%
|
<%:Html.ItemDisplayLink(T("View").Text, Model.ContentItem) %><%:T(" | ") %><%
|
||||||
if (Model.HasDraft) { %>
|
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 { %>
|
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++) {
|
for (var i = 0; i < queryParts.length; i++) {
|
||||||
var queryPartKVP = queryParts[i].split("=");
|
var queryPartKVP = queryParts[i].split("=");
|
||||||
//trusting hrefs in the page here
|
//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" });
|
form.css({ "position": "absolute", "left": "-9999em" });
|
||||||
|
Reference in New Issue
Block a user