Error-Handling: Bei AJAX-Requests Fehler als JSON-Object zurückgeben
[kivitendo-erp.git] / scripts / generate_client_js_actions.tpl
1 // NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE:
2
3 // This file is generated automatically by the script
4 // "scripts/generate_client_js_actions.pl". See the documentation for
5 // SL/ClientJS.pm for instructions.
6
7 function display_flash(type, message) {
8   $('#flash_' + type + '_content').text(message);
9   $('#flash_' + type).show();
10 }
11
12 function eval_json_result(data) {
13   if (!data)
14     return;
15
16   if (data.error)
17     return display_flash('error', data.error);
18
19   $('#flash_error').hide();
20   $('#flash_error_content').empty();
21
22   if ((data.js || '') != '')
23     eval(data.js);
24
25   if (data.eval_actions)
26     $(data.eval_actions).each(function(idx, action) {
27       // console.log("ACTION " + action[0] + " ON " + action[1]);
28
29 [% actions %]
30     });
31
32   // console.log("current_content_type " + $('#current_content_type').val() + ' ID ' + $('#current_content_id').val());
33 }
34
35 // Local Variables:
36 // mode: js
37 // End: