source: branches/1.2/workflow/js/jscode/common_functions.js @ 1349

Revision 1349, 2.4 KB checked in by niltonneto, 15 years ago (diff)

Ticket #561 - Inclusão do módulo Workflow faltante nessa versão.

  • Property svn:executable set to *
Line 
1function Element(element){
2        return document.getElementById(element);
3}
4
5function killElement(param){
6        var elem = document.getElementById(param);
7        if (elem)
8                elem.parentNode.removeChild(elem);
9}
10
11function load_lang(){
12
13        var handler_load_lang = function(data){
14                array_lang = data;
15        };
16        cExecute("$this.bo_userinterface.getLang",handler_load_lang);
17}
18
19function write_msg(msg) {
20        var msg = '<table width=100% class="msg_erro_table"><tr><th width="40%"></th><th noWrap class="msg_erro_th">'+msg+'</th><th width="40%"></th></tr><tbody></tbody><table>';
21        var divAppboxHeader = document.getElementById("divAppboxHeader");
22        divAppboxHeader.innerHTML = msg;
23        setTimeout("Element('divAppboxHeader').innerHTML = '<table align=center border=0 width=100%><tr><td align=center><span class=msg_erro_text>Workflow</span></td></tr></table>'", 5000);
24}
25
26function write_errors(msg_errors) {
27        alert(msg_errors.replace(/<br \/>/gi, "\n"));
28}
29
30function activity_icon(type, is_interactive) {
31
32        switch(type)
33        {
34                case 'activity':
35                        ic = "mini_" + ((is_interactive == 'y') ? 'blue_' : '') + "rectangle.gif";
36                        break;
37                case 'switch':
38                        ic = "mini_" + ((is_interactive == 'y')? 'blue_':'') + "diamond.gif";
39                        break;
40                case 'start':
41                        ic = "mini_" + ((is_interactive == 'y')? 'blue_':'') + "circle.gif";
42                        break;
43                case 'end':
44                        ic = "mini_" + ((is_interactive == 'y')? 'blue_':'') + "dbl_circle.gif";
45                        break;
46                case 'split':
47                        ic = "mini_" + ((is_interactive == 'y')? 'blue_':'') + "triangle.gif";
48                        break;
49                case 'join':
50                        ic = "mini_" + ((is_interactive == 'y')? 'blue_':'') + "inv_triangle.gif";
51                        break;
52                case 'standalone':
53                        ic = "mini_" + ((is_interactive == 'y')? 'blue_':'') + "hexagon.gif";
54                        break;
55                default:
56                        ic = "no-activity.gif";
57        }
58
59        var result = '<img src="' + _icon_dir + 'activities/' + ic + '" alt="' + type + '" title="' + type + '" />';
60        return result;
61}
62
63function get_icon(img_name, title, attributes)
64{
65        if (attributes == null) {
66                attributes = '';
67        }
68        return "<img " + attributes  + " src='" + _icon_dir + img_name + "' alt='" + title + "' title='" + title + "'>";
69}
70
71function get_link(link,text,attributes)
72{
73        if (attributes == null) {
74                attributes = '';
75        }
76
77        return "<a href=" + link + " " + attributes  + ">" + text + "</a>";
78}
79
80function _checkError(data)
81{
82        if (data['error'])
83        {
84                alert(data['error'].replace(/<br \/>/gi, "\n"));
85                if (data['url'])
86                        window.location = data['url'];
87                return true;
88        }
89
90        return false;
91}
Note: See TracBrowser for help on using the repository browser.