[Firebug-cvs] firebug/web/gmaps connect.php,1.2,1.3 db_gmap.php,1.2,1.3 db_render_xml.php,1.7,1.8
Brought to you by:
doolin
From: David M. D. <do...@us...> - 2005-06-09 03:53:17
|
Update of /cvsroot/firebug/firebug/web/gmaps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30891/gmaps Modified Files: connect.php db_gmap.php db_render_xml.php Log Message: Reformatted maps web app, moved image and icon handling into associative arrays. Index: db_render_xml.php =================================================================== RCS file: /cvsroot/firebug/firebug/web/gmaps/db_render_xml.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** db_render_xml.php 9 Jun 2005 01:34:04 -0000 1.7 --- db_render_xml.php 9 Jun 2005 03:53:08 -0000 1.8 *************** *** 3,19 **** ! function emit_gps_location($id, $lat, $long, $icon) { ! printf("<location infoStyle=\"geocodeinfo_rfs.xsl\" id=\"$id\">\n"); print("<point lat=\"$lat\" lng=\"-$long\"/>\n"); ! printf("<icon image=\"%s\" class=\"local\"/>\n", $icon); print("<info>") or perr("db_render_xml","4"); print("<title xml:space=\"preserve\" xmlns:xml=\"http://www.w3.org/XML/1998/namespace\">\n") or perr("db_render_xml","5"); print("</title>\n") or perr("db_render_xml","6"); print("<address>\n") or perr("db_render_xml","8"); ! print("<line>Ms. Eva Green</line>\n") or perr("db_render_xml","9"); print("</address>\n") or perr("db_render_xml","10"); print("<image>") or perr("db_render_xml","11"); ! print("http://localhost/firebug/images/greenman.png") or perr("db_render_xml","12"); print("</image>\n") or perr("db_render_xml","13"); print("</info>\n") or perr("db_render_xml","14"); --- 3,51 ---- ! /*** ! * ! * Setting up google maps specific stuff ! * ! * $ids contains the ten ids that you can associate ! * with locations ! * ! * $ imgs lists the image icons that you can have ! * ! ***/ ! $ids=array('A','B','C','D','E','F','G','H','I','J'); ! ! $images=array(14 => 'http://localhost/firebug/images/greenman.png', ! 17 => 'http://localhost/firebug/images/redman.png', ! 23 => 'http://localhost/firebug/images/greenman.png', ! 24 => 'http://localhost/firebug/images/greenman.png', ! 25 => 'http://localhost/firebug/images/greenman.png', ! 28 => 'http://localhost/firebug/images/greenman.png'); ! ! $icons=array(14 => 'http://localhost/firebug/images/sensor.png', ! 17 => 'http://localhost/firebug/images/sensor.png', ! 23 => 'http://localhost/firebug/images/sensor.png', ! 24 => 'http://localhost/firebug/images/sensor.png', ! 25 => 'http://localhost/firebug/images/sensor.png', ! 28 => 'http://localhost/firebug/images/sesnor.png'); ! ! ! ! ! function emit_gps_location($id, $lat, $long, $icon, $image, $title, $address) { ! ! print("<location infoStyle=\"geocodeinfo_rfs.xsl\" id=\"$id\">\n"); print("<point lat=\"$lat\" lng=\"-$long\"/>\n"); ! print("<icon image=\"$icon\" class=\"local\"/>\n"); print("<info>") or perr("db_render_xml","4"); print("<title xml:space=\"preserve\" xmlns:xml=\"http://www.w3.org/XML/1998/namespace\">\n") or perr("db_render_xml","5"); + print $title or perr("db_render_xml","title won't print"); print("</title>\n") or perr("db_render_xml","6"); print("<address>\n") or perr("db_render_xml","8"); ! //print("<line>Ms. Eva Green</line>\n") or perr("db_render_xml","9"); ! print "$address\n" or perr("db_render_xml","address won't print"); print("</address>\n") or perr("db_render_xml","10"); print("<image>") or perr("db_render_xml","11"); ! print "$image" or perr("db_render_xml","12"); print("</image>\n") or perr("db_render_xml","13"); print("</info>\n") or perr("db_render_xml","14"); *************** *** 24,48 **** ! /** TODO: All of the following code needs to be moved to ! * a function for printing gps locations. */ function print_from_database() { - /** TODO: Replace with an associative array keying images to - * physical events. For example: fire_fighter_danger => redman.png. - */ - $imgs=array('/firebug/images/greenman.png');//,'/firebug/images/redman.png'); - - /*** - * - * Setting up google maps specific stuff - * - * $ids contains the ten ids that you can associate - * with locations - * - * $ imgs lists the image icons that you can have - * - ***/ - $ids=array('A','B','C','D','E','F','G','H','I','J'); /** TODO: Remove hardcoded db and table names. --- 56,65 ---- ! /** TODO: Refactor the code for connecting to the ! * database into it's own function, rewrite this ! * as a print lat long location. */ function print_from_database() { /** TODO: Remove hardcoded db and table names. *************** *** 51,55 **** $tblname = "gga_l"; ! $dbh = connect_postgres($dbname); --- 68,72 ---- $tblname = "gga_l"; ! global $ids, $images, $icons; $dbh = connect_postgres($dbname); *************** *** 86,94 **** * ***/ ! ! $rows = pg_numrows($stat); ! ! ! for ($i=0;$i<$rows;$i++) { --- 103,107 ---- * ***/ ! $rows = pg_numrows($stat); for ($i=0;$i<$rows;$i++) { *************** *** 117,124 **** $lat = $latdeg + (float)($latmin/60.0); $long = $longdeg + ($longmin/60.0); ! $icon = $imgs[0]; $id = $ids[$i]; ! ! emit_gps_location($id,$lat,$long,$icon); } --- 130,139 ---- $lat = $latdeg + (float)($latmin/60.0); $long = $longdeg + ($longmin/60.0); ! $image = $images[14]; ! $icon = $icons[14]; $id = $ids[$i]; ! $title = 'Foo Bar'; ! $address = '<line>Dave and Karthik</line>'; ! emit_gps_location($id,$lat,$long,$image,$icon,$title,$address); } *************** *** 137,146 **** print("<overlay panelStyle=\"sidepanel.xsl\">\n\n\n"); print_from_database(); ! // $icon = $imgs[1]; ! // $id = $ids[3]; ! //emit_gps_location($id,37.9177,-122.332,$icon); print("</overlay>\n"); --- 152,169 ---- print("<overlay panelStyle=\"sidepanel.xsl\">\n\n\n"); + + + // An ugly function, can be refactored later. print_from_database(); ! $icon = $images[14]; ! $id = $ids[2]; ! $lat = 37.9177; ! $long = 122.332; ! $address = "<line>Here be spiders...</line>\n<line>Building 454, Room 1</line>"; ! $image = "/firebug/images/spider.png"; ! //print($icon); ! emit_gps_location($id,$lat,$long,$icon,$image,'Nick\'s office',$address); print("</overlay>\n"); Index: connect.php =================================================================== RCS file: /cvsroot/firebug/firebug/web/gmaps/connect.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** connect.php 8 Jun 2005 22:29:42 -0000 1.2 --- connect.php 9 Jun 2005 03:53:08 -0000 1.3 *************** *** 14,18 **** ! $connstr = "dbname=$db user=postgres host=192.168.1.131 port=5432"; //print "$connstr"; --- 14,20 ---- ! //$connstr = "dbname=$db user=postgres host=192.168.1.131 port=5432"; ! //$connstr = "dbname=$db user=postgres host=10.0.1.10 port=5432"; ! $connstr = "dbname=$db user=postgres host=localhost port=5432"; //print "$connstr"; Index: db_gmap.php =================================================================== RCS file: /cvsroot/firebug/firebug/web/gmaps/db_gmap.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** db_gmap.php 8 Jun 2005 22:29:42 -0000 1.2 --- db_gmap.php 9 Jun 2005 03:53:08 -0000 1.3 *************** *** 75,122 **** <!-- Note: Map height always maximum? --> <div style="position:absolute;left:5px;top:10px;right:5px;border:solid thin grey;"> ! <div id="container_frb" style="float:right;width:35%;" ></div> ! <div style="float:left;position:relative;left:10px;width:60%"> ! ! <!-- ! <div style="position:absolute;left:0px;top:0px;width:50%;overflow:auto;"> ! ! ! ! ! <h1 style="font-family:sans-serif;font-size:medium;">Unofficial Google Maps Embedding How To : Demo Two</h1> ! ! <p><tt>_MapsApplication({container div}, {panel div}, {metapanel div}, {permalink div}, {toggle div} | null, {printheader div})</tt></p> ! ! ! <p><dl> ! <dt style="font-weight:bold;">Container div</dt> ! ! <dd>The <tt><div></tt> where the map should be displayed.</dd> ! ! <dt style="font-weight:bold;">Panel div</dt> ! <dd>The <tt><div></tt> where the "sidepanel" should be displayed.</dd> ! ! <dt style="font-weight:bold;">Metapanel div</dt> ! <dd>It appears Gmaps uses this to display error and other messages</dd> ! ! <dt style="font-weight:bold;">Permalink div</dt> ! <dd>It appears Gmaps uses this to display a permanent URL. (Now appears to be required.)</dd> ! ! <dt style="font-weight:bold;">Toggle div</dt> ! ! <dd>The <tt><div></tt> where the map specification toggle should be displayed. The toggle switches between different map specifications, e.g. Map view and Satellite view. </dd> ! ! <dt style="font-weight:bold;">Printheader div</dt> ! <dd>Presumably displayed at the head of a printed map.</dd> ! </dl> </p> ! ! <p style="font-size:x-small;">-- follower at rancidbacon.com <br /> (Original page: <a href="http://stuff.rancidbacon.com/google-maps-embed-how-to/demo2.html">http://stuff.rancidbacon.com/google-maps-embed-how-to/demo2.html</a>)</p> ! ! <p style="font-size:x-small;">26 May 2005</p> ! </div> ! --> <div style="position:absolute;left:50%;top:5px;width:50%;"> <div id="toggle" style="position:absolute;top:0px:left:10px;font-family:sans-serif;font-size:smaller;"> </div> --- 75,85 ---- <!-- Note: Map height always maximum? --> <div style="position:absolute;left:5px;top:10px;right:5px;border:solid thin grey;"> ! <div id="container_frb" style="float:right;width:65%;" ></div> ! <div style="float:left;position:relative;left:10px;width:30%"> + <!-- <div style="position:absolute;left:50%;top:5px;width:50%;"> + --> <div id="toggle" style="position:absolute;top:0px:left:10px;font-family:sans-serif;font-size:smaller;"> </div> |