? full_screen.css ? throbber.gif ? js/full_screen.js ? js/markerloader_chunks.js ? markers/small/black.png ? markers/small/bpink.png ? markers/small/bred.png ? markers/small/brown.png ? markers/small/dblue.png ? markers/small/dgreen.png ? markers/small/fgreen.png ? markers/small/gray.png ? markers/small/green.png ? markers/small/lblue.png ? markers/small/lgray.png ? markers/small/orange.png ? markers/small/pblue.png ? markers/small/pgreen.png ? markers/small/pink.png ? markers/small/purple.png ? markers/small/pyellow.png ? markers/small/resources ? markers/small/white.png ? markers/small/yellow.png Index: gmap.css =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/gmap/gmap.css,v retrieving revision 1.3.2.2 diff -u -p -r1.3.2.2 gmap.css --- gmap.css 19 Sep 2007 00:23:21 -0000 1.3.2.2 +++ gmap.css 28 Aug 2008 12:50:01 -0000 @@ -28,3 +28,9 @@ v\:* { .gmap-right { float: right; } + +/* Content area of info windows is about 60x120px by default */ +img.gmap-loading-image { + margin: 15px 90px; + border: 0 none !important; +} Index: gmap.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/gmap/gmap.module,v retrieving revision 1.51.2.143 diff -u -p -r1.51.2.143 gmap.module --- gmap.module 21 Aug 2008 18:24:21 -0000 1.51.2.143 +++ gmap.module 28 Aug 2008 12:50:02 -0000 @@ -25,6 +25,11 @@ define('GMAP_LINECOLOR3', '#0000ff'); // for details on using other version numbers. define('GMAP_API_VERSION', '2.115'); +// Chunk markerloader defaults +define('GMAP_CHUNK_THRESHOLD', 200); +define('GMAP_CHUNK_SIZE', 2); +define('GMAP_CHUNK_DELAY', 100); + /** * Get the defaults for a gmap. */ @@ -32,11 +37,11 @@ function gmap_defaults() { $defaults = array( 'width' => '300px', 'height' => '200px', - 'zoom' => 3, + 'zoom' => 1, 'maxzoom' => 14, 'controltype' => 'Small', 'align' => 'None', - 'latlong' => '40,0', + 'latlong' => '30,-100', 'maptype' => 'Map', 'mtc' => 'standard', 'baselayers' => array('Map', 'Satellite', 'Hybrid'), @@ -52,8 +57,8 @@ function gmap_defaults() { foreach ($behaviors as $k => $v) { $defaults['behavior'][$k] = $v['default']; } - $defaults = array_merge($defaults, variable_get('gmap_default', array())); - return $defaults; + $stored = variable_get('gmap_default', array()); + return array_merge($defaults, $stored); } /** @@ -75,34 +80,75 @@ function gmap_gmap($op, &$map) { ); case 'pre_theme_map': $path = drupal_get_path('module', 'gmap') .'/js/'; + $js_settings = array(); + // Activate markers if needed if ($map['behavior']['dynmarkers'] || !empty($map['markers'])) { // The marker data is not a real file. Work around this fact. static $header_set = FALSE; if (!$header_set) { $header_set = TRUE; + // @Brandon: Why are the opening and closing tags switched? wtf? If there is a good reason it needs a comment. drupal_add_js("/* GMap markers enabled. */\n'); + + // Allow themes and custom modules to put the scripts somewhere other than
. + drupal_set_html_head(theme('gmap_script', variable_get('gmap_api_version', GMAP_API_VERSION), $key)); drupal_add_js(array( 'gmap_init' => array( @@ -233,6 +299,23 @@ drupal_add_js($gmap_path .'/js/poly.js') } /** + * Themes the '; +} + +/** + * Returns html markup for the a loading image or 'throbber'. + */ +function theme_gmap_loading_image() { + $t = t('Loading...'); + $att = array('class' => 'gmap-loading-image'); + return theme('image', drupal_get_path('module', 'gmap') .'/throbber.gif', $t, $t, $att); +} + +/** * Parse a macro style definition. * Example: #111111/1/100/#111111/1 */ @@ -758,29 +841,15 @@ function gmap_menu($may_cache) { /** * Generate the markerdata file. + * @@@ why is this a separate request. Doesn't it make more sense in the settings in the page request? e.g. drupal_add_js('setting') */ function gmap_markerdata_js() { drupal_set_header('Content-Type: text/javascript'); echo "// GMap marker image data.\n"; - echo "Drupal.gmap.iconpath = ". drupal_to_js(base_path() . drupal_get_path('module', 'gmap') .'/markers') .";\n"; + echo "Drupal.gmap.iconpath = '". base_path() . variable_get('gmap_markerfiles', drupal_get_path('module', 'gmap') .'/markers') ."';\n"; echo "Drupal.gmap.icondata = ". drupal_to_js(gmap_get_icondata()) .";\n"; } - -/** - * JSON request interface. - */ -function gmap_json_query() { - if (arg(2)=='markers') { - drupal_set_header('Content-Type: text/javascript'); - echo drupal_to_js(array( - 'path' => base_path() . drupal_get_path('module', 'gmap') .'/markers', - 'markers' => gmap_get_icondata(TRUE), - )); - exit(); - } -} - /** * Settings page. (remove for d6) */ @@ -1117,41 +1186,60 @@ function theme_gmap($element) { $map = array_merge(gmap_defaults(), $element['#settings']); gmap_map_cleanup($map); + $classes = array('gmap', 'gmap-map', "gmap-{$map['id']}"); switch (strtolower($map['align'])) { case 'left': - $element['#attributes']['class'] += ' gmap-left'; + $classes[] = 'gmap-left'; break; case 'right': - $element['#attributes']['class'] += ' gmap-right'; + $classes[] = 'gmap-right'; break; case 'center': case 'centre': - $element['#attributes']['class'] += ' gmap-center'; + $classes[] = 'gmap-center'; } - $style = array(); - $style[] = 'width: '. $map['width']; - $style[] = 'height: '. $map['height']; - - $element['#attributes']['class'] = trim($element['#attributes']['class'] .'gmap gmap-map gmap-'. $map['id'] .'-gmap'); + $element['#attributes']['class'] .= ' '. implode(' ', $classes); + $element['#attributes']['style'] .= "width: {$map['width']}; height: {$map['height']};"; + $element['#attributes']['id'] = $element['#id']; + $attr = drupal_attributes($element['#attributes']); // 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 = 'Alternate base map macros can be entered for a specific node type below.'), - '#default_value' => variable_get('gmap_location_block_macro', '[gmap |id=block0 |zoom=10 |width=100% |height=200px |control=Small |type=Map |behavior=+notype] '), - ); + switch ($delta) { + case 'node_map': + $form['gmap_location_block_macro'] = array( + '#type' => 'textfield', + '#title' => t('Map Macro'), + '#size' => 60, + '#maxlength' => 500, + '#description' => t('A macro to be used as a base map for the location block. This map will be recentered on the location, so the center is not that important.
Alternate base map macros can be entered for a specific node type below.'),
+ '#default_value' => variable_get('gmap_location_block_macro', '[gmap |id=block0 |zoom=10 |width=100% |height=200px |control=Small |type=Map |behavior=+notype] '),
+ );
- $ntypes = node_get_types();
- foreach ($ntypes as $key => $value) {
- if (variable_get('location_maxnum_'. $key, 0)) {
- $form['gmap_location_block_macro_'. $key] = array(
- '#type' => 'textfield',
- '#title' => t('Map Macro for '. $value->name),
- '#size' => 60,
- '#maxlength' => 500,
- '#default_value' => variable_get('gmap_location_block_macro_'. $key, ''),
- );
+ $ntypes = node_get_types();
+ foreach ($ntypes as $key => $value) {
+ if (variable_get("location_maxnum_$key", 0)) {
+ $form["gmap_location_block_macro_$key"] = array(
+ '#type' => 'textfield',
+ '#title' => t('Map Macro for !name', array('!name' => $value->name)),
+ '#size' => 60,
+ '#maxlength' => 500,
+ '#default_value' => variable_get("gmap_location_block_macro_$key", ''),
+ );
+ }
}
- }
- }
- elseif ($delta == 1) {
- $form['gmap_location_author_block_macro'] = array(
- '#type' => 'textfield',
- '#title' => t('Map Macro'),
- '#size' => 60,
- '#maxlength' => 500,
- '#description' => t('A macro to be used as a base map for the location block author. This map will be recentered on the location, so the center is not that important.'),
- '#default_value' => variable_get('gmap_location_author_block_macro', '[gmap |zoom=10 |width=100% |height=200px |control=Small |type=Map |behavior=+notype] '),
- );
+ break;
- $ntypes = node_get_types();
- foreach ($ntypes as $key => $type) {
- $form['gmap_location_author_block_'. $key] = array(
- '#type' => 'checkbox',
- '#title' => t('Author block enabled for %type content type', array('%type' => $type->name)),
- '#default_value' => variable_get('gmap_location_author_block_'. $key, 0),
+ case 'author_map':
+ $form['gmap_location_author_block_macro'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Map Macro'),
+ '#size' => 60,
+ '#maxlength' => 500,
+ '#description' => t('A macro to be used as a base map for the location block author. This map will be recentered on the location, so the center is not that important.'),
+ '#default_value' => variable_get('gmap_location_author_block_macro', '[gmap |zoom=10 |width=100% |height=200px |control=Small |type=Map |behavior=+notype] '),
);
- }
+
+ $ntypes = node_get_types();
+ foreach ($ntypes as $key => $type) {
+ $form['gmap_location_author_block_'. $key] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Author block enabled for %type content type', array('%type' => $type->name)),
+ '#default_value' => variable_get('gmap_location_author_block_'. $key, 0),
+ );
+ }
+ break;
}
return $form;
case 'save':
- if ($delta == 0) {
- // Have Drupal save the string to the database.
- variable_set('gmap_location_block_macro', $edit['gmap_location_block_macro']);
- $ntypes = node_get_types();
- foreach ($ntypes as $key => $value) {
- if (variable_get('location_maxnum_'. $key, 0)) {
- variable_set('gmap_location_block_macro_'. $key, $edit['gmap_location_block_macro_'. $key]);
+ switch ($delta) {
+ case 'node_map':
+ // Have Drupal save the string to the database.
+ variable_set('gmap_location_block_macro', $edit['gmap_location_block_macro']);
+ $ntypes = node_get_types();
+ foreach ($ntypes as $key => $value) {
+ if (variable_get('location_maxnum_'. $key, 0)) {
+ variable_set('gmap_location_block_macro_'. $key, $edit['gmap_location_block_macro_'. $key]);
+ }
}
- }
- }
- elseif ($delta == 1) {
- // Have Drupal save the string to the database.
- variable_set('gmap_location_author_block_macro', $edit['gmap_location_author_block_macro']);
- $ntypes = node_get_types();
- foreach ($ntypes as $key => $value) {
- variable_set('gmap_location_author_block_'. $key, $edit['gmap_location_author_block_'. $key]);
- }
+ break;
+
+ case 'author_map':
+ // Have Drupal save the string to the database.
+ variable_set('gmap_location_author_block_macro', $edit['gmap_location_author_block_macro']);
+ $ntypes = node_get_types();
+ foreach ($ntypes as $key => $value) {
+ variable_set('gmap_location_author_block_'. $key, $edit['gmap_location_author_block_'. $key]);
+ }
+ break;
}
return;
case 'view':
switch ($delta) {
- case 0:
- if (arg(0)=='node' && is_numeric(arg(1))) {
+ case 'node_map':
+ if (arg(0) == 'node' && is_numeric(arg(1))) {
return gmap_location_block_view(arg(1));
}
break;
- case 1:
- if (arg(0)=='node' && is_numeric(arg(1))) {
+ case 'author_map':
+ if (arg(0) == 'node' && is_numeric(arg(1))) {
return gmap_location_author_block_view(arg(1));
}
break;
+ case 'nodes_map':
+ if (user_access('show node map')) {
+ return array(
+ 'title' => 'Node Locations',
+ 'content' => gmap_location_node_page(),
+ );
+ }
+ break;
}
}
}
@@ -855,7 +868,7 @@ function gmap_location_user($op, &$edit,
if (variable_get('gmap_user', 0) && user_access('set user location')) {
switch ($op) {
case 'load':
- $result = db_query("SELECT latitude,longitude FROM {location} WHERE eid = %d AND type='user'", $user->uid);
+ $result = db_query("SELECT latitude,longitude FROM {location} WHERE eid = %d AND type='user' AND latitude IS NOT NULL", $user->uid);
$u = db_fetch_object($result);
if ($u) {
$user->gmap_location_longitude = $u->longitude;
@@ -876,20 +889,23 @@ function gmap_location_user($op, &$edit,
case 'update':
if ($category == 'gmap_user') {
// source==1, location.module's LOCATION_LATLON_USER_SUBMITTED define.
+ $lat = gmap_decimal($edit['gmap_location_latitude']);
+ $lon = gmap_decimal($edit['gmap_location_longitude']);
+
+ // If the user is removing their location data, we need to do that in the DB too.
+ if ($lat == 0 && $lon == 0) {
+ $lat = $lon = 'NULL';
+ }
+
// Insert or update based on the existance of $user->gmap_location_set.
if ($user->gmap_location_set) {
- db_query("UPDATE {location} SET latitude = %s , longitude = %s , source = 1 WHERE eid = %d AND type = 'user'",
- gmap_decimal($edit['gmap_location_latitude']),
- gmap_decimal($edit['gmap_location_longitude']),
- $user->uid);
+ db_query("UPDATE {location} SET latitude = %s , longitude = %s , source = 1 WHERE eid = %d AND type = 'user'", $lat, $lon, $user->uid);
}
else {
$lid = db_next_id('{location}_lid');
- db_query("INSERT INTO {location} (eid, lid, type, latitude, longitude, source) VALUES (%d, %d, 'user', %s, %s, 1)",
- $user->uid, $lid,
- gmap_decimal($edit['gmap_location_latitude']),
- gmap_decimal($edit['gmap_location_longitude']));
+ db_query("INSERT INTO {location} (eid, lid, type, latitude, longitude, source) VALUES (%d, %d, 'user', %s, %s, 1)", $user->uid, $lid, $lat, $lon);
}
+
unset($edit['gmap_location_latitude']);
unset($edit['gmap_location_longitude']);
}
@@ -897,13 +913,14 @@ function gmap_location_user($op, &$edit,
case 'form':
if ($category == 'gmap_user' && user_access('set user location')) {
+ // Create a form for user location picker.
$form = array();
$form['coordinates'] = array(
'#type' => 'fieldset',
'#title' => t('Coordinates'),
'#weight' => 5,
- '#collapsible' => $type!='user',
+ '#collapsible' => $type != 'user',
'#collapsed' => FALSE,
);
@@ -929,10 +946,9 @@ function gmap_location_user($op, &$edit,
// @@@ Why is this based off the user map?
$tmp = variable_get('gmap_user_map', _gmap_location_user_map_defaults());
-
$form['coordinates']['gmap_node']['#value'] = gmap_set_location($tmp['macro'], $form['coordinates'], array('latitude' => 'gmap_location_latitude', 'longitude' => 'gmap_location_longitude'));
-/*
+ /*
if (variable_get('gmap_geocode', 1)) {
$form['coordinates']['gmap_location_address'] = array(
'#type' => 'textfield',
@@ -940,7 +956,7 @@ function gmap_location_user($op, &$edit,
'#description' => t('The address to be found on the map. Enter an address and then hit "TAB" and the current location will be updated. Please note that this address is not saved for the node, it is only used for finding a location.'),
);
}
-*/
+ */
}
return $form;
}
Index: gmap_settings_ui.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/gmap/gmap_settings_ui.inc,v
retrieving revision 1.1.2.34
diff -u -p -r1.1.2.34 gmap_settings_ui.inc
--- gmap_settings_ui.inc 15 Jul 2008 20:34:19 -0000 1.1.2.34
+++ gmap_settings_ui.inc 28 Aug 2008 12:50:03 -0000
@@ -23,6 +23,10 @@ function _gmap_admin_settings() {
'#title' => t('Google Maps API Key'),
'#default_value' => variable_get('googlemap_api_key', ''),
'#size' => 50,
+ '#type' => 'textfield',
+ '#title' => t('Google Maps API Key'),
+ '#default_value' => variable_get('googlemap_api_key', ''),
+ '#size' => 50,
'#maxlength' => 255,
'#description' => t('Your personal Googlemaps API key. You must get this for each separate website at Google Map API website.'),
);
@@ -35,18 +39,27 @@ function _gmap_admin_settings() {
'#value' => t("Managed by keys api.", array('@url' => url('admin/settings/keys'))),
);
}
+ $form['initialization']['gmap_api_version'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Google Maps API Version'),
+ '#default_value' => variable_get('gmap_api_version', GMAP_API_VERSION),
+ '#description' => t("The version string that identifies which version of the Google Maps API to use. 's' is for stable. 'x' is for latest. See Google Maps API Version Changes page for details and the Mapki.com changlog for a more granular changelog."),
+ '#size' => 4,
+ );
$form['initialization']['gmap_load_zoom_plugin'] = array(
'#type' => 'checkbox',
'#title' => t('Enable mousewheel zooming'),
'#default_value' => variable_get('gmap_load_zoom_plugin', TRUE),
+ // @@@ What are the advantages of mousewheel.js over GMap2 API's own mousewheel zooming feature?
'#description' => t('Enables the mousewheel.js jQuery plugin, which adds the ability to use the mouse wheel to zoom the map.'),
);
- if (!file_exists(drupal_get_path('module', 'gmap') .'/thirdparty/mousewheel.js')) {
+ $mousewheel_path = drupal_get_path('module', 'gmap') .'/thirdparty/mousewheel.js';
+ if (!file_exists($mousewheel_path)) {
variable_set('gmap_load_zoom_plugin', FALSE);
$form['initialization']['gmap_load_zoom_plugin']['#default_value'] = FALSE;
$form['initialization']['gmap_load_zoom_plugin']['#value'] = FALSE;
$form['initialization']['gmap_load_zoom_plugin']['#disabled'] = TRUE;
- $form['initialization']['gmap_load_zoom_plugin']['#description'] += '
'. t('The mousewheel.js file was not found. Please download and place in the thirdparty/ folder.');
+ $form['initialization']['gmap_load_zoom_plugin']['#description'] .= t('mousewheel.js file was not found. Please download and place in %path.', array('%path' => $mousewheel_path));
}
$defaults = gmap_defaults();
@@ -176,7 +189,7 @@ function _gmap_admin_settings() {
}
}
- $form['gmap_default']['baselayers']['maptype'] = array(
+ $form['gmap_default']['maptype'] = array(
'#type' => 'select',
'#tree' => FALSE,
'#parents' => array('gmap_default', 'maptype'),
@@ -184,7 +197,7 @@ function _gmap_admin_settings() {
'#default_value' => $defaults['maptype'],
'#options' => $options,
);
- gmap_widget_setup($form['gmap_default']['baselayers']['maptype'], 'maptype', 'settings_default_map');
+ gmap_widget_setup($form['gmap_default']['maptype'], 'maptype', 'settings_default_map');
foreach ($baselayers as $name => $layers) {
$form['gmap_default']['baselayers'][$name] = array(
@@ -258,37 +271,72 @@ function _gmap_admin_settings() {
'#maxlength' => 7,
);
+ // Settings for chunks markerloader.
+ $chunk_settings = variable_get('gmap_chunk_markerloader', array(
+ 'autoLoad' => TRUE, // Automatically use the chunk marker loader if there are lots of markers?
+ 'threshold' => GMAP_CHUNK_THRESHOLD, // How many is 'lots'?
+ 'chunkSize' => GMAP_CHUNK_SIZE, // How many markers per chunk.
+ 'chunkDelay' => GMAP_CHUNK_DELAY, // Delay between each chunk in miliseconds.
+ ));
+ $form['gmap_chunk_markerloader'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Chunk Markerloader Settings'),
+ '#description' => t('The Chunk Markerloader is for managing large quantities of markers on a map. Processing lots of markers can cause the browser to freeze and appear to have crashed while it processes the markers and adds them to the DOM. Chunk Markerloader is an alternative to marker managers and clusterers, and probably will not work together with marker managers and clusterers. The Chunk Markerloader is used if the Chunk Autoload Threshold is reached and Chunk Autoload is on. It can also be activated by setting it as a GMap module behavior.'),
+ '#tree' => TRUE,
+ 'autoLoad' => array(
+ '#type' => 'checkbox',
+ '#title' => t('Chunk Autoload'),
+ '#description' => t('Autoload Chunk Markerloader if the threshold is reached'),
+ '#default_value' => $chunk_settings['autoLoad'],
+ '#size' => 4,
+ ),
+ 'threshold' => array(
+ '#type' => 'textfield',
+ '#title' => t('Chunk Autoload Theshold'),
+ '#description' => t('The minimum quantity of markers required for the Chunk Markerloader to be auto-loaded (Chunk Autoload must also be on).'),
+ '#default_value' => $chunk_settings['threshold'],
+ '#size' => 4,
+ ),
+ 'chunkSize' => array(
+ '#type' => 'textfield',
+ '#title' => t('Chunk Size'),
+ '#description' => t('The number of markers loaded in each chunk.'),
+ '#default_value' => $chunk_settings['chunkSize'],
+ '#size' => 4,
+ ),
+ 'chunkDelay' => array(
+ '#type' => 'textfield',
+ '#title' => t('Chunk Delay (ms)'),
+ '#description' => t('The length of the pause (timeout()) in miliseconds between each chunk.'),
+ '#default_value' => $chunk_settings['chunkDelay'],
+ '#size' => 4,
+ ),
+ );
+
+ // Ensure the $opts data structure is valid.
$opts = variable_get('gmap_markermanager', array());
- if (!is_array($opts['gmap'])) {
- $opts['gmap'] = array();
- }
- if (!is_array($opts['gmarkermanager'])) {
- $opts['gmarkermanager'] = array();
- }
- if (!is_array($opts['clusterer'])) {
- $opts['clusterer'] = array();
+ $default_opts = array(
+ 'gmap' => array(),
+ 'gmarkermanager' => array(
+ 'borderPadding' => 0,
+ 'maxZoom' => 4,
+ 'trackMarkers' => FALSE,
+ 'markerMinZoom' => 4,
+ 'markerMaxZoom' => 0,
+ ),
+ 'clusterer' => array(
+ 'clusterer_file' => 'Clusterer2.js',
+ 'marker' => 'cluster',
+ 'max_nocluster' => 150,
+ 'cluster_min' => 5,
+ 'max_lines' => 10,
+ ),
+ );
+ $opts = array_merge($default_opts, $opts);
+ foreach($default_opts as $key => $array) {
+ $opts[$key] = array_merge($array, $opts[$key]);
}
- $opts['gmap'] = array_merge(array(
- // None.
- ), $opts['gmap']);
-
- $opts['gmarkermanager'] = array_merge(array(
- 'borderPadding' => 0,
- 'maxZoom' => 4,
- 'trackMarkers' => FALSE,
- 'markerMinZoom' => 4,
- 'markerMaxZoom' => 0,
- ), $opts['gmarkermanager']);
-
- $opts['clusterer'] = array_merge(array(
- 'clusterer_file' => 'Clusterer2.js',
- 'marker' => 'cluster',
- 'max_nocluster' => 150,
- 'cluster_min' => 5,
- 'max_lines' => 10,
- ), $opts['clusterer']);
-
$form['gmap_markermanager'] = array(
'#type' => 'fieldset',
'#title' => t('Marker manager'),
@@ -408,9 +456,20 @@ function _gmap_admin_settings() {
'#maxlength' => 2,
'#default_value' => $opts['clusterer']['max_lines'],
);
+ $form['location'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Location settings'),
+ );
+ $form['location']['gmap_location_map'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Default location map'),
+ '#default_value' => variable_get('gmap_location_map', '[gmap|id=locmap|center=30,-100|zoom=1|width=100%|height=400px]'),
+ '#size' => 50,
+ '#maxlength' => 500,
+ '#description' => t('The gmap macro for the map to be used in the location.module for setting latitude and longitude.'),
+ );
$form['#validate']['gmap_admin_settings_validate'] = array();
-
return system_settings_form($form);
}
Index: gmap_views.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/gmap/gmap_views.module,v
retrieving revision 1.1.2.27
diff -u -p -r1.1.2.27 gmap_views.module
--- gmap_views.module 15 Jul 2008 16:06:03 -0000 1.1.2.27
+++ gmap_views.module 28 Aug 2008 12:50:03 -0000
@@ -96,6 +96,11 @@ function theme_views_view_gmap($view, $r
);
}
+ $ahah_info_windows = function_exists('gmap_location_node_point');
+ if ($ahah_info_windows ) {
+ $thismap['#settings']['rmtcallback'] = url('map/node/load');
+ }
+
$fatmarkers = (isset($thismap['#settings']['behavior']['fatmarkers']) && $thismap['#settings']['behavior']['fatmarkers']);
$markers = array();
@@ -147,18 +152,23 @@ function theme_views_view_gmap($view, $r
}
// Popup
if ($markermode == 1) {
- // @@@ TODO: Switch to using views_theme sometime. Unfortunately, it changes the function prototype.. :-/
- //$marker_popup = views_theme('gmap_views_marker_label', $view->name, $view, $fields, $entry);
- $marker_popup = theme('gmap_views_marker_label', $view, $fields, $entry);
-
- // add themed HTML to either text or tabs depending on whether or not
- // it was an array.
- if (is_array($marker_popup)) {
- // Tabbed.
- $themarker['tabs'] = $marker_popup;
+ if ($ahah_info_windows) {
+ $themarker['rmt'] = $entry->nid;
}
else {
- $themarker['text'] = $marker_popup;
+ // @@@ TODO: Switch to using views_theme sometime. Unfortunately, it changes the function prototype.. :-/
+ //$marker_popup = views_theme('gmap_views_marker_label', $view->name, $view, $fields, $entry);
+ $marker_popup = theme('gmap_views_marker_label', $view, $fields, $entry);
+
+ // add themed HTML to either text or tabs depending on whether or not
+ // it was an array.
+ if (is_array($marker_popup)) {
+ // Tabbed.
+ $themarker['tabs'] = $marker_popup;
+ }
+ else {
+ $themarker['text'] = $marker_popup;
+ }
}
}
// Link
Index: js/icon.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/gmap/js/icon.js,v
retrieving revision 1.1.2.16
diff -u -p -r1.1.2.16 icon.js
--- js/icon.js 7 Jul 2008 16:48:29 -0000 1.1.2.16
+++ js/icon.js 28 Aug 2008 12:50:03 -0000
@@ -37,7 +37,7 @@ Drupal.gmap.getIcon = function(setname,
if (!this.gicons[setname]) {
if (!Drupal.gmap.icons[setname]) {
- alert('Request for invalid marker set '+setname+'!');
+ alert('GMap Module: Marker "' + setname + '" is not available.');
}
this.gicons[setname] = [];
var q = Drupal.gmap.icons[setname];
@@ -68,9 +68,9 @@ Drupal.gmap.getIcon = function(setname,
};
/**
- * JSON callback to set up the icon defs.
- * When doing the JSON call, the data comes back in a packed format.
- * We need to expand it and file it away in a more useful format.
+ * Sets up the icon defs.
+ * Data is in a packed format, we need to expand it and file it away in a more useful format.
+ * @@@ This applied to when this was a JSON callback. Do this serverside now?
*/
Drupal.gmap.iconSetup = function() {
Drupal.gmap.icons = {};
@@ -78,8 +78,8 @@ Drupal.gmap.iconSetup = function() {
for (var path in m) {
// Reconstitute files array
var filef = m[path].f;
- var filew = Drupal.gmap.expandArray(m[path].w,filef.length);
- var fileh = Drupal.gmap.expandArray(m[path].h,filef.length);
+ var filew = Drupal.gmap.expandArray(m[path].w, filef.length);
+ var fileh = Drupal.gmap.expandArray(m[path].h, filef.length);
var files = [];
for (var i = 0; i < filef.length; i++) {
files[i] = {f : filef[i], w : filew[i], h : fileh[i]};
@@ -89,7 +89,7 @@ Drupal.gmap.iconSetup = function() {
delete fileh;
for (var ini in m[path].i) {
- $.extend(Drupal.gmap.icons,Drupal.gmap.expandIconDef(m[path].i[ini],path,files));
+ $.extend(Drupal.gmap.icons, Drupal.gmap.expandIconDef(m[path].i[ini], path, files));
}
}
};
Index: js/locpick.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/gmap/js/locpick.js,v
retrieving revision 1.1.2.4
diff -u -p -r1.1.2.4 locpick.js
--- js/locpick.js 26 Jun 2008 20:37:24 -0000 1.1.2.4
+++ js/locpick.js 28 Aug 2008 12:50:03 -0000
@@ -23,12 +23,45 @@ Drupal.gmap.addHandler('gmap',function(e
if (obj.vars.behavior.locpick) {
obj.locpick_coord = new GLatLng(obj.vars.latitude, obj.vars.longitude);
- GEvent.addListener(obj.map, "click", function(overlay,point) {
+ // On a double click click event is called twice then the dblclick event once.
+ // Disable zoom on double click since we'll zoom on single click.
+ obj.map.disableDoubleClickZoom();
+
+ // Is a click being processed? What point is it?
+ var pointClicked = false;
+
+ // Bind to the double click event on the marker.
+ GEvent.addListener(obj.map, "dblclick", function(overlay, point) {
+ if (pointClicked) {
+ // Pan back to the point we were processing.
+ obj.map.panTo(pointClicked);
+ }
+
+ // We're not procesing any clicks anymore, even if the timeout hasn't finished.
+ pointClicked = false;
+ });
+
+ // Bind to the single click event on the marker.
+ GEvent.addListener(obj.map, "click", function(overlay, point) {
+ // Don't do anything if a click is being processed.
+ if (pointClicked) {
+ return;
+ }
+
+ // We're processing a click & point.
+ pointClicked = point;
+
obj.map.checkResize();
- if (!overlay) {
+
+ if (overlay) {
+ // Unsetting the location.
+ obj.change('locpickremove', -1);
+ }
+ else {
if (obj.locpick_point) {
obj.map.removeOverlay(obj.locpick_point);
}
+
obj.map.zoomIn();
obj.map.zoomIn();
obj.map.addOverlay(obj.locpick_point = new GMarker(point, {draggable: true}));
@@ -47,10 +80,11 @@ Drupal.gmap.addHandler('gmap',function(e
obj.map.panTo(point);
obj.change('locpickchange', binding);
}
- else {
- // Unsetting the location
- obj.change('locpickremove',-1);
- }
+
+ // Wait for any add'l click or dblclick events to come through.
+ setTimeout(function() {
+ pointClicked = false;
+ }, 500);
});
}
});
Index: js/marker.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/gmap/js/marker.js,v
retrieving revision 1.1.2.4
diff -u -p -r1.1.2.4 marker.js
--- js/marker.js 21 Aug 2008 00:40:46 -0000 1.1.2.4
+++ js/marker.js 28 Aug 2008 12:50:03 -0000
@@ -55,16 +55,24 @@ Drupal.gmap.addHandler('gmap', function(
if (obj.vars.rmtcallback) {
uri = obj.vars.rmtcallback + '/' + marker.rmt;
}
- // @Bevan: I think it makes more sense to do it in this order.
- // @Bevan: I don't like your choice of variable btw, seems to me like
- // @Bevan: it belongs in the map object, or at *least* somewhere in
- // @Bevan: the gmap settings proper...
- //if (!marker.text && Drupal.settings.loadingImage) {
- // marker.marker.openInfoWindowHtml(Drupal.settings.loadingImage);
- //}
+ // @Bevan: I don't like your choice of variable btw
+ // @Brandon: This is the most convenient way of sending server-side variables to client
+ // with the main page request; and drupal_add_js('setting') exists for this purpose
+ // What alternative do you suggest?
$.get(uri, {}, function(data) {
marker.marker.openInfoWindowHtml(data);
});
+ // Because we're waiting on an external http request, load something to let the user know we're working on it.
+ if (marker.text) {
+ marker.marker.openInfoWindowHtml(marker.text);
+ }
+ else if (Drupal.settings.loadingImage) {
+ marker.marker.openInfoWindowHtml(Drupal.settings.loadingImage);
+ }
+ }
+ // Local/stored content
+ else if (marker.text) {
+ marker.marker.openInfoWindowHtml(marker.text);
}
// Tabbed content
else if (marker.tabs) {
Index: markers/small/blue.png
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/gmap/markers/small/blue.png,v
retrieving revision 1.1
diff -u -p -r1.1 blue.png
Binary files /tmp/cvs8NeQYq and blue.png differ
Index: markers/small/red.png
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/gmap/markers/small/red.png,v
retrieving revision 1.1
diff -u -p -r1.1 red.png
Binary files /tmp/cvsxt6CFs and red.png differ
Index: markers/small/small.ini
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/gmap/markers/small/small.ini,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 small.ini
--- markers/small/small.ini 6 Feb 2007 17:32:52 -0000 1.1.2.1
+++ markers/small/small.ini 28 Aug 2008 12:50:03 -0000
@@ -7,12 +7,88 @@ infoX = 10
infoY = 2
; Marker sets
+[small black]
+name = "Small Black"
+sequence = "black.png"
+
[small blue]
name = "Small Blue"
sequence = "blue.png"
+[small bpink]
+name = "Small Bright Pink"
+sequence = "bpink.png"
+
+[small bred]
+name = "Small Bright red"
+sequence = "bred.png"
+
+[small brown]
+name = "Small Brown"
+sequence = "brown.png"
+
+[small dblue]
+name = "Small Dark Blue"
+sequence = "dblue.png"
+
+[small dgreen]
+name = "Small Dark Green"
+sequence = "dgreen.png"
+
+[small fgreen]
+name = "Small Flouro Green"
+sequence = "fgreen.png"
+
+[small gray]
+name = "Small Gray"
+sequence = "gray.png"
+
+[small green]
+name = "Small Green"
+sequence = "green.png"
+
+[small lblue]
+name = "Small Light Blue"
+sequence = "lblue.png"
+
+[small lgray]
+name = "Small Light Gray"
+sequence = "lgray.png"
+
+[small orange]
+name = "Small Orange"
+sequence = "orange.png"
+
+[small pblue]
+name = "Small Pale Blue"
+sequence = "pblue.png"
+
+[small pgreen]
+name = "Small Pale Green"
+sequence = "pgreen.png"
+
+[small pyellow]
+name = "Small Pale Yellow"
+sequence = "pyellow.png"
+
+[small pink]
+name = "Small Pink"
+sequence = "pink.png"
+
+[small purple]
+name = "Small Purple"
+sequence = "purple.png"
+
[small red]
name = "Small Red"
sequence = "red.png"
-; Files
\ No newline at end of file
+[small white]
+name = "Small White"
+sequence = "white.png"
+
+[small yellow]
+name = "Small Yellow"
+sequence = "yellow.png"
+
+; Files