mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Getting the widget management actions to work back to at least IE7...
work item: 17521 --HG-- branch : 1.x
This commit is contained in:
@@ -88,20 +88,20 @@ namespace Orchard.Widgets.Controllers {
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Index")]
|
||||
public ActionResult IndexWidgetPOST(int? layerId, int? moveUp, int? moveDown, int? moveHere, int? moveOut, string returnUrl) {
|
||||
if (moveOut.HasValue)
|
||||
return DeleteWidget(moveOut.Value, returnUrl);
|
||||
public ActionResult IndexWidgetPOST(int widgetId, string returnUrl, int? layerId, string moveUp, string moveDown, string moveHere, string moveOut) {
|
||||
if (!string.IsNullOrWhiteSpace(moveOut))
|
||||
return DeleteWidget(widgetId, returnUrl);
|
||||
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageWidgets, T(NotAuthorizedManageWidgetsLabel)))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
try {
|
||||
if (moveUp.HasValue)
|
||||
_widgetsService.MoveWidgetUp(moveUp.Value);
|
||||
if (moveDown.HasValue)
|
||||
_widgetsService.MoveWidgetDown(moveDown.Value);
|
||||
if (moveHere.HasValue)
|
||||
_widgetsService.MoveWidgetToLayer(moveHere.Value, layerId);
|
||||
if (!string.IsNullOrWhiteSpace(moveUp))
|
||||
_widgetsService.MoveWidgetUp(widgetId);
|
||||
else if (!string.IsNullOrWhiteSpace(moveDown))
|
||||
_widgetsService.MoveWidgetDown(widgetId);
|
||||
else if (!string.IsNullOrWhiteSpace(moveHere))
|
||||
_widgetsService.MoveWidgetToLayer(widgetId, layerId);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
this.Error(exception, T("Moving widget failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||
|
@@ -12,10 +12,14 @@
|
||||
<ul>
|
||||
@foreach (WidgetPart widget in widgets) {
|
||||
<li class="@(widget == widgets.First() ? "first" : (widget == widgets.Last() ? "last" : ""))">
|
||||
<h3>@Html.ActionLink(HasText(widget.Title) ? widget.Title : widget.TypeDefinition.DisplayName, "EditWidget", new { @widget.Id, returnUrl })</h3>
|
||||
<div class="widgets-actions">
|
||||
<button name="moveOut" value="@widget.Id" class="link" type="submit">@T("Remove")</button>
|
||||
</div>
|
||||
@using (Html.BeginFormAntiForgeryPost()) {
|
||||
<h3>@Html.ActionLink(HasText(widget.Title) ? widget.Title : widget.TypeDefinition.DisplayName, "EditWidget", new { @widget.Id, returnUrl })</h3>
|
||||
<div class="widgets-actions">
|
||||
<button name="moveOut" class="link" type="submit" value="1">@T("Remove")</button>
|
||||
</div>
|
||||
@Html.Hidden("widgetId", widget.Id)
|
||||
@Html.Hidden("returnUrl", returnUrl)
|
||||
}
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
|
@@ -21,21 +21,24 @@
|
||||
int i = 0;
|
||||
foreach (WidgetPart widget in widgets.Where(w => w.Zone == zone).OrderBy(w => w.Position, new Orchard.UI.FlatPositionComparer())) {
|
||||
<li class="widgets-@(widget.LayerId == Model.CurrentLayer.Id ? "this" : "other")-layer widgets-layer-@widget.LayerId@(i == 0 ? " first" : (i == count ? " last" : ""))">
|
||||
<h3>@Html.ActionLink(HasText(widget.Title) ? widget.Title : widget.TypeDefinition.DisplayName, "EditWidget", new { @widget.Id, returnUrl })</h3>
|
||||
<div class="widgets-actions">
|
||||
@if (widget.LayerId != Model.CurrentLayer.Id) {
|
||||
<button name="moveHere" value="@widget.Id" class="link" type="submit">@T("Move to current layer")</button>
|
||||
}
|
||||
else { /* it could be useful to remove the widget regardless of the layer it's on but there's no place in the current UI for this and "Move to current layer" */
|
||||
<button name="moveOut" value="@widget.Id" class="link" type="submit">@T("Remove")</button>
|
||||
}
|
||||
</div>
|
||||
<div class="widgets-move-somewhere">
|
||||
<button name="moveUp" value="@widget.Id" @(i == 0 ? "disabled='disabled'" : "") class="widgets-move widgets-move-up" type="submit" title="@T("Move up")">@T("Move up")</button>
|
||||
<button name="moveDown" value="@widget.Id" @(++i == count ? "disabled='disabled'" : "") class="widgets-move widgets-move-down" type="submit" title="@T("Move down")">@T("Move down")</button>
|
||||
@using (Html.BeginFormAntiForgeryPost()) {
|
||||
<h3>@Html.ActionLink(HasText(widget.Title) ? widget.Title : widget.TypeDefinition.DisplayName, "EditWidget", new { @widget.Id, returnUrl })</h3>
|
||||
<div class="widgets-actions">
|
||||
@if (widget.LayerId != Model.CurrentLayer.Id) {
|
||||
<button name="moveHere" class="link" type="submit" value="1">@T("Move to current layer")</button>
|
||||
}
|
||||
else { /* it could be useful to remove the widget regardless of the layer it's on but there's no place in the current UI for this and "Move to current layer" */
|
||||
<button name="moveOut" class="link" type="submit" value="1">@T("Remove")</button>
|
||||
}
|
||||
</div>
|
||||
<div class="widgets-move-somewhere">
|
||||
<button name="moveUp" @(new MvcHtmlString(i == 0 ? "disabled='disabled'" : "")) class="widgets-move widgets-move-up" type="submit" title="@T("Move up")" value="1">@T("Move up")</button>
|
||||
<button name="moveDown" @(new MvcHtmlString(++i == count ? "disabled='disabled'" : "")) class="widgets-move widgets-move-down" type="submit" title="@T("Move down")" value="1">@T("Move down")</button>
|
||||
</div>
|
||||
@Html.Hidden("widgetId", widget.Id)
|
||||
@Html.Hidden("returnUrl", returnUrl)
|
||||
</div>
|
||||
</li>
|
||||
}
|
||||
</li>
|
||||
}
|
||||
}
|
||||
</ul>
|
||||
|
@@ -10,20 +10,16 @@
|
||||
<div id="widgets-placement">
|
||||
<div id="widgets-layers" class="widgets-container detail-view switchable">
|
||||
<div id="widgets-zones" class="widgets-listed">
|
||||
@using (Html.BeginFormAntiForgeryPost()) {
|
||||
@Display.WidgetPlacement_Zones(Widgets: Model.Widgets, Zones: Model.Zones, CurrentLayer: Model.CurrentLayer)
|
||||
}
|
||||
@Display.WidgetPlacement_Zones(Widgets: Model.Widgets, Zones: Model.Zones, CurrentLayer: Model.CurrentLayer)
|
||||
</div>
|
||||
@if (orphanZones.Count() > 0) {
|
||||
<div id="widgets-zones-orphans-container">
|
||||
<h3>@T("Zones for other enabled themes.")</h3>
|
||||
<p>@T("Widgets in these zones will not appear anywhere when your currently active theme is applied. They might still appear in selectively applied (e.g. mobile) themes.")</p>
|
||||
<div id="widgets-zones-orphans" class="widgets-listed">
|
||||
@using (Html.BeginFormAntiForgeryPost()) {
|
||||
@Display.WidgetPlacement_Zones(Widgets: Model.Widgets, Zones: Model.OrphanZones, CurrentLayer: Model.CurrentLayer)
|
||||
}
|
||||
@Display.WidgetPlacement_Zones(Widgets: Model.Widgets, Zones: Model.OrphanZones, CurrentLayer: Model.CurrentLayer)
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
Reference in New Issue
Block a user