Skip to content

Commit

Permalink
Hotfix 2024 07 25 (#1591)
Browse files Browse the repository at this point in the history
- Inventory and Project Management 
-- Display all checklists that have at least one linked taxon OR is a parent checklist inheriting taxa from a child checklist ([Issue #1532](#1532))
-- Removed limit that required checklist to have at least 10 linked taxa
-- Order checklists by project and checklists names
-- Only display Global symbol within map display option when one or more checklists within a group have lat/long centroids
-- Make project title an active link that opens the project within the project details page
- DwC-A Publishing 
-- Fix fatal error when DwC-A path fails to return a data file
  • Loading branch information
egbot authored Aug 2, 2024
1 parent 80532df commit 58a886e
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 21 deletions.
12 changes: 9 additions & 3 deletions checklists/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,17 @@
<?php
$projName = $projArr['name'];
if($projName == 'Miscellaneous Inventories') $projName = (isset($LANG['MISC_INVENTORIES'])?$LANG['MISC_INVENTORIES']:'Miscellaneous Inventories');
if($pid) echo '<a href="../projects/index.php?pid=' . $pid . '">';
echo $projName;
if($pid) echo '</a>';
if(!empty($projArr['displayMap'])){
?>
<a href="<?php echo "clgmap.php?pid=" . $pid; ?>" title='<?php echo (isset($LANG['SHOW_MAP'])?$LANG['SHOW_MAP']:'Show inventories on map'); ?>'>
<img src='../images/world.png' style='width:10px;border:0' />
</a>
<?php
}
?>
<a href="<?php echo "clgmap.php?pid=" . $pid; ?>" title='<?php echo (isset($LANG['SHOW_MAP'])?$LANG['SHOW_MAP']:'Show inventories on map'); ?>'>
<img src='../images/world.png' style='width:10px;border:0' />
</a>
</h3>
<ul>
<?php
Expand Down
18 changes: 12 additions & 6 deletions classes/ChecklistManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -657,17 +657,22 @@ public function addNewSpecies($postArr){
//Checklist index page fucntions
public function getChecklists($limitToKey=false){
$retArr = Array();
$sql = 'SELECT p.pid, p.projname, p.ispublic, c.clid, c.name, c.access, c.defaultSettings, COUNT(l.tid) AS sppcnt
$sql = 'SELECT p.pid, p.projname, p.ispublic, c.clid, c.name, c.access, c.defaultSettings, c.latCentroid
FROM fmchecklists c LEFT JOIN fmchklstprojlink cpl ON c.clid = cpl.clid
INNER JOIN fmchklsttaxalink l ON c.clid = l.clid
LEFT JOIN fmprojects p ON cpl.pid = p.pid
WHERE ((c.access LIKE "public%") ';
if(isset($GLOBALS['USER_RIGHTS']['ClAdmin']) && $GLOBALS['USER_RIGHTS']['ClAdmin']) $sql .= 'OR (c.clid IN('.implode(',',$GLOBALS['USER_RIGHTS']['ClAdmin']).'))';
WHERE c.type != "excludespp" AND ((c.access LIKE "public%") ';
if(isset($GLOBALS['USER_RIGHTS']['ClAdmin']) && $GLOBALS['USER_RIGHTS']['ClAdmin']){
$sql .= 'OR (c.clid IN('.implode(',',$GLOBALS['USER_RIGHTS']['ClAdmin']).'))';
}
$sql .= ') AND ((p.pid IS NULL) OR (p.ispublic = 1) ';
if(isset($GLOBALS['USER_RIGHTS']['ProjAdmin']) && $GLOBALS['USER_RIGHTS']['ProjAdmin']) $sql .= 'OR (p.pid IN('.implode(',',$GLOBALS['USER_RIGHTS']['ProjAdmin']).'))';
if(isset($GLOBALS['USER_RIGHTS']['ProjAdmin']) && $GLOBALS['USER_RIGHTS']['ProjAdmin']){
$sql .= 'OR (p.pid IN('.implode(',',$GLOBALS['USER_RIGHTS']['ProjAdmin']).'))';
}
$sql .= ') ';
if($this->pid) $sql .= 'AND (p.pid = '.$this->pid.') ';
$sql .= 'GROUP BY p.projname, c.Name HAVING sppcnt > 10';
//Following line limits result to only checklists that have a linked taxon or is a parent checklist with possible inherited taxa
$sql .= 'AND c.clid IN(SELECT clid FROM fmchklsttaxalink UNION DISTINCT SELECT clid FROM fmchklstchildren) ';
$sql .= 'ORDER BY p.projname, c.name';
$rs = $this->conn->query($sql);
while($row = $rs->fetch_object()){
if($limitToKey){
Expand All @@ -681,6 +686,7 @@ public function getChecklists($limitToKey=false){
$pid = 0;
$projName = 'Miscellaneous Inventories';
}
if($row->latCentroid) $retArr[$pid]['displayMap'] = 1;
$retArr[$pid]['name'] = $this->cleanOutStr($projName);
$retArr[$pid]['clid'][$row->clid] = $this->cleanOutStr($row->name).($row->access=='private'?' (Private)':'');
}
Expand Down
25 changes: 15 additions & 10 deletions classes/DwcArchiverPublisher.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,22 +316,27 @@ private function aasort(&$array, $key){
}

public function humanFileSize($filePath) {
$x = false;
if(substr($filePath,0,4)=='http') {
$x = array_change_key_case(get_headers($filePath, 1),CASE_LOWER);
if( strcasecmp($x[0], 'HTTP/1.1 200 OK') != 0 ) {
$x = $x['content-length'][1];
}
else {
$x = $x['content-length'];
if($headerArr = @get_headers($filePath, 1)){
$x = array_change_key_case($headerArr, CASE_LOWER);
if( strcasecmp($x[0], 'HTTP/1.1 200 OK') != 0 ) {
$x = $x['content-length'][1];
}
else {
$x = $x['content-length'];
}
}
}
else {
$x = @filesize($filePath);
}
$x = round($x/1000000, 1);
if(!$x) $x = 0.1;

return $x.'M ';
if($x !== false){
$x = round($x/1000000, 1);
if(!$x) $x = 0.1;
return $x.'M';
}
return '?M';
}
}
?>
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.32';
$CODE_VERSION = '3.0.33';

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
6 changes: 5 additions & 1 deletion ident/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@
foreach($projArr as $pidKey => $pArr){
$clArr = $pArr['clid'];
echo '<div style="margin:3px 0px 0px 15px;">';
echo '<h3>'.$pArr['name'].' <a href="../checklists/clgmap.php?pid='.$pidKey.'&target=keys"><img src="../images/world.png" style="width:10px;border:0" /></a></h3>';
echo '<h3>' . $pArr['name'];
if(!empty($pArr['displayMap'])){
echo ' <a href="../checklists/clgmap.php?pid=' . $pidKey . '&target=keys"><img src="../images/world.png" style="width:10px;border:0" /></a>';
}
echo '</h3>';
echo '<div><ul>';
foreach($clArr as $clid => $clName){
echo '<li><a href="key.php?clid='.$clid.'&pid='.$pidKey.'&taxon=All+Species">'.$clName.'</a></li>';
Expand Down

0 comments on commit 58a886e

Please sign in to comment.