Project

General

Profile

« Previous | Next » 

Revision cc3c9807

Added by Andreas Kohlbecker over 10 years ago

refactoring map settings and rendering

View differences:

7.x/modules/cdm_dataportal/cdm_api/cdm_api.module
2120 2120
 * @see http://us3.php.net/manual/en/ref.array.php
2121 2121
 *
2122 2122
 * @param array $array
2123
 * @param array $copy
2123
 * @param array $copy passed by reference
2124 2124
 * @param int $maxdepth
2125 2125
 * @param int $depth
2126
 *
2127
 * @return void
2128 2126
 */
2129 2127
function array_deep_copy(&$array, &$copy, $maxdepth = 50, $depth = 0) {
2130 2128
  if ($depth > $maxdepth) {
7.x/modules/cdm_dataportal/cdm_dataportal.install
128 128
 *  - migrating variable cdm_dataportal_show_default_image to cdm_taxon_profile_image['show']
129 129
 *  - enabling required module file
130 130
 *  - enable new debug block for all dataportals
131
 *  - migrating variables for map settings
131 132
 */
132 133
function cdm_dataportal_update_7304() {
133 134

  
......
230 231
    $tasks_performed[] = _remove_variable('cdm_webservice_debug');
231 232
    $tasks_performed[] = _remove_variable('cdm_webservice_isStub');
232 233

  
234
    /*
235
     *  migrating variables for map settings
236
     */
237
    $cdm_map_distribution = array();
238

  
239
    $cdm_map_distribution['width'] = variable_get('cdm_dataportal_geoservice_display_width', 390);
240
    $cdm_map_distribution['height'] = $cdm_map_distribution['width'] / 2;
241
    _remove_variable('cdm_dataportal_geoservice_display_width');
242

  
243
    $cdm_map_distribution['bbox'] = variable_get('cdm_dataportal_geoservice_bounding_box', '-180,-90,180,90');
244
    _remove_variable('cdm_dataportal_geoservice_bounding_box');
245

  
246
    $cdm_map_distribution['show_labels'] = variable_get('cdm_dataportal_geoservice_labels_on', FALSE);
247
    _remove_variable('cdm_dataportal_geoservice_labels_on');
248

  
249
    $cdm_map_distribution['caption'] = variable_get('cdm_dataportal_geoservice_map_caption', '');
250
    _remove_variable('cdm_dataportal_geoservice_map_caption');
251

  
252
    $cdm_map_distribution['distribution_opacity'] = variable_get('cdm_dataportal_geoservice_distributionOpacity', '0.5');
253
    _remove_variable('cdm_dataportal_geoservice_distributionOpacity');
254

  
255
    $cdm_map_distribution['mapType'] = variable_get('cdm_dataportal_map_openlayers', 1);
256
    _remove_variable('cdm_dataportal_map_openlayers');
257

  
258
    // imageMap
259
    $cdm_map_distribution['image_map'] = array();
260
    $cdm_map_distribution['image_map']['base_layer']= variable_get('map_base_layer', 'cyprusdivs');
261
    _remove_variable('map_base_layer');
262

  
263
    $cdm_map_distribution['image_map']['bg_color'] = variable_get('map_bg_color', '1874CD');
264
    _remove_variable('map_bg_color');
265

  
266
    $cdm_map_distribution['image_map']['layer_style'] = variable_get('map_base_layer_style', 'ffffff,606060,,');
267
    _remove_variable('map_base_layer_style');
268

  
269
    // OpenLayers
270
    $cdm_map_distribution['openlayers'] = array();
271
    $cdm_map_distribution['openlayers']['base_layers'] = variable_get('baselayers', array('osgeo_vmap0' => 'osgeo_vmap0', 'PREFERRED' => 'osgeo_vmap0'));
272
    _remove_variable('baselayers');
273

  
274
    $cdm_map_distribution['openlayers']['show_layer_switcher'] = variable_get('cdm_dataportal_geoservice_showLayerSwitcher', TRUE);
275
    _remove_variable('cdm_dataportal_geoservice_showLayerSwitcher');
276

  
277
    $cdm_map_distribution['legend'] = array();
278
    $cdm_map_distribution['legend']['show'] = variable_get('cdm_dataportal_geoservice_legend_on', TRUE);
279
    _remove_variable('cdm_dataportal_geoservice_legend_on');
280

  
281
    $cdm_map_distribution['legend']['opacity'] = variable_get('cdm_dataportal_geoservice_legendOpacity', '0.5');
282
    _remove_variable('cdm_dataportal_geoservice_legendOpacity');
283

  
284
    $cdm_map_distribution['legend']['font_size'] = variable_get('cdm_dataportal_geoservice_legend_font_size', 10);
285
    _remove_variable('cdm_dataportal_geoservice_legend_font_size');
286

  
287
    $cdm_map_distribution['legend']['font_style'] = variable_get('cdm_dataportal_geoservice_legend_font_style', FALSE);
288
    _remove_variable('cdm_dataportal_geoservice_legend_font_style');
289

  
290
    $cdm_map_distribution['legend']['icon_width'] = variable_get('cdm_dataportal_geoservice_legend_icon_width', 35);
291
    _remove_variable('cdm_dataportal_geoservice_legend_icon_width');
292

  
293
    $cdm_map_distribution['legend']['icon_height'] = variable_get('cdm_dataportal_geoservice_legend_icon_height', 15);
294
    _remove_variable('cdm_dataportal_geoservice_legend_icon_height');
295

  
296
    variable_set('cdm_map_distribution', $cdm_map_distribution);
297
    $tasks_performed[] =  'variables for map settings migrated to new variable "cdm_map_distribution"';
298

  
233 299
    return  join(', ',$tasks_performed);
234 300
}
235 301

  
7.x/modules/cdm_dataportal/cdm_dataportal.module
122 122
      'cache' => FALSE,
123 123
    )
124 124
  );
125
// TODO remove if not needed (Andreas Kohlbecker 30.07.2013)
125 126
//   drupal_add_js(drupal_get_path('module', 'cdm_dataportal') . $proj4js,
126 127
//     array(
127 128
//       'type' => 'file',
7.x/modules/cdm_dataportal/includes/maps.inc
44 44
 * @return array
45 45
 *    A drupal render array
46 46
 *
47
 * Similar compose function compose_distribution_map()
48
 *
47 49
 * @ingroup compose
48 50
 */
