Project

General

Profile

« Previous | Next » 

Revision 80d21b78

Added by Andreas Kohlbecker over 5 years ago

fix #7759 implementing classification subtree filtering

View differences:

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
 *

Also available in: Unified diff