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

Last change on this file since 9154 was 9154, checked in by Daniela Dorner, 16 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 8.1 KB
Line 
1<? // To be shifted to magicdefs.pho
2$htpath = "/www/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 // read the file into an array
61 $lines = file($path.$csvname[$type].".csv");
62
63 // some replacement for the printf
64 $search = array ("%", "\n", "\\" );
65 $replace = array ("%%", "", "\\\\" );
66
67 for ($i=0; $i<sizeof($lines); $i++)
68 {
69 //$arr = get_csv($lines[$i], "\t\n");
70 $tok = strtok($lines[$i], "\t\n");
71 $j=0;
72 while ($tok!==false)
73 {
74 $arr[$i][$j++] = str_replace($search, $replace, $tok);
75 $tok = strtok("\t");
76 }
77 }
78
79 fclose($file);
80?>
81<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
82
83<html>
84<head>
85 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
86 <meta name="Author" content="Thomas Bretz">
87 <link rel="stylesheet" type="text/css" href="tabs.css">
88 <script type="text/javascript" src="tabs.js">You need JavaScript switched on for this page to work!</script>
89 <title>Tabs: <? printf($arr[0][2]); ?></title>
90</head>
91
92<body onload="Resize();Switch(0);" onresize="Execute();">
93<div class="tabs-blue" id="tabs">
94<ul id="tabsul">
95 <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>
96 <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>
97 <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>
98 <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>
99 <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>
100<?
101 $n=0;
102
103 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",
104 $n, $n, $arr[0][2]);
105
106 $n++;
107
108 for ($i=1; $i<sizeof($lines); $i++, $n++)
109 {
110 // Use blur() to remove the focus after the click
111
112 foreach (glob($path.$prefix[$type].$i.".png") as $file)
113 {
114 $link = ereg_replace("^".$htpath, $htlink, $file);
115 $name = basename($file);
116
117 printf(" <li class='tabno".$n."'>");
118 printf("<A class='tooltip load_png' name='".$link."' ");
119 printf("onclick=\"Switch(".$n.");\" ");
120 printf("onmouseover=\"LoadImgTT('".$link."');\" HREF='#'>");
121 printf($arr[$i][1]."<span class='info'>".$arr[$i][2]."</span>");
122 printf("<span class='preview' id='preview'><div>".$arr[$i][2]."</div>");
123 printf("<span id='image'></span></span></A></li>\n");
124 }
125 }
126
127 foreach (glob($path."/*") as $file)
128 {
129 $info = pathinfo($file); // dirname, extension, basename, filename
130
131 $link = ereg_replace("^".$htpath, $htlink, $file);
132 $name = $info['basename'];
133 $exten = $info['extension'];
134
135
136 // Define list of valid extension
137 if ($exten!="html" && $exten!="rc")
138 continue;
139
140 printf(" <li class='tabno".$n."'>");
141 printf("<A class='tooltip load_".$exten."' name='".$link."' ");
142 printf("onclick=\"Switch(".$n.");\" HREF='#'>");
143
144 if ($exten=="html")
145 printf(ereg_replace("[0-9]{8}\.html", "", $name).".log");
146 if ($exten=="rc")
147 printf($name);
148
149 printf("<span class='info'>".$name."</span></A></li>\n");
150
151 $n++;
152 }
153?>
154</ul>
155</div>
156<table style="clear:both;" background="box_mtl_ctr.gif" border="0" cellpadding="0" cellspacing="0" width="100%">
157<tbody>
158 <tr height="12">
159 <td width="12"><img src="box_mtl_topl.gif"></td>
160 <td background="box_mtl_top.gif"><img src="spacer.gif"></td>
161 <td width="12"><img src="box_mtl_topr.gif"></td>
162 </tr>
163 <tr>
164 <td background="box_mtl_l.gif" width="12"><img src="spacer.gif"></td>
165 <td align="center" background="bg_spacer.gif" valign="top">
166 <div class="tabcontent" id="tabcontent"></div>
167 </td>
168 <td background="box_mtl_r.gif" width="12"><img src="spacer.gif"></td>
169 </tr>
170 <tr height="14">
171 <td width="12"><img src="box_mtl_botl.gif"></td>
172 <td background="box_mtl_bot.gif"><img src="spacer.gif"></td>
173 <td width="12"><img src="box_mtl_botr.gif"></td>
174 </tr>
175</tbody>
176</table>
177<!--
178<div class="tabcontent" id="tabcontent"></div>
179-->
180<div style="display:none" id="default">
181<?
182 printf("<p>\n");
183 printf("<center>\n");
184 printf(" <table class='marstable'>\n");
185 printf(" <tr><td id='title' colspan='3'>%s</td></tr>\n", $arr[0][2]);
186
187 for ($i=1; $i<sizeof($lines); $i++)
188 {
189 foreach (glob($path.$prefix[$type].$i.".png") as $file)
190 {
191 $link = ereg_replace("^".$htpath, $htlink, $file);
192 $name = basename($file);
193
194 printf(" <tr>");
195 printf("<td id='left'>%d</td>", $i);
196 printf("<td id='middle'><A HREF=\"#\" ");
197 printf("onclick=\"Switch(".$i.");\">");
198 printf(htmlspecialchars($arr[$i][1])."</A></td>");
199 printf("<td id='right'>".htmlspecialchars($arr[$i][2])."</td>");
200 printf("</tr>\n");
201 }
202 }
203
204 foreach (glob($path."*") as $file)
205 if (ereg("\.(root|log|html|pdf|ps|rc)$", $file))
206 {
207 $link = ereg_replace("^".$htpath, $htlink, $file);
208 $name = basename($file);
209
210 printf(" <tr>");
211 printf("<td id='left'></td>");
212 printf("<td id='middle'>Download</td>");
213 printf("<td id='middle' colspan='1'><A HREF=\"".$link."\">".$name."</A></td>");
214 printf("</tr>\n");
215 }
216
217 printf(" </table>\n");
218 printf("</center>\n");
219 printf("</p>\n");
220?>
221</div>
222<p id="myContent">
223<?/*printf(
224"SERVER: ".$_SERVER["SERVER_NAME"]."<br>".
225"HTTP_HOST: ".$_SERVER["HTTP_HOST"]."<br>".
226"REQ_URI: ".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]."<br>".
227"DIR: ".dirname($_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"])."<br>".
228"REQ_URI: ".basename($_SERVER["REQUEST_URI"])."<br>".
229"PATH_TRANS: ".$_SERVER["PATH_TRANSLATED"]."<br>".
230"PATH_INFO: ".$_SERVER["PATH_INFO"]."<br>".
231"SCRIPT_NAME: ".$_SERVER["SCRIP_NAME"]."<br>".
232"_FILE_: ".__FILE__."<br>".
233"_DIR_: ".__DIR__."<br>".
234$paths[$type]."\n".$path."\n".$_GET["number"]."\n".$_GET["type"]."\n".$number."\n".$type);
235*/?>
236</p>
237</body>
238</html>
Note: See TracBrowser for help on using the repository browser.