diff options
author | Mark Wells <mark@freeside.biz> | 2016-09-26 15:25:07 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2016-09-27 10:18:19 -0700 |
commit | a5242cfab7eeb5f02e9025d79eb97e077e3d1abb (patch) | |
tree | e9c87bb27014d4cb8136e5218f6add9e61f11fc4 /httemplate | |
parent | 00be4ba5a4ae727b18c1bd1ee61adfb97c744192 (diff) |
scanning daemon and network status map, goal 1C
Diffstat (limited to 'httemplate')
-rw-r--r-- | httemplate/search/elements/gmap.html | 20 | ||||
-rwxr-xr-x | httemplate/search/svc_broadband-map.html | 35 | ||||
-rw-r--r-- | httemplate/view/svc_broadband-popup.html | 35 |
3 files changed, 67 insertions, 23 deletions
diff --git a/httemplate/search/elements/gmap.html b/httemplate/search/elements/gmap.html index b7d135d..422e6df 100644 --- a/httemplate/search/elements/gmap.html +++ b/httemplate/search/elements/gmap.html @@ -117,8 +117,24 @@ function initMap() { // then pop up an info box with the feature content info.close(); info.setPosition(feature.getGeometry().get()); - info.setContent(feature.getProperty('content')); - info.open(map); + + if ( feature.getProperty('content') ) { + info.setContent(feature.getProperty('content')); + } else { + info.setContent(''); + } + + if ( feature.getProperty('url') ) { + $.ajax({ + url: feature.getProperty('url'), + success: function(data) { + info.setContent(data); + } + }); + info.open(map); + } else { + info.open(map); + } } // snap to feature ROI if it has one diff --git a/httemplate/search/svc_broadband-map.html b/httemplate/search/svc_broadband-map.html index fe3c095..41f4b8d 100755 --- a/httemplate/search/svc_broadband-map.html +++ b/httemplate/search/svc_broadband-map.html @@ -49,15 +49,24 @@ foreach my $svc_broadband (@rows) { push @coord, $svc_broadband->altitude + 0 if length($svc_broadband->altitude); # it's optional + my $svcnum = $svc_broadband->svcnum; + my $color = $svc_broadband->addr_status_color; + push @features, { - id => 'svc_broadband/'.$svc_broadband->svcnum, + id => 'svc_broadband/'.$svcnum, geometry => { type => 'Point', coordinates => \@coord, }, properties => { - content => include('.svc_broadband', $svc_broadband), + #content => include('.svc_broadband', $svc_broadband), + url => $fsurl . 'view/svc_broadband-popup.html?' . $svcnum, + style => { + icon => { + fillColor => $color, + }, + }, }, }; # look up tower location and draw connecting line @@ -85,8 +94,8 @@ foreach my $svc_broadband (@rows) { }, properties => { style => { - strokeColor => ($tower->color || 'green'), - strokeWeight => 2, + strokeColor => $color, + strokeWeight => 1, }, }, }; @@ -135,7 +144,7 @@ foreach my $tower (values(%towers)) { style => { icon => { path => undef, - url => $fsurl.'images/jcartier-antenna-square-21x51.png', + url => $fsurl.'images/antenna-square-21x51.png', anchor => { x => 10, y => 4 } }, }, @@ -159,22 +168,6 @@ foreach my $sector (values %sectors) { }; </%init> -<%def .svc_broadband> -% my $svc = shift; -% my @label = $svc->cust_svc->label; -<H3> - <a target="_blank" href="<% $fsurl %>view/svc_broadband.cgi?<% $svc->svcnum %>"> - <% $label[0] |h %> #<% $svc->svcnum %> | <% $label[1] %> - </a> -</H3> -% my $cust_main = $svc->cust_main; -<a target="_blank" href="<% $fsurl %>view/cust_main.cgi?<% $cust_main->custnum %>"> -<& /elements/small_custview.html, { - cust_main => $svc->cust_main, - #url => $fsurl.'view/cust_main.cgi', -} &> -</a> -</%def> <%def .tower> % my $tower = shift; % my $can_edit = $FS::CurrentUser::CurrentUser->access_right('Configuration'); diff --git a/httemplate/view/svc_broadband-popup.html b/httemplate/view/svc_broadband-popup.html new file mode 100644 index 0000000..1c23474 --- /dev/null +++ b/httemplate/view/svc_broadband-popup.html @@ -0,0 +1,35 @@ +<%init> +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('View customer services'); + +my ($svcnum) = $cgi->keywords; +# cleans svcnum, checks agent access, etc. +my $svc = qsearchs( FS::svc_broadband->search({ 'svcnum' => $svcnum }) ); +my $addr_status = $svc->addr_status; +my @label = $svc->cust_svc->label; +</%init> + +<H3> + <a target="_blank" href="<% $fsurl %>view/svc_broadband.cgi?<% $svc->svcnum %>"> + <% $label[0] |h %> #<% $svc->svcnum %> | <% $label[1] %> + </a> +</H3> +% if ( $addr_status ) { +<P> + <SPAN STYLE="font-weight: bold; color: <% $svc->addr_status_color %>"> + <% emt( $addr_status->up ? 'UP' : 'DOWN' ) %> + </SPAN> +% if ( $addr_status->up ) { + (<% $addr_status->delay |h %> ms) +% } + <% emt('as of') . ' ' . time2str('%b %o %H:%M', $addr_status->_date) %> +</P> +% } +% my $cust_main = $svc->cust_main; +<a target="_blank" href="<% $fsurl %>view/cust_main.cgi?<% $cust_main->custnum %>"> +<& /elements/small_custview.html, { + cust_main => $svc->cust_main, + #url => $fsurl.'view/cust_main.cgi', +} &> +</a> + |