source: trunk/htdocs/index.php @ 266

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

Added nsub and nchan as default parameters to show in resultset. Corrected the date range bug [52]

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