diff --git a/src/Umbraco.Web.UI/umbraco_client/Application/Extensions.js b/src/Umbraco.Web.UI/umbraco_client/Application/Extensions.js index 04173f8749..66c97c4db7 100644 --- a/src/Umbraco.Web.UI/umbraco_client/Application/Extensions.js +++ b/src/Umbraco.Web.UI/umbraco_client/Application/Extensions.js @@ -256,7 +256,21 @@ contentType: 'application/json; charset=utf-8', error: function (x, t, e) { if (x.status.toString().startsWith("500")) { - $u.Sys.ApiMgr.getApp().handleAjaxException(x, t, e); + //show ysod overlay if we can + if (UmbClientMgr) { + var startIndex = x.responseText.indexOf("
"); + var body = x.responseText.substring(startIndex, endIndex + 7); + var $div = $(body.replace("", "")); + $div.appendTo($(UmbClientMgr.mainWindow().document.getElementsByTagName("body")[0])); + UmbClientMgr.openModalWindowForContent($div, "ysod", true, 640, 640, null, null, null, function() { + //remove the $div + $div.closest(".umbModalBox").remove(); + }); + } + else { + alert("Unhandled exception occurred.\nStatus: " + x.status + "\nMessage: " + x.statusText + "\n\n" + x.responseText); + } } } }); diff --git a/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoClientManager.js b/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoClientManager.js index feeb02bf4f..6a3ac42c24 100644 --- a/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoClientManager.js +++ b/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoClientManager.js @@ -175,6 +175,26 @@ Umbraco.Sys.registerNamespace("Umbraco.Application"); } } }, + openModalWindowForContent: function (jQueryElement, name, showHeader, width, height, top, leftOffset, closeTriggers, onCloseCallback) { + //need to create the modal on the top window if the top window has a client manager, if not, create it on the current window + + //if this is the top window, or if the top window doesn't have a client manager, create the modal in this manager + if (window == this.mainWindow() || !this.mainWindow().UmbClientMgr) { + var m = new Umbraco.Controls.ModalWindow(); + this._modal.push(m); + m.show(jQueryElement, name, showHeader, width, height, top, leftOffset, closeTriggers, onCloseCallback); + } + else { + //if the main window has a client manager, then call the main window's open modal method whilst keeping the context of it's manager. + if (this.mainWindow().UmbClientMgr) { + this.mainWindow().UmbClientMgr.openModalWindowForContent.apply(this.mainWindow().UmbClientMgr, + [jQueryElement, name, showHeader, width, height, top, leftOffset, closeTriggers, onCloseCallback]); + } + else { + return; //exit recurse. + } + } + }, closeModalWindow: function(rVal) { ///