Project

General

Profile

« Previous | Next » 

Revision c6ee8193

Added by Andreas Kohlbecker almost 10 years ago

experimental feature to allow setting a custom statuscolor map - #4268 (allow defining custom presence and absence term colors for EditGeoServiceUtilities)

View differences:

7.x/modules/cdm_dataportal/includes/pages.inc
300 300
        $query_parameters['part'][] = 'elements';
301 301
      }
302 302
      $query_parameters['omitLevels'] = array(UUID_NAMEDAREALEVEL_TDWGLEVEL_2);
303
      $customStatusColorsJson = variable_get(DISTRIBUTION_STATUS_COLORS, null);
304
      if($customStatusColorsJson){
305
        $query_parameters['statusColors'] = $customStatusColorsJson;
306
      }
303 307

  
304 308
      $distribution_info_dto = cdm_ws_get(CDM_WS_PORTAL_DESCRIPTION_DISTRIBUTION_INFO_FOR, $taxon->uuid, queryString($query_parameters));
305 309
      // 4. get distribution TextData is there are any
......
312 316
      );
313 317

  
314 318
      // 5. put all disitribution data into the distribution feature node
315
      if($distribution_text_data //if text data exists 
319
      if($distribution_text_data //if text data exists
316 320
      || ($distribution_info_dto && isset($distribution_info_dto->tree) && $distribution_info_dto->tree->rootElement->numberOfChildren>0) // OR if tree element has distribution elements
317 321
      || ($distribution_info_dto && !empty($distribution_info_dto->elements))) {  // OR if DTO has distribution elements
318 322
        $distribution_node->descriptionElements = array('#type' => 'DTO');
7.x/modules/cdm_dataportal/settings.php
88 88
  )
89 89
);
90 90

  
91
define('DISTRIBUTION_STATUS_COLORS', 'distribution_status_colors');
92

  
91 93
/**
92 94
 * Returns the array of implemented taxon page tabs.
93 95
 * The array has fixed integer keys which must not be changed.
......
1489 1491
      distribution map.'),
1490 1492
  );
1491 1493

  
1494
  $form['taxon_profile'][DISTRIBUTION_STATUS_COLORS] = array(
1495
      '#type' => 'textarea',
1496
      '#title' => t('Custom status colors'),
1497
      '#element_validate' => array('form_element_validate_json'),
1498
      '#default_value' => variable_get(DISTRIBUTION_STATUS_COLORS, ''),
1499
      '#description' => t('<strong>EXPERIMENTAL!</strong><br/>This may be changed in the next release without notification.
1500
          A json map object with StatusTerm.idInVocabulary as key and a hex color as value. e.g: <code>{"n":"#ff0000","p":"#00ff00"}</code>.
1501
          reference list of the idInVocabulary valued of absence and presence terms:
1502
<pre>
1503
c = CULTIVATED
1504
e = ENDEMIC_FOR_THE_RELEVANT_AREA
1505
i = INTRODUCED
1506
ia = INTRODUCED_ADVENTITIOUS
1507
ic = INTRODUCED_CULTIVATED
1508
id = INTRODUCED_DOUBTFULLY_INTRODUCED
1509
in = INTRODUCED_NATURALIZED
1510
ip = INTRODUCED_UNCERTAIN_DEGREE_OF_NATURALISATION
1511
iq = INTRODUCED_PRESENCE_QUESTIONABLE
1512
n = NATIVE
1513
nd = NATIVE_DOUBTFULLY_NATIVE
1514
nq = NATIVE_PRESENCE_QUESTIONABLE
1515
p = PRESENT
1516
na = NATURALISED
1517
iv = INVASIVE
1518
cf = CULTIVATED_REPORTED_IN_ERROR
1519
if = INTRODUCED_REPORTED_IN_ERROR
1520
nf = NATIVE_REPORTED_IN_ERROR
1521
ne = NATIVE_FORMERLY_NATIVE
1522
ie = INTRODUCED_FORMERLY_INTRODUCED
1523
</pre>'),
1524
  );
1525

  
1492 1526

  
1493 1527
  /* ====== SYNONYMY ====== */
1494 1528
  $form['taxon_synonymy'] = array(

Also available in: Unified diff