diff -rupN gmap/GMAP-MACRO-DICTIONARY.txt gmap_new/GMAP-MACRO-DICTIONARY.txt --- gmap/GMAP-MACRO-DICTIONARY.txt 2008-07-16 02:30:29.000000000 +1000 +++ GMAP-MACRO-DICTIONARY.txt 2010-06-21 23:07:03.000000000 +1000 @@ -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 -------- diff -rupN gmap/gmap.module gmap_new/gmap.module --- gmap/gmap.module 2010-06-22 00:17:00.000000000 +1000 +++ gmap.module 2010-06-22 00:20:05.000000000 +1000 @@ -164,6 +164,12 @@ 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)) { + if (isset($map['extinfowindow']) && $map['extinfowindow']) { + gmap_add_extinfowindow($map['extinfowindow']); + } + } break; case 'macro_multiple': return array('points', 'markers', 'feed', 'circle', 'rpolygon', 'polygon', 'line', 'style'); @@ -1263,3 +1269,76 @@ 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. + */ +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) { + // Set js setting. + 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/' . variable_get('gmap_extinfowindow_filename', 'extinfowindow_packed.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; +} diff -rupN gmap/gmap_plugin_style_gmap.inc gmap_new/gmap_plugin_style_gmap.inc --- gmap/gmap_plugin_style_gmap.inc 2010-06-22 00:17:00.000000000 +1000 +++ gmap_plugin_style_gmap.inc 2010-06-21 23:07:03.000000000 +1000 @@ -43,6 +43,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; } @@ -210,6 +213,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); } } @@ -363,6 +370,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)), + ); + } } /** diff -rupN gmap/gmap_settings_ui.inc gmap_new/gmap_settings_ui.inc --- gmap/gmap_settings_ui.inc 2010-06-22 00:17:00.000000000 +1000 +++ gmap_settings_ui.inc 2010-06-22 00:04:03.000000000 +1000 @@ -621,6 +621,27 @@ function gmap_admin_settings(&$form_stat '#maxlength' => 4, ); + // ExtInfoWindow Settings + $form['gmap_extinfowindow'] = array( + '#type' => 'fieldset', + '#title' => t('ExtInfoWindow'), + '#description' => t('ExtInfoWindow enables you to theme the pop info window using CSS. To use, you must download it from here and extract the appropriate file to the thirdparty/extinfowindow folder.', array('@url' => 'http://gmaps-utility-library-dev.googlecode.com/svn/tags/extinfowindow/1.2/src/')), + '#collapsible' => TRUE, + '#collapsed' => TRUE, + ); + $form['gmap_extinfowindow']['gmap_extinfowindow_filename'] = array( + '#type' => 'textfield', + '#title' => t('Filename'), + '#description' => t('Name of downloaded file in the thirdparty/extinfowindow folder. Default: %default', array('%default' => 'extinfowindow_packed.js')), + '#default_value' => variable_get('gmap_extinfowindow_filename', 'extinfowindow_packed.js'), + ); + $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'), + ); + // @@@ Convert to element level validation. $form['#validate'][] = 'gmap_admin_settings_validate'; diff -rupN gmap/js/marker.js gmap_new/js/marker.js --- gmap/js/marker.js 2010-06-22 00:17:01.000000000 +1000 +++ js/marker.js 2010-06-21 23:07:03.000000000 +1000 @@ -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); + } } // AJAX content if (marker.rmt) { @@ -79,7 +90,18 @@ Drupal.gmap.addHandler('gmap', function // marker.marker.openInfoWindowHtml(Drupal.settings.loadingImage); //} $.get(uri, {}, function (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); + } }); } // Tabbed content diff -rupN gmap/thirdparty/extinfowindow/README.txt gmap_new/thirdparty/extinfowindow/README.txt --- gmap/thirdparty/extinfowindow/README.txt 1970-01-01 10:00:00.000000000 +1000 +++ thirdparty/extinfowindow/README.txt 2010-06-22 00:13:04.000000000 +1000 @@ -0,0 +1,24 @@ +/* $Id$ */ + +ExtInfoWindow +-------------- +Extinfowindow plugin by Joe Monahan. +Integration of the extinfowindow plugin with gmap by Arshad Chummun. + +Usage +-------------- +You must download the plugin from http://gmaps-utility-library-dev.googlecode.com/svn/tags/extinfowindow/1.2/src/ +You can enable extinfowindow in the gmap settings page. +You can specify a theme in views settings for gmap views and you can specify +a theme to use in gmap macros (see GMAP-MACRO-DICTIONARY.txt for details). + +Theming +-------------- +To create a new theme for extinfowindow: +1. Create a new directory in your theme called extinfowindow +2. Copy one of the the default themes (example: light) into the extinfowindow directory of your theme. +3. Rename the folder to your theme name (example: mytheme). +4. Rename light.css to yourthemename.css (example: mytheme.css) +5. Edit the css in the css file (images goes inside the images directory) + +Note that if you do not rename your theme's directory and css file the theme will override the default theme you copied. diff -rupN gmap/thirdparty/extinfowindow/themes/dark/dark.css gmap_new/thirdparty/extinfowindow/themes/dark/dark.css --- gmap/thirdparty/extinfowindow/themes/dark/dark.css 1970-01-01 10:00:00.000000000 +1000 +++ thirdparty/extinfowindow/themes/dark/dark.css 2010-06-08 00:52:01.000000000 +1000 @@ -0,0 +1,163 @@ +/* $Id$ */ + +#opacity_window { + width: 300px; +} + +#opacity_window_contents { + background: #111111; + font-family: arial; + font-size: 13px; + color: #050; + color: #FFFFFF; +} + +#opacity_window_contents p { + padding: 3px 5px; +} + +#opacity_window_contents div { + padding: 3px; +} + +* html #opacity_window_contents { + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/info_bg.png', sizingMethod='scale'); +} + +/** + * Top Left + */ +#opacity_window_tl { + width: 10px; + height: 10px; + background: url('images/info_bg.png') top left repeat transparent; +} + +* html #opacity_window_tl { + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/info_bg.png', sizingMethod='crop'); +} + +/** + * Top + */ +#opacity_window_t { + background: url('images/info_bg.png') top left repeat-x transparent; +} + +* html #opacity_window_t { + background-image: none; + filter:progid: DXImageTransform.Microsoft.AlphaImageLoader(src='images/info_bg.png', sizingMethod='scale'); +} + +/** + * Top Right + */ +#opacity_window_tr { + width: 10px; + height: 10px; + background: url('images/info_bg.png') top right repeat transparent; +} + +* html #opacity_window_tr { + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/info_bg.png', sizingMethod='scale'); +} + +/** + * Left + */ +#opacity_window_l { + background: url('images/info_bg.png') top left repeat-y transparent; + width: 10px; +} + +* html #opacity_window_l { + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/info_bg.png', sizingMethod='scale'); +} + +/** + * Right + */ +#opacity_window_r { + background: url('images/info_bg.png') top right repeat-y transparent; + width: 10px; +} + +* html #opacity_window_r { + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/info_bg.png', sizingMethod='scale'); +} + +/** + * Bottom Left + */ +#opacity_window_bl { + width: 10px; + height: 10px; + background: url('images/info_bg.png') top left repeat transparent; +} + +* html #opacity_window_bl { + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/info_bg.png', sizingMethod='crop'); +} + +/** + * Bottom + */ +#opacity_window_b { + height: 18px; + background: url('images/info_bg.png') bottom left repeat-x transparent; +} + +* html #opacity_window_b { + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/info_bg.png', sizingMethod='scale'); +} + +/** + * Bottom Right + */ +#opacity_window_br { + width: 10px; + height: 10px; + background: url('images/info_bg.png') top left repeat transparent; +} + +* html #opacity_window_br { + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/info_bg.png', sizingMethod='crop'); +} + +/** + * Close + */ +#opacity_window_close { + width: 20px; + height: 20px; + margin: -8px 0 0 10px; + background: url('images/close.png') top left no-repeat transparent; + cursor: pointer; +} + +* html #opacity_window_close { + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/info_bg.png', sizingMethod='crop'); +} + +/** + * Beak + */ +#opacity_window_beak { + width: 30px; + height: 20px; + background: transparent url(images/beak.png) no-repeat scroll center 2px; +} + +* html #opacity_window_beak { + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/info_bg.png', sizingMethod='crop'); +} diff -rupN gmap/thirdparty/extinfowindow/themes/light/light.css gmap_new/thirdparty/extinfowindow/themes/light/light.css --- gmap/thirdparty/extinfowindow/themes/light/light.css 1970-01-01 10:00:00.000000000 +1000 +++ thirdparty/extinfowindow/themes/light/light.css 2010-06-08 00:54:26.000000000 +1000 @@ -0,0 +1,163 @@ +/* $Id$ */ + +#opacity_window { + width: 200px; +} + +#opacity_window_contents { + background: #FFFFFF; + font-family: arial; + font-size: 13px; + color: #050; + color: #111111; +} + +#opacity_window_contents p { + padding:3px 5px; +} + +#opacity_window_contents div { + padding: 3px; +} + +* html #opacity_window_contents { + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/info_bg.png', sizingMethod='scale'); +} + +/** + * Top Left + */ +#opacity_window_tl { + width: 10px; + height: 10px; + background: url('images/info_bg.png') top left repeat transparent; +} + +* html #opacity_window_tl { + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/info_bg.png', sizingMethod='crop'); +} + +/** + * Top + */ +#opacity_window_t { + background: url('images/info_bg.png') top left repeat-x transparent; +} + +* html #opacity_window_t { + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/info_bg.png', sizingMethod='scale'); +} + +/** + * Top Right + */ +#opacity_window_tr { + width: 10px; + height: 10px; + background: url('images/info_bg.png') top right repeat transparent; +} + +* html #opacity_window_tr { + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/info_bg.png', sizingMethod='scale'); +} + +/** + * Left + */ +#opacity_window_l { + background: url('images/info_bg.png') top left repeat-y transparent; + width: 10px; +} + +* html #opacity_window_l { + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/info_bg.png', sizingMethod='scale'); +} + +/** + * Right + */ +#opacity_window_r { + background: url('images/info_bg.png') top right repeat-y transparent; + width: 10px; +} + +* html #opacity_window_r { + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/info_bg.png', sizingMethod='scale'); +} + +/** + * Bottom Left + */ +#opacity_window_bl { + width: 10px; + height: 10px; + background: url('images/info_bg.png') top left repeat transparent; +} + +* html #opacity_window_bl { + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/info_bg.png', sizingMethod='crop'); +} + +/** + * Bottom + */ +#opacity_window_b { + height: 18px; + background: url('images/info_bg.png') bottom left repeat-x transparent; +} + +* html #opacity_window_b { + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/info_bg.png', sizingMethod='scale'); +} + +/** + * Bottom Right + */ +#opacity_window_br { + width: 10px; + height: 10px; + background: url('images/info_bg.png') top left repeat transparent; +} + +* html #opacity_window_br { + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/info_bg.png', sizingMethod='crop'); +} + +/** + * Close + */ +#opacity_window_close { + width: 20px; + height: 20px; + margin: -8px 0 0 10px; + background: url('images/close.png') top left no-repeat transparent; + cursor: pointer; +} + +* html #opacity_window_close { + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/info_bg.png', sizingMethod='crop'); +} + +/** + * Beak + */ +#opacity_window_beak { + width: 30px; + height: 20px; + background: transparent url(images/beak.png) no-repeat scroll center 2px; +} + +* html #opacity_window_beak { + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/info_bg.png', sizingMethod='crop'); +}