From: Marcin Haba Date: Thu, 3 Feb 2022 06:15:56 +0000 (+0100) Subject: baculum: Fix #2653 create new resource by copying configuration from other resource X-Git-Tag: Release-11.0.6~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9706aa197b52e1134b74fae534bf5f9b9dcf8510;p=thirdparty%2Fbacula.git baculum: Fix #2653 create new resource by copying configuration from other resource --- diff --git a/gui/baculum/protected/Web/Portlets/DirectiveRenderer.php b/gui/baculum/protected/Web/Portlets/DirectiveRenderer.php index cf0ddec9c..ef625b93c 100644 --- a/gui/baculum/protected/Web/Portlets/DirectiveRenderer.php +++ b/gui/baculum/protected/Web/Portlets/DirectiveRenderer.php @@ -85,16 +85,22 @@ class DirectiveRenderer extends TItemDataRenderer { public function createItemInternal() { $data = $this->getData(); - if (key_exists('section', $data)) { - $this->addSection($data['section']); - } - $this->createItem($data); $this->setIsDataBound(true); } + public function render($writer) { + $data = $this->getData(); + if (key_exists('section', $data)) { + if ($data['section'] !== self::$current_section) { + self::$current_section = $data['section']; + $writer->write(''); + } + } + parent::render($writer); + } + public function createItem($data) { - $load_values = $this->SourceTemplateControl->getLoadValues(); $field = $this->getField($data['field_type']); $control = Prado::createComponent($field); $type = 'Directive' . $data['field_type']; @@ -143,21 +149,6 @@ class DirectiveRenderer extends TItemDataRenderer { return $control; } - public function addSection($section) { - if ($section !== self::$current_section) { - self::$current_section = $section; - $h3 = new THeader3(); - $h3->setCssClass('directive_section_header w3-border-bottom'); - $h3->setStyle('display: none'); - $h3->setAttribute('data-section', $section); - $text = new TLiteral(); - $text->setText(Prado::localize($section)); - $h3->addParsedObject($text); - $this->addParsedObject($h3); - } - - } - public function getData() { return $this->getViewState(self::DATA); }