r2124 - split builting and local reports
[racktables] / inc / navigation.php
1 <?php
2 /*
3 *
4 * This file implements generic navigation for RackTables.
5 *
6 */
7
8 $page = array();
9 $tab = array();
10 $trigger = array();
11 $ophandler = array();
12 $tabhandler = array();
13 $tabextraclass = array();
14 $delayauth = array();
15 $msgcode = array();
16
17 $page['index']['title'] = 'Main page';
18 $page['index']['handler'] = 'renderIndex';
19
20 $page['rackspace']['title'] = 'Rackspace';
21 $page['rackspace']['parent'] = 'index';
22 $tab['rackspace']['default'] = 'Browse';
23 $tab['rackspace']['history'] = 'History';
24 $tab['rackspace']['firstrow'] = 'Click me!';
25 $trigger['rackspace']['firstrow'] = 'trigger_emptyRackspace';
26 $tabhandler['rackspace']['default'] = 'renderRackspace';
27 $tabhandler['rackspace']['history'] = 'renderRackspaceHistory';
28 $tabhandler['rackspace']['firstrow'] = 'renderFirstRowForm';
29 $tabextraclass['rackspace']['firstrow'] = 'attn';
30
31 $page['objects']['title'] = 'Objects';
32 $page['objects']['parent'] = 'index';
33 $tab['objects']['default'] = 'View';
34 $tab['objects']['addmore'] = 'Add more';
35 $tabhandler['objects']['default'] = 'renderObjectSpace';
36 $tabhandler['objects']['addmore'] = 'renderAddMultipleObjectsForm';
37
38 $page['row']['title_handler'] = 'dynamic_title_row';
39 $page['row']['bypass'] = 'row_id';
40 $page['row']['bypass_type'] = 'uint';
41 $page['row']['parent'] = 'rackspace';
42 $tab['row']['default'] = 'View';
43 $tab['row']['newrack'] = 'Add new rack';
44 $tab['row']['tagroller'] = 'Tag roller';
45 $tabhandler['row']['default'] = 'renderRow';
46 $tabhandler['row']['newrack'] = 'renderNewRackForm';
47 $tabhandler['row']['tagroller'] = 'renderTagRollerForRow';
48 $ophandler['row']['tagroller']['rollTags'] = 'rollTags';
49 $ophandler['row']['newrack']['addRack'] = 'addRack';
50 $msgcode['row']['tagroller']['rollTags']['OK'] = 1;
51 $msgcode['row']['tagroller']['rollTags']['ERR'] = 149;
52 $msgcode['row']['newrack']['addRack']['OK'] = 65;
53 $msgcode['row']['newrack']['addRack']['ERR1'] = 171;
54 $msgcode['row']['newrack']['addRack']['ERR2'] = 172;
55
56 $page['rack']['title_handler'] = 'dynamic_title_rack';
57 $page['rack']['bypass'] = 'rack_id';
58 $page['rack']['bypass_type'] = 'uint';
59 $page['rack']['parent'] = 'row';
60 $page['rack']['tagloader'] = 'loadRackTags';
61 $page['rack']['autotagloader'] = 'loadRackAutoTags';
62 $tab['rack']['default'] = 'View';
63 $tab['rack']['edit'] = 'Properties';
64 $tab['rack']['design'] = 'Design';
65 $tab['rack']['problems'] = 'Problems';
66 $tab['rack']['tags'] = 'Tags';
67 $tabhandler['rack']['default'] = 'renderRackPage';
68 $tabhandler['rack']['edit'] = 'renderEditRackForm';
69 $tabhandler['rack']['design'] = 'renderRackDesign';
70 $tabhandler['rack']['problems'] = 'renderRackProblems';
71 $tabhandler['rack']['tags'] = 'renderRackTags';
72 $trigger['rack']['tags'] = 'trigger_tags';
73 $ophandler['rack']['edit']['updateRack'] = 'updateRack';
74 $ophandler['rack']['tags']['saveTags'] = 'saveRackTags';
75
76 $page['objgroup']['title_handler'] = 'dynamic_title_objgroup';
77 $page['objgroup']['handler'] = 'renderObjectGroup';
78 $page['objgroup']['bypass'] = 'group_id';
79 $page['objgroup']['bypass_type'] = 'uint0';
80 $page['objgroup']['parent'] = 'objects';
81
82 $page['object']['title_handler'] = 'dynamic_title_object';
83 $page['object']['bypass'] = 'object_id';
84 $page['object']['bypass_type'] = 'uint';
85 $page['object']['parent'] = 'objgroup';
86 $page['object']['tagloader'] = 'loadRackObjectTags';
87 $page['object']['autotagloader'] = 'loadRackObjectAutoTags';
88 $tab['object']['default'] = 'View';
89 $tab['object']['edit'] = 'Properties';
90 $tab['object']['rackspace'] = 'Rackspace';
91 $tab['object']['ports'] = 'Ports';
92 $tab['object']['ipv4'] = 'IPv4';
93 $tab['object']['nat4'] = 'NATv4';
94 $tab['object']['livevlans'] = 'Live VLANs';
95 $tab['object']['snmpportfinder'] = 'SNMP port finder';
96 $tab['object']['editrspvs'] = 'RS pools';
97 $tab['object']['lvsconfig'] = 'LVS config';
98 $tab['object']['autoports'] = 'AutoPorts';
99 $tab['object']['tags'] = 'Tags';
100 $tabhandler['object']['default'] = 'renderRackObject';
101 $tabhandler['object']['edit'] = 'renderEditObjectForm';
102 $tabhandler['object']['rackspace'] = 'renderRackSpaceForObject';
103 $tabhandler['object']['ports'] = 'renderPortsForObject';
104 $tabhandler['object']['ipv4'] = 'renderIPv4ForObject';
105 $tabhandler['object']['nat4'] = 'renderNATv4ForObject';
106 $tabhandler['object']['livevlans'] = 'renderVLANMembership';
107 $tabhandler['object']['snmpportfinder'] = 'renderSNMPPortFinder';
108 $tabhandler['object']['lvsconfig'] = 'renderLVSConfig';
109 $tabhandler['object']['autoports'] = 'renderAutoPortsForm';
110 $tabhandler['object']['tags'] = 'renderObjectTags';
111 $tabhandler['object']['editrspvs'] = 'renderObjectSLB';
112 $tabextraclass['object']['snmpportfinder'] = 'attn';
113 $tabextraclass['object']['autoports'] = 'attn';
114 $trigger['object']['ipv4'] = 'trigger_ipv4';
115 $trigger['object']['nat4'] = 'trigger_natv4';
116 $trigger['object']['livevlans'] = 'trigger_livevlans';
117 $trigger['object']['snmpportfinder'] = 'trigger_snmpportfinder';
118 $trigger['object']['editrspvs'] = 'trigger_natv4';
119 $trigger['object']['lvsconfig'] = 'trigger_lvsconfig';
120 $trigger['object']['autoports'] = 'trigger_autoports';
121 $trigger['object']['tags'] = 'trigger_tags';
122 $ophandler['object']['ports']['addPort'] = 'addPortForObject';
123 $ophandler['object']['ports']['delPort'] = 'delPortFromObject';
124 $ophandler['object']['ports']['editPort'] = 'editPortForObject';
125 $ophandler['object']['ports']['linkPort'] = 'linkPortForObject';
126 $ophandler['object']['ports']['unlinkPort'] = 'unlinkPortForObject';
127 $ophandler['object']['ports']['addMultiPorts'] = 'addMultiPorts';
128 $ophandler['object']['ports']['useup'] = 'useupPort';
129 $ophandler['object']['ipv4']['updIPv4Allocation'] = 'updIPv4Allocation';
130 $ophandler['object']['ipv4']['addIPv4Allocation'] = 'addIPv4Allocation';
131 $ophandler['object']['ipv4']['delIPv4Allocation'] = 'delIPv4Allocation';
132 $ophandler['object']['edit']['clearSticker'] = 'clearSticker';
133 $ophandler['object']['edit']['updateStickers'] = 'updateStickers';
134 $ophandler['object']['edit']['update'] = 'updateObject';
135 $ophandler['object']['nat4']['addNATv4Rule'] = 'addPortForwarding';
136 $ophandler['object']['nat4']['delNATv4Rule'] = 'delPortForwarding';
137 $ophandler['object']['nat4']['updNATv4Rule'] = 'updPortForwarding';
138 $ophandler['object']['livevlans']['setPortVLAN'] = 'setPortVLAN';
139 $ophandler['object']['autoports']['generate'] = 'generateAutoPorts';
140 $ophandler['object']['tags']['saveTags'] = 'saveObjectTags';
141 $ophandler['object']['editrspvs']['addLB'] = 'addLoadBalancer';
142 $ophandler['object']['editrspvs']['delLB'] = 'deleteLoadBalancer';
143 $ophandler['object']['editrspvs']['updLB'] = 'updateLoadBalancer';
144 $ophandler['object']['lvsconfig']['submitSLBConfig'] = 'submitSLBConfig';
145 $ophandler['object']['snmpportfinder']['querySNMPData'] = 'querySNMPData';
146 $delayauth['object']['livevlans']['setPortVLAN'] = TRUE;
147 $msgcode['object']['nat4']['addNATv4Rule']['OK'] = 2;
148 $msgcode['object']['nat4']['addNATv4Rule']['ERR'] = 100;
149 $msgcode['object']['nat4']['delNATv4Rule']['OK'] = 3;
150 $msgcode['object']['nat4']['delNATv4Rule']['ERR'] = 100;
151 $msgcode['object']['nat4']['updNATv4Rule']['OK'] = 4;
152 $msgcode['object']['nat4']['updNATv4Rule']['ERR'] = 100;
153 $msgcode['object']['ports']['addPort']['OK'] = 5;
154 $msgcode['object']['ports']['addPort']['ERR1'] = 101;
155 $msgcode['object']['ports']['addPort']['ERR2'] = 100;
156 $msgcode['object']['ports']['editPort']['OK'] = 6;
157 $msgcode['object']['ports']['editPort']['ERR1'] = 101;
158 $msgcode['object']['ports']['editPort']['ERR2'] = 100;
159 $msgcode['object']['ports']['delPort']['OK'] = 7;
160 $msgcode['object']['ports']['delPort']['ERR'] = 100;
161 $msgcode['object']['ports']['linkPort']['OK'] = 8;
162 $msgcode['object']['ports']['linkPort']['ERR'] = 100;
163 $msgcode['object']['ports']['unlinkPort']['OK'] = 9;
164 $msgcode['object']['ports']['unlinkPort']['ERR'] = 100;
165 $msgcode['object']['ports']['addMultiPorts']['OK'] = 10;
166 $msgcode['object']['ports']['addMultiPorts']['ERR'] = 123;
167 $msgcode['object']['ports']['useup']['OK'] = 11;
168 $msgcode['object']['ports']['useup']['ERR'] = 124;
169 $msgcode['object']['ipv4']['updIPv4Allocation']['OK'] = 12;
170 $msgcode['object']['ipv4']['updIPv4Allocation']['ERR'] = 100;
171 $msgcode['object']['ipv4']['addIPv4Allocation']['OK'] = 13;
172 $msgcode['object']['ipv4']['addIPv4Allocation']['ERR1'] = 170;
173 $msgcode['object']['ipv4']['addIPv4Allocation']['ERR2'] = 100;
174 $msgcode['object']['ipv4']['delIPv4Allocation']['OK'] = 14;
175 $msgcode['object']['ipv4']['delIPv4Allocation']['ERR'] = 100;
176 $msgcode['object']['edit']['clearSticker']['OK'] = 15;
177 $msgcode['object']['edit']['clearSticker']['ERR'] = 120;
178 $msgcode['object']['edit']['update']['OK'] = 16;
179 $msgcode['object']['edit']['update']['ERR'] = 121;
180 $msgcode['object']['edit']['updateStickers']['OK'] = 17;
181 $msgcode['object']['edit']['updateStickers']['ERR'] = 122;
182 $msgcode['object']['editrspvs']['addLB']['OK'] = 18;
183 $msgcode['object']['editrspvs']['addLB']['ERR'] = 137;
184 $msgcode['object']['editrspvs']['delLB']['OK'] = 19;
185 $msgcode['object']['editrspvs']['delLB']['ERR'] = 129;
186 $msgcode['object']['editrspvs']['updLB']['OK'] = 20;
187 $msgcode['object']['editrspvs']['updLB']['ERR'] = 134;
188 $msgcode['object']['autoports']['generate']['OK'] = 21;
189 $msgcode['object']['autoports']['generate']['ERR'] = 142;
190 $msgcode['object']['tags']['saveTags']['OK'] = 22;
191 $msgcode['object']['tags']['saveTags']['ERR'] = 143;
192 $msgcode['object']['livevlans']['setPortVLAN']['ERR1'] = 156;
193 $msgcode['rack']['tags']['saveTags'] = $msgcode['object']['tags']['saveTags'];
194 $msgcode['iprange']['tags']['saveTags'] = $msgcode['object']['tags']['saveTags'];
195 $msgcode['ipv4vs']['tags']['saveTags'] = $msgcode['object']['tags']['saveTags'];
196 $msgcode['ipv4rsp']['tags']['saveTags'] = $msgcode['object']['tags']['saveTags'];
197 $msgcode['user']['tags']['saveTags'] = $msgcode['object']['tags']['saveTags'];
198 $msgcode['ipv4vs']['editlblist'] = $msgcode['object']['editrspvs'];
199 $msgcode['ipv4rsp']['editlblist'] = $msgcode['object']['editrspvs'];
200 $msgcode['ipaddress']['assignment'] = $msgcode['object']['ipv4'];
201
202 $page['ipv4space']['title'] = 'IPv4 space';
203 $page['ipv4space']['parent'] = 'index';
204 $tab['ipv4space']['default'] = 'Browse';
205 $tab['ipv4space']['newrange'] = 'Manage';
206 $tabhandler['ipv4space']['default'] = 'renderIPv4Space';
207 $tabhandler['ipv4space']['newrange'] = 'renderIPv4SpaceEditor';
208 $ophandler['ipv4space']['newrange']['addIPv4Prefix'] = 'addIPv4Prefix';
209 $ophandler['ipv4space']['newrange']['delIPv4Prefix'] = 'delIPv4Prefix';
210 $ophandler['ipv4space']['newrange']['updIPv4Prefix'] = 'updIPv4Prefix';
211 $msgcode['ipv4space']['newrange']['addIPv4Prefix']['OK'] = 23;
212 $msgcode['ipv4space']['newrange']['addIPv4Prefix']['ERR'] = 100;
213 $msgcode['ipv4space']['newrange']['addIPv4Prefix']['ERR1'] = 173;
214 $msgcode['ipv4space']['newrange']['addIPv4Prefix']['ERR2'] = 174;
215 $msgcode['ipv4space']['newrange']['addIPv4Prefix']['ERR3'] = 175;
216 $msgcode['ipv4space']['newrange']['addIPv4Prefix']['ERR4'] = 176;
217 $msgcode['ipv4space']['newrange']['delIPv4Prefix']['OK'] = 24;
218 $msgcode['ipv4space']['newrange']['delIPv4Prefix']['ERR'] = 100;
219
220 $page['iprange']['title_handler'] = 'dynamic_title_iprange';
221 $page['iprange']['parent'] = 'ipv4space';
222 $page['iprange']['bypass'] = 'id';
223 $page['iprange']['bypass_type'] = 'uint';
224 $page['iprange']['autotagloader'] = 'loadIPv4PrefixAutoTags';
225 $page['iprange']['tagloader'] = 'loadIPv4PrefixTags';
226 $tab['iprange']['default'] = 'Browse';
227 $tab['iprange']['properties'] = 'Properties';
228 $tab['iprange']['liveptr'] = 'Live PTR';
229 $tab['iprange']['tags'] = 'Tags';
230 $tabhandler['iprange']['default'] = 'renderIPv4Network';
231 $tabhandler['iprange']['properties'] = 'renderIPv4NetworkProperties';
232 $tabhandler['iprange']['liveptr'] = 'renderLivePTR';
233 $tabhandler['iprange']['tags'] = 'renderIPv4PrefixTags';
234 $trigger['iprange']['tags'] = 'trigger_tags';
235 $ophandler['iprange']['properties']['editRange'] = 'updIPv4Prefix';
236 $ophandler['iprange']['liveptr']['importPTRData'] = 'importPTRData';
237 $ophandler['iprange']['tags']['saveTags'] = 'saveIPv4PrefixTags';
238 $msgcode['iprange']['properties']['editRange']['OK'] = 25;
239 $msgcode['iprange']['properties']['editRange']['ERR'] = 100;
240 $msgcode['iprange']['liveptr']['importPTRData']['OK'] = 26;
241 $msgcode['iprange']['liveptr']['importPTRData']['ERR'] = 141;
242 $msgcode['ipv4space']['newrange']['updIPv4Prefix'] = $msgcode['iprange']['properties']['editRange'];
243
244 $page['ipaddress']['title_handler'] = 'dynamic_title_ipaddress';
245 $page['ipaddress']['parent'] = 'iprange';
246 $page['ipaddress']['bypass'] = 'ip';
247 $page['ipaddress']['bypass_type'] = 'inet4';
248 $page['ipaddress']['autotagloader'] = 'loadIPv4AddressAutoTags';
249 $tab['ipaddress']['default'] = 'Browse';
250 $tab['ipaddress']['properties'] = 'Properties';
251 $tab['ipaddress']['assignment'] = 'Allocation';
252 $tab['ipaddress']['editrslist'] = '[SLB real servers]';
253 $tabhandler['ipaddress']['default'] = 'renderIPv4Address';
254 $tabhandler['ipaddress']['properties'] = 'renderIPv4AddressProperties';
255 $tabhandler['ipaddress']['assignment'] = 'renderIPv4AddressAllocations';
256 $tabhandler['ipaddress']['editrslist'] = 'dragon';
257 $ophandler['ipaddress']['properties']['editAddress'] = 'editAddress';
258 $ophandler['ipaddress']['assignment']['delIPv4Allocation'] = 'delIPv4Allocation';
259 $ophandler['ipaddress']['assignment']['updIPv4Allocation'] = 'updIPv4Allocation';
260 $ophandler['ipaddress']['assignment']['addIPv4Allocation'] = 'addIPv4Allocation';
261 $msgcode['ipaddress']['properties']['editAddress']['OK'] = 27;
262 $msgcode['ipaddress']['properties']['editAddress']['ERR'] = 100;
263
264 $page['ipv4slb']['title'] = 'IPv4 SLB';
265 $page['ipv4slb']['parent'] = 'index';
266 $page['ipv4slb']['handler'] = 'renderIPv4SLB';
267
268 $page['ipv4vslist']['title'] = 'Virtual services';
269 $page['ipv4vslist']['parent'] = 'ipv4slb';
270 $tab['ipv4vslist']['default'] = 'View';
271 $tab['ipv4vslist']['edit'] = 'Edit';
272 $tabhandler['ipv4vslist']['default'] = 'renderVSList';
273 $tabhandler['ipv4vslist']['edit'] = 'renderVSListEditForm';
274 $ophandler['ipv4vslist']['edit']['add'] = 'addVService';
275 $ophandler['ipv4vslist']['edit']['del'] = 'deleteVService';
276 $ophandler['ipv4vslist']['edit']['upd'] = 'updateVService';
277 $msgcode['ipv4vslist']['edit']['add']['OK'] = 28;
278 $msgcode['ipv4vslist']['edit']['add']['ERR1'] = 132;
279 $msgcode['ipv4vslist']['edit']['add']['ERR2'] = 100;
280 $msgcode['ipv4vslist']['edit']['del']['OK'] = 29;
281 $msgcode['ipv4vslist']['edit']['del']['ERR'] = 130;
282 $msgcode['ipv4vslist']['edit']['upd']['OK'] = 30;
283 $msgcode['ipv4vslist']['edit']['upd']['ERR'] = 135;
284 $msgcode['ipv4vs']['edit']['updIPv4VS'] = $msgcode['ipv4vslist']['edit']['upd'];
285
286 $page['ipv4vs']['title_handler'] = 'dynamic_title_vservice';
287 $page['ipv4vs']['parent'] = 'ipv4vslist';
288 $page['ipv4vs']['bypass'] = 'vs_id';
289 $page['ipv4vs']['bypass_type'] = 'uint';
290 $page['ipv4vs']['tagloader'] = 'loadIPv4VSTags';
291 $page['ipv4vs']['autotagloader'] = 'loadIPv4VSAutoTags';
292 $tab['ipv4vs']['default'] = 'View';
293 $tab['ipv4vs']['edit'] = 'Edit';
294 $tab['ipv4vs']['editlblist'] = 'Load balancers';
295 $tab['ipv4vs']['tags'] = 'Tags';
296 $tabhandler['ipv4vs']['default'] = 'renderVirtualService';
297 $tabhandler['ipv4vs']['edit'] = 'renderEditVService';
298 $tabhandler['ipv4vs']['editlblist'] = 'renderVServiceLBForm';
299 $tabhandler['ipv4vs']['tags'] = 'renderIPv4VSTags';
300 $ophandler['ipv4vs']['edit']['updIPv4VS'] = 'updateVService';
301 $ophandler['ipv4vs']['tags']['saveTags'] = 'saveIPv4VSTags';
302 $ophandler['ipv4vs']['editlblist']['addLB'] = 'addLoadBalancer';
303 $ophandler['ipv4vs']['editlblist']['delLB'] = 'deleteLoadBalancer';
304 $ophandler['ipv4vs']['editlblist']['updLB'] = 'updateLoadBalancer';
305 $trigger['ipv4vs']['tags'] = 'trigger_tags';
306
307 $page['ipv4rsplist']['title'] = 'RS pools';
308 $page['ipv4rsplist']['parent'] = 'ipv4slb';
309 $tab['ipv4rsplist']['default'] = 'View';
310 $tab['ipv4rsplist']['edit'] = 'Edit';
311 $tabhandler['ipv4rsplist']['default'] = 'renderRSPoolList';
312 $tabhandler['ipv4rsplist']['edit'] = 'editRSPools';
313 $ophandler['ipv4rsplist']['edit']['add'] = 'addRSPool';
314 $ophandler['ipv4rsplist']['edit']['del'] = 'deleteRSPool';
315 $ophandler['ipv4rsplist']['edit']['upd'] = 'updateRSPool';
316 $msgcode['ipv4rsplist']['edit']['add']['OK'] = 31;
317 $msgcode['ipv4rsplist']['edit']['add']['ERR'] = 100;
318 $msgcode['ipv4rsplist']['edit']['del']['OK'] = 32;
319 $msgcode['ipv4rsplist']['edit']['del']['ERR'] = 138;
320 $msgcode['ipv4rsplist']['edit']['upd']['OK'] = 33;
321 $msgcode['ipv4rsplist']['edit']['upd']['ERR'] = 139;
322 $msgcode['ipv4rsp']['edit']['updIPv4RSP'] = $msgcode['ipv4rsplist']['edit']['upd'];
323
324 $page['ipv4rsp']['title_handler'] = 'dynamic_title_rspool';
325 $page['ipv4rsp']['parent'] = 'ipv4rsplist';
326 $page['ipv4rsp']['bypass'] = 'pool_id';
327 $page['ipv4rsp']['bypass_type'] = 'uint';
328 $page['ipv4rsp']['tagloader'] = 'loadIPv4RSPoolTags';
329 $page['ipv4rsp']['autotagloader'] = 'loadIPv4RSPoolAutoTags';
330 $tab['ipv4rsp']['default'] = 'View';
331 $tab['ipv4rsp']['edit'] = 'Edit';
332 $tab['ipv4rsp']['editlblist'] = 'Load Balancers';
333 $tab['ipv4rsp']['editrslist'] = 'RS list';
334 $tab['ipv4rsp']['rsinservice'] = 'RS in service';
335 $tab['ipv4rsp']['tags'] = 'Tags';
336 $trigger['ipv4rsp']['rsinservice'] = 'trigger_poolrscount';
337 $trigger['ipv4rsp']['tags'] = 'trigger_tags';
338 $tabhandler['ipv4rsp']['default'] = 'renderRSPool';
339 $tabhandler['ipv4rsp']['edit'] = 'renderEditRSPool';
340 $tabhandler['ipv4rsp']['editrslist'] = 'renderRSPoolServerForm';
341 $tabhandler['ipv4rsp']['editlblist'] = 'renderRSPoolLBForm';
342 $tabhandler['ipv4rsp']['rsinservice'] = 'renderRSPoolRSInServiceForm';
343 $tabhandler['ipv4rsp']['tags'] = 'renderIPv4RSPoolTags';
344 $ophandler['ipv4rsp']['editrslist']['addRS'] = 'addRealServer';
345 $ophandler['ipv4rsp']['editrslist']['delRS'] = 'deleteRealServer';
346 $ophandler['ipv4rsp']['editrslist']['updRS'] = 'updateRealServer';
347 $ophandler['ipv4rsp']['editrslist']['addMany'] = 'addRealServers';
348 $ophandler['ipv4rsp']['editlblist']['addLB'] = 'addLoadBalancer';
349 $ophandler['ipv4rsp']['editlblist']['delLB'] = 'deleteLoadBalancer';
350 $ophandler['ipv4rsp']['editlblist']['updLB'] = 'updateLoadBalancer';
351 $ophandler['ipv4rsp']['rsinservice']['upd'] = 'updateRSInService';
352 $ophandler['ipv4rsp']['tags']['saveTags'] = 'saveIPv4RSPoolTags';
353 $ophandler['ipv4rsp']['edit']['updIPv4RSP'] = 'updateRSPool';
354 $msgcode['ipv4rsp']['editrslist']['addRS']['OK'] = 34;
355 $msgcode['ipv4rsp']['editrslist']['addRS']['ERR'] = 126;
356 $msgcode['ipv4rsp']['editrslist']['delRS']['OK'] = 35;
357 $msgcode['ipv4rsp']['editrslist']['delRS']['ERR'] = 128;
358 $msgcode['ipv4rsp']['editrslist']['updRS']['OK'] = 36;
359 $msgcode['ipv4rsp']['editrslist']['updRS']['ERR'] = 133;
360 $msgcode['ipv4rsp']['editrslist']['addMany']['OK'] = 37;
361 $msgcode['ipv4rsp']['editrslist']['addMany']['ERR1'] = 131;
362 $msgcode['ipv4rsp']['editrslist']['addMany']['ERR2'] = 127;
363 $msgcode['ipv4rsp']['rsinservice']['upd']['OK'] = 38;
364 $msgcode['ipv4rsp']['rsinservice']['upd']['ERR'] = 140;
365
366 $page['rservers']['title'] = 'Real servers';
367 $page['rservers']['parent'] = 'ipv4slb';
368 $page['rservers']['handler'] = 'renderRealServerList';
369
370 $page['lbs']['title'] = 'Load balancers';
371 $page['lbs']['parent'] = 'ipv4slb';
372 $page['lbs']['handler'] = 'renderLBList';
373
374 $page['search']['title_handler'] = 'dynamic_title_search';
375 $page['search']['handler'] = 'renderSearchResults';
376 $page['search']['parent'] = 'index';
377 $page['search']['bypass'] = 'q';
378
379 $page['config']['title'] = 'Configuration';
380 $page['config']['handler'] = 'renderConfigMainpage';
381 $page['config']['parent'] = 'index';
382
383 $page['userlist']['title'] = 'Users';
384 $page['userlist']['parent'] = 'config';
385 $tab['userlist']['default'] = 'View';
386 $tab['userlist']['edit'] = 'Edit';
387 $tabhandler['userlist']['default'] = 'renderUserList';
388 $tabhandler['userlist']['edit'] = 'renderUserListEditor';
389 $ophandler['userlist']['edit']['updateUser'] = 'updateUser';
390 $ophandler['userlist']['edit']['createUser'] = 'createUser';
391 $ophandler['userlist']['edit']['disableUser'] = 'disableUser';
392 $ophandler['userlist']['edit']['enableUser'] = 'enableUser';
393 $msgcode['userlist']['edit']['updateUser']['OK'] = 39;
394 $msgcode['userlist']['edit']['updateUser']['ERR1'] = 103;
395 $msgcode['userlist']['edit']['updateUser']['ERR1'] = 104;
396 $msgcode['userlist']['edit']['createUser']['OK'] = 40;
397 $msgcode['userlist']['edit']['createUser']['ERR'] = 102;
398 $msgcode['userlist']['edit']['disableUser']['OK'] = 41;
399 $msgcode['userlist']['edit']['disableUser']['ERR1'] = 107;
400 $msgcode['userlist']['edit']['disableUser']['ERR2'] = 106;
401 $msgcode['userlist']['edit']['enableUser']['OK'] = 42;
402 $msgcode['userlist']['edit']['enableUser']['ERR'] = 105;
403
404 $page['user']['title_handler'] = 'dynamic_title_user';
405 $page['user']['parent'] = 'userlist';
406 $page['user']['bypass'] = 'user_id';
407 $page['user']['bypass_type'] = 'uint';
408 $page['user']['tagloader'] = 'loadUserTags';
409 $page['user']['autotagloader'] = 'getUserAutoTags';
410 $tab['user']['default'] = 'View';
411 $tab['user']['tags'] = 'Tags';
412 $tabhandler['user']['default'] = 'renderUser';
413 $tabhandler['user']['tags'] = 'renderUserTags';
414 $ophandler['user']['tags']['saveTags'] = 'saveUserTags';
415
416 $page['perms']['title'] = 'Permissions';
417 $page['perms']['parent'] = 'config';
418 $tab['perms']['default'] = 'View';
419 $tab['perms']['edit'] = 'Edit';
420 $tabhandler['perms']['default'] = 'renderRackCodeViewer';
421 $tabhandler['perms']['edit'] = 'renderRackCodeEditor';
422 $ophandler['perms']['edit']['saveRackCode'] = 'saveRackCode';
423 $msgcode['perms']['edit']['saveRackCode']['OK'] = 43;
424 $msgcode['perms']['edit']['saveRackCode']['ERR1'] = 154;
425 $msgcode['perms']['edit']['saveRackCode']['ERR2'] = 155;
426
427 $page['portmap']['title'] = 'Port compatibility map';
428 $page['portmap']['parent'] = 'config';
429 $tab['portmap']['default'] = 'View';
430 $tab['portmap']['edit'] = 'Change';
431 $tabhandler['portmap']['default'] = 'renderPortMapViewer';
432 $tabhandler['portmap']['edit'] = 'renderPortMapEditor';
433 $ophandler['portmap']['edit']['save'] = 'savePortMap';
434 $msgcode['portmap']['edit']['save']['OK'] = 44;
435 $msgcode['portmap']['edit']['save']['ERR'] = 108;
436
437 $page['attrs']['title'] = 'Attributes';
438 $page['attrs']['parent'] = 'config';
439 $tab['attrs']['default'] = 'View';
440 $tab['attrs']['editattrs'] = 'Edit attributes';
441 $tab['attrs']['editmap'] = 'Edit map';
442 $tabhandler['attrs']['default'] = 'renderAttributes';
443 $tabhandler['attrs']['editattrs'] = 'renderEditAttributesForm';
444 $tabhandler['attrs']['editmap'] = 'renderEditAttrMapForm';
445 $ophandler['attrs']['editattrs']['add'] = 'createAttribute';
446 $ophandler['attrs']['editattrs']['upd'] = 'changeAttribute';
447 $ophandler['attrs']['editattrs']['del'] = 'deleteAttribute';
448 $ophandler['attrs']['editmap']['add'] = 'supplementAttrMap';
449 $ophandler['attrs']['editmap']['del'] = 'reduceAttrMap';
450 $msgcode['attrs']['editattrs']['add']['OK'] = 45;
451 $msgcode['attrs']['editattrs']['add']['ERR'] = 116;
452 $msgcode['attrs']['editattrs']['upd']['OK'] = 46;
453 $msgcode['attrs']['editattrs']['upd']['ERR'] = 115;
454 $msgcode['attrs']['editattrs']['del']['OK'] = 47;
455 $msgcode['attrs']['editattrs']['del']['ERR'] = 117;
456 $msgcode['attrs']['editmap']['add']['OK'] = 48;
457 $msgcode['attrs']['editmap']['add']['ERR'] = 118;
458 $msgcode['attrs']['editmap']['del']['OK'] = 49;
459 $msgcode['attrs']['editmap']['del']['ERR'] = 119;
460
461 $page['dict']['title'] = 'Dictionary';
462 $page['dict']['parent'] = 'config';
463 $tab['dict']['default'] = 'View';
464 $tab['dict']['edit'] = 'Edit words';
465 $tab['dict']['chapters'] = 'Manage chapters';
466 $tabhandler['dict']['default'] = 'renderDictionary';
467 $tabhandler['dict']['edit'] = 'renderDictionaryEditor';
468 $tabhandler['dict']['chapters'] = 'renderChaptersEditor';
469 $ophandler['dict']['edit']['del'] = 'reduceDictionary';
470 $ophandler['dict']['edit']['upd'] = 'updateDictionary';
471 $ophandler['dict']['edit']['add'] = 'supplementDictionary';
472 $ophandler['dict']['chapters']['del'] = 'delChapter';
473 $ophandler['dict']['chapters']['upd'] = 'updateChapter';
474 $ophandler['dict']['chapters']['add'] = 'addChapter';
475 $msgcode['dict']['edit']['del']['OK'] = 50;
476 $msgcode['dict']['edit']['del']['ERR'] = 111;
477 $msgcode['dict']['edit']['upd']['OK'] = 51;
478 $msgcode['dict']['edit']['upd']['ERR'] = 109;
479 $msgcode['dict']['edit']['add']['OK'] = 52;
480 $msgcode['dict']['edit']['add']['ERR'] = 110;
481 $msgcode['dict']['chapters']['del']['OK'] = 53;
482 $msgcode['dict']['chapters']['del']['ERR'] = 114;
483 $msgcode['dict']['chapters']['upd']['OK'] = 54;
484 $msgcode['dict']['chapters']['upd']['ERR'] = 113;
485 $msgcode['dict']['chapters']['add']['OK'] = 55;
486 $msgcode['dict']['chapters']['add']['ERR'] = 112;
487
488 $page['ui']['title'] = 'User interface';
489 $page['ui']['parent'] = 'config';
490 $tab['ui']['default'] = 'View';
491 $tab['ui']['edit'] = 'Change';
492 $tab['ui']['reset'] = 'Reset';
493 $tabhandler['ui']['default'] = 'renderUIConfig';
494 $tabhandler['ui']['edit'] = 'renderUIConfigEditForm';
495 $tabhandler['ui']['reset'] = 'renderUIResetForm';
496 $ophandler['ui']['edit']['upd'] = 'updateUI';
497 $ophandler['ui']['reset']['go'] = 'resetUIConfig';
498 $msgcode['ui']['edit']['upd']['OK'] = 56;
499 $msgcode['ui']['edit']['upd']['ERR'] = 125;
500 $msgcode['ui']['reset']['go']['OK'] = 57;
501
502 $page['tagtree']['title'] = 'Tag tree';
503 $page['tagtree']['parent'] = 'config';
504 $tab['tagtree']['default'] = 'View';
505 $tab['tagtree']['edit'] = 'Edit';
506 $tabhandler['tagtree']['default'] = 'renderTagTree';
507 $tabhandler['tagtree']['edit'] = 'renderTagTreeEditor';
508 $ophandler['tagtree']['edit']['destroyTag'] = 'destroyTag';
509 $ophandler['tagtree']['edit']['createTag'] = 'createTag';
510 $ophandler['tagtree']['edit']['updateTag'] = 'updateTag';
511 $msgcode['tagtree']['edit']['destroyTag']['OK'] = 58;
512 $msgcode['tagtree']['edit']['destroyTag']['ERR'] = 144;
513 $msgcode['tagtree']['edit']['createTag']['OK'] = 59;
514 $msgcode['tagtree']['edit']['createTag']['ERR1'] = 145;
515 $msgcode['tagtree']['edit']['createTag']['ERR2'] = 146;
516 $msgcode['tagtree']['edit']['createTag']['ERR3'] = 147;
517 $msgcode['tagtree']['edit']['updateTag']['OK'] = 60;
518 $msgcode['tagtree']['edit']['updateTag']['ERR1'] = 145;
519 $msgcode['tagtree']['edit']['updateTag']['ERR2'] = 148;
520
521 $page['myaccount']['title'] = 'My account';
522 $page['myaccount']['parent'] = 'config';
523 $tab['myaccount']['default'] = 'Info';
524 $tab['myaccount']['mypassword'] = 'Password change';
525 $tab['myaccount']['myrealname'] = '[Real name change]';
526 $trigger['myaccount']['mypassword'] = 'trigger_passwdchange';
527 $tabhandler['myaccount']['default'] = 'renderMyAccount';
528 $tabhandler['myaccount']['mypassword'] = 'renderMyPasswordEditor';
529 $tabhandler['myaccount']['myrealname'] = 'dragon';
530 $ophandler['myaccount']['mypassword']['changeMyPassword'] = 'changeMyPassword';
531 $msgcode['myaccount']['mypassword']['changeMyPassword']['OK'] = 61;
532 $msgcode['myaccount']['mypassword']['changeMyPassword']['ERR1'] = 150;
533 $msgcode['myaccount']['mypassword']['changeMyPassword']['ERR2'] = 151;
534 $msgcode['myaccount']['mypassword']['changeMyPassword']['ERR3'] = 152;
535 $msgcode['myaccount']['mypassword']['changeMyPassword']['ERR4'] = 153;
536
537 $page['reports']['title'] = 'Reports';
538 $page['reports']['parent'] = 'index';
539 $tab['reports']['default'] = 'System';
540 $tab['reports']['local'] = 'Local';
541 $trigger['reports']['local'] = 'trigger_localreports';
542 $tabhandler['reports']['default'] = 'renderSystemReports';
543 $tabhandler['reports']['local'] = 'renderLocalReports';
544
545 // This function returns array if page numbers leading to the target page
546 // plus page number of target page itself. The first element is the target
547 // page number and the last element is the index page number.
548 function getPath ($targetno)
549 {
550 global $page;
551 $path = array();
552 // Recursion breaks at first parentless page.
553 if (!isset ($page[$targetno]['parent']))
554 $path = array ($targetno);
555 else
556 {
557 $path = getPath ($page[$targetno]['parent']);
558 $path[] = $targetno;
559 }
560 return $path;
561 }
562
563 function showPathAndSearch ($pageno)
564 {
565 global $root, $page;
566 // Path.
567 echo "<td class=activemenuitem width='99%'>" . getConfigVar ('enterprise');
568 $path = getPath ($pageno);
569 foreach ($path as $no)
570 {
571 $title['params'] = array();
572 if (isset ($page[$no]['title']))
573 $title['name'] = $page[$no]['title'];
574 elseif (isset ($page[$no]['title_handler']))
575 $title = $page[$no]['title_handler']($no);
576 else
577 $title['name'] = '[N/A]';
578 echo ": <a href='${root}?page=${no}&tab=default";
579 foreach ($title['params'] as $param_name => $param_value)
580 echo "&${param_name}=${param_value}";
581 echo "'>" . $title['name'] . "</a>";
582 }
583 echo "</td>";
584 // Search form.
585 echo "<td><table border=0 cellpadding=0 cellspacing=0><tr><td>Search:</td>";
586 echo "<form name=search method=get action='${root}'><td>";
587 echo '<input type=hidden name=page value=search>';
588 // This input will be the first, if we don't add ports or addresses.
589 echo "<input type=text name=q size=20 tabindex=1000></td></form></tr></table></td>";
590 }
591
592 function getTitle ($pageno, $tabno)
593 {
594 global $page;
595 if (isset ($page[$pageno]['title']))
596 return $page[$pageno]['title'];
597 elseif (isset ($page[$pageno]['title_handler']))
598 {
599 $tmp = $page[$pageno]['title_handler']($pageno);
600 return $tmp['name'];
601 }
602 else
603 return getConfigVar ('enterprise');
604 }
605
606 function showTabs ($pageno, $tabno)
607 {
608 global $tab, $root, $page, $remote_username, $trigger, $tabextraclass;
609 if (!isset ($tab[$pageno]['default']))
610 return;
611 echo "<td><div class=greynavbar><ul id=foldertab style='margin-bottom: 0px; padding-top: 10px;'>";
612 foreach ($tab[$pageno] as $tabidx => $tabtitle)
613 {
614 // Hide forbidden tabs.
615 if (!permitted ($pageno, $tabidx))
616 continue;
617 // Dynamic tabs should only be shown in certain cases (trigger exists and returns true).
618 if (isset ($trigger[$pageno][$tabidx]))
619 {
620 // $t1 = microtime (TRUE);
621 $ok = $trigger[$pageno][$tabidx] ();
622 // $t2 = microtime (TRUE);
623 // echo 'DEBUG: ' . $trigger[$pageno][$tabidx] . ': ' . sprintf ('%0.4f', $t2 - $t1) . '<br>';
624 if (!$ok)
625 continue;
626 }
627 $class = ($tabidx == $tabno) ? 'current' : 'std';
628 $extra = (isset ($tabextraclass[$pageno][$tabidx])) ? $tabextraclass[$pageno][$tabidx] : '';
629 echo "<li><a class=${class}{$extra}";
630 echo " href='${root}?page=${pageno}&tab=${tabidx}";
631 if (isset ($page[$pageno]['bypass']) and isset ($_REQUEST[$page[$pageno]['bypass']]))
632 {
633 $bpname = $page[$pageno]['bypass'];
634 $bpval = $_REQUEST[$bpname];
635 echo "&${bpname}=${bpval}";
636 }
637 echo "'>${tabtitle}</a></li>\n";
638 }
639 echo "</ul></div></td>\n";
640 }
641
642 // This function returns pages, which are direct children of the requested
643 // page and are accessible by the current user.
644 function getDirectChildPages ($pageno)
645 {
646 global $page, $remote_username;
647 $children = array();
648 foreach ($page as $cpageno => $cpage)
649 if
650 (
651 isset ($cpage['parent']) and
652 $cpage['parent'] == $pageno and
653 accessibleSubpage ($cpageno) == TRUE
654 )
655 $children[$cpageno] = $cpage;
656 return $children;
657 }
658
659 function getAllChildPages ($parent)
660 {
661 global $page;
662 // Array pointer is global, so if we don't create local copies of
663 // the global array, we can't advance any more after nested call
664 // of getAllChildPages returns.
665 $mypage = $page;
666 $mykids = array();
667 foreach ($mypage as $ctitle => $cpage)
668 if (isset ($cpage['parent']) and $cpage['parent'] == $parent)
669 $mykids[] = array ('title' => $ctitle, 'kids' => getAllChildPages ($ctitle));
670 return $mykids;
671 }
672
673 ?>