]> wagnertech.de Git - kivitendo-erp.git/commitdiff
Flashanzeige erweitert: Löschen und Springen abschalten
authorMartin Helmling <martin.helmling@octosoft.eu>
Thu, 28 May 2015 15:51:42 +0000 (17:51 +0200)
committerMartin Helmling martin.helmling@octosoft.eu <martin.helmling@octosoft.eu>
Mon, 19 Sep 2016 15:08:05 +0000 (17:08 +0200)
1. Funktion zum Text löschen nach Timeout

Bei neuen Controllern, die per AJAX laufen, ist es empfehlenswert
bestimmte Texte nach einer gewissen Zeit implizit zu löschen,
damit eine weitere identische Anzeige erkennbar ist.

Änderung in clientjs:

2. nach Ausgabe einer Flash Anzeige (Info/Warning/Error)
   wird nach oben gesprungen ( derzeit zum frame-header).
   Damit wird die Anzeige auf jeden Fall sichtbar.

   Bei direkter Nutzung innerhalb Javascript kann per drittem Parameter 'true' das Scrollen verhindert werden.
   Dies ist derzeit nicht Controllerseitig durchführbar, da die flash() Funktion eine
   Liste von Strings erwartet. Hierzu müsste die Schnittstelle adaptiert werden oder ggf,
   eine neue Funktion flash_noscroll() eingebaut werden.

SL/ClientJS.pm
js/client_js.js
scripts/generate_client_js_actions.tpl

index 4cdb2037e2770d66b2bfeb9d9f69a29f94378989..91ff14b18b4ae251013c522b15714248bbcd6f39 100644 (file)
@@ -116,6 +116,7 @@ my %supported_methods = (
 
   flash                  => 2,  # kivi.display_flash(<TARGET>, <ARGS>)
   flash_detail           => 2,  # kivi.display_flash_detail(<TARGET>, <ARGS>)
 
   flash                  => 2,  # kivi.display_flash(<TARGET>, <ARGS>)
   flash_detail           => 2,  # kivi.display_flash_detail(<TARGET>, <ARGS>)
+  clear_flash            => 2,  # kivi.display_flash_detail(<TARGET>, <ARGS>)
   reinit_widgets         => 0,  # kivi.reinit_widgets()
   run                    => -1, # kivi.run(<TARGET>, <ARGS>)
   run_once_for           => 3,  # kivi.run_once_for(<TARGET>, <ARGS>)
   reinit_widgets         => 0,  # kivi.reinit_widgets()
   run                    => -1, # kivi.run(<TARGET>, <ARGS>)
   run_once_for           => 3,  # kivi.run_once_for(<TARGET>, <ARGS>)
index 6b3784a5a9fe9c50a9bbc88c2496f75a4bc42502..c592e4c8e29fd2c0c4ecf7e5652639c5584394f0 100644 (file)
@@ -5,10 +5,12 @@
 // SL/ClientJS.pm for instructions.
 
 namespace("kivi", function(ns) {
 // 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();
   $('#flash_' + type + '_content').text(message);
   $('#flash_' + type).show();
-  $('#frame-header')[0].scrollIntoView();
+  if (!noscroll) {
+    $('#frame-header')[0].scrollIntoView();
+  }
 };
 
 ns.display_flash_detail = function(type, message) {
 };
 
 ns.display_flash_detail = function(type, message) {
@@ -148,6 +150,7 @@ ns.eval_json_result = function(data) {
       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] == '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] == 'clear_flash')          kivi.clear_flash(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]);
       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]);
index 50a427c458964ff2c1decd910140a24fed5e2fbf..a29b3258785ef7874d651c157f9703ded212e894 100644 (file)
@@ -5,10 +5,12 @@
 // SL/ClientJS.pm for instructions.
 
 namespace("kivi", function(ns) {
 // 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();
   $('#flash_' + type + '_content').text(message);
   $('#flash_' + type).show();
-  $('#frame-header')[0].scrollIntoView();
+  if (!noscroll) {
+    $('#frame-header')[0].scrollIntoView();
+  }
 };
 
 ns.display_flash_detail = function(type, message) {
 };
 
 ns.display_flash_detail = function(type, message) {
@@ -16,6 +18,16 @@ ns.display_flash_detail = function(type, message) {
   $('#flash_' + type + '_disp').show();
 };
 
   $('#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) {
   if (!data)
     return;
 ns.eval_json_result = function(data) {
   if (!data)
     return;