Annotation of /alx-src/branches/alx-web-060/monitor.php
Parent Directory | Revision Log
Revision 2189 -
(hide annotations)
(download)
Tue Jun 7 13:05:36 2011 UTC (13 years, 4 months ago) by niro
File size: 2852 byte(s)
Tue Jun 7 13:05:36 2011 UTC (13 years, 4 months ago) by niro
File size: 2852 byte(s)
-fixed whitepaces
1 | niro | 1610 | <? |
2 | |||
3 | niro | 2189 | include('include/basesql.php'); |
4 | |||
5 | $step = (integer)$step; | ||
6 | $mon = sqlfirst('SELECT * FROM list_monitors WHERE id='.sqlfirst('SELECT monitorid FROM cfg_graphic WHERE serial='.$id, 'monitorid')); | ||
7 | if(count($mon)==0) $mon = array('id'=>0, 'vendor'=>'AutoDetect'); | ||
8 | niro | 1610 | |
9 | niro | 2189 | echo '<img src="pics/logo2.jpg" align=top> <u><b>Montior for #'.$id.'</b></u>'; |
10 | niro | 1610 | |
11 | niro | 2189 | echo '<form action="monitor.php" method=get>'; |
12 | echo '<input type=hidden name="id" value="'.$id.'">'; | ||
13 | niro | 1610 | |
14 | niro | 2189 | function drawmon($dat, $k) |
15 | { | ||
16 | niro | 1610 | global $mon; |
17 | niro | 2189 | if($mon[$k]==$dat[$k]) echo '<option style="font-weight:bold" selected>'.$dat[$k]; |
18 | else echo '<option>'.$dat[$k]; | ||
19 | } | ||
20 | niro | 1610 | |
21 | niro | 2189 | if($step==0) |
22 | { | ||
23 | echo '<input type=hidden name="step" value="1">'; | ||
24 | echo '<br><br><br>Select monitor vendor:<br>'; | ||
25 | echo '<select name="vendor">'; | ||
26 | |||
27 | drawmon(array('vendor'=>'AutoDetect'), 'vendor'); | ||
28 | sqlforeach('SELECT DISTINCT vendor FROM list_monitors ORDER by vendor ASC', 'drawmon', 'vendor'); | ||
29 | niro | 1610 | |
30 | niro | 2189 | echo '</select>'; |
31 | echo '<input type=submit value=">>">'; | ||
32 | } | ||
33 | else if($step==1) | ||
34 | { | ||
35 | if($vendor=='AutoDetect') { $step=50; $sel=0; } | ||
36 | else | ||
37 | { | ||
38 | echo '<input type=hidden name="step" value="2">'; | ||
39 | echo '<input type=hidden name="vendor" value="'.$vendor.'">'; | ||
40 | |||
41 | echo '<b>Vendor:</b> '.$vendor.'<br><br><br>'; | ||
42 | echo 'Select monitor model:<br>'; | ||
43 | |||
44 | echo '<input type=button value="<<" onclick="location.href=\'monitor.php?id='.$id.'\'">'; | ||
45 | niro | 1610 | echo '<select name="model">'; |
46 | niro | 2189 | |
47 | sqlforeach('SELECT DISTINCT model FROM list_monitors WHERE vendor=\''.redir($vendor).'\' ORDER BY model ASC', 'drawmon', 'model'); | ||
48 | niro | 1610 | |
49 | niro | 2189 | echo '</select>'; |
50 | echo '<input type=submit value=">>">'; | ||
51 | } | ||
52 | } | ||
53 | else if($step==2) | ||
54 | { | ||
55 | $matches = sqlarr('SELECT id, concat(\'Size: \',size,\' - HSync: \',hsync,\' - VRefresh: \',vrefresh) data FROM list_monitors WHERE vendor=\''.redir($vendor).'\' and model=\''.redir($model).'\''); | ||
56 | |||
57 | if(count($matches)==1) { $step=50; $sel=$matches[0]['id']; } | ||
58 | else | ||
59 | { | ||
60 | echo '<input type=hidden name="step" value="50">'; | ||
61 | echo '<input type=hidden name="vendor" value="'.$vendor.'">'; | ||
62 | echo '<input type=hidden name="model" value="'.$model.'">'; | ||
63 | |||
64 | echo '<b>Vendor:</b> '.$vendor.'<br>'; | ||
65 | echo '<b>Model:</b> '.$model.'<br><br>'; | ||
66 | echo 'Select monitor:<br>'; | ||
67 | |||
68 | echo '<input type=button value="<<" onclick="location.href=\'monitor.php?id='.$id.'&step=1&vendor='.urlencode($vendor).'\'">'; | ||
69 | echo '<select name="sel">'; | ||
70 | |||
71 | foreach($matches as $m) | ||
72 | { | ||
73 | if($m['id']==$mon['id']) echo '<option value="'.$m['id'].'" style="font-weight:bold" selected>'.$m['data']; | ||
74 | else echo '<option value="'.$m['id'].'">'.$m['data']; | ||
75 | } | ||
76 | niro | 1610 | |
77 | niro | 2189 | echo '</select>'; |
78 | echo '<input type=submit value=">>">'; | ||
79 | } | ||
80 | } | ||
81 | |||
82 | if($step==50) | ||
83 | { | ||
84 | mysql_query('UPDATE cfg_graphic SET monitorid='.$sel.' WHERE serial='.$id); | ||
85 | echo '<script language=JavaScript>window.setTimeout(\'window.close()\', 1400);</script>'; | ||
86 | echo '<big><b>MonitorID saved!</b></big>'; | ||
87 | } | ||
88 | |||
89 | echo '</form>'; | ||
90 | |||
91 | ?> |
Properties
Name | Value |
---|---|
svn:executable | * |