Merge remote-tracking branch 'origin/develop' into ent-8558-inventario-pasa-de-enterprise-open

This commit is contained in:
Calvo 2022-12-28 18:32:49 +01:00
commit fc7187ed0c
5 changed files with 81 additions and 25 deletions

View File

@ -404,6 +404,7 @@ if ($id_profile || $new_profile) {
html_print_input_hidden('create_profile', 1);
} else {
html_print_input_hidden('id', $id_profile);
html_print_input_hidden('old_name_profile', $name);
html_print_input_hidden('update_profile', 1);
html_print_submit_button(__('Update'), 'upd', false, 'class="sub upd"');
}
@ -415,15 +416,53 @@ enterprise_hook('close_meta_frame');
?>
<script type="text/javascript" language="javascript">
<script type="text/javascript" language="javascript">
$(document).ready (function () {
var disable_option = '<?php echo $disable_option; ?>';
if (disable_option != '') {
var ids = ['#checkbox-db_management', '#checkbox-user_management', '#checkbox-pandora_management'];
if (disable_option != '') {
var ids = ['#checkbox-db_management', '#checkbox-user_management', '#checkbox-pandora_management'];
ids.forEach(id => {
$(id).css({'cursor':'not-allowed', 'opacity':'0.5'});
});
}
}
//Not enable enter for prevent submits
$(window).keydown(function(event){
if(event.keyCode == 13) {
event.preventDefault();
return false;
}
});
});
$('#text-name').on('blur',function(){
/* Check if the name is already on use for new profiles or check if the
name is already on use for update checking if the name is distinct of the original*/
if($('#hidden-create_profile').val()==1 || ($('#hidden-update_profile').val()==1 && $('#hidden-old_name_profile').val()!=$('#text-name').val())){
$.ajax({
type: "POST",
url: "ajax.php",
dataType: "html",
data: {
page: 'include/ajax/profile',
search_profile_nanme: true,
profile_name: $('#text-name').val().trim(),
},
success: function (data) {
if(data === 'true'){
alert( <?php echo "'".__('Profile name already on use, please, change the name before save')."'"; ?> );
if($('#hidden-old_name_profile').val()){
$('#text-name').val($('#hidden-old_name_profile').val());
}else{
$('#text-name').val("");
}
}
},
error: function (data) {
console.error("Fatal error in AJAX call to interpreter order", data)
}
});
}
});
</script>

View File

@ -0,0 +1,29 @@
<?php
// Pandora FMS- http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
global $config;
require_once $config['homedir'].'/include/functions_profile.php';
// Clean the possible blanks introduced by the included files.
ob_clean();
$search_profile_name = (bool) get_parameter('search_profile_nanme');
if ($search_profile_name) {
$profile_name = (string) get_parameter('profile_name');
echo json_encode(profile_exist($profile_name));
return;
}

View File

@ -693,13 +693,8 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
$cluster = PandoraFMS\Cluster::loadFromAgentId(
$agent['id_agente']
);
$url = 'index.php?sec=reporting&sec2=';
$url .= 'operation/cluster/cluster';
$url = ui_get_full_url(
$url.'&op=update&id='.$cluster->id()
);
$go_to_agent .= '<a target="_blank" href="'.$url.'">';
$go_to_agent .= html_print_submit_button(__('Edit cluster'), 'upd_button', false, 'class="sub config"', true);
$go_to_agent .= '<a target=_blank href="'.$console_url.'index.php?sec=reporting&sec2=operation/cluster/cluster&op=update&id='.$cluster->id().'">';
$go_to_agent .= html_print_submit_button(__('Go to cluster edition'), 'upd_button', false, 'class="sub config"', true);
} else {
$go_to_agent .= '<a target=_blank href="'.$console_url.'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.$ent.'">';
$go_to_agent .= html_print_submit_button(__('Go to agent edition'), 'upd_button', false, 'class="sub config"', true);

View File

@ -695,7 +695,7 @@ class Manager implements PublicLogin
// Check ACl.
if (\is_user_admin($config['id_user']) !== true) {
// User no admin see dashboards of him groups and profile 'AR'.
// Non-admin user can see dashboards of his groups and 'AR' profile.
$group_list = \users_get_groups(
$config['id_user'],
'RR',
@ -802,7 +802,7 @@ class Manager implements PublicLogin
global $config;
if (is_user_admin($config['id_user']) !== false) {
// User no admin see dashboards of him groups and profile 'AR'.
// Non-admin user can see dashboards of his groups and 'AR' profile.
$group_list = \users_get_groups(
$config['id_user'],
'RR',
@ -820,18 +820,11 @@ class Manager implements PublicLogin
$sql_dashboard = sprintf(
"SELECT COUNT(*)
FROM tdashboard
WHERE (id_group IN (%s) AND id_user = '') OR
id_user = '%s'",
$string_groups,
$config['id_user']
WHERE (id_group IN (%s))",
$string_groups
);
} else {
$sql_dashboard = sprintf(
"SELECT COUNT(*)
FROM tdashboard
WHERE id_group = 0 AND id_user = '%s'",
$config['id_user']
);
$sql_dashboard = 'SELECT COUNT(*) FROM tdashboard WHERE id_group = 0';
}
} else {
$sql_dashboard = 'SELECT COUNT(*) FROM tdashboard';

View File

@ -401,7 +401,7 @@ if (!$meta) {
// User only can change skins if has more than one group.
if (function_exists('skins_print_select')) {
if (count($usr_groups) > 1) {
$skin = '<div class="label_select"><p class="edit_user_labels">'.__('Skin').': </p>';
$skin = '<div class="label_select"><p class="edit_user_labels">'.__('Theme').': </p>';
$skin .= skins_print_select($id_usr, 'skin', $user_info['id_skin'], '', __('None'), 0, true).'</div>';
}
}
@ -410,7 +410,7 @@ if (!$meta) {
// User only can change skins if has more than one group.
if (function_exists('skins_print_select')) {
if (count($usr_groups) > 1) {
$skin = '<div class="label_select"><p class="edit_user_labels">'.__('Skin').ui_print_help_tip(
$skin = '<div class="label_select"><p class="edit_user_labels">'.__('Theme').ui_print_help_tip(
__('This change will only apply to nodes'),
true
).'</p>';