summaryrefslogtreecommitdiff
path: root/yaksh/static
diff options
context:
space:
mode:
Diffstat (limited to 'yaksh/static')
-rw-r--r--yaksh/static/yaksh/js/add_question.js4
-rw-r--r--yaksh/static/yaksh/js/requesthandler.js8
2 files changed, 12 insertions, 0 deletions
diff --git a/yaksh/static/yaksh/js/add_question.js b/yaksh/static/yaksh/js/add_question.js
index 5bec8c6..346991a 100644
--- a/yaksh/static/yaksh/js/add_question.js
+++ b/yaksh/static/yaksh/js/add_question.js
@@ -110,6 +110,9 @@ function textareaformat()
document.getElementById('my').innerHTML = document.getElementById('id_description').value ;
});
+ $('#id_solution').bind('keypress', function (event){
+ document.getElementById('rend_solution').innerHTML = document.getElementById('id_solution').value ;
+ });
$('#id_type').bind('focus', function(event){
var type = document.getElementById('id_type');
@@ -121,6 +124,7 @@ function textareaformat()
language.style.border = '1px solid #ccc';
});
document.getElementById('my').innerHTML = document.getElementById('id_description').value ;
+ document.getElementById('rend_solution').innerHTML = document.getElementById('id_solution').value ;
if (document.getElementById('id_grade_assignment_upload').checked ||
document.getElementById('id_type').value == 'upload'){
diff --git a/yaksh/static/yaksh/js/requesthandler.js b/yaksh/static/yaksh/js/requesthandler.js
index 639dc81..f98ab12 100644
--- a/yaksh/static/yaksh/js/requesthandler.js
+++ b/yaksh/static/yaksh/js/requesthandler.js
@@ -36,6 +36,11 @@ function unlock_screen() {
document.getElementById("ontop").style.display = "none";
}
+function show_solution() {
+ document.getElementById("solution").style.display = "block";
+ document.getElementById("skip_ex").style.visibility = "visible";
+}
+
function get_result(uid){
var url = "/exam/get_result/" + uid + "/" + course_id + "/" + module_id + "/";
ajax_check_code(url, "GET", "html", null, uid)
@@ -119,6 +124,9 @@ function ajax_check_code(url, method_type, data_type, data, uid)
var global_editor = {};
var csrftoken = jQuery("[name=csrfmiddlewaretoken]").val();
$(document).ready(function(){
+ if(is_exercise == "True" && can_skip == "False"){
+ setTimeout(function() {show_solution();}, delay_time*1000);
+ }
// Codemirror object, language modes and initial content
// Get the textarea node