}
$httpFormList->addRow(_('Name'), $nameTextBox);
// Application
if ($this->data['application_list']) {
    $applications = zbx_array_merge([''], $this->data['application_list']);
    $httpFormList->addRow(_('Application'), new CComboBox('applicationid', $this->data['applicationid'], null, $applications));
} else {
    $httpFormList->addRow(_('Application'), new CSpan(_('No applications found.')));
}
// New application
$httpFormList->addRow(new CLabel(_('New application'), 'new_application'), (new CSpan((new CTextBox('new_application', $this->data['new_application']))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)))->addClass(ZBX_STYLE_FORM_NEW_GROUP))->addRow(_('Update interval (in sec)'), (new CNumericBox('delay', $this->data['delay'], 5))->setWidth(ZBX_TEXTAREA_NUMERIC_STANDARD_WIDTH))->addRow(_('Attempts'), (new CNumericBox('retries', $this->data['retries'], 2))->setWidth(ZBX_TEXTAREA_NUMERIC_STANDARD_WIDTH));
$agentComboBox = new CComboBox('agent', $this->data['agent']);
$userAgentsAll = userAgents();
$userAgentsAll[_('Others')][ZBX_AGENT_OTHER] = _('other') . ' ...';
foreach ($userAgentsAll as $userAgentGroup => $userAgents) {
    $agentComboBox->addItemsInGroup($userAgentGroup, $userAgents);
}
$httpFormList->addRow(_('Agent'), $agentComboBox);
$httpFormList->addRow(_('User agent string'), (new CTextBox('agent_other', $this->data['agent_other']))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH), 'row_agent_other');
// append HTTP proxy to form list
$httpFormList->addRow(_('HTTP proxy'), (new CTextBox('http_proxy', $this->data['http_proxy'], false, 255))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)->setAttribute('placeholder', 'http://[user[:password]@]proxy.example.com[:port]'))->addRow(_('Variables'), (new CTextArea('variables', $this->data['variables']))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH))->addRow(_('Headers'), (new CTextArea('headers', $this->data['headers']))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH))->addRow(_('Enabled'), (new CCheckBox('status'))->setChecked(!$this->data['status']));
/*
 * Authentication tab
 */
$httpAuthenticationFormList = new CFormList('httpAuthenticationFormList');
// Authentication type
$httpAuthenticationFormList->addRow(_('HTTP authentication'), new CComboBox('authentication', $this->data['authentication'], null, httptest_authentications()));
$httpAuthenticationFormList->addRow(_('User'), (new CTextBox('http_user', $this->data['http_user'], false, 64))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH))->addRow(_('Password'), (new CTextBox('http_password', $this->data['http_password'], false, 64))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH))->addRow(_('SSL verify peer'), (new CCheckBox('verify_peer'))->setChecked($this->data['verify_peer'] == 1))->addRow(_('SSL verify host'), (new CCheckBox('verify_host'))->setChecked($this->data['verify_host'] == 1))->addRow(_('SSL certificate file'), (new CTextBox('ssl_cert_file', $this->data['ssl_cert_file'], false, 255))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH))->addRow(_('SSL key file'), (new CTextBox('ssl_key_file', $this->data['ssl_key_file'], false, 255))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH))->addRow(_('SSL key password'), (new CTextBox('ssl_key_password', $this->data['ssl_key_password'], false, 64))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH));
/*
 * Step tab
 */
