Merge remote-tracking branch 'origin/develop' into ent-3924-eHorus-settings

Former-commit-id: fb3ba4cbda0daa688550708e4bc99e6512eea413
This commit is contained in:
Luis Calvo 2019-05-16 18:11:33 +02:00
commit 0cd60d0431
10 changed files with 223 additions and 98 deletions

View File

@ -1062,7 +1062,7 @@ $(document).ready (function () {
$("select[name='module[]']").append($("<option></option>").val(id).html(name));
}
else {
alert('<?php echo __('Repeated'); ?>');
alert("<?php echo __('Repeated'); ?>");
}
$("#module").find("option[value='0']").remove();
}
@ -1078,7 +1078,7 @@ $(document).ready (function () {
$("select[name='module[]']").append($("<option></option>").val(id).html(name));
}
else {
alert('<?php echo __('Repeated'); ?>');
alert("<?php echo __('Repeated'); ?>");
}
$("#module").find("option[value='0']").remove();
}
@ -1094,7 +1094,7 @@ $(document).ready (function () {
$("select[name='module[]']").append($("<option></option>").val(id).html(name));
}
else {
alert('<?php echo __('Repeated'); ?>');
alert("<?php echo __('Repeated'); ?>");
}
$("#module").find("option[value='0']").remove();
}
@ -1110,7 +1110,7 @@ $(document).ready (function () {
$("select[name='module[]']").append($("<option></option>").val(id).html(name));
}
else {
alert('<?php echo __('Repeated'); ?>');
alert("<?php echo __('Repeated'); ?>");
}
$("#module").find("option[value='0']").remove();
}
@ -1126,7 +1126,7 @@ $(document).ready (function () {
$("select[name='module[]']").append($("<option></option>").val(id).html(name));
}
else {
alert('<?php echo __('Repeated'); ?>');
alert("<?php echo __('Repeated'); ?>");
}
$("#module").find("option[value='0']").remove();
}
@ -1151,7 +1151,7 @@ $(document).ready (function () {
|| ($("#module option").length == 1
&& $("#module option").eq(0).val() == 0)) {
alert('<?php echo __('Modules list is empty'); ?>');
alert("<?php echo __('Modules list is empty'); ?>");
return false;
}
$('#module option').map(function() {

View File

@ -571,7 +571,7 @@ $(document).ready (function () {
$("select[name='module[]']").append($("<option></option>").val(id).html(name));
}
else {
alert('<?php echo __('Repeated'); ?>');
alert("<?php echo __('Repeated'); ?>");
}
$("#module").find("option[value='0']").remove();
}
@ -587,7 +587,7 @@ $(document).ready (function () {
$("select[name='module[]']").append($("<option></option>").val(id).html(name));
}
else {
alert('<?php echo __('Repeated'); ?>');
alert("<?php echo __('Repeated'); ?>");
}
$("#module").find("option[value='0']").remove();
}
@ -603,7 +603,7 @@ $(document).ready (function () {
$("select[name='module[]']").append($("<option></option>").val(id).html(name));
}
else {
alert('<?php echo __('Repeated'); ?>');
alert("<?php echo __('Repeated'); ?>");
}
$("#module").find("option[value='0']").remove();
}
@ -619,7 +619,7 @@ $(document).ready (function () {
$("select[name='module[]']").append($("<option></option>").val(id).html(name));
}
else {
alert('<?php echo __('Repeated'); ?>');
alert("<?php echo __('Repeated'); ?>");
}
$("#module").find("option[value='0']").remove();
}
@ -641,7 +641,7 @@ $(document).ready (function () {
$("#submit-create_modules_btn").click(function () {
if($("#module option").length == 0 || ($("#module option").length == 1 && $("#module option").eq(0).val() == 0)) {
alert('<?php echo __('Modules list is empty'); ?>');
alert("<?php echo __('Modules list is empty'); ?>");
return false;
}
$('#module option').map(function() {

View File

@ -1038,7 +1038,7 @@ ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript
}
function show_executing_alert () {
alert('<?php echo __('This elements cannot be modified while the downtime is being executed'); ?>');
alert("<?php echo __('This elements cannot be modified while the downtime is being executed'); ?>");
}
function show_editor_module(id_agent) {
@ -1168,7 +1168,7 @@ ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript
var module_sel = $("#modules", $('#module_editor_' + id_agent)).val();
if (module_sel == 0) {
alert('<?php echo __('Please select a module.'); ?>');
alert("<?php echo __('Please select a module.'); ?>");
}
else {
action_in_progress = true;

View File

@ -357,7 +357,7 @@ function addConnectionMap() {
for (var index in connectionMaps) {
if (isInt(index)) {
if (connectionMaps[index] == idConnectionMap) {
alert('<?php echo __('The connection'); ?> "' + connectionMapName + '" <?php echo __('just added previously.'); ?>');
alert("<?php echo __('The connection'); ?> "' + connectionMapName + '" <?php echo __('just added previously.'); ?>");
return;
}

View File

@ -391,7 +391,7 @@ $(document).ready (function () {
});
if($('#module')[0].childElementCount == 1 && ($('#module')[0].value == "" || $('#module')[0].value == "0")) {
alert('<?php echo __('Please, select a module'); ?>');
alert("<?php echo __('Please, select a module'); ?>");
return false;
}
});

View File

@ -151,100 +151,193 @@ if ($multiple_delete) {
}
$id_group = (int) get_parameter('id_group', 0);
$search = trim(get_parameter('search', ''));
$graphs = custom_graphs_get_user($config['id_user'], false, true, $access);
$offset = (int) get_parameter('offset');
$table_aux = new stdClass();
ui_pagination(count($graphs));
$table_aux->width = '100%';
$table_aux->class = 'databox filters';
$table_aux->cellpadding = 0;
$table_aux->cellspacing = 0;
if (!empty($graphs)) {
$table = new stdClass();
$table->width = '100%';
$table->class = 'info_table';
$table->cellpadding = 0;
$table->cellspacing = 0;
$table->align = [];
$table->head = [];
if ($report_w || $report_m) {
$table->align[5] = 'left';
$table->head[5] = html_print_checkbox('all_delete', 0, false, true, false);
$table->size[5] = '20px';
}
$table_aux->colspan[0][0] = 4;
$table_aux->data[0][0] = '<b>'.__('Group').'</b>';
$table->head[0] = __('Graph name');
$table->head[1] = __('Description');
$table->head[2] = __('Number of Graphs');
$table->head[3] = __('Group');
$table->size[0] = '30%';
$table->size[2] = '200px';
$table->size[3] = '200px';
$table->align[2] = 'left';
$table->align[3] = 'left';
$op_column = false;
if ($report_w || $report_m) {
$op_column = true;
$table->align[4] = 'left';
$table->head[4] = __('Op.');
$table->size[4] = '90px';
}
$table_aux->data[0][1] = html_print_select_groups(false, $access, true, 'id_group', $id_group, '', '', '', true, false, true, '', false, '', false, false, 'id_grupo', $strict_user).'<br>';
$table->data = [];
$table_aux->data[0][2] = '<b>'.__('Free text for search: ').ui_print_help_tip(
__('Search by report name or description, list matches.'),
true
).'</b>';
$table_aux->data[0][3] = html_print_input_text('search', $search, '', 30, '', true);
$result_graphs = array_slice($graphs, $offset, $config['block_size']);
$table_aux->data[0][6] = html_print_submit_button(__('Search'), 'search_submit', false, 'class="sub upd"', true);
foreach ($result_graphs as $graph) {
$data = [];
if ($report_m) {
$data[5] .= html_print_checkbox_extended('delete_multiple[]', $graph['id_graph'], false, false, '', 'class="check_delete" style="margin-left:2px;"', true);
if (is_metaconsole()) {
$filter = "<form class ='' action='index.php?sec=reporting&sec2=godmode/reporting/graphs&id_group=$id_group&pure=$pure'
method='post'>";
$filter .= html_print_table($table_aux, true);
$filter .= '</form>';
ui_toggle($filter, __('Show Option'));
} else {
echo "<form action='index.php?sec=reporting&sec2=godmode/reporting/graphs&id_group=$id_group&pure=$pure'
method='post'>";
html_print_table($table_aux);
echo '</form>';
}
$data[0] = '<a href="index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=1&id='.$graph['id_graph'].'">'.ui_print_truncate_text($graph['name'], 70).'</a>';
$data[1] = ui_print_truncate_text($graph['description'], 70);
$data[2] = $graph['graphs_count'];
$data[3] = ui_print_group_icon($graph['id_group'], true);
$data[4] = '';
$table->cellclass[][4] = 'action_buttons';
if (($report_w || $report_m)) {
$data[4] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/graph_builder&edit_graph=1&id='.$graph['id_graph'].'">'.html_print_image('images/config.png', true).'</a>';
// Show only selected groups.
if ($id_group > 0) {
$group = ["$id_group" => $id_group];
} else {
$group = false;
}
if ($report_m) {
$data[4] .= '<a href="index.php?sec=reporting&sec2=godmode/reporting/graphs&delete_graph=1&id='.$graph['id_graph'].'" onClick="if (!confirm(\''.__('Are you sure?').'\'))
$own_info = get_user_info($config['id_user']);
if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'RM')) {
$return_all_group = true;
} else {
$return_all_group = false;
}
if ($search != '') {
$filter = [
'name' => $search_name,
'order' => 'name',
];
} else {
$filter = ['order' => 'name'];
}
// Fix : group filter was not working
// Show only selected groups.
if ($id_group > 0) {
$group = ["$id_group" => $id_group];
$filter['id_group'] = $id_group;
} else {
$group = false;
}
// Filter normal and metaconsole reports.
if ($config['metaconsole'] == 1 && defined('METACONSOLE')) {
$filter['metaconsole'] = 1;
} else {
$filter['metaconsole'] = 0;
}
/*
$reports = reports_get_reports(
$filter,
[
'name',
'description',
'id_graph',
'id_group',
],
$return_all_group,
$access,
$group,
false
);*/
if ($id_group != null || $search != null) {
$graphs = custom_graphs_search($id_group, $search);
}
ui_pagination(count($graphs));
if (!empty($graphs)) {
$table = new stdClass();
$table->width = '100%';
$table->class = 'info_table';
$table->cellpadding = 0;
$table->cellspacing = 0;
$table->align = [];
$table->head = [];
if ($report_w || $report_m) {
$table->align[5] = 'left';
$table->head[5] = html_print_checkbox('all_delete', 0, false, true, false);
$table->size[5] = '20px';
}
$table->head[0] = __('Graph name');
$table->head[1] = __('Description');
$table->head[2] = __('Number of Graphs');
$table->head[3] = __('Group');
$table->size[0] = '30%';
$table->size[2] = '200px';
$table->size[3] = '200px';
$table->align[2] = 'left';
$table->align[3] = 'left';
$op_column = false;
if ($report_w || $report_m) {
$op_column = true;
$table->align[4] = 'left';
$table->head[4] = __('Op.');
$table->size[4] = '90px';
}
$table->data = [];
$result_graphs = array_slice($graphs, $offset, $config['block_size']);
foreach ($result_graphs as $graph) {
$data = [];
if ($report_m) {
$data[5] .= html_print_checkbox_extended('delete_multiple[]', $graph['id_graph'], false, false, '', 'class="check_delete" style="margin-left:2px;"', true);
}
$data[0] = '<a href="index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=1&id='.$graph['id_graph'].'">'.ui_print_truncate_text($graph['name'], 70).'</a>';
$data[1] = ui_print_truncate_text($graph['description'], 70);
$data[2] = $graph['graphs_count'];
$data[3] = ui_print_group_icon($graph['id_group'], true);
$data[4] = '';
$table->cellclass[][4] = 'action_buttons';
if (($report_w || $report_m)) {
$data[4] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/graph_builder&edit_graph=1&id='.$graph['id_graph'].'">'.html_print_image('images/config.png', true).'</a>';
}
if ($report_m) {
$data[4] .= '<a href="index.php?sec=reporting&sec2=godmode/reporting/graphs&delete_graph=1&id='.$graph['id_graph'].'" onClick="if (!confirm(\''.__('Are you sure?').'\'))
return false;">'.html_print_image('images/cross.png', true, ['alt' => __('Delete'), 'title' => __('Delete')]).'</a>';
}
array_push($table->data, $data);
}
if (!empty($result_graphs)) {
echo "<form method='post' style='' action='index.php?sec=reporting&sec2=godmode/reporting/graphs'>";
html_print_input_hidden('multiple_delete', 1);
html_print_table($table);
ui_pagination(count($graphs), false, 0, 0, false, 'offset', true, 'pagination-bottom');
echo "<div style='float: right;'>";
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
echo '</div>';
echo '</form>';
}
echo "<div style='float: right;'>";
if ($report_w || $report_m) {
echo '<form method="post" style="float:right;" action="index.php?sec=reporting&sec2=godmode/reporting/graph_builder">';
html_print_submit_button(__('Create graph'), 'create', false, 'class="sub next" style="margin-right:5px;"');
echo '</form>';
}
echo '</div>';
} else {
include_once $config['homedir'].'/general/firts_task/custom_graphs.php';
}
array_push($table->data, $data);
}
if (!empty($result_graphs)) {
echo "<form method='post' style='' action='index.php?sec=reporting&sec2=godmode/reporting/graphs'>";
html_print_input_hidden('multiple_delete', 1);
html_print_table($table);
ui_pagination(count($graphs), false, 0, 0, false, 'offset', true, 'pagination-bottom');
echo "<div style='float: right;'>";
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
echo '</div>';
echo '</form>';
}
echo "<div style='float: right;'>";
if ($report_w || $report_m) {
echo '<form method="post" style="float:right;" action="index.php?sec=reporting&sec2=godmode/reporting/graph_builder">';
html_print_submit_button(__('Create graph'), 'create', false, 'class="sub next" style="margin-right:5px;"');
echo '</form>';
}
echo '</div>';
} else {
include_once $config['homedir'].'/general/firts_task/custom_graphs.php';
}
?>
?>
<script type="text/javascript">

View File

@ -4006,7 +4006,7 @@ function addSLARow() {
});
}
else {
alert('<?php echo __('Could not be created'); ?>');
alert("<?php echo __('Could not be created'); ?>");
}
}

View File

@ -1189,13 +1189,13 @@ ui_require_javascript_file('pandora_modules');
}
}
else {
alert('<?php echo __('The plugin command cannot be updated because some modules or components are using the plugin.'); ?>');
alert("<?php echo __('The plugin command cannot be updated because some modules or components are using the plugin.'); ?>");
}
}
}
var macros_click_locked_event = function (event) {
alert('<?php echo __('The plugin macros cannot be updated because some modules or components are using the plugin'); ?>');
alert("<?php echo __('The plugin macros cannot be updated because some modules or components are using the plugin'); ?>");
}
if (locked) {

View File

@ -161,3 +161,35 @@ function custom_graphs_get_user($id_user=0, $only_names=false, $returnAllGroup=t
return $graphs;
}
function custom_graphs_search($id_group, $search)
{
if ($id_group != '' && $search != '') {
$all_graphs = db_get_all_rows_sql('select * from tgraph where id_group = '.$id_group.' AND name LIKE "%'.$search.'%"');
} else if ($id_group != '') {
$all_graphs = db_get_all_rows_sql('select * from tgraph where id_group = '.$id_group.'');
} else {
$all_graphs = db_get_all_rows_sql('select * from tgraph where name LIKE "%'.$search.'%"');
}
if ($all_graphs === false) {
return [];
}
$graphs = [];
foreach ($all_graphs as $graph) {
$graphsCount = db_get_value_sql(
'SELECT COUNT(id_gs)
FROM tgraph_source
WHERE id_graph = '.$graph['id_graph'].''
);
$graphs[$graph['id_graph']]['graphs_count'] = $graphsCount;
$graphs[$graph['id_graph']]['name'] = $graph['name'];
$graphs[$graph['id_graph']]['description'] = $graph['description'];
$graphs[$graph['id_graph']]['id_group'] = $graph['id_group'];
}
return $graphs;
}

View File

@ -226,7 +226,7 @@ unset($table);
url: "ajax.php",
success: function (data) {
if (data.correct == 0) {
alert('<?php echo __('There was error on setup the default map.'); ?>');
alert("<?php echo __('There was error on setup the default map.'); ?>");
}
}
});