Project

General

Profile

Revision 52f57468

ID52f57468600e3bfb1a7569675b42cb9e951155ed
Parent c902cfd4
Child b3ac03bf

Added by Katja Luther over 3 years ago

smaller changes in dna part of tree view

View differences:

modules/cdm_dataportal/includes/occurrences.inc
605 605
 *
606 606
 * @ingroup compose
607 607
 */
608
function compose_cdm_sequence($sequence)
608
function compose_cdm_sequence($sequence, $isSpecimenPage = false)
609 609
{
610 610

  
611 611
    $exclude_sequence_fields = &drupal_static(__FUNCTION__);
......
617 617
            'created',
618 618
            'updated',
619 619
            'class',
620
            'dnaMarker'
620 621
        );
621 622
    }
622 623

  
......
635 636
            switch ($field) {
636 637

  
637 638
                case 'geneticAccessionNumber';
638
                    $dd_elements = array();
639
                    foreach ($value as $accession) {
640
                        if (isset($accession->uri)) {
641
                            $dd_elements[] = l($accession->accessionNumber, $accession->uri);
642
                        } else {
643
                            $dd_elements[] = $accession->accessionNumber;
644
                        }
645
                    }
646
                    @_description_list_group_add($groups, cdm_occurrence_field_name_label($field), $dd_elements, NULL, 2);
639

  
640
                    @_description_list_group_add($groups, cdm_occurrence_field_name_label($field), $value, NULL, 2);
647 641
                    break;
648 642

  
649 643

  
650
                case 'locus': // FIXME 3.3 now dnaMarker (DefinedTerm)  if multiple amplifications where used to build this consensus sequence it may be the super set of the markers used in amplification.
651
                    if (isset($value->name)) {
644
                /*case 'dnaMarker': // FIXME 3.3 now dnaMarker (DefinedTerm)  if multiple amplifications where used to build this consensus sequence it may be the super set of the markers used in amplification.
645
                    /*if (isset($value->name)) {
652 646
                        @_description_list_group_add($groups, cdm_occurrence_field_name_label($field), $value->name, NULL, 3);
653 647
                    }
654 648
                    if (isset($value->description)) {
655 649
                        @_description_list_group_add($groups, cdm_occurrence_field_name_label($field) . ' ' . t('description'), $value->description, NULL, 4);
656 650
                    }
651
                    @_description_list_group_add($groups, cdm_occurrence_field_name_label($field) , $value, NULL, 4);
657 652
                    break;
658

  
653
                */
659 654
                case 'consensusSequence':
660 655
                    // format in genbank style, force linebreaks after each 70 nucleotites
661 656
                    // see also http://stackoverflow.com/questions/499137/css-how-can-i-force-a-long-string-without-any-blank-to-be-wrapped-in-xul-and
662
                    @_description_list_group_add(
663
                        $groups,
664
                        cdm_occurrence_field_name_label($field),
665
                        array(
657
                    if ($value->length > 0) {
658
                        @_description_list_group_add(
659
                            $groups,
660
                            cdm_occurrence_field_name_label($field),
666 661
                            array(
667
                                '#markup' => '<div class="sequence-length">' . $value->length . ' ' . t('pb') . '</div><div>' . wordwrap($value->string, 70, '</br>', TRUE) . '</div>',
668
                                '#wrapper_attributes' => array('class' => 'dna-sequence')
669
                            )
670
                        ),
671
                        5);
662
                                array(
663
                                    '#markup' => '<div class="sequence-length">' . $value->length . ' ' . t('pb') . '</div><div>' . wordwrap($value->string, 70, '</br>', TRUE) . '</div>',
664
                                    '#wrapper_attributes' => array('class' => 'dna-sequence')
665
                                )
666
                            ),
667
                            5);
668
                    }
672 669
                    break;
673 670

  
674 671
                case 'dnaSample': // FIXME 3.3 implement
......
751 748

  
752 749
    // template_preprocess_description_list() is not worting by weight so we do it right here
753 750
    uasort($groups, 'element_sort');
754

  
755
    $sequence_elements = array(
756
        '#theme' => 'description_list',
757
        '#groups' => $groups
758
    );
751
    if ($isSpecimenPage) {
752
        $sequence_elements = array(
753
            '#title' => $sequence->dnaMarker,
754
            '#theme' => 'description_list',
755
            '#groups' => $groups
756
        );
757
    } else{
758
        $sequence_elements = array(
759
            '#title' => $sequence->dnaMarker -> titleCache,
760
            '#theme' => 'description_list',
761
            '#groups' => $groups
762
        );
763
    }
759 764

  
760 765
    return $sequence_elements;
761 766
}
......
827 832
            'protectedTitleCache',
828 833
            'class',
829 834
            'uuid',
830
            'collectionDTO'
835
            'collectionDTO',
836
            'derivates'
831 837
        );
832 838
    }
833 839
    $items = array();
