Making sure the layer edit and delete actions return to the correct location.

work item: 17616

--HG--
branch : 1.x
This commit is contained in:
Nathan Heskew
2011-03-31 12:02:01 -07:00
parent e179e821b3
commit 4f6a021beb

View File

@@ -259,13 +259,13 @@ namespace Orchard.Widgets.Controllers {
} catch (Exception exception) {
this.Error(exception, T("Editing layer failed: {0}", exception.Message), Logger, Services.Notifier);
return RedirectToAction("Index", "Admin", new { id });
return RedirectToAction("Index", "Admin");
}
}
[HttpPost, ActionName("EditLayer")]
[FormValueRequired("submit.Save")]
public ActionResult EditLayerSavePOST(int id) {
public ActionResult EditLayerSavePOST(int id, string returnUrl) {
if (!Services.Authorizer.Authorize(Permissions.ManageWidgets, T(NotAuthorizedManageWidgetsLabel)))
return new HttpUnauthorizedResult();
@@ -287,12 +287,12 @@ namespace Orchard.Widgets.Controllers {
this.Error(exception, T("Editing layer failed: {0}", exception.Message), Logger, Services.Notifier);
}
return RedirectToAction("Index");
return this.RedirectLocal(returnUrl, () => RedirectToAction("Index"));
}
[HttpPost, ActionName("EditLayer")]
[FormValueRequired("submit.Delete")]
public ActionResult EditLayerDeletePOST(int id, string returnUrl) {
public ActionResult EditLayerDeletePOST(int id) {
if (!Services.Authorizer.Authorize(Permissions.ManageWidgets, T(NotAuthorizedManageWidgetsLabel)))
return new HttpUnauthorizedResult();
@@ -303,7 +303,7 @@ namespace Orchard.Widgets.Controllers {
this.Error(exception, T("Removing Layer failed: {0}", exception.Message), Logger, Services.Notifier);
}
return this.RedirectLocal(returnUrl, () => RedirectToAction("Index"));
return RedirectToAction("Index", "Admin");
}
public ActionResult EditWidget(int id) {
@@ -325,8 +325,8 @@ namespace Orchard.Widgets.Controllers {
catch (Exception exception) {
this.Error(exception, T("Editing widget failed: {0}", exception.Message), Logger, Services.Notifier);
if (widgetPart != null)
return RedirectToAction("Index", "Admin", new { id = widgetPart.LayerPart.Id });
if (widgetPart != null && widgetPart.LayerPart != null)
return RedirectToAction("Index", "Admin", new { layerId = widgetPart.LayerPart.Id });
return RedirectToAction("Index");
}