? location_name.patch
Index: location.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/location/location.inc,v
retrieving revision 1.2
diff -u -r1.2 location.inc
--- location.inc	23 Mar 2005 06:18:28 -0000	1.2
+++ location.inc	28 Mar 2005 19:35:48 -0000
@@ -69,6 +69,10 @@
   elseif (count($location)) {
     $output .= "\n";
     $output .= '<dl class="location">'."\n";
+    if (isset($location['name'])) {
+      $output .= '<dd>'. $location['name'] .'</dd>';
+    }
+    
     if (isset($location['street'])) {
       $output .= '<dd>'. $location['street'] .'</dd>';
     }
@@ -248,6 +252,13 @@
 function location_form($fields = array(), $prefilled_values = array(), $required_fields = array(), $description = '', $form_name = 'location', $function = NULL) {
   $form = $description;
   if (count($fields)) {
+    if (in_array('name', $fields)) {
+      $form .= '<div class="container-inline">';
+      $form .= form_textfield('Location Name', $form_name .'][name', isset($prefilled_values['name']) ? $prefilled_values['name'] : '', 64, 64, t('e.g. a place of business, venue, meeting point'), NULL, in_array('name', $required_fields));
+      $form .= "</div>\n";
+    }
+    
+    
     if (in_array('street', $fields)) {
       $form .= '<div class="container-inline">';
       $form .= form_textfield('Street', $form_name .'][street', isset($prefilled_values['street']) ? $prefilled_values['street'] : '', 64, 64, NULL, NULL, in_array('street', $required_fields));
@@ -286,6 +297,9 @@
   }
   else {
     $form .= '<div class="container-inline">';
+    $form .= form_textfield('Location Name', $form_name .'][name', isset($prefilled_values['name']) ? $prefilled_values['name'] : '', 64, 64, t('e.g. a place of business, venue, meeting point'), NULL, in_array('name', $required_fields));
+    $form .= "</div>\n";
+    $form .= '<div class="container-inline">';
     $form .= form_textfield('Street', $form_name .'][street', isset($prefilled_values['street']) ? $prefilled_values['street'] : '', 64, 64, NULL, NULL, in_array('street', $required_fields));
     $form .= "</div>\n";
     $form .= '<div class="container-inline">';
Index: location.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/location/location.module,v
retrieving revision 1.4
diff -u -r1.4 location.module
--- location.module	26 Mar 2005 01:35:44 -0000	1.4
+++ location.module	28 Mar 2005 19:35:50 -0000
@@ -153,7 +153,7 @@
     // Set the default workflow setting for all location fields for an 'event' node: 1... optional
     // This will only be used if the user hasn't gone into the default workflow page for events and changed it to something else
     // for each field.
-    $field_names = array('street' => 'Street location', 'city' => 'City', 'province' => 'State/Province', 'postal_code' => 'Postal code', 'country' => 'Country');
+    $field_names = array('name' => 'Location name', 'street' => 'Street location', 'city' => 'City', 'province' => 'State/Province', 'postal_code' => 'Postal code', 'country' => 'Country');
     $variable_prefix = 'location_';
     $variable_suffix = '_'. $node->type;
     $enabled = FALSE;
@@ -174,13 +174,15 @@
       // For the variable_get() params here, all the parameters of the form 'location_fieldname_' . $node->type can be condensed into a foreach
       // loop involving $field_names (set above).
       // But that would make it hard to read.
-      $form = form_radios(t('Street locationes'), 'location_street_'. $node->type, variable_get('location_street_'. $node->type, 0), array(t('Do not collect a street location for content of this type.'), t('Allow street locationes to be submitted for content of this type.'), t('Require street locationes to be submitted for content of this type.')));
+       $form = form_radios(t('Location names'), 'location_name_'. $node->type, variable_get('location_name_'. $node->type, $default), array(t('Do not collect location names (e.g. place of business) for this node type.'), t('Allow location names for content of this type.'), t('Require location names for content of this type.')));
+      $form .= form_radios(t('Street locations'), 'location_street_'. $node->type, variable_get('location_street_'. $node->type, $default), array(t('Do not collect a street location for content of this type.'), t('Allow street locations to be submitted for content of this type.'), t('Require street locations to be submitted for content of this type.')));
       $form .= form_radios(t('City names'), 'location_city_'. $node->type, variable_get('location_city_'. $node->type, 0), array(t('Do not collect city names for content of this type.'), t('Allow city names to be submitted for content of this type.'), t('Require city names to be submitted for content of this type.')));
       $form .=  form_radios('State/Province names', 'location_province_'. $node->type, variable_get('location_province_'. $node->type, 0), array(t('Do not collect state/province names for content of this type.'), t('Allow state/province names to be submitted for content of this type.'), t('Require state/province names to be submitted for content of this type.')));
       $form .= form_radios('Postal codes', 'location_postal_code_'. $node->type, variable_get('location_postal_code_'. $node->type, 0), array(t('Do not collect postal codes for content of this type.'), t('Allow postal codes to be submitted for content of this type.'), t('Require postal codes to be submitted for content of this type.')));
       $form .= form_radios('Country names', 'location_country_'. $node->type, variable_get('location_country_'. $node->type, 0), array(t('Do not collect country names for content of this type.'), t('Allow country names to be submitted for content of this type.'), t('Require country names to be submitted for content of this type.')));
       $form = form_group(t('Locative information'), $form);
       return array(t('Locations') => $form);
+    
     case 'form post':
       $location_fields = array();
       $required_fields = array();
@@ -192,8 +194,7 @@
             $required_fields[] = $field_name;
           }
         }
-      }
-    
+      }    
       if ($_POST['op'] == t('Preview') || ($_POST['op'] == t('Submit') && form_get_errors())) {
         return location_form($location_fields, $node->location ? $node->location : array(), $required_fields);
       }
