[Firebug-cvs] firebug/web/gmaps connect.php,1.1,1.2 db_gmap.php,1.1,1.2 db_render_xml.php,1.1,1.2 db
Brought to you by:
doolin
From: David M. D. <do...@us...> - 2005-06-08 22:29:52
|
Update of /cvsroot/firebug/firebug/web/gmaps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18069/gmaps Modified Files: connect.php db_gmap.php db_render_xml.php db_xml_create.php geocodeinfo_rfs.xsl Log Message: Fixed a mess of php db code. Index: db_render_xml.php =================================================================== RCS file: /cvsroot/firebug/firebug/web/gmaps/db_render_xml.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** db_render_xml.php 8 Jun 2005 20:45:36 -0000 1.1 --- db_render_xml.php 8 Jun 2005 22:29:42 -0000 1.2 *************** *** 1,3 **** - <p> <?php include("connect.php"); --- 1,2 ---- *************** *** 20,39 **** print("<request/>\n"); print("<center lat=\"37.9177\" lng=\"-122.332\"/>\n"); ! print("<!-- Original -->\n"); ! print("<!--\n"); ! print("<span lat=\"0.0179\" lng=\"0.027586\"/>\n"); ! print("-->\n"); print("<span lat=\"0.002\" lng=\"0.003\"/>\n"); ! print("<overlay panelStyle=\"sidepanel.xsl\">\n"); $dbname = "task"; $tblname = "gga_l"; $dbh = connect_postgres($dbname); $statement = "SELECT a.attname FROM pg_attribute a,pg_class c where c.relname ='$tblname' and a.attrelid = c.oid and a.attnum > 0"; $stat = @pg_exec($dbh,$statement); if(!stat) { die("Cannot select from database\n"); } $statement = "SELECT * FROM $tblname"; $stat = @pg_exec($dbh,$statement); --- 19,45 ---- print("<request/>\n"); print("<center lat=\"37.9177\" lng=\"-122.332\"/>\n"); ! print("<span lat=\"0.002\" lng=\"0.003\"/>\n"); ! print("<overlay panelStyle=\"sidepanel.xsl\">\n\n\n"); + /** TODO: Remove hardcoded db and table names. + */ $dbname = "task"; $tblname = "gga_l"; + + $dbh = connect_postgres($dbname); + if (!$dbh) { + print("no connection"); + } + $statement = "SELECT a.attname FROM pg_attribute a,pg_class c where c.relname ='$tblname' and a.attrelid = c.oid and a.attnum > 0"; $stat = @pg_exec($dbh,$statement); if(!stat) { + print("Cannot select from database\n"); die("Cannot select from database\n"); } + $statement = "SELECT * FROM $tblname"; $stat = @pg_exec($dbh,$statement); *************** *** 43,46 **** --- 49,53 ---- + /*** * *************** *** 64,73 **** ***/ $ids=array('A','B','C','D','E','F','G','H','I','J'); ! $imgs=array('http://libgmail.sourceforge.net/man.png', 'http://libgmail.sourceforge.net/spider.png'); for ($i=0;$i<$rows;$i++) { ! printf("<location infoStyle=\"geocodeinfo_rfs.xsl\" id=\"%s\">\n", $ids[$i]) or perr("db_xml_create", "Cant fprintf"); ! $row = array_values(pg_fetch_row($stat,$i)) or perr("db_xml_create", "Cannot retrieve data"); ! foreach ($rows as $key => $value) { switch($key) { case "latitudedegree": --- 71,83 ---- ***/ $ids=array('A','B','C','D','E','F','G','H','I','J'); ! $imgs=array('/firebug/images/greenman.png'); for ($i=0;$i<$rows;$i++) { ! //printf("<location infoStyle=\"geocodeinfo_rfs.xsl\" id=\"$ids[$i]\">\n"); ! printf("<location infoStyle=\"geocodeinfo_rfs.xsl\" id=\"$ids[$i]\">\n");// or perr("db_render_xml", "Can't printf"); ! $row = array_values(pg_fetch_row($stat,$i)) or perr("db_render_xml", "Cannot retrieve data"); ! ! foreach ($row as $key => $value) { ! print "$key"; //$value\n"; switch($key) { case "latitudedegree": *************** *** 80,84 **** $longdeg=$value; break; ! case "longtudeminute": $longmin=$value; break; --- 90,94 ---- $longdeg=$value; break; ! case "longitudeminutes": $longmin=$value; break; *************** *** 86,106 **** $disp[$key]=$value; } ! } ! $lat = $latdeg + ($latmin/60.0); $long = $longdeg + ($longmin/60.0); ! ! printf("<point lat=\"%f\" lng=\"%f\"/>\n", $lat, $long) or perr("db_xml_create", "1"); printf("<icon image=\"%s\" class=\"local\"/>\n", $imgs[0]); ! print("<info>") or perr("db_xml_create","4"); ! print("<title xml:space=\"preserve\" xmlns:xml=\"http://www.w3.org/XML/1998/namespace\">\n") or perr("db_xml_create","5"); ! print("</title>\n") or perr("db_xml_create","6"); ! print("<address>\n") or perr("db_xml_create","8"); ! print("<line>Ms. Eva Green</line>\n") or perr("db_xml_create","9"); ! print("</address>\n") or perr("db_xml_create","10"); ! print("<image>\n") or perr("db_xml_create","11"); ! print("http://www.google.co.nz/images/logo_sm.gif\n") or perr("db_xml_create","12"); ! print("</image>\n") or perr("db_xml_create","13"); ! print("</info>\n") or perr("db_xml_create","14"); } pg_close($dbh); ?> --- 96,126 ---- $disp[$key]=$value; } ! } ! ! $lat = $latdeg + (float)($latmin/60.0); $long = $longdeg + ($longmin/60.0); ! ! //print "$lat,$long"; ! ! print("<point lat=\"$lat\" lng=-\"$long\"/>\n");//, $lat, $long);// or perr("db_render_xml", "1"); printf("<icon image=\"%s\" class=\"local\"/>\n", $imgs[0]); ! 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://www.google.co.nz/images/logo_sm.gif\n") or perr("db_render_xml","12"); ! 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"); ! print("</location>\n\n"); ! } + + print("</overlay>\n"); + print("</page>\n"); + pg_close($dbh); ?> Index: connect.php =================================================================== RCS file: /cvsroot/firebug/firebug/web/gmaps/connect.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** connect.php 8 Jun 2005 20:45:36 -0000 1.1 --- connect.php 8 Jun 2005 22:29:42 -0000 1.2 *************** *** 8,17 **** function perr($fname, $err) { $pstring = "<strong>ERROR</strong>: ".$err. " in ".$fname; ! die($pstring); } function connect_postgres($db) { $connstr = "dbname=$db user=postgres host=192.168.1.131 port=5432"; ! if(!($dbh = @pg_connect($connstr))) { print("connect". "Could not connect to database\n"); } --- 8,25 ---- function perr($fname, $err) { $pstring = "<strong>ERROR</strong>: ".$err. " in ".$fname; ! print($pstring); } function connect_postgres($db) { + + $connstr = "dbname=$db user=postgres host=192.168.1.131 port=5432"; ! ! //print "$connstr"; ! ! $dbh = @pg_connect($connstr); ! //print("$dbh"); ! ! if(!$dbh) { print("connect". "Could not connect to database\n"); } Index: db_gmap.php =================================================================== RCS file: /cvsroot/firebug/firebug/web/gmaps/db_gmap.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** db_gmap.php 8 Jun 2005 20:45:36 -0000 1.1 --- db_gmap.php 8 Jun 2005 22:29:42 -0000 1.2 *************** *** 23,27 **** /* Note: All XML & XSL files must be on same domain. */ ! _loadXmlFileFromURL("/firebug/web/gmaps/db_render_xml.php", myMapApp); } --- 23,27 ---- /* Note: All XML & XSL files must be on same domain. */ ! _loadXmlFileFromURL("db_render_xml.php", myMapApp); } *************** *** 70,113 **** <body onload="initMap()"> - <!----> ! <?php ! include("db_xml_create.php"); ! ?> <!-- 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;">Richmond Field Station Demo</h1> ! <p><dl> ! Sensor data last updated: ! </dl> ! </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> <div style="position:absolute;top:30px;left:5px;"> ! <div id="panel" style="height:90%;width:100%;"> </div> - <div id="metapanel">metapanel</div> - <div id="permalink">permalink</div> - <div id="printheader">header</div> </div> ! </div> ! </div> </div> ! <!-- </body> </html> - --- 70,138 ---- <body onload="initMap()"> ! <!----> <!-- 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> <div style="position:absolute;top:30px;left:5px;"> ! <div id="panel" style="height:90%;width:100%;"> </div> ! <div id="metapanel"></div> ! <div id="permalink"></div> ! <div id="printheader"></div> ! </div> </div> </div> ! </div> ! ! </body> </html> Index: db_xml_create.php =================================================================== RCS file: /cvsroot/firebug/firebug/web/gmaps/db_xml_create.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** db_xml_create.php 8 Jun 2005 20:45:36 -0000 1.1 --- db_xml_create.php 8 Jun 2005 22:29:42 -0000 1.2 *************** *** 62,66 **** for ($i=0;$i<$rows;$i++) { ! fprintf($fh, "<location infoStyle=\"geocodeinfo_rfs.xsl\" id=\"%s\">\n", $ids[$i]) or perr("db_xml_create", "Cant fprintf"); $row = array_values(pg_fetch_row($stat,$i)) or perr("db_xml_create", "Cannot retrieve data"); foreach ($rows as $key => $value) { --- 62,66 ---- for ($i=0;$i<$rows;$i++) { ! fprintf($fh, "<location infoStyle=\"geocodeinfo_rfs.xsl\" id=\"%s\">\n", $ids[$i]) or perr("db_xml_create", "Can't fprintf"); $row = array_values(pg_fetch_row($stat,$i)) or perr("db_xml_create", "Cannot retrieve data"); foreach ($rows as $key => $value) { Index: geocodeinfo_rfs.xsl =================================================================== RCS file: /cvsroot/firebug/firebug/web/gmaps/geocodeinfo_rfs.xsl,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** geocodeinfo_rfs.xsl 8 Jun 2005 20:45:36 -0000 1.1 --- geocodeinfo_rfs.xsl 8 Jun 2005 22:29:42 -0000 1.2 *************** *** 2,9 **** --- 2,15 ---- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + + <!-- TODO: Add comment describing function of + this template. --> <xsl:template match="/"> <xsl:apply-templates select="location"/> </xsl:template> + + <!-- TODO: Add comment describing function of + this template. --> <xsl:template match="location"> <div style="padding-right: 8px; margin-top: 2px"> *************** *** 12,15 **** --- 18,24 ---- </xsl:template> + + <!-- TODO: Add comment describing function of + this template. --> <xsl:template match="info"> *************** *** 22,26 **** </xsl:variable> ! <div style="font-weight: bold">Custom!</div> <div> --- 31,35 ---- </xsl:variable> ! <div style="font-weight: bold">FireBug --- personnel</div> <div> *************** *** 38,45 **** --- 47,61 ---- </xsl:template> + + + <!-- TODO: Add comment describing function of + this template. --> <xsl:template match="line"> <div style="margin-top: 2px"><xsl:value-of select="."/></div> </xsl:template> + + <!-- TODO: Add comment describing function of + this template. --> <xsl:template name="getSingleLineAddress"> <xsl:for-each select="address/line"> *************** *** 49,52 **** --- 65,69 ---- </xsl:template> + </xsl:stylesheet> |