diff --git a/gmap.info b/gmap.info index be94607af4fd70c832f975bea05b1a5c30f81aac..8a36cd0b0160b942570ea98aa5ffab9476f3cc47 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 8b21eb0ea01d2dcd537c5be1a072296993508002..852ea9e53ae7cc1c196dfca8628c7db0a7666eed 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(''); + 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.') .''. t('Create a macro') .''; + return t('Insert Google Map macro.') . '' . t('Create a macro') . ''; } 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 = '