/** * Sets the header and adds a default expand-collapse icon. * * @param string|array|CTag $caption * @param string|array|CTag $icons */ public function setHeader($caption = null, $icons = SPACE) { zbx_value2array($icons); $icon = new CIcon(_('Show') . '/' . _('Hide'), $this->open ? 'arrowup' : 'arrowdown', 'changeWidgetState(this, "' . $this->id . '");'); $icon->setAttribute('id', $this->id . '_icon'); array_unshift($icons, $icon); parent::setHeader($caption, $icons); }
public function getMenuIcons() { $icons = array(); if ($this->canRefresh()) { $icon = new CIcon(_('Menu'), 'iconmenu'); $icon->setMenuPopup(CMenuPopupHelper::getRefresh($this->getID(), $this->getSetting('rf_rate', $this->defaultRefreshRate))); $icons[] = $icon; } return $icons; }
public function setHeader($caption = null, $icons = SPACE) { zbx_value2array($icons); if (is_null($caption) && !is_null($icons)) { $caption = SPACE; } $this->_header = new CDiv(null, 'nowrap ui-corner-all ui-widget-header ' . $this->css_class); if (!is_null($this->state)) { $icon = new CIcon(_('Show') . '/' . _('Hide'), $this->state ? 'arrowup' : 'arrowdown', "changeHatStateUI(this,'" . $this->domid . "');"); $icon->setAttribute('id', $this->domid . '_icon'); $this->_header->addItem($icon); } $this->_header->addItem($icons); $this->_header->addItem($caption); return $this->_header; }
public function __construct($url = 'index.php', $side = null) { if (is_null($side)) { $side = 'right'; } if ($side == 'right') { $pside = 'left'; } else { $side = 'left'; $pside = 'right'; } parent::__construct("http://www.zabbix.com/documentation", 'iconhelp'); //'http://www.zabbix.com/manual/v1.1/'.$url); parent::onClick('window.open("http://www.zabbix.com/documentation/");'); $this->attributes['style'] = 'float:' . $side . '; text-decoration: none;'; }
** ** 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. **/ $slideshowWidget = new CWidget('hat_slides'); // create header form $slideHeaderForm = new CForm('get'); $slideHeaderForm->setName('slideHeaderForm'); $configComboBox = new CComboBox('config', 'slides.php', 'javascript: redirect(this.options[this.selectedIndex].value);'); $configComboBox->addItem('screens.php', _('Screens')); $configComboBox->addItem('slides.php', _('Slide shows')); $slideHeaderForm->addItem($configComboBox); if ($this->data['slideshows']) { $favouriteIcon = $this->data['screen'] ? get_icon('favourite', array('fav' => 'web.favorite.screenids', 'elname' => 'slideshowid', 'elid' => $this->data['elementId'])) : new CIcon(_('Favourites'), 'iconplus'); $refreshIcon = new CIcon(_('Menu'), 'iconmenu'); if ($this->data['screen']) { $refreshIcon->setMenuPopup(CMenuPopupHelper::getRefresh(WIDGET_SLIDESHOW, 'x' . $this->data['refreshMultiplier'], true, array('elementid' => $this->data['elementId']))); } $slideshowWidget->addPageHeader(_('SLIDE SHOWS'), array($slideHeaderForm, SPACE, $favouriteIcon, SPACE, $refreshIcon, SPACE, get_icon('fullscreen', array('fullscreen' => $this->data['fullscreen'])))); $slideshowForm = new CForm('get'); $slideshowForm->setName('slideForm'); $slideshowForm->addVar('fullscreen', $this->data['fullscreen']); $slideshowsComboBox = new CComboBox('elementid', $this->data['elementId'], 'submit()'); foreach ($this->data['slideshows'] as $slideshow) { $slideshowsComboBox->addItem($slideshow['slideshowid'], $slideshow['name']); } $slideshowForm->addItem(array(_('Slide show') . SPACE, $slideshowsComboBox)); $slideshowWidget->addHeader($this->data['slideshows'][$this->data['elementId']]['name'], $slideshowForm); if ($this->data['screen']) { if (isset($this->data['isDynamicItems'])) {
private function createHeader() { $header = reset($this->headers); $columnRights = array(); if (!is_null($header['right'])) { foreach ($header['right'] as $right) { $columnRights[] = new CDiv($right, 'floatright'); } } if (!is_null($this->state)) { $icon = new CIcon(_('Show') . '/' . _('Hide'), $this->state ? 'arrowup' : 'arrowdown', "change_hat_state(this, '" . $this->bodyId . "');"); $icon->setAttribute('id', $this->bodyId . '_icon'); $columnRights[] = $icon; } if ($columnRights) { $columnRights = array_reverse($columnRights); } // header table $table = new CTable(null, $this->css_class . ' maxwidth'); $table->setCellSpacing(0); $table->setCellPadding(1); $table->addRow($this->createHeaderRow($header['left'], $columnRights), 'first'); if ($this->css_class != 'header_wide') { $table->addClass('ui-widget-header ui-corner-all'); } foreach ($this->headers as $num => $header) { if ($num > 0) { $table->addRow($this->createHeaderRow($header['left'], $header['right']), 'next'); } } return new CDiv($table); }
$triggerHintTable = array(); } else { $triggerInfo = SPACE; } // if item type is 'Log' we must show log menu if (in_array($item['value_type'], array(ITEM_VALUE_TYPE_LOG, ITEM_VALUE_TYPE_STR, ITEM_VALUE_TYPE_TEXT))) { $triggers = array(); foreach ($item['triggers'] as $trigger) { foreach ($trigger['functions'] as $function) { if (!str_in_array($function['function'], array('regexp', 'iregexp'))) { continue 2; } } $triggers[] = array('id' => $trigger['triggerid'], 'name' => $trigger['description']); } $menuIcon = new CIcon(_('Menu'), 'iconmenu_b'); $menuIcon->setMenuPopup(CMenuPopupHelper::getTriggerLog($item['itemid'], $item['name'], $triggers)); } else { $menuIcon = SPACE; } $checkBox = new CCheckBox('group_itemid[' . $item['itemid'] . ']', null, null, $item['itemid']); $checkBox->setEnabled(empty($item['discoveryRule'])); $itemTable->addRow(array($checkBox, $menuIcon, empty($this->data['filter_hostid']) ? $item['host'] : null, $description, $triggerInfo, CHtml::encode($item['key_']), $item['type'] == ITEM_TYPE_TRAPPER || $item['type'] == ITEM_TYPE_SNMPTRAP ? '' : $item['delay'], $item['history'], in_array($item['value_type'], array(ITEM_VALUE_TYPE_STR, ITEM_VALUE_TYPE_LOG, ITEM_VALUE_TYPE_TEXT)) ? '' : $item['trends'], item_type2str($item['type']), new CCol(CHtml::encode($item['applications_list']), 'wraptext'), $status, $infoIcons)); } // create go buttons $goComboBox = new CComboBox('action'); $goOption = new CComboItem('item.massenable', _('Enable selected')); $goOption->setAttribute('confirm', _('Enable selected items?')); $goComboBox->addItem($goOption); $goOption = new CComboItem('item.massdisable', _('Disable selected')); $goOption->setAttribute('confirm', _('Disable selected items?'));
public function __construct() { parent::__construct('http://www.zabbix.com/documentation', 'iconhelp'); parent::onClick('window.open("http://www.zabbix.com/documentation/");'); }
** ** 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. **/ include 'include/views/js/configuration.sysmaps.js.php'; $sysmapWidget = new CWidget(); $sysmapWidget->addPageHeader(_('CONFIGURATION OF NETWORK MAPS')); // create menu $addIcon = new CIcon(_('Add element'), 'iconplus'); $addIcon->setAttribute('id', 'selementAdd'); $removeIcon = new CIcon(_('Remove element'), 'iconminus'); $removeIcon->setAttribute('id', 'selementRemove'); $addLinkIcon = new CIcon(_('Add link'), 'iconplus'); $addLinkIcon->setAttribute('id', 'linkAdd'); $removeLinkIcon = new CIcon(_('Remove link'), 'iconminus'); $removeLinkIcon->setAttribute('id', 'linkRemove'); $expandMacros = new CSpan($this->data['sysmap']['expand_macros'] == SYSMAP_EXPAND_MACROS_ON ? _('On') : _('Off'), 'whitelink'); $expandMacros->setAttribute('id', 'expand_macros'); $gridShow = new CSpan($this->data['sysmap']['grid_show'] == SYSMAP_GRID_SHOW_ON ? _('Shown') : _('Hidden'), 'whitelink'); $gridShow->setAttribute('id', 'gridshow'); $gridAutoAlign = new CSpan($this->data['sysmap']['grid_align'] == SYSMAP_GRID_ALIGN_ON ? _('On') : _('Off'), 'whitelink'); $gridAutoAlign->setAttribute('id', 'gridautoalign'); $gridSize = new CComboBox('gridsize', $this->data['sysmap']['grid_size']); $gridSize->addItems(array(20 => '20x20', 40 => '40x40', 50 => '50x50', 75 => '75x75', 100 => '100x100')); $gridAlignAll = new CSubmit('gridalignall', _('Align icons')); $gridAlignAll->setAttribute('id', 'gridalignall'); $gridForm = new CDiv(array($gridSize, $gridAlignAll)); $gridForm->setAttribute('id', 'gridalignblock'); $saveButton = new CSubmit('update', _('Update')); $saveButton->setAttribute('id', 'sysmap_update');
if (empty($maps)) { access_deny(); } else { $sysmap = reset($maps); } } echo SBR; // elements $el_add = new CIcon(_('Add element'), 'iconplus'); $el_add->setAttribute('id', 'selementAdd'); $el_rmv = new CIcon(_('Remove element'), 'iconminus'); $el_rmv->setAttribute('id', 'selementRemove'); // connectors $cn_add = new CIcon(_('Add link'), 'iconplus'); $cn_add->setAttribute('id', 'linkAdd'); $cn_rmv = new CIcon(_('Remove link'), 'iconminus'); $cn_rmv->setAttribute('id', 'linkRemove'); $expandMacros = new CSpan($sysmap['expand_macros'] == SYSMAP_EXPAND_MACROS_ON ? _('On') : _('Off'), 'whitelink'); $expandMacros->setAttribute('id', 'expand_macros'); $gridShow = new CSpan($sysmap['grid_show'] == SYSMAP_GRID_SHOW_ON ? _('Shown') : _('Hidden'), 'whitelink'); $gridShow->setAttribute('id', 'gridshow'); $gridAutoAlign = new CSpan($sysmap['grid_align'] == SYSMAP_GRID_ALIGN_ON ? _('On') : _('Off'), 'whitelink'); $gridAutoAlign->setAttribute('id', 'gridautoalign'); $possibleGridSizes = array(20 => '20x20', 40 => '40x40', 50 => '50x50', 75 => '75x75', 100 => '100x100'); $gridSize = new CComboBox('gridsize', $sysmap['grid_size']); $gridSize->addItems($possibleGridSizes); $gridAlignAll = new CSubmit('gridalignall', _('Align icons')); $gridAlignAll->setAttribute('id', 'gridalignall'); $gridForm = new CDiv(array($gridSize, $gridAlignAll)); $gridForm->setAttribute('id', 'gridalignblock'); $saveButton = new CSubmit('save', _('Save'));
require_once dirname(__FILE__) . '/js/general.script.confirm.js.php'; $slideWidget = new CWidget('hat_slides'); // create header form $slideHeaderForm = new CForm('get'); $slideHeaderForm->setName('slideHeaderForm'); $configComboBox = new CComboBox('config', 'slides.php', 'javascript: redirect(this.options[this.selectedIndex].value);'); $configComboBox->addItem('screens.php', _('Screens')); $configComboBox->addItem('slides.php', _('Slide shows')); $slideHeaderForm->addItem($configComboBox); if (empty($this->data['slideshows'])) { $slideWidget->addPageHeader(_('SLIDE SHOWS'), $slideHeaderForm); $slideWidget->addItem(BR()); $slideWidget->addItem(new CTableInfo(_('No slide shows defined.'))); } else { $favouriteIcon = $this->data['screen'] ? get_icon('favourite', array('fav' => 'web.favorite.screenids', 'elname' => 'slideshowid', 'elid' => $this->data['elementid'])) : new CIcon(_('Favourites'), 'iconplus'); $refreshIcon = new CIcon(_('Menu'), 'iconmenu'); if (!empty($this->data['screen'])) { $refreshIcon->addAction('onclick', 'javascript: create_page_menu(event, "hat_slides");'); } $slideWidget->addPageHeader(_('SLIDE SHOWS'), array($slideHeaderForm, SPACE, $favouriteIcon, $refreshIcon, get_icon('fullscreen', array('fullscreen' => $this->data['fullscreen'])))); $slideForm = new CForm('get'); $slideForm->setName('slideForm'); $slideForm->addVar('fullscreen', $this->data['fullscreen']); $elementsComboBox = new CComboBox('elementid', $this->data['elementid'], 'submit()'); foreach ($this->data['slideshows'] as $slideshow) { $elementsComboBox->addItem($slideshow['slideshowid'], get_node_name_by_elid($slideshow['slideshowid'], null, ': ') . $slideshow['name']); } $slideForm->addItem(array(_('Slide show') . SPACE, $elementsComboBox)); $slideWidget->addHeader($this->data['slideshows'][$this->data['elementid']]['name'], $slideForm); if (!empty($this->data['screen'])) { // append groups to form
function get_icon($name, $params = array()) { switch ($name) { case 'favourite': if (infavorites($params['fav'], $params['elid'], $params['elname'])) { $icon = new CIcon(S_REMOVE_FROM . ' ' . S_FAVOURITES, 'iconminus', 'rm4favorites("' . $params['elname'] . '","' . $params['elid'] . '", 0);'); } else { $icon = new CIcon(S_ADD_TO . ' ' . S_FAVOURITES, 'iconplus', 'add2favorites("' . $params['elname'] . '","' . $params['elid'] . '");'); } $icon->setAttribute('id', 'addrm_fav'); break; case 'fullscreen': $url = new Curl(); $url->setArgument('fullscreen', $params['fullscreen'] ? '0' : '1'); $icon = new CIcon($_REQUEST['fullscreen'] ? S_NORMAL . ' ' . S_VIEW : S_FULLSCREEN, 'fullscreen', "document.location = '" . $url->getUrl() . "';"); break; case 'menu': $icon = new CIcon(S_MENU, 'iconmenu', 'create_page_menu(event, "' . $params['menu'] . '");'); break; case 'reset': $icon = new CIcon(S_RESET, 'iconreset', 'timeControl.objectReset("' . $params['id'] . '");'); break; } return $icon; }
$rate = CProfile::get('web.dashboard.widget.' . WIDGET_WEB_OVERVIEW . '.rf_rate', 60); $icon = new CIcon(_('Menu'), 'iconmenu'); $icon->setMenuPopup(CMenuPopupHelper::getRefresh(WIDGET_WEB_OVERVIEW, $rate)); $webMonitoring = new CCollapsibleUiWidget(WIDGET_WEB_OVERVIEW, new CSpan(_('Loading...'), 'textcolorstyles')); $webMonitoring->open = (bool) CProfile::get('web.dashboard.widget.' . WIDGET_WEB_OVERVIEW . '.state', true); $webMonitoring->setHeader(_('Web monitoring'), $icon); $webMonitoring->setFooter(new CDiv(SPACE, 'textwhite', WIDGET_WEB_OVERVIEW . '_footer')); $col = CProfile::get('web.dashboard.widget.' . WIDGET_WEB_OVERVIEW . '.col', 1); $row = CProfile::get('web.dashboard.widget.' . WIDGET_WEB_OVERVIEW . '.row', 4); $dashboardGrid[$col][$row] = $webMonitoring; $widgetRefreshParams[WIDGET_WEB_OVERVIEW] = array('frequency' => $rate, 'url' => '?output=html', 'counter' => 0, 'darken' => 0, 'params' => array('widgetRefresh' => WIDGET_WEB_OVERVIEW)); // discovery rules $dbDiscoveryRules = DBfetch(DBselect('SELECT COUNT(d.druleid) AS cnt' . ' FROM drules d' . ' WHERE d.status=' . DRULE_STATUS_ACTIVE)); if ($dbDiscoveryRules['cnt'] > 0 && check_right_on_discovery()) { $rate = CProfile::get('web.dashboard.widget.' . WIDGET_DISCOVERY_STATUS . '.rf_rate', 60); $icon = new CIcon(_('Menu'), 'iconmenu'); $icon->setMenuPopup(CMenuPopupHelper::getRefresh(WIDGET_DISCOVERY_STATUS, $rate)); $discoveryStatus = new CCollapsibleUiWidget(WIDGET_DISCOVERY_STATUS, new CSpan(_('Loading...'), 'textcolorstyles')); $discoveryStatus->open = (bool) CProfile::get('web.dashboard.widget.' . WIDGET_DISCOVERY_STATUS . '.state', true); $discoveryStatus->setHeader(_('Discovery status'), $icon); $discoveryStatus->setFooter(new CDiv(SPACE, 'textwhite', WIDGET_DISCOVERY_STATUS . '_footer')); $col = CProfile::get('web.dashboard.widget.' . WIDGET_DISCOVERY_STATUS . '.col', 1); $row = CProfile::get('web.dashboard.widget.' . WIDGET_DISCOVERY_STATUS . '.row', 5); $dashboardGrid[$col][$row] = $discoveryStatus; $widgetRefreshParams[WIDGET_DISCOVERY_STATUS] = array('frequency' => $rate, 'url' => '?output=html', 'counter' => 0, 'darken' => 0, 'params' => array('widgetRefresh' => WIDGET_DISCOVERY_STATUS)); } // sort dashboard grid foreach ($dashboardGrid as $key => $val) { ksort($dashboardGrid[$key]); } $dashboardTable = new CTable();
function get_icon($type, $params = array()) { switch ($type) { case 'favourite': if (CFavorite::exists($params['fav'], $params['elid'], $params['elname'])) { $icon = new CIcon(_('Remove from favourites'), 'iconminus', 'rm4favorites("' . $params['elname'] . '", "' . $params['elid'] . '");'); } else { $icon = new CIcon(_('Add to favourites'), 'iconplus', 'add2favorites("' . $params['elname'] . '", "' . $params['elid'] . '");'); } $icon->setAttribute('id', 'addrm_fav'); return $icon; case 'fullscreen': $url = new CUrl(); $url->setArgument('fullscreen', $params['fullscreen'] ? '0' : '1'); return new CIcon($params['fullscreen'] ? _('Normal view') : _('Fullscreen'), 'fullscreen', "document.location = '" . $url->getUrl() . "';"); case 'reset': return new CIcon(_('Reset'), 'iconreset', 'timeControl.objectReset();'); } return null; }
function get_icon($name, $params = array()) { switch ($name) { case 'favourite': if (infavorites($params['fav'], $params['elid'], $params['elname'])) { $icon = new CIcon(_('Remove from favourites'), 'iconminus', 'rm4favorites("' . $params['elname'] . '", "' . $params['elid'] . '", 0);'); } else { $icon = new CIcon(_('Add to favourites'), 'iconplus', 'add2favorites("' . $params['elname'] . '", "' . $params['elid'] . '");'); } $icon->setAttribute('id', 'addrm_fav'); break; case 'fullscreen': $url = new Curl(); $url->setArgument('fullscreen', $params['fullscreen'] ? '0' : '1'); $icon = new CIcon($_REQUEST['fullscreen'] ? _('Normal view') : _('Fullscreen'), 'fullscreen', "document.location = '" . $url->getUrl() . "';"); break; case 'menu': $icon = new CIcon(_('Menu'), 'iconmenu', 'create_page_menu(event, "' . $params['menu'] . '");'); break; case 'reset': $icon = new CIcon(_('Reset'), 'iconreset', 'timeControl.objectReset();'); break; } return $icon; }
private function createHeader() { $header = array_shift($this->headers); $td_l = new CCol(SPACE); $td_l->setAttribute('width', '100%'); $right_row = array($td_l); if (!is_null($header['right'])) { foreach ($header['right'] as $num => $r_item) { $right_row[] = new CCol($r_item); } } if (!is_null($this->state)) { $icon = new CIcon(S_SHOW . '/' . S_HIDE, $this->state ? 'arrowup' : 'arrowdown', "change_hat_state(this,'" . $this->domid . "');"); $icon->setAttribute('id', $this->domid . '_icon'); $right_row[] = new CCol($icon); } $right_tab = new CTable(null, 'nowrap'); $right_tab->setAttribute('width', '100%'); $right_tab->addRow($right_row, 'textblackwhite'); $header['right'] = $right_tab; $header_tab = new CTable(null, $this->css_class); $header_tab->setCellSpacing(0); $header_tab->setCellPadding(1); if (!empty($this->flicker)) { // $header_tab->setAttribute('style','border-bottom: 0px;'); } $header_tab->addRow($this->createHeaderRow($header['left'], $right_tab), 'first'); foreach ($this->headers as $num => $header) { $header_tab->addRow($this->createHeaderRow($header['left'], $header['right']), 'next'); } return $header_tab; }
access_deny(); } else { $sysmap = reset($maps); } } echo SBR; // ELEMENTS $el_add = new CIcon(S_ADD_ELEMENT, 'iconplus'); $el_add->setAttribute('id', 'selement_add'); $el_rmv = new CIcon(S_REMOVE_ELEMENT, 'iconminus'); $el_rmv->setAttribute('id', 'selement_rmv'); //----------------- // CONNECTORS $cn_add = new CIcon(S_ADD_LINK, 'iconplus'); $cn_add->setAttribute('id', 'link_add'); $cn_rmv = new CIcon(S_REMOVE_LINK, 'iconminus'); $cn_rmv->setAttribute('id', 'link_rmv'); //------------------------ // Side Menu $elcn_tab = new CTable(); $elcn_tab->addRow(array(bold('E'), bold('L'))); $elcn_tab->addRow(array($el_add, $cn_add)); $elcn_tab->addRow(array($el_rmv, $cn_rmv)); $td = new CCol($elcn_tab); $td->setAttribute('valign', 'top'); //---- $save_btn = new CButton('save', S_SAVE); $save_btn->setAttribute('id', 'sysmap_save'); $elcn_tab = new CTable(null, 'textwhite'); $menuRow = array(); $gridShow = new CSpan(S_SHOWN, 'whitelink');