diff --git a/analytics/matomo.php b/analytics/matomo.php
deleted file mode 100644
index 956f97d..0000000
--- a/analytics/matomo.php
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/public/explore/taxa/index.php b/public/explore/taxa/index.php
new file mode 100644
index 0000000..d26f23e
--- /dev/null
+++ b/public/explore/taxa/index.php
@@ -0,0 +1,78 @@
+ PDO::ERRMODE_EXCEPTION
+ ));
+} catch (Exception $e) {
+ die("Error : ".$e->getMessage());
+}
+
+$req = $db->prepare('SELECT * FROM `taxa`');
+$req->execute();
+$result = $req->fetchAll();
+?>
+
+
+
+
+
+
+ Explore | Chiro - Canto
+
+
+
+
+
+
+ Chiroptera Taxa
+ These taxa come from INPN TAXREF v14.0.
+
+
+
+ Kingdom |
+ Phylum |
+ Class |
+ Order |
+ Family |
+ Subfamily |
+ Tribu |
+ Genus |
+ Species |
+
+
+
+
+
+ =$row['taxon_kingdom']?> |
+ =$row['taxon_phylum']?> |
+ =$row['taxon_class']?> |
+ =$row['taxon_order']?> |
+ =$row['taxon_family']?> |
+ =$row['taxon_subfamily']?> |
+ =$row['taxon_tribu']?> |
+ =$row['taxon_genus']?> |
+ =$row['taxon_species']?> |
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/public/src/dump_taxref_into_database.php b/public/src/dump_taxref_into_database.php
index 94f91c3..804410f 100644
--- a/public/src/dump_taxref_into_database.php
+++ b/public/src/dump_taxref_into_database.php
@@ -37,7 +37,7 @@ if ($file = fopen("/var/www/chiro-canto/public/database/TAXREF14.0_CHIRO.csv", '
"order"=>$order,
"family"=>$family,
"subfamily"=>$subfamily,
- "tribu"=>$subfamily,
+ "tribu"=>$tribu,
"genus"=>$genus,
"species"=>$species
));
diff --git a/public/upload/getspecieshint.php b/public/upload/getspecieshint.php
new file mode 100644
index 0000000..357e696
--- /dev/null
+++ b/public/upload/getspecieshint.php
@@ -0,0 +1,54 @@
+ PDO::ERRMODE_EXCEPTION
+ ));
+} catch (Exception $e) {
+ die("Error : ".$e->getMessage());
+}
+
+$req = $db->prepare('SELECT taxon_species FROM `taxa`');
+$req->execute();
+$result = $req->fetchAll();
+
+$species = array();
+foreach ($result as $row) {
+ $species[] = $row['taxon_species'];
+}
+
+$q = $_REQUEST['q'];
+
+$hint = array();
+// print_r($species);
+
+if ($q !== "") {
+ $q = strtolower($q);
+ $len = strlen($q);
+ foreach($species as $sp) {
+ if (stristr($q, substr($sp, 0, $len))) {
+ $hint[] = $sp;
+ }
+ }
+}
+
+// Output "no suggestion" if no hint was found or output correct values
+?>
+
+
diff --git a/public/upload/metadata.php b/public/upload/metadata.php
index 6090d09..d08a525 100644
--- a/public/upload/metadata.php
+++ b/public/upload/metadata.php
@@ -9,8 +9,10 @@
-
- " placeholder="Enter a species..">
+
+ " id="species" placeholder="Enter a species..">
+
+
@@ -51,4 +53,5 @@
-
\ No newline at end of file
+
+
\ No newline at end of file
diff --git a/public/upload/scripts/ajax_species_suggestion.js b/public/upload/scripts/ajax_species_suggestion.js
new file mode 100644
index 0000000..d42a758
--- /dev/null
+++ b/public/upload/scripts/ajax_species_suggestion.js
@@ -0,0 +1,46 @@
+function showHint(str) {
+ if (str.length == 0) {
+ document.getElementById("hint").innerHTML = "";
+ return;
+ } else {
+ var xmlhttp = new XMLHttpRequest();
+ xmlhttp.onreadystatechange = function() {
+ if (this.readyState == 4 && this.status == 200) {
+ document.getElementById("hint").innerHTML = this.responseText;
+ }
+ };
+ xmlhttp.open("GET", `getspecieshint.php?q=${str}`, true);
+ xmlhttp.send();
+ }
+}
+document.getElementById('species').addEventListener('keyup', function() {
+ // console.log(this.value);
+ showHint(this.value);
+});
+
+function waitForElementToDisplay(selector, callback, checkFrequencyInMs, timeoutInMs) {
+
+ var startTimeInMs = Date.now();
+ (function loopSearch() {
+ if (document.querySelector(selector) != null) {
+ callback();
+ return;
+ }
+ else {
+ setTimeout(function () {
+ if (timeoutInMs && Date.now() - startTimeInMs > timeoutInMs)
+ return;
+ loopSearch();
+ }, checkFrequencyInMs);
+ }
+ })();
+}
+
+// Call the below function
+waitForElementToDisplay("#species-hint", function(){
+ this.addEventListener('click', function() {
+ species_select = document.getElementById('species-hint')
+ document.getElementById('species').value = species_select.value;
+ // console.log(species_select.value);
+ });
+},1000,9000);