2012-02-23 Vanessa Gil <vanessa.gil@artica.es>

* 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
This commit is contained in:
vgilc 2012-02-23 15:55:51 +00:00
parent 7b64da51fe
commit 23bdefecb8
7 changed files with 148 additions and 45 deletions

View File

@ -1,3 +1,13 @@
2012-02-23 Vanessa Gil <vanessa.gil@artica.es>
* 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 <juanmanuel.ramon@artica.es>
* godmode/reporting/reporting_builder.php: Changed location of

View File

@ -54,13 +54,21 @@ if ($create){
$id_template = db_process_sql_insert('tgraph_template', $values);
}
$buttons['graph_list'] = '<a href="index.php?sec=greporting&sec2=godmode/reporting/graph_template_list">'
. html_print_image ("images/god6.png", true, array ("title" => __('Template list')))
. '</a>';
$buttons['graph_list'] = array('active' => false,
'text' => '<a href="index.php?sec=greporting&sec2=godmode/reporting/graphs">' .
html_print_image("images/god6.png", true, array ("title" => __('Graph list'))) .'</a>');
$buttons['template_editor'] = '<a href="index.php?sec=greporting&sec2=godmode/reporting/graph_template_item_editor&id='.$id_template.'">'
. html_print_image ("images/config.png", true, array ("title" => __('Template editor')))
. '</a>';
$buttons['wizard'] = array('active' => false,
'text' => '<a href="index.php?sec=greporting&sec2=godmode/reporting/graph_template_wizard">' .
html_print_image("images/wand.png", true, array ("title" => __('Wizard'))) .'</a>');
$buttons['template'] = array('active' => false,
'text' => '<a href="index.php?sec=greporting&sec2=godmode/reporting/graph_template_list">' .
html_print_image("images/paste_plain.png", true, array ("title" => __('Templates'))) .'</a>');
$buttons['template_editor'] = array('active' => true,
'text' => '<a href="index.php?sec=greporting&sec2=godmode/reporting/graph_template_item_editor&id='.$id_template.'">' .
html_print_image("images/config.png", true, array ("title" => __('Item editor'))) .'</a>');
// Header
ui_print_page_header (__('Graph template editor'), "", false, "", true, $buttons);

View File

@ -30,9 +30,21 @@ $multiple_delete = (bool)get_parameter('multiple_delete', 0);
$change_weight = (bool)get_parameter('change_weight', 0);
$create = get_parameter('add',0);
$buttons['template_list'] = '<a href="index.php?sec=greporting&sec2=godmode/reporting/graph_template_list">'
. html_print_image ("images/god6.png", true, array ("title" => __('Template list')))
. '</a>';
$buttons['graph_list'] = array('active' => false,
'text' => '<a href="index.php?sec=greporting&sec2=godmode/reporting/graphs">' .
html_print_image("images/god6.png", true, array ("title" => __('Graph list'))) .'</a>');
$buttons['wizard'] = array('active' => false,
'text' => '<a href="index.php?sec=greporting&sec2=godmode/reporting/graph_template_wizard">' .
html_print_image("images/wand.png", true, array ("title" => __('Wizard'))) .'</a>');
$buttons['template'] = array('active' => false,
'text' => '<a href="index.php?sec=greporting&sec2=godmode/reporting/graph_template_list">' .
html_print_image("images/paste_plain.png", true, array ("title" => __('Templates'))) .'</a>');
$buttons['template_editor'] = array('active' => true,
'text' => '<a href="index.php?sec=greporting&sec2=godmode/reporting/graph_template_editor&id='.$id_template.'">' .
html_print_image("images/config.png", true, array ("title" => __('Template editor'))) .'</a>');
// 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) {
"<a href='index.php?sec=greporting&sec2=godmode/reporting/graph_template_item_editor&id=".$template['id_template']."&change_weight=1&new_weight=".$inc_weight."&id_gs_template=". $template['id_gs_template']. "'>".
html_print_image('images/up.png', true, array ('title' => __('Increase Weight')))."</a>";
$data[3] = "<a onclick='if(confirm(\"" . __('Are you sure?') . "\")) return true; else return false;'
if ($template['exact_match'])
$data[3] = __('Yes');
else
$data[3] = __('No');
$data[4] = "<a onclick='if(confirm(\"" . __('Are you sure?') . "\")) return true; else return false;'
href='index.php?sec=greporting&sec2=godmode/reporting/graph_template_item_editor&delete=1&id_gs_template=".$template['id_gs_template']."&id_template=".$template['id_template']."&offset=0'>" .
html_print_image('images/cross.png', true, array('title' => __('Delete'))) . "</a>" .
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] = '<b>'.__('Agent').'</b>';
//$table->data[1][0] = html_print_input_text('agent', '', '', 30, 255, true);
$table->data[0][1] = '<b>'.__('Module').'</b>';
$table->data[1][1] = html_print_input_text('module', '', '', 30, 255, true);
$table->data[2][0] = '<b>'.__('Weight').'</b>';
$table->data[2][0] .= '&nbsp;&nbsp;&nbsp;&nbsp;'.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] = '<b>'.__('Module').'</b>'."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
$table->data[0][0] .= "&nbsp;&nbsp;&nbsp;&nbsp;".html_print_input_text('module', '', '', 30, 255, true);
$table->data[1][0] = '<b>'.__('Weight').'</b>'."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
$table->data[1][0] .= '&nbsp;&nbsp;&nbsp;&nbsp;'.html_print_input_text('weight', 2, '', 3, 5, true);
$table->data[2][0] = __('Exact match')."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
$table->data[2][0] .= html_print_checkbox('match', 1, 0, true);
echo '<form method="post" action="index.php?sec=greporting&sec2=godmode/reporting/graph_template_item_editor&add=1&id='.$id_template.'">';
html_print_table($table);

