Skip to content
Snippets Groups Projects
Commit f8a47264 authored by Brandon Bergren's avatar Brandon Bergren
Browse files

Fix #322106, reported by sjf: Allow gmap to work when the Private download method is enabled.

parent 2c6b3ef5
No related branches found
No related tags found
No related merge requests found
......@@ -91,12 +91,25 @@ function gmap_gmap($op, &$map) {
static $header_set = FALSE;
if (!$header_set) {
$header_set = TRUE;
$markerpath = file_create_path('js');
if (!$markerpath || !file_exists("$markerpath/gmap_markers.js")) {
gmap_regenerate_markers();
// If the user is using private download method, it's up to them to get the path set up.
if (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) != FILE_DOWNLOADS_PUBLIC) {
$markerpath = variable_get('gmap_private_markerfile', '');
if (empty($markerpath) || !file_exists($markerpath)) {
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);
}
}
// With public method, we can handle all bookkeeping ourselves.
else {
$markerpath = file_create_path('js');
if (!$markerpath || !file_exists("$markerpath/gmap_markers.js")) {
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", 'module', 'header', FALSE, TRUE, FALSE);
}
drupal_add_js($path .'icon.js');
......
......@@ -49,6 +49,15 @@ function gmap_admin_settings(&$form_state) {
$form['initialization']['gmap_load_zoom_plugin']['#description'] += '<br />'. t('<em>The mousewheel.js file was not found. Please download and place in the <b>thirdparty/</b> folder.</em>');
}
if (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) != FILE_DOWNLOADS_PUBLIC) {
$form['initialization']['gmap_private_markerfile'] = array(
'#type' => 'textfield',
'#title' => t('Path to gmap_markers.js'),
'#description' => t('You are using the <em>Private</em> download method. For markers to work properly. you must press the <em>Regenerate</em> button, manually copy js/gmap_markers.js from the files directory to a location accessible by the webserver, and enter the file path relative to the Drupal root in this field.'),
'#default_value' => variable_get('gmap_private_markerfile', ''),
);
}
$form['initialization']['rebuild'] = array(
'#type' => 'fieldset',
'#title' => t('Regenerate marker cache'),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment