]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - tools/bddb/brlog.php
Initial revision
[karo-tx-uboot.git] / tools / bddb / brlog.php
1 <?php // php pages made with phpMyBuilder <http://kyber.dk/phpMyBuilder> ?>
2 <?php
3         // (C) Copyright 2001
4         // Murray Jensen <Murray.Jensen@cmst.csiro.au>
5         // CSIRO Manufacturing Science and Technology, Preston Lab
6
7         // list page (hymod_bddb / boards)
8
9         require("defs.php");
10
11         pg_head("$bddb_label - Browse Board Log");
12
13         if (!isset($serno) || $serno == 0)
14                 die("serial number not specified!");
15
16         function print_cell($str) {
17                 if ($str == '')
18                         $str = '&nbsp;';
19                 echo "\t<td>$str</td>\n";
20         }
21 ?>
22 <table align=center border=1 cellpadding=10>
23 <tr>
24 <th>serno / edit</th>
25 <th>ethaddr</th>
26 <th>date</th>
27 <th>batch</th>
28 <th>type</th>
29 <th>rev</th>
30 <th>location</th>
31 </tr>
32 <?php
33         $r=mysql_query("select * from boards where serno=$serno");
34
35         while($row=mysql_fetch_array($r)){
36                 foreach ($columns as $key) {
37                         if (!key_in_array($key, $row))
38                                 $row[$key] = '';
39                 }
40
41                 echo "<tr>\n";
42                 print_cell("<a href=\"edit.php?serno=$row[serno]\">$row[serno]</a>");
43                 print_cell($row['ethaddr']);
44                 print_cell($row['date']);
45                 print_cell($row['batch']);
46                 print_cell($row['type']);
47                 print_cell($row['rev']);
48                 print_cell($row['location']);
49                 echo "</tr>\n";
50         }
51
52         mysql_free_result($r);
53 ?>
54 </table>
55 <hr></hr>
56 <p></p>
57 <?php
58         $limit=abs(isset($limit)?$limit:20);
59         $offset=abs(isset($offset)?$offset:0);
60         $lr=mysql_query("select count(*) as n from log where serno=$serno");
61         $lrow=mysql_fetch_array($lr);
62         if($lrow['n']>$limit){
63                 $preoffset=max(0,$offset-$limit);
64                 $postoffset=$offset+$limit;
65                 echo "<table width=\"100%\">\n<tr align=center>\n";
66                 printf("<td><%sa href=\"%s?serno=$serno&offset=%d\"><img border=0 alt=\"&lt;\" src=\"/icons/left.gif\"></a></td>\n", $offset>0?"":"no", $PHP_SELF, $preoffset);
67                 printf("<td><%sa href=\"%s?serno=$serno&offset=%d\"><img border=0 alt=\"&gt;\" src=\"/icons/right.gif\"></a></td>\n", $postoffset<$lrow['n']?"":"no", $PHP_SELF, $postoffset);
68                 echo "</tr>\n</table>\n";
69         }
70         mysql_free_result($lr);
71 ?>
72 <table width="100%" border=1 cellpadding=10>
73 <tr valign=top>
74 <th>logno / edit</th>
75 <th>date</th>
76 <th width="70%">details</th>
77 </tr>
78 <?php
79         $r=mysql_query("select * from log where serno=$serno order by logno limit $offset,$limit");
80
81         while($row=mysql_fetch_array($r)){
82                 echo "<tr>\n";
83                 print_cell("<a href=\"edlog.php?serno=$row[serno]&logno=$row[logno]\">$row[logno]</a>");
84                 print_cell($row['date']);
85                 print_cell("<pre>" . urldecode($row['details']) . "</pre>");
86                 echo "</tr>\n";
87         }
88
89         mysql_free_result($r);
90 ?>
91 </table>
92 <hr></hr>
93 <p></p>
94 <table width="100%">
95 <tr>
96   <td align=center>
97     <a href="newlog.php?serno=<?php echo "$serno"; ?>">Add to Log</a>
98   </td>
99   <td align=center>
100     <a href="index.php">Back to Start</a>
101   </td>
102 </tr>
103 </table>
104 <?php
105         pg_foot();
106 ?>