2008-07-09 Sancho LErena <slerena@gmail.com>

* include/functions_html.php, include/functions_db.php,
        operation/agentes/ver_agente.php, operation/reporting/graph_viewer.php
        operation/reporting/custom_reporting.php, 
        godmode/reporting/reporting_builder.php: Some issues with ordered list
        resolved. Some strings are now converted to lowercase to have a real
        ordered (alphabetical) list.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@947 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2008-07-09 16:33:28 +00:00
parent 8373606ae6
commit 8d36a5d045
7 changed files with 32 additions and 22 deletions

View File

@ -1,3 +1,13 @@
2008-07-09 Sancho LErena <slerena@gmail.com>
* include/functions_html.php, include/functions_db.php,
operation/agentes/ver_agente.php, operation/reporting/graph_viewer.php
operation/reporting/custom_reporting.php,
godmode/reporting/reporting_builder.php: Some issues with ordered list
resolved. Some strings are now converted to lowercase to have a real
ordered (alphabetical) list.
2008-07-08 Evi Vanoost <vanooste@rcbi.rochester.edu>
* pandora/console/install.php: Added mysql_error debugging that can be u

View File

@ -193,7 +193,7 @@ if ($id_report) {
$all_agents = get_agents_in_group ($report_id_group);
$agents = array ();
foreach ($all_agents as $agent) {
$agents[$agent['id_agente']] = $agent['nombre'];
$agents[$agent['id_agente']] = strtolower($agent['nombre']);
}
asort ($agents);
@ -396,7 +396,7 @@ if ($edit_sla_report_content) {
$table->data[3][0] = lang_string ('module');
$modules = array ();
if ($id_agent) {
$sql = sprintf ('SELECT * FROM tagente_modulo WHERE id_agente = %d ORDER BY nombre', $id_agent);
$sql = sprintf ('SELECT id_agente_modulo, LOWER(nombre) FROM tagente_modulo WHERE id_agente = %d ORDER BY nombre', $id_agent);
$modules = get_db_all_rows_sql ($sql);
}
$table->data[3][1] = print_select ($modules, 'id_module', 0, '', '--', 0, true);
@ -459,8 +459,8 @@ if ($edit_sla_report_content) {
$data[2] = '--';
$data[3] = '--';
if (get_report_type_data_source ($report_content['type']) == 'module') {
$data[2] = dame_nombre_agente_agentemodulo ($report_content['id_agent_module']);
$data[3] = get_db_value ('descripcion', 'tagente_modulo', 'id_agente_modulo', $report_content['id_agent_module']);
$data[2] = strtolower (dame_nombre_agente_agentemodulo ($report_content['id_agent_module']));
$data[3] = strtolower (get_db_value ('descripcion', 'tagente_modulo', 'id_agente_modulo', $report_content['id_agent_module']));
}
$data[4] = human_time_description ($report_content['period']);
$data[5] = '';
@ -480,7 +480,7 @@ if ($edit_sla_report_content) {
echo "<h2>".lang_string ('reporting')." &gt; ";
echo lang_string ('custom_reporting')."</h2>";
$reports = get_db_all_rows_in_table ('treport');
$reports = get_db_all_rows_in_table ('treport', 'name');
$table->width = '0px';
if (sizeof ($reports)) {
$table->id = 'report_list';
@ -546,12 +546,8 @@ function agent_changed () {
success: function (data) {
$('#id_module').append ($('<option></option>').attr ('value', 0).text ("--"));
jQuery.each (data, function (i, val) {
if (val['descripcion'] == "") {
s = html_entity_decode (val['nombre']);
} else {
s = html_entity_decode (val['descripcion']);
}
$('#id_module').append ($('<option></option>').attr ('value', val['id_agente_modulo']).text (s));
$('#id_module').append ($('<option></option>').attr ('value', val['id_agente_modulo']).text (s.toLowerCase()));
});
$('#id_module').fadeIn ('normal');
}

View File

@ -223,7 +223,7 @@ function get_agents_in_group ($id_group, $disabled = false) {
/* 'All' group must return all agents */
if ($id_group == 1) {
if ($disabled)
return get_db_all_rows_in_table ('tagente');
return get_db_all_rows_in_table ('tagente', 'nombre');
return get_db_all_rows_field_filter ('tagente', 'disabled', 0);
}
if ($disabled)
@ -299,7 +299,7 @@ function get_alerts_in_agent ($id_agent) {
*/
function get_reports ($id_user) {
$user_reports = array ();
$all_reports = get_db_all_rows_in_table ('treport');
$all_reports = get_db_all_rows_in_table ('treport', 'name');
if (sizeof ($all_reports) == 0) {
return $user_reports;
}
@ -1034,7 +1034,7 @@ function list_group2 ($id_user) {
*/
function get_user_groups ($id_user) {
$user_groups = array ();
$groups = get_db_all_rows_in_table ('tgrupo');
$groups = get_db_all_rows_in_table ('tgrupo', 'nombre');
foreach ($groups as $group) {
if (! give_acl ($id_user, $group["id_grupo"], "AR"))
continue;
@ -1383,7 +1383,10 @@ function get_db_all_rows_sql ($sql) {
*
* @return A matrix with all the values in the table
*/
function get_db_all_rows_in_table ($table) {
function get_db_all_rows_in_table ($table, $order_field = "") {
if ($order_field != "")
return get_db_all_rows_sql ('SELECT * FROM ' . $table . " ORDER BY $order_field ");
else
return get_db_all_rows_sql ('SELECT * FROM '.$table);
}
@ -1396,7 +1399,7 @@ function get_db_all_rows_in_table ($table) {
*
* @return A matrix with all the values in the table that matches the condition in the field
*/
function get_db_all_rows_field_filter ($table, $field, $condition) {
function get_db_all_rows_field_filter ($table, $field, $condition, $order_field = "") {
if (is_int ($condition)) {
$sql = sprintf ('SELECT * FROM %s WHERE %s = %d', $table, $field, $condition);
} else if (is_float ($condition) || is_double ($condition)) {
@ -1405,6 +1408,8 @@ function get_db_all_rows_field_filter ($table, $field, $condition) {
$sql = sprintf ('SELECT * FROM %s WHERE %s = "%s"', $table, $field, $condition);
}
if ($order_field != "")
$sql .= " ORDER BY ".$order_field;
return get_db_all_rows_sql ($sql);
}

View File

@ -43,6 +43,7 @@ function print_select ($fields, $name, $selected = '', $script = '', $nothing =
}
if (!empty ($fields)) {
asort ($fields);
foreach ($fields as $value => $label) {
$output .= ' <option value="'. $value .'"';
if ($value == $selected) {

View File

@ -34,7 +34,7 @@ if (defined ('AJAX')) {
if ($get_agent_modules_json) {
$id_agent = (int) get_parameter ('id_agent');
$agent_modules = get_db_all_rows_field_filter ('tagente_modulo', 'id_agente', $id_agent);
$agent_modules = get_db_all_rows_field_filter ('tagente_modulo', 'id_agente', $id_agent, "nombre");
echo json_encode ($agent_modules);
exit ();

View File

@ -27,8 +27,6 @@ if (comprueba_login() != 0) {
exit;
}
//echo "SLA for Tato: %".return_module_SLA (50, 604800, 1, 1);
echo "<h2>".lang_string ('reporting')." &gt; ";
echo lang_string ('custom_reporting')."</h2>";

View File

@ -163,7 +163,7 @@ echo "<h2>" . lang_string ("reporting") . " &gt; ";
echo lang_string ("custom_graph_viewer") . "</h2>";
$color=1;
$sql="SELECT * FROM tgraph";
$sql="SELECT * FROM tgraph ORDER by name";
$res=mysql_query($sql);
if (mysql_num_rows($res)) {
echo "<table width='500' cellpadding=4 cellpadding=4 class='databox_frame'>";