maposmatic-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Maposmatic-dev] [PATCH 1/7] Filter the list of languages depending on t


From: Pierre Mauduit
Subject: [Maposmatic-dev] [PATCH 1/7] Filter the list of languages depending on the country
Date: Mon, 21 Dec 2009 20:41:26 +0100

From: Thomas Petazzoni <address@hidden>

Signed-off-by: Thomas Petazzoni <address@hidden>
---
 www/templates/maposmatic/index.html |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/www/templates/maposmatic/index.html 
b/www/templates/maposmatic/index.html
index f6c39a8..00739f3 100644
--- a/www/templates/maposmatic/index.html
+++ b/www/templates/maposmatic/index.html
@@ -131,7 +131,7 @@ function validate_city_search()
                else
                 {
                   $("#result_nominatim_search").append("<li><input 
onchange=\"javascript:update_hidden(this,'"
-                    +item.display_name+"');\" type=\"radio\" 
name=\"administrative_tmp_osmid\" value=\""
+                    +item.display_name+"'); select_country('" + 
item.country_code + "');\" type=\"radio\" name=\"administrative_tmp_osmid\" 
value=\""
                     +item.ocitysmap_params['id']+"\" 
id=\"rd"+item.ocitysmap_params['id']+"\"/><label for=\"rd"+
                     item.ocitysmap_params['id']+"\">" 
+item.display_name+"</label></li>");
                  elemFound = elemFound + 1;
@@ -147,6 +147,24 @@ function validate_city_search()
            });
 }
 
+function select_country(country)
+{
+  var nonhidden = null;
+  $('#id_map_language').find('option').each(function() {
+   var ischoosen = $(this).val().match(".._" + country.toUpperCase() + "\..*");
+   if (ischoosen == null) {
+     $(this).hide();
+   }
+   else {
+     $(this).show();
+     if (nonhidden == null)
+        nonhidden = $(this);
+   }
+   });
+
+   nonhidden.attr('selected', 'selected');
+}
+
 function update_hidden(obj, nloc)
 {
   toggle_form_validation("true");
-- 
1.6.5.7





reply via email to

[Prev in Thread] Current Thread [Next in Thread]