source: trunk/MagicSoft/Mars/datacenter/db/showplots-ds.php@ 8533

Last change on this file since 8533 was 8533, checked in by Daniela Dorner, 17 years ago
*** empty log message ***
File size: 3.6 KB
Line 
1<?php
2
3ini_set("display_errors", "On");
4
5include("plotinclude.php");
6printf("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n");
7printf("<html>\n<head>\n");
8printf("<meta http-equiv='content-type' content='text/html; charset=ISO-8859-1'>\n");
9printf("<title>show plots</title>\n");
10printf("<link rel='stylesheet' type='text/css' href='lamouette.css'>\n");
11printf("</head>\n");
12printf("<body>\n");
13
14$ds=0;
15if (!empty($_GET["ds"]))
16 $ds=$_GET["ds"];
17$tabnum=1;
18if (!empty($_GET["tabnum"]))
19 $tabnum=$_GET["tabnum"];
20$type2="calib";
21if (!empty($_GET["type2"]))
22 $type2=$_GET["type2"];
23$plot="";
24$nextseq=0;
25$prevseq=0;
26$seq=0;
27if (!empty($_GET["prevseq"]) && !empty($_GET["prev"]))
28 $seq=$_GET["prevseq"];
29if (!empty($_GET["nextseq"]) && !empty($_GET["next"]))
30 $seq=$_GET["nextseq"];
31$next=0;
32$prev=0;
33$numseq=0;
34
35if (!empty($ds))
36{
37 $num=sprintf("%08d",$ds);
38 $num2=substr($num,0,5);
39 $datasetfile="http://datacenter.astro.uni-wuerzburg.de/datasets/" . $num2 . "/dataset" . $num . ".txt";
40 $dataset=file_get_contents($datasetfile);
41 $onpos=strpos($dataset, "SequencesOn:");
42 $offpos=strpos($dataset, "SequencesOff:");
43 $possource=strpos($dataset, "SourceName:");
44 $sequoff="";
45 if (!empty($offpos))
46 $sequoff=split(" ", trim(substr($dataset, $offpos+13, $possource-($offpos+13))));
47 if (empty($offpos))
48 $offpos=$possource;
49 $sequon=split(" ", trim(substr($dataset, $onpos+12, $offpos-($onpos+12))));
50 $sequences=$sequon;
51 if (!empty($sequoff))
52 $sequences=array_merge($sequences,$sequoff);
53 if ($seq!=0 && !in_array($seq, $sequences))
54 $seq=0;
55 foreach($sequences as $key => $sequ)
56 {
57 if ($seq==0)
58 $seq=$sequ;
59 if ($next==1)
60 {
61 $nextseq=$sequ;
62 if ($prevseq!=0)
63 break;
64 $next=0;
65 }
66 if ($sequ==$seq)
67 {
68 $next=1;
69 continue;
70 }
71 $prevseq=$sequ;
72 }
73 $numseq=count($sequences);
74 if ($numseq==2)
75 $nextseq=$prevseq;
76}
77
78$type=gettypename($type2);
79$plot=getplotname($seq, $tabnum, $type, $type2);
80
81printf("<form action='showplots-ds.php' method='GET'>\n");
82printf("<table width='100%%' border='0'>\n");
83printf("<tr><td align='center'>\n");
84if (!empty($prevseq))
85 printf("%d &nbsp;", $prevseq);
86if ($numseq>1)
87 printf("<input type='submit' value='<< Prev Plot' name='prev'>\n");
88printf("<input type='text' name='ds' size='5' maxlength='5' value='%s'>\n", $ds);
89printf("<input type='text' name='type2' size='6' maxlength='6' value='%s'>\n", $type2);
90printf("<input type='text' name='tabnum' size='2' maxlenght='2' value='%s'>\n", $tabnum);
91printf("<input type='hidden' name='prevseq' size='2' maxlenght='2' value='%s'>\n", $prevseq);
92printf("<input type='hidden' name='nextseq' size='2' maxlenght='2' value='%s'>\n", $nextseq);
93if ($numseq>1)
94 printf("<input type='submit' value='Next Plot >>' name='next'>\n");
95else
96 printf("<input type='submit' value='Plot' name='next'>\n");
97if (!empty($nextseq))
98 printf("&nbsp;%d ", $nextseq);
99if ($numseq>0)
100{
101 printf("&nbsp; [ %d sequence", $numseq);
102 if ($numseq>1)
103 printf("s");
104 print(" ] \n");
105}
106printf("</td>\n</tr>\n<tr>\n<td align='center'>\n");
107if (!empty($seq))
108{
109 if (in_array($seq, $sequon))
110 printf("<font color='green'>\n");
111 else
112 printf("<font color='red'>\n");
113 printf("%s <img src='%s'>", $plot, $plot);
114}
115else
116 printf("You have to insert a dataset number in the first field.");
117printf("</td>\n</tr>\n</table>\n");
118printf("</form>\n");
119printf("</body>\n");
120printf("</html>\n");
121
122ini_set("display_errors", "Off");
123
124?>
Note: See TracBrowser for help on using the repository browser.