From da4813820120d13460b5e94087bdab297422403e Mon Sep 17 00:00:00 2001 From: Andrew Ruether Date: Tue, 22 Nov 2022 17:52:05 +0000 Subject: [PATCH 1/2] Switched to JQuery datepicker --- airmass.cgi | 43 +++++++++++++++++++++++-------------------- transits.cgi | 41 ++++++++++++++++++++++------------------- 2 files changed, 45 insertions(+), 39 deletions(-) diff --git a/airmass.cgi b/airmass.cgi index 1ffc9b6..d5808fc 100755 --- a/airmass.cgi +++ b/airmass.cgi @@ -224,8 +224,14 @@ print << "END_1"; + Airmass Plots + + + + + - - - + // Initialize datepicker objects + \$( function() { + // Regular expression for mm-dd-yyyy or m-d-yyyy + const re =/\\d{1,2}-\\d{1,2}-\\d{4}/ + \$( ".datepicker" ).datepicker({ + dateFormat: "mm-dd-yy", + constrainInput: false + }).change(function() { + // When date is changed, check to see if not a valid date format or not "today" then invalidate entry + const dateInput = \$(this).val(); + if (!re.test(dateInput) && dateInput.toLowerCase() != "today") { + \$(this).datepicker("setDate", ""); + } + }); + }); - - - -Airmass Plots @@ -505,16 +514,10 @@ print << "END_3";

Date for airmass plot (mm-dd-yyyy or 'today'): - +

- -

Target name: + + + + + + // Initialize datepicker objects + \$( function() { + // Regular expression for mm-dd-yyyy or m-d-yyyy + const re =/\\d{1,2}-\\d{1,2}-\\d{4}/ + \$( ".datepicker" ).datepicker({ + dateFormat: "mm-dd-yy", + constrainInput: false + }).change(function() { + // When date is changed, check to see if not a valid date format or not "today" then invalidate entry + const dateInput = \$(this).val(); + if (!re.test(dateInput) && dateInput.toLowerCase() != "today") { + \$(this).datepicker("setDate", ""); + } + }); + }); - - - - - - Transit Finder @@ -869,15 +878,9 @@ print << "END_3"; date starts search at local noon at observatory on that date."> Base date for transit list (mm-dd-yyyy or 'today'): + id="start_date" name="start_date" class="datepicker" style="text-align:center" />

- -

From that date, show transits for the next days. From 5374502dbfeede449b997ca2e6d5e983a734bd76 Mon Sep 17 00:00:00 2001 From: Andrew Ruether Date: Wed, 23 Nov 2022 16:02:56 +0000 Subject: [PATCH 2/2] Removed old datepicker install info --- README.md | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/README.md b/README.md index e3a8a50..2a8235e 100644 --- a/README.md +++ b/README.md @@ -54,30 +54,7 @@ need this. (Authentication for this has recently gotten very complicated - I'm * `Tie::Handle::CSV`: If you use the script for parsing the exoplanets.org CSV file, you'll need this. -* `Date-Picker`: If you want to have a nice pop-up calendar widget for selecting dates -in the interface for specifying the date range to be considered, you -can download and install the `Date-Picker` widget from -http://www.frequency-decoder.com/2009/09/09/unobtrusive-date-picker-widget-v5 - -The actual download link is toward the bottom of the page: -http://www.frequency-decoder.com/demo/date-picker-v5/date-picker-v5.zip - -There is a call to this in the supplied default input form, assuming -it is installed in a subdirectory called `src` below the directory -where the form is installed. To use, just unpack the zip file into -that `src` subdirectory, and make sure everything is readable by users -of your webserver: -`chmod -R o+rx src/` - -For my own installation, I also edited the file -`src/date-picker-v5/js/lang/en.js` to make Sunday be displayed as the -first day of the week: `firstDayOfWeek:6` It was set to O (Monday) by -default. - -To use a different localization, change the call in the header of the -input form to load a different language file from that subdirectory. - -If you run the code for creating finding charts, you'll need the tools +* If you run the code for creating finding charts, you'll need the tools `convert` and `identify` from `ImageMagick` to be installed and in your path.