Project

General

Profile

« Previous | Next » 

Revision 378bc1ce

Added by Andreas Kohlbecker over 7 years ago

fix #3650 visibility of distribution and specimen maps configurable

View differences:

modules/cdm_dataportal/settings.php
108 108
define('DISTRIBUTION_CONDENSED_RECIPE', 'distribution_condensed_recipe');
109 109
define('DISTRIBUTION_CONDENSED_RECIPE_DEFAULT', 'EuroPlusMed');
110 110

  
111

  
112 111
define('DISTRIBUTION_STATUS_COLORS', 'distribution_status_colors');
113 112
define('DISTRIBUTION_ORDER_MODE', 'distribution_order_mode');
114 113
define('DISTRIBUTION_ORDER_MODE_DEFAULT', 'TREE');
......
437 436
  )
438 437
)));
439 438

  
439
/**
440
 * Constant for the drupal variable key distribution_map_visibility
441
 *
442
 * possible values:
443
 *  - never
444
 *  - automatic
445
 *  - always
446
 */
447
define('DISTRIBUTION_MAP_VISIBILITY', 'distribution_map_visibility');
448
define('DISTRIBUTION_MAP_VISIBILITY_DEFAULT', 'automatic');
449

  
450
/**
451
 * Constant for the drupal variable key specimen_map_visibility
452
 *
453
 * possible values:
454
 *  - never
455
 *  - automatic
456
 *  - always
457
 */
