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