2009-07-28 Miguel de Dios <miguel.dedios@artica.es>
* godmode/alerts/alert_list.php, include/functions_agents.php: changes for to add filter (and html form to set filter) in the list of alerts. * include/styles/pandora.css, include/functions_html.php: minor changes to fix minor bug css and clean the source code. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1822 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
390af80e13
commit
b2daa85ae5
|
@ -1,3 +1,10 @@
|
|||
2009-07-28 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* godmode/alerts/alert_list.php, include/functions_agents.php: changes
|
||||
for to add filter (and html form to set filter) in the list of alerts.
|
||||
* include/styles/pandora.css, include/functions_html.php: minor changes to
|
||||
fix minor bug css and clean the source code.
|
||||
|
||||
2009-07-27 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/functions_visual_map.php: changes for support maps as widget in
|
||||
|
|
|
@ -192,6 +192,68 @@ if ($id_agente) {
|
|||
$agents = get_group_agents (array_keys ($groups), false, "none");
|
||||
}
|
||||
|
||||
echo '<a href="#" id="tgl_alert_control"><b>'.__('Alert control filter').'</b> '.print_image ("images/wand.png", true, array ("title" => __('Toggle filter(s)'))).'</a>';
|
||||
|
||||
$templateName = get_parameter('template_name','');
|
||||
$moduleName = get_parameter('module_name','');
|
||||
$agentID = get_parameter('agent_id','');
|
||||
$actionID = get_parameter('action_id','');
|
||||
$fieldContent = get_parameter('field_content','');
|
||||
$searchType = get_parameter('search_type','');
|
||||
$priority = get_parameter('priority','');
|
||||
|
||||
if (get_parameter('search',0)) {
|
||||
}
|
||||
|
||||
//Start div
|
||||
echo "<div id='alert_control' style='display:none'>\n";
|
||||
// Table for filter controls
|
||||
echo '<form method="post" action="index.php?sec=galertas&sec2=godmode/alerts/alert_list&refr='.$config["refr"].'&pure='.$config["pure"].'">';
|
||||
echo "<input type='hidden' name='search' value='1' />\n";
|
||||
echo '<table style="width="550" cellpadding="4" cellspacing="4" class="databox">'."\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td>".__('Template name')."</td><td>";
|
||||
print_input_text ('template_name', $templateName, '', 15);
|
||||
echo "</td>\n";
|
||||
$temp = get_agents();
|
||||
$arrayAgents = array();
|
||||
foreach ($temp as $agentElement) {
|
||||
$arrayAgents[$agentElement['id_agente']] = $agentElement['nombre'];
|
||||
}
|
||||
echo "<td>".__('Agents')."</td><td>";
|
||||
print_select ($arrayAgents, "agent_id", $agentID, '', __('All'),-1);
|
||||
echo "</td>\n";
|
||||
echo "<td>".__('Module name')."</td><td>";
|
||||
print_input_text ('module_name', $moduleName, '', 15);
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
$temp = get_db_all_rows_sql("SELECT id, name FROM talert_actions;");
|
||||
$arrayActions = array();
|
||||
foreach ($temp as $actionElement) {
|
||||
$arrayActions[$actionElement['id']] = $actionElement['name'];
|
||||
}
|
||||
echo "<td>".__('Actions')."</td><td>";
|
||||
print_select ($arrayActions, "action_id", $actionID, '', __('All'),-1);
|
||||
echo "</td>\n";
|
||||
echo "<td>".__('Field content')."</td><td>";
|
||||
print_input_text ('field_content', $fieldContent, '', 15);
|
||||
echo "</td>\n";
|
||||
echo "<td>".__('Priority')."</td><td>";
|
||||
print_select (get_priorities (), 'priority',$priority, '', __('All'),-1);
|
||||
echo "</td>";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='6' align='right'>";
|
||||
print_submit_button (__('Update'), '', false, 'class="sub upd"');
|
||||
echo "</td>";
|
||||
echo "</tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
$simple_alerts = array();
|
||||
|
||||
if ($id_agente) {
|
||||
$simple_alerts = get_agent_alerts_simple (array_keys ($agents));
|
||||
|
@ -202,12 +264,33 @@ if ($id_agente) {
|
|||
WHERE id_agent_module IN (SELECT id_agente_modulo
|
||||
FROM tagente_modulo WHERE id_agente IN (%s))',
|
||||
implode (',', array_keys ($agents)));
|
||||
$total = get_db_sql ($sql);
|
||||
|
||||
$where = '';
|
||||
if (get_parameter('search',0)) {
|
||||
if ($priority != -1 )
|
||||
$where .= " AND priority = " . $priority;
|
||||
if (strlen(trim($templateName)) > 0)
|
||||
$where .= " AND id_alert_template IN (SELECT id FROM talert_templates WHERE name LIKE '%" . trim($templateName) . "%')";
|
||||
if (strlen(trim($fieldContent)) > 0)
|
||||
$where .= " AND id_alert_template IN (SELECT id FROM talert_templates
|
||||
WHERE field1 LIKE '%" . trim($fieldContent) . "%' OR field2 LIKE '%" . trim($fieldContent) . "%' OR
|
||||
field3 LIKE '%" . trim($fieldContent) . "%' OR
|
||||
field2_recovery LIKE '%" . trim($fieldContent) . "%' OR
|
||||
field3_recovery LIKE '%" . trim($fieldContent) . "%')";
|
||||
if (strlen(trim($moduleName)) > 0)
|
||||
$where .= " AND id_agent_module IN (SELECT id_agente_modulo FROM tagente_modulo WHERE nombre LIKE '%" . trim($moduleName) . "%')";
|
||||
if ($agentID != -1)
|
||||
$where .= " AND id_agent_module IN (SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente = " . $agentID . ")";
|
||||
if ($actionID != -1)
|
||||
$where .= " AND id IN (SELECT id_alert_template_module FROM talert_template_module_actions WHERE id_alert_action = " . $actionID . ")";
|
||||
}
|
||||
|
||||
$total = get_db_sql ($sql.$where);
|
||||
}
|
||||
pagination ($total, 'index.php?sec=gagente&sec2=godmode/alerts/alert_list');
|
||||
$simple_alerts = get_agent_alerts_simple (array_keys ($agents), '',
|
||||
$simple_alerts = get_agent_alerts_simple (array_keys ($agents), array('priority' => $priority),
|
||||
array ('offset' => (int) get_parameter ('offset'),
|
||||
'limit' => $config['block_size']));
|
||||
'limit' => $config['block_size']), $where);
|
||||
}
|
||||
|
||||
$table->class = 'alert_list';
|
||||
|
@ -431,6 +514,11 @@ $(document).ready (function () {
|
|||
return false;
|
||||
});
|
||||
|
||||
$("#tgl_alert_control").click (function () {
|
||||
$("#alert_control").toggle ();
|
||||
return false;
|
||||
});
|
||||
|
||||
$("input[name=disable]").attr ("title", "<?php echo __('Disable')?>")
|
||||
.hover (function () {
|
||||
$(this).attr ("src", "images/lightbulb_off.png");
|
||||
|
|
|
@ -102,7 +102,7 @@ function create_agent ($name, $id_group, $interval, $ip_address, $values = false
|
|||
* @return array All simple alerts defined for an agent. Empty array if no
|
||||
* alerts found.
|
||||
*/
|
||||
function get_agent_alerts_simple ($id_agent, $filter = '', $options = false) {
|
||||
function get_agent_alerts_simple ($id_agent, $filter = '', $options = false, $where = '') {
|
||||
switch ($filter) {
|
||||
case "notfired":
|
||||
$filter = ' AND times_fired = 0 AND disabled = 0';
|
||||
|
@ -128,8 +128,8 @@ function get_agent_alerts_simple ($id_agent, $filter = '', $options = false) {
|
|||
|
||||
$sql = sprintf ("SELECT talert_template_modules.*
|
||||
FROM talert_template_modules
|
||||
WHERE id_agent_module in (%s)%s",
|
||||
implode (",", $id_modules), $filter);
|
||||
WHERE id_agent_module in (%s) %s %s",
|
||||
implode (",", $id_modules), $where, $filter);
|
||||
|
||||
$alerts = get_db_all_rows_sql ($sql);
|
||||
|
||||
|
@ -185,7 +185,7 @@ function get_agent_alerts_compound ($id_agent, $filter = '', $options = false) {
|
|||
*
|
||||
* By default, it will return all the agents where the user has reading access.
|
||||
*
|
||||
* @param array ilter options in an indexed array. See
|
||||
* @param array filter options in an indexed array. See
|
||||
* format_array_to_where_clause_sql()
|
||||
* @param array Fields to get.
|
||||
* @param string Access needed in the agents groups.
|
||||
|
|
|
@ -124,7 +124,9 @@ function print_select_style ($fields, $name, $selected = '', $style='', $script
|
|||
*
|
||||
* @return string HTML code if return parameter is true.
|
||||
*/
|
||||
function print_select ($fields, $name, $selected = '', $script = '', $nothing = '', $nothing_value = 0, $return = false, $multiple = false, $sort = true, $class = '', $disabled = false) {
|
||||
function print_select ($fields, $name, $selected = '', $script = '', $nothing = '', $nothing_value = 0, $return = false,
|
||||
$multiple = false, $sort = true, $class = '', $disabled = false) {
|
||||
|
||||
$output = "\n";
|
||||
|
||||
static $idcounter = array ();
|
||||
|
|
|
@ -861,7 +861,7 @@ ol.steps {
|
|||
margin-bottom: 15px;
|
||||
padding: 0;
|
||||
list-style-type: none;
|
||||
list-style-position: outline;
|
||||
list-style-position: outside;
|
||||
}
|
||||
ol.steps li {
|
||||
float: left;
|
||||
|
|
Loading…
Reference in New Issue