Project

General

Profile

« Previous | Next » 

Revision ba706bf0

Added by Andreas Kohlbecker about 11 years ago

solving #3254 (geoserver hardcoded in openlayers_map.js)

View differences:

7.x/modules/cdm_dataportal/cdm_dataportal.module
147 147
    drupal_add_js('http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.1', array('type' => 'external'));
148 148
  }
149 149

  
150
  $edit_map_service = get_edit_map_service_settings();
150 151
  // window.onload - is executed when the document and images etc is fully loaded
151 152
  // Query(document).ready - is executed much earlier, when the DOM is loaded
152 153
  drupal_add_js("
......
154 155

  
155 156
                window.onload = function () {
156 157
    			  // ---
157
                  jQuery('#openlayers_map').cdm_openlayers_map('"
158
                  . getEDITMapServiceURI() . "', {
158
                  jQuery('#openlayers_map').cdm_openlayers_map(
159
                   '" . $edit_map_service['base_uri'] . "',
160
                   '" . $edit_map_service['version'] . "',
161
                   {
159 162
                    legendPosition: 3,
160 163
                    displayWidth: '" . variable_get('cdm_dataportal_geoservice_display_width', FALSE) . "',
161 164
                    boundingBox: '" . variable_get('cdm_dataportal_geoservice_bounding_box', FALSE) . "',
......
164 167
                    showLayerSwitcher: " . (variable_get('cdm_dataportal_geoservice_showLayerSwitcher', TRUE) ? 'true' : 'false') . ",
165 168
                    baseLayerNames: [" . $layerNames . "],
166 169
                    defaultBaseLayerName: '" . $preferredLayer . "',
167
               	  });
168
               	  // ---
169
				};
170
               	  }
171
                );
172
               	// ---
173
			  };
170 174
          });
171 175
        ", array('type' => 'inline'));
172 176

  
......
186 190
 */
187 191
function get_image_map($width, $bounding_box = FALSE, $occurrenceQuery = FALSE, $distributionQuery = FALSE, $legendFormatQuery = FALSE, $map_caption = FALSE) {
188 192

  
189
  $server = getEDITMapServiceURI();
190

  
191
  if (!$server) {
192
    // Warning message.
193
    drupal_set_message(t(
194
      "No 'Geoservice Access Point' has been set so far.
195
      Please configure the variable 'Geoservice Access Point' here !url", array(
196
        '!url' => l(t('CDM Dataportal Settings'), 'admin/config/cdm_dataportal/geo'),
197
      )), 'warning');
198

  
199
    // Message to render.
200
    return '<p>' . t('No geoservice specified') . '</p>';
201
  }
202

  
203 193
  // Additional query parameters as set in the data portal admin section.
204 194
  $labels_on = variable_get('cdm_dataportal_geoservice_labels_on', 0);
205 195

  
......
211 201
    $query_string .= '&mlp=3&mc_s=Georgia,15,blue&mc=' . $map_caption;
212 202
  }
213 203

  
214
  if (getEDITMapServiceVersionNumber() >= 1.1) {
204
  if (get_edit_map_service_version_number() >= 1.1) {
215 205

  
216 206
    // Either occurrence or distribution - combined maps will be possible
217 207
    // in the future.
......
307 297
    }
308 298
  }
309 299

  
310
  $mapUri = url("$server/$map_service_script_name?$query_string");
300
  $mapUri = url(get_edit_map_service_full_uri() . '/' . $map_service_script_name . '?' .  $query_string);
311 301
  $out = '<img class="distribution_map" src="' . $mapUri . '" alt="Map" />';
312 302
  // Showing map caption.
313 303
  if ($map_caption) {

Also available in: Unified diff