? mapstraction.js
Index: mapstraction.drupal.js
===================================================================
RCS file: /cvs/drupal/contributions/modules/mapstraction/mapstraction.drupal.js,v
retrieving revision 1.1.2.9
diff -u -p -r1.1.2.9 mapstraction.drupal.js
--- mapstraction.drupal.js	30 Jun 2009 14:44:51 -0000	1.1.2.9
+++ mapstraction.drupal.js	8 Jul 2009 08:42:20 -0000
@@ -10,7 +10,7 @@ Drupal.behaviors.mapstraction = function
 
     // Set up markers and info bubbles.
     $(this.markers).each(function(index) {
-      var markerPoint = new LatLonPoint(Number(this.lat), Number(this.lon));
+      var markerPoint = new LatLonPoint(Number(this.latitude), Number(this.longitude));
       marker = new Marker(markerPoint);
       marker.setInfoBubble(this.title);
       marker.setIcon(this.icon);
Index: mapstraction_style_map.inc
===================================================================
RCS file: /cvs/drupal/contributions/modules/mapstraction/mapstraction_style_map.inc,v
retrieving revision 1.1.2.13
diff -u -p -r1.1.2.13 mapstraction_style_map.inc
--- mapstraction_style_map.inc	11 Jun 2009 12:40:00 -0000	1.1.2.13
+++ mapstraction_style_map.inc	8 Jul 2009 08:42:20 -0000
@@ -21,7 +21,7 @@ class mapstraction_style_map extends vie
     $options['behaviours'] = array();
     return $options;
   }
-  
+
   function options_form(&$form, &$form_state) {
     $form['api'] = array(
       '#type' => 'select',
@@ -30,14 +30,14 @@ class mapstraction_style_map extends vie
       '#options' => mapstraction_apis(),
       '#default_value' => $this->options['api'],
     );
-    
+
     foreach (mapstraction_apis(TRUE) as $key => $api) {
       module_load_include('inc', 'mapstraction', 'mapstraction.apis');
       if (function_exists($api['settings form'])) {
         $form['api_settings'][$key] = $api['settings form']($this->options['api_settings'][$key], $key);
       }
     }
-    
+
     $form['dimensions'] = array(
       '#type' => 'textfield',
       '#title' => t('Dimensions'),
@@ -45,7 +45,7 @@ class mapstraction_style_map extends vie
       '#maxlength' => 255,
       '#default_value' => $this->options['dimensions'],
     );
-    
+
     $form['initial_point'] = array(
       '#type' => 'fieldset',
       '#tree' => TRUE,
@@ -115,7 +115,7 @@ class mapstraction_style_map extends vie
         'map_type' => t('Map type')),
       '#default_value' => $this->options['controls'],
     );
-    
+
     $form['zoom_control'] = array(
       '#type' => 'select',
       '#title' => t('Zoom Control'),
@@ -126,7 +126,7 @@ class mapstraction_style_map extends vie
       ),
       '#default_value' => $this->options['controls']['zoom'],
     );
