Skip to content

Commit

Permalink
Merge pull request #425 from BioKIC/master
Browse files Browse the repository at this point in the history
Hotfix 2023 07 22 (BioKIC#559)
  • Loading branch information
egbot authored Jul 31, 2023
2 parents 0a9f10b + b3bccdb commit e67a69f
Show file tree
Hide file tree
Showing 15 changed files with 80 additions and 96 deletions.
6 changes: 1 addition & 5 deletions checklists/checklist.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,14 @@
if($clid) echo 'var clid = '.$clid.';'."\n";
echo 'var taxaCount = '.count($taxaArray).';'."\n";
?>
$( function() {
$( document ).tooltip();
} );

function changeImageSource(elem){
let f = document.optionform;
if(elem.id == "vi_voucher") f.voucherimages.value = "1";
else f.voucherimages.value = "0";
f.submit();
}
</script>
<script type="text/javascript" src="../js/symb/checklists.checklist.js?ver=3"></script>
<script type="text/javascript" src="../js/symb/checklists.checklist.js?ver=4"></script>
<style type="text/css">
<?php
if($printMode){
Expand Down
4 changes: 2 additions & 2 deletions checklists/rpc/searchsuggest.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
include_once('../../config/symbini.php');
include_once($SERVER_ROOT.'/classes/ChecklistManager.php');
header("Content-Type: text/html; charset=".$CHARSET);
header('Content-Type: text/html; charset='.$CHARSET);

$clid = $_REQUEST['clid'];
$term = $_REQUEST['term'];
$deep = (isset($_REQUEST['deep'])?$_REQUEST['deep']:0);

$clManager = new ChecklistManager();
$retArr = $clManager->getTaxonSearch($term,$clid,$deep);
$retArr = $clManager->getTaxonSearch($term, $clid, $deep);
echo json_encode($retArr);
?>
10 changes: 7 additions & 3 deletions classes/ChecklistManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -329,11 +329,16 @@ private function setImages(){
if($this->taxaList){
$matchedArr = array();
if($this->limitImagesToVouchers){
$clidStr = $this->clid;
if($this->childClidArr){
$clidStr .= ','.implode(',',array_keys($this->childClidArr));
}
$sql = 'SELECT i.tid, i.url, i.thumbnailurl, i.originalurl
FROM images i INNER JOIN omoccurrences o ON i.occid = o.occid
INNER JOIN fmvouchers v ON o.occid = v.occid
INNER JOIN fmchklsttaxalink cl ON v.clTaxaID = cl.clTaxaID
WHERE (cl.clid = 2) AND (i.tid IN('.implode(',',array_keys($this->taxaList)).'))';
WHERE (cl.clid = '.$clidStr.') AND (i.tid IN('.implode(',',array_keys($this->taxaList)).'))
ORDER BY i.sortOccurrence, i.sortSequence';
$matchedArr = $this->setImageSubset($sql);
}
if($missingArr = array_diff(array_keys($this->taxaList),$matchedArr)){
Expand All @@ -346,7 +351,7 @@ private function setImages(){
$matchedArr = $this->setImageSubset($sql);
if($missingArr = array_diff(array_keys($this->taxaList),$matchedArr)){
//Get children images
$sql = 'SELECT i2.tid, i.url, i.thumbnailurl FROM images i INNER JOIN '.
$sql = 'SELECT DISTINCT i2.tid, i.url, i.thumbnailurl FROM images i INNER JOIN '.
'(SELECT ts1.parenttid AS tid, SUBSTR(MIN(CONCAT(LPAD(i.sortsequence,6,"0"),i.imgid)),7) AS imgid '.
'FROM taxstatus ts1 INNER JOIN taxstatus ts2 ON ts1.tidaccepted = ts2.tidaccepted '.
'INNER JOIN images i ON ts2.tid = i.tid '.
Expand All @@ -361,7 +366,6 @@ private function setImages(){
private function setImageSubset($sql){
$matchTidArr = array();
if($this->taxaList){
//echo $sql;
$rs = $this->conn->query($sql);
while($r = $rs->fetch_object()){
if(!in_array($r->tid,$matchTidArr)){
Expand Down
19 changes: 9 additions & 10 deletions classes/DwcArchiverCore.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class DwcArchiverCore extends Manager{
private $includeDets = 1;
private $includeImgs = 1;
private $includeAttributes = 0;
private $includeMaterialSample = 0; // 0 = off, 1 = on, 2 = active (activated within at least one collection)
private $includeMaterialSample = 0;
private $hasPaleo = false;
private $redactLocalities = 1;
private $rareReaderArr = array();
Expand Down Expand Up @@ -191,7 +191,6 @@ public function setCollArr($collTarget, $collType = ''){
if (isset($modArr['paleo']['status'])) $this->hasPaleo = true;
elseif (isset($modArr['matSample']['status'])){
$this->collArr[$r->collid]['matSample'] = 1;
$this->includeMaterialSample = 2;
}
}
}
Expand Down Expand Up @@ -1055,7 +1054,7 @@ private function writeMetaFile(){
}

//MaterialSample extension
if ($this->includeMaterialSample == 2 && isset($this->fieldArrMap['materialSample'])) {
if ($this->includeMaterialSample && isset($this->fieldArrMap['materialSample'])) {
$extElem3 = $newDoc->createElement('extension');
$extElem3->setAttribute('encoding', $this->charSetOut);
$extElem3->setAttribute('fieldsTerminatedBy', $this->delimiter);
Expand Down Expand Up @@ -1765,7 +1764,7 @@ private function writeOccurrenceFile(){

$batchOccidArr[] = $r['occid'];
if (count($batchOccidArr) > 1000) {
if ($this->includeMaterialSample == 2) $this->writeMaterialSampleData($materialSampleHandler, $batchOccidArr);
if ($this->includeMaterialSample) $this->writeMaterialSampleData($materialSampleHandler, $batchOccidArr);
if ($pubID && $portalManager) $portalManager->insertPortalOccurrences($pubID, $batchOccidArr);
unset($batchOccidArr);
$batchOccidArr = array();
Expand All @@ -1782,7 +1781,7 @@ private function writeOccurrenceFile(){
if ($batchOccidArr) {
if ($pubID && $portalManager) $portalManager->insertPortalOccurrences($pubID, $batchOccidArr);
}
if ($this->includeMaterialSample == 2){
if ($this->includeMaterialSample){
$this->writeMaterialSampleData($materialSampleHandler, $batchOccidArr);
$materialSampleHandler->__destruct();
}
Expand All @@ -1801,7 +1800,7 @@ private function writeOccurrenceFile(){
$this->logOrEcho($this->errorMessage);
}
$this->logOrEcho('Done! (' . date('h:i:s A') . ")\n");
if ($this->includeMaterialSample == 2) $this->logOrEcho('Material Sample extension file created (' . date('h:i:s A') . ')... ');
if ($this->includeMaterialSample) $this->logOrEcho('Material Sample extension file created (' . date('h:i:s A') . ')... ');
return $filePath;
}

Expand Down Expand Up @@ -2161,19 +2160,19 @@ public function setDelimiter($d){
}

public function setIncludeDets($includeDets){
$this->includeDets = $includeDets;
if($includeDets) $this->includeDets = true;
}

public function setIncludeImgs($includeImgs){
$this->includeImgs = $includeImgs;
if($includeImgs) $this->includeImgs = true;
}

public function setIncludeAttributes($include){
$this->includeAttributes = $include;
if($include) $this->includeAttributes = true;
}

public function setIncludeMaterialSample($include){
$this->includeMaterialSample = $include;
if($include) $this->includeMaterialSample = true;
}

public function hasAttributes(){
Expand Down
8 changes: 5 additions & 3 deletions classes/OccurrenceUtilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -704,11 +704,13 @@ public static function occurrenceArrayCleaning($recMap){
}
}
else{
if(array_key_exists('genus',$recMap) && array_key_exists('specificepithet',$recMap) && array_key_exists('infraspecificepithet',$recMap)){
if(array_key_exists('genus',$recMap) && array_key_exists('specificepithet',$recMap)){
//Build sciname from individual units supplied by source
$sciName = trim($recMap['genus'].' '.$recMap['specificepithet']);
if(array_key_exists('taxonrank',$recMap)) $sciName .= ' '.$recMap['taxonrank'];
$sciName .= ' '.$recMap['infraspecificepithet'];
if(array_key_exists('infraspecificepithet',$recMap)){
if(array_key_exists('taxonrank',$recMap)) $sciName .= ' '.$recMap['taxonrank'];
$sciName .= ' '.$recMap['infraspecificepithet'];
}
$recMap['sciname'] = trim($sciName);
}
elseif(array_key_exists('scientificname',$recMap)){
Expand Down
6 changes: 2 additions & 4 deletions classes/SpecUploadDwca.php
Original file line number Diff line number Diff line change
Expand Up @@ -601,10 +601,8 @@ public function uploadData($finalTransfer){
$index = array_shift($indexArr);
if(array_key_exists($index,$recordArr)){
$valueStr = trim($recordArr[$index]);
if($valueStr){
if($cset != $this->encoding) $valueStr = $this->encodeString($valueStr);
$recMap[$symbField] = $valueStr;
}
if($cset != $this->encoding) $valueStr = $this->encodeString($valueStr);
$recMap[$symbField] = $valueStr;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion classes/TaxonSearchSupport.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private function getTaxaSuggestByRank(){
//Setters and getters
public function setQueryString($queryString){
//$queryString = $this->cleanInStr($queryString);
$queryString = preg_replace('/[\'"+\-=@$%]+/i', '', $queryString);
$queryString = preg_replace('/[\'"+\=@$%]+/i', '', $queryString);
if(strpos($queryString, ' ')){
$queryString = preg_replace('/\s{1}x{1}$/i', ' _', $queryString);
$queryString = preg_replace('/\s{1}x{1}\s{1}/i', ' _ ', $queryString);
Expand Down
40 changes: 19 additions & 21 deletions classes/TaxonomyHarvester.php
Original file line number Diff line number Diff line change
Expand Up @@ -965,28 +965,26 @@ private function addFdexTaxon($taxonArr){
if($numResults){
$tidAccepted = 0;
foreach($resultArr as $unitArr){
if($unitArr['recordSource'] == 'Index Fungorum'){
$taxonArr['sciname'] = $unitArr['taxon'];
$taxonArr['author'] = $unitArr['authors'];
$rankID = $this->getRankId($unitArr['rank']);
if($rankID) $taxonArr['rankid'] = $rankID;
$taxonArr['source'] = 'Via fDex: '.$unitArr['recordSource'];
$taxonArr['notes'] = 'taxonomicStatus: '.$unitArr['taxonomicStatus'].'; currentStatus: '.$unitArr['currentStatus'];
if(isset($unitArr['parentTaxon'])){
$parentTaxon = $unitArr['parentTaxon'];
$parentTid = 0;
$parentArr = $this->parseCleanCheck($parentTaxon);
if(isset($parentArr['tid']) && $parentArr['tid']) $parentTid = $parentArr['tid'];
else $parentTid = $this->addFdexTaxon($parentArr);
if($parentTid) $taxonArr['parent']['tid'] = $parentTid;
}
if($unitArr['taxon'] != $unitArr['currentTaxon']){
$acceptedArr = $this->parseCleanCheck($unitArr['currentTaxon']);
if(isset($acceptedArr['tid']) && $acceptedArr['tid']) $tidAccepted = $acceptedArr['tid'];
else $tidAccepted = $this->addFdexTaxon($acceptedArr);
}
$taxonArr['sciname'] = $unitArr['taxon'];
$taxonArr['author'] = $unitArr['authors'];
$rankID = $this->getRankId($unitArr['rank']);
if($rankID) $taxonArr['rankid'] = $rankID;
$taxonArr['source'] = 'Via fDex: '.$unitArr['recordSource'];
$taxonArr['notes'] = 'taxonomicStatus: '.$unitArr['taxonomicStatus'].'; currentStatus: '.$unitArr['currentStatus'];
if(isset($unitArr['parentTaxon'])){
$parentTaxon = $unitArr['parentTaxon'];
$parentTid = 0;
$parentArr = $this->parseCleanCheck($parentTaxon);
if(isset($parentArr['tid']) && $parentArr['tid']) $parentTid = $parentArr['tid'];
else $parentTid = $this->addFdexTaxon($parentArr);
if($parentTid) $taxonArr['parent']['tid'] = $parentTid;
}
break;
if($unitArr['taxon'] != $unitArr['currentTaxon']){
$acceptedArr = $this->parseCleanCheck($unitArr['currentTaxon']);
if(isset($acceptedArr['tid']) && $acceptedArr['tid']) $tidAccepted = $acceptedArr['tid'];
else $tidAccepted = $this->addFdexTaxon($acceptedArr);
}
if($unitArr['recordSource'] == 'Index Fungorum') break;
}
if($taxonArr) $tid = $this->loadNewTaxon($taxonArr, $tidAccepted);
}
Expand Down
4 changes: 3 additions & 1 deletion collections/admin/specuploadmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -627,9 +627,11 @@ function pkChanged(selObj){
</ul>
<?php
}
$versionCheckedStr = '';
if($isLiveData) $versionCheckedStr = 'checked';
?>
<div style="margin:10px 0px;">
<input name="versiondata" type="checkbox" value="1" checked />
<input name="versiondata" type="checkbox" value="1" <?php echo $versionCheckedStr; ?> />
<?php echo (isset($LANG['VERSION_DATA_CHANGES'])?$LANG['VERSION_DATA_CHANGES']:'Version data changes'); ?>
</div>
<div style="margin:10px 0px;">
Expand Down
6 changes: 3 additions & 3 deletions collections/harvestparams.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

$collManager = new OccurrenceManager();
$searchVar = $collManager->getQueryTermStr();
$attribSearch = new OccurrenceAttributeSearch();
?>
<html>
<head>
Expand All @@ -19,7 +18,7 @@
<script src="../js/jquery-3.2.1.min.js?ver=3" type="text/javascript"></script>
<script src="../js/jquery-ui/jquery-ui.min.js?ver=3" type="text/javascript"></script>
<link href="../js/jquery-ui/jquery-ui.min.css" type="text/css" rel="Stylesheet" />
<script src="../js/symb/collections.harvestparams.js?ver=1" type="text/javascript"></script>
<script src="../js/symb/collections.harvestparams.js?ver=2" type="text/javascript"></script>
<script src="../js/symb/collections.traitsearch.js?ver=8" type="text/javascript"></script> <!-- Contains search-by-trait modifications -->
<script src="../js/symb/wktpolygontools.js?ver=1c" type="text/javascript"></script>
<script type="text/javascript">
Expand Down Expand Up @@ -244,7 +243,8 @@
</div>
</div>
<?php
if(isset($SEARCH_BY_TRAITS) && $SEARCH_BY_TRAITS) {
if(!empty($SEARCH_BY_TRAITS)) {
$attribSearch = new OccurrenceAttributeSearch();
$traitArr = $attribSearch->getTraitSearchArr($SEARCH_BY_TRAITS);
if($traitArr){
?>
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.10';
$CODE_VERSION = '3.0.11';

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
4 changes: 2 additions & 2 deletions config/symbini_template.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@
$ACTIVATE_DUPLICATES = 0; //Activates Specimen Duplicate listings and support features. Mainly relavent for herabrium collections
$ACTIVATE_EXSICCATI = 0; //Activates exsiccati fields within data entry pages; adding link to exsiccati search tools to portal menu is recommended
$ACTIVATE_GEOLOCATE_TOOLKIT = 0; //Activates GeoLocate Toolkit located within the Processing Toolkit menu items
$SEARCH_BY_TRAITS = '0'; //Activates search fields for searching by traits (if trait data have been encoded): 0 = trait search off; any number of non-zeros separated by commas (e.g., '1,6') = trait search on for the traits with these id numbers in table tmtraits.
$CALENDAR_TRAIT_PLOTS = '0'; //Activates polar plots, in taxon profile, of the trait states listed: 0 = no plot; any number of non-zeros separated by commas (e.g., '1,6') = plots appear for the trait states with these id numbers (in table tmstates).
$SEARCH_BY_TRAITS = 0; //Activates search fields for searching by traits (if trait data have been encoded): 0 = trait search off; any number of non-zeros separated by commas (e.g., '1,6') = trait search on for the traits with these id numbers in table tmtraits.
$CALENDAR_TRAIT_PLOTS = 0; //Activates polar plots, in taxon profile, of the trait states listed: 0 = no plot; any number of non-zeros separated by commas (e.g., '1,6') = plots appear for the trait states with these id numbers (in table tmstates).

$IGSN_ACTIVATION = 0;

Expand Down
7 changes: 1 addition & 6 deletions js/symb/checklists.checklist.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ $(document).ready(function() {
//Filter autocomplete
$("#taxonfilter").autocomplete({
source: function( request, response ) {
$.getJSON( "rpc/searchsuggest.php", { term: request.term, clid: clid }, response );
$.getJSON( "rpc/searchsuggest.php", { term: request.term, clid: clid, deep: 1 }, response );
}
},
{ minLength: 3 });
Expand All @@ -17,11 +17,6 @@ $(document).ready(function() {
autoFocus: true
});

$("#speciestoadd").autocomplete({
source: "rpc/speciessuggest.php",
minLength: 4,
autoFocus: true
});
if(document.cookie.indexOf("editspp") > -1){
$(".editspp").show();
document.getElementById("editsppon").style.display = "inline";
Expand Down
56 changes: 23 additions & 33 deletions js/symb/collections.harvestparams.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,27 @@ function cleanNumericInput(formElem){

function checkHarvestParamsForm(frm){
//make sure they have filled out at least one field.
if((frm.taxa.value.trim() == '') && (frm.country.value.trim() == '') && (frm.state.value.trim() == '') && (frm.county.value.trim() == '') &&
(frm.local.value.trim() == '') && (frm.elevlow.value.trim() == '') && (frm.upperlat.value.trim() == '') && (frm.footprintwkt.value.trim() == '') && (frm.pointlat.value.trim() == '') &&
(frm.collector.value.trim() == '') && (frm.collnum.value.trim() == '') && (frm.eventdate1.value.trim() == '') && (frm.catnum.value.trim() == '') &&
(frm.typestatus.checked == false) && (frm.hasimages.checked == false) && (frm.hasgenetic.checked == false) && (frm.hascoords.checked == false)){
//Check trait search fields if present
if (typeof frm.SearchByTraits !== "undefined" && frm.SearchByTraits.value == "true") {
var traitinputs = frm.elements;
var traitselected = false;
for(var i = 0; i < traitinputs.length; i++) {
if(traitinputs[i].name.indexOf('traitid-') == 0) {
if(traitinputs[i].type == 'checkbox' || traitinputs[i].type == 'radio') {
if(traitinputs[i].checked == true) {
traitselected = traitinputs[i].checked;
break;
}
} else {
if(traitinputs[i].value.trim() !== '') {
traitselected = true;
break;
}
}
}
}
if(!traitselected) {
alert("Please fill in at least one search parameter!");
return false;
let searchDefined = false;
let traitInputs = frm.elements;
for(var i = 0; i < traitInputs.length; i++) {
if(traitInputs[i].type == "text" || traitInputs[i].type == "textarea"){
if(traitInputs[i].value.trim() != ""){
searchDefined = true;
break;
}
}
else if(traitInputs[i].type == "checkbox" || traitInputs[i].type == "radio"){
if(traitInputs[i].name != "usethes" && traitInputs[i].name != "includeothercatnum" && traitInputs[i].name != "includecult"){
if(traitInputs[i].checked){
searchDefined = true;
break;
}
} else {
alert("Please fill in at least one search parameter!");
return false;
}
}
}
if(!searchDefined) {
alert("Please fill in at least one search parameter!");
return false;
}

if(frm.upperlat.value != '' || frm.bottomlat.value != '' || frm.leftlong.value != '' || frm.rightlong.value != ''){
Expand All @@ -62,17 +52,17 @@ function checkHarvestParamsForm(frm){
alert("Longitude values can not be greater than 180 or less than -180.");
return false;
}
var uLat = frm.upperlat.value;
let uLat = frm.upperlat.value;
if(frm.upperlat_NS.value == 'S') uLat = uLat * -1;
var bLat = frm.bottomlat.value;
let bLat = frm.bottomlat.value;
if(frm.bottomlat_NS.value == 'S') bLat = bLat * -1;
if(uLat < bLat){
alert("Your northern latitude value is less then your southern latitude value. Please correct this.");
return false;
}
var lLng = frm.leftlong.value;
let lLng = frm.leftlong.value;
if(frm.leftlong_EW.value == 'W') lLng = lLng * -1;
var rLng = frm.rightlong.value;
let rLng = frm.rightlong.value;
if(frm.rightlong_EW.value == 'W') rLng = rLng * -1;
if(lLng > rLng){
alert("Your western longitude value is greater then your eastern longitude value. Please correct this. Note that western hemisphere longitudes in the decimal format are negitive.");
Expand Down
Loading

0 comments on commit e67a69f

Please sign in to comment.