Skip to content

Commit

Permalink
Merge pull request #30 from BioKIC/master
Browse files Browse the repository at this point in the history
Update to BioKIC/Symbiota v3.0.13
  • Loading branch information
egbot authored Sep 1, 2023
2 parents f709f0f + 38e3c36 commit 84baa3e
Show file tree
Hide file tree
Showing 78 changed files with 1,388 additions and 1,101 deletions.
2 changes: 2 additions & 0 deletions admin/schemamanager.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
$schemaManager->setPort($port);
$schemaManager->setUsername($username);
$schemaManager->installPatch();
$verHistory = $schemaManager->getVersionHistory();
$curentVersion = $schemaManager->getCurrentVersion();
}
?>
</fieldset>
Expand Down
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
45 changes: 23 additions & 22 deletions checklists/checklistmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,33 +67,34 @@ function initialize(){
}
}
}
//Check for and add checklist polygon
$clMeta = $clManager->getClMetaData();
if($clMeta['footprintwkt']){
?>
var polyPointArr = [];
<?php
$footPrintWkt = $clMeta['footprintwkt'];
if(substr($footPrintWkt, 0, 7) == 'POLYGON'){
$footPrintWkt = substr($footPrintWkt, 10, -2);
$pointArr = explode(',', $footPrintWkt);
foreach($pointArr as $pointStr){
$llArr = explode(' ', trim($pointStr));
if($llArr[0] > 90 || $llArr[0] < -90) break;
//Add checklist polygon
$wkt = $clMeta['footprintwkt'];
if(substr($wkt,0,7) == 'POLYGON') $wkt = substr($wkt,7);
else if(substr($wkt,0,12) == 'MULTIPOLYGON') $wkt = substr($wkt,12);
$coordArr = explode('),(', $wkt);
foreach($coordArr as $k => $polyFrag){
if($pointArr = explode(',', trim($polyFrag,' (),'))){
echo 'var polyPointArr'.$k.' = [];';
foreach($pointArr as $pointStr){
$llArr = explode(' ', trim($pointStr));
if($llArr[0] > 90 || $llArr[0] < -90) break;
?>
var polyPt = new google.maps.LatLng(<?php echo $llArr[0].','.$llArr[1]; ?>);
polyPointArr<?php echo $k; ?>.push(polyPt);
llBounds.extend(polyPt);
<?php
}
?>
var polyPt = new google.maps.LatLng(<?php echo $llArr[0].','.$llArr[1]; ?>);
polyPointArr.push(polyPt);
llBounds.extend(polyPt);
var footPoly<?php echo $k; ?> = new google.maps.Polygon({
paths: polyPointArr<?php echo $k; ?>,
strokeWeight: 2,
fillOpacity: 0.4,
map: map
});
<?php
}
?>
var footPoly = new google.maps.Polygon({
paths: polyPointArr,
strokeWeight: 2,
fillOpacity: 0.4,
map: map
});
<?php
}
}
?>
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
20 changes: 18 additions & 2 deletions classes/ChecklistVoucherAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ public function linkVouchers($occidArr){
return $statusCnt;
}

public function linkVoucher($taxa, $occid, $morphoSpecies=''){
public function linkVoucher($taxa, $occid, $morphoSpecies = '', $editorNotes = null, $notes = null){
$status = false;
if($this->voucherIsLinked($occid)){
$this->errorMessage = 'voucherAlreadyLinked';
Expand All @@ -364,7 +364,7 @@ public function linkVoucher($taxa, $occid, $morphoSpecies=''){
$clTaxaID = $this->getClTaxaID($taxa, $morphoSpecies);
if(!$clTaxaID) $clTaxaID = $this->insertChecklistTaxaLink($taxa);
if($clTaxaID){
$status = $this->insertVoucher($clTaxaID, $occid);
$status = $this->insertVoucher($clTaxaID, $occid, $editorNotes, $notes);
}
return $status;
}
Expand Down Expand Up @@ -495,6 +495,22 @@ private function transferVouchers($target, $source){
return $status;
}

public function deleteVoucher($voucherID){
$status = false;
if(is_numeric($voucherID)){
$sql = 'DELETE FROM fmvouchers WHERE (voucherID = ?)';
if($stmt = $this->conn->prepare($sql)) {
$stmt->bind_param('i', $voucherID);
$stmt->execute();
if($stmt->affected_rows) $status = true;
elseif($stmt->error) $this->errorMessage = 'ERROR deleting vouchers: '.$stmt->error;
$stmt->close();
}
else $this->errorMessage = 'ERROR preparing statement for voucher deletion: '.$this->conn->error;
}
return $status;
}

//Misc support and data functions
protected function getClTaxaID($tid, $morphoSpecies = ''){
$clTaxaID = 0;
Expand Down
16 changes: 0 additions & 16 deletions classes/ChecklistVoucherManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,22 +258,6 @@ private function addVoucherRecord($vOccId, $vNotes, $vEditNotes){
return false;
}

public function deleteVoucher($voucherID){
$status = false;
if(is_numeric($voucherID)){
$sql = 'DELETE FROM fmvouchers WHERE (voucherID = ?)';
if($stmt = $this->conn->prepare($sql)) {
$stmt->bind_param('i', $voucherID);
$stmt->execute();
if($stmt->affected_rows) $status = true;
elseif($stmt->error) $this->errorMessage = 'ERROR deleting vouchers: '.$stmt->error;
$stmt->close();
}
else $this->errorMessage = 'ERROR preparing statement for voucher deletion: '.$this->conn->error;
}
return $status;
}

//Setters and getters
public function setTid($t){
if(is_numeric($t)){
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
Loading

0 comments on commit 84baa3e

Please sign in to comment.