Project

General

Profile

« Previous | Next » 

Revision 22f5e82d

Added by Andreas Kohlbecker over 9 years ago

refactoring theme_cdm_descriptionElementTextData() #3484 , mock implementation of feature block settings #3257, solves most issues of #3915 (handling of annotations and sources inconsistent in theme_cdm_descriptionElementTextData)

View differences:

7.x/modules/cdm_dataportal/settings.php
39 39
define('CDM_TAXON_RELATIONSHIP_TYPES_DEFAULT', serialize(array(UUID_MISAPPLIED_NAME_FOR, UUID_INVALID_DESIGNATION_FOR)));
40 40

  
41 41

  
42

  
43 42
/* ---- MAP SETTING CONSTANTS ---- */
44 43
/**
45 44
 * @var array of URIs eg. http://edit.africamuseum.be"
......
393 392
  }
394 393
  else {
395 394
    return ($values[$index_value]);
396
  }
397 395

  
396
  }
398 397
}
399 398

  
400
  /**
401
   * preliminary mock implementation
402
   *
403
   *  "$feature uuid": {
404
   *    "as_list": div|ul|ol,                        // div: not as list, ul: as bullet list, ol: as numbered list, will be used in compose_cdm_feature_block_elements() as $enclosing_tag
405
   *    "link_to_reference": boolean,                 // render the reference as link, ignored if the element is NOT a DescriptionElementSource
406
   *    // references_inline:
407
   *    // TRUE:
408
   *    //   1. if element has text (TextData) the source references will be appended in brackets like "text (source references)"
409
   *    //   2. otherwise they are the only content (e.g. use case CITATION) and afre not put into brackets
410
   *    // FALSE:
411
   *    //  they are put into the bibliography(=references) pseudo feature block
412
   *    "references_inline": boolean
413
   *    "sort_elements": SORT_ASC, SORT_DESC, NULL    // whether and how to sort the elements
414
   *    "element_tag": span | div                     // only applies if "as_list" is NULL
415
   *  }
416
   */
417
  function get_feature_block_settings(){
418
    // the default must conform to the default paramter values of
419
    // compose_cdm_feature_block_elements() : $glue = '', $sort = FALSE, $enclosing_tag = 'ul'
420
    // theme_cdm_descriptionElementTextData() : asListElement = NULL
421

  
422
    // currently only element_tag is used.
423
    $default = array(
399
/**
400
 * preliminary mock implementation
401
 *
402
 *  "$feature uuid": {
403
 *    "as_list": div|ul|ol|dl,                       // div: not as list, ul: as bullet list, ol: as numbered list, dl:as definition list; will be used in compose_cdm_feature_block_elements() as $enclosing_tag
404
 *    "link_to_reference": boolean,                 // render the reference as link, ignored if the element is NOT a DescriptionElementSource
405
 *    "link_to_name_used_in_source": boolean
406
 *    // references_inline:
407
 *    // TRUE:
408
 *    //   1. if element has text (TextData) the source references will be appended in brackets like "text (source references)"
409
 *    //   2. otherwise they are the only content (e.g. use case CITATION) and afre not put into brackets
410
 *    // FALSE:
411
 *    //  they are put into the bibliography(=references) pseudo feature block
412
 *    "references_inline": boolean
413
 *    "sort_elements": SORT_ASC, SORT_DESC, NULL    // whether and how to sort the elements
414
 *    "element_tag": span | div                     // only applies if "as_list" == 'div'
415
 *  }
416
 */
417
function get_feature_block_settings($feature_uuid = 'DEFAULT'){
418
  // the default must conform to the default parameter values of
419
  // compose_cdm_feature_block_elements() : $glue = '', $sort = FALSE, $enclosing_tag = 'ul'
420
  // theme_cdm_descriptionElementTextData() : asListElement = NULL
421

  
422
  // currently only element_tag is used.
423
  $default = array(
424
    'DEFAULT' => array(
424 425
      'as_list' => 'ul',
425 426
      'link_to_reference' => FALSE,
427
      'link_to_name_used_in_source' => TRUE,
426 428
      'references_inline' => TRUE,
427 429
      'sort_elements' => FALSE,
428 430
      'glue' => '',
429 431
      'element_tag'=> NULL
430
    );
432
    )
433
  );
431 434

  
432
    $cichorieae_default = array(
435
  $cichorieae_default = array(
436
    'DEFAULT' => array(
437
      'as_list' => 'div',
438
      'link_to_reference' => TRUE,
439
      'link_to_name_used_in_source' => TRUE,
440
      'references_inline' => TRUE,
441
      'sort_elements' => FALSE,
442
      'glue' => '',
443
      'element_tag'=> 'div'
444
    ),
445
    UUID_CITATION => array(
433 446
      'as_list' => 'div',
434 447
      'link_to_reference' => FALSE,
448
      'link_to_name_used_in_source' => FALSE,
435 449
      'references_inline' => TRUE,
436 450
      'sort_elements' => FALSE,
437 451
      'glue' => '',
438 452
      'element_tag'=> 'div'
439
    );
453
    ),
454
    UUID_CHROMOSOMES_NUMBERS => array(
455
      'as_list' => 'ul',
456
      'link_to_reference' => TRUE,
457
      'link_to_name_used_in_source' => TRUE,
458
      'references_inline' => TRUE,
459
      'sort_elements' => FALSE,
460
      'glue' => '',
461
      'element_tag'=> 'div'
462
    ),
463
    UUID_CHROMOSOMES => array(
464
      'as_list' => 'ul',
465
      'link_to_reference' => FALSE,
466
      'link_to_name_used_in_source' => TRUE,
467
      'references_inline' => TRUE,
468
      'sort_elements' => FALSE,
469
      'glue' => '',
470
      'element_tag'=> 'div'
471
    ),
472
  );
440 473

  
441
    $default_theme = variable_get('theme_default', NULL);
442

  
443
    switch ($default_theme){
444
      case 'garland_cichorieae':
445
      case 'cyprus': // no longer used in production, but is required for selenium tests see class eu.etaxonomy.dataportal.pages.PortalPage
446
      case 'flore_afrique_centrale':
447
      case 'flora_malesiana':
448
      case 'flore_gabon':
449
        return $cichorieae_default;
450
      default:
451
       return $default;
452
    }
474
  $default_theme = variable_get('theme_default', NULL);
475

  
476
  switch ($default_theme){
477
    case 'garland_cichorieae':
478
    case 'cyprus': // no longer used in production, but is required for selenium tests see class eu.etaxonomy.dataportal.pages.PortalPage
479
      $settings_for_theme = $cichorieae_default;
480
      break;
481
    case 'flore_afrique_centrale':
482
    case 'flora_malesiana':
483
    case 'flore_gabon':
484
      $settings_for_theme = $cichorieae_default;
485
      $settings_for_theme[UUID_CITATION]['as_list'] = 'ul';
486
      break;
487
    default:
488
      $settings_for_theme =  $default;
453 489
  }
454 490

  
455
/**
491
  if(isset($settings_for_theme[$feature_uuid])){
492
    return $settings_for_theme[$feature_uuid];
493
  } else if(isset($settings_for_theme['DEFAULT'])){
494
    return $settings_for_theme['DEFAULT'];
495
  } else if(isset($settings_for_theme[$feature_uuid])){
496
    return $default[$feature_uuid];
497
  } else {
498
    return $default['DEFAULT'];
499
  }
500
}
501

  
502
  /**
456 503
 * returns the current setting for the original source bibliography
457 504
 *
458 505
 * Caches internally

Also available in: Unified diff