source: trunk/htdocs/index.php @ 278

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

moved toggling function to scripts/tooltips.js

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