2011-03-17 Sergio Martin <sergio.martin@artica.es>
* pandoradb_data.sql include/functions_config.php include/functions_incidents.php operation/menu.php operation/integria_incidents operation/integria_incidents/incident.incident.php operation/integria_incidents/incident.php operation/integria_incidents/incident.files.php operation/integria_incidents/incident.tracking.php operation/integria_incidents/incident_detail.php operation/integria_incidents/incident.workunits.php operation/integria_incidents/incident.download_file.php operation/integria_incidents/incident_statistics.php operation/integria_incidents/incident.list.php godmode/setup/setup.php: Added the integria incidents interface with switch in the setup git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4105 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
a7025d6e91
commit
195b381149
|
@ -1,3 +1,22 @@
|
|||
2011-03-17 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* pandoradb_data.sql
|
||||
include/functions_config.php
|
||||
include/functions_incidents.php
|
||||
operation/menu.php
|
||||
operation/integria_incidents
|
||||
operation/integria_incidents/incident.incident.php
|
||||
operation/integria_incidents/incident.php
|
||||
operation/integria_incidents/incident.files.php
|
||||
operation/integria_incidents/incident.tracking.php
|
||||
operation/integria_incidents/incident_detail.php
|
||||
operation/integria_incidents/incident.workunits.php
|
||||
operation/integria_incidents/incident.download_file.php
|
||||
operation/integria_incidents/incident_statistics.php
|
||||
operation/integria_incidents/incident.list.php
|
||||
godmode/setup/setup.php: Added the integria incidents interface
|
||||
with switch in the setup
|
||||
|
||||
2011-03-16 Sancho Lerena <slerena@artica.es>
|
||||
|
||||
* operation/agentes/estado_monitores.php: Fixed an ugly error when cannot
|
||||
|
|
|
@ -116,24 +116,55 @@ $table->data[17][0] = __('Enable GIS features in Pandora Console');
|
|||
$table->data[17][1] = __('Yes').' '.print_radio_button ('activate_gis', 1, '', $config["activate_gis"], true).' ';
|
||||
$table->data[17][1] .= __('No').' '.print_radio_button ('activate_gis', 0, '', $config["activate_gis"], true);
|
||||
|
||||
$table->data[20][0] = __('Timezone setup');
|
||||
$table->data[20][1] = print_input_text ('timezone', $config["timezone"], '', 25, 25, true);
|
||||
$table->data[18][0] = __('Enable Integria incidents in Pandora Console');
|
||||
$table->data[18][1] = __('Yes').' '.print_radio_button ('integria_enabled', 1, '', $config["integria_enabled"], true).' ';
|
||||
$table->data[18][1] .= __('No').' '.print_radio_button ('integria_enabled', 0, '', $config["integria_enabled"], true);
|
||||
|
||||
if($config["integria_enabled"]) {
|
||||
$table->data[19][0] = __('Integria URL');
|
||||
$table->data[19][1] = print_input_text ('integria_url', $config["integria_url"], '', 25, 255, true);
|
||||
|
||||
$table->data[20][0] = __('Integria API password');
|
||||
$table->data[20][1] = print_input_text ('integria_api_password', $config["integria_api_password"], '', 25, 25, true);
|
||||
|
||||
require_once('include/functions_incidents.php');
|
||||
$invent = call_api($config['integria_url']."/include/api.php?user=".$config['id_user']."&pass=".$config['integria_api_password']."&op=get_inventories");
|
||||
$invent = explode("\n",$invent);
|
||||
$inventories = array();
|
||||
foreach($invent as $inv) {
|
||||
if($inv == '') {
|
||||
continue;
|
||||
}
|
||||
$invexp = explode(',',$inv);
|
||||
if(substr($invexp[1], 0, 1) == '"' && substr($invexp[1], strlen($invexp[1])-1, 1) == '"') {
|
||||
$invexp[1] = substr($invexp[1], 1, strlen($invexp[1])-2);
|
||||
}
|
||||
|
||||
$inventories[$invexp[0]] = $invexp[1];
|
||||
}
|
||||
|
||||
$table->data[21][0] = __('Integria inventory');
|
||||
$table->data[21][1] = print_select($inventories, 'integria_inventory', $config["integria_inventory"], '', '', '', true);
|
||||
}
|
||||
|
||||
$table->data[22][0] = __('Timezone setup');
|
||||
$table->data[22][1] = print_input_text ('timezone', $config["timezone"], '', 25, 25, true);
|
||||
|
||||
$sounds = get_sounds();
|
||||
$table->data[21][0] = __('Sound for Alert fired');
|
||||
$table->data[21][1] = print_select($sounds, 'sound_alert', $config['sound_alert'], 'replaySound(\'alert\');', '', '', true);
|
||||
$table->data[21][1] .= ' <a href="javascript: toggleButton(\'alert\');">' . print_image("images/control_play.png", true, array("id" => "button_sound_alert", "style" => "vertical-align: middle;", "width" => "16")) . '</a>';
|
||||
$table->data[21][1] .= '<div id="layer_sound_alert"></div>';
|
||||
$table->data[23][0] = __('Sound for Alert fired');
|
||||
$table->data[23][1] = print_select($sounds, 'sound_alert', $config['sound_alert'], 'replaySound(\'alert\');', '', '', true);
|
||||
$table->data[23][1] .= ' <a href="javascript: toggleButton(\'alert\');">' . print_image("images/control_play.png", true, array("id" => "button_sound_alert", "style" => "vertical-align: middle;", "width" => "16")) . '</a>';
|
||||
$table->data[23][1] .= '<div id="layer_sound_alert"></div>';
|
||||
|
||||
$table->data[22][0] = __('Sound for Monitor critical');
|
||||
$table->data[22][1] = print_select($sounds, 'sound_critical', $config['sound_critical'], 'replaySound(\'critical\');', '', '', true);
|
||||
$table->data[22][1] .= ' <a href="javascript: toggleButton(\'critical\');">' . print_image("images/control_play.png", true, array("id" => "button_sound_critical", "style" => "vertical-align: middle;", "width" => "16")) . '</a>';
|
||||
$table->data[22][1] .= '<div id="layer_sound_critical"></div>';
|
||||
$table->data[24][0] = __('Sound for Monitor critical');
|
||||
$table->data[24][1] = print_select($sounds, 'sound_critical', $config['sound_critical'], 'replaySound(\'critical\');', '', '', true);
|
||||
$table->data[24][1] .= ' <a href="javascript: toggleButton(\'critical\');">' . print_image("images/control_play.png", true, array("id" => "button_sound_critical", "style" => "vertical-align: middle;", "width" => "16")) . '</a>';
|
||||
$table->data[24][1] .= '<div id="layer_sound_critical"></div>';
|
||||
|
||||
$table->data[23][0] = __('Sound for Monitor warning');
|
||||
$table->data[23][1] = print_select($sounds, 'sound_warning', $config['sound_warning'], 'replaySound(\'warning\');', '', '', true);
|
||||
$table->data[23][1] .= ' <a href="javascript: toggleButton(\'warning\');">' . print_image("images/control_play.png", true, array("id" => "button_sound_warning", "style" => "vertical-align: middle;", "width" => "16")) . '</a>';
|
||||
$table->data[23][1] .= '<div id="layer_sound_warning"></div>';
|
||||
$table->data[25][0] = __('Sound for Monitor warning');
|
||||
$table->data[25][1] = print_select($sounds, 'sound_warning', $config['sound_warning'], 'replaySound(\'warning\');', '', '', true);
|
||||
$table->data[25][1] .= ' <a href="javascript: toggleButton(\'warning\');">' . print_image("images/control_play.png", true, array("id" => "button_sound_warning", "style" => "vertical-align: middle;", "width" => "16")) . '</a>';
|
||||
$table->data[25][1] .= '<div id="layer_sound_warning"></div>';
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function toggleButton(type) {
|
||||
|
|
|
@ -227,6 +227,11 @@ function update_config () {
|
|||
update_config_value ('rintegria_user', get_parameter ('rintegria_user', $config['rintegria_user']));
|
||||
update_config_value ('rintegria_pass', get_parameter ('rintegria_pass', $config['rintegria_pass']));
|
||||
|
||||
update_config_value ('integria_enabled', get_parameter ('integria_enabled', $config['integria_enabled']));
|
||||
update_config_value ('integria_inventory', get_parameter ('integria_inventory', $config['integria_inventory']));
|
||||
update_config_value ('integria_api_password', get_parameter ('integria_api_password', $config['integria_api_password']));
|
||||
update_config_value ('integria_url', get_parameter ('integria_url', $config['integria_url']));
|
||||
|
||||
update_config_value ('sound_alert', get_parameter('sound_alert', $config['sound_alert']));
|
||||
update_config_value ('sound_critical', get_parameter('sound_critical', $config['sound_critical']));
|
||||
update_config_value ('sound_warning', get_parameter('sound_warning', $config['sound_warning']));
|
||||
|
@ -597,6 +602,22 @@ function process_config () {
|
|||
update_config_value ( 'rintegria_pass', '');
|
||||
}
|
||||
|
||||
if (!isset ($config['integria_enabled'])) {
|
||||
update_config_value ( 'integria_enabled', '0');
|
||||
}
|
||||
|
||||
if (!isset ($config['integria_api_password'])) {
|
||||
update_config_value ( 'integria_api_password', '');
|
||||
}
|
||||
|
||||
if (!isset ($config['integria_inventory'])) {
|
||||
update_config_value ( 'integria_inventory', '0');
|
||||
}
|
||||
|
||||
if (!isset ($config['integria_url'])) {
|
||||
update_config_value ( 'integria_url', '');
|
||||
}
|
||||
|
||||
if (!isset ($config['autoupdate'])) {
|
||||
update_config_value ( 'autoupdate', 0);
|
||||
}
|
||||
|
|
|
@ -46,22 +46,22 @@ function get_incidents_priorities () {
|
|||
function print_incidents_priority_img ($id_priority, $return = false) {
|
||||
switch ($id_priority) {
|
||||
case 0:
|
||||
$img = print_image ("images/dot_green.png", true).print_image ("images/dot_green.png", true).print_image ("images/dot_yellow.png", true);
|
||||
$img = print_image ("images/dot_green.png", true, array('title' => __('Informative'))).print_image ("images/dot_green.png", true, array('title' => __('Informative'))).print_image ("images/dot_yellow.png", true, array('title' => __('Informative')));
|
||||
break;
|
||||
case 1:
|
||||
$img = print_image ("images/dot_green.png", true).print_image ("images/dot_yellow.png", true).print_image ("images/dot_yellow.png", true);
|
||||
$img = print_image ("images/dot_green.png", true, array('title' => __('Low'))).print_image ("images/dot_yellow.png", true, array('title' => __('Low'))).print_image ("images/dot_yellow.png", true, array('title' => __('Low')));
|
||||
break;
|
||||
case 2:
|
||||
$img = print_image ("images/dot_yellow.png", true).print_image ("images/dot_yellow.png", true).print_image ("images/dot_red.png", true);
|
||||
$img = print_image ("images/dot_yellow.png", true, array('title' => __('Medium'))).print_image ("images/dot_yellow.png", true, array('title' => __('Medium'))).print_image ("images/dot_red.png", true, array('title' => __('Medium')));
|
||||
break;
|
||||
case 3:
|
||||
$img = print_image ("images/dot_yellow.png", true).print_image ("images/dot_red.png", true).print_image ("images/dot_red.png", true);
|
||||
$img = print_image ("images/dot_yellow.png", true, array('title' => __('Serious'))).print_image ("images/dot_red.png", true, array('title' => __('Serious'))).print_image ("images/dot_red.png", true, array('title' => __('Serious')));
|
||||
break;
|
||||
case 4:
|
||||
$img = print_image ("images/dot_red.png", true).print_image ("images/dot_red.png", true).print_image ("images/dot_red.png", true);
|
||||
$img = print_image ("images/dot_red.png", true, array('title' => __('Very serious'))).print_image ("images/dot_red.png", true, array('title' => __('Very serious'))).print_image ("images/dot_red.png", true, array('title' => __('Very serious')));
|
||||
break;
|
||||
case 10:
|
||||
$img = print_image ("images/dot_green.png", true).print_image ("images/dot_green.png", true).print_image ("images/dot_green.png", true);
|
||||
$img = print_image ("images/dot_green.png", true, array('title' => __('Maintenance'))).print_image ("images/dot_green.png", true, array('title' => __('Maintenance'))).print_image ("images/dot_green.png", true, array('title' => __('Maintenance')));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -98,19 +98,19 @@ function get_incidents_status () {
|
|||
function print_incidents_status_img ($id_status, $return = false) {
|
||||
switch ($id_status) {
|
||||
case 0:
|
||||
$img = print_image ("images/dot_red.png", true);
|
||||
$img = print_image ("images/dot_red.png", true, array('title' => __('Active incidents')));
|
||||
break;
|
||||
case 1:
|
||||
$img = print_image ("images/dot_yellow.png", true);
|
||||
$img = print_image ("images/dot_yellow.png", true, array('title' => __('Active incidents, with comments')));
|
||||
break;
|
||||
case 2:
|
||||
$img = print_image ("images/dot_blue.png", true);
|
||||
$img = print_image ("images/dot_blue.png", true, array('title' => __('Rejected incidents')));
|
||||
break;
|
||||
case 3:
|
||||
$img = print_image ("images/dot_green.png", true);
|
||||
$img = print_image ("images/dot_green.png", true, array('title' => __('Expired incidents')));
|
||||
break;
|
||||
case 13:
|
||||
$img = print_image ("images/dot_white.png", true);
|
||||
$img = print_image ("images/dot_white.png", true, array('title' => __('Closed incidents')));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -411,4 +411,24 @@ function get_incidents_attach ($id_incident) {
|
|||
function get_incidents_notes_author ($id_note) {
|
||||
return (string) get_db_value ('id_usuario', 'tnota', 'id_nota', (int) $id_note);
|
||||
}
|
||||
|
||||
function call_api($url, $postparameters = false) {
|
||||
|
||||
$curlObj = curl_init();
|
||||
curl_setopt($curlObj, CURLOPT_URL, $url);
|
||||
curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1);
|
||||
if($postparameters !== false) {
|
||||
curl_setopt($curlObj, CURLOPT_POSTFIELDS, $postparameters);
|
||||
}
|
||||
$result = curl_exec($curlObj);
|
||||
curl_close($curlObj);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
function xml_to_array($xml) {
|
||||
$xmlObj = simplexml_load_string($xml);
|
||||
return json_decode(json_encode($xmlObj), true);
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// 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
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
require_once ("../../include/functions_incidents.php");
|
||||
require_once ("../../include/config.php");
|
||||
|
||||
$id_file = $_GET["id_file"];
|
||||
$filename = $_GET["filename"];
|
||||
$id_user = $_GET["id_user"];
|
||||
|
||||
$integria_api = $config['integria_url']."/include/api.php?return_type=csv&user=".$config['id_user']."&pass=".$config['integria_api_password'];
|
||||
|
||||
$url = $integria_api."&op=download_file¶ms=".$id_file;
|
||||
|
||||
// Call the integria API
|
||||
$file = call_api($url);
|
||||
|
||||
header("Content-type: binary");
|
||||
header("Content-Disposition: attachment; filename=\"".$filename."\"");
|
||||
header("Pragma: no-cache");
|
||||
header("Expires: 0");
|
||||
|
||||
echo base64_decode($file);
|
||||
?>
|
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// 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
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
global $result;
|
||||
$table->width = "98%";
|
||||
$table->class = "databox";
|
||||
|
||||
$table->data = array();
|
||||
|
||||
$profiles = array();
|
||||
$table->data[0][0] = "<b>".__('File')."</b><br/>".print_input_file ('new_file', true, array('size' => "50%"));
|
||||
|
||||
$table->data[1][0] = "<b>".__('Description')."</b><br/>".print_textarea('description', 3, 6, '' , '', true);
|
||||
|
||||
$form = "<form method='post' action='' enctype='multipart/form-data'>";
|
||||
$form .= print_table($table, true);
|
||||
$form .= print_submit_button(__('Add'), 'submit_button', false, '', true);
|
||||
$form .= print_input_hidden('tab', 'files', true);
|
||||
$form .= print_input_hidden('attach_file', '1', true);
|
||||
$form .= print_input_hidden('id_incident', $id_incident, true);
|
||||
$form .= "</form>";
|
||||
|
||||
toggle($form, __('Add a file'));
|
||||
|
||||
unset($table);
|
||||
|
||||
$table->width = "98%";
|
||||
$table->class = "databox";
|
||||
|
||||
$table->head[0] = __('Filename');
|
||||
$table->head[1] = __('Timestamp');
|
||||
$table->head[2] = __('Description');
|
||||
$table->head[3] = __('Size');
|
||||
$table->head[4] = __('Delete');
|
||||
|
||||
$table->data = array();
|
||||
|
||||
if(isset($result['file'][0]) && is_array($result['file'][0])){
|
||||
$files = $result['file'];
|
||||
}
|
||||
else {
|
||||
$files = $result;
|
||||
}
|
||||
|
||||
$row = 0;
|
||||
foreach($files as $value) {
|
||||
$table->data[$row][0] = '<a href="operation/integria_incidents/incident.download_file.php?tab=files&id_incident='.$value['id_incidencia'].'&id_file='.$value['id_attachment'].'&filename='.$value['filename'].'&id_user='.$config['id_user'].'&rintegria_server='.$config['rintegria_server'].'">'.$value['filename'].'</a>';
|
||||
$table->data[$row][1] = $value['id_usuario'];
|
||||
if(is_array($value['description'])) {
|
||||
$value['description'] = '';
|
||||
}
|
||||
$table->data[$row][2] = $value['description'];
|
||||
$table->data[$row][3] = $value['size'];
|
||||
$table->data[$row][4] = "<a href='index.php?sec=incidencias&sec2=operation/integria_incidents/incident&tab=files&id_incident=".$value['id_incidencia']."&delete_file=".$value['id_attachment']."'>".print_image("images/cross.png", true, array('title' => __('Delete file')))."</a>";
|
||||
$row++;
|
||||
}
|
||||
|
||||
print_table($table);
|
||||
|
||||
?>
|
|
@ -0,0 +1,119 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// 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
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
global $result;
|
||||
global $result_resolutions;
|
||||
global $result_status;
|
||||
global $result_sources;
|
||||
global $result_groups;
|
||||
global $result_users;
|
||||
|
||||
$resolutions[0] = __('None');
|
||||
foreach($result_resolutions['resolution'] as $res) {
|
||||
$resolutions[$res['id']] = $res['name'];
|
||||
}
|
||||
|
||||
foreach($result_status['status'] as $st) {
|
||||
$status[$st['id']] = $st['name'];
|
||||
}
|
||||
|
||||
foreach($result_sources['source'] as $src) {
|
||||
$sources[$src['id']] = $src['name'];
|
||||
}
|
||||
|
||||
foreach($result_groups['group'] as $gr) {
|
||||
$groups[$gr['id']] = $gr['name'];
|
||||
}
|
||||
|
||||
foreach($result_users['id_user'] as $usr) {
|
||||
$users[$usr] = $usr;
|
||||
}
|
||||
|
||||
if(!isset($result['id_incidencia'])) {
|
||||
$result['titulo'] = '';
|
||||
$result['sla_disabled'] = 0;
|
||||
$result['notify_email'] = 0;
|
||||
$result['estado'] = 0;
|
||||
$result['prioridad'] = 0;
|
||||
$result['resolution'] = 0;
|
||||
$result['id_parent'] = 0;
|
||||
$result['origen'] = 0;
|
||||
$result['id_incident_type'] = 0;
|
||||
$result['id_task'] = 0;
|
||||
$result['id_creator'] = $config['id_user'];
|
||||
$result['id_grupo'] = 0;
|
||||
$result['id_usuario'] = 0;
|
||||
$result['id_task'] = 0;
|
||||
$result['descripcion'] = '';
|
||||
$result['epilog'] = '';
|
||||
}
|
||||
|
||||
$table->width = "98%";
|
||||
$table->class = "databox";
|
||||
|
||||
$table->data = array();
|
||||
$table->colspan[0][0] = 3;
|
||||
$table->colspan[3][0] = 3;
|
||||
$table->colspan[4][0] = 3;
|
||||
|
||||
$table->data[0][0] = "<b>".__('Title')."</b><br/>".print_input_text("title", $result['titulo'], '', 50, 255, true);
|
||||
if(isset($result['id_incidencia'])) {
|
||||
$table->data[1][2] = "<b>".__('Assigned user')."</b><br/>".print_select ($users, 'id_user', $result['id_usuario'], '', '', 0, true, false, false);
|
||||
}
|
||||
else {
|
||||
$table->data[1][2] = "";
|
||||
}
|
||||
|
||||
$table->data[1][0] = "<b>".__('Group')."</b><br/>".print_select ($groups, 'group', $result['id_grupo'], '', '', 0, true, false, false);
|
||||
$table->data[1][1] = "<b>".__('Priority')."</b><br/>".print_select (get_incidents_priorities (), 'priority', $result['prioridad'], '', '', 0, true, false, false);
|
||||
$table->data[1][2] = "<b>".__('Creator')."</b><br/>".$result['id_creator'];
|
||||
|
||||
if(isset($result['id_incidencia'])) {
|
||||
$table->data[2][0] = "<b>".__('Source')."</b><br/>".print_select ($sources, 'source', $result['origen'], '', '', 0, true, false, false);
|
||||
$table->data[2][1] = "<b>".__('Resolution')."</b><br/>".print_select ($resolutions, 'resolution', $result['resolution'], '', '', 0, true, false, false);
|
||||
$table->data[2][2] = "<b>".__('Status')."</b><br/>".print_select ($status, 'status', $result['estado'], '', '', 0, true, false, false);
|
||||
}
|
||||
|
||||
if(is_array($result['descripcion'])) {
|
||||
$result['descripcion'] = "";
|
||||
}
|
||||
|
||||
$table->data[3][0] = "<b>".__('Description')."</b><br/>".print_textarea("description", 10, 6, $result['descripcion'] , '', true);
|
||||
|
||||
if(isset($result['id_incidencia'])) {
|
||||
if(is_array($result['epilog'])) {
|
||||
$result['epilog'] = implode(',', $result['epilog']);
|
||||
}
|
||||
$table->data[4][0] = "<b>".__('Resolution epilog')."</b><br/>".print_textarea("epilog", 10, 6, $result['epilog'] , '', true);
|
||||
}
|
||||
|
||||
if(isset($result['id_incidencia'])) {
|
||||
echo "<form method='post' action=''>";
|
||||
print_table($table);
|
||||
print_submit_button(__('Update'), 'submit_button');
|
||||
print_input_hidden('tab', 'incident');
|
||||
print_input_hidden('update_incident', '1');
|
||||
print_input_hidden('id_incident', $result['id_incidencia']);
|
||||
echo "</form>";
|
||||
}
|
||||
else {
|
||||
echo "<form method='post' action=''>";
|
||||
print_table($table);
|
||||
print_submit_button(__('Create'), 'submit_button');
|
||||
print_input_hidden('tab', 'incident');
|
||||
print_input_hidden('create_incident', '1');
|
||||
echo "</form>";
|
||||
}
|
||||
?>
|
|
@ -0,0 +1,133 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// 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
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
global $search_status;
|
||||
global $search_group;
|
||||
global $search_string;
|
||||
|
||||
global $result;
|
||||
global $result_status;
|
||||
global $result_groups;
|
||||
global $result_resolutions;
|
||||
|
||||
foreach($result_status['status'] as $st) {
|
||||
$status[$st['id']] = $st['name'];
|
||||
}
|
||||
|
||||
// Add special status cases
|
||||
$status[0] = __('Any');
|
||||
$status[-10] = __('Not closed');
|
||||
|
||||
foreach($result_groups['group'] as $gr) {
|
||||
$groups[$gr['id']] = $gr['name'];
|
||||
}
|
||||
|
||||
$resolutions[0] = __('None');
|
||||
foreach($result_resolutions['resolution'] as $res) {
|
||||
$resolutions[$res['id']] = $res['name'];
|
||||
}
|
||||
|
||||
echo '<form method="post">';
|
||||
|
||||
echo '<br><table width="98%" border=0>';
|
||||
echo '<tr>';
|
||||
echo '<td>';
|
||||
echo "<b>".__('Search string')."</b>";
|
||||
echo '</td>';
|
||||
echo '<td>';
|
||||
echo "<b>".__('Status')."</b>";
|
||||
echo '</td>';
|
||||
echo '<td>';
|
||||
echo "<b>".__('Group')."</b>";
|
||||
echo '</td>';
|
||||
echo '</tr><tr>';
|
||||
echo '<td>';
|
||||
print_input_text('search_string', $search_string, '');
|
||||
echo '</td>';
|
||||
echo '<td>';
|
||||
print_select ($status, 'search_status', $search_status, '', '', 0, false);
|
||||
echo '</td>';
|
||||
echo '<td>';
|
||||
print_select ($groups, 'search_group', $search_group, '', '', 0, false, false, false);
|
||||
echo '</td>';
|
||||
echo '<td>';
|
||||
print_submit_button (__('Search'));
|
||||
echo '</td>';
|
||||
echo '</tr></table>';
|
||||
|
||||
echo '</form>';
|
||||
|
||||
|
||||
// Show headers
|
||||
$table->width = "98%";
|
||||
$table->class = "databox";
|
||||
$table->cellpadding = 4;
|
||||
$table->cellspacing = 4;
|
||||
$table->head = array ();
|
||||
$table->data = array ();
|
||||
$table->size = array ();
|
||||
$table->align = array ();
|
||||
|
||||
$table->head[0] = __('ID');
|
||||
//$table->head[1] = __('SLA');
|
||||
$table->head[2] = __('Incident');
|
||||
$table->head[3] = __('Group');
|
||||
$table->head[4] = __('Status')."<br/><i>".__('Resolution')."</i>";
|
||||
$table->head[5] = __('Priority');
|
||||
$table->head[6] = __('Updated')."<br/><i>".__('Started')."</i>";
|
||||
$table->head[7] = __('Details');
|
||||
$table->head[8] = __('Creator');
|
||||
$table->head[9] = __('Owner');
|
||||
$table->head[10] = __('Action');
|
||||
|
||||
$table->align[4] = "center";
|
||||
$table->align[5] = "center";
|
||||
|
||||
if(isset($result['incident'][0]) && is_array($result['incident'][0])){
|
||||
$incidents = $result['incident'];
|
||||
}
|
||||
else {
|
||||
$incidents = $result;
|
||||
}
|
||||
|
||||
$rowPair = true;
|
||||
$iterator = 0;
|
||||
foreach ($incidents as $row) {
|
||||
if ($rowPair)
|
||||
$table->rowclass[$iterator] = 'rowPair';
|
||||
else
|
||||
$table->rowclass[$iterator] = 'rowOdd';
|
||||
$rowPair = !$rowPair;
|
||||
$iterator++;
|
||||
|
||||
$data = array();
|
||||
|
||||
$data[0] = '<a href="index.php?login=1&sec=incidencias&sec2=operation/integria_incidents/incident&tab=incident&id_incident='.$row["id_incidencia"].'">'.$row["id_incidencia"].'</a>';
|
||||
//$data[1] = "";
|
||||
$data[2] = '<a href="index.php?login=1&sec=incidencias&sec2=operation/integria_incidents/incident&tab=incident&id_incident='.$row["id_incidencia"].'">'.substr(safe_output($row["titulo"]),0,45).'</a>';
|
||||
$data[3] = $groups[$row["id_grupo"]];
|
||||
$data[4] = $status[$row["estado"]]."<br/><i>".$resolutions[$row["resolution"]]."</i>";
|
||||
$data[5] = print_incidents_priority_img ($row["prioridad"], true);
|
||||
$data[6] = print_timestamp ($row["actualizacion"], true)."<br/><i>".print_timestamp ($row["inicio"], true)."</i>";
|
||||
$data[7] = $row["workunits_hours"]." ".__('Hours')."<br/>".$row["workunits_count"]." ".__('Workunits');
|
||||
$data[8] = $row["id_creator"];
|
||||
$data[9] = $row["id_usuario"];
|
||||
$data[10] = "<a href='index.php?sec=incidencias&sec2=operation/integria_incidents/incident&delete_incident=".$row['id_incidencia']."'>".print_image("images/cross.png", true, array('title' => __('Delete incident')))."</a><a href='index.php?login=1&sec=incidencias&sec2=operation/integria_incidents/incident&tab=incident&id_incident=".$row["id_incidencia"]."'>".print_image("images/config.png", true, array('title' => __('View incident details')))."</a>";
|
||||
|
||||
array_push ($table->data, $data);
|
||||
}
|
||||
|
||||
print_table ($table);
|
||||
?>
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2010 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
|
||||
|
@ -24,343 +24,247 @@ if (! check_acl ($config['id_user'], 0, "IR")) {
|
|||
exit;
|
||||
}
|
||||
|
||||
$tab = get_parameter('tab', 'list');
|
||||
$id_incident = get_parameter('id_incident', 0);
|
||||
|
||||
// We choose a strange token to use texts with commas, etc.
|
||||
$token = ';,;';
|
||||
|
||||
// Header
|
||||
print_page_header (__('Incident management'), "images/book_edit.png", false, "", false, "");
|
||||
if($tab == 'list' || $tab == 'editor') {
|
||||
$buttons = array(
|
||||
'list' => array(
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?login=1&sec=incidencias&sec2=operation/integria_incidents/incident&tab=list">' .
|
||||
print_image ("images/page_white_text.png", true, array ("title" => __('Incidents'))) .'</a>'),
|
||||
'editor' => array(
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?login=1&sec=incidencias&sec2=operation/integria_incidents/incident&tab=editor">' .
|
||||
print_image ("images/add.png", true, array ("title" => __('New Incident'))) .'</a>'));
|
||||
}
|
||||
else {
|
||||
$buttons = array(
|
||||
'list' => array(
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?login=1&sec=incidencias&sec2=operation/integria_incidents/incident&tab=list">' .
|
||||
print_image ("images/page_white_text.png", true, array ("title" => __('Incidents'))) .'</a>'),
|
||||
'incident' => array(
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?login=1&sec=incidencias&sec2=operation/integria_incidents/incident&tab=incident&id_incident='.$id_incident.'">' .
|
||||
print_image ("images/eye.png", true, array ("title" => __('Incident details'))) .'</a>'),
|
||||
'workunits' => array(
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?login=1&sec=incidencias&sec2=operation/integria_incidents/incident&tab=workunits&id_incident='.$id_incident.'">' .
|
||||
print_image ("images/computer.png", true, array ("title" => __('Workunits'))) .'</a>'),
|
||||
'files' => array(
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?login=1&sec=incidencias&sec2=operation/integria_incidents/incident&tab=files&id_incident='.$id_incident.'"">' .
|
||||
print_image ("images/file.png", true, array ("title" => __('Files'))) .'</a>'),
|
||||
'tracking' => array(
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?login=1&sec=incidencias&sec2=operation/integria_incidents/incident&tab=tracking&id_incident='.$id_incident.'"">' .
|
||||
print_image ("images/comments.png", true, array ("title" => __('Tracking'))) .'</a>'));
|
||||
}
|
||||
|
||||
$buttons[$tab]['active'] = true;
|
||||
|
||||
// Take input parameters
|
||||
print_page_header (__('Incident management'), "images/book_edit.png", false, "", false, $buttons);
|
||||
|
||||
// Offset adjustment
|
||||
if (isset($_GET["offset"])) {
|
||||
$offset = get_parameter_get ("offset");
|
||||
} else {
|
||||
$offset = 0;
|
||||
$update_incident = get_parameter('update_incident', 0);
|
||||
|
||||
$integria_api = $config['integria_url']."/include/api.php?return_type=xml&user=".$config['id_user']."&pass=".$config['integria_api_password'];
|
||||
|
||||
if($update_incident == 1) {
|
||||
$values[0] = $id_incident;
|
||||
$values[1] = str_replace(" ", "%20", safe_output(get_parameter('title')));
|
||||
$values[2] = str_replace(" ", "%20", safe_output(get_parameter('description')));
|
||||
$values[3] = str_replace(" ", "%20", safe_output(get_parameter('epilog')));
|
||||
$values[4] = get_parameter('group');
|
||||
$values[5] = get_parameter('priority');
|
||||
$values[6] = get_parameter('source');
|
||||
$values[7] = get_parameter('resolution');
|
||||
$values[8] = get_parameter('status');
|
||||
$values[9] = get_parameter('creator', get_parameter('creator_fix'));
|
||||
|
||||
$params = implode($token, $values);
|
||||
|
||||
$url = $integria_api."&op=update_incident&token=".$token."¶ms=".$params;
|
||||
// Call the integria API
|
||||
$result = call_api($url);
|
||||
}
|
||||
|
||||
// Check action. Try to get author and group
|
||||
$action = get_parameter_get ("action");
|
||||
$create_incident = get_parameter('create_incident', 0);
|
||||
|
||||
if ($action == "mass") {
|
||||
$id_inc = get_parameter_post ("id_inc", array ());
|
||||
$delete_btn = get_parameter_post ("delete_btn", -1);
|
||||
$own_btn = get_parameter_post ("own_btn", -1);
|
||||
if($create_incident == 1) {
|
||||
$values[0] = str_replace(" ", "%20", safe_output(get_parameter('title')));
|
||||
$values[1] = get_parameter('group');
|
||||
$values[2] = get_parameter('priority');
|
||||
$values[3] = str_replace(" ", "%20", safe_output(get_parameter('description')));
|
||||
$values[4] = $config['integria_inventory'];
|
||||
|
||||
foreach ($id_inc as $incident) {
|
||||
if (check_acl ($config['id_user'], get_incidents_group ($incident), "IM") || get_incidents_author ($incident) == $config["id_user"] || get_incidents_owner ($incident) == $config["id_user"]) {
|
||||
continue;
|
||||
}
|
||||
pandora_audit("ACL Forbidden","Mass-update or deletion of incident");
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($delete_btn != -1) {
|
||||
$result = delete_incidents ($id_inc);
|
||||
print_result_message ($result,
|
||||
__('Successfully deleted'),
|
||||
__('Could not be deleted'));
|
||||
}
|
||||
if ($own_btn != -1) {
|
||||
$result = process_incidents_chown ($id_inc, $config["id_user"]);
|
||||
print_result_message ($result,
|
||||
__('Successfully reclaimed ownership'),
|
||||
__('Could not reclame ownership'));
|
||||
}
|
||||
$params = implode($token, $values);
|
||||
|
||||
$url = $integria_api."&op=create_incident&token=".$token."¶ms=".$params;
|
||||
|
||||
// Call the integria API
|
||||
$result = call_api($url);
|
||||
}
|
||||
elseif ($action == "update") {
|
||||
$id_inc = get_parameter ("id_inc", 0);
|
||||
$author = get_incidents_author ($id_inc);
|
||||
$owner = get_incidents_owner ($id_inc);
|
||||
$grupo = get_incidents_group ($id_inc);
|
||||
|
||||
if ($author != $config["id_user"] && $owner != $config["id_user"] && !check_acl ($config['id_user'], $grupo, "IM")) { // Only admins (manage incident) or owners/creators can modify incidents
|
||||
pandora_audit("ACL Forbidden", "Update incident #".$id_inc, $author);
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$titulo = get_parameter_post ("titulo");
|
||||
$descripcion = get_parameter_post ("descripcion");
|
||||
$origen = get_parameter_post ("origen_form");
|
||||
$prioridad = get_parameter_post ("prioridad_form", 0);
|
||||
$estado = get_parameter_post ("estado_form", 0);
|
||||
$grupo = get_parameter_post ("grupo_form", 1);
|
||||
$usuario = get_parameter_post ("usuario_form", $config["id_user"]);
|
||||
|
||||
$values = array(
|
||||
'titulo' => $titulo,
|
||||
'origen' => $origen,
|
||||
'estado' => $estado,
|
||||
'id_grupo' => $grupo,
|
||||
'id_usuario' => $usuario,
|
||||
'prioridad' => $prioridad,
|
||||
'descripcion' => $descripcion,
|
||||
'id_lastupdate' => $config["id_user"]);
|
||||
$result = process_sql ($sql);
|
||||
|
||||
$result = process_sql_update('tincidencia', $values, array('id_incidencia' => $id_inc));
|
||||
|
||||
if ($result !== false) {
|
||||
pandora_audit("Incident updated","User ".$config['id_user']." updated incident #".$id_inc);
|
||||
}
|
||||
|
||||
print_result_message ($result,
|
||||
__('Successfully updated'),
|
||||
__('Could not be updated'));
|
||||
|
||||
} elseif ($action == "insert") {
|
||||
//Create incident
|
||||
$grupo = get_parameter_post ("grupo_form", 1);
|
||||
|
||||
if (!check_acl ($config['id_user'], $grupo, "IW")) {
|
||||
pandora_audit("ACL Forbidden", "User ".$config["id_user"]." tried to update incident");
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
$attach_file = get_parameter('attach_file', 0);
|
||||
|
||||
// Read input variables
|
||||
$titulo = get_parameter_post ("titulo");
|
||||
$descripcion = get_parameter_post ("descripcion");
|
||||
$origen = get_parameter_post ("origen_form");
|
||||
$prioridad = get_parameter_post ("prioridad_form");
|
||||
$id_creator = $config['id_user'];
|
||||
$estado = get_parameter_post ("estado_form");
|
||||
|
||||
$values = array(
|
||||
'inicio' => 'NOW()',
|
||||
'actualizacion' => 'NOW()',
|
||||
'titulo' => $titulo,
|
||||
'descripcion' => $descripcion,
|
||||
'id_usuario' => $config["id_user"],
|
||||
'origen' => $origen,
|
||||
'estado' => $estado,
|
||||
'prioridad' => $prioridad,
|
||||
'id_grupo' => $grupo,
|
||||
'id_creator' => $config["id_user"]);
|
||||
$id_inc = process_sql_insert('tincidencia', $values);
|
||||
if($attach_file == 1) {
|
||||
if($_FILES['new_file']['name'] != "" && $_FILES['new_file']['error'] == 0) {
|
||||
$file_content = file_get_contents($_FILES["new_file"]["tmp_name"]);
|
||||
|
||||
$values[0] = $id_incident;
|
||||
$values[1] = $_FILES['new_file']['name'];
|
||||
$values[2] = $_FILES['new_file']['size'];
|
||||
$values[3] = str_replace(" ", "%20", safe_output(get_parameter('description'), __('No description available')));
|
||||
$values[4] = base64_encode($file_content);
|
||||
|
||||
|
||||
$params = implode($token, $values);
|
||||
|
||||
if ($id_inc === false) {
|
||||
echo '<h3 class="error">'.__('Error creating incident').'</h3>';
|
||||
$url = $integria_api."&op=attach_file&token=".$token;
|
||||
|
||||
// Call the integria API
|
||||
$result = call_api($url, array('params' => $params));
|
||||
}
|
||||
else {
|
||||
pandora_audit("Incident created", "User ".$config["id_user"]." created incident #".$id_inc);
|
||||
}
|
||||
}
|
||||
|
||||
// Search
|
||||
$filter = "";
|
||||
|
||||
$texto = (string) get_parameter ("texto", "");
|
||||
if ($texto != "")
|
||||
$filter .= sprintf (" AND (titulo LIKE '%%%s%%' OR descripcion LIKE '%%%s%%')", $texto, $texto);
|
||||
|
||||
$usuario = (string) get_parameter ("usuario", "");
|
||||
if ($usuario != "")
|
||||
$filter .= sprintf (" AND id_usuario = '%s'", $usuario);
|
||||
|
||||
$estado = (int) get_parameter ("estado", -1);
|
||||
if ($estado >= 0) //-1 = All
|
||||
$filter .= sprintf (" AND estado = %d", $estado);
|
||||
|
||||
$grupo = (int) get_parameter ("grupo", 0);
|
||||
if ($grupo > 0) {
|
||||
$filter .= sprintf (" AND id_grupo = %d", $grupo);
|
||||
if (check_acl ($config['id_user'], $grupo, "IM") == 0) {
|
||||
pandora_audit("ACL Forbidden","User tried to read incidents from group without access");
|
||||
include ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$prioridad = (int) get_parameter ("prioridad", -1);
|
||||
if ($prioridad != -1) //-1 = All
|
||||
$filter .= sprintf (" AND prioridad = %d", $prioridad);
|
||||
|
||||
$offset = (int) get_parameter ("offset", 0);
|
||||
$groups = get_user_groups ($config["id_user"], "IR");
|
||||
|
||||
//Select incidencts where the user has access to ($groups from
|
||||
//get_user_groups), array_keys for the id, implode to pass to SQL
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$sql = "SELECT * FROM tincidencia
|
||||
WHERE id_grupo IN (".implode (",",array_keys ($groups)).")" . $filter . "
|
||||
ORDER BY actualizacion DESC LIMIT ".$offset.",".$config["block_size"];
|
||||
break;
|
||||
case "postgresql":
|
||||
$sql = "SELECT * FROM tincidencia
|
||||
WHERE id_grupo IN (".implode (",",array_keys ($groups)).")" . $filter . "
|
||||
ORDER BY actualizacion DESC LIMIT ".$config["block_size"]." OFFSET ".$offset;
|
||||
break;
|
||||
}
|
||||
|
||||
$result = get_db_all_rows_sql ($sql);
|
||||
if (empty ($result)) {
|
||||
$result = array ();
|
||||
$count = 0;
|
||||
}
|
||||
else {
|
||||
$count = count ($result);
|
||||
}
|
||||
|
||||
|
||||
echo '<form name="visualizacion" method="post" action="index.php?sec=incidencias&sec2=operation/incidents/incident">';
|
||||
|
||||
echo '<table class="databox" cellpadding="4" cellspacing="4" width="95%"><tr>
|
||||
<td valign="middle"><h3>'.__('Filter').'</h3>';
|
||||
|
||||
$fields = get_incidents_status ();
|
||||
print_select ($fields, "estado", $estado, 'javascript:this.form.submit();', __('All incidents'), -1, false, false, false, 'w155');
|
||||
|
||||
//Legend
|
||||
echo '</td><td valign="middle"><noscript>';
|
||||
print_submit_button (__('Show'), 'submit-estado', false, array ("class" => "sub"));
|
||||
|
||||
echo '</noscript></td><td rowspan="7" class="f9" style="padding-left: 30px; vertical-align: top;"><h3>'.__('Status').'</h3>';
|
||||
foreach (get_incidents_status () as $id => $str) {
|
||||
print_incidents_status_img ($id);
|
||||
echo ' - ' . $str . '<br />';
|
||||
}
|
||||
|
||||
echo '</td><td rowspan="7" class="f9" style="padding-left: 30px; vertical-align: top;"><h3>'.__('Priority').'</h3>';
|
||||
foreach (get_incidents_priorities () as $id => $str) {
|
||||
print_incidents_priority_img ($id);
|
||||
echo ' - ' . $str . '<br />';
|
||||
}
|
||||
|
||||
echo '</td></tr><tr><td>';
|
||||
|
||||
$fields = get_incidents_priorities ();
|
||||
|
||||
print_select ($fields, "prioridad", $prioridad, 'javascript:this.form.submit();', __('All priorities'), -1,false,false,false,'w155');
|
||||
|
||||
echo '</td></tr><tr><td>';
|
||||
|
||||
print_select (get_users_info (), "usuario", $usuario, 'javascript:this.form.submit();', __('All users'), "", false, false, false, "w155");
|
||||
|
||||
echo '</td></tr><tr><td colspan=3>';
|
||||
|
||||
print_select_groups($config["id_user"], "IR", true, "grupo", $grupo, 'javascript:this.form.submit();', '', '',false,false,false,'w155');
|
||||
|
||||
echo " ";
|
||||
|
||||
print_input_text ('texto', $texto, '', 45);
|
||||
echo ' ';
|
||||
print_input_image ("submit", "images/zoom.png", __('Search'), 'padding:0;', false, array ("alt" => __('Search')));
|
||||
|
||||
echo "</td></tr></table>";
|
||||
echo '</form>';
|
||||
|
||||
if ($count < 1) {
|
||||
echo '<div class="nf">'.__('No incidents match your search filter').'</div><br />';
|
||||
}
|
||||
else {
|
||||
// TOTAL incidents
|
||||
$url = "index.php?sec=incidencias&sec2=operation/incidents/incident";
|
||||
|
||||
$estado = -1;
|
||||
|
||||
// add form filter values for group, priority, state, and search fields: user and text
|
||||
if ($grupo != -1)
|
||||
$url .= "&grupo=".$grupo;
|
||||
if ($prioridad != -1)
|
||||
$url .= "&prioridad=".$prioridad;
|
||||
if ($estado != -1)
|
||||
$url .= "&estado=".$estado;
|
||||
if ($usuario != '')
|
||||
$url .= "&usuario=".$usuario;
|
||||
if ($texto != '')
|
||||
$url .= "&texto=".$texto;
|
||||
|
||||
// Show pagination
|
||||
pagination ($count + $offset, $url, $offset, 15, false); //($count + $offset) it's real count of incidents because it's use LIMIT $offset in query.
|
||||
echo '<br />';
|
||||
|
||||
// Show headers
|
||||
$table->width = "100%";
|
||||
$table->class = "databox";
|
||||
$table->cellpadding = 4;
|
||||
$table->cellspacing = 4;
|
||||
$table->head = array ();
|
||||
$table->data = array ();
|
||||
$table->size = array ();
|
||||
$table->align = array ();
|
||||
|
||||
$table->head[0] = __('ID');
|
||||
$table->head[1] = __('Status');
|
||||
$table->head[2] = __('Incident');
|
||||
$table->head[3] = __('Priority');
|
||||
$table->head[4] = __('Group');
|
||||
$table->head[5] = __('Updated');
|
||||
$table->head[6] = __('Source');
|
||||
$table->head[7] = __('Owner');
|
||||
$table->head[8] = __('Action');
|
||||
|
||||
$table->size[0] = 43;
|
||||
$table->size[7] = 50;
|
||||
|
||||
$table->align[1] = "center";
|
||||
$table->align[3] = "center";
|
||||
$table->align[4] = "center";
|
||||
$table->align[8] = "center";
|
||||
|
||||
$rowPair = true;
|
||||
$iterator = 0;
|
||||
foreach ($result as $row) {
|
||||
if ($rowPair)
|
||||
$table->rowclass[$iterator] = 'rowPair';
|
||||
else
|
||||
$table->rowclass[$iterator] = 'rowOdd';
|
||||
$rowPair = !$rowPair;
|
||||
$iterator++;
|
||||
|
||||
$data = array();
|
||||
|
||||
$data[0] = '<a href="index.php?sec=incidencias&sec2=operation/incidents/incident_detail&id='.$row["id_incidencia"].'">'.$row["id_incidencia"].'</a>';
|
||||
$attach = get_incidents_attach ($row["id_incidencia"]);
|
||||
|
||||
if (!empty ($attach))
|
||||
$data[0] .= ' '.print_image ("images/attachment.png", true, array ("style" => "align:middle;"));
|
||||
|
||||
$data[1] = print_incidents_status_img ($row["estado"], true);
|
||||
$data[2] = '<a href="index.php?sec=incidencias&sec2=operation/incidents/incident_detail&id='.$row["id_incidencia"].'">'.substr(safe_output($row["titulo"]),0,45).'</a>';
|
||||
$data[3] = print_incidents_priority_img ($row["prioridad"], true);
|
||||
$data[4] = print_group_icon ($row["id_grupo"], true);
|
||||
$data[5] = print_timestamp ($row["actualizacion"], true);
|
||||
$data[6] = $row["origen"];
|
||||
$data[7] = print_username ($row["id_usuario"], true);
|
||||
|
||||
if (check_acl ($config["id_user"], $row["id_grupo"], "IM") || $config["id_user"] == $row["id_usuario"] || $config["id_user"] == $row["id_creator"]) {
|
||||
$data[8] = print_checkbox ("id_inc[]", $row["id_incidencia"], false, true);
|
||||
} else {
|
||||
$data[8] = '';
|
||||
switch ($_FILES['new_file']['error']) {
|
||||
case 1:
|
||||
echo '<h3 class="error">'.__('File is too big').'</h3>';
|
||||
break;
|
||||
case 3:
|
||||
echo '<h3 class="error">'.__('File was partially uploaded. Please try again').'</h3>';
|
||||
break;
|
||||
case 4:
|
||||
echo '<h3 class="error">'.__('No file was uploaded').'</h3>';
|
||||
break;
|
||||
default:
|
||||
echo '<h3 class="error">'.__('Generic upload error').'(Code: '.$_FILES['new_file']['error'].')</h3>';
|
||||
}
|
||||
|
||||
array_push ($table->data, $data);
|
||||
}
|
||||
}
|
||||
|
||||
$delete_file = get_parameter('delete_file', 0);
|
||||
|
||||
if($delete_file != 0) {
|
||||
$url = $integria_api."&op=delete_file¶ms=".$delete_file;
|
||||
|
||||
// Call the integria API
|
||||
$result = call_api($url);
|
||||
}
|
||||
|
||||
$delete_incident = get_parameter('delete_incident', 0);
|
||||
|
||||
if($delete_incident != 0) {
|
||||
$url = $integria_api."&op=delete_incident¶ms=".$delete_incident;
|
||||
|
||||
// Call the integria API
|
||||
$result = call_api($url);
|
||||
}
|
||||
|
||||
$create_workunit = get_parameter('create_workunit', 0);
|
||||
|
||||
if($create_workunit == 1) {
|
||||
$values[0] = $id_incident;
|
||||
$values[1] = str_replace(" ", "%20", safe_output(get_parameter('description')));
|
||||
$values[2] = get_parameter('time_used');
|
||||
$values[3] = get_parameter('have_cost');
|
||||
$values[4] = get_parameter('public');
|
||||
$values[5] = get_parameter('profile');
|
||||
|
||||
echo '<form method="post" action="'.$url.'&action=mass" style="margin-bottom: 0px;">';
|
||||
print_table ($table);
|
||||
echo '<div style="text-align:right; float:right; padding-right: 2px;">';
|
||||
echo '<b>'.__('Action').': </b>' ;
|
||||
if (check_acl ($config["id_user"], 0, "IW")) {
|
||||
print_submit_button (__('Delete incidents'), 'delete_btn', false, 'class="sub delete"');
|
||||
}
|
||||
$params = implode($token, $values);
|
||||
|
||||
$url = $integria_api."&op=create_workunit&token=".$token."¶ms=".$params;
|
||||
|
||||
if (check_acl ($config["id_user"], 0, "IM")) {
|
||||
print_submit_button (__('Become owner'), 'own_btn', false, 'class="sub upd"');
|
||||
// Call the integria API
|
||||
$result = call_api($url);
|
||||
}
|
||||
|
||||
// Set the url with parameters to call the api
|
||||
switch($tab) {
|
||||
case 'list':
|
||||
$search_string = get_parameter('search_string', "");
|
||||
$params[0] = $search_string;
|
||||
|
||||
$search_status = get_parameter('search_status', -10);
|
||||
$params[1] = $search_status;
|
||||
|
||||
$search_group = get_parameter('search_group', 1);
|
||||
$params[2] = $search_group;
|
||||
|
||||
$params = implode($token,$params);
|
||||
|
||||
$url = $integria_api."&op=get_incidents&token=".$token."¶ms=".$params;
|
||||
$url_resolutions = $integria_api."&op=get_incidents_resolutions";
|
||||
$url_status = $integria_api."&op=get_incidents_status";
|
||||
$url_groups = $integria_api."&op=get_groups¶ms=1";
|
||||
break;
|
||||
case 'incident':
|
||||
$url = $integria_api."&op=get_incident_details¶ms=".$id_incident;
|
||||
case 'editor':
|
||||
$url_resolutions = $integria_api."&op=get_incidents_resolutions";
|
||||
$url_status = $integria_api."&op=get_incidents_status";
|
||||
$url_sources = $integria_api."&op=get_incidents_sources";
|
||||
$url_groups = $integria_api."&op=get_groups¶ms=0";
|
||||
$url_users = $integria_api."&op=get_users";
|
||||
break;
|
||||
case 'workunits':
|
||||
$url = $integria_api."&op=get_incident_workunits¶ms=".$id_incident;
|
||||
break;
|
||||
case 'files':
|
||||
$url = $integria_api."&op=get_incident_files¶ms=".$id_incident;
|
||||
break;
|
||||
case 'tracking':
|
||||
$url = $integria_api."&op=get_incident_tracking¶ms=".$id_incident;
|
||||
break;
|
||||
}
|
||||
|
||||
if(isset($url)) {
|
||||
// Call the integria API
|
||||
$xml = call_api($url);
|
||||
}
|
||||
else {
|
||||
$xml = "<xml></xml>";
|
||||
}
|
||||
|
||||
// If is a valid XML, parse it
|
||||
if(xml_parse(xml_parser_create(), $xml)) {
|
||||
$result = xml_to_array($xml);
|
||||
if($result == false) {
|
||||
$result = array();
|
||||
}
|
||||
switch($tab) {
|
||||
case 'list':
|
||||
$result_resolutions = xml_to_array(call_api($url_resolutions));
|
||||
$result_status = xml_to_array(call_api($url_status));
|
||||
$result_groups = xml_to_array(call_api($url_groups));
|
||||
require_once('incident.list.php');
|
||||
break;
|
||||
case 'editor':
|
||||
case 'incident':
|
||||
$result_resolutions = xml_to_array(call_api($url_resolutions));
|
||||
$result_status = xml_to_array(call_api($url_status));
|
||||
$result_sources = xml_to_array(call_api($url_sources));
|
||||
$result_groups = xml_to_array(call_api($url_groups));
|
||||
$result_users = xml_to_array(call_api($url_users));
|
||||
|
||||
require_once('incident.incident.php');
|
||||
break;
|
||||
case 'workunits':
|
||||
require_once('incident.workunits.php');
|
||||
break;
|
||||
case 'files':
|
||||
require_once('incident.files.php');
|
||||
break;
|
||||
case 'tracking':
|
||||
require_once('incident.tracking.php');
|
||||
break;
|
||||
}
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
unset ($table);
|
||||
}
|
||||
echo '<br><br>';
|
||||
if (check_acl ($config["id_user"], 0, "IW")) {
|
||||
echo '<div style="text-align:right; float:right; padding-right: 2px;">';
|
||||
echo '<form method="post" action="index.php?sec=incidencias&sec2=operation/incidents/incident_detail&insert_form=1">';
|
||||
print_submit_button (__('Create incident'), 'crt', false, 'class="sub next"');
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
|
||||
echo '<div style="clear:both"> </div>';
|
||||
?>
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// 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
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
global $result;
|
||||
|
||||
$table->width = "98%";
|
||||
$table->class = "databox";
|
||||
|
||||
$table->head[0] = __('Description');
|
||||
$table->head[1] = __('User');
|
||||
$table->head[2] = __('Date');
|
||||
|
||||
$table->data = array();
|
||||
|
||||
if(isset($result['tracking'][0]) && is_array($result['tracking'][0])){
|
||||
$tracking = $result['tracking'];
|
||||
}
|
||||
else {
|
||||
$tracking = $result;
|
||||
}
|
||||
|
||||
$row = 0;
|
||||
foreach($tracking as $value) {
|
||||
|
||||
$table->data[$row][0] = $value['description'];
|
||||
$table->data[$row][1] = $value['id_user'];
|
||||
$table->data[$row][2] = $value['timestamp'];
|
||||
$row++;
|
||||
}
|
||||
|
||||
print_table($table);
|
||||
|
||||
?>
|
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// 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
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
global $result;
|
||||
global $id_incident;
|
||||
|
||||
$table->width = "98%";
|
||||
$table->class = "databox";
|
||||
|
||||
$table->data = array();
|
||||
$table->colspan[1][0] = 3;
|
||||
|
||||
$profiles = array();
|
||||
$default_time = "0.25";
|
||||
$table->data[0][0] = "<b>".__('Time used')."</b><br/>".print_input_text ('time_used', $default_time, '', 10, 255, true);
|
||||
$table->data[0][1] = "<b>".__('Have cost')."</b><br/>".print_checkbox ('have_cost', '', false, true);
|
||||
$table->data[0][2] = "<b>".__('Public')."</b><br/>".print_checkbox ('public', '', true, true);
|
||||
|
||||
$table->data[1][0] = "<b>".__('Description')."</b><br/>".print_textarea('description', 3, 6, '' , '', true);
|
||||
|
||||
$form = "<form method='post' action=''>";
|
||||
$form .= print_table($table, true);
|
||||
$form .= print_submit_button(__('Add'), 'submit_button', false, '', true);
|
||||
$form .= print_input_hidden('tab', 'workunits', true);
|
||||
$form .= print_input_hidden('create_workunit', '1', true);
|
||||
$form .= print_input_hidden('id_incident', $id_incident, true);
|
||||
$form .= print_input_hidden('profile', '0', true);
|
||||
$form .= "</form>";
|
||||
|
||||
toggle($form, __('Add workunit'));
|
||||
|
||||
if(isset($result['workunit'][0]) && is_array($result['workunit'][0])){
|
||||
$workunits = $result['workunit'];
|
||||
}
|
||||
else {
|
||||
$workunits = $result;
|
||||
}
|
||||
|
||||
foreach($workunits as $value) {
|
||||
$table->width = "98%";
|
||||
$table->class = "databox";
|
||||
$table->colspan[1][0] = 4;
|
||||
$table->size[0] = "80%";
|
||||
$table->size[1] = "20%";
|
||||
|
||||
$table->data = array();
|
||||
|
||||
$table->data[0][0] = $value['id_user']." ".__('said')." ".$value['timestamp'];
|
||||
$table->data[0][1] = $value['duration']." ".__('Hours')." ".__('Public').": ".$value['public'];
|
||||
|
||||
$table->data[1][0] = $value['description'];
|
||||
|
||||
print_table($table);
|
||||
}
|
||||
?>
|
|
@ -161,8 +161,15 @@ enterprise_hook ('inventory_menu');
|
|||
|
||||
//Incidents
|
||||
if (check_acl ($config['id_user'], 0, "IR") == 1) {
|
||||
if($config['integria_enabled']) {
|
||||
$sec2 = "operation/integria_incidents/incident";
|
||||
}
|
||||
else {
|
||||
$sec2 = "operation/incidents/incident";
|
||||
}
|
||||
|
||||
$menu["incidencias"]["text"] = __('Manage incidents');
|
||||
$menu["incidencias"]["sec2"] = "operation/incidents/incident";
|
||||
$menu["incidencias"]["sec2"] = $sec2;
|
||||
$menu["incidencias"]["refr"] = 0;
|
||||
$menu["incidencias"]["id"] = "oper-incidents";
|
||||
|
||||
|
|
|
@ -74,8 +74,11 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
|
|||
('gis_purge', 15),
|
||||
('sound_alert', 'include/sounds/air_shock_alarm.wav'),
|
||||
('sound_critical', 'include/sounds/Star_Trek_emergency_simulation.wav'),
|
||||
('sound_warning', 'include/sounds/negativebeep.wav');
|
||||
|
||||
('sound_warning', 'include/sounds/negativebeep.wav'),
|
||||
('integria_enabled', '0'),
|
||||
('integria_api_password', ''),
|
||||
('integria_inventory', '0'),
|
||||
('integria_url', '');
|
||||
|
||||
UNLOCK TABLES;
|
||||
|
||||
|
|
Loading…
Reference in New Issue