X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=scripts%2Fgenerate_client_js_actions.tpl;h=274076a7a8a02a1253afcfc782d01c0082188968;hb=6f30741b2ec6d7d68aa37d7dc6918fd058c22c7b;hp=6772cd10284705e429cf2439f88d8bcf33212d20;hpb=17f39e02a0d2b7ceb565258861217fa7ba6bfbcf;p=kivitendo-erp.git diff --git a/scripts/generate_client_js_actions.tpl b/scripts/generate_client_js_actions.tpl index 6772cd102..274076a7a 100644 --- a/scripts/generate_client_js_actions.tpl +++ b/scripts/generate_client_js_actions.tpl @@ -5,9 +5,27 @@ // SL/ClientJS.pm for instructions. namespace("kivi", function(ns) { -ns.display_flash = function(type, message) { +ns.display_flash = function(type, message, noscroll) { $('#flash_' + type + '_content').text(message); $('#flash_' + type).show(); + if (!noscroll) { + $('#frame-header')[0].scrollIntoView(); + } +}; + +ns.display_flash_detail = function(type, message) { + $('#flash_' + type + '_detail').html(message); + $('#flash_' + type + '_disp').show(); +}; + +ns.clear_flash = function(category , timeout) { + window.setTimeout(function(){ + $('#flash_' + category).hide(); + $('#flash_detail_' + category).hide(); + $('#flash_' + category + '_disp').hide(); + $('#flash_' + category + '_content').empty(); + $('#flash_' + category + '_detail').empty(); + }, timeout); }; ns.eval_json_result = function(data) { @@ -17,11 +35,15 @@ ns.eval_json_result = function(data) { if (data.error) return ns.display_flash('error', data.error); - $(['info', 'warning', 'error']).each(function(idx, category) { - $('#flash_' + category).hide(); - $('#flash_' + category + '_content').empty(); - }); - + if (!data.no_flash_clear) { + $(['info', 'warning', 'error']).each(function(idx, category) { + $('#flash_' + category).hide(); + $('#flash_detail_' + category).hide(); + $('#flash_' + category + '_disp').hide(); + $('#flash_' + category + '_content').empty(); + $('#flash_' + category + '_detail').empty(); + }); + } if ((data.js || '') != '') eval(data.js); @@ -35,12 +57,6 @@ ns.eval_json_result = function(data) { // console.log("current_content_type " + $('#current_content_type').val() + ' ID ' + $('#current_content_id').val()); }; -ns.submit_ajax_form = function(url, form_selector, additional_data) { - var separator = /\?/.test(url) ? '&' : '?'; - $.post(url + separator + $(form_selector).serialize(), additional_data, ns.eval_json_result); - return true; -}; - }); // Local Variables: