$scriptForm->addVar('scriptid', $this->get('scriptid'));
}
$scriptFormList = new CFormList('scriptsTab');
// name
$nameTextBox = new CTextBox('name', $this->get('name'), ZBX_TEXTBOX_STANDARD_SIZE);
$nameTextBox->attr('autofocus', 'autofocus');
$nameTextBox->attr('placeholder', _('<Sub-menu/Sub-menu.../>Script'));
$scriptFormList->addRow(_('Name'), $nameTextBox);
// type
$typeComboBox = new CComboBox('type', $this->get('type'));
$typeComboBox->addItem(ZBX_SCRIPT_TYPE_IPMI, _('IPMI'));
$typeComboBox->addItem(ZBX_SCRIPT_TYPE_CUSTOM_SCRIPT, _('Script'));
$scriptFormList->addRow(_('Type'), $typeComboBox);
// execute on
$typeRadioButton = new CRadioButtonList('execute_on', $this->get('execute_on'));
$typeRadioButton->makeVertical();
$typeRadioButton->addValue(_('Zabbix agent'), ZBX_SCRIPT_EXECUTE_ON_AGENT);
$typeRadioButton->addValue(_('Zabbix server'), ZBX_SCRIPT_EXECUTE_ON_SERVER);
$scriptFormList->addRow(_('Execute on'), new CDiv($typeRadioButton, 'objectgroup inlineblock border_dotted ui-corner-all'), $this->get('type') == ZBX_SCRIPT_TYPE_IPMI);
$scriptFormList->addRow(_('Commands'), new CTextArea('command', $this->get('command')), $this->get('type') == ZBX_SCRIPT_TYPE_IPMI);
$scriptFormList->addRow(_('Command'), new CTextBox('commandipmi', $this->get('commandipmi'), ZBX_TEXTBOX_STANDARD_SIZE), $this->get('type') == ZBX_SCRIPT_TYPE_CUSTOM_SCRIPT);
$scriptFormList->addRow(_('Description'), new CTextArea('description', $this->get('description')));
// user groups
$userGroups = new CCombobox('usrgrpid', $this->get('usrgrpid'));
$userGroups->addItem(0, _('All'));
foreach ($this->getArray('usergroups') as $userGroup) {
    $userGroups->addItem($userGroup['usrgrpid'], $userGroup['name']);
}
$scriptFormList->addRow(_('User groups'), $userGroups);
// host groups
$hostGroups = new CCombobox('hgstype', $this->get('hgstype'));
Exemplo n.º 2
0
 $newOperationsTable->addRow(array(_('Target list'), $cmdList), 'indent_top');
 // type
 $typeComboBox = new CComboBox('new_operation[opcommand][type]', $this->data['new_operation']['opcommand']['type'], 'javascript: showOpTypeForm();');
 $typeComboBox->addItem(ZBX_SCRIPT_TYPE_IPMI, _('IPMI'));
 $typeComboBox->addItem(ZBX_SCRIPT_TYPE_CUSTOM_SCRIPT, _('Custom script'));
 $typeComboBox->addItem(ZBX_SCRIPT_TYPE_SSH, _('SSH'));
 $typeComboBox->addItem(ZBX_SCRIPT_TYPE_TELNET, _('Telnet'));
 $typeComboBox->addItem(ZBX_SCRIPT_TYPE_GLOBAL_SCRIPT, _('Global script'));
 $userScriptId = new CVar('new_operation[opcommand][scriptid]', $this->data['new_operation']['opcommand']['scriptid']);
 $userScriptName = new CTextBox('new_operation[opcommand][script]', $this->data['new_operation']['opcommand']['script'], 32, true);
 $userScriptSelect = new CButton('select_opcommand_script', _('Select'), null, 'link_menu');
 $userScript = new CDiv(array($userScriptId, $userScriptName, SPACE, $userScriptSelect), 'class_opcommand_userscript inlineblock hidden');
 $newOperationsTable->addRow(array(_('Type'), array($typeComboBox, SPACE, $userScript)), 'indent_bottom');
 // script
 $executeOnRadioButton = new CRadioButtonList('new_operation[opcommand][execute_on]', $this->data['new_operation']['opcommand']['execute_on']);
 $executeOnRadioButton->makeVertical();
 $executeOnRadioButton->addValue(SPACE . _('Zabbix agent') . SPACE, ZBX_SCRIPT_EXECUTE_ON_AGENT);
 $executeOnRadioButton->addValue(SPACE . _('Zabbix server') . SPACE, ZBX_SCRIPT_EXECUTE_ON_SERVER);
 $newOperationsTable->addRow(array(_('Execute on'), new CDiv($executeOnRadioButton, 'objectgroup border_dotted ui-corner-all inlineblock')), 'class_opcommand_execute_on hidden indent_both');
 // ssh
 $authTypeComboBox = new CComboBox('new_operation[opcommand][authtype]', $this->data['new_operation']['opcommand']['authtype'], 'javascript: showOpTypeAuth();');
 $authTypeComboBox->addItem(ITEM_AUTHTYPE_PASSWORD, _('Password'));
 $authTypeComboBox->addItem(ITEM_AUTHTYPE_PUBLICKEY, _('Public key'));
 $newOperationsTable->addRow(array(_('Authentication method'), $authTypeComboBox), 'class_authentication_method hidden');
 $newOperationsTable->addRow(array(_('User name'), new CTextBox('new_operation[opcommand][username]', $this->data['new_operation']['opcommand']['username'], ZBX_TEXTBOX_SMALL_SIZE)), 'class_authentication_username hidden indent_both');
 $newOperationsTable->addRow(array(_('Public key file'), new CTextBox('new_operation[opcommand][publickey]', $this->data['new_operation']['opcommand']['publickey'], ZBX_TEXTBOX_SMALL_SIZE)), 'class_authentication_publickey hidden indent_both');
 $newOperationsTable->addRow(array(_('Private key file'), new CTextBox('new_operation[opcommand][privatekey]', $this->data['new_operation']['opcommand']['privatekey'], ZBX_TEXTBOX_SMALL_SIZE)), 'class_authentication_privatekey hidden indent_both');
 $newOperationsTable->addRow(array(_('Password'), new CTextBox('new_operation[opcommand][password]', $this->data['new_operation']['opcommand']['password'], ZBX_TEXTBOX_SMALL_SIZE)), 'class_authentication_password hidden indent_both');
 // set custom id because otherwise they are set based on name (sick!) and produce duplicate ids
 $passphraseCB = new CTextBox('new_operation[opcommand][password]', $this->data['new_operation']['opcommand']['password'], ZBX_TEXTBOX_SMALL_SIZE);
 $passphraseCB->attr('id', 'new_operation_opcommand_passphrase');
if ($this->get('scriptid')) {
    $frmScr->addVar('scriptid', $this->get('scriptid'));
}
// name
$nameTB = new CTextBox('name', $this->get('name'));
$nameTB->setAttribute('maxlength', 255);
$nameTB->addStyle('width: 50em;');
$scriptTab->addRow(_('Name'), $nameTB);
// type
$typeCB = new CComboBox('type', $this->get('type'));
$typeCB->addItem(ZBX_SCRIPT_TYPE_IPMI, _('IPMI'));
$typeCB->addItem(ZBX_SCRIPT_TYPE_CUSTOM_SCRIPT, _('Script'));
$scriptTab->addRow(_('Type'), $typeCB);
// execute on
$typeRB = new CRadioButtonList('execute_on', $this->get('execute_on'));
$typeRB->makeVertical();
$typeRB->addValue(_('Zabbix agent'), ZBX_SCRIPT_EXECUTE_ON_AGENT);
$typeRB->addValue(_('Zabbix server'), ZBX_SCRIPT_EXECUTE_ON_SERVER);
$scriptTab->addRow(_('Execute on'), new CDiv($typeRB, 'objectgroup inlineblock border_dotted ui-corner-all'), $data['type'] == ZBX_SCRIPT_TYPE_IPMI);
// command
$commandTA = new CTextArea('command', $this->get('command'));
$commandTA->addStyle('width: 50em; padding: 0;');
$scriptTab->addRow(_('Commands'), $commandTA, $this->get('type') == ZBX_SCRIPT_TYPE_IPMI);
// command ipmi
$commandIpmiTB = new CTextBox('commandipmi', $this->get('commandipmi'));
$commandIpmiTB->addStyle('width: 50em;');
$scriptTab->addRow(_('Command'), $commandIpmiTB, $this->get('type') == ZBX_SCRIPT_TYPE_CUSTOM_SCRIPT);
// description
$descriptionTA = new CTextArea('description', $this->get('description'));
$descriptionTA->addStyle('width: 50em; padding: 0;');
$scriptTab->addRow(_('Description'), $descriptionTA);