### Eclipse Workspace Patch 1.0
#P location_cvs
Index: location.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/location/location.module,v
retrieving revision 1.70
diff -u -r1.70 location.module
--- location.module 20 Oct 2006 21:44:00 -0000 1.70
+++ location.module 17 Nov 2006 22:26:11 -0000
@@ -21,15 +21,16 @@
function location_menu($may_cache = FALSE) {
$items = array();
if ($may_cache) {
- //$items[] = array('path' => 'search/location', 'title' => t('by location'), 'callback' => 'location_search_form_page', 'access' => user_access('search content'), 'type' => MENU_LOCAL_TASK, 'weight' => 9);
- $items[] = array('path' => 'search/location', 'title' => t('by location'), 'callback' => 'location_search_view', 'access' => user_access('search content'), 'type' => MENU_LOCAL_TASK, 'weight' => 9);
- $items[] = array('path' => 'admin/settings/location', 'title' => t('location'), 'callback' => 'location_configure');
- $items[] = array('path' => 'admin/settings/location/main', 'title' => t('main settings'), 'type' => MENU_DEFAULT_LOCAL_TASK);
- $items[] = array('path' => 'admin/settings/location/maplinking', 'title' => t('map links'), 'callback' => 'location_map_link_options_page', 'access' => user_access('administer site configuration'), 'type' => MENU_LOCAL_TASK, 'weight' => 1);
- $items[] = array('path' => 'admin/settings/location/geocoding', 'title' => t('geocoding options'), 'callback' => 'location_geocoding_options_page', 'access' => user_access('administer site configuration'), 'type' => MENU_LOCAL_TASK, 'weight' => 2);
+ //$items[] = array('path' => 'search/location', 'title' => dr'by location'), 'callback' => 'location_search_form_page', 'access' => user_access('search content'), 'type' => MENU_LOCAL_TASK, 'weight' => 9,);
+ $items[] = array('path' => 'search/location', 'title' => t('By location'), 'callback' => 'location_search_view', 'access' => user_access('search content'), 'type' => MENU_LOCAL_TASK, 'weight' => 9,);
+ $items[] = array('path' => 'admin/settings/location', 'title' => t('Location'), 'callback' => 'location_configure',);
+ $items[] = array('path' => 'admin/settings/location/main', 'title' => t('Main settings'), 'type' => MENU_DEFAULT_LOCAL_TASK,);
+ $items[] = array('path' => 'admin/settings/location/maplinking', 'title' => t('Map links'), 'callback' => 'location_map_link_options_page', 'access' => user_access('administer site configuration'), 'type' => MENU_LOCAL_TASK, 'weight' => 1,);
+ $items[] = array('path' => 'admin/settings/location/geocoding', 'title' => t('Geocoding options'), 'callback' => 'location_geocoding_options_page', 'access' => user_access('administer site configuration'), 'type' => MENU_LOCAL_TASK, 'weight' => 2,);
+ $items[] = array('path' => 'admin/settings/location', 'title' => t('Location'), 'description' => t('Settings for Location module'), 'callback' => 'drupal_get_form','callback arguments' => 'location_admin_settings','access' => user_access('administer site configuration'),'type' => MENU_NORMAL_ITEM, );
}
else {
- theme_add_style(drupal_get_path('module', 'location') .'/location.css');
+ drupal_add_css(drupal_get_path('module', 'location') .'/location.css');
}
return $items;
}
@@ -54,14 +55,12 @@
administer locative information at administer >> content types to configure a type and see the locative information.
administer location at administer >> settings >> location.
use a database dump for a U.S. postal codes table that can be found at zipcode database.
-', array('%admin-node-configure-types' => url('admin/node/configure/types'), '%admin-settings-location' => url('admin/settings/location'), '%external-http-trac-civicspacelabs-com-cgi-bin-trac-cgi-file-trunk-database-zipcodes-mysql' => 'http://trac.civicspacelabs.com/cgi-bin/trac.cgi/file/trunk/database/zipcodes.mysql')) .'';
+', array('%admin-node-configure-types' => url('admin/content/configure/types'), '%admin-settings-location' => url('admin/settings/location'), '%external-http-trac-civicspacelabs-com-cgi-bin-trac-cgi-file-trunk-database-zipcodes-mysql' => 'http://trac.civicspacelabs.com/cgi-bin/trac.cgi/file/trunk/database/zipcodes.mysql')) .'';
$output .= ''. t('For more information please read the configuration and customization handbook Location page.', array('%location' => 'http://www.drupal.org/handbook/modules/location/')) .'
';
return $output;
- case 'admin/modules#description':
- return t('Enables the location system and allow users to attach locative information to content.');
}
}
-
+//TODO: check/fix this: admin/content/configure/types
function location_search_get_form($edit = array()) {
$location_form = location_form(array('postal_code', 'country'), $edit, array('postal_code', 'country'), variable_get('location_suppress_country', 0) ? array('country' => variable_get('location_default_country', 'us')) : array(), '', 'location', 'nearby_postalcodes_bylocation');
@@ -153,7 +152,7 @@
$results_offset = isset($_GET['from']) ? $_GET['from'] : 0;
$postal_data = location_get_postalcode_data($location);
$search_results_message = t('Displaying results %a - %b of %count for search on %c', array('%a' => $results_offset + 1, '%b' => $results_offset + $page_count, '%count' => $count->result_count, '%c' => ''. filter_xss($edit['postal_code']) .' ('. $postal_data['city'] . ', '. $postal_data['province'] .')'));
- }
+ } //TODO: filter_xss?
else {
if (isset($_POST['edit']) && !isset($_GET['from'])) {
$search_results .= theme('box', t('Your search yielded no results.'), '');
@@ -176,7 +175,7 @@
);
$extra = t('Local to ') . $result_location['postal_code'] .', ' . $result_location['city'] . ', '. $result_location['province'] .', '. $country_index[$result_location['country']] .' - '. $result_location['distance'] . ' ' . $edit['distance_unit'] .' away.';
-
+ //TODO: shouldn't this use printf style replacement like: %postal (array(%postal=>$result_location['postal_code']))
$extra = array();
$extra['location'] = t('Local to %place', array('%place' => l($result_location['city'] . ', '. $result_location['province'] .', '. $country_index[$result_location['country']], 'search/location', array(), 'postal_code='. urlencode($result_location['postal_code']) . '&country='. urlencode($result_location['country']) .'&distance='. urlencode($edit['distance']) .'&distance_unit='. urlencode($edit['distance_unit']))));
if ($result_location['postal_code'] == $edit['postal_code'] && $result_location['country'] == $edit['country']) {
@@ -189,8 +188,8 @@
else {
$distance_unit = ($edit['distance_unit'] == 'km') ? t('km') : t('mile');
}
- $extra['distance'] = t('Approximately %distance from %location', array('%distance' => ''. round($result_location['distance']) .' '. $distance_unit .'', '%location' => $edit['postal_code']));
- }
+ $extra['distance'] = t('Approximately %distance from %location', array('%distance' => round($result_location['distance']) .' '. $distance_unit, '%location' => $edit['postal_code']));
+ } //TODO: removed - because I think they are unnecessary, but maybe they are necessary...
$item = array('link' => url('node/'. $row->nid),
@@ -339,7 +338,7 @@
$providers = $provider_function();
drupal_set_title(t('Configure parameters for %service', array('%service' => $providers[$service]['name'])));
$breadcrumbs = drupal_get_breadcrumb();
- $breadcrumbs[] = l('location', 'admin/settings/locaiton');
+ $breadcrumbs[] = l('location', 'admin/settings/location');
$breadcrumbs[] = l('geocoding', 'admin/settings/location/geocoding');
$countries = location_get_iso3166_list();
$breadcrumbs[] = l($countries[$country_iso], 'admin/settings/location/geocoding', array(), NULL, $country_iso);
@@ -490,7 +489,7 @@
function location_form_alter($form_id, &$form) {
- if (isset($form['type']) && $form['type']['#value'] .'_node_settings' == $form_id) {
+ if ($form_id == 'node_type_form') {
$type = $form['type']['#value'];
$form['location'] = array(
'#type' => 'fieldset',
@@ -649,7 +648,7 @@
$workflow_setting = variable_get('location_'. $field_name .'_'. $node->type, $field_name == 'country' ? 1 : 0);
if (variable_get('location_'. $field_name .'_'. $node->type, 0) == 2) {
if (isset($node->location[$field_name]) && !strlen(trim($node->location[$field_name]))) {
- form_set_error('location]['. $field_name, t('The field %field is required.', array('%field' => theme('placeholder', $display_name))));
+ form_set_error('location]['. $field_name, t('The field %field is required.', array('%field' => $display_name)));
}
}
$node->location[$field_name] = trim($node->location[$field_name]);
@@ -671,8 +670,8 @@
if (user_access('submit latitude/longitude')) {
if ((!strlen(trim($node->location['latitude'])) && strlen(trim($node->location['longitude']))) ||
(strlen(trim($node->location['latitude'])) && !strlen(trim($node->location['longitude'])))) {
- form_set_error('location][latitude', t('You must fill out both longitude and latitude or'));
- form_set_error('location][longitude', t('you must leave them both blank.'));
+ form_set_error('location][latitude', t('You must fill out both longitude and latitude or you must leave them both blank.'));
+ form_set_error('location][longitude', NULL);
}
elseif (strlen(trim($node->location['latitude'])) && strlen(trim($node->location['longitude']))) {
if (!is_numeric($node->location['latitude']) || $node->location['latitude'] > 90.0 || $node->location['latitude'] < -90.0) {
@@ -890,10 +889,10 @@
/**
- * Implementation of hook_settings().
+ * Callback for admin/settings/location
*
*/
-function location_configure() {
+function location_admin_settings() {
$supported_countries = _location_supported_countries();
$default_country = variable_get('location_default_country', 'us');
@@ -927,7 +926,7 @@
'#title' => t('Hide country selection'),
'#return_value' => 1,
'#default_value' => variable_get('location_suppress_country', 0),
- '#description' => t('If your site is specific to a country and you would like to hide the country field on search forms and content creation forms, check this box. Doing so will automatically assume the country to be the country you have chosen for the \'default country selection\' above.')
+ '#description' => t("If your site is specific to a country and you would like to hide the country field on search forms and content creation forms, check this box. Doing so will automatically assume the country to be the country you have chosen for the 'default country selection' above.")
);
$form['location_search_distance_unit'] = array(
'#type' => 'radios',
@@ -941,10 +940,10 @@
'#title' => t('Toggle location display'),
'#default_value' => variable_get('location_display_location', 1),
'#options' => array(0 => t('Disable the display of locations.'), 1 => t('Enable the display of locations.')),
- '#description' => t('If you are interested in turning off locations and having a custom theme control their display, you may want to disable the display of locations so your theme can take over them.')
+ '#description' => t('If you are interested in turning off locations and having a custom theme control their display, you may want to disable the display of locations so your theme can take that function.')
);
- if (!module_exist('civicrm')) {
+ if (!module_exists('civicrm')) {
$form['location_user'] = array(
'#type' => 'radios',
'#title' => 'User locations',
@@ -957,7 +956,7 @@
$form['location_user'] = array(
'#type' => 'item',
'#title' => t('User locations'),
- '#description' => t('You have enabled the CiviCRM module. This means that CiviCRM will collect user locations for you. To make sure you will be able to use location module features with these user addresses, you should make sure the CiviCRM \'address\' profile is marked as active. If you are using CivicSpace, this comes activated on a default install. If you installed CiviCRM on a seperate Drupal installation, please consult the documentation in the README file for the location module.')
+ '#description' => t("You have enabled the CiviCRM module. This means that CiviCRM will collect user locations for you. To make sure you will be able to use location module features with these user addresses, you should make sure the CiviCRM 'address' profile is marked as active. If you installed CiviCRM on a seperate Drupal installation, please consult the documentation in the README.txt file for the Location module.")
);
}
@@ -966,7 +965,7 @@
'#title' => t('Use a Google Map to set latitude and longitude '),
'#return_value' => 1,
'#default_value' => variable_get('location_usegmap',1),
- '#description' => t('If the gmap.module is installed and %enabled, and this is setting is turned on, users that are allowed to manually enter latitude/longitude coordinates will be able to do so with an interactive Google Map. You should also make sure you have entered a %google_maps_api_key into your %gmap_module_settings.', array('%enabled' => l('enabled', 'admin/modules'), '%google_maps_api_key' => 'Google Maps API key', '%gmap_module_settings' => l('gmap module settings', 'admin/settings/gmap')))
+ '#description' => t('If the gmap.module is installed and %enabled, and this is setting is turned on, users that are allowed to manually enter latitude/longitude coordinates will be able to do so with an interactive Google Map. You should also make sure you have entered a %google_maps_api_key into your %gmap_module_settings.', array('%enabled' => l('enabled', 'admin/build/modules'), '%google_maps_api_key' => 'Google Maps API key', '%gmap_module_settings' => l('gmap module settings', 'admin/settings/gmap')))
);
$form['location_configured_countries'] = array(
@@ -977,12 +976,12 @@
'#description' => t('Currently, your CivicSpace site is capable of supporting extra features (e.g., postal code proximity searches) for locations from this list of countries. Please narrow the list down to countries for which you want to support these extra features. It may be useful for performance to narrow down this list if most the locations in your system are from only a handful of the listed countries.')
);
- return system_settings_form('location_configure_settings', $form);
+ return system_settings_form($form);
}
function _location_effective_user_setting() {
- if (module_exist('civicrm')) {
+ if (module_exists('civicrm')) {
return LOCATION_USER_CIVICRM_ONLY;
}
else {
@@ -1073,7 +1072,7 @@
if (user_access('submit latitude/longitude')) {
if ($user->location['latitude'] != NULL && $user->location['longitude'] != NULL) {
$items[] = array('title' => t('Coordinates'),
- 'value' => t('lat: %latitude
lon: %longitude', array('%latitude' => $user->location['latitude'], '%longitude' => $user->location['longitude'])),
+ 'value' => t('lat: %latitude',array('%latitude' => $user->location['latitude'])) .'
'. t('lon: %longitude', array('%longitude' => $user->location['longitude'])),
'class' => 'location',
);
}
Index: location.mysql
===================================================================
RCS file: location.mysql
diff -N location.mysql
--- location.mysql 31 Mar 2006 22:49:00 -0000 1.7
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,18 +0,0 @@
--- $Id: location.mysql,v 1.7 2006/03/31 22:49:00 ankur Exp $
-
-CREATE TABLE location (
- oid int(10) unsigned NOT NULL default '0',
- type varchar(6) NOT NULL default '',
- name varchar(255) default NULL,
- street varchar(255) default NULL,
- additional varchar(255) default NULL,
- city varchar(255) default NULL,
- province varchar(16) default NULL,
- postal_code varchar(16) default NULL,
- country char(2) default NULL,
- latitude decimal(10,6) default NULL,
- longitude decimal(10,6) default NULL,
- source tinyint(4) default '0',
- PRIMARY KEY (type,oid)
-) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;
-
Index: contrib/location_views/location_views.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/location/contrib/location_views/location_views.module,v
retrieving revision 1.14
diff -u -r1.14 location_views.module
--- contrib/location_views/location_views.module 17 Sep 2006 20:55:22 -0000 1.14
+++ contrib/location_views/location_views.module 17 Nov 2006 22:26:12 -0000
@@ -3,8 +3,10 @@
/**
* @file
* Views-enables the location module.
- *
+ *
*/
+
+//TODO: are the cache_get/cache_clear_all calls still appropriate? not sure...
/**
* Implementation of hook_help().
@@ -24,6 +26,7 @@
/**
* hunmonk's module dependency check: see http://drupal.org/node/54463
+ * TODO: we can probably skip this or use the .info
*/
if ($form_id == 'system_modules' && !$_POST) {
location_views_system_module_validate($form);
@@ -775,7 +778,7 @@
$form = array();
- if (!module_exist('gmap')) return $form;
+ if (!module_exists('gmap')) return $form;
$user = $GLOBALS['user'];
$res=db_query("SELECT * FROM {location} WHERE oid=%d AND type='user'",$user->uid);
Index: location.info
===================================================================
RCS file: location.info
diff -N location.info
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ location.info 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,3 @@
+; $Id$
+name = Location
+description = Enables the location system and allow users to attach locative information to content.