source: trunk/MagicSoft/Mars/datacenter/db/sequinfo.php@ 8122

Last change on this file since 8122 was 8122, checked in by Daniela Dorner, 18 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 26.5 KB
Line 
1<?php
2{
3 function CreateQuery($_GET, $alias, $checkwhere, $checkgroup, $checkstatusgroup, $needs)
4 {
5 $fromtable="Sequences";
6
7 $groups = 0;
8 foreach ($checkgroup as $element)
9 if ($element==-1)
10 $groups++;
11
12 $statusgroups = 0;
13 foreach ($checkstatusgroup as $element)
14 if ($element==-1)
15 $statusgroups++;
16
17 $query0 = "SELECT ";
18
19 if ($groups>0)
20 {
21 foreach ($checkgroup as $key => $element)
22 if ($element==-1)
23 $query0 .= $key . " as '" . $alias[$key] . "' " . ", ";
24 //--------------------------------------------------
25 $query0 .= "SUM(fRunTime)/3600 as '" . $alias["SUM(fRunTime)/3600"] . "', ";
26 //--------------------------------------------------
27 $query0 .= " SUM(fNumEvents) as '" . $alias["SUM(fNumEvents)"] . "', ";
28 $query0 .= " Min(fZenithDistanceMin) as '" . $alias["Min(fZenithDistanceMin)"] . "', ";
29 $query0 .= " Max(fZenithDistanceMax) as '" . $alias["Max(fZenithDistanceMax)"] . "', ";
30 $query0 .= " COUNT(*) as '# Sequ' ";
31 }
32 else
33 {
34 if ($statusgroups>0)
35 {
36 foreach ($checkstatusgroup as $key => $element)
37 if ($element==-1)
38 $query0 .= " (if(IsNull(" . $key . "), if(isnull(fStartTime), 'not done', if(isnull(fFailedTime),if(isnull(" . $needs[$key] . "),'not done',if(date_sub(Now(),interval 12 hour) < fStartTime,'running','crashed')),if(isnull(" . $needs[$key] . "),'not done','failed'))) ,if(" . $key . "='1970-01-01 00:00:00','dont do','done'))) as '" . $alias[$key] . "', ";
39// $query0 .= " (if(IsNull(" . $key . "), 'not done' ,if(" . $key . "='1970-01-01 00:00:00','dont do','done'))) as '" . $alias[$key] . "', ";
40
41 $query0 .= " COUNT(*) as '# Sequ'";
42
43 }
44 else
45 {
46 if (!empty($_GET["fSendTxt"]))
47 $query0 .= " " . $fromtable . ".fSequenceFirst as '" . $alias["fSequenceFirst"] . "' ";
48 else
49 {
50 $query0 .= " CONCAT('<A&ws;HREF=\"runinfo.php?', 'fRunStart=On', '&fZenithDistance=On', '&fRunMin=', Sequences.fSequenceFirst, '&fMeanTriggerRate=On', '&fTest=On', '&fRunTypeName=On', '&fRunMax=', fSequenceLast, '&fNumEvents=On', '&fSourceName=On&', 'fExcludedFDAKEY=1', '&fSequenceFirst=On', '&fRawFileAvail=On', '&fCCFileAvail=On', '&fCaCoFileAvail=On', '&fNumResults=500\">', Sequences.fSequenceFirst, '</A>') ";
51 $query0 .= " as " . $alias["fSequenceFirst"];
52 if (!empty($_GET["fLinks"]))
53 {
54 $query0 .= ", CONCAT('<A&ws;HREF=\"http://www.astro.uni-wuerzburg.de/datacenter/callisto/' , LEFT(LPAD(CONCAT(Sequences.fSequenceFirst, '.'), 9,'0'),4), '/', LPAD(CONCAT(Sequences.fSequenceFirst, '/'), 9,'0'), 'callisto', LPAD(CONCAT(Sequences.fSequenceFirst , '.html'), 13,'0') , '\">cl</A>'";
55 $query0 .= ", '&nbsp;<A&ws;HREF=\"http://www.astro.uni-wuerzburg.de/datacenter/callisto/' , LEFT(LPAD(CONCAT(Sequences.fSequenceFirst, '.'), 9,'0'),4), '/', LPAD(CONCAT(Sequences.fSequenceFirst, '/'), 9,'0'), '\">c</A>'";
56 $query0 .= ", '&nbsp;<A&ws;HREF=\"http://www.astro.uni-wuerzburg.de/datacenter/star/' , LEFT(LPAD(CONCAT(Sequences.fSequenceFirst, '.'), 9,'0'),4), '/', LPAD(CONCAT(Sequences.fSequenceFirst, '/'), 9,'0'), 'star', LPAD(CONCAT(Sequences.fSequenceFirst , '.html'), 13,'0') , '\">sl</A>'";
57 $query0 .= ", '&nbsp;<A&ws;HREF=\"http://www.astro.uni-wuerzburg.de/datacenter/star/' , LEFT(LPAD(CONCAT(Sequences.fSequenceFirst, '.'), 9,'0'),4), '/', LPAD(CONCAT(Sequences.fSequenceFirst, '/'), 9,'0'), '\">s</A>'";
58 $query0 .= ", '&nbsp;<A&ws;HREF=\"http://www.astro.uni-wuerzburg.de/datacenter/sequences/' , LEFT(LPAD(CONCAT(Sequences.fSequenceFirst, '.'), 9,'0'),4), '/sequence', LPAD(CONCAT(Sequences.fSequenceFirst , '.txt'), 12,'0') , '\">', 'f </A>' ";
59 $query0 .= ", '&nbsp;<A&ws;HREF=\"sequence.php?fSequenceNo=', Sequences.fSequenceFirst , '&fAll=On\">i</A>') ";
60 $query0 .= " as 'Links'";
61 }
62 }
63
64 foreach ($_GET as $key => $element)
65 if ($_GET[$key]=="On")
66 if ($key!="fLinks" && $key!="fTest")
67 if (empty($checkwhere[$key]) || $checkwhere[$key]==0)
68 $query0 .= ", " . $key . " as '" . $alias[$key] . "' ";
69 }
70 }
71
72 $query0 .= " FROM " . $fromtable;
73
74 $query0 .= " LEFT JOIN SequenceProcessStatus ON Sequences.fSequenceFirst=SequenceProcessStatus.fSequenceFirst ";
75 $query0 .= " LEFT JOIN Calibration ON Sequences.fSequenceFirst=Calibration.fSequenceFirst ";
76 $query0 .= " LEFT JOIN Star ON Sequences.fSequenceFirst=Star.fSequenceFirst ";
77
78// foreach ($_GET as $key => $element)
79// if (($_GET[$key]=="On" || $groups>0) && !empty($joins[$key]))
80// $query0 .= $joins[$key];
81
82 foreach ($_GET as $key => $element)
83 if (($_GET[$key]=="On" || $groups>0))// && !empty(GetJoin($fromtable,$key)))
84 $query0 .= GetJoin($fromtable,$key);
85
86 if ($_GET["fTest"]!="On")
87 {
88 if ($_GET["fSourceName"]!="On")
89 $query0 .= " LEFT JOIN Source ON Sequences.fSourceKEY=Source.fSourceKEY ";
90 $query0 .= " WHERE fTest='no'";
91 }
92
93 foreach ($checkwhere as $key => $element)
94 {
95 if (empty($element) || $element<=0)
96 continue;
97
98 if (strpos($query0, " WHERE ")==FALSE)
99 $query0 .= " WHERE ";
100 else
101 if ($element!=-1)
102 if (strrpos($query0, " AND ")!=strlen($query0)-5)
103 $query0 .= " AND ";
104
105 if ($element!=-1)
106 $query0 .= GetCheck($fromtable, $key) . "=" . $element;
107 }
108
109 if (strpos($query0, " WHERE ")==FALSE)
110 $query0 .= " WHERE ";
111 else
112 $query0 .= " AND ";
113
114 $query0 .= StatusQuery("fSequenceFileWritten", $needs);
115 $query0 .= StatusQuery("fAllFilesAvail", $needs);
116 $query0 .= StatusQuery("fCallisto", $needs);
117 $query0 .= StatusQuery("fFillCallisto", $needs);
118 $query0 .= StatusQuery("fStar", $needs);
119 $query0 .= StatusQuery("fFillStar", $needs);
120
121 if (!empty($_GET["fRunMin"]) && !empty($_GET["fRunMax"]))
122 $query0 .= "Sequences.fSequenceFirst BETWEEN " . $_GET["fRunMin"] . " AND " . $_GET["fRunMax"] . " ";
123 else
124 $query0 = substr($query0, 0, -4);
125
126/*
127 if (!empty($_GET["fDate"]))
128 $query0 .= " AND fRunStart REGEXP \"^" . $_GET["fDate"] . "\" ";
129*/
130
131 if (!empty($_GET["fSourceN"]))
132 $query0 .= " AND fSourceName REGEXP \"^" . $_GET["fSourceN"] . "\" ";
133
134 if (!empty($_GET["fStartDate"]))
135 {
136 if (strpos(strrev($query0), " DNA ")!=0 || !strpos(strrev($query0), " DNA "))
137 $query0 .= " AND ";
138
139 $startdate=substr($_GET["fStartDate"], 0, 10);
140 if ($startdate=="0000-00-00")
141 $query0 .=" fRunStart >= '" . $startdate . " 00:00:00' ";
142 else
143 $query0 .= " fRunStart >= ADDDATE('" . $startdate . " 13:00:00', INTERVAL -1 DAY) ";
144 }
145
146 if (!empty($_GET["fStopDate"]))
147 {
148 if (strpos(strrev($query0), " DNA ")!=0 || !strpos(strrev($query0), " DNA "))
149 $query0 .= " AND ";
150
151 $stopdate=substr($_GET["fStopDate"], 0, 10);
152 $query0 .= " fRunStart < '" . $stopdate . " 13:00:00' ";
153 }
154
155 if ($groups>0)
156 {
157 $query0 .= " GROUP BY ";
158 $num = $groups;
159 foreach ($checkgroup as $key => $element)
160 if ($element==-1)
161 {
162 $query0 .= GetCheck($fromtable,$key);
163 if ($num-->1)
164 $query0 .= ", ";
165 }
166 }
167
168 if ($statusgroups>0)
169 {
170 $query0 .= " GROUP BY ";
171 $num = $statusgroups;
172 foreach ($checkstatusgroup as $key => $element)
173 if ($element==-1)
174 {
175 $query0 .= $alias[$key];
176 if ($num-->1)
177 $query0 .= ", ";
178 }
179 }
180
181 if (!empty($_GET["fSortBy"]))
182 {
183 $val=substr($_GET["fSortBy"], 0, -1);
184 $query0 .= " ORDER BY " . GetTable($fromtable,$val) . " ";
185 if (substr($_GET["fSortBy"], -1)=="-")
186 $query0 .= "DESC";
187 }
188
189 if (empty($_GET["fSortBy"]) && $groups==0 && $statusgroups==0)
190 $query0 .= "ORDER BY Sequences.fSequenceFirst ASC ";
191
192 if (empty($_GET["fNumStart"]))
193 $_GET["fNumStart"]=0;
194
195 if (empty($_GET["fSendTxt"]))
196 $query0 .= " LIMIT " . $_GET["fNumStart"] . ", " . $_GET["fNumResults"];
197
198 return $query0;
199 }
200
201 function InitGet($_GET)
202 {
203 // Find out whether it is the first call to the php script
204 $first = empty($_GET["fRunMin"]) && empty($_GET["fRunMax"]);
205
206 if (empty($_GET["fNumResults"]))
207 $_GET["fNumResults"]="20";
208
209 if (empty($_GET["fLastUpdate"]))
210 $_GET["fLastUpdate"]="Off";
211
212 if (empty($_GET["fNumEvents"]))
213 $_GET["fNumEvents"]="Off";
214
215 if (empty($_GET["fRunStart"]))
216 $_GET["fRunStart"]=$first?"On":"";
217
218 if (empty($_GET["fRunTime/60"]))
219 $_GET["fRunTime/60"]=$first?"On":"";
220
221 if (empty($_GET["fSequenceLast"]))
222 $_GET["fSequenceLast"]="Off";
223
224 if (empty($_GET["fLinks"]))
225 $_GET["fLinks"]=$first?"On":"";
226
227 if (empty($_GET["fTest"]))
228 $_GET["fTest"]="Off";
229
230 if (empty($_GET["fAzimuthMin"]))
231 $_GET["fAzimuthMin"]="Off";
232
233 if (empty($_GET["fAzimuthMax"]))
234 $_GET["fAzimuthMax"]="Off";
235
236 if (empty($_GET["fZenithDistanceMin"]))
237 $_GET["fZenithDistanceMin"]=$first?"On":"";
238
239 if (empty($_GET["fZenithDistanceMax"]))
240 $_GET["fZenithDistanceMax"]="Off";
241
242 if (empty($_GET["fManuallyChangedName"]))
243 $_GET["fManuallyChangedName"]="Off";
244
245 if (empty($_GET["fSourceName"]))
246 $_GET["fSourceName"]=$first?"On":"";
247
248 if (empty($_GET["fProjectName"]))
249 $_GET["fProjectName"]="Off";
250
251 if (empty($_GET["fL1TriggerTableName"]))
252 $_GET["fL1TriggerTableName"]="Off";
253
254 if (empty($_GET["fL2TriggerTableName"]))
255 $_GET["fL2TriggerTableName"]="Off";
256
257 if (empty($_GET["fHvSettingsName"]))
258 $_GET["fHvSettingsName"]="Off";
259
260 if (empty($_GET["fDiscriminatorThresholdTableName"]))
261 $_GET["fDiscriminatorThresholdTableName"]="Off";
262
263 if (empty($_GET["fTriggerDelayTableName"]))
264 $_GET["fTriggerDelayTableName"]="Off";
265
266 if (empty($_GET["fLightConditionsName"]))
267 $_GET["fLightConditionsName"]="Off";
268
269 if (empty($_GET["fTestFlagName"]))
270 $_GET["fTestFlagName"]="Off";
271
272 if (empty($_GET["fSequenceFileWritten"]))
273 $_GET["fSequenceFileWritten"]="Off";
274
275 if (empty($_GET["fSequenceFileWrittenStatus"]))
276 $_GET["fSequenceFileWrittenStatus"]="0";
277
278 if (empty($_GET["fAllFilesAvail"]))
279 $_GET["fAllFilesAvail"]="Off";
280
281 if (empty($_GET["fAllFilesAvailStatus"]))
282 $_GET["fAllFilesAvailStatus"]="0";
283
284 if (empty($_GET["fCallisto"]))
285 $_GET["fCallisto"]="Off";
286
287 if (empty($_GET["fCallistoStatus"]))
288 $_GET["fCallistoStatus"]="0";
289
290 if (empty($_GET["fFillCallisto"]))
291 $_GET["fFillCallisto"]="Off";
292
293 if (empty($_GET["fFillCallistoStatus"]))
294 $_GET["fFillCallistoStatus"]="0";
295
296 if (empty($_GET["fStar"]))
297 $_GET["fStar"]=$first?"On":"";
298
299 if (empty($_GET["fStarStatus"]))
300 $_GET["fStarStatus"]="0";
301
302 if (empty($_GET["fFillStar"]))
303 $_GET["fFillStar"]="Off";
304
305 if (empty($_GET["fFillStarStatus"]))
306 $_GET["fFillStarStatus"]="0";
307
308 if (empty($_GET["fUnreliableInner"]))
309 $_GET["fUnreliableInner"]="Off";
310
311 if (empty($_GET["fUnsuitableOuter"]))
312 $_GET["fUnsuitableOuter"]="Off";
313
314 if (empty($_GET["fUnreliableOuter"]))
315 $_GET["fUnreliableOuter"]="Off";
316
317 if (empty($_GET["fUnsuitableInner"]))
318 $_GET["fUnsuitableInner"]="Off";
319
320 if (empty($_GET["fIsolatedInner"]))
321 $_GET["fIsolatedInner"]="Off";
322
323 if (empty($_GET["fIsolatedOuter"]))
324 $_GET["fIsolatedOuter"]="Off";
325
326 if (empty($_GET["fMeanPedRmsInner"]))
327 $_GET["fMeanPedRmsInner"]="Off";
328
329 if (empty($_GET["fMeanPedRmsOuter"]))
330 $_GET["fMeanPedRmsOuter"]="Off";
331
332 if (empty($_GET["fIsolatedMaxCluster"]))
333 $_GET["fIsolatedMaxCluster"]="Off";
334
335 if (empty($_GET["fArrTimeMeanInner"]))
336 $_GET["fArrTimeMeanInner"]="Off";
337
338 if (empty($_GET["fArrTimeMeanOuter"]))
339 $_GET["fArrTimeMeanOuter"]="Off";
340
341 if (empty($_GET["fArrTimeRmsInner"]))
342 $_GET["fArrTimeRmsInner"]="Off";
343
344 if (empty($_GET["fArrTimeRmsOuter"]))
345 $_GET["fArrTimeRmsOuter"]="Off";
346
347 if (empty($_GET["fMeanSignalInner"]))
348 $_GET["fMeanSignalInner"]=$first?"Off":"";
349
350 if (empty($_GET["fMeanSignalOuter"]))
351 $_GET["fMeanSignalOuter"]=$first?"Off":"";
352
353 if (empty($_GET["fPulsePosMean"]))
354 $_GET["fPulsePosMean"]=$first?"Off":"";
355
356 if (empty($_GET["fConvFactorInner"]))
357 $_GET["fConvFactorInner"]=$first?"On":"";
358
359 if (empty($_GET["fConvFactorOuter"]))
360 $_GET["fConvFactorOuter"]="Off";
361
362 if (empty($_GET["fMeanNumberIslands"]))
363 $_GET["fMeanNumberIslands"]="Off";
364
365 if (empty($_GET["fPSF"]))
366 $_GET["fPSF"]=$first?"On":"";
367
368 if (empty($_GET["fRatio"]))
369 $_GET["fRatio"]=$first?"On":"";
370
371 if (empty($_GET["fMuonNumber"]))
372 $_GET["fMuonNumber"]=$first?"On":"";
373
374 if (empty($_GET["fEffOnTime"]))
375 $_GET["fEffOnTime"]="Off";
376
377 if (empty($_GET["fEffOnTime/fRunTime"]))
378 $_GET["fEffOnTime/fRunTime"]="Off";
379
380 if (empty($_GET["fMuonRate"]))
381 $_GET["fMuonRate"]="Off";
382
383 if (empty($_GET["fInhomogeneity"]))
384 $_GET["fInhomogeneity"]="Off";
385
386 if (empty($_GET["fDataRate"]))
387 $_GET["fDataRate"]="Off";
388
389 if (empty($_GET["fMaxHumidity"]))
390 $_GET["fMaxHumidity"]="Off";
391
392 if (empty($_GET["fStartTime"]))
393 $_GET["fStartTime"]="Off";
394
395 if (empty($_GET["fFailedTime"]))
396 $_GET["fFailedTime"]="Off";
397
398 if (empty($_GET["fReturnCode"]))
399 $_GET["fReturnCode"]="Off";
400
401 if (empty($_GET["fFailedCode"]))
402 $_GET["fFailedCode"]="Off";
403
404 if (empty($_GET["fFailedCodeAdd"]))
405 $_GET["fFailedCodeAdd"]="Off";
406
407 }
408
409 function PrintForm($_GET, $host, $user, $pw, $db)
410 {
411 printf("<center>\n");
412 printf("<form action=\"sequinfo.php\" METHOD=\"GET\">\n");
413 printf(" <table>\n");
414 printf(" <tr>\n");
415
416 CheckBox("fRunStart", "Start time");
417 CheckBox("fAzimuthMin", "Azimuth min");
418 CheckBox("fAzimuthMax", "Azimuth max");
419 CheckBox("fZenithDistanceMin", "Zenith distance min");
420 CheckBox("fZenithDistanceMax", "Zenith distance max");
421
422 printf(" </tr><tr>\n");
423
424 CheckBox("fNumEvents", "Num of events");
425 CheckBox("fRunTime/60", "Duration");
426 CheckBox("fSequenceLast", "Last run");
427 CheckBox("fLinks", "Links");
428 CheckBox("fTest", "incl. TestSources");
429
430 printf(" </tr></table>\n");
431 printf(" <p>\n");
432 printf(" <table><tr><td>\n");
433
434 PrintStatusMenu("fSequenceFileWritten", "Sequfile");
435 printf(" </td><td>\n");
436 PrintStatusMenu("fAllFilesAvail", "Files avail");
437 printf(" </td><td>\n");
438 PrintStatusMenu("fCallisto", "Callisto");
439 printf(" </td><td>\n");
440 PrintStatusMenu("fStar", "Star");
441 printf(" </td><td>\n");
442 PrintStatusMenu("fFillCallisto", "Fillcallisto");
443 printf(" </td><td>\n");
444 PrintStatusMenu("fFillStar", "Fillstar");
445
446 printf("</td></tr> </table>\n");
447// printf(" <p>\n");
448
449 printf(" <table>\n");
450 printf(" <tr>\n");
451
452 CheckBox("fStartTime", "StartTime");
453 CheckBox("fFailedTime", "FailedTime");
454 CheckBox("fReturnCode", "ErrCode");
455 CheckBox("fFailedCode", "RetCode");
456 CheckBox("fFailedCodeAdd", "CodeAdd");
457
458 printf(" </tr>\n");
459 printf(" </table>\n");
460 printf(" <p>\n");
461
462 printf(" <table>\n");
463 printf(" <tr>\n");
464
465 CheckBox("fUnsuitableInner", "Unsuitable inner");
466 CheckBox("fUnsuitableOuter", "Unsuitable outer");
467 CheckBox("fUnreliableInner", "Unreliable inner");
468 CheckBox("fUnreliableOuter", "Unreliable outer");
469
470 printf(" </tr><tr>\n");
471
472 CheckBox("fIsolatedInner", "Isolated inner");
473 CheckBox("fIsolatedOuter", "Isolated outer");
474 CheckBox("fIsolatedMaxCluster", "IsolatedMaxCluster");
475
476 printf(" </tr><tr>\n");
477
478 CheckBox("fArrTimeMeanInner", "ArrTimeMean inner ");
479 CheckBox("fArrTimeMeanOuter", "ArrTimeMean outer ");
480 CheckBox("fArrTimeRmsInner", "ArrTimeRms inner ");
481 CheckBox("fArrTimeRmsOuter", "ArrTimeRms outer ");
482
483 printf(" </tr><tr>\n");
484
485 CheckBox("fMeanPedRmsInner", "MeanPedRms inner");
486 CheckBox("fMeanPedRmsOuter", "MeanPedRms outer");
487 CheckBox("fMeanSignalInner", "MeanSignal inner");
488 CheckBox("fMeanSignalOuter", "MeanSignal outer");
489
490 printf(" </tr><tr>\n");
491
492 CheckBox("fConvFactorInner", "Conv inner ");
493 CheckBox("fConvFactorOuter", "Conv outer ");
494 CheckBox("fPulsePosMean", "Mean PulsePos");
495
496 printf(" </tr></table>\n");
497// printf(" <p>\n");
498
499 printf(" <table>\n");
500 printf(" <tr>\n");
501
502 CheckBox("fDataRate", "CleanedEvtRate");
503 CheckBox("fMeanNumberIslands", "MeanNumIslands");
504 CheckBox("fMaxHumidity", "MaxHumidity");
505 CheckBox("fInhomogeneity", "Inhomogeneity");
506
507 printf(" </tr><tr>\n");
508
509 CheckBox("fMuonRate", "MuonRate");
510 CheckBox("fMuonNumber", "MuonNumber");
511 CheckBox("fRatio", "Ratio");
512 CheckBox("fPSF", "PSF");
513
514 printf(" </tr><tr>\n");
515
516 CheckBox("fEffOnTime", "EffOnTime");
517 CheckBox("fEffOnTime/fRunTime", "RelOnTime");
518
519 printf(" </tr>\n");
520 printf(" </table>\n");
521 printf(" <p>\n");
522
523 // pull down boxes
524
525 printf(" <table>\n");
526 printf(" <tr><td>\n");
527 PrintPullDown($host, $user, $pw, $db, "Source", "fSourceName", "fSourceKEY", "Source Name");
528 printf(" </td><td>\n");
529 PrintPullDown($host, $user, $pw, $db, "L1TriggerTable", "fL1TriggerTableName", "fL1TriggerTableKEY", "L1Trigger Table");
530 printf(" </td><td>\n");
531 PrintPullDown($host, $user, $pw, $db, "L2TriggerTable", "fL2TriggerTableName", "fL2TriggerTableKEY", "L2Trigger Table");
532 printf(" </td><td>\n");
533 PrintPullDown($host, $user, $pw, $db, "TriggerDelayTable", "fTriggerDelayTableName", "fTriggerDelayTableKEY", "Trigger Delay Table");
534 printf(" </td></tr><tr><td>\n");
535 PrintPullDown($host, $user, $pw, $db, "LightConditions", "fLightConditionsName", "fLightConditionsKEY", "Light Conditions");
536 printf(" </td><td>\n");
537 PrintPullDown($host, $user, $pw, $db, "Project", "fProjectName", "fProjectKEY", "Project Name");
538 printf(" </td><td>\n");
539 PrintPullDown($host, $user, $pw, $db, "HvSettings", "fHvSettingsName", "fHvSettingsKEY", "HV Settings");
540 printf(" </td><td>\n");
541 PrintPullDown($host, $user, $pw, $db, "DiscriminatorThresholdTable", "fDiscriminatorThresholdTableName", "fDiscriminatorThresholdTableKEY", "DT Table");
542 printf(" </td></tr><tr><td>\n");
543 PrintPullDown($host, $user, $pw, $db, "ManuallyChanged", "fManuallyChangedName", "fManuallyChangedKEY", "Manually changed");
544 printf(" </td><td>\n");
545 PrintPullDown($host, $user, $pw, $db, "TestFlag", "fTestFlagName", "fTestFlagKEY", "Test Flag");
546 printf(" </td></tr>\n");
547 printf(" </table>\n");
548 printf(" <p>\n");
549
550 if (empty($_GET["fStartDate"]))
551 $timemin = GetMin("fRunStart", "Sequences", $host, $user, $pw, $db);
552 else
553 $timemin = $_GET["fStartDate"];
554
555 if (empty($_GET["fStopDate"]))
556 $timemax = GetMax("fRunStart", "Sequences", $host, $user, $pw, $db);
557 else
558 $timemax = $_GET["fStopDate"];
559
560 printf("Night&nbsp;(yyyy-mm-dd)&nbsp;from&nbsp;<input name=\"fStartDate\" type=\"text\" size=\"10\" maxlength=\"10\" value=\"%s\">\n", $timemin);
561 printf("to&nbsp;<input name=\"fStopDate\" type=\"text\" size=\"10\" maxlength=\"10\" value=\"%s\">&nbsp;&nbsp;&nbsp;&nbsp;\n", $timemax);
562
563 if (empty($_GET["fRunMin"]))
564 $min = GetMin("fSequenceFirst", "Sequences", $host, $user, $pw, $db);
565 else
566 $min = $_GET["fRunMin"];
567
568 if (empty($_GET["fRunMax"]))
569 $max = GetMax("fSequenceFirst", "Sequences", $host, $user, $pw, $db);
570 else
571 $max = $_GET["fRunMax"];
572
573/*
574 printf("Date&nbsp;(yyyy-mm-dd)&nbsp;<input name=\"fDate\" type=\"text\" size=\"10\" maxlength=\"10\" value=\"");
575 if (!empty($_GET["fDate"]))
576 printf("%s", $_GET["fDate"]);
577 printf("\">&nbsp;&nbsp;&nbsp;\n");
578*/
579
580 printf("Sequences&nbsp;from&nbsp;<input name=\"fRunMin\" type=\"text\" size=\"6\" maxlength=\"6\" value=\"%s\">\n", $min);
581 printf("to&nbsp;<input name=\"fRunMax\" type=\"text\" size=\"6\" maxlength=\"6\" value=\"%s\">&nbsp;&nbsp;&nbsp;\n", $max);
582
583 printf(" <P>\n");
584
585 printf("Source&nbsp;(<A HREF=\"regexp.html\">regexp</A>)&nbsp;<input name=\"fSourceN\" type=\"text\" size=\"15\" maxlength=\"15\" value=\"");
586 if (!empty($_GET["fSourceN"]))
587 printf("%s", $_GET["fSourceN"]);
588 printf("\">&nbsp;&nbsp;&nbsp;\n");
589
590 printf(" Results:\n");
591 printf(" <select name=\"fNumResults\">\n");
592
593 $numres = array("10", "20", "50", "100", "200", "500");
594 foreach ($numres as $element)
595 {
596 if ($element==$_GET["fNumResults"])
597 printf("<option value=\"%s\" selected>%3s</option>\n", $element, $element);
598 else
599 printf("<option value=\"%s\">%3s</option>\n", $element, $element);
600 }
601 printf(" </select>\n");
602 printf(" &nbsp;&nbsp;&nbsp;\n");
603
604 ini_set("mysql.trace_mode", "Off");
605 ini_set("display_errors", "Off");
606
607 printf("<input class='Width' type='submit' value='Query Table'>&nbsp;&nbsp;&nbsp;\n");
608 printf("<input class='Width' type='button' value='Reset' onClick='self.location.href=\"sequinfo.php\"'>&nbsp;&nbsp;&nbsp;\n");
609 if (strchr($_SERVER["REQUEST_URI"], '?')!=FALSE)
610 printf("<input class='Width' type='button' value='Get .txt' onClick='self.location.href=\"%s&fSendTxt=1\"'>&nbsp;&nbsp;&nbsp;\n", $_SERVER["REQUEST_URI"]);
611 if (strchr($_SERVER["REQUEST_URI"], '?')!=FALSE)
612 printf("<input class='Width' type='button' value='Print' onClick='self.location.href=\"%s&fPrintTable=1\"'>&nbsp;&nbsp;&nbsp;\n", $_SERVER["REQUEST_URI"]);
613 printf("</form>\n");
614 printf("</center>\n");
615 printf("</td>\n");
616 printf("</tr>\n");
617 printf("<tr class='Block'>\n");
618 printf("<td>\n");
619 }
620
621 function PrintPage($html, $host, $user, $pw, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $needs)
622 {
623 $db_id = mysql_connect($host, $user, $pw);
624 if ($db_id==FALSE)
625 {
626 printf("mysql_connect returned the following error: %s\n", mysql_error());
627 die("");
628 }
629 mysql_select_db($db);
630
631 $query0 = CreateQuery($_GET, $alias, $checkwhere, $checkgroup, $checkstatusgroup, $needs);
632
633 $result0 = mysql_query($query0, $db_id);
634
635 if ($result0)
636 {
637 if ($html=="1" || $html=="2")
638 PrintMagicTable($result0, $alias, $rightalign, "", "", "", $_GET);
639 else
640 PrintText($result0);
641
642 mysql_free_result($result0);
643 }
644 mysql_close($db_id);
645
646 PrintSubmittedQuery($query0, $html, $db, "old");
647 }
648
649 include ("include.php");
650 include ("db.php");
651 include ("magicdefs.php");
652
653 ini_set("display_errors", "On");
654 ini_set("mysql.trace_mode", "On");
655
656 if (!empty($_GET["fSendTxt"]))
657 {
658 header("Content-type: application/octet");
659 header("Content-Disposition: attachment; filename=query-result.txt");
660
661 PrintPage("0", $host, $user, $pw, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $needs);
662 }
663 else
664 {
665 echo (file_get_contents("index-header.html"));
666
667 $environment = sizeof($_GET);
668
669 InitGet($_GET);
670 if (empty($_GET["fPrintTable"]))
671 PrintForm($_GET, $host, $user, $pw, $db);
672
673 if ($environment==0)
674 printf("No query submitted yet.<BR>");
675 else
676 {
677 if (empty($_GET["fPrintTable"]))
678 PrintPage("1", $host, $user, $pw, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $needs);
679 else
680 PrintPage("2", $host, $user, $pw, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $needs);
681 }
682
683 echo (file_get_contents("index-footer.html"));
684 }
685
686 ini_set("display_errors", "Off");
687 ini_set("mysql.trace_mode", "Off");
688}
689?>
Note: See TracBrowser for help on using the repository browser.