2013-10-08 Sergio Martin <sergio.martin@artica.es>
* include/functions_alerts.php include/javascript/jquery.pandora.controls.js include/functions_treeview.php operation/tree.php operation/agentes/ver_agente.php godmode/groups/group_list.php godmode/massive/massive_add_alerts.php godmode/massive/massive_delete_modules.php godmode/massive/massive_delete_alerts.php godmode/massive/massive_edit_modules.php godmode/reporting/graph_builder.graph_editor.php: Add sorting in many agents list retrieved by ajax and tree view git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8868 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
719915003c
commit
79d4553472
|
@ -1,3 +1,18 @@
|
|||
2013-10-08 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/functions_alerts.php
|
||||
include/javascript/jquery.pandora.controls.js
|
||||
include/functions_treeview.php
|
||||
operation/tree.php
|
||||
operation/agentes/ver_agente.php
|
||||
godmode/groups/group_list.php
|
||||
godmode/massive/massive_add_alerts.php
|
||||
godmode/massive/massive_delete_modules.php
|
||||
godmode/massive/massive_delete_alerts.php
|
||||
godmode/massive/massive_edit_modules.php
|
||||
godmode/reporting/graph_builder.graph_editor.php: Add sorting
|
||||
in many agents list retrieved by ajax and tree view
|
||||
|
||||
2013-10-07 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/styles/pandora.css: Added a overflow hidden
|
||||
|
|
|
@ -67,6 +67,8 @@ if (is_ajax ()) {
|
|||
$disabled = (int) get_parameter ('disabled', 0);
|
||||
$search = (string) get_parameter ('search', '');
|
||||
$recursion = (int) get_parameter ('recursion', 0);
|
||||
// Is is possible add keys prefix to avoid auto sorting in js object conversion
|
||||
$keys_prefix = (string) get_parameter ('keys_prefix', '');
|
||||
// Ids of agents to be include in the SQL clause as id_agent IN ()
|
||||
$filter_agents_json = (string) get_parameter ('filter_agents_json', '');
|
||||
|
||||
|
@ -87,9 +89,16 @@ if (is_ajax ()) {
|
|||
$filter['string'] = $search;
|
||||
}
|
||||
|
||||
|
||||
$agents = agents_get_group_agents ($id_group, $filter, "none", false, $recursion);
|
||||
|
||||
// Add keys prefix
|
||||
if ($keys_prefix !== "") {
|
||||
foreach($agents as $k => $v) {
|
||||
$agents[$keys_prefix . $k] = $v;
|
||||
unset($agents[$k]);
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode ($agents);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -35,10 +35,20 @@ if (is_ajax ()) {
|
|||
|
||||
if ($get_agents) {
|
||||
$id_group = (int) get_parameter ('id_group');
|
||||
// Is is possible add keys prefix to avoid auto sorting in js object conversion
|
||||
$keys_prefix = (string) get_parameter ('keys_prefix', '');
|
||||
|
||||
$agents_alerts = agents_get_group_agents ($id_group, false, "", false, $recursion);
|
||||
$agents = agents_get_group_agents ($id_group, false, "", false, $recursion);
|
||||
|
||||
echo json_encode ($agents_alerts);
|
||||
// Add keys prefix
|
||||
if ($keys_prefix !== "") {
|
||||
foreach($agents as $k => $v) {
|
||||
$agents[$keys_prefix . $k] = $v;
|
||||
unset($agents[$k]);
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode ($agents);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
|
@ -183,11 +193,16 @@ $(document).ready (function () {
|
|||
{"page" : "godmode/massive/massive_add_alerts",
|
||||
"get_agents" : 1,
|
||||
"id_group" : this.value,
|
||||
"recursion" : $("#checkbox-recursion").is(":checked") ? 1 : 0
|
||||
"recursion" : $("#checkbox-recursion").is(":checked") ? 1 : 0,
|
||||
// Add a key prefix to avoid auto sorting in js object conversion
|
||||
"keys_prefix" : "_"
|
||||
},
|
||||
function (data, status) {
|
||||
options = "";
|
||||
jQuery.each (data, function (id, value) {
|
||||
// Remove keys_prefix from the index
|
||||
id = id.substring(1);
|
||||
|
||||
options += "<option value=\""+id+"\">"+value+"</option>";
|
||||
});
|
||||
$("#id_agents").append (options);
|
||||
|
|
|
@ -36,6 +36,8 @@ if (is_ajax ()) {
|
|||
if ($get_agents) {
|
||||
$id_group = (int) get_parameter ('id_group');
|
||||
$id_alert_template = (int) get_parameter ('id_alert_template');
|
||||
// Is is possible add keys prefix to avoid auto sorting in js object conversion
|
||||
$keys_prefix = (string) get_parameter ('keys_prefix', '');
|
||||
|
||||
if ($recursion) {
|
||||
$groups = groups_get_id_recursive($id_group, true);
|
||||
|
@ -53,7 +55,19 @@ if (is_ajax ()) {
|
|||
}
|
||||
}
|
||||
|
||||
echo json_encode (index_array ($agents_alerts, 'id_agente', 'nombre'));
|
||||
$agents = index_array ($agents_alerts, 'id_agente', 'nombre');
|
||||
|
||||
asort($agents);
|
||||
|
||||
// Add keys prefix
|
||||
if ($keys_prefix !== "") {
|
||||
foreach($agents as $k => $v) {
|
||||
$agents[$keys_prefix . $k] = $v;
|
||||
unset($agents[$k]);
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode ($agents);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
|
@ -252,11 +266,16 @@ $(document).ready (function () {
|
|||
"get_agents" : 1,
|
||||
"id_group" : this.value,
|
||||
"recursion" : $("#checkbox-recursion").is(":checked") ? 1 : 0,
|
||||
"id_alert_template" : $("#id_alert_template").val()
|
||||
"id_alert_template" : $("#id_alert_template").val(),
|
||||
// Add a key prefix to avoid auto sorting in js object conversion
|
||||
"keys_prefix" : "_"
|
||||
},
|
||||
function (data, status) {
|
||||
options = "";
|
||||
jQuery.each (data, function (id, value) {
|
||||
// Remove keys_prefix from the index
|
||||
id = id.substring(1);
|
||||
|
||||
options += "<option value=\""+id+"\">"+value+"</option>";
|
||||
});
|
||||
$("#id_agents").append (options);
|
||||
|
|
|
@ -459,12 +459,16 @@ $(document).ready (function () {
|
|||
{"page" : "operation/agentes/ver_agente",
|
||||
"get_agents_group_json" : 1,
|
||||
"recursion" : $("#checkbox-recursion").attr ("checked") ? 1 : 0,
|
||||
"id_group" : this.value
|
||||
"id_group" : this.value,
|
||||
// Add a key prefix to avoid auto sorting in js object conversion
|
||||
"keys_prefix" : "_"
|
||||
},
|
||||
function (data, status) {
|
||||
$("#id_agents").html('');
|
||||
|
||||
jQuery.each (data, function (id, value) {
|
||||
// Remove keys_prefix from the index
|
||||
id = id.substring(1);
|
||||
|
||||
option = $("<option></option>").attr ("value", value["id_agente"]).html (value["nombre"]);
|
||||
$("#id_agents").append (option);
|
||||
});
|
||||
|
|
|
@ -776,12 +776,17 @@ $(document).ready (function () {
|
|||
{"page" : "operation/agentes/ver_agente",
|
||||
"get_agents_group_json" : 1,
|
||||
"recursion" : $("#checkbox-recursion").attr ("checked") ? 1 : 0,
|
||||
"id_group" : this.value
|
||||
"id_group" : this.value,
|
||||
// Add a key prefix to avoid auto sorting in js object conversion
|
||||
"keys_prefix" : "_"
|
||||
},
|
||||
function (data, status) {
|
||||
$("#id_agents").html('');
|
||||
|
||||
jQuery.each (data, function (id, value) {
|
||||
// Remove keys_prefix from the index
|
||||
id = id.substring(1);
|
||||
|
||||
option = $("<option></option>").attr ("value", value["id_agente"]).html (value["nombre"]);
|
||||
$("#id_agents").append (option);
|
||||
});
|
||||
|
|
|
@ -197,14 +197,20 @@ function filterByGroup(idGroup) {
|
|||
jQuery.post ("ajax.php",
|
||||
{"page" : "godmode/groups/group_list",
|
||||
"get_group_agents" : 1,
|
||||
"id_group" : idGroup
|
||||
"id_group" : idGroup,
|
||||
// Add a key prefix to avoid auto sorting in js object conversion
|
||||
"keys_prefix" : "_"
|
||||
},
|
||||
function (data, status) {
|
||||
i = 0
|
||||
jQuery.each (data, function (id, value) {
|
||||
// Remove keys_prefix from the index
|
||||
id = id.substring(1);
|
||||
|
||||
i++;
|
||||
$("#id_agents").append ($("<option></option>").attr ("value", id).html (value));
|
||||
});
|
||||
|
||||
if (i == 0) {
|
||||
$("#id_agents").append ($("<option></option>").attr ("value", 0).html ('<?php echo __('None');?>'));
|
||||
}
|
||||
|
|
|
@ -1370,6 +1370,7 @@ function alerts_get_agents_with_alert_template ($id_alert_template, $id_group, $
|
|||
$filter['id_alert_template'] = $id_alert_template;
|
||||
$filter['tagente_modulo.disabled'] = '<> 1';
|
||||
$filter['delete_pending'] = '<> 1';
|
||||
|
||||
if (empty ($id_agents)) {
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
|
|
|
@ -693,10 +693,10 @@ function treeview_getData ($type) {
|
|||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
$list = db_get_all_rows_sql("SELECT * FROM tgrupo WHERE nombre IN (" . $stringAvariableGroups . ") $sql_search");
|
||||
$list = db_get_all_rows_sql("SELECT * FROM tgrupo WHERE nombre IN (" . $stringAvariableGroups . ") $sql_search ORDER BY nombre COLLATE utf8_general_ci ASC");
|
||||
break;
|
||||
case "oracle":
|
||||
$list = db_get_all_rows_sql("SELECT * FROM tgrupo WHERE dbms_lob.substr(nombre,4000,1) IN (" . $stringAvariableGroups . ")");
|
||||
$list = db_get_all_rows_sql("SELECT * FROM tgrupo WHERE dbms_lob.substr(nombre,4000,1) IN (" . $stringAvariableGroups . ") ORDER BY nombre COLLATE utf8_general_ci ASC");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -748,7 +748,8 @@ function treeview_getData ($type) {
|
|||
tagente.id_grupo IN ($groups) AND
|
||||
tagente.nombre LIKE '%$search_free%' AND
|
||||
tagente.disabled = 0 AND
|
||||
tagente_modulo.disabled = 0";
|
||||
tagente_modulo.disabled = 0
|
||||
ORDER BY tpolicies.name COLLATE utf8_general_ci ASC";
|
||||
|
||||
$list = db_get_all_rows_sql($sql);
|
||||
|
||||
|
@ -823,7 +824,8 @@ function treeview_getData ($type) {
|
|||
tpolicies.id = tpolicy_modules.id_policy AND
|
||||
tagente.id_grupo IN ($groups) AND
|
||||
tagente.disabled = 0 AND
|
||||
tagente_modulo.disabled = 0");
|
||||
tagente_modulo.disabled = 0
|
||||
ORDER BY tpolicies.name COLLATE utf8_general_ci ASC");
|
||||
|
||||
$element = 0;
|
||||
switch ($select_status) {
|
||||
|
@ -955,7 +957,8 @@ function treeview_getData ($type) {
|
|||
AND tagente.disabled = 0
|
||||
AND ttag_module.id_agente_modulo = tagente_modulo.id_agente_modulo" .
|
||||
$search_sql .
|
||||
$user_tags_sql;
|
||||
$user_tags_sql .
|
||||
"ORDER BY ttag.name COLLATE utf8_general_ci ASC";
|
||||
|
||||
$list = db_get_all_rows_sql($sql);
|
||||
break;
|
||||
|
@ -1301,7 +1304,7 @@ function treeview_getSecondBranchSQL ($fatherType, $id, $id_father) {
|
|||
}
|
||||
|
||||
// This line checks for initializated modules or (non-initialized) asyncronous modules
|
||||
$sql .= ' AND disabled = 0 AND (utimestamp > 0 OR id_tipo_modulo IN (21,22,23))';
|
||||
$sql .= ' AND disabled = 0 AND (utimestamp > 0 OR id_tipo_modulo IN (21,22,23)) ORDER BY nombre COLLATE utf8_general_ci ASC';
|
||||
return $sql;
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -41,12 +41,16 @@
|
|||
"recursion" : config.recursion,
|
||||
"filter_agents_json" : config.filter_agents_json,
|
||||
"disabled" : config.disabled ? 1 : 0,
|
||||
// Add a key prefix to avoid auto sorting in js object conversion
|
||||
"keys_prefix" : "_"
|
||||
};
|
||||
|
||||
jQuery.post ("ajax.php",
|
||||
opts,
|
||||
function (data, status) {
|
||||
jQuery.each (data, function (id, value) {
|
||||
// Remove keys_prefix from the index
|
||||
id = id.substring(1);
|
||||
if (id !== 'keycount'){
|
||||
config.callbackPre ();
|
||||
option = $("<option></option>")
|
||||
|
|
|
@ -46,6 +46,8 @@ if (is_ajax ()) {
|
|||
if ($get_agents_group_json) {
|
||||
$id_group = (int) get_parameter('id_group');
|
||||
$recursion = (int) get_parameter ('recursion', 0);
|
||||
// Is is possible add keys prefix to avoid auto sorting in js object conversion
|
||||
$keys_prefix = (string) get_parameter ('keys_prefix', '');
|
||||
|
||||
if ($id_group > 0) {
|
||||
$groups = array($id_group);
|
||||
|
@ -59,10 +61,18 @@ if (is_ajax ()) {
|
|||
$groups = array_keys($groups_orig);
|
||||
}
|
||||
|
||||
$filter = " WHERE id_grupo IN (". implode(',', $groups) .")";
|
||||
$filter = " WHERE id_grupo IN (". implode(',', $groups) .") ORDER BY nombre ASC";
|
||||
$agents = db_get_all_rows_sql("SELECT id_agente, nombre
|
||||
FROM tagente" . $filter);
|
||||
|
||||
// Add keys prefix
|
||||
if ($keys_prefix !== "") {
|
||||
foreach($agents as $k => $v) {
|
||||
$agents[$keys_prefix . $k] = $v;
|
||||
unset($agents[$k]);
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode($agents);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -123,6 +123,7 @@ if (is_ajax ())
|
|||
$avariableGroups = users_get_groups();
|
||||
$avariableGroupsIds = array_keys($avariableGroups);
|
||||
$sql = treeview_getFirstBranchSQL ($type, $id, $avariableGroupsIds, $statusSel, $search_free);
|
||||
|
||||
if ($sql === false) {
|
||||
$rows = array ();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue