/dev/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/dev/trunk

« back to all changes in this revision

Viewing changes to js/menu.js

  • Committer: Suren A. Chilingaryan
  • Date: 2008-04-02 10:23:22 UTC
  • Revision ID: csa@dside.dyndns.org-20080402102322-okib92sicg2dx3o3
Initial import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
function MENU(config, updater, menu_id) {
 
2
    this.aMenuBar = new dhtmlXMenuBarObject(document.getElementById(menu_id));
 
3
    this.aMenuBar.setOnClickHandler(this.onClick(this));
 
4
    this.aMenuBar.setGfxPath("images/");
 
5
    this.aMenuBar.setZIndex(1000);
 
6
 
 
7
    this.config = config;
 
8
    if (config) config.Register(this);
 
9
    
 
10
    this.updater = updater;
 
11
 
 
12
    this.window = null;
 
13
    this.exporter = null;
 
14
}
 
15
 
 
16
MENU.prototype.Load = function() {
 
17
    this.ReLoad();
 
18
}
 
19
 
 
20
MENU.prototype.AttachWindow = function(wnd) {
 
21
    this.window = wnd;
 
22
}
 
23
 
 
24
MENU.prototype.AttachExporter = function(exp) {
 
25
    this.exporter = exp;
 
26
}
 
27
 
 
28
 
 
29
MENU.prototype.ReLoad = function() {
 
30
    this.aMenuBar.loadXML(adei.GetServiceURL("menu"));
 
31
    this.aMenuBar.showBar();
 
32
}
 
33
 
 
34
MENU.prototype.SetQuery = function(srv, db, grp, mask, exp) {
 
35
        // This will force reset of time range (independent of other settings)
 
36
    if (typeof exp == "undefined") exp = "0-0";
 
37
 
 
38
    this.config.ApplyDataSource(srv,db,grp,mask,exp);
 
39
}
 
40
 
 
41
MENU.prototype.SetSource = function(srv, db, grp, mask) {
 
42
    this.config.ApplyDataSource(srv,db,grp,mask);
 
43
}
 
44
 
 
45
MENU.prototype.SetWindow = function(width) {
 
46
    if (this.window) {
 
47
        this.window.UpdateWidth(width);
 
48
    }
 
49
}
 
50
 
 
51
MENU.prototype.SetFormat = function(format) {
 
52
    if (this.exporter) {
 
53
        this.exporter.SetFormat(format);
 
54
    }
 
55
}
 
56
 
 
57
MENU.prototype.SetExportSampling = function(sampling) {
 
58
    if (this.exporter) {
 
59
        this.exporter.SetSampling(sampling);
 
60
    }
 
61
}
 
62
 
 
63
MENU.prototype.LockWindow = function() {
 
64
    if (this.window) this.window.Lock();
 
65
}
 
66
 
 
67
MENU.prototype.ReDraw = function() {
 
68
    if (this.updater) this.updater.Update();
 
69
}
 
70
 
 
71
MENU.prototype.ExportWindow = function() {
 
72
    if (this.exporter) {
 
73
        this.exporter.Export(true, 0);
 
74
    }
 
75
}
 
76
 
 
77
MENU.prototype.SetExportMask = function(mask) {
 
78
    if (this.exporter) {
 
79
        this.exporter.SetMask(mask);
 
80
    }
 
81
}
 
82
 
 
83
MENU.prototype.onClick = function(self) {
 
84
    return function(itemId,itemValue) {
 
85
        var params = itemId.split("__");
 
86
        if (params[0] == "folder") return;
 
87
            
 
88
        var args = "";
 
89
        if (params.length > 1) {
 
90
            args = "\"" + params[1] + "\"";
 
91
            for (var i = 2; i < params.length; i++)
 
92
                args += ", \"" + params[i] + "\"";
 
93
        }
 
94
        
 
95
        var cmd = "if (typeof self." + params[0] + " == \"function\") {" +
 
96
            "self." + params[0] + "(" + args + ");" +
 
97
        "} else {" +
 
98
            "adeiReportError(\"Invalid menu action (" + params[0] + ")\", \"MENU\");" +
 
99
        "}";
 
100
        
 
101
        eval(cmd);      
 
102
    }
 
103
}
 
104
 
 
105
 
 
 
b'\\ No newline at end of file'