mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-22 20:13:50 +08:00
@@ -1,5 +1,5 @@
|
||||
ec573e5476f7e8a5a61593d6393e9985e9484fcc src/Orchard.Web/Modules/Orchard.Forms
|
||||
431490c4617992f03bcd1c150828a0ea35934d23 src/Orchard.Web/Modules/Orchard.Projections
|
||||
01b83c05050bb731d9f69256bbe8884d458ea1c9 src/Orchard.Web/Modules/Orchard.Rules
|
||||
541c387200e9354aa5d53b4cf8819349dd60d0d9 src/Orchard.Web/Modules/Orchard.Projections
|
||||
1146de194cce920d47c00eced57f44bf6f135ad6 src/Orchard.Web/Modules/Orchard.Rules
|
||||
65057c6a5cd71f7994ba9bcbeece50dbb737620e src/Orchard.Web/Modules/Orchard.TaskLease
|
||||
c2e3c396c1fc6c60b131bfc9f83564c6f8d18e58 src/Orchard.Web/Modules/Orchard.Tokens
|
||||
|
@@ -18,7 +18,7 @@
|
||||
<div class="related">
|
||||
@Display(Model.Actions)
|
||||
@Html.ItemEditLink(T("Edit").Text, contentItem) @T(" | ")
|
||||
@Html.Link(T("Delete").Text, Url.Action("Remove", "Admin", new { area = "Contents", id = contentItem.Id, returnUrl }), new { itemprop = "RemoveUrl UnsafeUrl" })
|
||||
@Html.Link(T("Delete").Text, Url.ItemRemoveUrl(contentItem, new { returnUrl }), new { itemprop = "RemoveUrl UnsafeUrl" })
|
||||
</div>
|
||||
@if (Model.Content != null) {
|
||||
<div class="primary">@Display(Model.Content)</div>
|
||||
|
@@ -109,7 +109,7 @@ namespace Orchard.Core.Navigation.Controllers {
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
|
||||
[ValidateAntiForgeryTokenOrchard]
|
||||
[HttpPost]
|
||||
public ActionResult Delete(int id) {
|
||||
if (!_services.Authorizer.Authorize(Permissions.ManageMainMenu, T("Couldn't manage the main menu")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
@@ -29,7 +29,7 @@
|
||||
<td><input type="text" class="text-box" name="@Html.NameOf(m => m.MenuItemEntries[i].Text)" value="@menuPartEntry.Text" /></td>
|
||||
<td><input type="text" class="text-box" name="@Html.NameOf(m => m.MenuItemEntries[i].Position)" value="@menuPartEntry.Position" /></td>
|
||||
<td>@if (!menuPartEntry.IsMenuItem) {<input type="text" class="text-box disabled" disabled="disabled" value="@menuPartEntry.Url" /> } else {<input type="text" class="text-box" name="@Html.NameOf(m => m.MenuItemEntries[i].Url)" value="@menuPartEntry.Url" />}</td>
|
||||
<td><input type="hidden" name="@Html.NameOf(m => m.MenuItemEntries[i].MenuItemId)" value="@menuPartEntry.MenuItemId" /><a href="@Html.AntiForgeryTokenGetUrl(Url.Action("Delete", new {id = menuPartEntry.MenuItemId}))" class="remove">@T("Delete")</a></td>
|
||||
<td><input type="hidden" name="@Html.NameOf(m => m.MenuItemEntries[i].MenuItemId)" value="@menuPartEntry.MenuItemId" />@Html.ActionLink(T("Delete").Text, "Delete", new { id = menuPartEntry.MenuItemId }, new { @class="remove", itemprop="RemoveUrl UnsafeUrl" })</td>
|
||||
</tr>
|
||||
++menuPartEntryIndex;
|
||||
}
|
||||
|
@@ -208,7 +208,14 @@
|
||||
}
|
||||
form.css({ "position": "absolute", "left": "-9999em" });
|
||||
$("body").append(form);
|
||||
_this.click(function () { form.submit(); return false; });
|
||||
_this.click(function () {
|
||||
if (_this.filter("[itemprop~='RemoveUrl']").length == 1) {
|
||||
if (!confirm(confirmRemoveMessage)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
form.submit();
|
||||
});
|
||||
});
|
||||
});
|
||||
})(jQuery);
|
||||
|
@@ -63,6 +63,7 @@ namespace Orchard.Packaging.Controllers {
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult Remove(int id) {
|
||||
if (_shellSettings.Name != ShellSettings.DefaultName || !Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to remove sources")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
@@ -6,7 +6,7 @@
|
||||
<div class="manage">
|
||||
@Html.ActionLink(T("Add Feed").Text, "AddSource", new { }, new { @class = "button primaryAction" })
|
||||
</div>
|
||||
|
||||
@using (Html.BeginFormAntiForgeryPost()) {
|
||||
<fieldset>
|
||||
<table class="items" summary="@T("This is a table of the gallery feeds in your application")">
|
||||
<colgroup>
|
||||
@@ -21,12 +21,13 @@
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@foreach ( var item in Model.Sources ) {
|
||||
@foreach (var item in Model.Sources) {
|
||||
<tr>
|
||||
<td>@item.FeedTitle</td>
|
||||
<td>@Html.Link(item.FeedUrl, item.FeedUrl)</td>
|
||||
<td>@Html.ActionLink(T("Delete").ToString(), "Remove", new { id = item.Id })</td>
|
||||
<td>@Html.ActionLink(T("Delete").ToString(), "Remove", new { id = item.Id }, new { itemprop = "RemoveUrl UnsafeUrl" })</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
}
|
@@ -61,4 +61,13 @@
|
||||
$(".bulk-actions-auto select").change(function () {
|
||||
$(this).closest("form").find(".apply-bulk-actions-auto:first").click();
|
||||
});
|
||||
|
||||
$("[itemprop~='RemoveUrl']").on("click", function (event) {
|
||||
// don't show the confirm dialog if the link is also UnsafeUrl, as it will already be handled in base.js
|
||||
if ($(this).filter("[itemprop~='UnsafeUrl']").length == 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return confirm(confirmRemoveMessage);
|
||||
});
|
||||
})(jQuery);
|
@@ -92,4 +92,12 @@
|
||||
<div id="footer" role="contentinfo">
|
||||
@Zone(Model.Footer)
|
||||
</div>
|
||||
}
|
||||
|
||||
@using (Script.Foot()) {
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
var confirmRemoveMessage = '@T("Are you sure you want to remove this element ?")';
|
||||
//]]>
|
||||
</script>
|
||||
}
|
@@ -13,6 +13,9 @@ namespace Orchard.Mvc.Html {
|
||||
return MvcHtmlString.Create(html.Encode(metadata.DisplayText));
|
||||
}
|
||||
|
||||
public static MvcHtmlString ItemDisplayLink(this HtmlHelper html, IContent content) {
|
||||
return ItemDisplayLink(html, null, content);
|
||||
}
|
||||
|
||||
public static MvcHtmlString ItemDisplayLink(this HtmlHelper html, string linkText, IContent content) {
|
||||
var metadata = content.ContentItem.ContentManager.GetItemMetadata(content);
|
||||
@@ -25,8 +28,39 @@ namespace Orchard.Mvc.Html {
|
||||
metadata.DisplayRouteValues);
|
||||
}
|
||||
|
||||
public static MvcHtmlString ItemDisplayLink(this HtmlHelper html, IContent content) {
|
||||
return ItemDisplayLink(html, null, content);
|
||||
public static string ItemDisplayUrl(this UrlHelper urlHelper, IContent content) {
|
||||
var metadata = content.ContentItem.ContentManager.GetItemMetadata(content);
|
||||
if (metadata.DisplayRouteValues == null)
|
||||
return null;
|
||||
|
||||
return urlHelper.Action(
|
||||
Convert.ToString(metadata.DisplayRouteValues["action"]),
|
||||
metadata.DisplayRouteValues);
|
||||
}
|
||||
|
||||
public static MvcHtmlString ItemRemoveLink(this HtmlHelper html, IContent content) {
|
||||
return ItemRemoveLink(html, null, content, null);
|
||||
}
|
||||
|
||||
public static MvcHtmlString ItemRemoveLink(this HtmlHelper html, string linkText, IContent content, object additionalRouteValues) {
|
||||
var metadata = content.ContentItem.ContentManager.GetItemMetadata(content);
|
||||
if (metadata.RemoveRouteValues == null)
|
||||
return null;
|
||||
|
||||
return html.ActionLink(
|
||||
NonNullOrEmpty(linkText, metadata.DisplayText, "remove"),
|
||||
Convert.ToString(metadata.RemoveRouteValues["action"]),
|
||||
metadata.RemoveRouteValues.Merge(additionalRouteValues));
|
||||
}
|
||||
|
||||
public static string ItemRemoveUrl(this UrlHelper urlHelper, IContent content, object additionalRouteValues) {
|
||||
var metadata = content.ContentItem.ContentManager.GetItemMetadata(content);
|
||||
if (metadata.RemoveRouteValues == null)
|
||||
return null;
|
||||
|
||||
return urlHelper.Action(
|
||||
Convert.ToString(metadata.RemoveRouteValues["action"]),
|
||||
metadata.RemoveRouteValues.Merge(additionalRouteValues));
|
||||
}
|
||||
|
||||
public static MvcHtmlString ItemEditLinkWithReturnUrl(this HtmlHelper html, string linkText, IContent content) {
|
||||
@@ -67,16 +101,6 @@ namespace Orchard.Mvc.Html {
|
||||
metadata.AdminRouteValues.Merge(additionalRouteValues));
|
||||
}
|
||||
|
||||
public static string ItemDisplayUrl(this UrlHelper urlHelper, IContent content) {
|
||||
var metadata = content.ContentItem.ContentManager.GetItemMetadata(content);
|
||||
if (metadata.DisplayRouteValues == null)
|
||||
return null;
|
||||
|
||||
return urlHelper.Action(
|
||||
Convert.ToString(metadata.DisplayRouteValues["action"]),
|
||||
metadata.DisplayRouteValues);
|
||||
}
|
||||
|
||||
public static string ItemEditUrl(this UrlHelper urlHelper, IContent content) {
|
||||
var metadata = content.ContentItem.ContentManager.GetItemMetadata(content);
|
||||
if (metadata.DisplayRouteValues == null)
|
||||
|
Reference in New Issue
Block a user