]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/template/search-html.php
correctly quote display name in html search result
[nominatim.git] / lib / template / search-html.php
index 07c26be14785b35bed54406515c19889671b05c4..7da79ad82a07180d0fe57d6ad8d6abd674c8fff5 100644 (file)
        <script src="js/prototype-1.6.0.3.js" type="text/javascript"></script>
 
        <script type="text/javascript">
-        
+
                var map;
 
                function handleResize()
                {
                        if ($('searchresults'))
                        {
-                var viewwidth = ((document.documentElement.clientWidth > 0?document.documentElement.clientWidth:document.documentElement.offsetWidth) - 200) + 'px';
+                               var viewwidth = ((document.documentElement.clientWidth > 0?document.documentElement.clientWidth:document.documentElement.offsetWidth) - 200) + 'px';
                                $('map').style.width = viewwidth;
                                $('report').style.width = viewwidth;
                        }
@@ -31,7 +31,7 @@
                                $('map').style.width = ((document.documentElement.clientWidth > 0?document.documentElement.clientWidth:document.documentElement.offsetWidth) - 0) + 'px';
                                $('map').style.left = '0px';
                        }
-                       
+
                        if ($('map')) $('map').style.height = ((document.documentElement.clientHeight > 0?document.documentElement.clientHeight:document.documentElement.offsetHeight) - 38) + 'px';
                        if ($('searchresults')) $('searchresults').style.height = ((document.documentElement.clientHeight > 0?document.documentElement.clientHeight:document.documentElement.offsetHeight) - 38) + 'px';
                        if ($('report')) $('report').style.height = ((document.documentElement.clientHeight > 0?document.documentElement.clientHeight:document.documentElement.offsetHeight) - 38) + 'px';
                 controls:[
                                                                                new OpenLayers.Control.Navigation(),
                                                                                new OpenLayers.Control.PanZoomBar(),
-                                                                               new OpenLayers.Control.MouseDefaults(),
                                                                                new OpenLayers.Control.MousePosition(),
                                                                                new OpenLayers.Control.Attribution()],
                 maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
                                <tr>
                                        <td valign="middle" style="width:30px;"><img alt="logo" src="images/logo.gif" /></td>
                                        <td valign="middle" style="width:400px;"><input id="q" name="q" value="<?php echo htmlspecialchars($sQuery); 
-?>" style="width:270px;" /><input type="text" id="viewbox" style="width:128px;" name="viewbox" /></td>
+?>" style="width:270px;" /><input type="text" id="viewbox" style="width:120px;" name="viewbox" /></td>
                                        <td style="width:80px;"><input type="submit" value="Search"/></td>
 <?php if (CONST_Search_AreaPolygons) { ?>                                      <td style="width:100px;"><input type="checkbox" value="1" name="polygon" <?php if ($bAsText) echo "checked='checked'"; ?>/> Highlight</td>
 <td style="text-align:right;">Data: <?php echo $sDataDate; ?></td>
@@ -168,7 +167,7 @@ target="_blank">FAQ</a></td>
        </div>
 
 <?php
-       if ($sQuery || sizeof($aSearchResults))
+       if ($sQuery)
        {
 ?>
        <div id="searchresultsfade1"></div><div id="searchresultsfade2"></div><div id="searchresultsfade3"></div><div id="searchresultsfade4"></div>
@@ -200,11 +199,13 @@ target="_blank">FAQ</a></td>
                }
 
                echo (isset($aResult['icon'])?'<img alt="icon" src="'.$aResult['icon'].'"/>':'');
-               echo ' <span class="name">'.$aResult['name'].'</span>';
+               echo ' <span class="name">'.htmlspecialchars($aResult['name']).'</span>';
                echo ' <span class="latlon">'.round($aResult['lat'],3).','.round($aResult['lon'],3).'</span>';
                echo ' <span class="place_id">'.$aResult['place_id'].'</span>';
                if (isset($aResult['label']))
                        echo ' <span class="type">('.$aResult['label'].')</span>';
+               else if ($aResult['type'] == 'yes')
+                       echo ' <span class="type">('.ucwords(str_replace('_',' ',$aResult['class'])).')</span>';
                else
                        echo ' <span class="type">('.ucwords(str_replace('_',' ',$aResult['type'])).')</span>';
                echo ' <span class="details">(<a href="details.php?place_id='.$aResult['place_id'].'">details</a>)</span>';
@@ -244,7 +245,7 @@ the component to 'nominatim'.  You can search for existing bug reports <a href="
 the problem relates to missing data, the osm id of the item that is missing.  Problems that contain enough detail are likely to get looked at before ones that 
 require significant research!</p>
                </div>
-               
+
 <!--
                <p>Please use this form to report problems with the search results.  Of particular interest are items missing, but please also use this form to 
 report any other problems.</p>