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 ...@@ -42,22 +42,23 @@ Double Handle Slider Modified from: http://jqueryui.com/slider/#range
<section id="formWrapper"> <section id="formWrapper">
<section id="pickSciRanks"> <section id="pickSciRanks">
Phylum: 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: Class:
<select name="pickSciR" id="pickClass" size="1" onChange="changedSciR('class')"> <select name="pickSciR" id="pickClass" size="1" onChange="updateSciR('pickOrder', this)">
<option value="00">Arthropoda</option> <%--<option value="00">Arthropoda</option>--%>
<option value="01">Chordata</option> <%--<option value="01">Chordata</option>--%>
<option value="03">Mollusca</option> <%--<option value="03">Mollusca</option>--%>
</select> </select>
Order: 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: Family:
<select name="pickSciR" size="1"><!--Dynamically Filled--></select> <select name="pickSciR" id="pickFamily" size="1" onChange="updateSciR('pickGenus', this)"><!--Dynamically Filled--></select>
Genus: Genus:
<select name="pickSciR" size="1"><!--Dynamically Filled--></select> <select name="pickSciR" id="pickGenus" size="1" onChange="updateSciR('pickSpecies', this)"><!--Dynamically Filled--></select>
Species: 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>
<section id="yearIn"> <section id="yearIn">
......
// Initialization // Initialization
function init() { function init() {
updateSciR(2); // Init Phylum. [Animalia == 2] initPickPhylum();
} }
// Post Function // nodeList = {
// Used by getChildren(id) // "taxonId":[1821,51,1065],
function getChildren(id) { // "taxonName":["Chordata","Mollusca","Arthropoda"]
document.getElementById("console").innerHTML += "In | getChildren()<br>"; //TODO: Console REMOVEME // };
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 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(); var xhr = new XMLHttpRequest();
xhr.open("POST", path); xhr.open("POST", path);
//Send the proper header information along with the request //Send the proper header information along with the request
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 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) xhr.onreadystatechange = function() {//Call a function when the state changes (i.e. response comes back)
document.getElementById("console").innerHTML += "In | onreadystatechange ... "; //TODO: Console REMOVEME // Update the dropdown
//this is where we can update the various dropdowns
if(xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) { if(xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) {
document.getElementById("console").innerHTML += "Retrieved:<br>"; //TODO: Console REMOVEME document.getElementById("console").innerHTML += "Retrieved: "; //TODO: Console REMOVEME
document.getElementById("console").innerHTML += this.responseText + "<br>"; //TODO: Console REMOVEME
console.log("RETRIEVED:") console.log("RETRIEVED:" + this.responseText);
console.log(this.responseText); // Have to go to dev console to print this. Won't show up on pseudo-console. var nodeList = JSON.parse(this.responseText);
var nodeList;
nodeList = JSON.parse(this.responseText);
// nodeList = {
// "taxonId":[1821,51,1065],
// "taxonName":["Chordata","Mollusca","Arthropoda"]
// };
document.getElementById("console").innerHTML += nodeList + "<br>"; //TODO: Console REMOVEME document.getElementById("console").innerHTML += nodeList + "<br>"; //TODO: Console REMOVEME
var content = "", x, y; var content = "", x, y;
for (i in nodeList.taxonId){ for (var i in nodeList.taxonId){
x = nodeList.taxonId[i]; x = nodeList.taxonId[i];
y = nodeList.taxonName[i]; y = nodeList.taxonName[i];
content += '"<option value="' + x + '">' + y + '</option>'; content += '"<option value="' + x + '">' + y + '</option>';
} }
document.getElementById("pickPhylum").innerHTML = content; document.getElementById(tagID).innerHTML = content;
// return this.responseText;
} }
else{ else{
document.getElementById("console").innerHTML += "Error<br>"; //TODO: Console REMOVEME document.getElementById("console").innerHTML += "Error<br>"; //TODO: Console REMOVEME
...@@ -56,20 +56,6 @@ function getChildren(id) { ...@@ -56,20 +56,6 @@ function getChildren(id) {
document.getElementById("console").innerHTML += "Sent request to " + path + ": " + jsonString + "<br>"; //TODO: Console REMOVEME 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 // JQuery for Range Slider
$( function() { $( function() {
$( "#slider-range" ).slider({ $( "#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