summaryrefslogtreecommitdiff
path: root/httemplate/elements/coord-links.html
blob: 02a224a00124f1453e2408f962b538b0bb991f5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<& /elements/init_overlib.html &>

<& /elements/popup_link.html,
     'action'      => $p. 'view/map.html?'. $query,
     'label'       => mt('map'),
     '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,
  &>
% }

<A HREF="<%$p%>view/kml.cgi?<% $query %>"><% mt('earth') |h %></A>

<%init>

my ($latitude, $longitude, $name, $agentnum) = @_;

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 $origin;
#for directions link
if ( $agentnum =~ /^\d+$/ ) {
  $origin = FS::Conf->new->config('company_address', $agentnum);
  $origin = uri_escape($origin);
}
</%init>