Flashanzeige erweitert: Nun auch Details
[kivitendo-erp.git] / js / client_js.js
index 6d89819..6b3784a 100644 (file)
@@ -8,6 +8,22 @@ namespace("kivi", function(ns) {
 ns.display_flash = function(type, message) {
   $('#flash_' + type + '_content').text(message);
   $('#flash_' + type).show();
+  $('#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) {
@@ -19,7 +35,10 @@ ns.eval_json_result = function(data) {
 
   $(['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 || '') != '')
@@ -128,6 +147,7 @@ ns.eval_json_result = function(data) {
       // ## other stuff ##
       else if (action[0] == 'redirect_to')          window.location.href = action[1];
       else if (action[0] == 'flash')                kivi.display_flash(action[1], action[2]);
+      else if (action[0] == 'flash_detail')         kivi.display_flash_detail(action[1], action[2]);
       else if (action[0] == 'reinit_widgets')       kivi.reinit_widgets();
       else if (action[0] == 'run')                  kivi.run(action[1], action.slice(2, action.length));
       else if (action[0] == 'run_once_for')         kivi.run_once_for(action[1], action[2], action[3]);