$mediaTypeWidget = new CWidget();
$mediaTypeWidget->addPageHeader(_('CONFIGURATION OF MEDIA TYPES'));
// create form
$mediaTypeForm = new CForm();
$mediaTypeForm->setName('mediaTypeForm');
$mediaTypeForm->addVar('form', $this->data['form']);
$mediaTypeForm->addVar('mediatypeid', $this->data['mediatypeid']);
// create form list
$mediaTypeFormList = new CFormList('mediaTypeFormList');
$nameTextBox = new CTextBox('description', $this->data['description'], ZBX_TEXTBOX_STANDARD_SIZE, false, 100);
$nameTextBox->attr('autofocus', 'autofocus');
$mediaTypeFormList->addRow(_('Name'), $nameTextBox);
// append type to form list
$cmbType = new CComboBox('type', $this->data['type'], 'submit()');
$cmbType->addItems(array(MEDIA_TYPE_EMAIL => _('Email'), MEDIA_TYPE_EXEC => _('Script'), MEDIA_TYPE_SMS => _('SMS'), MEDIA_TYPE_JABBER => _('Jabber')));
$cmbType->addItemsInGroup(_('Commercial'), array(MEDIA_TYPE_EZ_TEXTING => _('Ez Texting')));
$cmbTypeRow = array($cmbType);
if ($this->data['type'] == MEDIA_TYPE_EZ_TEXTING) {
    $ez_texting_link = new CLink('https://app.eztexting.com', 'https://app.eztexting.com/', null, null, 'nosid');
    $ez_texting_link->setTarget('_blank');
    $cmbTypeRow[] = $ez_texting_link;
}
$mediaTypeFormList->addRow(_('Type'), $cmbTypeRow);
// append others fields to form list
if ($this->data['type'] == MEDIA_TYPE_EMAIL) {
    $mediaTypeFormList->addRow(_('SMTP server'), new CTextBox('smtp_server', $this->data['smtp_server'], ZBX_TEXTBOX_STANDARD_SIZE));
    $mediaTypeFormList->addRow(_('SMTP helo'), new CTextBox('smtp_helo', $this->data['smtp_helo'], ZBX_TEXTBOX_STANDARD_SIZE));
    $mediaTypeFormList->addRow(_('SMTP email'), new CTextBox('smtp_email', $this->data['smtp_email'], ZBX_TEXTBOX_STANDARD_SIZE));
} elseif ($this->data['type'] == MEDIA_TYPE_SMS) {
    $mediaTypeFormList->addRow(_('GSM modem'), new CTextBox('gsm_modem', $this->data['gsm_modem'], ZBX_TEXTBOX_STANDARD_SIZE));
} elseif ($this->data['type'] == MEDIA_TYPE_EXEC) {
Ejemplo n.º 3
0
     $smtp_helo = get_request('smtp_helo', 'localhost');
     $smtp_email = get_request('smtp_email', 'zabbix@localhost');
     $exec_path = get_request('exec_path', '');
     $gsm_modem = get_request('gsm_modem', '/dev/ttyS0');
     $default_username = $type == MEDIA_TYPE_EZ_TEXTING ? 'username' : 'user@server';
     $username = get_request('username', $default_username);
 }
 $frmMedia = new CFormTable(S_MEDIA);
 //		$frmMeadia->setHelp('web.config.medias.php');
 if (isset($_REQUEST['mediatypeid'])) {
     $frmMedia->addVar('mediatypeid', $_REQUEST['mediatypeid']);
 }
 $frmMedia->addRow(S_DESCRIPTION, new CTextBox('description', $description, 30));
 $cmbType = new CComboBox('type', $type, 'submit()');
 $cmbType->addItems(array(MEDIA_TYPE_EMAIL => S_EMAIL, MEDIA_TYPE_EXEC => S_SCRIPT, MEDIA_TYPE_SMS => S_SMS, MEDIA_TYPE_JABBER => S_JABBER));
 $cmbType->addItemsInGroup(S_COMMERCIAL, array(MEDIA_TYPE_EZ_TEXTING => S_EZ_TEXTING));
 $row = array($cmbType);
 if ($type == MEDIA_TYPE_EZ_TEXTING) {
     $ez_texting_link = new CLink('https://app.eztexting.com', 'https://app.eztexting.com/', null, null, 'nosid');
     $ez_texting_link->setTarget('_blank');
     $row[] = $ez_texting_link;
 }
 $frmMedia->addRow(S_TYPE, $row);
 if ($type == MEDIA_TYPE_EMAIL) {
     $frmMedia->addRow(S_SMTP_SERVER, new CTextBox('smtp_server', $smtp_server, 30));
     $frmMedia->addRow(S_SMTP_HELO, new CTextBox('smtp_helo', $smtp_helo, 30));
     $frmMedia->addRow(S_SMTP_EMAIL, new CTextBox('smtp_email', $smtp_email, 30));
 } else {
     if ($type == MEDIA_TYPE_SMS) {
         $frmMedia->addRow(S_GSM_MODEM, new CTextBox('gsm_modem', $gsm_modem, 50));
     } else {