Project

General

Profile

« Previous | Next » 

Revision 38dd933d

Added by Andreas Kohlbecker about 8 years ago

#5737 admins settings for hierarchical distribution styles

View differences:

modules/cdm_dataportal/cdm_dataportal.css
689 689
    color: royalblue;
690 690
}
691 691

  
692
.fieldset-float {
693
    float: left;
694
}
695

  
692 696
/*
693 697
 * ======= specimens =======
694 698
 */
modules/cdm_dataportal/includes/descriptions.inc
1614 1614
    if (isset($descriptionElement->status)) {
1615 1615
      $status_label = $descriptionElement->status->representation_L10n;
1616 1616
      $status_markup = '<span class="distributionStatus distributionStatus-' . $descriptionElement->status->idInVocabulary . '"> '
1617
        . $status_label . ' </span>';
1617
        . $status_label . '</span>';
1618 1618

  
1619 1619
    };
1620 1620
    return array($status_label, $status_markup);
......
1707 1707
  function compose_distribution_hierarchy($distribution_tree, $feature_block_settings){
1708 1708

  
1709 1709
    static $hierarchy_style;
1710
    // TODO expose $hierarchy_style to administration of provide a hook
1710
    // TODO expose $hierarchy_style to administration or provide a hook
1711 1711
    if( !isset($hierarchy_style)){
1712
      $hierarchy_style = array(
1713
        // level 2
1714
        array(
1715
          'label_suffix' => '',
1716
          'element_glue' => ', ',
1717
          'element_set_pre' => '(',
1718
          'element_set_post' => ')'
1719
        ),
1720
        // level 1
1721
        array(
1722
          'label_suffix' => '',
1723
          'element_glue' => '; ',
1724
          'element_set_pre' => '',
1725
          'element_set_post' => ''
1726
        ),
1727
        // level 0
1728
        array(
1729
          'label_suffix' => ':',
1730
          'element_glue' => ' ',
1731
          'element_set_pre' => '',
1732
          'element_set_post' => ''
1733
        ),
1734
      );
1712
      $hierarchy_style = get_array_variable_merged(DISTRIBUTION_HIERARCHY_STYLE, DISTRIBUTION_HIERARCHY_STYLE_DEFAULT);
1735 1713
    }
1736 1714

  
1737 1715
    $render_array = array();
......
1779 1757
    $level_index++;
1780 1758
    static $enclosingTag = "span";
1781 1759

  
1782
    $level_style = array_pop($hierarchy_style);
1760
    $level_style = array_shift($hierarchy_style);
1783 1761
    if(count($hierarchy_style) == 0){
1784 1762
      // lowest defined level style will be reused for all following levels
1785 1763
      $hierarchy_style[] = $level_style;
......
1842 1820
        . ' level_index_' . $level_index
1843 1821
        . ' " title="' . $status_label . '">'
1844 1822
        . '<span class="area_label">' . $label
1845
        . $level_style['label_suffix'] . ' </span>'
1823
        . $level_style['label_suffix'] . '</span>'
1846 1824
        .  $status_markup
1847 1825
      ;
1848 1826

  
......
1867 1845

  
1868 1846
      $per_node_markup[$node_index] .= '</' . $enclosingTag . '>';
1869 1847
    }
1870
    $markup .= $level_style['element_set_pre']  . join( $level_style['element_glue'], $per_node_markup) . $level_style['element_set_post'];
1848
    $markup .= $level_style['item_group_prefix']  . join( $level_style['item_glue'], $per_node_markup) . $level_style['item_group_postfix'];
1871 1849
  }
1872 1850

  
1873 1851

  
modules/cdm_dataportal/settings.php
410 410
     )
411 411
));
412 412

  
413
define('DISTRIBUTION_HIERARCHY_STYLE', 'distribution_hierarchy_style');
414
define('DISTRIBUTION_HIERARCHY_STYLE_DEFAULT', serialize(array(
415
  "level_0" => array(
416
    'label_suffix' => ':',
417
    'item_glue' => ' ',
418
    'item_group_prefix' => '',
419
    'item_group_postfix' => ''
420
  ),
421
  "level_1" => array(
422
    'label_suffix' => '',
423
    'item_glue' => '; ',
424
    'item_group_prefix' => ', ',
425
    'item_group_postfix' => ''
426
  ),
427
  "level_2" => array(
428
    'label_suffix' => '',
429
    'item_glue' => ', ',
430
    'item_group_prefix' => ' (',
431
    'item_group_postfix' => ')'
432
  )
433
)));
413 434

  
414 435
define('CDM_TAXON_MEDIA_FILTER', 'cdm_taxon_media_filter');
415 436
define('CDM_TAXON_MEDIA_FILTER_DEFAULT', serialize(
......
1231 1252

  
1232 1253
  $form['aggregation']['aggregate_by_taxon_relationships'][CDM_AGGREGATE_BY_TAXON_RELATIONSHIPS] = array(
1233 1254
      '#type' => 'fieldset',
1234
      '#attributes' => array('class'=>array('clearfix')),
1255
      '#attributes' => array('class' => array('clearfix')),
1235 1256
      '#title' => t('Aggregation via taxon relationsships'),
1236 1257
      '#collapsible' => TRUE,
1237 1258
      '#collapsed' => TRUE,
......
1261 1282

  
1262 1283
  $form['drupal_integration'] = array(
1263 1284
    '#type' => 'fieldset',
1264
    '#attributes' => array('class'=>array('clearfix')),
1285
    '#attributes' => array('class'=> array('clearfix')),
1265 1286
    '#title' => t('Drupal integration'),
1266 1287
    '#collapsible' => FALSE,
1267 1288
    '#collapsed' => FALSE,
......
2186 2207
    ' for details on the <em>Marked area filter</em>.',
2187 2208
  );
2188 2209

  
2210
  $form['taxon_profile']['distribution_layout'][DISTRIBUTION_HIERARCHY_STYLE] = array(
2211
    '#type' => 'fieldset',
2212
    '#tree' => true,
2213
    '#title' => t('Distribution hierarchy style')
2214
  );
2215

  
2216
  $hierarchy_styles = get_array_variable_merged(DISTRIBUTION_HIERARCHY_STYLE, DISTRIBUTION_HIERARCHY_STYLE_DEFAULT);
2217
  foreach(array_keys($hierarchy_styles) as $level) {
2218
    $form['taxon_profile']['distribution_layout'][DISTRIBUTION_HIERARCHY_STYLE][$level] = array(
2219
      '#type' => 'fieldset',
2220
      '#tree' => true,
2221
      '#title' => t(drupal_ucfirst((str_replace('_', ' ', $level)))),
2222
      '#attributes' => array('class' => array('fieldset-float'))
2223
    );
2224
    foreach ($hierarchy_styles[$level] as $key => $value) {
2225
      $form['taxon_profile']['distribution_layout'][DISTRIBUTION_HIERARCHY_STYLE][$level][$key] = array(
2226
        '#type' => 'textfield',
2227
        '#title' => t(drupal_ucfirst((str_replace('_', ' ', $key)))),
2228
        '#default_value' => $hierarchy_styles[$level][$key],
2229
        '#maxlength' => 4,
2230
        '#size' => 4
2231
      );
2232
    }
2233
  }
2234

  
2189 2235
  $level_options = cdm_vocabulary_as_option(UUID_NAMED_AREA_LEVEL, NULL, FALSE, SORT_ASC);
2190 2236
  $form['taxon_profile']['distribution_layout'][DISTRIBUTION_TREE_OMIT_LEVELS] = array(
2191 2237
    '#type' => 'checkboxes',

Also available in: Unified diff