[Rebranding] Added custom logo to network maps central node
This commit is contained in:
parent
8f2302630c
commit
0e3db1eb80
|
@ -235,11 +235,13 @@ if(enterprise_installed()) {
|
|||
}
|
||||
|
||||
if(enterprise_installed()){
|
||||
// Get all the custom logos
|
||||
$files = list_files('enterprise/images/custom_general_logos', "png", 1, 0);
|
||||
|
||||
// Custom docs icon
|
||||
$table_styles->data[$row][0] = __('Custom documentation logo');
|
||||
$table_styles->data[$row][0] .= ui_print_help_tip(__('You can place your custom logos into the folder enterprise/images/custom_general_logos/'), true);
|
||||
|
||||
$files = list_files('enterprise/images/custom_general_logos', "png", 1, 0);
|
||||
|
||||
$table_styles->data[$row][1] = html_print_select(
|
||||
$files,
|
||||
'custom_docs_logo',
|
||||
|
@ -260,8 +262,6 @@ if(enterprise_installed()){
|
|||
// Custom support icon
|
||||
$table_styles->data[$row][0] = __('Custom support logo');
|
||||
$table_styles->data[$row][0] .= ui_print_help_tip(__('You can place your custom logos into the folder enterprise/images/custom_general_logos/'), true);
|
||||
|
||||
$files = list_files('enterprise/images/custom_general_logos', "png", 1, 0);
|
||||
$table_styles->data[$row][1] = html_print_select(
|
||||
$files,
|
||||
'custom_support_logo',
|
||||
|
@ -278,6 +278,26 @@ if(enterprise_installed()){
|
|||
);
|
||||
$table_styles->data[$row][1] .= " " . html_print_button(__("View"), 'custom_support_logo_preview', $open, '', 'class="sub camera"', true,false,$open,'visualmodal');
|
||||
$row++;
|
||||
|
||||
// Custom center networkmap icon
|
||||
$table_styles->data[$row][0] = __('Custom networkmap center logo');
|
||||
$table_styles->data[$row][0] .= ui_print_help_tip(__('You can place your custom logos into the folder enterprise/images/custom_general_logos/'), true);
|
||||
$table_styles->data[$row][1] = html_print_select(
|
||||
$files,
|
||||
'custom_network_center_logo',
|
||||
$config["custom_network_center_logo"],
|
||||
'',
|
||||
__('Default'),
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
false,
|
||||
'width:240px'
|
||||
);
|
||||
$table_styles->data[$row][1] .= " " . html_print_button(__("View"), 'custom_network_center_logo_preview', $open, '', 'class="sub camera"', true,false,$open,'visualmodal');
|
||||
$row++;
|
||||
}
|
||||
|
||||
//login title1
|
||||
|
@ -1277,7 +1297,6 @@ $("#button-custom_docs_logo_preview").click (function (e) {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
$("#button-custom_support_logo_preview").click (function (e) {
|
||||
var icon_name = $("select#custom_support_logo option:selected").val();
|
||||
var icon_path = "<?php echo $config['homeurl']; ?>enterprise/images/custom_general_logos/" + icon_name;
|
||||
|
@ -1319,6 +1338,46 @@ $("#button-custom_support_logo_preview").click (function (e) {
|
|||
}
|
||||
});
|
||||
|
||||
$("#button-custom_network_center_logo_preview").click (function (e) {
|
||||
var icon_name = $("select#custom_network_center_logo option:selected").val();
|
||||
var icon_path = "<?php echo $config['homeurl']; ?>enterprise/images/custom_general_logos/" + icon_name;
|
||||
|
||||
if (icon_name == "")
|
||||
return;
|
||||
|
||||
$dialog = $("<div></div>");
|
||||
$image = $("<img src=\"" + icon_path + "\">");
|
||||
$image
|
||||
.css('max-width', '500px')
|
||||
.css('max-height', '500px');
|
||||
|
||||
try {
|
||||
$dialog
|
||||
.hide()
|
||||
.html($image)
|
||||
.dialog({
|
||||
title: "<?php echo __('Logo preview'); ?>",
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
overlay: {
|
||||
opacity: 0.5,
|
||||
background: "black"
|
||||
},
|
||||
minHeight: 1,
|
||||
width: $image.width,
|
||||
close: function () {
|
||||
$dialog
|
||||
.empty()
|
||||
.remove();
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
catch (err) {
|
||||
// console.log(err);
|
||||
}
|
||||
});
|
||||
|
||||
$("#button-login_background_preview").click (function (e) {
|
||||
var icon_name = $("select#login_background option:selected").val();
|
||||
var icon_path = "<?php echo $config['homeurl']; ?>/images/backgrounds/" + icon_name;
|
||||
|
|
|
@ -509,6 +509,8 @@ function config_update_config () {
|
|||
if (!config_update_value ('custom_docs_logo', (string) get_parameter ('custom_docs_logo')))
|
||||
$error_update[] = __('Custom documentation logo');
|
||||
if (!config_update_value ('custom_support_logo', (string) get_parameter ('custom_support_logo')))
|
||||
$error_update[] = __('Custom networkmap center logo');
|
||||
if (!config_update_value ('custom_network_center_logo', (string) get_parameter ('custom_network_center_logo')))
|
||||
$error_update[] = __('Custom support logo');
|
||||
if (!config_update_value ('custom_title1_login', (string) get_parameter ('custom_title1_login')))
|
||||
$error_update[] = __('Custom title1 login');
|
||||
|
@ -1207,7 +1209,11 @@ function config_process_config () {
|
|||
if (!isset ($config["custom_support_logo"])) {
|
||||
config_update_value ('custom_support_logo', '');
|
||||
}
|
||||
|
||||
|
||||
if (!isset ($config["custom_network_center_logo"])) {
|
||||
config_update_value ('custom_network_center_logo', '');
|
||||
}
|
||||
|
||||
if (!isset ($config["custom_title1_login"])) {
|
||||
config_update_value ('custom_title1_login', __('WELCOME TO PANDORA FMS'));
|
||||
}
|
||||
|
|
|
@ -29,6 +29,11 @@ require_once($config['homedir'] . "/include/functions_modules.php");
|
|||
require_once($config['homedir'] . "/include/functions_groups.php");
|
||||
ui_require_css_file ('cluetip');
|
||||
|
||||
/**
|
||||
* Definitions
|
||||
*/
|
||||
define('DEFAULT_NETWORKMAP_CENTER_LOGO', 'images/networkmap/bola_pandora_network_maps.png');
|
||||
|
||||
// Check if a node descends from a given node
|
||||
function networkmap_is_descendant ($node, $ascendant, $parents) {
|
||||
if (! isset ($parents[$node])) {
|
||||
|
@ -1327,7 +1332,7 @@ function networkmap_create_pandora_node ($name, $font_size = 10, $simple = 0, $s
|
|||
}
|
||||
$stats_json = base64_encode(json_encode($summary));
|
||||
|
||||
$img_src = "images/networkmap/bola_pandora_network_maps.png";
|
||||
$img_src = networkmap_get_center_logo();
|
||||
if (defined('METACONSOLE')) {
|
||||
|
||||
$url_tooltip = '../../ajax.php?' .
|
||||
|
@ -1346,11 +1351,11 @@ function networkmap_create_pandora_node ($name, $font_size = 10, $simple = 0, $s
|
|||
|
||||
if ($hack_networkmap_mobile) {
|
||||
$img = '<TR><TD>' .
|
||||
"<img src='" . $config['homedir'] . '/' . "images/networkmap/bola_pandora_network_maps.png' />" .
|
||||
"<img src='" . $config['homedir'] . '/' . networkmap_get_center_logo() . "' />" .
|
||||
'</TD></TR>';
|
||||
}
|
||||
else {
|
||||
$image = html_print_image("images/networkmap/bola_pandora_network_maps.png", true, false, false, true);
|
||||
$image = html_print_image(networkmap_get_center_logo(), true, false, false, true);
|
||||
//$image = str_replace('"',"'",$image);
|
||||
$img = '<TR><TD>' . $image . '</TD></TR>';
|
||||
}
|
||||
|
@ -1866,6 +1871,23 @@ function modules_get_all_interfaces($id_agent) {
|
|||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the central networkmap logo
|
||||
*
|
||||
* @return string with the path to logo. If it is not set, return the default.
|
||||
*
|
||||
*/
|
||||
function networkmap_get_center_logo () {
|
||||
global $config;
|
||||
|
||||
html_debug("hola", true);
|
||||
if ((!enterprise_installed()) || empty($config['custom_network_center_logo'])) {
|
||||
return DEFAULT_NETWORKMAP_CENTER_LOGO;
|
||||
}
|
||||
|
||||
return 'enterprise/images/custom_general_logos/' . $config['custom_support_logo'];
|
||||
}
|
||||
|
||||
?>
|
||||
<script language="javascript" type="text/javascript">
|
||||
$(document).ready (function () {
|
||||
|
|
|
@ -3445,7 +3445,9 @@ function draw_elements_graph() {
|
|||
node_temp.append("image")
|
||||
.attr("class", "node_image")
|
||||
.attr("xlink:href", function (d) {
|
||||
return d.image_url;
|
||||
return is_central_node(d)
|
||||
? $("#hidden-center_logo").val()
|
||||
: d.image_url;
|
||||
})
|
||||
.attr("x", function (d) {
|
||||
return d.x - (d.image_width / 2);
|
||||
|
@ -3665,9 +3667,13 @@ function draw_elements_graph() {
|
|||
node.exit().remove();
|
||||
}
|
||||
|
||||
function is_central_node (data) {
|
||||
return (data.type == 0 && data.id_agent == 0);
|
||||
}
|
||||
|
||||
function get_node_name_ov (data) {
|
||||
// Node central name should be the product name
|
||||
return (data.type == 0 && data.id_agent == 0)
|
||||
return (is_central_node(data))
|
||||
? $("#hidden-product_name").val()
|
||||
: data.text;
|
||||
}
|
||||
|
|
|
@ -700,8 +700,9 @@ else {
|
|||
$id = (int) get_parameter('id_networkmap', 0);
|
||||
}
|
||||
|
||||
// Print the product name to handle it in js
|
||||
// Print some params to handle it in js
|
||||
html_print_input_hidden ('product_name', get_product_name());
|
||||
html_print_input_hidden ('center_logo', ui_get_full_url(networkmap_get_center_logo()));
|
||||
|
||||
$dash_mode = 0;
|
||||
$map_dash_details = array();
|
||||
|
|
Loading…
Reference in New Issue