Skip to content
Snippets Groups Projects
Commit 06eeea58 authored by Christopher Schankula's avatar Christopher Schankula :earth_africa:
Browse files

Merge branch 'web' of git@gitlab.cas.mcmaster.ca:schankuc/2XB3.git into web

parents e2c6257f 3a4517b3
No related branches found
No related tags found
No related merge requests found
......@@ -42,22 +42,23 @@ Double Handle Slider Modified from: http://jqueryui.com/slider/#range
<section id="formWrapper">
<section id="pickSciRanks">
Phylum:
<select name="pickSciR" id="pickPhylum" size="1" onChange="changedSciR('phylum')"><!--Dynamically Filled--></select>
<%--<select name="pickSciR" id="pickPhylum" size="1" onChange="updateSci(this)"><!--Dynamically Filled--></select>--%>
<select name="pickSciR" id="pickPhylum" size="1" onChange="updateSciR('pickClass', this)"><!--Dynamically Filled--></select>
Class:
<select name="pickSciR" id="pickClass" size="1" onChange="changedSciR('class')">
<option value="00">Arthropoda</option>
<option value="01">Chordata</option>
<option value="03">Mollusca</option>
<select name="pickSciR" id="pickClass" size="1" onChange="updateSciR('pickOrder', this)">
<%--<option value="00">Arthropoda</option>--%>
<%--<option value="01">Chordata</option>--%>
<%--<option value="03">Mollusca</option>--%>
</select>
Order:
<select name="pickSciR" size="1" onChange="alert()"><!--Dynamically Filled--></select>
<select name="pickSciR" id="pickOrder" size="1" onChange="updateSciR('pickFamily', this)""><!--Dynamically Filled--></select>
Family:
<select name="pickSciR" size="1"><!--Dynamically Filled--></select>
<select name="pickSciR" id="pickFamily" size="1" onChange="updateSciR('pickGenus', this)"><!--Dynamically Filled--></select>
Genus:
<select name="pickSciR" size="1"><!--Dynamically Filled--></select>
<select name="pickSciR" id="pickGenus" size="1" onChange="updateSciR('pickSpecies', this)"><!--Dynamically Filled--></select>
Species:
<select name="pickSciR" size="1"><!--Dynamically Filled--></select>
<select name="pickSciR" id="pickSpecies" size="1" onChange="alert("No function atm")"><!--Dynamically Filled--></select>
</section>
<section id="yearIn">
......
// Initialization
function init() {
updateSciR(2); // Init Phylum. [Animalia == 2]
initPickPhylum();
}
// Post Function
// Used by getChildren(id)
function getChildren(id) {
document.getElementById("console").innerHTML += "In | getChildren()<br>"; //TODO: Console REMOVEME
// nodeList = {
// "taxonId":[1821,51,1065],
// "taxonName":["Chordata","Mollusca","Arthropoda"]
// };
function initPickPhylum(){
updateSciR("pickPhylum", {value:2});
}
// Updates a dropdown List
// tagID = tag of dropdown that changes
// taxID = id of parent of the thing that changes
function updateSciR(tagID, object) {
var path = 'doBioLookup.do';
var params = { taxid: id};
var taxID = object.value;
alert("Updating: " + tagID + "with children of: " + taxID); //TODO Remove me
var params = { taxId: taxID};
var xhr = new XMLHttpRequest();
xhr.open("POST", path);
//Send the proper header information along with the request
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
// xhr.setRequestHeader("Content-type", "application/json");
xhr.onreadystatechange = function() {//Call a function when the state changes (i.e. response comes back)
document.getElementById("console").innerHTML += "In | onreadystatechange ... "; //TODO: Console REMOVEME
//this is where we can update the various dropdowns
// Update the dropdown
if(xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) {
document.getElementById("console").innerHTML += "Retrieved:<br>"; //TODO: Console REMOVEME
console.log("RETRIEVED:")
console.log(this.responseText); // Have to go to dev console to print this. Won't show up on pseudo-console.
var nodeList;
nodeList = JSON.parse(this.responseText);
// nodeList = {
// "taxonId":[1821,51,1065],
// "taxonName":["Chordata","Mollusca","Arthropoda"]
// };
document.getElementById("console").innerHTML += "Retrieved: "; //TODO: Console REMOVEME
document.getElementById("console").innerHTML += this.responseText + "<br>"; //TODO: Console REMOVEME
console.log("RETRIEVED:" + this.responseText);
var nodeList = JSON.parse(this.responseText);
document.getElementById("console").innerHTML += nodeList + "<br>"; //TODO: Console REMOVEME
var content = "", x, y;
for (i in nodeList.taxonId){
for (var i in nodeList.taxonId){
x = nodeList.taxonId[i];
y = nodeList.taxonName[i];
content += '"<option value="' + x + '">' + y + '</option>';
}
document.getElementById("pickPhylum").innerHTML = content;
// return this.responseText;
document.getElementById(tagID).innerHTML = content;
}
else{
document.getElementById("console").innerHTML += "Error<br>"; //TODO: Console REMOVEME
......@@ -56,20 +56,6 @@ function getChildren(id) {
document.getElementById("console").innerHTML += "Sent request to " + path + ": " + jsonString + "<br>"; //TODO: Console REMOVEME
}
nodeList = {
"taxonId":[1821,51,1065],
"taxonName":["Chordata","Mollusca","Arthropoda"]
};
function updateSciR(rank){
document.getElementById("console").innerHTML += "In | init phylum<br>"; //TODO: Console REMOVEME
getChildren(rank);
}
function changedSciR(rank){
// var changedRank = document.getElementsByName()
}
// JQuery for Range Slider
$( function() {
$( "#slider-range" ).slider({
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment