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