[freeside-commits] freeside/httemplate/view prospect_main.html, 1.5, 1.5.2.1 kml.cgi, NONE, 1.1.2.2 map.html, NONE, 1.1.2.2 svc_broadband.cgi, 1.22.2.2, 1.22.2.3
Ivan,,,
ivan at wavetail.420.am
Mon Dec 12 21:10:25 PST 2011
Update of /home/cvs/cvsroot/freeside/httemplate/view
In directory wavetail.420.am:/tmp/cvs-serv15013/httemplate/view
Modified Files:
Tag: FREESIDE_2_3_BRANCH
prospect_main.html svc_broadband.cgi
Added Files:
Tag: FREESIDE_2_3_BRANCH
kml.cgi map.html
Log Message:
add latitude/longitude to prospects, customers and package locations, RT#15539
Index: svc_broadband.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/view/svc_broadband.cgi,v
retrieving revision 1.22.2.2
retrieving revision 1.22.2.3
diff -u -w -d -r1.22.2.2 -r1.22.2.3
--- svc_broadband.cgi 10 Dec 2011 00:37:04 -0000 1.22.2.2
+++ svc_broadband.cgi 13 Dec 2011 05:10:23 -0000 1.22.2.3
@@ -13,9 +13,17 @@
);
} keys %$fields;
+#my %labels = ();
+
+$labels{'description'} = emt('Description');
$labels{'router'} = emt('Router');
+$labels{'speed_down'} = emt('Download Speed');
+$labels{'speed_up'} = emt('Upload Speed');
+$labels{'ip_addr'} = emt('IP Address');
$labels{'usergroup'} = emt('RADIUS groups'); #?
+$labels{'coordinates'} = 'Latitude/Longitude';
+
my @fields = (
'description',
{ field => 'router', value => \&router },
@@ -24,8 +32,9 @@
{ field => 'ip_addr', value => \&ip_addr },
{ field => 'sectornum', value => \§ornum },
'mac_addr',
- 'latitude',
- 'longitude',
+ #'latitude',
+ #'longitude',
+ { field => 'coordinates', value => \&coordinates },
'altitude',
'vlan_profile',
'authkey',
@@ -46,8 +55,9 @@
sub ip_addr {
my $svc = shift;
my $ip_addr = $svc->ip_addr;
- my $out = $ip_addr . ' (' .
- include('/elements/popup_link-ping.html', ip => $ip_addr) . ')';
+ my $out = $ip_addr;
+ $out .= ' (' . include('/elements/popup_link-ping.html', ip => $ip_addr) . ')'
+ if $ip_addr;
if ( my $addr_block = $svc->addr_block ) {
$out .= '<br>Netmask: ' . $addr_block->NetAddr->mask .
'<br>Gateway: ' . $addr_block->ip_gateway;
@@ -72,4 +82,19 @@
$link . $tower_sector->description. ( $link ? '</A>' : '');
}
+sub coordinates {
+ my $s = shift; #$svc_broadband
+ return '' unless $s->latitude && $s->longitude;
+
+ my $d = $s->description;
+ unless ($d) {
+ my $cust_pkg = $s->cust_svc->cust_pkg;
+ $d = $cust_pkg->cust_main->name_short if $cust_pkg;
+ }
+
+ #'Latitude: '. $s->latitude. ', Longitude: '. $s->longitude. ' '.
+ $s->latitude. ', '. $s->longitude. ' '.
+ include('/elements/coord-links.html', $s->latitude, $s->longitude, $d);
+}
+
</%init>
Index: prospect_main.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/view/prospect_main.html,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -u -w -d -r1.5 -r1.5.2.1
--- prospect_main.html 21 Mar 2011 00:55:12 -0000 1.5
+++ prospect_main.html 13 Dec 2011 05:10:23 -0000 1.5.2.1
@@ -52,6 +52,12 @@
%>
</TD>
</TR>
+% if ( $cust_location->latitude && $cust_location->longitude ) {
+ <& /elements/tr-coords.html, $cust_location->latitude,
+ $cust_location->longitude,
+ $prospect_main->name,
+ &>
+% }
% }
</TABLE>
--- NEW FILE: kml.cgi ---
<% $kml->archive %>\
<%init>
my ($latitude, $longitude, $name) = @_;
#would be nice to pass in customer or prospect name too...
my $kml = Geo::GoogleEarth::Pluggable->new;
$kml->Point( map { $_=>scalar($cgi->param($_)) } qw( name lat lon ) );
#http_header('Content-Type' => 'application/vnd.google-earth.kml+xml' ); #kml
http_header('Content-Type' => 'application/vnd.google-earth.kmz' ); #kmz
</%init>
--- NEW FILE: map.html ---
<& /elements/header-popup.html, {
title => '',#$name,
head => $head,
etc => 'onload="html_googlemaps_initialize()"',
nobr => 1,
}
&>
<% $map_div %>
<%init>
my $name = js_string( scalar($cgi->param('name')) );
my $point = [ map scalar($cgi->param($_)), qw( longitude latitude ) ];
my( $head, $map_div ) = onload_render(
$name,
map scalar($cgi->param($_)), qw( lat lon )
);
#false laziness w/Mason.pm
sub js_string {
my $string = shift;
$string =~ s/(['\\])/\\$1/g;
$string =~ s/\r/\\r/g;
$string =~ s/\n/\\n/g;
$string = "'". $string. "'";
return $string;
}
#subroutines below derived from HTML::GoogleMapsV3, but without using
#Geo::Coder::Google or GPS::Point
sub onload_render
{
## my $self = shift;
my( $name, $latitude, $longitude ) = @_;
#map_canvas { height: 100% }
my $header='
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0px; padding: 0px }
#map_canvas { height: 100% }
</style>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?libraries=panoramio,geometry&v=3.4&sensor=false">
</script>
<script type="text/javascript">
var lengthLine=0;
function html_googlemaps_initialize() {
var latlng = new google.maps.LatLng(' .$latitude . ',' . $longitude . ');
var myOptions = {
zoom: 14,
center: latlng,
rotateControl: true,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
map.setOptions( {rotateControl : true });
';
##our own hacked in code for displaying a marker at the center
$header .= '
var markerOptions = {
map: map,
position: latlng,
title: '. $name. '
};
var marker = new google.maps.Marker(markerOptions);
';
## if( defined $self->{polyline} ) {
## foreach my $polyline ( keys %{$self->{polyline}} ) {
## $header .= $self->{polyline}->{$polyline} . "\n";
## }
## }
$header .= '}
</script>';
#my $div = '<div id="map_canvas" style="width:80%; height:75%"></div>';
my $div = '<div id="map_canvas" style="width:100%; height:100%"></div>';
$header .= "<SCRIPT>
panoramioLayer = new google.maps.panoramio.PanoramioLayer();
function panoramioOn(){
panoramioLayer.setMap(map);
}
function panoramioOff() {
panoramioLayer.setMap(null);
}
function panoramioToggle() {
if( panoramioLayer.getMap() == null ) {
panoramioOn();
} else {
panoramioOff();
}
}
</SCRIPT>";
return ($header,$div)
}
</%init>
More information about the freeside-commits
mailing list