From 23bdefecb862c14376f9ebf2235f5423d600e3c2 Mon Sep 17 00:00:00 2001 From: vgilc Date: Thu, 23 Feb 2012 15:55:51 +0000 Subject: [PATCH] 2012-02-23 Vanessa Gil * include/functions_reporting.php godmode/reporting/graph_template_editor.php godmode/reporting/graph_template_item_editor.php godmode/reporting/graph_template_list.php godmode/reporting/graph_template_wizard.php godmode/reporting/graphs.php: Added multiple delete option to graph list and other visual changes. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5637 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 10 +++ .../reporting/graph_template_editor.php | 22 ++++-- .../reporting/graph_template_item_editor.php | 52 +++++++++----- .../godmode/reporting/graph_template_list.php | 18 +++-- .../reporting/graph_template_wizard.php | 16 +++-- pandora_console/godmode/reporting/graphs.php | 70 +++++++++++++++++-- .../include/functions_reporting.php | 5 +- 7 files changed, 148 insertions(+), 45 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index e3012fd110..fa0fe4704b 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,13 @@ +2012-02-23 Vanessa Gil + + * include/functions_reporting.php + godmode/reporting/graph_template_editor.php + godmode/reporting/graph_template_item_editor.php + godmode/reporting/graph_template_list.php + godmode/reporting/graph_template_wizard.php + godmode/reporting/graphs.php: Added multiple delete option to graph + list and other visual changes. + 2012-02-23 Juan Manuel Ramon * godmode/reporting/reporting_builder.php: Changed location of diff --git a/pandora_console/godmode/reporting/graph_template_editor.php b/pandora_console/godmode/reporting/graph_template_editor.php index c14e4e64a1..c1380de357 100644 --- a/pandora_console/godmode/reporting/graph_template_editor.php +++ b/pandora_console/godmode/reporting/graph_template_editor.php @@ -54,14 +54,22 @@ if ($create){ $id_template = db_process_sql_insert('tgraph_template', $values); } -$buttons['graph_list'] = '' - . html_print_image ("images/god6.png", true, array ("title" => __('Template list'))) - . ''; +$buttons['graph_list'] = array('active' => false, + 'text' => '' . + html_print_image("images/god6.png", true, array ("title" => __('Graph list'))) .''); -$buttons['template_editor'] = '' - . html_print_image ("images/config.png", true, array ("title" => __('Template editor'))) - . ''; - +$buttons['wizard'] = array('active' => false, + 'text' => '' . + html_print_image("images/wand.png", true, array ("title" => __('Wizard'))) .''); + +$buttons['template'] = array('active' => false, + 'text' => '' . + html_print_image("images/paste_plain.png", true, array ("title" => __('Templates'))) .''); + +$buttons['template_editor'] = array('active' => true, + 'text' => '' . + html_print_image("images/config.png", true, array ("title" => __('Item editor'))) .''); + // Header ui_print_page_header (__('Graph template editor'), "", false, "", true, $buttons); diff --git a/pandora_console/godmode/reporting/graph_template_item_editor.php b/pandora_console/godmode/reporting/graph_template_item_editor.php index cba7e00469..e0434d9077 100644 --- a/pandora_console/godmode/reporting/graph_template_item_editor.php +++ b/pandora_console/godmode/reporting/graph_template_item_editor.php @@ -30,10 +30,22 @@ $multiple_delete = (bool)get_parameter('multiple_delete', 0); $change_weight = (bool)get_parameter('change_weight', 0); $create = get_parameter('add',0); -$buttons['template_list'] = '' - . html_print_image ("images/god6.png", true, array ("title" => __('Template list'))) - . ''; +$buttons['graph_list'] = array('active' => false, + 'text' => '' . + html_print_image("images/god6.png", true, array ("title" => __('Graph list'))) .''); + +$buttons['wizard'] = array('active' => false, + 'text' => '' . + html_print_image("images/wand.png", true, array ("title" => __('Wizard'))) .''); + +$buttons['template'] = array('active' => false, + 'text' => '' . + html_print_image("images/paste_plain.png", true, array ("title" => __('Templates'))) .''); +$buttons['template_editor'] = array('active' => true, + 'text' => '' . + html_print_image("images/config.png", true, array ("title" => __('Template editor'))) .''); + // Header ui_print_page_header (__('Graph template editor'), "", false, "", true, $buttons); @@ -124,13 +136,14 @@ if ($id_template) { $sql = "SELECT * FROM tgraph_source_template where id_template=$id_template"; $templates = db_get_all_rows_sql($sql); if ($templates != false) { - $table_aux->width = '90%'; + $table_aux->width = '98%'; $table_aux->size = array(); //$table_aux->size[0] = '40%'; $table_aux->size[1] = '40%'; $table_aux->size[2] = '30%'; - $table_aux->size[3] = '50px'; + $table_aux->size[3] = '20%'; + $table_aux->size[4] = '60px'; //$table_aux->head[0] = __('Agent'); //$table_aux->align[0] = 'center'; @@ -138,8 +151,10 @@ if ($id_template) { $table_aux->align[1] = 'center'; $table_aux->head[2] = __('Weight'); $table_aux->align[2] = 'center'; - $table_aux->head[3] = __('Action') . html_print_checkbox('all_delete', 0, false, true, false, 'check_all_checkboxes();'); + $table_aux->head[3] = __('Exact match'); $table_aux->align[3] = 'center'; + $table_aux->head[4] = __('Action') . html_print_checkbox('all_delete', 0, false, true, false, 'check_all_checkboxes();'); + $table_aux->align[4] = 'center'; $table_aux->data = array(); @@ -157,7 +172,12 @@ if ($id_template) { "". html_print_image('images/up.png', true, array ('title' => __('Increase Weight'))).""; - $data[3] = "" . html_print_image('images/cross.png', true, array('title' => __('Delete'))) . "" . html_print_checkbox_extended ('delete_multiple[]', $template['id_gs_template'], false, false, '', 'class="check_delete"', true); @@ -179,22 +199,18 @@ if ($id_template) { } //Configuration form -$table->width = '90%'; - -$table->size = array(); -//$table->size[0] = '40%'; -$table->size[1] = '40%'; +$table->width = '98%'; $table->data = array(); //$table->data[0][0] = ''.__('Agent').''; //$table->data[1][0] = html_print_input_text('agent', '', '', 30, 255, true); -$table->data[0][1] = ''.__('Module').''; -$table->data[1][1] = html_print_input_text('module', '', '', 30, 255, true); -$table->data[2][0] = ''.__('Weight').''; -$table->data[2][0] .= '    '.html_print_input_text('weight', 2, '', 3, 5, true); -$table->data[2][1] = __('Exact match'); -$table->data[2][1] .= html_print_checkbox('match', 1, 0, true); +$table->data[0][0] = ''.__('Module').''."     "; +$table->data[0][0] .= "    ".html_print_input_text('module', '', '', 30, 255, true); +$table->data[1][0] = ''.__('Weight').''."     "; +$table->data[1][0] .= '    '.html_print_input_text('weight', 2, '', 3, 5, true); +$table->data[2][0] = __('Exact match')."     "; +$table->data[2][0] .= html_print_checkbox('match', 1, 0, true); echo '
'; html_print_table($table); diff --git a/pandora_console/godmode/reporting/graph_template_list.php b/pandora_console/godmode/reporting/graph_template_list.php index 9796ca571b..0c178597e0 100644 --- a/pandora_console/godmode/reporting/graph_template_list.php +++ b/pandora_console/godmode/reporting/graph_template_list.php @@ -27,13 +27,17 @@ if (! check_acl ($config['id_user'], 0, "IW")) { return; } -$buttons['graph_list'] = '' - . html_print_image ("images/god6.png", true, array ("title" => __('Graph list'))) - . ''; +$buttons['graph_list'] = array('active' => false, + 'text' => '' . + html_print_image("images/god6.png", true, array ("title" => __('Graph list'))) .''); -$buttons['wizard'] = '' - . html_print_image ("images/wand.png", true, array ("title" => __('Wizard'))) - . ''; +$buttons['wizard'] = array('active' => false, + 'text' => '' . + html_print_image("images/wand.png", true, array ("title" => __('Wizard'))) .''); + +$buttons['template'] = array('active' => true, + 'text' => '' . + html_print_image("images/paste_plain.png", true, array ("title" => __('Templates'))) .''); // Header ui_print_page_header (__('Graph template management'), "", false, "", true, $buttons); @@ -105,7 +109,7 @@ if (! empty ($templates)) { if (check_acl ($config['id_user'], 0, "AW")) { $table->align[4] = 'center'; $table->head[4] = __('Action'). html_print_checkbox('all_delete', 0, false, true, false, 'check_all_checkboxes();'); - $table->size[4] = '50px'; + $table->size[4] = '60px'; } $table->data = array (); diff --git a/pandora_console/godmode/reporting/graph_template_wizard.php b/pandora_console/godmode/reporting/graph_template_wizard.php index 003eeb0a45..ff6f92710d 100644 --- a/pandora_console/godmode/reporting/graph_template_wizard.php +++ b/pandora_console/godmode/reporting/graph_template_wizard.php @@ -64,10 +64,18 @@ echo ''; -$buttons['template_list'] = '' - . html_print_image ("images/god6.png", true, array ("title" => __('Template list'))) - . ''; - +$buttons['graph_list'] = array('active' => false, + 'text' => '' . + html_print_image("images/god6.png", true, array ("title" => __('Graph list'))) .''); + +$buttons['wizard'] = array('active' => true, + 'text' => '' . + html_print_image("images/wand.png", true, array ("title" => __('Wizard'))) .''); + +$buttons['template'] = array('active' => false, + 'text' => '' . + html_print_image("images/paste_plain.png", true, array ("title" => __('Templates'))) .''); + // Header ui_print_page_header (__('Wizard template'), "", false, "", true, $buttons); diff --git a/pandora_console/godmode/reporting/graphs.php b/pandora_console/godmode/reporting/graphs.php index 902052a0b1..09a9fee508 100644 --- a/pandora_console/godmode/reporting/graphs.php +++ b/pandora_console/godmode/reporting/graphs.php @@ -27,13 +27,22 @@ if (! check_acl ($config['id_user'], 0, "IW")) { return; } -$buttons['template'] = '' - . html_print_image ("images/paste_plain.png", true, array ("title" => __('Templates'))) - . ''; - +$buttons['graph_list'] = array('active' => true, + 'text' => '' . + html_print_image("images/god6.png", true, array ("title" => __('Graph list'))) .''); + +$buttons['wizard'] = array('active' => false, + 'text' => '' . + html_print_image("images/wand.png", true, array ("title" => __('Wizard'))) .''); + +$buttons['template'] = array('active' => false, + 'text' => '' . + html_print_image("images/paste_plain.png", true, array ("title" => __('Templates'))) .''); + $delete_graph = (bool) get_parameter ('delete_graph'); $view_graph = (bool) get_parameter ('view_graph'); $id = (int) get_parameter ('id'); +$multiple_delete = (bool)get_parameter('multiple_delete', 0); // Header ui_print_page_header (__('Graphs management'), "", false, "", true, $buttons); @@ -64,6 +73,32 @@ if ($delete_graph) { } } +if ($multiple_delete) { + $ids = (array)get_parameter('delete_multiple', array()); + + db_process_sql_begin(); + + foreach ($ids as $id) { + $result = db_process_sql_delete ('tgraph', + array ('id_graph' => $id)); + + if ($result === false) { + db_process_sql_rollback(); + break; + } + } + + if ($result !== false) { + db_process_sql_commit(); + } + + if ($result !== false) $result = true; + else $result = false; + + ui_print_result_message ($result, + __('Successfully deleted'), + __('Not deleted. Error deleting data')); +} $own_info = get_user_info ($config['id_user']); if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM")) $return_all_group = true; @@ -90,7 +125,7 @@ if (! empty ($graphs)) { $table->size[4] = '50px'; if (check_acl ($config['id_user'], 0, "AW")) { $table->align[5] = 'center'; - $table->head[5] = __('Delete'); + $table->head[5] = __('Delete'). html_print_checkbox('all_delete', 0, false, true, false, 'check_all_checkboxes();'); $table->size[5] = '50px'; } $table->data = array (); @@ -110,20 +145,41 @@ if (! empty ($graphs)) { if (check_acl ($config['id_user'], 0, "AW")) { $data[5] = '' . html_print_image("images/cross.png", true) . ''; + return false;">' . html_print_image("images/cross.png", true) . '' . + html_print_checkbox_extended ('delete_multiple[]', $graph['id_graph'], false, false, '', 'class="check_delete"', true); } array_push ($table->data, $data); } + + echo ""; + html_print_input_hidden('multiple_delete', 1); html_print_table ($table); + echo "
"; + html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"'); + echo "
"; + echo "
"; } else { echo "
".__('There are no defined reportings')."
"; } - + echo '
'; echo '
'; html_print_submit_button (__('Create graph'), 'create', false, 'class="sub next"'); echo "
"; echo "
"; ?> + + diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 250396259f..2aff500b62 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -4731,7 +4731,7 @@ function reporting_apply_report_template_graph ($agents_selected, $template_sele foreach ($source_templates as $source) { $modules = agents_get_modules($id_agent, false, array('disabled' => 0)); $exact_match = $source['exact_match']; - + foreach ($modules as $key => $module) { $insert_module = false; if ($exact_match) { @@ -4739,7 +4739,8 @@ function reporting_apply_report_template_graph ($agents_selected, $template_sele $insert_module = true; } } else { - $result = preg_match('/[.]*'.$source['module'].'[.]*/i', $module); + $exp = '/'.$source['module'].'/i'; + $result = preg_match($exp, $module); if ($result) { $insert_module = true; }