array(T_ZBX_INT, O_NO, null, DB_ID, '(isset({form})&&({form}=="update"))'), "new_nodeid"=> array(T_ZBX_INT, O_OPT, null, DB_ID, 'isset({save})'), "name"=> array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({save})'), "timezone"=> array(T_ZBX_INT, O_OPT, null, BETWEEN(-12,+13), 'isset({save})'), "ip"=> array(T_ZBX_IP, O_OPT, null, null, 'isset({save})'), "node_type"=> array(T_ZBX_INT, O_OPT, null, IN(ZBX_NODE_REMOTE.','.ZBX_NODE_MASTER.','.ZBX_NODE_LOCAL), 'isset({save})&&!isset({nodeid})'), "port"=> array(T_ZBX_INT, O_OPT, null, BETWEEN(1,65535), 'isset({save})'), "slave_history"=> array(T_ZBX_INT, O_OPT, null, BETWEEN(0,65535), 'isset({save})'), "slave_trends"=> array(T_ZBX_INT, O_OPT, null, BETWEEN(0,65535), 'isset({save})'), /* actions */ "save"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), "delete"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), "cancel"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL), /* other */ "form"=> array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL), "form_refresh"=> array(T_ZBX_INT, O_OPT, NULL, NULL, NULL) ); check_fields($fields); validate_sort_and_sortorder(); $available_nodes = get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_LIST,PERM_RES_IDS_ARRAY); if (0 == count($available_nodes) ){ access_deny(); } $available_nodes = implode(',', $available_nodes); ?> AddItem(new CButton('form',S_NEW_NODE)); show_table_header(S_NODES_BIG,$form); $table=new CTableInfo(S_NO_NODES_DEFINED); $table->SetHeader(array( make_sorting_link(S_ID,'n.nodeid'), make_sorting_link(S_NAME,'n.name'), make_sorting_link(S_TYPE,'n.nodetype'), make_sorting_link(S_TIME_ZONE,'n.timezone'), make_sorting_link(S_IP.':'.S_PORT,'n.ip') )); $db_nodes = DBselect('SELECT n.* '. ' FROM nodes n'. ' WHERE n.nodeid in ('.$available_nodes.') '. order_by('n.nodeid,n.name,n.nodetype,n.timezone,n.ip','n.masterid') ); while($row=DBfetch($db_nodes)){ $node_type = detect_node_type($row); $node_type_name = node_type2str($node_type); $table->AddRow(array( $row['nodeid'], array( get_node_path($row['masterid']), new CLink( ($row['nodetype'] ? new CSpan($row["name"], 'bold') : $row["name"]), "?&form=update&nodeid=".$row["nodeid"],'action')), $node_type == ZBX_NODE_LOCAL ? new CSpan($node_type_name, 'bold') : $node_type_name, new CSpan("GMT".sprintf("%+03d:00", $row['timezone']), $row['nodetype'] ? 'bold' : null), new CSpan($row['ip'].':'.$row['port'], $row['nodetype'] ? 'bold' : null) )); } $table->Show(); } ?>