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