[Rebranding] Docs and Support login icons are configurables

This commit is contained in:
Fermin 2018-05-21 14:29:11 +02:00
parent 3497132517
commit 8f2302630c
7 changed files with 206 additions and 10 deletions

View File

@ -1160,6 +1160,8 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 13);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '720');

View File

@ -86,6 +86,9 @@ if (!empty($config['login_background'])) {
$background_url = "images/backgrounds/" . $config['login_background'];
$login_body_style = "style=\"background-image: url('$background_url');\"";
}
// Get the custom icons
$docs_logo = ui_get_docs_logo();
$support_logo = ui_get_support_logo();
echo '<div id="login_body" ' . $login_body_style . '>';
echo '<div id="header_login">';
echo '<div id="icon_custom_pandora">';
@ -102,15 +105,20 @@ echo '<div id="header_login">';
echo '<img src="images/custom_logo/pandora_logo_head_3.png" alt="pandora_console">';
}
echo '</div>';
echo '<div id="list_icon_docs_support"><ul>';
echo '<li><a href="'.$config['custom_docs_url'].'" target="_blank"><img src="images/icono_docs.png" alt="docs pandora"></a></li>';
echo '<li>' . __('Docs') . '</li>';
if (file_exists (ENTERPRISE_DIR . "/load_enterprise.php")) {
echo '<li id="li_margin_left"><a href="'.$config['custom_support_url'].'" target="_blank"><img src="images/icono_support.png" alt="support pandora"></a></li>';
} else {
echo '<li id="li_margin_left"><a href="https://pandorafms.com/monitoring-services/support/" target="_blank"><img src="images/icono_support.png" alt="support pandora"></a></li>';
echo '<div id="list_icon_docs_support"><ul style="line-height: 36px;">';
if ($docs_logo !== false) {
echo '<li><a href="'.$config['custom_docs_url'].'" target="_blank"><img src="' . $docs_logo . '" alt="docs"></a></li>';
}
echo '<li><a style="color: white; font-size:inherit;" href="'.$config['custom_docs_url'].'" target="_blank">' . __('Docs') . '</li>';
if (file_exists (ENTERPRISE_DIR . "/load_enterprise.php")) {
if ($support_logo !== false) {
echo '<li id="li_margin_left"><a href="'.$config['custom_support_url'].'" target="_blank"><img src="' . $support_logo .'" alt="support"></a></li>';
}
echo '<li><a style="color: white; font-size:inherit;" href="'.$config['custom_support_url'].'" target="_blank">' . __('Support') . '</li>';
} else {
echo '<li id="li_margin_left"><a href="https://pandorafms.com/monitoring-services/support/" target="_blank"><img src="' . $support_logo .'" alt="support"></a></li>';
echo '<li>' . __('Support') . '</li>';
}
echo '<li>' . __('Support') . '</li>';
echo '</ul></div>';

View File

@ -234,6 +234,52 @@ if(enterprise_installed()) {
$row++;
}
if(enterprise_installed()){
// 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',
$config["custom_docs_logo"],
'',
__('None'),
'',
true,
false,
true,
'',
false,
'width:240px'
);
$table_styles->data[$row][1] .= "&nbsp;" . html_print_button(__("View"), 'custom_docs_logo_preview', $open, '', 'class="sub camera"', true,false,$open,'visualmodal');
$row++;
// 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',
$config["custom_support_logo"],
'',
__('None'),
'',
true,
false,
true,
'',
false,
'width:240px'
);
$table_styles->data[$row][1] .= "&nbsp;" . html_print_button(__("View"), 'custom_support_logo_preview', $open, '', 'class="sub camera"', true,false,$open,'visualmodal');
$row++;
}
//login title1
if(enterprise_installed()) {
$table_styles->data[$row][0] = __('Title 1 (login)');
@ -1190,6 +1236,88 @@ $("#button-custom_splash_login_preview").click (function (e) {
}
});
$("#button-custom_docs_logo_preview").click (function (e) {
var icon_name = $("select#custom_docs_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"
},
dialogClass: 'dialog-grayed',
minHeight: 1,
width: $image.width,
close: function () {
$dialog
.empty()
.remove();
}
}).show();
}
catch (err) {
// console.log(err);
}
});
$("#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;
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"
},
dialogClass: 'dialog-grayed',
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();