458
define('SPECIMEN_MAP_VISIBILITY', 'specimen_map_visibility');
459
define('SPECIMEN_MAP_VISIBILITY_DEFAULT', 'automatic');
460

  
440 461
define('CDM_TAXON_MEDIA_FILTER', 'cdm_taxon_media_filter');
441 462
define('CDM_TAXON_MEDIA_FILTER_DEFAULT', serialize(
442 463
    array(
......
2158 2179
    '#collapsible' => TRUE,
2159 2180
    '#collapsed' => FALSE,
2160 2181
    '#type' => 'fieldset',
2161
    '#description' => 'This section covers general settings regarding the textual representation of distributions.
2162
        Map related settings are found in the '
2182
    '#description' => 'This section covers general settings regarding the textual representation of distributions and the visibility of the map.
2183
        Map settings regarding the geometry, layers, etc are found in the '
2163 2184
      . l('geo & map tab', 'admin/config/cdm_dataportal/settings/geo') .
2164 2185
      '. Further settings regarding the distribution feature block can be found in above in this tab at '
2165 2186
      . l(
......
2172 2193

  
2173 2194
  );
2174 2195

  
2196
  $form['taxon_profile']['distribution_layout'][DISTRIBUTION_MAP_VISIBILITY] = _cdm_map_visibility_setting('distribution');
2197

  
2175 2198
  $form['taxon_profile']['distribution_layout'][DISTRIBUTION_CONDENSED] = array(
2176 2199
    '#type' => 'checkbox',
2177 2200
    '#title' => t('Condensed distribution'),
......
2393 2416
      <strong>specimens</strong> tab.'),
2394 2417
  );
2395 2418

  
2396
    $form['taxon_specimens']['cdm_dataportal_compressed_specimen_derivate_table'] = array(
2397
        '#type' => 'checkbox',
2398
        '#title' => t('Show specimen derivatives in a compressed table'),
2399
        '#default_value' => variable_get('cdm_dataportal_compressed_specimen_derivate_table', CDM_DATAPORTAL_COMPRESSED_SPECIMEN_DERIVATE_TABLE),
2400
        '#description' => t('If checked, the specimen will be listed in a table. Every row represents
2401
        a collection and it can be expanded to get an overview of the specimens and their derivates.'),
2402
    );
2403
    
2404
    $form['taxon_specimens']['cdm_dataportal_compressed_specimen_derivate_table_show_determined_as'] = array(
2405
        '#type' => 'checkbox',
2406
        '#title' => t('Show "Associated with" in specimen table.'),
2407
        '#default_value' => variable_get('cdm_dataportal_compressed_specimen_derivate_table_show_determined_as', CDM_DATAPORTAL_COMPRESSED_SPECIMEN_DERIVATE_TABLE_SHOW_DETERMINED_AS)
2408
    );
2419
  $form['taxon_specimens'][SPECIMEN_MAP_VISIBILITY]  = _cdm_map_visibility_setting('specimen');
2420

  
2421
  $form['taxon_specimens']['cdm_dataportal_compressed_specimen_derivate_table'] = array(
2422
    '#type' => 'checkbox',
2423
    '#title' => t('Show specimen derivatives in a compressed table'),
2424
    '#default_value' => variable_get('cdm_dataportal_compressed_specimen_derivate_table', CDM_DATAPORTAL_COMPRESSED_SPECIMEN_DERIVATE_TABLE),
2425
    '#description' => t('If checked, the specimen will be listed in a table. Every row represents
2426
    a collection and it can be expanded to get an overview of the specimens and their derivates.'),
2427
  );
2428

  
2429
  $form['taxon_specimens']['cdm_dataportal_compressed_specimen_derivate_table_show_determined_as'] = array(
2430
    '#type' => 'checkbox',
2431
    '#title' => t('Show "Associated with" in specimen table.'),
2432
    '#default_value' => variable_get('cdm_dataportal_compressed_specimen_derivate_table_show_determined_as', CDM_DATAPORTAL_COMPRESSED_SPECIMEN_DERIVATE_TABLE_SHOW_DETERMINED_AS)
2433
  );
2409 2434

  
2410 2435
  $featureTrees = cdm_get_featureTrees_as_options(TRUE);
2411 2436
  $profile_feature_tree_uuid = variable_get(CDM_OCCURRENCE_FEATURETREE_UUID, UUID_DEFAULT_FEATURETREE);
......
2413 2438
    $profile_feature_tree_uuid = UUID_DEFAULT_FEATURETREE;
2414 2439
  }
2415 2440
  $form['taxon_specimens']['feature_trees'][CDM_OCCURRENCE_FEATURETREE_UUID] = array(
2416
      '#type' => 'radios',
2417
      '#title' => t('Specimen description feature tree') . ':',
2418
      '#default_value' => $profile_feature_tree_uuid,
2419
      '#options' =>  $featureTrees['options'],
2420
      '#pre_render' => array('form_pre_render_conditional_form_element', 'radios_prepare_options_suffix'),
2421
      '#options_suffixes' => $featureTrees['treeRepresentations'],
2422
      '#description' => t('Select the feature tree to be used for displaying specimen descriptions. Click "Show Details" to see the Feature Tree elements.'
2423
      ),
2441
    '#type' => 'radios',
2442
    '#title' => t('Specimen description feature tree') . ':',
2443
    '#default_value' => $profile_feature_tree_uuid,
2444
    '#options' =>  $featureTrees['options'],
2445
    '#pre_render' => array('form_pre_render_conditional_form_element', 'radios_prepare_options_suffix'),
2446
    '#options_suffixes' => $featureTrees['treeRepresentations'],
2447
    '#description' => t('Select the feature tree to be used for displaying specimen descriptions. Click "Show Details" to see the Feature Tree elements.'
2448
    ),
2424 2449
  );
2425 2450

  
2426 2451
  $form_name = CDM_DATAPORTAL_SPECIMEN_GALLERY_NAME;
......
2454 2479
  return system_settings_form($form);
2455 2480
}
2456 2481

  
2482
/**
2483
 * Creates a form element for the constants DISTRIBUTION_MAP_VISIBILITY, SPECIMEN_MAP_VISIBILITY.
2484
 *
2485
 * @param $map_id
2486
 * @param $form
2487
 * @return mixed
2488
 */
2489
function _cdm_map_visibility_setting($map_id)
2490
{
2491
  return array(
2492
    '#type' => 'select',
2493
    '#title' => t(ucfirst($map_id) . ' map visibility'),
2494
    '#default_value' => variable_get(constant(strtoupper($map_id) . '_MAP_VISIBILITY'), constant(strtoupper($map_id) . '_MAP_VISIBILITY_DEFAULT')),
2495
    '#options' => array('always' => 'always', 'automatic' => 'automatic', 'never' => 'never'),
2496
    '#description' => "The visibility of the map can managed <b>automatically</b> depending on whether there is data to show or not. 
2497
        The map also can forced to show up <b>always</b> or <b>never</b>."
2498
  );
2499
}
2500

  
2457 2501
/**
2458 2502
 * @todo document this function.
2459 2503
 */

Also available in: Unified diff