-    
+
     $handlers = $this->display->handler->get_handlers('field');
     if (empty($handlers)) {
       $form['error_markup'] = array(
@@ -136,66 +136,87 @@ class mapstraction_style_map extends vie
       );
     }
     else {
-      $field_names[$field] = array('' => '--');
+      $fields[$field] = array('' => t('<none>'));
       foreach ($handlers as $field => $handler) {
         if ($label = $handler->label()) {
-          $field_names[$field] = $label;
+          $fields[$field] = $label;
         }
         else {
-          $field_names[$field] = $handler->ui_name();
+          $fields[$field] = $handler->ui_name();
         }
       }
-      $field_options = array(
-        'title' => t('Title'),
-        'latitude' => t('Latitude'),
-        'longitude' => t('Longitude'),
-        'class' => t('Class'),
-        'icon' => t('Icon URL'),
-      );
       $form['fields'] = array(
         '#type' => 'fieldset',
-        '#title' => 'Field usage',
-        '#description' => t('Select the fields that contain the latitude,
-                            longitude and title of each point. If selected, the
-                            class field will be used to apply a class to each 
-                            point. Remaining fields will be available in the 
-                            hidden "content" region of the point.'),
-      );
-      foreach ($field_options as $k => $v) {
-        $form['fields'][$k] = array(
-          '#type' => 'select',
-          '#title' => $v,
-          '#options' => $field_names,
-          '#default_value' => $this->options['fields'][$k],
-          '#required' => ($k == 'class' ? FALSE : TRUE),
-        );
-      }
+        '#title' => t('Field mapping'),
+      );
+
+      $form['fields']['title'] = array(
+        '#type' => 'select',
+        '#title' => t('Title'),
+        '#description' => t('Select a field wich will be shown as the info bubble for each marker. If no field is selected, there will be no info bubble.'),
+        '#options' => $fields,
+        '#default_value' => $this->options['fields']['title'],
+      );
+
+      $form['fields']['latitude'] = array(
+        '#type' => 'select',
+        '#title' => t('Latitude'),
+        '#description' => t('Select a field that decides the latitude for each marker.'),
+        '#options' => $fields,
+        '#default_value' => $this->options['fields']['latitude'],
+        '#required' => TRUE,
+      );
+
+      $form['fields']['longitude'] = array(
+        '#type' => 'select',
+        '#title' => t('Longitude'),
+        '#description' => t('Select a field that decides the longitude for each marker.'),
+        '#options' => $fields,
+        '#default_value' => $this->options['fields']['longitude'],
+        '#required' => TRUE,
+      );
+
+      $form['fields']['class'] = array(
+        '#type' => 'select',
+        '#title' => t('Class'),
+        '#description' => t('Select a field that will be put as a class name for each marker.'),
+        '#options' => $fields,
+        '#default_value' => $this->options['fields']['class'],
+      );
+
+      $form['fields']['icon'] = array(
+        '#type' => 'select',
+        '#title' => t('Icon URL'),
+        '#description' => t('Select a field that holds the URL to which icon each marker will use. If no field is selected, a default icon will be used.'),
+        '#options' => $fields,
+        '#default_value' => $this->options['fields']['icon'],
+      );
     }
   }
-  
+
   function options_submit($form, &$form_state) {
     $form_state['values']['style_options']['controls']['zoom'] = $form_state['values']['style_options']['zoom_control'];
     unset($form_state['values']['style_options']['zoom_control']);
   }
-  
+
   function validate() {
     $errors = array();
-    
+
     // Validate the field style for location.module's lat/lon fields. They
     // must be set to decimal degress.
     $fields = $this->display->handler->get_handlers('field');
     $field_array = array($fields[$this->options['fields']['latitude']],
     $fields[$this->options['fields']['longitude']]);
-    
+
     foreach ($field_array as $field) {
       if ($field->options['table'] == 'location' && $field->options['style'] != 'dd') {
         $errors[] = t('The display style for @field must be set to decimal degrees.', array('@field' => $field->options['label']));
       }
     }
-    
+
     return $errors;
   }
-  
+
   function render() {
     if ($this->view->preview == TRUE) {
       return '<div class="messages error">Preview is disabled for the Mapstraction style plugin.</div>';
@@ -231,33 +252,40 @@ class mapstraction_style_map extends vie
       return $output;
     }
   }
-  
+
   function map_points($rows) {
     $points = array();
     foreach ($rows as $id => $row) {
       $point = array('href' => 'node/'. $row->nid, 'nid' => $row->nid);
       foreach ($this->view->field as $key => $field) {
-        if ($key == $this->options['fields']['title']) {
-          $point['title'] = $field->theme($row);
-        }
-        elseif ($key == $this->options['fields']['latitude']) {
-          $point['lat'] = $field->theme($row);
-        }
-        elseif ($key == $this->options['fields']['longitude']) {
-          $point['lon'] = $field->theme($row);
-        }
-        elseif ($key == $this->options['fields']['class']) {
-          $point['attributes']['class'] = $this->map_point_class($field->theme($row));
-        }
-        elseif ($key == $this->options['fields']['icon']) {
-          $point['icon'] = $field->theme($row);
-        }
-        else {
-          $point['content'] .= $field->theme($row);
+        switch ($key) {
+          case $this->options['fields']['title']:
+            $point['title'] = $field->theme($row);
+            break;
+
+          case $this->options['fields']['latitude']:
+            $point['latitude'] = $field->theme($row);
+            break;
+
+          case $this->options['fields']['longitude']:
+            $point['longitude'] = $field->theme($row);
+            break;
+
+          case $this->options['fields']['class']:
+            $point['class'] = $field->theme($row);
+            break;
+
+          case $this->options['fields']['icon']:
+            $point['icon'] = $field->theme($row);
+            break;
+
+          default:
+            $point['content'] = $field->theme($row);
+            break;
         }
       }
       $points[] = $point;
     }
     return $points;
   }
-}
\ No newline at end of file
+}
