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