X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=scripts%2Fgenerate_client_js_actions.tpl;fp=scripts%2Fgenerate_client_js_actions.tpl;h=467344fbd8da3fa533ca784b4f03591e8cade2c4;hb=53593baa211863fbf66540cf1bcc36c8fb37257f;hp=9e2180289895405366ebe851edf7f91ba71471da;hpb=deb4d2dbb676d7d6f69dfe7815d6e0cb09bd4a44;p=kivitendo-erp.git diff --git a/scripts/generate_client_js_actions.tpl b/scripts/generate_client_js_actions.tpl index 9e2180289..467344fbd 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,13 +35,19 @@ 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.js || '') != '') + 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 || '') !== '') + // jshint -W061 eval(data.js); + // jshint +W061 if (data.eval_actions) $(data.eval_actions).each(function(idx, action) {