From: drowe67 Date: Tue, 1 Jul 2014 22:01:19 +0000 (+0000) Subject: mv to attic X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=7ec51ecb5bcde17848b048e94bcf5f072829730a;p=freetel-svn-tracking.git mv to attic git-svn-id: https://svn.code.sf.net/p/freetel/code@1727 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/attic/foxy/README.txt b/attic/foxy/README.txt new file mode 100644 index 00000000..04aab022 --- /dev/null +++ b/attic/foxy/README.txt @@ -0,0 +1,150 @@ +README.txt for foxy +David Rowe +May 25 2013 + + +Introduction +------------ + +Simple Google Maps application to plot Fox Hunt bearings. When run on +a phone it automatically detects position and compass bearing. Placing +Bearings can be placed with a mouse click on non-mobile devices. The +bearings are stored in a text file database so can be shared by anyone +who can reach the server. + +* Screen shot: foxy_screenshot.png + +* Based on Google maps V3 API. + +* Light weight: On the server we have just a few CGIs and a text file + database. A browser cookie is used for storing configuration + information. The CGIs are a few lines of shell script, so can run + on any machine. Installation involves copying a few files and + setting a few permissions. + +* Foxy will stand alone without the server & CGIs, but bearing storage + won't be persistent and bearings can't be shared. Good for demos or + when you can't reach the Internet. + +BUGS +---- + +On mobile devices: ++ Click to add bearings places the bearing at a location offset from the tap location ++ Double click doesn't remove bearings on mobile devices. + +Using Foxy +---------- + +1/ Point your browser at http://yourserver/foxy.html + +2/ If running on your phone your bearing will be updated +automatically. Click on add bearing to add a bearing from your +current position to the map. + +3/ The "where Am I" button re-centers the map on your current +position. This is useful when scroll and zooming moves your position. + +4/ The "Click to Add Bearing" check box allow manual placement of +bearings with a mouse click. Useful for demo and development on +non-mobile devices such as desktops and laptops. This should be +unchecked on mobile devices as pinching/scrolling often generates +spurious "click" events leading to unwanted bearings. + +5/ Double click on a bearing to delete it. + + +Implementation Notes +-------------------- + +Foxy is implemented in Javascript (foxy.html). A simple text database +file /var/www/foxy/bearings.txt is used to store bearing +information. Very simple 1 page CGIs written in shell script are used +to access the bearing database. + +A browser cookie is used to store config information like the current +map centre. + +All the CGI scripts assume a hard coded to a path of +/var/www/foxy/bearings.txt for the bearings.txt database. + + +Files +----- + + foxy.html - Javascript & HTML code for Foxy + foxy.css - style sheet + +"cgi-bin" directory: + + addbearing.cgi - adds a bearing to bearings.txt + delbearing.cgi - deletes a bearing from bearings.txt + getbearings.cgi - reads bearings.txt database + cleardb.cgi - clears database, removing all bearings + + +Software +-------- + +You need: + +1/ A web server. Apache is assumed in the /usr/lib/cgi-bin path below. + The paths may be different for other web servers. Note the path + to /var/www/foxy is hard coded in the CGI scripts so it's + best not to change that. + + +Installation +------------ + +1/ Server PC + + $ svn co https://freetel.svn.sourceforge.net/svnroot/freetel/foxy + $ cd foxy + $ sudo mkdir /var/www/foxy + $ sudo chmod 777 /var/www/foxy + $ cp foxy.css foxy.html /var/www/foxy + $ sudo cp cgi-bin/* /usr/lib/cgi-bin + +Tests +----- + +1/ Test reading and writing bearings.txt database with your browser: + + http://localhost/cgi-bin/addbearing.cgi?lat=123&lng=456&bearing=90 + + $ cat /var/www/foxy/bearings.txt + 123,456,90 + + http://localhost/cgi-bin/delbearing.cgi?lat=123&lng=456 + + $ cat /var/www/foxy/bearings.txt + (empty file) + +Debugging +--------- + +1/ Monitor Apache log: + + $ tail -f /var/log/apache2/access.log + +2/ Use Firebug on Firefox to single step, set breakpoints etc. + +3/ Check bearings.txt database, each line is (lat, lng, IP): + + # cat /var/www/foxy/bearings.txt + + -34.88548650005714,138.55225324630737,90 + -34.88006501016277,138.55394840240479,180 + -34.87893842193011,138.55278968811035,265 + -34.882511765792316,138.55210304260254,10 + +4/ The "foxy001" cookie stores our state. On Firefox 3.5 you + can remove the foxy cookie using Edit-Preferences-Privacy, then + click on "remove individual cookies". + +5/ To manually reset to defaults: + + * move to another page (cookie is saved when we exit page) + * rm -f /var/www/foxy/bearings.txt + * Delete cookie using step (4) above diff --git a/attic/foxy/cgi-bin/addbearing.cgi b/attic/foxy/cgi-bin/addbearing.cgi new file mode 100755 index 00000000..95f95c6d --- /dev/null +++ b/attic/foxy/cgi-bin/addbearing.cgi @@ -0,0 +1,31 @@ +#!/bin/sh +# addbearing.cgi +# David Rowe 25 May 2013 +# +# CGI to add a new bearing + +cat < + + + + + +EOF + +lat=`echo "$QUERY_STRING" | sed -n "s/.*lat=\(.*\)&lng.*/\1/p"` +lng=`echo "$QUERY_STRING" | sed -n "s/.*lng=\(.*\)&bearing.*/\1/p"` +bearing=`echo "$QUERY_STRING" | sed -n "s/.*bearing=\(.*\)/\1/p"` + +echo $lat,$lng,$bearing >> /var/www/foxy/bearings.txt + +echo $QUERY_STRING "
" +echo "
" +echo $lat $lng $bearing + +cat < + +EOF diff --git a/attic/foxy/cgi-bin/cleardb.cgi b/attic/foxy/cgi-bin/cleardb.cgi new file mode 100755 index 00000000..1d39234c --- /dev/null +++ b/attic/foxy/cgi-bin/cleardb.cgi @@ -0,0 +1,26 @@ +#!/bin/sh +# cleardb.cgi +# David Rowe 25 May 2013 +# +# CGI to delete entire bearing database + +cat < + + + + + +EOF + +# path to node database text file + +P=/var/www/foxy +rm $P/bearings.txt + +cat < + +EOF diff --git a/attic/foxy/cgi-bin/delbearing.cgi b/attic/foxy/cgi-bin/delbearing.cgi new file mode 100755 index 00000000..19168dfe --- /dev/null +++ b/attic/foxy/cgi-bin/delbearing.cgi @@ -0,0 +1,36 @@ +#!/bin/sh +# delbearing.cgi +# David Rowe 25 May 2012 +# +# CGI to delete a bearing + +cat < + + + + + +EOF + +lat=`echo "$QUERY_STRING" | sed -n "s/lat=\(.*\)&.*/\1/pg"` +lng=`echo "$QUERY_STRING" | sed -n "s/.*lng=\(.*\)/\1/pg"` + +# path to node database text file + +P=/var/www/foxy + +cat $P/bearings.txt | sed "/$lat,$lng.*/ d" > $P/bearings.tmp +cp $P/bearings.tmp $P/bearings.txt +rm $P/bearings.tmp + +#echo $QUERY_STRING "
" +#echo "
" +#echo $lat $lng + +cat < + +EOF diff --git a/attic/foxy/cgi-bin/getbearings.cgi b/attic/foxy/cgi-bin/getbearings.cgi new file mode 100755 index 00000000..05f7c47f --- /dev/null +++ b/attic/foxy/cgi-bin/getbearings.cgi @@ -0,0 +1,30 @@ +#!/bin/sh +# getbearings.cgi +# David Rowe 25 May 2013 +# +# CGI to return list of bearings from the bearings.txt database text file +# We use a CGI rather than fetching the text file directly +# so we can stop Firefox from caching + +cat < + + + + + + +EOF + +BEARINGS=/var/www/foxy/bearings.txt + +if [ -f $BEARINGS ] ; then + cat $BEARINGS +fi + +cat < + +EOF diff --git a/attic/foxy/foxy.css b/attic/foxy/foxy.css new file mode 100644 index 00000000..9909684c --- /dev/null +++ b/attic/foxy/foxy.css @@ -0,0 +1,70 @@ +html,body{ + margin:0; + padding:0; + width:100%; + height:100%; + font-family:Arial, Helvetica, sans-serif; +} + +div#header{ + vertical-align:middle; + border-bottom:1px solid #000; +} +div#main-map{ + width:100%; + height:90%; + float:top; +} +div#bottom{ + height:10%; + float:bottom; +} + +div#dataPanel{ + width:90%; + height:50%; + overflow:auto; + border:2px solid #DDDDDD; +} +input{ + width:90%; +} + +input.navi{ + font-size:12px; + height:30px; + margin-bottom:10px; +} +div ul{ + margin-top:30px; + margin-bottom:30px; +} +div ul li{ + display: inline; + list-style-type: none; + padding-right: 40px; + font-size:18px; + font-weight:bold; +} + +div ul li.title{ + font-size:22px; + color:#888; +} + +div#header p{ + color:#888; + font-size:14px; + padding-left:20px; +} +span.instruction{ + font-weight:bold; + +} + +.message-box { text-align: center; padding: 5px; color:#545454; width:80%; margin:5px auto; font-size:12px;} +.clean { background-color: #efefef; border-top: 2px solid #dedede; border-bottom: 2px solid #dedede; } +.info { background-color: #f7fafd; border-top: 2px solid #b5d3ff; border-bottom: 2px solid #b5d3ff; } +.ok { background-color: #d7f7c4; border-top: 2px solid #82cb2f; border-bottom: 2px solid #82cb2f; } +.alert { background-color: #fef5be; border-top: 2px solid #fdd425; border-bottom: 2px solid #fdd425; } +.error { background-color: #ffcdd1; border-top: 2px solid #e10c0c; border-bottom: 2px solid #e10c0c; } \ No newline at end of file diff --git a/attic/foxy/foxy.html b/attic/foxy/foxy.html new file mode 100644 index 00000000..09a050b2 --- /dev/null +++ b/attic/foxy/foxy.html @@ -0,0 +1,617 @@ + + + + + + +Foxy + + + + + + + + + +
+
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + +
Clear Database
Click to Add Bearing
Debug Messages
HelpFoxy README
+
+
+ + +
+

