forked from openwebwork/webwork2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add .js files from Grant He's repository
There might be some extraneous .js files but this should help insure that things work as Grant intended them to.
- Loading branch information
Showing
10 changed files
with
701 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* This is the javascript that creates the AJAX object and attaches it to the reload button*/ | ||
/* Reference: w3schools.com, http://www.w3schools.com/ajax/ajax_examples.asp*/ | ||
|
||
function ajax_Reload() { | ||
var xmlhttp; | ||
|
||
if(window.XMLHttpRequest){ | ||
xmlhttp = new XMLHttpRequest(); | ||
} | ||
else{ | ||
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); | ||
} | ||
|
||
xmlhttp.onreadystatechange=function() { | ||
if (xmlhttp.readyState==4 && xmlhttp.status==200){ | ||
document.getElementById("problem_viewer_content").innerHTML=xmlhttp.responseText; | ||
} | ||
}; | ||
|
||
var tempEditFileDirectory = document.getElementById("temp_url_id").getAttribute("value"); | ||
alert(location.protocol+"//"+location.host+tempEditFileDirectory+"/temp_body.txt"); | ||
xmlhttp.open("GET", location.protocol+"//"+location.host+tempEditFileDirectory+"/temp_body.txt", true); | ||
xmlhttp.send(); | ||
} | ||
|
||
/*This method of adding to the onload event listener is taken from tabber.js, which in turn takes from http://simon.incutio.com/archive/2004/05/26/addLoadEvent*/ | ||
|
||
// var oldonload; | ||
|
||
// oldonload = window.onload; | ||
|
||
// if(typeof window.onload != "function"){ | ||
// window.onload = function() { document.getElementById("reload_button").onclick = ajax_Reload; }; | ||
// } | ||
// else{ | ||
// window.onload = function() { | ||
// oldonload(); | ||
// document.getElementById("reload_button").onclick = ajax_Reload; | ||
// }; | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/*This is the Javascript which applies some handlers to various input elements*/ | ||
|
||
function classlist_add_filter_elements() { | ||
var filter_select = document.getElementById("filter_select"); | ||
var filter_elements = document.getElementById("filter_elements"); | ||
|
||
if(filter_select.selectedIndex == 3){ | ||
filter_elements.style.display = "block"; | ||
} | ||
else{ | ||
filter_elements.style.display = "none"; | ||
} | ||
} | ||
|
||
function classlist_add_export_elements() { | ||
var export_select_target = document.getElementById("export_select_target"); | ||
var export_elements = document.getElementById("export_elements"); | ||
|
||
if(export_select_target.selectedIndex == 0){ | ||
export_elements.style.display = "block"; | ||
} | ||
else{ | ||
export_elements.style.display = "none"; | ||
} | ||
} | ||
|
||
addOnLoadEvent(function() { | ||
document.getElementById("filter_select").onchange = classlist_add_filter_elements; | ||
classlist_add_filter_elements(); | ||
document.getElementById("export_select_target").onchange = classlist_add_export_elements; | ||
classlist_add_export_elements(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/*This is the javascript which checks the forms for errors on the Hmwksets editor page.*/ | ||
|
||
function check_form_hmwk_sets() { | ||
var filter_text = document.getElementById("filter_text"); | ||
var filter_select = document.getElementById("filter_select"); | ||
var filter_err_msg = document.getElementById("filter_err_msg"); | ||
var filter_radio = document.getElementById("filter_id"); | ||
|
||
if(filter_radio.checked && filter_select.selectedIndex == 3 && filter_text.value == ""){ | ||
filter_err_msg.style.display = "inline"; | ||
return false; | ||
} | ||
} | ||
|
||
|
||
addOnLoadEvent(function (){ | ||
document.getElementById("take_action").onclick = check_form_hmwk_sets; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/*This gets the input table for the XMLRPC call*/ | ||
|
||
function getInputTable(){ | ||
var problem_viewer = document.getElementById("problem_viewer_form"); | ||
var inputElems = problem_viewer.getElementsByTagName("input"); | ||
|
||
var inputTable = new Array(); | ||
|
||
var type,name,value; | ||
for(i in inputElems){ | ||
type = inputElems[i].getAttribute("type"); | ||
name = inputElems[i].getAttribute("name"); | ||
value = inputElems[i].getAttribute("value"); | ||
if(type == "submit" || type == "button" || type == "reset"){ | ||
continue; | ||
} | ||
else{ | ||
inputTable[name] = value; | ||
} | ||
} | ||
|
||
return inputTable; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/*This contains the Javascripts for the handlers on the hmwk sets page.*/ | ||
|
||
function hmwksets_add_filter_elements() { | ||
var filter_select = document.getElementById("filter_select"); | ||
var filter_elements = document.getElementById("filter_elements"); | ||
|
||
if(filter_select.selectedIndex == 3){ | ||
filter_elements.style.display = "block"; | ||
} | ||
else{ | ||
filter_elements.style.display = "none"; | ||
} | ||
} | ||
|
||
addOnLoadEvent(function() { | ||
document.getElementById("filter_select").onchange = hmwksets_add_filter_elements; | ||
hmwksets_add_filter_elements(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/*This is the file where the proper functions are initialized for the problem applets which use them.*/ | ||
|
||
function initWW(){ | ||
if (typeof(initializeWWquestion) == 'function') { | ||
initializeWWquestion(); | ||
} | ||
} | ||
|
||
addOnLoadEvent(initWW); |
Oops, something went wrong.