/** * @param array $options['objectOptions'] an array of parameters to be added to the request URL * * @see jQuery.multiSelect() */ public function __construct(array $options = []) { parent::__construct('div', true); $this->addClass('multiselect'); $this->setId(zbx_formatDomId($options['name'])); // url $url = new CUrl('jsrpc.php'); $url->setArgument('type', PAGE_TYPE_TEXT_RETURN_JSON); $url->setArgument('method', 'multiselect.get'); $url->setArgument('objectName', $options['objectName']); if (!empty($options['objectOptions'])) { foreach ($options['objectOptions'] as $optionName => $optionvalue) { $url->setArgument($optionName, $optionvalue); } } $params = ['url' => $url->getUrl(), 'name' => $options['name'], 'labels' => ['No matches found' => _('No matches found'), 'More matches found...' => _('More matches found...'), 'type here to search' => _('type here to search'), 'new' => _('new'), 'Select' => _('Select')]]; if (array_key_exists('data', $options)) { $params['data'] = zbx_cleanHashes($options['data']); } foreach (['ignored', 'defaultValue', 'disabled', 'selectedLimit', 'addNew'] as $option) { if (array_key_exists($option, $options)) { $params[$option] = $options[$option]; } } if (array_key_exists('popup', $options)) { foreach (['parameters', 'width', 'height'] as $option) { if (array_key_exists($option, $options['popup'])) { $params['popup'][$option] = $options['popup'][$option]; } } } zbx_add_post_js('jQuery("#' . $this->getAttribute('id') . '").multiSelect(' . CJs::encodeJson($params) . ');'); }
public function __construct($name = 'editablecombobox', $value = null, $size = null, $action = null) { insert_javascript_for_editable_combobox(); parent::__construct($name, $value, $action); parent::addAction('onfocus', 'CEditableComboBoxInit(this);'); $width = $size == ZBX_TEXTBOX_STANDARD_SIZE ? ZBX_TEXTAREA_STANDARD_WIDTH : null; parent::addAction('onchange', 'CEditableComboBoxOnChange(this, ' . CJs::encodeJson($size) . ', ' . CJs::encodeJson($width) . ');'); // prevent Firefox remembering selected option on page refresh $this->setAttribute('autocomplete', 'off'); }
protected function doAction() { $widget = $this->getInput('widget'); $data = ['main_block' => '']; // refresh rate if ($this->hasInput('refreshrate')) { $refreshrate = $this->getInput('refreshrate'); CProfile::update('web.dashboard.widget.' . $widget . '.rf_rate', $refreshrate, PROFILE_TYPE_INT); $data['main_block'] = 'PMasters["dashboard"].dolls["' . $widget . '"].frequency(' . CJs::encodeJson($refreshrate) . ');' . "\n" . 'PMasters["dashboard"].dolls["' . $widget . '"].restartDoll();'; } // widget state if ($this->hasInput('state')) { CProfile::update('web.dashboard.widget.' . $widget . '.state', $this->getInput('state'), PROFILE_TYPE_INT); } $this->setResponse(new CControllerResponseData($data)); }
/** * @param array $options['objectOptions'] an array of parameters to be added to the request URL * * @see jQuery.multiSelect() */ public function __construct(array $options = array()) { parent::__construct('div', 'yes'); $this->addClass('multiselect'); $this->attr('id', zbx_formatDomId($options['name'])); // url $url = new Curl('jsrpc.php'); $url->setArgument('type', PAGE_TYPE_TEXT_RETURN_JSON); $url->setArgument('method', 'multiselect.get'); $url->setArgument('objectName', $options['objectName']); if (!empty($options['objectOptions'])) { foreach ($options['objectOptions'] as $optionName => $optionvalue) { $url->setArgument($optionName, $optionvalue); } } $params = array('id' => $this->getAttribute('id'), 'url' => $url->getUrl(), 'name' => $options['name'], 'labels' => array('No matches found' => _('No matches found'), 'More matches found...' => _('More matches found...'), 'type here to search' => _('type here to search'), 'new' => _('new'), 'Select' => _('Select')), 'data' => empty($options['data']) ? array() : zbx_cleanHashes($options['data']), 'ignored' => isset($options['ignored']) ? $options['ignored'] : null, 'defaultValue' => isset($options['defaultValue']) ? $options['defaultValue'] : null, 'disabled' => isset($options['disabled']) ? $options['disabled'] : false, 'selectedLimit' => isset($options['selectedLimit']) ? $options['selectedLimit'] : null, 'addNew' => isset($options['addNew']) ? $options['addNew'] : false, 'popup' => array('parameters' => isset($options['popup']['parameters']) ? $options['popup']['parameters'] : null, 'width' => isset($options['popup']['width']) ? $options['popup']['width'] : null, 'height' => isset($options['popup']['height']) ? $options['popup']['height'] : null, 'buttonClass' => isset($options['popup']['buttonClass']) ? $options['popup']['buttonClass'] : null)); zbx_add_post_js('jQuery("#' . $this->getAttribute('id') . '").multiSelect(' . CJs::encodeJson($params) . ')'); }
/** * Process screen. * * @return CDiv (screen inside container) */ public function get() { $this->dataId = 'graph_' . $this->screenitem['screenitemid'] . '_' . $this->screenitem['screenid']; $resourceid = !empty($this->screenitem['real_resourceid']) ? $this->screenitem['real_resourceid'] : $this->screenitem['resourceid']; $containerid = 'graph_container_' . $this->screenitem['screenitemid'] . '_' . $this->screenitem['screenid']; $graphDims = getGraphDims(); $graphDims['graphHeight'] = $this->screenitem['height']; $graphDims['width'] = $this->screenitem['width']; // get time control $timeControlData = array('id' => $this->getDataId(), 'containerid' => $containerid, 'objDims' => $graphDims, 'loadImage' => 1, 'periodFixed' => CProfile::get('web.screens.timelinefixed', 1), 'sliderMaximumTimePeriod' => ZBX_MAX_PERIOD); // host feature if ($this->screenitem['dynamic'] == SCREEN_DYNAMIC_ITEM && !empty($this->hostid)) { $newitemid = get_same_item_for_host($resourceid, $this->hostid); $resourceid = !empty($newitemid) ? $newitemid : ''; } if ($this->mode == SCREEN_MODE_PREVIEW && !empty($resourceid)) { $this->action = 'history.php?action=' . HISTORY_GRAPH . '&itemids[]=' . $resourceid . '&period=' . $this->timeline['period'] . '&stime=' . $this->timeline['stimeNow'] . $this->getProfileUrlParams(); } if ($resourceid && $this->mode != SCREEN_MODE_EDIT) { if ($this->mode == SCREEN_MODE_PREVIEW) { $timeControlData['loadSBox'] = 1; } } $timeControlData['src'] = $resourceid ? 'chart.php?itemids[]=' . $resourceid . '&' . $this->screenitem['url'] . '&width=' . $this->screenitem['width'] . '&height=' . $this->screenitem['height'] : 'chart3.php?'; $timeControlData['src'] .= $this->mode == SCREEN_MODE_EDIT ? '&period=3600&stime=' . date(TIMESTAMP_FORMAT, time()) : '&period=' . $this->timeline['period'] . '&stime=' . $this->timeline['stimeNow']; $timeControlData['src'] .= $this->getProfileUrlParams(); // output if ($this->mode == SCREEN_MODE_JS) { return 'timeControl.addObject("' . $this->getDataId() . '", ' . CJs::encodeJson($this->timeline) . ', ' . CJs::encodeJson($timeControlData) . ')'; } else { if ($this->mode == SCREEN_MODE_SLIDESHOW) { insert_js('timeControl.addObject("' . $this->getDataId() . '", ' . CJs::encodeJson($this->timeline) . ', ' . CJs::encodeJson($timeControlData) . ');'); } else { zbx_add_post_js('timeControl.addObject("' . $this->getDataId() . '", ' . CJs::encodeJson($this->timeline) . ', ' . CJs::encodeJson($timeControlData) . ');'); } if ($this->mode == SCREEN_MODE_EDIT || $this->mode == SCREEN_MODE_SLIDESHOW) { $item = new CDiv(); } elseif ($this->mode == SCREEN_MODE_PREVIEW) { $item = new CLink(null, 'history.php?action=' . HISTORY_GRAPH . '&itemids[]=' . $resourceid . '&period=' . $this->timeline['period'] . '&stime=' . $this->timeline['stimeNow']); } $item->setAttribute('id', $containerid); return $this->getOutput($item); } }
public function toString($destroy = true) { $url = $this->url; if ($this->use_sid) { if (array_key_exists('zbx_sessionid', $_COOKIE)) { $url .= strpos($url, '&') !== false || strpos($url, '?') !== false ? '&' : '?'; $url .= 'sid=' . substr($_COOKIE['zbx_sessionid'], 16, 16); } $confirm_script = $this->confirm_message !== '' ? 'Confirm(' . CJs::encodeJson($this->confirm_message) . ') && ' : ''; $this->onClick("javascript: return " . $confirm_script . "redirect('" . $url . "', 'post', 'sid', true)"); $this->setAttribute('href', 'javascript:void(0)'); } else { $this->setAttribute('href', $url); if ($this->confirm_message !== '') { $this->onClick('javascript: return Confirm(' . CJs::encodeJson($this->confirm_message) . ');'); } } return parent::toString($destroy); }
if (isset($this->data['change_bind_password']) || zbx_empty($this->data['config']['ldap_bind_password'])) { $authenticationForm->addVar('change_bind_password', 1); $authenticationFormList->addRow(_('Bind password'), (new CPassBox('ldap_bind_password'))->setWidth(ZBX_TEXTAREA_SMALL_WIDTH)); } else { $authenticationFormList->addRow(_('Bind password'), (new CSubmit('change_bind_password', _('Change password')))->addClass(ZBX_STYLE_BTN_GREY)); } $authenticationFormList->addRow(_('Test authentication'), ' [' . _('must be a valid LDAP user') . ']'); $authenticationFormList->addRow(_('Login'), $userComboBox); $authenticationFormList->addRow(_('User password'), (new CPassBox('user_password'))->setWidth(ZBX_TEXTAREA_SMALL_WIDTH)); } // append form list to tab $authenticationTab = new CTabView(); $authenticationTab->addTab('authenticationTab', $this->data['title'], $authenticationFormList); // create save button $saveButton = new CSubmit('update', _('Update')); if ($this->data['is_authentication_type_changed']) { $saveButton->onClick('javascript: if (confirm(' . CJs::encodeJson(_('Switching authentication method will reset all except this session! Continue?')) . ')) {' . 'jQuery("#authenticationForm").submit(); return true; } else { return false; }'); } elseif ($this->data['config']['authentication_type'] != ZBX_AUTH_LDAP) { $saveButton->setAttribute('disabled', 'true'); } // append buttons to form if ($this->data['config']['authentication_type'] == ZBX_AUTH_LDAP) { $authenticationTab->setFooter(makeFormFooter($saveButton, [new CSubmit('test', _('Test'))])); } else { $authenticationTab->setFooter(makeFormFooter($saveButton)); } // append tab to form $authenticationForm->addItem($authenticationTab); // append form to widget $widget->addItem($authenticationForm); return $widget;
$buttonCol = new CCol(new CButton('addIPMIInterface', _('Add'), null, 'link_menu'), 'interface-add-control'); $col = new CCol($helpTextWhenDragInterfaceIPMI); $col->setAttribute('colspan', 6); $buttonRow = new CRow(array($buttonCol, $col)); $buttonRow->setAttribute('id', 'IPMIIterfacesFooter'); $ifTab->addRow($buttonRow); $hostList->addRow(_('IPMI interfaces'), new CDiv($ifTab, 'border_dotted objectgroup inlineblock interface-group'), false, null, 'interface-row'); } else { $interfaces = array(); $existingInterfaceTypes = array(); foreach ($dbHost['interfaces'] as $interface) { $interface['locked'] = true; $existingInterfaceTypes[$interface['type']] = true; $interfaces[$interface['interfaceid']] = $interface; } zbx_add_post_js('hostInterfacesManager.add(' . CJs::encodeJson($interfaces) . ');'); zbx_add_post_js('hostInterfacesManager.disable()'); // table for agent interfaces with footer $ifTab = new CTable(null, 'formElementTable'); $ifTab->setAttribute('id', 'agentInterfaces'); $ifTab->setAttribute('data-type', 'agent'); // header $ifTab->addRow(array(new CCol(SPACE, 'interface-drag-control'), new CCol(_('IP address'), 'interface-ip'), new CCol(_('DNS name'), 'interface-dns'), new CCol(_('Connect to'), 'interface-connect-to'), new CCol(_('Port'), 'interface-port'), new CCol(_('Default'), 'interface-default'), new CCol(SPACE, 'interface-control'))); $row = new CRow(null, null, 'agentIterfacesFooter'); if (!isset($existingInterfaceTypes[INTERFACE_TYPE_AGENT])) { $row->addItem(new CCol(null, 'interface-drag-control')); $row->addItem(new CCol(_('No agent interfaces found.'), null, 5)); } $ifTab->addRow($row); $hostList->addRow(_('Agent interfaces'), new CDiv($ifTab, 'border_dotted objectgroup interface-group'), false, null, 'interface-row interface-row-first'); // table for SNMP interfaces with footer
if (hasRequest('widgetRefresh')) { $screenBuilder = new CScreenBuilder(['screen' => $dbScreen, 'mode' => SCREEN_MODE_PREVIEW, 'profileIdx' => 'web.slides', 'profileIdx2' => $elementId, 'hostid' => getRequest('hostid'), 'period' => getRequest('period'), 'stime' => getRequest('stime')]); CScreenBuilder::insertScreenCleanJs(); echo (new CDiv($screenBuilder->show()))->addClass(ZBX_STYLE_TABLE_FORMS_CONTAINER)->toString(); CScreenBuilder::insertScreenStandardJs(['timeline' => $screenBuilder->timeline, 'profileIdx' => $screenBuilder->profileIdx]); insertPagePostJs(); } // refresh rate if (hasRequest('widgetRefreshRate')) { $widgetRefreshRate = substr(getRequest('widgetRefreshRate'), 1); CProfile::update('web.slides.rf_rate.' . WIDGET_SLIDESHOW, $widgetRefreshRate, PROFILE_TYPE_STR, $elementId); } else { $widgetRefreshRate = CProfile::get('web.slides.rf_rate.' . WIDGET_SLIDESHOW, 1, getRequest('elementid', CProfile::get('web.slides.elementid'))); } $delay = $screen['delay'] > 0 ? $screen['delay'] : $data['screen']['delay']; insert_js('PMasters["slideshows"].dolls["' . WIDGET_SLIDESHOW . '"].frequency(' . CJs::encodeJson($delay * $widgetRefreshRate) . ');' . "\n" . 'PMasters["slideshows"].dolls["' . WIDGET_SLIDESHOW . '"].restartDoll();'); } } // filter state if (hasRequest('favobj') && hasRequest('favid')) { $favouriteObject = getRequest('favobj'); $favouriteId = getRequest('favid'); // saving fixed/dynamic setting to profile if ($favouriteObject === 'timelinefixedperiod') { CProfile::update('web.slides.timelinefixed', $favouriteId, PROFILE_TYPE_INT); } } if ($page['type'] == PAGE_TYPE_JS || $page['type'] == PAGE_TYPE_HTML_BLOCK) { require_once dirname(__FILE__) . '/include/page_footer.php'; exit; }
macroInput = $(macroInput); macroInput.val(macroInput.val().toUpperCase()); conditions.push({ id: macroInput.data('formulaid'), type: macroInput.val() }); }); $('#expression').html(getConditionFormula(conditions, +$('#evaltype').val())); } $('#conditions') .dynamicRows({ template: '#condition-row', counter: <?php echo CJs::encodeJson($counter); ?> , dataCallback: function(data) { data.formulaId = num2letter(data.rowNum); return data; } }) .bind('tableupdate.dynamicRows', function(event, options) { $('#conditionRow').toggle($(options.row, $(this)).length > 1); }) .bind('rowremove.dynamicRows', function() { updateExpression(); }) .on('change', '.macro', function() {
// if ($_REQUEST['favobj'] == 'sysmap' && getRequest('action') == 'update') { if (getRequest('favobj') == 'sysmap' && hasRequest('action') && getRequest('action') == 'update') { $sysmapid = getRequest('sysmapid', 0); @ob_start(); try { DBstart(); $sysmap = API::Map()->get(array('sysmapids' => $sysmapid, 'editable' => true, 'output' => array('sysmapid'))); $sysmap = reset($sysmap); if ($sysmap === false) { throw new Exception(_('Access denied!') . "\n\r"); } $sysmapUpdate = $json->decode($_REQUEST['sysmap'], true); $sysmapUpdate['sysmapid'] = $sysmapid; $result = API::Map()->update($sysmapUpdate); if ($result !== false) { echo 'if (confirm(' . CJs::encodeJson(_('Map is updated! Return?')) . ')) { location.href = "sysmaps.php"; }'; } else { throw new Exception(_('Map update failed.') . "\n\r"); } DBend(true); } catch (Exception $e) { DBend(false); $msg = array($e->getMessage()); foreach (clear_messages() as $errMsg) { $msg[] = $errMsg['type'] . ': ' . $errMsg['message']; } ob_clean(); echo 'alert(' . zbx_jsvalue(implode("\n\r", $msg)) . ');'; } @ob_flush(); exit;
public function preload() { $id = $this->getAttribute('id'); if (empty($id)) { $id = 'img' . uniqid(); $this->setAttribute('id', $id); } insert_js('jQuery(' . CJs::encodeJson($this->toString()) . ').load(function() { var parent = jQuery("#' . $id . 'preloader").parent(); jQuery("#' . $id . 'preloader").remove(); jQuery(parent).append(jQuery(this)); });', true); $this->addClass('preloader'); $this->setAttribute('id', $id . 'preloader'); $this->setAttribute('src', 'styles/themes/' . getUserTheme(CWebUser::$data) . '/images/preloader.gif'); }
public function get() { $widget = array(); if (!empty($this->pageHeaders)) { $widget[] = $this->createPageHeader(); } if (!empty($this->headers)) { $widget[] = $this->createHeader(); } if (!empty($this->flicker)) { $flicker_domid = 'flicker_' . $this->bodyId; $flicker_tab = new CTable(); $flicker_tab->setAttribute('width', '100%'); $flicker_tab->setCellPadding(0); $flicker_tab->setCellSpacing(0); $div = new CDiv($this->flicker, null, $flicker_domid); if (!$this->flicker_state) { $div->setAttribute('style', 'display: none;'); } $icon_l = new CDiv(SPACE . SPACE, $this->flicker_state ? 'dbl_arrow_up' : 'dbl_arrow_down', 'flicker_icon_l'); $icon_l->setAttribute('title', _('Maximize') . '/' . _('Minimize')); $icon_r = new CDiv(SPACE . SPACE, $this->flicker_state ? 'dbl_arrow_up' : 'dbl_arrow_down', 'flicker_icon_r'); $icon_r->setAttribute('title', _('Maximize') . '/' . _('Minimize')); $icons_row = new CTable(null, 'textwhite'); $flickerTitleWhenVisible = _('Hide filter'); $flickerTitleWhenHidden = _('Show filter'); $flickerTitle = $this->flicker_state ? $flickerTitleWhenVisible : $flickerTitleWhenHidden; $icons_row->addRow(array($icon_l, new CSpan(SPACE . $flickerTitle . SPACE, null, 'flicker_title'), $icon_r)); $thin_tab = $this->createFlicker($icons_row); $thin_tab->attr('id', 'filter_icon'); $thin_tab->addAction('onclick', "javascript: changeFlickerState(" . "'" . $flicker_domid . "', " . CJs::encodeJson($flickerTitleWhenVisible) . ", " . CJs::encodeJson($flickerTitleWhenHidden) . ");"); $flicker_tab->addRow($thin_tab, 'textcolorstyles pointer'); $flicker_tab->addRow($div); $widget[] = $flicker_tab; } $div = new CDiv($this->body, 'w'); $div->setAttribute('id', $this->bodyId); $widget[] = $div; return new CDiv($widget, $this->getRootClass()); }
** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ require_once dirname(__FILE__) . '/js/adm.regexprs.edit.js.php'; zbx_add_post_js('zabbixRegExp.addExpressions(' . CJs::encodeJson(array_values($this->get('expressions'))) . ');'); $form = new CForm(); $form->attr('id', 'zabbixRegExpForm'); $form->addVar('form', 1); $form->addVar('regexpid', $this->data['regexpid']); /* * Expressions tab */ $exprTab = new CFormList('exprTab'); $nameTextBox = new CTextBox('name', $this->get('name'), ZBX_TEXTBOX_STANDARD_SIZE, false, 128); $nameTextBox->attr('autofocus', 'autofocus'); $exprTab->addRow(_('Name'), $nameTextBox); $exprTable = new CTable(null, 'formElementTable formWideTable'); $exprTable->attr('id', 'exprTable'); $exprTable->setHeader(array(_('Expression'), new CCol(_('Expression type'), 'nowrap'), new CCol(_('Case sensitive'), 'nowrap'), SPACE)); $exprTable->setFooter(new CButton('add', _('Add'), null, 'link_menu exprAdd'));
tr.appendChild(td); // column "action" var td = document.createElement('td'); td.setAttribute('class', '<?php echo ZBX_STYLE_NOWRAP; ?> '); var inputRemove = document.createElement('button'); inputRemove.setAttribute('class', '<?php echo ZBX_STYLE_BTN_LINK; ?> '); inputRemove.setAttribute('onclick', 'javascript: removeDependentChild(\'' + serviceid + '\');'); inputRemove.appendChild(document.createTextNode(<?php echo CJs::encodeJson(_('Remove')); ?> )); td.appendChild(inputRemove); tr.appendChild(td); document.getElementById('service_children').firstChild.appendChild(tr); } } function removeDependentChild(serviceid) { removeObjectById('children_' + serviceid); removeObjectById('children_' + serviceid + '_name'); removeObjectById('children_' + serviceid + '_serviceid'); removeObjectById('children_' + serviceid + '_trigger'); }
} } $errorImg = makeErrorIcon($errors); } // templated trigger if ($this->data['limited']) { // make all links inside inactive foreach ($e['list'] as &$obj) { if (gettype($obj) == 'object' && get_class($obj) == 'CSpan' && $obj->getAttribute('class') == ZBX_STYLE_LINK_ACTION) { $obj->removeAttribute('class'); $obj->onClick(null); } } unset($obj); } $expressionTable->addRow(new CRow([!$this->data['limited'] ? (new CCheckBox('expr_target_single', $e['id']))->setChecked($i == 0)->onClick('check_target(this);') : null, $e['list'], !$this->data['limited'] ? (new CCol((new CButton(null, _('Remove')))->addClass(ZBX_STYLE_BTN_LINK)->onClick('javascript:' . ' if (confirm(' . CJs::encodeJson(_('Delete expression?')) . ')) {' . ' delete_expression("' . $e['id'] . '");' . ' document.forms["' . $triggersForm->getName() . '"].submit();' . ' }')))->addClass(ZBX_STYLE_NOWRAP) : null, $errorImg])); } } else { $allowedTesting = false; $this->data['outline'] = ''; } $testButton = (new CButton('test_expression', _('Test')))->onClick('openWinCentered("tr_testexpr.php?expression=" + encodeURIComponent(this.form.elements["expression"].value),' . '"ExpressionTest", 950, 650, "titlebar=no, resizable=yes, scrollbars=yes"); return false;')->addClass(ZBX_STYLE_BTN_LINK); if (!$allowedTesting) { $testButton->setAttribute('disabled', 'disabled'); } if (empty($this->data['outline'])) { $testButton->setAttribute('disabled', 'disabled'); } $wrapOutline = new CSpan([$this->data['outline']]); $triggersFormList->addRow(null, [$wrapOutline, BR(), BR(), (new CDiv([$expressionTable, $testButton]))->addClass(ZBX_STYLE_TABLE_FORMS_SEPARATOR)->setAttribute('style', 'min-width: ' . ZBX_TEXTAREA_BIG_WIDTH . 'px;')]); $inputMethodToggle = (new CButton(null, _('Close expression constructor')))->addClass(ZBX_STYLE_BTN_LINK)->onClick('javascript: ' . 'document.getElementById("toggle_input_method").value=1;' . 'document.getElementById("input_method").value=' . IM_ESTABLISHED . ';' . 'document.forms["' . $triggersForm->getName() . '"].submit();');
handle: 'span.ui-icon-arrowthick-2-n-s', revert: 'invalid', stop: function(event, ui) { var hostInterfaceId = jQuery(this).data('interfaceid'); resetMainInterfaces(); resetUseipInterface(hostInterfaceId) } }); } function addNotDraggableIcon(domElement) { domElement.children().first().append('<span class="ui-icon ui-icon-arrowthick-2-n-s state-disabled"></span>'); jQuery('.ui-icon', domElement).hover( function (event) { jQuery('<div>' + <?php echo CJs::encodeJson(_('Interface is used by items that require this type of the interface.')); ?> + '</div>') .css({position: 'absolute', opacity: 1, padding: '2px'}) .addClass('ui-state-highlight') .appendTo(event.target.parentNode); }, function (event) { jQuery(event.target).next().remove(); } ) } function getDomElementsAttrsForInterface(hostInterface) { var attrs = { disabled: '',
/** * Process screen. * * @return CDiv (screen inside container) */ public function get() { $output = []; $items = API::Item()->get(['output' => ['itemid', 'hostid', 'name', 'key_', 'value_type', 'valuemapid'], 'selectHosts' => ['name'], 'itemids' => $this->itemids, 'webitems' => true, 'preservekeys' => true]); $items = CMacrosResolverHelper::resolveItemNames($items); $stime = zbxDateToTime($this->timeline['stime']); $firstItem = reset($items); $iv_string = [ITEM_VALUE_TYPE_LOG => 1, ITEM_VALUE_TYPE_TEXT => 1]; $iv_numeric = [ITEM_VALUE_TYPE_FLOAT => 1, ITEM_VALUE_TYPE_UINT64 => 1]; if ($this->action == HISTORY_VALUES || $this->action == HISTORY_LATEST) { $options = ['history' => $firstItem['value_type'], 'itemids' => $this->itemids, 'output' => API_OUTPUT_EXTEND, 'sortorder' => ZBX_SORT_DOWN]; if ($this->action == HISTORY_LATEST) { $options['limit'] = 500; } elseif ($this->action == HISTORY_VALUES) { $config = select_config(); // interval start value is non-inclusive, hence the + 1 second $options['time_from'] = $stime + 1; $options['time_till'] = $stime + $this->timeline['period']; $options['limit'] = $config['search_limit']; } // text log if (isset($iv_string[$firstItem['value_type']])) { $isManyItems = count($items) > 1; $useLogItem = $firstItem['value_type'] == ITEM_VALUE_TYPE_LOG; $useEventLogItem = strpos($firstItem['key_'], 'eventlog[') === 0; if (empty($this->plaintext)) { $historyTable = (new CTableInfo())->setHeader([(new CColHeader(_('Timestamp')))->addClass(ZBX_STYLE_CELL_WIDTH), $isManyItems ? _('Item') : null, $useLogItem ? (new CColHeader(_('Local time')))->addClass(ZBX_STYLE_CELL_WIDTH) : null, $useEventLogItem && $useLogItem ? (new CColHeader(_('Source')))->addClass(ZBX_STYLE_CELL_WIDTH) : null, $useEventLogItem && $useLogItem ? (new CColHeader(_('Severity')))->addClass(ZBX_STYLE_CELL_WIDTH) : null, $useEventLogItem && $useLogItem ? (new CColHeader(_('Event ID')))->addClass(ZBX_STYLE_CELL_WIDTH) : null, _('Value')]); } if ($this->filter !== '' && in_array($this->filterTask, [FILTER_TASK_SHOW, FILTER_TASK_HIDE])) { $options['search'] = ['value' => $this->filter]; if ($this->filterTask == FILTER_TASK_HIDE) { $options['excludeSearch'] = 1; } } $options['sortfield'] = 'id'; $historyData = API::History()->get($options); foreach ($historyData as $data) { $data['value'] = rtrim($data['value'], " \t\r\n"); if (empty($this->plaintext)) { $item = $items[$data['itemid']]; $host = reset($item['hosts']); $color = null; if ($this->filter !== '') { $haystack = mb_strtolower($data['value']); $needle = mb_strtolower($this->filter); $pos = mb_strpos($haystack, $needle); if ($pos !== false && $this->filterTask == FILTER_TASK_MARK) { $color = $this->markColor; } elseif ($pos === false && $this->filterTask == FILTER_TASK_INVERT_MARK) { $color = $this->markColor; } switch ($color) { case MARK_COLOR_RED: $color = ZBX_STYLE_RED; break; case MARK_COLOR_GREEN: $color = ZBX_STYLE_GREEN; break; case MARK_COLOR_BLUE: $color = ZBX_STYLE_BLUE; break; } } $row = []; $row[] = (new CCol(zbx_date2str(DATE_TIME_FORMAT_SECONDS, $data['clock'])))->addClass(ZBX_STYLE_NOWRAP)->addClass($color); if ($isManyItems) { $row[] = (new CCol($host['name'] . NAME_DELIMITER . $item['name_expanded']))->addClass($color); } if ($useLogItem) { $row[] = $data['timestamp'] != 0 ? (new CCol(zbx_date2str(DATE_TIME_FORMAT_SECONDS, $data['timestamp'])))->addClass(ZBX_STYLE_NOWRAP)->addClass($color) : ''; // if this is a eventLog item, showing additional info if ($useEventLogItem) { $row[] = (new CCol($data['source']))->addClass(ZBX_STYLE_NOWRAP)->addClass($color); $row[] = $data['severity'] != 0 ? (new CCol(get_item_logtype_description($data['severity'])))->addClass(ZBX_STYLE_NOWRAP)->addClass(get_item_logtype_style($data['severity'])) : ''; $row[] = $data['logeventid'] != 0 ? (new CCol($data['logeventid']))->addClass(ZBX_STYLE_NOWRAP)->addClass($color) : ''; } } $row[] = (new CCol(new CPre(zbx_nl2br($data['value']))))->addClass($color); $historyTable->addRow($row); } else { $output[] = zbx_date2str(DATE_TIME_FORMAT_SECONDS, $data['clock']) . ' ' . $data['clock'] . ' ' . htmlspecialchars($data['value']); } } if (empty($this->plaintext)) { $output[] = $historyTable; } } else { if (empty($this->plaintext)) { $historyTable = (new CTableInfo())->setHeader([(new CColHeader(_('Timestamp')))->addClass(ZBX_STYLE_CELL_WIDTH), _('Value')]); } $options['sortfield'] = ['itemid', 'clock']; $historyData = API::History()->get($options); foreach ($historyData as $data) { $item = $items[$data['itemid']]; $value = rtrim($data['value'], " \t\r\n"); // format the value as float if ($item['value_type'] == ITEM_VALUE_TYPE_FLOAT) { sscanf($data['value'], '%f', $value); } // html table if (empty($this->plaintext)) { if ($item['valuemapid']) { $value = applyValueMap($value, $item['valuemapid']); } $historyTable->addRow([(new CCol(zbx_date2str(DATE_TIME_FORMAT_SECONDS, $data['clock'])))->addClass(ZBX_STYLE_NOWRAP), new CPre(zbx_nl2br($value))]); } else { $output[] = zbx_date2str(DATE_TIME_FORMAT_SECONDS, $data['clock']) . ' ' . $data['clock'] . ' ' . htmlspecialchars($value); } } if (empty($this->plaintext)) { $output[] = $historyTable; } } } // time control if (!$this->plaintext && str_in_array($this->action, [HISTORY_VALUES, HISTORY_GRAPH, HISTORY_BATCH_GRAPH])) { $graphDims = getGraphDims(); $this->timeline['starttime'] = date(TIMESTAMP_FORMAT, get_min_itemclock_by_itemid($firstItem['itemid'])); $this->dataId = 'historyGraph'; $timeControlData = ['periodFixed' => CProfile::get('web.history.timelinefixed', 1), 'sliderMaximumTimePeriod' => ZBX_MAX_PERIOD]; if (($this->action == HISTORY_GRAPH || $this->action == HISTORY_BATCH_GRAPH) && !isset($iv_string[$firstItem['value_type']])) { $containerId = 'graph_cont1'; $output[] = (new CDiv())->addClass('center')->setId($containerId); $timeControlData['id'] = $this->getDataId(); $timeControlData['containerid'] = $containerId; $timeControlData['src'] = $this->getGraphUrl($this->itemids); $timeControlData['objDims'] = $graphDims; $timeControlData['loadSBox'] = 1; $timeControlData['loadImage'] = 1; $timeControlData['dynamic'] = 1; } else { $timeControlData['id'] = $this->getDataId(); $timeControlData['mainObject'] = 1; } if ($this->mode == SCREEN_MODE_JS) { $timeControlData['dynamic'] = 0; return 'timeControl.addObject("' . $this->getDataId() . '", ' . CJs::encodeJson($this->timeline) . ', ' . CJs::encodeJson($timeControlData) . ');'; } else { zbx_add_post_js('timeControl.addObject("' . $this->getDataId() . '", ' . CJs::encodeJson($this->timeline) . ', ' . CJs::encodeJson($timeControlData) . ');'); } } if (!empty($this->plaintext)) { return $output; } else { if ($this->mode != SCREEN_MODE_JS) { $flickerfreeData = ['itemids' => $this->itemids, 'action' => $this->action == HISTORY_BATCH_GRAPH ? HISTORY_GRAPH : $this->action, 'filter' => $this->filter, 'filterTask' => $this->filterTask, 'markColor' => $this->markColor]; return $this->getOutput($output, true, $flickerfreeData); } } }
function prepareSubfilterOutput($data, $subfilter, $subfilterName) { order_result($data, 'name'); $output = array(); foreach ($data as $id => $element) { $element['name'] = nbsp(CHtml::encode($element['name'])); // is activated if (str_in_array($id, $subfilter)) { $span = new CSpan($element['name'] . SPACE . '(' . $element['count'] . ')', 'subfilter_enabled'); $span->onClick(CHtml::encode('javascript: create_var("zbx_filter", "subfilter_set", "1", false);' . 'create_var("zbx_filter", ' . CJs::encodeJson($subfilterName . '[' . $id . ']') . ', null, true);')); $output[] = $span; } else { // subfilter has 0 items if ($element['count'] == 0) { $span = new CSpan($element['name'] . SPACE . '(' . $element['count'] . ')', 'subfilter_inactive'); $output[] = $span; } else { // this level has no active subfilters $nspan = $subfilter ? new CSpan(SPACE . '(+' . $element['count'] . ')', 'subfilter_active') : new CSpan(SPACE . '(' . $element['count'] . ')', 'subfilter_active'); $span = new CSpan($element['name'], 'subfilter_disabled'); $span->onClick(CHtml::encode('javascript: create_var("zbx_filter", "subfilter_set", "1", false);' . 'create_var("zbx_filter", ' . CJs::encodeJson($subfilterName . '[' . $id . ']') . ', ' . CJs::encodeJson($id) . ', ' . 'true' . ');')); $output[] = $span; $output[] = $nspan; } } $output[] = ', '; } array_pop($output); return $output; }
$icon = (new CButton(null))->addClass(ZBX_STYLE_BTN_WIDGET_ACTION)->setTitle(_('Action'))->setMenuPopup(CMenuPopupHelper::getRefresh($widgetid, $rate)); $dashboardGrid[$col][$row] = (new CCollapsibleUiWidget($widgetid, (new CDiv())->addClass('preloader')))->setExpanded($expanded)->setHeader($widget['header'], [$icon], true, 'zabbix.php?action=dashboard.widget')->setFooter((new CList())->setId($widgetid . '_footer')); $widgetRefreshParams[$widgetid] = ['frequency' => $rate, 'url' => 'zabbix.php?action=' . $widget['action'], 'counter' => 0, 'darken' => 0, 'params' => ['widgetRefresh' => $widgetid]]; } // sort dashboard grid foreach ($dashboardGrid as $key => $val) { ksort($dashboardGrid[$key]); } $dashboardRow = (new CDiv([(new CDiv($dashboardGrid[0]))->addClass('cell'), (new CDiv($dashboardGrid[1]))->addClass('cell'), (new CDiv($dashboardGrid[2]))->addClass('cell')]))->addClass('row'); $dashboardTable = (new CDiv($dashboardRow))->addClass('table')->addClass('widget-placeholder'); $dashboard->addItem($dashboardTable)->show(); /* * Javascript */ // start refresh process $this->addPostJS('initPMaster("dashboard", ' . CJs::encodeJson($widgetRefreshParams) . ');'); // activating blinking $this->addPostJS('jqBlink.blink();'); ?> <script type="text/javascript"> /** * @see init.js add.popup event */ function addPopupValues(list) { var favourites = {graphid: 1, itemid: 1, screenid: 1, slideshowid: 1, sysmapid: 1}; if (isset(list.object, favourites)) { var favouriteIds = []; for (var i = 0; i < list.values.length; i++) {
/** * Executes a given JSON request and returns the result. Returns false if an error has occurred. * * @param array $params * * @return mixed the output of the script if it has been executed successfully or false otherwise */ protected function request(array $params) { // connect to the server if (!$this->connect()) { return false; } // set timeout stream_set_timeout($this->socket, $this->timeout); // send the command if (fwrite($this->socket, CJs::encodeJson($params)) === false) { $this->error = _s('Cannot send command, check connection with Zabbix server "%1$s".', $this->host); return false; } // read the response $readBytesLimit = $this->totalBytesLimit && $this->totalBytesLimit < $this->readBytesLimit ? $this->totalBytesLimit : $this->readBytesLimit; $response = ''; $now = time(); $i = 0; while (!feof($this->socket)) { $i++; if (time() - $now >= $this->timeout) { $this->error = _s('Connection timeout of %1$s seconds exceeded when connecting to Zabbix server "%2$s".', $this->timeout, $this->host); return false; } elseif ($this->totalBytesLimit && $i * $readBytesLimit >= $this->totalBytesLimit) { $this->error = _s('Size of the response received from Zabbix server "%1$s" exceeds the allowed size of %2$s bytes. This value can be increased in the ZBX_SOCKET_BYTES_LIMIT constant in include/defines.inc.php.', $this->host, $this->totalBytesLimit); return false; } if (($out = fread($this->socket, $readBytesLimit)) !== false) { $response .= $out; } else { $this->error = _s('Cannot read the response, check connection with the Zabbix server "%1$s".', $this->host); return false; } } fclose($this->socket); // check if the response is empty if (!strlen($response)) { $this->error = _s('Empty response received from Zabbix server "%1$s".', $this->host); return false; } $response = CJs::decodeJson($response); if (!$response || !$this->validateResponse($response)) { $this->error = _s('Incorrect response received from Zabbix server "%1$s".', $this->host); return false; } // request executed successfully if ($response['response'] == self::RESPONSE_SUCCESS) { return $response['data']; } else { $this->error = $response['info']; return false; } }
} }); } jQuery.when(jqxhr).done(function() { jQuery('#add_new_dcheck').prop('disabled', false); if (validationErrors.length) { showModalWindow( t(<?php echo CJs::encodeJson(_('Discovery check error')); ?> ), validationErrors.join('\n'), [{text: t(<?php echo CJs::encodeJson(_('Close')); ?> ), click: function() { jQuery(this).dialog('destroy'); }}] ); } else { dCheck.name = jQuery('#type :selected').text(); if (typeof dCheck.ports !== 'undefined' && dCheck.ports != discoveryCheckDefaultPort(dCheck.type)) { dCheck.name += ' (' + dCheck.ports + ')'; } if (dCheck.key_) { dCheck.name += ' "' + dCheck.key_ + '"'; }
/** * Encodes the data as a JSON string with HTML entities escaped. * * @static * * @param array $data * * @return string */ public static function serialize(array $data) { return self::encode(CJs::encodeJson($data)); }
/** * Process screen. * * @return CDiv (screen inside container) */ public function get() { $this->dataId = 'graph_' . $this->screenitem['screenitemid'] . '_' . $this->screenitem['screenid']; $resourceId = isset($this->screenitem['real_resourceid']) ? $this->screenitem['real_resourceid'] : $this->screenitem['resourceid']; $containerId = 'graph_container_' . $this->screenitem['screenitemid'] . '_' . $this->screenitem['screenid']; $graphDims = getGraphDims($resourceId); $graphDims['graphHeight'] = $this->screenitem['height']; $graphDims['width'] = $this->screenitem['width']; $graph = getGraphByGraphId($resourceId); $graphId = $graph['graphid']; $legend = $graph['show_legend']; $graph3d = $graph['show_3d']; if ($this->screenitem['dynamic'] == SCREEN_DYNAMIC_ITEM && $this->hostid) { // get host $hosts = API::Host()->get(['hostids' => $this->hostid, 'output' => ['hostid', 'name']]); $host = reset($hosts); // get graph $graph = API::Graph()->get(['graphids' => $resourceId, 'output' => API_OUTPUT_EXTEND, 'selectHosts' => ['hostid'], 'selectGraphItems' => API_OUTPUT_EXTEND]); $graph = reset($graph); // if items from one host we change them, or set calculated if not exist on that host if (count($graph['hosts']) == 1) { if ($graph['ymax_type'] == GRAPH_YAXIS_TYPE_ITEM_VALUE && $graph['ymax_itemid']) { $newDynamic = getSameGraphItemsForHost([['itemid' => $graph['ymax_itemid']]], $this->hostid, false); $newDynamic = reset($newDynamic); if (isset($newDynamic['itemid']) && $newDynamic['itemid'] > 0) { $graph['ymax_itemid'] = $newDynamic['itemid']; } else { $graph['ymax_type'] = GRAPH_YAXIS_TYPE_CALCULATED; } } if ($graph['ymin_type'] == GRAPH_YAXIS_TYPE_ITEM_VALUE && $graph['ymin_itemid']) { $newDynamic = getSameGraphItemsForHost([['itemid' => $graph['ymin_itemid']]], $this->hostid, false); $newDynamic = reset($newDynamic); if (isset($newDynamic['itemid']) && $newDynamic['itemid'] > 0) { $graph['ymin_itemid'] = $newDynamic['itemid']; } else { $graph['ymin_type'] = GRAPH_YAXIS_TYPE_CALCULATED; } } } // get url $this->screenitem['url'] = $graph['graphtype'] == GRAPH_TYPE_PIE || $graph['graphtype'] == GRAPH_TYPE_EXPLODED ? 'chart7.php' : 'chart3.php'; $this->screenitem['url'] = new CUrl($this->screenitem['url']); foreach ($graph as $name => $value) { if ($name == 'width' || $name == 'height') { continue; } $this->screenitem['url']->setArgument($name, $value); } $newGraphItems = getSameGraphItemsForHost($graph['gitems'], $this->hostid, false); foreach ($newGraphItems as $newGraphItem) { unset($newGraphItem['gitemid'], $newGraphItem['graphid']); foreach ($newGraphItem as $name => $value) { $this->screenitem['url']->setArgument('items[' . $newGraphItem['itemid'] . '][' . $name . ']', $value); } } $this->screenitem['url']->setArgument('name', $host['name'] . NAME_DELIMITER . $graph['name']); $this->screenitem['url'] = $this->screenitem['url']->getUrl(); } // get time control $timeControlData = ['id' => $this->getDataId(), 'containerid' => $containerId, 'objDims' => $graphDims, 'loadSBox' => 0, 'loadImage' => 1, 'periodFixed' => CProfile::get('web.screens.timelinefixed', 1), 'sliderMaximumTimePeriod' => ZBX_MAX_PERIOD]; $isDefault = false; if ($graphDims['graphtype'] == GRAPH_TYPE_PIE || $graphDims['graphtype'] == GRAPH_TYPE_EXPLODED) { if ($this->screenitem['dynamic'] == SCREEN_SIMPLE_ITEM || $this->screenitem['url'] === '') { $this->screenitem['url'] = 'chart6.php?graphid=' . $resourceId . '&screenid=' . $this->screenitem['screenid']; $isDefault = true; } $this->timeline['starttime'] = date(TIMESTAMP_FORMAT, get_min_itemclock_by_graphid($resourceId)); $timeControlData['src'] = $this->screenitem['url'] . '&width=' . $this->screenitem['width'] . '&height=' . $this->screenitem['height'] . '&legend=' . $legend . '&graph3d=' . $graph3d . $this->getProfileUrlParams(); $timeControlData['src'] .= $this->mode == SCREEN_MODE_EDIT ? '&period=3600&stime=' . date(TIMESTAMP_FORMAT, time()) : '&period=' . $this->timeline['period'] . '&stime=' . $this->timeline['stimeNow']; } else { if ($this->screenitem['dynamic'] == SCREEN_SIMPLE_ITEM || $this->screenitem['url'] === '') { $this->screenitem['url'] = 'chart2.php?graphid=' . $resourceId . '&screenid=' . $this->screenitem['screenid']; $isDefault = true; } if ($this->mode != SCREEN_MODE_EDIT && $graphId) { if ($this->mode == SCREEN_MODE_PREVIEW) { $timeControlData['loadSBox'] = 1; } } $timeControlData['src'] = $this->screenitem['url'] . '&width=' . $this->screenitem['width'] . '&height=' . $this->screenitem['height'] . '&legend=' . $legend . $this->getProfileUrlParams(); $timeControlData['src'] .= $this->mode == SCREEN_MODE_EDIT ? '&period=3600&stime=' . date(TIMESTAMP_FORMAT, time()) : '&period=' . $this->timeline['period'] . '&stime=' . $this->timeline['stimeNow']; } // output if ($this->mode == SCREEN_MODE_JS) { return 'timeControl.addObject("' . $this->getDataId() . '", ' . CJs::encodeJson($this->timeline) . ', ' . CJs::encodeJson($timeControlData) . ')'; } else { if ($this->mode == SCREEN_MODE_SLIDESHOW) { insert_js('timeControl.addObject("' . $this->getDataId() . '", ' . CJs::encodeJson($this->timeline) . ', ' . CJs::encodeJson($timeControlData) . ');'); } else { zbx_add_post_js('timeControl.addObject("' . $this->getDataId() . '", ' . CJs::encodeJson($this->timeline) . ', ' . CJs::encodeJson($timeControlData) . ');'); } if ($this->mode == SCREEN_MODE_EDIT || $this->mode == SCREEN_MODE_SLIDESHOW || !$isDefault) { $item = new CDiv(); } elseif ($this->mode == SCREEN_MODE_PREVIEW) { $item = new CLink(null, 'charts.php?graphid=' . $resourceId . '&period=' . $this->timeline['period'] . '&stime=' . $this->timeline['stimeNow']); } $item->setId($containerId); return $this->getOutput($item); } }
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ require_once dirname(__FILE__) . '/include/func.inc.php'; require_once dirname(__FILE__) . '/include/classes/class.chttp_request.php'; $allowed_content = array('application/json-rpc' => 'json-rpc', 'application/json' => 'json-rpc', 'application/jsonrequest' => 'json-rpc'); $http_request = new CHTTP_request(); $content_type = $http_request->header('Content-Type'); $content_type = explode(';', $content_type); $content_type = $content_type[0]; if (!isset($allowed_content[$content_type])) { header('HTTP/1.0 412 Precondition Failed'); exit; } require_once dirname(__FILE__) . '/include/classes/core/Z.php'; header('Content-Type: application/json'); $data = $http_request->body(); try { Z::getInstance()->run(ZBase::EXEC_MODE_API); $jsonRpc = new CJSONrpc($data); echo $jsonRpc->execute(); } catch (Exception $e) { // decode input json request to get request's id $jsonData = CJs::decodeJson($data); $response = array('jsonrpc' => '2.0', 'error' => array('code' => 1, 'message' => $e->getMessage()), 'id' => isset($jsonData['id']) ? $jsonData['id'] : null); echo CJs::encodeJson($response); }
echo MAP_LABEL_TYPE_CUSTOM; ?> '); } jQuery(document).ready(function() { jQuery('#label_format').click(function() { toggleAdvancedLabels(jQuery('#label_format:checked').length != 0); }); var inputs = ['label_type_hostgroup', 'label_type_host', 'label_type_trigger', 'label_type_map', 'label_type_image']; jQuery.each(inputs, function() { jQuery('#' + this).change(toggleCustomLabel); }); toggleAdvancedLabels(jQuery('#label_format:checked').length != 0); // clone button jQuery('#clone').click(function() { jQuery('#sysmapid, #delete, #clone').remove(); jQuery('#update').val(<?php echo CJs::encodeJson(_('Add')); ?> ).attr({id: 'add', name: 'add'}); jQuery('#cancel').addClass('ui-corner-left'); jQuery('#name').focus(); }); }); </script>
}); // Convert macro names to uppercase. $('#tbl_macros').on('blur', 'input.macro', function() { macroToUpperCase(this); }); $('#update').click(function() { var removedCount = $(this).data('removedCount'); if (removedCount) { return confirm(<?php echo CJs::encodeJson(_('Are you sure you want to delete')); ?> + ' ' + removedCount + ' ' + <?php echo CJs::encodeJson(_('macro(s)')); ?> + '?'); } }); $('#tbl_macros').dynamicRows({ template: '#macroRow' }); $('form[name="macrosForm"]').submit(function() { $('input.macro').each(function() { macroToUpperCase(this); }); });
; organizeInterfaces(itemIntefaceTypes[<?php echo CJs::encodeJson($data['initial_item_type']); ?> ]); } else { jQuery('#type').trigger('change'); } }); jQuery('#type') .change(function() { // update the interface select with each item type change var itemIntefaceTypes = <?php echo CJs::encodeJson(itemTypeInterface()); ?> ; organizeInterfaces(itemIntefaceTypes[parseInt(jQuery(this).val())]); }) .trigger('change'); if (jQuery('#visible_delay_flex').length != 0) { displayNewDeleyFlexInterval(); jQuery('#visible_delay_flex').click(function() { displayNewDeleyFlexInterval(); }); } // create jquery buttonset object when authprotocol visible box is switched on
?> "); jQuery(this).dialog("destroy"); } }, {text: <?php echo CJs::encodeJson(_('Cancel')); ?> , click: function(){ jQuery(this).dialog("destroy"); }} ], draggable: true, modal: true, width: (w > 600 ? 600 : 'inherit'), resizable: false, minWidth: 200, minHeight: 100, title: <?php echo CJs::encodeJson(_('Reset confirmation')); ?> , close: function(){ jQuery(this).dialog('destroy'); } }); jQuery('#dialog').dialog('widget').find('button:first').addClass('main'); }); }); </script>
<script type="text/javascript"> jQuery(document).ready(function() { 'use strict'; jQuery('#edit').click(function() { jQuery('#comments') .val(<?php echo CJs::encodeJson($this->data['trigger']['comments']); ?> ) .removeAttr('readonly') .focus(); jQuery('#edit').prop('disabled', true); jQuery('#update').prop('disabled', false); }); }); </script>