f73acd653358bbc354c3a951426726bd25945a10
[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']['livevlans'] = 'Live VLANs';
85 $tab['object']['snmpportfinder'] = 'SNMP port finder';
86 $tab['object']['editrspvs'] = 'RS pools';
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']['livevlans'] = 'renderVLANMembership';
97 $tabhandler['object']['snmpportfinder'] = 'renderSNMPPortFinder';
98 $tabhandler['object']['lvsconfig'] = 'renderLVSConfig';
99 $tabhandler['object']['autoports'] = 'renderAutoPortsForm';
100 $tabhandler['object']['tags'] = 'renderObjectTags';
101 $tabhandler['object']['editrspvs'] = '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']['livevlans'] = 'trigger_livevlans';
107 $trigger['object']['snmpportfinder'] = 'trigger_snmpportfinder';
108 $trigger['object']['editrspvs'] = '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']['livevlans']['setPortVLAN'] = 'setPortVLAN';
128 $ophandler['object']['autoports']['generate'] = 'generateAutoPorts';
129 $ophandler['object']['tags']['saveTags'] = 'saveObjectTags';
130 $ophandler['object']['editrspvs']['addLB'] = 'addLoadBalancer';
131 $ophandler['object']['editrspvs']['delLB'] = 'deleteLoadBalancer';
132 $ophandler['object']['editrspvs']['updLB'] = 'updateLoadBalancer';
133 $delayauth['object']['livevlans']['setPortVLAN'] = TRUE;
134
135 $page['ipv4space']['title'] = 'IPv4 space';
136 $page['ipv4space']['parent'] = 'index';
137 $tab['ipv4space']['default'] = 'Browse';
138 $tab['ipv4space']['newrange'] = 'Manage';
139 $tabhandler['ipv4space']['default'] = 'renderAddressspace';
140 $tabhandler['ipv4space']['newrange'] = 'renderAddNewRange';
141 $ophandler['ipv4space']['newrange']['addIPv4Prefix'] = 'addIPv4Prefix';
142 $ophandler['ipv4space']['newrange']['delIPv4Prefix'] = 'delIPv4Prefix';
143
144 $page['iprange']['title_handler'] = 'dynamic_title_iprange';
145 $page['iprange']['parent'] = 'ipv4space';
146 $page['iprange']['bypass'] = 'id';
147 $page['iprange']['bypass_type'] = 'uint';
148 $page['iprange']['autotagloader'] = 'loadIPv4PrefixAutoTags';
149 $page['iprange']['tagloader'] = 'loadIPv4PrefixTags';
150 $tab['iprange']['default'] = 'Browse';
151 $tab['iprange']['properties'] = 'Properties';
152 $tab['iprange']['liveptr'] = 'Live PTR';
153 $tab['iprange']['tags'] = 'Tags';
154 $tabhandler['iprange']['default'] = 'renderIPRange';
155 $tabhandler['iprange']['properties'] = 'renderIPRangeProperties';
156 $tabhandler['iprange']['liveptr'] = 'renderLivePTR';
157 $tabhandler['iprange']['tags'] = 'renderIPv4PrefixTags';
158 $trigger['iprange']['tags'] = 'trigger_tags';
159 $ophandler['iprange']['properties']['editRange'] = 'editRange';
160 $ophandler['iprange']['liveptr']['importPTRData'] = 'importPTRData';
161 $ophandler['iprange']['tags']['saveTags'] = 'saveIPv4PrefixTags';
162
163 $page['ipaddress']['title_handler'] = 'dynamic_title_ipaddress';
164 $page['ipaddress']['parent'] = 'iprange';
165 $page['ipaddress']['bypass'] = 'ip';
166 $page['ipaddress']['autotagloader'] = 'loadIPv4AddressAutoTags';
167 $tab['ipaddress']['default'] = 'Browse';
168 $tab['ipaddress']['properties'] = 'Properties';
169 $tab['ipaddress']['assignment'] = 'Allocation';
170 $tab['ipaddress']['editrslist'] = '[SLB real servers]';
171 $tabhandler['ipaddress']['default'] = 'renderIPAddress';
172 $tabhandler['ipaddress']['properties'] = 'renderIPAddressProperties';
173 $tabhandler['ipaddress']['assignment'] = 'renderIPAddressAssignment';
174 $ophandler['ipaddress']['properties']['editAddress'] = 'editAddress';
175 $ophandler['ipaddress']['assignment']['delIPv4Allocation'] = 'delIPv4Allocation';
176 $ophandler['ipaddress']['assignment']['updIPv4Allocation'] = 'updIPv4Allocation';
177 $ophandler['ipaddress']['assignment']['addIPv4Allocation'] = 'addIPv4Allocation';
178
179 $page['ipv4slb']['title'] = 'IPv4 SLB';
180 $page['ipv4slb']['parent'] = 'index';
181 $page['ipv4slb']['handler'] = 'renderIPv4SLB';
182
183 $page['ipv4vslist']['title'] = 'Virtual services';
184 $page['ipv4vslist']['parent'] = 'ipv4slb';
185 $tab['ipv4vslist']['default'] = 'View';
186 $tab['ipv4vslist']['edit'] = 'Edit';
187 $tabhandler['ipv4vslist']['default'] = 'renderVSList';
188 $tabhandler['ipv4vslist']['edit'] = 'renderVSListEditForm';
189 $ophandler['ipv4vslist']['edit']['add'] = 'addVService';
190 $ophandler['ipv4vslist']['edit']['del'] = 'deleteVService';
191 $ophandler['ipv4vslist']['edit']['upd'] = 'updateVService';
192
193 $page['ipv4vs']['title_handler'] = 'dynamic_title_vservice';
194 $page['ipv4vs']['parent'] = 'ipv4vslist';
195 $page['ipv4vs']['bypass'] = 'vs_id';
196 $page['ipv4vs']['bypass_type'] = 'uint';
197 $page['ipv4vs']['tagloader'] = 'loadIPv4VSTags';
198 $page['ipv4vs']['autotagloader'] = 'loadIPv4VSAutoTags';
199 $tab['ipv4vs']['default'] = 'View';
200 $tab['ipv4vs']['edit'] = 'Edit';
201 $tab['ipv4vs']['editlblist'] = 'Load balancers';
202 $tab['ipv4vs']['tags'] = 'Tags';
203 $tabhandler['ipv4vs']['default'] = 'renderVirtualService';
204 $tabhandler['ipv4vs']['edit'] = 'renderEditVService';
205 $tabhandler['ipv4vs']['editlblist'] = 'renderVServiceLBForm';
206 $tabhandler['ipv4vs']['tags'] = 'renderIPv4VSTags';
207 $ophandler['ipv4vs']['tags']['saveTags'] = 'saveIPv4VSTags';
208 $ophandler['ipv4vs']['editlblist']['addLB'] = 'addLoadBalancer';
209 $ophandler['ipv4vs']['editlblist']['delLB'] = 'deleteLoadBalancer';
210 $ophandler['ipv4vs']['editlblist']['updLB'] = 'updateLoadBalancer';
211 $trigger['ipv4vs']['tags'] = 'trigger_tags';
212
213 $page['ipv4rsplist']['title'] = 'RS pools';
214 $page['ipv4rsplist']['parent'] = 'ipv4slb';
215 $tab['ipv4rsplist']['default'] = 'View';
216 $tab['ipv4rsplist']['edit'] = 'Edit';
217 $tabhandler['ipv4rsplist']['default'] = 'renderRSPoolList';
218 $tabhandler['ipv4rsplist']['edit'] = 'editRSPools';
219 $ophandler['ipv4rsplist']['edit']['add'] = 'addRSPool';
220 $ophandler['ipv4rsplist']['edit']['del'] = 'deleteRSPool';
221 $ophandler['ipv4rsplist']['edit']['upd'] = 'updateRSPool';
222
223 $page['ipv4rsp']['title_handler'] = 'dynamic_title_rspool';
224 $page['ipv4rsp']['parent'] = 'ipv4rsplist';
225 $page['ipv4rsp']['bypass'] = 'pool_id';
226 $page['ipv4rsp']['bypass_type'] = 'uint';
227 $page['ipv4rsp']['tagloader'] = 'loadIPv4RSPoolTags';
228 $page['ipv4rsp']['autotagloader'] = 'loadIPv4RSPoolAutoTags';
229 $tab['ipv4rsp']['default'] = 'View';
230 $tab['ipv4rsp']['edit'] = 'Edit';
231 $tab['ipv4rsp']['editlblist'] = 'Load Balancers';
232 $tab['ipv4rsp']['editrslist'] = 'RS list';
233 $tab['ipv4rsp']['rsinservice'] = 'RS in service';
234 $tab['ipv4rsp']['tags'] = 'Tags';
235 $trigger['ipv4rsp']['rsinservice'] = 'trigger_poolrscount';
236 $trigger['ipv4rsp']['tags'] = 'trigger_tags';
237 $tabhandler['ipv4rsp']['default'] = 'renderRSPool';
238 $tabhandler['ipv4rsp']['edit'] = 'renderEditRSPool';
239 $tabhandler['ipv4rsp']['editrslist'] = 'renderRSPoolServerForm';
240 $tabhandler['ipv4rsp']['editlblist'] = 'renderRSPoolLBForm';
241 $tabhandler['ipv4rsp']['rsinservice'] = 'renderRSPoolRSInServiceForm';
242 $tabhandler['ipv4rsp']['tags'] = 'renderIPv4RSPoolTags';
243 $ophandler['ipv4rsp']['editrslist']['addRS'] = 'addRealServer';
244 $ophandler['ipv4rsp']['editrslist']['delRS'] = 'deleteRealServer';
245 $ophandler['ipv4rsp']['editrslist']['updRS'] = 'updateRealServer';
246 $ophandler['ipv4rsp']['editrslist']['addMany'] = 'addRealServers';
247 $ophandler['ipv4rsp']['editlblist']['addLB'] = 'addLoadBalancer';
248 $ophandler['ipv4rsp']['editlblist']['delLB'] = 'deleteLoadBalancer';
249 $ophandler['ipv4rsp']['editlblist']['updLB'] = 'updateLoadBalancer';
250 $ophandler['ipv4rsp']['rsinservice']['upd'] = 'updateRSInService';
251 $ophandler['ipv4rsp']['tags']['saveTags'] = 'saveIPv4RSPoolTags';
252 $ophandler['ipv4rsp']['edit']['updIPv4RSP'] = 'updateRSPool';
253
254 $page['rservers']['title'] = 'Real servers';
255 $page['rservers']['parent'] = 'ipv4slb';
256 $page['rservers']['handler'] = 'renderRealServerList';
257
258 $page['lbs']['title'] = 'Load balancers';
259 $page['lbs']['parent'] = 'ipv4slb';
260 $page['lbs']['handler'] = 'renderLBList';
261
262 $page['search']['title_handler'] = 'dynamic_title_search';
263 $page['search']['handler'] = 'renderSearchResults';
264 $page['search']['parent'] = 'index';
265 $page['search']['bypass'] = 'q';
266
267 $page['config']['title'] = 'Configuration';
268 $page['config']['handler'] = 'renderConfigMainpage';
269 $page['config']['parent'] = 'index';
270
271 $page['userlist']['title'] = 'Users';
272 $page['userlist']['parent'] = 'config';
273 $tab['userlist']['default'] = 'View';
274 $tab['userlist']['edit'] = 'Edit';
275 $tabhandler['userlist']['default'] = 'renderUserList';
276 $tabhandler['userlist']['edit'] = 'renderUserListEditor';
277 $ophandler['userlist']['edit']['updateUser'] = 'updateUser';
278 $ophandler['userlist']['edit']['createUser'] = 'createUser';
279 $ophandler['userlist']['edit']['disableUser'] = 'disableUser';
280 $ophandler['userlist']['edit']['enableUser'] = 'enableUser';
281
282 $page['user']['title_handler'] = 'dynamic_title_user';
283 $page['user']['parent'] = 'userlist';
284 $page['user']['bypass'] = 'user_id';
285 $page['user']['bypass_type'] = 'uint';
286 $page['user']['tagloader'] = 'loadUserTags';
287 $page['user']['autotagloader'] = 'getUserAutoTags';
288 $tab['user']['default'] = 'View';
289 $tab['user']['password'] = 'Change password';
290 $tab['user']['tags'] = 'Tags';
291 $tabhandler['user']['default'] = 'renderUser';
292 $tabhandler['user']['password'] = 'renderUserPasswordEditor';
293 $tabhandler['user']['tags'] = 'renderUserTags';
294 $ophandler['user']['tags']['saveTags'] = 'saveUserTags';
295 $ophandler['user']['password']['changePassword'] = 'changePassword';
296
297 $page['perms']['title'] = 'Permissions';
298 $page['perms']['parent'] = 'config';
299 $tab['perms']['default'] = 'View';
300 $tab['perms']['edit'] = 'Edit';
301 $tabhandler['perms']['default'] = 'renderRackCodeViewer';
302 $tabhandler['perms']['edit'] = 'renderRackCodeEditor';
303 $ophandler['perms']['edit']['saveRackCode'] = 'saveRackCode';
304
305 $page['portmap']['title'] = 'Port compatibility map';
306 $page['portmap']['parent'] = 'config';
307 $tab['portmap']['default'] = 'View';
308 $tab['portmap']['edit'] = 'Change';
309 $tabhandler['portmap']['default'] = 'renderPortMapViewer';
310 $tabhandler['portmap']['edit'] = 'renderPortMapEditor';
311 $ophandler['portmap']['edit']['save'] = 'savePortMap';
312
313 $page['attrs']['title'] = 'Attributes';
314 $page['attrs']['parent'] = 'config';
315 $tab['attrs']['default'] = 'View';
316 $tab['attrs']['editattrs'] = 'Edit attributes';
317 $tab['attrs']['editmap'] = 'Edit map';
318 $tabhandler['attrs']['default'] = 'renderAttributes';
319 $tabhandler['attrs']['editattrs'] = 'renderEditAttributesForm';
320 $tabhandler['attrs']['editmap'] = 'renderEditAttrMapForm';
321 $ophandler['attrs']['editattrs']['add'] = 'createAttribute';
322 $ophandler['attrs']['editattrs']['upd'] = 'changeAttribute';
323 $ophandler['attrs']['editattrs']['del'] = 'deleteAttribute';
324 $ophandler['attrs']['editmap']['add'] = 'supplementAttrMap';
325 $ophandler['attrs']['editmap']['del'] = 'reduceAttrMap';
326
327 $page['dict']['title'] = 'Dictionary';
328 $page['dict']['parent'] = 'config';
329 $tab['dict']['default'] = 'View';
330 $tab['dict']['edit'] = 'Edit words';
331 $tab['dict']['chapters'] = 'Manage chapters';
332 $tabhandler['dict']['default'] = 'renderDictionary';
333 $tabhandler['dict']['edit'] = 'renderDictionaryEditor';
334 $tabhandler['dict']['chapters'] = 'renderChaptersEditor';
335 $ophandler['dict']['edit']['del'] = 'reduceDictionary';
336 $ophandler['dict']['edit']['upd'] = 'updateDictionary';
337 $ophandler['dict']['edit']['add'] = 'supplementDictionary';
338 $ophandler['dict']['chapters']['del'] = 'delChapter';
339 $ophandler['dict']['chapters']['upd'] = 'updateChapter';
340 $ophandler['dict']['chapters']['add'] = 'addChapter';
341
342 $page['ui']['title'] = 'User interface';
343 $page['ui']['parent'] = 'config';
344 $tab['ui']['default'] = 'View';
345 $tab['ui']['edit'] = 'Change';
346 $tab['ui']['reset'] = 'Reset';
347 $tabhandler['ui']['default'] = 'renderUIConfig';
348 $tabhandler['ui']['edit'] = 'renderUIConfigEditForm';
349 $tabhandler['ui']['reset'] = 'renderUIResetForm';
350 $ophandler['ui']['edit']['upd'] = 'updateUI';
351 $ophandler['ui']['reset']['go'] = 'resetUIConfig';
352
353 $page['tagtree']['title'] = 'Tag tree';
354 $page['tagtree']['parent'] = 'config';
355 $tab['tagtree']['default'] = 'View';
356 $tab['tagtree']['edit'] = 'Edit';
357 $tabhandler['tagtree']['default'] = 'renderTagTree';
358 $tabhandler['tagtree']['edit'] = 'renderTagTreeEditor';
359 $ophandler['tagtree']['edit']['destroyTag'] = 'destroyTag';
360 $ophandler['tagtree']['edit']['createTag'] = 'createTag';
361 $ophandler['tagtree']['edit']['updateTag'] = 'updateTag';
362
363 $page['reports']['title'] = 'Reports';
364 $page['reports']['parent'] = 'index';
365 $page['reports']['handler'] = 'renderReportSummary';
366
367 // This function returns array if page numbers leading to the target page
368 // plus page number of target page itself. The first element is the target
369 // page number and the last element is the index page number.
370 function getPath ($targetno)
371 {
372 global $page;
373 $path = array();
374 // Recursion breaks at first parentless page.
375 if (!isset ($page[$targetno]['parent']))
376 $path = array ($targetno);
377 else
378 {
379 $path = getPath ($page[$targetno]['parent']);
380 $path[] = $targetno;
381 }
382 return $path;
383 }
384
385 function showPathAndSearch ($pageno)
386 {
387 global $root, $page;
388 // Path.
389 echo "<td class=activemenuitem width='99%'>" . getConfigVar ('enterprise');
390 $path = getPath ($pageno);
391 foreach ($path as $no)
392 {
393 $title['params'] = array();
394 if (isset ($page[$no]['title']))
395 $title['name'] = $page[$no]['title'];
396 elseif (isset ($page[$no]['title_handler']))
397 $title = $page[$no]['title_handler']($no);
398 else
399 $title['name'] = '[N/A]';
400 echo ": <a href='${root}?page=${no}";
401 foreach ($title['params'] as $param_name => $param_value)
402 echo "&${param_name}=${param_value}";
403 echo "'>" . $title['name'] . "</a>";
404 }
405 echo "</td>";
406 // Search form.
407 echo "<td><table border=0 cellpadding=0 cellspacing=0><tr><td>Search:</td>";
408 echo "<form name=search method=get action='${root}'><td>";
409 echo '<input type=hidden name=page value=search>';
410 // This input will be the first, if we don't add ports or addresses.
411 echo "<input type=text name=q size=20 tabindex=1000></td></form></tr></table></td>";
412 }
413
414 function getTitle ($pageno, $tabno)
415 {
416 global $page;
417 if (isset ($page[$pageno]['title']))
418 return $page[$pageno]['title'];
419 elseif (isset ($page[$pageno]['title_handler']))
420 {
421 $tmp = $page[$pageno]['title_handler']($pageno);
422 return $tmp['name'];
423 }
424 else
425 return getConfigVar ('enterprise');
426 }
427
428 function showTabs ($pageno, $tabno)
429 {
430 global $tab, $root, $page, $remote_username, $trigger, $tabextraclass;
431 if (!isset ($tab[$pageno]['default']))
432 return;
433 echo "<td><div class=greynavbar><ul id=foldertab style='margin-bottom: 0px; padding-top: 10px;'>";
434 foreach ($tab[$pageno] as $tabidx => $tabtitle)
435 {
436 // Hide forbidden tabs.
437 if (!permitted ($pageno, $tabidx))
438 continue;
439 // Dynamic tabs should only be shown in certain cases (trigger exists and returns true).
440 if (isset ($trigger[$pageno][$tabidx]))
441 {
442 // $t1 = microtime (TRUE);
443 $ok = $trigger[$pageno][$tabidx] ();
444 // $t2 = microtime (TRUE);
445 // echo 'DEBUG: ' . $trigger[$pageno][$tabidx] . ': ' . sprintf ('%0.4f', $t2 - $t1) . '<br>';
446 if (!$ok)
447 continue;
448 }
449 $class = ($tabidx == $tabno) ? 'current' : 'std';
450 $extra = (isset ($tabextraclass[$pageno][$tabidx])) ? $tabextraclass[$pageno][$tabidx] : '';
451 echo "<li><a class=${class}{$extra}";
452 echo " href='${root}?page=${pageno}&tab=${tabidx}";
453 if (isset ($page[$pageno]['bypass']) and isset ($_REQUEST[$page[$pageno]['bypass']]))
454 {
455 $bpname = $page[$pageno]['bypass'];
456 $bpval = $_REQUEST[$bpname];
457 echo "&${bpname}=${bpval}";
458 }
459 echo "'>${tabtitle}</a></li>\n";
460 }
461 echo "</ul></div></td>\n";
462 }
463
464 // This function returns pages, which are direct children of the requested
465 // page and are accessible by the current user.
466 function getDirectChildPages ($pageno)
467 {
468 global $page, $remote_username;
469 $children = array();
470 foreach ($page as $cpageno => $cpage)
471 if
472 (
473 isset ($cpage['parent']) and
474 $cpage['parent'] == $pageno and
475 accessibleSubpage ($cpageno) == TRUE
476 )
477 $children[$cpageno] = $cpage;
478 return $children;
479 }
480
481 function getAllChildPages ($parent)
482 {
483 global $page;
484 // Array pointer is global, so if we don't create local copies of
485 // the global array, we can't advance any more after nested call
486 // of getAllChildPages returns.
487 $mypage = $page;
488 $mykids = array();
489 foreach ($mypage as $ctitle => $cpage)
490 if (isset ($cpage['parent']) and $cpage['parent'] == $parent)
491 $mykids[] = array ('title' => $ctitle, 'kids' => getAllChildPages ($ctitle));
492 return $mykids;
493 }
494
495 ?>