r1815 + remove the only tab from reports framework
[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';
159$tab['ipaddress']['default'] = 'Browse';
160$tab['ipaddress']['properties'] = 'Properties';
161$tab['ipaddress']['assignment'] = 'Allocation';
7e13adfe 162$tab['ipaddress']['editrslist'] = '[SLB real servers]';
8b6ffe9c
DO
163$tabhandler['ipaddress']['default'] = 'renderIPAddress';
164$tabhandler['ipaddress']['properties'] = 'renderIPAddressProperties';
165$tabhandler['ipaddress']['assignment'] = 'renderIPAddressAssignment';
e673ee24
DO
166$ophandler['ipaddress']['properties']['editAddress'] = 'editAddress';
167$ophandler['ipaddress']['assignment']['delIpAssignment'] = 'delIpAssignment';
168$ophandler['ipaddress']['assignment']['editBondForAddress'] = 'editIpAssignment';
169$ophandler['ipaddress']['assignment']['bindObjectToIp'] = 'addIpAssignment';
170
f973f491
DO
171$page['ipv4slb']['title'] = 'IPv4 SLB';
172$page['ipv4slb']['parent'] = 'index';
173$page['ipv4slb']['handler'] = 'renderIPv4SLB';
174
b3c50e6c 175$page['vservices']['title'] = 'Virtual services';
f973f491 176$page['vservices']['parent'] = 'ipv4slb';
e57dca7f 177$tab['vservices']['default'] = 'View';
1183c73f 178$tab['vservices']['edit'] = 'Edit';
e57dca7f 179$tabhandler['vservices']['default'] = 'renderVSList';
1183c73f
DO
180$tabhandler['vservices']['edit'] = 'renderVSListEditForm';
181$ophandler['vservices']['edit']['add'] = 'addVService';
182$ophandler['vservices']['edit']['del'] = 'deleteVService';
183$ophandler['vservices']['edit']['upd'] = 'updateVService';
b3c50e6c 184
eebf9145 185$page['vservice']['title_handler'] = 'dynamic_title_vservice';
b3c50e6c 186$page['vservice']['parent'] = 'vservices';
c9b4588f
DO
187$page['vservice']['bypass'] = 'id';
188$page['vservice']['bypass_type'] = 'uint';
3bab7445
DO
189$tab['vservice']['default'] = 'View';
190$tab['vservice']['edit'] = '[Edit]';
7e13adfe 191$tab['vservice']['editlblist'] = '[Load balancers]';
0bcdc163 192$tabhandler['vservice']['default'] = 'renderVirtualService';
c9b4588f 193
9a81d416 194$page['rspools']['title'] = 'RS pools';
f973f491 195$page['rspools']['parent'] = 'ipv4slb';
9a81d416 196$tab['rspools']['default'] = 'View';
5ad76f01 197$tab['rspools']['edit'] = 'Edit';
9a81d416 198$tabhandler['rspools']['default'] = 'renderRSPoolList';
5ad76f01
DO
199$tabhandler['rspools']['edit'] = 'editRSPools';
200$ophandler['rspools']['edit']['add'] = 'addRSPool';
201$ophandler['rspools']['edit']['del'] = 'deleteRSPool';
202$ophandler['rspools']['edit']['upd'] = 'updateRSPool';
b3c50e6c 203
30aaee5a 204$page['rspool']['title_handler'] = 'dynamic_title_rspool';
b3c50e6c 205$page['rspool']['parent'] = 'rspools';
71b8bda1
DO
206$page['rspool']['bypass'] = 'id';
207$page['rspool']['bypass_type'] = 'uint';
208$tab['rspool']['default'] = 'View';
0bcdc163 209$tab['rspool']['edit'] = '[Edit]';
3241551e 210$tab['rspool']['editlblist'] = 'Load Balancers';
1f7d18fa
DO
211$tab['rspool']['editrslist'] = 'RS list';
212$tab['rspool']['rsinservice'] = 'RS in service';
a785988f 213$trigger['rspool']['rsinservice'] = 'trigger_poolrscount';
71b8bda1 214$tabhandler['rspool']['default'] = 'renderRSPool';
ca461127 215$tabhandler['rspool']['editrslist'] = 'renderRSPoolServerForm';
3241551e 216$tabhandler['rspool']['editlblist'] = 'renderRSPoolLBForm';
1f7d18fa 217$tabhandler['rspool']['rsinservice'] = 'renderRSPoolRSInServiceForm';
ca461127 218$ophandler['rspool']['editrslist']['addRS'] = 'addRealServer';
fb1c4a54
DO
219$ophandler['rspool']['editrslist']['delRS'] = 'deleteRealServer';
220$ophandler['rspool']['editrslist']['updRS'] = 'updateRealServer';
732e4578 221$ophandler['rspool']['editrslist']['addMany'] = 'addRealServers';
3241551e
DO
222$ophandler['rspool']['editlblist']['addLB'] = 'addLoadBalancer';
223$ophandler['rspool']['editlblist']['delLB'] = 'deleteLoadBalancer';
224$ophandler['rspool']['editlblist']['updLB'] = 'updateLoadBalancer';
1f7d18fa 225$ophandler['rspool']['rsinservice']['upd'] = 'updateRSInService';
71b8bda1 226
8253d9f0 227$page['rservers']['title'] = 'Real servers';
f973f491 228$page['rservers']['parent'] = 'ipv4slb';
8253d9f0 229$page['rservers']['handler'] = 'renderRealServerList';
b3c50e6c 230
4b0932b6 231$page['lbs']['title'] = 'Load balancers';
f973f491 232$page['lbs']['parent'] = 'ipv4slb';
4b0932b6 233$page['lbs']['handler'] = 'renderLBList';
b3c50e6c 234
eebf9145 235$page['search']['title_handler'] = 'dynamic_title_search';
3aeb15f3 236$page['search']['handler'] = 'renderSearchResults';
e673ee24
DO
237$page['search']['parent'] = 'index';
238$page['search']['bypass'] = 'q';
239
eebf9145 240$page['config']['title'] = 'Configuration';
3aeb15f3 241$page['config']['handler'] = 'renderConfigMainpage';
e673ee24
DO
242$page['config']['parent'] = 'index';
243
eebf9145 244$page['accounts']['title'] = 'Accounts';
e673ee24
DO
245$page['accounts']['parent'] = 'config';
246$tab['accounts']['default'] = 'View';
247$tab['accounts']['edit'] = 'Change';
8b6ffe9c
DO
248$tabhandler['accounts']['default'] = 'renderAccounts';
249$tabhandler['accounts']['edit'] = 'renderAccountsEditForm';
e673ee24
DO
250$ophandler['accounts']['edit']['updateAccount'] = 'updateUserAccount';
251$ophandler['accounts']['edit']['createAccount'] = 'createUserAccount';
252$ophandler['accounts']['edit']['disableAccount'] = 'disableUserAccount';
253$ophandler['accounts']['edit']['enableAccount'] = 'enableUserAccount';
254
eebf9145 255$page['perms']['title'] = 'Permissions';
e673ee24
DO
256$page['perms']['parent'] = 'config';
257$tab['perms']['default'] = 'View';
258$tab['perms']['edit'] = 'Change';
8b6ffe9c
DO
259$tabhandler['perms']['default'] = 'renderPermissions';
260$tabhandler['perms']['edit'] = 'renderPermissionsEditForm';
e673ee24
DO
261$ophandler['perms']['edit']['revoke'] = 'revokePermission';
262$ophandler['perms']['edit']['grant'] = 'grantPermission';
263
eebf9145 264$page['portmap']['title'] = 'Port compatibility map';
e673ee24
DO
265$page['portmap']['parent'] = 'config';
266$tab['portmap']['default'] = 'View';
267$tab['portmap']['edit'] = 'Change';
17c32f4c
DO
268$tabhandler['portmap']['default'] = 'renderPortMapViewer';
269$tabhandler['portmap']['edit'] = 'renderPortMapEditor';
e673ee24
DO
270$ophandler['portmap']['edit']['save'] = 'savePortMap';
271
eebf9145 272$page['attrs']['title'] = 'Attributes';
e673ee24
DO
273$page['attrs']['parent'] = 'config';
274$tab['attrs']['default'] = 'View';
275$tab['attrs']['editattrs'] = 'Edit attributes';
276$tab['attrs']['editmap'] = 'Edit map';
8b6ffe9c
DO
277$tabhandler['attrs']['default'] = 'renderAttributes';
278$tabhandler['attrs']['editattrs'] = 'renderEditAttributesForm';
279$tabhandler['attrs']['editmap'] = 'renderEditAttrMapForm';
e673ee24
DO
280$ophandler['attrs']['editattrs']['add'] = 'createAttribute';
281$ophandler['attrs']['editattrs']['upd'] = 'changeAttribute';
282$ophandler['attrs']['editattrs']['del'] = 'deleteAttribute';
283$ophandler['attrs']['editmap']['add'] = 'supplementAttrMap';
284$ophandler['attrs']['editmap']['del'] = 'reduceAttrMap';
285
eebf9145 286$page['dict']['title'] = 'Dictionary';
e673ee24
DO
287$page['dict']['parent'] = 'config';
288$tab['dict']['default'] = 'View';
289$tab['dict']['edit'] = 'Edit words';
290$tab['dict']['chapters'] = 'Manage chapters';
8b6ffe9c
DO
291$tabhandler['dict']['default'] = 'renderDictionary';
292$tabhandler['dict']['edit'] = 'renderDictionaryEditor';
293$tabhandler['dict']['chapters'] = 'renderChaptersEditor';
e673ee24
DO
294$ophandler['dict']['edit']['del'] = 'reduceDictionary';
295$ophandler['dict']['edit']['upd'] = 'updateDictionary';
296$ophandler['dict']['edit']['add'] = 'supplementDictionary';
297$ophandler['dict']['chapters']['del'] = 'delChapter';
298$ophandler['dict']['chapters']['upd'] = 'updateChapter';
299$ophandler['dict']['chapters']['add'] = 'addChapter';
300
eebf9145 301$page['ui']['title'] = 'User interface';
e673ee24 302$page['ui']['parent'] = 'config';
0a1b1268 303$tab['ui']['default'] = 'View';
4fe32e78 304$tab['ui']['edit'] = 'Change';
b07f617c 305$tab['ui']['reset'] = 'Reset';
8b6ffe9c
DO
306$tabhandler['ui']['default'] = 'renderUIConfig';
307$tabhandler['ui']['edit'] = 'renderUIConfigEditForm';
308$tabhandler['ui']['reset'] = 'renderUIResetForm';
4fe32e78 309$ophandler['ui']['edit']['upd'] = 'updateUI';
b07f617c 310$ophandler['ui']['reset']['go'] = 'resetUIConfig';
e673ee24 311
931bf334
DO
312$page['tagtree']['title'] = 'Tag tree';
313$page['tagtree']['parent'] = 'config';
314$tab['tagtree']['default'] = 'View';
315$tab['tagtree']['edit'] = 'Change';
316$tabhandler['tagtree']['default'] = 'renderTagTree';
317$tabhandler['tagtree']['edit'] = 'renderTagTreeEditor';
fe7044ad
DO
318$ophandler['tagtree']['edit']['destroyTag'] = 'destroyTag';
319$ophandler['tagtree']['edit']['createTag'] = 'createTag';
320$ophandler['tagtree']['edit']['updateTag'] = 'updateTag';
931bf334 321
eebf9145 322$page['reports']['title'] = 'Reports';
e673ee24 323$page['reports']['parent'] = 'index';
79a10049 324$page['reports']['handler'] = 'renderReportSummary';
e673ee24
DO
325
326// This function returns array if page numbers leading to the target page
327// plus page number of target page itself. The first element is the target
328// page number and the last element is the index page number.
329function getPath ($targetno)
330{
331 global $page;
332 $path = array();
333 // Recursion breaks at first parentless page.
334 if (!isset ($page[$targetno]['parent']))
335 $path = array ($targetno);
336 else
337 {
338 $path = getPath ($page[$targetno]['parent']);
339 $path[] = $targetno;
340 }
341 return $path;
342}
343
344function showPathAndSearch ($pageno)
345{
9c0b0016 346 global $root, $page;
e673ee24 347 // Path.
73635d32 348 echo "<td class=activemenuitem width='99%'>" . getConfigVar ('enterprise');
eebf9145
DO
349 $path = getPath ($pageno);
350 foreach ($path as $no)
e673ee24 351 {
eebf9145
DO
352 $title['params'] = array();
353 if (isset ($page[$no]['title']))
354 $title['name'] = $page[$no]['title'];
355 elseif (isset ($page[$no]['title_handler']))
356 $title = $page[$no]['title_handler']($no);
357 else
358 $title['name'] = '[N/A]';
359 echo ": <a href='${root}?page=${no}";
360 foreach ($title['params'] as $param_name => $param_value)
361 echo "&${param_name}=${param_value}";
362 echo "'>" . $title['name'] . "</a>";
e673ee24
DO
363 }
364 echo "</td>";
365 // Search form.
366 echo "<td><table border=0 cellpadding=0 cellspacing=0><tr><td>Search:</td>";
367 echo "<form method=get action='${root}'><td>";
368 echo '<input type=hidden name=page value=search>';
369 // This input will be the first, if we don't add ports or addresses.
370 echo "<input type=text name=q size=20 tabindex=1000></td></form></tr></table></td>";
371}
372
373function getTitle ($pageno, $tabno)
374{
9c0b0016 375 global $page;
eebf9145
DO
376 if (isset ($page[$pageno]['title']))
377 return $page[$pageno]['title'];
378 elseif (isset ($page[$pageno]['title_handler']))
379 {
380 $tmp = $page[$pageno]['title_handler']($pageno);
381 return $tmp['name'];
382 }
383 else
9c0b0016 384 return getConfigVar ('enterprise');
e673ee24
DO
385}
386
387function showTabs ($pageno, $tabno)
388{
08b16bf5 389 global $tab, $root, $page, $remote_username, $trigger, $tabextraclass;
e673ee24
DO
390 if (!isset ($tab[$pageno]['default']))
391 return;
392 echo "<td><div class=greynavbar><ul id=foldertab style='margin-bottom: 0px; padding-top: 10px;'>";
393 foreach ($tab[$pageno] as $tabidx => $tabtitle)
394 {
395 // Hide forbidden tabs.
396 if (authorized ($remote_username, $pageno, $tabidx) == FALSE)
397 continue;
641fe9b0
DO
398 // Dynamic tabs should only be shown in certain cases (trigger exists and returns true).
399 if
400 (
401 isset ($trigger[$pageno][$tabidx]) &&
402 $trigger[$pageno][$tabidx] () != TRUE
403 )
404 continue;
08b16bf5
DO
405 $class = ($tabidx == $tabno) ? 'current' : 'std';
406 $extra = (isset ($tabextraclass[$pageno][$tabidx])) ? $tabextraclass[$pageno][$tabidx] : '';
407 echo "<li><a class=${class}{$extra}";
e673ee24
DO
408 echo " href='${root}?page=${pageno}&tab=${tabidx}";
409 if (isset ($page[$pageno]['bypass']) and isset ($_REQUEST[$page[$pageno]['bypass']]))
410 {
411 $bpname = $page[$pageno]['bypass'];
412 $bpval = $_REQUEST[$bpname];
413 echo "&${bpname}=${bpval}";
414 }
415 echo "'>${tabtitle}</a></li>\n";
416 }
417 echo "</ul></div></td>\n";
418}
419
420// This function returns pages, which are direct children of the requested
421// page and are accessible by the current user.
422function getDirectChildPages ($pageno)
423{
424 global $page, $remote_username;
425 $children = array();
426 foreach ($page as $cpageno => $cpage)
427 if
428 (
429 isset ($cpage['parent']) and
430 $cpage['parent'] == $pageno and
431 authorized ($remote_username, $cpageno, 'default') == TRUE
432 )
433 $children[$cpageno] = $cpage;
434 return $children;
435}
436
437function getAllChildPages ($parent)
438{
439 global $page;
440 // Array pointer is global, so if we don't create local copies of
441 // the global array, we can't advance any more after nested call
442 // of getAllChildPages returns.
443 $mypage = $page;
444 $mykids = array();
445 foreach ($mypage as $ctitle => $cpage)
446 if (isset ($cpage['parent']) and $cpage['parent'] == $parent)
447 $mykids[] = array ('title' => $ctitle, 'kids' => getAllChildPages ($ctitle));
448 return $mykids;
449}
450
451?>