Rev 51 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
<?php
include_once( '../../header.php' );
include_once( './functions.php' );
include_once( '../../includes/functions.php' );
define( DEBUG, true );
if ( isset( $_POST["submit"] ) && $_POST["submit"] == 'Save Modifications' ) {
$str = overwriteLicense( $_REQUEST['license_id'], $_REQUEST['client_id'], $_REQUEST['device_id'], $_REQUEST['license_product_id'], $_REQUEST['license'], $_REQUEST['added_date'], $_REQUEST['removed_date'], true );
header('Location: index.html');
}
// make them go back to the index page if they access this directly
if ( ! isset( $_REQUEST[ 'license_id'] ) ) header('Location: index.html');
$adding = $_REQUEST[ 'license_id'] == -1;
if ( ! $adding ) {
$currentLicense = queryDatabaseExtended( 'select * from license where license_id = ' . makeSafeSQLValue( $_REQUEST['license_id'] ) );
$currentLicense = $currentLicense['data'][0];
}
?>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Computer Asset Management Program - License - Edit</title>
<link rel="stylesheet" type="text/css" href="../../camp.css">
</head>
<body>
<?php include_once('../../menu.php'); ?>
<div id="content">
<?php print $str; ?>
<?php if ( $adding ) { # we are adding ?>
<h1 align='center'>Adding new license</h1>
<h2 align='center'>Warning: Inputs not validated. Use Caution</h2>
<?php } else { ?>
<h1 align='center'>Warning: Edits are not validated. Use Caution.</h1>
<h2 align='center'>Only use this to correct mistakes, not to move a license</h2>
<?php } // if..else
if ( DEBUG ) { print '<pre>'; print_r( $currentLicense ); print '</pre>'; } ?>
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" enctype="multipart/form-data">
<input type='hidden' name='license_id' value='<?php print $adding ? 'null' : $_REQUEST[ 'license_id']; ?>' />
<table border='1'>
<tr>
<td>Client</td>
<td>
<select name='client_id'>
<?php print queryToSelect( getClients() , $adding ? '' : $currentLicense['client_id'] ); ?>
</select>
</td>
</tr>
<tr>
<td>Machine</td>
<td>
<select name='device_id'>
<?php
if ( $adding || ! $currentLicense['device_id'] )
print "<option value=-1 selected>Available</option>\n";
else {
print "<option value=-1>Available</option>\n";
}
print queryToSelect( getAllDevices() , $adding ? '' : $currentLicense['device_id']); ?>
</select>
</td>
</tr>
<tr>
<td>Product</td>
<td>
<select name='license_product_id'>
<?php print queryToSelect( 'select license_product_id,name from license_product order by name', $adding ? '' : $currentLicense['license_product_id']); ?>
</select>
</td>
</tr>
<tr>
<td>License</td>
<td>
<textarea name='license' cols="50" rows="2"><?php print $adding ? '' : $currentLicense['license']; ?></textarea>
</td>
</tr>
<tr>
<td>Added Date (YYYY-MM-DD)</td>
<td>
<input type=text name='added_date' value='<?php print $adding ? '' : $currentLicense['added_date']; ?>' />
</td>
</tr>
<tr>
<td>Removed Date (YYYY-MM-DD)</td>
<td>
<input type=text name='removed_date' value='<?php print $adding ? '' : $currentLicense['removed_date']; ?>' />
</td>
</tr>
<tr>
<td colspan='2' align='center'><input type="submit" value="Save Modifications" name="submit"></td>
</tr>
</table>
</div>
</body>
</html>