This patch improves support of remote AJAX callbacks for info windows (marker popups).
rmtcallback property is now optional, so that absolute uris from different domains can be handled in the same marker set by setting the full uri in marker.rmt.
Since getting the info window content is an http request that can take time to be responded to, a loading image (spinning circle) has been added and displays while the http request is being made. If marker.text is set then that is used instead of the loading image.
This patch includes diff lines from patches at http://drupal.org/node/238471 and http://drupal.org/node/236029 and will need to be re-rolled once they are committed.
The parts that are new in this patch are:
$mms = variable_get('gmap_markermanager', array());
if (empty($mms[$mm])) {
$mms[$mm] = array();
}
+
+ // Html markup for the spinning 'loading' image for asynchronous callbacks
+ drupal_add_js(array('loadingImage' => theme('gmap_loading_image')), 'setting');
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', 'module', 'header', null, null, false);
$key = variable_get('googlemap_api_key', '');
if (module_exists('keys_api')) {
$key = keys_api_get_key('gmap', $_SERVER['HTTP_HOST']);
@@ -185,6 +214,12 @@ drupal_add_js($gmap_path .'/js/poly.js')
$gmap_initialized = TRUE;
}
+function theme_gmap_loading_image() {
+ $t = t('Loading...');
+ $att = array('class' => 'gmap-loading-image');
+ return theme('image', drupal_get_path('module', 'gmap') .'/loading.gif', $t, $t, $att);
+}
+
/**
* Cleans the gmap variables to prevent javascript interjection.
*
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | throbber.gif | 2.62 KB | Bevan |
| #2 | throbber.png | 53.11 KB | Bevan |
| marker_js_ajax_loading_img.patch | 10.56 KB | Bevan | |
| loading.gif | 2.47 KB | Bevan |
Comments
Comment #1
Bevan commentedthis is a cooler throbber: http://edward.oconnor.cx/images/throbber.gif
Comment #2
Bevan commentedThis is the throbber from above but with a transparent background. The PNG is a fireworks file for making further edits, if required.
Changes to code will be included in a rerolled patch on http://drupal.org/node/238872
Comment #3
rooby commentedDrupal 5 is no longer supported.
If this issue affects drupal 6 or 7 please look for an existing issue for that version or else update this issue accordingly.