source: trunk/htdocs/index.php @ 219

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

Added usage of MysqlDB object and outputting mysql errors.

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