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