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