From 8673ea57b17df9bad33433cd6d097282a19643a4 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Wed, 15 Feb 2023 16:28:40 +0100 Subject: [PATCH] Fix issues with view button in setup view --- pandora_console/godmode/setup/setup_visuals.php | 6 +++--- pandora_console/include/functions_html.php | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index 8f7654fa06..7b8943bbf9 100755 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -1946,9 +1946,9 @@ $(".logo_preview").click (function(e) { var homeUrl = ""; var homeUrlEnt = homeUrl + ""; - + var elementToCheck = $('#'+e.target.id).parent().attr('id'); // Fill it seing the target has been clicked - switch (e.target.id) { + switch (elementToCheck) { case 'button-custom_logo_preview': icon_name = $("select#custom_logo option:selected").val(); icon_path = homeUrlEnt + "images/custom_logo/" + icon_name; @@ -1958,7 +1958,7 @@ $(".logo_preview").click (function(e) { icon_name = $("select#custom_logo_collapsed option:selected").val(); icon_path = homeUrlEnt + "images/custom_logo/" + icon_name; options.grayed = true; - break; + break; case 'button-custom_logo_white_bg_preview': icon_name = $("select#custom_logo_white_bg option:selected").val(); icon_path = homeUrlEnt + "images/custom_logo/" + icon_name; diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 1c1671eaf4..735801616c 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -3505,8 +3505,12 @@ function html_print_button($label='OK', $name='', $disabled=false, $script='', $ $iconDiv = ''; } + // Defined id. Is usable for span and button. + // TODO. Check if will be proper use button or submit when where appropiate. + $mainId = ((empty($fixedId) === false) ? $fixedId : 'button-'.$name); + if ($imageButton === false) { - $content = ''.$label.''; + $content = ''.$label.''; $content .= $iconDiv; } else { $content = $iconDiv; @@ -3526,7 +3530,7 @@ function html_print_button($label='OK', $name='', $disabled=false, $script='', $ $parameters = []; $parameters[] = 'class="'.$classes.'"'; $parameters[] = (empty($name) === false) ? ' name="'.$name.'"' : ''; - $parameters[] = 'id="'.((empty($fixedId) === false) ? $fixedId : 'button-'.$name ).'"'; + $parameters[] = 'id="'.$mainId.'"'; $parameters[] = (empty($label) === false) ? ' value="'.$label.'"' : ''; $parameters[] = (empty($script) === false) ? ' onClick="'.$script.'"' : ''; $parameters[] = ($disabled === true) ? ' disabled' : '';