Project

General

Profile

bug #6356

Updated by Andreas Kohlbecker over 6 years ago

The classification browser (taxontree) should be    using the same sort order as the taxon navigator in the editor. 

 Maybe this should be optional? Do we need to allow configuring the sort mode? 


 **How taxon nodes are sorted in the portal:** 

 the nodes at level lower that root level are being sorted in the portal in the function cdm_taxontree.module#cdm_taxontree_populate. The order of nodes at root level seems not to be changed: 

 ~~~php 
 function cdm_taxontree_populate($tree, $expand_excluded, $filter_default = NULL) { 

 ... 

 // Reorder nodes which are not expanded, expanded nodes are reordered 
       // implicitly above. 
       if (isset($tree[$uuid]->children) && count($tree[$uuid]->children) > 1) { 
         // Copy the children into an array which can be sorted by its keys. 
         $ordered = array(); 
         foreach ($tree[$uuid]->children as $cnode) { 
           // Concatenate full name and uid. 
           $reordered[str_pad($cnode->titleCache, 255, '-') . $cnode->taxonUuid] = $cnode; 
         } 

         // Sort. 
         ksort($reordered); 

         // Move the children back into the parent node. 
         $tree[$uuid]->children = array(); 
         foreach ($reordered as $cnode) { 
           $tree[$uuid]->children[$cnode->taxonUuid] = $cnode; 
         } 

 ... 

 } 
 ~~~ 

 That is the nodes are sorted only alphabetically in the portal.   

 **TODO**: Check if the order of the nodes as they are coming from the web service is already ordered correctly. In this case we only need to remove the reordering implemented in the portal

Back