Skip to content

Commit

Permalink
Merge branch 'master' of github.com:aaronmiler/habitat4humanity
Browse files Browse the repository at this point in the history
  • Loading branch information
simonv3 committed May 19, 2013
2 parents d511826 + 63ca1b4 commit 3e3fff4
Show file tree
Hide file tree
Showing 404 changed files with 157,917 additions and 0 deletions.
1 change: 1 addition & 0 deletions sites/all/modules/location/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.patch
8 changes: 8 additions & 0 deletions sites/all/modules/location/CREDITS.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

Originally developed and implemented by:
Ankur Rishi (user name 'ankur': http://drupal.org/user/11703 )


Maintained by:
Brandon Bergren (user name 'Bdragon' http://drupal.org/user/53801 )
Rebecca White (user name 'bec' http://drupal.org/user/81067)
73 changes: 73 additions & 0 deletions sites/all/modules/location/INSTALL.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@

CONTENTS OF THIS FILE
---------------------

* Introduction
* Installation

INTRODUCTION
------------

Current maintainer: Brandon Bergren <http://drupal.org/user/53081>

Location module and its associated API allows Drupal objects, including nodes
and users, to be associated with specific physical locations.

This package consists of several modules, including:
- Location (required): Base module that provides a standard API and storage for
location data.
- Location Add Another: Quickly add additional locations directly from a node.
- Location Fax: Add a fax number to a location.
- Location Phone: Add a phone number to a location.
- Location Search: A custom search page for locations.

For Drupal 6, Views support has been rolled directly into the base Location module.

INSTALLATION
------------

1. Copy the files to your sites/SITENAME/modules directory.

2. Enable the Location module and any desired optional modules at Administer >>
Site building >> Modules (admin/build/modules).

3. Set user permissions for Location module at Administer >> User management >>
Access control (admin/user/access).

4. Configure Location module's settings at Administer >> Site configuration >>
Location (admin/settings/location). Here, you may configure settings related
to how Location fields are displayed, how location data is gathered, what
geocoding service is used to translate addresses to longitude and latitude
points, and which mapping service should display them.

5. If you wish to collect location data about content, go to Administer >>
Content management >> Content types and click "edit" on the given type, such
as "Event". In the Locative information fieldset, expand and set your
options accordingly.

6. (Optional) Import a postal codes database for the countries served by your
website, to support proximity searches and other useful features. Postal
code databases may be found in the "databases/" sub-directory of the
Location module directory. The files are in the format of zipcodes.CC.mysql,
where CC is a two-letter country code such as 'us' or 'de'.

Note: If your site is using table prefixes, you will need to adjust for this
manually, by opening the file in a text editor and replacing 'zipcodes' with
'prefix_zipcodes' throughout.

To import the files from the command line, enter the following:

cd sites/SITENAME/modules/location
mysql -u username -p database-name < database/zipcodes.us.mysql

KNOWN ISSUES
------------

1. Node locations and CCK locations cannot safely be used on the same content types.
You can use both on one site but they must be used on different content types.
To turn node locations off for a particular content type edit the content type
and set the max number of locations to zero.
The problem is that node locations can interfere with the saving of cck locations
and you can end up losing your cck locations.
For more information see this issue - http://drupal.org/node/906968.

339 changes: 339 additions & 0 deletions sites/all/modules/location/LICENSE.txt

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions sites/all/modules/location/TODO-3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Make sure that we scan for broken location table (oid -> eid)
- lid editor
- Remove variable 'gmap_location_map' -- gmap was taking care of it for us but we never used it.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name = Location Add Another
description = Allows you to quickly add locations directly from a node without having to click 'edit' first.
dependencies[] = location
dependencies[] = location_node
package = Location
core = 7.x
files[] = location_addanother.module
files[] = location_addanother.install


; Information added by drupal.org packaging script on 2013-05-11
version = "7.x-3.0-rc1"
core = "7.x"
project = "location"
datestamp = "1368266412"

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

/**
* @file
* Install, update and uninstall functions for the location_addanother module.
*/

/**
* Implementshook_install().
*/
function location_addanother_install() {
// Change weight so we execute after location.
db_update('system')
->fields(array(
'weight' => 1,
))
->condition('name', 'location_addanother')
->condition('type', 'module')
->execute();
}

/**
* Implementshook_uninstall().
*/
function location_addanother_uninstall() {
$result = db_query("SELECT name FROM {variable} WHERE name LIKE 'location_addanother_%'")->fetchCol();
foreach ($result as $row) {
variable_del($row->name);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<?php

/**
* @file
* "Add location from node view" functionality.
* Split from main location.module in version 3.
*/

/**
* Implements hook_node_view().
*/
function location_addanother_node_view($node, $view_mode) {
if (variable_get('location_addanother_' . $node->type, 0) && count($node->locations) < variable_get('location_maxnum_' . $node->type, 0) && $view_mode == 'full' && node_access('update', $node)) {
$addanother_form = drupal_get_form('location_addanother_form', $node);
$node->content['location_addanother'] = array(
'#type' => 'markup',
'#markup' => drupal_render($addanother_form),
);
}
}

/**
* Implements hook_form_FORM_ID_alter().
* Alter the node_type_form form.
*/
function location_addanother_form_node_type_form_alter(&$form, &$form_state, $form_id) {
$type = $form['#node_type']->type;

$form['location_settings']['multiple']['location_addanother'] = array(
'#type' => 'checkbox',
'#title' => t('Add another location from node view page'),
'#default_value' => variable_get('location_addanother_' . $type, 0),
'#description' => t('Display the "Add another location" option on the node view page.'),
);
}

/**
* Form to display directly on a node view for "quick location add" functionality.
*/
function location_addanother_form($form, &$form_state, &$node) {
$settings = variable_get('location_settings_node_' . $node->type, array());

$form['location'] = array(
'#type' => 'location_element',
'#title' => t('Add another location'),
'#default_value' => NULL,
'#location_settings' => $settings['form']['fields'],
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['location']['nid'] = array(
'#type' => 'hidden', // @@@ See if we can get away with value-ing this.
'#value' => $node->nid,
);

$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Add location'),
'#weight' => 50,
);
return $form;
}

/**
* Validation function for "add another location" form.
*/
function location_addanother_form_validate($form, &$form_state) {
$location = $form_state['values']['location'];
$node = node_load($location['nid']);
unset($location['nid']);
if (!(variable_get('location_addanother_' . $node->type, 0) && count($node->locations) < variable_get('location_maxnum_' . $node->type, 0) && node_access('update', $node))) {
form_set_error('location', t("You don't have permission to add a location to this node, or the node has the maximum number of locations already."));
}
}

/**
* Submission function for "add another location" form.
*/
function location_addanother_form_submit($form, &$form_state) {
$location = $form_state['values']['location'];
$node = node_load($location['nid']);
$locations = $node->locations;
unset($location['nid']);
$locations[] = $location;

location_save_locations($locations, array('nid' => $node->nid, 'vid' => $node->vid));

return 'node/' . $node->nid;
}

/**
* Implements hook_node_type_delete().
* Synchronize our settings.
*/
function location_addanother_node_type_delete($info) {
variable_del('location_addanother_' . $info->type);
}

/**
* Implements hook_node_type_update().
* Synchronize our settings.
*/
function location_addanother_node_type_update($info) {
if (!empty($info->old_type) && $info->old_type != $info->type) {
$setting = variable_get('location_addanother_' . $info->old_type, 0);
variable_del('location_addanother_' . $info->old_type);
variable_set('location_addanother_' . $info->type, $setting);
}
}
15 changes: 15 additions & 0 deletions sites/all/modules/location/contrib/location_cck/location_cck.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name = Location CCK
description = Defines a Location field type.
dependencies[] = location
package = CCK
core = 7.x
files[] = location_cck.module
files[] = location_cck.install


; Information added by drupal.org packaging script on 2013-05-11
version = "7.x-3.0-rc1"
core = "7.x"
project = "location"
datestamp = "1368266412"

Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

/**
* @file
* Install, update and uninstall functions for the location_cck module.
*/

/**
* Drupal 6 location_cck 3.x update.
*/
function location_cck_update_6301() {
// Create a temporary table to fix some location_instance data.
$schema = drupal_get_schema('location_instance');
$schema['description'] = 'Temp table to repair data integrity of location_instance table.';
unset($schema['indexes']);
db_create_table('location_instance_tmp', $schema);

// Populate the temporary table.
$join_select = db_select('location_instance', 'li');
$join_select->addExpression("SUBSTRING_INDEX(genid, ':', -1)", 'genvid');
$join_select->fields('li', array('lid', 'genid'));

$insert_select = db_select('node', 'n')
->fields('n', array('nid', 'vid'))
->fields('l', array('genid', 'lid'));
$insert_select->join($join_select, 'l', 'n.vid = l.genvid');

db_insert('location_instance_tmp')
->fields(array('nid', 'vid', 'genid', 'lid'))
->from($insert_select)
->execute();

// Update the location_instance table.
db_delete('location_instance')
->condition('genid', 'cck:%', 'LIKE')
->execute();

$insert_select = db_select('location_instance_tmp', 'lit')
->fields('lit', array('nid', 'vid', 'genid', 'lid'));

db_insert('location_instance')
->fields(array('nid', 'vid', 'genid', 'lid'))
->from($insert_select)
->execute();

// Remove the temporary table.
db_drop_table('location_instance_tmp');
}
Loading

0 comments on commit 3e3fff4

Please sign in to comment.