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