Project

General

Profile

Revision 669f08ee

ID669f08ee073432d163976f10b59f1d516e71f827
Parent 4c21ffdb
Child 378bc1ce

Added by Andreas Kohlbecker almost 4 years ago

fix #5938 unique ids for each openlayers block elements

View differences:

modules/cdm_dataportal/includes/maps.inc
89 89
 * Adds the javascript for a openlayers map to the page as well as all javascript libs.
90 90
 *
91 91
 *
92
 * @param $map_id
92 93
 * @param $map_settings
93 94
 *   The map settings array as retrieved by e.g. get_array_variable_merged(CDM_MAP_DISTRIBUTION, CDM_MAP_DISTRIBUTION_DEFAULT);
94 95
 * @param array $event_listeners
......
106 107
 * @param bool $resizable
107 108
 *   The map is made resizable when set to true
108 109
 */
109
function _add_js_openlayers_map($map_settings, array $event_listeners = array(), $resizable = false) {
110
function _add_js_openlayers_map($map_id, $map_settings, array $event_listeners = array(), $resizable = false) {
110 111

  
111 112
  font_awesome_icon_markup(); // no icon specified, only used to add the font and styles
112 113

  
......
200 201
  drupal_add_js("
201 202
          jQuery(document).ready(function() {
202 203
                jQuery(window).load(function () {
203
                  var map_container = jQuery('#openlayers_map').cdm_openlayers_map(
204
                  var map_container = jQuery('#openlayers-map-" . $map_id . "').cdm_openlayers_map(
204 205
                   '" . $mapserver_base_uri . "',
205 206
                   '" . $edit_map_service['version'] . "',
206 207
                   " .  json_encode($cdm_openlayers_options) . "
......
249 250
  $map_settings = get_array_variable_merged(CDM_MAP_DISTRIBUTION, CDM_MAP_DISTRIBUTION_DEFAULT);
250 251

  
251 252
  if($map_id == NULL){
252
    $map_id = "openlayers-container-" . sha1($occurrenceQuery . $distributionQuery);
253
    $map_id = sha1($occurrenceQuery . $distributionQuery);
253 254
  }
254 255

  
255
  _add_js_openlayers_map($map_settings, $event_listeners, $resizable);
256
  _add_js_openlayers_map($map_id, $map_settings, $event_listeners, $resizable);
256 257

  
257
  $out = '<div id="' . $map_id . '" class="openlayers-container openlayers_width ui-widget-content" style="width: 100%;">';
258
  $out .= '<div id="openlayers_map" class="smallmap" style="width:100%; height:100%; margin: 10px;"';
258
  $out = '<div id=""openlayers-container-' . $map_id . '" class="openlayers-container openlayers_width ui-widget-content" style="width: 100%;">';
259
  $out .= '<div id="openlayers-map-' . $map_id . '" class="smallmap" style="width:100%; height:100%; margin: 10px;"';
259 260

  
260 261
  // Additional query parameters as set in the data portal admin section.
261 262
  $labels_on = $map_settings['show_labels'];

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)