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