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