epic-ts
[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 namespace("kivi", function(ns) {
8 ns.display_flash = function(type, message) {
9   $('#flash_' + type + '_content').text(message);
10   $('#flash_' + type).show();
11 };
12
13 ns.eval_json_result = function(data) {
14   if (!data)
15     return;
16
17   if (data.error)
18     return ns.display_flash('error', data.error);
19
20   $(['info', 'warning', 'error']).each(function(idx, category) {
21     $('#flash_' + category).hide();
22     $('#flash_' + category + '_content').empty();
23   });
24
25   if ((data.js || '') != '')
26     eval(data.js);
27
28   if (data.eval_actions)
29     $(data.eval_actions).each(function(idx, action) {
30       // console.log("ACTION " + action[0] + " ON " + action[1]);
31
32 [% actions %]
33     });
34
35   // console.log("current_content_type " + $('#current_content_type').val() + ' ID ' + $('#current_content_id').val());
36 };
37
38 });
39
40 // Local Variables:
41 // mode: js
42 // End: