source: trunk/MagicSoft/Mars/datacenter/db/tabs.php@ 9488

Last change on this file since 9488 was 9310, checked in by aparavac, 16 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 8.2 KB
Line 
1<? // To be shifted to magicdefs.pho
2$htpath = "/var/www/uni-wuerzburg.de/astro/db/htdocs/datacenter";
3$htlink = "http://datacenter.astro.uni-wuerzburg.de";
4
5$htlinks = dirname($_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);
6
7$paths = array
8 (
9 "star" => "/star/",
10 "calib" => "/callisto/",
11 "signal" => "/callisto/",
12 "ganymed" => "/ganymed/",
13 "gplotdb" => "/ganymed/",
14 "db" => "/plotdb/",
15 "status" => "/status/",
16 "condor" => "/condor/",
17 "optical" => "/optical/",
18 );
19
20$csvname = array
21 (
22 "star" => "star",
23 "calib" => "calib",
24 "signal" => "signal",
25 "ganymed" => "ganymed",
26 "gplotdb" => "plotdb",
27 "db" => "plotdb",
28 "status" => "plotstat",
29 "condor" => "plotusage",
30 "optical" => "plotoptical",
31 );
32
33$prefix = array
34 (
35 "star" => "star",
36 "calib" => "calib",
37 "signal" => "signal",
38 "ganymed" => "ganymed",
39 "gplotdb" => "gplotdb",
40 "db" => "plotdb",
41 "status" => "status",
42 "condor" => "condor",
43 "optical" => "optical",
44 );
45
46?>
47<? // Prepare
48
49 $number = empty($_GET["n"]) ? -1 : $_GET["n"];
50 $type = empty($_GET["t"]) ? "db" : $_GET["t"];
51
52 $path = $htpath.$paths[$type];
53 if ($number>0)
54 if ($type=="ganymed" || $type=="gplotdb")
55 $path = sprintf($path."%05d/%08d/", $number/1000, $number);
56 else
57 $path = sprintf($path."%04d/%08d/", $number/10000, $number);
58?>
59<?
60
61 $csvfile=$path.$csvname[$type].".csv";
62 if (file_exists($csvfile))
63 {
64 // read the file into an array
65 $lines = file($csvfile);
66
67 // some replacement for the printf
68 $search = array ("%", "\n", "\\" );
69 $replace = array ("%%", "", "\\\\" );
70
71 for ($i=0; $i<sizeof($lines); $i++)
72 {
73 //$arr = get_csv($lines[$i], "\t\n");
74 $tok = strtok($lines[$i], "\t\n");
75 $j=0;
76 while ($tok!==false)
77 {
78 $arr[$i][$j++] = str_replace($search, $replace, $tok);
79 $tok = strtok("\t");
80 }
81 }
82 }
83
84// fclose($file);
85?>
86<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
87
88<html>
89<head>
90 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
91 <meta name="Author" content="Thomas Bretz">
92 <link rel="stylesheet" type="text/css" href="tabs.css">
93 <script type="text/javascript" src="tabs.js">You need JavaScript switched on for this page to work!</script>
94 <title>Tabs: <? printf($arr[0][2]); ?></title>
95</head>
96
97<body onload="Resize();Switch(0);" onresize="Execute();">
98<div class="tabs-blue" id="tabs">
99<ul id="tabsul">
100 <li id='prevnext'><A HREF="#" accesskey='alt-shift-P' style="width:6;" class='tooltip' onclick="Add(+1);">+<span class='info'>Switch to previous tab.</span></A></li>
101 <li id='prevnext' style='margin-left:5px'><A HREF="#" accesskey='alt-shift-N' style="width:6;" class='tooltip' onclick="Add(-1);">-<span class='info'>Switch to next tab.</span></A></li>
102 <li id='prevnext'><A HREF="#" accesskey='alt-shift-P' style="width:6;" class='tooltip' onclick="Hide();">&gt;<span class='info'>Step in shown tabs to right.</span></A></li>
103 <li id='prevnext' style='margin-left:5px'><A HREF="#" accesskey='alt-shift-N' style="width:6;" class='tooltip' onclick="Show();">&lt;<span class='info'>Step in shown tabs to leaft.</span></A></li>
104 <li id='magnify'><A HREF="#" style="width:8;" class='tooltip' id="magtxt" onclick="ToggleSize();">O<span class='info'>Toggle between original image size and resized to the document's width.</span></A></li>
105<?
106 $n=0;
107
108 printf(" <li style='margin-right:3px' id='current' class='tabno%d'><A HREF=\"#\" class='tooltip load_def' onclick=\"Switch(%d);\">MARS<span class='info' style='text-align:center;'><P><font style='text-decoration:underline;'>Tab Overview</font><P>%s</span></A></li>\n",
109 $n, $n, $arr[0][2]);
110
111 $n++;
112
113 for ($i=1; $i<sizeof($lines); $i++, $n++)
114 {
115 // Use blur() to remove the focus after the click
116
117 foreach (glob($path.$prefix[$type].$i.".png") as $file)
118 {
119 $link = ereg_replace("^".$htpath, $htlink, $file);
120 $name = basename($file);
121
122 printf(" <li class='tabno".$n."'>");
123 printf("<A class='tooltip load_png' name='".$link."' ");
124 printf("onclick=\"Switch(".$n.");\" ");
125 printf("onmouseover=\"LoadImgTT('".$link."');\" HREF='#'>");
126 printf($arr[$i][1]."<span class='info'>".$arr[$i][2]."</span>");
127 printf("<span class='preview' id='preview'><div>".$arr[$i][2]."</div>");
128 printf("<span id='image'></span></span></A></li>\n");
129 }
130 }
131
132 foreach (glob($path."/*") as $file)
133 {
134 $info = pathinfo($file); // dirname, extension, basename, filename
135
136 $link = ereg_replace("^".$htpath, $htlink, $file);
137 $name = $info['basename'];
138 $exten = $info['extension'];
139
140
141 // Define list of valid extension
142 if ($exten!="html" && $exten!="rc")
143 continue;
144
145 printf(" <li class='tabno".$n."'>");
146 printf("<A class='tooltip load_".$exten."' name='".$link."' ");
147 printf("onclick=\"Switch(".$n.");\" HREF='#'>");
148
149 if ($exten=="html")
150 printf(ereg_replace("[0-9]{8}\.html", "", $name).".log");
151 if ($exten=="rc")
152 printf($name);
153
154 printf("<span class='info'>".$name."</span></A></li>\n");
155
156 $n++;
157 }
158?>
159</ul>
160</div>
161<table style="clear:both;" background="box_mtl_ctr.gif" border="0" cellpadding="0" cellspacing="0" width="100%">
162<tbody>
163 <tr height="12">
164 <td width="12"><img src="box_mtl_topl.gif"></td>
165 <td background="box_mtl_top.gif"><img src="spacer.gif"></td>
166 <td width="12"><img src="box_mtl_topr.gif"></td>
167 </tr>
168 <tr>
169 <td background="box_mtl_l.gif" width="12"><img src="spacer.gif"></td>
170 <td align="center" background="bg_spacer.gif" valign="top">
171 <div class="tabcontent" id="tabcontent"></div>
172 </td>
173 <td background="box_mtl_r.gif" width="12"><img src="spacer.gif"></td>
174 </tr>
175 <tr height="14">
176 <td width="12"><img src="box_mtl_botl.gif"></td>
177 <td background="box_mtl_bot.gif"><img src="spacer.gif"></td>
178 <td width="12"><img src="box_mtl_botr.gif"></td>
179 </tr>
180</tbody>
181</table>
182<!--
183<div class="tabcontent" id="tabcontent"></div>
184-->
185<div style="display:none" id="default">
186<?
187 printf("<p>\n");
188 printf("<center>\n");
189 printf(" <table class='marstable'>\n");
190 printf(" <tr><td id='title' colspan='3'>%s</td></tr>\n", $arr[0][2]);
191
192 for ($i=1; $i<sizeof($lines); $i++)
193 {
194 foreach (glob($path.$prefix[$type].$i.".png") as $file)
195 {
196 $link = ereg_replace("^".$htpath, $htlink, $file);
197 $name = basename($file);
198
199 printf(" <tr>");
200 printf("<td id='left'>%d</td>", $i);
201 printf("<td id='middle'><A HREF=\"#\" ");
202 printf("onclick=\"Switch(".$i.");\">");
203 printf(htmlspecialchars($arr[$i][1])."</A></td>");
204 printf("<td id='right'>".htmlspecialchars($arr[$i][2])."</td>");
205 printf("</tr>\n");
206 }
207 }
208
209 foreach (glob($path."*") as $file)
210 if (ereg("\.(root|log|html|pdf|ps|rc)$", $file))
211 {
212 $link = ereg_replace("^".$htpath, $htlink, $file);
213 $name = basename($file);
214
215 printf(" <tr>");
216 printf("<td id='left'></td>");
217 printf("<td id='middle'>Download</td>");
218 printf("<td id='middle' colspan='1'><A HREF=\"".$link."\">".$name."</A></td>");
219 printf("</tr>\n");
220 }
221
222 printf(" </table>\n");
223 printf("</center>\n");
224 printf("</p>\n");
225?>
226</div>
227<p id="myContent">
228<?/*printf(
229"SERVER: ".$_SERVER["SERVER_NAME"]."<br>".
230"HTTP_HOST: ".$_SERVER["HTTP_HOST"]."<br>".
231"REQ_URI: ".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]."<br>".
232"DIR: ".dirname($_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"])."<br>".
233"REQ_URI: ".basename($_SERVER["REQUEST_URI"])."<br>".
234"PATH_TRANS: ".$_SERVER["PATH_TRANSLATED"]."<br>".
235"PATH_INFO: ".$_SERVER["PATH_INFO"]."<br>".
236"SCRIPT_NAME: ".$_SERVER["SCRIP_NAME"]."<br>".
237"_FILE_: ".__FILE__."<br>".
238"_DIR_: ".__DIR__."<br>".
239$paths[$type]."\n".$path."\n".$_GET["number"]."\n".$_GET["type"]."\n".$number."\n".$type);
240*/?>
241</p>
242</body>
243</html>
Note: See TracBrowser for help on using the repository browser.