#!/bin/ksh
echo 'Interface to Google Chart Geo or Map Chart interfacer created by RJM Programming ...'
echo ''
text=""
underscore=""
csuffix=""
centralplace=""
equl="="
echo 'Verb for command line eg. open eg. curl eg. map'
read verb
if [ -z "$verb" ]; then
 verb="open"
fi
if [ "$verb" != "map" ]; then
 csuffix=""
else
 csuffix="#mapit=y"
 underscore="__"
fi
if [ ! -z "$verb" ]; then
echo ''
if [ "$verb" != "map" ]; then
echo 'Enter comma separated list of placenames (and append #mapit=y for Map Chart rather than Geo Chart), or list of countries (suffix by &amp;text=y for text mode display)  eg. Sydney,Beijing,London,Paris,Rome,Boston,Santiago,New_Delhi,Cairo,Istanbul'
else
echo 'Enter comma separated list of placenames (suffix by &amp;text=y for text mode display)  eg. Sydney,Beijing,London,Paris,Rome,Boston,Santiago,New_Delhi,Cairo,Istanbul'
fi
read commastring
if [ ! -z "$commastring" ]; then
if [ "`echo $commastring`" != "`echo $commastring | sed '/mapit/s///g'`" ]; then
 underscore="__"
fi
echo ''
if [ "$verb" != "map" ]; then
echo 'Enter optional central country  eg. Italy'
read centralplace
fi
echo ''
echo 'Enter width [556]  eg. 1112'
read width
if [ -z "$width" ]; then
 width="556"
fi
if [ ! -z "$width" ]; then
echo ''
echo 'Enter height [347] eg. 694'
read height
if [ -z "$height" ]; then
 height="347"
fi
if [ ! -z "$commastring" ]; then
echo ''
echo 'Enter the word text for text display'
read text
echo ''
echo 'Starting the call ...'
if [ "$verb" -eq "map" ]; then
 verb="open"
fi
echo "$verb https://www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?${text}_${width}_${height}_${underscore}${centralplace}_listis${equl}${commastring}${csuffix}"
ksh -c "$verb https://www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?${text}_${width}_${height}_${underscore}${centralplace}_listis${equl}${commastring}${csuffix}"
exit
fi
fi
fi
fi
fi
exit