View File

@ -27,13 +27,17 @@ if (! check_acl ($config['id_user'], 0, "IW")) {
return;
}
$buttons['graph_list'] = '<a href="index.php?sec=greporting&sec2=godmode/reporting/graphs">'
. html_print_image ("images/god6.png", true, array ("title" => __('Graph list')))
. '</a>';
$buttons['graph_list'] = array('active' => false,
'text' => '<a href="index.php?sec=greporting&sec2=godmode/reporting/graphs">' .
html_print_image("images/god6.png", true, array ("title" => __('Graph list'))) .'</a>');
$buttons['wizard'] = '<a href="index.php?sec=greporting&sec2=godmode/reporting/graph_template_wizard">'
. html_print_image ("images/wand.png", true, array ("title" => __('Wizard')))
. '</a>';
$buttons['wizard'] = array('active' => false,
'text' => '<a href="index.php?sec=greporting&sec2=godmode/reporting/graph_template_wizard">' .
html_print_image("images/wand.png", true, array ("title" => __('Wizard'))) .'</a>');
$buttons['template'] = array('active' => true,
'text' => '<a href="index.php?sec=greporting&sec2=godmode/reporting/graph_template_list">' .
html_print_image("images/paste_plain.png", true, array ("title" => __('Templates'))) .'</a>');
// 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 ();

View File

@ -64,9 +64,17 @@ echo '<div id="wrong_cleanup" style="display:none">';
ui_print_error_message(__('Cleanup error'));
echo '</div>';
$buttons['template_list'] = '<a href="index.php?sec=greporting&sec2=godmode/reporting/graph_template_list">'
. html_print_image ("images/god6.png", true, array ("title" => __('Template list')))
. '</a>';
$buttons['graph_list'] = array('active' => false,
'text' => '<a href="index.php?sec=greporting&sec2=godmode/reporting/graphs">' .
html_print_image("images/god6.png", true, array ("title" => __('Graph list'))) .'</a>');
$buttons['wizard'] = array('active' => true,
'text' => '<a href="index.php?sec=greporting&sec2=godmode/reporting/graph_template_wizard">' .
html_print_image("images/wand.png", true, array ("title" => __('Wizard'))) .'</a>');
$buttons['template'] = array('active' => false,
'text' => '<a href="index.php?sec=greporting&sec2=godmode/reporting/graph_template_list">' .
html_print_image("images/paste_plain.png", true, array ("title" => __('Templates'))) .'</a>');
// Header
ui_print_page_header (__('Wizard template'), "", false, "", true, $buttons);

View File

@ -27,13 +27,22 @@ if (! check_acl ($config['id_user'], 0, "IW")) {
return;
}
$buttons['template'] = '<a href="index.php?sec=greporting&sec2=godmode/reporting/graph_template_list">'
. html_print_image ("images/paste_plain.png", true, array ("title" => __('Templates')))
. '</a>';
$buttons['graph_list'] = array('active' => true,
'text' => '<a href="index.php?sec=greporting&sec2=godmode/reporting/graphs">' .
html_print_image("images/god6.png", true, array ("title" => __('Graph list'))) .'</a>');
$buttons['wizard'] = array('active' => false,
'text' => '<a href="index.php?sec=greporting&sec2=godmode/reporting/graph_template_wizard">' .
html_print_image("images/wand.png", true, array ("title" => __('Wizard'))) .'</a>');
$buttons['template'] = array('active' => false,
'text' => '<a href="index.php?sec=greporting&sec2=godmode/reporting/graph_template_list">' .
html_print_image("images/paste_plain.png", true, array ("title" => __('Templates'))) .'</a>');
$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,12 +145,20 @@ if (! empty ($graphs)) {
if (check_acl ($config['id_user'], 0, "AW")) {
$data[5] = '<a href="index.php?sec=greporting&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) . '</a>';
return false;">' . html_print_image("images/cross.png", true) . '</a>' .
html_print_checkbox_extended ('delete_multiple[]', $graph['id_graph'], false, false, '', 'class="check_delete"', true);
}
array_push ($table->data, $data);
}
echo "<form method='post' action='index.php?sec=greporting&sec2=godmode/reporting/graphs'>";
html_print_input_hidden('multiple_delete', 1);
html_print_table ($table);
echo "<div style='padding-bottom: 20px; text-align: right; width:" . $table->width . "'>";
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
echo "</div>";
echo "</form>";
}
else {
echo "<div class='nf'>".__('There are no defined reportings')."</div>";
@ -127,3 +170,16 @@ html_print_submit_button (__('Create graph'), 'create', false, 'class="sub next"
echo "</div>";
echo "</form>";
?>
<script type="text/javascript">
function check_all_checkboxes() {
if ($("input[name=all_delete]").attr('checked')) {
$(".check_delete").attr('checked', true);
}
else {
$(".check_delete").attr('checked', false);
}
}
</script>

View File

@ -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;
}