Tests

+
    +
  1. Test bearings.txt database
    +
+
+ +
+

Debugging Output

+
    +
+
+
+ + + + diff --git a/attic/foxy/foxy_screenshot.png b/attic/foxy/foxy_screenshot.png new file mode 100644 index 00000000..d529e861 Binary files /dev/null and b/attic/foxy/foxy_screenshot.png differ diff --git a/foxy/README.txt b/foxy/README.txt deleted file mode 100644 index 04aab022..00000000 --- a/foxy/README.txt +++ /dev/null @@ -1,150 +0,0 @@ -README.txt for foxy -David Rowe -May 25 2013 - - -Introduction ------------- - -Simple Google Maps application to plot Fox Hunt bearings. When run on -a phone it automatically detects position and compass bearing. Placing -Bearings can be placed with a mouse click on non-mobile devices. The -bearings are stored in a text file database so can be shared by anyone -who can reach the server. - -* Screen shot: foxy_screenshot.png - -* Based on Google maps V3 API. - -* Light weight: On the server we have just a few CGIs and a text file - database. A browser cookie is used for storing configuration - information. The CGIs are a few lines of shell script, so can run - on any machine. Installation involves copying a few files and - setting a few permissions. - -* Foxy will stand alone without the server & CGIs, but bearing storage - won't be persistent and bearings can't be shared. Good for demos or - when you can't reach the Internet. - -BUGS ----- - -On mobile devices: -+ Click to add bearings places the bearing at a location offset from the tap location -+ Double click doesn't remove bearings on mobile devices. - -Using Foxy ----------- - -1/ Point your browser at http://yourserver/foxy.html - -2/ If running on your phone your bearing will be updated -automatically. Click on add bearing to add a bearing from your -current position to the map. - -3/ The "where Am I" button re-centers the map on your current -position. This is useful when scroll and zooming moves your position. - -4/ The "Click to Add Bearing" check box allow manual placement of -bearings with a mouse click. Useful for demo and development on -non-mobile devices such as desktops and laptops. This should be -unchecked on mobile devices as pinching/scrolling often generates -spurious "click" events leading to unwanted bearings. - -5/ Double click on a bearing to delete it. - - -Implementation Notes --------------------- - -Foxy is implemented in Javascript (foxy.html). A simple text database -file /var/www/foxy/bearings.txt is used to store bearing -information. Very simple 1 page CGIs written in shell script are used -to access the bearing database. - -A browser cookie is used to store config information like the current -map centre. - -All the CGI scripts assume a hard coded to a path of -/var/www/foxy/bearings.txt for the bearings.txt database. - - -Files ------ - - foxy.html - Javascript & HTML code for Foxy - foxy.css - style sheet - -"cgi-bin" directory: - - addbearing.cgi - adds a bearing to bearings.txt - delbearing.cgi - deletes a bearing from bearings.txt - getbearings.cgi - reads bearings.txt database - cleardb.cgi - clears database, removing all bearings - - -Software --------- - -You need: - -1/ A web server. Apache is assumed in the /usr/lib/cgi-bin path below. - The paths may be different for other web servers. Note the path - to /var/www/foxy is hard coded in the CGI scripts so it's - best not to change that. - - -Installation ------------- - -1/ Server PC - - $ svn co https://freetel.svn.sourceforge.net/svnroot/freetel/foxy - $ cd foxy - $ sudo mkdir /var/www/foxy - $ sudo chmod 777 /var/www/foxy - $ cp foxy.css foxy.html /var/www/foxy - $ sudo cp cgi-bin/* /usr/lib/cgi-bin - -Tests ------ - -1/ Test reading and writing bearings.txt database with your browser: - - http://localhost/cgi-bin/addbearing.cgi?lat=123&lng=456&bearing=90 - - $ cat /var/www/foxy/bearings.txt - 123,456,90 - - http://localhost/cgi-bin/delbearing.cgi?lat=123&lng=456 - - $ cat /var/www/foxy/bearings.txt - (empty file) - -Debugging ---------- - -1/ Monitor Apache log: - - $ tail -f /var/log/apache2/access.log - -2/ Use Firebug on Firefox to single step, set breakpoints etc. - -3/ Check bearings.txt database, each line is (lat, lng, IP): - - # cat /var/www/foxy/bearings.txt - - -34.88548650005714,138.55225324630737,90 - -34.88006501016277,138.55394840240479,180 - -34.87893842193011,138.55278968811035,265 - -34.882511765792316,138.55210304260254,10 - -4/ The "foxy001" cookie stores our state. On Firefox 3.5 you - can remove the foxy cookie using Edit-Preferences-Privacy, then - click on "remove individual cookies". - -5/ To manually reset to defaults: - - * move to another page (cookie is saved when we exit page) - * rm -f /var/www/foxy/bearings.txt - * Delete cookie using step (4) above diff --git a/foxy/cgi-bin/addbearing.cgi b/foxy/cgi-bin/addbearing.cgi deleted file mode 100755 index 95f95c6d..00000000 --- a/foxy/cgi-bin/addbearing.cgi +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -# addbearing.cgi -# David Rowe 25 May 2013 -# -# CGI to add a new bearing - -cat < - - - - - -EOF - -lat=`echo "$QUERY_STRING" | sed -n "s/.*lat=\(.*\)&lng.*/\1/p"` -lng=`echo "$QUERY_STRING" | sed -n "s/.*lng=\(.*\)&bearing.*/\1/p"` -bearing=`echo "$QUERY_STRING" | sed -n "s/.*bearing=\(.*\)/\1/p"` - -echo $lat,$lng,$bearing >> /var/www/foxy/bearings.txt - -echo $QUERY_STRING "
" -echo "
" -echo $lat $lng $bearing - -cat < - -EOF diff --git a/foxy/cgi-bin/cleardb.cgi b/foxy/cgi-bin/cleardb.cgi deleted file mode 100755 index 1d39234c..00000000 --- a/foxy/cgi-bin/cleardb.cgi +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -# cleardb.cgi -# David Rowe 25 May 2013 -# -# CGI to delete entire bearing database - -cat < - - - - - -EOF - -# path to node database text file - -P=/var/www/foxy -rm $P/bearings.txt - -cat < - -EOF diff --git a/foxy/cgi-bin/delbearing.cgi b/foxy/cgi-bin/delbearing.cgi deleted file mode 100755 index 19168dfe..00000000 --- a/foxy/cgi-bin/delbearing.cgi +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh -# delbearing.cgi -# David Rowe 25 May 2012 -# -# CGI to delete a bearing - -cat < - - - - - -EOF - -lat=`echo "$QUERY_STRING" | sed -n "s/lat=\(.*\)&.*/\1/pg"` -lng=`echo "$QUERY_STRING" | sed -n "s/.*lng=\(.*\)/\1/pg"` - -# path to node database text file - -P=/var/www/foxy - -cat $P/bearings.txt | sed "/$lat,$lng.*/ d" > $P/bearings.tmp -cp $P/bearings.tmp $P/bearings.txt -rm $P/bearings.tmp - -#echo $QUERY_STRING "
" -#echo "
" -#echo $lat $lng - -cat < - -EOF diff --git a/foxy/cgi-bin/getbearings.cgi b/foxy/cgi-bin/getbearings.cgi deleted file mode 100755 index 05f7c47f..00000000 --- a/foxy/cgi-bin/getbearings.cgi +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -# getbearings.cgi -# David Rowe 25 May 2013 -# -# CGI to return list of bearings from the bearings.txt database text file -# We use a CGI rather than fetching the text file directly -# so we can stop Firefox from caching - -cat < - - - - - - -EOF - -BEARINGS=/var/www/foxy/bearings.txt - -if [ -f $BEARINGS ] ; then - cat $BEARINGS -fi - -cat < - -EOF diff --git a/foxy/foxy.css b/foxy/foxy.css deleted file mode 100644 index 9909684c..00000000 --- a/foxy/foxy.css +++ /dev/null @@ -1,70 +0,0 @@ -html,body{ - margin:0; - padding:0; - width:100%; - height:100%; - font-family:Arial, Helvetica, sans-serif; -} - -div#header{ - vertical-align:middle; - border-bottom:1px solid #000; -} -div#main-map{ - width:100%; - height:90%; - float:top; -} -div#bottom{ - height:10%; - float:bottom; -} - -div#dataPanel{ - width:90%; - height:50%; - overflow:auto; - border:2px solid #DDDDDD; -} -input{ - width:90%; -} - -input.navi{ - font-size:12px; - height:30px; - margin-bottom:10px; -} -div ul{ - margin-top:30px; - margin-bottom:30px; -} -div ul li{ - display: inline; - list-style-type: none; - padding-right: 40px; - font-size:18px; - font-weight:bold; -} - -div ul li.title{ - font-size:22px; - color:#888; -} - -div#header p{ - color:#888; - font-size:14px; - padding-left:20px; -} -span.instruction{ - font-weight:bold; - -} - -.message-box { text-align: center; padding: 5px; color:#545454; width:80%; margin:5px auto; font-size:12px;} -.clean { background-color: #efefef; border-top: 2px solid #dedede; border-bottom: 2px solid #dedede; } -.info { background-color: #f7fafd; border-top: 2px solid #b5d3ff; border-bottom: 2px solid #b5d3ff; } -.ok { background-color: #d7f7c4; border-top: 2px solid #82cb2f; border-bottom: 2px solid #82cb2f; } -.alert { background-color: #fef5be; border-top: 2px solid #fdd425; border-bottom: 2px solid #fdd425; } -.error { background-color: #ffcdd1; border-top: 2px solid #e10c0c; border-bottom: 2px solid #e10c0c; } \ No newline at end of file diff --git a/foxy/foxy.html b/foxy/foxy.html deleted file mode 100644 index 09a050b2..00000000 --- a/foxy/foxy.html +++ /dev/null @@ -1,617 +0,0 @@ - - - - - - -Foxy - - - - - - - - - -
-
- -
- -
-
- - - - - - - - - - - - - - - - - - - - - - -
Clear Database
Click to Add Bearing
Debug Messages
HelpFoxy README
-
-
- - -
-

Tests

-
    -
  1. Test bearings.txt database
    -
-
- -
-

Debugging Output

-
    -
-
-
- - - - diff --git a/foxy/foxy_screenshot.png b/foxy/foxy_screenshot.png deleted file mode 100644 index d529e861..00000000 Binary files a/foxy/foxy_screenshot.png and /dev/null differ