#!/bin/sh

# Script:       Optional Date-Time-Location Prompt
#                      using Default Prefs
#                         for Eryss 0.1
#
# by Apollia - http://apollia.com/
#
# http://eryss.com/
#
#
#------------------------------------------------------------------------------
#
# 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 "Default" prefs file, a Bash script 
# which then launches the Eryss 0.1 PHP console script.
#
#------------------------------------------------------------------------------
#
#
# 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 )"
PREFS_FILENAME="Default"

PREFS_PATH="$THIS_SCRIPT_DIR/prefs/$PREFS_FILENAME"

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 this prefs file: $PREFS_FILENAME" 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 "$PREFS_PATH" "$input"
    ;;
    
  1)
    echo "Cancel pressed.";;
  255)
    echo "Box closed.";;
esac