From 323463709c49b751827ffecc4372fa52d430574f Mon Sep 17 00:00:00 2001 From: Florent Bruneau Date: Fri, 31 Aug 2007 22:04:41 +0200 Subject: [PATCH] Geoloc validation Signed-off-by: Florent Bruneau --- modules/profile/addresses.inc.php | 2 ++ templates/geoloc/form.address.tpl | 16 ++++++++++++---- templates/profile/adresses.address.tpl | 2 +- templates/profile/adresses.tpl | 23 +++++++++++++++++++++++ 4 files changed, 38 insertions(+), 5 deletions(-) diff --git a/modules/profile/addresses.inc.php b/modules/profile/addresses.inc.php index 4243527..e78a5a0 100644 --- a/modules/profile/addresses.inc.php +++ b/modules/profile/addresses.inc.php @@ -34,6 +34,8 @@ class ProfileAddress { require_once 'geoloc.inc.php'; $success = true; + unset($address['geoloc']); + unset($address['geoloc_cityid']); if (@$address['parsevalid'] || (@$address['text'] && @$address['changed']) || !@$address['cityid']) { $address = array_merge($address, empty_address()); $new = get_address_infos(@$address['text']); diff --git a/templates/geoloc/form.address.tpl b/templates/geoloc/form.address.tpl index 9561af5..3b4f87d 100644 --- a/templates/geoloc/form.address.tpl +++ b/templates/geoloc/form.address.tpl @@ -22,25 +22,33 @@ {if $adr.geoloc} -
+
La geolocalisation n'a pas donné un résultat certain, valide la nouvelle adresse ou modifie l'ancienne pour que ton adresse puisse être prise en compte.
{/if} +
{if $adr.geoloc} + -

- -

+ +
+
+ diff --git a/templates/profile/adresses.address.tpl b/templates/profile/adresses.address.tpl index 5b49c91..09d13b0 100644 --- a/templates/profile/adresses.address.tpl +++ b/templates/profile/adresses.address.tpl @@ -56,7 +56,7 @@
{include file="include/flags.radio.tpl" name="`$adpref`[pub]" notable=true val=$adr.pub}
{include file="geoloc/form.address.tpl" name=$adpref id=$adid adr=$adr}
-
+
diff --git a/templates/profile/adresses.tpl b/templates/profile/adresses.tpl index 833d716..8ca6568 100644 --- a/templates/profile/adresses.tpl +++ b/templates/profile/adresses.tpl @@ -107,6 +107,29 @@ function addTel(id) Ajax.update_html(tel + i, 'profile/ajax/tel/' + id + '/' + i); } +function validGeoloc(id, pref) +{ + document.getElementById(id + '_geoloc').style.display = 'none'; + document.getElementById(id + '_geoloc_error').style.display = 'none'; + document.getElementById(id + '_geoloc_valid').style.display = 'none'; + document.forms.prof_annu[pref + "[parsevalid]"] = "1"; + document.forms.prof_annu[pref + "[text]"].value = document.forms.prof_annu[pref + "[geoloc]"].value; + attachEvent(document.forms.prof_annu[pref + "[text]"], "click", + function() { document.forms.prof_annu[pref + "[text]"].blur(); }); + document.forms.prof_annu[pref + "[text]"].className = ''; +} + +function validAddress(id, pref) +{ + document.getElementById(id + '_geoloc').style.display = 'none'; + document.getElementById(id + '_geoloc_error').style.display = 'none'; + document.getElementById(id + '_geoloc_valid').style.display = 'none'; + document.forms.prof_annu[pref + "[parsevalid]"] = "0"; + attachEvent(document.forms.prof_annu[pref + "[text]"], "click", + function() { document.forms.prof_annu[pref + "[text]"].blur(); }); + document.forms.prof_annu[pref + "[text]"].className = ''; +} + {/literal} //]]> -- 2.1.4