diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index bca08ce2d9..24202ac477 100644 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -329,43 +329,11 @@ $listIcons = gis_get_array_list_icons(); $arraySelectIcon = array(); foreach ($listIcons as $index => $value) $arraySelectIcon[$index] = $index; -$path = 'images/gis_map/icons/'; //TODO set better method the path - $table->data[$row][0] = __('Default icon in GIS') . ui_print_help_tip(__('Agent icon for GIS Maps. If set to "none", group icon will be used'), true); - -$gis_default_icon = $config["gis_default_icon"]; - -if ($gis_default_icon == '') { - $display_icons = 'none'; - // Hack to show no icon. Use any given image to fix not found image errors - $path_without = "images/spinner.png"; - $path_default = "images/spinner.png"; - $path_ok = "images/spinner.png"; - $path_bad = "images/spinner.png"; - $path_warning = "images/spinner.png"; -} -else { - $display_icons = ''; - $path_without = $path . $gis_default_icon . ".default.png"; - $path_default = $path . $gis_default_icon . ".default.png"; - $path_ok = $path . $gis_default_icon . ".ok.png"; - $path_bad = $path . $gis_default_icon . ".bad.png"; - $path_warning = $path . $gis_default_icon . ".warning.png"; -} - $table->data[$row][1] = html_print_select($arraySelectIcon, - "gis_default_icon", $gis_default_icon, "changeIcons();", __('None'), - '', true) . - ' ' . - html_print_image($path_ok, true, - array("id" => "icon_ok", - "style" => "display:".$display_icons.";")) . ' ' . - html_print_image($path_bad, true, - array("id" => "icon_bad", - "style" => "display:".$display_icons.";")) . ' ' . - html_print_image($path_warning, true, - array("id" => "icon_warning", - "style" => "display:".$display_icons.";")); + "gis_default_icon", $config["gis_default_icon"], "", __('None'), + '', true); +$table->data[$row][1] .= " " . html_print_button(__("View"), 'gis_icon_preview', false, '', '', true); $row++; @@ -680,43 +648,6 @@ $(document).ready (function () { }); }); -function changeIcons() { - icon = $("#gis_default_icon :selected").val(); - - $("#icon_without_status").attr("src", "images/spinner.png"); - $("#icon_default").attr("src", "images/spinner.png"); - $("#icon_ok").attr("src", "images/spinner.png"); - $("#icon_bad").attr("src", "images/spinner.png"); - $("#icon_warning").attr("src", "images/spinner.png"); - - if (icon.length == 0) { - $("#icon_without_status").attr("style", "display:none;"); - $("#icon_default").attr("style", "display:none;"); - $("#icon_ok").attr("style", "display:none;"); - $("#icon_bad").attr("style", "display:none;"); - $("#icon_warning").attr("style", "display:none;"); - } - else { - $("#icon_without_status").attr("src", - "" + icon + ".default.png"); - $("#icon_default").attr("src", - "" + icon + ".default.png"); - $("#icon_ok").attr("src", - "" + icon + ".ok.png"); - $("#icon_bad").attr("src", - "" + icon + ".bad.png"); - $("#icon_warning").attr("src", - "" + icon + ".warning.png"); - $("#icon_without_status").attr("style", ""); - $("#icon_default").attr("style", ""); - $("#icon_ok").attr("style", ""); - $("#icon_bad").attr("style", ""); - $("#icon_warning").attr("style", ""); - } - - //$("#icon_default").attr("src", "" + icon + -} - // Dialog loaders for the images previews $("#button-custom_logo_preview").click (function (e) { @@ -797,4 +728,46 @@ $("#button-login_background_preview").click (function (e) { } }); +$("#button-gis_icon_preview").click (function (e) { + var icon_prefix = $("select#gis_default_icon option:selected").val(); + var icon_path = "/images/gis_map/icons/" + icon_prefix; + + if (icon_prefix == "") + return; + + $dialog = $("
"); + $icon_default = $(""); + $icon_ok = $(""); + $icon_warning = $(""); + $icon_bad = $(""); + + try { + $dialog + .hide() + .empty() + .append($icon_default) + .append($icon_ok) + .append($icon_warning) + .append($icon_bad) + .dialog({ + title: "", + resizable: true, + draggable: true, + modal: true, + overlay: { + opacity: 0.5, + background: "black" + }, + close: function () { + $dialog + .empty() + .remove(); + } + }).show(); + } + catch (err) { + // console.log(err); + } +}); +