Revision bfb2b81a
Added by Andreas Kohlbecker over 11 years ago
7.x/modules/cdm_dataportal/cdm_api/cdm_api.module | ||
---|---|---|
142 | 142 |
} |
143 | 143 |
|
144 | 144 |
/** |
145 |
* Returns the FeatureTree profile as selected.
|
|
145 |
* Returns the chosen FeatureTree for the taxon profile.
|
|
146 | 146 |
* |
147 | 147 |
* The FeatureTree profile returned is the one that has been set in the |
148 | 148 |
* dataportal settings (layout->taxon:profile). |
... | ... | |
150 | 150 |
* the standard feature tree (UUID_DEFAULT_FEATURETREE) will be returned. |
151 | 151 |
* |
152 | 152 |
* @return mixed |
153 |
* A feature profile tree object.
|
|
153 |
* A cdm FeatureTree object.
|
|
154 | 154 |
*/ |
155 | 155 |
function get_profile_featureTree() { |
156 |
$profile_featureTree = cdm_ws_get( |
|
157 |
CDM_WS_FEATURETREE, |
|
158 |
variable_get(CDM_PROFILE_FEATURETREE_UUID, UUID_DEFAULT_FEATURETREE) |
|
159 |
); |
|
160 |
if (!$profile_featureTree) { |
|
156 |
static $profile_featureTree; |
|
157 |
|
|
158 |
if($profile_featureTree == NULL) { |
|
161 | 159 |
$profile_featureTree = cdm_ws_get( |
162 | 160 |
CDM_WS_FEATURETREE, |
163 |
UUID_DEFAULT_FEATURETREE
|
|
161 |
variable_get(CDM_PROFILE_FEATURETREE_UUID, UUID_DEFAULT_FEATURETREE)
|
|
164 | 162 |
); |
163 |
if (!$profile_featureTree) { |
|
164 |
$profile_featureTree = cdm_ws_get(CDM_WS_FEATURETREE, UUID_DEFAULT_FEATURETREE); |
|
165 |
} |
|
165 | 166 |
} |
166 | 167 |
return $profile_featureTree; |
167 | 168 |
} |
168 | 169 |
|
170 |
/** |
|
171 |
* Returns the chosen FeatureTree for SpecimenDescriptions. |
|
172 |
* |
|
173 |
* The FeatureTree returned is the one that has been set in the |
|
174 |
* dataportal settings (layout->taxon:specimen). |
|
175 |
* When the chosen FeatureTree is not found in the database, |
|
176 |
* the standard feature tree (UUID_DEFAULT_FEATURETREE) will be returned. |
|
177 |
* |
|
178 |
* @return mixed |
|
179 |
* A cdm FeatureTree object. |
|
180 |
*/ |
|
181 |
function cdm_get_occurrence_featureTree() { |
|
182 |
static $occurrence_featureTree; |
|
183 |
|
|
184 |
if($occurrence_featureTree == NULL) { |
|
185 |
$occurrence_featureTree = cdm_ws_get( |
|
186 |
CDM_WS_FEATURETREE, |
|
187 |
variable_get(CDM_OCCURRENCE_FEATURETREE_UUID, UUID_DEFAULT_FEATURETREE) |
|
188 |
); |
|
189 |
if (!$occurrence_featureTree) { |
|
190 |
$occurrence_featureTree = cdm_ws_get(CDM_WS_FEATURETREE, UUID_DEFAULT_FEATURETREE); |
|
191 |
} |
|
192 |
} |
|
193 |
return $occurrence_featureTree; |
|
194 |
} |
|
195 |
|
|
196 |
/** |
|
197 |
* Returns the FeatureTree for structured descriptions |
|
198 |
* |
|
199 |
* The FeatureTree returned is the one that has been set in the |
|
200 |
* dataportal settings (layout->taxon:profile). |
|
201 |
* When the chosen FeatureTree is not found in the database, |
|
202 |
* the standard feature tree (UUID_DEFAULT_FEATURETREE) will be returned. |
|
203 |
* |
|
204 |
* @return mixed |
|
205 |
* A cdm FeatureTree object. |
|
206 |
*/ |
|
207 |
function get_structured_description_featureTree() { |
|
208 |
static $structured_description_featureTree; |
|
209 |
|
|
210 |
if($structured_description_featureTree == NULL) { |
|
211 |
$structured_description_featureTree = cdm_ws_get( |
|
212 |
CDM_WS_FEATURETREE, |
|
213 |
variable_get(CDM_DATAPORTAL_STRUCTURED_DESCRIPTION_FEATURETREE_UUID, UUID_DEFAULT_FEATURETREE) |
|
214 |
); |
|
215 |
if (!$structured_description_featureTree) { |
|
216 |
$structured_description_featureTree = cdm_ws_get( |
|
217 |
CDM_WS_FEATURETREE, |
|
218 |
UUID_DEFAULT_FEATURETREE |
|
219 |
); |
|
220 |
} |
|
221 |
} |
|
222 |
return $structured_description_featureTree; |
|
223 |
} |
|
224 |
|
|
169 | 225 |
/** |
170 | 226 |
* @todo Please document this function. |
171 | 227 |
* @see http://drupal.org/node/1354 |
... | ... | |
1142 | 1198 |
} |
1143 | 1199 |
|
1144 | 1200 |
/** |
1145 |
* @todo Please document this function. |
|
1146 |
* @see http://drupal.org/node/1354 |
|
1201 |
* Merges the given featureNodes structure with the descriptionElements. |
|
1202 |
* |
|
1203 |
* This method is used in preparation for rendering the descriptionElements. |
|
1204 |
* The descriptionElements wich belong to a specific feature node are appended |
|
1205 |
* to a the feature node by creating a new field: FeatureNode->descriptionElements |
|
1206 |
* which originally is not existing in the cdm. |
|
1207 |
* |
|
1208 |
* @param array $featureNodes |
|
1209 |
* An array of cdm FeatureNodes which may be hierachical since feature nodes |
|
1210 |
* may have children. |
|
1211 |
* @param array $descriptionElements |
|
1212 |
* An flat array of cdm DescriptionElements |
|
1213 |
* @return array |
|
1214 |
* The $featureNodes structure enriched with the accoding $descriptionElements |
|
1147 | 1215 |
*/ |
1148 | 1216 |
function _mergeFeatureTreeDescriptions($featureNodes, $descriptionElements) { |
1149 | 1217 |
foreach ($featureNodes as &$node) { |
7.x/modules/cdm_dataportal/cdm_api/webservice_uris.php | ||
---|---|---|
56 | 56 |
define('CDM_WS_DESCRIPTION_NATURALLANGUAGE_DESCRIPTION', 'description/$0/naturalLanguageDescription/$1'); |
57 | 57 |
define('CDM_WS_DESCRIPTION_HAS_STRUCTRURED_DATA', 'description/$0/hasStructuredData'); |
58 | 58 |
|
59 |
define('CDM_WS_PORTAL_DESCRIPTION', 'portal/description/$0'); |
|
59 | 60 |
define('CDM_WS_PORTAL_DESCRIPTION_AREAS_TREE', 'portal/description/$0/namedAreaTree'); |
60 | 61 |
define('CDM_WS_PORTAL_DESCRIPTION_DISTRIBUTION_TREE', 'portal/description/$0/DistributionTree'); |
61 | 62 |
|
7.x/modules/cdm_dataportal/cdm_dataportal.install | ||
---|---|---|
35 | 35 |
*/ |
36 | 36 |
|
37 | 37 |
/** |
38 |
* update function for RELEASE 3.13 |
|
38 |
* update for RELEASE 3.13: |
|
39 |
* - reset edit_map_server variable to default |
|
39 | 40 |
*/ |
40 | 41 |
function cdm_dataportal_update_7301() { |
41 | 42 |
// reset edit_map_server variable to default |
7.x/modules/cdm_dataportal/includes/occurrences.inc | ||
---|---|---|
198 | 198 |
// TODO compose descriptions |
199 | 199 |
// store in variable so we don't need to ask the cdmserver for them again |
200 | 200 |
$descriptions = $value; |
201 |
$occurrence_featureTree = cdm_get_occurrence_featureTree(); |
|
202 |
$dd_elements = array(); |
|
203 |
|
|
201 | 204 |
foreach ($value as $description) { |
202 |
@_description_list_group_add($groups, cdm_occurrence_field_name_label($field), $description->titleCache . ' ' . $description->uuid); |
|
203 |
} |
|
205 |
$dd_elements[] = array('#markup' => $description->titleCache . ' ' . $description->uuid); |
|
206 |
$description = cdm_ws_get(CDM_WS_PORTAL_DESCRIPTION, $description->uuid); |
|
207 |
$elements_by_feature = _mergeFeatureTreeDescriptions($occurrence_featureTree->root->children, $description->elements); |
|
208 |
$rendered_description = theme( |
|
209 |
'cdm_feature_nodes', |
|
210 |
array('mergedFeatureNodes' => $elements_by_feature) |
|
211 |
); |
|
212 |
$dd_elements[] = array('#markup' => $rendered_description); |
|
213 |
} |
|
214 |
|
|
215 |
@_description_list_group_add($groups, cdm_occurrence_field_name_label($field), $dd_elements); |
|
204 | 216 |
break; |
205 | 217 |
|
206 | 218 |
case 'sources': |
7.x/modules/cdm_dataportal/settings.php | ||
---|---|---|
99 | 99 |
define('CDM_DATAPORTAL_DISPLAY_NAME_RELATIONSHIPS_DEFAULT', 1); |
100 | 100 |
define('CDM_TAXON_RELATIONSHIP_TYPES', 'cdm_taxon_relationship_types'); |
101 | 101 |
define('CDM_PROFILE_FEATURETREE_UUID', 'cdm_dataportal_featuretree_uuid'); |
102 |
define('CDM_OCCURRENCE_FEATURETREE_UUID', 'cdm_occurrence_featuretree_uuid'); |
|
102 | 103 |
define('CDM_DATAPORTAL_STRUCTURED_DESCRIPTION_FEATURETREE_UUID', 'cdm_dataportal_structdesc_featuretree_uuid'); |
103 | 104 |
|
104 | 105 |
/** |
... | ... | |
1096 | 1097 |
<strong>specimens</strong> tab.'), |
1097 | 1098 |
); |
1098 | 1099 |
|
1100 |
$featureTrees = cdm_get_featureTrees_as_options(TRUE); |
|
1101 |
$form['taxon_specimens']['feature_trees'][CDM_OCCURRENCE_FEATURETREE_UUID] = array( |
|
1102 |
'#type' => 'radios', |
|
1103 |
'#title' => t('Specimen description feature tree') . ':', |
|
1104 |
'#default_value' => variable_get(CDM_OCCURRENCE_FEATURETREE_UUID, UUID_DEFAULT_FEATURETREE), |
|
1105 |
'#options' => $featureTrees['options'], |
|
1106 |
// Comment @WA: because #options are sanitized in D7, it would |
|
1107 |
// strip html like <fieldset>, so we put the fieldset in a suffix. |
|
1108 |
'#field_suffix' => $featureTrees['treeRepresentations'], |
|
1109 |
'#description' => t('Select the feature tree to be used for displaying specimen descriptions. Click "Show Details" to see the Feature Tree elements.' |
|
1110 |
), |
|
1111 |
); |
|
1112 |
|
|
1099 | 1113 |
$form_name = CDM_DATAPORTAL_SPECIMEN_GALLERY_NAME; |
1100 | 1114 |
$form_title = t('Specimen media'); |
1101 | 1115 |
$form_description = t('Specimens may have media which is displayed at the |
... | ... | |
1694 | 1708 |
} |
1695 | 1709 |
} |
1696 | 1710 |
|
1711 |
|
|
1697 | 1712 |
/** |
1698 | 1713 |
* Implements hook_element_info(). |
1699 | 1714 |
* |
7.x/modules/cdm_dataportal/theme/cdm_dataportal.descriptions.theme | ||
---|---|---|
198 | 198 |
*/ |
199 | 199 |
else { |
200 | 200 |
if (isset($node->descriptionElements)) { |
201 |
$taxon_uuid = NULL; |
|
202 |
if(isset($taxon) ) { |
|
203 |
$taxon_uuid = $taxon->uuid; |
|
204 |
} |
|
201 | 205 |
$block->content .= theme('cdm_descriptionElements', array( |
202 | 206 |
'descriptionElements' => $node->descriptionElements, |
203 | 207 |
'featureUuid' => $node->feature->uuid, |
204 |
'taxon_uuid' => $taxon->uuid,
|
|
208 |
'taxon_uuid' => $taxon_uuid,
|
|
205 | 209 |
)); |
206 | 210 |
} |
207 | 211 |
/* |
... | ... | |
583 | 587 |
* |
584 | 588 |
* @param array $variables |
585 | 589 |
* An associative array containing: |
586 |
* - descriptionElements |
|
587 |
* - featureUuid |
|
588 |
* - taxon_uuid |
|
590 |
* - array of descriptionElements which belong to the same feature. |
|
591 |
* These descriptions elements of a Description must be ordered by the chosen feature tree by |
|
592 |
* calling the function _mergeFeatureTreeDescriptions(). |
|
593 |
* @see _mergeFeatureTreeDescriptions() |
|
594 |
* - featureUuid: currently unused, accoding code disabled |
|
595 |
* - taxon_uuid: only used for ordered dditributions (will be removed!) |
|
589 | 596 |
* |
590 | 597 |
* @ingroup themeable |
591 | 598 |
*/ |
... | ... | |
596 | 603 |
$outArray = array(); |
597 | 604 |
|
598 | 605 |
/* |
599 |
$userDefined = mixed_variable_get(LAYOUT_SETTING_PREFIX . $featureUuid, |
|
600 |
FEATURE_TREE_LAYOUT_DEFAULTS); if(variable_get('distribution_sort', |
|
601 |
'NO_SORT') != 'NO_SORT'){ $glue = ''; $enclosingTag = 'dl'; |
|
602 |
$entryEnclosingTag = NULL; } else if($userDefined && |
|
603 |
$userDefined['enabled']){ $glue = $userDefined['glue']; $enclosingTag = |
|
604 |
$userDefined['enclosingTag']; $entryEnclosingTag = |
|
605 |
$userDefined['entryEnclosingTag']; } else { // TODO remove once |
|
606 |
LAYOUT_SETTING_PREFIX-{uuid} seeting are confired to work for all portals |
|
607 |
(selenium test still missing!!!) $glue = ''; $enclosingTag = 'ul'; |
|
608 |
$entryEnclosingTag = NULL ; } |
|
606 |
$userDefined = mixed_variable_get(LAYOUT_SETTING_PREFIX . $featureUuid, FEATURE_TREE_LAYOUT_DEFAULTS); |
|
607 |
if(variable_get('distribution_sort', |
|
608 |
'NO_SORT') != 'NO_SORT'){ |
|
609 |
$glue = ''; |
|
610 |
$enclosingTag = 'dl'; |
|
611 |
$entryEnclosingTag = NULL; |
|
612 |
} else if($userDefined && |
|
613 |
$userDefined['enabled']){ |
|
614 |
$glue = $userDefined['glue']; |
|
615 |
$enclosingTag = $userDefined['enclosingTag']; |
|
616 |
$entryEnclosingTag = $userDefined['entryEnclosingTag']; |
|
617 |
} else { // TODO remove once LAYOUT_SETTING_PREFIX-{uuid} setting are configured to work for all portals(selenium test still missing!!!) |
|
618 |
$glue = ''; $enclosingTag = 'ul'; |
|
619 |
$entryEnclosingTag = NULL ; |
|
620 |
} |
|
609 | 621 |
*/ |
610 | 622 |
|
623 |
|
|
611 | 624 |
if (variable_get('distribution_sort', 'NO_SORT') != 'NO_SORT') { |
612 | 625 |
$glue = ''; |
613 | 626 |
$enclosingTag = 'dl'; |
... | ... | |
852 | 865 |
* @see http://drupal.org/node/1354 |
853 | 866 |
*/ |
854 | 867 |
function theme_cdm_description_ordered_distributions($variables) { |
868 |
|
|
855 | 869 |
$taxon_uuid = $variables['taxon_uuid']; |
856 | 870 |
$descriptionElements = $variables['descriptionElements']; |
871 |
|
|
857 | 872 |
// Returning NULL if there are no description elements. |
858 |
if ($descriptionElements == NULL) { |
|
859 |
return '';
|
|
873 |
if ($taxon_uuid == null || $descriptionElements == NULL) {
|
|
874 |
return NULL;
|
|
860 | 875 |
} |
876 |
|
|
861 | 877 |
// Initialization of some variables. |
862 | 878 |
$out = ''; |
863 | 879 |
$separator = ','; |
864 | 880 |
RenderHints::pushToRenderStack('descriptionElementDistribution'); |
865 | 881 |
RenderHints::setFootnoteListKey(UUID_DISTRIBUTION); |
882 |
|
|
866 | 883 |
// Getting all the taxon description for a given taxon. |
867 | 884 |
$markerTypesEmpty = array(); |
868 | 885 |
// $markerTypesEmpty['markerTypes'] = 'af9860ff-08f5-4b4d-863c-49ae96985115'; |
... | ... | |
871 | 888 |
foreach ($taxonDescriptions as $description) { |
872 | 889 |
$descriptions_uuids[] = $description->uuid; |
873 | 890 |
} |
891 |
|
|
874 | 892 |
// Getting the sortered distributions (omitting level ??). |
875 | 893 |
$request_params = array(); |
876 | 894 |
$request_params['omitLevels'] = UUID_NAMEDAREALEVEL_TDWGLEVEL_2; |
Also available in: Unified diff
feature tree for specimen descriptions, resetting map service uri