summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrandon Bergren2010-01-24 01:47:20 (GMT)
committer Brandon Bergren2010-01-24 01:47:20 (GMT)
commit464992462522e66d0051a3677ff837a043e0b040 (patch)
tree9e58c55195c4ac6fd8493b2a384e0c6eace98096
parentcc40c90157a066c9161a03641dcee10f0b4c0526 (diff)
Manual commit of D7 porting work so far. (Had a conflict in the .info file due to keyword expansion.)
-rwxr-xr-xgmap.info5
-rw-r--r--gmap.module84
2 files changed, 46 insertions, 43 deletions
diff --git a/gmap.info b/gmap.info
index be94607..8a36cd0 100755
--- a/gmap.info
+++ b/gmap.info
@@ -1,5 +1,8 @@
; $Id$
name = GMap
description = Filter to allow insertion of a google map into a node
-core = 6.x
+core = 7.x
package = Location
+files[] = gmap.module
+files[] = gmap.views.inc
+files[] = gmap-view-gmap.tpl.php
diff --git a/gmap.module b/gmap.module
index 8b21eb0..852ea9e 100644
--- a/gmap.module
+++ b/gmap.module
@@ -90,7 +90,7 @@ function gmap_gmap($op, &$map) {
),
);
case 'pre_theme_map':
- $path = drupal_get_path('module', 'gmap') .'/js/';
+ $path = drupal_get_path('module', 'gmap') . '/js/';
// Activate markers if needed.
if ((isset($map['behavior']['dynmarkers']) && $map['behavior']['dynmarkers']) || !empty($map['markers'])) {
static $header_set = FALSE;
@@ -103,7 +103,7 @@ function gmap_gmap($op, &$map) {
drupal_set_message(t('GMap marker file settings are not configured properly for Private download method, markers will not work!'), 'error');
}
else {
- drupal_add_js($markerpath, 'module', 'header', FALSE, TRUE, FALSE);
+ drupal_add_js($markerpath, 'external');
}
}
// With public method, we can handle all bookkeeping ourselves.
@@ -113,12 +113,12 @@ function gmap_gmap($op, &$map) {
gmap_regenerate_markers();
$markerpath = file_create_path('js');
}
- drupal_add_js("$markerpath/gmap_markers.js", 'module', 'header', FALSE, TRUE, FALSE);
+ drupal_add_js("$markerpath/gmap_markers.js", 'external');
}
}
- drupal_add_js($path .'icon.js');
- drupal_add_js($path .'marker.js');
+ drupal_add_js($path . 'icon.js');
+ drupal_add_js($path . 'marker.js');
$mm = variable_get('gmap_mm_type', 'gmap');
// If you really really want to override the marker manager, implement
@@ -127,20 +127,20 @@ function gmap_gmap($op, &$map) {
_gmap_markermanager_override($mm);
}
- drupal_add_js($path . $mm .'_marker.js');
+ drupal_add_js($path . $mm . '_marker.js');
}
if (isset($map['behavior']['locpick']) && $map['behavior']['locpick']) {
- drupal_add_js($path .'locpick.js');
+ drupal_add_js($path . 'locpick.js');
}
if (!empty($map['markers']) || !empty($map['lines'])) {
- drupal_add_js($path .'markerloader_static.js');
+ drupal_add_js($path . 'markerloader_static.js');
}
if (!empty($map['shapes'])) {
- drupal_add_js($path .'shapeloader_static.js');
- drupal_add_js($path .'gmap_shapes.js');
+ drupal_add_js($path . 'shapeloader_static.js');
+ drupal_add_js($path . 'gmap_shapes.js');
}
if (isset($map['feed']) && is_array($map['feed'])) {
- drupal_add_js($path .'markerloader_georss.js');
+ drupal_add_js($path . 'markerloader_georss.js');
}
break;
case 'macro_multiple':
@@ -259,8 +259,8 @@ function _gmap_doheader() {
return;
}
$gmap_path = drupal_get_path('module', 'gmap');
- drupal_add_css($gmap_path .'/gmap.css');
- drupal_add_js($gmap_path .'/js/gmap.js');
+ drupal_add_css($gmap_path . '/gmap.css');
+ drupal_add_js($gmap_path . '/js/gmap.js');
$mm = variable_get('gmap_mm_type', 'gmap');
$mms = variable_get('gmap_markermanager', array());
if (empty($mms[$mm])) {
@@ -273,16 +273,16 @@ function _gmap_doheader() {
}
if ($mm == 'clusterer' || $mm == 'clustermarker') {
// Needed for access to clusterer marker.
- drupal_add_js($gmap_path .'/js/icon.js');
+ drupal_add_js($gmap_path . '/js/icon.js');
}
if (isset($mms[$mm]['filename'])) {
- drupal_add_js($gmap_path .'/thirdparty/'. $mms[$mm]['filename']);
+ drupal_add_js($gmap_path . '/thirdparty/' . $mms[$mm]['filename']);
}
- drupal_add_js($gmap_path .'/js/marker.js');
- drupal_add_js($gmap_path .'/js/'. $mm .'_marker.js');
+ drupal_add_js($gmap_path . '/js/marker.js');
+ drupal_add_js($gmap_path . '/js/' . $mm . '_marker.js');
drupal_add_js(array('gmap_markermanager' => $mms[$mm]), 'setting');
// @@@
-drupal_add_js($gmap_path .'/js/poly.js');
+drupal_add_js($gmap_path . '/js/poly.js');
global $language;
$query = array(
@@ -291,7 +291,7 @@ drupal_add_js($gmap_path .'/js/poly.js');
'key' => gmap_get_key(),
'hl' => $language->language,
);
- drupal_set_html_head('<script src="'. check_url(url('http://maps.google.com/maps', array('query' => $query))) .'" type="text/javascript"></script>');
+ drupal_add_js(url('http://maps.google.com/maps', array('query' => $query)), 'external');
$gmap_initialized = TRUE;
}
@@ -308,7 +308,7 @@ drupal_add_js($gmap_path .'/js/poly.js');
* A GMap array.
*/
function gmap_parse_macro($instring, $ver = 2) {
- require_once drupal_get_path('module', 'gmap') .'/gmap_parse_macro.inc';
+ require_once drupal_get_path('module', 'gmap') . '/gmap_parse_macro.inc';
return _gmap_parse_macro($instring, $ver);
}
@@ -346,7 +346,7 @@ function gmap_set_location($map, &$form, $fields) {
if (!is_array($map)) {
$map = array_merge(gmap_defaults(), gmap_parse_macro($map));
}
- $id = 'loc'. $ctr;
+ $id = 'loc' . $ctr;
$map['id'] = $id;
// This is a locpick map.
@@ -463,7 +463,7 @@ function gmap_filter($op, $delta = 0, $format = -1, $text = '') {
*/
function gmap_filter_tips($delta, $format, $long = FALSE) {
if (user_access('create gmap macro')) { // only display macro if user can create one
- return t('Insert Google Map macro.') .'<a href="'. url('map/macro') .'" target="_blank" >'. t('Create a macro') .'</a>';
+ return t('Insert Google Map macro.') . '<a href="' . url('map/macro') . '" target="_blank" >' . t('Create a macro') . '</a>';
}
else {
return t('Insert Google Map macro.');
@@ -497,8 +497,8 @@ function gmap_regenerate_markers() {
file_check_directory($jspath, FILE_CREATE_DIRECTORY);
$contents .= "// GMap marker image data.\n";
- $contents .= "Drupal.gmap.iconpath = ". drupal_to_js(base_path() . variable_get('gmap_markerfiles', drupal_get_path('module', 'gmap') .'/markers')) .";\n";
- $contents .= "Drupal.gmap.icondata = ". drupal_to_js(gmap_get_icondata(TRUE)) .";\n";
+ $contents .= "Drupal.gmap.iconpath = " . drupal_to_js(base_path() . variable_get('gmap_markerfiles', drupal_get_path('module', 'gmap') . '/markers')) . ";\n";
+ $contents .= "Drupal.gmap.icondata = " . drupal_to_js(gmap_get_icondata(TRUE)) . ";\n";
file_save_data($contents, "$jspath/gmap_markers.js", FILE_EXISTS_REPLACE);
@@ -775,9 +775,9 @@ function process_gmap_markerchooser($element) {
*/
function theme_gmap_overlay_edit($element) {
$path = drupal_get_path('module', 'gmap');
- drupal_add_js($path .'/js/gmap.js');
- drupal_add_js($path .'/js/gmap_shapes.js');
- drupal_add_js($path .'/js/overlay_edit.js');
+ drupal_add_js($path . '/js/gmap.js');
+ drupal_add_js($path . '/js/gmap_shapes.js');
+ drupal_add_js($path . '/js/overlay_edit.js');
return theme('select', $element);
}
@@ -806,20 +806,20 @@ function gmap_map_cleanup(&$map) {
}
function theme_gmap_macrotext($element) {
- drupal_add_js(drupal_get_path('module', 'gmap') .'/js/macro.js');
+ drupal_add_js(drupal_get_path('module', 'gmap') . '/js/macro.js');
// @@@
- drupal_add_js(drupal_get_path('module', 'gmap') .'/js/macrobuilder.js');
+ drupal_add_js(drupal_get_path('module', 'gmap') . '/js/macrobuilder.js');
return theme('textarea', $element);
}
function theme_gmap_address($element) {
- drupal_add_js(drupal_get_path('module', 'gmap') .'/js/address.js');
+ drupal_add_js(drupal_get_path('module', 'gmap') . '/js/address.js');
$element['#autocomplete_path'] = '';
return theme('textfield', $element);
}
function theme_gmap_align($element) {
- drupal_add_js(drupal_get_path('module', 'gmap') .'/js/align.js');
+ drupal_add_js(drupal_get_path('module', 'gmap') . '/js/align.js');
$element['#multiple'] = FALSE;
return theme('select', $element);
}
@@ -902,19 +902,19 @@ function theme_gmap($element) {
}
$style = array();
- $style[] = 'width: '. $map['width'];
- $style[] = 'height: '. $map['height'];
+ $style[] = 'width: ' . $map['width'];
+ $style[] = 'height: ' . $map['height'];
- $element['#attributes']['class'] = trim($element['#attributes']['class'] .' gmap gmap-map gmap-'. $mapid .'-gmap');
+ $element['#attributes']['class'] = trim($element['#attributes']['class'] . ' gmap gmap-map gmap-' . $mapid . '-gmap');
// Some markup parsers (IE) don't handle empty inners well. Use the space to let users know javascript is required.
// @@@ Bevan sez: Google static maps could be useful here.
// @@@ Bdragon sez: Yeah, would be nice, but hard to guarantee functionality. Not everyone uses the static markerloader.
- $o = '<div style="'. implode('; ', $style) .';" id="'. $element['#id'] .'"'. drupal_attributes($element['#attributes']) .'>'. t('Javascript is required to view this map.') .'</div>';
+ $o = '<div style="' . implode('; ', $style) . ';" id="' . $element['#id'] . '"' . drupal_attributes($element['#attributes']) . '>' . t('Javascript is required to view this map.') . '</div>';
// $map can be manipulated by reference.
foreach (module_implements('gmap') as $module) {
- call_user_func_array($module .'_gmap', array('pre_theme_map', &$map));
+ call_user_func_array($module . '_gmap', array('pre_theme_map', &$map));
}
if (isset($mapids[$element['#map']])) {
@@ -962,7 +962,7 @@ function gmap_widget_setup(&$element, $type, $map=NULL) {
$element['#attributes']['class'] = trim(implode(' ', array(
$element['#attributes']['class'],
'gmap-control',
- 'gmap-'. $type,
+ 'gmap-' . $type,
)));
$element['#id'] = gmap_get_id($map, $type);
$element['#map'] = $map;
@@ -982,7 +982,7 @@ function gmap_get_id($map, $type) {
$serial[$map][$type] = -1;
}
$serial[$map][$type]++;
- return 'gmap-'. $map .'-'. $type . $serial[$map][$type];
+ return 'gmap-' . $map . '-' . $type . $serial[$map][$type];
}
/**
@@ -991,7 +991,7 @@ function gmap_get_id($map, $type) {
function gmap_get_auto_mapid() {
static $auto = 0;
$auto++;
- return 'auto'. $auto .'map';
+ return 'auto' . $auto . 'map';
}
/**
@@ -1014,7 +1014,7 @@ function gmap_get_marker_titles($reset = FALSE) {
}
}
- require_once(drupal_get_path('module', 'gmap') .'/gmap_markerinfo.inc');
+ require_once(drupal_get_path('module', 'gmap') . '/gmap_markerinfo.inc');
$titles = _gmap_get_marker_titles();
cache_set('gmap_marker_titles', $titles, 'cache');
return $titles;
@@ -1035,7 +1035,7 @@ function gmap_get_icondata($reset = FALSE) {
}
if ($reset || !$icons) {
- require_once(drupal_get_path('module', 'gmap') .'/gmap_markerinfo.inc');
+ require_once(drupal_get_path('module', 'gmap') . '/gmap_markerinfo.inc');
$icons = _gmap_get_icondata();
}
cache_set('gmap_icondata', $icons, 'cache');
@@ -1077,7 +1077,7 @@ function gmap_decimal($num) {
*/
function gmap_geocode($address, $tld = 'com') {
$key = gmap_get_key();
- $data = drupal_http_request('http://maps.google.'. $tld .'/maps/geo?q='. drupal_urlencode($address) .'&output=csv&key='. $key);
+ $data = drupal_http_request('http://maps.google.' . $tld . '/maps/geo?q=' . drupal_urlencode($address) . '&output=csv&key=' . $key);
if ($data->code == 200) {
$r = explode(',', $data->data);
return array(