#!/bin/sh

# Script:       Optional Date-Time-Location Prompt
#                         for Eryss 0.1
#
# by Apollia of Astroblahhh.Com - http://astroblahhh.com/
#
#
# This script "Optional Date-Time-Location Prompt" is included in:
#
#         Eryss-0.1-and-Swiss-Ephemeris-1.78.00-Extension-Package-1.0-
#         for-Astroblahhh-GLMP-GTK-or-PH-GTK
#
#
#------------------------------------------------------------------------------
#
# Displays an input box asking the user for a date and/or time and/or location,
# all of which are optional.
#
# The user's input is passed to the "Eryss 0.1.phpb"
# PHP console script.  Uses the default preferences inside Eryss 0.1.phpb.
#
#------------------------------------------------------------------------------
#
#
# Under the GNU Affero General Public License v3.0.
#
#
# Copyright (C) 2013-2019  Apollia
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Affero General Public License as published
#    by the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
#
# Contact info:     http://astroblahhh.com/contact-apollia.shtml
#
# ----



THIS_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"


Xdialog --title "Date/Time/Location for Eryss Astrology Software" \
        --inputbox "Please input a date and/or time and/or location.
All are optional.

The location must be at the end of the line, and in this format:

79:59W 40:26N

Then, click OK, or type Tab then Enter on your keyboard.

Leave the input box blank for astrological positions for the present moment.

Will use no prefs file." 0 0 2> /tmp/Apollias-Astrological-Data-Input-Prompt.tmp.$$


retval=$?
input=`cat /tmp/Apollias-Astrological-Data-Input-Prompt.tmp.$$`
rm -f /tmp/Apollias-Astrological-Data-Input-Prompt.tmp.$$


case $retval in
  0)

	if [ -z $input ]
	then
		input=now
	fi
    
    echo "Input string is '$input'"

	sh "Open terminal window which waits for Enter key press instead of instantly closing at end of script" "$THIS_SCRIPT_DIR/Eryss 0.1.phpb" "$input"

    ;;
    
  1)
    echo "Cancel pressed.";;
  255)
    echo "Box closed.";;
esac