2 # Deliver click values to volcano.htm...
3 # Author. John D. Coryat 02/2010...
4 # Copyright 2010 USNaviguide LLC. All rights reserved...
6 use CGI qw/:standard *table/;
9 use USNaviguide_Google_Tiles ;
12 my $dbh = DBI->connect ( "dbi:Pg:dbname=koha" , "" , "" , { AutoCommit => 1 } ) ;
13 my $point = param('POINT') ;
14 my $zoom = param('ZOOM') ;
28 my $maxpix = 15 ; # Maximum pixels between click and point
34 print qq{Content-type: text/xml\r\n\r\n};
35 print qq{<?xml version="1.0" encoding="UTF-8"?>\n} ;
40 print qq!<info error="No point passed..."/>\n! ;
46 if ( $point =~ /(.*),(.*)/ )
51 $value = &Google_Tile_Factors($zoom) ; # Calculate Tile Factors
53 ($latpix,$lngpix) = &Google_Coord_to_Pix( $value, $lat, $lng ) ; # Convert coordinate to pixel location
55 $x = "select name,descript,volpnt,point'($lat,$lng)' <-> volpnt as distance from gvp_world order by distance limit 1" ;
57 if ( ($name,$descript,$volpnt,$i) = $dbh->selectrow_array($x) ) # Got one
59 $volpnt =~ /\((.*),(.*)\)/ ;
63 ($vlatpix,$vlngpix) = &Google_Coord_to_Pix( $value, $vlat, $vlng ) ; # Convert coordinate to pixel location
65 if ( sqrt(($vlatpix - $latpix)**2 + ($vlngpix - $lngpix)**2) > $maxpix )
67 # Click not within maxpix of point...
68 print qq!<info error="No publisher is within range of your click, please try again."/>\n! ;
69 } else # Good point found
72 my $hash = eval $descript;
74 my $feed = XML::FeedPP->new( "http://koha.ffzg.hr/cgi-bin/koha/opac-search.pl?idx=pl&format=rss2&q=$name" );
77 foreach my $item ( $feed->get_item ) {
78 push @links, sprintf qq|<li><a target="koha" href="%s">%s</a> %s|,
79 $item->link, $item->title, $item->description
90 print qq!<info error = "" name = "$name" lat="$vlat" lng="$vlng">\n! ;
91 print qq! <description><\![CDATA[$descript]]></description>\n! ;
97 print qq!<info error="No valid point ($point) passed. Should be: (lat,lng) format."/>\n! ;