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