From ab7fb7443b3c93b44929ec3a8c97622af3b59fd0 Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Tue, 13 Sep 2011 08:51:05 +0000 Subject: [PATCH] 2011-09-13 Sergio Martin * godmode/modules/manage_network_templates_form.php: Added component name filter to component templates form to bug 3406374 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4945 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 5 ++ .../modules/manage_network_templates_form.php | 57 +++++++++++++------ 2 files changed, 45 insertions(+), 17 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 86b602457a..506b4eea69 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,8 @@ +2011-09-13 Sergio Martin + + * godmode/modules/manage_network_templates_form.php: Added component + name filter to component templates form to bug 3406374 + 2011-09-13 Junichi Satoh * include/functions_api.php: Fixed module name filtering in diff --git a/pandora_console/godmode/modules/manage_network_templates_form.php b/pandora_console/godmode/modules/manage_network_templates_form.php index 433bcc833e..200e885292 100644 --- a/pandora_console/godmode/modules/manage_network_templates_form.php +++ b/pandora_console/godmode/modules/manage_network_templates_form.php @@ -2,7 +2,7 @@ // Pandora FMS - http://pandorafms.com // ================================================== -// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas +// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas // Please see http://pandorafms.org for full contribution list // This program is free software; you can redistribute it and/or @@ -33,6 +33,7 @@ ui_print_page_header (__('Module management')." » ".__('Module template ma $id_np = get_parameter ("id_np", -1); //Network Profile $ncgroup = get_parameter ("ncgroup", -1); //Network component group +$ncfilter = get_parameter ("ncfilter", ''); //Network component group $id_nc = get_parameter ("components", array ()); if (isset ($_GET["delete_module"])) { @@ -199,7 +200,7 @@ if ($id_np > 0) { if (!empty ($table->data)) { echo '
'; html_print_table ($table); - echo '
'; + echo '
'; html_print_submit_button (__('Delete'), "delbutton", false, 'class="sub delete" onClick="if (!confirm(\'Are you sure?\')) return false;"'); echo '
'; } @@ -207,11 +208,25 @@ if ($id_np > 0) { echo "

".__('Add modules')."

"; - //Here should be a form to filter group - + unset($table); + + $table->head = array (); + $table->data = array (); + $table->align = array (); + $table->width = '98%'; + $table->cellpadding = 4; + $table->cellspacing = 4; + $table->class = "databox"; + //The form to submit when adding a list of components - echo '
'; - echo '
'; + + $filter = ''; + $filter .= html_print_input_text ('ncfilter', $ncfilter, '', 50, 255, true); + $filter .= ' '.html_print_submit_button (__('Filter'), 'ncgbutton', false, 'class="sub search"', true); + $filter .= ''; + + $group_filter = '
'; + $group_filter .= '
'; $result = db_get_all_rows_in_table ("tnetwork_component_group","name"); if($result === false) { $result = array(); @@ -232,18 +247,15 @@ if ($id_np > 0) { $groups_compound[$row["id_sg"]] .= $row["name"]; } - html_print_select ($groups_compound, "ncgroup", $ncgroup, 'javascript:this.form.submit();', __('Group')." - ".__('All'), -1, false, false, true, '" style="width:350px'); - echo '
'; + $group_filter .= html_print_select ($groups_compound, "ncgroup", $ncgroup, 'javascript:this.form.submit();', __('Group')." - ".__('All'), -1, true, false, true, '" style="width:350px'); + + $group_filter .= '
'; - echo '
'; - echo '
'; if ($ncgroup > 0) { - $sql = sprintf ("SELECT id_nc, name, id_group FROM tnetwork_component WHERE id_group = %d ORDER BY name", $ncgroup); + $sql = sprintf ("SELECT id_nc, name, id_group FROM tnetwork_component WHERE id_group = %d AND name LIKE '%".$ncfilter."%' ORDER BY name", $ncgroup); } else { - $sql = "SELECT id_nc, name, id_group FROM tnetwork_component ORDER BY name"; + $sql = "SELECT id_nc, name, id_group FROM tnetwork_component WHERE name LIKE '%".$ncfilter."%' ORDER BY name"; } $result = db_get_all_rows_sql ($sql); @@ -255,10 +267,21 @@ if ($id_np > 0) { $components[$row["id_nc"]] = $row["name"]; } - html_print_select ($components, "components[]", $id_nc, '', '', -1, false, true, false, '" style="width:350px'); - echo "  "; + $components_select = ''; + $components_select .= html_print_select ($components, "components[]", $id_nc, '', '', -1, true, true, false, '" style="width:350px'); + + $table->data[0][0] = __('Filter'); + $table->data[0][1] = $filter; + $table->data[1][0] = __('Group'); + $table->data[1][1] = $group_filter; + $table->data[2][0] = __('Components'); + $table->data[2][1] = $components_select; + + html_print_table($table); + + echo '
'; html_print_submit_button (__('Add'), 'crtbutton', false, 'class="sub wand"'); - echo "
"; + echo '
'; } ?>