49 51
function compose_map($occurrence_query, $distribution_query, $legend_format_query, array $event_listeners = array()) {
50 52

  
51
  if (variable_get('cdm_dataportal_map_openlayers', 1)) {
53
  $map_settings = get_array_variable_merged(CDM_MAP_DISTRIBUTION, CDM_MAP_DISTRIBUTION_DEFAULT);
54
  if ($map_settings['map_type'] == 1) {
52 55
    $map_html = get_openlayers_map(
53
        variable_get('cdm_dataportal_geoservice_display_width', 680),
54
        variable_get('cdm_dataportal_geoservice_bounding_box', FALSE),
56
        $map_settings['width'],
57
        $map_settings['height'],
58
        $map_settings['bbox'],
55 59
        $occurrence_query,
56 60
        $distribution_query,
57 61
        $legend_format_query,
58
        variable_get('cdm_dataportal_geoservice_map_caption', ''),
62
        $map_settings['caption'],
59 63
        $event_listeners
60 64
    );
61 65
  }
62 66
  else {
63 67
    $map_html = get_image_map(
64
        variable_get('cdm_dataportal_geoservice_display_width', 680),
65
        variable_get('cdm_dataportal_geoservice_bounding_box', FALSE),
68
        $map_settings['width'],
69
        $map_settings['height'],
70
        $map_settings['bbox'],
66 71
        $occurrence_query,
67 72
        $distribution_query,
68 73
        $legend_format_query,
69
        variable_get('cdm_dataportal_geoservice_map_caption', '')
74
        $map_settings['caption']
70 75
    );
71 76
  }
72 77
  return markup_to_render_array($map_html, 0);
......
91 96

  
92 97
  _add_js_openlayers();
93 98

  
99
  $map_settings = get_array_variable_merged(CDM_MAP_DISTRIBUTION, CDM_MAP_DISTRIBUTION_DEFAULT);
100
  $baseLayers = $map_settings['openlayers']['base_layers'];
101
  $gmap_api_key = variable_get('gmap_api_key', 'ABQIAAAAFho6eHAcUOTHLmH9IYHAeBRi_j0U6kJrkFvY4-OX2XYmEAa76BTsyMmEq-tn6nFNtD2UdEGvfhvoCQ');
102

  
94 103
  drupal_add_js(drupal_get_path('module', 'cdm_dataportal') . '/js/map/openlayers_map.js');
95 104
  drupal_add_js(drupal_get_path('module', 'cdm_dataportal') . '/js/map/openlayers_layers.js');
96 105

  
97
  $gmap_api_key = variable_get('gmap_api_key', 'ABQIAAAAFho6eHAcUOTHLmH9IYHAeBRi_j0U6kJrkFvY4-OX2XYmEAa76BTsyMmEq-tn6nFNtD2UdEGvfhvoCQ');
98 106

  
99
  $baseLayers = variable_get('baselayers', array());
100 107
  if (!is_array($baseLayers) || count($baseLayers) == 0) {
101 108
    $baseLayers = array(
102 109
        'metacarta_vmap0' => 'Metacarta Vmap0',
......
142 149
                   '" . $edit_map_service['version'] . "',
143 150
                   {
144 151
                    legendPosition: 3,
145
                    boundingBox: '" . variable_get('cdm_dataportal_geoservice_bounding_box', FALSE) . "',
146
                    distributionOpacity: '" . variable_get('cdm_dataportal_geoservice_distributionOpacity', '0.5') . "',
147
                    legendOpacity: '" . variable_get('cdm_dataportal_geoservice_legendOpacity', '0.5') . "',
148
                    showLayerSwitcher: " . (variable_get('cdm_dataportal_geoservice_showLayerSwitcher', TRUE) ? 'true' : 'false') . ",
152
                    boundingBox: '" . $map_settings['bbox'] . "',
153
                    distributionOpacity: '" . $map_settings['distribution_opacity'] . "',
154
                    legendOpacity: '" . $map_settings['legend']['opacity'] . "',
155
                    showLayerSwitcher: " . ($map_settings['openlayers']['show_layer_switcher'] ? 'true' : 'false') . ",
149 156
                    baseLayerNames: [" . $layerNames . "],
150 157
                    defaultBaseLayerName: '" . $preferredLayer . "'
151 158
                   }
......
186 193
 * @return String
187 194
 *    rendered html
188 195
 */
189
function get_openlayers_map($width, $bounding_box = FALSE, $occurrenceQuery = FALSE, $distributionQuery = FALSE, $legendFormatQuery = FALSE, $map_caption = FALSE, array $event_listeners = array()) {
196
function get_openlayers_map($width, $height, $bounding_box = FALSE, $occurrenceQuery = FALSE, $distributionQuery = FALSE, $legendFormatQuery = FALSE, $map_caption = FALSE, array $event_listeners = array()) {
190 197

  
191 198
  _add_js_openlayers_map($event_listeners);
192 199

  
200
  $map_settings = get_array_variable_merged(CDM_MAP_DISTRIBUTION, CDM_MAP_DISTRIBUTION_DEFAULT);
201

  
193 202
  $out = '<div id="openlayers">';
194 203
  $out .= '<div id="openlayers_map" class="smallmap"';
195 204
  if($width) {
196
    $out .= ' style="width: ' . $width . 'px; height:' . ($width / 2) . 'px"';
205
    if(!$height){
206
      $height = $width / 2;
207
    }
208
    $out .= ' style="width: ' . $width . 'px; height:' . $height . 'px"';
197 209
  }
198 210

  
199 211
  // Additional query parameters as set in the data portal admin section.
200
  $labels_on = variable_get('cdm_dataportal_geoservice_labels_on', 0);
212
  $labels_on = $map_settings['show_labels'];
201 213

  
202 214
  $openlayers_map_query_string = '&img=false&ms=' . $width
203 215
  . ($bounding_box ? '&bbox=' . $bounding_box : '')
......
248 260
* @return String
249 261
 *    rendered html
250 262
 */
251
function get_image_map($width, $bounding_box = FALSE, $occurrenceQuery = FALSE, $distributionQuery = FALSE, $legendFormatQuery = FALSE, $map_caption = FALSE) {
263
function get_image_map($width, $height= NULL, $bounding_box = FALSE, $occurrenceQuery = FALSE, $distributionQuery = FALSE, $legendFormatQuery = FALSE, $map_caption = FALSE) {
252 264

  
253
  // Additional query parameters as set in the data portal admin section.
254
  $labels_on = variable_get('cdm_dataportal_geoservice_labels_on', 0);
265
  $map_settings = get_array_variable_merged(CDM_MAP_DISTRIBUTION, CDM_MAP_DISTRIBUTION_DEFAULT);
255 266

  
256
  $query_string = '&image=true&recalculate=false&legend=1&ms=' . $width
267
  $query_string = '&image=true&recalculate=false&legend=1&ms=' . $width . ($height ? ',' . $height : '')
268
  // Additional query parameters as set in the data portal admin section.
257 269
  . ($bounding_box ? '&bbox=' . $bounding_box : '')
258
  . ($labels_on ? '&label=' . $labels_on : '');
270
  . ($map_settings['show_labels'] ? '&label=' . $map_settings['show_labels'] : '');
259 271

  
260 272
  if ($map_caption) {
261 273
    $query_string .= '&mlp=3&mc_s=Georgia,15,blue&mc=' . $map_caption;
......
300 312
    $additional_area_styles = array();
301 313

  
302 314
    // Background color:
303
    if (variable_get('map_bg_color', '')) {
315
    if ($map_settings['image_map']['bg_color'] ) {
304 316
      $bgcolor_layer = "background_gis:" . $bgcolor_areaStyleId;
305
      $additional_area_styles[] = $bgcolor_areaStyleId . ":" . variable_get('map_bg_color', '') . ",,";
317
      $additional_area_styles[] = $bgcolor_areaStyleId . ":" . $map_settings['image_map']['bg_color'] . ",,";
306 318
    }
307 319

  
308 320
    // TODO HACK to replace the default base layer which currently is tdwg4 !!!
......
319 331
    else {
320 332
      $areystyle_param_token = "&as=";
321 333
    }
322
    if (variable_get('map_base_layer', '')) {
323
      $query_string = str_replace($layer_param_token . "tdwg4", "$layer_param_token" . variable_get('map_base_layer', '') . ":" . $baselayer_areaStyleId, $query_string);
334
    if ($map_settings['image_map']['base_layer']) {
335
      $query_string = str_replace($layer_param_token . "tdwg4", "$layer_param_token" . $map_settings['image_map']['base_layer'] . ":" . $baselayer_areaStyleId, $query_string);
324 336
    }
325 337
    else {
326 338
      $query_string = str_replace($layer_param_token . "tdwg4", $layer_param_token . "tdwg4:" . $baselayer_areaStyleId . ",", $query_string);
......
330 342
      $query_string = str_replace($layer_param_token, $layer_param_token . $bgcolor_layer . ",", $query_string);
331 343
    }
332 344

  
333
    if (variable_get('map_base_layer_style', '')) {
334
      $additional_area_styles[] = $baselayer_areaStyleId . ":" . variable_get('map_base_layer_style', '');
345
    if ($map_settings['image_map']['layer_style']) {
346
      $additional_area_styles[] = $baselayer_areaStyleId . ":" . $map_settings['image_map']['layer_style'];
335 347
    }
336 348

  
337 349
    foreach ($additional_area_styles as $as) {
7.x/modules/cdm_dataportal/js/map/openlayers_layers.js
36 36
                  EPSG:900913
37 37
             */
38 38
            return  new OpenLayers.Layer.WMS(
39
                  "Metacarta Vmap0",
39
                  "OSGEO Vmap0",
40 40
                  "http://vmap0.tiles.osgeo.org/wms/vmap0",
41 41
                  {layers: 'basic', format:"png"},
42 42
                  {
43
                maxExtent: window.CdmOpenLayers.mapExtends.epsg_4326,
44
                projection: new OpenLayers.Projection("EPSG:4326"),
45
                isBaseLayer: true,
46
                displayInLayerSwitcher: true
47
              }
48
            );
43
                    maxExtent: window.CdmOpenLayers.mapExtends.epsg_4326,
44
                    projection: new OpenLayers.Projection("EPSG:4326"),
45
                    isBaseLayer: true,
46
                    displayInLayerSwitcher: true
47
                  }
48
                );
49 49

  
50
          case 'edit-etopo1':
50
         /**
51
          * TODO unused, can be deleted?
52
          */
53
         case 'edit-etopo1':
51 54
            return  new OpenLayers.Layer.WMS(
52 55
                  "ETOPO1 Global Relief Model",
53 56
                  "http://edit.br.fgov.be:8080/geoserver/wms",
54 57
                  {layers: 'topp:color_etopo1_ice_full', format:"image/png"},
55 58
                  {
56
                maxExtent: window.CdmOpenLayers.mapExtends.epsg_4326,
57
                projection: new OpenLayers.Projection("EPSG:4326"),
58
                isBaseLayer: true,
59
                displayInLayerSwitcher: true
60
              }
61
            );
59
                    maxExtent: window.CdmOpenLayers.mapExtends.epsg_4326,
60
                    projection: new OpenLayers.Projection("EPSG:4326"),
61
                    isBaseLayer: true,
62
                    displayInLayerSwitcher: true
63
                  }
64
                );
62 65

  
63
          case 'edit-vmap0_world_basic':
66
        /**
67
         * TODO unused, can be deleted?
68
         */
69
        case 'edit-vmap0_world_basic':
64 70
            return  new OpenLayers.Layer.WMS(
65 71
                  "EDIT Vmap0",
66 72
                  "http://edit.br.fgov.be:8080/geoserver/wms",
......
197 203

  
198 204
})();
199 205

  
200
//TODO remove below lines before release
201
//var layerdef = {
202
//      /**
203
//       * NOTE: labs.metacarta.com is currently unavailable
204
//       *
205
//       * Available Projections:
206
//       *     EPSG:900913
207
//       *     EPSG:4326
208
//       */
209
//      metacarta_vmap0: new OpenLayers.Layer.WMS(
210
//              "Metacarta Vmap0",
211
//              "http://labs.metacarta.com/wms/vmap0",
212
//              {layers: "basic", format:"png"},
213
//              {
214
//                  maxExtent: window.CdmOpenLayers.mapExtends.epsg_4326,
215
//                  projection: window.CdmOpenLayers.projections.epsg_4326,
216
//                  isBaseLayer: true,
217
//                  displayInLayerSwitcher: true
218
//              }
219
//        ),
220
//
221
//      osgeo_vmap0: {
222
//          create: function(){
223
//              this.layer = new OpenLayers.Layer.WMS(
224
//                  this.name,
225
//                  "http://vmap0.tiles.osgeo.org/wms/vmap0",
226
//                  {layers: 'basic', format:"png"},
227
//                  {
228
//                    maxExtent: CdmOpenLayers.mapExtends.epsg_4326,
229
//                    projection: new OpenLayers.Projection("EPSG:4326"),
230
//                    isBaseLayer: true,
231
//                    displayInLayerSwitcher: true
232
//                  });
233
//          },
234
//          layer: null,
235
//          name: "OSGEO Vmap0",
236
//          description: ""
237
//      }
238
//};
239

  
240
///**
241
// * initialize all layers for testing
242
// */
243
//window.CdmOpenLayers.availableLayers.createAllLayers();
244

  
7.x/modules/cdm_dataportal/js/map/openlayers_map.js
29 29
        baseLayerNames: ["osgeo_vmap0"],
30 30
        defaultBaseLayerName: 'osgeo_vmap0',
31 31
        maxZoom: 4,
32
        minZoom: 0
32
        minZoom: 0,
33
        /**
34
         * allows the map to display parts of the layers which are outside
35
         * the maxExtent if the aspect ratio of the map and of the baselayer
36
         * are not equal
37
         */
38
        displayOutsideMaxExtent: true,
39
        customWMSBaseLayerData: {
40
            name: "Euro+Med",
41
            url: "http://edit.africamuseum.be/geoserver/topp/wms",
42
            params: {layers: "topp:em_tiny_jan2003", format:"image/png", tiled: true},
43
            projection: "EPSG:7777777",
44
            maxExtent: "-1600072.75, -1800000, 5600000, 5850093",
45
            unit: 'm'
46
        }
33 47
    };
34 48
})(jQuery);
35 49

  
......
64 78
            projections: projections,
65 79
            mapExtends: mapExtends,
66 80
            getLayerByName: function(layerName){} // initially empty fuction, will be populated by openlayers_layers.js
67
// TODO remove below lines before release
68
//            availableLayers: {
69
//
70
//                layers: {}, // initially empty, will be populated by openlayers_layers.js
71
//
72
//                createAllLayers: function() {
73
//                    for (var key in this.layers) {
74
//                        if (this.layers.hasOwnProperty(key)){
75
//                            var layer = this.layers[key];
76
//                            layer.create();
77
//                        };
78
//                    };
79
//                }
80
//            }
81 81
    };
82 82

  
83 83
})(); // end of namespace definition for CdmOpenLayers
......
119 119
             new OpenLayers.Control.Navigation({zoomWheelEnabled: false, handleRightClicks:true, zoomBoxKeyMask: OpenLayers.Handler.MOD_CTRL})
120 120
           ];
121 121

  
122
    var dataProj = new OpenLayers.Projection("EPSG:4326");
122
//    var dataProj = new OpenLayers.Projection("EPSG:4326");
123 123

  
124 124
    var dataLayerOptions = {
125
        maxExtent: window.CdmOpenLayers.mapExtends.epsg_900913,
126 125
        isBaseLayer: false,
127 126
        displayInLayerSwitcher: true
128 127
    };
......
139 138
     */
140 139
    this.init = function(){ // public function
141 140

  
142
      createLayers(options.baseLayerNames, options.defaultBaseLayerName);
141
      createLayers(options.baseLayerNames, options.defaultBaseLayerName, options.customWMSBaseLayerData);
143 142

  
144
      initOpenLayers();
143
      initMap();
145 144

  
146 145
      // -- Distribution Layer --
147 146
      var mapServiceRequest;
......
228 227

  
229 228
        var info = "<dl>";
230 229
        info += "<dt>zoom:<dt><dd>" + map.getZoom() + "</dd>";
231
        info += "<dt>resolution:<dt><dd>" + map.getResolution() + "</dd>";
232
        info += "<dt>max resolution:<dt><dd>" + map.getMaxResolution() + "</dd>";
233
        info += "<dt>scale:<dt><dd>" + map.getScale() + "</dd>";
234
        info += "<dt>extend bbox:<dt><dd>" + map.getExtent().toBBOX() + " (" + mapExtendDegree.toBBOX() + ")</dd>";
235
        info += "<dt>maxExtend bbox:<dt><dd>" + map.getMaxExtent().toBBOX() + "</dd>";
230
        info += "<dt>map resolution:<dt><dd>" + map.getResolution() + "</dd>";
231
        info += "<dt>map max resolution:<dt><dd>" + map.getMaxResolution() + "</dd>";
232
        info += "<dt>map scale:<dt><dd>" + map.getScale() + "</dd>";
233
        info += "<dt>map extent bbox:<dt><dd>" + map.getExtent().toBBOX() + " (" + mapExtendDegree.toBBOX() + ")</dd>";
234
        info += "<dt>map maxExtent bbox:<dt><dd>" + map.getMaxExtent().toBBOX() + "</dd>";
236 235
        info += "<dt>baselayer projection:<dt><dd>" + map.baseLayer.projection.getCode() + "</dd>";
237 236
        info += "</dl>";
238 237

  
......
244 243
    };
245 244

  
246 245
    /**
247
     * Initialize the Openlayers viewer with the base layer
246
     * Initialize the Openlayers Map with the base layer
248 247
     */
249
    var initOpenLayers = function(){
248
    var initMap = function(){
250 249

  
251 250

  
252 251
      if(options.showLayerSwitcher === true){
253 252
          defaultControls.push(new OpenLayers.Control.LayerSwitcher({'ascending':false}));
254 253
      }
255 254

  
256
//      var maxExtendByAspectRatio = cropBoundsToAspectRatio(defaultBaseLayer.maxExtent, mapWidth/mapHeight);
255
//      var maxExtentByAspectRatio = cropBoundsToAspectRatio(defaultBaseLayer.maxExtent, mapWidth/mapHeight);
257 256
      var maxResolution = null;
257
      // gmaps has no maxExtent at this point, need to check for null
258 258
      if(defaultBaseLayer.maxExtent != null){
259
          // gmaps has no maxExtend at this point
260
          maxResolution = defaultBaseLayer.maxExtent.getWidth()/ mapWidth;
259
          maxResolution = Math[(options.displayOutsideMaxExtent ? 'max' : 'min')](
260
                      defaultBaseLayer.maxExtent.getWidth() / mapWidth,
261
                      defaultBaseLayer.maxExtent.getHeight() / mapHeight
262
                    );
261 263
      }
262

  
263
      console.log("maxResolution: " + maxResolution);
264
//      console.log("restrictedExtent: " + maxExtendByAspectRatio.toBBOX());
264
      console.log("mapOptions.maxResolution: " + maxResolution);
265
      console.log("mapOptions.restrictedExtent: " + defaultBaseLayer.maxExtent);
265 266

  
266 267
      map = new OpenLayers.Map(
267 268
          "openlayers_map",
......
270 271
              controls: defaultControls,
271 272

  
272 273
              // maxResolution determines the lowest zoom level and thus places the map
273
              // in its maximum extend into the available view port so that no additinal
274
              // in its maximum extent into the available view port so that no additinal
274 275
              // gutter is visible and no parts of the map are hidden
275 276
              // see http://trac.osgeo.org/openlayers/wiki/SettingZoomLevels
277
              // IMPORTANT!!!
278
              // the maxResulution set here will be overwritten if the baselayers maxResolution
279
              // it is set
276 280
              maxResolution: maxResolution,
277 281

  
278
              // setting restrictedExtent the the maxExtend prevents from panning the
282
              // setting restrictedExtent the the maxExtent prevents from panning the
279 283
              // map out of its bounds
280 284
              restrictedExtent: defaultBaseLayer.maxExtent,
281 285
//              maxExtent: defaultBaseLayer.maxExtent,
......
296 300
      map.addLayers(baseLayers);
297 301
      map.setBaseLayer(defaultBaseLayer);
298 302

  
303
      // calculate the bounds to zoom to
299 304
      zoomToBounds = zoomToBoundsFor(options.boundingBox, defaultBaseLayer);
300

  
301 305
      zoomToBounds = cropBoundsToAspectRatio(zoomToBounds, map.getSize().w / map.getSize().h);
302

  
303

  
304 306
      console.log("zoomToBounds: " + zoomToBounds);
305 307

  
306
      // zoom to the extend of the bbox
308
      // zoom to the extent of the bbox
307 309
      map.zoomToExtent(zoomToBounds, true);
308 310

  
309 311
      // readjust if the zoom level is out side of the min max
310
      if(map.getZoom() > options.maxZoom){
311
        map.zoomTo(options.maxZoom);
312
      } else if(map.getZoom() < options.minZoom){
313
        map.zoomTo(options.minZoom);
314
      }
312
//      if(map.getZoom() > options.maxZoom){
313
//        map.zoomTo(options.maxZoom);
314
//      } else if(map.getZoom() < options.minZoom){
315
//        map.zoomTo(options.minZoom);
316
//      }
315 317

  
316 318
    };
317 319

  
......
374 376
        // zoom to the required area
375 377
        if(mapResponseObj.bbox !== undefined){
376 378
          var newBounds =  OpenLayers.Bounds.fromString( mapResponseObj.bbox );
379
          newBounds.transform(layer.projection, map.getProjectionObject());
377 380
          if(dataBounds !== null){
378 381
            dataBounds.extend(newBounds);
379 382
          } else if(newBounds !== undefined){
380 383
            dataBounds = newBounds;
381 384
          }
382
          map.zoomToExtent(dataBounds.transform(dataProj, map.getProjectionObject()), false);
385
          map.zoomToExtent(dataBounds, false);
383 386

  
384 387
          if(map.getZoom() > options.maxZoom){
385 388
            map.zoomTo(options.maxZoom);
......
467 470
     /**
468 471
      *
469 472
      */
470
     var createLayers = function( baseLayerNames, defaultBaseLayerName){
471
       for(var i = 0; i <  baseLayerNames.length; i++) {
473
     var createLayers = function( baseLayerNames, defaultBaseLayerName, customWMSBaseLayerData){
474
       var i = 0;
475
       for(; i <  baseLayerNames.length; i++) {
472 476
         baseLayers[i] = window.CdmOpenLayers.getLayerByName(baseLayerNames[i]);
473 477
         if(baseLayerNames[i] == defaultBaseLayerName){
474 478
           defaultBaseLayer = baseLayers[i];
475 479
         }
476 480
       }
481
       if(false && customWMSBaseLayerData){
482
            var wmsLayer = createWMSBaseLayer(
483
                   customWMSBaseLayerData.name,
484
                   customWMSBaseLayerData.url,
485
                   customWMSBaseLayerData.params,
486
                   customWMSBaseLayerData.projection,
487
                   customWMSBaseLayerData.unit,
488
                   OpenLayers.Bounds.fromString(customWMSBaseLayerData.maxExtent)
489
                );
490
           // FIXME remove HACK (customWMSBaseLayerData as default)
491
           baseLayers[i++] = wmsLayer;
492
           defaultBaseLayer = wmsLayer;
493
       }
477 494
     };
478 495

  
479 496
     /**
......
542 559
      * @param layer
543 560
      *     the Openlayers.Layer
544 561
      *
545
      * @return the bboxstring projected onto the layer and intersected with the maximum extend of the layer
562
      * @return the bboxstring projected onto the layer and intersected with the maximum extent of the layer
546 563
      */
547 564
     var zoomToBoundsFor = function(bboxString, layer){
548 565
         var zoomToBounds;
549 566
         if(typeof bboxString == 'string' && bboxString.length > 6) {
550 567
             zoomToBounds = OpenLayers.Bounds.fromString(bboxString);
568
             // transform bounding box given in degree values to the projection of the base layer
569
             zoomToBounds.transform(CdmOpenLayers.projections.epsg_4326, layer.projection);
570
         } else if(layer.maxExtent) {
571
             zoomToBounds = layer.maxExtent;
572
             // no need to transform since the bounds are obtained from the layer
551 573
         } else {
552 574
             zoomToBounds = new OpenLayers.Bounds(-180, -90, 180, 90);
575
             // transform bounding box given in degree values to the projection of the base layer
576
             zoomToBounds.transform(CdmOpenLayers.projections.epsg_4326, layer.projection);
553 577
         }
554
         // transform bounding box given in degree values to the projection of the base layer
555
         zoomToBounds.transform(CdmOpenLayers.projections.epsg_4326, layer.projection);
556 578

  
557 579
         zoomToBounds = intersectionOfBounds(layer.maxExtent, zoomToBounds);
558 580

  
......
576 598
       }
577 599
     };
578 600

  
601
     /**
602
      * Creates a WMS Base layer
603
      * @param String name
604
      *     A name for the layer
605
      * @param String url
606
      *     Base url for the WMS (e.g.  http://wms.jpl.nasa.gov/wms.cgi)
607
      * @param Object params
608
      *     An object with key/value pairs representing the GetMap query string parameters and parameter values.
609
      * @param Object projection
610
      *    A OpenLayers.Projection object
611
      */
612
     var createWMSBaseLayer= function(name, url, params, projection, unit, maxExtent){
613

  
614
         if(maxExtent == null){
615
             maxExtent = CdmOpenLayers.mapExtends.epsg_4326.clone();
616
             maxExtent.transform(CdmOpenLayers.projections.epsg_4326, projection);
617
         }
618

  
619
         return  new OpenLayers.Layer.WMS(
620
                 name,
621
                 url,
622
                 params,
623
                 {
624
                   maxExtent: maxExtent,
625
                   projection: projection,
626
                   unit: unit,
627
                   isBaseLayer: true,
628
                   displayInLayerSwitcher: true
629
                 }
630
               );
631
     };
632

  
579 633
  }; // end of CdmOpenLayers.Map
580 634
})();
581 635

  
7.x/modules/cdm_dataportal/settings.php
236 236
     )
237 237
  ));
