/adei/ui

To get this branch, use:
bzr branch http://darksoft.org/webbzr/adei/ui

« back to all changes in this revision

Viewing changes to js/popup.js

  • Committer: Suren A. Chilingaryan
  • Date: 2008-10-30 01:27:40 UTC
  • mto: This revision was merged to the branch mainline in revision 116.
  • Revision ID: csa@dside.dyndns.org-20081030012740-svt0yigxj5uzwxyj
Few steps on source tree integration in javascript frontend

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
    this.popup_off_callbacks = new Array();
7
7
    this.current_height = new Array();
8
8
    this.popups = new Array();
 
9
    this.modules = new Array();
 
10
    this.controls = new Array();
9
11
    this.popups_width = 300;
10
12
    this.num_opened = 0;
11
13
 
16
18
    if (typeof cb != "undefined") this.RegisterCallback(cb,cbattr);
17
19
}
18
20
 
 
21
POPUP.prototype.RegisterPopup = function(module) {
 
22
    this.popups.push(module);
 
23
    this.controls[module] = new Array();
 
24
    this.popup_states[module] = 0;
 
25
}
 
26
 
 
27
POPUP.prototype.RegisterControlsModule = function(module, cmod) {
 
28
    if (typeof this.controls[module] == "undefined") {
 
29
        this.RegisterPopup(module);
 
30
    }
 
31
 
 
32
    this.modules[module] = cmod;
 
33
}
 
34
 
 
35
POPUP.prototype.RegisterControl = function(module, control) {
 
36
    if (typeof this.controls[module] == "undefined") {
 
37
        this.RegisterPopup(module);
 
38
    }
 
39
    
 
40
    this.controls[module].push(control);
 
41
}
 
42
 
 
43
POPUP.prototype.FindControl = function(control) {
 
44
    for (var i = 0; i < this.popups.length; i++) {
 
45
        var popup = this.popups[i];
 
46
        if (typeof this.controls[popup] != "undefind") {
 
47
            for (var j = 0; j < this.controls[popup].length; j++) {
 
48
                if (this.controls[popup][j] == control) {
 
49
                    return popup;
 
50
                }
 
51
            }
 
52
        }
 
53
    }
 
54
    return false;
 
55
}
 
56
 
 
57
POPUP.prototype.OpenControl = function(control) {
 
58
    var popup = this.FindControl(control);
 
59
    var module = this.modules[popup];
 
60
    
 
61
    if ((popup)&&(module)) {
 
62
        this.Open(popup);
 
63
        module.Open(control);
 
64
    }
 
65
}
 
66
 
19
67
 
20
68
POPUP.prototype.TryFixedSizeMode = function(sidebar, popup, geometry_node) {
21
69
    this.super_popup = false;
154
202
    }
155
203
}
156
204
 
 
205
POPUP.prototype.Open = function (module) {
 
206
    if (!this.popup_states[module]) {
 
207
        this.Switch(module);
 
208
    }
 
209
}
 
210
 
 
211
POPUP.prototype.Close = function (module) {
 
212
    if (this.popup_states[module]) {
 
213
        this.Switch(module);
 
214
    }
 
215
}
157
216
 
158
217
POPUP.prototype.Switch = function (module) {
159
218
 with (this) {
160
219
    if (typeof this.popup_states[module] == "undefined") {
 
220
        this.RegisterPopup(module);
 
221
    }
 
222
 
 
223
    if (this.popup_states[module]) {
 
224
        domHide("popup_" + module);
161
225
        this.popup_states[module] = 0;
162
 
        this.popups.push(module);
163
 
    }
164
 
 
165
 
    if (popup_states[module]) {
166
 
        domHide("popup_" + module);
167
 
        popup_states[module] = 0;
168
226
 
169
227
        if (typeof this.popup_off_callbacks[module] != "undefined") {
170
228
            for (var i = 0; i < this.popup_off_callbacks[module].length; i++) {