mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
Fixed Custom Graphs deletion TICKETS #3356
This commit is contained in:
parent
dce69d4422
commit
e16f3b85cb
@ -73,13 +73,16 @@ ui_print_page_header (__('Reporting')." » ".__('Custom graphs'), "images/c
|
|||||||
// Delete module SQL code
|
// Delete module SQL code
|
||||||
if ($delete_graph) {
|
if ($delete_graph) {
|
||||||
if (check_acl ($config['id_user'], 0, "RW")) {
|
if (check_acl ($config['id_user'], 0, "RW")) {
|
||||||
$result = db_process_sql_delete("tgraph_source", array('id_graph' =>$id));
|
|
||||||
|
|
||||||
if ($result)
|
|
||||||
$result = ui_print_success_message(__('Successfully deleted'));
|
|
||||||
else
|
|
||||||
$result = ui_print_error_message(__('Not deleted. Error deleting data'));
|
|
||||||
|
|
||||||
|
$exist = db_get_value("id_graph", "tgraph_source", "id_graph", $id);
|
||||||
|
if ($exist) {
|
||||||
|
$result = db_process_sql_delete("tgraph_source", array('id_graph' =>$id));
|
||||||
|
|
||||||
|
if ($result)
|
||||||
|
$result = ui_print_success_message(__('Successfully deleted'));
|
||||||
|
else
|
||||||
|
$result = ui_print_error_message(__('Not deleted. Error deleting data'));
|
||||||
|
}
|
||||||
$result = db_process_sql_delete("tgraph", array('id_graph' =>$id));
|
$result = db_process_sql_delete("tgraph", array('id_graph' =>$id));
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
@ -150,7 +153,9 @@ if (!empty ($graphs)) {
|
|||||||
$table->align[3] = 'left';
|
$table->align[3] = 'left';
|
||||||
if (check_acl ($config['id_user'], 0, "RW")) {
|
if (check_acl ($config['id_user'], 0, "RW")) {
|
||||||
$table->align[4] = 'left';
|
$table->align[4] = 'left';
|
||||||
$table->head[4] = __('Op.');
|
$table->head[4] = __('Op.') .
|
||||||
|
html_print_checkbox('all_delete', 0, false, true, false,
|
||||||
|
'check_all_checkboxes();');
|
||||||
$table->size[4] = '90px';
|
$table->size[4] = '90px';
|
||||||
}
|
}
|
||||||
$table->data = array ();
|
$table->data = array ();
|
||||||
@ -174,36 +179,33 @@ if (!empty ($graphs)) {
|
|||||||
|
|
||||||
$data[4] .= '<a href="index.php?sec=reporting&sec2=godmode/reporting/graphs&delete_graph=1&id='
|
$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?').'\'))
|
.$graph['id_graph'].'" onClick="if (!confirm(\''.__('Are you sure?').'\'))
|
||||||
return false;">' . html_print_image("images/cross.png", true) . '</a>' .
|
return false;">' . html_print_image("images/cross.png", true, array('alt' => __('Delete'), 'title' => __('Delete'))) . '</a>' .
|
||||||
html_print_checkbox_extended ('delete_multiple[]', $graph['id_graph'], false, false, '', 'class="check_delete"', true);
|
html_print_checkbox_extended ('delete_multiple[]', $graph['id_graph'], false, false, '', 'class="check_delete" style="margin-left:2px;"', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
array_push ($table->data, $data);
|
array_push ($table->data, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
html_print_table ($table);
|
|
||||||
|
|
||||||
echo "<table width='100%'>";
|
if (!empty($graphs)){
|
||||||
echo "<tr>";
|
echo "<form method='post' style='' action='index.php?sec=reporting&sec2=godmode/reporting/graphs'>";
|
||||||
echo "<td>";
|
html_print_input_hidden('multiple_delete', 1);
|
||||||
echo "<div style='float: right;'>";
|
html_print_table ($table);
|
||||||
if (!empty($graphs)){
|
echo "<div style='float: right;'>";
|
||||||
if (check_acl ($config['id_user'], 0, "RW") && users_can_manage_group_all($graph['id_group'])) {
|
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
|
||||||
echo "<form method='post' style='float:right;' action='index.php?sec=reporting&sec2=godmode/reporting/graphs'>";
|
echo "</div>";
|
||||||
html_print_input_hidden('multiple_delete', 1);
|
echo "</form>";
|
||||||
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
|
}
|
||||||
echo "</form>";
|
|
||||||
}
|
|
||||||
}
|
echo "<div style='float: right;'>";
|
||||||
if (check_acl ($config['id_user'], 0, "RW")) {
|
if (check_acl ($config['id_user'], 0, "RW")) {
|
||||||
echo '<form method="post" style="float:right;" action="index.php?sec=reporting&sec2=godmode/reporting/graph_builder">';
|
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;"');
|
html_print_submit_button (__('Create graph'), 'create', false, 'class="sub next" style="margin-right:5px;"');
|
||||||
echo "</form>";
|
echo "</form>";
|
||||||
}
|
}
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
echo "</td>";
|
|
||||||
echo "</tr>";
|
|
||||||
echo "</table>";
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
require_once ($config['homedir'] . "/general/firts_task/custom_graphs.php");
|
require_once ($config['homedir'] . "/general/firts_task/custom_graphs.php");
|
||||||
@ -213,13 +215,15 @@ else {
|
|||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
function check_all_checkboxes() {
|
$("input[name=all_delete]").css("margin-left", "32px");
|
||||||
if ($("input[name=all_delete]").attr('checked')) {
|
|
||||||
$(".check_delete").attr('checked', true);
|
function check_all_checkboxes() {
|
||||||
|
if ($("input[name=all_delete]").prop("checked")) {
|
||||||
|
$(".check_delete").prop("checked", true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$(".check_delete").prop("checked", false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
$(".check_delete").attr('checked', false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user