给HOST设备增加别名搜索步骤

PHP前端页面二次发或优化

版主: malajiding

回复
头像
mxj333
论坛管理员
论坛管理员
帖子: 94
注册时间: 2013年 11月 22日 11:55 星期五

给HOST设备增加别名搜索步骤

帖子 mxj333 » 2013年 12月 3日 15:53 星期二

给设备增加别名搜索步骤:
设备别名为自己新添加的字段。

给设备增加别名搜索步骤;
1、打开“hosts.php”,修改显示页面,增加一行:如
设备别名 类似:

找到:添加红色部分

//生成搜索表单 改为一行显示 一个 ,提交改为用按钮

代码: 全选

// HOSTS FILTER {{{
		$filter_table = new CTable('', 'formtable');

		//$_host = new CCol();
		$filter_table->addRow(array(
			new CCol(array(bold(S_HOST.S_NAME), SPACE.S_LIKE_SMALL.': '),'form_row_l'),
			new CCol(array(new CTextBox('filter_host', $_REQUEST['filter_host'], 20)),'form_row_r')
		));
		
		$filter_table->addRow(array(
			new CCol(array(bold(S_HOST.S_DEVICE_ALIAS), SPACE.S_LIKE_SMALL.': '),'form_row_l'),
			new CCol(array(new CTextBox('filter_n_name', $_REQUEST['filter_n_name'], 20)),'form_row_r')
		));
		
		$filter_table->addRow(array(
			new CCol(array(bold(S_DNS), SPACE.S_LIKE_SMALL.': ')),
			new CCol(array(new CTextBox('filter_dns', $_REQUEST['filter_dns'], 20)))
		));
		$filter_table->addRow(array(
			new CCol(array(bold(S_IP), SPACE.S_LIKE_SMALL.': ')),
			new CCol(array(new CTextBox('filter_ip', $_REQUEST['filter_ip'], 20)))

		));
		$filter_table->addRow(array(
			new CCol(array(bold(S_PORT.': '))),
			new CCol(array(new CTextBox('filter_port', $_REQUEST['filter_port'], 20)))
		));



2、找到:添加红色部分

代码: 全选

/* FILTER 
	if(isset($_REQUEST['filter_set'])){
		$_REQUEST['filter_ip'] = get_request('filter_ip');
		$_REQUEST['filter_dns'] = get_request('filter_dns');
		$_REQUEST['filter_host'] = get_request('filter_host');
		$_REQUEST['filter_port'] = get_request('filter_port');
		$_REQUEST['filter_n_name'] = get_request('filter_n_name');

		CProfile::update('web.hosts.filter_ip', $_REQUEST['filter_ip'], PROFILE_TYPE_STR);
		CProfile::update('web.hosts.filter_dns', $_REQUEST['filter_dns'], PROFILE_TYPE_STR);
		CProfile::update('web.hosts.filter_host', $_REQUEST['filter_host'], PROFILE_TYPE_STR);
		CProfile::update('web.hosts.filter_port', $_REQUEST['filter_port'], PROFILE_TYPE_STR);
		CProfile::update('web.hosts.filter_n_name', $_REQUEST['filter_n_name'], PROFILE_TYPE_STR);
	}
	else{
		$_REQUEST['filter_ip'] = CProfile::get('web.hosts.filter_ip');
		$_REQUEST['filter_dns'] = CProfile::get('web.hosts.filter_dns');
		$_REQUEST['filter_host'] = CProfile::get('web.hosts.filter_host');
		$_REQUEST['filter_port'] = CProfile::get('web.hosts.filter_port');
		$_REQUEST['filter_n_name'] = CProfile::get('web.hosts.filter_n_name');
	}
3、打开 “include/ schema.inc.php” 找到:添加红色部分

代码: 全选

'hosts' => array(
		'type' => DB::TABLE_TYPE_CONFIG,
		'key' => 'hostid',
		'fields' => array(
			'hostid' => array(
				'null' => false,
				'type' => DB::FIELD_TYPE_ID,
				'length' => 20,
				'default' => '0',
			),
			'proxy_hostid' => array(
				'null' => false,
				'type' => DB::FIELD_TYPE_ID,
				'length' => 20,
				'default' => '0',
			),
			'host' => array(
				'null' => false,
				'type' => DB::FIELD_TYPE_CHAR,
				'length' => 64,
				'default' => '',
			),
			'n_name' => array(
				'null' => false,
				'type' => DB::FIELD_TYPE_CHAR,
				'length' => 128,
				'default' => '',
			),
4、完成。
zabbix中文论坛:http://www.zabbix.net.cn 或者 www.zabbix.org.cn

回复