@@ -230,8 +231,9 @@
       }
       
       if (isset($posted_location['lat']) && isset($posted_location['lon'])) {
-         db_query("REPLACE INTO {location_node} (nid, street, additional, city, province, postal_code, country, latitude, longitude) VALUES (%d, '%s', '%s', '%s', '%s', '%s', '%s', '%f', '%f')", 
+         db_query("REPLACE INTO {location_node} (nid, name, street, additional, city, province, postal_code, country, latitude, longitude) VALUES (%d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%f', '%f')", 
                 $node->nid, 
+                (!isset($posted_location['name']) || is_null($posted_location['name'])) ? '' : $posted_location['name'],
                 (!isset($posted_location['street']) || is_null($posted_location['street'])) ? '' : $posted_location['street'],
                 (!isset($posted_location['additional']) || is_null($posted_location['additional'])) ? '' : $posted_location['additional'],
                 (!isset($posted_location['city']) || is_null($posted_location['city'])) ? '' : $posted_location['city'],
@@ -243,8 +245,9 @@
               );     
       }
       else {
-        db_query("REPLACE INTO {location_node} (nid, street, additional, city, province, postal_code, country) VALUES (%d, '%s', '%s', '%s', '%s', '%s', '%s')", 
+        db_query("REPLACE INTO {location_node} (nid, name, street, additional, city, province, postal_code, country) VALUES (%d, '%s', '%s', '%s', '%s', '%s', '%s', '%s')", 
                 $node->nid, 
+                (!isset($posted_location['name']) || is_null($posted_location['name'])) ? '' : $posted_location['name'],
                 (!isset($posted_location['street']) || is_null($posted_location['street'])) ? '' : $posted_location['street'],
                 (!isset($posted_location['additional']) || is_null($posted_location['additional'])) ? '' : $posted_location['additional'],
                 (!isset($posted_location['city']) || is_null($posted_location['city'])) ? '' : $posted_location['city'],
@@ -266,7 +269,7 @@
       }
 
       if (count($location)) {
-        foreach (array('street', 'city', 'postal_code', 'province', 'country') as $field_name) {
+        foreach (array('name', 'street', 'city', 'postal_code', 'province', 'country') as $field_name) {
           if (!(variable_get($variable_prefix . $field_name . $variable_suffix, 0))) {
             unset($location[$field_name]);
           }
Index: location.mysql
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/location/location.mysql,v
retrieving revision 1.1
diff -u -r1.1 location.mysql
--- location.mysql	17 Mar 2005 05:31:34 -0000	1.1
+++ location.mysql	28 Mar 2005 19:35:50 -0000
@@ -1,5 +1,6 @@
 CREATE TABLE location_node (
   nid int(10) unsigned NOT NULL default '0',
+  name varchar(255) default NULL,
   street varchar(255) default NULL,
   additional varchar(255) default NULL,
   city varchar(255) default NULL,
