#!/bin/bash
SUBDIR=
ThisDev=Web
source Commons.sh
#./Web.sh -c
function CreateShotHomepage()
{
$LogFunctionStart
echo "<html><body>" > $SHM0/index.html
WebRec "<div align="right"><a href=http://golem.fjfi.cvut.cz/shots/$((`cat $SHM/ShotNo`-1))>Previous</a>....<a href=http://golem.fjfi.cvut.cz/shots/$((`cat $SHM/ShotNo`))>Last</a>...<a href=http://golem.fjfi.cvut.cz/shots/$((`cat $SHM/ShotNo`+1))>Next</a></div>"
WebRec "<h1>Shot #`cat $SHM/ShotNo` @ GOLEM</h1>"
WebRec "<i>`grep Command $SHM0/ShotLogbook`</i>"
WebRec "<hr/>"
WebRec "<h2><a href=DASs/>DASs</a></h2>"
WebRec "<a href=DASs/TektrMSO56Standard/ScreenShot.png><img src=DASs/TektrMSO56Standard/ScreenShot.png width=50%/></a>"
WebRec "<br/><h3>Standard DAS: <font color=yellow>U<sub>l</sub></font>,<font color=orange>B<sub>t</sub></font>,<font color=violet>I<sub>p+ch</sub></font>,<font color=green>I<sub>rad</sub></font>....<a href=DASs/TektrMSO56Standard/>Data</a></h3>"
WebRec "<h2><a href=Infrastructure/>Infrastructure</a></h2>"
WebRec "<a href=Infrastructure/Charger/ScreenShot.png><img src=Infrastructure/Charger/ScreenShot.png width=50%/></a>"
WebRec "<br/><h3>Power supply, Capacitor Charger: <font color=yellow>HV power supply</font>,<font color=violet>U<sub>Bt</sub></font>,<font color=blue>U<sub>CD</sub></font></h3>"
WebRec "<hr/>"
WebRec "</html></body>"
$LogFunctionEnd
}
function WebRec()
{
echo $@ >> $SHM0/index.html
}
TASK=$1
COMMANDLINE=`echo $@|sed 's/-r //g;s/-s //g'`
case "$TASK" in
"")
RETVAL=1
;;
--raw_command|-r)
$COMMANDLINE
;;
--sandbox|-s)
echo "$COMMANDLINE"|netcat -w 1 $ThisDev 5555
;;
--rsync)
RsyncDeviceFromDirigent
;;
--create|-c)
RsyncDeviceFromDirigent
CreateShotHomepage
;;
esac