From c31a288cfd56e5479dfe1964a11104f0817bccc7 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Wed, 1 Apr 2020 17:26:04 +0200 Subject: [PATCH] Minor fix when create a template and add components --- .../include/class/ModuleTemplates.class.php | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/pandora_console/include/class/ModuleTemplates.class.php b/pandora_console/include/class/ModuleTemplates.class.php index 5760f26a89..d066f91607 100644 --- a/pandora_console/include/class/ModuleTemplates.class.php +++ b/pandora_console/include/class/ModuleTemplates.class.php @@ -151,8 +151,8 @@ class ModuleTemplates extends HTML // Capture all parameters before start. $this->id_np = get_parameter('id_np', -1); $this->action = get_parameter('action_button', ''); + // Profile exists. Set the attributes with the info. if ($this->id_np > 0 || empty($this->action)) { - // Profile exists. Set the attributes with the info. $this->setNetworkProfile(); } @@ -907,17 +907,20 @@ class ModuleTemplates extends HTML ], ]; - // Adding components button. - $inputs[] = [ - 'arguments' => [ - 'name' => 'add_components_button', - 'label' => __('Add components'), - 'type' => 'button', - 'attributes' => 'class="sub cog"', - 'script' => 'showAddComponent();', - 'return' => true, - ], - ]; + if ($createNewBlock === false) { + // Adding components button. + $inputs[] = [ + 'arguments' => [ + 'name' => 'add_components_button', + 'label' => __('Add components'), + 'type' => 'button', + 'attributes' => 'class="sub cog"', + 'script' => 'showAddComponent();', + 'return' => true, + ], + ]; + } + // Required for PEN field. ui_require_jquery_file('tag-editor'); ui_require_css_file('jquery.tag-editor'); @@ -1190,7 +1193,8 @@ class ModuleTemplates extends HTML if (!failed) { $(".ui-dialog-content").dialog("close"); $(".info").hide(); - location.reload(); + var id_np = id_np; ?>; + window.location = window.location.href+'&id_np='+id_np; } else { $(this).dialog("close"); }