if (!empty($this->data['templates'])) { $triggersFormList->addRow(_('Parent triggers'), $this->data['templates']); } $triggersFormList->addRow(_('Name'), (new CTextBox('description', $this->data['description'], $this->data['limited']))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)->setAttribute('autofocus', 'autofocus')); // append expression to form list if ($this->data['expression_field_readonly']) { $triggersForm->addVar('expression', $this->data['expression']); } $addExpressionButton = (new CButton('insert', $this->data['input_method'] == IM_TREE ? _('Edit') : _('Add')))->addClass(ZBX_STYLE_BTN_GREY)->onClick('return PopUp("popup_trexpr.php?dstfrm=' . $triggersForm->getName() . '&dstfld1=' . $this->data['expression_field_name'] . '&srctbl=expression&srcfld1=expression' . '&expression=" + encodeURIComponent(jQuery(\'[name="' . $this->data['expression_field_name'] . '"]\').val()));'); if ($this->data['limited']) { $addExpressionButton->setAttribute('disabled', 'disabled'); } $expressionRow = [(new CTextArea($this->data['expression_field_name'], $this->data['expression_field_value'], ['readonly' => $this->data['expression_field_readonly']]))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH), (new CDiv())->addClass(ZBX_STYLE_FORM_INPUT_MARGIN), $addExpressionButton]; if ($this->data['input_method'] == IM_TREE) { // insert macro button $insertMacroButton = (new CButton('insert_macro', _('Insert expression')))->addClass(ZBX_STYLE_BTN_GREY)->setMenuPopup(CMenuPopupHelper::getTriggerMacro()); if ($this->data['limited']) { $insertMacroButton->setAttribute('disabled', 'disabled'); } $expressionRow[] = (new CDiv())->addClass(ZBX_STYLE_FORM_INPUT_MARGIN); $expressionRow[] = $insertMacroButton; array_push($expressionRow, BR()); if (empty($this->data['outline'])) { // add button $addExpressionButton = (new CSubmit('add_expression', _('Add')))->addClass(ZBX_STYLE_BTN_GREY); if ($this->data['limited']) { $addExpressionButton->setAttribute('disabled', 'disabled'); } $expressionRow[] = $addExpressionButton; } else { // add button
$nameTextBox->attr('autofocus', 'autofocus'); $triggersFormList->addRow(_('Name'), $nameTextBox); // append expression to form list $expressionTextBox = new CTextArea($this->data['expression_field_name'], $this->data['expression_field_value'], array('rows' => ZBX_TEXTAREA_STANDARD_ROWS, 'width' => ZBX_TEXTAREA_STANDARD_WIDTH, 'readonly' => $this->data['expression_field_readonly'])); if ($this->data['expression_field_readonly']) { $triggersForm->addVar('expression', $this->data['expression']); } $addExpressionButton = new CButton('insert', $this->data['input_method'] == IM_TREE ? _('Edit') : _('Add'), 'return PopUp("popup_trexpr.php?dstfrm=' . $triggersForm->getName() . '&dstfld1=' . $this->data['expression_field_name'] . '&srctbl=expression' . url_param('parent_discoveryid') . '&srcfld1=expression&expression=" + encodeURIComponent(jQuery(\'[name="' . $this->data['expression_field_name'] . '"]\').val()), 800, 265);', 'formlist'); if ($this->data['limited']) { $addExpressionButton->setAttribute('disabled', 'disabled'); } $expressionRow = array($expressionTextBox, $addExpressionButton); if ($this->data['input_method'] == IM_TREE) { // insert macro button $insertMacroButton = new CButton('insert_macro', _('Insert expression'), null, 'formlist'); $insertMacroButton->setMenuPopup(CMenuPopupHelper::getTriggerMacro()); if ($this->data['limited']) { $insertMacroButton->setAttribute('disabled', 'disabled'); } $expressionRow[] = $insertMacroButton; array_push($expressionRow, BR()); if (empty($this->data['outline'])) { // add button $addExpressionButton = new CSubmit('add_expression', _('Add'), null, 'formlist'); if ($this->data['limited']) { $addExpressionButton->setAttribute('disabled', 'disabled'); } array_push($expressionRow, $addExpressionButton); } else { // add button $addExpressionButton = new CSubmit('and_expression', _('And'), null, 'formlist');