r1980 + lots of adjustments to fit the new RackCode authorization framework
[racktables] / inc / navigation.php
1 <?php
2 /*
3 *
4 * This file implements generic navigation for RackTables.
5 *
6 */
7
8 $page = array();
9 $tab = array();
10 $trigger = array();
11 $ophandler = array();
12 $tabhandler = array();
13
14 $page['index']['title'] = 'Main page';
15 $page['index']['handler'] = 'renderIndex';
16
17 $page['rackspace']['title'] = 'Rackspace';
18 $page['rackspace']['parent'] = 'index';
19 $tab['rackspace']['default'] = 'Browse';
20 $tab['rackspace']['history'] = 'History';
21 $tab['rackspace']['firstrow'] = 'Click me!';
22 $trigger['rackspace']['firstrow'] = 'trigger_emptyRackspace';
23 $tabhandler['rackspace']['default'] = 'renderRackspace';
24 $tabhandler['rackspace']['history'] = 'renderRackspaceHistory';
25 $tabhandler['rackspace']['firstrow'] = 'renderFirstRowForm';
26 $tabextraclass['rackspace']['firstrow'] = 'attn';
27
28 $page['objects']['title'] = 'Objects';
29 $page['objects']['parent'] = 'index';
30 $tab['objects']['default'] = 'View';
31 $tab['objects']['addmore'] = 'Add more';
32 $tabhandler['objects']['default'] = 'renderObjectSpace';
33 $tabhandler['objects']['addmore'] = 'renderAddMultipleObjectsForm';
34
35 $page['row']['title_handler'] = 'dynamic_title_row';
36 $page['row']['bypass'] = 'row_id';
37 $page['row']['bypass_type'] = 'uint';
38 $page['row']['parent'] = 'rackspace';
39 $tab['row']['default'] = 'View';
40 $tab['row']['newrack'] = 'Add new rack';
41 $tab['row']['tagroller'] = 'Tag roller';
42 $tabhandler['row']['default'] = 'renderRow';
43 $tabhandler['row']['newrack'] = 'renderNewRackForm';
44 $tabhandler['row']['tagroller'] = 'renderTagRollerForRow';
45 $ophandler['row']['tagroller']['rollTags'] = 'rollTags';
46
47 $page['rack']['title_handler'] = 'dynamic_title_rack';
48 $page['rack']['bypass'] = 'rack_id';
49 $page['rack']['bypass_type'] = 'uint';
50 $page['rack']['parent'] = 'row';
51 $page['rack']['tagloader'] = 'loadRackTags';
52 $page['rack']['autotagloader'] = 'loadRackAutoTags';
53 $tab['rack']['default'] = 'View';
54 $tab['rack']['edit'] = 'Properties';
55 $tab['rack']['design'] = 'Design';
56 $tab['rack']['problems'] = 'Problems';
57 $tab['rack']['tags'] = 'Tags';
58 $tabhandler['rack']['default'] = 'renderRackPage';
59 $tabhandler['rack']['edit'] = 'renderEditRackForm';
60 $tabhandler['rack']['design'] = 'renderRackDesign';
61 $tabhandler['rack']['problems'] = 'renderRackProblems';
62 $tabhandler['rack']['tags'] = 'renderRackTags';
63 $trigger['rack']['tags'] = 'trigger_tags';
64 $ophandler['rack']['tags']['saveTags'] = 'saveRackTags';
65
66 $page['objgroup']['title_handler'] = 'dynamic_title_objgroup';
67 $page['objgroup']['handler'] = 'renderObjectGroup';
68 $page['objgroup']['bypass'] = 'group_id';
69 $page['objgroup']['bypass_type'] = 'uint0';
70 $page['objgroup']['parent'] = 'objects';
71
72 $page['object']['title_handler'] = 'dynamic_title_object';
73 $page['object']['bypass'] = 'object_id';
74 $page['object']['bypass_type'] = 'uint';
75 $page['object']['parent'] = 'objgroup';
76 $page['object']['tagloader'] = 'loadRackObjectTags';
77 $page['object']['autotagloader'] = 'loadRackObjectAutoTags';
78 $tab['object']['default'] = 'View';
79 $tab['object']['edit'] = 'Properties';
80 $tab['object']['rackspace'] = 'Rackspace';
81 $tab['object']['ports'] = 'Ports';
82 $tab['object']['network'] = 'IPv4';
83 $tab['object']['portfwrd'] = 'NATv4';
84 $tab['object']['switchvlans'] = 'Live VLANs';
85 $tab['object']['snmpportfinder'] = 'SNMP port finder';
86 $tab['object']['slb'] = '[SLB]';
87 $tab['object']['lvsconfig'] = 'LVS configuration';
88 $tab['object']['autoports'] = 'AutoPorts';
89 $tab['object']['tags'] = 'Tags';
90 $tabhandler['object']['default'] = 'renderRackObject';
91 $tabhandler['object']['edit'] = 'renderEditObjectForm';
92 $tabhandler['object']['rackspace'] = 'renderRackSpaceForObject';
93 $tabhandler['object']['ports'] = 'renderPortsForObject';
94 $tabhandler['object']['network'] = 'renderNetworkForObject';
95 $tabhandler['object']['portfwrd'] = 'renderNATv4ForObject';
96 $tabhandler['object']['switchvlans'] = 'renderVLANMembership';
97 $tabhandler['object']['snmpportfinder'] = 'renderSNMPPortFinder';
98 $tabhandler['object']['lvsconfig'] = 'renderLVSConfig';
99 $tabhandler['object']['autoports'] = 'renderAutoPortsForm';
100 $tabhandler['object']['tags'] = 'renderObjectTags';
101 $tabhandler['object']['slb'] = 'renderObjectSLB';
102 $tabextraclass['object']['snmpportfinder'] = 'attn';
103 $tabextraclass['object']['autoports'] = 'attn';
104 $trigger['object']['network'] = 'trigger_ipv4';
105 $trigger['object']['portfwrd'] = 'trigger_natv4';
106 $trigger['object']['switchvlans'] = 'trigger_switchvlans';
107 $trigger['object']['snmpportfinder'] = 'trigger_snmpportfinder';
108 $trigger['object']['slb'] = 'trigger_natv4';
109 $trigger['object']['lvsconfig'] = 'trigger_lvsconfig';
110 $trigger['object']['autoports'] = 'trigger_autoports';
111 $trigger['object']['tags'] = 'trigger_tags';
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']['updIPv4Allocation'] = 'updIPv4Allocation';
120 $ophandler['object']['network']['addIPv4Allocation'] = 'addIPv4Allocation';
121 $ophandler['object']['network']['delIPv4Allocation'] = 'delIPv4Allocation';
122 $ophandler['object']['edit']['del'] = 'resetAttrValue';
123 $ophandler['object']['edit']['upd'] = 'updateAttrValues';
124 $ophandler['object']['portfwrd']['forwardPorts'] = 'addPortForwarding';
125 $ophandler['object']['portfwrd']['delPortForwarding'] = 'delPortForwarding';
126 $ophandler['object']['portfwrd']['updPortForwarding'] = 'updPortForwarding';
127 $ophandler['object']['autoports']['generate'] = 'generateAutoPorts';
128 $ophandler['object']['tags']['saveTags'] = 'saveObjectTags';
129
130 $page['ipv4space']['title'] = 'IPv4 space';
131 $page['ipv4space']['parent'] = 'index';
132 $tab['ipv4space']['default'] = 'Browse';
133 $tab['ipv4space']['newrange'] = 'Manage';
134 $tabhandler['ipv4space']['default'] = 'renderAddressspace';
135 $tabhandler['ipv4space']['newrange'] = 'renderAddNewRange';
136 $ophandler['ipv4space']['newrange']['addIPv4Prefix'] = 'addIPv4Prefix';
137 $ophandler['ipv4space']['newrange']['delIPv4Prefix'] = 'delIPv4Prefix';
138
139 $page['iprange']['title_handler'] = 'dynamic_title_iprange';
140 $page['iprange']['parent'] = 'ipv4space';
141 $page['iprange']['bypass'] = 'id';
142 $page['iprange']['bypass_type'] = 'uint';
143 $page['iprange']['autotagloader'] = 'loadIPv4PrefixAutoTags';
144 $page['iprange']['tagloader'] = 'loadIPv4PrefixTags';
145 $tab['iprange']['default'] = 'Browse';
146 $tab['iprange']['properties'] = 'Properties';
147 $tab['iprange']['liveptr'] = 'Live PTR';
148 $tab['iprange']['tags'] = 'Tags';
149 $tabhandler['iprange']['default'] = 'renderIPRange';
150 $tabhandler['iprange']['properties'] = 'renderIPRangeProperties';
151 $tabhandler['iprange']['liveptr'] = 'renderLivePTR';
152 $tabhandler['iprange']['tags'] = 'renderIPv4PrefixTags';
153 $trigger['iprange']['tags'] = 'trigger_tags';
154 $ophandler['iprange']['properties']['editRange'] = 'editRange';
155 $ophandler['iprange']['liveptr']['importPTRData'] = 'importPTRData';
156 $ophandler['iprange']['tags']['saveTags'] = 'saveIPv4PrefixTags';
157
158 $page['ipaddress']['title_handler'] = 'dynamic_title_ipaddress';
159 $page['ipaddress']['parent'] = 'iprange';
160 $page['ipaddress']['bypass'] = 'ip';
161 $page['ipaddress']['autotagloader'] = 'loadIPv4AddressAutoTags';
162 $tab['ipaddress']['default'] = 'Browse';
163 $tab['ipaddress']['properties'] = 'Properties';
164 $tab['ipaddress']['assignment'] = 'Allocation';
165 $tab['ipaddress']['editrslist'] = '[SLB real servers]';
166 $tabhandler['ipaddress']['default'] = 'renderIPAddress';
167 $tabhandler['ipaddress']['properties'] = 'renderIPAddressProperties';
168 $tabhandler['ipaddress']['assignment'] = 'renderIPAddressAssignment';
169 $ophandler['ipaddress']['properties']['editAddress'] = 'editAddress';
170 $ophandler['ipaddress']['assignment']['delIPv4Allocation'] = 'delIPv4Allocation';
171 $ophandler['ipaddress']['assignment']['updIPv4Allocation'] = 'updIPv4Allocation';
172 $ophandler['ipaddress']['assignment']['addIPv4Allocation'] = 'addIPv4Allocation';
173
174 $page['ipv4slb']['title'] = 'IPv4 SLB';
175 $page['ipv4slb']['parent'] = 'index';
176 $page['ipv4slb']['handler'] = 'renderIPv4SLB';
177
178 $page['vservices']['title'] = 'Virtual services';
179 $page['vservices']['parent'] = 'ipv4slb';
180 $tab['vservices']['default'] = 'View';
181 $tab['vservices']['edit'] = 'Edit';
182 $tabhandler['vservices']['default'] = 'renderVSList';
183 $tabhandler['vservices']['edit'] = 'renderVSListEditForm';
184 $ophandler['vservices']['edit']['add'] = 'addVService';
185 $ophandler['vservices']['edit']['del'] = 'deleteVService';
186 $ophandler['vservices']['edit']['upd'] = 'updateVService';
187
188 $page['vservice']['title_handler'] = 'dynamic_title_vservice';
189 $page['vservice']['parent'] = 'vservices';
190 $page['vservice']['bypass'] = 'id';
191 $page['vservice']['bypass_type'] = 'uint';
192 $page['vservice']['tagloader'] = 'loadIPv4VSTags';
193 $page['vservice']['autotagloader'] = 'loadIPv4VSAutoTags';
194 $tab['vservice']['default'] = 'View';
195 $tab['vservice']['edit'] = '[Edit]';
196 $tab['vservice']['editlblist'] = '[Load balancers]';
197 $tab['vservice']['tags'] = 'Tags';
198 $tabhandler['vservice']['default'] = 'renderVirtualService';
199 $tabhandler['vservice']['edit'] = 'renderEditVService';
200 $tabhandler['vservice']['editlblist'] = 'renderEditLBsForVService';
201 $tabhandler['vservice']['tags'] = 'renderIPv4VSTags';
202 $ophandler['vservice']['tags']['saveTags'] = 'saveIPv4VSTags';
203 $trigger['vservice']['tags'] = 'trigger_tags';
204
205 $page['rspools']['title'] = 'RS pools';
206 $page['rspools']['parent'] = 'ipv4slb';
207 $tab['rspools']['default'] = 'View';
208 $tab['rspools']['edit'] = 'Edit';
209 $tabhandler['rspools']['default'] = 'renderRSPoolList';
210 $tabhandler['rspools']['edit'] = 'editRSPools';
211 $ophandler['rspools']['edit']['add'] = 'addRSPool';
212 $ophandler['rspools']['edit']['del'] = 'deleteRSPool';
213 $ophandler['rspools']['edit']['upd'] = 'updateRSPool';
214
215 $page['rspool']['title_handler'] = 'dynamic_title_rspool';
216 $page['rspool']['parent'] = 'rspools';
217 $page['rspool']['bypass'] = 'pool_id';
218 $page['rspool']['bypass_type'] = 'uint';
219 $page['rspool']['tagloader'] = 'loadIPv4RSPoolTags';
220 $page['rspool']['autotagloader'] = 'loadIPv4RSPoolAutoTags';
221 $tab['rspool']['default'] = 'View';
222 $tab['rspool']['edit'] = '[Edit]';
223 $tab['rspool']['editlblist'] = 'Load Balancers';
224 $tab['rspool']['editrslist'] = 'RS list';
225 $tab['rspool']['rsinservice'] = 'RS in service';
226 $tab['rspool']['tags'] = 'Tags';
227 $trigger['rspool']['rsinservice'] = 'trigger_poolrscount';
228 $trigger['rspool']['tags'] = 'trigger_tags';
229 $tabhandler['rspool']['default'] = 'renderRSPool';
230 $tabhandler['rspool']['edit'] = 'renderEditRSPool';
231 $tabhandler['rspool']['editrslist'] = 'renderRSPoolServerForm';
232 $tabhandler['rspool']['editlblist'] = 'renderRSPoolLBForm';
233 $tabhandler['rspool']['rsinservice'] = 'renderRSPoolRSInServiceForm';
234 $tabhandler['rspool']['tags'] = 'renderIPv4RSPoolTags';
235 $ophandler['rspool']['editrslist']['addRS'] = 'addRealServer';
236 $ophandler['rspool']['editrslist']['delRS'] = 'deleteRealServer';
237 $ophandler['rspool']['editrslist']['updRS'] = 'updateRealServer';
238 $ophandler['rspool']['editrslist']['addMany'] = 'addRealServers';
239 $ophandler['rspool']['editlblist']['addLB'] = 'addLoadBalancer';
240 $ophandler['rspool']['editlblist']['delLB'] = 'deleteLoadBalancer';
241 $ophandler['rspool']['editlblist']['updLB'] = 'updateLoadBalancer';
242 $ophandler['rspool']['rsinservice']['upd'] = 'updateRSInService';
243 $ophandler['rspool']['tags']['saveTags'] = 'saveIPv4RSPoolTags';
244
245 $page['rservers']['title'] = 'Real servers';
246 $page['rservers']['parent'] = 'ipv4slb';
247 $page['rservers']['handler'] = 'renderRealServerList';
248
249 $page['lbs']['title'] = 'Load balancers';
250 $page['lbs']['parent'] = 'ipv4slb';
251 $page['lbs']['handler'] = 'renderLBList';
252
253 $page['search']['title_handler'] = 'dynamic_title_search';
254 $page['search']['handler'] = 'renderSearchResults';
255 $page['search']['parent'] = 'index';
256 $page['search']['bypass'] = 'q';
257
258 $page['config']['title'] = 'Configuration';
259 $page['config']['handler'] = 'renderConfigMainpage';
260 $page['config']['parent'] = 'index';
261
262 $page['userlist']['title'] = 'Users';
263 $page['userlist']['parent'] = 'config';
264 $tab['userlist']['default'] = 'View';
265 $tab['userlist']['edit'] = 'Edit';
266 $tabhandler['userlist']['default'] = 'renderUserList';
267 $tabhandler['userlist']['edit'] = 'renderUserListEditor';
268 $ophandler['userlist']['edit']['updateUser'] = 'updateUser';
269 $ophandler['userlist']['edit']['createUser'] = 'createUser';
270 $ophandler['userlist']['edit']['disableUser'] = 'disableUser';
271 $ophandler['userlist']['edit']['enableUser'] = 'enableUser';
272
273 $page['user']['title_handler'] = 'dynamic_title_user';
274 $page['user']['parent'] = 'userlist';
275 $page['user']['bypass'] = 'user_id';
276 $page['user']['bypass_type'] = 'uint';
277 $page['user']['tagloader'] = 'loadUserTags';
278 $page['user']['autotagloader'] = 'getUserAutoTags';
279 $tab['user']['default'] = 'View';
280 $tab['user']['password'] = 'Change password';
281 $tab['user']['tags'] = 'Tags';
282 $tabhandler['user']['default'] = 'renderUser';
283 $tabhandler['user']['password'] = 'renderUserPasswordEditor';
284 $tabhandler['user']['tags'] = 'renderUserTags';
285 $ophandler['user']['tags']['saveTags'] = 'saveUserTags';
286 $ophandler['user']['password']['changePassword'] = 'changePassword';
287
288 $page['perms']['title'] = 'Permissions';
289 $page['perms']['parent'] = 'config';
290 $tab['perms']['default'] = 'View';
291 $tab['perms']['edit'] = 'Edit';
292 $tabhandler['perms']['default'] = 'renderRackCodeViewer';
293 $tabhandler['perms']['edit'] = 'renderRackCodeEditor';
294 $ophandler['perms']['edit']['saveRackCode'] = 'saveRackCode';
295
296 $page['portmap']['title'] = 'Port compatibility map';
297 $page['portmap']['parent'] = 'config';
298 $tab['portmap']['default'] = 'View';
299 $tab['portmap']['edit'] = 'Change';
300 $tabhandler['portmap']['default'] = 'renderPortMapViewer';
301 $tabhandler['portmap']['edit'] = 'renderPortMapEditor';
302 $ophandler['portmap']['edit']['save'] = 'savePortMap';
303
304 $page['attrs']['title'] = 'Attributes';
305 $page['attrs']['parent'] = 'config';
306 $tab['attrs']['default'] = 'View';
307 $tab['attrs']['editattrs'] = 'Edit attributes';
308 $tab['attrs']['editmap'] = 'Edit map';
309 $tabhandler['attrs']['default'] = 'renderAttributes';
310 $tabhandler['attrs']['editattrs'] = 'renderEditAttributesForm';
311 $tabhandler['attrs']['editmap'] = 'renderEditAttrMapForm';
312 $ophandler['attrs']['editattrs']['add'] = 'createAttribute';
313 $ophandler['attrs']['editattrs']['upd'] = 'changeAttribute';
314 $ophandler['attrs']['editattrs']['del'] = 'deleteAttribute';
315 $ophandler['attrs']['editmap']['add'] = 'supplementAttrMap';
316 $ophandler['attrs']['editmap']['del'] = 'reduceAttrMap';
317
318 $page['dict']['title'] = 'Dictionary';
319 $page['dict']['parent'] = 'config';
320 $tab['dict']['default'] = 'View';
321 $tab['dict']['edit'] = 'Edit words';
322 $tab['dict']['chapters'] = 'Manage chapters';
323 $tabhandler['dict']['default'] = 'renderDictionary';
324 $tabhandler['dict']['edit'] = 'renderDictionaryEditor';
325 $tabhandler['dict']['chapters'] = 'renderChaptersEditor';
326 $ophandler['dict']['edit']['del'] = 'reduceDictionary';
327 $ophandler['dict']['edit']['upd'] = 'updateDictionary';
328 $ophandler['dict']['edit']['add'] = 'supplementDictionary';
329 $ophandler['dict']['chapters']['del'] = 'delChapter';
330 $ophandler['dict']['chapters']['upd'] = 'updateChapter';
331 $ophandler['dict']['chapters']['add'] = 'addChapter';
332
333 $page['ui']['title'] = 'User interface';
334 $page['ui']['parent'] = 'config';
335 $tab['ui']['default'] = 'View';
336 $tab['ui']['edit'] = 'Change';
337 $tab['ui']['reset'] = 'Reset';
338 $tabhandler['ui']['default'] = 'renderUIConfig';
339 $tabhandler['ui']['edit'] = 'renderUIConfigEditForm';
340 $tabhandler['ui']['reset'] = 'renderUIResetForm';
341 $ophandler['ui']['edit']['upd'] = 'updateUI';
342 $ophandler['ui']['reset']['go'] = 'resetUIConfig';
343
344 $page['tagtree']['title'] = 'Tag tree';
345 $page['tagtree']['parent'] = 'config';
346 $tab['tagtree']['default'] = 'View';
347 $tab['tagtree']['edit'] = 'Edit';
348 $tabhandler['tagtree']['default'] = 'renderTagTree';
349 $tabhandler['tagtree']['edit'] = 'renderTagTreeEditor';
350 $ophandler['tagtree']['edit']['destroyTag'] = 'destroyTag';
351 $ophandler['tagtree']['edit']['createTag'] = 'createTag';
352 $ophandler['tagtree']['edit']['updateTag'] = 'updateTag';
353
354 $page['reports']['title'] = 'Reports';
355 $page['reports']['parent'] = 'index';
356 $page['reports']['handler'] = 'renderReportSummary';
357
358 // This function returns array if page numbers leading to the target page
359 // plus page number of target page itself. The first element is the target
360 // page number and the last element is the index page number.
361 function getPath ($targetno)
362 {
363 global $page;
364 $path = array();
365 // Recursion breaks at first parentless page.
366 if (!isset ($page[$targetno]['parent']))
367 $path = array ($targetno);
368 else
369 {
370 $path = getPath ($page[$targetno]['parent']);
371 $path[] = $targetno;
372 }
373 return $path;
374 }
375
376 function showPathAndSearch ($pageno)
377 {
378 global $root, $page;
379 // Path.
380 echo "<td class=activemenuitem width='99%'>" . getConfigVar ('enterprise');
381 $path = getPath ($pageno);
382 foreach ($path as $no)
383 {
384 $title['params'] = array();
385 if (isset ($page[$no]['title']))
386 $title['name'] = $page[$no]['title'];
387 elseif (isset ($page[$no]['title_handler']))
388 $title = $page[$no]['title_handler']($no);
389 else
390 $title['name'] = '[N/A]';
391 echo ": <a href='${root}?page=${no}";
392 foreach ($title['params'] as $param_name => $param_value)
393 echo "&${param_name}=${param_value}";
394 echo "'>" . $title['name'] . "</a>";
395 }
396 echo "</td>";
397 // Search form.
398 echo "<td><table border=0 cellpadding=0 cellspacing=0><tr><td>Search:</td>";
399 echo "<form name=search method=get action='${root}'><td>";
400 echo '<input type=hidden name=page value=search>';
401 // This input will be the first, if we don't add ports or addresses.
402 echo "<input type=text name=q size=20 tabindex=1000></td></form></tr></table></td>";
403 }
404
405 function getTitle ($pageno, $tabno)
406 {
407 global $page;
408 if (isset ($page[$pageno]['title']))
409 return $page[$pageno]['title'];
410 elseif (isset ($page[$pageno]['title_handler']))
411 {
412 $tmp = $page[$pageno]['title_handler']($pageno);
413 return $tmp['name'];
414 }
415 else
416 return getConfigVar ('enterprise');
417 }
418
419 function showTabs ($pageno, $tabno)
420 {
421 global $tab, $root, $page, $remote_username, $trigger, $tabextraclass;
422 if (!isset ($tab[$pageno]['default']))
423 return;
424 echo "<td><div class=greynavbar><ul id=foldertab style='margin-bottom: 0px; padding-top: 10px;'>";
425 foreach ($tab[$pageno] as $tabidx => $tabtitle)
426 {
427 // Hide forbidden tabs.
428 if (!accessiblePath ($pageno, $tabidx))
429 continue;
430 // Dynamic tabs should only be shown in certain cases (trigger exists and returns true).
431 if
432 (
433 isset ($trigger[$pageno][$tabidx]) &&
434 $trigger[$pageno][$tabidx] () != TRUE
435 )
436 continue;
437 $class = ($tabidx == $tabno) ? 'current' : 'std';
438 $extra = (isset ($tabextraclass[$pageno][$tabidx])) ? $tabextraclass[$pageno][$tabidx] : '';
439 echo "<li><a class=${class}{$extra}";
440 echo " href='${root}?page=${pageno}&tab=${tabidx}";
441 if (isset ($page[$pageno]['bypass']) and isset ($_REQUEST[$page[$pageno]['bypass']]))
442 {
443 $bpname = $page[$pageno]['bypass'];
444 $bpval = $_REQUEST[$bpname];
445 echo "&${bpname}=${bpval}";
446 }
447 echo "'>${tabtitle}</a></li>\n";
448 }
449 echo "</ul></div></td>\n";
450 }
451
452 // This function returns pages, which are direct children of the requested
453 // page and are accessible by the current user.
454 function getDirectChildPages ($pageno)
455 {
456 global $page, $remote_username;
457 $children = array();
458 foreach ($page as $cpageno => $cpage)
459 if
460 (
461 isset ($cpage['parent']) and
462 $cpage['parent'] == $pageno and
463 accessiblePath ($cpageno, 'default') == TRUE
464 )
465 $children[$cpageno] = $cpage;
466 return $children;
467 }
468
469 function getAllChildPages ($parent)
470 {
471 global $page;
472 // Array pointer is global, so if we don't create local copies of
473 // the global array, we can't advance any more after nested call
474 // of getAllChildPages returns.
475 $mypage = $page;
476 $mykids = array();
477 foreach ($mypage as $ctitle => $cpage)
478 if (isset ($cpage['parent']) and $cpage['parent'] == $parent)
479 $mykids[] = array ('title' => $ctitle, 'kids' => getAllChildPages ($ctitle));
480 return $mykids;
481 }
482
483 ?>