]> git.openstreetmap.org Git - nominatim.git/blob - lib/template/details-error-html.php
clean up details page
[nominatim.git] / lib / template / details-error-html.php
1 <?php
2         header("content-type: text/html; charset=UTF-8");
3 ?>
4 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
5 <html xmlns="http://www.w3.org/1999/xhtml">
6   <head>
7     <title>OpenStreetMap Nominatim: <?php echo $aPointDetails['localname'];?></title>
8     <style>
9 body {
10         margin:0px;
11         padding:16px;
12   background:#ffffff;
13   height: 100%;
14   font: normal 12px/15px arial,sans-serif;
15 }
16 .line{
17   margin-left:20px;
18 }
19 .name{
20   font-weight: bold;
21 }
22 .notused{
23   color:#ddd;
24 }
25 .noname{
26   color:#800;
27 }
28 #map {
29   width:500px;
30   height:500px;
31   border: 2px solid #666;
32   float: right;
33 }
34     </style>
35         <script src="js/OpenLayers.js"></script>
36         <script src="js/tiles.js"></script>
37         <script type="text/javascript">
38         
39                 var map;
40
41     function init() {
42                         map = new OpenLayers.Map ("map", {
43                 controls:[
44                                                                                 new OpenLayers.Control.Permalink(),
45                                                                                 new OpenLayers.Control.Navigation(),
46                                                                                 new OpenLayers.Control.PanZoomBar(),
47                                                                                 new OpenLayers.Control.MouseDefaults(),
48                                                                                 new OpenLayers.Control.MousePosition(),
49                                                                                 new OpenLayers.Control.Attribution()],
50                 maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
51                 maxResolution: 156543.0399,
52                 numZoomLevels: 19,
53                 units: 'm',
54                 projection: new OpenLayers.Projection("EPSG:900913"),
55                 displayProjection: new OpenLayers.Projection("EPSG:4326")
56                 } );
57                         map.addLayer(new OpenLayers.Layer.OSM.<?php echo CONST_Tile_Default;?>("Default"));
58
59                         var layer_style = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);
60                         layer_style.fillOpacity = 0.2;
61                         layer_style.graphicOpacity = 0.2;
62
63                         vectorLayer = new OpenLayers.Layer.Vector("Points", {style: layer_style});
64                         map.addLayer(vectorLayer);
65
66             var proj_EPSG4326 = new OpenLayers.Projection("EPSG:4326");
67                         var proj_map = map.getProjectionObject();
68
69             freader = new OpenLayers.Format.WKT({
70                 'internalProjection': proj_map,
71                 'externalProjection': proj_EPSG4326
72             });
73
74             var bounds;
75             <?php if ($aPointDetails['prevgeom']) { ?>
76             var feature = freader.read('<?php echo $aPointDetails['prevgeom'];?>');
77             if (feature) {
78                 bounds = feature.geometry.getBounds();
79
80             }
81             feature.style = {
82                                 strokeColor: "#777777",
83                                 fillColor: "#F0F0F0",
84                                 strokeWidth: 2,
85                                 strokeOpacity: 0.75,
86                                 fillOpacity: 0.75,
87                 strokeDashstyle: "longdash"
88                         };
89             vectorLayer.addFeatures([feature]);
90             <?php } ?>
91
92             <?php if ($aPointDetails['newgeom']) { ?>
93             feature = freader.read('<?php echo $aPointDetails['newgeom'];?>');
94             if (feature) {
95                 if (!bounds) {
96                     bounds = feature.geometry.getBounds();
97                 } 
98                 else 
99                 {
100                     bounds.extend(feature.geometry.getBounds());
101                 }
102             }
103             feature.style = {
104                                 strokeColor: "#75ADFF",
105                                 fillColor: "#FFF7F0",
106                                 strokeWidth: 2,
107                                 strokeOpacity: 0.75,
108                                 fillOpacity: 0.75
109                         };
110             vectorLayer.addFeatures([feature]);
111             <?php } ?>
112
113             <?php if (isset($aPointDetails['error_x'])) { ?>
114             var pt = new OpenLayers.Geometry.Point(<?php echo $aPointDetails['error_x'].','.$aPointDetails['error_y'];?>);
115             pt = pt.transform(proj_EPSG4326, proj_map);
116             feature = new OpenLayers.Feature.Vector(pt, null,
117                        {
118                             graphicName : "x",
119                             fillColor: "#FF0000",
120                             graphic : true,
121                             pointRadius: 6
122                        });
123             vectorLayer.addFeatures([feature]);
124             <?php } ?>
125
126
127             map.zoomToExtent(bounds);
128
129                 }
130                 
131         </script>
132   </head>
133   <body onload="init();">
134     <div id="map"></div>
135         <h1><?php echo $aPointDetails['localname'] ?></h1>
136         <div class="locationdetails">
137         <div>Type: <span class="type"><?php echo $aPointDetails['class'].':'.$aPointDetails['type'];?></span></div>
138  
139 <?php
140     $sOSMType = ($aPointDetails['osm_type'] == 'N'?'node':($aPointDetails['osm_type'] == 'W'?'way':   ($aPointDetails['osm_type'] == 'R'?'relation':'')));
141     if ($sOSMType) echo ' <div>OSM: <span class="osm"><span class="label"></span>'.$sOSMType.' <a     href="http://www.openstreetmap.org/browse/'.$sOSMType.'/'.$aPointDetails['osm_id'].'">'.              $aPointDetails['osm_id'].'</a></span></div>';
142 ?>
143
144     <p>This object has an invalid geometry.</p>
145     <p><b>Details:</b> <?php
146
147 $sVal = $aPointDetails['errormessage']?$aPointDetails['errormessage']:'&nbsp;';
148 $sOSMType = ($aPointDetails['osm_type'] == 'N'?'node':($aPointDetails['osm_type'] == 'W'?'way':($aPointDetails['osm_type'] == 'R'?'relation':'')));
149 $sOSMID = $aPointDetails['osm_id'];
150
151 if (isset($aPointDetails['error_x']))
152 {
153         $sLat = $aPointDetails['error_y'];
154         $sLon = $aPointDetails['error_x'];
155         echo "<a href=\"http://www.openstreetmap.org/?lat=".$sLat."&lon=".$sLon."&zoom=18&layers=M&".$sOSMType."=".$sOSMID."\">".$sVal."</a>";
156 }
157 else
158 {
159         echo $sVal;
160 }
161 ?>
162     <p><b>Edit:</b> in <?php
163 if (isset($aPointDetails['error_x']))
164 {
165         $fWidth = 0.0002;
166         echo " <a href=\"http://localhost:8111/load_and_zoom?left=".($sLon-$fWidth)."&right=".($sLon+$fWidth)."&top=".($sLat+$fWidth)."&bottom=".($sLat-$fWidth)."\" target=\"josm\">Remote Control (JOSM / Merkaartor)</a>";
167         echo " | <a href=\"http://www.openstreetmap.org/edit?editor=potlatch2&bbox=".($sLon-$fWidth).",".($sLat-$fWidth).",".($sLon+$fWidth).",".($sLat+$fWidth)."\" target=\"potlatch2\">Potlatch 2</a>";
168 }
169 else
170 {
171         echo " <a href=\"http://localhost:8111/import?url=http://www.openstreetmap.org/api/0.6/".$sOSMType.'/'.$sOSMID."/full\" target=\"josm\">Remote Control (JOSM / Merkaartor)</a>";
172         // Should be better to load by object id - but this doesn't seem to zoom correctly
173         //echo " <a href=\"http://localhost:8111/load_object?new_layer=true&objects=".strtolower($aPointDetails['osm_type']).$sOSMID."\" target=\"josm\">Remote Control (JOSM / Merkaartor)</a>";
174 }
175
176 ?></p>
177
178   </body>
179 </html>
180