예제 #1
0
CProfile::update('web.popup_right.nodeid.last', $nodeid, PROFILE_TYPE_ID);
$frmTitle = new CForm();
$frmTitle->addVar('dstfrm', $dstfrm);
$frmTitle->addVar('permission', $permission);
if (ZBX_DISTRIBUTED) {
    $available_nodes = get_accessible_nodes_by_user($USER_DETAILS, PERM_READ_ONLY, PERM_RES_IDS_ARRAY);
    $cmbResourceNode = new CComboBox('nodeid', $nodeid, 'submit();');
    $cmbResourceNode->addItem(0, S_ALL_S);
    $sql = 'SELECT name,nodeid ' . ' FROM nodes ' . ' WHERE ' . DBcondition('nodeid', $available_nodes);
    $db_nodes = DBselect($sql);
    while ($node = DBfetch($db_nodes)) {
        $cmbResourceNode->addItem($node['nodeid'], $node['name']);
    }
    $frmTitle->addItem(array(S_NODE, SPACE, $cmbResourceNode));
}
show_table_header(permission2str($permission), $frmTitle);
$form = new CForm();
$form->setAttribute('id', 'groups');
$table = new CTableInfo(S_NO_RESOURCES_DEFINED);
$table->setHeader(new CCol(array(new CCheckBox('all_groups', NULL, 'check_all(this.checked)'), S_NAME)));
// NODES
if ($nodeid == 0) {
    $nodeids = get_current_nodeid(true);
} else {
    $nodeids = $nodeid;
}
$count = 0;
$grouplist = array();
$options = array('nodeids' => $nodeids, 'output' => API_OUTPUT_EXTEND);
$groups = CHostGroup::get($options);
foreach ($groups as $gnum => $row) {
예제 #2
0
$dstfrm = getRequest('dstfrm', 0);
$permission = getRequest('permission', PERM_DENY);
/*
 * Display
 */
// host groups
$hostGroupForm = (new CForm())->setId('groups');
$hostGroupTable = (new CTableInfo())->setHeader([(new CColHeader((new CCheckBox('all_groups'))->onClick('checkAll(this.checked)')))->addClass(ZBX_STYLE_CELL_WIDTH), _('Name')]);
$hostGroups = API::HostGroup()->get(['output' => ['groupid', 'name']]);
order_result($hostGroups, 'name');
foreach ($hostGroups as $hostGroup) {
    $hostGroupTable->addRow([(new CCheckBox())->setAttribute('data-id', $hostGroup['groupid'])->setAttribute('data-name', $hostGroup['name'])->setAttribute('data-permission', $permission), $hostGroup['name']]);
}
$hostGroupTable->setFooter(new CCol((new CButton('select', _('Select')))->onClick('addGroups("' . $dstfrm . '")')));
$hostGroupForm->addItem($hostGroupTable);
(new CWidget())->setTitle(permission2str($permission))->addItem($hostGroupForm)->show();
?>
<script type="text/javascript">
	function addGroups(formName) {
		var parentDocument = window.opener.document;

		if (!parentDocument) {
			return close_window();
		}

		jQuery('#groups input[type=checkbox]').each(function() {
			var obj = jQuery(this);

			if (obj.attr('name') !== 'all_groups' && obj.prop('checked')) {
				var id = obj.data('id');
예제 #3
0
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
$page['title'] = _('Resource');
$page['file'] = 'popup_right.php';
define('ZBX_PAGE_NO_MENU', 1);
require_once dirname(__FILE__) . '/include/page_header.php';
//	VAR					TYPE	OPTIONAL FLAGS	VALIDATION	EXCEPTION
$fields = array('dstfrm' => array(T_ZBX_STR, O_MAND, P_SYS, NOT_EMPTY, null), 'permission' => array(T_ZBX_INT, O_MAND, P_SYS, IN(PERM_DENY . ',' . PERM_READ . ',' . PERM_READ_WRITE), null));
check_fields($fields);
$dstfrm = getRequest('dstfrm', 0);
$permission = getRequest('permission', PERM_DENY);
/*
 * Display
 */
show_table_header(permission2str($permission));
// host groups
$hostGroupForm = new CForm();
$hostGroupForm->setAttribute('id', 'groups');
$hostGroupTable = new CTableInfo(_('No host groups found.'));
$hostGroupTable->setHeader(new CCol(array(new CCheckBox('all_groups', null, 'checkAll(this.checked)'), _('Name'))));
$hostGroups = API::HostGroup()->get(array('output' => array('groupid', 'name')));
order_result($hostGroups, 'name');
foreach ($hostGroups as $hostGroup) {
    $hostGroupCheckBox = new CCheckBox();
    $hostGroupCheckBox->setAttribute('data-id', $hostGroup['groupid']);
    $hostGroupCheckBox->setAttribute('data-name', $hostGroup['name']);
    $hostGroupCheckBox->setAttribute('data-permission', $permission);
    $hostGroupTable->addRow(new CCol(array($hostGroupCheckBox, $hostGroup['name'])));
}
$hostGroupTable->setFooter(new CCol(new CButton('select', _('Select'), 'addGroups("' . $dstfrm . '")'), 'right'));
예제 #4
0
 * Display
 */
// node combobox
$titleFrom = new CForm();
$titleFrom->addVar('dstfrm', $dstfrm);
$titleFrom->addVar('permission', $permission);
if ($availableNodeIds !== null) {
    $nodeComboBox = new CComboBox('nodeid', $nodeId, 'submit();');
    $nodeComboBox->addItem(0, _('All'));
    $nodes = DBselect('SELECT n.name,n.nodeid FROM nodes n WHERE ' . dbConditionInt('n.nodeid', $availableNodeIds));
    while ($node = DBfetch($nodes)) {
        $nodeComboBox->addItem($node['nodeid'], $node['name']);
    }
    $titleFrom->addItem(array(_('Node'), SPACE, $nodeComboBox));
}
show_table_header(permission2str($permission), $titleFrom);
// host groups
$hostGroupForm = new CForm();
$hostGroupForm->setAttribute('id', 'groups');
$hostGroupTable = new CTableInfo(_('No host groups found.'));
$hostGroupTable->setHeader(new CCol(array(new CCheckBox('all_groups', null, 'checkAll(this.checked)'), _('Name'))));
$hostGroups = API::HostGroup()->get(array('output' => array('groupid', 'name'), 'nodeids' => $nodeId === null ? $availableNodeIds : $nodeId));
if ($availableNodeIds && $nodeId === null) {
    foreach ($hostGroups as $key => $hostGroup) {
        $hostGroups[$key]['name'] = get_node_name_by_elid($hostGroup['groupid'], true, NAME_DELIMITER) . $hostGroup['name'];
    }
}
order_result($hostGroups, 'name');
foreach ($hostGroups as $hostGroup) {
    $hostGroupCheckBox = new CCheckBox();
    $hostGroupCheckBox->setAttribute('data-id', $hostGroup['groupid']);