Skip to content

Commit

Permalink
Merge pull request #41 from bryo-lichen/revert-39-revert-38-master
Browse files Browse the repository at this point in the history
Revert "Revert "Merge Symbiota-light developments into bryo-lichen code repo""
  • Loading branch information
egbot authored Feb 26, 2021
2 parents f0e847f + 3820294 commit 7d5c97c
Show file tree
Hide file tree
Showing 71 changed files with 1,158 additions and 383 deletions.
21 changes: 3 additions & 18 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
/config/dbconnection.php
/config/symbini.php
/footer.php
/header.php
/leftmenu.php
/index.php
content/lang/header.en.php
content/lang/header.es.php
content/lang/index.en.php
content/lang/index.es.php
includes/header.php
includes/footer.php
includes/head.php
includes/leftmenu.php
includes/spprofilehead.php
includes/usagepolicy.php
css/main.css
css/speciesprofile.css

config/symbini.php
config/dbconnection.php
60 changes: 29 additions & 31 deletions agents/agent.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,42 +14,42 @@

$agent = new Agent();
$agentview = new AgentView();
if (strlen($agentid) > 0 ) {
if (strlen($agentid) > 0 ) {
$agent->load($agentid);
$agentview->setModel($agent);
} elseif (strlen($uuid)>0) {
if (UuidFactory::is_valid($uuid)) {
} elseif (strlen($uuid)>0) {
if (UuidFactory::is_valid($uuid)) {
$agent->loadByGUID($uuid);
$agentview->setModel($agent);
}
}
}

$done = FALSE;
if ($force=='turtle') {
deliverTurtle();
if ($force=='turtle') {
deliverTurtle();
$done = TRUE;
}
if ($force=='rdfxml') {
deliverRdfXml();
if ($force=='rdfxml') {
deliverRdfXml();
$done = TRUE;
}
reset($accept);
while (!$done && list($key, $mediarange) = each($accept)) {
if ($mediarange=='text/turtle') {
deliverTurtle();
deliverTurtle();
$done = TRUE;
}
}
if ($mediarange=='application/rdf+xml') {
deliverRdfXml();
deliverRdfXml();
$done = TRUE;
}
}
}
if (!$done) {
if (!$done) {
Header("Content-Type: text/html; charset=".$CHARSET);
$spDisplay = " Agent: ". $agent->getMinimalName();
pageheader($agent);
$am = new AgentManager();
if ($am->isAgentEditor()) {
if ($am->isAgentEditor()) {
echo "<div id='commandDiv'><span class='link' id='editLink'>Edit</span>&nbsp;<span class='link' id='viewLink'>View</span>&nbsp;<span class='link' id='createLink'>New</span></div>";
echo "
<script type='text/javascript'>
Expand All @@ -69,7 +69,7 @@
console.dir( xhr );
}
});
return false;
return false;
});
$('#viewLink').click(function () {
$.ajax({
Expand All @@ -87,7 +87,7 @@
console.dir( xhr );
}
});
return false;
return false;
});
$('#createLink').click(function () {
$.ajax({
Expand All @@ -105,15 +105,15 @@
console.dir( xhr );
}
});
return false;
return false;
});
</script>
";
}
}
echo "<div id='agentDetailDiv".$agent->getagentid()."'>";
echo $agentview->getDetailsView();
echo "</div>";
if ($findobjects==1) {
if ($findobjects==1) {
echo $am->getPrettyListOfCollectionObjectsForCollector($agent->getagentid());
}
footer();
Expand All @@ -128,13 +128,13 @@ function deliverTurtle() {
echo $agentview->getAsTurtle();
}

function deliverRdfXml() {
function deliverRdfXml() {
global $agent, $agentview, $charset;
Header("Content-Type: application/rdf+xml; charset=".$CHARSET);
echo $agentview->getAsRdfXml();
}

function pageheader($agent) {
function pageheader($agent) {
global $SERVER_ROOT, $DEFAULT_TITLE, $spDisplay, $CLIENT_ROOT, $agent_indexCrumbs, $charset;
echo '<!DOCTYPE HTML>
<html>
Expand All @@ -146,11 +146,9 @@ function pageheader($agent) {
<link href="../css/main.css<?php echo (isset($CSS_VERSION_LOCAL)?'?ver='.$CSS_VERSION_LOCAL:''); ?>" type="text/css" rel="stylesheet" />
<link href="../css/jquery-ui_accordian.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src="../js/jquery-ui.js"></script>
<script type="text/javascript">';
// include_once($SERVER_ROOT.'/includes/googleanalytics.php');
echo '</script>
<script type="text/javascript">
<script type="text/javascript" src="../js/jquery-ui.js"></script>';
// include_once($SERVER_ROOT.'/includes/googleanalytics.php');
echo '<script type="text/javascript">
var currentLevel = ' . ($descrDisplayLevel?$descrDisplayLevel:"1"). ';
var levelArr = new Array('. ($descr?"'".implode("','",array_keys($descr))."'":"") . ');
</script>
Expand All @@ -163,14 +161,14 @@ function pageheader($agent) {
array_push($agent_indexCrumbs,"<a href='$CLIENT_ROOT/index.php'>Home</a>");
array_push($agent_indexCrumbs,"<a href='$CLIENT_ROOT/agents/index.php'>Agents</a>");
}
if (isset($agent)) {
if (isset($agent)) {
$name = $agent->getMinimalName();
$queryname = $agent->getMinimalName(false);
}
}
if (strlen($name)>0) {
array_push($agent_indexCrumbs,"<a href='$CLIENT_ROOT/agents/index.php?name=$queryname'>Search</a>");
array_push($agent_indexCrumbs,$name);
}
}
echo "<div class='navpath'>";
$last = array_pop($agent_indexCrumbs);
echo implode($agent_indexCrumbs, " &gt;&gt;");
Expand All @@ -179,10 +177,10 @@ function pageheader($agent) {
echo "</div>";

}



function footer() {

function footer() {
global $SERVER_ROOT,$CLIENT_ROOT;
include($SERVER_ROOT.'/includes/footer.php');
echo "</body>\n</html>";
Expand Down
6 changes: 2 additions & 4 deletions agents/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,9 @@ function pageheader($name) {
<link href="../css/main.css'.(isset($CSS_VERSION_LOCAL)?'?ver='.$CSS_VERSION_LOCAL:'').'" type="text/css" rel="stylesheet" />
<link href="../css/speciesprofilebase.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src="../js/jquery-ui.js"></script>
<script type="text/javascript">';
<script type="text/javascript" src="../js/jquery-ui.js"></script>';
// include_once($SERVER_ROOT.'/includes/googleanalytics.php');
echo '</script>
<script type="text/javascript">
echo '<script type="text/javascript">
var currentLevel = ' . ($descrDisplayLevel?$descrDisplayLevel:"1"). ';
var levelArr = new Array('. ($descr?"'".implode("','",array_keys($descr))."'":"") . ');
</script>
Expand Down
4 changes: 1 addition & 3 deletions checklists/checklist.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,10 @@
echo '<link href="'.$CLIENT_ROOT.'/css/base.css?ver=1" type="text/css" rel="stylesheet" />';
echo '<link href="'.$CLIENT_ROOT.'/css/main.css?ver=1" type="text/css" rel="stylesheet" />';
}
include_once($SERVER_ROOT.'/includes/googleanalytics.php');
?>
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src="../js/jquery-ui.js"></script>
<script type="text/javascript">
<?php include_once($SERVER_ROOT.'/includes/googleanalytics.php'); ?>
</script>
<script type="text/javascript">
<?php if($clid) echo 'var clid = '.$clid.';'; ?>
$( function() {
Expand Down
6 changes: 2 additions & 4 deletions checklists/checklistmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@
echo '<link href="'.$CLIENT_ROOT.'/css/base.css?ver=1" type="text/css" rel="stylesheet" />';
echo '<link href="'.$CLIENT_ROOT.'/css/main.css?ver=1" type="text/css" rel="stylesheet" />';
}
?>
<script type="text/javascript">
<?php include_once($SERVER_ROOT.'/includes/googleanalytics.php'); ?>
</script>
include_once($SERVER_ROOT.'/includes/googleanalytics.php');
?>
<script src="//maps.googleapis.com/maps/api/js?v=3.exp&libraries=drawing<?php echo (isset($GOOGLE_MAP_KEY) && $GOOGLE_MAP_KEY?'&key='.$GOOGLE_MAP_KEY:''); ?>"></script>
<script type="text/javascript">
var map;
Expand Down
19 changes: 10 additions & 9 deletions checklists/tools/checklistloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,17 @@ function displayErrors(clickObj){

</div>
<div style="margin-top:10px;">
<div>Must be a CSV text file with the first row containing the following columns. Note that Excel spreadsheets can be saved as a CSV file.</div>
<div>Input file must be a CSV text file containing the following columns.
Column order does not matter, though the first row should contain columns names in accordance with the names in bold listed below.
Note that Excel spreadsheets (xlsx) can be saved as a CSV file via the "Save as..." option.</div>
<ul>
<li>sciname (required)</li>
<li>family (optional)</li>
<li>habitat (optional)</li>
<li>abundance (optional)</li>
<li>notes (optional)</li>
<li>internalnotes (optional) - displayed only to editors</li>
<li>source (optional)</li>

<li><b>sciname</b> (required)</li>
<li><b>family</b> (optional)</li>
<li><b>habitat</b> (optional)</li>
<li><b>abundance</b> (optional)</li>
<li><b>notes</b> (optional)</li>
<li><b>internalnotes</b> (optional) - displayed only to editors</li>
<li><b>source</b> (optional)</li>
</ul>
</div>
<div style="margin:25px;">
Expand Down
13 changes: 6 additions & 7 deletions classes/ChecklistManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ public function getTaxaList($pageNumber = 1,$retLimit = 500){
$taxonTokens = $newArr;
}
if(!$retLimit || ($this->taxaCount >= (($pageNumber-1)*$retLimit) && $this->taxaCount <= ($pageNumber)*$retLimit)){
if($row->rankid == 180) $sciName .= " sp.";
if($row->morphospecies) $sciName .= ' '.$row->morphospecies;
elseif($row->rankid == 180) $sciName .= " sp.";
if($row->rankid > 220 && $this->clMetadata['type'] != 'rarespp' && !array_key_exists($row->parenttid, $this->taxaList)){
$this->taxaList[$row->parenttid]['taxongroup'] = '<i>'.$taxonGroup.'</i>';
$this->taxaList[$row->parenttid]['family'] = $family;
Expand All @@ -229,13 +230,12 @@ public function getTaxaList($pageNumber = 1,$retLimit = 500){
if($row->source) $clStr .= ", <u>source</u>: ".$row->source;
if($clStr) $this->taxaList[$tid]["notes"] = substr($clStr,2);
}
//$morphoStr = $row->morphospecies;
//if(!$morphoStr) $morphoStr = 0;
//$this->taxaList[$tid][$morphoStr]['sciname'] = $sciName;
$this->taxaList[$tid]['sciname'] = $sciName;
$this->taxaList[$tid]['family'] = $family;
$this->taxaList[$tid]['taxongroup'] = '<i>'.$taxonGroup.'</i>';
if(isset($this->taxaList[$tid]['clid'])) $this->taxaList[$tid]['clid'] = $this->taxaList[$tid]['clid'].','.$row->clid;
if(isset($this->taxaList[$tid]['clid'])){
if($this->taxaList[$tid]['clid'] != $row->clid) $this->taxaList[$tid]['clid'] = $this->taxaList[$tid]['clid'].','.$row->clid;
}
else $this->taxaList[$tid]['clid'] = $row->clid;
if($this->showAuthors) $this->taxaList[$tid]['author'] = $this->cleanOutStr($row->author);
}
Expand Down Expand Up @@ -492,7 +492,7 @@ public function downloadChecklistCsv(){
$this->showAuthors = 1;
if($taxaArr = $this->getTaxaList(1,0)){
$fh = fopen('php://output', 'w');
$headerArr = array('Family','ScientificName','ScientificNameAuthorship','morphoSpecies');
$headerArr = array('Family','ScientificName','ScientificNameAuthorship');
if($this->showCommon) $headerArr[] = 'CommonName';
$headerArr[] = 'Notes';
$headerArr[] = 'TaxonId';
Expand All @@ -501,7 +501,6 @@ public function downloadChecklistCsv(){
$outArr = array($tArr['family']);
$outArr[] = html_entity_decode($tArr['sciname'],ENT_QUOTES|ENT_XML1);
$outArr[] = html_entity_decode($tArr['author'],ENT_QUOTES|ENT_XML1);
$outArr[] = html_entity_decode($tArr['morphospecies'],ENT_QUOTES|ENT_XML1);
if($this->showCommon) $outArr[] = (array_key_exists('vern',$tArr)?html_entity_decode($tArr['vern'],ENT_QUOTES|ENT_XML1):'');
$outArr[] = (array_key_exists('notes',$tArr)?strip_tags(html_entity_decode($tArr['notes'],ENT_QUOTES|ENT_XML1)):'');
$outArr[] = $tid;
Expand Down
66 changes: 66 additions & 0 deletions classes/ImageDropBox.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?php
class ImageDropbox extends Manager {

private $collid;
private $collMetaArr;
private $dropboxApiUrl = 'https://api.dropboxapi.com/2/files/list_folder';
private $authKey;
private $basePath = '/Images/Global/';

public function __construct($connType = 'write'){
parent::__construct(null,$connType);
}

public function __destruct(){
parent::__destruct();
}

public function processImages(){
if($this->collMetaArr){
$collPath = $this->basePath.$this->collMetaArr['instcode'];
if($this->collMetaArr['collcode']) $collPath .= '-'.$this->collMetaArr['collcode'];
$fileListObj = json_encode($this->getFileList(getFileList($targetPath)));

}
}

//Data functions
public function setCollMeta(){
if($this->collid){
$sql = 'SELECT institutioncode, collectioncode, collectionname FROM omcollections WHERE collid = '.$this->collid;
$rs = $this->conn->query($sql);
while($r = $rs->fetch_object()){
$this->collMetaArr['instcode'] = $r->institioncode;
$this->collMetaArr['collcode'] = $r->collectioncode;
$this->collMetaArr['collname'] = $r->collectionname;
}
$rs->free();
}
}

//DropBox API calls
private function getFileList($targetPath){
$listJson = '';
$ch = curl_init($this->dropboxApiUrl);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json','Authorization: Bearer'));
$dataArr = array( 'path' => $targetPath );
curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode($dataArr) );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
if(!$listJson = curl_exec($ch)){
$this->errorMessage = 'ERROR getting file list: '.curl_error($ch);
$this->logOrEcho($this->errorMessage);
}
curl_close($ch);
return $listJson;
}

//Setters and getters
public function setCollid($collid){
if(is_numeric($collid)){
$this->collid = $collid;
$this->setCollMeta();
}
}
}
Loading

0 comments on commit 7d5c97c

Please sign in to comment.