Index: contrib/location_cck/location_cck.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/location/contrib/location_cck/location_cck.info,v
retrieving revision 1.3.2.1
diff -u -p -r1.3.2.1 location_cck.info
--- contrib/location_cck/location_cck.info	6 Jan 2009 19:33:31 -0000	1.3.2.1
+++ contrib/location_cck/location_cck.info	27 Aug 2010 05:43:29 -0000
@@ -5,3 +5,10 @@ core = 6.x
 package = CCK
 dependencies[] = location
 dependencies[] = content
+
+; Information added by drupal.org packaging script on 2010-07-06
+version = "6.x-3.1"
+core = "6.x"
+project = "location"
+datestamp = "1278427508"
+
Index: contrib/location_cck/location_cck.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/location/contrib/location_cck/location_cck.module,v
retrieving revision 1.5.2.19
diff -u -p -r1.5.2.19 location_cck.module
--- contrib/location_cck/location_cck.module	25 Mar 2010 07:00:07 -0000	1.5.2.19
+++ contrib/location_cck/location_cck.module	27 Aug 2010 05:43:30 -0000
@@ -483,3 +483,177 @@ function location_cck_locationapi(&$obj,
       }
   }
 }
+
+/**
+ * Implementation of hook_profile_csv_export();
+ */
+function location_cck_profile_csv_export(&$value, $field, $node) {
+  // We only deal with 'location' fields.
+  $field_name = str_replace('location_', '', $field['type']);
+  switch ($field['type']) {
+    case 'location':
+      $field = content_fields($field['name'], $node->type);
+      $output = array();
+      foreach ($value as $x => $location) {
+        $parts = array();
+        foreach ($field['location_settings']['display']['hide'] as $loc_field => $loc_val) {
+          if ($loc_field == $loc_val && !empty($location[$loc_field])) {
+            switch ($loc_field) {
+              case 'country_name':
+              case 'province_name':
+                // Skip these ones.
+                break;
+              case 'country':
+                $parts[$field['location_settings']['form']['fields'][$loc_field]['weight']] = location_country_name($location[$loc_field]);
+                break;
+              case 'province':
+                $parts[$field['location_settings']['form']['fields'][$loc_field]['weight']] = location_province_name($location['country'], $location[$loc_field]);
+                break;
+              default:
+                $parts[$field['location_settings']['form']['fields'][$loc_field]['weight']] = $location[$loc_field];
+            }
+          }
+        }
+        // Join all of the address pieces together.
+        $output[] = implode(', ', $parts);
+      }
+      // Override the output value. 
+      $value = implode("\n", $output);
+      // Tell the calling function to use this value.
+      return TRUE;
+      break;
+
+    // The rest of these values are assumed to be singular.
+
+    // These fields are passed over as-is.
+    case 'location_name':
+    case 'location_additional':
+    case 'location_city':
+    case 'location_postal_code':
+      if (!empty($value[0][$field_name])) {
+        $value = $value[0][$field_name];
+      }
+      else {
+        $value = '';
+      }
+      return TRUE;
+      break;
+    case 'location_province_code':
+      $value = strtoupper($value[0][$field_name]);
+      return TRUE;
+      break;
+    case 'location_province_name':
+      $value = $value[0][$field_name];
+      return TRUE;
+      break;
+    case 'location_country_code':
+      $value = strtoupper($value[0]['country']);
+      return TRUE;
+      break;
+    case 'location_country_name':
+      $value = location_country_name($value[0][$field_name]);
+      return TRUE;
+      break;
+    case 'location_latitude':
+    case 'location_longitude':
+      if (floatval($value[0][$field_name]) > 0) {
+        $value = $value[0][$field_name];
+        return TRUE;
+        break;
+      }
+    case 'location_coords':
+      if (floatval($value[0]['longitude']) > 0 && floatval($value[0]['latitude']) > 0) {
+        $value = $value[0]['longitude'] . ':' . $value[0]['latitude'];
+      }
+      else {
+        $value = '';
+      }
+      return TRUE;
+      break;
+  }
+}
+
+/**
+ * Implementation of hook_profile_csv_fields();
+ */
+function location_cck_profile_csv_fields(&$fields) {
+  foreach ($fields as $x => $field) {
+    if ($field['type'] == 'location') {
+      $field_settings = content_fields($field['name'], $field['node_type']);
+      $new_fields = _location_cck_profile_csv_new_fields();
+      foreach ($new_fields as $new_field => $new_label) {
+        $new = $field;
+        $new['base'] = $new['name'];
+        $new['name'] .= '_' . $new_field;
+        $new['type'] .= '_' . $new_field;
+        $new['title'] .= ': ' . $new_label;
+        $fields[] = $new;
+      }
+    }
+  }
+}
+
+/**
+ * Implementation of hook_form_alter().
+ */
+function location_cck_form_alter(&$form, $form_state, $form_id) {
+  // Add extra fields to the Profile_CSV form.
+  if ($form_id == 'profile_csv_admin_settings') {
+    $new_fields = _location_cck_profile_csv_new_fields();
+    $types = _profile_csv_get_content_profile_types();
+    foreach ($types as $type_name => $type) {
+      $fieldset = 'profile_csv_param_content_profile_' . $type_name;
+      foreach ($form['content_profile'][$fieldset] as $field_name => $field) {
+        // Split up location fields.
+        if (is_array($field) && isset($field['#type'])) {
+          if ($field['#type'] == 'fieldset') {
+            foreach ($field as $inner_name => $inner_field) {
+              if (is_array($inner_field) && strpos($inner_field['#title'], '(location)')) {
+                foreach ($new_fields as $new_field => $new_label) {
+                  $fld = $inner_name . '_' . $new_field;
+                  $form['content_profile'][$fieldset][$field_name][$fld] = array(
+                    '#type' => 'checkbox',
+                    '#title' => str_replace(' (location)', '', $inner_field['#title']) . ': ' . $new_label,
+                    '#return_value' => 1,
+                    '#default_value' => variable_get($fld, FALSE),
+                  );
+                }
+              }
+            }
+          }
+          if (strpos($field['#title'], '(location)')) {
+            foreach ($new_fields as $new_field => $new_label) {
+              $fld = $field_name . '_' . $new_field;
+              $form['content_profile'][$fieldset][$fld] = array(
+                '#type' => 'checkbox',
+                '#title' => str_replace(' (location)', '', $field['#title']) . ': ' . $new_label,
+                '#return_value' => 1,
+                '#default_value' => variable_get($fld, FALSE),
+              );
+            }
+          }
+        }
+      }
+    }
+  }
+}
+
+/**
+ * 
+ */
+function _location_cck_profile_csv_new_fields() {
+  return array(
+    'name' => t('Name'),
+    'street' => t('Street'),
+    'additional' => t('Additional'),
+    'city' => t('City'),
+    'province_code' => t('Province Code'),
+    'province_name' => t('Province Name'),
+    'postal_code' => t('Postal Code'),
+    'country_code' => t('Country Code'),
+    'country_name' => t('Country Name'),
+    'coords' => t("Coordinates"),
+    'latitude' => t("Latitude"),
+    'longitude' => t("Longitude"),
+  );
+}
\ No newline at end of file
