source: trunk/MagicSoft/Mars/datacenter/db/plotdb.php@ 8532

Last change on this file since 8532 was 8466, checked in by Daniela Dorner, 18 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 10.2 KB
Line 
1<?php
2{
3 function GetSequencesFromDataSet($onoff)
4 {
5 include("db.php");
6 $db_id = mysql_pconnect($host, $user, $pw);
7 if ($db_id==FALSE)
8 {
9 printf("mysql_connect returned the following error: %s\n", mysql_error());
10 die("");
11 }
12 mysql_select_db($db);
13 $query="SELECT fSequenceFirst FROM DataSetSequenceMapping WHERE fDataSetNumber IN (";
14 $query .= str_replace(" ", ",", trim($_GET["Set"])) . ") AND fOnOff=" . $onoff;
15// printf("Q: %s<br>", $query);
16 $result=mysql_query($query, $db_id);
17
18 $sequences="";
19 while ($row = mysql_fetch_row($result))
20 $sequences.= $row[0] . " ";
21
22 mysql_free_result($result);
23 mysql_close($db_id);
24
25 $text="";
26 if (!empty($sequences))
27 $text.= str_replace(" ", "+", trim($sequences));
28 return $text;
29 }
30
31 function PrintDiv($host, $user, $pw, $db, $column, $tables, $num)
32 {
33 $list=GetList($host, $user, $pw, $db, $column, $tables);
34
35 if (($_GET["prim"]==$column && empty($num))
36 || ($_GET["prim"]==$column && $num==3)
37 || ($_GET["prim"]==$column && $num==4)
38 || ($_GET["prim"]==$column && $_GET["plot"]=="val" && $num==2))
39 printf("<div id='%s%s' style='display:inline'>\n", $column, $num);
40 else
41 printf("<div id='%s%s' style='display:none'>\n", $column, $num);
42
43 if ($num==2)
44 $vs="vs";
45
46 printf("<select name='%sCol%s' size='1' class='Width'>\n", $column, $num);
47 foreach($list as $column2)
48 if ($_GET[$column."Col".$num]==$column2)
49 printf("<option value='%s' selected>%s %s</option>\n", $column2, $vs, $column2);
50 else
51 printf("<option value='%s'>%s %s</option>\n", $column2, $vs, $column2);
52
53 printf("</select>\n<br>\n");
54 printf("</div>\n");
55 }
56
57 ini_set("display_errors", "On");
58 ini_set("mysql.trace_mode", "On");
59
60 echo (file_get_contents("index-header.html"));
61
62 include("plotinclude.php");
63
64 //init
65 if (empty($_GET["plot"]))
66 $_GET["plot"]="";
67 if (empty($_GET["primstart"]))
68 $_GET["primstart"]="";
69 if (empty($_GET["primstop"]))
70 $_GET["primstop"]="";
71 if (empty($_GET["prim"]))
72 $_GET["prim"]="";
73 if (empty($_GET["fSequenceFirstCol"]))
74 $_GET["fSequenceFirstCol"]="";
75 if (empty($_GET["fSequenceFirstCol2"]))
76 $_GET["fSequenceFirstCol2"]="";
77 if (empty($_GET["fSequenceFirstCol3"]))
78 $_GET["fSequenceFirstCol3"]="";
79 if (empty($_GET["fRunNumberCol"]))
80 $_GET["fRunNumberCol"]="";
81 if (empty($_GET["fRunNumberCol2"]))
82 $_GET["fRunNumberCol2"]="";
83 if (empty($_GET["fRunNumberCol3"]))
84 $_GET["fRunNumberCol3"]="";
85 if (empty($_GET["fDataSetNumberCol"]))
86 $_GET["fDataSetNumberCol"]="";
87 if (empty($_GET["fDataSetNumberCol2"]))
88 $_GET["fDataSetNumberCol2"]="";
89 if (empty($_GET["fDataSetNumberCol3"]))
90 $_GET["fDataSetNumberCol3"]="";
91 if (empty($_GET["Start"]))
92 $_GET["Start"]="";
93 if (empty($_GET["Stop"]))
94 $_GET["Stop"]="";
95 if (empty($_GET["Start2"]))
96 $_GET["Start2"]="";
97 if (empty($_GET["Stop2"]))
98 $_GET["Stop2"]="";
99 if (empty($_GET["Start3"]))
100 $_GET["Start3"]="";
101 if (empty($_GET["Stop3"]))
102 $_GET["Stop3"]="";
103 if (empty($_GET["Start4"]))
104 $_GET["Start4"]="";
105 if (empty($_GET["Stop4"]))
106 $_GET["Stop4"]="";
107 if (empty($_GET["Set"]))
108 $_GET["Set"]="";
109 if (empty($_GET["Set2"]))
110 $_GET["Set2"]="";
111 if (empty($_GET["set"]))
112 $_GET["set"]="";
113
114 printf("<center>\n<table cellpadding='0'>\n");
115 printf("<tr><td align='left'>\n");
116 printf("<form style='margin-bottom:0;' action='plotdb.php' METHOD='GET'>\n");
117
118 printf("&nbsp;<input type='radio' name='plot' value='prim' onclick='hidepulldown2()' %s> vs primary &nbsp;", $_GET["plot"]=="prim" ? "checked" : "");
119 printf("&nbsp;<input type='radio' name='plot' value='val' onclick='showpulldown2()' %s> vs value <br><br>", $_GET["plot"]=="val" ? "checked" : "");
120
121 printf("<table>\n");
122 printf("<tr><td>\n");
123 printf("<select name='prim' size='1' class='Width'>\n");
124 foreach($prims as $primary => $column)
125 if ($_GET["prim"]==$column)
126 printf("<option onclick=\"showpulldown('%s')\" value='%s' selected>%s</option>\n", $column, $column, $primary);
127 else
128 printf("<option onclick=\"showpulldown('%s')\" value='%s'>%s</option>\n", $column, $column, $primary);
129 printf("</select>\n");
130 printf(" </td><td valign='top'>\n ");
131 printf(" from&nbsp;<input name='primstart' type='text' size='6' maxlength='6' value='%s'>", $_GET["primstart"]);
132 printf(" to&nbsp;<input name='primstop' type='text' size='6' maxlength='6' value='%s'>", $_GET["primstop"]);
133 printf("</td>\n</tr>\n");
134
135 printf("<tr><td>\n");
136 foreach($prims as $primary => $column)
137 PrintDiv($host, $user, $pw, $db, $column, $tables, "");
138 printf(" </td><td valign='top'>\n <div id='Range' style='display:inline'>\n ");
139 printf(" from&nbsp;<input name='Start' type='text' size='6' maxlength='6' value='%s'>", $_GET["Start"]);
140 printf(" to&nbsp;<input name='Stop' type='text' size='6' maxlength='6' value='%s'>\n", $_GET["Stop"]);
141 printf("</div></td>\n</tr>\n");
142
143 printf("<tr><td>\n");
144 foreach($prims as $primary => $column)
145 PrintDiv($host, $user, $pw, $db, $column, $tables, "2");
146 if ($_GET["plot"]=="val")
147 printf(" </td><td valign='top'>\n <div id='Range2' style='display:inline'>\n ");
148 else
149 printf(" </td><td valign='top'>\n <div id='Range2' style='display:none'>\n ");
150 printf(" from&nbsp;<input name='Start2' type='text' size='6' maxlength='6' value='%s'>", $_GET["Start2"]);
151 printf(" to&nbsp;<input name='Stop2' type='text' size='6' maxlength='6' value='%s'>\n", $_GET["Stop2"]);
152 printf("</div></td>\n</tr>\n");
153
154 printf("<tr>\n<td colspan='2'>\nLimits</td>\n</tr>\n<tr>\n<td>\n");
155 foreach($prims as $primary => $column)
156 PrintDiv($host, $user, $pw, $db, $column, $tables, "3");
157 printf(" </td><td valign='top'>\n <div id='Range3' style='display:inline'>\n ");
158 printf(" from&nbsp;<input name='Start3' type='text' size='6' maxlength='6' value='%s'>", $_GET["Start3"]);
159 printf(" to&nbsp;<input name='Stop3' type='text' size='6' maxlength='6' value='%s'>\n", $_GET["Stop3"]);
160 printf("</div></td>\n</tr>\n");
161
162 printf("<tr>\n<td>\n");
163 foreach($prims as $primary => $column)
164 PrintDiv($host, $user, $pw, $db, $column, $tables, "4");
165 printf(" </td><td valign='top'>\n <div id='Range4' style='display:inline'>\n ");
166 printf(" from&nbsp;<input name='Start4' type='text' size='6' maxlength='6' value='%s'>", $_GET["Start4"]);
167 printf(" to&nbsp;<input name='Stop4' type='text' size='6' maxlength='6' value='%s'>\n", $_GET["Stop4"]);
168 printf("</div></td>\n</tr>\n");
169
170 printf("</table>\n");
171 printf("<br>\n");
172
173 printf("&nbsp;<input type='radio' name='set' value='sequences' onclick='showset2()' %s> sequences &nbsp;\n", $_GET["set"]=="sequences" ? "checked" : "");
174 printf("&nbsp;<input type='radio' name='set' value='datasets' onclick='hideset2()' %s> datasets <br>\n", $_GET["set"]=="datasets" ? "checked" : "");
175
176 printf("<div id='set1' style='display:inline'>Set1: <input name='Set' type='text' size='20' maxlength='100' value='%s'>\n</div>\n<br>\n", $_GET["Set"]);
177 if (empty($_GET["set"]) || $_GET["set"]=="sequences")
178 printf("<div id='set2' style='display:inline'>Set2: <input name='Set2' type='text' size='20' maxlength='100' value='%s'>\n</div>\n<br>\n", $_GET["Set2"]);
179 else
180 printf("<div id='set2' style='display:none'>Set2: <input name='Set2' type='text' size='20' maxlength='100' value='%s'>\n</div>\n<br>\n", $_GET["Set2"]);
181
182 printf("<br><input class='Width' type='submit' value='Query Plot'><br>\n");
183 printf("<input class='Width' type='button' value='Reset' onClick='self.location.href=\"plotdb.php\"'><br>\n");
184
185 printf("</form>");
186 printf("</td>\n");
187
188 printf("<td align='right' width='640px' height='400px'>\n");
189 if (!empty($_GET))
190 {
191 $img="plot.php?par=hallo";
192 foreach($_GET as $var => $val)
193 {
194 if ($var=="Set2" && $_GET["set"]=="datasets")
195 continue;
196 if ($var=="Set" && $_GET["set"]=="datasets" && !empty($val))
197 {
198 $img.= "&amp;Set=" . GetSequencesFromDataSet("1");
199 $img.= "&amp;Set2=" . GetSequencesFromDataSet("2");
200 continue;
201 }
202 $img.="&amp;".$var ."=".$val;
203 }
204// printf("link: %s<br>", $img);
205 printf("<img src='%s' alt='plot'>", $img);
206 }
207 printf("</td></tr>\n");
208 printf("<tr><td colspan='2'>\n");
209 printf("some remarks:\n<ul>");
210 printf("<li>For Runs plotting the whole range (i.e. without giving a range or when giving a too large range) \n");
211 printf("doesn't work with ChartDirector.</li>\n");
212 printf("<li>In Set1 and Set2 Sets can be given: <br>\n ");
213 printf("If 'sequences' is selected e.g. on sequences in Set1 (displayed in blue) and off sequences in Set2 \n");
214 printf("(diplayed in red). <br>\n ");
215 printf("If 'datasets' is selected you can enter a dataset number as Set1. The on data is displayed in blue, \n");
216 printf("the off data in red. <br>\n");
217 printf("&nbsp;&nbsp;&nbsp;Please give the numbers with space as separator (e.g. 40004 40022).<br>\n</<li>\n");
218 printf("<li>0 is not accepted in the ranges fields, please write .0 or 00</li>\n");
219 printf("<li>Be aware, that plotting timestamps, e.g. fRunStart, and strings, e.g. fComment doesn't work. </li>\n");
220 printf("</ul>\n</td>\n</tr>\n");
221
222 /*
223 printf("<tr><td colspan='2'>\n");
224 $query=GetQuery($tables, $joins, "");
225 printf("Q: %s<br>", $query);
226 if (!empty($_GET["Set"]))
227 {
228 $query=GetQuery($tables, $joins, "Set");
229 printf("Q: %s<br>", $query);
230 }
231 if (!empty($_GET["Set2"]))
232 {
233 $query=GetQuery($tables, $joins, "Set2");
234 printf("Q: %s<br>", $query);
235 }
236 printf("</td></tr>");
237 */
238
239 printf("</table>\n");
240 printf("</center>\n");
241
242 echo (file_get_contents("index-footer.html"));
243
244 ini_set("display_errors", "Off");
245 ini_set("mysql.trace_mode", "Off");
246}
247?>
Note: See TracBrowser for help on using the repository browser.