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