r1898 + implement tag tree editor
[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';
31$tab['objects']['newobj'] = 'Add an object';
32$tab['objects']['newmulti'] = 'Add multiple objects';
7cc02fc1 33$tabhandler['objects']['default'] = 'renderObjectSpace';
8b6ffe9c
DO
34$tabhandler['objects']['newobj'] = 'renderNewObjectForm';
35$tabhandler['objects']['newmulti'] = 'renderAddMultipleObjectsForm';
e673ee24 36
eebf9145 37$page['row']['title_handler'] = 'dynamic_title_row';
e673ee24 38$page['row']['bypass'] = 'row_id';
8b6ffe9c 39$page['row']['bypass_type'] = 'uint';
e673ee24
DO
40$page['row']['parent'] = 'rackspace';
41$tab['row']['default'] = 'View';
42$tab['row']['newrack'] = 'Add new rack';
2f32cc32 43$tab['row']['tagroller'] = 'Tag roller';
8b6ffe9c
DO
44$tabhandler['row']['default'] = 'renderRow';
45$tabhandler['row']['newrack'] = 'renderNewRackForm';
2f32cc32 46$tabhandler['row']['tagroller'] = 'renderTagRollerForRow';
e673ee24 47
eebf9145 48$page['rack']['title_handler'] = 'dynamic_title_rack';
e673ee24 49$page['rack']['bypass'] = 'rack_id';
8b6ffe9c 50$page['rack']['bypass_type'] = 'uint';
e673ee24 51$page['rack']['parent'] = 'row';
41bd8c87
DO
52$page['rack']['tagloader'] = 'loadRackTags';
53$page['rack']['autotagloader'] = 'loadRackAutoTags';
e673ee24
DO
54$tab['rack']['default'] = 'View';
55$tab['rack']['edit'] = 'Properties';
56$tab['rack']['design'] = 'Design';
57$tab['rack']['problems'] = 'Problems';
41bd8c87 58$tab['rack']['tags'] = 'Tags';
8b6ffe9c
DO
59$tabhandler['rack']['default'] = 'renderRackPage';
60$tabhandler['rack']['edit'] = 'renderEditRackForm';
61$tabhandler['rack']['design'] = 'renderRackDesign';
62$tabhandler['rack']['problems'] = 'renderRackProblems';
41bd8c87
DO
63$tabhandler['rack']['tags'] = 'renderRackTags';
64$trigger['rack']['tags'] = 'trigger_tags';
65$ophandler['rack']['tags']['save'] = 'saveRackTags';
e673ee24 66
eebf9145 67$page['objgroup']['title_handler'] = 'dynamic_title_objgroup';
3aeb15f3 68$page['objgroup']['handler'] = 'renderObjectGroup';
e673ee24 69$page['objgroup']['bypass'] = 'group_id';
105cea6e 70$page['objgroup']['bypass_type'] = 'uint0';
e673ee24
DO
71$page['objgroup']['parent'] = 'objects';
72
eebf9145 73$page['object']['title_handler'] = 'dynamic_title_object';
e673ee24 74$page['object']['bypass'] = 'object_id';
3bebaebd 75$page['object']['bypass_type'] = 'uint';
e673ee24 76$page['object']['parent'] = 'objgroup';
2fb24351
DO
77$page['object']['tagloader'] = 'loadRackObjectTags';
78$page['object']['autotagloader'] = 'loadRackObjectAutoTags';
e673ee24
DO
79$tab['object']['default'] = 'View';
80$tab['object']['edit'] = 'Properties';
81$tab['object']['rackspace'] = 'Rackspace';
82$tab['object']['ports'] = 'Ports';
83$tab['object']['network'] = 'IPv4';
737f9ac1 84$tab['object']['portfwrd'] = 'NATv4';
a684aa6f 85$tab['object']['switchvlans'] = 'Live VLANs';
9c67f713 86$tab['object']['snmpportfinder'] = 'SNMP port finder';
7e13adfe 87$tab['object']['slb'] = '[SLB]';
3ee1252b 88$tab['object']['lvsconfig'] = 'LVS configuration';
118e4c38 89$tab['object']['autoports'] = 'AutoPorts';
2fb24351 90$tab['object']['tags'] = 'Tags';
e45a78d7
DO
91$tabhandler['object']['default'] = 'renderRackObject';
92$tabhandler['object']['edit'] = 'renderEditObjectForm';
93$tabhandler['object']['rackspace'] = 'renderRackSpaceForObject';
94$tabhandler['object']['ports'] = 'renderPortsForObject';
95$tabhandler['object']['network'] = 'renderNetworkForObject';
eeb4a5d8 96$tabhandler['object']['portfwrd'] = 'renderNATv4ForObject';
e45a78d7
DO
97$tabhandler['object']['switchvlans'] = 'renderVLANMembership';
98$tabhandler['object']['snmpportfinder'] = 'renderSNMPPortFinder';
3ee1252b 99$tabhandler['object']['lvsconfig'] = 'renderLVSConfig';
118e4c38 100$tabhandler['object']['autoports'] = 'renderAutoPortsForm';
2fb24351 101$tabhandler['object']['tags'] = 'renderObjectTags';
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';
119$ophandler['object']['network']['editAddressFromObject'] = 'editAddressFromObject';
120$ophandler['object']['network']['addAddrFObj'] = 'addAddressToObject';
121$ophandler['object']['network']['delAddrFObj'] = 'delAddressFromObject';
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';
e673ee24
DO
136$ophandler['ipv4space']['newrange']['addRange'] = 'addNewrange';
137$ophandler['ipv4space']['newrange']['delRange'] = 'delRange';
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
DO
169$ophandler['ipaddress']['properties']['editAddress'] = 'editAddress';
170$ophandler['ipaddress']['assignment']['delIpAssignment'] = 'delIpAssignment';
171$ophandler['ipaddress']['assignment']['editBondForAddress'] = 'editIpAssignment';
172$ophandler['ipaddress']['assignment']['bindObjectToIp'] = 'addIpAssignment';
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';
d817ba03 199$tabhandler['vservice']['tags'] = 'renderIPv4VSTags';
1bfe7291 200$ophandler['vservice']['tags']['save'] = 'saveIPv4VSTags';
d817ba03 201$trigger['vservice']['tags'] = 'trigger_tags';
c9b4588f 202
9a81d416 203$page['rspools']['title'] = 'RS pools';
f973f491 204$page['rspools']['parent'] = 'ipv4slb';
9a81d416 205$tab['rspools']['default'] = 'View';
5ad76f01 206$tab['rspools']['edit'] = 'Edit';
9a81d416 207$tabhandler['rspools']['default'] = 'renderRSPoolList';
5ad76f01
DO
208$tabhandler['rspools']['edit'] = 'editRSPools';
209$ophandler['rspools']['edit']['add'] = 'addRSPool';
210$ophandler['rspools']['edit']['del'] = 'deleteRSPool';
211$ophandler['rspools']['edit']['upd'] = 'updateRSPool';
b3c50e6c 212
30aaee5a 213$page['rspool']['title_handler'] = 'dynamic_title_rspool';
b3c50e6c 214$page['rspool']['parent'] = 'rspools';
c0ae6968 215$page['rspool']['bypass'] = 'pool_id';
71b8bda1 216$page['rspool']['bypass_type'] = 'uint';
d817ba03
DO
217$page['rspool']['tagloader'] = 'loadIPv4RSPoolTags';
218$page['rspool']['autotagloader'] = 'loadIPv4RSPoolAutoTags';
71b8bda1 219$tab['rspool']['default'] = 'View';
0bcdc163 220$tab['rspool']['edit'] = '[Edit]';
3241551e 221$tab['rspool']['editlblist'] = 'Load Balancers';
1f7d18fa
DO
222$tab['rspool']['editrslist'] = 'RS list';
223$tab['rspool']['rsinservice'] = 'RS in service';
d817ba03 224$tab['rspool']['tags'] = 'Tags';
a785988f 225$trigger['rspool']['rsinservice'] = 'trigger_poolrscount';
d817ba03 226$trigger['rspool']['tags'] = 'trigger_tags';
71b8bda1 227$tabhandler['rspool']['default'] = 'renderRSPool';
ca461127 228$tabhandler['rspool']['editrslist'] = 'renderRSPoolServerForm';
3241551e 229$tabhandler['rspool']['editlblist'] = 'renderRSPoolLBForm';
1f7d18fa 230$tabhandler['rspool']['rsinservice'] = 'renderRSPoolRSInServiceForm';
d817ba03 231$tabhandler['rspool']['tags'] = 'renderIPv4RSPoolTags';
ca461127 232$ophandler['rspool']['editrslist']['addRS'] = 'addRealServer';
fb1c4a54
DO
233$ophandler['rspool']['editrslist']['delRS'] = 'deleteRealServer';
234$ophandler['rspool']['editrslist']['updRS'] = 'updateRealServer';
732e4578 235$ophandler['rspool']['editrslist']['addMany'] = 'addRealServers';
3241551e
DO
236$ophandler['rspool']['editlblist']['addLB'] = 'addLoadBalancer';
237$ophandler['rspool']['editlblist']['delLB'] = 'deleteLoadBalancer';
238$ophandler['rspool']['editlblist']['updLB'] = 'updateLoadBalancer';
1f7d18fa 239$ophandler['rspool']['rsinservice']['upd'] = 'updateRSInService';
1bfe7291 240$ophandler['rspool']['tags']['save'] = 'saveIPv4RSPoolTags';
71b8bda1 241
8253d9f0 242$page['rservers']['title'] = 'Real servers';
f973f491 243$page['rservers']['parent'] = 'ipv4slb';
8253d9f0 244$page['rservers']['handler'] = 'renderRealServerList';
b3c50e6c 245
4b0932b6 246$page['lbs']['title'] = 'Load balancers';
f973f491 247$page['lbs']['parent'] = 'ipv4slb';
4b0932b6 248$page['lbs']['handler'] = 'renderLBList';
b3c50e6c 249
eebf9145 250$page['search']['title_handler'] = 'dynamic_title_search';
3aeb15f3 251$page['search']['handler'] = 'renderSearchResults';
e673ee24
DO
252$page['search']['parent'] = 'index';
253$page['search']['bypass'] = 'q';
254
eebf9145 255$page['config']['title'] = 'Configuration';
3aeb15f3 256$page['config']['handler'] = 'renderConfigMainpage';
e673ee24
DO
257$page['config']['parent'] = 'index';
258
eebf9145 259$page['accounts']['title'] = 'Accounts';
e673ee24
DO
260$page['accounts']['parent'] = 'config';
261$tab['accounts']['default'] = 'View';
262$tab['accounts']['edit'] = 'Change';
8b6ffe9c
DO
263$tabhandler['accounts']['default'] = 'renderAccounts';
264$tabhandler['accounts']['edit'] = 'renderAccountsEditForm';
e673ee24
DO
265$ophandler['accounts']['edit']['updateAccount'] = 'updateUserAccount';
266$ophandler['accounts']['edit']['createAccount'] = 'createUserAccount';
267$ophandler['accounts']['edit']['disableAccount'] = 'disableUserAccount';
268$ophandler['accounts']['edit']['enableAccount'] = 'enableUserAccount';
269
eebf9145 270$page['perms']['title'] = 'Permissions';
e673ee24
DO
271$page['perms']['parent'] = 'config';
272$tab['perms']['default'] = 'View';
273$tab['perms']['edit'] = 'Change';
8b6ffe9c
DO
274$tabhandler['perms']['default'] = 'renderPermissions';
275$tabhandler['perms']['edit'] = 'renderPermissionsEditForm';
e673ee24
DO
276$ophandler['perms']['edit']['revoke'] = 'revokePermission';
277$ophandler['perms']['edit']['grant'] = 'grantPermission';
278
eebf9145 279$page['portmap']['title'] = 'Port compatibility map';
e673ee24
DO
280$page['portmap']['parent'] = 'config';
281$tab['portmap']['default'] = 'View';
282$tab['portmap']['edit'] = 'Change';
17c32f4c
DO
283$tabhandler['portmap']['default'] = 'renderPortMapViewer';
284$tabhandler['portmap']['edit'] = 'renderPortMapEditor';
e673ee24
DO
285$ophandler['portmap']['edit']['save'] = 'savePortMap';
286
eebf9145 287$page['attrs']['title'] = 'Attributes';
e673ee24
DO
288$page['attrs']['parent'] = 'config';
289$tab['attrs']['default'] = 'View';
290$tab['attrs']['editattrs'] = 'Edit attributes';
291$tab['attrs']['editmap'] = 'Edit map';
8b6ffe9c
DO
292$tabhandler['attrs']['default'] = 'renderAttributes';
293$tabhandler['attrs']['editattrs'] = 'renderEditAttributesForm';
294$tabhandler['attrs']['editmap'] = 'renderEditAttrMapForm';
e673ee24
DO
295$ophandler['attrs']['editattrs']['add'] = 'createAttribute';
296$ophandler['attrs']['editattrs']['upd'] = 'changeAttribute';
297$ophandler['attrs']['editattrs']['del'] = 'deleteAttribute';
298$ophandler['attrs']['editmap']['add'] = 'supplementAttrMap';
299$ophandler['attrs']['editmap']['del'] = 'reduceAttrMap';
300
eebf9145 301$page['dict']['title'] = 'Dictionary';
e673ee24
DO
302$page['dict']['parent'] = 'config';
303$tab['dict']['default'] = 'View';
304$tab['dict']['edit'] = 'Edit words';
305$tab['dict']['chapters'] = 'Manage chapters';
8b6ffe9c
DO
306$tabhandler['dict']['default'] = 'renderDictionary';
307$tabhandler['dict']['edit'] = 'renderDictionaryEditor';
308$tabhandler['dict']['chapters'] = 'renderChaptersEditor';
e673ee24
DO
309$ophandler['dict']['edit']['del'] = 'reduceDictionary';
310$ophandler['dict']['edit']['upd'] = 'updateDictionary';
311$ophandler['dict']['edit']['add'] = 'supplementDictionary';
312$ophandler['dict']['chapters']['del'] = 'delChapter';
313$ophandler['dict']['chapters']['upd'] = 'updateChapter';
314$ophandler['dict']['chapters']['add'] = 'addChapter';
315
eebf9145 316$page['ui']['title'] = 'User interface';
e673ee24 317$page['ui']['parent'] = 'config';
0a1b1268 318$tab['ui']['default'] = 'View';
4fe32e78 319$tab['ui']['edit'] = 'Change';
b07f617c 320$tab['ui']['reset'] = 'Reset';
8b6ffe9c
DO
321$tabhandler['ui']['default'] = 'renderUIConfig';
322$tabhandler['ui']['edit'] = 'renderUIConfigEditForm';
323$tabhandler['ui']['reset'] = 'renderUIResetForm';
4fe32e78 324$ophandler['ui']['edit']['upd'] = 'updateUI';
b07f617c 325$ophandler['ui']['reset']['go'] = 'resetUIConfig';
e673ee24 326
931bf334
DO
327$page['tagtree']['title'] = 'Tag tree';
328$page['tagtree']['parent'] = 'config';
329$tab['tagtree']['default'] = 'View';
49fb1027 330$tab['tagtree']['edit'] = 'Edit';
931bf334
DO
331$tabhandler['tagtree']['default'] = 'renderTagTree';
332$tabhandler['tagtree']['edit'] = 'renderTagTreeEditor';
fe7044ad
DO
333$ophandler['tagtree']['edit']['destroyTag'] = 'destroyTag';
334$ophandler['tagtree']['edit']['createTag'] = 'createTag';
335$ophandler['tagtree']['edit']['updateTag'] = 'updateTag';
931bf334 336
eebf9145 337$page['reports']['title'] = 'Reports';
e673ee24 338$page['reports']['parent'] = 'index';
79a10049 339$page['reports']['handler'] = 'renderReportSummary';
e673ee24
DO
340
341// This function returns array if page numbers leading to the target page
342// plus page number of target page itself. The first element is the target
343// page number and the last element is the index page number.
344function getPath ($targetno)
345{
346 global $page;
347 $path = array();
348 // Recursion breaks at first parentless page.
349 if (!isset ($page[$targetno]['parent']))
350 $path = array ($targetno);
351 else
352 {
353 $path = getPath ($page[$targetno]['parent']);
354 $path[] = $targetno;
355 }
356 return $path;
357}
358
359function showPathAndSearch ($pageno)
360{
9c0b0016 361 global $root, $page;
e673ee24 362 // Path.
73635d32 363 echo "<td class=activemenuitem width='99%'>" . getConfigVar ('enterprise');
eebf9145
DO
364 $path = getPath ($pageno);
365 foreach ($path as $no)
e673ee24 366 {
eebf9145
DO
367 $title['params'] = array();
368 if (isset ($page[$no]['title']))
369 $title['name'] = $page[$no]['title'];
370 elseif (isset ($page[$no]['title_handler']))
371 $title = $page[$no]['title_handler']($no);
372 else
373 $title['name'] = '[N/A]';
374 echo ": <a href='${root}?page=${no}";
375 foreach ($title['params'] as $param_name => $param_value)
376 echo "&${param_name}=${param_value}";
377 echo "'>" . $title['name'] . "</a>";
e673ee24
DO
378 }
379 echo "</td>";
380 // Search form.
381 echo "<td><table border=0 cellpadding=0 cellspacing=0><tr><td>Search:</td>";
e09e31d5 382 echo "<form name=search method=get action='${root}'><td>";
e673ee24
DO
383 echo '<input type=hidden name=page value=search>';
384 // This input will be the first, if we don't add ports or addresses.
385 echo "<input type=text name=q size=20 tabindex=1000></td></form></tr></table></td>";
386}
387
388function getTitle ($pageno, $tabno)
389{
9c0b0016 390 global $page;
eebf9145
DO
391 if (isset ($page[$pageno]['title']))
392 return $page[$pageno]['title'];
393 elseif (isset ($page[$pageno]['title_handler']))
394 {
395 $tmp = $page[$pageno]['title_handler']($pageno);
396 return $tmp['name'];
397 }
398 else
9c0b0016 399 return getConfigVar ('enterprise');
e673ee24
DO
400}
401
402function showTabs ($pageno, $tabno)
403{
08b16bf5 404 global $tab, $root, $page, $remote_username, $trigger, $tabextraclass;
e673ee24
DO
405 if (!isset ($tab[$pageno]['default']))
406 return;
407 echo "<td><div class=greynavbar><ul id=foldertab style='margin-bottom: 0px; padding-top: 10px;'>";
408 foreach ($tab[$pageno] as $tabidx => $tabtitle)
409 {
410 // Hide forbidden tabs.
411 if (authorized ($remote_username, $pageno, $tabidx) == FALSE)
412 continue;
641fe9b0
DO
413 // Dynamic tabs should only be shown in certain cases (trigger exists and returns true).
414 if
415 (
416 isset ($trigger[$pageno][$tabidx]) &&
417 $trigger[$pageno][$tabidx] () != TRUE
418 )
419 continue;
08b16bf5
DO
420 $class = ($tabidx == $tabno) ? 'current' : 'std';
421 $extra = (isset ($tabextraclass[$pageno][$tabidx])) ? $tabextraclass[$pageno][$tabidx] : '';
422 echo "<li><a class=${class}{$extra}";
e673ee24
DO
423 echo " href='${root}?page=${pageno}&tab=${tabidx}";
424 if (isset ($page[$pageno]['bypass']) and isset ($_REQUEST[$page[$pageno]['bypass']]))
425 {
426 $bpname = $page[$pageno]['bypass'];
427 $bpval = $_REQUEST[$bpname];
428 echo "&${bpname}=${bpval}";
429 }
430 echo "'>${tabtitle}</a></li>\n";
431 }
432 echo "</ul></div></td>\n";
433}
434
435// This function returns pages, which are direct children of the requested
436// page and are accessible by the current user.
437function getDirectChildPages ($pageno)
438{
439 global $page, $remote_username;
440 $children = array();
441 foreach ($page as $cpageno => $cpage)
442 if
443 (
444 isset ($cpage['parent']) and
445 $cpage['parent'] == $pageno and
446 authorized ($remote_username, $cpageno, 'default') == TRUE
447 )
448 $children[$cpageno] = $cpage;
449 return $children;
450}
451
452function getAllChildPages ($parent)
453{
454 global $page;
455 // Array pointer is global, so if we don't create local copies of
456 // the global array, we can't advance any more after nested call
457 // of getAllChildPages returns.
458 $mypage = $page;
459 $mykids = array();
460 foreach ($mypage as $ctitle => $cpage)
461 if (isset ($cpage['parent']) and $cpage['parent'] == $parent)
462 $mykids[] = array ('title' => $ctitle, 'kids' => getAllChildPages ($ctitle));
463 return $mykids;
464}
465
466?>