C4Vette Thanks for the tips..theres some great idea's in that code....Hopefully can load some of my event messages into a css and display them in a drop down box...
cheers rob Australia ----- Original Message ----- From: "C4Vette" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Wednesday, September 05, 2007 5:45 PM Subject: Re: [Owfs-developers] Error trap works great on NSLU2 with owfs > > > Ok, I'll try to explain better: > > About the CSS first. The bash-script that is doing the > measuring/calculation/RRD-stuff also does the following: > > OffTIME=77400 # is 21:30 in seconds > OFFSET=$(echo ${CTIME} - ${OffTIME}|bc) # tussenberekening in seconden > if [ $OFFSET -lt 0 ]; then OFFSET=$(echo ${OFFSET} + 86400|bc); fi > PIXELS1=$(echo -e "scale=5\n670-$OFFSET/86400*336"|bc|awk -F "." '{print > $1}') > PIXELS2=$(echo -e "$PIXELS1-335"|bc) # 335 is pixels in between > PIXELS3=$(echo -e "$PIXELS1-670"|bc) > echo "#divNIGHT1 {position:absolute; left:${PIXELS1}px; top:0px;}" >>/tmp/pngnight.css > echo "#divNIGHT2 {position:absolute; left:${PIXELS2}px; top:0px;}" >>>/tmp/pngnight.css > echo "#divNIGHT3 {position:absolute; left:${PIXELS3}px; top:0px;}" >>>/tmp/pngnight.css > > So the CSS file gets updated every time the main script runs. The CSS-file > then looks as follows: > > #divNIGHT1 {position:absolute; left:516px; top:0px;} > #divNIGHT2 {position:absolute; left:181px; top:0px;} > #divNIGHT3 {position:absolute; left:-154px; top:0px;} > > Use this to write to an IFrame with: > > <HEAD> > <link rel="stylesheet" type="text/css" href="css/pngnight.css"> > <title>Untitled</title> > > <style type="text/css"> > <!-- BODY {background:none transparent;}--> > </style> > </head> > > <body> > <div id="divNIGHT1" class="plainbackground"> > img/night.png > </div> > > <div id="divNIGHT2" class="plainbackground"> > img/night.png > </div> > > <div id="divNIGHT3" class="plainbackground"> > img/night.png > </div> > > </body> > </html> > And the night-shade picture (3 times) will move along with the time. > Calculations all depend on the size of the images and iFrame of cause. > > About the auto update: > I use a small javascript to change to upper and lower values. See lower > window in the picture. This uses CGI to start a bash-script that writes > those two values to separate files. Then that same html-file gets > re-written > by the script using variables for the lower and upper temps. and reloads > the > iFrame. These variables get filled by redirecting the two files into them: > > #!/bin/sh > # > echo "Content-type: text/html" > echo "" > > read CGIVAR > eval $(echo "$CGIVAR"|awk -F'&' '{for(i=1;i<=NF;i++){print $i}}') > > echo $(httpd -d $Ondergrens) >/tmp/conf/templaag.cnf > echo $(httpd -d $Bovengrens) >/tmp/conf/temphoog.cnf > /opt/usr/bin/tempalarm.sh > echo "<meta http-equiv=\"refresh\" content=\"3;url=/tempalarm.html\">" > echo " > javascript:setTimeout\(\'parent.frames[2].location.reload\(true\)\',1000\) > " > > Resulting in the newly created html-file: > > <HTML> > <BODY> > > <FORM METHOD="POST" ACTION="/cgi-bin/ap/tempalarm"> > Alarm instellingen:<BR> > Ondergrens:  <INPUT TYPE=text name=Ondergrens SIZE=2 value=24> > <INPUT TYPE=button VALUE="lager" > onClick=javascript:this.form.Ondergrens.value--;> > <INPUT TYPE=button VALUE="hoger" > onClick=javascript:this.form.Ondergrens.value++;><BR> > Bovengrens:  <INPUT TYPE=text name=Bovengrens SIZE=2 value=28> > <INPUT TYPE=button VALUE="lager" > onClick=javascript:this.form.Bovengrens.value--;> > <INPUT TYPE=button VALUE="hoger" > onClick=javascript:this.form.Bovengrens.value++;><BR><BR> > <INPUT TYPE="submit" VALUE="Opslaan"> > </FORM> > > </BODY> > </HTML> > > Which was created by the script: > > #!/bin/sh > # > # Function: Dit script maakt html-files met daarin variabele gegevens. > > FILE1=/tmp/tempalarm.html > FILE2=/tmp/tempgrenzen.html > ONDERGRENS=`cat</tmp/conf/templaag.cnf` > BOVENGRENS=`cat</tmp/conf/temphoog.cnf` > > echo "<HTML>" > "${FILE1}" > echo "<BODY>" >> "${FILE1}" > echo "" >> "${FILE1}" > echo "<FORM METHOD=\"POST\" ACTION=\"/cgi-bin/ap/tempalarm\">" >> > "${FILE1}" > echo " Alarm instellingen:<BR>" >> "${FILE1}" > echo " Ondergrens:  <INPUT TYPE=text name=Ondergrens SIZE=2 > value=$ONDERGRENS>" >> "${FILE1}" > echo " <INPUT TYPE=button VALUE=\"lager\" > onClick="javascript:this.form.Ondergrens.value--\;">" >> "${FILE1}" > echo " <INPUT TYPE=button VALUE=\"hoger\" > onClick="javascript:this.form.Ondergrens.value++\;"><BR>" >> > "${FILE1}" > echo " Bovengrens:  <INPUT TYPE=text name=Bovengrens SIZE=2 > value=$BOVENGRENS>" >> "${FILE1}" > echo " <INPUT TYPE=button VALUE=\"lager\" > onClick="javascript:this.form.Bovengrens.value--\;">" >> "${FILE1}" > echo " <INPUT TYPE=button VALUE=\"hoger\" > onClick="javascript:this.form.Bovengrens.value++\;"><BR><BR>" >> > "${FILE1}" > echo " <INPUT TYPE=\"submit\" VALUE=\"Opslaan\">" >> "${FILE1}" > echo "</FORM>" >> "${FILE1}" > echo " " >> "${FILE1}" > echo "</BODY>" >> "${FILE1}" > echo "</HTML>" >> "${FILE1}" > > echo "<HTML>" >> "${FILE2}" > echo "<BODY>" >>> "${FILE2}" > echo "<style type=\"text/css\">" >>> "${FILE2}" > echo "<!-- BODY {background:none transparent;}-->" >>> "${FILE2}" > echo "</style>" >>> "${FILE2}" > echo "Grenswaarden:" >>> "${FILE2}" > echo "  $ONDERGRENS < > $BOVENGRENS" >>> "${FILE2}" > > I know it doesn't win any prizes for cleanlyness but it works flawlessly > and > updates real-time without any server-side tools like java or php. This > would > be nicer but the box has to litte memory I'm afraid. > > Sorry some is in Dutch bau thats only text visible on the webpage. > -- > View this message in context: > http://www.nabble.com/Error-trap-works-great-on-NSLU2-with-owfs-tf4305299.html#a12493277 > Sent from the OWFS - Dev mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Owfs-developers mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/owfs-developers > ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Owfs-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/owfs-developers
