From: Florent Bruneau Date: Sat, 8 Sep 2007 23:52:02 +0000 (+0200) Subject: Geoloc and other fixes X-Git-Tag: xorg/0.9.15~174^2~5 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=1879c7b22a1c881d6db01c867ca7853fbc49f35d;p=platal.git Geoloc and other fixes Signed-off-by: Florent Bruneau --- diff --git a/modules/profile.php b/modules/profile.php index ccbd047..40ef129 100644 --- a/modules/profile.php +++ b/modules/profile.php @@ -380,6 +380,11 @@ class ProfileModule extends PLModule $page->assign('job', array()); $page->assign('ajaxjob', true); $page->assign('new', true); + $page->assign('secteurs', XDB::iterator("SELECT id, label + FROM emploi_secteur")); + $page->assign('fonctions', XDB::iterator("SELECT id, fonction_fr, FIND_IN_SET('titre', flags) AS title + FROM fonctions_def + ORDER BY id")); } function handler_ajax_secteur(&$page, $id, $sect, $ssect = -1) diff --git a/modules/profile/jobs.inc.php b/modules/profile/jobs.inc.php index b81c8f9..c544ef9 100644 --- a/modules/profile/jobs.inc.php +++ b/modules/profile/jobs.inc.php @@ -68,7 +68,7 @@ class ProfileJob extends ProfileGeoloc } $success = true; foreach ($value as $key=>&$job) { - if (@$job['removed']) { + if (@$job['removed'] || !trim($job['name'])) { unset($value[$key]); } } diff --git a/modules/profile/page.inc.php b/modules/profile/page.inc.php index 411be43..1afcd9f 100644 --- a/modules/profile/page.inc.php +++ b/modules/profile/page.inc.php @@ -138,9 +138,11 @@ abstract class ProfileGeoloc implements ProfileSetting || (@$address['text'] && !@$address['cityid'])) { $address = array_merge($address, empty_address()); $new = get_address_infos(@$address['text']); - if (compare_addresses_text(@$adress['text'], $geotxt = get_address_text($new)) - || @$address['parsevalid']) { + if (compare_addresses_text(@$address['text'], $geotxt = get_address_text($new)) + || (@$address['parsevalid'] && @$address['cityid'])) { $address = array_merge($address, $new); + } else if (@$address['parsevalid']) { + $address = array_merge($address, cut_address(@$address['text'])); } else { $success = false; $address = array_merge($address, cut_address(@$address['text'])); diff --git a/templates/geoloc/form.address.tpl b/templates/geoloc/form.address.tpl index 3b4f87d..428cc6e 100644 --- a/templates/geoloc/form.address.tpl +++ b/templates/geoloc/form.address.tpl @@ -40,6 +40,7 @@ name="{$name}[geoloc]" onclick="blur()" >{$adr.geoloc} + diff --git a/templates/profile/adresses.tpl b/templates/profile/adresses.tpl index f87b691..9d6f176 100644 --- a/templates/profile/adresses.tpl +++ b/templates/profile/adresses.tpl @@ -124,7 +124,7 @@ 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]"].value = "1"; + document.forms.prof_annu[pref + "[parsevalid]"].value = "0"; attachEvent(document.forms.prof_annu[pref + "[text]"], "click", function() { document.forms.prof_annu[pref + "[text]"].blur(); }); document.forms.prof_annu[pref + "[text]"].className = ''; diff --git a/templates/profile/jobs.tpl b/templates/profile/jobs.tpl index 46fe55c..e42a14a 100644 --- a/templates/profile/jobs.tpl +++ b/templates/profile/jobs.tpl @@ -75,6 +75,7 @@ function validGeoloc(id, pref) document.getElementById(id + '_geoloc_valid').style.display = 'none'; document.forms.prof_annu[pref + "[parsevalid]"].value = "1"; document.forms.prof_annu[pref + "[text]"].value = document.forms.prof_annu[pref + "[geoloc]"].value; + document.forms.prof_annu[pref + "[cityid]"].value = document.forms.prof_annu[pref + "[geoloc_cityid]"].value; attachEvent(document.forms.prof_annu[pref + "[text]"], "click", function() { document.forms.prof_annu[pref + "[text]"].blur(); }); document.forms.prof_annu[pref + "[text]"].className = '';