Subversion Repositories computer_asset_manager_v1

Rev

Rev 47 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
47 rodolico 1
<?php 
2
   include_once( '../../header.php' );
3
   define( DEBUG, true );
4
   if ( isset( $_POST["submit"] ) && $_POST["submit"] == 'Save Modifications' ) {
51 rodolico 5
      $str = overwriteLicense( $_REQUEST['license_id'], $_REQUEST['client_id'], $_REQUEST['device_id'], $_REQUEST['license_product_id'], $_REQUEST['license'], $_REQUEST['added_date'], $_REQUEST['removed_date'], true  );
47 rodolico 6
      header('Location: index.html');
7
   }
8
   // make them go back to the index page if they access this directly
9
   if ( ! isset( $_REQUEST[ 'license_id'] ) ) header('Location: index.html');
10
   $adding = $_REQUEST[ 'license_id'] == -1;
11
   if ( ! $adding ) {
12
      $currentLicense = queryDatabaseExtended( 'select * from license where license_id = ' . makeSafeSQLValue( $_REQUEST['license_id'] ) );
13
      $currentLicense = $currentLicense['data'][0];
14
   }
15
?>
16
<?xml version="1.0" encoding="utf-8"?>
17
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
18
<html xmlns="http://www.w3.org/1999/xhtml">
19
   <head>
20
      <title>Computer Asset Management Program - License - Edit</title>
21
      <link rel="stylesheet" type="text/css" href="../../camp.css">
22
   </head>
23
   <body>
24
      <?php include_once('../../menu.php'); ?>
25
      <div id="content">
51 rodolico 26
         <?php print $str; ?>
27
         <?php if ( $adding ) { # we are adding ?>
28
            <h1 align='center'>Adding new license</h1>
29
            <h2 align='center'>Warning: Inputs not validated. Use Caution</h2>
30
         <?php } else { ?>
31
            <h1 align='center'>Warning: Edits are not validated. Use Caution.</h1>
32
            <h2 align='center'>Only use this to correct mistakes, not to move a license</h2>
33
      <?php } // if..else
34
            if ( DEBUG ) { print '<pre>'; print_r( $currentLicense ); print '</pre>'; } ?>
47 rodolico 35
      <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" enctype="multipart/form-data">
51 rodolico 36
         <input type='hidden' name='license_id' value='<?php print $adding ? 'null' : $_REQUEST[ 'license_id']; ?>' />
47 rodolico 37
         <table border='1'>
38
            <tr>
39
               <td>Client</td>
40
               <td>
41
                  <select name='client_id'>
42
                  <?php print queryToSelect( 'select client_id,name from client where removed_date is null order by name', $adding ? '' : $currentLicense['client_id'] ); ?>
43
                  </select>
44
               </td>
45
            </tr>
46
            <tr>
47
               <td>Machine</td>
48
               <td>
49
                  <select name='device_id'>
50
                  <?php 
51
                  if ( $adding || ! $currentLicense['device_id'] )
52
                     print "<option value=-1 selected>Available</option>\n";
53
                  else {
54
                     print "<option value=-1>Available</option>\n";
55
                  }
56
                  print queryToSelect( "select device.device_id,device.name from device where device_type_id in (select device_type_id from device_type where show_as_system = 'Y') order by device.name", $adding ? '' : $currentLicense['device_id']); ?>
57
                  </select>
58
               </td>
59
            </tr>
60
            <tr>
61
               <td>Product</td>
62
               <td>
63
                  <select name='license_product_id'>
64
                  <?php print queryToSelect( 'select license_product_id,name from license_product order by name', $adding ? '' : $currentLicense['license_product_id']); ?>
65
                  </select>
66
               </td>
67
            </tr>
68
            <tr>
69
               <td>License</td>
70
               <td>
71
                  <textarea name='license' cols="50" rows="2"><?php print $adding ? '' : $currentLicense['license']; ?></textarea>
72
               </td>
73
            </tr>
74
            <tr>
75
               <td>Added Date (YYYY-MM-DD)</td>
76
               <td>
77
                  <input type=text name='added_date' value='<?php print $adding ? '' : $currentLicense['added_date']; ?>' />
78
               </td>
79
            </tr>
80
            <tr>
81
               <td>Removed Date (YYYY-MM-DD)</td>
82
               <td>
83
                  <input type=text name='removed_date' value='<?php print $adding ? '' : $currentLicense['removed_date']; ?>' />
84
               </td>
85
            </tr>
86
            <tr>
87
               <td colspan='2' align='center'><input type="submit" value="Save Modifications" name="submit"></td>
88
            </tr>
89
         </table>
90
      </div>
91
   </body>
92
</html>