source: branches/AddingGoogleTestEnvironment/datacenter/db/showplots-ds.php@ 19779

Last change on this file since 19779 was 9466, checked in by aparavac, 16 years ago
*** empty log message ***
File size: 4.4 KB
Line 
1<?php
2
3ini_set("display_errors", "On");
4
5include("plotinclude.php");
6//print header
7printf("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n");
8printf("<html>\n<head>\n");
9printf("<meta http-equiv='content-type' content='text/html; charset=ISO-8859-1'>\n");
10printf("<title>show plots</title>\n");
11printf("<link rel='stylesheet' type='text/css' href='lamouette.css'>\n");
12printf("</head>\n");
13printf("<body>\n");
14
15//init
16$ds=0;
17if (!empty($_GET["ds"]))
18 $ds=$_GET["ds"];
19$tabnum=1;
20if (!empty($_GET["tabnum"]))
21 $tabnum=$_GET["tabnum"];
22$type2="calib";
23if (!empty($_GET["type2"]))
24 $type2=$_GET["type2"];
25$plot="";
26$nextseq=0;
27$prevseq=0;
28$seq=0;
29if (!empty($_GET["prevseq"]) && !empty($_GET["prev"]))
30 $seq=$_GET["prevseq"];
31if (!empty($_GET["nextseq"]) && !empty($_GET["next"]))
32 $seq=$_GET["nextseq"];
33$next=0;
34$prev=0;
35$numseq=0;
36
37//check if dataset file is existing
38if (!empty($ds))
39{
40 $num=sprintf("%08d",$ds);
41 $num2=substr($num,0,5);
42 $datasetfile="./datasets/" . $num2 . "/dataset" . $num . ".txt";
43 if (!file_exists($datasetfile))
44 {
45 printf("Sorry, there's no file for dataset %s available.", $ds);
46 //set dataset and sequence numbers to 0 for next checks
47 $ds=0;
48 $seq=0;
49 }
50}
51
52//in case of a valid dataset
53if (!empty($ds))
54{
55 //get sequences from dataset file
56 // alternative: query it from db
57 $dataset=file_get_contents($datasetfile);
58 $onpos=strpos($dataset, "SequencesOn:");
59 $offpos=strpos($dataset, "SequencesOff:");
60 $possource=strpos($dataset, "SourceName:");
61 $sequoff="";
62 if (!empty($offpos))
63 $sequoff=split(" ", trim(substr($dataset, $offpos+13, $possource-($offpos+13))));
64 if (empty($offpos))
65 $offpos=$possource;
66 $sequon=split(" ", trim(substr($dataset, $onpos+12, $offpos-($onpos+12))));
67 $sequences=$sequon;
68 if (!empty($sequoff))
69 $sequences=array_merge($sequences,$sequoff);
70 if ($seq!=0 && !in_array($seq, $sequences))
71 $seq=0;
72
73 //get next, current and previous sequence
74 foreach($sequences as $key => $sequ)
75 {
76 if ($seq==0)
77 $seq=$sequ;
78 if ($next==1)
79 {
80 $nextseq=$sequ;
81 if ($prevseq!=0)
82 break;
83 $next=0;
84 }
85 if ($sequ==$seq)
86 {
87 $next=1;
88 continue;
89 }
90 $prevseq=$sequ;
91 }
92 $numseq=count($sequences);
93
94 //in case a dataset consists of less than 3 sequences
95 if ($numseq==2)
96 $nextseq=$prevseq;
97}
98
99//get link for plot
100$type=gettypename($type2);
101$plot=getplotname($seq, $tabnum, $type, $type2);
102
103//print form for choosing dataset and plots
104printf("<form action='showplots-ds.php' method='GET'>\n");
105printf("<table width='100%%' border='0'>\n");
106printf("<tr><td valign='top'>\n<tr>\n");
107PrintHomeHelp();
108printf("<td align='center'>\n");
109if (!empty($prevseq))
110 printf("%d &nbsp;", $prevseq);
111if ($numseq>1)
112 printf("<input type='submit' value='<< Prev Plot' name='prev'>\n");
113printf("<input type='text' name='ds' size='5' maxlength='5' value='%s'>\n", $ds);
114PrintType2PullDown($type2);
115printf("<input type='text' name='tabnum' size='2' maxlenght='2' value='%s'>\n", $tabnum);
116printf("<input type='hidden' name='prevseq' size='2' maxlenght='2' value='%s'>\n", $prevseq);
117printf("<input type='hidden' name='nextseq' size='2' maxlenght='2' value='%s'>\n", $nextseq);
118if ($numseq>1)
119 printf("<input type='submit' value='Next Plot >>' name='next'>\n");
120else
121 printf("<input type='submit' value='Plot' name='next'>\n");
122if (!empty($nextseq))
123 printf("&nbsp;%d ", $nextseq);
124if ($numseq>0)
125{
126 printf("&nbsp; [ %d sequence", $numseq);
127 if ($numseq>1)
128 printf("s");
129 print(" ] \n");
130}
131printf("</td><td align='right'>\n");
132printf("<input class='Width' type='button' value='Reset' onClick='self.location.href=\"showplots-ds.php\"'>\n");
133printf("</td>\n</tr>\n<tr>\n<td align='center' colspan='3'>\n");
134if (!empty($seq))
135{
136 if (in_array($seq, $sequon))
137 $color="green";
138 else
139 $color="red";
140
141 printf("<div style='color:%s' onmouseover=\"this.innerHTML='%s';style.color='black'\" onmouseout=\"this.innerHTML='%s';style.color='%s'\"> %s </div>\n", $color, getinfofromdb($seq), $plot, $color, $plot);
142 printf("<img src='%s'>\n", $plot);
143}
144else
145 printf("You have to insert a dataset number into the first field.");
146printf("</td>\n</tr>\n</table>\n");
147printf("</form>\n");
148printf("</body>\n");
149printf("</html>\n");
150
151ini_set("display_errors", "Off");
152
153?>
Note: See TracBrowser for help on using the repository browser.