#!/usr/bin/perl
#
# PIX Logging Architecture
# [ Kristof Philipsen ]
#
# This file is part of PIX Logging Architecture
#
# PIX Logging Architecture 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; either version 2 of the License, or
# (at your option) any later version.
#
# PIX Logging Architecture 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.
#
# You should have received a copy of the GNU General Public License
# along with Foobar; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

                                                                                                                                                                                                  
use DBI;
use CGI;
                                                                                                                                                                                                  
#
# include configuration
#
require "conf.pl";      # General Configuration
require "subs.pl";      # Subroutines
                                                                                                                                                                                                  
#
# Make Database Connection
#
db_connect();
                                                                                                                                                                                                  
#
# Get CGI Parameters
#
$query = new CGI;
$id = $query->param("id");
                                                                                                                                                                                                  
#
# HTML SECTION
#
printtitle();
                                                                                                                                                                                                  
print <<EOF;
<span class='titlehead'><b>PIX Event Management > Edit Incident</b></span>
<br><br><br>
EOF
$getAllEvents = "SELECT incident_id, incident_entry_time, incident_status, incident_update_time, incident_name, incident_severity, incident_handler, incident_description FROM event_management_data where incident_id like \"$id\"";
$statement2 = $db_handle->prepare($getAllEvents) or die "Couldn't prepare query '$getAllEvents': $DBI::errstr\n";
$statement2->execute();
while (($incident_id, $incident_entry_time, $incident_status, $incident_update_time, $incident_name, $incident_severity, $incident_handler, $incident_description) = $statement2->fetchrow) {
print <<EOF;
<form action="./pix_event_edit_process" method="post">
<input type="hidden" name="id" value="$id">
<table width="700" cellpadding="0" cellspacing="0" border="0">
<td width="200"><span class="main">Incident Name:</span></td>
<td width="300"><span class="main"><input type="text" name="incident_name" size="60" width="50" value="$incident_name"><span class="main"></td>
<tr>
<td width="200"><span class="main">Incident Handler:</span></td>
<td width="300"><span class="main"><input type="text" name="incident_handler" size="60" width="50" value="$incident_handler"><span class="main"></td>
<tr>
<td width="200"><span class="main">Incident Severity:</span></td>
<td width="300"><span class="main">
<select name="incident_severity">
<option selected value="$incident_severity">$incident_severity
<option>
<option value="Low">Low
<option value="Medium">Medium
<option value="High">High
</td>
<tr>
<td width="200"><span class="main">Incident Status:</span></td>
<td width="300"><span class="main">
<select name="incident_status">
<option selected value="$incident_status">$incident_status
<option>
<option value="Open">Open
<option value="Closed">Closed
<option value="Deferred">Deferred
</select>
</td>
<tr>
<td width="200"><span class="main">Incident Description:</span></td>
<td width="300"><span class="main"><textarea name="incident_description" rows="10" cols="85" scrollable="no" multiline="true">$incident_description</textarea><span class="main"></td>
</table>
<input type="submit" value="Update">
</form>
EOF
}
$db_handle->disconnect();

