X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Fcoord-links.html;h=45b81320162d6429f8997575f2b30488783f78e9;hb=2a0b5339081a439a8c5ec1f2b9cd28b63fd3fa49;hp=60882deed86e633b482aab3b7d3a243a9f337f00;hpb=3063fb45f35d0cb5253871a540a8f0a0efa06b5a;p=freeside.git diff --git a/httemplate/elements/coord-links.html b/httemplate/elements/coord-links.html index 60882deed..45b813201 100644 --- a/httemplate/elements/coord-links.html +++ b/httemplate/elements/coord-links.html @@ -3,7 +3,7 @@ <& /elements/popup_link.html, 'action' => $p. 'view/map.html?'. $query, 'label' => mt('map'), - 'actionlabel' => uri_escape_utf8($name), + 'actionlabel' => $js_name, 'width' => 763, 'height' => 575, #'color' @@ -13,7 +13,7 @@ <& /elements/popup_link.html, 'action' => $p. "view/directions.html?origin=$origin;". $query, 'label' => mt('directions'), - 'actionlabel' => uri_escape_utf8($name), + 'actionlabel' => $js_name, 'width' => 763, 'height' => 575, &> @@ -23,16 +23,32 @@ <%init> -my ($latitude, $longitude, $name, $agentnum) = @_; +my %opt = (); +my ($latitude, $longitude, $name, $agentnum); +if ( ref($_[0]) ) { + %opt = %{ $_[0] }; + $latitude = $opt{latitude}; + $longitude = $opt{longitude}; + $name = $opt{name}; + $agentnum = $opt{agentnum}; +} else { + ($latitude, $longitude, $name, $agentnum) = @_; +} my $query = 'name='. uri_escape_utf8($name). ';lat='. $latitude. ';lon='. $longitude; -my $origin; +my $js_name = $name; +$js_name =~ s/[<>"']/ /g; +$m->interp->apply_escapes($js_name, 'js_string'); +$js_name =~ s/^'//; +$js_name =~ s/'$//; + #for directions link -if ( $agentnum =~ /^\d+$/ ) { - $origin = FS::Conf->new->config('company_address', $agentnum); - $origin = uri_escape($origin); -} +my @origin = $opt{company_address} + ? @{ $opt{company_address} } + : FS::Conf->new->config('company_address', $agentnum); +my $origin = uri_escape(join(',', @origin)); +