mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 15:54:29 +02:00
Added a preview to the gis icons
This commit is contained in:
parent
45640c8c96
commit
7c89c42709
@ -329,43 +329,11 @@ $listIcons = gis_get_array_list_icons();
|
|||||||
$arraySelectIcon = array();
|
$arraySelectIcon = array();
|
||||||
foreach ($listIcons as $index => $value) $arraySelectIcon[$index] = $index;
|
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);
|
$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,
|
$table->data[$row][1] = html_print_select($arraySelectIcon,
|
||||||
"gis_default_icon", $gis_default_icon, "changeIcons();", __('None'),
|
"gis_default_icon", $config["gis_default_icon"], "", __('None'),
|
||||||
'', true) .
|
'', true);
|
||||||
' ' .
|
$table->data[$row][1] .= " " . html_print_button(__("View"), 'gis_icon_preview', false, '', '', 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.";"));
|
|
||||||
|
|
||||||
$row++;
|
$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",
|
|
||||||
"<?php echo $path; ?>" + icon + ".default.png");
|
|
||||||
$("#icon_default").attr("src",
|
|
||||||
"<?php echo $path; ?>" + icon + ".default.png");
|
|
||||||
$("#icon_ok").attr("src",
|
|
||||||
"<?php echo $path; ?>" + icon + ".ok.png");
|
|
||||||
$("#icon_bad").attr("src",
|
|
||||||
"<?php echo $path; ?>" + icon + ".bad.png");
|
|
||||||
$("#icon_warning").attr("src",
|
|
||||||
"<?php echo $path; ?>" + 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", "<?php echo $path; ?>" + icon +
|
|
||||||
}
|
|
||||||
|
|
||||||
// Dialog loaders for the images previews
|
// Dialog loaders for the images previews
|
||||||
|
|
||||||
$("#button-custom_logo_preview").click (function (e) {
|
$("#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 = "<?php echo $config['homeurl']; ?>/images/gis_map/icons/" + icon_prefix;
|
||||||
|
|
||||||
|
if (icon_prefix == "")
|
||||||
|
return;
|
||||||
|
|
||||||
|
$dialog = $("<div></div>");
|
||||||
|
$icon_default = $("<img src=\"" + icon_path + ".default.png\">");
|
||||||
|
$icon_ok = $("<img src=\"" + icon_path + ".ok.png\">");
|
||||||
|
$icon_warning = $("<img src=\"" + icon_path + ".warning.png\">");
|
||||||
|
$icon_bad = $("<img src=\"" + icon_path + ".bad.png\">");
|
||||||
|
|
||||||
|
try {
|
||||||
|
$dialog
|
||||||
|
.hide()
|
||||||
|
.empty()
|
||||||
|
.append($icon_default)
|
||||||
|
.append($icon_ok)
|
||||||
|
.append($icon_warning)
|
||||||
|
.append($icon_bad)
|
||||||
|
.dialog({
|
||||||
|
title: "<?php echo __('Background preview'); ?>",
|
||||||
|
resizable: true,
|
||||||
|
draggable: true,
|
||||||
|
modal: true,
|
||||||
|
overlay: {
|
||||||
|
opacity: 0.5,
|
||||||
|
background: "black"
|
||||||
|
},
|
||||||
|
close: function () {
|
||||||
|
$dialog
|
||||||
|
.empty()
|
||||||
|
.remove();
|
||||||
|
}
|
||||||
|
}).show();
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
// console.log(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user