bzr branch
http://darksoft.org/webbzr/adei/trunk
78
by Suren A. Chilingaryan
Major javascript revision providing synchronous source/axis control updates in order to resolve Ticket #13 |
1 |
function MENU(config, updater, menu_id, skin) { |
86
by Suren A. Chilingaryan
Alarms support in all browsers |
2 |
|
12
by Suren A. Chilingaryan
Layout redesign: search tab, controls, menu |
3 |
var menu_node = document.getElementById(menu_id); |
86
by Suren A. Chilingaryan
Alarms support in all browsers |
4 |
if (isIE()) menu_node.style.zIndex = 400; // should be below dialog z-index |
78
by Suren A. Chilingaryan
Major javascript revision providing synchronous source/axis control updates in order to resolve Ticket #13 |
5 |
|
6 |
var skin = false; |
|
7 |
||
8 |
var re = /dhtmlxmenu_(.*).css$/; |
|
9 |
for (var i=0;i<document.styleSheets.length;i++) { |
|
10 |
if ((document.styleSheets[i])&&(document.styleSheets[i].href)) { |
|
11 |
var href = document.styleSheets[i].href; |
|
12 |
if (m = re.exec(href)) { |
|
13 |
skin = m[1]; |
|
14 |
break; |
|
15 |
}
|
|
16 |
}
|
|
17 |
}
|
|
18 |
||
19 |
if (!skin) adeiReportError("No DHTMLX skin is loaded, check if dhtmlx css files are in place"); |
|
20 |
||
86
by Suren A. Chilingaryan
Alarms support in all browsers |
21 |
|
22 |
||
23 |
/*
|
|
24 |
v.1
|
|
12
by Suren A. Chilingaryan
Layout redesign: search tab, controls, menu |
25 |
this.aMenuBar = new dhtmlXMenuBarObject(menu_node);
|
1
by Suren A. Chilingaryan
Initial import |
26 |
this.aMenuBar.setOnClickHandler(this.onClick(this));
|
27 |
this.aMenuBar.setGfxPath("images/");
|
|
28 |
this.aMenuBar.setZIndex(1000);
|
|
78
by Suren A. Chilingaryan
Major javascript revision providing synchronous source/axis control updates in order to resolve Ticket #13 |
29 |
*/
|
30 |
||
86
by Suren A. Chilingaryan
Alarms support in all browsers |
31 |
|
78
by Suren A. Chilingaryan
Major javascript revision providing synchronous source/axis control updates in order to resolve Ticket #13 |
32 |
this.aMenuBar = new dhtmlXMenuObject(menu_id, skin); |
33 |
this.aMenuBar.setImagePath("includes/dhtmlx/imgs/"); |
|
34 |
this.aMenuBar.setIconsPath("images/"); |
|
35 |
this.aMenuBar.attachEvent("onClick", this.onClick(this)); |
|
36 |
||
1
by Suren A. Chilingaryan
Initial import |
37 |
|
38 |
this.config = config; |
|
39 |
if (config) config.Register(this); |
|
40 |
||
41 |
this.updater = updater; |
|
42 |
||
43 |
this.window = null; |
|
44 |
this.exporter = null; |
|
45 |
}
|
|
46 |
||
47 |
MENU.prototype.Load = function() { |
|
48 |
this.ReLoad(); |
|
49 |
}
|
|
50 |
||
51 |
MENU.prototype.AttachWindow = function(wnd) { |
|
52 |
this.window = wnd; |
|
53 |
}
|
|
54 |
||
55 |
MENU.prototype.AttachExporter = function(exp) { |
|
56 |
this.exporter = exp; |
|
57 |
}
|
|
58 |
||
80
by Suren A. Chilingaryan
Few steps on source tree integration in javascript frontend |
59 |
MENU.prototype.OnLoad = function(self) { |
60 |
return function() { |
|
61 |
if (adei.cfg.menu_scroll_limit) { |
|
62 |
self.aMenuBar.setOverflowHeight(adei.cfg.menu_scroll_limit); |
|
63 |
}
|
|
64 |
}
|
|
65 |
}
|
|
1
by Suren A. Chilingaryan
Initial import |
66 |
|
67 |
MENU.prototype.ReLoad = function() { |
|
86
by Suren A. Chilingaryan
Alarms support in all browsers |
68 |
|
80
by Suren A. Chilingaryan
Few steps on source tree integration in javascript frontend |
69 |
this.aMenuBar.loadXML(adei.GetServiceURL("menu"), this.OnLoad(this)); |
86
by Suren A. Chilingaryan
Alarms support in all browsers |
70 |
|
71 |
||
78
by Suren A. Chilingaryan
Major javascript revision providing synchronous source/axis control updates in order to resolve Ticket #13 |
72 |
// this.aMenuBar.enableDynamicLoading(adei.GetServiceURL("menu"));
|
73 |
// this.aMenuBar.showBar();
|
|
12
by Suren A. Chilingaryan
Layout redesign: search tab, controls, menu |
74 |
// fix popups if placed in sidebar which is in super mode
|
1
by Suren A. Chilingaryan
Initial import |
75 |
}
|
76 |
||
77 |
MENU.prototype.SetQuery = function(srv, db, grp, mask, exp) { |
|
78 |
// This will force reset of time range (independent of other settings)
|
|
79 |
if (typeof exp == "undefined") exp = "0-0"; |
|
80 |
||
87
by Suren A. Chilingaryan
JavaScript fixups, some stuff for control data display is implemented |
81 |
this.config.ApplyDataSource(srv,db,grp,undefined,mask,exp); |
1
by Suren A. Chilingaryan
Initial import |
82 |
}
|
83 |
||
84 |
MENU.prototype.SetSource = function(srv, db, grp, mask) { |
|
87
by Suren A. Chilingaryan
JavaScript fixups, some stuff for control data display is implemented |
85 |
this.config.ApplyDataSource(srv,db,grp,undefined,mask); |
1
by Suren A. Chilingaryan
Initial import |
86 |
}
|
87 |
||
88 |
MENU.prototype.SetWindow = function(width) { |
|
89 |
if (this.window) { |
|
90 |
this.window.UpdateWidth(width); |
|
91 |
}
|
|
92 |
}
|
|
93 |
||
94 |
MENU.prototype.SetFormat = function(format) { |
|
95 |
if (this.exporter) { |
|
96 |
this.exporter.SetFormat(format); |
|
97 |
}
|
|
98 |
}
|
|
99 |
||
100 |
MENU.prototype.SetExportSampling = function(sampling) { |
|
101 |
if (this.exporter) { |
|
102 |
this.exporter.SetSampling(sampling); |
|
103 |
}
|
|
104 |
}
|
|
105 |
||
106 |
MENU.prototype.LockWindow = function() { |
|
107 |
if (this.window) this.window.Lock(); |
|
108 |
}
|
|
109 |
||
110 |
MENU.prototype.ReDraw = function() { |
|
111 |
if (this.updater) this.updater.Update(); |
|
112 |
}
|
|
113 |
||
114 |
MENU.prototype.ExportWindow = function() { |
|
115 |
if (this.exporter) { |
|
116 |
this.exporter.Export(true, 0); |
|
117 |
}
|
|
118 |
}
|
|
119 |
||
120 |
MENU.prototype.SetExportMask = function(mask) { |
|
121 |
if (this.exporter) { |
|
122 |
this.exporter.SetMask(mask); |
|
123 |
}
|
|
124 |
}
|
|
125 |
||
126 |
MENU.prototype.onClick = function(self) { |
|
127 |
return function(itemId,itemValue) { |
|
128 |
var params = itemId.split("__"); |
|
129 |
if (params[0] == "folder") return; |
|
130 |
||
131 |
var args = ""; |
|
132 |
if (params.length > 1) { |
|
133 |
args = "\"" + params[1] + "\""; |
|
134 |
for (var i = 2; i < params.length; i++) |
|
135 |
args += ", \"" + params[i] + "\""; |
|
136 |
}
|
|
137 |
||
138 |
var cmd = "if (typeof self." + params[0] + " == \"function\") {" + |
|
139 |
"self." + params[0] + "(" + args + ");" + |
|
140 |
"} else {" + |
|
141 |
"adeiReportError(\"Invalid menu action (" + params[0] + ")\", \"MENU\");" + |
|
142 |
"}"; |
|
143 |
||
144 |
eval(cmd); |
|
145 |
}
|
|
146 |
}
|
|
147 |
||
148 |