summaryrefslogtreecommitdiff
path: root/yaksh/static
diff options
context:
space:
mode:
authormaheshgudi2016-05-16 12:42:35 +0530
committermaheshgudi2016-05-27 12:43:12 +0530
commit175153cc5daeccd80bfa0184114ebf01bae93013 (patch)
treef33bfa2940e734df930602bcd15c69318d5de751 /yaksh/static
parent14b1408c291c644ec5748e029ac1ae39e9ac3913 (diff)
downloadonline_test-175153cc5daeccd80bfa0184114ebf01bae93013.tar.gz
online_test-175153cc5daeccd80bfa0184114ebf01bae93013.tar.bz2
online_test-175153cc5daeccd80bfa0184114ebf01bae93013.zip
added no prerequisite required condition
Diffstat (limited to 'yaksh/static')
-rw-r--r--yaksh/static/yaksh/js/add_quiz.js18
1 files changed, 14 insertions, 4 deletions
diff --git a/yaksh/static/yaksh/js/add_quiz.js b/yaksh/static/yaksh/js/add_quiz.js
index e212b70..33358a7 100644
--- a/yaksh/static/yaksh/js/add_quiz.js
+++ b/yaksh/static/yaksh/js/add_quiz.js
@@ -10,11 +10,21 @@ function test()
}
}
+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;
- 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
+ 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