X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=js%2Fkivi.js;h=81a978fc1e06f5baa52da1aff26de054736fd1f6;hb=99bbf349b825fc48cdb71288e0979ab687770227;hp=2c281102775eac43d29f8659ba9b92889e830204;hpb=abead59dc75d6ffd40daa10695bcab8410c38978;p=kivitendo-erp.git diff --git a/js/kivi.js b/js/kivi.js index 2c2811027..81a978fc1 100644 --- a/js/kivi.js +++ b/js/kivi.js @@ -59,11 +59,16 @@ namespace("kivi", function(ns) { return namespace(parts[1])[ parts[2] ]; }; - // Open a modal jQuery UI popup dialog. The content is loaded via AJAX. + // Open a modal jQuery UI popup dialog. The content can be either + // loaded via AJAX (if the parameter 'url' is given) or simply + // displayed if it exists in the DOM already (referenced via + // 'id'). If an existing DOM div should be used then the element + // won't be removed upon closing the dialog which allows re-opening + // it later on. // // Parameters: // - id: dialog DIV ID (optional; defaults to 'jqueryui_popup_dialog') - // - url, data, type: passed as the first three arguments to the $.ajax() call + // - url, data, type: passed as the first three arguments to the $.ajax() call if an AJAX call is made, otherwise ignored. // - dialog: an optional object of options passed to the $.dialog() call ns.popup_dialog = function(params) { var dialog; @@ -79,9 +84,15 @@ namespace("kivi", function(ns) { // User supplied options: params.dialog || { }, { // Options that must not be changed: - close: function(event, ui) { dialog.remove(); } + close: function(event, ui) { if (params.url) dialog.remove(); else dialog.dialog('close'); } }); + if (!params.url) { + // Use existing DOM element and show it. No AJAX call. + dialog = $('#' + id).dialog(dialog_params); + return true; + } + $('#' + id).remove(); dialog = $('
').appendTo('body');