From: Stéphane Jacob Date: Tue, 3 May 2011 12:10:49 +0000 (+0200) Subject: Removes user confusing geocoding multichoice. X-Git-Tag: xorg/1.1.2~62^2~34 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=00b2bc89fd75cb6d6579d7dc5ab28f25aefebbd8;p=platal.git Removes user confusing geocoding multichoice. Signed-off-by: Stéphane Jacob --- diff --git a/classes/address.php b/classes/address.php index fc438e5..fb4eb44 100644 --- a/classes/address.php +++ b/classes/address.php @@ -316,8 +316,6 @@ class Address public $south = null; public $east = null; public $west = null; - public $geocodedText = null; - public $geocodeChosen = null; // Database's field required for both 'home' and 'job' addresses. public $pub = 'ax'; @@ -580,17 +578,8 @@ class Address $this->postalText = $text; } - public function format(array $format = array()) + public function format() { - if (empty($format)) { - $format['requireGeocoding'] = false; - $format['stripGeocoding'] = false; - $format['postalText'] = false; - } else { - foreach (array('requireGeocoding', 'stripGeocoding', 'postalText') as $type) { - $format[$type] = (isset($format[$type])) ? $format[$type] : false; - } - } $this->text = trim($this->text); $this->phones = Phone::formatFormArray($this->phones, $this->error, new ProfileVisibility($this->pub)); if ($this->removed == 1) { @@ -602,30 +591,19 @@ class Address } } - if ($format['requireGeocoding'] || $this->changed == 1) { + $this->formatPostalAddress(); + if ($this->changed == 1) { $gmapsGeocoder = new GMapsGeocoder(); $gmapsGeocoder->getGeocodedAddress($this); - $this->changed = 0; - $this->error = !empty($this->geocodedText); - } - if ($format['stripGeocoding'] || ($this->type == self::LINK_COMPANY && $this->error) || $this->geocodeChosen === '0') { - if ($this->geocodeChosen === '0') { - $mailer = new PlMailer('profile/geocoding.mail.tpl'); - $mailer->assign('text', $this->text); - $mailer->assign('geoloc', $this->geocodedText); - $mailer->send(); - } - $gmapsGeocoder = new GMapsGeocoder(); - $gmapsGeocoder->stripGeocodingFromAddress($this); + } + foreach (array('administrativeArea', 'subAdministrativeArea', 'locality') as $area) { + Geocoder::getAreaId($this, $area); } if ($this->countryId == '') { $this->countryId = null; } - $this->geocodeChosen = null; - if ($format['postalText']) { - $this->formatPostalAddress(); - } - return !$this->error; + + return true; } public function toFormArray() @@ -655,10 +633,6 @@ class Address 'changed' => $this->changed, 'removed' => $this->removed, ); - if (!is_null($this->geocodedText)) { - $address['geocodedText'] = $this->geocodedText; - $address['geocodeChosen'] = $this->geocodeChosen; - } if ($this->type == self::LINK_PROFILE || $this->type == self::LINK_JOB) { $address['pub'] = $this->pub; @@ -723,14 +697,7 @@ class Address public function save() { - static $areas = array('administrativeArea', 'subAdministrativeArea', 'locality'); - - $this->format(array('postalText' => true)); if (!$this->isEmpty()) { - foreach ($areas as $area) { - Geocoder::getAreaId($this, $area); - } - XDB::execute('INSERT IGNORE INTO profile_addresses (pid, jobid, groupid, type, id, flags, accuracy, text, postalText, postalCode, localityId, subAdministrativeAreaId, administrativeAreaId, diff --git a/htdocs/javascript/profile.js b/htdocs/javascript/profile.js index d4899ec..0219aeb 100644 --- a/htdocs/javascript/profile.js +++ b/htdocs/javascript/profile.js @@ -333,20 +333,6 @@ function addressChanged(prefid) $('#' + prefid + '_cont').find('[name*=changed]').val("1"); } -function validGeoloc(prefid, id, geoloc) -{ - if (geoloc == 1) { - $('#' + prefid + '_cont').find('[name*=text]').val($('#' + prefid + '_cont').find('[name*=geocodedText]').val()); - $('#' + prefid + '_cont').find('[name*=postalText]').val(''); - } - if (geoloc > 0) { - $('#' + prefid + '_cont').find("[name*='[geocodedText]']").remove(); - } - $('#' + prefid + '_cont').find('[name*=text]').removeClass('error'); - $('#' + prefid + '_cont').find('[name*=geocodeChosen]').val(geoloc); - $('.' + prefid + '_geoloc').remove(); -} - // {{{1 Phones function addTel(prefid, prefname, subField, mainField, mainId) diff --git a/templates/geoloc/form.address.tpl b/templates/geoloc/form.address.tpl index 27c51b4..0fb4845 100644 --- a/templates/geoloc/form.address.tpl +++ b/templates/geoloc/form.address.tpl @@ -20,33 +20,7 @@ {* *} {**************************************************************************} -{if t($address.geocodedText)} -
- Le géocodage n'a pas donné un résultat certain ! Tu as le choix entre : -
- -{/if} - -
- -{if t($address.geocodedText)} - -{/if} -
-{if !$isMe}
Adress postale :
{$address.postalText|nl2br}
{/if} -{if t($address.geocodedText)} - - -{/if} +