Skip to content

Commit

Permalink
Hotfix 2023-05-25 (BioKIC#488)
Browse files Browse the repository at this point in the history
* Taxon Profile display bug - Ensure the taxadescrblock field take precedence

* GeoLocate CoGe bug fix - path correction for temp staging area
  • Loading branch information
egbot authored May 31, 2023
1 parent 38dd6e9 commit de15df7
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 8 deletions.
2 changes: 1 addition & 1 deletion classes/OccurrenceMaintenance.php
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ public function getErrorArr(){
//Misc support functions
private function outputMsg($str, $indent = 0){
if($this->verbose){
echo '<li style="margin-left:'.($indent*10).'px;">'.$str.'</li>';
echo '<li style="margin-left:'.($indent*15).'px;">'.$str.'</li>';
ob_flush();
flush();
}
Expand Down
4 changes: 2 additions & 2 deletions classes/TPDescEditorManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public function __destruct(){
public function getDescriptions(){
$descrArr = Array();
$langArr = false;
$sql = 'SELECT p.tdProfileID, IFNULL(p.caption, d.caption) as caption, IFNULL(p.publication, d.source) AS source, IFNULL(p.urlTemplate, d.sourceurl) AS sourceurl,
IFNULL(p.defaultDisplayLevel, d.displaylevel) AS displaylevel, t.tid, t.sciname, d.tdbid, d.notes, l.langid, d.language
$sql = 'SELECT p.tdProfileID, IFNULL(d.caption, p.caption) as caption, IFNULL(d.source, p.publication) AS source, IFNULL(d.sourceurl, p.urlTemplate) AS sourceurl,
IFNULL(d.displaylevel, p.defaultDisplayLevel) AS displaylevel, t.tid, t.sciname, d.tdbid, d.notes, l.langid, d.language
FROM taxadescrprofile p INNER JOIN taxadescrblock d ON p.tdProfileID = d.tdProfileID
LEFT JOIN adminlanguages l ON p.langid = l.langid ';
if($this->acceptance){
Expand Down
21 changes: 19 additions & 2 deletions classes/TaxonProfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,8 @@ private function getDescriptions(){
$retArr = Array();
if($this->tid){
$rsArr = array();
$sql = 'SELECT p.tdProfileID, IFNULL(p.caption, d.caption) as caption, IFNULL(p.publication, d.source) AS source, IFNULL(p.urlTemplate, d.sourceurl) AS sourceurl,
IFNULL(p.defaultDisplayLevel, d.displaylevel) AS displaylevel, d.tid, d.tdbid, s.tdsid, s.heading, s.statement, s.displayheader, d.language, p.langid
$sql = 'SELECT p.tdProfileID, IFNULL(d.caption, p.caption) as caption, IFNULL(d.source, p.publication) AS source, IFNULL(d.sourceurl, p.urlTemplate) AS sourceurl,
IFNULL(d.displaylevel, p.defaultDisplayLevel) AS displaylevel, d.tid, d.tdbid, s.tdsid, s.heading, s.statement, s.displayheader, d.language, p.langid
FROM taxadescrprofile p INNER JOIN taxadescrblock d ON p.tdProfileID = d.tdProfileID
INNER JOIN taxadescrstmts s ON d.tdbid = s.tdbid
LEFT JOIN adminlanguages l ON p.langid = l.langid ';
Expand Down Expand Up @@ -482,6 +482,23 @@ public function getLinkArr(){
return $this->linkArr;
}

public function getResourceLinkArr(){
$retArr = array();
if($this->tid){
$sql = 'SELECT taxaResourceID, sourceName, sourceIdentifier, sourceGuid, url, notes FROM taxaresourcelinks WHERE tid = '.$this->tid.' ORDER BY ranking, sourceName';
$rs = $this->conn->query($sql);
while($r = $rs->fetch_object()){
$retArr[$r->taxaResourceID]['name'] = $r->sourceName;
$retArr[$r->taxaResourceID]['id'] = $r->sourceIdentifier;
$retArr[$r->taxaResourceID]['guid'] = $r->sourceGuid;
$retArr[$r->taxaResourceID]['url'] = $r->url;
$retArr[$r->taxaResourceID]['notes'] = $r->notes;
}
$rs->free();
}
return $retArr;
}

//Set children data for taxon higher than species level
public function getSppArray($page, $taxaLimit, $pid, $clid){
if(!$this->sppArray && $this->tid){
Expand Down
1 change: 1 addition & 0 deletions classes/TaxonomyCleaner.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ private function indexOccurrenceTaxa(){

$occurMaintenance = new OccurrenceMaintenance($this->conn);
$occurMaintenance->setCollidStr($this->collid);
$occurMaintenance->setVerbose(true);
$occurMaintenance->generalOccurrenceCleaning();
}

Expand Down
21 changes: 20 additions & 1 deletion classes/TaxonomyHarvester.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,9 @@ private function translateColNode($nodeArr){
elseif(isset($nodeArr['name']['authorship'])) $taxonArr['author'] = $nodeArr['name']['authorship'];
if(isset($nodeArr['source_database'])) $taxonArr['source'] = $nodeArr['source_database'];
elseif(isset($nodeArr['datasetKey'])) $taxonArr['source'] = '<a href="https://www.catalogueoflife.org/data/dataset/'.$nodeArr['datasetKey'].'" target="_blank">https://www.catalogueoflife.org/data/dataset/'.$nodeArr['datasetKey'].'</a>';
if(isset($nodeArr['source_database_url'])) $taxonArr['sourceURL'] = $nodeArr['source_database_url'];
if(isset($nodeArr['online_resource'])) $taxonArr['sourceURL'] = $nodeArr['online_resource'];
elseif(isset($nodeArr['link'])) $taxonArr['sourceURL'] = $nodeArr['link'];
if(isset($nodeArr['url'])) $taxonArr['resourceURL'] = $nodeArr['url'];
$rankID = $this->getRankIdByTaxonArr($taxonArr);
if($rankID){
$taxonArr['rankid'] = $rankID;
Expand Down Expand Up @@ -1250,6 +1251,15 @@ private function loadNewTaxon($taxonArr, $tidAccepted = 0){
}
$this->logOrEcho('Taxon <b>'.$taxonDisplay.'</b> added to thesaurus as '.$accStr,2);
}
//Load taxonomic resources identifiers
if(isset($taxonArr['resourceURL'])){
$this->insertTaxonomicResource($newTid, 'Catalog of Life', $taxonArr['id'], $taxonArr['resourceURL']);
}
if(isset($taxonArr['sourceURL'])){
if(preg_match('/molluscabase.+\D+(\d+)$/', $taxonArr['sourceURL'], $m)){
$this->insertTaxonomicResource($newTid, 'MolluscaBase', $m[1], $taxonArr['sourceURL']);
}
}
}
}
//Add Synonyms
Expand Down Expand Up @@ -1379,6 +1389,15 @@ private function getParentArr($taxonArr){
return $parArr;
}

private function insertTaxonomicResource($tid, $sourceName, $sourceIdentifier, $sourceUrl){
$sql = 'INSERT INTO taxaresourcelinks(tid, sourceName, sourceIdentifier, url) VALUES(?, ?, ?, ?)';
if($stmt = $this->conn->prepare($sql)){
$stmt->bind_param('isss', $tid, $sourceName, $sourceIdentifier, $sourceUrl);
$stmt->execute();
$stmt->close();
}
}

//Misc functions
public function buildTaxonArr(&$taxonArr){
if(is_array($taxonArr)){
Expand Down
3 changes: 3 additions & 0 deletions collections/download/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ function closePage(timeToClose){
<button type="submit" name="submitaction">Download Data</button>
<img id="workingcircle" src="../../images/ajax-loader_sm.gif" style="margin-bottom:-4px;width:20px;display:none;" />
</div>
<div class="sectionDiv">
* There is a 1,000,000 record limit to occurrence downloads
</div>
</fieldset>
</form>
</div>
Expand Down
2 changes: 1 addition & 1 deletion collections/specprocessor/rpc/coge_build_dwca.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
if(substr($tPath,-1) != '/' && substr($tPath,-1) != '\\'){
$tPath .= '/';
}
$pathFrag = 'temp/data/geolocate/';
$pathFrag = 'temp/data/';
$tPath .= $pathFrag;
$dwcaHandler->setTargetPath($tPath);
$cnt = $dwcaHandler->getOccurrenceCnt();
Expand Down
2 changes: 1 addition & 1 deletion config/symbbase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
header('X-Frame-Options: DENY');
header('Cache-control: private'); // IE 6 FIX
date_default_timezone_set('America/Phoenix');
$CODE_VERSION = '3.0.6';
$CODE_VERSION = '3.0.7';

if(!isset($CLIENT_ROOT) && isset($clientRoot)) $CLIENT_ROOT = $clientRoot;
if(substr($CLIENT_ROOT,-1) == '/') $CLIENT_ROOT = substr($CLIENT_ROOT,0,strlen($CLIENT_ROOT)-1);
Expand Down
15 changes: 15 additions & 0 deletions taxa/resourcetab.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
?>
<div id="tab-resource" class="sptab">
<?php
echo '<div class="resource-div">';
echo '<div class="resource-title">'.(isset($LANG['INTERNAL_RESOURCES'])?$LANG['INTERNAL_RESOURCES']:'Internal Resources').'</div>';
echo '<ul>';
$occNum = $taxonManager->getOccTaxonInDbCnt();
Expand All @@ -37,16 +38,30 @@
}
echo '<li><a href="taxonomy/taxonomydynamicdisplay.php?target='.$tid.'" target="_blank">Taxonomic Tree</a></li>';
echo '</ul>';
echo '</div>';
//TODO: list other internal resources such as Taxon Traits, etc

if($linkArr = $taxonManager->getLinkArr()){
echo '<div class="resource-div">';
echo '<div class="resource-title">'.(isset($LANG['EXTERNAL_RESOURCES'])?$LANG['EXTERNAL_RESOURCES']:'External Resources').'</div>';
echo '<ul>';
foreach($linkArr as $linkObj){
echo '<li><a href="'.$linkObj['url'].'" target="_blank">'.$linkObj['title'].'</a></li>';
if($linkObj['notes']) echo '<li style="margin-left:10px">'.$linkObj['notes'].'</li>';
}
echo '</ul>';
echo '</div>';
}
if($resourceArr = $taxonManager->getResourceLinkArr()){
echo '<div class="resource-div">';
echo '<div class="resource-title">'.(isset($LANG['TAXONOMIC_RESOURCES'])?$LANG['TAXONOMIC_RESOURCES']:'Taxonomic Resources').'</div>';
echo '<ul>';
foreach($resourceArr as $resourceObj){
echo '<li><a href="'.$resourceObj['url'].'" target="_blank">'.$resourceObj['name'].' #'.$resourceObj['id'].($resourceObj['guid']?$resourceObj['guid']:'').'</a></li>';
if($resourceObj['notes']) echo '<li style="margin-left:10px">'.$resourceObj['notes'].'</li>';
}
echo '</ul>';
echo '</div>';
}
?>
</div>

0 comments on commit de15df7

Please sign in to comment.