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("", "
").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) { /// /// will close the latest open modal window. diff --git a/src/Umbraco.Web.UI/umbraco_client/modal/modal.js b/src/Umbraco.Web.UI/umbraco_client/modal/modal.js index 597c95476f..c2c2812b0e 100644 --- a/src/Umbraco.Web.UI/umbraco_client/modal/modal.js +++ b/src/Umbraco.Web.UI/umbraco_client/modal/modal.js @@ -118,6 +118,7 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls"); /// The callback will receive one parameter with 2 properties: /// modalContent = the jQuery object for the popup window to query against /// outVal = the value passed to the close window method that was used to close the window (if it was specified) + /// /// The generated jquery object bound to the modal window @@ -355,7 +356,7 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls"); $.fn.jqmAddClose = function(e) { return hs(this, e, 'jqmHide'); }; $.fn.jqmAddTrigger = function(e) { return hs(this, e, 'jqmShow'); }; $.fn.jqmShow = function(t) { return this.each(function() { $.jqm.open(this._jqm, t); }); }; - $.fn.jqmHide = function(t) { return this.each(function() { $.jqm.close(this._jqm, t) }); }; + $.fn.jqmHide = function(t) { return this.each(function() { $.jqm.close(this._jqm, t); }); }; $.jqm = { hash: {},