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