wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 1 | <?php // php pages made with phpMyBuilder <http://kyber.dk/phpMyBuilder> ?> |
| 2 | <?php |
| 3 | // (C) Copyright 2001 |
Wolfgang Denk | 2c9dfca | 2005-08-12 23:20:59 +0200 | [diff] [blame] | 4 | // Murray Jensen <Murray.Jensen@csiro.au> |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 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 | |
Wolfgang Denk | 804ecb1 | 2005-08-12 23:27:18 +0200 | [diff] [blame^] | 13 | $serno=intval($serno); |
| 14 | if ($serno == 0) |
| 15 | die("serial number not specified or invalid!"); |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 16 | |
| 17 | function print_cell($str) { |
| 18 | if ($str == '') |
| 19 | $str = ' '; |
| 20 | echo "\t<td>$str</td>\n"; |
| 21 | } |
| 22 | ?> |
| 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"); |
| 35 | |
| 36 | while($row=mysql_fetch_array($r)){ |
| 37 | foreach ($columns as $key) { |
| 38 | if (!key_in_array($key, $row)) |
| 39 | $row[$key] = ''; |
| 40 | } |
| 41 | |
| 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"; |
| 51 | } |
| 52 | |
| 53 | mysql_free_result($r); |
| 54 | ?> |
| 55 | </table> |
| 56 | <hr></hr> |
| 57 | <p></p> |
| 58 | <?php |
Wolfgang Denk | 804ecb1 | 2005-08-12 23:27:18 +0200 | [diff] [blame^] | 59 | $limit=abs(isset($_REQUEST['limit'])?$_REQUEST['limit']:20); |
| 60 | $offset=abs(isset($_REQUEST['offset'])?$_REQUEST['offset']:0); |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 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"; |
Wolfgang Denk | 804ecb1 | 2005-08-12 23:27:18 +0200 | [diff] [blame^] | 67 | printf("<td><%sa href=\"%s?submit=Log&serno=$serno&offset=%d\"><img border=0 alt=\"<\" 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=\">\" src=\"/icons/right.gif\"></a></td>\n", $postoffset<$lrow['n']?"":"no", $PHP_SELF, $postoffset); |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 69 | echo "</tr>\n</table>\n"; |
| 70 | } |
| 71 | mysql_free_result($lr); |
| 72 | ?> |
| 73 | <table width="100%" border=1 cellpadding=10> |
| 74 | <tr valign=top> |
| 75 | <th>logno / edit</th> |
| 76 | <th>date</th> |
wdenk | b00ec16 | 2003-06-19 23:40:20 +0000 | [diff] [blame] | 77 | <th>who</th> |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 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"); |
| 82 | |
| 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']); |
wdenk | b00ec16 | 2003-06-19 23:40:20 +0000 | [diff] [blame] | 87 | print_cell($row['who']); |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 88 | print_cell("<pre>" . urldecode($row['details']) . "</pre>"); |
| 89 | echo "</tr>\n"; |
| 90 | } |
| 91 | |
| 92 | mysql_free_result($r); |
| 93 | ?> |
| 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(); |
| 109 | ?> |