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