コード例 #1
0
ファイル: class.ccolor.php プロジェクト: itnihao/zatree-2.2
 public function __construct($name, $value)
 {
     parent::__construct();
     $txt = new CTextBox($name, $value);
     $txt->addStyle('width: 6em;');
     $txt->attr('maxlength', 6);
     $txt->attr('id', zbx_formatDomId($name));
     $txt->addAction('onchange', 'set_color_by_name("' . $name . '", this.value)');
     $txt->addStyle('style', 'margin-top: 0px; margin-bottom: 0px;');
     $lbl = new CColorCell('lbl_' . $name, $value, 'javascript: show_color_picker("' . $name . '")');
     $this->addItem(array($txt, $lbl));
     insert_show_color_picker_javascript();
 }
$severityTab->addRow(_('Information'), array($severityNameTB1, SPACE, $severityColorTB1));
$severityNameTB2 = new CTextBox('severity_name_2', $this->data['config']['severity_name_2']);
$severityNameTB2->addStyle('width: 15em;');
$severityNameTB2->setAttribute('maxlength', 32);
$severityColorTB2 = new CColor('severity_color_2', $this->data['config']['severity_color_2']);
$severityTab->addRow(_('Warning'), array($severityNameTB2, SPACE, $severityColorTB2));
$severityNameTB3 = new CTextBox('severity_name_3', $this->data['config']['severity_name_3']);
$severityNameTB3->addStyle('width: 15em;');
$severityNameTB3->setAttribute('maxlength', 32);
$severityColorTB3 = new CColor('severity_color_3', $this->data['config']['severity_color_3']);
$severityTab->addRow(_('Average'), array($severityNameTB3, SPACE, $severityColorTB3));
$severityNameTB4 = new CTextBox('severity_name_4', $this->data['config']['severity_name_4']);
$severityNameTB4->addStyle('width: 15em;');
$severityNameTB4->setAttribute('maxlength', 32);
$severityColorTB4 = new CColor('severity_color_4', $this->data['config']['severity_color_4']);
$severityTab->addRow(_('High'), array($severityNameTB4, SPACE, $severityColorTB4));
$severityNameTB5 = new CTextBox('severity_name_5', $this->data['config']['severity_name_5']);
$severityNameTB5->addStyle('width: 15em;');
$severityNameTB5->setAttribute('maxlength', 32);
$severityColorTB5 = new CColor('severity_color_5', $this->data['config']['severity_color_5']);
$severityTab->addRow(_('Disaster'), array($severityNameTB5, SPACE, $severityColorTB5));
$severityTab->addRow(SPACE);
$severityTab->addInfo(_('Custom severity names affect all locales and require manual translation!'));
$severityView = new CTabView();
$severityView->addTab('severities', _('Trigger severities'), $severityTab);
$severityForm = new CForm();
$severityForm->setName('triggerSeverity');
$severityForm->addVar('form_refresh', $this->data['form_refresh'] + 1);
$severityForm->addItem($severityView);
$severityForm->addItem(makeFormFooter(array(new CSubmit('save', _('Save'))), new CButton('resetDefaults', _('Reset defaults'))));
return $severityForm;
コード例 #3
0
$inventoryTypeRadioButton = array($inventoryDisabledBtn, new CLabel(_('Disabled'), 'host_inventory_radio_' . HOST_INVENTORY_DISABLED), $inventoryManualBtn, new CLabel(_('Manual'), 'host_inventory_radio_' . HOST_INVENTORY_MANUAL), $inventoryAutomaticBtn, new CLabel(_('Automatic'), 'host_inventory_radio_' . HOST_INVENTORY_AUTOMATIC));
$inventoryFormList->addRow(SPACE, new CDiv($inventoryTypeRadioButton, 'jqueryinputset'));
$hostInventoryTable = DB::getSchema('host_inventory');
$hostInventoryFields = getHostInventories();
foreach ($hostInventoryFields as $inventoryNo => $inventoryInfo) {
    if (!isset($host_inventory[$inventoryInfo['db_field']])) {
        $host_inventory[$inventoryInfo['db_field']] = '';
    }
    if ($hostInventoryTable['fields'][$inventoryInfo['db_field']]['type'] == DB::FIELD_TYPE_TEXT) {
        $input = new CTextArea('host_inventory[' . $inventoryInfo['db_field'] . ']', $host_inventory[$inventoryInfo['db_field']]);
        $input->addStyle('width: 64em;');
    } else {
        $fieldLength = $hostInventoryTable['fields'][$inventoryInfo['db_field']]['length'];
        $input = new CTextBox('host_inventory[' . $inventoryInfo['db_field'] . ']', $host_inventory[$inventoryInfo['db_field']]);
        $input->setAttribute('maxlength', $fieldLength);
        $input->addStyle('width: ' . ($fieldLength > 64 ? 64 : $fieldLength) . 'em;');
    }
    if ($inventory_mode == HOST_INVENTORY_DISABLED) {
        $input->setAttribute('disabled', 'disabled');
    }
    // link to populating item at the right side (if any)
    if (isset($hostItemsToInventory[$inventoryNo])) {
        $itemName = itemName($hostItemsToInventory[$inventoryNo]);
        $populatingLink = new CLink($itemName, 'items.php?form=update&itemid=' . $hostItemsToInventory[$inventoryNo]['itemid']);
        $populatingLink->setAttribute('title', _s('This field is automatically populated by item "%s".', $itemName));
        $populatingItemCell = array(' ← ', $populatingLink);
        $input->addClass('linked_to_item');
        // this will be used for disabling fields via jquery
        if ($inventory_mode == HOST_INVENTORY_AUTOMATIC) {
            $input->setAttribute('disabled', 'disabled');
        }
コード例 #4
0
$host_groups->addItem(0, _('All'));
$groups = $this->getArray('groups');
foreach ($groups as $gnum => $group) {
    $host_groups->addItem($group['groupid'], $group['name']);
}
$scriptTab->addRow(_('Host groups'), $host_groups);
// permissions
$select_acc = new CCombobox('access', $this->get('access'));
$select_acc->addItem(PERM_READ_ONLY, _('Read'));
$select_acc->addItem(PERM_READ_WRITE, _('Write'));
$scriptTab->addRow(_('Required host permissions'), $select_acc);
// confirmation
$enableQuestCB = new CCheckBox('enableConfirmation', $this->get('enableConfirmation'));
$scriptTab->addRow(new CLabel(_('Enable confirmation'), 'enableConfirmation'), array($enableQuestCB, SPACE));
$confirmationTB = new CTextBox('confirmation', $this->get('confirmation'));
$confirmationTB->addStyle('width: 50em;');
$confirmationTB->setAttribute('maxlength', 255);
$testLink = new CButton('testConfirmation', _('Test confirmation'), null, 'link_menu');
$confirmationLabel = new CLabel(_('Confirmation text'), 'confirmation');
$confirmationLabel->setAttribute('id', 'confirmationLabel');
$scriptTab->addRow($confirmationLabel, array($confirmationTB, SPACE, $testLink));
$scriptView = new CTabView();
$scriptView->addTab('scripts', _('Script'), $scriptTab);
$frmScr->addItem($scriptView);
// footer
$main = array(new CSubmit('save', _('Save')));
$others = array();
if (isset($_REQUEST['scriptid'])) {
    $others[] = new CButton('clone', _('Clone'));
    $others[] = new CButtonDelete(_('Delete script?'), url_param('form') . url_param('scriptid'));
}
$headerDiv = new CDiv(_('Colour'), 'inlineblock trigger_displaying_form_col');
$headerDiv->addStyle('margin-left: 2px;');
$triggerDOFormList->addRow(SPACE, array($headerDiv, _('Blinking')));
// Unacknowledged problem events
$triggerDOFormList->addRow(_('Unacknowledged PROBLEM events'), array(new CDiv(new CColor('problem_unack_color', $this->data['problem_unack_color']), 'inlineblock trigger_displaying_form_col'), new CCheckBox('problem_unack_style', $this->data['problem_unack_style'] == 1, null, 1)));
// Acknowledged problem events
$triggerDOFormList->addRow(_('Acknowledged PROBLEM events'), array(new CDiv(new CColor('problem_ack_color', $this->data['problem_ack_color']), 'inlineblock trigger_displaying_form_col'), new CCheckBox('problem_ack_style', $this->data['problem_ack_style'] == 1, null, 1)));
// Unacknowledged recovery events
$triggerDOFormList->addRow(_('Unacknowledged OK events'), array(new CDiv(new CColor('ok_unack_color', $this->data['ok_unack_color']), 'inlineblock trigger_displaying_form_col'), new CCheckBox('ok_unack_style', $this->data['ok_unack_style'] == 1, null, 1)));
// Acknowledged recovery events
$triggerDOFormList->addRow(_('Acknowledged OK events'), array(new CDiv(new CColor('ok_ack_color', $this->data['ok_ack_color']), 'inlineblock trigger_displaying_form_col'), new CCheckBox('ok_ack_style', $this->data['ok_ack_style'] == 1, null, 1)));
// some air between the sections
$triggerDOFormList->addRow(BR());
// Display OK triggers
$okPeriodTextBox = new CTextBox('ok_period', $this->data['ok_period']);
$okPeriodTextBox->addStyle('width: 4em;');
$okPeriodTextBox->setAttribute('maxlength', '6');
$triggerDOFormList->addRow(_('Display OK triggers for'), array($okPeriodTextBox, SPACE, _('seconds')));
// Triggers blink on status change
$okPeriodTextBox = new CTextBox('blink_period', $this->data['blink_period']);
$okPeriodTextBox->addStyle('width: 4em;');
$okPeriodTextBox->setAttribute('maxlength', '6');
$triggerDOFormList->addRow(_('On status change triggers blink for'), array($okPeriodTextBox, SPACE, _('seconds')));
$severityView = new CTabView();
$severityView->addTab('triggerdo', _('Trigger displaying options'), $triggerDOFormList);
$severityForm = new CForm();
$severityForm->setName('triggerDisplayOptions');
$severityForm->addVar('form_refresh', $this->data['form_refresh'] + 1);
$severityForm->addItem($severityView);
$severityForm->addItem(makeFormFooter(new CSubmit('save', _('Save')), new CButton('resetDefaults', _('Reset defaults'))));
return $severityForm;
// append inventories to form list
$inventoryModesComboBox = new CComboBox('inventory_mode', $this->data['inventory_mode'], 'submit()');
$inventoryModesComboBox->addItem(HOST_INVENTORY_DISABLED, _('Disabled'));
$inventoryModesComboBox->addItem(HOST_INVENTORY_MANUAL, _('Manual'));
$inventoryModesComboBox->addItem(HOST_INVENTORY_AUTOMATIC, _('Automatic'));
$hostFormList->addRow(array(_('Inventory mode'), SPACE, new CVisibilityBox('visible[inventory_mode]', isset($this->data['visible']['inventory_mode']), 'inventory_mode', _('Original'))), $inventoryModesComboBox);
$hostInventoryTable = DB::getSchema('host_inventory');
if ($this->data['inventory_mode'] != HOST_INVENTORY_DISABLED) {
    foreach ($this->data['inventories'] as $field => $fieldInfo) {
        if (!isset($this->data['host_inventory'][$field])) {
            $this->data['host_inventory'][$field] = '';
        }
        if ($hostInventoryTable['fields'][$field]['type'] == DB::FIELD_TYPE_TEXT) {
            $fieldInput = new CTextArea('host_inventory[' . $field . ']', $this->data['host_inventory'][$field]);
            $fieldInput->addStyle('width: 64em;');
        } else {
            $fieldLength = $hostInventoryTable['fields'][$field]['length'];
            $fieldInput = new CTextBox('host_inventory[' . $field . ']', $this->data['host_inventory'][$field]);
            $fieldInput->setAttribute('maxlength', $fieldLength);
            $fieldInput->addStyle('width: ' . ($fieldLength > 64 ? 64 : $fieldLength) . 'em;');
        }
        $hostFormList->addRow(array($fieldInfo['title'], SPACE, new CVisibilityBox('visible[' . $field . ']', isset($this->data['visible'][$field]), 'host_inventory[' . $field . ']', _('Original'))), $fieldInput);
    }
}
// append tabs to form
$hostTab = new CTabView();
$hostTab->addTab('hostTab', _('Mass update'), $hostFormList);
$hostForm->addItem($hostTab);
// append buttons to form
$hostForm->addItem(makeFormFooter(new CSubmit('masssave', _('Update')), new CButtonCancel(url_param('groupid'))));
return $hostForm;
コード例 #7
0
ファイル: index.php プロジェクト: songyuanjie/zabbix-stats
}
include_once 'include/page_header.php';
if (isset($_REQUEST['message'])) {
    show_error_message($_REQUEST['message']);
}
if (!isset($sessionid) || $USER_DETAILS['alias'] == ZBX_GUEST_USER) {
    switch ($authentication_type) {
        case ZBX_AUTH_HTTP:
            break;
        case ZBX_AUTH_LDAP:
        case ZBX_AUTH_INTERNAL:
        default:
            //	konqueror bug #138024; adding useless param(login=1) to the form's action path to avoid bug!!
            $frmLogin = new CFormTable(S_LOGIN, 'index.php?login=1', 'post', 'multipart/form-data');
            $frmLogin->setHelp('web.index.login');
            $frmLogin->addVar('request', $request);
            $lt = new CTextBox('name');
            $lt->addStyle('width: 150px');
            $frmLogin->addRow(S_LOGIN_NAME, $lt);
            $pt = new CPassBox('password');
            $pt->addStyle('width: 150px');
            $frmLogin->addRow(S_PASSWORD, $pt);
            $frmLogin->addItemToBottomRow(new CButton('enter', 'Enter'));
            $frmLogin->show(false);
            setFocus($frmLogin->getName(), 'name');
            $frmLogin->destroy();
    }
} else {
    echo '<div align="center" class="textcolorstyles">' . S_WELCOME . ' <b>' . $USER_DETAILS['alias'] . '</b>.</div>';
}
include_once 'include/page_footer.php';