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 |
| 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 = ' '; |
| 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=\"<\" 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=\">\" 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> |
wdenk | b00ec16 | 2003-06-19 23:40:20 +0000 | [diff] [blame^] | 76 | <th>who</th> |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 77 | <th width="70%">details</th> |
| 78 | </tr> |
| 79 | <?php |
| 80 | $r=mysql_query("select * from log where serno=$serno order by logno limit $offset,$limit"); |
| 81 | |
| 82 | while($row=mysql_fetch_array($r)){ |
| 83 | echo "<tr>\n"; |
| 84 | print_cell("<a href=\"edlog.php?serno=$row[serno]&logno=$row[logno]\">$row[logno]</a>"); |
| 85 | print_cell($row['date']); |
wdenk | b00ec16 | 2003-06-19 23:40:20 +0000 | [diff] [blame^] | 86 | print_cell($row['who']); |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 87 | print_cell("<pre>" . urldecode($row['details']) . "</pre>"); |
| 88 | echo "</tr>\n"; |
| 89 | } |
| 90 | |
| 91 | mysql_free_result($r); |
| 92 | ?> |
| 93 | </table> |
| 94 | <hr></hr> |
| 95 | <p></p> |
| 96 | <table width="100%"> |
| 97 | <tr> |
| 98 | <td align=center> |
| 99 | <a href="newlog.php?serno=<?php echo "$serno"; ?>">Add to Log</a> |
| 100 | </td> |
| 101 | <td align=center> |
| 102 | <a href="index.php">Back to Start</a> |
| 103 | </td> |
| 104 | </tr> |
| 105 | </table> |
| 106 | <?php |
| 107 | pg_foot(); |
| 108 | ?> |