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