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