X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Felements%2Fcoord-links.html;h=db04dad97787c47dd4d2c4b685416f9e4bc22911;hp=907e5f04a0e15fdd2114dbb0b7fd430c03555722;hb=ff27c3f36240aee48ed50153dd5d8fe3ac3f2443;hpb=fb4ab1073f0d15d660c6cdc4e07afebf68ef3924 diff --git a/httemplate/elements/coord-links.html b/httemplate/elements/coord-links.html index 907e5f04a..db04dad97 100644 --- a/httemplate/elements/coord-links.html +++ b/httemplate/elements/coord-links.html @@ -3,20 +3,57 @@ <& /elements/popup_link.html, 'action' => $p. 'view/map.html?'. $query, 'label' => mt('map'), - 'actionlabel' => $name, + 'actionlabel' => $js_name, 'width' => 763, 'height' => 575, #'color' &> +% if ( $origin ) { + <& /elements/popup_link.html, + 'action' => $p. "view/directions.html?origin=$origin;". $query, + 'label' => mt('directions'), + 'actionlabel' => $js_name, + 'width' => 763, + 'height' => 575, + &> +% } + <% mt('earth') |h %> <%init> -my ($latitude, $longitude, $name) = @_; +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($name). +my $query = 'name='. uri_escape_utf8($name). ';lat='. $latitude. ';lon='. $longitude; +my $js_name = $name; +$js_name =~ s/[<>"']/ /g; +$m->interp->apply_escapes($js_name, 'js_string'); +$js_name =~ s/^'//; +$js_name =~ s/'$//; + +my $conf = new FS::Conf; +my $apikey = $conf->config('google_maps_api_key'); + +#for directions link +my @origin = $opt{company_address} + ? @{ $opt{company_address} } + : ( $conf->config('company_physical_address', $agentnum) + ? $conf->config('company_physical_address', $agentnum) + : $conf->config('company_address', $agentnum) ); +my $origin = uri_escape(join(',', @origin)); +