b7cd5089510e507a45962f5875c84889089e5c66
[oweals/u-boot.git] / tools / bddb / browse.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         if (!isset($verbose))
12                 $verbose = 0;
13
14         if (!isset($serno))
15                 $serno = 0;
16
17         pg_head("$bddb_label - Browse database" . ($verbose?" (verbose)":""));
18 ?>
19 <p></p>
20 <?php
21         if ($serno == 0) {
22                 $limit=abs(isset($limit)?$limit:20);
23                 $offset=abs(isset($offset)?$offset:0);
24                 $lr=mysql_query("select count(*) as n from boards");
25                 $lrow=mysql_fetch_array($lr);
26                 if($lrow['n']>$limit){
27                         $preoffset=max(0,$offset-$limit);
28                         $postoffset=$offset+$limit;
29                         echo "<table width=\"100%\">\n<tr align=center>\n";
30                         printf("<td><%sa href=\"%s?offset=%d\"><img border=0 alt=\"&lt;\" src=\"/icons/left.gif\"></a></td>\n", $offset>0?"":"no", $PHP_SELF, $preoffset);
31                         printf("<td><%sa href=\"%s?offset=%d\"><img border=0 alt=\"&gt;\" src=\"/icons/right.gif\"></a></td>\n", $postoffset<$lrow['n']?"":"no", $PHP_SELF, $postoffset);
32                         echo "</tr>\n</table>\n";
33                 }
34                 mysql_free_result($lr);
35         }
36 ?>
37 <table align=center border=1 cellpadding=10>
38 <tr>
39 <th></th>
40 <th>serno / edit</th>
41 <th>ethaddr</th>
42 <th>date</th>
43 <th>batch</th>
44 <th>type</th>
45 <th>rev</th>
46 <th>location</th>
47 <?php
48         if ($verbose) {
49                 echo "<th>comments</th>\n";
50                 echo "<th>sdram</th>\n";
51                 echo "<th>flash</th>\n";
52                 echo "<th>zbt</th>\n";
53                 echo "<th>xlxtyp</th>\n";
54                 echo "<th>xlxspd</th>\n";
55                 echo "<th>xlxtmp</th>\n";
56                 echo "<th>xlxgrd</th>\n";
57                 echo "<th>cputyp</th>\n";
58                 echo "<th>cpuspd</th>\n";
59                 echo "<th>cpmspd</th>\n";
60                 echo "<th>busspd</th>\n";
61                 echo "<th>hstype</th>\n";
62                 echo "<th>hschin</th>\n";
63                 echo "<th>hschout</th>\n";
64         }
65 ?>
66 </tr>
67 <?php
68         if ($serno == 0)
69                 $r=mysql_query("select * from boards order by serno limit $offset,$limit");
70         else
71                 $r=mysql_query("select * from boards where serno=$serno");
72
73         function print_cell($str) {
74                 if ($str == '')
75                         $str = '&nbsp;';
76                 echo "\t<td>$str</td>\n";
77         }
78
79         while($row=mysql_fetch_array($r)){
80                 foreach ($columns as $key) {
81                         if (!key_in_array($key, $row))
82                                 $row[$key] = '';
83                 }
84
85                 echo "<tr>\n";
86                 print_cell("<a href=\"brlog.php?serno=$row[serno]\">Log</a>");
87                 print_cell("<a href=\"edit.php?serno=$row[serno]\">$row[serno]</a>");
88                 print_cell($row['ethaddr']);
89                 print_cell($row['date']);
90                 print_cell($row['batch']);
91                 print_cell($row['type']);
92                 print_cell($row['rev']);
93                 print_cell($row['location']);
94                 if ($verbose) {
95                         print_cell("<pre>\n" . urldecode($row['comments']) .
96                                 "\n\t</pre>");
97                         print_cell(gather_enum_multi_print("sdram", 4, $row));
98                         print_cell(gather_enum_multi_print("flash", 4, $row));
99                         print_cell(gather_enum_multi_print("zbt", 16, $row));
100                         print_cell(gather_enum_multi_print("xlxtyp", 4, $row));
101                         print_cell(gather_enum_multi_print("xlxspd", 4, $row));
102                         print_cell(gather_enum_multi_print("xlxtmp", 4, $row));
103                         print_cell(gather_enum_multi_print("xlxgrd", 4, $row));
104                         print_cell($row['cputyp']);
105                         print_cell($row['cpuspd']);
106                         print_cell($row['cpmspd']);
107                         print_cell($row['busspd']);
108                         print_cell($row['hstype']);
109                         print_cell($row['hschin']);
110                         print_cell($row['hschout']);
111                 }
112                 echo "</tr>\n";
113         }
114 ?>
115 </table>
116 <p></p>
117 <table width="100%">
118 <tr>
119   <td align=center><?php
120         if ($verbose)
121                 echo "<a href=\"browse.php?verbose=0\">Terse Listing</a>";
122         else
123                 echo "<a href=\"browse.php?verbose=1\">Verbose Listing</a>";
124   ?></td>
125   <td align=center><a href="index.php">Back to Start</a></td>
126 </tr>
127 </table>
128 <?php
129         pg_foot();
130 ?>