Revision 80d21b78
Added by Andreas Kohlbecker over 5 years ago
modules/cdm_dataportal/cdm_api/cdm_api.module | ||
---|---|---|
1720 | 1720 |
if (!$absoluteURI) { |
1721 | 1721 |
$uri = cdm_compose_url($uri, $pathParameters, $query); |
1722 | 1722 |
} |
1723 |
cdm_ws_apply_classification_subtree_filter($uri); |
|
1723 | 1724 |
|
1724 | 1725 |
// read request parameter 'cacheL2_refresh' |
1725 | 1726 |
// which allows refreshing the level 2 cache |
... | ... | |
1819 | 1820 |
return $obj; |
1820 | 1821 |
} |
1821 | 1822 |
|
1823 |
function cdm_ws_apply_classification_subtree_filter(&$uri){ |
|
1824 |
|
|
1825 |
$classification_subtree_filter_patterns = &drupal_static('classification_subtree_filter_patterns', array( |
|
1826 |
"#/classification/[0-9a-f\-]{36}/childNodes#", |
|
1827 |
"#/classification/[0-9a-f\-]{36}/childNodesAt/{rankUuid}#", |
|
1828 |
"#/portal/classification/[0-9a-f\-]{36}/childNodes#", |
|
1829 |
"#/portal/classification/[0-9a-f\-]{36}/childNodesAt/[0-9a-f\-]{36}#", |
|
1830 |
"#/portal/taxon/search#", |
|
1831 |
"#/portal/taxon/find#", |
|
1832 |
"#/portal/taxon/findByDescriptionElementFullText#", |
|
1833 |
"#/portal/taxon/findByFullText#", |
|
1834 |
"#/portal/taxon/findByEverythingFullText#", |
|
1835 |
"#/portal/taxon/findByIdentifier#", |
|
1836 |
"#/portal/taxon/findByMarker#" |
|
1837 |
)); |
|
1838 |
|
|
1839 |
$sub_tree_filter_uuid_value = variable_get(CDM_SUB_TREE_FILTER_UUID, FALSE); |
|
1840 |
if(is_uuid($sub_tree_filter_uuid_value)){ |
|
1841 |
foreach($classification_subtree_filter_patterns as $preg_pattern){ |
|
1842 |
if(preg_match($preg_pattern, $uri)){ |
|
1843 |
// no need to take care for uri fragments with ws uris! |
|
1844 |
if(strpos( $uri, '?')){ |
|
1845 |
$uri .= '&subtree=' . $sub_tree_filter_uuid_value; |
|
1846 |
} else { |
|
1847 |
$uri .= '?subtree='. $sub_tree_filter_uuid_value; |
|
1848 |
} |
|
1849 |
break; |
|
1850 |
} |
|
1851 |
} |
|
1852 |
} |
|
1853 |
|
|
1854 |
} |
|
1822 | 1855 |
/** |
1823 | 1856 |
* Processes and stores the given information in $_SESSION['cdm']['ws_debug'] as table row. |
1824 | 1857 |
* |
modules/cdm_dataportal/cdm_api/webservice_uris.php | ||
---|---|---|
53 | 53 |
define('CDM_WS_TAXON_SEARCH', 'taxon/search'); |
54 | 54 |
define('CDM_WS_PORTAL_TAXON_FINDBY_DESCRIPTIONELEMENT_FULLTEXT', 'portal/taxon/findByDescriptionElementFullText'); |
55 | 55 |
|
56 |
|
|
57 |
define('CDM_WS_TAXONNODE', 'taxonNode/$0'); |
|
58 |
|
|
56 | 59 |
/** |
57 | 60 |
* /description/{uuid}/naturalLanguageDescription/{featuretree_uuid} |
58 | 61 |
*/ |
modules/cdm_dataportal/settings.php | ||
---|---|---|
12 | 12 |
define('CDM_TAXONOMICTREE_UUID', 'cdm_taxonomictree_uuid'); |
13 | 13 |
define('CDM_TAXONTREE_INCLUDES', 'taxontree_includes'); |
14 | 14 |
|
15 |
define('CDM_SUB_TREE_FILTER_UUID', 'cdm_sub_tree_filter_uuid'); |
|
16 |
|
|
15 | 17 |
define('NO_SORT', -1); |
16 | 18 |
define('SORT_HIERARCHICAL', 9); |
17 | 19 |
|
... | ... | |
1216 | 1218 |
'#default_value' => variable_get('cdm_webservice_proxy_pwd', FALSE), |
1217 | 1219 |
); |
1218 | 1220 |
|
1221 |
$form['sub_tree_filter'] = array( |
|
1222 |
'#type' => 'fieldset', |
|
1223 |
'#title' => t('Subtree filter'), |
|
1224 |
'#collapsible' => FALSE, |
|
1225 |
'#collapsed' => TRUE, |
|
1226 |
'#description' => t('The Data Portal can be restricted to the taxa which belong to a specific classification subtree. Other taxa will not be shown or accessible otherwise.'), |
|
1227 |
); |
|
1228 |
|
|
1229 |
$sub_tree_filter_uuid_value = variable_get(CDM_SUB_TREE_FILTER_UUID, FALSE); |
|
1230 |
$taxon_node_info = ''; |
|
1231 |
if($sub_tree_filter_uuid_value){ |
|
1232 |
$taxon_node_dto = cdm_ws_get(CDM_WS_TAXONNODE, array($sub_tree_filter_uuid_value)); |
|
1233 |
if($taxon_node_dto){ |
|
1234 |
$taxon_node_info = " Current taxon node: <strong>" . cdm_tagged_text_to_markup($taxon_node_dto->taggedTitle) . " [" . $taxon_node_dto->treeIndex . "]</strong>"; |
|
1235 |
} |
|
1236 |
} |
|
1237 |
$form['sub_tree_filter'][CDM_SUB_TREE_FILTER_UUID] = array( |
|
1238 |
'#type' => 'textfield', |
|
1239 |
'#title' => t('Taxon Node UUID') . ':', |
|
1240 |
'#default_value' => variable_get(CDM_SUB_TREE_FILTER_UUID, FALSE), |
|
1241 |
'#description' => "The uuid of the TaxonNode entity to be used as filter." . $taxon_node_info |
|
1242 |
); |
|
1243 |
|
|
1219 | 1244 |
// TODO: settings are still incomplete, compare with |
1220 | 1245 |
// trunk/dataportal/inc/config_default.php.inc. |
1221 | 1246 |
$form['taxon_tree'] = array( |
Also available in: Unified diff
fix #7759 implementing classification subtree filtering