Subversion Repositories computer_asset_manager_v1

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 rodolico 1
<?php 
2
   include_once( './sysinfo.php' );
3
   include_once( '../../header.php' ); 
4
   if (UnknownEntries() == 0) { // we are through with the processing
5
      redirectPage('index.html');
6
   } elseif ($_POST['action'] == 'client') { // They want to process some clients
7
      $results = processUnknownClients();
8
   } elseif ($_POST['action'] == 'device') { // processing some devices
9
      $results = processUnknownDevices();
10
   }
11
?>
12
<?xml version="1.0" encoding="utf-8"?>
13
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
14
<html xmlns="http://www.w3.org/1999/xhtml">
15
  <head>
16
    <title>Computer Asset Management Program - SysInfo</title>
17
    <link rel="stylesheet" type="text/css" href="../../camp.css">
18
  </head>
19
  <body>
20
    <?php include_once('../../menu.php'); ?>
21
    <div id="content">
22
      <h1>
23
         Process Unknown Entries
24
      </h1>
25
      <FORM action="<?php print $_SERVER['PHP_SELF']; ?>" method="POST" enctype="multipart/form-data">
26
         <table border="1" align="center">
27
            <?php
28
               $query = 'select min(unknown_entry_id) entry,client_name from unknown_entry where client_name not in (select name from client union select alias from client_alias) and processed_date is null group by client_name';
29
               $data = queryDatabaseExtended( $query );
30
               if ( $data['count'] ) {
31
            ?>
32
            <input type='hidden' name='action' value='client' />
33
            <caption>Process Unknown Clients</caption>
34
            <thead>
35
               <tr>
36
                  <th>New</th>
37
                  <th>Alias For</th>
38
                  <th>Entry</th>
39
               </tr>
40
            </thead>
41
            <tbody>
42
               <?php
43
                  foreach ($data['data'] as $thisRow => $values) {
44
               ?>
45
               <tr>
46
                  <td>
47
                     <input type="checkbox" name="new_<?php print $values['entry']; ?>" />
48
                  </td>
49
                  <td>
50
                     <select name="alias_for_<?php print $values['entry']; ?>">
51
                        <option selected="selected" value='0'>Not an Alias</option>
52
                        <?php print queryToSelect('select client_id,name from client order by name'); ?>
53
                     </select>
54
                  </td>
55
                  <td>
56
                     <?php print $values['client_name']; ?>
57
                  </td>
58
               </tr>
59
               <?php 
60
                     } // foreach
61
                  } else { // no clients, so let's look for new devices
62
                     $query = 'select min(unknown_entry_id) entry, min(report_date) reported, client_name, device_name 
63
                               from unknown_entry 
64
                               where processed_date is null 
65
                               group by client_name,device_name 
66
                               order by client_name,device_name, reported';
67
                     $data = queryDatabaseExtended( $query );
68
                     if ( $data['count'] ) { 
69
            ?>
70
            <input type='hidden' name='action' value='device' />
71
            <caption>Process Unknown Devices</caption>
72
            <thead>
73
               <tr>
74
                  <th>New</th>
75
                  <th>Alias For</th>
76
                  <th>Client Name</th>
77
                  <th>Initial Report Date</th>
78
                  <th>Entry</th>
79
               </tr>
80
            </thead>
81
            <tbody>
82
               <?php
83
                  foreach ($data['data'] as $thisRow => $values) {
84
               ?>
85
               <tr>
86
                  <td>
87
                     <input type="checkbox" name="new_<?php print $values['entry']; ?>" />
88
                  </td>
89
                  <td>
90
                     <select name="alias_for_<?php print $values['entry']; ?>">
91
                        <option selected="selected" value='0'>Not an Alias</option>
92
                        <?php print queryToSelect("select device_id,device.name from device join device_type using (device_type_id) where device_type.show_as_system = 'Y' order by name"); ?>
93
                     </select>
94
                  </td>
95
                  <td>
96
                     <?php print $values['client_name']; ?>
97
                  </td>
98
                  <td>
99
                     <?php print $values['reported']; ?>
100
                  </td>
101
                  <td>
102
                     <?php print $values['device_name']; ?>
103
                  </td>
104
               </tr>
105
               <?php 
106
                      } // foreach
107
                   } // if data['count']
108
                } // if..else 
109
               ?>
110
               <tr>
111
                  <td colspan="5" align="center">
112
                     <input name='Submit' type="submit" />
113
                  </td>
114
               </tr>
115
           </tbody>
116
        </table>
117
      </form>
118
    </div>
119
  </body>
120
</html>