~ubuntu-dev/ubuntu/lucid/zabbix/lucid-201002101903

« back to all changes in this revision

Viewing changes to frontends/php/include/page_header.php

  • Committer: Bazaar Package Importer
  • Author(s): Michael Ablassmeier
  • Date: 2009-04-05 19:10:27 UTC
  • mfrom: (1.1.9 upstream) (8.2.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090405191027-lxd44l6jqdcfp2bi
Tags: 1:1.6.4-1
* New upstream release.
* Fix zabbix-frontend-php.template, add missing questions for
  zabbix-server and port (Closes: #522076)
* Loosen up depends for libgnutls (Closes: #522074)

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
        
32
32
        unset($denyed_page_requested);
33
33
 
34
 
        if(!isset($page["type"])) $page["type"] = PAGE_TYPE_HTML;
35
 
        if(!isset($page["file"])) $page["file"] = basename($_SERVER['PHP_SELF']);
 
34
        if(!isset($page['type'])) $page['type'] = PAGE_TYPE_HTML;
 
35
        if(!isset($page['file'])) $page['file'] = basename($_SERVER['PHP_SELF']);
36
36
        
37
37
        if($_REQUEST['fullscreen']=get_request('fullscreen', 0)) define('ZBX_PAGE_NO_MENU', 1);
38
38
 
42
42
        /* Init CURRENT NODE ID */
43
43
 
44
44
        init_nodes();
45
 
        
 
45
 
46
46
        /* set Page header */
47
 
        switch($page["type"]){
 
47
        switch($page['type']){
48
48
                case PAGE_TYPE_IMAGE:
49
49
                        set_image_header();
50
50
                        define('ZBX_PAGE_NO_MENU', 1);
78
78
                                        $page['title'] .= ' ('.$curr_node_data['name'].')';
79
79
                        }
80
80
                        
81
 
                        if((defined('ZBX_PAGE_DO_REFRESH') || defined('ZBX_PAGE_DO_JS_REFRESH')) && $USER_DETAILS["refresh"]){
 
81
                        if((defined('ZBX_PAGE_DO_REFRESH') || defined('ZBX_PAGE_DO_JS_REFRESH')) && $USER_DETAILS['refresh']){
82
82
                                $page['title'] .= ' [refreshed every '.$USER_DETAILS['refresh'].' sec]';
83
83
                        }
84
84
                break; 
102
102
        $ZBX_MENU = array(
103
103
                'view'=>array(
104
104
                                'label'                 => S_MONITORING,
 
105
                                'user_type'             => USER_TYPE_ZABBIX_USER,
105
106
                                'node_perm'             => PERM_READ_LIST,
106
107
                                'default_page_id'       => 0,
107
108
                                'pages'=>array(
163
164
                                ),
164
165
                'cm'=>array(
165
166
                                'label'                 => S_INVENTORY,
 
167
                                'user_type'             => USER_TYPE_ZABBIX_USER,
166
168
                                'node_perm'             => PERM_READ_LIST,
167
169
                                'default_page_id'       => 0,
168
170
                                'pages'=>array(
171
173
                                ),
172
174
                'reports'=>array(
173
175
                                'label'                 => S_REPORTS,
 
176
                                'user_type'             => USER_TYPE_ZABBIX_USER,
174
177
                                'node_perm'             => PERM_READ_LIST,
175
178
                                'default_page_id'       => 0,
176
179
                                'pages'=>array(
208
211
                                                        'sub_pages'=>array('popup_trexpr.php')
209
212
                                                ),
210
213
                                        array('url'=>'actionconf.php'   ,'label'=>S_ACTIONS),
211
 
                                        array('url'=>'graphs.php'       ,'label'=>S_GRAPHS,
212
 
                                                'sub_pages'=>array('popup_gitem.php')
213
 
                                                ),
214
 
                                        array('url'=>'screenconf.php'   ,'label'=>S_SCREENS,
215
 
                                                'sub_pages'=>array('screenedit.php')
216
 
                                                ),
217
 
                                        array('url'=>'sysmaps.php'      ,'label'=>S_MAPS,
218
 
                                                'sub_pages'=>array('sysmap.php','popup_link_tr.php')
219
 
                                                ),
220
 
                                        array('url'=>'services.php'     ,'label'=>S_IT_SERVICES,
221
 
                                                'sub_pages'=>array('services_form.php') 
 
214
                                        array('url'=>'graphs.php',
 
215
                                                        'label'=>S_GRAPHS,
 
216
                                                        'sub_pages'=>array('popup_gitem.php')
 
217
                                                ),
 
218
                                        array('url'=>'screenconf.php',
 
219
                                                        'label'=>S_SCREENS,
 
220
                                                        'sub_pages'=>array('screenedit.php')
 
221
                                                ),
 
222
                                        array('url'=>'sysmaps.php',
 
223
                                                        'label'=>S_MAPS,
 
224
                                                        'sub_pages'=>array('sysmap.php','popup_link_tr.php')
 
225
                                                ),
 
226
                                        array('url'=>'services.php',
 
227
                                                        'label'=>S_IT_SERVICES,
 
228
                                                        'sub_pages'=>array('services_form.php') 
222
229
                                                ),
223
230
                                        array('url'=>'discoveryconf.php','label'=>S_DISCOVERY),
224
231
                                        array('url'=>'exp_imp.php'      ,'label'=>S_EXPORT_IMPORT),
232
239
                                'default_page_id'       => 1,
233
240
                                'forse_disable_subnodes'=> true,
234
241
                                'pages'=>array(
235
 
                                        ZBX_DISTRIBUTED ? array('url'=>'nodes.php'      ,'label'=>S_NODES) : null ,
 
242
                                        ZBX_DISTRIBUTED?array('url'=>'nodes.php','label'=>S_NODES):null,
236
243
                                        array('url'=>'authentication.php'       ,'label'=>S_AUTHENTICATION),
237
 
                                        array('url'=>'users.php'        ,'label'=>S_USERS               ,
 
244
                                        array('url'=>'users.php',
 
245
                                                'label'=>S_USERS,
238
246
                                                'sub_pages'=>array('popup_media.php','popup_usrgrp.php','popup_right.php','popup_users.php')
239
247
                                                ),
240
 
                                        array('url'=>'media_types.php'  ,'label'=>S_MEDIA_TYPES         ),
 
248
                                        array('url'=>'media_types.php'  ,'label'=>S_MEDIA_TYPES),
241
249
                                        array('url'=>'scripts.php'      ,'label'=>S_SCRIPTS),
242
 
                                        array('url'=>'audit.php'        ,'label'=>S_AUDIT               ),
243
 
                                        array('url'=>'queue.php'        ,'label'=>S_QUEUE       ),
244
 
                                        array('url'=>'report4.php'      ,'label'=>S_NOTIFICATIONS       ),
 
250
                                        array('url'=>'audit.php'        ,'label'=>S_AUDIT),
 
251
                                        array('url'=>'queue.php'        ,'label'=>S_QUEUE),
 
252
                                        array('url'=>'report4.php'      ,'label'=>S_NOTIFICATIONS),
245
253
                                        array('url'=>'locales.php'      ,'label'=>S_LOCALES     ),
246
 
                                        array('url'=>'instal.php'       ,'label'=>S_INSTALLATION        ,
 
254
                                        array('url'=>'instal.php'       ,'label'=>S_INSTALLATION,
247
255
                                                'sub_pages'=>array('setup.php','warning.php'))
248
256
                                        )
249
257
                                ),
250
258
                'login'=>array(
251
259
                                'label'                 => S_LOGIN,
 
260
                                'user_type'             =>      0,
252
261
                                'default_page_id'       => 0,
253
262
                                'forse_disable_subnodes'=> true,
254
263
                                'pages'=>array(
255
 
                                        array('url'=>'index.php',
256
 
                                                'sub_pages'=>array('profile.php')
257
 
                                                )
 
264
                                        array('url'=>'index.php','sub_pages'=>array('profile.php'))
258
265
                                        )
259
266
                                )
260
267
                );
261
 
 
262
 
        $main_menu_row  = array();
263
 
        $sub_menu_row   = array();
264
 
 
265
 
        foreach($ZBX_MENU as $label=>$sub){
266
 
// Check permissions for main menu
267
 
                unset($deny);
268
 
                if(!defined('ZBX_PAGE_NO_AUTHERIZATION')){
269
 
                        if(isset($sub['user_type'])){
270
 
                                if($USER_DETAILS['type'] < $sub['user_type']){
271
 
                                        $deny = true;
272
 
                                }
273
 
                        }
274
 
 
275
 
                        if(isset($sub['node_perm'])){ 
276
 
                                if(0 == count(get_accessible_nodes_by_user($USER_DETAILS,$sub['node_perm']))){
277
 
                                        $deny = true;
278
 
                                }
279
 
                        }
280
 
 
281
 
                        if($label=='login'){
282
 
                                $deny = true;                           
283
 
/*                              if(isset($USER_DETAILS['sessionid']))
284
 
                                        $sub['label'] = S_LOGOUT;
285
 
                                else
286
 
                                        unset($deny);
287
 
*/
288
 
                        }
289
 
                }
290
 
 
291
 
// End of main menu permissions checking
292
 
 
293
 
                unset($menu_url);
294
 
                foreach($sub['pages'] as $id => $sub_pages){
295
 
 
296
 
                        if(!defined('ZBX_PAGE_NO_AUTHERIZATION')){
297
 
                                if(isset($sub_pages['user_type'])){
298
 
                                        if($USER_DETAILS['type'] < $sub_pages['user_type']){
299
 
                                                unset($sub['pages'][$id]);
300
 
                                                continue;
301
 
                                        }
302
 
                                }
303
 
 
304
 
                                if(isset($sub_pages['node_perm'])){
305
 
                                        if ( 0 == count(get_accessible_nodes_by_user($USER_DETAILS,$sub_pages['node_perm']))){
306
 
                                                unset($sub['pages'][$id]);
307
 
                                                continue;
308
 
                                        }
309
 
                                }
310
 
                        }
311
 
 
312
 
                        if(isset($page_exist)) continue; 
313
 
                                
314
 
                        if($page['file'] == $sub_pages['url']){
315
 
                                if(isset($sub_pages['label'])){
316
 
                                        $menu_url = $sub_pages['url'];
317
 
                                }
318
 
                                
319
 
                                $page_exist = true;
320
 
                                $sub['pages'][$id]['active'] = true; /* mark as active */
321
 
                        }
322
 
                        else if(isset($sub_pages['sub_pages'])){
323
 
                                if(str_in_array($page['file'], $sub_pages['sub_pages'])){
324
 
                                        if(isset($sub_pages['label'])){
325
 
                                                $menu_url = $sub_pages['url'];
326
 
                                        }
327
 
                                        $page_exist = true;
328
 
                                        $sub['pages'][$id]['active'] = true; /* mark as active */
329
 
                                }                                       
330
 
                        }
331
 
 
332
 
                        if (isset($page_exist) &&
333
 
                                ( isset($sub['forse_disable_subnodes']) || isset($sub_pages['forse_disable_subnodes']) ) &&
334
 
                                !defined('ZBX_DISABLE_SUBNODES'))
335
 
                        {
336
 
                                        define('ZBX_DISABLE_SUBNODES', 1);
337
 
                        }
338
 
                }
339
 
 
340
 
                if(isset($menu_url)){ /* active menu */
341
 
                        $class = 'active';
342
 
 
343
 
                        update_profile('web.menu.'.$label.'.last', $menu_url, PROFILE_TYPE_STR);
344
 
 
345
 
                        if(isset($deny)){
346
 
                                $denyed_page_requested = true;
347
 
                                continue;
348
 
                        }
349
 
 
350
 
                        foreach($sub['pages'] as $sub_pages){
351
 
                                if(!isset($sub_pages['label'])) continue;
352
 
 
353
 
                                $label = new CLink($sub_pages['label'], $sub_pages['url'],'highlight');
354
 
                                if(isset($sub_pages['active'])) $label = new CSpan($label, 'active');
355
 
                                
356
 
                                array_push($sub_menu_row, 
357
 
                                        $label,
358
 
                                        new CSpan(SPACE.SPACE.'|'.SPACE.SPACE, 'divider')
359
 
                                        );
360
 
                        }
361
 
                }
362
 
                else{
363
 
                        if(isset($deny)) continue;
364
 
 
365
 
                        $class = 'horizontal_menu_n';
366
 
 
367
 
                        $menu_url = get_profile('web.menu.'.$label.'.last',false);
368
 
 
369
 
                        if(!$menu_url)
370
 
                                $menu_url = $sub['pages'][$sub['default_page_id']]['url'];
371
 
                }
372
 
 
373
 
                array_push($main_menu_row, new CCol(new CLink($sub['label'], $menu_url, 'highlight'),$class));
374
 
                unset($menu_url, $class);
 
268
//SDI($USER_DETAILS);
 
269
        $deny = !defined('ZBX_PAGE_NO_AUTHERIZATION');
 
270
        $main_menu      = array();
 
271
        $sub_menus      = array();
 
272
        foreach($ZBX_MENU as $label => $menu){
 
273
// Check to show menu or not
 
274
                $show_menu = true;
 
275
 
 
276
                if(isset($menu['user_type'])){
 
277
                        $show_menu &= ($menu['user_type'] <= $USER_DETAILS['type']);
 
278
                }
 
279
 
 
280
                if(isset($menu['node_perm']) && isset($DB['DB']) && !is_null($DB['DB'])){
 
281
                        $available_nodes = get_accessible_nodes_by_user($USER_DETAILS,$menu['node_perm']);
 
282
                        $show_menu &= (0 < count($available_nodes));
 
283
                }
 
284
 
 
285
                if($label == 'login'){
 
286
                        $show_menu = false;
 
287
                }
 
288
 
 
289
//---
 
290
                $menu_class = 'horizontal_menu_n';
 
291
                
 
292
                $page_exists = false;
 
293
                $sub_menus[$label] = array();
 
294
                foreach($menu['pages'] as $id => $sub_page){
 
295
                        $show_sub_menu = true;
 
296
// show check
 
297
                        if(!isset($sub_page['label'])) $show_sub_menu = false;
 
298
 
 
299
                        if(isset($sub_page['user_type']) && ($USER_DETAILS['type'] < $sub_page['user_type'])){
 
300
                                $show_sub_menu = false;
 
301
                        }
 
302
 
 
303
                        if(isset($sub_pages['node_perm']) && isset($DB['DB']) && !is_null($DB['DB'])){
 
304
                                $available_nodes = get_accessible_nodes_by_user($USER_DETAILS,$sub_page['node_perm']);                          
 
305
                                if(0 == count($available_nodes)){
 
306
                                        $show_sub_menu = false;
 
307
                                }
 
308
                        }
 
309
//----------
 
310
                        $row = array('menu_text' => isset($sub_page['label'])?$sub_page['label']:'', 
 
311
                                                        'menu_url'=> $sub_page['url'],
 
312
                                                        'class'=> 'highlight',
 
313
                                                        'selected'=> false);
 
314
 
 
315
                        $sub_menu_active = ($page['file'] == $sub_page['url']);
 
316
                        $sub_menu_active |=  (isset($sub_page['sub_pages']) && str_in_array($page['file'], $sub_page['sub_pages']));
 
317
 
 
318
                        if($sub_menu_active){
 
319
// PERMISSION CHECK
 
320
                                $deny &= ($USER_DETAILS['type'] < $menu['user_type']);
 
321
// END OF PERMISSION CHECK 
 
322
                                $menu_class = 'active';
 
323
                                $page_exists = true;
 
324
                                $page['menu'] = $label;
 
325
                                $row['selected'] = true;
 
326
                                
 
327
                                if(!defined('ZBX_PAGE_NO_MENU'))
 
328
                                        update_profile('web.menu.'.$label.'.last', $sub_page['url'], PROFILE_TYPE_STR);
 
329
                        }
 
330
                        
 
331
                        if($show_sub_menu) $sub_menus[$label][] = $row;
 
332
                }
 
333
                
 
334
                if($page_exists && !defined('ZBX_DISABLE_SUBNODES') && 
 
335
                        (isset($menu['forse_disable_subnodes']) || isset($sub_page['forse_disable_subnodes'])))
 
336
                {
 
337
                        define('ZBX_DISABLE_SUBNODES', 1);
 
338
                }
 
339
//SDI($label.' : '.$show_menu.' : '.$deny);
 
340
                if($page_exists && $deny){
 
341
                        $denyed_page_requested = true;
 
342
                }
 
343
 
 
344
                if(!$show_menu){
 
345
                        unset($sub_menus[$label]);
 
346
                        continue;
 
347
                }
 
348
                
 
349
                $menu_url = get_profile('web.menu.'.$label.'.last',false);                      
 
350
//              if(ZBX_DISABLE_MENU_CACHE == 1) $menu_url = $menu['pages'][$sub_menus['default_page_id']]['url'];
 
351
 
 
352
                $mmenu_entry = new CCol($menu['label'], $menu_class);
 
353
                $mmenu_entry->addOption('id', $label);
 
354
                $mmenu_entry->addAction('onclick', "javascript: location.href = '$menu_url';");
 
355
                $mmenu_entry->addAction('onmouseover', 'javascript: MMenu.mouseOver("'.$label.'");');
 
356
                $mmenu_entry->addAction('onmouseout', 'javascript: MMenu.mouseOut();');
 
357
                
 
358
                array_push($main_menu, $mmenu_entry);
375
359
        }
376
360
 
377
 
        if((!isset($page_exist) && $page['type']!=PAGE_TYPE_XML)){
 
361
        if(!isset($page_exists) && ($page['type']!=PAGE_TYPE_XML)){
378
362
                $denyed_page_requested = true;
379
363
        }
380
364
 
381
365
        zbx_flush_post_cookies(isset($denyed_page_requested));
382
366
 
383
 
        if($page['type'] == PAGE_TYPE_HTML)
384
 
        {
 
367
        if($page['type'] == PAGE_TYPE_HTML){
385
368
?>
386
369
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
387
370
<html xmlns="http://www.w3.org/1999/xhtml">
426
409
 
427
410
<script type="text/javascript" src="js/prototype.js"></script>
428
411
<script type="text/javascript" src="js/common.js"></script>
 
412
<script type="text/javascript" src="js/gpc.js"></script>
429
413
<script type="text/javascript" src="js/ajax_req.js"></script>
430
 
<script type="text/javascript" src="js/url.js"></script>
431
 
<script type="text/javascript" src="js/chkbxrange.js"></script>
 
414
 
432
415
<?php
433
416
        if(isset($page['scripts']) && is_array($page['scripts'])){
434
417
                foreach($page['scripts'] as $id => $script){
456
439
                $req = substr($_SERVER['REQUEST_URI'],0,strpos($_SERVER['REQUEST_URI'],'print')-1);
457
440
                
458
441
                $link = new CLink(bold('&laquo;'.S_BACK_BIG), $req, 'small_font');
459
 
                $link->AddOption('style','padding-left: 10px;');
 
442
                $link->addOption('style','padding-left: 10px;');
460
443
                
461
444
                $printview = new CDiv($link,'printless');
462
 
                $printview->AddOption('style','border: 1px #333 dotted;');
 
445
                $printview->addOption('style','border: 1px #333 dotted;');
463
446
                $printview->Show();
464
447
                
465
448
        }
467
450
        if(!defined('ZBX_PAGE_NO_MENU')){
468
451
COpt::compare_files_with_menu($ZBX_MENU);
469
452
 
470
 
                $help = new CLink(S_HELP, "http://www.zabbix.com/manual/v1.4", "small_font");
471
 
                $help->SetTarget('_blank');
472
 
                $support = new CLink(S_GET_SUPPORT, "http://www.zabbix.com/support.php", "small_font");
473
 
                $support->SetTarget('_blank');
 
453
                $help = new CLink(S_HELP, 'http://www.zabbix.com/documentation.php', 'small_font', null, true);
 
454
                $help->setTarget('_blank');
 
455
                $support = new CLink(S_GET_SUPPORT, 'http://www.zabbix.com/support.php', 'small_font', null, true);
 
456
                $support->setTarget('_blank');
474
457
                $printview = new CLink(S_PRINT, $_SERVER['REQUEST_URI'].(empty($_GET)?'?':'&').'print=1', 'small_font');
475
458
                
476
459
                $page_header_r_col = array($help,'|',$support,'|',$printview);
477
460
 
478
 
                if($USER_DETAILS["alias"]!=ZBX_GUEST_USER){
479
 
                        $page_header_r_col[] = array("|", 
480
 
                                                new CLink(S_PROFILE, "profile.php", "small_font"),"|", 
481
 
                                                new CLink(S_LOGOUT, "index.php?reconnect=1", "small_font"));
 
461
                if($USER_DETAILS['alias']!=ZBX_GUEST_USER){
 
462
                        $page_header_r_col[] = array('|', 
 
463
                                                new CLink(S_PROFILE, 'profile.php', 'small_font'),'|', 
 
464
                                                new CLink(S_LOGOUT, 'index.php?reconnect=1', 'small_font'));
482
465
                } 
483
466
                else {
484
 
                        $page_header_r_col[] = array("|", new CLink(S_LOGIN, "index.php?reconnect=1", "small_font"));
 
467
                        $page_header_r_col[] = array('|', new CLink(S_LOGIN, 'index.php?reconnect=1', 'small_font'));
485
468
                }
486
469
 
487
 
                $logo = new CLink(new CDiv(SPACE,'zabbix_logo'),"http://www.zabbix.com");
488
 
                $logo->SetTarget('_blank');
489
 
//              $logo = new CDiv(SPACE,'zabbix_logo');
490
 
//              $logo->AddAction('onclick',"javascript: document.location = 'http://www.zabbix.com';");         
 
470
                $logo = new CLink(new CDiv(SPACE,'zabbix_logo'),'http://www.zabbix.com/', null, null, true);
 
471
                $logo->setTarget('_blank');
491
472
                
492
 
                $td_r = new CCol($page_header_r_col, "page_header_r");
493
 
                $td_r->AddOption('width','100%');
 
473
                $td_r = new CCol($page_header_r_col, 'page_header_r');
 
474
                $td_r->addOption('width','100%');
494
475
 
495
 
                $top_page_row   = array(new CCol($logo, "page_header_l"), $td_r);
 
476
                $top_page_row   = array(new CCol($logo, 'page_header_l'), $td_r);
496
477
                unset($logo, $page_header_r_col, $help, $support);
497
478
 
498
 
                $table = new CTable(NULL,"page_header");
499
 
                $table->SetCellSpacing(0);
500
 
                $table->SetCellPadding(5);
501
 
                $table->AddRow($top_page_row);
502
 
                $table->Show();
 
479
                $table = new CTable(NULL,'page_header');
 
480
                $table->setCellSpacing(0);
 
481
                $table->setCellPadding(5);
 
482
                $table->addRow($top_page_row);
 
483
                $table->show();
503
484
 
504
485
                $menu_table = new CTable(NULL,'menu');
505
 
                $menu_table->SetCellSpacing(0);
506
 
                $menu_table->SetCellPadding(5);
507
 
                $menu_table->AddRow($main_menu_row);
508
 
 
 
486
                $menu_table->setCellSpacing(0);
 
487
                $menu_table->setCellPadding(5);
 
488
                $menu_table->addRow($main_menu);
 
489
                
509
490
                $node_form = null;
510
 
 
511
491
                if(ZBX_DISTRIBUTED){
512
 
                        $lst_nodes = new CComboBox('switch_node', get_current_nodeid(false), "submit()");
 
492
                        $lst_nodes = new CComboBox('switch_node', get_current_nodeid(false), 'submit()');
513
493
                        $available_nodes = get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_LIST);
 
494
 
514
495
                        $db_nodes = DBselect('SELECT * '.
515
496
                                                ' FROM nodes '.
516
497
                                                ' WHERE '.DBcondition('nodeid',$available_nodes).
517
498
                                                ' ORDER BY name ');
518
499
                        while($node_data = DBfetch($db_nodes)){
519
 
                                $lst_nodes->AddItem($node_data['nodeid'],$node_data['name']);
 
500
                                $lst_nodes->addItem($node_data['nodeid'],$node_data['name']);
520
501
                        }
521
502
 
522
 
                        if($lst_nodes->ItemsCount() > 1){
 
503
                        if($lst_nodes->ItemsCount() > 0){
523
504
                                $node_form = new CForm();
524
 
                                $node_form->AddItem(array(new CSpan(S_CURRENT_NODE,'textcolorstyles'),$lst_nodes));
 
505
                                $node_form->addItem(array(new CSpan(S_CURRENT_NODE,'textcolorstyles'),$lst_nodes));
525
506
                                unset($lst_nodes);
526
507
 
527
508
                                if(!defined('ZBX_DISABLE_SUBNODES')){
528
509
                                        global $ZBX_WITH_SUBNODES;
529
510
 
530
 
                                        $cmd_show_subnodes = new CComboBox('show_subnodes', !empty($ZBX_WITH_SUBNODES) ? 1 : 0, "submit()");
531
 
                                        $cmd_show_subnodes->AddItem(0, S_CURRENT_NODE_ONLY);
532
 
                                        $cmd_show_subnodes->AddItem(1, S_WITH_SUBNODES);
 
511
                                        $cmd_show_subnodes = new CComboBox('show_subnodes', !empty($ZBX_WITH_SUBNODES) ? 1 : 0, 'submit()');
 
512
                                        $cmd_show_subnodes->addItem(0, S_CURRENT_NODE_ONLY);
 
513
                                        $cmd_show_subnodes->addItem(1, S_WITH_SUBNODES);
533
514
 
534
 
                                        $node_form->AddItem(array(SPACE, new CSpan(S_SHOW,'textcolorstyles'), $cmd_show_subnodes));
 
515
                                        $node_form->addItem(array(SPACE, new CSpan(S_SHOW,'textcolorstyles'), $cmd_show_subnodes));
535
516
                                }
536
 
 
537
 
// No need for the button anymore
538
 
//                              $node_form->AddItem(new CButton('submit',S_SWITCH_NODE));
539
517
                        }
540
518
                }
541
519
                
542
520
                $table = new CTable();
543
 
                $table->SetCellSpacing(0);
544
 
                $table->SetCellPadding(0);
545
 
                $table->AddOption('style','width: 100%;');
 
521
                $table->setCellSpacing(0);
 
522
                $table->setCellPadding(0);
 
523
                $table->addOption('style','width: 100%;');
546
524
 
547
525
                $r_col = new CCol($node_form);
548
 
                $r_col->AddOption('style','text-align: right;');
549
 
                
550
 
                $table->AddRow(array($menu_table,$r_col));
551
 
                $table->Show();
552
 
                
 
526
                $r_col->addOption('style','text-align: right;');
 
527
                
 
528
                $table->addRow(array($menu_table,$r_col));
 
529
                
 
530
                $page_menu = new CDiv();
 
531
                $page_menu->addoption('id','mmenu');
 
532
                $page_menu->addItem($table);
 
533
                
 
534
                $menu_selected = false;
 
535
                foreach($sub_menus as $label => $sub_menu){
 
536
                        $sub_menu_table = new CTable(NULL,'sub_menu');
 
537
                        $sub_menu_table->setCellSpacing(0);
 
538
                        $sub_menu_table->setCellPadding(5);
 
539
                        
 
540
                        $sub_menu_row = array();
 
541
                        foreach($sub_menu as $id => $sub_page){
 
542
                                if(empty($sub_page['menu_text'])) $sub_page['menu_text'] = SPACE;
 
543
                                
 
544
                                $sub_menu_item = new CLink($sub_page['menu_text'], $sub_page['menu_url'], $sub_page['class']);
 
545
                                if($sub_page['selected']) $sub_menu_item = new CSpan($sub_menu_item, 'active');
 
546
                                $sub_menu_row[] = $sub_menu_item;
 
547
                                $sub_menu_row[] = new CSpan(SPACE.SPACE.'|'.SPACE.SPACE, 'divider');
 
548
                        }
 
549
                        $sub_menu_table->addRow(new CCol($sub_menu_row));
 
550
                        
 
551
                        $sub_menu_div = new CDiv($sub_menu_table);
 
552
                        $sub_menu_div->addOption('id', 'sub_'.$label);
 
553
                        $sub_menu_div->addAction('onmouseover','javascript: MMenu.submenu_mouseOver();');
 
554
                        $sub_menu_div->addAction('onmouseout','javascript: MMenu.mouseOut();');
 
555
 
 
556
                        if(isset($page['menu']) && ($page['menu'] == $label)){
 
557
                                $menu_selected = true;
 
558
                                $sub_menu_div->addOption('style','display: block;');
 
559
                                insert_js('MMenu.def_label = '.zbx_jsvalue($label));
 
560
                        }
 
561
                        else{
 
562
                                $sub_menu_div->addOption('style','display: none;');
 
563
                        }
 
564
                        
 
565
                        $page_menu->addItem($sub_menu_div);
 
566
                }
 
567
 
553
568
                $sub_menu_table = new CTable(NULL,'sub_menu');
554
 
                $sub_menu_table->SetCellSpacing(0);
555
 
                $sub_menu_table->SetCellPadding(5);
556
 
                
557
 
                (empty($sub_menu_row))?($sub_menu_row = '&nbsp;'):('');
558
 
                $sub_menu_table->AddRow(new CCol($sub_menu_row));
559
 
                $sub_menu_table->Show();
 
569
                $sub_menu_table->setCellSpacing(0);
 
570
                $sub_menu_table->setCellPadding(5);
 
571
                $sub_menu_table->addRow(SPACE);
 
572
                
 
573
                $sub_menu_div = new CDiv($sub_menu_table);
 
574
                $sub_menu_div->addOption('id', 'sub_empty');
 
575
                $sub_menu_div->addOption('style','display: '.($menu_selected?'none;':'block;'));
 
576
                $page_menu->addItem($sub_menu_div);
 
577
                
 
578
                $page_menu->show();
560
579
        }
561
580
//------------------------------------- <HISTORY> ---------------------------------------
562
 
        if(isset($page['hist_arg']) && ($USER_DETAILS["alias"] != ZBX_GUEST_USER) && ($page["type"] == PAGE_TYPE_HTML) && !defined('ZBX_PAGE_NO_MENU')){
 
581
        if(isset($page['hist_arg']) && ($USER_DETAILS['alias'] != ZBX_GUEST_USER) && ($page['type'] == PAGE_TYPE_HTML) && !defined('ZBX_PAGE_NO_MENU')){
563
582
                $table = new CTable();
564
 
                $table->SetClass('history');
 
583
                $table->setClass('history');
565
584
                
566
 
                $table->SetCellSpacing(0);
567
 
                $table->SetCellPadding(0);
 
585
                $table->setCellSpacing(0);
 
586
                $table->setCellPadding(0);
568
587
 
569
588
                $history = get_user_history();
570
589
 
571
590
                $tr = new CRow(new CCol('History:','caption'));
572
 
                $tr->AddItem($history);
 
591
                $tr->addItem($history);
573
592
                
574
 
                $table->AddRow($tr);
 
593
                $table->addRow($tr);
575
594
                $table->Show();
576
595
        } 
577
 
        else if(($page["type"] == PAGE_TYPE_HTML) && !defined('ZBX_PAGE_NO_MENU')) {
 
596
        else if(($page['type'] == PAGE_TYPE_HTML) && !defined('ZBX_PAGE_NO_MENU')) {
578
597
                echo SBR;
579
598
        }
580
599
//------------------------------------ </HISTORY> ---------------------------------------
584
603
        unset($table, $top_page_row, $menu_table, $node_form);
585
604
        unset($main_menu_row);
586
605
        unset($db_nodes, $node_data);
587
 
        unset($sub_menu_table, $sub_menu_row);
 
606
        unset($sub_menu_table, $sub_menu_rows);
588
607
 
589
608
        if(isset($denyed_page_requested)){
590
609
                access_deny();
600
619
        }
601
620
        
602
621
        show_messages();
603
 
?>
 
 
b'\\ No newline at end of file'
 
622
?>