foreach ($dRules as $dRule) { foreach ($dRule['dchecks'] as $dCheck) { $name = $dRule['name'] . NAME_DELIMITER . discovery_check2str($dCheck['type'], $dCheck['key_'], $dCheck['ports']); $action = get_window_opener($dstfrm, $dstfld1, $dCheck[$srcfld1]) . (isset($srcfld2) ? get_window_opener($dstfrm, $dstfld2, $name) : ''); $name = new CSpan($name, 'link'); $name->setAttribute('onclick', $action . ' close_window(); return false;'); $table->addRow($name); } } $table->show(); } elseif ($srctbl == 'proxies') { $table = new CTableInfo(_('No proxies found.')); $table->setHeader(_('Name')); $result = DBselect('SELECT h.hostid,h.host' . ' FROM hosts h' . ' WHERE h.status IN (' . HOST_STATUS_PROXY_ACTIVE . ',' . HOST_STATUS_PROXY_PASSIVE . ')' . andDbNode('h.hostid', $nodeId) . ' ORDER BY h.host,h.hostid'); while ($row = DBfetch($result)) { $action = get_window_opener($dstfrm, $dstfld1, $row[$srcfld1]) . (isset($srcfld2) ? get_window_opener($dstfrm, $dstfld2, $row[$srcfld2]) : ''); $name = new CSpan($row['host'], 'link'); $name->setAttribute('onclick', $action . ' close_window(); return false;'); $table->addRow($name); } $table->show(); } elseif ($srctbl == 'scripts') { $form = new CForm(); $form->setName('scriptform'); $form->attr('id', 'scripts'); $table = new CTableInfo(_('No scripts found.')); if ($multiselect) { $header = array(array(new CCheckBox('all_scripts', null, "javascript: checkAll('" . $form->getName() . "', 'all_scripts', 'scripts');"), _('Name')), _('Execute on'), _('Commands')); } else { $header = array(_('Name'), _('Execute on'), _('Commands')); }
while ($row = DBfetch($db_groups)) { $row['node_name'] = isset($row['node_name']) ? '(' . $row['node_name'] . ') ' : ''; if (!$all) { $name = new CLink(bold(S_MINUS_ALL_GROUPS_MINUS), '#', 'action'); if (isset($_REQUEST['reference']) && $_REQUEST['reference'] == 'dashboard') { $action = get_window_opener($dstfrm, $dstfld1, $srcfld2) . get_window_opener($dstfrm, $dstfld2, create_id_by_nodeid(0, $nodeid)) . "window.opener.setTimeout('add2favorites();', 1000);"; } else { $action = get_window_opener($dstfrm, $dstfld1, create_id_by_nodeid(0, $nodeid)) . get_window_opener($dstfrm, $dstfld2, $row['node_name'] . S_MINUS_ALL_GROUPS_MINUS); } $name->setAction($action . " close_window(); return false;"); $table->addRow($name); $all = true; } $name = new CLink($row['name'], '#', 'action'); $row['name'] = $row['node_name'] . $row['name']; $name->setAction(get_window_opener($dstfrm, $dstfld1, $row[$srcfld1]) . get_window_opener($dstfrm, $dstfld2, $row[$srcfld2]) . (isset($_REQUEST['reference']) && $_REQUEST['reference'] == 'dashboard' ? "window.opener.setTimeout('add2favorites();', 1000);" : '') . ' return close_window();'); $table->addRow($name); } $table->show(); } } } } } } } } } } } }