]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
baculum: Fix #2653 create new resource by copying configuration from other resource
authorMarcin Haba <marcin.haba@bacula.pl>
Thu, 3 Feb 2022 06:15:56 +0000 (07:15 +0100)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:03:27 +0000 (09:03 +0100)
gui/baculum/protected/Web/Portlets/DirectiveRenderer.php

index cf0ddec9c2b18cc4d1dc3232893daa1965763d06..ef625b93c76274d66d69d29790696dccd3718892 100644 (file)
@@ -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('<h3 class="directive_section_header w3-border-bottom" data-section="' . $data['section'] . '" style="display:none;">' . $data['section'] . '</h3>');
+                       }
+               }
+               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);
        }