source: trunk/htdocs/index.php @ 280

Last change on this file since 280 was 280, checked in by DavidSmith, 16 years ago

fixed use of $cals

File size: 25.7 KB
Line 
1<?php   session_start(); ?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html>
3<?php
4 // index.php
5 // Matthew Whiting Nov 2007
6 // From the original by Albert Teoh
7 //
8 // The opening page for the ATNF Pulsar Data Archive
9 // system. Used to search for observation archive
10 // files.
11 
12 // BEGIN Javascript for expansion blocks
13 // Thanks to:
14 // http://assn9.blogspot.com/
15 // Douglas Bowman
16 // URL:      www.stopdesign.com
17 // Used in: http://www.bloggerforum.com/modules/newbb/viewtopic.php?topic_id=8725&forum=6
18 // Date:     26 Feb 2004
19 //
20
21?>
22<head>
23<link rel="stylesheet" type="text/css" href="styles/opal.css" />
24<link rel="stylesheet" type="text/css" href="styles/style.css" />
25<link rel="stylesheet" type="text/css" href="styles/query.css" />
26<link rel="stylesheet" type="text/css" href="styles/results.css" />
27<link rel="stylesheet" type="text/css" href="styles/atnf.css" />
28<meta http-equiv="Content-Type" content="text/html; charset=iso-8759-1" />
29<meta name="DC.Creator" lang="en" content="personalName=Teoh,Albert" />
30<meta name="ATNF.Maintainer" content="contactName=Webmaster,the" />
31<meta name="DC.Title.alt" lang="en" content="" />
32<meta name="DC.Subject" lang="en" content="pulsar" />
33<meta name="DC.Description" lang="en" content="Searches the data archives at the ATNF" />
34<meta name="DC.Date.created" scheme="ISO8601" content="2002-12-12" />
35<meta name="ATNF.Site" content="Marsfield" />
36<meta name="ATNF.AccessPermission" content="Public" />
37    <meta name="ATNF.MetaVersion" content="1.0" />
38   
39    <script type="text/javascript" src="scripts/atnf-oo-utils.js"></script>
40    <script type="text/javascript" src="scripts/atnf-string-utils.js"></script>
41    <script type="text/javascript" src="scripts/atnf-dom-utils.js"></script>
42    <script type="text/javascript" src="scripts/atnf-validation.js"></script>
43    <script type="text/javascript" src="scripts/atoa-query.js"></script>
44    <script type="text/javascript" src="scripts/tooltips.js"></script>
45
46<!--
47   <script type="text/javascript" src="scripts/atnf-dom-utils.js"></script>
48   <script type="text/javascript" src="scripts/atoa-query.js"></script>
49   <script type="text/javascript" src="scripts/process.js"></script>
50-->
51
52
53<script type="text/javascript" language="javascript1.2">
54
55
56
57function togglecomments (id1,id2) {
58
59                var obj1 = document.getElementById(id1);
60                var obj2 = document.getElementById(id2);
61                (obj1.className=="commentshown") ? obj1.className="commenthidden" : obj1.className="commentshown";
62                (obj1.className=="commentshown") ? obj2.innerHTML="<< Hide" : obj2.innerHTML="Show all >>";
63
64}
65
66function checkAll(objName, FormName, FieldName ) {
67
68        var obj = document.getElementsByName(objName);
69        var CheckValue = obj[0].checked;
70
71        if(!document.forms[FormName])
72                return;
73        var objCheckBoxes = document.forms[FormName].elements[FieldName];
74        if(!objCheckBoxes)
75                return;
76        var countCheckBoxes = objCheckBoxes.length;
77        if(!countCheckBoxes)
78                objCheckBoxes.checked = CheckValue;
79        else
80                // set the check value for all check boxes
81                for(var i = 0; i < countCheckBoxes; i++)
82                        objCheckBoxes[i].checked = CheckValue;
83}
84
85function updateSelectAll(objId, allId) {
86        var obj = document.getElementById(objId);
87        var allCheckbox = document.getElementById(allId);       
88       
89        if (!objId.checked && allCheckbox.checked) {
90                allCheckbox.checked = false;
91        }
92               
93               
94}
95</script>
96
97</head>
98
99<title>ATNF Pulsar Data Archive Home</title>
100
101<!-- Start Content -->
102<?php
103       
104require_once 'constants.php';
105require_once 'security.php';
106require_once 'PulsarArchiveDB.php';
107require_once 'date.php';
108require_once 'logger.php';
109
110include 'header.html';
111
112
113
114
115// The fields to display in the results
116if( isset( $_SESSION['fields'] ) )
117    $selected_fields = $_SESSION['fields'];
118else
119  $selected_fields = Array( "filename", "src_name", "project_id", "raj", "decj",
120                            "data_type", "obsfreq", "bw", "scanlen", "date", "ut", "nsub", "nchan" );
121
122// set some form defaults
123
124$radius = 60;
125$bandname = Array();
126$cals = 'cals';
127$cals_within_mins = 30;
128$orderDir = 'asc';
129
130
131if( isset($_SESSION['pulsar_name']) ) $pulsar_name = $_SESSION['pulsar_name'];
132if( isset($_SESSION['project_id']) )  $project_id = $_SESSION['project_id'];
133if( isset($_SESSION['obs_mode']) )  $obs_mode = $_SESSION['obs_mode'];
134if( isset($_SESSION['data_type']) )  $data_type = $_SESSION['data_type'];
135if( isset($_SESSION['orderBy']) )  $orderBy = $_SESSION['orderBy'];
136if( isset($_SESSION['orderDir']) ) $orderDir = $_SESSION['orderDir'];
137if( isset($_SESSION['survey']) )  $survey = $_SESSION['survey'];
138if( isset($_SESSION['rahour']) )  $rahour = $_SESSION['rahour'];
139if( isset($_SESSION['ramin']) )  $ramin = $_SESSION['ramin'];
140if( isset($_SESSION['rasec']) )  $rasec = $_SESSION['rasec'];
141if( isset($_SESSION['decdeg']) )  $decdeg = $_SESSION['decdeg'];
142if( isset($_SESSION['decmin']) )  $decmin = $_SESSION['decmin'];
143if( isset($_SESSION['decsec']) )  $decsec = $_SESSION['decsec'];
144if( isset($_SESSION['radius']) )  $radius = $_SESSION['radius'];
145if( isset($_SESSION['bandname']) )  $bandname = $_SESSION['bandname'];
146if( isset($_SESSION['from_day']) )  $from_day = $_SESSION['from_day'];
147if( isset($_SESSION['from_month']) ) $from_month = $_SESSION['from_month'];
148if( isset($_SESSION['from_year']) )  $from_year = $_SESSION['from_year'];
149if( isset($_SESSION['to_day']) )  $to_day = $_SESSION['to_day'];
150if( isset($_SESSION['to_month']) )  $to_month = $_SESSION['to_month'];
151if( isset($_SESSION['to_year']) )  $to_year = $_SESSION['to_year'];
152if( isset($_SESSION['cals_within_mins']) ) $cals_within_mins = $_SESSION['cals_within_mins'];
153if( isset($_SESSION['cals']) ) $cals = $_SESSION['cals'];
154
155
156
157
158
159try {
160
161
162$now_day = date("j");
163$now_month = date("n");
164$now_year = date("Y");
165
166$all_params_id = "all_params";
167$all_others_id = "all_others";
168
169//$link = db_connect();
170$db = new PulsarArchiveDB();
171$db->connect( DB_SERVER . ':' . DB_PORT, DB_USERNAME, DB_PASS, DB_NAME );
172
173
174//$link = db_connect_admin();
175//loadNewTables();
176//////////////////////////////
177// Initialise error messages
178//
179
180$date_error = "";
181
182///////////////////////////////////
183// Find out the first and last dates
184//$query = "select min(mjd), max(mjd) from ".OBSERVATIONS_TABLE;
185
186$min_mjd = '';
187$max_mjd = '';
188
189$db->GetMinMaxMJD( $min_mjd, $max_mjd );
190
191// Convert from MJD to JD
192$min_jd = $min_mjd + 2400000.5;
193$max_jd = $max_mjd + 2400000.5;
194
195// convert the mjd to a date
196$min_jd = floor($min_jd);
197$max_jd = ceil($max_jd);
198
199$min_unix = jdtounix($min_jd);
200$max_unix = jdtounix($max_jd);
201$min_date_text = date("j F Y", $min_unix);
202$max_date_text = date("j F Y", $max_unix);
203$minDay   = date("j",$min_unix);
204$minMonth = date("n",$min_unix);
205$minYear  = date("Y",$min_unix);
206$maxDay   = date("j",$max_unix);
207$maxMonth = date("n",$max_unix);
208$maxYear  = date("Y",$max_unix);
209
210// proprietry date limit
211$today_mjd = cal_to_jd ( CAL_GREGORIAN, date("n"), date("j"), date("Y") ) - 2400000.5;
212$prop_mjd = $today_mjd - PROPRIETRY_PERIOD_DAY;
213$prop_unix = jdtounix($prop_mjd+2400000.5);
214$prop_date_text = date("j F Y", $prop_unix);
215
216
217
218// Clear any old form inputs in session cache
219init();
220
221//////////////////////////////////////////////
222// Get the field names to fill form checkboxes
223
224$fields = $db->GetObservationFields();
225
226$field_names = Array("filename" => "Filename",
227                     "src_name" => "Source Name",
228                     "project_id" => "Project ID",
229                     "raj" => "RA (J2000, hh:mm:ss)",
230                     "decj" => "Dec (J2000, dd:mm:ss)",
231                     "data_type" => "Data Type",
232                     "obsfreq" => "Frequency",
233                     "bw" => "Bandwidth",
234                     "scanlen" => "Scan Length",
235                     "date" => "UT Date",
236                     "ut" => "UT Time",
237                     "MJD" => "MJD",
238                     "rajd" => "RA (J2000, degs)",
239                     "decjd" => "Dec (J2000, degs)",
240                     "gl" => "Gal. Long. (degs)",
241                     "gb" => "Gal. Lat. (degs)",
242                     "BMAJ" => "Beamsize: BMAJ",
243                     "BMIN" => "Beamsize: BMIN",
244                     "BPA" => "Beam: BPA",
245                     "dm" => "D.M.",
246                     "period" => "Period",
247                     "nchan" => "# channels",
248                     "npol" => "# polarisations",
249                     "nbin" => "# bins",
250                     "nsub" => "# subintegrations",
251                     "tsamp" => "Sample time",
252                     "nbits" => "# bits per sample",
253                     "nbeam" => "# beams",
254                     "cnfg" => "Configuration",
255                     "inst" => "Instrument",
256                     "rcvr" => "Receiver",
257                     "hdrver" => "PSRFITS version",
258                     "survey" => "Survey name",
259                     "telescope" => "Telescope",
260                     "site" => "Site ID",
261                     "obsrvr" => "Observer ID" );
262
263/////////////////////////////////////////////////
264// Load search form parameters if they have been stored.
265//
266
267
268
269///////////////////////////////////////////////
270// Get the data types available in the database
271//
272
273$data_types = $db->GetDataTypes();
274
275///////////////////////////////////////////////
276// If the user clicked on the logout button
277if (isset($HTTP_GET_VARS['command'])) {
278  $command = $HTTP_GET_VARS['command'];
279  if ($command == 'logout') {
280    //unset($_SESSION['auth_code']);
281    //unset($_SESSION['username']);
282    $_SESSION = array();
283  }
284}
285
286// If the user hasn't logged in before or if the previous
287// session's authentication wasn't successful
288// Then use the submitted username and password
289if (!isset($_SESSION['auth_code']) || $_SESSION['auth_code'] != OK) {
290  //    $username = $HTTP_POST_VARS["username"];
291//      $password = $HTTP_POST_VARS["password"];
292  $username = $HTTP_POST_VARS["opalEmail"];
293  $password = $HTTP_POST_VARS["opalPassword"];
294  $type = $HTTP_POST_VARS['authenticateType'];
295  if($type == "anon"){
296    $username = $HTTP_POST_VARS["email"];
297    $auth_code = OK;
298    logger_login( $username, 'Anonymous', 'success' );
299  }
300  else{
301    $auth_code = authenticate($username, $password);
302    if( $auth_code == OK )
303      logger_login( $username, 'Opal', 'success' );
304    else
305      logger_login( $username, 'Opal', 'failure' );
306    //$auth_code = newAuthenticate();
307  }
308}
309else {
310        $auth_code = $_SESSION['auth_code'];
311        $username = $_SESSION['username'];
312}
313
314// Initial state where no username or password supplied OR bad login state
315if ($auth_code != OK) { ?>
316  <body class="front_page">
317
318
319<div class="bodycontents">
320
321<h1>The ATNF Pulsar Data Archive</h1>
322
323<p>The ATNF Pulsar Data Archive provides access to pulsar observations
324made with the Parkes radio Telescope. Data older than <b>
325<?php echo PROPRIETRY_PERIOD_MONTH ?> months</b> is
326publicly available, and can be accessed by simply providing your email
327address. More recent data is proprietry, and can only be accessed by
328those who were involved in the proposal. We plan to do this via the
329<a href="http://opal.atnf.csiro.au">OPAL system</a>, but this is
330currently not enabled. In the interim, those who have previously
331obtained a login for the Data Archive can use that option below
332(making sure to check the "Data Archive login" button!). </p>
333
334<p>A <a href="pulsar_archive_guide.html">Users Guide</a> to the archive is available.</p>
335
336<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
337<table width="700" style="border: 0px;">
338
339  <tr>
340    <td><input type="radio" name="authenticateType" checked value="anon">Non-proprietry access<br>
341      <table class="login" width="500" style="border: 0px;">
342        <tr>
343          <td class="form_field">Email: </td>
344          <td><input type="text" name="email"></td>
345        </tr>
346      </table>
347      <br>
348    </td>
349  </tr>
350 
351  <tr>
352
353    <td><input type="radio" name="authenticateType" value="opal">Data Archive login<br>
354      <table class="login" width="500" style="border: 0px;">
355        <tr><td class="form_field">Username: </td><td><input type="text" name="opalEmail"></td></tr>
356        <tr><td class="form_field">Password: </td><td><input type="password" name="opalPassword"></td></tr>
357      </table>
358      <br>
359    </td>
360  </tr>
361 
362  <tr>
363    <td><input type="submit" value="Login"><input type="reset" value="Reset"></td>
364  </tr>
365</table>
366
367</form>
368
369
370<?php } else {
371        $_SESSION['username'] = $username;
372        $_SESSION['auth_code'] = $auth_code;
373        $_SESSION['logintype'] = $HTTP_POST_VARS['authenticateType'];
374
375        $actions = $HTTP_GET_VARS['actions'];
376       
377        if ($actions == "new_query") {
378                init();
379        }
380        else if ($actions == "error") {
381          //            $date_error = "You are only authorised to access data > 18 months old";
382        }
383?>
384<body class="atoa">
385    <div class="bodycontents">
386
387    <h1>ATNF Pulsar Data Archive</h1>
388
389    <p>This archive provides access to pulsar observations taken at the Parkes radio telescope between the dates of <b><?php echo $min_date_text."</b> and <b>".$max_date_text?></b>.</p>
390    <?php
391    // TODO - This code needs to be replaced with opal based code
392// // //    if (!atnf_staff($_SESSION['username'])) {
393// // //      //if($_SESSION['logintype']=="anon") {
394// // //      echo "<p>Note that you do not have access to data more recent than <b>".$prop_date_text."</b>.</p>\n";
395// // //    }?>
396<p>See the Users Guide link for more details. </p>
397   
398    <table width="700" style="border: 0px;">
399    <tr align="center">
400    <td>
401    <a class="top_menu" href="<?php echo $PHP_SELF; ?>?command=logout">Logout</a>
402    <!--a href="login?_action=logout">Logout</a-->
403
404    </td>
405        <td>
406        <a href="#" onClick="toggleInstructions();return false;">Instructions</a>
407        </td>
408        <td size="30">
409        &nbsp;
410    </td>
411        <td>
412        <a href="pulsar_archive_guide.html">Users Guide</a>
413        </td>
414        </tr>
415
416        </table>
417
418        <div id="divInstructions" style="display:none" >
419          <dl class="top">
420            <h2>Instructions</h2>
421        <i>To hide, click "Instructions" again. </i>
422              <dt> Display Parameters </dt>
423                <dd> Check the fields you want shown in the results table. Suggested columns are checked by default</dd>
424                <dd> The results can be ordered by one of the parameters in the "Order By" drop-down list</dd>
425              <dt> Coordinates </dt>
426                <dd> The sky position can be specified by a Pulsar name or a RA/Dec position.
427                      The pulsar name takes precedence. The search radius must be given. </dd>
428              <dt> Filter Options </dt>
429                <dd> Results can be limited to observations just from a particular project - use the Project ID box</dd>
430                <dd> The date range can be specified - the defaults are the range of dates in the archive.</dd>
431                <dd> Either timing data (particular pulsar) or survey data can be specified. Or both! </dd>
432                <dd> The type of instrument can be specified. Default is any type.</dd>
433                <dd> More than one frequency band can be specified.
434              <dt> Display Other </dt>
435        <dd> Calibraton observations taken within a given time period of the queried observations can also be shown and downloaded. Check the box to do so, and specify the time interval. </dd>
436            </dl>
437        </div>
438
439
440
441<!--<table class="noborder">
442<tr><td><a class="top_menu" href="<?php echo $PHP_SELF; ?>?command=logout">Logout</a> | <a class="top_menu" href="change_password.html?prev_page=<?php echo urlencode("index.php"); ?>">Change Password</a></td>
443</tr>
444</table>-->
445
446
447<form action="query.php" method="GET" name="data_archive_form" id="data_archive_form">
448<input type="hidden" name="state" value="results">
449   
450
451   
452   
453<table class="noborder" cellpadding=0>
454
455    <tr><td colspan=3>
456        <br>
457        <center><input type="submit" value="submit" name="submit_button" style="float: center;"> &nbsp;
458        <input type="reset" value="reset" name="reset_button" style="float: center;"></center>
459        <br>
460    </td></tr>
461   
462    <tr>
463       
464<!-- **************************** -->
465    <td valign="top" class="form_field" rowspan="1">
466
467    <fieldset>
468                <legend>DISPLAY PARAMETERS</legend>
469                <input type="checkbox" name="<?php echo $all_params_id; ?>" id="<?php echo $all_params_id; ?>" onClick="checkAll('<?php echo $all_params_id; ?>', 'data_archive_form', 'params[]')" >Select all<br>
470                        <!--font size="-1"><a href="javascript:togglecomments('params', 'toggler1')" id="toggler1">Show all >></a></font--><br>
471                        <!span class="commenthidden" id="params">
472                        <div id="list">
473                                <?php
474                                foreach ($fields as $field) {
475                                  echo "<input
476onClick=\"updateSelectAll('".$field['Field']."', '$all_params_id')\" type=\"checkbox\" name=\"params[]\" value=\"".$field['Field']."\" id=\"".$field['Field']."\"";
477                                  if( in_array( $field['Field'], $selected_fields ) )
478                                    echo ' checked="true"';
479                                  echo " >".$field_names[$field['Field']]."<br>\n";
480                                }
481                                ?>
482                        </div>
483                        </span>
484        </fieldset>
485                       
486        </td>
487
488<!-- **************************** -->
489
490        <td class="form_field" height="10%" rowspan="1">
491        <!-- Position Options -->
492
493        <table cellspacing=0 cellpadding=0 style="border: 0px;">
494        <tr><td>
495        <fieldset id="flsPosition">
496                <legend>POSITION REQUIREMENTS</legend>
497               
498                <!-- Pulsar Name -->
499                <fieldset>
500                <legend>Pulsar Name</legend>
501                <input type="text" name="pulsar_name" size="20" value="<?php echo $pulsar_name;?>">
502                <br>
503                <p>Note that search-by-name takes precedence over search-by-RA/Dec.</p>
504                </fieldset>
505
506                <br>
507               
508                <fieldset>
509                <legend>Right Ascension (J2000)</legend>
510               
511                <input type="text" id="txtRAHour" name="rahour" size="3" tabindex="1" value="<?php echo $rahour;?>"/>
512                <label for="txtRAHour" class="coordinate"><abbr title="hours"><sup>h</sup></abbr></label>
513                                             
514                    <input type="text" id="txtRAMinute" name="ramin" size="3" tabindex="1" value="<?php echo $ramin;?>"/>
515                <label for="txtRAMinute" class="coordinate"><abbr title="minutes"><sup>m</sup></abbr></label>
516               
517                    <input type="text" id="txtRASecond" name="rasec" size="6" tabindex="1" value="<?php echo $rasec;?>"/>
518                <label for="txtRASecond" class="coordinate"><abbr title="seconds"><sup>s</sup></abbr></label>
519                </fieldset>
520       
521                <fieldset>
522                <legend>Declination (J2000)</legend>
523               
524                    <input type="text" id="txtDecDegree" name="decdeg" size="3" tabindex="1" value="<?php echo $decdeg;?>"/>
525                <label for="txtDecDegree" class="coordinate"><abbr title="degrees">&deg;</abbr></label>
526               
527                    <input type="text" id="txtDecMinute" name="decmin" size="3" tabindex="1" value="<?php echo $decmin;?>"/>
528                <label for="txtDecMinute" class="coordinate"><abbr title="minutes">&prime;</abbr></label>
529               
530                    <input type="text" id="txtDecSecond" name="decsec" size="6" tabindex="1" value="<?php echo $decsec;?>"/>
531                <label for="txtDecSecond" class="coordinate"><abbr title="seconds">&Prime;</abbr></label>
532                </fieldset>
533
534                <br>
535                <br>
536        </fieldset>
537
538        <fieldset id="flsSearchRadius">
539        <legend>SEARCH WINDOW [arcmin]</legend>
540        <input type="text" id="txtSearchWindow" name="radius" size="20" tabindex="1" value="<?php echo $radius;?>"/>
541        </fieldset>
542
543<br>
544        <fieldset id="flsProjectID">
545        <legend>PROJECT ID</legend>
546        <input type="text" id="txtSearchWindow" name="projID" size="20" tabindex="1" value="<?php echo $project_id;?>"/>
547        </fieldset>
548
549        </td></tr>
550</table>
551</td>
552
553<!-- **************************** -->
554
555        <td class="form_field" height="10%">
556        <!-- Filter Options -->
557        <table cellspacing=0 cellpadding=0 style="border: 0px;">
558        <tr><td>
559        <fieldset id="flsObsDate">
560                               
561                <legend>FILTER OPTIONS</legend>
562<br>
563
564                <!-- Date range -->
565                <fieldset>
566                        <legend>Date Range</legend>
567                       
568                          From:                                                                       
569                            <select name="from_day">
570                            <?php
571                            for ($i = 1; $i <= 31; $i++) {
572                              echo "\t\t\t<option";
573                              if ($i == $from_day || $from_day == '' && $i == minDay) { echo " selected"; }
574                              echo " value=\"$i\">$i</option>\n";
575                            }
576                                ?>
577                            </select>
578                        <select name="from_month">
579                                <?php
580                                $monthlist = cal_info(0);
581                                for ($i = 1; $i <= 12; $i++) {
582                                  echo "\t\t\t<option";
583                                  $month = $monthlist[abbrevmonths][$i];
584                                  if ($i == $from_month || $from_month == '' && $i == minMonth) { echo " selected"; }
585                                  echo " value=\"$i\">$month</option>\n";
586                                }
587                                ?>
588                                  </select>
589<!-- <input type="text" size="4" name="from_year" value="<?php echo $min_cal_assoc['year']; ?>"> -->
590                      <select name="from_year">
591                                      <?php
592                                      for ($i = $minYear; $i <= $maxYear; $i++) {
593                                        echo "\t\t\t<option";
594                                        if ($i == $from_year || $from_year == '' && $i == minYear ) { echo " selected"; }
595                                  echo " value=\"$i\">$i</option>\n";
596                                }
597                                ?>
598                            </select>
599                        <?php echo "<font size=\"-1\" color=\"red\">$date_error</font>" ?>
600                                &nbsp To:
601                        <select name="to_day">
602                                <?php
603                                        for ($i = 1; $i <= 31; $i++) {
604                                          echo "\t\t\t<option";
605                                          if ($i == $to_day || $to_day == '' && $i == $maxDay) { echo " selected"; }
606                                          echo " value=\"$i\">$i</option>\n";
607                                        }
608                                ?>
609                        </select>
610                        <select name="to_month">
611                                <?php
612                            for ($i = 1; $i <= 12; $i++) {
613                              echo "\t\t\t<option";
614                              $month = $monthlist[abbrevmonths][$i];
615                              if ($i == $to_month || $to_month == '' && $i == $maxMonth) { echo " selected"; }
616                              echo " value=\"$i\">$month</option>\n";
617                            }
618                                ?>
619                        </select>
620                      <select name="to_year">
621                                      <?php
622                                      for ($i = $minYear; $i <= $maxYear; $i++) {
623                                        echo "\t\t\t<option";
624                                        if ($i == $to_year || $to_year == '' && $i == $maxYear ) { echo " selected"; }
625                                  echo " value=\"$i\">$i</option>\n";
626                                }
627                                ?>
628                            </select>
629                </fieldset>
630 
631<br>
632                <!-- Obs Mode -->
633                <fieldset>
634                  <legend>Obs Mode</legend>
635
636                  <select name="obs_mode" onchange="ObsModeChanged()" id="ObsModeList">
637                    <option value="any" <?php if($obs_mode == 'any') echo 'SELECTED';?> > Any </option>
638                    <option value="timing" <?php if($obs_mode == 'timing') echo 'SELECTED';?>> Only timing data </option>
639                    <option value="search" <?php if($obs_mode == 'search') echo 'SELECTED';?>> Only search data </option>
640                  </select>
641                </fieldset>
642
643                <!-- Data Type -->
644                <fieldset>
645                        <legend>Data Type</legend>
646
647                        <select name="data_type">
648                                <option value="" selected> Any </option>
649                                <?php
650                                foreach ($data_types as $next_type) {
651                                        echo '<option value="' . $next_type['data_type'] . '"';
652                                        if( $next_type['data_type'] == $data_type ) echo ' SELECTED ';
653                                        echo '> ' . $next_type['data_type'] . '</option>';
654                                }
655                                ?>
656                        </select>
657                </fieldset>     
658
659                <!-- Frequency band -->
660                <fieldset>
661                        <legend>Band Name</legend>
662                            <select id="selBand" name="bandname[]" multiple="multiple" size="5">
663                            <option value="anyBand"
664                                    <?php if( in_array( 'anyBand', $bandname ) ) echo 'SELECTED';?>
665                                    >Any
666                            </option>
667                            <option value="70cm"   
668                                <?php if( in_array( '70cm', $bandname ) ) echo 'SELECTED';?>
669                                >70cm (~0.44 GHz)
670                            </option>
671                            <option value="50cm"
672                                    <?php if( in_array( '50cm', $bandname ) ) echo 'SELECTED';?>
673                                    >50cm (~0.66 GHz)
674                            </option>
675                            <option value="20cm"
676                                    <?php if( in_array( '20cm', $bandname ) ) echo 'SELECTED';?>
677                                    >20/18cm (1.2-1.8 GHz)
678                            </option>
679                            <option value="13cm"
680                                    <?php if( in_array( '13cm', $bandname ) ) echo 'SELECTED';?>
681                                    >13cm (2.0-2.5 GHz)
682                            </option>
683                            <option value="10cm"
684                                    <?php if( in_array( '10cm', $bandname ) ) echo 'SELECTED';?>
685                                    >10cm (2.6-3.6 GHz)
686                            </option>
687                            <option value="6cm"
688                                    <?php if( in_array( '6cm', $bandname ) ) echo 'SELECTED';?>
689                                    >6cm (4.5-5.1 GHz)
690                            </option>
691                            <option value="5cm"
692                                    <?php if( in_array( '5cm', $bandname ) ) echo 'SELECTED';?>
693                                    >5cm (5.9-6.8 GHz)
694                            </option>
695                            <option value="3cm"
696                                    <?php if( in_array( '3cm', $bandname ) ) echo 'SELECTED';?>
697                                    >3cm (8.1-8.6 GHz)
698                            </option>
699                            <option value="1.3cm"
700                                    <?php if( in_array( '1.3cm', $bandname ) ) echo 'SELECTED';?>
701                                    >1.3cm (21.-24. GHz)
702                            </option>
703          </select>
704     </fieldset>
705
706       </fieldset>
707        </td></tr>
708        <tr><td>
709                <fieldset>
710                    <legend>ORDER RESULTS BY</legend>
711                            <table cellspacing="0px" cellpadding="0px" style="border: 0px;">
712                            <tr><td>
713                      <select name="orderBy" id="OrderByList">
714                            <option value="distance" <?php if($orderBy == 'distance') echo 'SELECTED';?>>Distance
715                            <option value="date" <?php if($orderBy == 'date') echo 'SELECTED';?>>Date
716                            <option value="obsfreq" <?php if($orderBy == 'obsfreq') echo 'SELECTED';?>>Frequency
717                            <option value="filename" <?php if($orderBy == 'filename') echo 'SELECTED';?>>Filename
718                      </select>
719                            </td><td>
720                            &nbsp;<input type="radio" name="orderDir" id="orderDirectionSel" value="asc"
721                                 <?php if( $orderDir == 'asc' ) echo 'checked';?>
722                                 >Ascending
723                            <br>
724                            &nbsp;<input type="radio" name="orderDir" id="orderDirectionSel" value="desc"
725                                 <?php if( $orderDir == 'desc' ) echo 'checked';?>
726                                 >Descending
727                            </td></tr>
728                            </table>
729                    <br>
730                </fieldset>
731        </td></tr>
732        <tr><td>
733                <fieldset>
734                    <legend>DISPLAY OTHER DATA</legend>
735                               
736                    <input type="checkbox" name="cals" value="cals" id="cals"
737                                <?php if( $cals == 'cals' ) echo 'checked'; ?>
738                                />
739                                Display Cals taken within
740                    <input type="text" name="cals_within_mins" maxlength="5" size="3"
741                                <?php if( $cals_within_mins != '' ) echo 'value="' . $cals_within_mins . '"';?>
742                                />
743                                mins of Observations
744                    <br>
745                </fieldset>
746        </td></tr>
747        </table>
748        <br>
749        </td>
750        </tr>   
751</table>
752
753
754</form>
755<div style="min-height: 20px; max-height: 1000px;"> </div>
756<?php
757}
758
759} catch( MysqlDBException $e ) {
760  logger_exception( $_SESSION['username'], $e->getCode(), $e->getMessage(), '' );
761  echo '<p><div class="exception_box">' .
762       '<center>' .
763       '<b>A database error was encountered</b> <br>' .
764       'the details of the error have been logged, please contact the system administrator for futher assistance <br>' .
765       '</center>' .
766       '</div><p>';
767}
768
769?>
770</div>
771
772<div id=\"footer\">
773<?php   include "footer.html"; ?>
774</div>
775
776</body>
777
778</html>
779
780
781<?php //////////// Function definitions ///////////////
782
783
784// Initialise the input form variables. If the "New query" button is clicked
785// no argument is passed to init(), hence the need for a default NULL value
786// because there is no need for updating user access statistics
787function init($link=NULL) {
788
789        unset($_SESSION['cals']); // The result set of cals
790        unset($_SESSION['obs']); // The result set of observations
791        //unset($_SESSION['cart_items']); // The result set of observations
792}
793
794
795
796
797?>
Note: See TracBrowser for help on using the repository browser.