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

Revision 1349, 1.1 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 
1var cities = function(data)
2{
3        if (typeof(data) == "string")
4        {
5                write_errors(data);
6                return false;
7        }
8        else
9        {
10                var container = document.getElementById(data["target"]);
11                container.innerHTML = "";
12                container.disabled = true;
13                fill_combo(data["target"], data["cities"]);
14                container.disabled = false;
15                return true;
16        }
17};
18
19function draw_cities(target, state_id, callback, handleExpiredSessions)
20{
21        cExecute("$this.bo_utils.get_cities",
22                        function (data)
23                        {
24                                if (data['error'])
25                                {
26                                        alert(data['error'].replace(/<br \/>/gi, "\n"));
27                                        if (data['url'])
28                                                if (handleExpiredSessions)
29                                                        window.location = data['url'].replace(/\.\./gi, ".");
30
31                                        return;
32                                }
33                                if (cities(data))
34                                {
35                                        if (callback)
36                                        {
37                                                callback();
38                                        }
39                                }
40                        }
41                        , "state_id=" + state_id + "&target=" + target);
42}
43
44function fill_combo(target, cities)
45{
46        var container = document.getElementById(target);
47
48        for (var i = 0; i < cities.length; i++)
49        {
50                var option = document.createElement("option");
51                option.innerHTML = cities[i].name;
52                option.value = cities[i].id;
53                container.appendChild(option);
54        }
55}
Note: See TracBrowser for help on using the repository browser.