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