r2184 - enhance saveEntityTags() and get rid of 6 wrapping functions
[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 $tabextraclass = array();
14 $delayauth = array();
15 $msgcode = array();
16
17 $page['index']['title'] = 'Main page';
18 $page['index']['handler'] = 'renderIndex';
19
20 $page['rackspace']['title'] = 'Rackspace';
21 $page['rackspace']['parent'] = 'index';
22 $tab['rackspace']['default'] = 'Browse';
23 $tab['rackspace']['history'] = 'History';
24 $tab['rackspace']['firstrow'] = 'Click me!';
25 $trigger['rackspace']['firstrow'] = 'trigger_emptyRackspace';
26 $tabhandler['rackspace']['default'] = 'renderRackspace';
27 $tabhandler['rackspace']['history'] = 'renderRackspaceHistory';
28 $tabhandler['rackspace']['firstrow'] = 'renderFirstRowForm';
29 $tabextraclass['rackspace']['firstrow'] = 'attn';
30
31 $page['objects']['title'] = 'Objects';
32 $page['objects']['parent'] = 'index';
33 $tab['objects']['default'] = 'View';
34 $tab['objects']['addmore'] = 'Add more';
35 $tabhandler['objects']['default'] = 'renderObjectSpace';
36 $tabhandler['objects']['addmore'] = 'renderAddMultipleObjectsForm';
37
38 $page['row']['title_handler'] = 'dynamic_title_row';
39 $page['row']['bypass'] = 'row_id';
40 $page['row']['bypass_type'] = 'uint';
41 $page['row']['parent'] = 'rackspace';
42 $tab['row']['default'] = 'View';
43 $tab['row']['newrack'] = 'Add new rack';
44 $tab['row']['tagroller'] = 'Tag roller';
45 $tabhandler['row']['default'] = 'renderRow';
46 $tabhandler['row']['newrack'] = 'renderNewRackForm';
47 $tabhandler['row']['tagroller'] = 'renderTagRollerForRow';
48 $ophandler['row']['tagroller']['rollTags'] = 'rollTags';
49 $ophandler['row']['newrack']['addRack'] = 'addRack';
50 $msgcode['row']['tagroller']['rollTags']['OK'] = 67;
51 $msgcode['row']['tagroller']['rollTags']['ERR'] = 149;
52 $msgcode['row']['newrack']['addRack']['OK'] = 65;
53 $msgcode['row']['newrack']['addRack']['ERR1'] = 171;
54 $msgcode['row']['newrack']['addRack']['ERR2'] = 172;
55
56 $page['rack']['title_handler'] = 'dynamic_title_rack';
57 $page['rack']['bypass'] = 'rack_id';
58 $page['rack']['bypass_type'] = 'uint';
59 $page['rack']['parent'] = 'row';
60 $page['rack']['tagloader'] = 'loadRackTags';
61 $page['rack']['autotagloader'] = 'loadRackAutoTags';
62 $tab['rack']['default'] = 'View';
63 $tab['rack']['edit'] = 'Properties';
64 $tab['rack']['design'] = 'Design';
65 $tab['rack']['problems'] = 'Problems';
66 $tab['rack']['tags'] = 'Tags';
67 $tabhandler['rack']['default'] = 'renderRackPage';
68 $tabhandler['rack']['edit'] = 'renderEditRackForm';
69 $tabhandler['rack']['design'] = 'renderRackDesign';
70 $tabhandler['rack']['problems'] = 'renderRackProblems';
71 $tabhandler['rack']['tags'] = 'renderRackTags';
72 $trigger['rack']['tags'] = 'trigger_tags';
73 $ophandler['rack']['edit']['updateRack'] = 'updateRack';
74 $ophandler['rack']['tags']['saveTags'] = 'saveEntityTags';
75 $msgcode['rack']['edit']['updateRack']['OK'] = 68;
76 $msgcode['rack']['edit']['updateRack']['ERR'] = 177;
77
78 $page['objgroup']['title_handler'] = 'dynamic_title_objgroup';
79 $page['objgroup']['handler'] = 'renderObjectGroup';
80 $page['objgroup']['bypass'] = 'group_id';
81 $page['objgroup']['bypass_type'] = 'uint0';
82 $page['objgroup']['parent'] = 'objects';
83
84 $page['object']['title_handler'] = 'dynamic_title_object';
85 $page['object']['bypass'] = 'object_id';
86 $page['object']['bypass_type'] = 'uint';
87 $page['object']['parent'] = 'objgroup';
88 $page['object']['tagloader'] = 'loadRackObjectTags';
89 $page['object']['autotagloader'] = 'loadRackObjectAutoTags';
90 $tab['object']['default'] = 'View';
91 $tab['object']['edit'] = 'Properties';
92 $tab['object']['rackspace'] = 'Rackspace';
93 $tab['object']['ports'] = 'Ports';
94 $tab['object']['ipv4'] = 'IPv4';
95 $tab['object']['nat4'] = 'NATv4';
96 $tab['object']['livevlans'] = 'Live VLANs';
97 $tab['object']['snmpportfinder'] = 'SNMP port finder';
98 $tab['object']['editrspvs'] = 'RS pools';
99 $tab['object']['lvsconfig'] = 'LVS config';
100 $tab['object']['autoports'] = 'AutoPorts';
101 $tab['object']['tags'] = 'Tags';
102 $tabhandler['object']['default'] = 'renderRackObject';
103 $tabhandler['object']['edit'] = 'renderEditObjectForm';
104 $tabhandler['object']['rackspace'] = 'renderRackSpaceForObject';
105 $tabhandler['object']['ports'] = 'renderPortsForObject';
106 $tabhandler['object']['ipv4'] = 'renderIPv4ForObject';
107 $tabhandler['object']['nat4'] = 'renderNATv4ForObject';
108 $tabhandler['object']['livevlans'] = 'renderVLANMembership';
109 $tabhandler['object']['snmpportfinder'] = 'renderSNMPPortFinder';
110 $tabhandler['object']['lvsconfig'] = 'renderLVSConfig';
111 $tabhandler['object']['autoports'] = 'renderAutoPortsForm';
112 $tabhandler['object']['tags'] = 'renderObjectTags';
113 $tabhandler['object']['editrspvs'] = 'renderObjectSLB';
114 $tabextraclass['object']['snmpportfinder'] = 'attn';
115 $tabextraclass['object']['autoports'] = 'attn';
116 $trigger['object']['ipv4'] = 'trigger_ipv4';
117 $trigger['object']['nat4'] = 'trigger_natv4';
118 $trigger['object']['livevlans'] = 'trigger_livevlans';
119 $trigger['object']['snmpportfinder'] = 'trigger_snmpportfinder';
120 $trigger['object']['editrspvs'] = 'trigger_natv4';
121 $trigger['object']['lvsconfig'] = 'trigger_lvsconfig';
122 $trigger['object']['autoports'] = 'trigger_autoports';
123 $trigger['object']['tags'] = 'trigger_tags';
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';
131 $ophandler['object']['ipv4']['updIPv4Allocation'] = 'updIPv4Allocation';
132 $ophandler['object']['ipv4']['addIPv4Allocation'] = 'addIPv4Allocation';
133 $ophandler['object']['ipv4']['delIPv4Allocation'] = 'delIPv4Allocation';
134 $ophandler['object']['edit']['clearSticker'] = 'clearSticker';
135 $ophandler['object']['edit']['updateStickers'] = 'updateStickers';
136 $ophandler['object']['edit']['update'] = 'updateObject';
137 $ophandler['object']['nat4']['addNATv4Rule'] = 'addPortForwarding';
138 $ophandler['object']['nat4']['delNATv4Rule'] = 'delPortForwarding';
139 $ophandler['object']['nat4']['updNATv4Rule'] = 'updPortForwarding';
140 $ophandler['object']['livevlans']['setPortVLAN'] = 'setPortVLAN';
141 $ophandler['object']['autoports']['generate'] = 'generateAutoPorts';
142 $ophandler['object']['tags']['saveTags'] = 'saveEntityTags';
143 $ophandler['object']['editrspvs']['addLB'] = 'addLoadBalancer';
144 $ophandler['object']['editrspvs']['delLB'] = 'deleteLoadBalancer';
145 $ophandler['object']['editrspvs']['updLB'] = 'updateLoadBalancer';
146 $ophandler['object']['lvsconfig']['submitSLBConfig'] = 'submitSLBConfig';
147 $ophandler['object']['snmpportfinder']['querySNMPData'] = 'querySNMPData';
148 $delayauth['object']['livevlans']['setPortVLAN'] = TRUE;
149 $msgcode['object']['nat4']['addNATv4Rule']['OK'] = 2;
150 $msgcode['object']['nat4']['addNATv4Rule']['ERR'] = 100;
151 $msgcode['object']['nat4']['delNATv4Rule']['OK'] = 3;
152 $msgcode['object']['nat4']['delNATv4Rule']['ERR'] = 100;
153 $msgcode['object']['nat4']['updNATv4Rule']['OK'] = 4;
154 $msgcode['object']['nat4']['updNATv4Rule']['ERR'] = 100;
155 $msgcode['object']['ports']['addPort']['OK'] = 5;
156 $msgcode['object']['ports']['addPort']['ERR1'] = 101;
157 $msgcode['object']['ports']['addPort']['ERR2'] = 100;
158 $msgcode['object']['ports']['editPort']['OK'] = 6;
159 $msgcode['object']['ports']['editPort']['ERR1'] = 101;
160 $msgcode['object']['ports']['editPort']['ERR2'] = 100;
161 $msgcode['object']['ports']['delPort']['OK'] = 7;
162 $msgcode['object']['ports']['delPort']['ERR'] = 100;
163 $msgcode['object']['ports']['linkPort']['OK'] = 8;
164 $msgcode['object']['ports']['linkPort']['ERR'] = 100;
165 $msgcode['object']['ports']['unlinkPort']['OK'] = 9;
166 $msgcode['object']['ports']['unlinkPort']['ERR'] = 100;
167 $msgcode['object']['ports']['addMultiPorts']['OK'] = 10;
168 $msgcode['object']['ports']['addMultiPorts']['ERR'] = 123;
169 $msgcode['object']['ports']['useup']['OK'] = 11;
170 $msgcode['object']['ports']['useup']['ERR'] = 124;
171 $msgcode['object']['ipv4']['updIPv4Allocation']['OK'] = 12;
172 $msgcode['object']['ipv4']['updIPv4Allocation']['ERR'] = 100;
173 $msgcode['object']['ipv4']['addIPv4Allocation']['OK'] = 13;
174 $msgcode['object']['ipv4']['addIPv4Allocation']['ERR1'] = 170;
175 $msgcode['object']['ipv4']['addIPv4Allocation']['ERR2'] = 100;
176 $msgcode['object']['ipv4']['delIPv4Allocation']['OK'] = 14;
177 $msgcode['object']['ipv4']['delIPv4Allocation']['ERR'] = 100;
178 $msgcode['object']['edit']['clearSticker']['OK'] = 15;
179 $msgcode['object']['edit']['clearSticker']['ERR'] = 120;
180 $msgcode['object']['edit']['update']['OK'] = 16;
181 $msgcode['object']['edit']['update']['ERR'] = 121;
182 $msgcode['object']['edit']['updateStickers']['OK'] = 17;
183 $msgcode['object']['edit']['updateStickers']['ERR'] = 122;
184 $msgcode['object']['editrspvs']['addLB']['OK'] = 18;
185 $msgcode['object']['editrspvs']['addLB']['ERR'] = 137;
186 $msgcode['object']['editrspvs']['delLB']['OK'] = 19;
187 $msgcode['object']['editrspvs']['delLB']['ERR'] = 129;
188 $msgcode['object']['editrspvs']['updLB']['OK'] = 20;
189 $msgcode['object']['editrspvs']['updLB']['ERR'] = 134;
190 $msgcode['object']['autoports']['generate']['OK'] = 21;
191 $msgcode['object']['autoports']['generate']['ERR'] = 142;
192 $msgcode['object']['tags']['saveTags']['OK'] = 22;
193 $msgcode['object']['tags']['saveTags']['ERR'] = 143;
194 $msgcode['object']['livevlans']['setPortVLAN']['ERR1'] = 156;
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'];
203
204 $page['ipv4space']['title'] = 'IPv4 space';
205 $page['ipv4space']['parent'] = 'index';
206 $tab['ipv4space']['default'] = 'Browse';
207 $tab['ipv4space']['newrange'] = 'Manage';
208 $tabhandler['ipv4space']['default'] = 'renderIPv4Space';
209 $tabhandler['ipv4space']['newrange'] = 'renderIPv4SpaceEditor';
210 $ophandler['ipv4space']['newrange']['addIPv4Prefix'] = 'addIPv4Prefix';
211 $ophandler['ipv4space']['newrange']['delIPv4Prefix'] = 'delIPv4Prefix';
212 $ophandler['ipv4space']['newrange']['updIPv4Prefix'] = 'updIPv4Prefix';
213 $msgcode['ipv4space']['newrange']['addIPv4Prefix']['OK'] = 23;
214 $msgcode['ipv4space']['newrange']['addIPv4Prefix']['ERR'] = 100;
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;
219 $msgcode['ipv4space']['newrange']['delIPv4Prefix']['OK'] = 24;
220 $msgcode['ipv4space']['newrange']['delIPv4Prefix']['ERR'] = 100;
221
222 $page['iprange']['title_handler'] = 'dynamic_title_iprange';
223 $page['iprange']['parent'] = 'ipv4space';
224 $page['iprange']['bypass'] = 'id';
225 $page['iprange']['bypass_type'] = 'uint';
226 $page['iprange']['autotagloader'] = 'loadIPv4PrefixAutoTags';
227 $page['iprange']['tagloader'] = 'loadIPv4PrefixTags';
228 $tab['iprange']['default'] = 'Browse';
229 $tab['iprange']['properties'] = 'Properties';
230 $tab['iprange']['liveptr'] = 'Live PTR';
231 $tab['iprange']['tags'] = 'Tags';
232 $tabhandler['iprange']['default'] = 'renderIPv4Network';
233 $tabhandler['iprange']['properties'] = 'renderIPv4NetworkProperties';
234 $tabhandler['iprange']['liveptr'] = 'renderLivePTR';
235 $tabhandler['iprange']['tags'] = 'renderIPv4PrefixTags';
236 $trigger['iprange']['tags'] = 'trigger_tags';
237 $ophandler['iprange']['properties']['editRange'] = 'updIPv4Prefix';
238 $ophandler['iprange']['liveptr']['importPTRData'] = 'importPTRData';
239 $ophandler['iprange']['tags']['saveTags'] = 'saveEntityTags';
240 $msgcode['iprange']['properties']['editRange']['OK'] = 25;
241 $msgcode['iprange']['properties']['editRange']['ERR'] = 100;
242 $msgcode['iprange']['liveptr']['importPTRData']['OK'] = 26;
243 $msgcode['iprange']['liveptr']['importPTRData']['ERR'] = 141;
244 $msgcode['ipv4space']['newrange']['updIPv4Prefix'] = $msgcode['iprange']['properties']['editRange'];
245
246 $page['ipaddress']['title_handler'] = 'dynamic_title_ipaddress';
247 $page['ipaddress']['parent'] = 'iprange';
248 $page['ipaddress']['bypass'] = 'ip';
249 $page['ipaddress']['bypass_type'] = 'inet4';
250 $page['ipaddress']['autotagloader'] = 'loadIPv4AddressAutoTags';
251 $tab['ipaddress']['default'] = 'Browse';
252 $tab['ipaddress']['properties'] = 'Properties';
253 $tab['ipaddress']['assignment'] = 'Allocation';
254 $tab['ipaddress']['editrslist'] = '[SLB real servers]';
255 $tabhandler['ipaddress']['default'] = 'renderIPv4Address';
256 $tabhandler['ipaddress']['properties'] = 'renderIPv4AddressProperties';
257 $tabhandler['ipaddress']['assignment'] = 'renderIPv4AddressAllocations';
258 $tabhandler['ipaddress']['editrslist'] = 'dragon';
259 $ophandler['ipaddress']['properties']['editAddress'] = 'editAddress';
260 $ophandler['ipaddress']['assignment']['delIPv4Allocation'] = 'delIPv4Allocation';
261 $ophandler['ipaddress']['assignment']['updIPv4Allocation'] = 'updIPv4Allocation';
262 $ophandler['ipaddress']['assignment']['addIPv4Allocation'] = 'addIPv4Allocation';
263 $msgcode['ipaddress']['properties']['editAddress']['OK'] = 27;
264 $msgcode['ipaddress']['properties']['editAddress']['ERR'] = 100;
265
266 $page['ipv4slb']['title'] = 'IPv4 SLB';
267 $page['ipv4slb']['parent'] = 'index';
268 $page['ipv4slb']['handler'] = 'renderIPv4SLB';
269
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';
279 $msgcode['ipv4vslist']['edit']['add']['OK'] = 28;
280 $msgcode['ipv4vslist']['edit']['add']['ERR1'] = 132;
281 $msgcode['ipv4vslist']['edit']['add']['ERR2'] = 100;
282 $msgcode['ipv4vslist']['edit']['del']['OK'] = 29;
283 $msgcode['ipv4vslist']['edit']['del']['ERR'] = 130;
284 $msgcode['ipv4vslist']['edit']['upd']['OK'] = 30;
285 $msgcode['ipv4vslist']['edit']['upd']['ERR'] = 135;
286 $msgcode['ipv4vs']['edit']['updIPv4VS'] = $msgcode['ipv4vslist']['edit']['upd'];
287
288 $page['ipv4vs']['title_handler'] = 'dynamic_title_vservice';
289 $page['ipv4vs']['parent'] = 'ipv4vslist';
290 $page['ipv4vs']['bypass'] = 'vs_id';
291 $page['ipv4vs']['bypass_type'] = 'uint';
292 $page['ipv4vs']['tagloader'] = 'loadIPv4VSTags';
293 $page['ipv4vs']['autotagloader'] = 'loadIPv4VSAutoTags';
294 $tab['ipv4vs']['default'] = 'View';
295 $tab['ipv4vs']['edit'] = 'Edit';
296 $tab['ipv4vs']['editlblist'] = 'Load balancers';
297 $tab['ipv4vs']['tags'] = 'Tags';
298 $tabhandler['ipv4vs']['default'] = 'renderVirtualService';
299 $tabhandler['ipv4vs']['edit'] = 'renderEditVService';
300 $tabhandler['ipv4vs']['editlblist'] = 'renderVServiceLBForm';
301 $tabhandler['ipv4vs']['tags'] = 'renderIPv4VSTags';
302 $ophandler['ipv4vs']['edit']['updIPv4VS'] = 'updateVService';
303 $ophandler['ipv4vs']['tags']['saveTags'] = 'saveEntityTags';
304 $ophandler['ipv4vs']['editlblist']['addLB'] = 'addLoadBalancer';
305 $ophandler['ipv4vs']['editlblist']['delLB'] = 'deleteLoadBalancer';
306 $ophandler['ipv4vs']['editlblist']['updLB'] = 'updateLoadBalancer';
307 $trigger['ipv4vs']['tags'] = 'trigger_tags';
308
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';
318 $msgcode['ipv4rsplist']['edit']['add']['OK'] = 31;
319 $msgcode['ipv4rsplist']['edit']['add']['ERR'] = 100;
320 $msgcode['ipv4rsplist']['edit']['del']['OK'] = 32;
321 $msgcode['ipv4rsplist']['edit']['del']['ERR'] = 138;
322 $msgcode['ipv4rsplist']['edit']['upd']['OK'] = 33;
323 $msgcode['ipv4rsplist']['edit']['upd']['ERR'] = 139;
324 $msgcode['ipv4rsp']['edit']['updIPv4RSP'] = $msgcode['ipv4rsplist']['edit']['upd'];
325
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';
333 $tab['ipv4rsp']['edit'] = 'Edit';
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';
354 $ophandler['ipv4rsp']['tags']['saveTags'] = 'saveEntityTags';
355 $ophandler['ipv4rsp']['edit']['updIPv4RSP'] = 'updateRSPool';
356 $msgcode['ipv4rsp']['editrslist']['addRS']['OK'] = 34;
357 $msgcode['ipv4rsp']['editrslist']['addRS']['ERR'] = 126;
358 $msgcode['ipv4rsp']['editrslist']['delRS']['OK'] = 35;
359 $msgcode['ipv4rsp']['editrslist']['delRS']['ERR'] = 128;
360 $msgcode['ipv4rsp']['editrslist']['updRS']['OK'] = 36;
361 $msgcode['ipv4rsp']['editrslist']['updRS']['ERR'] = 133;
362 $msgcode['ipv4rsp']['editrslist']['addMany']['OK'] = 37;
363 $msgcode['ipv4rsp']['editrslist']['addMany']['ERR1'] = 131;
364 $msgcode['ipv4rsp']['editrslist']['addMany']['ERR2'] = 127;
365 $msgcode['ipv4rsp']['rsinservice']['upd']['OK'] = 38;
366 $msgcode['ipv4rsp']['rsinservice']['upd']['ERR'] = 140;
367
368 $page['rservers']['title'] = 'Real servers';
369 $page['rservers']['parent'] = 'ipv4slb';
370 $page['rservers']['handler'] = 'renderRealServerList';
371
372 $page['lbs']['title'] = 'Load balancers';
373 $page['lbs']['parent'] = 'ipv4slb';
374 $page['lbs']['handler'] = 'renderLBList';
375
376 $page['search']['title_handler'] = 'dynamic_title_search';
377 $page['search']['handler'] = 'renderSearchResults';
378 $page['search']['parent'] = 'index';
379 $page['search']['bypass'] = 'q';
380
381 $page['config']['title'] = 'Configuration';
382 $page['config']['handler'] = 'renderConfigMainpage';
383 $page['config']['parent'] = 'index';
384
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';
395 $msgcode['userlist']['edit']['updateUser']['OK'] = 39;
396 $msgcode['userlist']['edit']['updateUser']['ERR1'] = 103;
397 $msgcode['userlist']['edit']['updateUser']['ERR1'] = 104;
398 $msgcode['userlist']['edit']['createUser']['OK'] = 40;
399 $msgcode['userlist']['edit']['createUser']['ERR'] = 102;
400 $msgcode['userlist']['edit']['disableUser']['OK'] = 41;
401 $msgcode['userlist']['edit']['disableUser']['ERR1'] = 107;
402 $msgcode['userlist']['edit']['disableUser']['ERR2'] = 106;
403 $msgcode['userlist']['edit']['enableUser']['OK'] = 42;
404 $msgcode['userlist']['edit']['enableUser']['ERR'] = 105;
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';
411 $page['user']['autotagloader'] = 'getUserAutoTags';
412 $tab['user']['default'] = 'View';
413 $tab['user']['tags'] = 'Tags';
414 $tabhandler['user']['default'] = 'renderUser';
415 $tabhandler['user']['tags'] = 'renderUserTags';
416 $ophandler['user']['tags']['saveTags'] = 'saveEntityTags';
417
418 $page['perms']['title'] = 'Permissions';
419 $page['perms']['parent'] = 'config';
420 $tab['perms']['default'] = 'View';
421 $tab['perms']['edit'] = 'Edit';
422 $tabhandler['perms']['default'] = 'renderRackCodeViewer';
423 $tabhandler['perms']['edit'] = 'renderRackCodeEditor';
424 $ophandler['perms']['edit']['saveRackCode'] = 'saveRackCode';
425 $msgcode['perms']['edit']['saveRackCode']['OK'] = 43;
426 $msgcode['perms']['edit']['saveRackCode']['ERR1'] = 154;
427 $msgcode['perms']['edit']['saveRackCode']['ERR2'] = 155;
428
429 $page['portmap']['title'] = 'Port compatibility map';
430 $page['portmap']['parent'] = 'config';
431 $tab['portmap']['default'] = 'View';
432 $tab['portmap']['edit'] = 'Change';
433 $tabhandler['portmap']['default'] = 'renderPortMapViewer';
434 $tabhandler['portmap']['edit'] = 'renderPortMapEditor';
435 $ophandler['portmap']['edit']['save'] = 'savePortMap';
436 $msgcode['portmap']['edit']['save']['OK'] = 44;
437 $msgcode['portmap']['edit']['save']['ERR'] = 108;
438
439 $page['attrs']['title'] = 'Attributes';
440 $page['attrs']['parent'] = 'config';
441 $tab['attrs']['default'] = 'View';
442 $tab['attrs']['editattrs'] = 'Edit attributes';
443 $tab['attrs']['editmap'] = 'Edit map';
444 $tabhandler['attrs']['default'] = 'renderAttributes';
445 $tabhandler['attrs']['editattrs'] = 'renderEditAttributesForm';
446 $tabhandler['attrs']['editmap'] = 'renderEditAttrMapForm';
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';
452 $msgcode['attrs']['editattrs']['add']['OK'] = 45;
453 $msgcode['attrs']['editattrs']['add']['ERR'] = 116;
454 $msgcode['attrs']['editattrs']['upd']['OK'] = 46;
455 $msgcode['attrs']['editattrs']['upd']['ERR'] = 115;
456 $msgcode['attrs']['editattrs']['del']['OK'] = 47;
457 $msgcode['attrs']['editattrs']['del']['ERR'] = 117;
458 $msgcode['attrs']['editmap']['add']['OK'] = 48;
459 $msgcode['attrs']['editmap']['add']['ERR'] = 118;
460 $msgcode['attrs']['editmap']['del']['OK'] = 49;
461 $msgcode['attrs']['editmap']['del']['ERR'] = 119;
462
463 $page['dict']['title'] = 'Dictionary';
464 $page['dict']['parent'] = 'config';
465 $tab['dict']['default'] = 'View';
466 $tab['dict']['edit'] = 'Edit words';
467 $tab['dict']['chapters'] = 'Manage chapters';
468 $tabhandler['dict']['default'] = 'renderDictionary';
469 $tabhandler['dict']['edit'] = 'renderDictionaryEditor';
470 $tabhandler['dict']['chapters'] = 'renderChaptersEditor';
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';
477 $msgcode['dict']['edit']['del']['OK'] = 50;
478 $msgcode['dict']['edit']['del']['ERR'] = 111;
479 $msgcode['dict']['edit']['upd']['OK'] = 51;
480 $msgcode['dict']['edit']['upd']['ERR'] = 109;
481 $msgcode['dict']['edit']['add']['OK'] = 52;
482 $msgcode['dict']['edit']['add']['ERR'] = 110;
483 $msgcode['dict']['chapters']['del']['OK'] = 53;
484 $msgcode['dict']['chapters']['del']['ERR'] = 114;
485 $msgcode['dict']['chapters']['upd']['OK'] = 54;
486 $msgcode['dict']['chapters']['upd']['ERR'] = 113;
487 $msgcode['dict']['chapters']['add']['OK'] = 55;
488 $msgcode['dict']['chapters']['add']['ERR'] = 112;
489
490 $page['ui']['title'] = 'User interface';
491 $page['ui']['parent'] = 'config';
492 $tab['ui']['default'] = 'View';
493 $tab['ui']['edit'] = 'Change';
494 $tab['ui']['reset'] = 'Reset';
495 $tabhandler['ui']['default'] = 'renderUIConfig';
496 $tabhandler['ui']['edit'] = 'renderUIConfigEditForm';
497 $tabhandler['ui']['reset'] = 'renderUIResetForm';
498 $ophandler['ui']['edit']['upd'] = 'updateUI';
499 $ophandler['ui']['reset']['go'] = 'resetUIConfig';
500 $msgcode['ui']['edit']['upd']['OK'] = 56;
501 $msgcode['ui']['edit']['upd']['ERR'] = 125;
502 $msgcode['ui']['reset']['go']['OK'] = 57;
503
504 $page['tagtree']['title'] = 'Tag tree';
505 $page['tagtree']['parent'] = 'config';
506 $tab['tagtree']['default'] = 'View';
507 $tab['tagtree']['edit'] = 'Edit';
508 $tabhandler['tagtree']['default'] = 'renderTagTree';
509 $tabhandler['tagtree']['edit'] = 'renderTagTreeEditor';
510 $ophandler['tagtree']['edit']['destroyTag'] = 'destroyTag';
511 $ophandler['tagtree']['edit']['createTag'] = 'createTag';
512 $ophandler['tagtree']['edit']['updateTag'] = 'updateTag';
513 $msgcode['tagtree']['edit']['destroyTag']['OK'] = 58;
514 $msgcode['tagtree']['edit']['destroyTag']['ERR'] = 144;
515 $msgcode['tagtree']['edit']['createTag']['OK'] = 59;
516 $msgcode['tagtree']['edit']['createTag']['ERR1'] = 145;
517 $msgcode['tagtree']['edit']['createTag']['ERR2'] = 146;
518 $msgcode['tagtree']['edit']['createTag']['ERR3'] = 147;
519 $msgcode['tagtree']['edit']['updateTag']['OK'] = 60;
520 $msgcode['tagtree']['edit']['updateTag']['ERR1'] = 145;
521 $msgcode['tagtree']['edit']['updateTag']['ERR2'] = 148;
522
523 $page['myaccount']['title'] = 'My account';
524 $page['myaccount']['parent'] = 'config';
525 $tab['myaccount']['default'] = 'Info';
526 $tab['myaccount']['mypassword'] = 'Password change';
527 $tab['myaccount']['myrealname'] = '[Real name change]';
528 $trigger['myaccount']['mypassword'] = 'trigger_passwdchange';
529 $tabhandler['myaccount']['default'] = 'renderMyAccount';
530 $tabhandler['myaccount']['mypassword'] = 'renderMyPasswordEditor';
531 $tabhandler['myaccount']['myrealname'] = 'dragon';
532 $ophandler['myaccount']['mypassword']['changeMyPassword'] = 'changeMyPassword';
533 $msgcode['myaccount']['mypassword']['changeMyPassword']['OK'] = 61;
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;
538
539 $page['reports']['title'] = 'Reports';
540 $page['reports']['parent'] = 'index';
541 $tab['reports']['default'] = 'System';
542 $tab['reports']['rackcode'] = 'RackCode';
543 $tab['reports']['local'] = 'Local';
544 $trigger['reports']['local'] = 'trigger_localreports';
545 $tabhandler['reports']['default'] = 'renderSystemReports';
546 $tabhandler['reports']['rackcode'] = 'renderRackCodeReports';
547 $tabhandler['reports']['local'] = 'renderLocalReports';
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.
552 function 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
567 function showPathAndSearch ($pageno)
568 {
569 global $root, $page;
570 // Path.
571 echo "<td class=activemenuitem width='99%'>" . getConfigVar ('enterprise');
572 $path = getPath ($pageno);
573 foreach ($path as $no)
574 {
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]';
582 echo ": <a href='${root}?page=${no}&tab=default";
583 foreach ($title['params'] as $param_name => $param_value)
584 echo "&${param_name}=${param_value}";
585 echo "'>" . $title['name'] . "</a>";
586 }
587 echo "</td>";
588 // Search form.
589 echo "<td><table border=0 cellpadding=0 cellspacing=0><tr><td>Search:</td>";
590 echo "<form name=search method=get action='${root}'><td>";
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
596 function getTitle ($pageno, $tabno)
597 {
598 global $page;
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
607 return getConfigVar ('enterprise');
608 }
609
610 function showTabs ($pageno, $tabno)
611 {
612 global $tab, $root, $page, $remote_username, $trigger, $tabextraclass;
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.
619 if (!permitted ($pageno, $tabidx))
620 continue;
621 // Dynamic tabs should only be shown in certain cases (trigger exists and returns true).
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 }
631 $class = ($tabidx == $tabno) ? 'current' : 'std';
632 $extra = (isset ($tabextraclass[$pageno][$tabidx])) ? $tabextraclass[$pageno][$tabidx] : '';
633 echo "<li><a class=${class}{$extra}";
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.
648 function 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
657 accessibleSubpage ($cpageno) == TRUE
658 )
659 $children[$cpageno] = $cpage;
660 return $children;
661 }
662
663 function 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 ?>