summaryrefslogtreecommitdiff
path: root/yaksh/static
diff options
context:
space:
mode:
authorPrabhu Ramachandran2016-07-05 10:00:35 -0400
committerGitHub2016-07-05 10:00:35 -0400
commit15152d232ab81a1ec6af24b10424d85f1c01d170 (patch)
tree283190f3ab51896e75d538296036272e856a1f7d /yaksh/static
parentc8dfe62663d715dcf4b571c1f738428165734d2a (diff)
parent9c61c84194e6b52913dfc284765a7b7bd77201ad (diff)
downloadonline_test-15152d232ab81a1ec6af24b10424d85f1c01d170.tar.gz
online_test-15152d232ab81a1ec6af24b10424d85f1c01d170.tar.bz2
online_test-15152d232ab81a1ec6af24b10424d85f1c01d170.zip
Merge pull request #101 from maheshgudi/test_modes
Test modes
Diffstat (limited to 'yaksh/static')
-rw-r--r--yaksh/static/yaksh/js/add_quiz.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/yaksh/static/yaksh/js/add_quiz.js b/yaksh/static/yaksh/js/add_quiz.js
index 184881c..33358a7 100644
--- a/yaksh/static/yaksh/js/add_quiz.js
+++ b/yaksh/static/yaksh/js/add_quiz.js
@@ -9,3 +9,22 @@ function test()
document.getElementById("submit").innerHTML = "Save";
}
}
+
+String.prototype.beginsWith = function (string) {
+ return(this.indexOf(string) === 0);
+};
+
+function usermode(location)
+{
+ var select = document.getElementById("id_prerequisite");
+ var select_text = select.options[select.selectedIndex].text;
+ if (select_text.beginsWith("----")){
+ window.alert("No prerequisite for this course.\n \
+ You can attempt the quiz.");
+ window.location.replace(location);
+ } else {
+ window.alert(select_text + " is a prerequisite for this course.\n \
+ You are still allowed to attempt this quiz.")
+ window.location.replace(location);
+ }
+ } \ No newline at end of file