Index: supported/location.fi.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/location/supported/location.fi.inc,v
retrieving revision 1.6
diff -u -p -r1.6 location.fi.inc
--- supported/location.fi.inc	24 Jan 2008 09:00:02 -0000	1.6
+++ supported/location.fi.inc	27 Feb 2009 18:10:36 -0000
@@ -3,11 +3,127 @@
 
 // Finland
 
+/**
+ * Returns an associative array of states/territories where
+ *   -> the keys are integers starting from 1
+ *   -> the values are the English names for those states/territories
+ *
+ * Please note that providences are not usually used in Finnish locations
+ *
+ */
 function location_province_list_fi() {
-  return array('ES' => "Etela-Suomen laani",
-    'LS' => "Lansi-Suomen laani",
-    'IS' => "Ita-Suomen laani",
-    'OU' => "Oulun laani",
-    'LL' => "Lapin laani",
-    'AH' => "Ahvenanmaan laani");
+  return array('ES' => "Etelä-Suomen lääni",
+    'LS' => "Länsi-Suomen lääni",
+    'IS' => "Itä-Suomen lääni",
+    'OU' => "Oulun lääni",
+    'LL' => "Lapin lääni",
+    'AH' => "Ahvenanmaan lääni");
+}
+
+/**
+ * Returns a lat/lon pair of the approximate center of the given postal code in the given country
+ *
+ * @param $location
+ *   An associative array $location where
+ *     'street'       => the street portion of the location
+ *     'supplemental' => additional street portion of the location
+ *     'province'     => the province, state, or territory
+ *     'country'      => lower-cased two-letter ISO code (REQUIRED)
+ *     'postal_code'  => the international postal code for this location (REQUIRED)
+ *
+ * @return
+ *   An associative array where
+ *      'lat' => approximate latitude of the center of the postal code's area
+ *      'lon' => approximate longitude of the center of the postal code's area
+ *
+ */
+function location_latlon_rough_fi($location = array()) {
+  if (!isset($location['postal_code'])) {
+    return NULL;
+  }
+
+  $result = db_query("SELECT latitude, longitude FROM {zipcodes} WHERE country = '%s' AND zip = '%s'", $location['country'], $location['postal_code']);
+
+  if ($row = db_fetch_object($result)) {
+    return array('lat' => $row->latitude, 'lon' => $row->longitude);
+  }
+  else {
+    return NULL;
+  }
+}
+
+/**
+ * Returns a lat/lon pair of the approximate center of the given postal code in the given country
+ *
+ * @param $location
+ *   An associative array $location where only postal code and country are necessary, but can have the keys:
+ *     'street'       => the street portion of the location
+ *     'supplemental' => additional street portion of the location
+ *     'province'     => the province, state, or territory
+ *     'country'      => lower-cased two-letter ISO code (REQUIRED)
+ *     'postal_code'  => the international postal code for this location (REQUIRED)
+ *
+ * @return
+ *   An associative array where
+ *      'lat' => approximate latitude of the center of the postal code's area
+ *      'lon' => approximate longitude of the center of the postal code's area
+ *
+ */
+function location_get_postalcode_data_fi($location = array()) {
+  // Now we pad the thing and query.
+  $res = db_query("SELECT * FROM {zipcodes} where country = '%s' AND zip = '%s'", $location['country'], $location['postal_code']);
+  if ($row = db_fetch_object($res)) {
+    return array('lat' => $row->latitude, 'lon' => $row->longitude, 'city' => $row->city, 'province' => $row->state, 'country' => $row->country);
+  }
+  else {
+    return NULL;
+  }
+}
+
+function location_map_link_fi_google($location = array()) {
+  $query_params = array();
+
+  foreach (array('street', 'city', 'province', 'postal_code', 'country') as $field) {
+    if (isset($location[$field])) {
+      $query_params[] = $location[$field];
+    }
+  }
+
+  if (count($query_params)) {
+    return ('http://maps.google.fi?q='. urlencode(implode(", ", $query_params)));
+  }
+  else {
+    return NULL;
+  }
+}
+
+
+/**
+ * @return
+ *   An array where
+ *     -> the key is the word that helps identify the name of function that builds the link.  For example, a key of 'yahoo' means the name of the
+ *        the function that builds a link to a map on Yahoo! Maps would be 'location_map_link_us_yahoo'
+ *     -> the value is itself an array with 3 key/value pairs:
+ *          'name' => points to the name of the mapping service.  For 'yahoo', this would be 'Yahoo! Maps'
+ *          'url' => the url of the main page of the mapping service.  For 'yahoo', this would be 'http://maps.yahoo.com'
+ *          'tos' => the url of the page that explains the map providers Terms of Service, or Terms of Use. For 'yahoo', this would be
+ *                   'http://help.yahoo.com/help/us/maps/maps-24.html'
+ */
+function location_map_link_fi_providers() {
+  return array('google' => array('name' => 'Google Maps', 'url' => 'http://maps.google.com', 'tos' => 'http://www.google.com/help/terms_local.html'));
+}
+
+/**
+ * @return
+ *   An array of values that work as keys to the array returned by location_map_link_us_providers.  The idea is that if the
+ *   administrator of the site has not yet had a chance to visit the "Map Links" subtab on the location module's settings page,
+ *   that we can provide deep-linking to a relatively safe default.  By 'relatively safe', we mean that the Terms Of Service of
+ *   the provider of the maps are flexible enough for most parties.
+ *
+ *   For the case of the U.S., 'google' has relatively flexible Terms Of Service, whereas Yahoo! Maps and MapQuest have more
+ *   restrictive Terms Of Service.
+ *
+ */
+function location_map_link_fi_default_providers() {
+  return array('google');
 }