......
899 905
                    case 'sex':
900 906
                    case 'lifeStage':
901 907
                    case 'kindOfUnit':
902
                        @_description_list_group_add($groups, cdm_occurrence_field_name_label($field), $value->representation_L10n, NULL, 1);
908
                        @_description_list_group_add($groups, cdm_occurrence_field_name_label($field), $value, NULL, 1);
903 909
                        break;
904 910

  
905 911
                    case 'definition':
......
1026 1032

  
1027 1033
                    /* ---- Specimen --- */
1028 1034
                    case 'sequences':
1029
                        /*
1030 1035
                        $dd_elements = array();
1031 1036
                        foreach ($value as $sequence) {
1032
                            $dd_elements[] = compose_cdm_sequence($sequence);
1037
                            $dd_elements[] = compose_cdm_sequence($sequence, true);
1038
                            $dd_elements[] = "";
1033 1039
                        }
1034 1040
                        @_description_list_group_add($groups, cdm_occurrence_field_name_label($field), $dd_elements);
1035
                        */
1036 1041
                        break;
1037 1042

  
1038 1043
                    // TODO preservation
......
1042 1047
                    /* ---- FieldObservation --- */
1043 1048
                    case 'gatheringEvent':
1044 1049

  
1045
                        @_description_list_group_add($groups, cdm_occurrence_field_name_label('collector'), $value->actor->titleCache);
1050
                        @_description_list_group_add($groups, cdm_occurrence_field_name_label('collector'), $value->collector);
1046 1051
                        @_description_list_group_add($groups, t('Gathering time'), timePeriodToString($value->timeperiod));
1047 1052
                        @_description_list_group_add($groups, cdm_occurrence_field_name_label('description'), $value->description);
1048
                        @_description_list_group_add($groups, cdm_occurrence_field_name_label('locality'), $value->locality->text);
1049
                        @_description_list_group_add($groups, cdm_occurrence_field_name_label('country'), $value->country->representation_L10n);
1053
                        @_description_list_group_add($groups, cdm_occurrence_field_name_label('locality'), $value->locality);
1054
                        @_description_list_group_add($groups, cdm_occurrence_field_name_label('country'), $value->country);
1050 1055
                        @_description_list_group_add($groups, cdm_occurrence_field_name_label('collectingMethod'), $value->collectingMethod);
1051 1056
                        if (isset($value->absoluteElevation)) {
1052 1057
                            $min_max_markup = min_max_measure($value, 'absoluteElevation');
......
1064 1069
                        if (isset($value->collectingAreas)) {
1065 1070
                            $area_representations = array();
1066 1071
                            foreach ($value->collectingAreas as $area) {
1067
                                $area_representations[] = l($area->representation_L10n, path_to_named_area($area->uuid));
1072
                               // $area_representations[] = l($area->representation_L10n, path_to_named_area($area->uuid));
1073
                                $area_representations[] = $area;
1068 1074
                            }
1069 1075
                            if (!empty($area_representations))
1070 1076
                                @_description_list_group_add($groups, cdm_occurrence_field_name_label('collectingAreas'),
......
1103 1109

  
1104 1110
                    default:
1105 1111
                        if (is_object($value) || is_array($value)) {
1106
                           // drupal_set_message("Unhandled type in compose_cdm_specimenOrObservation() for field " . $field, "warning");
1112
                            drupal_set_message("Unhandled type in compose_cdm_specimenOrObservation() for field " . $field, "warning");
1107 1113
                        } else {
1108 1114
                            _description_list_group_add($groups, cdm_occurrence_field_name_label($field), $value);
1109 1115
                        }
modules/cdm_dataportal/includes/pages.inc
167 167
                '#items' => array($value),
168 168
                '#type' => 'ul');
169 169
            $output = drupal_render($renderArray);
170
//            $specimen_table['#rows'][] = array(
171
//                // An array of table rows. collabsible row
172
//                'data' => "",
173
//                'class' => array('expand_column')
174
//            );
170 175
            $specimen_table['#rows'][] = array(
171 176
                // An array of table rows. Every row is an array of cells, or an associative array
172 177
                'data' => array($output),
......
175 180
                    'descriptionElement_IndividualsAssociation'
176 181
                ),
177 182
            );
183

  
184

  
178 185
        }
179 186

  
180 187
        $render_array['specimen_list'] = $specimen_table;
181
      //  $render_array['specimen_list'] = $specimen_array;
188

  
182 189

  
183 190
    }
184 191
    else{
modules/cdm_dataportal/includes/pre-drupal8.inc
210 210
    } else {
211 211
      $term_elements = $term;
212 212
    }
213

  
213
    if (strpos($description, 'http:') !== false && !is_array($description)){
214
        //make links for urls
215
        $description = l($description, $description);
216
    }
214 217
    $groups[$term] = array(
215 218
        'term' => $term_elements,
216 219
        'description' => $description,

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)