View File

@ -506,6 +506,10 @@ function config_update_config () {
$error_update[] = __('Custom logo login');
if (!config_update_value ('custom_splash_login', (string) get_parameter ('custom_splash_login')))
$error_update[] = __('Custom splash login');
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 support logo');
if (!config_update_value ('custom_title1_login', (string) get_parameter ('custom_title1_login')))
$error_update[] = __('Custom title1 login');
if (!config_update_value ('custom_title2_login', (string) get_parameter ('custom_title2_login')))
@ -1195,6 +1199,14 @@ function config_process_config () {
if (!isset ($config["custom_splash_login"])) {
config_update_value ('custom_splash_login', 'splash_image_default.png');
}
if (!isset ($config["custom_docs_logo"])) {
config_update_value ('custom_docs_logo', '');
}
if (!isset ($config["custom_support_logo"])) {
config_update_value ('custom_support_logo', '');
}
if (!isset ($config["custom_title1_login"])) {
config_update_value ('custom_title1_login', __('WELCOME TO PANDORA FMS'));

View File

@ -3919,4 +3919,41 @@ function ui_get_snapshot_link($params, $only_params = false) {
// Return the function call to inline js execution
return "winopeng_var('" . implode("', '", $link_parts) . "')";
}
/**
* Get the custom docs logo
*
* @return string with the path to logo. False if it should not be displayed
*
*/
function ui_get_docs_logo () {
global $config;
// Default logo to open version (enterprise_installed function only works in login status)
if (!file_exists (ENTERPRISE_DIR . "/load_enterprise.php")) {
return "images/icono_docs.png";
}
if (empty($config['custom_docs_logo'])) return false;
return 'enterprise/images/custom_general_logos/' . $config['custom_docs_logo'];
}
/**
* Get the custom support logo
*
* @return string with the path to logo. False if it should not be displayed
*
*/
function ui_get_support_logo () {
global $config;
// Default logo to open version (enterprise_installed function only works in login status)
if (!file_exists (ENTERPRISE_DIR . "/load_enterprise.php")) {
return "images/icono_support.png";
}
if (empty($config['custom_support_logo'])) return false;
return 'enterprise/images/custom_general_logos/' . $config['custom_support_logo'];
}
?>

View File

@ -4653,4 +4653,12 @@ form ul.form_flex li ul li{
.pandora_upper {
text-transform: uppercase;
}
.dialog-grayed {
background: #373737 !important;
}
.dialog-grayed .ui-dialog-buttonpane {
background: #373737 !important;
}

View File

@ -113,8 +113,9 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('identification_reminder', 1),
('identification_reminder_timestamp', 0),
('current_package_enterprise', '722'),
('post_process_custom_values', '{"0.00000038580247":"Seconds&#x20;to&#x20;months","0.00000165343915":"Seconds&#x20;to&#x20;weeks","0.00001157407407":"Seconds&#x20;to&#x20;days","0.01666666666667":"Seconds&#x20;to&#x20;minutes","0.00000000093132":"Bytes&#x20;to&#x20;Gigabytes","0.00000095367432":"Bytes&#x20;to&#x20;Megabytes","0.0009765625":"Bytes&#x20;to&#x20;Kilobytes","0.00000001653439":"Timeticks&#x20;to&#x20;weeks","0.00000011574074":"Timeticks&#x20;to&#x20;days"}');
('post_process_custom_values', '{"0.00000038580247":"Seconds&#x20;to&#x20;months","0.00000165343915":"Seconds&#x20;to&#x20;weeks","0.00001157407407":"Seconds&#x20;to&#x20;days","0.01666666666667":"Seconds&#x20;to&#x20;minutes","0.00000000093132":"Bytes&#x20;to&#x20;Gigabytes","0.00000095367432":"Bytes&#x20;to&#x20;Megabytes","0.0009765625":"Bytes&#x20;to&#x20;Kilobytes","0.00000001653439":"Timeticks&#x20;to&#x20;weeks","0.00000011574074":"Timeticks&#x20;to&#x20;days"}'),
('custom_docs_logo', 'default_docs.png'),
('custom_support_logo', 'default_support.png');
UNLOCK TABLES;
--