From f2a2c29815768171406587b7bc528f5033ec9b8f Mon Sep 17 00:00:00 2001 From: Marc Tobias Metten Date: Tue, 19 Jan 2016 12:29:07 +0100 Subject: [PATCH] responsive details-error page. Shared header and footer --- VAGRANT.md | 2 +- lib/template/details-error-html.php | 297 ++++++++---------- lib/template/details-html.php | 30 +- lib/template/includes/html-footer.php | 20 +- lib/template/includes/html-top-navigation.php | 49 +++ lib/template/search-html.php | 60 +--- website/css/common.css | 31 ++ website/css/details.css | 7 +- website/css/search.css | 33 +- website/details.php | 11 +- website/js/nominatim-ui.js | 14 +- website/search.php | 45 +-- 12 files changed, 286 insertions(+), 313 deletions(-) create mode 100644 lib/template/includes/html-top-navigation.php create mode 100644 website/css/common.css diff --git a/VAGRANT.md b/VAGRANT.md index 504d28f3..3a8e479b 100644 --- a/VAGRANT.md +++ b/VAGRANT.md @@ -129,7 +129,7 @@ No. Long running Nominatim installations will differ once new import features (o bug fixes) get added since those usually only get applied to new/changed data. Also this document skips the optional Wikipedia data import which affects ranking -of search results. See [Nominatim instllation](http://wiki.openstreetmap.org/wiki/Nominatim/Installation) for details. +of search results. See [Nominatim installation](http://wiki.openstreetmap.org/wiki/Nominatim/Installation) for details. ##### Why Ubuntu, can I test CentOS/CoreOS/FreeBSD? diff --git a/lib/template/details-error-html.php b/lib/template/details-error-html.php index 1268414d..1c6d2a0a 100644 --- a/lib/template/details-error-html.php +++ b/lib/template/details-error-html.php @@ -1,180 +1,133 @@ - - - - OpenStreetMap Nominatim: <?php echo $aPointDetails['localname'];?> - - - - - - -
-

-
-
Type:
- OSM: '.$sOSMType.' '. $aPointDetails['osm_id'].'
'; -?> -

This object has an invalid geometry.

-

Details: ".$sVal.""; -} -else -{ - echo $sVal; -} + function osm_link($aFeature) + { + $sOSMType = ($aFeature['osm_type'] == 'N'?'node':($aFeature['osm_type'] == 'W'?'way':($aFeature['osm_type'] == 'R'?'relation':''))); + if ($sOSMType) { + return ''.$sOSMType.' '.$aFeature['osm_id'].''; + } + return ''; + } + + function osm_map_url($aFeature) + { + $sLon = $aFeature['error_x']; + $sLat = $aFeature['error_y']; + + if (isset($sLat)) + { + $sOSMType = ($aFeature['osm_type'] == 'N'?'node':($aFeature['osm_type'] == 'W'?'way':($aFeature['osm_type'] == 'R'?'relation':''))); + if ($sOSMType) + { + return "http://www.openstreetmap.org/?lat=".$sLat."&lon=".$sLon."&zoom=18&layers=M&".$sOSMType."=".$aFeature['osm_id']; + } + } + return ''; + } + + function josm_edit_url($aFeature) + { + $fWidth = 0.0002; + $sLon = $aFeature['error_x']; + $sLat = $aFeature['error_y']; + + if (isset($sLat)) + { + return "http://localhost:8111/load_and_zoom?left=".($sLon-$fWidth)."&right=".($sLon+$fWidth)."&top=".($sLat+$fWidth)."&bottom=".($sLat-$fWidth); + } + + $sOSMType = ($aFeature['osm_type'] == 'N'?'node':($aFeature['osm_type'] == 'W'?'way':($aFeature['osm_type'] == 'R'?'relation':''))); + if ($sOSMType) + { + return 'http://localhost:8111/import?url=http://www.openstreetmap.org/api/0.6/'.$sOSMType.'/'.$aFeature['osm_id'].'/full'; + // Should be better to load by object id - but this doesn't seem to zoom correctly + // return " Remote Control (JOSM / Merkaartor)"; + } + return ''; + } + + function potlach_edit_url($aFeature) + { + $fWidth = 0.0002; + $sLat = $aFeature['error_y']; + $sLon = $aFeature['error_x']; + + if (isset($sLat)) + { + return "http://www.openstreetmap.org/edit?editor=potlatch2&bbox=".($sLon-$fWidth).",".($sLat-$fWidth).",".($sLon+$fWidth).",".($sLat+$fWidth); + } + return ''; + } + + + ?> -

Edit: in Remote Control (JOSM / Merkaartor)"; - echo " | Potlatch 2"; -} -else -{ - echo " Remote Control (JOSM / Merkaartor)"; - // Should be better to load by object id - but this doesn't seem to zoom correctly - //echo " Remote Control (JOSM / Merkaartor)"; -} - -?>

- - - + +
+
+
+ + +

+
+

This object has an invalid geometry.

+ +
+ Type: +
+ +
+ OSM: +
+ + +

Error

+

+ +

+ + view on osm.org + + +

Edit

+ +
+
+
+
+
+ +
+ + + + + + + + \ No newline at end of file diff --git a/lib/template/details-html.php b/lib/template/details-html.php index da36167c..548cee7a 100644 --- a/lib/template/details-html.php +++ b/lib/template/details-html.php @@ -2,9 +2,11 @@ header("content-type: text/html; charset=UTF-8"); ?> + + '.$sOSMType.' '.$aFeature['osm_id'].''; } return ''; @@ -28,7 +31,7 @@ if ($aFeature['wikipedia']) { list($sWikipediaLanguage,$sWikipediaArticle) = explode(':',$aFeature['wikipedia']); - return ''.$aFeature['wikipedia'].''; + return ''.$aFeature['wikipedia'].''; } return ''; } @@ -40,7 +43,19 @@ function format_distance($fDistance) { - return'~'.(round($fDistance,1)).' km'; + // $fDistance is in meters + if ($fDistance < 1) + { + return '0'; + } + elseif ($fDistance < 1000) + { + return'~'.(round($fDistance,0)).' m'; + } + else + { + return'~'.(round($fDistance/1000,1)).' km'; + } } function kv($sKey,$sValue) @@ -245,13 +260,6 @@
- - - - - - - - \ No newline at end of file + + + + + + + diff --git a/lib/template/includes/html-top-navigation.php b/lib/template/includes/html-top-navigation.php new file mode 100644 index 00000000..92eb0fb8 --- /dev/null +++ b/lib/template/includes/html-top-navigation.php @@ -0,0 +1,49 @@ +
+
+ +
+ + Data last updated: +
+ + +
+
+
+ + +
+
+
+
+ + diff --git a/lib/template/search-html.php b/lib/template/search-html.php index 91e9e890..a327b493 100644 --- a/lib/template/search-html.php +++ b/lib/template/search-html.php @@ -2,42 +2,13 @@ header("content-type: text/html; charset=UTF-8"); ?> + - -
-
- -
- Data last updated: -
- -
-
-
- - -
-
-
-
+