? geo-hook_uninstall-174257-1.patch
? geo-install-file-typo-168864.patch
? geo_two_points.patch
Index: geo_cck.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/geo/geo_cck.inc,v
retrieving revision 1.8
diff -u -p -r1.8 geo_cck.inc
--- geo_cck.inc	28 Jul 2007 00:04:33 -0000	1.8
+++ geo_cck.inc	1 Nov 2007 21:05:18 -0000
@@ -154,8 +154,11 @@ function geo_widget_info() {
   return array(
     'wkt' => array(
       'label' => t('Direct Text Entry'),
-      'field types' => array_keys(geo_field_info()), // easy way to get all fields
-    ),
+      'field types' => array_keys(geo_field_info())), // easy way to get all fields
+    'two_points' => array(
+      'label' => t('Two Textbox Points'),
+      'field types' => array('point'),
+    )
   );
 }
 
@@ -193,19 +196,48 @@ function geo_widget($op, &$node, $field,
       $fn = $field['field_name'];
       
       $form[$fn] = array('#tree' => TRUE);
-      // for now, we just have one item
-      $form[$fn][0]['wkt'] = array(
-        '#type' => 'textfield',
-        '#title' => t($field['widget']['label']),
-        '#default_value' => $items[0]['wkt'],
-        '#required' => $field['required'],
-        '#description' => $field['widget']['description'],
-      );
-      
+      switch ($field['widget']['type']) {
+        case 'two_points':
+          $data = _geo_parse_point($items[0]['wkt']);
+          $form[$fn][0]['two_points']['lat'] = array(
+            '#type' => 'textfield',
+            '#title' => t('Latitude'),
+            '#default_value' => $data['lat'],
+            '#required' => $field['required'],
+            '#size' => 15,
+            '#maxlength' => 15,
+          );
+          $form[$fn][0]['two_points']['lon'] = array(
+            '#type' => 'textfield',
+            '#title' => t('Longitude'),
+            '#default_value' => $data['lon'],
+            '#required' => $field['required'],
+            '#size' => 15,
+            '#maxlength' => 15,
+          );
+          break;
+        case 'wkt':
+        default:
+          // for now, we just have one item
+          $form[$fn][0]['wkt'] = array(
+            '#type' => 'textfield',
+            '#title' => t($field['widget']['label']),
+            '#default_value' => $items[0]['wkt'],
+            '#required' => $field['required'],
+            '#description' => $field['widget']['description'],
+          );
+          break;
+      }
+
       return $form;
 
     case 'process form values':
-
+      foreach($items as $delta => $values) {
+        if (isset($values['two_points']) && strlen($values['two_points']['lat'])) {
+          $items[$delta]['wkt'] = 'POINT('. $items[0]['two_points']['lat'] .' '. $items[0]['two_points']['lon'] .')';
+          unset($items[$delta]['two_points']);
+        }
+      }
       break;
   }
 }
@@ -236,3 +268,15 @@ EOF;
   $title = 'content_'. $table_name .'_'. $field_name;
   db_query($sql, $field_name, $title, $table_name, $field_name, $type, $type, $srid);
 }
+
+/**
+ * Given a POINT as a string, return an array of lat/lon
+ */
+function _geo_parse_point($point) {
+  $point = str_replace('POINT(','',$point);
+  $point = str_replace(')','',$point);
+  $point_array = explode(' ', $point);
+  $return['lat'] = $point_array[0];
+  $return['lon'] = $point_array[1];
+  return $return;
+}
\ No newline at end of file
