r1940 + align allocations table according to the current style
[racktables] / inc / navigation.php
CommitLineData
b325120a 1<?php
e673ee24
DO
2/*
3*
4* This file implements generic navigation for RackTables.
5*
6*/
7
83dd1b15
DO
8$page = array();
9$tab = array();
83dd1b15
DO
10$trigger = array();
11$ophandler = array();
81bab70c 12$tabhandler = array();
83dd1b15 13
eebf9145 14$page['index']['title'] = 'Main page';
e673ee24
DO
15$page['index']['handler'] = 'renderIndex';
16
eebf9145 17$page['rackspace']['title'] = 'Rackspace';
e673ee24
DO
18$page['rackspace']['parent'] = 'index';
19$tab['rackspace']['default'] = 'Browse';
20$tab['rackspace']['history'] = 'History';
9b0cf84f
DO
21$tab['rackspace']['firstrow'] = 'Click me!';
22$trigger['rackspace']['firstrow'] = 'trigger_emptyRackspace';
8b6ffe9c
DO
23$tabhandler['rackspace']['default'] = 'renderRackspace';
24$tabhandler['rackspace']['history'] = 'renderRackspaceHistory';
25$tabhandler['rackspace']['firstrow'] = 'renderFirstRowForm';
08b16bf5 26$tabextraclass['rackspace']['firstrow'] = 'attn';
e673ee24 27
eebf9145 28$page['objects']['title'] = 'Objects';
e673ee24
DO
29$page['objects']['parent'] = 'index';
30$tab['objects']['default'] = 'View';
216c84bb 31$tab['objects']['addmore'] = 'Add more';
7cc02fc1 32$tabhandler['objects']['default'] = 'renderObjectSpace';
216c84bb 33$tabhandler['objects']['addmore'] = 'renderAddMultipleObjectsForm';
e673ee24 34
eebf9145 35$page['row']['title_handler'] = 'dynamic_title_row';
e673ee24 36$page['row']['bypass'] = 'row_id';
8b6ffe9c 37$page['row']['bypass_type'] = 'uint';
e673ee24
DO
38$page['row']['parent'] = 'rackspace';
39$tab['row']['default'] = 'View';
40$tab['row']['newrack'] = 'Add new rack';
5bbbeaa2 41$tab['row']['tagroller'] = '[Tag roller]';
8b6ffe9c
DO
42$tabhandler['row']['default'] = 'renderRow';
43$tabhandler['row']['newrack'] = 'renderNewRackForm';
2f32cc32 44$tabhandler['row']['tagroller'] = 'renderTagRollerForRow';
e673ee24 45
eebf9145 46$page['rack']['title_handler'] = 'dynamic_title_rack';
e673ee24 47$page['rack']['bypass'] = 'rack_id';
8b6ffe9c 48$page['rack']['bypass_type'] = 'uint';
e673ee24 49$page['rack']['parent'] = 'row';
41bd8c87
DO
50$page['rack']['tagloader'] = 'loadRackTags';
51$page['rack']['autotagloader'] = 'loadRackAutoTags';
e673ee24
DO
52$tab['rack']['default'] = 'View';
53$tab['rack']['edit'] = 'Properties';
54$tab['rack']['design'] = 'Design';
55$tab['rack']['problems'] = 'Problems';
41bd8c87 56$tab['rack']['tags'] = 'Tags';
8b6ffe9c
DO
57$tabhandler['rack']['default'] = 'renderRackPage';
58$tabhandler['rack']['edit'] = 'renderEditRackForm';
59$tabhandler['rack']['design'] = 'renderRackDesign';
60$tabhandler['rack']['problems'] = 'renderRackProblems';
41bd8c87
DO
61$tabhandler['rack']['tags'] = 'renderRackTags';
62$trigger['rack']['tags'] = 'trigger_tags';
63$ophandler['rack']['tags']['save'] = 'saveRackTags';
e673ee24 64
eebf9145 65$page['objgroup']['title_handler'] = 'dynamic_title_objgroup';
3aeb15f3 66$page['objgroup']['handler'] = 'renderObjectGroup';
e673ee24 67$page['objgroup']['bypass'] = 'group_id';
105cea6e 68$page['objgroup']['bypass_type'] = 'uint0';
e673ee24
DO
69$page['objgroup']['parent'] = 'objects';
70
eebf9145 71$page['object']['title_handler'] = 'dynamic_title_object';
e673ee24 72$page['object']['bypass'] = 'object_id';
3bebaebd 73$page['object']['bypass_type'] = 'uint';
e673ee24 74$page['object']['parent'] = 'objgroup';
2fb24351
DO
75$page['object']['tagloader'] = 'loadRackObjectTags';
76$page['object']['autotagloader'] = 'loadRackObjectAutoTags';
e673ee24
DO
77$tab['object']['default'] = 'View';
78$tab['object']['edit'] = 'Properties';
79$tab['object']['rackspace'] = 'Rackspace';
80$tab['object']['ports'] = 'Ports';
81$tab['object']['network'] = 'IPv4';
737f9ac1 82$tab['object']['portfwrd'] = 'NATv4';
a684aa6f 83$tab['object']['switchvlans'] = 'Live VLANs';
9c67f713 84$tab['object']['snmpportfinder'] = 'SNMP port finder';
7e13adfe 85$tab['object']['slb'] = '[SLB]';
3ee1252b 86$tab['object']['lvsconfig'] = 'LVS configuration';
118e4c38 87$tab['object']['autoports'] = 'AutoPorts';
2fb24351 88$tab['object']['tags'] = 'Tags';
e45a78d7
DO
89$tabhandler['object']['default'] = 'renderRackObject';
90$tabhandler['object']['edit'] = 'renderEditObjectForm';
91$tabhandler['object']['rackspace'] = 'renderRackSpaceForObject';
92$tabhandler['object']['ports'] = 'renderPortsForObject';
93$tabhandler['object']['network'] = 'renderNetworkForObject';
eeb4a5d8 94$tabhandler['object']['portfwrd'] = 'renderNATv4ForObject';
e45a78d7
DO
95$tabhandler['object']['switchvlans'] = 'renderVLANMembership';
96$tabhandler['object']['snmpportfinder'] = 'renderSNMPPortFinder';
3ee1252b 97$tabhandler['object']['lvsconfig'] = 'renderLVSConfig';
118e4c38 98$tabhandler['object']['autoports'] = 'renderAutoPortsForm';
2fb24351 99$tabhandler['object']['tags'] = 'renderObjectTags';
5bbbeaa2 100$tabhandler['object']['slb'] = 'renderObjectSLB';
08b16bf5
DO
101$tabextraclass['object']['snmpportfinder'] = 'attn';
102$tabextraclass['object']['autoports'] = 'attn';
6dbdc7c7
DO
103$trigger['object']['network'] = 'trigger_ipv4';
104$trigger['object']['portfwrd'] = 'trigger_natv4';
641fe9b0 105$trigger['object']['switchvlans'] = 'trigger_switchvlans';
9c67f713 106$trigger['object']['snmpportfinder'] = 'trigger_snmpportfinder';
7e13adfe 107$trigger['object']['slb'] = 'trigger_natv4';
094bb33c 108$trigger['object']['lvsconfig'] = 'trigger_lvsconfig';
118e4c38 109$trigger['object']['autoports'] = 'trigger_autoports';
91dbb8a3 110$trigger['object']['tags'] = 'trigger_tags';
e673ee24
DO
111$ophandler['object']['ports']['addPort'] = 'addPortForObject';
112$ophandler['object']['ports']['delPort'] = 'delPortFromObject';
113$ophandler['object']['ports']['editPort'] = 'editPortForObject';
114$ophandler['object']['ports']['linkPort'] = 'linkPortForObject';
115$ophandler['object']['ports']['unlinkPort'] = 'unlinkPortForObject';
116$ophandler['object']['ports']['addMultiPorts'] = 'addMultiPorts';
117$ophandler['object']['ports']['useup'] = 'useupPort';
b4c1ef87
DO
118$ophandler['object']['network']['updIPv4Allocation'] = 'updIPv4Allocation';
119$ophandler['object']['network']['addIPv4Allocation'] = 'addIPv4Allocation';
120$ophandler['object']['network']['delIPv4Allocation'] = 'delIPv4Allocation';
e673ee24 121$ophandler['object']['edit']['del'] = 'resetAttrValue';
0dfb8a2a 122$ophandler['object']['edit']['upd'] = 'updateAttrValues';
e673ee24
DO
123$ophandler['object']['portfwrd']['forwardPorts'] = 'addPortForwarding';
124$ophandler['object']['portfwrd']['delPortForwarding'] = 'delPortForwarding';
125$ophandler['object']['portfwrd']['updPortForwarding'] = 'updPortForwarding';
f3f0161f 126$ophandler['object']['autoports']['generate'] = 'generateAutoPorts';
24cbe8af 127$ophandler['object']['tags']['save'] = 'saveObjectTags';
e673ee24 128
eebf9145 129$page['ipv4space']['title'] = 'IPv4 space';
e673ee24
DO
130$page['ipv4space']['parent'] = 'index';
131$tab['ipv4space']['default'] = 'Browse';
0bcdc163 132$tab['ipv4space']['newrange'] = 'Manage';
8b6ffe9c
DO
133$tabhandler['ipv4space']['default'] = 'renderAddressspace';
134$tabhandler['ipv4space']['newrange'] = 'renderAddNewRange';
e673ee24
DO
135$ophandler['ipv4space']['newrange']['addRange'] = 'addNewrange';
136$ophandler['ipv4space']['newrange']['delRange'] = 'delRange';
137
eebf9145 138$page['iprange']['title_handler'] = 'dynamic_title_iprange';
e673ee24
DO
139$page['iprange']['parent'] = 'ipv4space';
140$page['iprange']['bypass'] = 'id';
2fe5476a 141$page['iprange']['bypass_type'] = 'uint';
f9bc186f
DO
142$page['iprange']['autotagloader'] = 'loadIPv4PrefixAutoTags';
143$page['iprange']['tagloader'] = 'loadIPv4PrefixTags';
e673ee24
DO
144$tab['iprange']['default'] = 'Browse';
145$tab['iprange']['properties'] = 'Properties';
2fe5476a 146$tab['iprange']['liveptr'] = 'Live PTR';
2034d968 147$tab['iprange']['tags'] = 'Tags';
8b6ffe9c
DO
148$tabhandler['iprange']['default'] = 'renderIPRange';
149$tabhandler['iprange']['properties'] = 'renderIPRangeProperties';
2fe5476a 150$tabhandler['iprange']['liveptr'] = 'renderLivePTR';
2034d968
DO
151$tabhandler['iprange']['tags'] = 'renderIPv4PrefixTags';
152$trigger['iprange']['tags'] = 'trigger_tags';
e673ee24 153$ophandler['iprange']['properties']['editRange'] = 'editRange';
3f3bd41e 154$ophandler['iprange']['liveptr']['import'] = 'importPTRData';
2034d968 155$ophandler['iprange']['tags']['save'] = 'saveIPv4PrefixTags';
e673ee24 156
eebf9145 157$page['ipaddress']['title_handler'] = 'dynamic_title_ipaddress';
e673ee24
DO
158$page['ipaddress']['parent'] = 'iprange';
159$page['ipaddress']['bypass'] = 'ip';
d817ba03 160$page['ipaddress']['autotagloader'] = 'loadIPv4AddressAutoTags';
e673ee24
DO
161$tab['ipaddress']['default'] = 'Browse';
162$tab['ipaddress']['properties'] = 'Properties';
163$tab['ipaddress']['assignment'] = 'Allocation';
7e13adfe 164$tab['ipaddress']['editrslist'] = '[SLB real servers]';
8b6ffe9c
DO
165$tabhandler['ipaddress']['default'] = 'renderIPAddress';
166$tabhandler['ipaddress']['properties'] = 'renderIPAddressProperties';
167$tabhandler['ipaddress']['assignment'] = 'renderIPAddressAssignment';
e673ee24 168$ophandler['ipaddress']['properties']['editAddress'] = 'editAddress';
b4c1ef87
DO
169$ophandler['ipaddress']['assignment']['delIPv4Allocation'] = 'delIPv4Allocation';
170$ophandler['ipaddress']['assignment']['updIPv4Allocation'] = 'updIPv4Allocation';
171$ophandler['ipaddress']['assignment']['addIPv4Allocation'] = 'addIPv4Allocation';
e673ee24 172
f973f491
DO
173$page['ipv4slb']['title'] = 'IPv4 SLB';
174$page['ipv4slb']['parent'] = 'index';
175$page['ipv4slb']['handler'] = 'renderIPv4SLB';
176
b3c50e6c 177$page['vservices']['title'] = 'Virtual services';
f973f491 178$page['vservices']['parent'] = 'ipv4slb';
e57dca7f 179$tab['vservices']['default'] = 'View';
1183c73f 180$tab['vservices']['edit'] = 'Edit';
e57dca7f 181$tabhandler['vservices']['default'] = 'renderVSList';
1183c73f
DO
182$tabhandler['vservices']['edit'] = 'renderVSListEditForm';
183$ophandler['vservices']['edit']['add'] = 'addVService';
184$ophandler['vservices']['edit']['del'] = 'deleteVService';
185$ophandler['vservices']['edit']['upd'] = 'updateVService';
b3c50e6c 186
eebf9145 187$page['vservice']['title_handler'] = 'dynamic_title_vservice';
b3c50e6c 188$page['vservice']['parent'] = 'vservices';
c9b4588f
DO
189$page['vservice']['bypass'] = 'id';
190$page['vservice']['bypass_type'] = 'uint';
d817ba03
DO
191$page['vservice']['tagloader'] = 'loadIPv4VSTags';
192$page['vservice']['autotagloader'] = 'loadIPv4VSAutoTags';
3bab7445
DO
193$tab['vservice']['default'] = 'View';
194$tab['vservice']['edit'] = '[Edit]';
7e13adfe 195$tab['vservice']['editlblist'] = '[Load balancers]';
d817ba03 196$tab['vservice']['tags'] = 'Tags';
0bcdc163 197$tabhandler['vservice']['default'] = 'renderVirtualService';
5bbbeaa2
DO
198$tabhandler['vservice']['edit'] = 'renderEditVService';
199$tabhandler['vservice']['editlblist'] = 'renderEditLBsForVService';
d817ba03 200$tabhandler['vservice']['tags'] = 'renderIPv4VSTags';
1bfe7291 201$ophandler['vservice']['tags']['save'] = 'saveIPv4VSTags';
d817ba03 202$trigger['vservice']['tags'] = 'trigger_tags';
c9b4588f 203
9a81d416 204$page['rspools']['title'] = 'RS pools';
f973f491 205$page['rspools']['parent'] = 'ipv4slb';
9a81d416 206$tab['rspools']['default'] = 'View';
5ad76f01 207$tab['rspools']['edit'] = 'Edit';
9a81d416 208$tabhandler['rspools']['default'] = 'renderRSPoolList';
5ad76f01
DO
209$tabhandler['rspools']['edit'] = 'editRSPools';
210$ophandler['rspools']['edit']['add'] = 'addRSPool';
211$ophandler['rspools']['edit']['del'] = 'deleteRSPool';
212$ophandler['rspools']['edit']['upd'] = 'updateRSPool';
b3c50e6c 213
30aaee5a 214$page['rspool']['title_handler'] = 'dynamic_title_rspool';
b3c50e6c 215$page['rspool']['parent'] = 'rspools';
c0ae6968 216$page['rspool']['bypass'] = 'pool_id';
71b8bda1 217$page['rspool']['bypass_type'] = 'uint';
d817ba03
DO
218$page['rspool']['tagloader'] = 'loadIPv4RSPoolTags';
219$page['rspool']['autotagloader'] = 'loadIPv4RSPoolAutoTags';
71b8bda1 220$tab['rspool']['default'] = 'View';
0bcdc163 221$tab['rspool']['edit'] = '[Edit]';
3241551e 222$tab['rspool']['editlblist'] = 'Load Balancers';
1f7d18fa
DO
223$tab['rspool']['editrslist'] = 'RS list';
224$tab['rspool']['rsinservice'] = 'RS in service';
d817ba03 225$tab['rspool']['tags'] = 'Tags';
a785988f 226$trigger['rspool']['rsinservice'] = 'trigger_poolrscount';
d817ba03 227$trigger['rspool']['tags'] = 'trigger_tags';
71b8bda1 228$tabhandler['rspool']['default'] = 'renderRSPool';
5bbbeaa2 229$tabhandler['rspool']['edit'] = 'renderEditRSPool';
ca461127 230$tabhandler['rspool']['editrslist'] = 'renderRSPoolServerForm';
3241551e 231$tabhandler['rspool']['editlblist'] = 'renderRSPoolLBForm';
1f7d18fa 232$tabhandler['rspool']['rsinservice'] = 'renderRSPoolRSInServiceForm';
d817ba03 233$tabhandler['rspool']['tags'] = 'renderIPv4RSPoolTags';
ca461127 234$ophandler['rspool']['editrslist']['addRS'] = 'addRealServer';
fb1c4a54
DO
235$ophandler['rspool']['editrslist']['delRS'] = 'deleteRealServer';
236$ophandler['rspool']['editrslist']['updRS'] = 'updateRealServer';
732e4578 237$ophandler['rspool']['editrslist']['addMany'] = 'addRealServers';
3241551e
DO
238$ophandler['rspool']['editlblist']['addLB'] = 'addLoadBalancer';
239$ophandler['rspool']['editlblist']['delLB'] = 'deleteLoadBalancer';
240$ophandler['rspool']['editlblist']['updLB'] = 'updateLoadBalancer';
1f7d18fa 241$ophandler['rspool']['rsinservice']['upd'] = 'updateRSInService';
1bfe7291 242$ophandler['rspool']['tags']['save'] = 'saveIPv4RSPoolTags';
71b8bda1 243
8253d9f0 244$page['rservers']['title'] = 'Real servers';
f973f491 245$page['rservers']['parent'] = 'ipv4slb';
8253d9f0 246$page['rservers']['handler'] = 'renderRealServerList';
b3c50e6c 247
4b0932b6 248$page['lbs']['title'] = 'Load balancers';
f973f491 249$page['lbs']['parent'] = 'ipv4slb';
4b0932b6 250$page['lbs']['handler'] = 'renderLBList';
b3c50e6c 251
eebf9145 252$page['search']['title_handler'] = 'dynamic_title_search';
3aeb15f3 253$page['search']['handler'] = 'renderSearchResults';
e673ee24
DO
254$page['search']['parent'] = 'index';
255$page['search']['bypass'] = 'q';
256
eebf9145 257$page['config']['title'] = 'Configuration';
3aeb15f3 258$page['config']['handler'] = 'renderConfigMainpage';
e673ee24
DO
259$page['config']['parent'] = 'index';
260
eebf9145 261$page['accounts']['title'] = 'Accounts';
e673ee24
DO
262$page['accounts']['parent'] = 'config';
263$tab['accounts']['default'] = 'View';
264$tab['accounts']['edit'] = 'Change';
8b6ffe9c
DO
265$tabhandler['accounts']['default'] = 'renderAccounts';
266$tabhandler['accounts']['edit'] = 'renderAccountsEditForm';
e673ee24
DO
267$ophandler['accounts']['edit']['updateAccount'] = 'updateUserAccount';
268$ophandler['accounts']['edit']['createAccount'] = 'createUserAccount';
269$ophandler['accounts']['edit']['disableAccount'] = 'disableUserAccount';
270$ophandler['accounts']['edit']['enableAccount'] = 'enableUserAccount';
271
eebf9145 272$page['perms']['title'] = 'Permissions';
e673ee24
DO
273$page['perms']['parent'] = 'config';
274$tab['perms']['default'] = 'View';
275$tab['perms']['edit'] = 'Change';
8b6ffe9c
DO
276$tabhandler['perms']['default'] = 'renderPermissions';
277$tabhandler['perms']['edit'] = 'renderPermissionsEditForm';
e673ee24
DO
278$ophandler['perms']['edit']['revoke'] = 'revokePermission';
279$ophandler['perms']['edit']['grant'] = 'grantPermission';
280
eebf9145 281$page['portmap']['title'] = 'Port compatibility map';
e673ee24
DO
282$page['portmap']['parent'] = 'config';
283$tab['portmap']['default'] = 'View';
284$tab['portmap']['edit'] = 'Change';
17c32f4c
DO
285$tabhandler['portmap']['default'] = 'renderPortMapViewer';
286$tabhandler['portmap']['edit'] = 'renderPortMapEditor';
e673ee24
DO
287$ophandler['portmap']['edit']['save'] = 'savePortMap';
288
eebf9145 289$page['attrs']['title'] = 'Attributes';
e673ee24
DO
290$page['attrs']['parent'] = 'config';
291$tab['attrs']['default'] = 'View';
292$tab['attrs']['editattrs'] = 'Edit attributes';
293$tab['attrs']['editmap'] = 'Edit map';
8b6ffe9c
DO
294$tabhandler['attrs']['default'] = 'renderAttributes';
295$tabhandler['attrs']['editattrs'] = 'renderEditAttributesForm';
296$tabhandler['attrs']['editmap'] = 'renderEditAttrMapForm';
e673ee24
DO
297$ophandler['attrs']['editattrs']['add'] = 'createAttribute';
298$ophandler['attrs']['editattrs']['upd'] = 'changeAttribute';
299$ophandler['attrs']['editattrs']['del'] = 'deleteAttribute';
300$ophandler['attrs']['editmap']['add'] = 'supplementAttrMap';
301$ophandler['attrs']['editmap']['del'] = 'reduceAttrMap';
302
eebf9145 303$page['dict']['title'] = 'Dictionary';
e673ee24
DO
304$page['dict']['parent'] = 'config';
305$tab['dict']['default'] = 'View';
306$tab['dict']['edit'] = 'Edit words';
307$tab['dict']['chapters'] = 'Manage chapters';
8b6ffe9c
DO
308$tabhandler['dict']['default'] = 'renderDictionary';
309$tabhandler['dict']['edit'] = 'renderDictionaryEditor';
310$tabhandler['dict']['chapters'] = 'renderChaptersEditor';
e673ee24
DO
311$ophandler['dict']['edit']['del'] = 'reduceDictionary';
312$ophandler['dict']['edit']['upd'] = 'updateDictionary';
313$ophandler['dict']['edit']['add'] = 'supplementDictionary';
314$ophandler['dict']['chapters']['del'] = 'delChapter';
315$ophandler['dict']['chapters']['upd'] = 'updateChapter';
316$ophandler['dict']['chapters']['add'] = 'addChapter';
317
eebf9145 318$page['ui']['title'] = 'User interface';
e673ee24 319$page['ui']['parent'] = 'config';
0a1b1268 320$tab['ui']['default'] = 'View';
4fe32e78 321$tab['ui']['edit'] = 'Change';
b07f617c 322$tab['ui']['reset'] = 'Reset';
8b6ffe9c
DO
323$tabhandler['ui']['default'] = 'renderUIConfig';
324$tabhandler['ui']['edit'] = 'renderUIConfigEditForm';
325$tabhandler['ui']['reset'] = 'renderUIResetForm';
4fe32e78 326$ophandler['ui']['edit']['upd'] = 'updateUI';
b07f617c 327$ophandler['ui']['reset']['go'] = 'resetUIConfig';
e673ee24 328
931bf334
DO
329$page['tagtree']['title'] = 'Tag tree';
330$page['tagtree']['parent'] = 'config';
331$tab['tagtree']['default'] = 'View';
49fb1027 332$tab['tagtree']['edit'] = 'Edit';
931bf334
DO
333$tabhandler['tagtree']['default'] = 'renderTagTree';
334$tabhandler['tagtree']['edit'] = 'renderTagTreeEditor';
fe7044ad
DO
335$ophandler['tagtree']['edit']['destroyTag'] = 'destroyTag';
336$ophandler['tagtree']['edit']['createTag'] = 'createTag';
337$ophandler['tagtree']['edit']['updateTag'] = 'updateTag';
931bf334 338
eebf9145 339$page['reports']['title'] = 'Reports';
e673ee24 340$page['reports']['parent'] = 'index';
79a10049 341$page['reports']['handler'] = 'renderReportSummary';
e673ee24
DO
342
343// This function returns array if page numbers leading to the target page
344// plus page number of target page itself. The first element is the target
345// page number and the last element is the index page number.
346function getPath ($targetno)
347{
348 global $page;
349 $path = array();
350 // Recursion breaks at first parentless page.
351 if (!isset ($page[$targetno]['parent']))
352 $path = array ($targetno);
353 else
354 {
355 $path = getPath ($page[$targetno]['parent']);
356 $path[] = $targetno;
357 }
358 return $path;
359}
360
361function showPathAndSearch ($pageno)
362{
9c0b0016 363 global $root, $page;
e673ee24 364 // Path.
73635d32 365 echo "<td class=activemenuitem width='99%'>" . getConfigVar ('enterprise');
eebf9145
DO
366 $path = getPath ($pageno);
367 foreach ($path as $no)
e673ee24 368 {
eebf9145
DO
369 $title['params'] = array();
370 if (isset ($page[$no]['title']))
371 $title['name'] = $page[$no]['title'];
372 elseif (isset ($page[$no]['title_handler']))
373 $title = $page[$no]['title_handler']($no);
374 else
375 $title['name'] = '[N/A]';
376 echo ": <a href='${root}?page=${no}";
377 foreach ($title['params'] as $param_name => $param_value)
378 echo "&${param_name}=${param_value}";
379 echo "'>" . $title['name'] . "</a>";
e673ee24
DO
380 }
381 echo "</td>";
382 // Search form.
383 echo "<td><table border=0 cellpadding=0 cellspacing=0><tr><td>Search:</td>";
e09e31d5 384 echo "<form name=search method=get action='${root}'><td>";
e673ee24
DO
385 echo '<input type=hidden name=page value=search>';
386 // This input will be the first, if we don't add ports or addresses.
387 echo "<input type=text name=q size=20 tabindex=1000></td></form></tr></table></td>";
388}
389
390function getTitle ($pageno, $tabno)
391{
9c0b0016 392 global $page;
eebf9145
DO
393 if (isset ($page[$pageno]['title']))
394 return $page[$pageno]['title'];
395 elseif (isset ($page[$pageno]['title_handler']))
396 {
397 $tmp = $page[$pageno]['title_handler']($pageno);
398 return $tmp['name'];
399 }
400 else
9c0b0016 401 return getConfigVar ('enterprise');
e673ee24
DO
402}
403
404function showTabs ($pageno, $tabno)
405{
08b16bf5 406 global $tab, $root, $page, $remote_username, $trigger, $tabextraclass;
e673ee24
DO
407 if (!isset ($tab[$pageno]['default']))
408 return;
409 echo "<td><div class=greynavbar><ul id=foldertab style='margin-bottom: 0px; padding-top: 10px;'>";
410 foreach ($tab[$pageno] as $tabidx => $tabtitle)
411 {
412 // Hide forbidden tabs.
413 if (authorized ($remote_username, $pageno, $tabidx) == FALSE)
414 continue;
641fe9b0
DO
415 // Dynamic tabs should only be shown in certain cases (trigger exists and returns true).
416 if
417 (
418 isset ($trigger[$pageno][$tabidx]) &&
419 $trigger[$pageno][$tabidx] () != TRUE
420 )
421 continue;
08b16bf5
DO
422 $class = ($tabidx == $tabno) ? 'current' : 'std';
423 $extra = (isset ($tabextraclass[$pageno][$tabidx])) ? $tabextraclass[$pageno][$tabidx] : '';
424 echo "<li><a class=${class}{$extra}";
e673ee24
DO
425 echo " href='${root}?page=${pageno}&tab=${tabidx}";
426 if (isset ($page[$pageno]['bypass']) and isset ($_REQUEST[$page[$pageno]['bypass']]))
427 {
428 $bpname = $page[$pageno]['bypass'];
429 $bpval = $_REQUEST[$bpname];
430 echo "&${bpname}=${bpval}";
431 }
432 echo "'>${tabtitle}</a></li>\n";
433 }
434 echo "</ul></div></td>\n";
435}
436
437// This function returns pages, which are direct children of the requested
438// page and are accessible by the current user.
439function getDirectChildPages ($pageno)
440{
441 global $page, $remote_username;
442 $children = array();
443 foreach ($page as $cpageno => $cpage)
444 if
445 (
446 isset ($cpage['parent']) and
447 $cpage['parent'] == $pageno and
448 authorized ($remote_username, $cpageno, 'default') == TRUE
449 )
450 $children[$cpageno] = $cpage;
451 return $children;
452}
453
454function getAllChildPages ($parent)
455{
456 global $page;
457 // Array pointer is global, so if we don't create local copies of
458 // the global array, we can't advance any more after nested call
459 // of getAllChildPages returns.
460 $mypage = $page;
461 $mykids = array();
462 foreach ($mypage as $ctitle => $cpage)
463 if (isset ($cpage['parent']) and $cpage['parent'] == $parent)
464 $mykids[] = array ('title' => $ctitle, 'kids' => getAllChildPages ($ctitle));
465 return $mykids;
466}
467
468?>