1 <?php
// php pages made with phpMyBuilder <http://kyber.dk/phpMyBuilder> ?>
4 // Murray Jensen <Murray.Jensen@csiro.au>
5 // CSIRO Manufacturing Science and Technology, Preston Lab
7 // list page (hymod_bddb / boards)
11 $serno=isset($_REQUEST['serno'])?
$_REQUEST['serno']:'';
13 $verbose=isset($_REQUEST['verbose'])?
intval($_REQUEST['verbose']):0;
15 pg_head("$bddb_label - Browse database" . ($verbose?
" (verbose)":""));
19 $limit=isset($_REQUEST['limit'])?
abs(intval($_REQUEST['limit'])):20;
20 $offset=isset($_REQUEST['offset'])?
abs(intval($_REQUEST['offset'])):0;
24 $lr=mysql_query("select count(*) as n from boards");
25 $lrow=mysql_fetch_array($lr);
27 if($lrow['n']>$limit){
28 $preoffset=max(0,$offset-$limit);
29 $postoffset=$offset+
$limit;
30 echo "<table width=\"100%\">\n<tr>\n";
31 printf("<td align=left><%sa href=\"%s?submit=Browse&offset=%d&verbose=%d\"><img border=0 alt=\"<\" src=\"/icons/left.gif\"></a></td>\n", $offset>0?
"":"no", $PHP_SELF, $preoffset, $verbose);
32 printf("<td align=right><%sa href=\"%s?submit=Browse&offset=%d&verbose=%d\"><img border=0 alt=\">\" src=\"/icons/right.gif\"></a></td>\n", $postoffset<$lrow['n']?
"":"no", $PHP_SELF, $postoffset, $offset);
33 echo "</tr>\n</table>\n";
36 mysql_free_result($lr);
39 <table align
=center border
=1 cellpadding
=10>
51 echo "<th>comments</th>\n";
52 echo "<th>sdram</th>\n";
53 echo "<th>flash</th>\n";
54 echo "<th>zbt</th>\n";
55 echo "<th>xlxtyp</th>\n";
56 echo "<th>xlxspd</th>\n";
57 echo "<th>xlxtmp</th>\n";
58 echo "<th>xlxgrd</th>\n";
59 echo "<th>cputyp</th>\n";
60 echo "<th>cpuspd</th>\n";
61 echo "<th>cpmspd</th>\n";
62 echo "<th>busspd</th>\n";
63 echo "<th>hstype</th>\n";
64 echo "<th>hschin</th>\n";
65 echo "<th>hschout</th>\n";
70 $query = "select * from boards";
73 foreach (preg_split("/[\s,]+/", $serno) as $s) {
74 if (preg_match('/^[0-9]+$/',$s))
75 $query .= $pre . "serno=" . $s;
76 else if (preg_match('/^([0-9]+)-([0-9]+)$/',$s,$m)) {
77 $m1 = intval($m[1]); $m2 = intval($m[2]);
79 die("bad serial number range ($s)");
80 $query .= $pre . "(serno>=$m[1] and serno<=$m[2])";
83 die("illegal serial number ($s)");
87 $query .= " order by serno";
89 $query .= " limit $offset,$limit";
91 $r = mysql_query($query);
93 function print_cell($str) {
96 echo "\t<td>$str</td>\n";
99 while($row=mysql_fetch_array($r)){
100 foreach ($columns as $key) {
101 if (!key_in_array($key, $row))
106 print_cell("<a href=\"brlog.php?serno=$row[serno]\">Log</a>");
107 print_cell("<a href=\"edit.php?serno=$row[serno]\">$row[serno]</a>");
108 print_cell($row['ethaddr']);
109 print_cell($row['date']);
110 print_cell($row['batch']);
111 print_cell($row['type']);
112 print_cell($row['rev']);
113 print_cell($row['location']);
115 print_cell("<pre>\n" . urldecode($row['comments']) .
117 print_cell(gather_enum_multi_print("sdram", 4, $row));
118 print_cell(gather_enum_multi_print("flash", 4, $row));
119 print_cell(gather_enum_multi_print("zbt", 16, $row));
120 print_cell(gather_enum_multi_print("xlxtyp", 4, $row));
121 print_cell(gather_enum_multi_print("xlxspd", 4, $row));
122 print_cell(gather_enum_multi_print("xlxtmp", 4, $row));
123 print_cell(gather_enum_multi_print("xlxgrd", 4, $row));
124 print_cell($row['cputyp']);
125 print_cell($row['cpuspd']);
126 print_cell($row['cpmspd']);
127 print_cell($row['busspd']);
128 print_cell($row['hstype']);
129 print_cell($row['hschin']);
130 print_cell($row['hschout']);
139 <td align
=center
><?php
140 printf("<a href=\"%s?submit=Browse&offset=%d&verbose=%d%s\">%s Listing</a>\n", $PHP_SELF, $offset, $verbose?
0:1, $serno!=''?
"&serno=$serno":'', $verbose?
"Terse":"Verbose");
142 <td align
=center
><a href
="index.php">Back to Start
</a
></td
>