]> git.openstreetmap.org Git - nominatim.git/blob - lib/template/address-html.php
user interface: reverse search remembers zoom level after map click
[nominatim.git] / lib / template / address-html.php
1 <?php
2   header("content-type: text/html; charset=UTF-8");
3 ?>
4 <?php include(CONST_BasePath.'/lib/template/includes/html-header.php'); ?>
5   <link href="css/common.css" rel="stylesheet" type="text/css" />
6   <link href="css/search.css" rel="stylesheet" type="text/css" />
7 </head>
8
9 <body id="reverse-page">
10
11   <?php include(CONST_BasePath.'/lib/template/includes/html-top-navigation.php'); ?>
12
13   <form class="form-inline" role="search" accept-charset="UTF-8" action="<?php echo CONST_Website_BaseURL; ?>reverse.php">
14     <div class="form-group">
15       <input name="format" type="hidden" value="html">
16       <input name="prevmapzoom" type="hidden" value="">
17       <input name="lat" type="text" class="form-control input-sm" placeholder="latitude"  value="<?php echo htmlspecialchars($_GET['lat']); ?>" >
18       <input name="lon" type="text" class="form-control input-sm" placeholder="longitude" value="<?php echo htmlspecialchars($_GET['lon']); ?>" >
19     </div>
20     <div class="form-group search-button-group">
21       <button type="submit" class="btn btn-primary btn-sm">Search</button>
22     </div>
23     <div class="search-type-link">
24       <a href="<?php echo CONST_Website_BaseURL; ?>search.php">forward search</a>
25     </div>
26   </form>
27
28
29   <div id="content">
30
31 <?php if ($aPlace) { ?>
32
33     <div id="searchresults" class="sidebar">
34     <?php
35       $aResult = $aPlace;
36
37       echo '<div class="result" data-position="0">';
38
39       echo (isset($aResult['icon'])?'<img alt="icon" src="'.$aResult['icon'].'"/>':'');
40       echo ' <span class="name">'.htmlspecialchars($aResult['langaddress']).'</span>';
41       if (isset($aResult['label']))
42         echo ' <span class="type">('.$aResult['label'].')</span>';
43       else if ($aResult['type'] == 'yes')
44         echo ' <span class="type">('.ucwords(str_replace('_',' ',$aResult['class'])).')</span>';
45       else
46         echo ' <span class="type">('.ucwords(str_replace('_',' ',$aResult['type'])).')</span>';
47       echo '<p>'.$aResult['lat'].','.$aResult['lon'].'</p>';
48       echo ' <a class="btn btn-default btn-xs details" href="details.php?place_id='.$aResult['place_id'].'">details</a>';
49       echo '</div>';
50     ?>
51     </div>
52
53 <?php } else { ?>
54
55     <div id="intro" class="sidebar">
56       Search for coordinates or click anywhere on the map.
57     </div>
58
59 <?php } ?>
60
61     <div id="map-wrapper">
62       <div id="map-position"></div>
63       <div id="map"></div>
64     </div>
65
66   </div> <!-- /content -->
67
68
69
70
71
72
73
74   <script type="text/javascript">
75   <?php
76
77     $aNominatimMapInit = [
78       'prevmapzoom' => isset($_GET['prevmapzoom'])?htmlspecialchars($_GET['prevmapzoom']):NULL,
79       'zoom' => isset($_GET['zoom'])?htmlspecialchars($_GET['zoom']):NULL,
80       'lat'  => isset($_GET['lat'] )?htmlspecialchars($_GET['lat']):NULL,
81       'lon'  => isset($_GET['lon'] )?htmlspecialchars($_GET['lon']):NULL
82     ];
83     echo 'var nominatim_map_init = ' . json_encode($aNominatimMapInit, JSON_PRETTY_PRINT) . ';';
84
85     echo 'var nominatim_results = ' . json_encode([$aPlace], JSON_PRETTY_PRINT) . ';'; 
86   ?>
87   </script>
88   <?php include(CONST_BasePath.'/lib/template/includes/html-footer.php'); ?>
89
90 </body>
91 </html>