Index: GMAP-MACRO-DICTIONARY.txt =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/gmap/GMAP-MACRO-DICTIONARY.txt,v retrieving revision 1.2 diff -u -p -r1.2 GMAP-MACRO-DICTIONARY.txt --- GMAP-MACRO-DICTIONARY.txt 15 Jul 2008 16:30:29 -0000 1.2 +++ GMAP-MACRO-DICTIONARY.txt 3 Feb 2011 16:09:35 -0000 @@ -46,6 +46,11 @@ Description: id for the rendered map ele Example: id=mymap Notes: use if you need to access the map from a script, or if you plan to have multiple maps on a page. As of Gmap 1.0, this is no longer required. +Attribute: extinfowindow +Values: exinfowindow theme name +Description: the name of the extinfowindow theme you want to use. if multiple maps are on a page they will all use the theme for the first map. +Example: extinfowindow=light + -------- OVERLAYS -------- Index: gmap.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/gmap/gmap.module,v retrieving revision 1.104.2.10 diff -u -p -r1.104.2.10 gmap.module --- gmap.module 27 Jan 2011 22:39:19 -0000 1.104.2.10 +++ gmap.module 3 Feb 2011 16:09:37 -0000 @@ -164,6 +164,11 @@ function gmap_gmap($op, &$map) { if (isset($map['feed']) && is_array($map['feed'])) { drupal_add_js($path . 'markerloader_georss.js'); } + // ExtInfoWindow + if (variable_get('gmap_extinfowindow_active', FALSE)) { + $extinfowindow_theme = isset($map['extinfowindow']) ? $map['extinfowindow'] : ''; + gmap_add_extinfowindow($extinfowindow_theme); + } break; case 'macro_multiple': return array('points', 'markers', 'feed', 'circle', 'rpolygon', 'polygon', 'line', 'style'); @@ -1278,6 +1283,85 @@ function gmap_views_plugins() { } /** + * Function that adds the required js and css for extinfowindow pop-ups. + * + * @param $theme_name + * The name of the theme to use. + * If omitted it will be the extinfowindow theme set on the gmap settings page. + */ +function gmap_add_extinfowindow($theme_name = '') { + // Due to the way these themes work (css) we can only reliably have one theme + // used on a page at any one time. + // So if we have already loaded a theme then skip this. + $themes = gmap_extinfowindow_themes(FALSE); + $css = drupal_add_css(); + $found = FALSE; + foreach ($themes as $theme) { + if (array_key_exists($theme['css_path'], $css['all']['module'])) { + $found = TRUE; + } + } + if (!$found) { + if (!$theme_name) { + $theme_name = variable_get('gmap_extinfowindow_theme', 'dark'); + } + + drupal_add_js(array('gmap' => array('extinfowindow' => variable_get('gmap_extinfowindow_active', FALSE))), 'setting'); + + // Add the extinfowindow js + drupal_add_js(drupal_get_path('module', 'gmap') . '/thirdparty/extinfowindow/extinfowindow.js'); + + // Find the active theme + $theme = gmap_extinfowindow_themes(FALSE, $theme_name); + // Add the theme css + drupal_add_css($theme['css_path']); + } +} + +/** + * Get the themes for ExtInfoWindow. + * + * Gets default themes from the gmap module and additional themes from the active theme. + * An ext theme in the active theme will override one in the gmap module. + * + * @param $names + * Whether to return names only or names with their paths. + * @param $theme_name + * The name of a specific theme to return. If omitted all themes will be returned. + * + * @return + * Depending on parameters it could be: + * - An array of theme names; + * - An array of themes, with their name and the patch to their css; + * - A single theme name string; + * - An array of a single theme's name and path to css. + */ +function gmap_extinfowindow_themes($names = TRUE, $theme_name = '') { + global $theme; + $theme_path = drupal_get_path('theme', $theme); + $default_path = drupal_get_path('module', 'gmap') . '/thirdparty/extinfowindow/themes'; + + $default_themes = file_scan_directory($default_path, '.css'); + $themes = file_scan_directory($theme_path . '/extinfowindow', '.css'); + $themes = array_merge($default_themes, $themes); + + $ext_themes = array(); + foreach ($themes as $ext_theme) { + if ($names) { + $ext_themes[$ext_theme->name] = $ext_theme->name; + } + else { + $ext_themes[$ext_theme->name] = array( + 'name' => $ext_theme->name, + 'css_path' => $ext_theme->filename, + ); + } + } + + return $theme_name ? $ext_themes[$theme_name] : $ext_themes; +} + +/** * Implementation of hook_views_pre_render(). */ function gmap_views_pre_render(&$view) { Index: gmap_plugin_style_gmap.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/gmap/gmap_plugin_style_gmap.inc,v retrieving revision 1.11.2.7 diff -u -p -r1.11.2.7 gmap_plugin_style_gmap.inc --- gmap_plugin_style_gmap.inc 27 Jan 2011 06:48:45 -0000 1.11.2.7 +++ gmap_plugin_style_gmap.inc 3 Feb 2011 16:09:37 -0000 @@ -47,6 +47,9 @@ class gmap_plugin_style_gmap extends vie $options['tooltipenabled'] = array('default' => 0); $options['tooltipfield'] = array('default' => ''); + $options['extinfowindow_enabled'] = array('default' => 0); + $options['extinfowindow_theme'] = array('default' => ''); + return $options; } @@ -243,6 +246,10 @@ class gmap_plugin_style_gmap extends vie } $map['markers'] = $markers; + + if ($this->options['extinfowindow_enabled']) { + $map['extinfowindow'] = $this->options['extinfowindow_theme']; + } $output .= theme($this->theme_functions(), $this->view, $this->options, $map, $title); } } @@ -423,6 +430,23 @@ class gmap_plugin_style_gmap extends vie '#process' => array('views_process_dependency'), '#dependency' => array('edit-style-options-tooltipenabled' => array(TRUE)), ); + + if (variable_get('gmap_extinfowindow_active', FALSE)) { + $form['extinfowindow_enabled'] = array( + '#type' => 'checkbox', + '#title' => t('Use extinfowindow for pop-ups'), + '#default_value' => $this->options['extinfowindow_enabled'], + ); + $form['extinfowindow_theme'] = array( + '#title' => t('Extinfowindow theme'), + '#description' => t("The extinfowindow theme to use for this view."), + '#type' => 'select', + '#options' => gmap_extinfowindow_themes(), + '#default_value' => isset($this->options['extinfowindow_theme']) ? $this->options['extinfowindow_theme'] : variable_get('gmap_extinfowindow_theme', 'dark'), + '#process' => array('views_process_dependency'), + '#dependency' => array('edit-style-options-extinfowindow-enabled' => array(TRUE)), + ); + } } /** Index: gmap_settings_ui.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/gmap/gmap_settings_ui.inc,v retrieving revision 1.12.2.6 diff -u -p -r1.12.2.6 gmap_settings_ui.inc --- gmap_settings_ui.inc 15 Sep 2010 23:40:50 -0000 1.12.2.6 +++ gmap_settings_ui.inc 3 Feb 2011 16:09:38 -0000 @@ -620,6 +620,29 @@ function gmap_admin_settings(&$form_stat '#size' => 4, '#maxlength' => 4, ); + // ExtInfoWindow Settings + $form['gmap_extinfowindow'] = array( + '#type' => 'fieldset', + '#title' => t('ExtInfoWindow'), + '#description' => t('ExtInfoWindow enables you to theme the pop info window'), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + ); + + $form['gmap_extinfowindow']['gmap_extinfowindow_active'] = array( + '#type' => 'checkbox', + '#title' => t('Enable GMap Ext Window'), + '#default_value' => variable_get('gmap_extinfowindow_active', FALSE), + '#description' => t('Enable/disable the GMap Ext Info Window'), + ); + + $form['gmap_extinfowindow']['gmap_extinfowindow_theme'] = array( + '#type' => 'select', + '#title' => t('Theme'), + '#default_value' => variable_get('gmap_extinfowindow_theme', 'dark'), + '#options' => gmap_extinfowindow_themes(), + '#description' => t('The theme to use for the ext window inplementation.') + ); // @@@ Convert to element level validation. $form['#validate'][] = 'gmap_admin_settings_validate'; Index: js/marker.js =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/gmap/js/marker.js,v retrieving revision 1.4.2.3 diff -u -p -r1.4.2.3 marker.js --- js/marker.js 1 Feb 2011 19:36:15 -0000 1.4.2.3 +++ js/marker.js 3 Feb 2011 16:09:38 -0000 @@ -61,7 +61,18 @@ Drupal.gmap.addHandler('gmap', function obj.bind('clickmarker', function (marker) { // Local/stored content if (marker.text) { - marker.marker.openInfoWindowHtml(marker.text); + // ExtInfoWindow implementation + if (Drupal.settings.gmap.extinfowindow) { + marker.marker.openExtInfoWindow( + obj.map, + 'opacity_window', + marker.text, + {beakOffset: 2} + ); + } + else { + marker.marker.openInfoWindowHtml(marker.text); + } } // Info Window Query / Info Window Offset if (marker.iwq || (obj.vars.iwq && typeof marker.iwo != 'undefined')) { @@ -88,7 +99,18 @@ Drupal.gmap.addHandler('gmap', function // Cached RMT. if (obj.rmtcache[marker.rmt]) { - marker.marker.openInfoWindowHtml(obj.rmtcache[marker.rmt]); + // ExtInfoWindow implementation + if (Drupal.settings.gmap.extinfowindow) { + marker.marker.openExtInfoWindow( + obj.map, + 'opacity_window', + obj.rmtcache[marker.rmt], + {beakOffset: 2} + ); + } + else { + marker.marker.openInfoWindowHtml(obj.rmtcache[marker.rmt]); + } } else { var uri = marker.rmt; @@ -106,7 +128,18 @@ Drupal.gmap.addHandler('gmap', function //} $.get(uri, {}, function (data) { obj.rmtcache[marker.rmt] = data; - marker.marker.openInfoWindowHtml(data); + // ExtInfoWindow implementation + if (Drupal.settings.gmap.extinfowindow) { + marker.marker.openExtInfoWindow( + obj.map, + 'opacity_window', + data, + {beakOffset: 2} + ); + } + else { + marker.marker.openInfoWindowHtml(data); + } }); } }