X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=js%2Fkivi.js;h=b04a88cfa226c5d37f5cb1a404907f308e3ab203;hb=ed76c91e9b0870269fd66b3b6d13dbeb68c9c153;hp=17c0ab0563f428cac15eb2155f83ae2ec245220e;hpb=766f5705ecb9cd56adfbffd94c871959bb64c6fd;p=kivitendo-erp.git diff --git a/js/kivi.js b/js/kivi.js index 17c0ab056..b04a88cfa 100644 --- a/js/kivi.js +++ b/js/kivi.js @@ -127,6 +127,17 @@ namespace("kivi", function(ns) { kivi.PartPicker($(elt)); }); + if (ns.CustomerVendorPicker) + ns.run_once_for('input.customer_vendor_autocomplete', 'customer_vendor_picker', function(elt) { + kivi.CustomerVendorPicker($(elt)); + }); + + if (ns.ChartPicker) + ns.run_once_for('input.chart_autocomplete', 'chart_picker', function(elt) { + kivi.ChartPicker($(elt)); + }); + + var func = kivi.get_function_by_name('local_reinit_widgets'); if (func) func(); @@ -163,9 +174,9 @@ namespace("kivi", function(ns) { // 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. + // 'id') or given via param.html. 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') @@ -185,10 +196,10 @@ namespace("kivi", function(ns) { // User supplied options: params.dialog || { }, { // Options that must not be changed: - close: function(event, ui) { if (params.url) dialog.remove(); else dialog.dialog('close'); } + close: function(event, ui) { if (params.url || params.html) dialog.remove(); else dialog.dialog('close'); } }); - if (!params.url) { + if (!params.url && !params.html) { // Use existing DOM element and show it. No AJAX call. dialog = $('#' + id) @@ -204,15 +215,20 @@ namespace("kivi", function(ns) { dialog = $('').appendTo('body'); dialog.dialog(dialog_params); - $.ajax({ - url: params.url, - data: params.data, - type: params.type, - success: function(new_html) { - dialog.html(new_html); - dialog.removeClass('loading'); - } - }); + if (params.html) { + dialog.html(params.html); + } else { + // no html? get it via ajax + $.ajax({ + url: params.url, + data: params.data, + type: params.type, + success: function(new_html) { + dialog.html(new_html); + dialog.removeClass('loading'); + } + }); + } return true; };