public function __construct($name, $value, $insert_color_picker = true) { parent::__construct([(new CColorCell('lbl_' . $name, $value))->setTitle('#' . $value)->onClick('javascript: show_color_picker("' . zbx_formatDomId($name) . '")'), (new CTextBox($name, $value))->setWidth(ZBX_TEXTAREA_COLOR_WIDTH)->setAttribute('maxlength', 6)->onChange('set_color_by_name("' . zbx_formatDomId($name) . '", this.value)')]); $this->addClass(ZBX_STYLE_INPUT_COLOR_PICKER); if ($insert_color_picker) { insert_show_color_picker_javascript(); } }
public function __construct($name, $value) { parent::__construct(); $lbl = new CColorCell('lbl_' . $name, $value, "show_color_picker('" . $name . "')"); $txt = new CTextBox($name, $value, 7); $txt->setAttribute('maxlength', 6); $txt->setAttribute('id', $name); $txt->addAction('onchange', "set_color_by_name('" . $name . "',this.value)"); $txt->setAttribute('style', 'margin-top: 0px; margin-bottom: 0px'); $this->addItem(array($txt, $lbl)); insert_show_color_picker_javascript(); }
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(); }
$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'); $menuTable = new CTable(null, 'textwhite'); $menuTable->addRow(array(_s('Map "%s"', $this->data['sysmap']['name']), SPACE . SPACE, _('Icon'), SPACE, $addIcon, SPACE, $removeIcon, SPACE . SPACE, _('Link'), SPACE, $addLinkIcon, SPACE, $removeLinkIcon, SPACE . SPACE, _('Expand macros') . ' [ ', $expandMacros, ' ]', SPACE . SPACE, _('Grid') . SPACE . '[', $gridShow, '|', $gridAutoAlign, ']', SPACE, $gridForm, SPACE . '|' . SPACE, $saveButton)); $sysmapWidget->addPageHeader($menuTable); // create map $backgroundImage = new CImg('images/general/tree/zero.gif', 'Sysmap'); $backgroundImage->setAttribute('id', 'sysmap_img', $this->data['sysmap']['width'], $this->data['sysmap']['height']); $backgroundImageTable = new CTable(); $backgroundImageTable->addRow($backgroundImage); $sysmapWidget->addItem($backgroundImageTable); $container = new CDiv(); $container->setAttribute('id', 'sysmap_cnt'); $sysmapWidget->addItem($container); // create elements zbx_add_post_js('ZABBIX.apps.map.run("sysmap_cnt", ' . CJs::encodeJson(array('sysmap' => $this->data['sysmap'], 'iconList' => $this->data['iconList'], 'defaultAutoIconId' => $this->data['defaultAutoIconId'], 'defaultIconId' => $this->data['defaultIconId'], 'defaultIconName' => $this->data['defaultIconName']), true) . ');'); insert_show_color_picker_javascript(); return $sysmapWidget;