码迷,mamicode.com
首页 > 其他好文 > 详细

zabbix添加菜单栏

时间:2017-06-23 15:51:14      阅读:386      评论:0      收藏:0      [点我收藏+]

标签:monit   mouseover   file   pre   window   htm   const   zab   new   

1.更改字体(中文乱码多半是因为字体不支持中文)
define(ZBX_GRAPH_FONT_NAME,    DejaVuSans); // font file name
define(ZBX_FONT_NAME, DejaVuSans);
2.增加页面
要增加页面,需要在include\menu.inc.php添加
3.菜单栏增加按钮
zabbix/php/include/menu.inc.php
 
调整数组$ZBX_MENU,增加以下
‘zatree‘=>array(
                 ‘label‘ => _(‘Zatree‘),
                 ‘user_type‘                             => USER_TYPE_ZABBIX_USER,
                 ‘default_page_id‘       => 0,
                 ‘force_disable_all_nodes‘ => true,
                 ‘target‘ => true,//新窗口中打开
                 ‘pages‘ =>array(
                         array(‘url‘ => ‘zabbix.php‘,‘label‘ => _(‘Zatree‘))
                         )

         ),

         ‘traffic‘=>array(
                 ‘label‘ => _(‘Traffic‘),
                 ‘user_type‘                             => USER_TYPE_ZABBIX_USER,
                 ‘default_page_id‘       => 0,
                 ‘force_disable_all_nodes‘ => true,
                 ‘target‘ => true,//新窗口中打开
                 ‘pages‘ =>array(
                         array(‘url‘ => ‘Traffic/index.html‘,‘label‘ => _(‘traffic‘))
                         )

         ),
         ‘monitor‘=>array(
                 ‘label‘ => _(‘Monitor‘),
                 ‘user_type‘                             => USER_TYPE_ZABBIX_USER,
                 ‘default_page_id‘       => 0,
                 ‘force_disable_all_nodes‘ => true,
                 ‘target‘ => true,//新窗口中打开
                 ‘pages‘ =>array(
                         array(‘url‘ => ‘Monitor/monitor.php‘,‘label‘ => _(‘Monitor‘))
                         )

         ),

增加新窗口中打开,函数zbx_construct_menu
    if(isset($menu[‘target‘])){
            $mmenu_entry->addAction(‘onclick‘, ‘javascript: window.open(\‘‘.$menu_url.‘\‘);‘);
        }else{
            $mmenu_entry->addAction(‘onclick‘, ‘javascript: redirect(\‘‘.$menu_url.‘\‘);‘);
        }

//前后代码
$menu_url = $sub_menus[$label][$menu[‘default_page_id‘]][‘menu_url‘];
        //print_r($menu_url.‘<br>‘);
        $mmenu_entry = new CCol($menu[‘label‘], $menu_class);
        $mmenu_entry->setAttribute(‘id‘, $label);

        if(isset($menu[‘target‘])){
            $mmenu_entry->addAction(‘onclick‘, ‘javascript: window.open(\‘‘.$menu_url.‘\‘);‘);
        }else{
            $mmenu_entry->addAction(‘onclick‘, ‘javascript: redirect(\‘‘.$menu_url.‘\‘);‘);
        }

        //$mmenu_entry->addAction(‘onclick‘, ‘javascript: redirect(\‘‘.$menu_url.‘\‘);‘);
        $mmenu_entry->addAction(‘onmouseover‘, ‘javascript: MMenu.mouseOver(\‘‘.$label.‘\‘);‘);
        $mmenu_entry->addAction(‘onmouseout‘, ‘javascript: MMenu.mouseOut();‘);
//前后代码
调整js正常zabbix/php/js/main.js
MMenu增加对应json
 menus: {‘empty‘: 0, ‘view‘: 0, ‘cm‘: 0, ‘reports‘: 0, ‘config‘: 0, ‘admin‘: 0, ‘zatree‘:0,‘traffic‘:0,‘monitor‘:0,},

 

zabbix添加菜单栏

标签:monit   mouseover   file   pre   window   htm   const   zab   new   

原文地址:http://www.cnblogs.com/redheat/p/7069572.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!