238 238

  
239
define('CDM_MAP_DISTRIBUTION', 'cdm_map_distribution');
240
define('CDM_MAP_DISTRIBUTION_DEFAULT', serialize(array(
241
  // needs to be merged with user setting by drupal_array_merge_deep()
242
  'width' => 512, // optimum size for OSM layers is 512
243
  'height' => 512 / 2, // optimum size for OSM layers 256
244
  'bbox' => '', // empty to allow automatic zooming to extend
245
  'show_labels' => FALSE,
246
  'caption' => '',
247
  'distribution_opacity' => '0.5',
248
  'map_type' => 1, //  1 = 'openlayers', 0 = 'image'
249
  'image_map' => array(
250
    'base_layer' => '', // none, formerly this was cyprusdivs
251
    'bg_color' => '1874CD',
252
    'layer_style' => 'ffffff,606060,,',
253
  ),
254
  'openlayers' => array(
255
    'base_layers' =>  array(
256
      // A layer MUST NOT BE SET in the defaults,
257
      // otherwise it can not be overidden by the user settings:
258
      // 'osgeo_vmap0' => 'osgeo_vmap0',
259
      // it is sufficient to define the preferred layer,
260
      // since it will automatically be enabled:
261
      'PREFERRED' => 'osgeo_vmap0'),
262
    'show_layer_switcher' => TRUE
263
  ),
264
  'legend' => array(
265
    'show' => TRUE,
266
    'opacity' => '0.5',
267
    'font_size' => 10,
268
    'font_style' => FALSE,
269
    'icon_width' => 35,
270
    'icon_height' => 15
271
  )
272
)));
273

  
274
/**
275
 * Merges the named array variable with the array of defaults.
276
 *
277
 * @param string $variable_name
278
 *     The variable name
279
 * @param string | array $default
280
 *     The array containing the default values either as array or serialized as string.
281
 *     Unserialization is cared for if nessecary
282
 * @return array
283
 *     The merged array as returnd by drupal_array_merge_deep()
284
 */
