#!/usr/sbin/blassic
'/var/www/cgi-bin/solar_web_plot/choose_the_plot.bas
'DATE$ is mm-dd-yyyy
mydate$ = DATE$
month$ = LEFT$(mydate$, 2): day$ = MID$(mydate$, 4, 2): year$ = RIGHT$(mydate$, 4)
PlotPathBasic$ = "http://192.168.0.52:8052/solar_webpage_builder/"
string1$ = PROGRAMARG$(1)
IF string1$ = "today" THEN GOTO PrintTodayPlot
IF string1$ = "yesterday" THEN GOTO PrintYesterdayPlot
IF string1$ = "back" THEN GOTO BackOneDayPlot
' string1$ must be a date number so send an archived page
PlotPath$ = PlotPathBasic$ + string1$ + "_solar_plot.html"
PRINT"
hop"
PRINT""
SYSTEM
' string1 is today
LABEL PrintTodayPlot
PlotPath$ = PlotPathBasic$ + "today_solar_plot.html"
PRINT"hop"
PRINT""
shell "echo -n "+day$+" >/var/www/ramdisk/current_display_day.txt"
SYSTEM
'string1 is yesterday
LABEL PrintYesterdayPlot
yesterday$ = STR$(((VAL(day$)) - 1))
PlotPath$ = PlotPathBasic$ + year$ + month$ + yesterday$ + "_solar_plot.html"
PRINT"hop"
PRINT""
shell "echo -n "+yesterday$+" >/var/www/ramdisk/current_display_day.txt"
SYSTEM
'string1 is back
LABEL BackOneDayPlot
OPEN "/var/www/ramdisk/current_display_day.txt" FOR INPUT AS #1
INPUT #1,current_display_day$
CLOSE #1
back_a_day$ = STR$(((VAL(current_display_day$)) - 1))
PlotPath$ = PlotPathBasic$ + year$ + month$ + back_a_day$ + "_solar_plot.html"
PRINT"hop"
PRINT""
shell "echo -n "+back_a_day$+" >/var/www/ramdisk/current_display_day.txt"
SYSTEM
OPEN "/var/www/ramdisk/myfile" FOR INPUT AS #1
INPUT #1,mystring$
CLOSE #1
shell "echo -n "+my_string$+" >/var/www/ramdisk/my_string"