285
function get_array_variable_merged($variable_name, $default){
286

  
287
    // unserialize if nessecary
288
    if(!is_array($default)){
289
      $default = unserialize($default);
290
    }
291
    $variable = variable_get($variable_name, array());
292
    return drupal_array_merge_deep($default, $variable);
293
}
294

  
239 295
/**
240 296
 * @todo document this function.
241 297
 */
242 298
function getGallerySettings($gallery_config_form_name) {
243
  $default_values = unserialize(CDM_DATAPORTAL_GALLERY_SETTINGS);
244
  return variable_get($gallery_config_form_name, $default_values);
299
  return get_array_variable_merged($gallery_config_form_name, CDM_DATAPORTAL_GALLERY_SETTINGS);
245 300
}
246 301

  
247 302
/**
......
1531 1586
 */
1532 1587
function cdm_settings_geo($form, &$form_state) {
1533 1588

  
1589
  $current_geoserver_settings = get_edit_map_service_settings();
1590
  $map_distribution = get_array_variable_merged(CDM_MAP_DISTRIBUTION, CDM_MAP_DISTRIBUTION_DEFAULT);
1591

  
1534 1592
  $form = array();
1535 1593

  
1594
  $dummy_distribution_query = NULL;
1595
  if($map_distribution['map_type'] != 1){
1596
    // we need to apply a dummy query since the map serice requires for image maps
1597
    // at least as and ad to be defined
1598
    $dummy_distribution_query = "as=a:339966&ad=tdwg1:a:1,2,3,4,5,6,7,8,9";
1599
  }
1536 1600
  $form['map_preview'] = array(
1537 1601
      '#type' => 'fieldset',
1538 1602
      '#tree' => FALSE,
1539 1603
      '#title' => t('Map preview'),
1540 1604
      '#collapsible' => FALSE,
1541
      '#description' => t('Preview of the map.'),
1605
      '#description' => 'The preview of the map'
1606
       . ($dummy_distribution_query != null ? ' may not be accurate in case if image maps, please check the map display in the taxon pages.': '.')
1542 1607
  );
1543

  
1544
  $form['map_preview']['map'] = compose_map(NULL, NULL, NULL,
1608
  $form['map_preview']['map'] = compose_map(NULL, $dummy_distribution_query, NULL,
1545 1609
      array(
1546 1610
          'move' => "this.cdmOpenlayersMap.printInfo",
1547 1611
          '#execute' => "this.cdmOpenlayersMap.printInfo"
1548 1612
      )
1549 1613
  );
1550 1614

  
1615

  
1551 1616
  /*
1552 1617
   * GEO SERVER
1553 1618
   */
......
1561 1626
      The Geo Server is responsible for generating the maps.'),
1562 1627
  );
1563 1628

  
1564
  $current_geoserver_settings = get_edit_map_service_settings();
1565

  
1566 1629
  $form['edit_map_server']['base_uri'] = array(
1567 1630
    '#type' => 'select',
1568 1631
    '#title' => t('EDIT map service') . ':',
......
1578 1641
      '#description' => t('The version of the EDIT map services'),
1579 1642
  );
1580 1643

  
1644
  $localhostkey = 'ABQIAAAAFho6eHAcUOTHLmH9IYHAeBRi_j0U6kJrkFvY4-OX2XYmEAa76BTsyMmEq-tn6nFNtD2UdEGvfhvoCQ';
1645
  $gmap_api_key = variable_get('gmap_api_key', 'ABQIAAAAFho6eHAcUOTHLmH9IYHAeBRi_j0U6kJrkFvY4-OX2XYmEAa76BTsyMmEq-tn6nFNtD2UdEGvfhvoCQ');
1646
  $form['gmap_api_key'] = array(
1647
      '#type' => 'textfield',
1648
      '#title' => t('Google maps API key') . ':',
1649
      '#default_value' => variable_get('gmap_api_key', $gmap_api_key),
1650
      '#description' => t('If you want to use the Google Maps Layer, a key is
1651
      needed. If you need a key, visit
1652
      <a href="http://code.google.com/intl/en/apis/maps/signup.html">google maps api key</a>.
1653
      <br/><strong>Note:</strong> The following key: <code>!localhostkey</code>
1654
      is the default key for the localhost (127.0.0.1).',
1655
      array('!localhostkey' => $localhostkey)),
1656
  );
1657

  
1658

  
1581 1659
  /*
1582 1660
   * MAP SETTINGS
1583 1661
   */
1584
  $form['map_settings'] = array(
1662

  
1663
  $form[CDM_MAP_DISTRIBUTION] = array(
1585 1664
    '#type' => 'fieldset',
1665
    '#tree' => TRUE,
1586 1666
    '#title' => t('Maps settings'),
1587 1667
    '#collapsible' => TRUE,
1588 1668
    '#collapsed' => TRUE,
1589 1669
    '#description' => t('General configuration for all map types.'),
1590 1670
  );
1591 1671

  
1592
  $form['map_settings']['cdm_dataportal_geoservice_display_width'] = array(
1672
  /*
1673
   * settings for the distribution map are used also for specimens map!!!!
1674
   */
1675

  
1676
  $form[CDM_MAP_DISTRIBUTION]['width'] = array(
1593 1677
    '#type' => 'textfield',
1594
    '#title' => t('Maps width') . ':',
1595
    '#default_value' => variable_get('cdm_dataportal_geoservice_display_width', 390),
1596
    '#description' => 'Choose the width of your maps, the height will always
1597
      be the half of the width. A value of 500 means the size will be 500 pixels
1598
      width and 250 pixels height.To allow OSM baselayers to zoom out to the full extend of the world the map width must be
1678
    '#title' => 'Width',
1679
    '#default_value' => $map_distribution['width'],
1680
    '#maxlength' => 4,
1681
    '#size' => 4,
1682
    '#description' => 'Width of the map. To allow OSM baselayers to zoom out to the full extend of the world the map width must be
1599 1683
      a multiple of 256px since the osm tiles from tile.openstreetmap.org have a size of 256px x 256px and frational zoom
1600 1684
      levels are not possible in this case.',
1601 1685
  );
1686
  $form[CDM_MAP_DISTRIBUTION]['height'] = array(
1687
      '#type' => 'textfield',
1688
      '#title' => 'Height',
1689
      '#default_value' => $map_distribution['height'],
1690
      '#maxlength' => 4,
1691
      '#size' => 4,
1692
      '#description' => 'Height of the map. Depending on the chosen base layer you may want to choose the height equal
1693
      to the width or half of the width. Any other aspect ratio is also possible if desired.',
1694
  );
1602 1695

  
1603
  $form['map_settings']['cdm_dataportal_geoservice_bounding_box'] = array(
1696
  $form[CDM_MAP_DISTRIBUTION]['bbox'] = array(
1604 1697
    '#type' => 'textfield',
1605
    '#title' => t('Fixed bounding box') . ':',
1606
    '#default_value' => variable_get('cdm_dataportal_geoservice_bounding_box', '-180,-90,180,90'),
1607
    '#description' => t('Define surrounding of area to be displayed in maps.
1698
    '#title' => 'Bounding box',
1699
    '#default_value' => $map_distribution['bbox'],
1700
    '#description' => t('The bounding box defines the area to be initially displayed in maps.
1608 1701
      Use "-180,-90,180,90" for the whole world. Leave <strong>empty</strong>
1609
      to let the map <strong>automatically zoom</strong> to the distribution
1610
      area.'),
1702
      to let the map <strong>automatically zoom</strong> to the bounds enclosing the shown data.'),
1611 1703
  );
1612 1704

  
1613
  $form['map_settings']['cdm_dataportal_geoservice_labels_on'] = array(
1705
  $form[CDM_MAP_DISTRIBUTION]['show_labels'] = array(
1614 1706
    '#type' => 'checkbox',
1615
    '#title' => '<b>' . t('Display area labels') . '</b>',
1616
    '#default_value' => variable_get('cdm_dataportal_geoservice_labels_on', FALSE),
1617
    '#description' => t('Check this if you like area names to be displayed in the maps. DOES IT WORK???? '),
1707
    '#title' => 'Display area labels',
1708
    '#default_value' => $map_distribution['show_labels'],
1709
    '#description' => t('The map will show name labels of the areas'),
1618 1710
  );
1619 1711

  
1620
  $form['map_settings']['cdm_dataportal_geoservice_map_caption'] = array(
1712
  $form[CDM_MAP_DISTRIBUTION]['caption'] = array(
1621 1713
    '#type' => 'textfield',
1622
    '#title' => t('Map caption') . ':',
1623
    '#default_value' => variable_get('cdm_dataportal_geoservice_map_caption', ''),
1624
    '#description' => t('Define a caption for the map.'),
1714
    '#title' => 'Map caption',
1715
    '#default_value' => $map_distribution['caption'],
1716
    '#description' => t('The caption will be shown below the map.'),
1625 1717
  );
1626 1718

  
1627
  $form['map_settings']['cdm_dataportal_geoservice_distributionOpacity'] = array(
1719
  $form[CDM_MAP_DISTRIBUTION]['distribution_opacity'] = array(
1628 1720
    '#type' => 'textfield',
1629
    '#title' => t('Distribution layer opacity') . ':',
1630
    '#default_value' => variable_get('cdm_dataportal_geoservice_distributionOpacity', '0.5'),
1721
    '#title' => 'Distribution layer opacity',
1722
    '#default_value' => $map_distribution['distribution_opacity'],
1631 1723
    '#description' => t('Valid values range from 0.0 to 1.0. Value 1.0 means the distributions (the countries or regions) will
1632 1724
                           fully visible, while a value near to 0.0 will be not much visible.'),
1633 1725
  );
1634 1726

  
1635
  $form['map_settings']['cdm_dataportal_map_openlayers'] = array(
1727
  $form[CDM_MAP_DISTRIBUTION]['map_type'] = array(
1636 1728
    '#type' => 'radios',
1637
    '#title' => t('Map Viewer') . ':',
1729
    '#title' => 'Map types',
1638 1730
    '#options' => array(
1639
      1 => "OpenLayers dynamic mapviewer",
1731
      1 => "OpenLayers dynamic map viewer",
1640 1732
      0 => "Plain image",
1641 1733
    ),
1642
    '#default_value' => variable_get('cdm_dataportal_map_openlayers', 1),
1643
    '#description' => t('You can choose from two different map viewers:
1644
      <ul><li><em>OpenLayers</em> displays the maps in an interactive viewer
1645
      which allows zooming and panning. If not enabled the maps will consist
1646
      on a static image. If enabled you can configure the default layer
1647
      (background of your maps) below. Only one of them will be rendered.</li>
1648
      <li><em>Plain image</em> displays the map as a plain non interactive
1649
      image.</li></ul>'),
1734
    '#default_value' => $map_distribution['map_type'],
1735
    '#description' => 'Two different map types are available :
1736
      <ul><li><em>OpenLayers</em>: Display the maps in an interactive viewer
1737
      which allows zooming and panning. If enabled you can configure the default layer
1738
      (background of your maps) below.</li>
1739
      <li><em>Plain image</em>: The map will be static non interactive
1740
      image.</li></ul>',
1650 1741
  );
1651

  
1652
  $openLayersEnabled = variable_get('cdm_dataportal_map_openlayers', 1) == 1;
1742
  $open_layers_is_enabled = $map_distribution['map_type'] == 1;
1653 1743

  
1654 1744

  
1655 1745
  // --- Plain Image Settings --- //
1656
  $form['map_image'] = array(
1746
  $form[CDM_MAP_DISTRIBUTION]['image_map'] = array(
1657 1747
    '#type' => 'fieldset',
1658
    '#title' => t('Plain image map settings'),
1748
    '#title' => 'Plain image map settings',
1749
    '#tree' => TRUE,
1659 1750
    '#collapsible' => TRUE,
1660
    '#collapsed' => $openLayersEnabled,
1661
    '#description' => t('The settings in this section are still expertimental
1662
      and can only be used with the EDIT map service version 1.1 or above.'),
1751
    '#collapsed' => $open_layers_is_enabled,
1752
    '#description' => 'The settings in this section are still expertimental
1753
      and can only be used with the EDIT map service version 1.1 or above.',
1663 1754
  );
1664

  
1665 1755
  $edit_mapserver_version = get_edit_map_service_version_number();
1666 1756
  if ($edit_mapserver_version < 1.1) {
1667
    $form['map_image']['#description'] = '<div class="messages warning">' . t("The selected EDIT map service version has to small version number: $edit_mapserver_version") . '</div>'
1668
      . $form['map_image']['#description'];
1757
    $form[CDM_MAP_DISTRIBUTION]['image_map']['#description'] = '<div class="messages warning">' . t("The chosen EDIT map service version ($edit_mapserver_version) is too low, it must be at least 1.1") . '</div>'
1758
      . $form[CDM_MAP_DISTRIBUTION]['image_map']['#description'];
1669 1759
  }
1670 1760

  
1671
  $form['map_image']['map_base_layer'] = array(
1761
  $form[CDM_MAP_DISTRIBUTION]['image_map']['base_layer'] = array(
1672 1762
    '#type' => 'textfield',
1673
    '#title' => t('Background layer') . ':',
1674
    '#default_value' => variable_get('map_base_layer', 'cyprusdivs'),
1763
    '#title' => 'Background layer',
1764
    '#default_value' => $map_distribution['image_map']['base_layer'],
1675 1765
    '#description' => t('Background layer. For available layers inspect !url1 or !url2.', array(
1676
      '!url1' => l(t('deegree-csw'), 'http://edit.africamuseum.be:8080/deegree-csw/md_search.jsp'),
1677
      '!url2' => l(t('geoserver layers'), 'http://edit.africamuseum.be/geoserver/web/'), // http://edit.africamuseum.be/geoserver/rest/layers
1766
      '!url1' => l('deegree-csw', 'http://edit.africamuseum.be:8080/deegree-csw/md_search.jsp'),
1767
      '!url2' => l('geoserver layers', 'http://edit.africamuseum.be/geoserver/web/'),
1678 1768
    )),
1679 1769
  );
1680 1770

  
1681
  $form['map_image']['map_bg_color'] = array(
1771
  $form[CDM_MAP_DISTRIBUTION]['image_map']['bg_color'] = array(
1682 1772
    '#type' => 'textfield',
1683
    '#title' => t('Background color') . ':',
1684
    '#default_value' => variable_get('map_bg_color', '1874CD'),
1773
    '#title' => 'Background color',
1774
    '#default_value' => $map_distribution['image_map']['bg_color'],
1685 1775
  );
1686 1776

  
1687
  $form['map_image']['map_base_layer_style'] = array(
1777
  $form[CDM_MAP_DISTRIBUTION]['image_map']['layer_style'] = array(
1688 1778
    '#type' => 'textfield',
1689
    '#title' => t('Background layer area style') . ':',
1779
    '#title' => 'Background layer style',
1690 1780
     // Only line color by now.
1691
    '#default_value' => variable_get('map_base_layer_style', 'ffffff,606060,,'),
1692
    '#description' => t('Syntax: {Area fill color},{Area stroke color},{Area stroke width},{Area stroke dash style}'),
1781
    '#default_value' => $map_distribution['image_map']['layer_style'],
1782
    '#description' => 'Syntax: {Area fill color},{Area stroke color},{Area stroke width},{Area stroke dash style}',
1693 1783
  );
1694 1784

  
1695 1785

  
1696 1786
  // --- OpenLayers Settings --- //
1697
  $form['openlayers'] = array(
1787
  $form[CDM_MAP_DISTRIBUTION]['openlayers'] = array(
1698 1788
    '#type' => 'fieldset',
1699
    '#title' => t('OpenLayers settings'),
1789
    '#title' => 'OpenLayers settings',
1790
    '#tree' => TRUE,
1700 1791
    '#collapsible' => TRUE,
1701
    '#collapsed' => !$openLayersEnabled,
1792
    '#collapsed' => !$open_layers_is_enabled,
1702 1793
    '#description' => '',
1703 1794
  );
1704 1795

  
1705
  if (!$openLayersEnabled) {
1706
    $form['openlayers']['#description'] = '<div class="messages warning">' . t('The Openlayers viewer is currently not enabled! (see section Maps settings above )') . '</div>'
1707
      . $form['openlayers']['#description'];
1796
  if (!$open_layers_is_enabled) {
1797
    $form[CDM_MAP_DISTRIBUTION]['openlayers']['#description'] = '<div class="messages warning">'
1798
        . 'The Openlayers viewer is currently not enabled! (see section Maps settings above )</div>'
1799
        . $form[CDM_MAP_DISTRIBUTION]['openlayers']['#description'];
1708 1800
  }
1709 1801

  
1710 1802
  $baselayer_options = array(
......
1722 1814
    'gmap' => 'Google Streets',
1723 1815
    'gsat' => 'Google Satellite',
1724 1816
    'ghyb' => 'Google Hybrid',
1725
    'veroad' => 'Virtual Earth Roads',
1726
    'veaer' => 'Virtual Earth Aerial',
1727
    'vehyb' => 'Virtual Earth Hybrid',
1817
//     'veroad' => 'Virtual Earth Roads',
1818
//     'veaer' => 'Virtual Earth Aerial',
1819
//     'vehyb' => 'Virtual Earth Hybrid',
1728 1820
    // 'yahoo' => 'Yahoo Street',
1729 1821
    // 'yahoosat' => 'Yahoo Satellite',
1730 1822
    // 'yahoohyb' => 'Yahoo Hybrid',
1731 1823
  );
1732 1824

  
1733
  $form['openlayers']['baselayers'] = array(
1825
  $form[CDM_MAP_DISTRIBUTION]['openlayers']['base_layers'] = array(
1734 1826
    '#type' => 'checkboxes_preferred',
1735
    '#title' => t('Base Layers') . ':',
1827
    '#title' => 'Base Layers',
1736 1828
    '#options' => $baselayer_options,
1737
    '#default_value' => variable_get('baselayers', array('metacarta_vmap0' => "metacarta_vmap0", 'PREFERRED' => 'metacarta_vmap0')),
1738
    '#description' => t('Choose the baselayer layer you prefer to use as map background in the OpenLayers dynamic mapviewer.'),
1829
    '#default_value' =>  $map_distribution['openlayers']['base_layers'],
1830
    '#description' => 'Choose the baselayer layer you prefer to use as map background in the OpenLayers dynamic mapviewer.',
1739 1831
  );
1740 1832

  
1741 1833
  // cdm_dataportal_geoservice_showLayerSwitcher
1742
  $form['openlayers']['cdm_dataportal_geoservice_showLayerSwitcher'] = array(
1834
  $form[CDM_MAP_DISTRIBUTION]['openlayers']['show_layer_switcher'] = array(
1743 1835
    '#type' => 'checkbox',
1744
    '#title' => '<b>' . t('Show Layer Switcher') . '</b>',
1745
    '#default_value' => variable_get('cdm_dataportal_geoservice_showLayerSwitcher', TRUE),
1746
    '#description' => t('
1747
      The Layer Switcher control displays a table of contents
1836
    '#title' => 'Show Layer Switcher',
1837
    '#default_value' => $map_distribution['openlayers']['show_layer_switcher'],
1838
    '#description' => 'The Layer Switcher control displays a table of contents
1748 1839
      for the map.  This allows the user interface to switch between
1749
      BaseLayers and to show or hide Overlays.  By default the switcher is
1840
      base layers and to show or hide overlays.  By default the switcher is
1750 1841
      shown minimized on the right edge of the map, the user may expand it
1751
      by clicking on the handle.'
1752
    ),
1842
      by clicking on the handle.',
1753 1843
  );
1754 1844

  
1755
  $localhostkey = 'ABQIAAAAFho6eHAcUOTHLmH9IYHAeBRi_j0U6kJrkFvY4-OX2XYmEAa76BTsyMmEq-tn6nFNtD2UdEGvfhvoCQ';
1756
  $gmap_api_key = variable_get('gmap_api_key', 'ABQIAAAAFho6eHAcUOTHLmH9IYHAeBRi_j0U6kJrkFvY4-OX2XYmEAa76BTsyMmEq-tn6nFNtD2UdEGvfhvoCQ');
1757
  $form['openlayers']['gmap_api_key'] = array(
1758
    '#type' => 'textfield',
1759
    '#title' => t('Google maps API key') . ':',
1760
    '#default_value' => variable_get('gmap_api_key', $gmap_api_key),
1761
    '#description' => t('If you want to use the Google Maps Layer, a key is
1762
      needed. If you need a key, visit
1763
      <a href="http://code.google.com/intl/en/apis/maps/signup.html">google maps api key</a>.
1764
      <br/><strong>Note:</strong> The following key: <code>!localhostkey</code>
1765
      is the default key for the localhost (127.0.0.1). The key in use is the
1766
      one above this text.', array('!localhostkey' => $localhostkey)),
1767
  );
1768

  
1769
  $form['cdm_dataportal_geoservice_map_legend'] = array(
1845
  /*
1846
   * Map Legend
1847
   */
1848
  $form[CDM_MAP_DISTRIBUTION]['legend'] = array(
1770 1849
    '#type' => 'fieldset',
1771
    '#title' => t('Map legend'),
1850
    '#title' => 'Map legend',
1851
    '#tree' => TRUE,
1772 1852
    '#collapsible' => TRUE,
1773 1853
    '#collapsed' => TRUE,
1774
    '#description' => t('Configure the maps legend.'),
1854
    '#description' => 'Configure the maps legend.',
1775 1855
  );
1776 1856

  
1777
  $form['cdm_dataportal_geoservice_map_legend']['cdm_dataportal_geoservice_legend_on'] = array(
1857
  $form[CDM_MAP_DISTRIBUTION]['legend']['show'] = array(
1778 1858
    '#type' => 'checkbox',
1779
    '#title' => '<b>' . t('Display a map legend') . '</b>',
1780
    '#default_value' => variable_get('cdm_dataportal_geoservice_legend_on', TRUE),
1781
    '#description' => t('Check this if you like a legend to be displayed with the maps.'),
1859
    '#title' => 'Display a map legend',
1860
    '#default_value' => $map_distribution['legend']['show'],
1861
    '#description' => 'Check this if you like a legend to be displayed with the maps.',
1782 1862
  );
1783 1863

  
1784
  $form['cdm_dataportal_geoservice_map_legend']['cdm_dataportal_geoservice_legendOpacity'] = array(
1864
  $form[CDM_MAP_DISTRIBUTION]['legend']['opacity'] = array(
1785 1865
    '#type' => 'textfield',
1786
    '#title' => t('Legend opacity'),
1787
    '#default_value' => variable_get('cdm_dataportal_geoservice_legendOpacity', '0.5'),
1788
    '#description' => t('Valid values range from 0.0 to 1.0. Value 1.0 means the legend will be fully visible, while a value near
1789
                         to 0.0 will be not much visible.'),
1866
    '#title' => 'Legend opacity',
1867
    '#default_value' => $map_distribution['legend']['opacity'],
1868
    '#description' => 'Valid values range from 0.0 to 1.0. Value 1.0 means the legend will be fully visible, while a value near
1869
                         to 0.0 will be not much visible.',
1790 1870
  );
1791 1871

  
1792
  $form['cdm_dataportal_geoservice_map_legend']['cdm_dataportal_geoservice_legend_font_size'] = array(
1872
  $form[CDM_MAP_DISTRIBUTION]['legend']['font_size'] = array(
1793 1873
    '#type' => 'textfield',
1794
    '#title' => t('Font size'),
1795
    '#default_value' => variable_get('cdm_dataportal_geoservice_legend_font_size', 10),
1796
    '#description' => t('Font size in pixels.'),
1874
    '#title' => 'Font size',
1875
    '#default_value' => $map_distribution['legend']['font_size'],
1876
    '#description' => 'Font size in pixels.',
1797 1877
  );
1798 1878

  
1799 1879
  $fontStyles = array(
1800 1880
    0 => "plane",
1801 1881
    1 => "italic",
1802 1882
  );
1803
  $form['cdm_dataportal_geoservice_map_legend']['cdm_dataportal_geoservice_legend_font_style'] = array(
1883
  $form[CDM_MAP_DISTRIBUTION]['legend']['font_style'] = array(
1804 1884
    '#type' => 'select',
1805
    '#title' => t('Available font styles'),
1806
    '#default_value' => variable_get('cdm_dataportal_geoservice_legend_font_style', FALSE),
1885
    '#title' => 'Available font styles',
1886
    '#default_value' => $map_distribution['legend']['font_style'],
1807 1887
    '#options' => $fontStyles,
1808
    '#description' => t('Select a font style for the map legend.'),
1888
    '#description' => 'Select a font style for the map legend.',
1809 1889
  );
1810 1890

  
1811
  $form['cdm_dataportal_geoservice_map_legend']['cdm_dataportal_geoservice_legend_icon_width'] = array(
1891
  $form[CDM_MAP_DISTRIBUTION]['legend']['icon_width'] = array(
1812 1892
    '#type' => 'textfield',
1813
    '#title' => t('Legend icon width'),
1814
    '#default_value' => variable_get('cdm_dataportal_geoservice_legend_icon_width', 35),
1815
    '#description' => t('Legend icon width in pixels.'),
1893
    '#title' => 'Icon width',
1894
    '#default_value' => $map_distribution['legend']['icon_width'],
1895
    '#description' => 'Legend icon width in pixels.',
1816 1896
  );
1817
  $form['cdm_dataportal_geoservice_map_legend']['cdm_dataportal_geoservice_legend_icon_height'] = array(
1897
  $form[CDM_MAP_DISTRIBUTION]['legend']['icon_height'] = array(
1818 1898
    '#type' => 'textfield',
1819
    '#title' => t('Legend icon height'),
1820
    '#default_value' => variable_get('cdm_dataportal_geoservice_legend_icon_height', 15),
1821
    '#description' => t('Legend icon height in pixels.'),
1899
    '#title' => 'Icon height',
1900
    '#default_value' => $map_distribution['legend']['icon_height'],
1901
    '#description' => 'Legend icon height in pixels.',
1822 1902
  );
1823 1903

  
1824 1904
  // @WA: D7 form api does not support reset buttons,
......
2066 2146
  // First of all create checkboxes for each of the elements
2067 2147
  $element = form_process_checkboxes($element);
2068 2148

  
2149
  // compose the element name
2150
  $parents = array();
2151
  array_deep_copy($element['#parents'], $parents);
2152
  $parents[count($parents) -1 ] .= '_preferred';
2153
  $element_name = $parents[0];
2154
  for ($i=1; $i < count($parents); $i++){
2155
    $element_name .= '[' . $parents[$i] . ']';
2156
  }
2157

  
2069 2158
  $children = element_children($element);
2070 2159

  
2071 2160
  $element['table_start'] = array(
......
2093 2182
      if (!isset($element[$key . '_preferred'])) {
2094 2183
        $element[$key . '_preferred'] = array(
2095 2184
          '#type' => 'radio',
2096
          '#name' => $element['#parents'][0] . '_preferred',
2185
          '#name' => $element_name,
2097 2186
          '#return_value' => check_plain($key),
2098 2187
          '#default_value' => empty($element['#default_value_2']) ? NULL : $element['#default_value_2'],
2099 2188
          '#attributes' => $element['#attributes'],
......
2138 2227
 *
2139 2228
 * @see http://api.drupal.org/api/drupal/developer!topics!forms_api_reference.html/7#after_build
2140 2229
 *
2141
 * @param $form
2230
 * @param $element
2142 2231
 *   Nested array of form elements that comprise the form.
2143 2232
 * @param $form_state
2144 2233
 *   A keyed array containing the current state of the form.
2234
 *   This includes the current persistent storage data for the form.
2235
 *   Additional information, like the sanitized $_POST data,
2236
 *   is also accumulated here in $form_state['input']
2145 2237
 *
2146 2238
 * @return the modified form array
2147 2239
 */
2148
function checkboxes_preferred_after_build($form, &$form_state) {
2240
function checkboxes_preferred_after_build($element, &$form_state) {
2149 2241

  
2150
  $parent_id = $form['#parents'][0];
2242
  $parent_id = $element['#parents'][count($element['#parents']) - 1];
2151 2243

  
2152 2244
  if ($_POST && count($_POST) > 0) {
2245
    // TODO use  $form_state['input'] instead of POST !!!
2153 2246
    // First pass of form processing.
2154
    $preferred_layer = $_POST[$parent_id . '_preferred'];
2155
    $form['#value']['PREFERRED'] = $preferred_layer;
2156
    $form_state[$parent_id] = $form['#value'];
2157
    $form_state['values']['baselayers'] = $form['#value'];
2247
    $parents = array();
2248
    array_deep_copy($element['#parents'], $parents);
2249
    $parents[count($parents) - 1] .= '_preferred';
2250
    $preferred_layer = drupal_array_get_nested_value($_POST, $parents);
2251
    $element['#value']['PREFERRED'] = $preferred_layer;
2252
//     $form_state[$parent_id] = $element['#value'];
2253
//     $form_state['values']['baselayers'] = $element['#value'];
2254
    $form_state_element_values = &drupal_array_get_nested_value($form_state['values'], $element['#parents']);
2255
    $form_state_element_values = $element['#value'];
2158 2256
  }
2159 2257
  else {
2160 2258
    // Second pass of form processing.
2161
    $preferred_layer = $form['#value']['PREFERRED'];
2259
    $preferred_layer = $element['#value']['PREFERRED'];
2162 2260
  }
2163 2261

  
2164 2262
  // Also set the chosen value (not sure if this is good Drupal style ....).
2165
  foreach ($children = element_children($form) as $key) {
2166
    if (!empty($form[$key]['#type']) && $form[$key]['#type'] == 'radio') {
2167
      $form[$key]['#value'] = $preferred_layer;
2263
  foreach ($children = element_children($element) as $key) {
2264
    if (!empty($element[$key]['#type']) && $element[$key]['#type'] == 'radio') {
2265
      $element[$key]['#value'] = $preferred_layer;
2168 2266
    }
2169 2267
  }
2170 2268
  // The default layer must always be enabled.
2171
  $form[$preferred_layer]['#value'] = $preferred_layer;
2269
  $element[$preferred_layer]['#value'] = $preferred_layer;
2172 2270

  
2173
  return $form;
2271
  return $element;
2174 2272
}
2175 2273

  
2176 2274
function radios_prepare_options_suffix(&$elements){
......
2207 2305
 *
2208 2306
 * @param $element
2209 2307
 *   The form element to validate
2210
 * @param $form
2211
 *   Nested array of form elements that comprise the form.
2212 2308
 * @param $form_state
2213 2309
 *   A keyed array containing the current state of the form.
2310
 * @param $form
2311
 *   Nested array of form elements that comprise the form.
2214 2312
 */
2215 2313
function form_element_validate_json($element, &$form_state, $form) {
2216 2314
   if (!empty($element['#value'])) {
7.x/modules/cdm_dataportal/theme/cdm_dataportal.descriptions.theme
140 140

  
141 141
          // Display cdm distribution map TODO this is a HACK to a proper
142 142
          // generic implementation?
143
          $block->content .= theme('cdm_distribution_map', array('taxon' => $taxon));
143
          $map_render_element = compose_distribution_map($taxon);
144
          $block->content .= $map_render_element['#markup'];
144 145
          $block->content .= theme('cdm_descriptionElements', array(
145 146
            'descriptionElements' => $node->descriptionElements,
146 147
            'featureUuid' => $node->feature->uuid,
......
1053 1054
*/
1054 1055

  
1055 1056
/**
1056
 * TODO
1057
 * Quick-and-dirty solution to show distribution service to exemplar groups.
1057
 * Composes the render array for a distribution map of the given taxon.
1058
 *
1059
 * The distribution map can either be a plain image or a dynamic open layers map
1060
 * depending on the settings.
1061
 *
1062
 * compose_hook() implementation
1063
 *
1064
 * @param $taxon
1065
 *   The CDM Taxon instance to create the distribution map for.
1066
 * @return array
1067
 *    A drupal render array
1068
 *
1069
 * Similar compose function compose_map()
1070
 *
1071
 * @ingroup compose
1058 1072
 */
1059
function theme_cdm_distribution_map($variables) {
1060
  $taxon = $variables['taxon'];
1073
function compose_distribution_map($taxon) {
1074

  
1061 1075
  $out = '';
1062 1076
  $settings = get_edit_map_service_settings();
1063 1077

  
......
1079 1093
  $query_string = str_replace('%3A', ":", $query_string);
1080 1094

  
1081 1095
  /* ------ choose the display mode, either openlayers or static image ------ */
1082
  if (variable_get('cdm_dataportal_map_openlayers', 1)) {
1096

  
1097
  $map_settings = get_array_variable_merged(CDM_MAP_DISTRIBUTION, CDM_MAP_DISTRIBUTION_DEFAULT);
1098

  
1099
  if ($map_settings['map_type'] == 1) {
1083 1100

  
1084 1101
    /* =========== display distributions using the openlayers map viewer =========== */
1085
    $legend_url_font_size = variable_get('cdm_dataportal_geoservice_legend_font_size', 10);
1086
    $legend_url_font_style = variable_get('cdm_dataportal_geoservice_legend_font_style', 1);
1087
    $legend_url_font_style = $fontStyles[$legend_url_font_style];
1088
    $legend_url_icon_width = variable_get('cdm_dataportal_geoservice_legend_icon_width', 35);
1089
    $legend_url_icon_height = variable_get('cdm_dataportal_geoservice_legend_icon_height', 15);
1090

  
1091
    $legendFormatQueryStr = "format=image" . urlencode('/') . "png&TRANSPARENT=TRUE";
1092
    $legendFormatQueryStr .= "&WIDTH=" . $legend_url_icon_width . "&HEIGHT=" . $legend_url_icon_height . "&";
1093
    // TODO why is the layer=topp:tdwg_level_4 parameter needed at all here??
1094
    $legendFormatQueryStr .= "layer=topp" . urlencode(':') . "tdwg_level_4&LEGEND_OPTIONS=forceLabels" . urlencode(':') . "on;fontStyle" . urlencode(':') . $legend_url_font_style . ";fontSize" . urlencode(':') . $legend_url_font_size . "&SLD=";
1095

  
1096
    $out .= get_openlayers_map(variable_get('cdm_dataportal_geoservice_display_width', 300), variable_get('cdm_dataportal_geoservice_bounding_box', FALSE), NULL, $query_string, $legendFormatQueryStr, variable_get('cdm_dataportal_geoservice_map_caption', ''));
1102

  
1103
    $legendFormatQueryStr = "format=image" . urlencode('/') . "png"
1104
         . "&TRANSPARENT=TRUE"
1105
         . "&WIDTH=" . $map_settings['legend']['icon_width']
1106
         . "&HEIGHT=" . $map_settings['legend']['icon_height']
1107
           // TODO why is the layer=topp:tdwg_level_4 parameter needed at all here??
1108
           // AK: i think the tdwg_level_4 is used as place holder and will be replaced later on
1109
           // => search for "tdwg_level_4" in the code
1110
         . "&layer=topp" . urlencode(':') . "tdwg_level_4"
1111
         . "&LEGEND_OPTIONS=forceLabels" . urlencode(':') . "on"
1112
             . ";fontStyle" . urlencode(':') . $fontStyles[$map_settings['legend']['font_style']]
1113
             . ";fontSize" . urlencode(':') .  $map_settings['legend']['font_size']
1114
         . "&SLD=";
1115

  
1116
    $out .= get_openlayers_map(
1117
        $map_settings['width'],
1118
        $map_settings['height'],
1119
        $map_settings['bbox'],
1120
        NULL,
1121
        $query_string,
1122
        $legendFormatQueryStr,
1123
        $map_settings['caption']
1124
     );
1097 1125
  }
1098 1126
  else {
1099 1127
    $legendFormatQueryStr = '';
1100
    return get_image_map(variable_get('cdm_dataportal_geoservice_display_width', 300), variable_get('cdm_dataportal_geoservice_bounding_box', FALSE), NULL, $query_string, $legendFormatQueryStr, variable_get('cdm_dataportal_geoservice_map_caption', ''));
1101

  
1102
    // Simple image.
1103
    $mapStaticCaption = '&mc_s=Georgia,15,blue&mc=' . variable_get('cdm_dataportal_geoservice_map_caption', '');
1104

  
1105
    $query_string .= '&img=true';
1106
    $query_string .= '&legend=1&mlp=3' . $mapStaticCaption . '&recalculate=FALSE';
1107

  
1108
    $map_service_script_name = "areas.php";
1109

  
1110
    // Apply Plain Image map settings.
1111
    if (get_edit_map_service_version_number() >= 1.1) {
1112
      /*
1113
       * example : title=a:Naturalized++non-invasive
1114
       * &ad=cyprusdivs:bdcode:a:5&as=a:ff9900,,0.1,&l=tdwg4
1115
       * &ms=500&bbox=32,34,35,36&img=true&legend=1&mlp=3
1116
       * &mc_s=Georgia,15,blue&mc=&recalculate=FALSE
1117
       * http://edit.br.fgov.be/edit_wp5/v1/rest_gen.php?
1118
       * l=background_gis:b,cyprusdivs&ad=cyprusdivs%3Abdcode%3Aa%3A8%2C4
1119
       * &as=a%3A339966%2C%2C0.1%2C|b:0000ff,,
1120
       * &bbox=32%2C34%2C35%2C36&img=true&legend=1&mc=&mc_s=Georgia%2C15%2Cblue
1121
       * &mlp=3&ms=500&recalculate=FALSE&title=a%3Aindigenous
1122
       */
1123

  
1124
      $map_service_script_name = "rest_gen.php";
1125

  
1126
      $bgcolor_areaStyleId = "y";
1127
      $baselayer_areaStyleId = "z";
1128
      $bgcolor_layer = '';
1129
      $additional_area_styles = array();
1130

  
1131
      // Background color.
1132
      if (variable_get('map_bg_color', '')) {
1133
        $bgcolor_layer = "background_gis:" . $bgcolor_areaStyleId;
1134
        $additional_area_styles[] = $bgcolor_areaStyleId . ":" . variable_get('map_bg_color', '') . ",,";
1135
      }
1136

  
1137
      // TODO HACK to replace the default base layer which currently is tdwg4
1138
      // !!!
1139
      if (strpos($query_string, "?l=") !== FALSE) {
1140
        $layer_param_token = "?l=";
1141
      }
1142
      else {
1143
        $layer_param_token = "&l=";
1144
      }
1145
      if (strpos($query_string, "?as=") !== FALSE) {
1146
        $areystyle_param_token = "?as=";
1147
      }
1148
      else {
1149
        $areystyle_param_token = "&as=";
1150
      }
1151

  
1152
      if (variable_get('map_base_layer', '')) {
1153
        $query_string = str_replace($layer_param_token . "tdwg4", "$layer_param_token" . variable_get('map_base_layer', '') . ":" . $baselayer_areaStyleId, $query_string);
1154
      }
1155
      else {
1156
        $query_string = str_replace($layer_param_token . "tdwg4", $layer_param_token . "tdwg4:" . $baselayer_areaStyleId . ",", $query_string);
1157
      }
1158

  
1159
      if ($bgcolor_layer) {
1160
        $query_string = str_replace($layer_param_token, $layer_param_token . $bgcolor_layer . ",", $query_string);
1161
      }
1162

  
1163
      if (variable_get('map_base_layer_style', '')) {
1164
        $additional_area_styles[] = $baselayer_areaStyleId . ":" . variable_get('map_base_layer_style', '');
1165
      }
1166

  
1167
      foreach ($additional_area_styles as $as) {
1168
        $query_string = str_replace($areystyle_param_token, $areystyle_param_token . $as . "|", $query_string);
1169
      }
1170
    }
1171

  
1172
    $mapUri = url(get_edit_map_service_full_uri() . '/' . $map_service_script_name . '? '. $query_string);
1173
    $out .= '<img class="distribution_map" src="' . urlencode($mapUri) . '" alt="Distribution Map" />';
1128
    $out = get_image_map(
1129
        $map_settings['width'],
1130
        $map_settings['height'],
1131
        $map_settings['bbox'],
1132
        NULL,
1133
        $query_string,
1134
        $legendFormatQueryStr,
1135
        $map_settings['caption']
1136
    );
1174 1137
  }
1175
  return $out;
1138
  return markup_to_render_array($out);
1176 1139
}
1177 1140

  
1178 1141
/**
7.x/modules/cdm_dataportal/theme/theme_registry.inc
112 112
          'taxon_uuid' => NULL,
113 113
          'descriptionElements' => NULL,
114 114
      )),
115
      'cdm_distribution_map' => array('variables' => array('taxon' => NULL)),
116 115
      'cdm_IdentificationKey' => array('variables' => array(
117 116
          'identificationKey' => NULL,
118 117
          'doLinkToKeyPage' => TRUE,

Also available in: Unified diff